|
@@ -1,619 +1,619 @@
|
|
|
-<template>
|
|
|
- <div class="app-container">
|
|
|
- <!-- 搜索模块 -->
|
|
|
- <div class="filter-container">
|
|
|
- <span>
|
|
|
- <span>{{$t("resource.searchForm.resourceName")}}:</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.linkStatus")}}:</span>
|
|
|
- <el-select v-model="queryParams.model.status" :placeholder='$t("common.pleaseSelect")' size="medium" style="width: 150px;">
|
|
|
- <el-option
|
|
|
- v-for="item in audioStatus"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </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 v-has-permission="['eqpg:synchronization']" type="primary" icon="el-icon-connection" size="medium" @click="synchronousTool">{{$t("resource.buttons.tongbSk")}}</el-button>
|
|
|
- <el-button v-has-permission="['eqpg:upload']" type="primary" icon="el-icon-connection" size="medium" @click="editUpload">{{$t("resource.buttons.upload")}}</el-button>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
-
|
|
|
- <!-- 【设备】列表数据 -->
|
|
|
- <!-- 列表数据 -->
|
|
|
- <el-table
|
|
|
- :key="tableKey"
|
|
|
- ref="table"
|
|
|
- v-loading="loading"
|
|
|
- :data="tableData.data"
|
|
|
- border
|
|
|
- stripe
|
|
|
- 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.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")' width="180px"></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="nums" :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' ? '是' : '否'}}-->
|
|
|
-<!-- </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="programSynTime" :label='$t("resource.table.resours.programSynTime")' width="180px"></el-table-column>
|
|
|
- <el-table-column prop="programNum" :label='$t("resource.table.resours.programNum")' width="180px"></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>
|
|
|
- <pagination
|
|
|
- v-show="tableData.count > 0"
|
|
|
- :limit.sync="queryParams.size"
|
|
|
- :page.sync="queryParams.current"
|
|
|
- :total="Number(tableData.count)"
|
|
|
- @pagination="fetch"
|
|
|
- />
|
|
|
-
|
|
|
-
|
|
|
- <!-- 【程序】列表数据 -->
|
|
|
- <div class="tableTitle">{{$t("resource.common.programList")}}</div>
|
|
|
- <el-table
|
|
|
- :key="tableKey2"
|
|
|
- ref="table2"
|
|
|
- v-loading="loading2"
|
|
|
- :data="tableData2.records"
|
|
|
- border
|
|
|
- stripe
|
|
|
- fit
|
|
|
- row-key="id"
|
|
|
- style="width: 100%;"
|
|
|
- @selection-change="onSelectChange2"
|
|
|
- @cell-click="cellClick2"
|
|
|
- >
|
|
|
- <el-table-column :label='$t("common.serialNo")' width="55px" align="center">
|
|
|
- <template slot-scope="scope">
|
|
|
- <div>
|
|
|
- {{scope.$index+(queryParams2.current - 1) * queryParams2.size + 1}}
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column align="center" type="selection" width="50" :reserve-selection="true" />
|
|
|
-<!-- <el-table-column prop="no" :label='$t("resource.table.program.no")' :show-overflow-tooltip="true"></el-table-column>-->
|
|
|
- <el-table-column prop="name" :label='$t("resource.table.program.name")' width="280px"></el-table-column>
|
|
|
-<!-- <el-table-column prop="runTime" :label='$t("resource.table.program.runTime")' width="180px"></el-table-column>-->
|
|
|
- <el-table-column prop="size" :label='$t("resource.table.program.size")' width="180px"></el-table-column>
|
|
|
-<!-- <el-table-column prop="toolNums" :label='$t("resource.table.program.toolNums")' width="180px"></el-table-column>-->
|
|
|
-<!-- <el-table-column prop="version" :label='$t("resource.table.program.version")' width="180px"></el-table-column>-->
|
|
|
-<!-- <el-table-column prop="status" :label='$t("resource.table.program.status")' align="center" width="90px">-->
|
|
|
-<!-- <template slot-scope="{ row }">-->
|
|
|
-<!-- <el-tag :type="row.status=='1' ? 'success' : 'danger'">-->
|
|
|
-<!-- {{ row.status=='1' ? $t("common.show") : $t("common.hide") }}-->
|
|
|
-<!-- </el-tag>-->
|
|
|
-<!-- </template>-->
|
|
|
-<!-- </el-table-column>-->
|
|
|
- <el-table-column prop="synTime" :label='$t("resource.table.program.synTime")' width="250px"></el-table-column>
|
|
|
- <el-table-column
|
|
|
- :label="$t('table.operation')"
|
|
|
- align="center"
|
|
|
- column-key="operation"
|
|
|
- width="120px"
|
|
|
- >
|
|
|
- <template slot-scope="{ row }">
|
|
|
- <el-tooltip class="item" :content='$t("common.view")' 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.common.eqDelete")' effect="dark" placement="top-start">
|
|
|
- <i
|
|
|
- class="el-icon-delete table-operation"
|
|
|
- style="color: #f50f50;"
|
|
|
- @click="equipmentDelete(row)"
|
|
|
- />
|
|
|
- </el-tooltip>
|
|
|
- <a class="el-icon-download table-operation" style="color: #1890ff;" :href="row.filePath" :download="row.submittedFileName"></a>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- <pagination2
|
|
|
- v-show="tableData2.total > 0"
|
|
|
- :limit.sync="queryParams2.size"
|
|
|
- :page.sync="queryParams2.current"
|
|
|
- :total="Number(tableData2.total)"
|
|
|
- @pagination="fetch2"
|
|
|
- />
|
|
|
- <tenant-edit
|
|
|
- ref="edit"
|
|
|
- :dialog-visible="dialog.isVisible"
|
|
|
- :title="dialog.title"
|
|
|
- @close="editClose"
|
|
|
- @success="editSuccess"
|
|
|
- />
|
|
|
- <tenant-view
|
|
|
- ref="view"
|
|
|
- :dialog-visible="tenantViewVisible"
|
|
|
- @close="viewClose"
|
|
|
- />
|
|
|
-
|
|
|
- <!-- 上传附件 -->
|
|
|
- <tenant-upload
|
|
|
- ref="upload"
|
|
|
- :dialog-visible="dialogUpload.isVisible"
|
|
|
- :title="dialogUpload.title"
|
|
|
- @close="editUploadClose"
|
|
|
- @success="editUploadSuccess"
|
|
|
- />
|
|
|
- <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 Pagination from "@/components/Pagination"
|
|
|
- import Pagination2 from "@/components/Pagination"
|
|
|
- import TenantEdit from "./components/Edit"
|
|
|
- import TenantView from "./components/View"
|
|
|
- import TenantUpload from "./components/Upload"
|
|
|
- // 【程序中心】-API
|
|
|
- import programCenterApi from "@/api/resourceProductMgr/programCenter"
|
|
|
- // 【设备管理】-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: "WarehouseTypeMgr",
|
|
|
- directives: { elDragDialog },
|
|
|
- components: { Pagination, Pagination2, TenantEdit, TenantView,TenantUpload },
|
|
|
- props: {
|
|
|
- },
|
|
|
- data () {
|
|
|
- return {
|
|
|
- audioStatus: [],
|
|
|
- dialog: {
|
|
|
- isVisible: false,
|
|
|
- title: ""
|
|
|
- },
|
|
|
- preview: {
|
|
|
- isVisible: false,
|
|
|
- context: ''
|
|
|
- },
|
|
|
- dialogUpload: {
|
|
|
- isVisible: false,
|
|
|
- title: ""
|
|
|
- },
|
|
|
- tenantViewVisible: false,
|
|
|
- tableKey: 0,
|
|
|
- queryParams: initQueryParams({}),
|
|
|
- selection: [],
|
|
|
- loading: false,
|
|
|
- tableData: {
|
|
|
- total: 0
|
|
|
- },
|
|
|
- currentRow: null,
|
|
|
- tableKey2: 2,
|
|
|
- queryParams2: initQueryParams({}),
|
|
|
- selection2: [],
|
|
|
- loading2: false,
|
|
|
- tableData2: {
|
|
|
- total: 0
|
|
|
- },
|
|
|
- dicts: {
|
|
|
- MONITOR_WAY: {}
|
|
|
- },
|
|
|
- enums: {
|
|
|
- TenantTypeEnum: {},
|
|
|
- TenantStatusEnum: {}
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
|
|
|
- created() {
|
|
|
- // 调用常量-审核状态
|
|
|
- this.audioStatus = this.$constWKS.INLINESTATUSLIST
|
|
|
- // 加载【字典】
|
|
|
- initDicts(['MONITOR_WAY'], this.dicts);
|
|
|
- // 加载【设备】列表数据
|
|
|
- this.fetch()
|
|
|
- },
|
|
|
- computed: {
|
|
|
- currentUser () {
|
|
|
- return this.$store.state.account.user
|
|
|
- },
|
|
|
- nationList() {
|
|
|
- return convertEnum(this.dicts.MONITOR_WAY)
|
|
|
- }
|
|
|
- },
|
|
|
- mounted () {
|
|
|
-
|
|
|
- },
|
|
|
- methods: {
|
|
|
- // 【同步数控程序】按钮-事件
|
|
|
- synchronousTool(){
|
|
|
- if (!this.selection.length) {
|
|
|
- this.$message({
|
|
|
- message: this.$t("tips.noDataSelected"),
|
|
|
- type: "warning"
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
- let resourceIdList = []
|
|
|
- this.selection.map(item => {
|
|
|
- resourceIdList.push(item.id)
|
|
|
- })
|
|
|
- programCenterApi.synchronousNumericalProgram({resourceIdList}).then(res => {
|
|
|
- res = res.data
|
|
|
- // console.log("同步数控程序】: ", res)
|
|
|
- if(res.isSuccess){
|
|
|
- this.$message({
|
|
|
- message: this.$t("resource.tips.tongbTips"),
|
|
|
- type: "success"
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
-
|
|
|
- // 上传框弹出
|
|
|
- editUpload(){
|
|
|
- if (this.selection.length!=1) {
|
|
|
- this.$message({
|
|
|
- message: this.$t("tips.mustOne"),
|
|
|
- type: "warning"
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
- let row = this.selection[0];
|
|
|
- this.$refs.upload.setTenant(row, this.dicts)
|
|
|
- this.$refs.upload.type = "upload"
|
|
|
- this.dialogUpload.title = this.$t("resource.buttons.upload")
|
|
|
- this.dialogUpload.isVisible = true
|
|
|
-
|
|
|
- },
|
|
|
- // 【从设备删除】按钮-事件
|
|
|
- equipmentDelete(row){
|
|
|
- this.$confirm(this.$t("resource.tips.deletePg"), this.$t("common.tips"), {
|
|
|
- distinguishCancelAndClose: true,
|
|
|
- confirmButtonText: this.$t("common.confirm"),
|
|
|
- cancelButtonText: this.$t("common.cancel"),
|
|
|
- type: "warning"
|
|
|
- }).then(() => {
|
|
|
- programCenterApi.equipmentDelete(row).then(res => {
|
|
|
- // console.log("【从设备删除】: ", res)
|
|
|
- res = res.data
|
|
|
- if (res.isSuccess) {
|
|
|
- this.$message({
|
|
|
- message: this.$t("tips.deleteSuccess"),
|
|
|
- type: "success"
|
|
|
- })
|
|
|
- // 加载【刀具列表】数据
|
|
|
- this.fetch2()
|
|
|
- // 清理已经删除的数据
|
|
|
- this.$refs.table2.clearSelection()
|
|
|
- }
|
|
|
- })
|
|
|
- }).catch(() => {})
|
|
|
- },
|
|
|
- //【执行程序】按钮-事件
|
|
|
- implementProgram(row){
|
|
|
- this.$confirm(this.$t("resource.tips.zxTips"), this.$t("common.tips"), {
|
|
|
- distinguishCancelAndClose: true,
|
|
|
- confirmButtonText: this.$t("common.confirm"),
|
|
|
- cancelButtonText: this.$t("common.cancel"),
|
|
|
- type: "warning"
|
|
|
- }).then(() => {
|
|
|
- programCenterApi.implementProgram(row).then(res => {
|
|
|
- // console.log("【执行程序】: ", res)
|
|
|
- res = res.data
|
|
|
- if (res.isSuccess) {
|
|
|
- this.$message({
|
|
|
- message: this.$t("resource.tips.zhixingTips"),
|
|
|
- type: "success"
|
|
|
- })
|
|
|
- // 加载【刀具列表】数据
|
|
|
- this.fetch2()
|
|
|
- }
|
|
|
- })
|
|
|
- }).catch(() => {})
|
|
|
- },
|
|
|
- // 选择当前行数据(设备列表)
|
|
|
- handleCurrentChange(val) {
|
|
|
- this.currentRow = val;
|
|
|
- // 加载【刀具列表】数据
|
|
|
- this.fetch2()
|
|
|
- },
|
|
|
- viewClose () {
|
|
|
- this.tenantViewVisible = false
|
|
|
- },
|
|
|
- editClose () {
|
|
|
- this.dialog.isVisible = false
|
|
|
- },
|
|
|
- editUploadClose (){
|
|
|
- this.dialogUpload.isVisible = false
|
|
|
- },
|
|
|
- editSuccess () {
|
|
|
- this.search()
|
|
|
- },
|
|
|
- editUploadSuccess(){
|
|
|
- this.search()
|
|
|
- },
|
|
|
-
|
|
|
- // 当选择项发生变化时会触发该事件
|
|
|
- onSelectChange (selection) {
|
|
|
- // console.log("当选择项发生变化时会触发该事件:", this.selection)
|
|
|
- this.selection = selection
|
|
|
- // 加载【刀具列表】数据
|
|
|
- this.fetch2()
|
|
|
- },
|
|
|
- onSelectChange2 (selection2) {
|
|
|
- this.selection2 = selection2
|
|
|
- },
|
|
|
- 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)
|
|
|
- this.batchDelete()
|
|
|
- },
|
|
|
- batchDelete () {
|
|
|
- if (!this.selection.length) {
|
|
|
- this.$message({
|
|
|
- message: this.$t("tips.noDataSelected"),
|
|
|
- type: "warning"
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- this.$confirm(this.$t("lineSide.tips.wareTips"), 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) {
|
|
|
- programCenterApi.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.edit.setTenant(row, this.dicts)
|
|
|
- this.$refs.edit.type = "view"
|
|
|
- this.dialog.title = this.$t("common.view")
|
|
|
- this.dialog.isVisible = 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.setJiankong")
|
|
|
- this.dialog.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.displayStatus = "1";
|
|
|
- this.queryParams.cncProgram = "1";
|
|
|
- this.queryParams.displayStatus = "1";
|
|
|
- equipmentMgrApi.getPageList(this.queryParams).then(response => {
|
|
|
- const res = response.data
|
|
|
- if (res.isSuccess) {
|
|
|
- // 赋值
|
|
|
- this.tableData = res.data
|
|
|
- this.tableData.count = this.tableData.data.length
|
|
|
- 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];
|
|
|
- })
|
|
|
- // 默认点击第一条数据
|
|
|
- //this.$refs.table.setCurrentRow(this.tableData.data[0]); // 单选
|
|
|
- this.$refs.table.toggleRowSelection(this.tableData.data[0], true) // 多选
|
|
|
- // 加载【刀具列表】数据
|
|
|
- this.fetch2()
|
|
|
- }
|
|
|
- }
|
|
|
- // 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)
|
|
|
- }
|
|
|
- },
|
|
|
- fetch2 (params = {}) {
|
|
|
- // console.log("当前的选中行:", this.selection)
|
|
|
- this.loading2 = true
|
|
|
- if (this.queryParams2.timeRange) {
|
|
|
- this.queryParams2.map.createTime_st = this.queryParams2.timeRange[0]
|
|
|
- this.queryParams2.map.createTime_ed = this.queryParams2.timeRange[1]
|
|
|
- }
|
|
|
-
|
|
|
- this.queryParams2.current = params.current ? params.current : this.queryParams2.current
|
|
|
- this.queryParams2.size = params.size ? params.size : this.queryParams2.size
|
|
|
-
|
|
|
- // 传【设备】id数组
|
|
|
- let resourceIdList = []
|
|
|
- if(this.selection && this.selection.length > 0){
|
|
|
- this.selection.map(item => {
|
|
|
- resourceIdList.push(item.id)
|
|
|
- })
|
|
|
- }
|
|
|
- this.queryParams2.model.resourceIdList = resourceIdList
|
|
|
- programCenterApi.page(this.queryParams2).then(response => {
|
|
|
- const res = response.data
|
|
|
- if (res.isSuccess) {
|
|
|
- this.tableData2 = res.data
|
|
|
- }
|
|
|
- // eslint-disable-next-line no-return-assign
|
|
|
- }).finally(() => this.loading2 = false)
|
|
|
-
|
|
|
- },
|
|
|
- cellClick2 (row, column) {
|
|
|
- if (column['columnKey'] === "operation") {
|
|
|
- return
|
|
|
- }
|
|
|
- let flag = false
|
|
|
- this.selection2.forEach((item) => {
|
|
|
- if (item.id === row.id) {
|
|
|
- flag = true
|
|
|
- this.$refs.table2.toggleRowSelection(row)
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- if (!flag) {
|
|
|
- this.$refs.table2.toggleRowSelection(row, true)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-</script>
|
|
|
-<style lang="scss" scoped>
|
|
|
- .tableTitle{
|
|
|
- background: #EEEEEE;
|
|
|
- font-weight: bold;
|
|
|
- padding: 15px 10px;
|
|
|
- }
|
|
|
-</style>
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <!-- 搜索模块 -->
|
|
|
+ <div class="filter-container">
|
|
|
+ <span>
|
|
|
+ <span>{{$t("resource.searchForm.resourceName")}}:</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.linkStatus")}}:</span>
|
|
|
+ <el-select v-model="queryParams.model.status" :placeholder='$t("common.pleaseSelect")' size="medium" style="width: 150px;">
|
|
|
+ <el-option
|
|
|
+ v-for="item in audioStatus"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </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 v-has-permission="['eqpg:synchronization']" type="primary" icon="el-icon-connection" size="medium" @click="synchronousTool">{{$t("resource.buttons.tongbSk")}}</el-button>
|
|
|
+ <el-button v-has-permission="['eqpg:upload']" type="primary" icon="el-icon-connection" size="medium" @click="editUpload">{{$t("resource.buttons.upload")}}</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <!-- 【设备】列表数据 -->
|
|
|
+ <!-- 列表数据 -->
|
|
|
+ <el-table
|
|
|
+ :key="tableKey"
|
|
|
+ ref="table"
|
|
|
+ v-loading="loading"
|
|
|
+ :data="tableData.data"
|
|
|
+ border
|
|
|
+ stripe
|
|
|
+ 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.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")' width="180px"></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="nums" :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' ? '是' : '否'}}-->
|
|
|
+<!-- </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="programSynTime" :label='$t("resource.table.resours.programSynTime")' width="180px"></el-table-column>
|
|
|
+ <el-table-column prop="programNum" :label='$t("resource.table.resours.programNum")' width="180px"></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>
|
|
|
+ <pagination
|
|
|
+ v-show="tableData.count > 0"
|
|
|
+ :limit.sync="queryParams.size"
|
|
|
+ :page.sync="queryParams.current"
|
|
|
+ :total="Number(tableData.count)"
|
|
|
+ @pagination="fetch"
|
|
|
+ />
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 【程序】列表数据 -->
|
|
|
+ <div class="tableTitle">{{$t("resource.common.programList")}}</div>
|
|
|
+ <el-table
|
|
|
+ :key="tableKey2"
|
|
|
+ ref="table2"
|
|
|
+ v-loading="loading2"
|
|
|
+ :data="tableData2.records"
|
|
|
+ border
|
|
|
+ stripe
|
|
|
+ fit
|
|
|
+ row-key="id"
|
|
|
+ style="width: 100%;"
|
|
|
+ @selection-change="onSelectChange2"
|
|
|
+ @cell-click="cellClick2"
|
|
|
+ >
|
|
|
+ <el-table-column :label='$t("common.serialNo")' width="55px" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div>
|
|
|
+ {{scope.$index+(queryParams2.current - 1) * queryParams2.size + 1}}
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column align="center" type="selection" width="50" :reserve-selection="true" />
|
|
|
+<!-- <el-table-column prop="no" :label='$t("resource.table.program.no")' :show-overflow-tooltip="true"></el-table-column>-->
|
|
|
+ <el-table-column prop="name" :label='$t("resource.table.program.name")' width="280px"></el-table-column>
|
|
|
+<!-- <el-table-column prop="runTime" :label='$t("resource.table.program.runTime")' width="180px"></el-table-column>-->
|
|
|
+ <el-table-column prop="size" :label='$t("resource.table.program.size")' width="180px"></el-table-column>
|
|
|
+<!-- <el-table-column prop="toolNums" :label='$t("resource.table.program.toolNums")' width="180px"></el-table-column>-->
|
|
|
+<!-- <el-table-column prop="version" :label='$t("resource.table.program.version")' width="180px"></el-table-column>-->
|
|
|
+<!-- <el-table-column prop="status" :label='$t("resource.table.program.status")' align="center" width="90px">-->
|
|
|
+<!-- <template slot-scope="{ row }">-->
|
|
|
+<!-- <el-tag :type="row.status=='1' ? 'success' : 'danger'">-->
|
|
|
+<!-- {{ row.status=='1' ? $t("common.show") : $t("common.hide") }}-->
|
|
|
+<!-- </el-tag>-->
|
|
|
+<!-- </template>-->
|
|
|
+<!-- </el-table-column>-->
|
|
|
+ <el-table-column prop="synTime" :label='$t("resource.table.program.synTime")' width="250px"></el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ :label="$t('table.operation')"
|
|
|
+ align="center"
|
|
|
+ column-key="operation"
|
|
|
+ width="120px"
|
|
|
+ >
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <el-tooltip class="item" :content='$t("common.view")' 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.common.eqDelete")' effect="dark" placement="top-start">
|
|
|
+ <i
|
|
|
+ class="el-icon-delete table-operation"
|
|
|
+ style="color: #f50f50;"
|
|
|
+ @click="equipmentDelete(row)"
|
|
|
+ />
|
|
|
+ </el-tooltip>
|
|
|
+ <a class="el-icon-download table-operation" style="color: #1890ff;" :href="row.filePath" :download="row.submittedFileName"></a>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <pagination2
|
|
|
+ v-show="tableData2.total > 0"
|
|
|
+ :limit.sync="queryParams2.size"
|
|
|
+ :page.sync="queryParams2.current"
|
|
|
+ :total="Number(tableData2.total)"
|
|
|
+ @pagination="fetch2"
|
|
|
+ />
|
|
|
+ <tenant-edit
|
|
|
+ ref="edit"
|
|
|
+ :dialog-visible="dialog.isVisible"
|
|
|
+ :title="dialog.title"
|
|
|
+ @close="editClose"
|
|
|
+ @success="editSuccess"
|
|
|
+ />
|
|
|
+ <tenant-view
|
|
|
+ ref="view"
|
|
|
+ :dialog-visible="tenantViewVisible"
|
|
|
+ @close="viewClose"
|
|
|
+ />
|
|
|
+
|
|
|
+ <!-- 上传附件 -->
|
|
|
+ <tenant-upload
|
|
|
+ ref="upload"
|
|
|
+ :dialog-visible="dialogUpload.isVisible"
|
|
|
+ :title="dialogUpload.title"
|
|
|
+ @close="editUploadClose"
|
|
|
+ @success="editUploadSuccess"
|
|
|
+ />
|
|
|
+ <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 Pagination from "@/components/Pagination"
|
|
|
+ import Pagination2 from "@/components/Pagination"
|
|
|
+ import TenantEdit from "./components/Edit"
|
|
|
+ import TenantView from "./components/View"
|
|
|
+ import TenantUpload from "./components/Upload"
|
|
|
+ // 【程序中心】-API
|
|
|
+ import programCenterApi from "@/api/resourceProductMgr/programCenter"
|
|
|
+ // 【设备管理】-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: "WarehouseTypeMgr",
|
|
|
+ directives: { elDragDialog },
|
|
|
+ components: { Pagination, Pagination2, TenantEdit, TenantView,TenantUpload },
|
|
|
+ props: {
|
|
|
+ },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ audioStatus: [],
|
|
|
+ dialog: {
|
|
|
+ isVisible: false,
|
|
|
+ title: ""
|
|
|
+ },
|
|
|
+ preview: {
|
|
|
+ isVisible: false,
|
|
|
+ context: ''
|
|
|
+ },
|
|
|
+ dialogUpload: {
|
|
|
+ isVisible: false,
|
|
|
+ title: ""
|
|
|
+ },
|
|
|
+ tenantViewVisible: false,
|
|
|
+ tableKey: 0,
|
|
|
+ queryParams: initQueryParams({}),
|
|
|
+ selection: [],
|
|
|
+ loading: false,
|
|
|
+ tableData: {
|
|
|
+ total: 0
|
|
|
+ },
|
|
|
+ currentRow: null,
|
|
|
+ tableKey2: 2,
|
|
|
+ queryParams2: initQueryParams({}),
|
|
|
+ selection2: [],
|
|
|
+ loading2: false,
|
|
|
+ tableData2: {
|
|
|
+ total: 0
|
|
|
+ },
|
|
|
+ dicts: {
|
|
|
+ MONITOR_WAY: {}
|
|
|
+ },
|
|
|
+ enums: {
|
|
|
+ TenantTypeEnum: {},
|
|
|
+ TenantStatusEnum: {}
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
|
|
|
+ created() {
|
|
|
+ // 调用常量-审核状态
|
|
|
+ this.audioStatus = this.$constWKS.INLINESTATUSLIST
|
|
|
+ // 加载【字典】
|
|
|
+ initDicts(['MONITOR_WAY'], this.dicts);
|
|
|
+ // 加载【设备】列表数据
|
|
|
+ this.fetch()
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ currentUser () {
|
|
|
+ return this.$store.state.account.user
|
|
|
+ },
|
|
|
+ nationList() {
|
|
|
+ return convertEnum(this.dicts.MONITOR_WAY)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
+
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 【同步数控程序】按钮-事件
|
|
|
+ synchronousTool(){
|
|
|
+ if (!this.selection.length) {
|
|
|
+ this.$message({
|
|
|
+ message: this.$t("tips.noDataSelected"),
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let resourceIdList = []
|
|
|
+ this.selection.map(item => {
|
|
|
+ resourceIdList.push(item.id)
|
|
|
+ })
|
|
|
+ programCenterApi.synchronousNumericalProgram({resourceIdList}).then(res => {
|
|
|
+ res = res.data
|
|
|
+ // console.log("同步数控程序】: ", res)
|
|
|
+ if(res.isSuccess){
|
|
|
+ this.$message({
|
|
|
+ message: this.$t("resource.tips.tongbTips"),
|
|
|
+ type: "success"
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ // 上传框弹出
|
|
|
+ editUpload(){
|
|
|
+ if (this.selection.length!=1) {
|
|
|
+ this.$message({
|
|
|
+ message: this.$t("tips.mustOne"),
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let row = this.selection[0];
|
|
|
+ this.$refs.upload.setTenant(row, this.dicts)
|
|
|
+ this.$refs.upload.type = "upload"
|
|
|
+ this.dialogUpload.title = this.$t("resource.buttons.upload")
|
|
|
+ this.dialogUpload.isVisible = true
|
|
|
+
|
|
|
+ },
|
|
|
+ // 【从设备删除】按钮-事件
|
|
|
+ equipmentDelete(row){
|
|
|
+ this.$confirm(this.$t("resource.tips.deletePg"), this.$t("common.tips"), {
|
|
|
+ distinguishCancelAndClose: true,
|
|
|
+ confirmButtonText: this.$t("common.confirm"),
|
|
|
+ cancelButtonText: this.$t("common.cancel"),
|
|
|
+ type: "warning"
|
|
|
+ }).then(() => {
|
|
|
+ programCenterApi.equipmentDelete(row).then(res => {
|
|
|
+ // console.log("【从设备删除】: ", res)
|
|
|
+ res = res.data
|
|
|
+ if (res.isSuccess) {
|
|
|
+ this.$message({
|
|
|
+ message: this.$t("tips.deleteSuccess"),
|
|
|
+ type: "success"
|
|
|
+ })
|
|
|
+ // 加载【刀具列表】数据
|
|
|
+ this.fetch2()
|
|
|
+ // 清理已经删除的数据
|
|
|
+ this.$refs.table2.clearSelection()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }).catch(() => {})
|
|
|
+ },
|
|
|
+ //【执行程序】按钮-事件
|
|
|
+ implementProgram(row){
|
|
|
+ this.$confirm(this.$t("resource.tips.zxTips"), this.$t("common.tips"), {
|
|
|
+ distinguishCancelAndClose: true,
|
|
|
+ confirmButtonText: this.$t("common.confirm"),
|
|
|
+ cancelButtonText: this.$t("common.cancel"),
|
|
|
+ type: "warning"
|
|
|
+ }).then(() => {
|
|
|
+ programCenterApi.implementProgram(row).then(res => {
|
|
|
+ // console.log("【执行程序】: ", res)
|
|
|
+ res = res.data
|
|
|
+ if (res.isSuccess) {
|
|
|
+ this.$message({
|
|
|
+ message: this.$t("resource.tips.zhixingTips"),
|
|
|
+ type: "success"
|
|
|
+ })
|
|
|
+ // 加载【刀具列表】数据
|
|
|
+ this.fetch2()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }).catch(() => {})
|
|
|
+ },
|
|
|
+ // 选择当前行数据(设备列表)
|
|
|
+ handleCurrentChange(val) {
|
|
|
+ this.currentRow = val;
|
|
|
+ // 加载【刀具列表】数据
|
|
|
+ this.fetch2()
|
|
|
+ },
|
|
|
+ viewClose () {
|
|
|
+ this.tenantViewVisible = false
|
|
|
+ },
|
|
|
+ editClose () {
|
|
|
+ this.dialog.isVisible = false
|
|
|
+ },
|
|
|
+ editUploadClose (){
|
|
|
+ this.dialogUpload.isVisible = false
|
|
|
+ },
|
|
|
+ editSuccess () {
|
|
|
+ this.search()
|
|
|
+ },
|
|
|
+ editUploadSuccess(){
|
|
|
+ this.search()
|
|
|
+ },
|
|
|
+
|
|
|
+ // 当选择项发生变化时会触发该事件
|
|
|
+ onSelectChange (selection) {
|
|
|
+ // console.log("当选择项发生变化时会触发该事件:", this.selection)
|
|
|
+ this.selection = selection
|
|
|
+ // 加载【刀具列表】数据
|
|
|
+ this.fetch2()
|
|
|
+ },
|
|
|
+ onSelectChange2 (selection2) {
|
|
|
+ this.selection2 = selection2
|
|
|
+ },
|
|
|
+ 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)
|
|
|
+ this.batchDelete()
|
|
|
+ },
|
|
|
+ batchDelete () {
|
|
|
+ if (!this.selection.length) {
|
|
|
+ this.$message({
|
|
|
+ message: this.$t("tips.noDataSelected"),
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$confirm(this.$t("lineSide.tips.wareTips"), 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) {
|
|
|
+ programCenterApi.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.edit.setTenant(row, this.dicts)
|
|
|
+ this.$refs.edit.type = "view"
|
|
|
+ this.dialog.title = this.$t("common.view")
|
|
|
+ this.dialog.isVisible = 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.setJiankong")
|
|
|
+ this.dialog.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.displayStatus = "1";
|
|
|
+ this.queryParams.cncProgram = "1";
|
|
|
+ this.queryParams.displayStatus = "1";
|
|
|
+ equipmentMgrApi.getPageList(this.queryParams).then(response => {
|
|
|
+ const res = response.data;
|
|
|
+ if (res.isSuccess) {
|
|
|
+ // 赋值
|
|
|
+ this.tableData = res.data
|
|
|
+ this.tableData.count = res.data.count;
|
|
|
+ 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];
|
|
|
+ })
|
|
|
+ // 默认点击第一条数据
|
|
|
+ //this.$refs.table.setCurrentRow(this.tableData.data[0]); // 单选
|
|
|
+ this.$refs.table.toggleRowSelection(this.tableData.data[0], true) // 多选
|
|
|
+ // 加载【刀具列表】数据
|
|
|
+ this.fetch2()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 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)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fetch2 (params = {}) {
|
|
|
+ // console.log("当前的选中行:", this.selection)
|
|
|
+ this.loading2 = true
|
|
|
+ if (this.queryParams2.timeRange) {
|
|
|
+ this.queryParams2.map.createTime_st = this.queryParams2.timeRange[0]
|
|
|
+ this.queryParams2.map.createTime_ed = this.queryParams2.timeRange[1]
|
|
|
+ }
|
|
|
+
|
|
|
+ this.queryParams2.current = params.current ? params.current : this.queryParams2.current
|
|
|
+ this.queryParams2.size = params.size ? params.size : this.queryParams2.size
|
|
|
+
|
|
|
+ // 传【设备】id数组
|
|
|
+ let resourceIdList = []
|
|
|
+ if(this.selection && this.selection.length > 0){
|
|
|
+ this.selection.map(item => {
|
|
|
+ resourceIdList.push(item.id)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.queryParams2.model.resourceIdList = resourceIdList
|
|
|
+ programCenterApi.page(this.queryParams2).then(response => {
|
|
|
+ const res = response.data
|
|
|
+ if (res.isSuccess) {
|
|
|
+ this.tableData2 = res.data
|
|
|
+ }
|
|
|
+ // eslint-disable-next-line no-return-assign
|
|
|
+ }).finally(() => this.loading2 = false)
|
|
|
+
|
|
|
+ },
|
|
|
+ cellClick2 (row, column) {
|
|
|
+ if (column['columnKey'] === "operation") {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let flag = false
|
|
|
+ this.selection2.forEach((item) => {
|
|
|
+ if (item.id === row.id) {
|
|
|
+ flag = true
|
|
|
+ this.$refs.table2.toggleRowSelection(row)
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ if (!flag) {
|
|
|
+ this.$refs.table2.toggleRowSelection(row, true)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+ .tableTitle{
|
|
|
+ background: #EEEEEE;
|
|
|
+ font-weight: bold;
|
|
|
+ padding: 15px 10px;
|
|
|
+ }
|
|
|
+</style>
|