declarationDialog.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <ele-modal
  3. custom-class="ele-dialog-form long-dialog-form"
  4. :visible.sync="visibleDialog"
  5. title="报工"
  6. :close-on-click-modal="false"
  7. width="85%"
  8. append-to-body
  9. @close="handleClose"
  10. :maxable="true"
  11. >
  12. <el-form ref="form" :model="addForm" label-width="100px">
  13. <el-form-item label="实际起始时间" prop="time">
  14. <el-date-picker
  15. v-model="addForm.time"
  16. type="datetimerange"
  17. value-format="yyyy-MM-dd HH:mm:ss"
  18. range-separator="至"
  19. start-placeholder="实际开始日期"
  20. end-placeholder="实际结束日期"
  21. :disabled="type == 'view'"
  22. >
  23. </el-date-picker>
  24. </el-form-item>
  25. <el-form-item label="附件:" prop="attachments">
  26. <fileMain
  27. v-model="addForm.attachments"
  28. :type="type == 'view' ? 'view' : ''"
  29. ></fileMain>
  30. </el-form-item>
  31. <el-form-item label="备注:" prop="reason">
  32. <el-input
  33. type="textarea"
  34. placeholder="请输入内容"
  35. v-model="addForm.reason"
  36. :disabled="type == 'view'"
  37. >
  38. </el-input>
  39. </el-form-item>
  40. </el-form>
  41. <info ref="infoRef" type="view" :isPurchaseNeed="false"></info>
  42. <header-title title="方案"></header-title>
  43. <spareParts ref="sparePartsRef" :type="type"></spareParts>
  44. <div slot="footer" class="footer">
  45. <el-button type="primary" @click="submitAdd" v-if="type != 'view'"
  46. >提交</el-button
  47. >
  48. <el-button @click="handleClose">取消</el-button>
  49. </div>
  50. </ele-modal>
  51. </template>
  52. <script>
  53. import fileMain from '@/components/addDoc/index.vue';
  54. import { getSalesWorkOrderById } from '@/api/salesServiceManagement/index';
  55. import { reportWorkingSalesWorkOrder } from '@/api/salesServiceManagement/index';
  56. import spareParts from '@/views/salesServiceManagement/components/sparePartsList.vue';
  57. import info from '@/views/salesServiceManagement/components/info.vue';
  58. export default {
  59. props: {},
  60. components: {
  61. fileMain,
  62. spareParts,
  63. info
  64. },
  65. watch: {},
  66. computed: {},
  67. data() {
  68. return {
  69. title: '',
  70. visibleDialog: false,
  71. addForm: {
  72. id: '',
  73. time: [],
  74. attachments: [],
  75. reason: ''
  76. },
  77. row: {},
  78. type: 'add'
  79. };
  80. },
  81. created() {},
  82. methods: {
  83. open(row, type) {
  84. this.visibleDialog = true;
  85. this.type = type;
  86. this.getDetail(row);
  87. },
  88. async getDetail(row) {
  89. console.log(row, 'row');
  90. const res = await getSalesWorkOrderById(row.id);
  91. this.addForm=res
  92. this.$nextTick(() => {
  93. this.$refs.infoRef.init(res.afterSalesDemandVO);
  94. this.$refs.sparePartsRef.setTableValue(res?.costListVOS || []);
  95. });
  96. },
  97. async submitAdd() {
  98. this.$refs.form.validate(async (valid) => {
  99. if (valid) {
  100. await reportWorkingSalesWorkOrder({
  101. acceptTime: this.addForm.time[0],
  102. finishTime: this.addForm.time[1],
  103. attachments: this.addForm.attachments,
  104. id:this.addForm.id,
  105. reason: this.addForm.reason,
  106. costListVOS: this.$refs.sparePartsRef.getTableValue()
  107. }).then((res) => {
  108. if (!res) return;
  109. this.$message.success('操作成功');
  110. this.visibleDialog = false;
  111. this.$emit('reload');
  112. });
  113. } else {
  114. return false;
  115. }
  116. });
  117. },
  118. handleClose() {
  119. this.visibleDialog = false;
  120. }
  121. }
  122. };
  123. </script>
  124. <style lang="scss" scoped>
  125. .dialog_top {
  126. margin-bottom: 10px;
  127. display: flex;
  128. align-items: center;
  129. span {
  130. margin-left: 50px;
  131. }
  132. .name {
  133. font-weight: 800;
  134. color: #40a9ff;
  135. }
  136. }
  137. ::v-deep .el-row {
  138. display: flex;
  139. flex-wrap: wrap;
  140. }
  141. .btns {
  142. text-align: right;
  143. // margin: 10px 0;
  144. }
  145. .main_container {
  146. width: 100%;
  147. display: flex;
  148. justify-content: space-between;
  149. }
  150. </style>