Эх сурвалжийг харах

计划规则+事项规则

yijing 1 жил өмнө
parent
commit
157a6d624d

+ 51 - 7
src/views/rulesManagement/components/programRulesDialog.vue

@@ -97,7 +97,7 @@
             <div class="equipmentList_box">
               <header-title title="设备列表">
                 <div>
-                  <el-button size="small" icon="el-icon-plus" class="ele-btn-icon" type="primary"
+                  <el-button size="small" icon="el-icon-plus" class="ele-btn-icon" type="primary" :disables="hasCategoryId"
                     @click="handleAdd(ruleIdList, ruleIdListIndex)">新增</el-button>
                 </div>
               </header-title>
@@ -145,6 +145,26 @@
                     <span>{{ scope.$index + 1 }}</span>
                   </template>
                 </el-table-column>
+                <el-table-column label="零部件编码" prop="categoryCode" width="100">
+                  <template slot-scope="scope">
+                    <div v-if="scope.row.isNew">
+                      <el-input v-model="scope.row.categoryCode" placeholder="请输入零部件编码"></el-input>
+                    </div>
+                    <div v-else>
+                      <span>{{ scope.row.categoryCode }}</span>
+                    </div>
+                  </template>
+                </el-table-column>
+                <el-table-column label="零部件名称" prop="categoryName" width="100">
+                  <template slot-scope="scope">
+                    <div v-if="scope.row.isNew">
+                      <el-input v-model="scope.row.categoryName" placeholder="请输入零部件名称"></el-input>
+                    </div>
+                    <div v-else>
+                      <span>{{ scope.row.categoryName }}</span>
+                    </div>
+                  </template>
+                </el-table-column>
                 <el-table-column label="事项" prop="name" width="100">
                   <template slot-scope="scope">
                     <div v-if="scope.row.isNew">
