Browse Source

我的工单修改批量操作,列表增加数量显示

damon227 5 months ago
parent
commit
f0b1c45117
1 changed files with 44 additions and 15 deletions
  1. 44 15
      src/views/modules/works/work.vue

+ 44 - 15
src/views/modules/works/work.vue

@@ -48,7 +48,7 @@
         prop="ranks"
         header-align="center"
         align="center"
-        min-width="140"
+        min-width="100"
         :show-tooltip-when-overflow="true"
         label="级别"
       >
@@ -66,7 +66,7 @@
         prop="taskType"
         header-align="center"
         align="center"
-        min-width="160"
+        min-width="100"
         label="工单类型"
       >
         <template slot-scope="scope">
@@ -83,11 +83,22 @@
         prop="taskName"
         header-align="center"
         align="center"
-        min-width="140"
+        min-width="160"
         :show-tooltip-when-overflow="true"
         label="工单名称"
       >
       </el-table-column>
+      <el-table-column
+        prop=""
+        header-align="center"
+        align="center"
+        min-width="100"
+        label="数量"
+      >
+        <template slot-scope="scope">
+            {{scope.row.taskIds == null ? 0 : scope.row.taskIds.length}}
+         </template>
+      </el-table-column>
       <!-- <el-table-column
         prop="content"
         header-align="center"
@@ -220,10 +231,10 @@
             "
             type="text"
             size="small"
-            @click="checkTask(scope.row.taskId, 1)"
+            @click="checkTask(scope.row, 1)"
             >通过</el-button
           >
-          <el-button
+          <!-- <el-button
             v-if="
                 isAuth('work:clt:check') &&
                 Number(scope.row.state) === 2 &&
@@ -234,7 +245,7 @@
             size="small"
             @click="checkTask(scope.row.taskId, 2)"
             >不通过</el-button
-          >
+          > -->
           <el-button
             v-if="
               isAuth('work:clt:damage') &&
@@ -254,7 +265,7 @@
             "
             type="text"
             size="small"
-            @click="submitTask(scope.row.nodeId, scope.row.productionId, scope.row.taskId)"
+            @click="submitTask(scope.row)"
             >提审理单</el-button
           >
           <el-button
@@ -378,6 +389,9 @@
         :rules="checkDialogFormRules"
         ref="checkDialogForm"
       >
+        <el-form-item label="数量" prop="count" label-width="120px">
+          <el-input-number v-model="checkDialogForm.count" :min="1" :max="checkDialogForm.maxCount"></el-input-number>
+        </el-form-item>
         <el-form-item
           label="完成记录说明"
           prop="operationRecords"
@@ -537,6 +551,9 @@
         :rules="submitDialogFormRules"
         ref="submitDialogForm"
       >
+        <el-form-item label="数量" prop="count" label-width="120px">
+          <el-input-number v-model="submitDialogForm.count" :min="1" :max="submitDialogForm.maxCount"></el-input-number>
+        </el-form-item>
         <el-form-item
           label="完成记录说明"
           prop="operationRecords"
@@ -671,7 +688,8 @@ export default {
         checkType: '',
         operationRecords: '',
         notes: '',
-        prodProductionRecordList: []
+        prodProductionRecordList: [],
+        count: 0
       },
       checkDialogBatch: false, // 是否是批量操作
       checkDialogFormRules: {
@@ -722,7 +740,8 @@ export default {
         taskId: undefined,
         operationRecords: '',
         notes: '',
-        prodProductionRecordList: []
+        prodProductionRecordList: [],
+        count: 0
       },
       submitDialogFormRules: {
         operationRecords: [
@@ -940,8 +959,11 @@ export default {
       })
     },
     // 检验
-    checkTask (taskId, checkType) {
-      this.checkDialogForm.taskId = taskId
+    checkTask (item, checkType) {
+      let {taskIds} = item
+      this.checkDialogForm.taskIds = taskIds
+      this.checkDialogForm.count = taskIds == null ? 0 : taskIds.length
+      this.checkDialogForm.maxCount = this.checkDialogForm.count
 
       if (checkType === 1) {
         // 查询工艺详情
@@ -1001,7 +1023,9 @@ export default {
               }
             })
           } else {
-            checkTask(submitData).then(({ data }) => {
+            let submitData = this.checkDialogForm
+            submitData.taskIds = this.checkDialogForm.taskIds.slice(0, this.checkDialogForm.count)
+            batchCheckTask(submitData).then(({ data }) => {
               if (data && data.code === '200') {
                 this.$message({
                   type: 'success',
@@ -1145,11 +1169,15 @@ export default {
         this.finishDialogForm.taskIds = this.multipleSelection.map(t => t.taskId)
       }
     },
-    submitTask (nodeId, productionId, taskId) {
+    submitTask (item) {
+      let {taskIds} = item
       this.submitDialogForm = {
-        taskIds: [taskId]
+        taskIds: taskIds,
+        count: taskIds == null ? 0 : taskIds.length,
+        maxCount: taskIds == null ? 0 : taskIds.length
       }
-      getTechList(taskId).then(({data}) => {
+
+      getTechList(taskIds[0]).then(({data}) => {
         if (data && data.code === '200') {
           this.techOptions = data.data
         }
@@ -1159,6 +1187,7 @@ export default {
     submitSubmit () {
       this.$refs['submitDialogForm'].validate((valid) => {
         if (valid) {
+          this.submitDialogForm.taskIds = this.submitDialogForm.taskIds.slice(0, this.submitDialogForm.number)
           submitTask(this.submitDialogForm).then(({ data }) => {
             if (data && data.code === '200') {
               this.$message({