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

完成设备资源管理中详细配置功能

oyq28 3 лет назад
Родитель
Сommit
002cc9f4fe

+ 10 - 0
imcs-ui/src/api/resourceProductMgr/productionResourcesMgr.js

@@ -25,6 +25,10 @@ const apiList = {
     method: 'POST',
     url: `/authority/productionresource/update`
   },
+  updateConf: {
+    method: 'POST',
+    url: `/authority/productionresource/updateConf`
+  },
   remove: {
     method: 'DELETE',
     url: `/authority/productionresource`
@@ -70,6 +74,12 @@ export default {
       data
     })
   },
+  updateConf (data) {
+    return axiosApi({
+      ...apiList.updateConf,
+      data
+    })
+  },
   remove (data) {
     return axiosApi({
       ...apiList.remove,

+ 8 - 0
imcs-ui/src/lang/zh/resource.js

@@ -120,6 +120,14 @@ export default {
 				name: '设备名称',
 				brand: '品牌',
 				specification: '规格',
+				capitalNo: '资产编号',
+			    capitalName: '资产名称',
+				capitalType: '资产类别',
+			    modeSpecification: '型号规格',
+				capitalPrice: '资产原值',
+				productionDate: '出厂年月', 
+				productionNo: '出厂编号',
+				manufacturer: '制造厂家',				
 				model: '型号',
 				category: '分类',
 				zoneName: '所属区域',

+ 44 - 20
imcs-ui/src/views/zuihou/resourceProductMgr/resourcesMgr/Index.vue

@@ -65,8 +65,18 @@
       <el-table-column prop="name" :label='$t("resource.table.resours.name")' :show-overflow-tooltip="true" width="180px"></el-table-column>
       <el-table-column prop="code" :label='$t("resource.table.resours.no")' :show-overflow-tooltip="true" width="100px"></el-table-column>
       <el-table-column prop="brand" :label='$t("resource.table.resours.brand")' width="100px"></el-table-column>
-      <el-table-column prop="specification" :label='$t("resource.table.resours.specification")' width="180px"></el-table-column>
-      <el-table-column prop="model" :label='$t("resource.table.resours.model")'></el-table-column>
+      <el-table-column prop="specification" :label='$t("resource.table.resours.specification")'></el-table-column>
+      
+	  <el-table-column prop="capitalNo" :label='$t("resource.table.resours.capitalNo")'></el-table-column>
+	  <el-table-column prop="capitalName" :label='$t("resource.table.resours.capitalName")'></el-table-column>
+	  <el-table-column prop="capitalType" :label='$t("resource.table.resours.capitalType")'></el-table-column>
+	  <el-table-column prop="modeSpecification" :label='$t("resource.table.resours.modeSpecification")'></el-table-column>
+	  <el-table-column prop="capitalPrice" :label='$t("resource.table.resours.capitalPrice")'></el-table-column>
+	  <el-table-column prop="productionDate" :label='$t("resource.table.resours.productionDate")'></el-table-column>
+      <el-table-column prop="productionNo" :label='$t("resource.table.resours.productionNo")'></el-table-column>
+	  <el-table-column prop="manufacturer" :label='$t("resource.table.resours.manufacturer")'></el-table-column>
+   
+	  <el-table-column prop="model" :label='$t("resource.table.resours.model")'></el-table-column>
       <el-table-column prop="category.data" :label='$t("resource.table.resours.category")' width="100px"></el-table-column>
       <el-table-column prop="zoneName" :label='$t("resource.table.resours.zoneName")' width="180px"></el-table-column>
       <el-table-column prop="positionCount" :label='$t("resource.table.resours.nums")' width="120px"></el-table-column>
@@ -97,7 +107,7 @@
         fixed="right"
         align="center"
         column-key="operation"
-        width="150px"
+        width="180px"
       >
         <template slot-scope="{ row }">
         	<!--<el-tooltip class="item" content="查看详情" effect="dark" placement="top-start">
@@ -135,13 +145,13 @@
 	            @click="autoCode(row)"
 	          />
           </el-tooltip>
-          <!--<el-tooltip class="item" :content='$t("common.delete")' effect="dark" placement="top-start">
+          <el-tooltip class="item" content='详情配置' effect="dark" placement="top-start">
 	          <i
-	            class="el-icon-delete table-operation"
+	            class="el-icon-guide table-operation"
 	            style="color: #f50;"
-	            @click="singleDelete(row)"
+	            @click="detailConf(row)"
 	          />
-          </el-tooltip>-->
+          </el-tooltip>
         </template>
       </el-table-column>
     </el-table>
@@ -172,14 +182,14 @@
       @close="editHardwareClose"
       @success="editHardwareSuccess"
     />
-	<!-- 设备自动化节点配置 
-    <autoCode
-      ref="autoCode"
-      :dialog-visible="dialogAutoCode.isVisible"
-      :title="dialogAutoCode.title"
-      @close="editAutoCodeClose"
-      @success="editAutoCodeSuccess"
-    /> -->
+	<!-- 生产资源资料  -->
+    <detailConf
+      ref="detailConf"
+      :dialog-visible="dialogDetailConf.isVisible"
+      :title="dialogDetailConf.title"
+      @close="editDetailConfClose"
+      @success="editDetailConfSuccess"
+    />
 	
 	<el-dialog
 		  :title='$t("resource.buttons.autoCode")'
@@ -191,7 +201,6 @@
 		<autoCode :rowData="rowData" @close="editAutoCodeClose" @success="editAutoCodeSuccess" />
 
 	</el-dialog>
-	
 
     <!-- 详情 -->
     <tenant-view
@@ -233,6 +242,7 @@
 	// 【硬件配置】
 	import Hardware from "./components/Hardware"
 	import AutoCode from "./components/AutoCode"
+	import DetailConf from "./components/DetailConf"
 	import TenantView from "./components/View"
 	// 【设备管理】-API
 	import equipmentMgrApi from "@/api/resourceProductMgr/equipmentMgr"
@@ -244,14 +254,14 @@
 	export default {
 	  name: "ResourcesMgr",
 	  directives: { elDragDialog },
-	  components: { Pagination, TenantEdit, Hardware, AutoCode, TenantView, equipmentMgrApi, equipmentPosition },
+	  components: { Pagination, TenantEdit, Hardware, AutoCode, TenantView, DetailConf, equipmentMgrApi, equipmentPosition },
 	  props: {
 	  },
 	  data () {
 	    return {
 	    	currentRow: null, // 当前选中的行数据
 	    	equipmentVisible: false, // 设备管理
-			autoCodeVisible:false,  //节点配置
+			autoCodeVisible:false,  //节点配置			
 	    	rowData: {}, // row数据,
 	    	audioStatus: [],
 	      dialog: {
@@ -261,6 +271,10 @@
 	      dialogHardware: {
 	        isVisible: false,
 	        title: ""
+	      },
+		  dialogDetailConf: {
+	        isVisible: false,
+	        title: ""
 	      },		  
 	      preview: {
 	        isVisible: false,
@@ -298,7 +312,7 @@
 	    },
 	    nationList() {
         return convertEnum(this.dicts.NATION)
-      }
+        }
 	  },
 	  mounted () {
 
@@ -334,7 +348,11 @@
 	    editSuccess () {
 	      this.search()
 	    },
-
+		detailConf(row){
+			this.$refs.detailConf.type = 'edit'
+			this.$refs.detailConf.setTenant(row, this.dicts)
+            this.dialogDetailConf.isVisible = true
+		},
 	    // 【硬件配置】-确定
 	    editHardwareSuccess(){
 	    	this.search()
@@ -348,6 +366,12 @@
 	    },
 		editAutoCodeSuccess(){
 	    	this.search()
+	    },
+		editDetailConfClose (){
+	    	this.dialogDetailConf.isVisible = false
+	    },
+		editDetailConfSuccess(){
+	    	this.search()
 	    },
 	    onSelectChange (selection) {
 	      this.selection = selection

+ 229 - 0
imcs-ui/src/views/zuihou/resourceProductMgr/resourcesMgr/components/DetailConf.vue

@@ -0,0 +1,229 @@
+<template>
+  <el-dialog 
+  	:close-on-click-modal="false" 
+  	:close-on-press-escape="false" 
+  	:title="title" 
+  	:append-to-body="true"
+  	:visible.sync="isVisible" 
+  	:width="width" 
+  	top="50px"
+  >
+    <el-form ref="form" :model="tenant" :rules="rules" label-position="right" label-width="130px">
+      <el-form-item label='资产编号:' prop="capitalNo">
+          <el-input v-model="tenant.capitalNo" :placeholder='$t("common.pleaseEnter")'/>
+      </el-form-item>
+      <el-form-item label='资产名称:' prop="capitalName">
+          <el-input v-model="tenant.capitalName" :placeholder='$t("common.pleaseEnter")'/>
+      </el-form-item>
+      <el-form-item label='资产类别:' prop="capitalType">
+          <el-input v-model="tenant.capitalType" :placeholder='$t("common.pleaseEnter")'/>
+      </el-form-item>
+      <el-form-item label='型号规格:' prop="modeSpecification">
+          <el-input v-model="tenant.modeSpecification" :placeholder='$t("common.pleaseEnter")'/>
+      </el-form-item>
+      <el-form-item label='资产原值:' prop="capitalPrice">
+          <el-input v-model="tenant.capitalPrice" :placeholder='$t("common.pleaseEnter")'/>
+      </el-form-item>
+      <el-form-item label='出厂年月:' prop="productionDate">
+          <el-input v-model="tenant.productionDate" :placeholder='$t("common.pleaseEnter")'/>
+      </el-form-item>
+      <el-form-item label='出厂编号:' prop="productionNo">
+          <el-input v-model="tenant.productionNo" :placeholder='$t("common.pleaseEnter")'/>
+      </el-form-item>
+      <el-form-item label='制造厂家:' prop="manufacturer">
+          <el-input v-model="tenant.manufacturer" :placeholder='$t("common.pleaseEnter")'/>
+      </el-form-item>      
+    </el-form>
+    <div slot="footer" class="dialog-footer">
+      <el-button plain type="warning" @click="isVisible = false">{{ $t('common.cancel') }}</el-button>
+      <el-button plain type="primary" :disabled="confirmDisabled" @click="submitForm">{{ $t('common.confirm') }}</el-button>
+    </div>
+  </el-dialog>
+</template>
+<script>
+// 【区域管理】-API
+import productionResourcesMgrApi from "@/api/resourceProductMgr/productionResourcesMgr"
+import merge from 'deepmerge'
+
+export default {
+  name: 'DetailConf',
+  props: {
+    dialogVisible: {
+      type: Boolean,
+      default: false
+    },
+    title: {
+      type: String,
+      default: ''
+    }
+  },
+  data () {
+    return {
+      type: 'add',
+      tenant: this.initTenant(),
+      screenWidth: 0,
+      width: this.initWidth(),
+      confirmDisabled: false,
+      dicts:{
+        NATION: {}
+      },
+      roles: [],
+      rules: {
+        name: [
+        	{ required: true, message: this.$t("rules.require"), trigger: 'blur' }
+        ]
+      }
+    }
+  },
+  computed: {
+    isVisible: {
+      get () {
+        return this.dialogVisible
+      },
+      set () {
+        this.close()
+        this.reset()
+      }
+    }
+  },
+  mounted () {
+    window.onresize = () => {
+      return (() => {
+        this.width = this.initWidth()
+      })()
+    }
+  },
+  methods: {
+    initTenant () {
+      return {
+        id: '',
+        tenantId: '',
+        capitalNo: '',
+        capitalName: '',
+        capitalType: '',
+        modeSpecification: '',
+        capitalPrice: '',
+        productionDate: '', 
+        productionNo: '',
+        manufacturer: '',    
+      }
+    },
+    initWidth () {
+      this.screenWidth = document.body.clientWidth
+      if (this.screenWidth < 991) {
+        return '90%'
+      } else if (this.screenWidth < 1400) {
+        return '45%'
+      } else {
+        return '800px'
+      }
+    },
+    setTenant (val, dict) {
+    	if(val){            
+            for( let key in this.tenant){
+                this.tenant[key] = val[key]
+            }
+            //this.tenant = {...val}           
+    	}
+      this.dict = dict
+    },
+    close () {
+      this.$emit('close')
+    },
+    reset () {
+      // 先清除校验,再清除表单,不然有奇怪的bug
+      this.$refs.form.clearValidate()
+      this.$refs.form.resetFields()
+      this.tenant = this.initTenant()
+    },
+    submitForm () {
+      this.$refs.form.validate((valid) => {
+        if (valid) {
+          this.confirmDisabled = true
+          if (this.type === 'add') {
+            this.save()
+          } else {
+            this.update()
+          }
+        } else {
+          return false
+        }
+      })
+    },
+    save () {      
+      productionResourcesMgrApi.save(this.tenant)
+        .then((response) => {
+          const res = response.data
+          if (res.isSuccess) {
+            this.isVisible = false
+            this.$message({
+              message: this.$t('tips.createSuccess'),
+              type: 'success'
+            })
+            // 通知列表
+	          this.$emit("success");
+	          // 通知列表-并关闭弹出框
+	          this.$emit("close");
+          }
+        }).finally(() => {
+          this.confirmDisabled = false
+          return true
+        })
+    },
+    update () {
+      this.tenant.ip = ''
+      this.tenant.port = ''  
+      console.log(this.tenant)
+      productionResourcesMgrApi.updateConf(this.tenant)
+        .then((response) => {
+          const res = response.data
+          if (res.isSuccess) {
+            this.isVisible = false
+            this.$message({
+              message: this.$t('tips.updateSuccess'),
+              type: 'success'
+            })
+            // 通知列表
+	          this.$emit("success");
+	          // 通知列表-并关闭弹出框
+	          this.$emit("close");
+          }
+        }).finally(() => {
+          this.confirmDisabled = false
+          return true
+        }) 
+    }
+
+  }
+}
+</script>
+<style lang="scss" >
+.avatar-uploader .el-upload {
+  border: 1px dashed #d9d9d9;
+  border-radius: 6px;
+  cursor: pointer;
+  position: relative;
+  overflow: hidden;
+}
+.avatar-uploader .el-upload:hover {
+  border-color: #409eff;
+}
+.avatar-uploader-icon {
+  font-size: 28px;
+  color: #8c939d;
+  width: 100px;
+  height: 100px;
+  line-height: 100px;
+  text-align: center;
+}
+.avatar {
+  width: 100px;
+  height: 100px;
+  display: block;
+}
+.checkUsed{
+	display: inline-block;
+	margin-left: 10px;
+	color: #1890ff;
+}
+</style>