@@ -447,7 +467,10 @@ export default {
       taskId: null,
 
       addDialog: false,
-      tabsValue: null
+      tabsValue: null,
+
+      hasCategoryId:false,
+      getByIdData:{}
     };
   },
   computed: {
@@ -610,6 +633,8 @@ export default {
     },
     /* 打开操作手册编辑款 */
     openOperationGuideDialogDialog(row, index, isNew) {
+      console.log(isNew,'isNew');
+
       if (isNew) {
         this.$refs.operationGuideDialog.open(row, index);
       }
@@ -621,10 +646,10 @@ export default {
       this.ruleIdList[this.ruleIndex].ruleItems.splice(index, 1);
     },
     addPostscript() {
-      console.log(
-        'this.matterRulesList---------------',
-        this.matterRulesList
-      );
+      // console.log(
+      //   'this.matterRulesList---------------',
+      //   this.matterRulesList
+      // );
       this.ruleIdList[this.ruleIndex].ruleItems.push({
         sort: null,
         name: '',
@@ -636,6 +661,7 @@ export default {
           toolList: []
         }
       });
+      console.log(this.ruleIdList,'225')
     },
     async getInfo(id) {
       console.log(id);
@@ -892,7 +918,13 @@ export default {
     handleRuleNameChange(val) {
       this.ruleId = val;
       console.log('val----', val);
-      // this._getMatterRulesDetails(val);
+      this.getRulesDetails(val);
+    },
+    async getRulesDetails(val) {
+      const res = await getDetail(val);
+      console.log('res------', res);
+      this.getByIdData=res;
+      this.hasCategoryId = res?.categoryId;
     },
     // 封装 - 获取规则下面的详情数据及事项
     async _getMatterRulesDetails(val) {
@@ -901,6 +933,7 @@ export default {
       // console.log('res------', res);
       // this.matterRulesList = res.ruleItems;
     },
+    
     async addRule() {
       console.log(this.ruleIdList);
       console.log(this.ruleId);
@@ -912,6 +945,17 @@ export default {
         this.ruleObj.ruleItems = await this._getMatterRulesDetails(
           this.ruleId
         );
+
+        for (let i = 0; i < this.ruleObj.ruleItems.length; i++) {
+          const id = this.getByIdData?.categoryId;
+          const name = this.getByIdData?.categoryName;
+
+          this.ruleObj.ruleItems[i].categoryId = id;
+          this.ruleObj.ruleItems[i].categoryName = name;
+
+          this.ruleObj.ruleItems[i].isNew=true;
+        }
+
         this.ruleIdList.push(deepClone(this.ruleObj));
         console.log('this.ruleIdList--------', this.ruleIdList);
         this.addDialog = false;

+ 2 - 2
src/views/rulesManagement/matterRules/components/ProductModal.vue

@@ -85,7 +85,7 @@
     data() {
       return {
         visible: false,
-        title: '选择工具',
+        title: '选择零部件',
 
         categoryLevelId: null,
         categoryId: 1,
@@ -270,7 +270,7 @@
       chooseRadio(row) {
         console.log(row, '勾选');
         this.visible = false;
-        this.$emit('chooseRadio', row);
+        this.$emit('chooseRadio', row,this.rowDataBom);
       }
     }
   };

+ 35 - 4
src/views/rulesManagement/matterRules/components/matter-add.vue

@@ -59,7 +59,9 @@
               </el-switch>
             </el-form-item>
           </el-col>
-          <el-col :span="24">
+        </el-row>
+        <el-row>
+          <el-col :span="13">
             <el-form-item label="周期" prop="cycleValue">
               <rule-cycle
                 ref="cycleMultipleRef"
@@ -69,6 +71,11 @@
               />
             </el-form-item>
           </el-col>
+          <el-col :span="11">
+            <el-form-item label="设备信息" prop="">
+              <el-input v-model="ShebeiName" disabled></el-input>
+            </el-form-item>
+          </el-col>
         </el-row>
 
         <el-table
@@ -93,6 +100,7 @@
           <el-table-column prop="categoryCode" label="零部件编码" width="160">
             <template slot-scope="scope">
               <el-input
+              size="small"
                 @click.native="
                   openpartDialog(scope.row, scope.$index, '零部件')
                 "
@@ -103,6 +111,7 @@
           <el-table-column prop="categoryName" label="零部件名称" width="160">
             <template slot-scope="scope">
               <el-input
+              size="small"
                 @click.native="
                   openpartDialog(scope.row, scope.$index, '零部件')
                 "
@@ -116,6 +125,7 @@
                 v-model="scope.row.matterType"
                 placeholder="请选择"
                 style="width: 100%"
+                size="small"
               >
                 <el-option
                   v-for="item in matterTypeList"
@@ -328,7 +338,11 @@
             { required: true, message: '请输入巡点检标准', trigger: 'blur' }
           ]
         },
-        isBindPlan: false
+        isBindPlan: false,
+        cCode:'',
+          cName:'',
+          cId:'',
+          ShebeiName:''
         // matterTypeList: []
       };
     },
@@ -463,8 +477,14 @@
       dataKeep() {
         let form = deepClone(this.formData);
         console.log(this.$refs.cycleMultipleRef);
+        
+        form.categoryCode=this.cCode;
+        form.categoryName=this.cName;
+        form.categoryId=this.cId;
+
         form.cycle = this.$refs.cycleMultipleRef.ruleCycleList;
         console.log(form);
+        
         switch (form.cycleType) {
           case 1:
             if (form.cycle[0].minute === '') {
@@ -560,8 +580,19 @@
           this.$message.error('请添加事项内容!');
         }
       },
-      chooseRadio(val) {
+      chooseRadio(val,clickBomData) {
         if (val.length > 0) {
+          console.log('clickBomData--------------------',clickBomData);
+
+          this.cCode= clickBomData.code;
+          this.cName= clickBomData.name;
+          this.cId= clickBomData.id;
+          this.ShebeiName=clickBomData.code+'-'+clickBomData.name+'-'+clickBomData.modelType;
+          
+          console.log('this.cCode', this.cCode);
+          console.log('this.cName', this.cName);
+          console.log('this.cId', this.cId);
+
           const findex = val[0].findex;
           const items = val.map((item) => ({
             ...this.formData.ruleItems[findex],
@@ -587,7 +618,7 @@
 <style scoped lang="scss">
   .operationGuide_box {
     width: 100%;
-    height: 50px;
+    height: 48px;
     display: flex;
     overflow: hidden;
     cursor: pointer;

+ 3 - 3
src/views/rulesManagement/matterRules/components/rule-cycle.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
-    <el-row :gutter="8" v-if="pageType">
-      <el-col :span="2">
+    <el-row :gutter="24" v-if="pageType">
+      <el-col :span="4">
         <el-input
           @input="
             (value) =>
@@ -15,7 +15,7 @@
           :disabled="isBindPlan"
         ></el-input>
       </el-col>
-      <el-col :span="3">
+      <el-col :span="4">
         <el-select
           v-model="formData.cycleType"
           size="small"