Bläddra i källkod

2022-02-23 22:01

王克恕 3 år sedan
förälder
incheckning
23ed4d8e4d

+ 12 - 0
imcs-ui/src/api/resourceProductMgr/equipmentConfig.js

@@ -47,6 +47,11 @@ const apiList = {
     method: 'POST',
     url: `/authority/productionresourceConf/preview`
   },
+  // 托板下拉数据
+  tuobanList: {
+    method: 'POST',
+    url: `/authority/plate/all`
+  },
   export: {
     method: 'POST',
     url: `/authority/productionresourceConf/export`
@@ -139,6 +144,13 @@ export default {
       data
     })
   },
+  // 托板下拉数据
+  tuobanList (data) {
+    return axiosApi({
+      ...apiList.tuobanList,
+      data
+    })
+  },
   export (data) {
     return axiosApi({
       ...apiList.export,

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

@@ -20,6 +20,7 @@ export default {
 			jichuang: '机床',
 			jxsbi: '机械手臂',
 			agv: 'AGV',
+			tuoban: '托板',
 			users: '使用',
 			history: '历史',
 			eqDelete: '从设备删除',
@@ -132,8 +133,9 @@ export default {
 				productionDate: '出厂年月',
 				productionNo: '出厂编号',
 				manufacturer: '制造厂家',
+				zoneName: '所属产线',
 				model: '型号',
-				category: '分类',
+				category: '设备分类',
 				zoneName: '所属产线',
         		programSynTime: '同步时间',
         		programNum: '程序数量',
@@ -281,6 +283,7 @@ export default {
 			cache_storge_num: '缓存库数量',
 			max_speed: '最大移动速度',
 			tray_num: '可放子盘数量',
+			tuoban: '关联托板分类',
 			arm: '手抓',
 			armName: '手抓名称',
       target_resource: '目标设备',

+ 6 - 6
imcs-ui/src/views/zuihou/prepareProductMgr/material/Index.vue

@@ -43,14 +43,14 @@
     <!-- 功能按钮 -->
     <el-row class="filter-container">
     	<el-col>
-    		<el-button type="primary" icon="el-icon-plus" size="medium" v-has-permission="['toolsMaterial:add']" @click="add">{{ $t("common.add") }}</el-button>
-	      <el-button type="primary" icon="el-icon-edit" size="medium" v-has-permission="['toolsMaterial:set']" @click="trayOne">
+    		<el-button type="primary" icon="el-icon-plus" size="medium" v-has-permission="['material:add']" @click="add">{{ $t("common.add") }}</el-button>
+	      <el-button type="primary" icon="el-icon-edit" size="medium" v-has-permission="['material:int']" @click="trayOne">
 	        	接收
 	      </el-button>
-	      <el-button type="success" icon="el-icon-edit" size="medium" v-has-permission="['toolsMaterial:update']" @click="editOne">
+	      <el-button type="success" icon="el-icon-edit" size="medium" v-has-permission="['material:update']" @click="editOne">
 	        {{ $t("common.edit") }}
 	      </el-button>
-	      <el-button type="danger" icon="el-icon-delete" size="medium" v-has-permission="['toolsMaterial:delete']" @click="batchDelete">
+	      <el-button type="danger" icon="el-icon-delete" size="medium" v-has-permission="['material:delete']" @click="batchDelete">
 	        {{ $t("table.delete") }}
 	      </el-button>
 	      
@@ -102,8 +102,8 @@
         width="120px"
       >
         <template slot-scope="{ row }">
-        	<a href="javascript:;" style="color: #2db7f5;" @click="tray(row)">接收</a>
-        	<a href="javascript:;" style="color: #2db7f5;" @click="view(row)">接收记录</a>
+        	<a href="javascript:;" style="color: #2db7f5;" v-has-permission="['material:int']" @click="tray(row)">接收</a>
+        	<a href="javascript:;" style="color: #2db7f5;" v-has-permission="['material:view']" @click="view(row)">接收记录</a>
         </template>
       </el-table-column>
     </el-table>

+ 40 - 14
imcs-ui/src/views/zuihou/prepareProductMgr/technologyVersion/components/equipmentForm/components/Edit.vue

@@ -13,13 +13,14 @@
     	<!-- 搜索模块 -->
 	    <div class="filter-container">
 	    	<span>
-	    		<span>{{$t("resource.searchForm.name")}}:</span>
-	    		<el-input v-model="queryParams.model.name" :placeholder='$t("common.pleaseEnter")' style="width: 150px;" size="medium"/>
+	    		<span>所属产线:</span>
+	    		<el-select v-model="queryParams.model.zoneId" :placeholder='$t("common.pleaseSelect")' style="width: 150px;" size="medium">
+	        	<el-option v-for="item in lineList" :key="item.id" :label="item.name" :value="item.id"></el-option>
+	      	</el-select>
 	    	</span>
 	    	<span style="margin-left: 15px;">
-	    		<span>{{$t("resource.searchForm.no")}}:</span>
-	    		<el-input v-model="queryParams.model.code" :placeholder='$t("common.pleaseEnter")' style="width: 150px;" size="medium"/>
-	      	</el-select>
+	    		<span>设备名称:</span>
+	    		<el-input v-model="queryParams.model.name" :placeholder='$t("common.pleaseEnter")' style="width: 150px;" size="medium"/>
 	    	</span>
 	      <span style="margin-left: 15px;">
 		      <el-button plain type="primary" icon="el-icon-search" size="medium" @click="search">
@@ -44,6 +45,7 @@
 	      @selection-change="onSelectChange"
 	      @cell-click="cellClick"
 	    >
+	    	<!-- 序号 -->
 	    	<el-table-column :label='$t("common.serialNo")' width="55px" align="center">
 		      <template slot-scope="scope">
 		        <div>
@@ -51,11 +53,17 @@
 		        </div>
 		      </template>
 	      </el-table-column>
+	      <!-- CheckBox -->
 	      <el-table-column align="center" type="selection" width="50" :reserve-selection="true" />
+	      <!-- 设备名称 -->
 	      <el-table-column prop="name" :label='$t("resource.table.resours.name")' :show-overflow-tooltip="true" width="160px"></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="category.data" :label='$t("resource.table.resours.category")' width="120px"></el-table-column>
+	      <!-- 所属产线 -->
+	      <el-table-column prop="zoneName" :label='$t("resource.table.resours.zoneName")'></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="160px"></el-table-column>
+	      <el-table-column prop="specification" :label='$t("resource.table.resours.specification")' width="160px"></el-table-column>-->
 	      <!-- 设备业务 -->
 	      <el-table-column prop="resourceBusinessId" :label='$t("resource.table.resours.resourceBusinessId")' width="200px">
 	      	<template slot-scope="{ row }">
@@ -69,15 +77,14 @@
 						</el-select>
 	      	</template>
 	      </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="model" :label='$t("resource.table.resours.model")'></el-table-column>
 	      <el-table-column prop="cncProgram" :label='$t("resource.table.resours.isProgram")' width="110px" align="center">
 	      	<template slot-scope="{ row }">
 	      		<el-tag :type="row.cncProgram == '1' ? 'success' : 'info'">
 	      			{{row.cncProgram == '1' ? $t("common.yes") : $t("common.no")}}
 	      		</el-tag>
 	      	</template>
-	      </el-table-column>
+	      </el-table-column>-->
 	    </el-table>
 	    
 	    <!-- 【分页组件】-->
@@ -101,6 +108,8 @@
 import Pagination from "@/components/Pagination"
 // 【设备管理】-API
 import equipmentMgrApi from "@/api/resourceProductMgr/equipmentMgr"
+// 【产线管理】-API
+import areaMgrApi from "@/api/resourceProductMgr/areaMgr"
 // 【共通】函数
 import { initQueryParams } from '@/utils/commons'
 export default {
@@ -126,6 +135,7 @@ export default {
       tableData: {
         count: 0
       },
+      lineList: [],
       tenant: this.initTenant(),
       screenWidth: 0,
       width: this.initWidth(),
@@ -140,6 +150,8 @@ export default {
   },
   // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
   created() {
+  	// 产线下拉数据
+  	this.getLineList();
   	// 加载列表数据
   	this.fetch()
 	},
@@ -162,6 +174,17 @@ export default {
     }
   },
   methods: {
+  	// 产线下拉数据
+  	getLineList(){
+  		areaMgrApi.getList().then(res => {
+  			res = res.data;
+  			console.log("产线下拉数据: ", res);
+  			if(res.code == 0) {
+  				this.lineList = res.data;
+  			}
+  		})
+  	},
+  	
   	// 【新增】按钮-事件
     addRes(){
       this.tableData.push({
@@ -268,6 +291,8 @@ export default {
       this.queryParams = initQueryParams({})
       // 清空列表选中的数据
       this.$refs.table.clearSelection()
+      // 重新加载数据
+      this.fetch();
     },
     submitForm () {
     	this.selection.forEach(item => {
@@ -280,12 +305,13 @@ export default {
     	this.isVisible = false
     },
     fetch (params = {}) {
-	      this.loading = true
+	      this.loading = true;
 	
-	      this.queryParams.current = params.current ? params.current : this.queryParams.current
-	      this.queryParams.size = params.size ? params.size : this.queryParams.size
+	      this.queryParams.current = params.current ? params.current : this.queryParams.current;
+	      this.queryParams.size = params.size ? params.size : this.queryParams.size;
 	      // 固定参数(采集的生产资源)
-	      this.queryParams.resourceStatus = "1"
+	      this.queryParams.resourceStatus = "1";
+	      this.queryParams.displayStatus = "1";
 	      equipmentMgrApi.resourcePageList(this.queryParams).then(response => {
 	        const res = response.data
 	        if (res.isSuccess) {

+ 351 - 349
imcs-ui/src/views/zuihou/resourceProductMgr/equipmentMgr/Index.vue

@@ -1,349 +1,351 @@
-<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"
-      border
-      fit
-      row-key="id"
-      style="width: 100%;"
-      @selection-change="onSelectChange"
-      @cell-click="cellClick"
-    >
-    	<el-table-column :label='$t("common.serialNo")' width="55px" align="center">
-	      <template slot-scope="scope">
-	        <div>
-	          {{scope.$index+(queryParams.current - 1) * queryParams.size + 1}}
-	        </div>
-	      </template>
-      </el-table-column>
-      <el-table-column align="center" type="selection" width="50" :reserve-selection="true" />
-      <el-table-column prop="pic" :label='$t("resource.table.selectQm.pic")' align="center" width="150px">
-      	<template slot-scope="{ row }">
-      		<div v-if="row.pic" class="demo-image__preview">
-					  <el-image 
-					    style="width: 100px; height: 60px"
-					    :src="row.pic" 
-					    :preview-src-list="row.srcList">
-					  </el-image>
-					</div>
-					<span v-else>{{$t("common.noData")}}</span>
-      	</template>
-      </el-table-column>
-      <el-table-column prop="name" :label='$t("resource.table.equipment.name")' :show-overflow-tooltip="true" width="180px"></el-table-column>
-      <el-table-column prop="code" :label='$t("resource.table.equipment.no")' :show-overflow-tooltip="true" width="100px"></el-table-column>
-      <el-table-column prop="brand" :label='$t("resource.table.equipment.brand")' width="100px"></el-table-column>
-      <el-table-column prop="specification" :label='$t("resource.table.equipment.specification")' width="180px"></el-table-column>
-      <el-table-column prop="model" :label='$t("resource.table.equipment.model")'></el-table-column>
-      <el-table-column
-        :label="$t('table.operation')"
-        fixed="right"
-        align="center"
-        column-key="operation"
-        width="60px"
-      >
-        <template slot-scope="{ row }">
-          <el-tooltip class="item" :content='$t("common.delete")' effect="dark" placement="top-start">
-	          <i
-	            class="el-icon-delete table-operation"
-	            style="color: #f50;"
-	            @click="rowDel(row)"
-	          />
-          </el-tooltip>
-        </template>
-      </el-table-column>
-    </el-table>
-    
-    <div slot="footer" class="dialog-footer" align="right" style="margin-top: 30px;">
-      <el-button plain type="warning" @click="colse()">{{ $t('common.cancel') }}</el-button>
-      <el-button plain type="primary" @click="submitForm">{{ $t('common.confirm') }}</el-button>
-    </div>
-    <tenant-edit
-      ref="edit"
-      :dialog-visible="dialog.isVisible"
-      :title="dialog.title"
-      @close="editClose"
-      @success="editSuccess"
-    />
-    <tenant-view
-      ref="view"
-      :dialog-visible="tenantViewVisible"
-      @close="viewClose"
-    />
-    <el-dialog
-      v-el-drag-dialog
-      :close-on-click-modal="false"
-      :close-on-press-escape="true"
-      :title='$t("common.preview")'
-      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/Edit"
-	import TenantView from "./components/View"
-	// 【区域管理】-API
-	import areaMgrApi from "@/api/resourceProductMgr/areaMgr"
-	// 【设备管理】-API
-	import equipmentMgrApi from "@/api/resourceProductMgr/equipmentMgr"
-	import elDragDialog from '@/directive/el-drag-dialog'
-	import { downloadFile, initEnums, initDicts, initQueryParams } from '@/utils/commons'
-	import axios from 'axios'
-	export default {
-	  name: "EquipmentMgr",
-	  directives: { elDragDialog },
-	  components: { TenantEdit, TenantView },
-	  props: {
-	  	rowData: Object
-	  },
-	  data () {
-	    return {
-	    	audioStatus: [],
-	      dialog: {
-	        isVisible: false,
-	        title: ""
-	      },
-	      preview: {
-	        isVisible: false,
-	        context: ''
-	      },
-	      tenantViewVisible: false,
-	      tableKey: 0,
-	      queryParams: initQueryParams({}),
-	      selection: [],
-	      loading: false,
-	      tableData: [],
-	      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: {
-	  	rowDel(row){
-	  		// 过滤数据
-	  		let targetList = this.tableData.filter(item => item.id != row.id)
-	  		// 重新赋值
-	  		this.tableData = targetList
-	  	},
-	  	// 【取消】按钮-事件
-	  	colse(){
-	  		this.$emit("close")
-	  	},
-	  	// 【确定】按钮-事件
-	  	submitForm(){
-	  		let obj = {
-	  			id: this.rowData.id,
-	  			resourceList: []
-	  		}
-	  		this.tableData.map(item => {
-	  			obj.resourceList.push(item.id)
-	  		})
-	  		equipmentMgrApi.setResource(obj).then(res => {
-	  			res = res.data
-	  		})
-	  		this.$emit("close")
-	  	},
-	    viewClose () {
-	      this.tenantViewVisible = false
-	    },
-	    editClose () {
-	      this.dialog.isVisible = false
-	    },
-	    // 【选择 】
-	    editSuccess (arr) {
-	    	// 子组件传的数据
-	    	// console.log("选择的数据:", arr)
-	    	this.tableData = [...this.tableData, ...arr]
-	    	// 过滤重复的数据
-	    	let obj = {};
-				this.tableData = this.tableData.reduce((cur,next) => {
-				    obj[next.id] ? "" : obj[next.id] = true && cur.push(next);
-				    return cur;
-				},[]) //设置cur默认类型为数组,并且初始值为空的数组
-	    },
-	    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.dicts)
-	      this.dialog.title = this.$t("resource.common.selectAdd")
-	      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("resource.tips.areaTips"), 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) {
-	      areaMgrApi.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()
-	        }
-	      })
-	    },
-	    view (row) {
-	      this.$refs.view.setTenant(row)
-	      this.tenantViewVisible = 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.dicts)
-	      this.$refs.edit.type = "edit"
-	      this.dialog.title = this.$t("common.edit")
-	      this.dialog.isVisible = true
-	    },
-	    fetch (params = {}) {
-	      this.loading = true
-	      
-	      equipmentMgrApi.getList({ zoneId: this.rowData.id }).then(response => {
-	        const res = response.data
-	        if (res.isSuccess) {
-	          // 赋值
-	          this.tableData = res.data
-	          this.tableData.forEach((item, index) => {
-	        		// item.url = 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg';
-	        		item.srcList = [item.pic];
-	        	})
-	        }
-	        // eslint-disable-next-line no-return-assign
-	      }).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>
+<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"
+      border
+      fit
+      row-key="id"
+      style="width: 100%;"
+      @selection-change="onSelectChange"
+      @cell-click="cellClick"
+    >
+    	<el-table-column :label='$t("common.serialNo")' width="55px" align="center">
+	      <template slot-scope="scope">
+	        <div>
+	          {{scope.$index+(queryParams.current - 1) * queryParams.size + 1}}
+	        </div>
+	      </template>
+      </el-table-column>
+      <el-table-column align="center" type="selection" width="50" :reserve-selection="true" />
+      <el-table-column prop="pic" :label='$t("resource.table.selectQm.pic")' align="center" width="150px">
+      	<template slot-scope="{ row }">
+      		<div v-if="row.pic" class="demo-image__preview">
+					  <el-image 
+					    style="width: 100px; height: 60px"
+					    :src="row.pic" 
+					    :preview-src-list="row.srcList">
+					  </el-image>
+					</div>
+					<span v-else>{{$t("common.noData")}}</span>
+      	</template>
+      </el-table-column>
+      <el-table-column prop="name" :label='$t("resource.table.equipment.name")' :show-overflow-tooltip="true" width="180px"></el-table-column>
+      <el-table-column prop="code" :label='$t("resource.table.equipment.no")' :show-overflow-tooltip="true" width="100px"></el-table-column>
+      <el-table-column prop="brand" :label='$t("resource.table.equipment.brand")' width="100px"></el-table-column>
+      <el-table-column prop="specification" :label='$t("resource.table.equipment.specification")' width="180px"></el-table-column>
+      <el-table-column prop="model" :label='$t("resource.table.equipment.model")'></el-table-column>
+      <el-table-column
+        :label="$t('table.operation')"
+        fixed="right"
+        align="center"
+        column-key="operation"
+        width="60px"
+      >
+        <template slot-scope="{ row }">
+          <el-tooltip class="item" :content='$t("common.delete")' effect="dark" placement="top-start">
+	          <i
+	            class="el-icon-delete table-operation"
+	            style="color: #f50;"
+	            @click="rowDel(row)"
+	          />
+          </el-tooltip>
+        </template>
+      </el-table-column>
+    </el-table>
+    
+    <div slot="footer" class="dialog-footer" align="right" style="margin-top: 30px;">
+      <el-button plain type="warning" @click="colse()">{{ $t('common.cancel') }}</el-button>
+      <el-button plain type="primary" @click="submitForm">{{ $t('common.confirm') }}</el-button>
+    </div>
+    <tenant-edit
+      ref="edit"
+      :dialog-visible="dialog.isVisible"
+      :title="dialog.title"
+      @close="editClose"
+      @success="editSuccess"
+    />
+    <tenant-view
+      ref="view"
+      :dialog-visible="tenantViewVisible"
+      @close="viewClose"
+    />
+    <el-dialog
+      v-el-drag-dialog
+      :close-on-click-modal="false"
+      :close-on-press-escape="true"
+      :title='$t("common.preview")'
+      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/Edit"
+	import TenantView from "./components/View"
+	// 【区域管理】-API
+	import areaMgrApi from "@/api/resourceProductMgr/areaMgr"
+	// 【设备管理】-API
+	import equipmentMgrApi from "@/api/resourceProductMgr/equipmentMgr"
+	import elDragDialog from '@/directive/el-drag-dialog'
+	import { downloadFile, initEnums, initDicts, initQueryParams } from '@/utils/commons'
+	import axios from 'axios'
+	export default {
+	  name: "EquipmentMgr",
+	  directives: { elDragDialog },
+	  components: { TenantEdit, TenantView },
+	  props: {
+	  	rowData: Object
+	  },
+	  data () {
+	    return {
+	    	audioStatus: [],
+	      dialog: {
+	        isVisible: false,
+	        title: ""
+	      },
+	      preview: {
+	        isVisible: false,
+	        context: ''
+	      },
+	      tenantViewVisible: false,
+	      tableKey: 0,
+	      queryParams: initQueryParams({}),
+	      selection: [],
+	      loading: false,
+	      tableData: [],
+	      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: {
+	  	rowDel(row){
+	  		// 过滤数据
+	  		let targetList = this.tableData.filter(item => item.id != row.id)
+	  		// 重新赋值
+	  		this.tableData = targetList
+	  	},
+	  	// 【取消】按钮-事件
+	  	colse(){
+	  		this.$emit("close")
+	  	},
+	  	// 【确定】按钮-事件
+	  	submitForm(){
+	  		let obj = {
+	  			id: this.rowData.id,
+	  			resourceList: []
+	  		}
+	  		this.tableData.map(item => {
+	  			obj.resourceList.push(item.id)
+	  		})
+	  		equipmentMgrApi.setResource(obj).then(res => {
+	  			res = res.data;
+	  			// 通知,父组件
+	  			this.$emit("success");
+	  		})
+	  		this.$emit("close")
+	  	},
+	    viewClose () {
+	      this.tenantViewVisible = false
+	    },
+	    editClose () {
+	      this.dialog.isVisible = false
+	    },
+	    // 【选择 】
+	    editSuccess (arr) {
+	    	// 子组件传的数据
+	    	// console.log("选择的数据:", arr)
+	    	this.tableData = [...this.tableData, ...arr]
+	    	// 过滤重复的数据
+	    	let obj = {};
+				this.tableData = this.tableData.reduce((cur,next) => {
+				    obj[next.id] ? "" : obj[next.id] = true && cur.push(next);
+				    return cur;
+				},[]) //设置cur默认类型为数组,并且初始值为空的数组
+	    },
+	    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.dicts)
+	      this.dialog.title = this.$t("resource.common.selectAdd")
+	      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("resource.tips.areaTips"), 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) {
+	      areaMgrApi.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()
+	        }
+	      })
+	    },
+	    view (row) {
+	      this.$refs.view.setTenant(row)
+	      this.tenantViewVisible = 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.dicts)
+	      this.$refs.edit.type = "edit"
+	      this.dialog.title = this.$t("common.edit")
+	      this.dialog.isVisible = true
+	    },
+	    fetch (params = {}) {
+	      this.loading = true
+	      
+	      equipmentMgrApi.getList({ zoneId: this.rowData.id }).then(response => {
+	        const res = response.data
+	        if (res.isSuccess) {
+	          // 赋值
+	          this.tableData = res.data
+	          this.tableData.forEach((item, index) => {
+	        		// item.url = 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg';
+	        		item.srcList = [item.pic];
+	        	})
+	        }
+	        // eslint-disable-next-line no-return-assign
+	      }).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>

+ 402 - 377
imcs-ui/src/views/zuihou/resourceProductMgr/resourcesMgr/components/Hardware.vue

@@ -1,377 +1,402 @@
-<template>
-  <el-dialog 
-  	:close-on-click-modal="false" 
-  	:close-on-press-escape="false" 
-  	:title="title" 
-  	:append-to-body="true"
-  	:visible.sync="isVisible" 
-  	width="700px" 
-  	top="50px"
-  >
-    <el-form ref="form" :model="tenant" :rules="rules" label-position="right" label-width="130px">
-    	<!-- 机床 -->
-    	<div v-if="tenant.category.key == 'machine'">
-	    	<div class="formTitle">{{ $t("resource.common.jichuang") }}</div>
-	    	<!-- 工作台数量 -->
-	    	<el-form-item :label='$t("resource.form.workbench_num")+":"' prop="workbenchNum">
-	      	<el-input-number v-model="tenant.workbenchNum"></el-input-number>
-	      </el-form-item>
-      </div>
-      
-      <!-- 机械手臂 -->
-	    <div v-if="tenant.category.key == 'arm'">
-	    	<div class="formTitle">{{ $t("resource.common.jxsbi") }}</div>
-	      <!-- 手臂数量 -->
-	      <el-form-item :label='$t("resource.form.hand_num")+":"' prop="handNum">
-	      	<el-input-number v-model="tenant.handNum"></el-input-number>
-	      </el-form-item>
-	      <!-- 缓存库数量 -->
-	      <el-form-item :label='$t("resource.form.cache_storge_num")+":"' prop="cacheStorgeNum">
-	      	<el-input-number v-model="tenant.cacheStorgeNum"></el-input-number>
-	      </el-form-item>
-	      <!-- 最大移动速度 -->
-	      <el-form-item :label='$t("resource.form.max_speed")+":"' prop="maxSpeed">
-	      	<el-input-number v-model="tenant.maxSpeed"></el-input-number>
-	      	<span>{{ $t("resource.common.mimm") }}</span>
-	      </el-form-item>
-	      <!-- 手抓 -->
-      	<el-form-item :label='$t("resource.form.arm")+":"'>
-	        <!-- 功能按钮 -->
-			    <el-row class="filter-container">
-			    	<el-col>
-			    		<el-button type="primary" icon="el-icon-plus" size="medium" @click="addRes">{{ $t("common.add") }}</el-button>
-			    	</el-col>
-			    </el-row>
-			    <!-- Table数据 -->
-					<el-table
-			      ref="table"
-			      v-loading="loading"
-			      :data="tableData"
-			      border
-			      fit
-			      style="width: 100%;"
-			      @selection-change="onSelectChange"
-			    >
-			      <el-table-column prop="positionSort" :label='$t("common.serialNo")' align="center" width="50px">
-			      	<template slot-scope="{ row }">
-			      		<span>{{row.positionSort}}</span>
-			      	</template>
-			      </el-table-column>
-			      <el-table-column prop="name" :label='$t("resource.form.armName")' align="center">
-			      	<template slot-scope="{ row }">
-			      		<el-input size="small" v-model="row.name" v-if="row.isEdit" :placeholder='$t("common.pleaseEnter")'></el-input>
-			      		<span v-else="">{{row.name}}</span>
-			      	</template>
-			      </el-table-column>
-			      <el-table-column prop="zoneType" :label='$t("resource.form.rouJiagong")' width="160px">
-			      	<template slot-scope="{ row }">
-			      		<el-select v-if="row.isEdit" v-model="row.zoneType" :placeholder='$t("common.pleaseSelect")' size="small">
-				        	<el-option label="产线类型" value="1"></el-option>
-				        	<el-option label="智能加个产线" value="2"></el-option>
-				      	</el-select>
-			      		<span v-else="">{{row.zoneType}}</span>
-			      	</template>
-			      </el-table-column>
-			      <el-table-column
-			        :label="$t('table.operation')"
-			        fixed="right"
-			        align="center"
-			        column-key="operation"
-			        width="80px"
-			      >
-			        <template slot-scope="{ row }">
-			        	<el-tooltip v-if="type != 'add'" 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>
-			        </template>
-			      </el-table-column>
-			    </el-table>
-	      </el-form-item>
-	    </div>
-      <!-- AGV -->
-      <div v-if="tenant.category.key == 'agv'">
-	    	<div class="formTitle">{{ $t("resource.common.agv") }}</div>
-	      <!-- 产线控制状态 -->
-	      <!-- 可放子盘数量 -->
-	      <el-form-item :label='$t("resource.form.tray_num")+":"' prop="trayNum">
-	      	<el-input-number v-model="tenant.trayNum"></el-input-number>
-	      </el-form-item>
-	    </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 areaMgrApi from "@/api/resourceProductMgr/areaMgr"
-// 【生产资源配置】-API
-import equipmentConfigApi from "@/api/resourceProductMgr/equipmentConfig"
-
-export default {
-  name: 'TenantEdit',
-  props: {
-    dialogVisible: {
-      type: Boolean,
-      default: false
-    },
-    title: {
-      type: String,
-      default: ''
-    }
-  },
-  data () {
-    return {
-      type: 'add',
-      loading: false,
-      tableData: [],
-      tenant: this.initTenant(),
-      screenWidth: 0,
-      width: this.initWidth(),
-      confirmDisabled: false,
-      roles: [],
-      rules: {
-        workbenchNum: [
-        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
-        ],
-        handNum: [
-        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
-        ],
-        cacheStorgeNum: [
-        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
-        ],
-        maxSpeed: [
-        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
-        ],
-        trayNum: [
-        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
-        ]
-      }
-    }
-  },
-  computed: {
-    isVisible: {
-      get () {
-        return this.dialogVisible
-      },
-      set () {
-        this.close()
-        this.reset()
-      }
-    }
-  },
-  mounted () {
-    window.onresize = () => {
-      return (() => {
-        this.width = this.initWidth()
-      })()
-    }
-  },
-  methods: {
-    initTenant () {
-      return {
-        id: '',
-        category: {
-        	data: '',
-        	key: ''
-        }
-        /*handNum: null,
-        workbenchNum: null,
-        cacheStorgeNum: null,
-        maxSpeed: null,
-        trayNum: null*/
-      }
-    },
-    initWidth () {
-      this.screenWidth = document.body.clientWidth
-      if (this.screenWidth < 991) {
-        return '90%'
-      } else if (this.screenWidth < 1400) {
-        return '45%'
-      } else {
-        return '800px'
-      }
-    },
-    
-    // 【新增】按钮-事件
-    addRes(){
-      this.tableData.push({
-      	key: "WKS_"+ Math.random(),
-      	id: '',
-      	positionSort: this.tableData.length + 1,
-      	name: '',
-      	zoneType: '',
-      	isEdit: true
-      })
-    },
-    
-    // Table的选择事件
-    onSelectChange (selection) {
-      this.selection = selection
-    },
-    
-    // 【修改】按钮事件
-    edit(row){
-    	let list = new Array();
-    	this.tableData.forEach((item, index) => {
-    		// 当前编辑行
-    		if(!!item.id && item.id == row.id){
-    			item.isEdit = true
-    		}
-    		list.push(item)
-    	})
-    	// 赋值给当前
-    	this.tableData = list
-    },
-    
-    // 【删除】按钮事件
-    singleDelete(row){
-    	this.$confirm(this.$t("tips.comTips"), this.$t("common.tips"), {
-      	distinguishCancelAndClose: true,
-        confirmButtonText: this.$t("common.confirm"),
-        cancelButtonText: this.$t("common.cancel"),
-        type: "warning"
-      }).then(() => {
-      	// 过滤符合条件的数据
-      	let arr = this.tableData.filter(item => item.key != row.key || item.id != row.id)
-      	// 给数据排序
-    		arr.forEach((item, index) => {
-    			item.positionSort = index + 1
-    		})
-      	// 给新的数据赋值
-    		this.tableData = arr;
-
-      }).catch(() => {})
-    },
-    
-    setTenant (val) {
-    	if(val){
-    		console.log("2222 == ", val);
-    		this.tenant = { ...val };
-    	}
-    },
-    
-    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.list = this.tableData;
-      equipmentConfigApi.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.list = this.tableData;
-      equipmentConfigApi.updateResource(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>
-
-<style type="text/css" lang="scss" scoped>
-	.formTitle {
-		margin: 0 0 10px 20px;
-		
-		font-size: 16px;
-		font-weight: bold;
-		color: #1890FF;
-	}
-</style>
+<template>
+  <el-dialog 
+  	:close-on-click-modal="false" 
+  	:close-on-press-escape="false" 
+  	:title="title" 
+  	:append-to-body="true"
+  	:visible.sync="isVisible" 
+  	width="700px" 
+  	top="50px"
+  >
+    <el-form ref="form" :model="tenant" :rules="rules" label-position="right" label-width="130px">
+    	<!-- 机床 -->
+    	<div v-if="tenant.category.key == 'machine'">
+	    	<div class="formTitle">{{ $t("resource.common.jichuang") }}</div>
+	    	<!-- 工作台数量 -->
+	    	<el-form-item :label='$t("resource.form.workbench_num")+":"' prop="workbenchNum">
+	      	<el-input-number v-model="tenant.workbenchNum"></el-input-number>
+	      </el-form-item>
+      </div>
+      
+      <!-- 机械手臂 -->
+	    <div v-if="tenant.category.key == 'arm'">
+	    	<div class="formTitle">{{ $t("resource.common.jxsbi") }}</div>
+	      <!-- 手臂数量 -->
+	      <el-form-item :label='$t("resource.form.hand_num")+":"' prop="handNum">
+	      	<el-input-number v-model="tenant.handNum"></el-input-number>
+	      </el-form-item>
+	      <!-- 缓存库数量 -->
+	      <el-form-item :label='$t("resource.form.cache_storge_num")+":"' prop="cacheStorgeNum">
+	      	<el-input-number v-model="tenant.cacheStorgeNum"></el-input-number>
+	      </el-form-item>
+	      <!-- 最大移动速度 -->
+	      <el-form-item :label='$t("resource.form.max_speed")+":"' prop="maxSpeed">
+	      	<el-input-number v-model="tenant.maxSpeed"></el-input-number>
+	      	<span>{{ $t("resource.common.mimm") }}</span>
+	      </el-form-item>
+	      <!-- 手抓 -->
+      	<el-form-item :label='$t("resource.form.arm")+":"'>
+	        <!-- 功能按钮 -->
+			    <el-row class="filter-container">
+			    	<el-col>
+			    		<el-button type="primary" icon="el-icon-plus" size="medium" @click="addRes">{{ $t("common.add") }}</el-button>
+			    	</el-col>
+			    </el-row>
+			    <!-- Table数据 -->
+					<el-table
+			      ref="table"
+			      v-loading="loading"
+			      :data="tableData"
+			      border
+			      fit
+			      style="width: 100%;"
+			      @selection-change="onSelectChange"
+			    >
+			      <el-table-column prop="positionSort" :label='$t("common.serialNo")' align="center" width="50px">
+			      	<template slot-scope="{ row }">
+			      		<span>{{row.positionSort}}</span>
+			      	</template>
+			      </el-table-column>
+			      <el-table-column prop="name" :label='$t("resource.form.armName")' align="center">
+			      	<template slot-scope="{ row }">
+			      		<el-input size="small" v-model="row.name" v-if="row.isEdit" :placeholder='$t("common.pleaseEnter")'></el-input>
+			      		<span v-else="">{{row.name}}</span>
+			      	</template>
+			      </el-table-column>
+			      <el-table-column prop="zoneType" :label='$t("resource.form.rouJiagong")' width="160px">
+			      	<template slot-scope="{ row }">
+			      		<el-select v-if="row.isEdit" v-model="row.zoneType" :placeholder='$t("common.pleaseSelect")' size="small">
+				        	<el-option label="产线类型" value="1"></el-option>
+				        	<el-option label="智能加个产线" value="2"></el-option>
+				      	</el-select>
+			      		<span v-else="">{{row.zoneType}}</span>
+			      	</template>
+			      </el-table-column>
+			      <el-table-column
+			        :label="$t('table.operation')"
+			        fixed="right"
+			        align="center"
+			        column-key="operation"
+			        width="80px"
+			      >
+			        <template slot-scope="{ row }">
+			        	<el-tooltip v-if="type != 'add'" 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>
+			        </template>
+			      </el-table-column>
+			    </el-table>
+	      </el-form-item>
+	    </div>
+      <!-- AGV -->
+      <div v-if="tenant.category.key == 'agv'">
+	    	<div class="formTitle">{{ $t("resource.common.agv") }}</div>
+	      <!-- 产线控制状态 -->
+	      <!-- 可放子盘数量 -->
+	      <el-form-item :label='$t("resource.form.tray_num")+":"' prop="trayNum">
+	      	<el-input-number v-model="tenant.trayNum"></el-input-number>
+	      </el-form-item>
+	    </div>
+	    
+	    <!-- 托板(tuoban) -->
+      <div v-if="tenant.category.key == 'tuoban'">
+	    	<div class="formTitle">{{ $t("resource.common.tuoban") }}</div>
+	      <!-- 关联托板分类 -->
+	      <el-form-item :label='$t("resource.form.tuoban")+":"' prop="plateId">
+	      	<el-select v-model="tenant.plateId" :placeholder='$t("common.pleaseSelect")' size="small">
+	        	<el-option v-for="item in tuobanList" :key="item.id" :label="item.name" :value="item.id"></el-option>
+	      	</el-select>
+	      </el-form-item>
+	    </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 areaMgrApi from "@/api/resourceProductMgr/areaMgr"
+// 【生产资源配置】-API
+import equipmentConfigApi from "@/api/resourceProductMgr/equipmentConfig"
+
+export default {
+  name: 'TenantEdit',
+  props: {
+    dialogVisible: {
+      type: Boolean,
+      default: false
+    },
+    title: {
+      type: String,
+      default: ''
+    }
+  },
+  data () {
+    return {
+      type: 'add',
+      loading: false,
+      tableData: [],
+      tenant: this.initTenant(),
+      screenWidth: 0,
+      width: this.initWidth(),
+      confirmDisabled: false,
+      roles: [],
+      tuobanList: [],  // 托板类型下拉数据
+      rules: {
+        workbenchNum: [
+        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
+        ],
+        handNum: [
+        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
+        ],
+        cacheStorgeNum: [
+        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
+        ],
+        maxSpeed: [
+        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
+        ],
+        trayNum: [
+        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
+        ]
+      }
+    }
+  },
+  computed: {
+    isVisible: {
+      get () {
+        return this.dialogVisible
+      },
+      set () {
+        this.close()
+        this.reset()
+      }
+    }
+  },
+  mounted () {
+    window.onresize = () => {
+      return (() => {
+        this.width = this.initWidth()
+      })()
+    }
+  },
+  methods: {
+    initTenant () {
+      return {
+        id: '',
+        category: {
+        	data: '',
+        	key: ''
+        }
+        /*handNum: null,
+        workbenchNum: null,
+        cacheStorgeNum: null,
+        maxSpeed: null,
+        trayNum: null*/
+      }
+    },
+    initWidth () {
+      this.screenWidth = document.body.clientWidth
+      if (this.screenWidth < 991) {
+        return '90%'
+      } else if (this.screenWidth < 1400) {
+        return '45%'
+      } else {
+        return '800px'
+      }
+    },
+    
+    // 【新增】按钮-事件
+    addRes(){
+      this.tableData.push({
+      	key: "WKS_"+ Math.random(),
+      	id: '',
+      	positionSort: this.tableData.length + 1,
+      	name: '',
+      	zoneType: '',
+      	isEdit: true
+      })
+    },
+    
+    // Table的选择事件
+    onSelectChange (selection) {
+      this.selection = selection
+    },
+    
+    // 【修改】按钮事件
+    edit(row){
+    	let list = new Array();
+    	this.tableData.forEach((item, index) => {
+    		// 当前编辑行
+    		if(!!item.id && item.id == row.id){
+    			item.isEdit = true
+    		}
+    		list.push(item)
+    	})
+    	// 赋值给当前
+    	this.tableData = list
+    },
+    
+    // 【删除】按钮事件
+    singleDelete(row){
+    	this.$confirm(this.$t("tips.comTips"), this.$t("common.tips"), {
+      	distinguishCancelAndClose: true,
+        confirmButtonText: this.$t("common.confirm"),
+        cancelButtonText: this.$t("common.cancel"),
+        type: "warning"
+      }).then(() => {
+      	// 过滤符合条件的数据
+      	let arr = this.tableData.filter(item => item.key != row.key || item.id != row.id)
+      	// 给数据排序
+    		arr.forEach((item, index) => {
+    			item.positionSort = index + 1
+    		})
+      	// 给新的数据赋值
+    		this.tableData = arr;
+
+      }).catch(() => {})
+    },
+    
+    setTenant (val) {
+    	if(val){
+    		console.log("2222 == ", val);
+    		this.tenant = { ...val };
+    		// 托板下拉数据
+    		this.getTuobanList();
+    	}
+    },
+    
+    // 托板下拉数据
+    getTuobanList() {
+    	equipmentConfigApi.tuobanList().then((response) => {
+	    	const res = response.data
+	    	// console.log("托板下拉数据: ",  res);
+	      if (res.code == 0) {
+	        this.tuobanList = res.data;
+	      }
+	    })
+    },
+    
+    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.list = this.tableData;
+      equipmentConfigApi.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.list = this.tableData;
+      equipmentConfigApi.updateResource(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>
+
+<style type="text/css" lang="scss" scoped>
+	.formTitle {
+		margin: 0 0 10px 20px;
+		
+		font-size: 16px;
+		font-weight: bold;
+		color: #1890FF;
+	}
+</style>