|
@@ -1,376 +1,377 @@
|
|
|
<template>
|
|
|
- <div class="app-container">
|
|
|
- <!-- 搜索模块 -->
|
|
|
- <div class="filter-container">
|
|
|
- <span>
|
|
|
- <span>{{$t("cuttingTool.searchForm.customizeCuttingtool.cuttingtoolName")}}:</span>
|
|
|
- <el-input v-model="queryParams.model.cuttingToolName" :placeholder='$t("common.pleaseEnter")' style="width: 120px;" size="medium"/>
|
|
|
- </span>
|
|
|
- <span style="margin-left: 15px;">
|
|
|
- <span>{{$t("cuttingTool.searchForm.customizeCuttingtool.specifications")}}:</span>
|
|
|
- <el-input v-model="queryParams.model.specifications" :placeholder='$t("common.pleaseEnter")' style="width: 120px;" size="medium"/>
|
|
|
- </span>
|
|
|
+ <div class="app-container">
|
|
|
+ <!-- 搜索模块 -->
|
|
|
+ <div class="filter-container">
|
|
|
+ <span>
|
|
|
+ <span>{{$t("cuttingTool.searchForm.customizeCuttingtool.cuttingtoolName")}}:</span>
|
|
|
+ <el-input v-model="queryParams.model.cuttingToolName" :placeholder='$t("common.pleaseEnter")' style="width: 120px;" size="medium"/>
|
|
|
+ </span>
|
|
|
+ <span style="margin-left: 15px;">
|
|
|
+ <span>{{$t("cuttingTool.searchForm.customizeCuttingtool.specifications")}}:</span>
|
|
|
+ <el-input v-model="queryParams.model.specifications" :placeholder='$t("common.pleaseEnter")' style="width: 120px;" size="medium"/>
|
|
|
+ </span>
|
|
|
+ <!-- <span style="margin-left: 15px;">
|
|
|
+ <span>{{$t("cuttingTool.searchForm.customizeCuttingtool.deviceId")}}:</span>
|
|
|
+ <el-select v-model="queryParams.model.deviceId" :placeholder='$t("common.pleaseSelect")' style="width: 150px;">
|
|
|
+ <el-option :key="item.name" :label="item.name" :value="item.id" v-for="(item, index) in deviceData.records" />
|
|
|
+ </el-select>
|
|
|
+ </span>-->
|
|
|
<span style="margin-left: 15px;">
|
|
|
- <span>{{$t("cuttingTool.searchForm.customizeCuttingtool.deviceId")}}:</span>
|
|
|
- <el-select v-model="queryParams.model.deviceId" :placeholder='$t("common.pleaseSelect")' style="width: 150px;">
|
|
|
- <el-option :key="item.name" :label="item.name" :value="item.id" v-for="(item, index) in deviceData.records" />
|
|
|
- </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 type="primary" icon="el-icon-plus" size="medium" @click="add">{{ $t("common.add") }}</el-button>
|
|
|
- <el-button type="success" icon="el-icon-edit" size="medium" @click="editOne">
|
|
|
- {{ $t("common.edit") }}
|
|
|
- </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.records"
|
|
|
- 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 align="center" prop="cuttingToolName" :label='$t("cuttingTool.table.customizeCuttingtool.cuttingToolName")' :show-overflow-tooltip="true"></el-table-column>
|
|
|
- <!-- 刀具规格 -->
|
|
|
- <el-table-column align="center" prop="specifications" :label='$t("cuttingTool.table.customizeCuttingtool.specifications")' :show-overflow-tooltip="true"></el-table-column>
|
|
|
- <!-- 设备名称 -->
|
|
|
- <el-table-column align="center" prop="deviceName" :label='$t("cuttingTool.table.customizeCuttingtool.storgeName")' :show-overflow-tooltip="true">
|
|
|
- <template slot-scope="{ row }">
|
|
|
- {{row['deviceName']? row['deviceName'] : row['storgeName']}}
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <!-- 刀具类型 -->
|
|
|
- <el-table-column align="center"
|
|
|
- :filter-multiple="false"
|
|
|
- :filters="cuttingToolTypeList"
|
|
|
- column-key="cuttingToolType.key"
|
|
|
- :label="$t('cuttingTool.table.customizeCuttingtool.cuttingToolType')"
|
|
|
- :show-overflow-tooltip="true"
|
|
|
- >
|
|
|
- <template slot-scope="scope">
|
|
|
- <span>{{ scope.row.cuttingToolType['data'] ? scope.row.cuttingToolType['data'] : scope.row.cuttingToolType['key'] }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <!-- 刀具图片 -->
|
|
|
-<!-- <el-table-column prop="cuttingToolPicture" :label='$t("cuttingTool.table.customizeCuttingtool.cuttingToolPicture")' :show-overflow-tooltip="true"></el-table-column>-->
|
|
|
- <el-table-column align="center" :label='$t("cuttingTool.table.customizeCuttingtool.cuttingToolPicture")' :show-overflow-tooltip="true">
|
|
|
- <template slot-scope="{ row }">
|
|
|
- <el-image
|
|
|
- style="width: 100px; height: 100px"
|
|
|
- :src="row.cuttingToolPicture"
|
|
|
- :preview-src-list="[row.cuttingToolPicture]">
|
|
|
- </el-image>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <!-- 装夹方式 -->
|
|
|
- <el-table-column align="center" :label='$t("cuttingTool.table.customizeCuttingtool.cuttingToolInstallPicture")' :show-overflow-tooltip="true">
|
|
|
- <template slot-scope="{ row }">
|
|
|
- <el-image
|
|
|
- style="width: 100px; height: 100px"
|
|
|
- :src="row.cuttingToolInstallPicture"
|
|
|
- :preview-src-list="[row.cuttingToolInstallPicture]">
|
|
|
- </el-image>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <!-- 启用状态 -->
|
|
|
- <el-table-column prop="status" :label='$t("runCenter.table.oder.status")' align="center">
|
|
|
- <template slot-scope="{ row }">
|
|
|
- <el-tag :type="row.status=='1' ? 'success' : 'danger'">
|
|
|
- {{ row.status=='1' ? $t("common.status.valid") : $t("common.frozen") }}
|
|
|
- </el-tag>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <!-- 启用状态 -->
|
|
|
- <el-table-column prop="programId" :label='$t("runCenter.table.oder.state")' align="center">
|
|
|
- <template slot-scope="{ row }">
|
|
|
- <el-tag :type="row.programId==null ? 'success' : 'danger'">
|
|
|
- {{ row.programId==null ? '可用' : '占用' }}
|
|
|
- </el-tag>
|
|
|
- </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 class="item" :content='$t("common.edit")' effect="dark" placement="top-start">
|
|
|
- {{row.cutterNo}}
|
|
|
- <i
|
|
|
- v-if="row.cutterNo==0"
|
|
|
- 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
|
|
|
- v-if="row.cutterNo==0"
|
|
|
- class="el-icon-delete table-operation"
|
|
|
- style="color: #f50;"
|
|
|
- @click="singleDelete(row)"
|
|
|
- />
|
|
|
- </el-tooltip>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- <pagination
|
|
|
- v-show="tableData.total > 0"
|
|
|
- :limit.sync="queryParams.size"
|
|
|
- :page.sync="queryParams.current"
|
|
|
- :total="Number(tableData.total)"
|
|
|
- @pagination="fetch"
|
|
|
- />
|
|
|
- <edit
|
|
|
- ref="edit"
|
|
|
- :dialog-visible="dialog.isVisible"
|
|
|
- :title="dialog.title"
|
|
|
- @close="editClose"
|
|
|
- @success="editSuccess"
|
|
|
- />
|
|
|
- </div>
|
|
|
-</template>
|
|
|
-
|
|
|
-<script>
|
|
|
- import Pagination from "@/components/Pagination"
|
|
|
- import Edit from "./components/Edit"
|
|
|
- import { convertEnum } from '@/utils/utils'
|
|
|
- // 【刀具基础数据】-API
|
|
|
- // 【刀具管理】-API
|
|
|
- import machineCustomizeCuttingToolMgrApi from "@/api/prepareProductMgr/machineCustomizeCuttingTool"
|
|
|
- import customizeCuttingToolMgrApi from "@/api/prepareProductMgr/customizeCuttingTool"
|
|
|
- import elDragDialog from '@/directive/el-drag-dialog'
|
|
|
- import { initDicts,initQueryParams } from '@/utils/commons'
|
|
|
- export default {
|
|
|
- name: "CustomizeCuttingTool",
|
|
|
- directives: { elDragDialog },
|
|
|
- components: { Pagination, Edit },
|
|
|
- props: {
|
|
|
- },
|
|
|
- data () {
|
|
|
- return {
|
|
|
- dialog: {
|
|
|
- isVisible: false,
|
|
|
- title: ""
|
|
|
- },
|
|
|
- dicts: {
|
|
|
- CUTTING_TOOL_TYPE: {}
|
|
|
- },
|
|
|
- tableKey: 0,
|
|
|
- queryParams: initQueryParams({
|
|
|
- model: {
|
|
|
- cuttingToolType: {
|
|
|
- key: ''
|
|
|
- },
|
|
|
-
|
|
|
- }
|
|
|
- }),
|
|
|
- queryMachineParams: initQueryParams({}),
|
|
|
- selection: [],
|
|
|
- loading: false,
|
|
|
- deviceData: [],
|
|
|
- tableData: {
|
|
|
- total: 0
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
|
|
|
- created() {
|
|
|
- // 加载【字典】
|
|
|
- initDicts(['CUTTING_TOOL_TYPE'], this.dicts);
|
|
|
- // 加载列表数据
|
|
|
- this.fetch()
|
|
|
- this.device()
|
|
|
- },
|
|
|
- computed: {
|
|
|
- cuttingToolTypeList() {
|
|
|
- return convertEnum(this.dicts.CUTTING_TOOL_TYPE)
|
|
|
- }
|
|
|
- },
|
|
|
- mounted () {
|
|
|
- },
|
|
|
- methods: {
|
|
|
- editClose () {
|
|
|
- this.dialog.isVisible = false
|
|
|
- },
|
|
|
- editSuccess () {
|
|
|
- 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.setCustomizeCuttingTool(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("runCenter.tips.orderTips"), 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) {
|
|
|
- customizeCuttingToolMgrApi.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()
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- // 【修改】表头上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.setCustomizeCuttingTool(row, this.dicts)
|
|
|
- this.$refs.edit.type = "edit"
|
|
|
- this.dialog.title = this.$t("common.edit")
|
|
|
- this.dialog.isVisible = true
|
|
|
- },
|
|
|
- fetch (params = {}) {
|
|
|
- this.loading = true
|
|
|
- if (this.queryParams.timeRange) {
|
|
|
- this.queryParams.map.deliveryTime_st = this.queryParams.timeRange[0]
|
|
|
- this.queryParams.map.deliveryTime_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
|
|
|
- customizeCuttingToolMgrApi.page(this.queryParams).then(response => {
|
|
|
- const res = response.data
|
|
|
- if (res.isSuccess) {
|
|
|
- this.tableData = res.data
|
|
|
- console.log(this.tableData)
|
|
|
- // 给列表设置条数
|
|
|
- this.$emit('setTabNums', res.data.total, 'tab2')
|
|
|
- }
|
|
|
- // eslint-disable-next-line no-return-assign
|
|
|
- }).finally(() => this.loading = false)
|
|
|
-
|
|
|
- },
|
|
|
- device (params = {}) {
|
|
|
- this.loading = true
|
|
|
- this.queryMachineParams.current = params.current ? params.current : this.queryMachineParams.current
|
|
|
- this.queryMachineParams.size = 100
|
|
|
-
|
|
|
- // 查询必须参数
|
|
|
- machineCustomizeCuttingToolMgrApi.getPageList(this.queryMachineParams).then(response => {
|
|
|
- const res = response.data
|
|
|
- if (res.isSuccess) {
|
|
|
- this.deviceData = res.data
|
|
|
- }
|
|
|
- // 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)
|
|
|
- }
|
|
|
- }
|
|
|
+ <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-plus" size="medium" @click="add">{{ $t("common.add") }}</el-button>
|
|
|
+ <el-button type="success" icon="el-icon-edit" size="medium" @click="editOne">
|
|
|
+ {{ $t("common.edit") }}
|
|
|
+ </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.records"
|
|
|
+ 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 align="center" prop="cuttingToolNo" :label='$t("cuttingTool.table.customizeCuttingtool.cuttingToolNo")' :show-overflow-tooltip="true"></el-table-column>
|
|
|
+ <!-- 刀具名称 -->
|
|
|
+ <el-table-column align="center" prop="cuttingToolName" :label='$t("cuttingTool.table.customizeCuttingtool.cuttingToolName")' :show-overflow-tooltip="true"></el-table-column>
|
|
|
+ <!-- 刀具规格 -->
|
|
|
+ <el-table-column align="center" prop="specifications" :label='$t("cuttingTool.table.customizeCuttingtool.specifications")' :show-overflow-tooltip="true"></el-table-column>
|
|
|
+ <!-- 设备名称 -->
|
|
|
+ <!-- <el-table-column align="center" prop="deviceName" :label='$t("cuttingTool.table.customizeCuttingtool.deviceName")' :show-overflow-tooltip="true"></el-table-column>-->
|
|
|
+ <!-- 刀具类型 -->
|
|
|
+ <el-table-column align="center"
|
|
|
+ :filter-multiple="false"
|
|
|
+ :filters="cuttingToolTypeList"
|
|
|
+ column-key="cuttingToolType.key"
|
|
|
+ :label="$t('cuttingTool.table.customizeCuttingtool.cuttingToolType')"
|
|
|
+ :show-overflow-tooltip="true"
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ scope.row.cuttingToolType['data'] ? scope.row.cuttingToolType['data'] : scope.row.cuttingToolType['key'] }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <!-- 刀具图片 -->
|
|
|
+ <el-table-column align="center" :label='$t("cuttingTool.table.customizeCuttingtool.cuttingToolPicture")' :show-overflow-tooltip="true">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <el-image
|
|
|
+ style="width: 100px; height: 100px"
|
|
|
+ :src="row.cuttingToolPicture"
|
|
|
+ :preview-src-list="[row.cuttingToolPicture]">
|
|
|
+ </el-image>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <!– 装夹方式 –>
|
|
|
+ <el-table-column align="center" :label='$t("cuttingTool.table.customizeCuttingtool.cuttingToolInstallPicture")' :show-overflow-tooltip="true">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <el-image
|
|
|
+ style="width: 100px; height: 100px"
|
|
|
+ :src="row.cuttingToolInstallPicture"
|
|
|
+ :preview-src-list="[row.cuttingToolInstallPicture]">
|
|
|
+ </el-image>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="toolSetToCheckParameter" :label='$t("cuttingTool.table.customizeCuttingtool.toolSetToCheckParameter")' :show-overflow-tooltip="true"></el-table-column>
|
|
|
+ <!-- 启用状态 -->
|
|
|
+ <el-table-column prop="status" :label='$t("runCenter.table.oder.status")' align="center">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <el-tag :type="row.status=='1' ? 'success' : 'danger'">
|
|
|
+ {{ row.status=='1' ? $t("common.status.valid") : $t("common.frozen") }}
|
|
|
+ </el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <!-- 启用状态 -->
|
|
|
+ <!-- <el-table-column prop="programId" :label='$t("runCenter.table.oder.state")' align="center">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <el-tag :type="row.programId==null ? 'success' : 'danger'">
|
|
|
+ {{ row.programId==null ? '可用' : '占用' }}
|
|
|
+ </el-tag>
|
|
|
+ </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 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>
|
|
|
+ <pagination
|
|
|
+ v-show="tableData.total > 0"
|
|
|
+ :limit.sync="queryParams.size"
|
|
|
+ :page.sync="queryParams.current"
|
|
|
+ :total="Number(tableData.total)"
|
|
|
+ @pagination="fetch"
|
|
|
+ />
|
|
|
+ <edit
|
|
|
+ ref="edit"
|
|
|
+ :dialog-visible="dialog.isVisible"
|
|
|
+ :title="dialog.title"
|
|
|
+ @close="editClose"
|
|
|
+ @success="editSuccess"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <script>
|
|
|
+ import Pagination from "@/components/Pagination"
|
|
|
+ import Edit from "./components/Edit"
|
|
|
+ import { convertEnum } from '@/utils/utils'
|
|
|
+ // 【刀具基础数据】-API
|
|
|
+ // 【刀具管理】-API
|
|
|
+ import machineCustomizeCuttingToolMgrApi from "@/api/prepareProductMgr/machineCustomizeCuttingTool"
|
|
|
+ import customizeCuttingToolMgrApi from "@/api/prepareProductMgr/customizeCuttingTool"
|
|
|
+ import elDragDialog from '@/directive/el-drag-dialog'
|
|
|
+ import { initDicts,initQueryParams } from '@/utils/commons'
|
|
|
+ export default {
|
|
|
+ name: "CustomizeCuttingTool",
|
|
|
+ directives: { elDragDialog },
|
|
|
+ components: { Pagination, Edit },
|
|
|
+ props: {
|
|
|
+ },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ dialog: {
|
|
|
+ isVisible: false,
|
|
|
+ title: ""
|
|
|
+ },
|
|
|
+ dicts: {
|
|
|
+ CUTTING_TOOL_TYPE: {},
|
|
|
+ CUTTING_TOOL_CATEGORY: {}
|
|
|
+ },
|
|
|
+ tableKey: 0,
|
|
|
+ queryParams: initQueryParams({
|
|
|
+ model: {
|
|
|
+ cuttingToolType: {
|
|
|
+ key: ''
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }),
|
|
|
+ queryMachineParams: initQueryParams({}),
|
|
|
+ selection: [],
|
|
|
+ loading: false,
|
|
|
+ deviceData: [],
|
|
|
+ tableData: {
|
|
|
+ total: 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
|
|
|
+ created() {
|
|
|
+ // 加载【字典】
|
|
|
+ initDicts(['CUTTING_TOOL_TYPE','CUTTING_TOOL_CATEGORY'], this.dicts);
|
|
|
+ // 加载列表数据
|
|
|
+ this.fetch()
|
|
|
+ this.device()
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ cuttingToolTypeList() {
|
|
|
+ return convertEnum(this.dicts.CUTTING_TOOL_TYPE)
|
|
|
+ },
|
|
|
+ cuttingToolCategoryList() {
|
|
|
+ return convertEnum(this.dicts.CUTTING_TOOL_CATEGORY)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ editClose () {
|
|
|
+ this.dialog.isVisible = false
|
|
|
+ },
|
|
|
+ editSuccess () {
|
|
|
+ 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.setCustomizeCuttingTool(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("runCenter.tips.orderTips"), 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) {
|
|
|
+ customizeCuttingToolMgrApi.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()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 【修改】表头上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.setCustomizeCuttingTool(row, this.dicts)
|
|
|
+ this.$refs.edit.type = "edit"
|
|
|
+ this.dialog.title = this.$t("common.edit")
|
|
|
+ this.dialog.isVisible = true
|
|
|
+ },
|
|
|
+ fetch (params = {}) {
|
|
|
+ this.loading = true
|
|
|
+ if (this.queryParams.timeRange) {
|
|
|
+ this.queryParams.map.deliveryTime_st = this.queryParams.timeRange[0]
|
|
|
+ this.queryParams.map.deliveryTime_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
|
|
|
+ customizeCuttingToolMgrApi.page(this.queryParams).then(response => {
|
|
|
+ const res = response.data
|
|
|
+ if (res.isSuccess) {
|
|
|
+ this.tableData = res.data
|
|
|
+ console.log(this.tableData)
|
|
|
+ // 给列表设置条数
|
|
|
+ this.$emit('setTabNums', res.data.total, 'tab2')
|
|
|
+ }
|
|
|
+ // eslint-disable-next-line no-return-assign
|
|
|
+ }).finally(() => this.loading = false)
|
|
|
+
|
|
|
+ },
|
|
|
+ device (params = {}) {
|
|
|
+ this.loading = true
|
|
|
+ this.queryMachineParams.current = params.current ? params.current : this.queryMachineParams.current
|
|
|
+ this.queryMachineParams.size = 100
|
|
|
+
|
|
|
+ // 查询必须参数
|
|
|
+ machineCustomizeCuttingToolMgrApi.getPageList(this.queryMachineParams).then(response => {
|
|
|
+ const res = response.data
|
|
|
+ if (res.isSuccess) {
|
|
|
+ this.deviceData = res.data
|
|
|
+ }
|
|
|
+ // 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>
|
|
|
+ </script>
|
|
|
+ <style lang="scss" scoped></style>
|
|
|
+
|