entrustDialog.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <el-dialog
  3. title="委外派单"
  4. :visible.sync="entrustVisible"
  5. :before-close="handleClose"
  6. :close-on-click-modal="false"
  7. :close-on-press-escape="false"
  8. width="50%"
  9. >
  10. <div class="main_container">
  11. <el-form :model="addForm" :rules="addFormRules" label-width="120px" ref="addFormRef">
  12. <el-row>
  13. <el-col :span="12">
  14. <el-form-item label="报修记录编号:" prop="repairsCode">
  15. <el-input
  16. v-model="addForm.repairsCode"
  17. size="small"
  18. disabled
  19. ></el-input>
  20. </el-form-item>
  21. </el-col>
  22. <el-col :span="12">
  23. <el-form-item label="设备编码:" prop="equiCode">
  24. <el-input
  25. v-model="addForm.equiCode"
  26. size="small"
  27. disabled
  28. ></el-input>
  29. </el-form-item>
  30. </el-col>
  31. </el-row>
  32. <el-row>
  33. <el-col :span="12">
  34. <el-form-item label="设备名称:" prop="equiName">
  35. <el-input
  36. v-model="addForm.equiName"
  37. size="small"
  38. disabled
  39. ></el-input>
  40. </el-form-item>
  41. </el-col>
  42. <el-col :span="12">
  43. <el-form-item label="委外单位:" prop="outsourcUnit">
  44. <el-select
  45. size="small"
  46. style="width: 100%"
  47. clearable
  48. v-model="addForm.outsourcUnit"
  49. placeholder="请选择"
  50. >
  51. <el-option
  52. v-for="item in deptList"
  53. :key="item.id"
  54. :label="item.name"
  55. :value="item.name"
  56. >
  57. </el-option>
  58. </el-select>
  59. </el-form-item>
  60. </el-col>
  61. </el-row>
  62. <el-row>
  63. <el-col :span="12">
  64. <el-form-item label="计划完成时间:" prop="plannCompletionTime">
  65. <el-date-picker
  66. v-model="addForm.plannCompletionTime"
  67. type="datetime"
  68. style="width: 100%"
  69. placeholder="选择日期时间"
  70. size="small"
  71. value-format="yyyy-MM-dd HH:mm:ss"
  72. >
  73. </el-date-picker>
  74. </el-form-item>
  75. </el-col>
  76. </el-row>
  77. </el-form>
  78. </div>
  79. <div class="btns">
  80. <el-button type="primary" size="small" @click="submitAdd">提交</el-button>
  81. <el-button size="small" @click="handleClose">关闭</el-button>
  82. </div>
  83. </el-dialog>
  84. </template>
  85. <script>
  86. // import { addOutsource, getAllSupplier } from '@/api/maintenance/repair/repair'
  87. export default {
  88. props: {
  89. },
  90. watch: {
  91. },
  92. data () {
  93. return {
  94. addForm: {},
  95. addFormRules: {
  96. outsourcUnit:[{ required: true, message: '请选择委外单位', trigger: 'change' }],
  97. plannCompletionTime:[{ required: true, message: '请选择计划完成时间', trigger: 'change' }]
  98. },
  99. entrustVisible:false,
  100. deptList:[]
  101. }
  102. },
  103. created () {
  104. },
  105. methods: {
  106. init(row){
  107. this.addForm = {}
  108. this.addForm.repairsCode = row.repairsCode
  109. this.addForm.equiCode = row.equiCode
  110. this.addForm.equiName = row.equiName
  111. this.addForm.equiId = row.equiId
  112. this.addForm.status = 0
  113. // this.getgys()
  114. this.entrustVisible = true
  115. },
  116. // 获取供应商列表
  117. async getgys () {
  118. let res = await getAllSupplier()
  119. this.deptList = res.data
  120. },
  121. handleClose () {
  122. this.$refs.addFormRef.resetFields()
  123. this.entrustVisible = false
  124. },
  125. submitAdd(){
  126. this.$refs.addFormRef.validate(valid => {
  127. if (valid) {
  128. addOutsource(this.addForm).then(res=>{
  129. if (res?.success) {
  130. this.handleClose()
  131. this.$message.success('委派成功!')
  132. this.$emit('refresh')
  133. }
  134. })
  135. }
  136. })
  137. }
  138. }
  139. }
  140. </script>
  141. <style lang="scss" scoped>
  142. .dialog_top {
  143. display: flex;
  144. justify-content: space-between;
  145. align-items: center;
  146. margin-bottom: 10px;
  147. }
  148. .btns {
  149. text-align: right;
  150. margin: 10px 0;
  151. }
  152. </style>