Просмотр исходного кода

完善益寿缘销售端任务栏用户信息采集进度的终止操作

cgp 1 день назад
Родитель
Сommit
5d86f71486
1 измененных файлов с 70 добавлено и 27 удалено
  1. 70 27
      src/views/qw/collectionSchedule/index.vue

+ 70 - 27
src/views/qw/collectionSchedule/index.vue

@@ -84,12 +84,13 @@
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
-            :disabled="true"
             size="mini"
             type="text"
             icon="el-icon-delete"
-            @click="handleDelete(scope.row)"
-            v-hasPermi="['qw:collectionSchedule:remove']"
+            @click="endProcess(scope.row)"
+            v-hasPermi="['qw:collectionSchedule:stop']"
+            :disabled="scope.row.status !== 1"
+            :style="{ color: scope.row.status === 1 ? '#f56c6c' : '#999' }"
           >终止</el-button>
         </template>
       </el-table-column>
@@ -103,6 +104,24 @@
       @pagination="getList"
     />
 
+    <!-- 终止原因弹窗 -->
+    <el-dialog title="终止进度" :visible.sync="endProcessVisible" width="400px" @close="resetEndForm">
+      <el-form :model="endForm" ref="endFormRef" label-width="80px">
+        <el-form-item label="终止原因" prop="remark" :rules="[{ required: true, message: '请输入终止原因', trigger: 'blur' }]">
+          <el-input
+            v-model="endForm.remark"
+            type="textarea"
+            :rows="4"
+            placeholder="请输入终止原因"
+          />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="endProcessVisible = false">取 消</el-button>
+        <el-button type="primary" @click="submitEndProcess">确 定</el-button>
+      </div>
+    </el-dialog>
+
   </div>
 </template>
 
@@ -122,6 +141,13 @@ export default {
       6: 'success'    // 完成 —— 蓝色
     };
     return {
+      // === 新增:终止弹窗相关 ===
+      endProcessVisible: false,
+      endForm: {
+        id: null,
+        collectionId: null,
+        remark: ''
+      },
       // 遮罩层
       loading: true,
       // 导出遮罩层
@@ -221,6 +247,47 @@ export default {
       this.resetForm("queryForm");
       this.handleQuery();
     },
+
+    /** 终止按钮操作 - 打开弹窗 */
+    endProcess(row) {
+      this.endForm.id = row.id;
+      this.endForm.collectionId = row.collectionId;
+      this.endForm.remark = '';
+      this.endProcessVisible = true;
+    },
+    /** 提交终止操作 */
+    /** 提交终止操作 */
+    submitEndProcess() {
+      this.$refs["endFormRef"].validate(valid => {
+        if (valid) {
+          const { id, collectionId, remark } = this.endForm
+          this.$confirm('确认终止该采集进度?', '提示', {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning'
+          }).then(() => {
+            endProcess({ id, collectionId, remark }).then(response => {
+              this.msgSuccess("终止成功");
+              this.endProcessVisible = false;
+              this.getList();
+            }).catch(() => {
+              // 可选:错误提示
+            });
+          }).catch(() => {
+            // 取消
+          });
+        }
+      });
+    },
+    /** 重置终止表单 */
+    resetEndForm() {
+      this.$refs["endFormRef"] && this.$refs["endFormRef"].resetFields();
+      this.endForm.id = null;
+      this.endForm.collectionId = null;
+      this.endForm.remark = '';
+    },
+
+
     // 多选框选中数据
     handleSelectionChange(selection) {
       this.ids = selection.map(item => item.id)
@@ -233,16 +300,6 @@ export default {
       this.open = true;
       this.title = "添加用户信息采集进度";
     },
-    /** 修改按钮操作 */
-    handleUpdate(row) {
-      this.reset();
-      const id = row.id || this.ids
-      getCollectionSchedule(id).then(response => {
-        this.form = response.data;
-        this.open = true;
-        this.title = "修改用户信息采集进度";
-      });
-    },
     /** 提交按钮 */
     submitForm() {
       this.$refs["form"].validate(valid => {
@@ -263,20 +320,6 @@ export default {
         }
       });
     },
-    /** 删除按钮操作 */
-    handleDelete(row) {
-      const ids = row.id || this.ids;
-      this.$confirm('是否确认删除用户信息采集进度编号为"' + ids + '"的数据项?', "警告", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        }).then(function() {
-          return delCollectionSchedule(ids);
-        }).then(() => {
-          this.getList();
-          this.msgSuccess("删除成功");
-        }).catch(() => {});
-    },
     /** 导出按钮操作 */
     handleExport() {
       const queryParams = this.queryParams;