Procházet zdrojové kódy

vue 20241217 task 修改

贾小兵 před 5 měsíci
rodič
revize
e9fe3988cb
1 změnil soubory, kde provedl 80 přidání a 73 odebrání
  1. 80 73
      ruoyi-ui/src/views/peoples/task/index.vue

+ 80 - 73
ruoyi-ui/src/views/peoples/task/index.vue

@@ -134,7 +134,7 @@
                 icon="el-icon-delete"
                 @click="handleDelete(scope.row)"
               >删除</el-button>
-              
+
             </template>
           </el-table-column>
         </el-table>
@@ -154,7 +154,7 @@
         <el-row>
           <el-col :span="12">
             <el-form-item label="型号" prop="simType">
-              <el-select v-model="form.simType"  placeholder="请选择模拟器型号" @selection-change="selectedEquip">
+              <el-select v-model="form.simType"  placeholder="请选择模拟器型号" @change="selectSimType">
                 <el-option
                   v-for="dict in dict.type.sim_sim_type"
                   :key="dict.value"
@@ -174,10 +174,10 @@
             <el-button @click="toggleSelection()">取消选择</el-button>
           </div>
         </el-row>
-       
-        <el-table 
-          :data="tableData" border ref="multipleTable" @selection-change="handleSelectionRow" 
-          :span-method="objectSpanMethod" 
+
+        <el-table
+          :data="tableData" border ref="multipleTable" @selection-change="handleSelectionRow"
+          :span-method="objectSpanMethod"
           style="width:100%;text-align:center;margin-left:10px; margin-top:10px">
           <el-table-column
             prop="xinghao"
@@ -209,7 +209,6 @@
         <el-row>
           <el-col :span="12">
             <el-form-item label="型号" prop="simType">
-              <!-- v-model="form.monitype" -->
               <el-select v-model="selectedEquip"  placeholder="请选择模拟器型号">
                 <el-option
                   value="请选择"
@@ -233,11 +232,11 @@
             <el-button @click="toggleSelection()">取消选择</el-button>
           </div>
         </el-row>
-        
-       
-        <el-table 
-          :data="tableData" border ref="multipleTable" @selection-change="handleSelectionRow" 
-          :span-method="objectSpanMethod" 
+
+
+        <el-table
+          :data="tableData" border ref="multipleTable" @selection-change="handleSelectionRow"
+          :span-method="objectSpanMethod"
           style="width:100%;text-align:center;margin-left:10px; margin-top:10px">
           <el-table-column
             prop="xinghao"
@@ -463,7 +462,7 @@
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
-    
+
   </div>
 </template>
 <style>
@@ -475,7 +474,7 @@
   }
 </style>
 <script>
