LAPTOP-16IUEB3P\Lenovo 3 лет назад
Родитель
Сommit
f049fe6957

+ 99 - 0
src/api/ruleManagement/plan.js

@@ -0,0 +1,99 @@
+import request from '@/utils/request';
+
+// 获取规则名称下拉
+export async function getRule (data) {
+	let par = new URLSearchParams(data);
+  const res = await request.get(`/main/ruleinfo/page?` + par, {});
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 获取类别信息列表
+export async function getCategory (data) {
+  const res = await request.post(`/main/category/getList` , data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+
+// 获取实体列表分页
+export async function getAssetList (data) {
+  let par = new URLSearchParams(data);
+  const res = await request.get(`/main/asset/page?` + par, {});
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 巡点检计划配置新增或更新 
+export async function saveOrUpdate (data) {
+  const res = await request.post('/eam/planconfig/saveOrUpdate' , data );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+
+
+
+
+
+
+// // 更新或保存
+// export async function saveOrUpdate (data) {
+//   const res = await request.post('/main/ruleinfo/saveOrEdit', data);
+//   if (res.data.code == 0) {
+//     return res.data;
+//   }
+//   return Promise.reject(new Error(res.data.message));
+// }
+
+// // 生成编码
+// export async function getCode (code) {
+//   const res = await request.get(`/main/codemanage/getCode/` + code, {});
+//   if (res.data.code == 0) {
+//     return res.data.data;
+//   }
+//   return Promise.reject(new Error(res.data.message));
+// }
+
+// // 获取规则列表页
+// export async function getList (data) {
+// 	let par = new URLSearchParams(data);
+//   const res = await request.get(`/main/ruleinfo/page?` + par, {});
+//   if (res.data.code == 0) {
+//     return res.data.data;
+//   }
+//   return Promise.reject(new Error(res.data.message));
+// }
+
+// // 获取规则详情
+// export async function getDetail (id) {
+//   const res = await request.get(`/main/ruleinfo/getById/` + id, {});
+//   if (res.data.code == 0) {
+//     return res.data.data;
+//   }
+//   return Promise.reject(new Error(res.data.message));
+// }
+
+
+// /**
+//  * 删除事项
+//  */
+// export async function removeRule(data) {
+//   const res = await request.delete('/main/ruleinfo/delete', { data } );
+//   if (res.data.code == 0) {
+//     return res.data.data;
+//   }
+//   return Promise.reject(new Error(res.data.message));
+// }
+
+
+
+

+ 237 - 306
src/components/addPatrolConfigDialog/index.vue

@@ -16,20 +16,20 @@
         label-width="120px"
       >
         <el-row>
-<!--          <el-col :span="8">
-            <el-form-item label="计划配置单号" prop="planRuleCode">
+         <el-col :span="8">
+            <el-form-item label="计划配置单号" prop="code">
               <el-input
-                v-model="addForm.planRuleCode"
+                v-model="addForm.code"
                 size="small"
                 placeholder="自动带出"
                 disabled
               ></el-input>
             </el-form-item>
-          </el-col> -->
+          </el-col>
           <el-col :span="8">
-            <el-form-item label="计划配置名称" prop="planRuleName">
+            <el-form-item label="计划配置名称" prop="name">
               <el-input
-                v-model="addForm.planRuleName"
+                v-model="addForm.name"
                 size="small"
                 placeholder="请输入"
                 :disabled="isBindPlan"
@@ -37,15 +37,15 @@
             </el-form-item>
           </el-col>
           <el-col :span="8">
-            <el-form-item label="自动派单" prop="isSyncBill">
+            <el-form-item label="自动派单" prop="autoOrder">
               <el-select
-                v-model="addForm.isSyncBill"
+                v-model="addForm.autoOrder"
                 size="small"
                 style="width: 100%"
                 :disabled="isBindPlan"
               >
-                <el-option :value="true" label="是"></el-option>
-                <el-option :value="false" label="否"></el-option>
+                <el-option :value="1" label="是"></el-option>
+                <el-option :value="0" label="否"></el-option>
               </el-select>
             </el-form-item>
           </el-col>
@@ -82,10 +82,24 @@
               </div>
             </el-form-item>
           </el-col>
+		  <el-col :span="8">
+		    <el-form-item label="设备分类" prop="classify">
+		        <ele-tree-select
+		            clearable
+		            :data="classifyTree"
+		            v-model="addForm.classify"
+		            placeholder="请选择"
+		            default-expand-all
+		            labelKey="name"
+		            valueKey="id"
+		        	@change="chooseClassify"
+		        />
+		    </el-form-item>
+		  </el-col>
           <el-col :span="8">
-            <el-form-item label="设备分类" prop="bizTypeId">
+            <el-form-item label="设备类别" prop="categoryId">
               <el-select
-                v-model="addForm.bizTypeId"
+                v-model="addForm.categoryId"
                 size="small"
                 style="width: 100%"
                  :disabled="isBindPlan"
@@ -101,9 +115,9 @@
             </el-form-item>
           </el-col>
           <el-col :span="8">
-            <el-form-item label="审核人" prop="verifyUserId">
+            <el-form-item label="审核人" prop="approvalUserId">
               <el-select
-                v-model="addForm.verifyUserId"
+                v-model="addForm.approvalUserId"
                 size="small"
                 clearable
                 style="width: 100%"
@@ -111,64 +125,40 @@
               >
                 <el-option
                   v-for="item in uerList"
-                  :key="item.userId"
-                  :value="item.userId"
-                  :label="item.trueName"
-                  @click.native="addForm.verifyUserName = item.trueName"
+                  :key="item.id"
+                  :value="item.id"
+                  :label="item.name"
                 ></el-option>
               </el-select>
             </el-form-item>
           </el-col>
-          <el-col :span="8" v-if="addForm.isSyncBill">
-            <el-form-item :label="formLabel + '部门'" prop="executorDeptCode">
+          <el-col :span="8" v-if="addForm.autoOrder">
+            <el-form-item :label="formLabel + '部门'" prop="groupId">
 				<ele-tree-select
 				    clearable
-				    :data="treeData"
-				    v-model="addForm.executorDeptCode"
+				    :data="deptData"
+				    v-model="addForm.groupId"
 				    placeholder="请选择"
 				    default-expand-all
 				    labelKey="name"
 				    valueKey="id"
+					@change="searchDeptNodeClick"
 				/>
-             <!-- <el-input
-                v-model="addForm.executorDeptCode"
-                v-show="false"
-                 :disabled="isBindPlan"
-              ></el-input>
-              <SelectTree
-                class="form-input"
-                ref="searchTree"
-                :options="deptList"
-                :value="addForm.executorDeptCode"
-                :props="{
-                  value: 'code',
-                  label: 'name',
-                  children: 'children'
-                }"
-                :isBindPlan="isBindPlan"
-                @getValue="searchDeptNodeClick"
-              /> -->
             </el-form-item>
           </el-col>
-          <el-col :span="8" v-if="addForm.isSyncBill">
-            <el-form-item :label="formLabel + '人员'" prop="executorId">
+          <el-col :span="8" v-if="addForm.autoOrder">
+            <el-form-item :label="formLabel + '人员'" prop="executeId">
               <el-select
-                v-model="addForm.executorId"
+                v-model="addForm.executeId"
                 size="small"
                 style="width: 100%"
                  :disabled="isBindPlan"
               >
                 <el-option
                   v-for="item in executorList"
-                  :key="item.userId"
-                  :value="item.userId"
-                  :label="item.trueName"
-                  @click.native="
-                    {
-                      addForm.executorName = item.trueName
-                      addForm.executorPhone = item.mobile
-                    }
-                  "
+                  :key="item.id"
+                  :value="item.id"
+                  :label="item.name"
                 ></el-option>
               </el-select>
             </el-form-item>
@@ -177,12 +167,10 @@
             <el-form-item label="状态" prop="status">
               <el-switch
                 v-model="addForm.status"
-                active-color="#157a2c"
-                inactive-color="#999"
                 active-text="开"
                 inactive-text="关"
-                :active-value="true"
-                :inactive-value="false"
+                :active-value="1"
+                :inactive-value="0"
               />
             </el-form-item>
           </el-col>
@@ -209,11 +197,12 @@
             <el-tree
               :data="addForm.planRuleEquiList"
               :props="defaultProps"
-              ref="planRuleEquiList"
+              ref="equiListTree"
               highlight-current
               node-key="id"
               @node-click="handleNodeClick"
                :disabled="isBindPlan"
+			   show-checkbox
             ></el-tree>
           </div>
         </div>
@@ -238,11 +227,9 @@
           </div>
           <!-- 添加操作事项 -->
           <div>
-            <el-button type="text" @click="addOperationItems"  :disabled="isBindPlan"
-              >添加操作事项</el-button
-            >
-            <el-table
-              :data="addForm.planRuleEquiList[currentEquItemIndex] && addForm.planRuleEquiList[currentEquItemIndex].itemJson"
+            <el-button type="text">操作事项</el-button>
+			<el-table
+              :data="matterRulesList"
               border
             >
               <el-table-column label="序号" align="center" width="60">
@@ -256,16 +243,6 @@
               </el-table-column>
               <el-table-column label="标准" align="center" prop="norm">
               </el-table-column>
-              <el-table-column label="操作" align="center" width="70">
-                <template slot-scope="scope">
-                  <el-button
-                    type="text"
-                    @click="handleDeleteOperationItem(scope.$index)"
-                     :disabled="isBindPlan"
-                    >删除</el-button
-                  >
-                </template>
-              </el-table-column>
             </el-table>
           </div>
 
@@ -331,13 +308,13 @@
       <el-button size="small" type="primary" @click="submit">提交</el-button>
       <el-button size="small" @click="handleClose">关闭</el-button>
     </div>
-   <RuleItemSelection
+<!--   <RuleItemSelection
       ref="ruleItemSelectionRef"
       :ruleItem="matterRulesList"
       :selectedMatter="selectedMatter"
       :labelTitle="formLabel"
       @submit="ruleItemSelectionSubmit"
-    />
+    /> -->
     <AddSpareDialog
       ref="addSpareDialogRef"
       :selectedSpare="selectedSpare"
@@ -358,6 +335,11 @@ import AddSpareDialog from '@/components/addSpareDialog'
 // import { mapGetters } from 'vuex'
 // import { getRuleNameList } from '@/api/stockManagement/stocking'
 import {deepClone} from "@/utils"
+
+  import { getRule , getCategory , getAssetList , saveOrUpdate } from '@/api/ruleManagement/plan';
+  import {  getDetail , getCode } from '@/api/ruleManagement/matter';
+  import {  listOrganizations , getUserPage } from '@/api/system/organization';
+  import { getTreeByType } from '@/api/classifyManage'
 export default {
   name: 'addPatrolConfigDialog',
   components: { RuleItemSelection, AddSpareDialog },
@@ -374,12 +356,6 @@ export default {
         return false
       }
     },
-    // queryId: {
-    //   type: Number,
-    //   default: function () {
-    //     return 0
-    //   }
-    // },
   },
   data () {
     return {
@@ -404,22 +380,17 @@ export default {
       },
 	  treeData:[],
       addForm: {
-        // planRuleCode: getRuleNo('PL'), // 计划配置单号
-        planRuleName: '', // 计划配置名称
-        isSyncBill: true, // 自动派单
+        name: '', // 计划配置名称
+        autoOrder: 1, // 自动派单
         ruleId: '', // 规则id
         ruleName: '', // 规则名称
         duration: null, // 计划完成时长
-        bizTypeId: '', // 设备分类id
-        bizTypeName: '', // 设备分类name
-        verifyUserId: '', // 审核人id
-        verifyUserName: '', // 审核人name
-        executorDeptCode: '', // 巡点检部门code
-        executorDeptName: '', // 巡点检部门name
-        executorId: '', // 巡点检人员id
-        executorName: '', // 巡点检人员name
+        categoryId: '', // 设备类别id
+        approvalUserId: '', // 审核人id
+        groupId: '', // 巡点检部门code
+        executeId: '', // 巡点检人员id
         executorPhone: '',
-        status: true, // 状态
+        status: 1, // 状态
         remark: '', // 备注
         planRuleType: 'PATROL', // 计划规则类型 巡点检: 'PATROL', 保养: 'MAINTAIN', 盘点: 'INVENTORY'
         // 计划规则设备列表
@@ -432,34 +403,17 @@ export default {
             equiModel: '', // 设备型号 specifications
             equiLocation: '', // 设备位置
             equiLocationCode: '', // 设备位置code
-            // 设备事项
-            itemJson: [
-              // {
-              //   name: '', // 事项名称
-              //   content: '', // 事项内容
-              //   norm: '' // 事项标准
-              // }
-            ],
             // 设备备品备件 - 巡点检不需要备品备件,保养需要
-            partJson: [
-              //   {
-              //     code: '', // 备品备件code
-              //     name: '', // 备品备件name
-              //     model: '', // 备品备件型号
-              //     num: '', // 所需数量
-              //     unit: '', // 单位
-              //     amount: '', // 费用
-              //   }
-            ],
+            partJson: [ ],
             totalCost:0,
           }
         ]
       },
       addFormRules: {
-        planRuleName: [
+        name: [
           { required: true, message: '请输入计划配置名称', trigger: 'blur' }
         ],
-        isSyncBill: [
+        autoOrder: [
           { required: true, message: '请选择是否自动派单', trigger: 'change' }
         ],
         ruleId: [
@@ -468,23 +422,25 @@ export default {
         duration: [
           { required: true, message: '请输入计划完成时长', trigger: 'blur' }
         ],
-        bizTypeId: [
-          { required: true, message: '请选择设备分类', trigger: 'change' }
-        ],
-        verifyUserId: [
-          { required: false, message: '请选择审核人', trigger: 'change' }
+		classify:[
+			{ required: true, message: '请选择设备分类', trigger: 'change' }
+		],
+        categoryId: [
+          { required: true, message: '请选择设备类别', trigger: 'change' }
         ],
-        executorDeptCode: [
+        groupId: [
           { required: true, message: '请选择选择巡点检部门', trigger: 'change' }
         ],
-        executorId: [
+        executeId: [
           { required: true, message: '请选择选择巡点检人员', trigger: 'change' }
         ]
       },
       ruleNameList:[],
-	  addDialogLoading:false,
-	  
-	  equipmentList:[]
+	  addDialogLoading:false,	  
+	  equipmentList:[],	  
+	  deptData:[],   //部门树
+	  classifyTree:[],  //设备分类树
+	  rootId:null,
     }
   },
   computed: {
@@ -503,18 +459,23 @@ export default {
           : this.dialogTitle.includes('保养')
           ? '保养'
           : '盘点'
-        const planRuleTypeObj = {
-          巡点检: 'PATROL',
-          保养: 'MAINTAIN',
-          盘点: 'INVENTORY'
-        }
-        this.addForm.planRuleType = planRuleTypeObj[this.formLabel]
+        // const planRuleTypeObj = {
+        //   巡点检: 'PATROL',
+        //   保养: 'MAINTAIN',
+        //   盘点: 'INVENTORY'
+        // }
+        // this.addForm.planRuleType = planRuleTypeObj[this.formLabel]
         // 获取审核人列表数据
         this.getUserList()
         // 获取部门
-        this.getDeptList()
+        this.getDeptList()		
         // 获取规则名称
         this._getRuleNameList()
+		// 获取设备分类树
+		this.getClassifyTree()
+		//  获取计划配置单号
+		this.getOrderCode()
+		
       }
     },
     async planRulesDetails (val) {
@@ -527,17 +488,17 @@ export default {
       // 编辑弹窗需要重新获取规则下面的事项
       this._getMatterRulesDetails(val.ruleId)
       // 设备分类回显需要将id转成string
-      this.addForm.bizTypeId = String(val.bizTypeId)
+      this.addForm.categoryId = String(val.categoryId)
       // 根据部门回显人员
-      const params = { deptCode: val.executorDeptCode, status: 1 }
+      const params = { deptCode: val.groupId, status: 1 }
       this.getUserList(params)
       // 回显设备事项
-      await this._getEquipmentList(val.bizTypeId)
+      await this._getEquipmentList(val.categoryId)
       const item = this.addForm.planRuleEquiList[0]
       console.log('item',item)
       // 默认选中列表第一条树节点
       this.$nextTick(() => {
-        this.$refs.planRuleEquiList.setCurrentKey(item.id)
+        this.$refs.equiListTree.setCurrentKey(item.id)
       })
       const { equiLocation, equiLocationCode } = this.getEquiLocation(item)
       this.equipmentInfo = {
@@ -551,20 +512,20 @@ export default {
       this.addForm.planRuleEquiList[0]['equiLocation'] = equiLocation
       this.addForm.planRuleEquiList[0]['equiLocationCode'] = equiLocationCode
       // 对比详情返回的数据和设备分类下面所有的设备列表,将itemJson同步过去
-      for (let i = 0; i < this.addForm.planRuleEquiList.length; i++) {
-        for (let j = 0; j < tempPlanRuleEquiList.length; j++) {
-          if (
-            this.addForm.planRuleEquiList[i].code ===
-            tempPlanRuleEquiList[j].equiCode
-          ) {
-            this.addForm.planRuleEquiList[i]['itemJson'] =
-              tempPlanRuleEquiList[j]['itemJson']
-            this.addForm.planRuleEquiList[i]['partJson'] =
-              tempPlanRuleEquiList[j]['partJson']
-            break
-          }
-        }
-      }
+      // for (let i = 0; i < this.addForm.planRuleEquiList.length; i++) {
+      //   for (let j = 0; j < tempPlanRuleEquiList.length; j++) {
+      //     if (
+      //       this.addForm.planRuleEquiList[i].code ===
+      //       tempPlanRuleEquiList[j].equiCode
+      //     ) {
+      //       this.addForm.planRuleEquiList[i]['itemJson'] =
+      //         tempPlanRuleEquiList[j]['itemJson']
+      //       this.addForm.planRuleEquiList[i]['partJson'] =
+      //         tempPlanRuleEquiList[j]['partJson']
+      //       break
+      //     }
+      //   }
+      // }
     }
   },
   created(){
@@ -580,20 +541,16 @@ export default {
       this.equipmentInfo = {}
       this.addForm = {
         // planRuleCode: getRuleNo('PL'), // 计划配置单号
-        planRuleName: '', // 计划配置名称
-        isSyncBill: true, // 自动派单
+        name: '', // 计划配置名称
+        autoOrder: 1, // 自动派单
         ruleId: '', // 规则id
         duration: null, // 计划完成时长
-        bizTypeId: '', // 设备分类
-        bizTypeName: '', // 设备分类
-        verifyUserId: '', // 审核人id
-        verifyUserName: '', // 审核人name
-        executorDeptCode: '', // 巡点检部门code
-        executorDeptName: '', // 巡点检部门name
-        executorId: '', // 巡点检人员id
-        executorName: '', // 巡点检人员name
+        categoryId: '', // 设备类别
+        approvalUserId: '', // 审核人id
+        groupId: '', // 巡点检部门code
+        executeId: '', // 巡点检人员id
         executorPhone: '',
-        status: true, // 状态
+        status: 1, // 状态
         remark: '', // 备注
         planRuleType: 'PATROL', // 计划规则类型 巡点检: 'PATROL', 保养: 'MAINTAIN', 盘点: 'INVENTORY'
         // 计划规则设备列表
@@ -606,25 +563,8 @@ export default {
             equiModel: '', // 设备型号 specifications
             equiLocation: '', // 设备位置
             equiLocationCode: '', // 设备位置 code
-            // 设备事项
-            itemJson: [
-              // {
-              //   name: '', // 事项名称
-              //   content: '', // 事项内容
-              //   norm: '' // 事项标准
-              // }
-            ],
             // 设备备品备件 - 巡点检不需要备品备件,保养需要
-            partJson: [
-              //   {
-              //     code: '', // 备品备件code
-              //     name: '', // 备品备件name
-              //     model: '', // 备品备件型号
-              //     num: '', // 所需数量
-              //     unit: '', // 单位
-              //     amount: '', // 费用
-              //   }
-            ],
+            partJson: [],
             totalCost:0
           }
         ]
@@ -633,18 +573,15 @@ export default {
     // 设备分类选择
     async handleEquipmentClassChange (item) {
       this.clickedTreeNode = true
-      this.addForm.bizTypeName = item.name
       this.equipmentInfo = {}
       this._getEquipmentList(item.id)
     },
     // 封装 - 获取设备分类列表
     async _getEquipmentList (val) {
-      const params = { page: 1, size: 99999 }
-      const data = { classificationId: parseInt(val)}
+      const params = { pageNum: 1,size: -1, categoryId: val, rootCategoryLevelId: this.rootId }
       try {
-        const res = await getAssetsList(params, data)
-        // console.log('设备列表:', res)
-        this.addForm.planRuleEquiList = res.data.records
+        const res = await getAssetList(params)
+        this.addForm.planRuleEquiList = res.list
         this.addForm.planRuleEquiList.map(item=>{
             item.showName = item.name+'('+item.code+')'
         })
@@ -652,11 +589,9 @@ export default {
         const item = this.addForm.planRuleEquiList[0]
         const { equiLocation, equiLocationCode } = this.getEquiLocation(item)
         this.$nextTick(() => {
-          this.$refs.planRuleEquiList.setCurrentKey(item.id)
+          this.$refs.equiListTree.setCurrentKey(item.id)
           this.equipmentInfo = {
-            equiTypeId: this.addForm.bizTypeId,
-            equiTypeName: this.addForm.bizTypeName,
-            // equiCode: item.equCode,
+            equiTypeId: this.addForm.categoryId,
             equiCode: item.code,
             equiName: item.name,
             equiModel: item.specifications,
@@ -680,63 +615,87 @@ export default {
     // 获取审核人列表、巡点检人员
     async getUserList (params) {
       try {
-        let data = { status: 1, page: 1, size: 999999 }
+        let data = {  pageNum: 1 ,size:-1 }
         // 如果传了参数就是获取巡点检人员数据
         if (params) {
           data = Object.assign(data, params)
         }
-        const res = await user.list(data)
+        const res = await getUserPage(data)
         if (params) {
-          this.executorList = res.data.items
+          this.executorList = res.list
         } else {
-          this.uerList = res.data.items
+          this.uerList = res.list
         }
       } catch (error) {}
     },
     // 获取部门列表数据
     async getDeptList () {
       try {
-        let tree = await dept.tree()
-        this.deptList = tree.data
+        let list = await listOrganizations()
+        this.deptData = this.$util.toTreeData({
+			  data: list,
+			  idField: 'id',
+			  parentIdField: 'parentId'
+        });
       } catch (error) {}
     },
     //选择部门(搜索)
     searchDeptNodeClick (info) {
       if (info) {
-        this.addForm.executorDeptCode = info.code
-        this.addForm.executorDeptName = info.name
         // 根据部门获取人员
-        const params = { deptCode: info.code, status: 1 }
+        const params = { groupId: info }
         this.getUserList(params)
       } else {
-        this.addForm.executorDeptCode = null
+        this.addForm.groupId = null
       }
     },
+	
+	// 获取设备分类树
+	async getClassifyTree(){
+		const res = await getTreeByType(1)
+		this.classifyTree = res.data
+		this.rootId = res.data[0].id
+	},
+	
+	// 分类树的选择
+	chooseClassify(val){
+		this.categoryEquipment(val)
+	},
+	
+	// 获取设备分类数据
+	async categoryEquipment(id){
+		const params = {categoryLevelId:id,pageNum:1,size:-1}
+		const data = await getCategory(params)
+		this.equipmentList = data.list
+	},
+	
+	// 获取计划配置单号
+	async getOrderCode () {
+	  const data = await getCode('patrolconfig_code');
+	  this.$set(this.formData, 'code', data);
+	}, 
+	
     // 封装 - 获取设备位置名称和code方法
     getEquiLocation(data) {
       // 设备位置名称
-      const positionWorkshop = data.positionWorkshop ? data.positionWorkshop + '-' : ''
-      const positionFarm = data.positionFarm ? data.positionFarm + '-' : ''
-      const positionLine = data.positionLine ? data.positionLine + '-' : ''
-      const positionFactory = data.positionFactory ? data.positionFactory : ''
-      const equiLocation = positionWorkshop + positionFarm + positionLine + positionFactory
+      const path = data.position[0].path
+	  const arry = []
+	  path.map(item=>{
+		  arry.push(item.name)
+	  })	  
+      const equiLocation = arry.join('/')
       // 设备位置编码
-      const positionWorkshopCode = data.positionWorkshopCode ? data.positionWorkshopCode + '-' : ''
-      const positionFarmCode = data.positionFarmCode ? data.positionFarmCode + '-' : ''
-      const positionLineCode = data.positionLineCode ? data.positionLineCode + '-' : ''
-      const positionFactoryCode = data.positionFactoryCode ? data.positionFactoryCode : ''
-      const equiLocationCode = positionWorkshopCode + positionFarmCode + positionLineCode + positionFactoryCode
+      const equiLocationCode = data.position[0].pathIds
       return { equiLocation, equiLocationCode }
     },
     // 设备列表树点击
     handleNodeClick (data, node) {
-      // console.log(data)
       const { equiLocation, equiLocationCode } = this.getEquiLocation(data)
       this.equipmentInfo = {
         equiCode: data.code,
         equiName: data.name,
         equiId: data.id,
-        equiModel: data.modelType,
+        equiModel: data.category.modelType,
         equiLocation: equiLocation,
         equiLocationCode: equiLocationCode
       }
@@ -752,16 +711,16 @@ export default {
     async _getRuleNameList () {
       if(this.dialogTitle==='新增保养计划配置'||this.dialogTitle==='编辑保养计划配置'){
           // console.log('保养计划')
-          const res = await getRuleNameList({ruleTypeEm:'MAINTAIN'})
-          if (res?.success) {
-            this.ruleNameList = res.data || []
+          const res = await getRule({type:2,pageNum:1,size:-1})
+          if (res.list) {
+            this.ruleNameList = res.list || []
           }
       }
       if (this.dialogTitle==='新增巡点检计划配置'||this.dialogTitle==='编辑巡点检计划配置'){
           console.log('巡点检计划')
-          const res = await getRuleNameList({ruleTypeEm:'PATROL'})
-          if (res?.success) {
-            this.ruleNameList = res.data || []
+          const res = await getRule({type:1,pageNum:1,size:-1})
+          if (res.list) {
+            this.ruleNameList = res.list || []
           }
       }
     },
@@ -770,55 +729,31 @@ export default {
       this._getMatterRulesDetails(val)
     },
     // 封装 - 获取规则下面的详情数据及事项
-    async _getMatterRulesDetails (val) {
-      const res = await contentConfig.getInfoNew(val)
-      if (res.success) {
-        this.matterRulesList = res.data.ruleDetailList
-        // console.log('事项规则:', this.matterRulesList)
-      }
+    async _getMatterRulesDetails (val) {		
+      const res = await getDetail(val)
+       this.matterRulesList = res.ruleItems
     },
 
     // 从事项弹窗将数据丢到事项配置
-    ruleItemSelectionSubmit (list) {
-      if (
-        !this.addForm.planRuleEquiList[this.currentEquItemIndex]['itemJson']
-      ) {
-        this.addForm.planRuleEquiList[this.currentEquItemIndex]['itemJson'] = []
-      }
-      this.addForm.planRuleEquiList[this.currentEquItemIndex]['itemJson'] =
-        list.map(item => {
-          return {
-            id: item.id,
-            name: item.name,
-            content: item.content,
-            norm: item.norm
-          }
-        })
-      this.$forceUpdate()
-    },
-    // 添加操作事项
-    addOperationItems () {
-      if (!this.clickedTreeNode) {
-        return this.$message.warning('请选择设备分类!')
-      }
-      if (!this.addForm.ruleId) {
-        return this.$message.warning('请选择规则名称!')
-      }
-      this.$refs.ruleItemSelectionRef.open()
-      if (this.addForm.planRuleEquiList[this.currentEquItemIndex]['itemJson']) {
-        this.selectedMatter =
-          this.addForm.planRuleEquiList[this.currentEquItemIndex]['itemJson']
-      } else {
-        this.selectedMatter = []
-      }
-    },
+    // ruleItemSelectionSubmit (list) {
+    //   if (
+    //     !this.addForm.planRuleEquiList[this.currentEquItemIndex]['itemJson']
+    //   ) {
+    //     this.addForm.planRuleEquiList[this.currentEquItemIndex]['itemJson'] = []
+    //   }
+    //   this.addForm.planRuleEquiList[this.currentEquItemIndex]['itemJson'] =
+    //     list.map(item => {
+    //       return {
+    //         id: item.id,
+    //         name: item.name,
+    //         content: item.content,
+    //         norm: item.norm
+    //       }
+    //     })
+    //   this.$forceUpdate()
+    // },
+
 
-    // 删除操作事项
-    handleDeleteOperationItem (index) {
-      this.addForm.planRuleEquiList[this.currentEquItemIndex][
-        'itemJson'
-      ].splice(index, 1)
-    },
 
     // 添加备品备件
     addSpareItems () {
@@ -895,49 +830,45 @@ export default {
       this.$refs.addFormRef.validate(async valid => {
         if (valid) {
           try {
-			// this.addForm.planRuleEquiList =
-            //          this.addForm.planRuleEquiList.filter(item => item.itemJson)
-            this.addForm.planRuleEquiList = this.addForm.planRuleEquiList.map(
-              item => {
-                return {
-                  equiTypeId: this.addForm.bizTypeId,
-                  equiTypeName: this.addForm.bizTypeName,
-                  equiCode: item.code,
-                  equiName: item.name,
-                  equiId: item.id,
-                  equiModel: item.modelType,
-                  equiLocation: item.equiLocation,
-                  equiLocationCode: item.equiLocationCode,
-                  itemJson: item.itemJson?item.itemJson:[],
-                  partJson: item.partJson?item.partJson:[],
-                }
-              }
-            )
-              if (this.addForm.planRuleType instanceof Object) {
-                this.addForm.planRuleType =
-                  this.planRuleTypeObj[this.addForm.planRuleType.code]
-              }
-              if(this.addForm.planRuleEquiList.length==0){
-                 this.$message.info('请添加操作事项')
-                  return
-              }
-              let arr = []
-              this.addForm.planRuleEquiList.map((item)=>{
-                  if(item.itemJson.length||item.partJson.length){
-                    arr.push(item)
-                  }
-              })
-              this.addForm.planRuleEquiList = arr
-              let newArr = JSON.parse(JSON.stringify(this.addForm.planRuleEquiList))
-              for (let i = 0; i < newArr.length; i++) {
-                  for (let j = 0; j < newArr[i].partJson.length; j++) {
-                      // delete newArr[i].partJson[j].createTime
-                      // delete newArr[i].partJson[j].id
-                      newArr[i].partJson[j].equipmentCode = newArr[i].equiCode
-                  }
-              }
-              this.addForm.planRuleEquiList = newArr
-              const res = await planRules.handleSaveOrUpdate(this.addForm)
+		    const selectList = this.$refs.equiListTree.getCheckedNodes();
+			console.log('selectList',selectList)
+			this.addForm.deviceInfo = selectList.map(
+			  item => {
+			    return {
+			      substanceName: item.name,
+			      substanceId: item.id,
+			      sparePart: item.partJson?item.partJson:[],
+			    }
+			  }
+			)
+            // this.addForm.planRuleEquiList = this.addForm.planRuleEquiList.map(
+            //   item => {
+            //     return {
+            //       substanceName: item.name,
+            //       substanceId: item.id,
+            //       sparePart: item.partJson?item.partJson:[],
+            //     }
+            //   }
+            // )
+      //         if (this.addForm.planRuleType instanceof Object) {
+      //           this.addForm.planRuleType =
+      //             this.planRuleTypeObj[this.addForm.planRuleType.code]
+      //         }
+      //         let arr = []
+      //         this.addForm.planRuleEquiList.map((item)=>{
+				  // if(item.partJson.length){
+				  //   arr.push(item)
+				  // }
+      //         })
+      //         this.addForm.planRuleEquiList = arr
+      //         let newArr = JSON.parse(JSON.stringify(this.addForm.planRuleEquiList))
+      //         for (let i = 0; i < newArr.length; i++) {
+      //             for (let j = 0; j < newArr[i].partJson.length; j++) {
+      //                 newArr[i].partJson[j].equipmentCode = newArr[i].equiCode
+      //             }
+      //         }
+      //         this.addForm.planRuleEquiList = newArr
+              const res = await saveOrUpdate(this.addForm)
               if (res.success) {
                 const type = this.dialogTitle.includes('新增') ? '新增' : '编辑'
                 this.handleClose()
@@ -969,8 +900,8 @@ export default {
     border: 1px solid #797979;
     margin-right: 5px;
     .equipment_list_title {
-      height: 24px;
-      line-height: 24px;
+      height: 34px;
+      line-height: 34px;
       text-align: center;
       background-color: #d7d7d7;
       color: #000;
@@ -1000,8 +931,8 @@ export default {
       border: 1px solid #ddd;
       .item_info {
         width: 33%;
-        height: 24px;
-        line-height: 24px;
+        height: 34px;
+        line-height: 34px;
         display: flex;
         .item_label {
           width: 90px;

+ 1 - 1
src/views/rulesManagement/planRules/InventoryConfig/index.vue

@@ -175,7 +175,7 @@
 		  {
 		    columnKey: 'action',
 		    label: '操作',
-		    width: 230,
+		    width: 150,
 		    align: 'center',
 		    resizable: false,
 		    slot: 'action',

+ 1 - 1
src/views/rulesManagement/planRules/MaintainConfig/index.vue

@@ -167,7 +167,7 @@
 		  {
 		    columnKey: 'action',
 		    label: '操作',
-		    width: 230,
+		    width: 150,
 		    align: 'center',
 		    resizable: false,
 		    slot: 'action',

+ 1 - 1
src/views/rulesManagement/planRules/PatrolConfig/index.vue

@@ -167,7 +167,7 @@
 		  {
 		    columnKey: 'action',
 		    label: '操作',
-		    width: 230,
+		    width: 150,
 		    align: 'center',
 		    resizable: false,
 		    slot: 'action',