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

实现设备业务动态节点功能配置

oyq28 пре 4 година
родитељ
комит
bd484ff6bb

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

@@ -13,6 +13,10 @@ const apiList = {
     method: 'POST',
     url: `/authority/productionresource/page`
   },
+  getBusinessList: {
+    method: 'POST',
+    url: `/authority/productionresource/getList`
+  },
   save: {
     method: 'POST',
     url: `/authority/productionresource`

+ 97 - 0
imcs-ui/src/api/resourceProductMgr/resourceAutoCode.js

@@ -0,0 +1,97 @@
+import axiosApi from '../AxiosApi.js'
+
+const apiList = {
+  getList: {
+    method: 'GET',
+    url: `/authority/resourceAutoCode/all`
+  },
+  getPid: {
+    method: 'GET',
+    url: `/authority/resourceAutoCode/getPid`
+  },
+  page: {
+    method: 'POST',
+    url: `/authority/resourceAutoCode/page`
+  },
+  update: {
+    method: 'POST',
+    url: `/authority/resourceAutoCode/update`
+  },
+  save: {
+    method: 'POST',
+    url: `/authority/resourceAutoCode`
+  },
+  updateStatus: {
+    method: 'POST',
+    url: `/authority/resourceAutoCode/status`
+  },
+  remove: {
+    method: 'DELETE',
+    url: `/authority/resourceAutoCode`
+  },
+  delete: {
+    method: 'POST',
+    url: `/authority/resourceAutoCode/delete`
+  },  
+  list: {
+    method: 'POST',
+    url: `/authority/resourceAutoCode/query`
+  }
+}
+
+export default {
+  getList (data) {
+    return axiosApi({
+      ...apiList.getList,
+      data
+    })
+  },
+  getPid (data) {
+    return axiosApi({
+      ...apiList.getPid,
+      data
+    })
+  },
+  page (data) {
+    return axiosApi({
+      ...apiList.page,
+      data
+    })
+  },
+  save (data) {
+    return axiosApi({
+      ...apiList.save,
+      data
+    })
+  },
+  update (data) {
+    return axiosApi({
+      ...apiList.update,
+      data
+    })
+  },
+  updateStatus (data) {
+    return axiosApi({
+      ...apiList.updateStatus,
+      data
+    })
+  },
+  remove (data) {
+    return axiosApi({
+      ...apiList.remove,
+      data
+    })
+  },
+  delete (data) {
+    return axiosApi({
+      ...apiList.delete,
+      data
+    })
+  },  
+  list (data) {
+    return axiosApi({
+      ...apiList.list,
+      data
+    })
+  }
+}

+ 87 - 0
imcs-ui/src/api/resourceProductMgr/resourceBusiness.js

@@ -0,0 +1,87 @@
+import axiosApi from '../AxiosApi.js'
+
+const apiList = {
+  getList: {
+    method: 'GET',
+    url: `/authority/resourceBusiness/all`
+  },
+  page: {
+    method: 'POST',
+    url: `/authority/resourceBusiness/page`
+  },
+  update: {
+    method: 'POST',
+    url: `/authority/resourceBusiness/update`
+  },
+  save: {
+    method: 'POST',
+    url: `/authority/resourceBusiness`
+  },
+  updateStatus: {
+    method: 'POST',
+    url: `/authority/resourceBusiness/status`
+  },
+  remove: {
+    method: 'DELETE',
+    url: `/authority/resourceBusiness`
+  },
+  delete: {
+    method: 'POST',
+    url: `/authority/resourceBusiness/delete`
+  },  
+  list: {
+    method: 'POST',
+    url: `/authority/resourceBusiness/query`
+  }
+}
+
+export default {
+	getList (data) {
+    return axiosApi({
+      ...apiList.getList,
+      data
+    })
+  },
+  page (data) {
+    return axiosApi({
+      ...apiList.page,
+      data
+    })
+  },
+  save (data) {
+    return axiosApi({
+      ...apiList.save,
+      data
+    })
+  },
+  update (data) {
+    return axiosApi({
+      ...apiList.update,
+      data
+    })
+  },
+  updateStatus (data) {
+    return axiosApi({
+      ...apiList.updateStatus,
+      data
+    })
+  },
+  remove (data) {
+    return axiosApi({
+      ...apiList.remove,
+      data
+    })
+  },
+  delete (data) {
+    return axiosApi({
+      ...apiList.delete,
+      data
+    })
+  },  
+  list (data) {
+    return axiosApi({
+      ...apiList.list,
+      data
+    })
+  }
+}

+ 2 - 1
imcs-ui/src/lang/zh/resource.js

@@ -76,7 +76,8 @@ export default {
 	  		tongbu: '同步刀具',
 	  		tongbEq: '同步到设备',
 	  		tongbSk: '同步数控程序',
-			mode:  '模式'
+			mode:  '模式',
+			autoCode: '设备业务自动化节点'
 	  	},
 	  	// 列表的cell名称
 		table: {

+ 1 - 1
imcs-ui/src/views/zuihou/resourceProductMgr/equipmentPosition/Index.vue

@@ -114,7 +114,7 @@
     <tenant-edit
       ref="edit"
       :dialog-visible="dialog.isVisible"
-      :title="dialog.title"add
+      :title="dialog.title"
       @close="editClose"
       @success="editSuccess"
     />

+ 49 - 6
imcs-ui/src/views/zuihou/resourceProductMgr/resourcesMgr/Index.vue

@@ -59,7 +59,7 @@
 					    :preview-src-list="row.srcList">
 					  </el-image>
 					</div>
-					<span v-else="">{{$t("common.noData")}}</span>
+					<span v-else>{{$t("common.noData")}}</span>
       	</template>
       </el-table-column>
       <el-table-column prop="name" :label='$t("resource.table.resours.name")' :show-overflow-tooltip="true" width="180px"></el-table-column>
@@ -97,7 +97,7 @@
         fixed="right"
         align="center"
         column-key="operation"
-        width="120px"
+        width="150px"
       >
         <template slot-scope="{ row }">
         	<!--<el-tooltip class="item" content="查看详情" effect="dark" placement="top-start">
@@ -127,6 +127,13 @@
 	            style="color: #2db7f5;"
 	            @click="editHardware(row)"
 	          />
+          </el-tooltip>
+		  <el-tooltip class="item" :content='$t("resource.buttons.autoCode")' effect="dark" placement="top-start">
+	          <i
+	            class="el-icon-place table-operation"
+	            style="color: #2db7f5;"
+	            @click="autoCode(row)"
+	          />
           </el-tooltip>
           <!--<el-tooltip class="item" :content='$t("common.delete")' effect="dark" placement="top-start">
 	          <i
@@ -165,6 +172,26 @@
       @close="editHardwareClose"
       @success="editHardwareSuccess"
     />
+	<!-- 设备自动化节点配置 
+    <autoCode
+      ref="autoCode"
+      :dialog-visible="dialogAutoCode.isVisible"
+      :title="dialogAutoCode.title"
+      @close="editAutoCodeClose"
+      @success="editAutoCodeSuccess"
+    /> -->
+	
+	<el-dialog
+		  :title='$t("resource.buttons.autoCode")'
+		  :visible.sync="autoCodeVisible"
+		  width="80%"
+		  custom-class="dialogNoTop"
+		>
+			<!--【设备自动化节点配置】 -->
+		<autoCode :rowData="rowData" @close="editAutoCodeClose" @success="editAutoCodeSuccess" />
+
+	</el-dialog>
+	
 
     <!-- 详情 -->
     <tenant-view
@@ -205,6 +232,7 @@
 	import TenantEdit from "./components/Edit"
 	// 【硬件配置】
 	import Hardware from "./components/Hardware"
+	import AutoCode from "./components/AutoCode"
 	import TenantView from "./components/View"
 	// 【设备管理】-API
 	import equipmentMgrApi from "@/api/resourceProductMgr/equipmentMgr"
@@ -216,14 +244,15 @@
 	export default {
 	  name: "ResourcesMgr",
 	  directives: { elDragDialog },
-	  components: { Pagination, TenantEdit, Hardware, TenantView, equipmentMgrApi, equipmentPosition },
+	  components: { Pagination, TenantEdit, Hardware, AutoCode, TenantView, equipmentMgrApi, equipmentPosition },
 	  props: {
 	  },
 	  data () {
 	    return {
 	    	currentRow: null, // 当前选中的行数据
 	    	equipmentVisible: false, // 设备管理
-	    	rowData: {}, // row数据
+			autoCodeVisible:false,  //节点配置
+	    	rowData: {}, // row数据,
 	    	audioStatus: [],
 	      dialog: {
 	        isVisible: false,
@@ -232,7 +261,7 @@
 	      dialogHardware: {
 	        isVisible: false,
 	        title: ""
-	      },
+	      },		  
 	      preview: {
 	        isVisible: false,
 	        context: ''
@@ -285,6 +314,11 @@
 	  		this.rowData = row
 	  		this.equipmentVisible = true
 	  	},
+		// 【节点配置】按钮-事件
+		autoCode(row){
+	  		this.rowData = row
+	  		this.autoCodeVisible = true
+	  	},
 	  	editEquipmentClose(){
 	  		this.equipmentVisible = false
 	  	},
@@ -305,10 +339,15 @@
 	    editHardwareSuccess(){
 	    	this.search()
 	    },
-
 	    // 【硬件配置】-取消
 	    editHardwareClose (){
 	    	this.dialogHardware.isVisible = false
+	    },
+		editAutoCodeClose (){
+	    	this.autoCodeVisible = false
+	    },
+		editAutoCodeSuccess(){
+	    	this.search()
 	    },
 	    onSelectChange (selection) {
 	      this.selection = selection
@@ -466,6 +505,10 @@
             })
 	    	}
 	    },
+		editAutoCode (row) {
+	    	//
+	    	this.dialogAutoCode.isVisible = true
+	    },
 
 	    fetch (params = {}) {
 	      this.loading = true

+ 356 - 0
imcs-ui/src/views/zuihou/resourceProductMgr/resourcesMgr/components/AutoCode.vue

@@ -0,0 +1,356 @@
+<template>
+  <div class="app-container">
+    
+    <!-- 功能按钮 -->
+    <el-row class="filter-container">
+    	<el-col>
+    	   <el-button type="primary" icon="el-icon-plus" size="medium" @click="add">{{ $t("common.add") }}</el-button>
+    	</el-col>
+    </el-row>
+
+		<!-- 列表数据 -->
+    <el-table
+      :key="tableKey"
+      ref="table"
+      v-loading="loading"
+      :data="tableData.records"
+      border
+      fit
+      row-key="id"
+      style="width: 100%;"
+      @selection-change="onSelectChange"
+      @cell-click="cellClick"
+    >
+      <el-table-column :label='$t("common.serialNo")' width="85px" align="center">
+	      <template slot-scope="scope">
+	        <div>
+	          {{scope.$index+(queryParams.current - 1) * queryParams.size + 1}}
+	        </div>
+	      </template>
+      </el-table-column>	  
+      <el-table-column prop="name" label='设备业务' align="center" width="300px"></el-table-column>  
+	  <el-table-column prop="isFinal" label='是否线终序' align="center" width="150px">
+		  <template slot-scope="{ row }">
+          <el-tag>
+          	{{ row.isFinal ? "是" : "否" }}
+          </el-tag>
+        </template>
+	  </el-table-column>    
+      <el-table-column prop="status" :label='$t("common.status.init")' align="center" width="150px">
+      	<template slot-scope="{ row }">
+          <el-tag :type="row.status=='1' ? 'danger' : 'success'">
+          	{{ row.status=='1' ? $t("common.status.valid") : $t("common.status.invalid") }}
+          </el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column
+        :label="$t('table.operation')"
+        fixed="right"
+        align="center"
+        column-key="operation"       
+      >
+        <template slot-scope="{ row }">
+		  <el-tooltip class="item" content='配置节点' effect="dark" placement="top-start">
+	          <i
+	            class="el-icon-setting table-operation"
+	            style="color: #2db7f5;"
+	            @click="setting(row)"
+	          />
+          </el-tooltip>	        	
+          <el-tooltip class="item" :content='$t("common.edit")' effect="dark" placement="top-start">
+	          <i
+	            class="el-icon-edit table-operation"
+	            style="color: #2db7f5;"
+	            @click="edit(row)"
+	          />
+          </el-tooltip>
+          <el-tooltip class="item" :content='$t("common.delete")' effect="dark" placement="top-start">
+	          <i
+	            class="el-icon-delete table-operation"
+	            style="color: #f50;"
+	            @click="singleDelete(row)"
+	          />
+          </el-tooltip>
+		  <el-tooltip v-show="false" class="item" :content='row.isFinal == "1" ? $t("common.status.invalid"): $t("common.status.valid") ' effect="dark" placement="top-start">
+	          <i
+	            class="el-icon-set-up table-operation"
+	            style="color: #f50;"
+	            @click="switcher(row)"
+	          />
+          </el-tooltip>
+        </template>
+      </el-table-column>
+    </el-table>
+    
+    <tenant-edit
+      ref="edit"
+      :dialog-visible="dialog.isVisible"
+      :title="dialog.title" 
+      @close="editClose"
+      @success="editSuccess"
+    />
+    <tenant-code-edit
+      ref="tenantCode"	
+	  :codeData = codeData
+      :dialog-visible="tenantCodeVisible"	  
+	  :title="dialog.title"	
+      @close="editTenantClose"
+	  @success="editTenantSuccess"
+    />
+    <el-dialog
+      v-el-drag-dialog
+      :close-on-click-modal="false"
+      :close-on-press-escape="true"
+      title="预览"
+      width="80%"
+      top="50px"
+      :visible.sync="preview.isVisible"
+    >
+      <el-scrollbar>
+        <div v-html="preview.context" />
+      </el-scrollbar>
+    </el-dialog>
+  </div>
+</template>
+
+<script>	
+	import TenantEdit from "../components/TenantEdit"
+	import TenantCodeEdit from "../components/TenantCodeEdit"
+	// 【设备位置管理】-API
+	import resourceBusinessApi from "@/api/resourceProductMgr/resourceBusiness"
+	import elDragDialog from '@/directive/el-drag-dialog'
+	import { downloadFile, initEnums, initDicts, initQueryParams } from '@/utils/commons'
+
+	export default {
+	  name: "AutoCode",
+	  directives: { elDragDialog },
+	  components: { TenantEdit, TenantCodeEdit },
+	  props: {
+	  	rowData: Object
+	  },
+	  data () {
+	    return {
+	      audioStatus: [], 
+		  codeData: {},
+	      dialog: {
+	        isVisible: false,
+	        title: ""
+	      },
+	      preview: {
+	        isVisible: false,
+	        context: ''
+	      },
+	      tenantCodeVisible: false,
+	      tableKey: 0,
+	      queryParams: initQueryParams({}),
+	      selection: [],
+	      loading: false,
+	      tableData: {
+	        total: 0
+	      },
+	      dicts: {
+          NATION: {}
+        },
+	      enums: {
+	        TenantTypeEnum: {},
+	        TenantStatusEnum: {}
+	      }
+	    }
+	  },
+	  watch: {
+	  	// 如果rowData.id的值改变了
+	  	'rowData.id': {
+	  		handler(val, oldVal) {
+	        // 加载列表数据
+	  			this.fetch()
+	      }
+	  	}
+	  },
+	  // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
+	  created() {
+	  	// 调用常量-审核状态
+	  	this.audioStatus = this.$constWKS.SHOWHIDE
+	  	// 加载【字典】
+	  	initDicts(['NATION'], this.dicts);
+	  	// 加载列表数据
+	  	this.fetch()
+		},
+	  computed: {
+	    currentUser () {
+	      return this.$store.state.account.user
+	    },
+	    nationList() {
+        return convertEnum(this.dicts.NATION)
+      }
+	  },
+	  mounted () {
+	    
+	  },
+	  methods: {
+	    editTenantClose () {
+	      this.tenantCodeVisible = false
+	    },
+	    editClose () {
+	      this.dialog.isVisible = false
+	    },
+	    editSuccess () {
+	      this.search()
+	    },
+		editTenantSuccess () {
+	      this.search()
+	    },
+	    onSelectChange (selection) {
+	      this.selection = selection
+	    },
+	    search () {
+	      this.fetch({
+	        ...this.queryParams
+	      })
+	    },
+	    reset () {
+	      this.queryParams = initQueryParams({})
+	      this.$refs.table.clearSort()
+	      this.$refs.table.clearFilter()
+	      this.search()
+	    },
+	    add () {
+	      this.$refs.edit.type = "add"		  
+	      this.$refs.edit.setTenant(false, this.rowData)
+	      this.dialog.title = this.$t("common.add")
+	      this.dialog.isVisible = true
+	    },
+	    link(){
+	    	if (!this.selection.length) {
+	        this.$message({
+	          message: this.$t("tips.noDataSelected"),
+	          type: "warning"
+	        })
+	        return
+	      }
+	    	if (this.selection.length > 1) {
+	        this.$message({
+	          message: this.$t("tips.mustOne"),
+	          type: "warning"
+	        })
+	        return
+	      }
+	      this.$refs.edit.type = "link"
+	      this.$refs.edit.setTenant(this.selection[0], this.dicts, this.rowData)
+	      this.dialog.title = this.$t("resource.buttons.linkLine")
+	      this.dialog.isVisible = true
+	    },
+	    singleDelete (row) {
+	      this.$refs.table.clearSelection()
+	      this.$refs.table.toggleRowSelection(row, true)
+	      this.batchDelete()
+	    },
+	    batchDelete () {
+	      if (!this.selection.length) {
+	        this.$message({
+	          message: this.$t("tips.noDataSelected"),
+	          type: "warning"
+	        })
+	        return
+	      }
+	
+	      this.$confirm('确认是否删除节点数据?', this.$t("common.tips"), {
+	      	distinguishCancelAndClose: true,
+	        confirmButtonText: this.$t("common.confirm"),
+	        cancelButtonText: this.$t("common.cancel"),
+	        type: "warning"
+	      }).then(() => {
+	      	const ids = []
+		      this.selection.forEach(item => {
+		        ids.push(item.id)
+		      })
+		      this.delete(ids)
+	      }).catch(() => {})
+	    },
+	    clearSelections () {
+	      this.$refs.table.clearSelection()
+	    },
+	    delete (ids) {
+	      resourceBusinessApi.remove({ ids: ids }).then(response => {
+	        const res = response.data
+	        if (res.isSuccess) {
+	          this.$message({
+	            message: this.$t("tips.deleteSuccess"),
+	            type: "success"
+	          })
+	          this.search()
+	          // 清理已经删除的数据
+	          this.$refs.table.clearSelection()
+	        }
+	      })
+	    },
+		switcher(row){
+           row.status = (row.status == "1") ? "0" : "1"		  
+
+		},
+		setting(row){	
+		   //this.rowData.businessId = row.id		   		   
+		   this.codeData = row
+           this.$refs.tenantCode.setTenant(false, this.rowData)	   
+		   this.$refs.tenantCode.type = "tenantCode"		   
+	       this.tenantCodeVisible = true
+		},
+	    // 【修改】表头上Btn-事件
+	    editOne() {
+	    	if (!this.selection.length) {
+	        this.$message({
+	          message: this.$t("tips.noDataSelected"),
+	          type: "warning"
+	        })
+	        return
+	      }
+	    	if (this.selection.length > 1) {
+	        this.$message({
+	          message: this.$t("tips.mustOne"),
+	          type: "warning"
+	        })
+	        return
+	      }
+	    	this.edit(this.selection[0]);
+	    },
+	    edit (row) {
+	      if (row.readonly) {
+	        this.$message({
+	          message: this.$t("tips.systemData"),
+	          type: "warning"
+	        })
+	        return
+	      }		  		  
+	      this.$refs.edit.setTenant(row, this.rowData)
+	      this.$refs.edit.type = "edit"
+	      this.dialog.title = this.$t("common.edit")
+	      this.dialog.isVisible = true
+	    },
+	    fetch (params = {}) {
+	     	 this.loading = true
+			 resourceBusinessApi.getList({resourceId:this.rowData.id}).then(response => { 
+				const res = response.data
+	    		if(res.isSuccess){
+	    			this.tableData.records = res.data	    			
+	    		}
+			 }).finally(() => this.loading = false)	    
+		},
+	    cellClick (row, column) {
+	      if (column['columnKey'] === "operation") {
+	        return
+	      }
+	      let flag = false
+	      this.selection.forEach((item) => {
+	        if (item.id === row.id) {
+	          flag = true
+	          this.$refs.table.toggleRowSelection(row)
+	        }
+	      })
+	
+	      if (!flag) {
+	        this.$refs.table.toggleRowSelection(row, true)
+	      }
+	    }
+	  }
+	}
+</script>
+<style lang="scss" scoped></style>

+ 387 - 0
imcs-ui/src/views/zuihou/resourceProductMgr/resourcesMgr/components/AutoCodeEdit.vue

@@ -0,0 +1,387 @@
+<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 prop="type" v-if="this.type == 'add' ">
+            <el-radio-group v-model="tenant.type" @change="switcher">
+				  <el-radio label="0" >动作节点</el-radio>
+				  <el-radio label="1" >自动化节点</el-radio>
+            </el-radio-group> 
+        </el-form-item>        
+      <el-form-item :label='$t("lineSide.form.name")' prop="name">
+          <el-input v-model="tenant.name" :placeholder='$t("common.pleaseEnter")'/>          
+      </el-form-item>
+      <el-form-item label='父节点:'  v-show="isShow">
+            <template>
+                <el-select v-model="tenant.parentId" placeholder="请选择" >
+                    <el-option
+                            v-for="item in parentIds"
+                            :key="item.id"
+                            :label="item.name"
+                            :value="item.id">
+                    </el-option>
+                </el-select>
+            </template>
+        </el-form-item>
+      <el-form-item label='权重' prop="weight">
+          <el-input-number v-model="tenant.weight" :min="1" :max="100" label="1"></el-input-number>
+      </el-form-item>
+      <el-form-item label='备注' prop="remark">
+          <el-input v-model="tenant.remark" :placeholder='$t("common.pleaseEnter")'/>
+      </el-form-item>
+      <el-form-item :label='$t("lineSide.form.status")' prop="status">
+        <template>
+				  <el-radio v-model="tenant.status" label="1">{{$t("common.status.valid")}}</el-radio>
+				  <el-radio v-model="tenant.status" label="0">{{$t("common.status.invalid")}}</el-radio>
+				</template>
+      </el-form-item>
+
+            <!--隐藏切换项-->
+            <div style="width:80%;margin-left:15%;" v-show="isShow">
+                    <el-tabs v-model="tenant.category" type="card" @tab-click="handleClick('')">
+                        <el-tab-pane label="生产设备" name="1" >
+                          <div v-if=" tenant.category=='1' " >
+                            <el-form-item label='设备:'>
+                                 <template>
+                                      <span>{{ this.rowData.name }}</span>
+                                 </template>
+                            </el-form-item>  
+                            <el-form-item label='节点:'>
+                                <template>
+                                    <el-select v-model="tenant.command" placeholder="请选择">
+                                        <el-option
+                                                v-for="item in machineNodes"
+                                                :key="item.value"
+                                                :label="item.label"
+                                                :value="item.value">
+                                        </el-option>
+                                    </el-select>
+                                </template>
+                            </el-form-item> 
+                          </div>                             
+                        </el-tab-pane>
+                        <el-tab-pane label="AGV" name="2"  >
+                          <div v-if=" tenant.category=='2' " >
+                           <el-form-item label='起点:'>
+                                 <template>
+                                      <span>物料位置接驳位</span>
+                                 </template>
+                            </el-form-item>                              
+                            <el-form-item label='终点:'>
+                                <template>
+                                    <el-select v-model="tenant.targetId" placeholder="请选择">
+                                        <el-option
+                                                v-for="item in agvNodes"
+                                                :key="item.value"
+                                                :label="item.label"
+                                                :value="item.value">
+                                        </el-option>
+                                    </el-select>
+                                </template>
+                            </el-form-item> 
+                          </div>   
+                        </el-tab-pane>
+                        <el-tab-pane label="机械手" name="3" > 
+                          <div v-if=" tenant.category=='3' " >                             
+                            <el-form-item label='机械手搬运设备:'>
+                                <template>
+                                    <el-select v-model="tenant.resourceId" placeholder="请选择">
+                                        <el-option
+                                                v-for="item in robotNodes"
+                                                :key="item.value"
+                                                :label="item.label"
+                                                :value="item.value">
+                                        </el-option>
+                                    </el-select>
+                                </template>
+                            </el-form-item> 
+                            <el-form-item label='节点:'>
+                                <template>
+                                    <el-select v-model="tenant.command" placeholder="请选择" @change="actionChange">
+                                        <el-option
+                                                v-for="item in robotAction"
+                                                :key="item.value"
+                                                :label="item.label"
+                                                :value="item.value">
+                                        </el-option>
+                                    </el-select>
+                                </template>
+                            </el-form-item> 
+                            <el-form-item label='取目标:' v-show="actionShow">
+                                 <template>
+                                      <span>物料位置</span>
+                                 </template>
+                            </el-form-item>
+                            <el-form-item label='放目标:' v-show="!actionShow">
+                                 <template>                                                                            
+                                      <span v-if="!codeData.isFinal">本位置</span>                                     
+                                      <el-select v-if="codeData.isFinal"  v-model="tenant.targetId" placeholder="请选择">
+                                        <el-option
+                                                v-for="item in actionTarget"
+                                                :key="item.value"
+                                                :label="item.label"
+                                                :value="item.value">
+                                        </el-option>
+                                    </el-select>
+                                 </template>
+                            </el-form-item>
+                          </div>
+                        </el-tab-pane>                        
+                    </el-tabs>
+            </div>    
+
+    </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 resourceAutoCodeApi from "@/api/resourceProductMgr/resourceAutoCode"
+
+export default {
+  name: 'AutoCodeEdit',
+  props: {
+    dialogVisible: {
+      type: Boolean,
+      default: false
+    },
+    title: {
+      type: String,
+      default: ''
+    },
+    codeData: Object
+  },
+  data () {
+    return {
+      type: 'add',
+      rowData: {},
+      isShow: false,
+      actionShow:true,
+      tenant: this.initTenant(),
+      screenWidth: 0,
+      width: this.initWidth(),
+      confirmDisabled: false,
+      parentIds: [],
+      machineNodes:[{label:'上传程序',value:1},{label:'执行程序',value:2},{label:'刀具校验',value:3}],
+      agvNodes:[{label:'舱体线接驳位',value:"1"},{label:'框体线接驳位',value:"2"},{label:'保障中心线接驳位',value:"3"}],
+      robotNodes:[{label:'舱体线机器人',value:"1"},{label:'伺服舵机',value:"2"},{label:'框体线机器人',value:"3"}],
+      robotAction:[{label:'取',value:1},{label:'放',value:2}],
+      actionTarget: [{label:'本设备',value:"1"},{label:'接驳位',value:"2"}],
+      dicts:{
+        NATION: {}
+      },
+      roles: [],
+      rules: {
+        name: [
+        	{ required: true, message: this.$t("rules.require"), trigger: 'blur' }
+        ]
+      }
+    }
+  },
+  created() {
+    
+  },
+  watch: {
+	  	// 如果rowData.id的值改变了
+	  	'codeData.id': {
+	  		handler(val, oldVal) {
+	        // 加载列表数据          
+	  			this.getPidCode()
+	      }
+	  	}
+	},
+  computed: {
+    isVisible: {
+      get () {
+        return this.dialogVisible
+      },
+      set () {
+        this.close()
+        this.reset()
+      }
+    }
+  },
+  mounted () {
+    window.onresize = () => {
+      return (() => {
+        this.width = this.initWidth()
+      })()
+    }
+    this.$nextTick(()=> {
+        this.getPidCode()
+    })
+  },
+  methods: {
+    initTenant () {
+      return {
+        id: '',
+        name: '',
+        status: '1',
+        type:'0',
+        weight:1,
+        category: '',
+        command:'',
+        resourceId:'',
+        parentId: '',
+        startId:'',
+        targetId:'',
+        remark:'',
+      }
+    },
+    initWidth () {
+      this.screenWidth = document.body.clientWidth
+      if (this.screenWidth < 991) {
+        return '90%'
+      } else if (this.screenWidth < 1400) {
+        return '45%'
+      } else {
+        return '800px'
+      }
+    },
+    actionChange(val){
+      this.actionShow = (val == 1)? true : false
+    },
+    setTenant (val, rowData) {
+    	if(val){
+    		this.tenant = { ...val }
+    	}
+      // 字典表
+      this.rowData = rowData
+    },
+    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
+        }
+      })
+    },
+    switcher(value){       
+       this.isShow = (value == '0') ? false : true              
+       this.tenant.category = (value == '0') ? '' : '1' 
+       this.getPidCode()
+       //this.tenant.resourceId = (value == '0') ? '0' : '' 
+      
+       //this.tenant.resourceId = (value == '0') ?  0 : this.rowData.id  
+    },
+    handleClick(name){     
+      if(name != ''){
+        this.tenant.category = name
+      }
+    }, 
+    getPidCode(){
+       if(this.codeData.id){           
+        resourceAutoCodeApi.getPid({businessId:this.codeData.id}).then(res => {
+				if(res.status == 200 && res.data.isSuccess){
+				   this.parentIds = res.data.data
+				}else{
+          this.$message({
+						message: "获取动作节点数据失败",
+						type: "error"
+					})			
+                }
+		   })
+       }
+    },
+    save () {
+      //console.log(this.tenant)
+      this.tenant.businessId = this.codeData.id  
+      resourceAutoCodeApi.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.businessId = this.codeData.id 
+      resourceAutoCodeApi.update(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>

+ 319 - 0
imcs-ui/src/views/zuihou/resourceProductMgr/resourcesMgr/components/TenantCodeEdit.vue

@@ -0,0 +1,319 @@
+<template>
+  <el-dialog
+    title="设备自动化节点管理"
+    :width="width"
+    :append-to-body="true"
+    :visible.sync="isVisible"
+    class="tenant-view"
+  >
+
+  <p class="tipsP">
+      {{ this.codeData.name }}的节点配置
+  </p>
+  <div class="app-container">
+    
+    <!-- 功能按钮 -->
+    <el-row class="filter-container">
+    	<el-col>
+    	   <el-button type="primary" icon="el-icon-plus" size="medium" @click="addCode">新增节点</el-button>
+    	</el-col>
+    </el-row>
+
+		<!-- 列表数据 -->
+    <el-table
+      :key="tableKey"
+      ref="table"
+      v-loading="loading"
+      :data="tableData.records"
+      border
+      fit
+      default-expand-all 
+      row-key="id"
+      style="width: 100%;"
+      @selection-change="onChange"
+      @cell-click="doubleClick"
+    >
+      <el-table-column :label='$t("common.serialNo")' width="50px" align="center">
+	      
+      </el-table-column>	  
+      <el-table-column prop="id" type="selection"></el-table-column>
+      <!--<el-table-column width="50px" type="expand"></el-table-column>-->
+      <el-table-column width="250px" prop="name" align="center" label="名称" ></el-table-column>
+      <el-table-column prop="type" label='类型' align="center" width="130px">
+            <template slot-scope="{ row }">
+              <el-tag>
+          	      {{ row.type == '1' ? "动作节点" : "自动化节点" }}
+              </el-tag>
+          </template>
+      </el-table-column>    
+      <el-table-column prop="resourceId" label='设备' align="center" width="120px">
+           <template slot-scope="{ row }">             
+              <el-tag  v-if="row.category == '1'"> 
+                      本设备         	      
+              </el-tag>
+              <el-tag  v-if="row.category == '2'"> 
+                      AGV        	      
+              </el-tag>
+              <el-tag  v-if="row.category == '3'"> 
+                    {{ row.resourceId == 1 ? '舱体线机器人':(row.resourceId == 2 ? '伺服舵机': '框体线机器人' )  }}                            	      
+              </el-tag>
+          </template>        
+      </el-table-column> 
+      <el-table-column prop="command" label='指令' align="center" width="100px">           
+           <template slot-scope="{ row }">              
+              <el-tag  v-if=" row.category =='1' "> 
+                    {{ row.command == 1 ? '上传程序':(row.command == 2 ? '执行程序': '刀具校验' )  }}        	      
+              </el-tag>
+              <el-tag  v-if=" row.category =='2' "> 
+                     搬运  
+              </el-tag>
+              <el-tag  v-if=" row.category =='3' "> 
+                     {{ row.command == 1 ? '取':'放' }}   
+              </el-tag>              
+          </template>
+      </el-table-column> 
+      <el-table-column prop="weight" label='权重' align="center" width="80px"></el-table-column>
+      <el-table-column
+        :label="$t('table.operation')"
+        fixed="right"
+        align="center" 
+        column-key="operation"       
+      >
+        <template slot-scope="{ row }">		          	
+          <el-tooltip class="item" :content='$t("common.edit")' effect="dark" placement="top-start">
+	          <i
+	            class="el-icon-edit table-operation"
+	            style="color: #2db7f5;"
+	            @click="editCode(row)"
+	          />
+          </el-tooltip>
+          <el-tooltip class="item" :content='$t("common.delete")' effect="dark" placement="top-start">
+	          <i
+	            class="el-icon-delete table-operation"
+	            style="color: #f50;"
+	            @click="singleDelete(row)"
+	          />
+          </el-tooltip>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <auto-code-edit
+      ref="editCode"
+      :codeData = codeData
+      :dialog-visible="msgBox.isVisible"
+      :title="msgBox.title" 
+      @close="editCodeClose"
+      @success="editCodeSuccess"
+    />
+  </div>
+  </el-dialog>
+</template>
+  
+<script>
+import AutoCodeEdit from "../components/AutoCodeEdit"
+import {initDicts, initQueryParams } from '@/utils/commons'
+
+import resourceAutoCodeApi from "@/api/resourceProductMgr/resourceAutoCode"
+export default {
+  name: 'TenantCodeEdit',  
+  components: { AutoCodeEdit },
+  props: {
+    dialogVisible: {
+      type: Boolean,
+      default: false
+    },
+    title: {
+      type: String,
+      default: ''
+    },
+    codeData: Object
+  },
+  data () {
+    return {
+      type: 'add',
+      rowData: {},
+      tenant: this.initTenant(),
+      width: "100%",
+      screenWidth: 0, 
+      queryParams: initQueryParams({}),
+      //machineNodes:[{label:'上传程序',value:1},{label:'执行程序',value:2},{label:'刀具校验',value:3}],
+      robotNodes:{},
+      dicts:{
+        NATION: {}
+      }, 
+      msgBox: {
+	        isVisible: false,
+	        title: ""
+	    },         
+      loading: false,
+      tableKey: 0,
+      selection: [],
+      tableData: {
+	        total: 0
+	    },
+    }
+  },
+  watch: {
+	  	// 如果rowData.id的值改变了
+	  	'codeData.id': {
+	  		handler(val, oldVal) {
+	        // 加载列表数据          
+	  			this.load()
+	      }
+	  	}
+	},
+  created() {
+    //this.fetch()
+    this.robotNodes = {1:'舱体线机器人',2:'伺服舵机',3:'框体线机器人'}
+  },
+  computed: {
+    isVisible: {
+      get () {
+        return this.dialogVisible
+      },
+      set () {
+        this.close()
+      }
+    }
+  },
+  mounted () {
+    this.$nextTick(()=> {
+        this.load()
+    })
+  },
+  methods: {
+    initTenant () {
+      return {
+        id: '',
+        name: '',
+        type:'1',
+        status: '1',
+        remark: '',   
+      }
+    },
+    setTenant (val, rowData) {
+    	if(val){        
+    		this.tenant = { ...val }
+    	}
+      this.rowData = rowData  
+    },
+    editCodeClose(){
+       this.msgBox.isVisible = false
+    },
+    editCodeSuccess(){
+       this.load()
+    },
+    addCode () {
+	      this.$refs.editCode.type = "add"
+	      this.$refs.editCode.setTenant(false, this.codeData)
+	      this.msgBox.title = "新增节点"
+	      this.msgBox.isVisible = true
+	  },
+    editCode(row){
+        this.$refs.editCode.type = "edit" 
+        console.log(row)         
+	      this.$refs.editCode.setTenant(row, this.codeData)        
+        this.$refs.editCode.switcher(row.type)
+        this.$refs.editCode.handleClick(row.category)
+	      this.msgBox.title = "修改节点"
+	      this.msgBox.isVisible = true
+    },
+    onChange (selection) {
+	      this.selection = selection
+	  },
+    singleDelete (row) {
+	      this.$refs.table.clearSelection()
+	      this.$refs.table.toggleRowSelection(row, true)
+	      this.batchDelete(row.id)
+	  },
+    batchDelete (id) {
+	      if (!this.selection.length) {
+	        this.$message({
+	          message: this.$t("tips.noDataSelected"),
+	          type: "warning"
+	        })
+	        return
+	      }	
+	      this.$confirm('确认是否删除节点数据?', this.$t("common.tips"), {
+	      	distinguishCancelAndClose: true,
+	        confirmButtonText: this.$t("common.confirm"),
+	        cancelButtonText: this.$t("common.cancel"),
+	        type: "warning"
+	      }).then(() => {	      	
+		      this.delete(id)
+	      }).catch(() => {})
+	    },
+	    clearSelections () {
+	      this.$refs.table.clearSelection()
+	    },
+	    delete (id) {
+	      resourceAutoCodeApi.delete({ id: id }).then(response => {
+	        const res = response.data
+	        if (res.isSuccess) {
+	          this.$message({
+	            message: this.$t("tips.deleteSuccess"),
+	            type: "success"
+	          })
+	          this.load()
+	          // 清理已经删除的数据
+	          this.$refs.table.clearSelection()
+	        }
+	      })
+	    },
+    load () {
+       //this.tableData.records = [{name:"从上到序取放到CS2000",type:0,resource:"",command:"",weight:100,id:1, children:[{name:"从物料位置取",type:1,resource:"柔性线机械手",command:"抓",weight:110,id:2},{name:"放到清洗机",type:1,resource:"柔性线机械手",command:"放",weight:90,id:3}]},{name:"执行清洗",type:0,resource:"",command:"",weight:80,id:4,children:[{name:"执行清洗",type:1,resource:"清洗机",command:"执行清洗",weight:70,id:5}]}]
+        if(this.codeData.id){
+           this.loading = true        
+			     resourceAutoCodeApi.getList({businessId:this.codeData.id}).then(response => { 
+				   const res = response.data
+	    		 if(res.isSuccess){
+	    			  this.tableData.records = res.data	    			
+	    		  }
+			     }).finally(() => this.loading = false)
+        }    
+    },
+    doubleClick (row, column) {
+	      if (column['columnKey'] === "operation") {
+	        return
+	      }
+	      let flag = false
+	      this.selection.forEach((item) => {
+	        if (item.id === row.id) {
+	          flag = true
+	          this.$refs.table.toggleRowSelection(row)
+	        }
+	      })
+	
+	      if (!flag) {
+	        this.$refs.table.toggleRowSelection(row, true)
+	      }
+	  },
+    close () {
+      this.$emit('close')
+    }
+  }
+}
+</script>
+<style lang="scss" scoped>
+.tenant-view {
+  .img-wrapper {
+    text-align: center;
+    margin-top: -1.5rem;
+    margin-bottom: 10px;
+    img {
+      width: 4rem;
+      border-radius: 50%;
+    }
+  }
+  .view-item {
+    margin: 7px;
+    i {
+      font-size: 0.97rem;
+    }
+    span {
+      margin-left: 5px;
+    }
+  }
+}
+</style>

+ 214 - 0
imcs-ui/src/views/zuihou/resourceProductMgr/resourcesMgr/components/TenantEdit.vue

@@ -0,0 +1,214 @@
+<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="name">
+          <el-input v-model="tenant.name" :placeholder='rowData.name'/>
+      </el-form-item>
+      <el-form-item :label='$t("resource.table.area.status")' prop="status">
+        <template>
+				  <el-radio v-model="tenant.status" label="1">{{$t("common.status.valid")}}</el-radio>
+				  <el-radio v-model="tenant.status" label="0">{{$t("common.status.invalid")}}</el-radio>
+				</template>
+      </el-form-item>      
+      <el-form-item label='是否最终序' prop="isFinal">
+        <template>
+				  <el-radio v-model="tenant.isFinal" :label="true">是</el-radio>
+				  <el-radio v-model="tenant.isFinal" :label="false">否</el-radio>
+				</template>
+      </el-form-item>
+      <el-form-item :label='$t("resource.table.area.remark")+":"' prop="remark">
+      	<el-input v-model="tenant.remark" type="textarea" :rows="3" style="width: 100%;"/>
+      </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 resourceBusinessApi from "@/api/resourceProductMgr/resourceBusiness"
+
+export default {
+  name: 'TenantEdit',
+  props: {
+    dialogVisible: {
+      type: Boolean,
+      default: false
+    },
+    title: {
+      type: String,
+      default: ''
+    }
+  },
+  data () {
+    return {
+      type: 'add',
+      rowData:{},
+      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: '',
+        name: '',
+        status: '1',
+        isFinal: true,
+        remark: '',   
+      }
+    },
+    initWidth () {
+      this.screenWidth = document.body.clientWidth
+      if (this.screenWidth < 991) {
+        return '90%'
+      } else if (this.screenWidth < 1400) {
+        return '45%'
+      } else {
+        return '800px'
+      }
+    },
+    setTenant (val, rowData) {
+    	if(val){
+    		this.tenant = { ...val }
+    	}
+      this.rowData = rowData
+    },
+    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 () {
+      this.tenant.resourceId = this.rowData.id
+      resourceBusinessApi.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.isFinal = (this.tenant.isFinal) ? "1" : "0"
+      resourceBusinessApi.update(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>