Преглед изворни кода

Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-eam into dev

quwangxin пре 3 година
родитељ
комит
df936b834f

+ 15 - 11
src/components/addPatrolConfigDialog/index.vue

@@ -496,8 +496,8 @@ export default {
     handleClose () {
       this.addPatrolConfigDialog = false
       this.$refs.addFormRef.resetFields()
-      if (this.$refs.searchTree) {
-        this.$refs.searchTree.clearHandle()
+      if (this.$refs.equiListTree) {
+        this.$refs.equiListTree.setCheckedKeys([]);
       }
       this.currentEquItemIndex = 0
       this.equipmentInfo = {}
@@ -552,14 +552,17 @@ export default {
           this.planRuleEquiList[0]['equiLocationCode'] = equiLocationCode
 		  
 		  // 对比详情返回的数据和设备分类下面所有的设备列表,将sparePart同步过去
-		  for (let i = 0; i < this.planRuleEquiList.length; i++) {
-		    for (let j = 0; j < this.addForm.deviceInfo.length; j++) {
-		      if ( this.planRuleEquiList[i].code === this.addForm.deviceInfo[j].substanceCode ) {
-		        this.planRuleEquiList[i]['sparePart'] = this.addForm.deviceInfo[j]['sparePart']
-		        break
-		      }
-		    }
+		  if(this.addForm.deviceInfo){
+			  for (let i = 0; i < this.planRuleEquiList.length; i++) {
+			    for (let j = 0; j < this.addForm.deviceInfo.length; j++) {
+			      if ( this.planRuleEquiList[i].code === this.addForm.deviceInfo[j].substanceCode ) {
+			        this.planRuleEquiList[i]['sparePart'] = this.addForm.deviceInfo[j]['sparePart']
+			  		// this.planRuleEquiList[i]['totalCost'] = this.addForm.deviceInfo[j]['totalCost']
+			      }
+			    }
+			  }
 		  }
+	
         })
       } catch (error) {
         this.planRuleEquiList = []
@@ -736,7 +739,7 @@ export default {
         let applayList = this.planRuleEquiList[this.currentEquItemIndex].sparePart
         let total = 0
         applayList.map(item=>{
-           if(item.hasOwnProperty('num')&&item.num!=''){
+           if(item.num&&item.num!=''){
               switch (item.univalenceUnit) {
                 case 'wanyuan': {
                   item.chengs = 10000
@@ -770,7 +773,8 @@ export default {
 			      sparePart: item.sparePart?item.sparePart:[],
 				  substanceCode: item.code,
 				  mode: item.category.modelType,
-				  position: equiLocation
+				  position: equiLocation,
+				  totalCost:item.totalCost
 			    }
 			  }
 			)

+ 41 - 40
src/views/rulesManagement/planRules/MaintainConfig/detail.vue

@@ -1,9 +1,5 @@
 <template>
   <div class="maintain_config_detail" v-loading="detailsLoading">
-<!--    <div class="detail_title">
-      <span>详情</span>
-      <el-button size="small" @click="$router.go(-1)">关闭</el-button>
-    </div> -->
     <div class="main_content">
       <!-- 基本信息 -->
       <div class="base_info">
@@ -11,15 +7,15 @@
         <el-row class="base_info_content">
           <el-col :span="6">
             <span>计划单号:</span>
-            <span>{{ detailsForm.planRuleCode }}</span>
+            <span>{{ detailsForm.code }}</span>
           </el-col>
           <el-col :span="6">
             <span>保养名称:</span>
-            <span>{{ detailsForm.planRuleName }}</span>
+            <span>{{ detailsForm.name }}</span>
           </el-col>
           <el-col :span="6">
             <span>保养部门:</span>
-            <span>{{ detailsForm.executorDeptName }}</span>
+            <span>{{ detailsForm.groupName }}</span>
           </el-col>
           <el-col :span="6">
             <span>保养人员:</span>
@@ -31,23 +27,27 @@
           </el-col>
           <el-col :span="6">
             <span>设备分类:</span>
-            <span>{{ detailsForm.equiTypeName }}</span>
+            <span>{{ detailsForm.categoryName }}</span>
           </el-col>
           <el-col :span="6">
             <span>规则名称:</span>
             <span>{{ detailsForm.ruleName }}</span>
           </el-col>
-          <el-col :span="6">
+<!--          <el-col :span="6">
             <span>创建部门:</span>
             <span>{{ detailsForm.createOrgName }}</span>
-          </el-col>
+          </el-col> -->
           <el-col :span="6">
             <span>创建人:</span>
             <span>{{ detailsForm.createUserName }}</span>
           </el-col>
+		  <el-col :span="6">
+		    <span>创建时间:</span>
+		    <span>{{ detailsForm.createTime }}</span>
+		  </el-col>
           <el-col :span="6">
             <span>审核人:</span>
-            <span>{{ detailsForm.verifyUserName }}</span>
+            <span>{{ detailsForm.approvalUserName }}</span>
           </el-col>
           <el-col :span="24">
             <span>备注:</span>
@@ -61,30 +61,30 @@
         <div class="maintain_equipment_info_content">
           <div
             class="equipment_item"
-            v-for="item in detailsForm.planRuleEquiList"
+            v-for="item in detailsForm.deviceInfo"
             :key="item.id"
           >
             <div class="equipment_info">
               <div class="item_info">
                 <span class="item_label">设备编码</span>
-                <span class="item_value">{{ item.equiCode }}</span>
+                <span class="item_value">{{ item.substanceCode }}</span>
               </div>
               <div class="item_info">
                 <span class="item_label">设备名称</span>
-                <span class="item_value">{{ item.equiName }}</span>
+                <span class="item_value">{{ item.substanceName }}</span>
               </div>
               <div class="item_info">
                 <span class="item_label">设备型号</span>
-                <span class="item_value">{{ item.equiModel }}</span>
+                <span class="item_value">{{ item.mode }}</span>
               </div>
               <div class="item_info">
                 <span class="item_label">设备位置</span>
-                <span class="item_value">{{ item.equiLocation }}</span>
+                <span class="item_value">{{ item.position }}</span>
               </div>
             </div>
             <p>操作事项</p>
             <div class="matter_info">
-              <el-table :data="item.itemJson" border>
+              <el-table :data="matterRulesList" border>
                 <el-table-column label="序号" align="center" width="80">
                   <template slot-scope="scope">
                     <span>{{ scope.$index + 1 }}</span>
@@ -97,7 +97,7 @@
             </div>
             <p>备品备件</p>
             <div class="matter_info">
-              <el-table :data="item.partJson" border>
+              <el-table :data="item.sparePart" border>
                 <el-table-column label="序号" align="center" width="80">
                   <template slot-scope="scope">
                     <span>{{ scope.$index + 1 }}</span>
@@ -109,11 +109,7 @@
                 </el-table-column>
                 <el-table-column label="所需数量" align="center" prop="num">
                 </el-table-column>
-                <el-table-column label="单位" align="center" prop="unit">
-                   <template slot-scope="scope">
-                      <div v-if="scope.row.unit=='wanyuan'">万元</div>
-                      <div v-if="scope.row.unit=='yuan'">元</div>
-                   </template>
+                <el-table-column label="单位" align="center" prop="measuringUnit">
                 </el-table-column>
               </el-table>
             </div>
@@ -125,44 +121,49 @@
 </template>
 
 <script>
-// import planRules from '@/api/planRules/patrolConfig'
-import { mapGetters } from 'vuex'
+  import { getInfoById } from '@/api/ruleManagement/plan';
+  import {  getDetail } from '@/api/ruleManagement/matter';
 
 export default {
   name: 'maintainConfigDetail',
   data () {
     return {
       detailsLoading: false,
-      detailsForm: {}
+      detailsForm: {},
+      matterRulesList:[]
     }
   },
   computed: {
-    ...mapGetters(['equipmentList', 'ruleNameList'])
+    
   },
   mounted () {
-    // this.getDetailsData(this.$route.query.id)
+    this.getDetailsData(this.$route.query.id)
   },
   methods: {
     // 获取详情数据
-    getDetailsData (id) {
+    async getDetailsData (id) {
       this.detailsLoading = true
-      planRules
-        .getPlanRulesDetails(id)
+      getInfoById(id)
         .then(res => {
-          console.log('res.data',res.data)
           this.detailsLoading = false
-          this.detailsForm = res.data
-          this.detailsForm['equiTypeName'] = this.equipmentList.filter(item => item.id == this.detailsForm.bizTypeId)[0].name
-          this.detailsForm['ruleName'] = this.ruleNameList.filter(item => item.id == this.detailsForm.ruleId)[0].name
-          this.detailsForm.planRuleEquiList =
-            this.detailsForm.planRuleEquiList.filter(
-              item => item.itemJson != null
-            )
+          this.detailsForm = res
+    		let arr = []
+    		res.execute.map(item=>{
+    			 arr.push(item.userName)
+    		})
+    		 this.$set(this.detailsForm,'executorName',arr.join(','))
+    		 this._getMatterRulesDetails(res.ruleId)
         })
         .catch(() => {
           this.detailsLoading = false
         })
-    }
+    },
+    
+    // 封装 - 获取规则下面的详情数据及事项
+    async _getMatterRulesDetails (val) {		
+      const res = await getDetail(val)
+       this.matterRulesList = res.ruleItems
+    },
   }
 }
 </script>

+ 13 - 5
src/views/rulesManagement/planRules/MaintainConfig/index.vue

@@ -57,6 +57,7 @@
       ref="addPatrolConfigDialogRef"
       :dialogTitle="dialogTitle"
       :isBindPlan="isBindPlan"
+	  @done="reload"
     />
   </div>
 </template>
@@ -205,14 +206,21 @@
 			this.$refs.addPatrolConfigDialogRef.init(row,'保养')
 	  },
 	  
-	  goDetail(){
+	  goDetail({id}){
 		  this.$router.push({
 		    path: '/rulesManagement/planRules/MaintainConfig/detail',
-		    // query: {
-		    //   id
-		    // }
+		    query: {
+		      id
+		    }
 		  })
-	  }
+	  },
+	  
+	  remove(row){
+	    removeRule([row.id]).then(res=>{
+	  	  this.$message.success('删除成功!')
+	  	  this.reload()
+	    })
+	  },
 	  
     }
   };

+ 1 - 5
src/views/rulesManagement/planRules/PatrolConfig/detail.vue

@@ -1,9 +1,5 @@
 <template>
   <div class="patrol_config_detail" v-loading="detailsLoading">
-<!--    <div class="detail_title">
-      <span>详情</span>
-      <el-button size="small" @click="$router.go(-1)">关闭</el-button>
-    </div> -->
     <div class="main_content">
       <!-- 基本信息 -->
       <div class="base_info">
@@ -115,7 +111,7 @@ export default {
     return {
       detailsLoading: false,
       detailsForm: {},
-	  matterRulesList:[]
+	    matterRulesList:[]
     }
   },
   mounted () {

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

@@ -188,17 +188,7 @@
       datasource({ page, limit, where, order }) {
         return planConfigPage({ pageNum: page, size: limit, ...where , ruleType:1 });
       },
-      async changeEnable(row) {
-        const res = await putRoles(row);
-        if (res.code == 0) {
-          this.$message({
-            type: 'success',
-            message: '修改成功',
-            customClass: 'ele-message-border'
-          });
-          this.reload();
-        }
-      },
+
       /* 刷新表格 */
       reload(where) {
         this.$refs.table.reload({ page: 1, where , ruleType:1 });