浏览代码

完成设备管理功能

oyq28 3 年之前
父节点
当前提交
901ed529f8

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

@@ -63,7 +63,7 @@ export default {
 			isProStaus: '产线控制状态',
 			maxTime: '每日最多加工',
 			baoyang: '临近保养',
-			isAutoCode: '是否工序节点'
+			isAutoCode: '是否工序设备'
 		},
 		// 按钮的名称
 	  	buttons: {

+ 2 - 2
imcs-ui/src/views/zuihou/prepareProductMgr/plateMgr/Index.vue

@@ -100,8 +100,8 @@
 	            class="el-icon-view table-operation"
 	            style="color: #87d068;"
 	            @click="view(row)"
-	          /> -->
-          </el-tooltip>
+	          /> 
+          </el-tooltip> -->
           <el-tooltip class="item" :content='$t("common.edit")' effect="dark" placement="top-start">
 	          <i
 	            class="el-icon-edit table-operation"

+ 2 - 2
imcs-ui/src/views/zuihou/prepareProductMgr/trayMgr/components/Edit.vue

@@ -53,13 +53,13 @@
 		      <el-table-column prop="size" :label='$t("prepare.table.trayPosition.size")' align="center" width="100px">
 		      	<template slot-scope="{ row }">
 		      		<el-input size="small" v-model="row.size" v-if="row.isEdit" :placeholder='$t("common.pleaseEnter")'></el-input>
-		      		<span v-else="">{{row.size}}</span>
+		      		<span v-else>{{row.size}}</span>
 		      	</template>
 		      </el-table-column>
 		      <el-table-column prop="remark" :label='$t("prepare.table.trayPosition.remark")'>
 		      	<template slot-scope="{ row }">
 		      		<el-input size="small" v-model="row.remark" v-if="row.isEdit" :placeholder='$t("common.pleaseEnter")'></el-input>
-		      		<span v-else="">{{row.remark}}</span>
+		      		<span v-else>{{row.remark}}</span>
 		      	</template>
 		      </el-table-column>
 		      <el-table-column

+ 598 - 0
imcs-ui/src/views/zuihou/resourceProductMgr/deviceMgr/Index.vue

@@ -0,0 +1,598 @@
+<template>
+  <div class="app-container">
+		<!-- 搜索模块 -->
+    <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 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"/>
+    	</span>
+      <span style="margin-left: 15px;">
+	      <el-button plain type="primary" icon="el-icon-search" size="medium" @click="search">
+	        {{ $t("table.search") }}
+	      </el-button>
+	      <el-button plain type="warning" icon="el-icon-refresh" size="medium" @click="reset">
+	        {{ $t("table.reset") }}
+	      </el-button>
+      </span>
+    </div>
+
+    <!-- 功能按钮 -->
+    <el-row class="filter-container">
+    	<el-col>
+    		<!--<el-button type="primary" icon="el-icon-s-tools" size="medium">{{ $t("resource.buttons.setBtn") }}</el-button>-->
+	      <!--<el-button type="danger" icon="el-icon-delete" size="medium" @click="batchDelete">
+	        {{ $t("table.delete") }}
+	      </el-button>-->
+    	</el-col>
+    </el-row>
+
+		<!-- 列表数据 -->
+    <el-table
+      :key="tableKey"
+      ref="table"
+      v-loading="loading"
+      :data="tableData.data"
+      border
+      fit
+      row-key="id"
+      style="width: 100%;"
+      highlight-current-row
+    	@current-change="handleCurrentChange"
+    >
+    	<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 prop="pic" :label='$t("resource.table.resours.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.resours.name")' :show-overflow-tooltip="true" width="180px"></el-table-column>
+      <el-table-column prop="code" :label='$t("resource.table.resours.no")' :show-overflow-tooltip="true" width="100px"></el-table-column>
+      <el-table-column prop="brand" :label='$t("resource.table.resours.brand")' width="100px"></el-table-column>
+      <el-table-column prop="specification" :label='$t("resource.table.resours.specification")'></el-table-column>
+      
+	  <el-table-column prop="capitalNo" :label='$t("resource.table.resours.capitalNo")'></el-table-column>
+	  <el-table-column prop="capitalName" :label='$t("resource.table.resours.capitalName")'></el-table-column>
+	  <el-table-column prop="capitalType" :label='$t("resource.table.resours.capitalType")'></el-table-column>
+	  <el-table-column prop="modeSpecification" :label='$t("resource.table.resours.modeSpecification")'></el-table-column>
+	  <el-table-column prop="capitalPrice" :label='$t("resource.table.resours.capitalPrice")'></el-table-column>
+	  <el-table-column prop="productionDate" :label='$t("resource.table.resours.productionDate")'></el-table-column>
+      <el-table-column prop="productionNo" :label='$t("resource.table.resours.productionNo")'></el-table-column>
+	  <el-table-column prop="manufacturer" :label='$t("resource.table.resours.manufacturer")'></el-table-column>
+   
+	  <el-table-column prop="model" :label='$t("resource.table.resours.model")'></el-table-column>
+      <el-table-column prop="category.data" :label='$t("resource.table.resours.category")' width="100px"></el-table-column>
+      <el-table-column prop="zoneName" :label='$t("resource.table.resours.zoneName")' width="180px"></el-table-column>
+      <el-table-column prop="positionCount" :label='$t("resource.table.resours.nums")' width="120px"></el-table-column>
+      <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 prop="linkStatus" :label='$t("resource.table.resours.linkStatus")' width="180px" align="center">
+      	<template slot-scope="{ row }">
+      		<div class="statusDiv" :style="'background:'+ row.linkStatus.background">{{row.linkStatus.text}}</div>
+      	</template>
+      </el-table-column>
+      <el-table-column prop="controlStatus" :label='$t("resource.table.resours.controlStatus")' width="180px" align="center">
+      	<template slot-scope="{ row }">
+      		<div class="statusDiv" :style="'background:'+ row.controlStatus.background">{{row.controlStatus.text}}</div>
+      	</template>
+      </el-table-column>
+      <el-table-column prop="productionStatus" :label='$t("resource.table.resours.productionStatus")' width="180px" align="center">
+      	<template slot-scope="{ row }">
+      		<div class="statusDiv" :style="'background:'+ row.productionStatus.background">{{row.productionStatus.text}}</div>
+      	</template>
+      </el-table-column>
+      <el-table-column
+        :label="$t('table.operation')"
+        fixed="right"
+        align="center"
+        column-key="operation"
+        width="180px"
+      >
+        <template slot-scope="{ row }">
+        	<!--<el-tooltip class="item" content="查看详情" effect="dark" placement="top-start">
+	          <i
+	            class="el-icon-view table-operation"
+	            style="color: #87d068;"
+	            @click="view(row)"
+	          />
+          </el-tooltip>-->
+          <el-tooltip class="item" :content='$t("resource.buttons.work")' effect="dark" placement="top-start">
+	          <i
+	            class="el-icon-location-information table-operation"
+	            style="color: #2db7f5;"
+	            @click="equipment(row)"
+	          />
+          </el-tooltip>
+          <el-tooltip class="item" :content='$t("resource.buttons.setting")' effect="dark" placement="top-start">
+	          <i
+	            class="el-icon-setting table-operation"
+	            style="color: #2db7f5;"
+	            @click="edit(row)"
+	          />
+          </el-tooltip>
+          <el-tooltip class="item" :content='$t("resource.buttons.hardware")' effect="dark" placement="top-start">
+	          <i
+	            class="el-icon-s-help table-operation"
+	            style="color: #2db7f5;"
+	            @click="editHardware(row)"
+	          />
+          </el-tooltip>
+		  <el-tooltip class="item" :content='$t("resource.buttons.autoCode")' effect="dark" placement="top-start" v-if="row.isAutoCode=='1'">
+	          <i
+	            class="el-icon-place table-operation"
+	            style="color: #2db7f5;"
+	            @click="autoCode(row)"
+	          />
+          </el-tooltip>
+          <el-tooltip class="item" :content='$t("resource.buttons.detailConf")' effect="dark" placement="top-start">
+	          <i
+	            class="el-icon-guide table-operation"
+	            style="color: #f50;"
+	            @click="detailConf(row)"
+	          />
+          </el-tooltip>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <!-- 分页 -->
+    <pagination
+      v-show="tableData.count > 0"
+      :limit.sync="queryParams.size"
+      :page.sync="queryParams.current"
+      :total="Number(tableData.count)"
+      @pagination="fetch"
+    />
+
+    <!-- 配置 -->
+    <tenant-edit
+      ref="edit"
+      :dialog-visible="dialog.isVisible"
+      :title="dialog.title"
+      @close="editClose"
+      @success="editSuccess"
+    />
+
+    <!-- 硬件配置 -->
+    <hardware
+      ref="hardware"
+      :dialog-visible="dialogHardware.isVisible"
+      :title="dialogHardware.title"
+      @close="editHardwareClose"
+      @success="editHardwareSuccess"
+    />
+	<!-- 生产资源资料  -->
+    <detailConf
+      ref="detailConf"
+      :dialog-visible="dialogDetailConf.isVisible"
+      :title="dialogDetailConf.title"
+      @close="editDetailConfClose"
+      @success="editDetailConfSuccess"
+    />
+	
+	<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
+      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>
+
+    <el-dialog
+		  :title='$t("resource.buttons.position")'
+		  :visible.sync="equipmentVisible"
+		  width="80%"
+		  custom-class="dialogNoTop"
+		>
+			<!--【	工作位置管理】 -->
+			<equipmentPosition :rowData="rowData" @close="editEquipmentClose" @success="editEquipmentSuccess" />
+
+		</el-dialog>
+
+  </div>
+</template>
+
+<script>
+	import Pagination from "@/components/Pagination"
+	import TenantEdit from "../resourcesMgr/components/Edit"
+	// 【硬件配置】
+	import Hardware from "../resourcesMgr/components/Hardware"
+	import AutoCode from "../resourcesMgr/components/AutoCode"
+	import DetailConf from "../resourcesMgr/components/DetailConf"
+	import TenantView from "../resourcesMgr/components/View"
+	// 【设备管理】-API
+	import equipmentMgrApi from "@/api/resourceProductMgr/equipmentMgr"
+	// 【工作位置管理】组件
+	import equipmentPosition from "../equipmentPosition/Index"
+	import elDragDialog from '@/directive/el-drag-dialog'
+	import { downloadFile, initEnums, initDicts, initQueryParams } from '@/utils/commons'
+	import axios from 'axios'
+	export default {
+	  name: "ResourcesMgr",
+	  directives: { elDragDialog },
+	  components: { Pagination, TenantEdit, Hardware, AutoCode, TenantView, DetailConf, equipmentMgrApi, equipmentPosition },
+	  props: {
+	  },
+	  data () {
+	    return {
+	    	currentRow: null, // 当前选中的行数据
+	    	equipmentVisible: false, // 设备管理
+			autoCodeVisible:false,  //节点配置			
+	    	rowData: {}, // row数据,
+	    	audioStatus: [],
+	      dialog: {
+	        isVisible: false,
+	        title: ""
+	      },
+	      dialogHardware: {
+	        isVisible: false,
+	        title: ""
+	      },
+		  dialogDetailConf: {
+	        isVisible: false,
+	        title: ""
+	      },		  
+	      preview: {
+	        isVisible: false,
+	        context: ''
+	      },
+	      tenantViewVisible: false,
+	      tableKey: 0,
+	      queryParams: initQueryParams({}),
+	      selection: [],
+	      loading: false,
+	      tableData: {
+	        count: 0
+	      },
+	      dicts: {
+          NATION: {}
+        },
+	      enums: {
+	        TenantTypeEnum: {},
+	        TenantStatusEnum: {}
+	      }
+	    }
+	  },
+	  // 实例已经在内存中创建好,此时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: {
+	  	// table的当前行值变化后
+	  	handleCurrentChange(val) {
+	  		// 设置当前行
+		    this.currentRow = val;
+		  },
+	  	// 【设备管理】按钮-事件
+	  	equipment(row){
+	  		this.rowData = row
+	  		this.equipmentVisible = true
+	  	},
+		// 【节点配置】按钮-事件
+		autoCode(row){
+	  		this.rowData = row
+	  		this.autoCodeVisible = true
+	  	},
+	  	editEquipmentClose(){
+	  		this.equipmentVisible = false
+	  	},
+	  	editEquipmentSuccess(data){
+	  		this.search()
+	  	},
+	    viewClose () {
+	      this.tenantViewVisible = false
+	    },
+	    editClose () {
+	      this.dialog.isVisible = false
+	    },
+	    editSuccess () {
+	      this.search()
+	    },
+		detailConf(row){
+			this.$refs.detailConf.type = 'edit'
+			this.$refs.detailConf.setTenant(row, this.dicts)
+            this.dialogDetailConf.isVisible = true
+		},
+	    // 【硬件配置】-确定
+	    editHardwareSuccess(){
+	    	this.search()
+	    },
+	    // 【硬件配置】-取消
+	    editHardwareClose (){
+	    	this.dialogHardware.isVisible = false
+	    },
+		editAutoCodeClose (){
+	    	this.autoCodeVisible = false
+	    },
+		editAutoCodeSuccess(){
+	    	this.search()
+	    },
+		editDetailConfClose (){
+	    	this.dialogDetailConf.isVisible = false
+	    },
+		editDetailConfSuccess(){
+	    	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.dicts)
+	      this.dialog.title = this.$t("common.add")
+	      this.dialog.isVisible = true
+	    },
+	    singleDelete (row) {
+	      this.$refs.table.clearSelection()
+	      this.$refs.table.toggleRowSelection(row, true)
+	      // 调用单个删除API
+      	this.remove(row)
+      	// 如果是多选删除API
+      	// this.batchDelete()
+	    },
+	    batchDelete () {
+	      /*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
+	      }*/
+
+	     	if(!this.currentRow){
+	     		this.$message({
+	          message: this.$t("tips.noDataSelected"),
+	          type: "warning"
+	        })
+	        return
+	     	}
+
+	      this.$confirm(this.$t("resource.tips.resourTips"), 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)
+		      })
+		      // 如果是多选删除API
+		      this.delete(ids)*/
+		     	// 调用删除API
+    		 	this.remove(this.currentRow)
+	      }).catch(() => {})
+	    },
+	    clearSelections () {
+	      this.$refs.table.clearSelection()
+	    },
+	    delete (ids) {
+	      equipmentMgrApi.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()
+	        }
+	      })
+	    },
+	    // 【单体-删除】-函数
+	    remove(row) {
+	    	this.$confirm(this.$t("resource.tips.resourTips"), this.$t("common.tips"), {
+	      	distinguishCancelAndClose: true,
+	        confirmButtonText: this.$t("common.confirm"),
+	        cancelButtonText: this.$t("common.cancel"),
+	        type: "warning"
+	      }).then(() => {
+		    	equipmentMgrApi.removeMore(row).then(response => {
+		        const res = response.data
+		        if (res.isSuccess) {
+		          this.$message({
+		            message: this.$t("tips.deleteSuccess"),
+		            type: "success"
+		          })
+		          // 查询列表
+		          this.search()
+		          // 清理已经删除的数据
+	          	this.$refs.table.clearSelection()
+		        }
+		      })
+		    }).catch(() => {
+		    })
+	    },
+	    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) {
+	      this.$refs.edit.setTenant(row, this.dicts)
+	      this.$refs.edit.type = "edit"
+	      this.dialog.title = this.$t("resource.common.peizhi")
+	      this.dialog.isVisible = true
+	    },
+
+	    // 【硬件配置】-事件
+	    editHardware (row) {
+	    	// 如果可以配置(agv、arm、machine)
+	    	let str = "agv,arm,machine";
+	    	if(str.indexOf(row.category.key) > -1) {
+	    		this.$refs.hardware.setTenant(row)
+		      this.$refs.hardware.type = "edit"
+		      this.dialogHardware.title = this.$t("resource.buttons.hardware")
+		      this.dialogHardware.isVisible = true
+	    	} else {
+	    		this.$message({
+              message: this.$t('resource.tips.hardware'),
+              type: 'warning'
+            })
+	    	}
+	    },
+		editAutoCode (row) {
+	    	//
+	    	this.dialogAutoCode.isVisible = true
+	    },
+
+	    fetch (params = {}) {
+	      this.loading = true
+	      if (this.queryParams.timeRange) {
+	        this.queryParams.map.createTime_st = this.queryParams.timeRange[0]
+	        this.queryParams.map.createTime_ed = this.queryParams.timeRange[1]
+	      }
+
+	      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.isAutoCode = "1"
+
+	      equipmentMgrApi.getPageList(this.queryParams).then(response => {
+	        const res = response.data
+	        if (res.isSuccess) {
+	          // 赋值
+	          this.tableData = res.data
+	          if(this.tableData.data && this.tableData.data.length > 0){
+	          	// 设置图片,放大属性
+	          	this.tableData.data.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 type="text/css">
+	.dialogNoTop .el-dialog__body{
+		padding: 0;
+	}
+</style>
+<style lang="scss" scoped>
+	.statusDiv{
+		color: white;
+		-moz-border-radius: 2px;
+		-webkit-border-radius: 2px;
+		border-radius: 2px;
+	}
+</style>