RepairMyForm.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <a-spin :spinning="confirmLoading">
  3. <j-form-container :disabled="formDisabled">
  4. <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
  5. <a-row>
  6. <a-col :span="24">
  7. <a-form-model-item label="维修工单编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repaircode">
  8. <a-input v-model="model.repaircode" placeholder="请输入维修工单编号" disabled></a-input>
  9. </a-form-model-item>
  10. </a-col>
  11. <a-col :span="24">
  12. <a-form-model-item label="维修工单名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repairname">
  13. <a-input v-model="model.repairname" placeholder="请输入工单名称" disabled></a-input>
  14. </a-form-model-item>
  15. </a-col>
  16. <a-col :span="24">
  17. <a-form-model-item label="设备名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="equipmentname">
  18. <a-input v-model="model.equipmentname" placeholder="请输入设备名称" disabled></a-input>
  19. </a-form-model-item>
  20. </a-col>
  21. <!-- <a-col :span="24">
  22. <a-form-model-item label="故障日期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="faultdate">
  23. <j-date placeholder="请选择故障日期" v-model="model.faultdate" style="width: 100%" disabled/>
  24. </a-form-model-item>
  25. </a-col> -->
  26. <a-col :span="24">
  27. <a-form-model-item label="故障描述" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="faultdesc">
  28. <a-textarea v-model="model.faultdesc" placeholder="请输入故障描述" disabled></a-textarea>
  29. </a-form-model-item>
  30. </a-col>
  31. <!-- <a-col :span="24">
  32. <a-form-model-item label="优先级:0普通,1紧急,2特急" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="priority">
  33. <a-input v-model="model.priority" placeholder="请输入优先级:0普通,1紧急,2特急" ></a-input>
  34. </a-form-model-item>
  35. </a-col> -->
  36. <a-col :span="24">
  37. <a-form-model-item label="维修反馈" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="feedback">
  38. <a-textarea v-model="model.feedback" placeholder="请输入维修反馈" ></a-textarea>
  39. </a-form-model-item>
  40. </a-col>
  41. <a-col :span="24">
  42. <a-form-model-item label="维修时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repairdate">
  43. <j-date placeholder="请选择维修时间" v-model="model.repairdate" style="width: 100%" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss"/>
  44. </a-form-model-item>
  45. </a-col>
  46. <a-col :span="24">
  47. <!-- <a-form-model-item label="是否挂单" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="status">
  48. <a-switch :checked="model.status === '2' ? true : false" checked-children="是" un-checked-children="否" @change="changeStatus"/>
  49. </a-form-model-item> -->
  50. <a-form-model-item label="本次维修状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="status">
  51. <a-radio-group v-model="model.status" :default-value="4">
  52. <a-radio :value="2"> 在办 </a-radio>
  53. <a-radio :value="3"> 挂单 </a-radio>
  54. <a-radio :value="4"> 结束 </a-radio>
  55. </a-radio-group>
  56. </a-form-model-item>
  57. </a-col>
  58. <!-- <a-col :span="24">
  59. <a-form-model-item label="维修工单状态: 0正常、1冻结、2拒绝" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="repairstatus">
  60. <a-input v-model="model.repairstatus" placeholder="请输入维修工单状态: 0正常、1冻结、2拒绝" ></a-input>
  61. </a-form-model-item>
  62. </a-col> -->
  63. <a-col :span="24">
  64. <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark">
  65. <a-textarea v-model="model.remark" placeholder="请输入备注"></a-textarea>
  66. </a-form-model-item>
  67. </a-col>
  68. </a-row>
  69. </a-form-model>
  70. </j-form-container>
  71. </a-spin>
  72. </template>
  73. <script>
  74. import { putAction } from '@/api/manage'
  75. import { validateDuplicateValue } from '@/utils/util'
  76. export default {
  77. name: 'RepairMyForm',
  78. components: {
  79. },
  80. props: {
  81. //表单禁用
  82. disabled: {
  83. type: Boolean,
  84. default: false,
  85. required: false
  86. }
  87. },
  88. data () {
  89. return {
  90. model:{
  91. },
  92. labelCol: {
  93. xs: { span: 24 },
  94. sm: { span: 5 },
  95. },
  96. wrapperCol: {
  97. xs: { span: 24 },
  98. sm: { span: 16 },
  99. },
  100. confirmLoading: false,
  101. validatorRules: {
  102. faultdesc: [
  103. { required: true, message: '请输入故障描述!'},
  104. ],
  105. repairuser: [
  106. { required: true, message: '请输入待办人!'},
  107. ],
  108. repairdate: [
  109. { required: true, message: '请输入维修时间!'},
  110. ],
  111. feedback: [
  112. { required: true, message: '请输入维修反馈!'},
  113. ],
  114. result: [
  115. { required: true, message: '请输入维修结果!'},
  116. ],
  117. },
  118. url: {
  119. feedback: "/cmmsRepair/cmmsRepair/repair",
  120. queryById: "/cmmsRepairMy/cmmsRepairMy/queryById"
  121. }
  122. }
  123. },
  124. computed: {
  125. formDisabled(){
  126. return this.disabled
  127. },
  128. },
  129. created () {
  130. //备份model原始值
  131. this.modelDefault = JSON.parse(JSON.stringify(this.model));
  132. },
  133. methods: {
  134. // add () {
  135. // this.edit(this.modelDefault);
  136. // },
  137. // edit (record) {
  138. // this.model = Object.assign({}, record);
  139. // this.visible = true;
  140. // },
  141. feedback(record){
  142. this.model = Object.assign({}, record);
  143. console.log(this.model)
  144. this.visible = true;
  145. },
  146. changeStatus(checked){
  147. console.log(checked)
  148. this.model.status = checked ? '2' : '3'
  149. },
  150. submitForm () {
  151. const that = this;
  152. // 触发表单验证
  153. this.$refs.form.validate(valid => {
  154. if (valid) {
  155. that.confirmLoading = true;
  156. this.model.nodeList = [
  157. {
  158. handledate: this.model.repairdate,
  159. nodename: this.model.status,
  160. opinion: this.model.feedback,
  161. remark: this.model.remark,
  162. relid: this.model.id
  163. }
  164. ]
  165. putAction(this.url.feedback, this.model).then((res)=>{
  166. if(res.success){
  167. that.$message.success(res.message);
  168. that.$emit('ok');
  169. }else{
  170. that.$message.warning(res.message);
  171. }
  172. }).finally(() => {
  173. that.confirmLoading = false;
  174. })
  175. }
  176. })
  177. },
  178. }
  179. }
  180. </script>