-import { listTask,simTypeTask,addTask } from "@/api/sim/task";
+import { listTask,simTypeTask,addTask,updateTask,delTask,getTask } from "@/api/sim/task";
 import { getToken } from "@/utils/auth";
 
 export default {
@@ -584,7 +583,7 @@ export default {
         //   xianxiang: '无法开机',
         //   name: '13.DC/DC',
         // },
-        
+
         // {
         //   ids:31,
         //   xinghao: '防化兵用毒剂报警器',
@@ -792,7 +791,7 @@ export default {
         name7:7,
         name8:7,
         name9:7,
-        name10:7, 
+        name10:7,
         value1:1,
         value2:1,
         value3:2,
@@ -1198,8 +1197,8 @@ export default {
         value9:1,
         value10:1,
       },
-      
-      
+
+
       {
         gzxx: '仪器无法开机',
         buwei: '1.FFC排线',
@@ -1562,7 +1561,7 @@ export default {
         value9:1,
         value10:2,
       },
-      
+
       ],
       // 遮罩层
       loading: true,
@@ -1796,7 +1795,7 @@ export default {
           name7:7,
           name8:7,
           name9:7,
-          name10:7, 
+          name10:7,
           value1:1,
           value2:1,
           value3:2,
@@ -2568,20 +2567,43 @@ export default {
   },
   created() {
     this.getList();
-    //this.getDeptTree();
-    this.getConfigKey("sys.user.initPassword").then(response => {
-      this.initPassword = response.msg;
-    });
   },
   methods: {
-
     // 选择型号,循环故障清单
-    selectedEquip(val) {
+    selectSimType(val){
       console.log(val);
       console.log('newValue');
-      // 根据newValue更新tableData
+      simTypeTask(val).then(response => {
+        console.log(response.data)
+        console.log('response')
+        // let jsonString = '';
+        // const obj = {};
+        // for (let i = 0; i < 6; i++) {
+        //   obj[i] = response.data.selectedData[i]['name'];
+        // }
+        // console.log(obj)
+        // jsonString = JSON.stringify(obj);
+
+        const arr = [];
+        arr['ids'] = 1;
+        arr['xinghao'] = 'FZD04B型侦毒器';
+        arr['xianxiang'] = '开机无响应';
+        arr['name'] = '1.电源开关';
+        console.log(arr);
+        console.log(JSON.stringify(arr));
+        this.tableData = arr;
+      });
+
+      // {
+        //   ids:1,
+        //   xinghao: 'FZD04B型侦毒器',
+        //   xianxiang: '开机无响应',
+        //   name: '1.电源开关',
+        // },
+
     },
     objectSpanMethod({ row, column, rowIndex, columnIndex }) {
+      // console.log(this.selectedEquip+'@@@')
       //第一列型号
       if(columnIndex === 0) {
         if(this.selectedEquip==2){
@@ -2617,7 +2639,7 @@ export default {
             return { rowspan: 1, colspan: 1 };
           }else{
             return { rowspan: 0, colspan: 0 };
-          } 
+          }
         }else if(this.selectedEquip==3){
           if(rowIndex<7 && rowIndex % 2 === 0){
             return { rowspan: 2, colspan: 1 };
@@ -2629,7 +2651,7 @@ export default {
             return { rowspan: 1, colspan: 1 };
           }else{
             return { rowspan: 0, colspan: 0 };
-          } 
+          }
         }else{
           if(rowIndex<7 && rowIndex % 2 === 0){
             return { rowspan: 2, colspan: 1 };
@@ -2645,14 +2667,14 @@ export default {
             return { rowspan: 0, colspan: 0 };
           }
         }
-        
+
       }
       //故障部位 和 选择
       if(columnIndex === 2 || columnIndex === 3){
         //return { rowspan: 1, colspan: 1 };
       }
     },
-    
+
     objectSpanMethod1({ row, column, rowIndex, columnIndex }) {
       //第二列故障现象
       if(columnIndex === 0) {
@@ -2707,22 +2729,6 @@ export default {
       if (!value) return true;
       return data.label.indexOf(value) !== -1;
     },
-    // 节点单击事件
-    handleNodeClick(data) {
-      this.queryParams.deptId = data.id;
-      this.handleQuery();
-    },
-    // 用户状态修改
-    handleStatusChange(row) {
-      let text = row.status === "0" ? "启用" : "停用";
-      this.$modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗?').then(function() {
-        return changeUserStatus(row.userId, row.status);
-      }).then(() => {
-        this.$modal.msgSuccess(text + "成功");
-      }).catch(function() {
-        row.status = row.status === "0" ? "1" : "0";
-      });
-    },
     //清除故障
     clearFaultChange(row,number,nametext){
       console.log()
@@ -2774,7 +2780,7 @@ export default {
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.userId);
+      this.ids = selection.map(item => item.taskId);
       this.single = selection.length != 1;
       this.multiple = !selection.length;
     },
@@ -2800,7 +2806,7 @@ export default {
     },
     /* 故障设置自检 **/
     handleInspect() {
-      //this.reset();
+      this.reset();
       // getUser().then(response => {
         //this.postOptions = response.posts;
         //this.roleOptions = response.roles;
@@ -2812,23 +2818,23 @@ export default {
     /** 修改按钮操作 */
     handleUpdate(row) {
       this.reset();
-      const userId = row.userId || this.ids;
-      getUser(userId).then(response => {
+      const taskId = row.taskId || this.ids;
+      getTask(taskId).then(response => {
         this.form = response.data;
-        this.postOptions = response.posts;
-        this.roleOptions = response.roles;
-        this.$set(this.form, "postIds", response.postIds);
-        this.$set(this.form, "roleIds", response.roleIds);
+        // this.postOptions = response.posts;
+        // this.roleOptions = response.roles;
+        // this.$set(this.form, "postIds", response.postIds);
+        // this.$set(this.form, "roleIds", response.roleIds);
         this.open = true;
-        this.title = "修改用户";
-        this.form.password = "";
+        this.title = "修改任务";
+        // this.form.password = "";
       });
     },
     /** 详情按钮操作 */
     handleView(row) {
       this.reset();
-      const userId = row.userId || this.ids;
-      getUser(userId).then(response => {
+      const taskId = row.taskId || this.ids;
+      getUser(taskId).then(response => {
         this.form = response.data;
         this.openview = true;
         this.title = "任务详情";
@@ -2839,7 +2845,7 @@ export default {
       this.$refs["form"].validate(valid => {
         if (valid) {
           if (this.form.taskId != undefined) {
-            updateUser(this.form).then(response => {
+            updateTask(this.form).then(response => {
               this.$modal.msgSuccess("修改成功");
               this.open = false;
               this.getList();
@@ -2856,24 +2862,25 @@ export default {
     },
     /** 删除按钮操作 */
     handleDelete(row) {
-      const userIds = row.userId || this.ids;
-      this.$modal.confirm('是否确认删除用户编号为"' + userIds + '"的数据项?').then(function() {
-        return delUser(userIds);
-      }).then(() => {
-        this.getList();
-        this.$modal.msgSuccess("删除成功");
-      }).catch(() => {});
-    },
-    //训练任务下发
-    handleIssued(row) {
-      const userIds = row.userId || this.ids;
-      this.$modal.confirm('是否确定编号为"' + userIds + '"的训练任务?').then(function() {
-        //return delUser(userIds);
+      const taskIds = row.taskId || this.ids;
+      this.$modal.confirm('是否确认删除编号为"' + taskIds + '"的数据项?').then(function() {
+        return delTask(taskIds);
       }).then(() => {
         this.getList();
         this.$modal.msgSuccess("删除成功");
       }).catch(() => {});
     },
+    // //训练任务下发
+    // handleIssued(row) {
+    //   const userIds = row.userId || this.ids;
+    //   this.$modal.confirm('是否确定编号为"' + userIds + '"的训练任务?').then(function() {
+    //     //return delUser(userIds);
+    //   }).then(() => {
+    //     this.getList();
+    //     this.$modal.msgSuccess("删除成功");
+    //   }).catch(() => {});
+    // },
+
   }
 };
 </script>