|
@@ -1,462 +1,462 @@
|
|
|
-<template>
|
|
|
- <div class="app-container">
|
|
|
- <!-- 搜索模块 -->
|
|
|
- <div class="filter-container">
|
|
|
- <span>
|
|
|
- <span>{{$t("prepare.table.tools.no")}}:</span>
|
|
|
- <el-input v-model="queryParams.model.no" :placeholder='$t("common.pleaseEnter")' style="width: 150px;" size="medium"/>
|
|
|
- </span>
|
|
|
- <span style="margin-left: 15px;" >
|
|
|
- <span>{{$t("prepare.table.tools.materialType")}}:</span>
|
|
|
- <el-input v-model="queryParams.model.materialType" :placeholder='$t("common.pleaseEnter")' style="width: 150px;" size="medium"/>
|
|
|
- </span>
|
|
|
- <span style="margin-left: 15px;" >
|
|
|
- <span>{{$t("prepare.table.tools.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("prepare.searchForm.status")}}:</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 type="primary" icon="el-icon-plus" size="medium" v-has-permission="['frock:add']" @click="add">{{ $t("common.add") }}</el-button>
|
|
|
- <el-button type="success" icon="el-icon-edit" size="medium" v-has-permission="['frock:update']" @click="editOne">
|
|
|
- {{ $t("common.edit") }}
|
|
|
- </el-button>
|
|
|
- <el-button type="danger" icon="el-icon-delete" size="medium" v-has-permission="['frock:delete']" @click="batchDelete">
|
|
|
- {{ $t("table.delete") }}
|
|
|
- </el-button>
|
|
|
- <!-- 设置可存放托盘 -->
|
|
|
- <el-button type="success" icon="el-icon-edit" size="medium" v-has-permission="['frock:set']" @click="trayOne" v-show="false">
|
|
|
- {{ $t("lineSide.common.trayBtn") }}
|
|
|
- </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 prop="no" :label='$t("prepare.table.tools.no")' :show-overflow-tooltip="true" width="120px"></el-table-column>
|
|
|
- <el-table-column prop="name" :label='$t("prepare.table.tools.name")' :show-overflow-tooltip="true" width="150px"></el-table-column>
|
|
|
- <el-table-column prop="materialType" :label='$t("prepare.table.tools.materialType")' :show-overflow-tooltip="true" width="150px"></el-table-column>
|
|
|
-
|
|
|
- <el-table-column prop="mapNo" :label='$t("prepare.table.tools.mapNo")' :show-overflow-tooltip="true" width="100px"></el-table-column>
|
|
|
- <el-table-column prop="factory" :label="$t('prepare.table.tools.factory')" align="center" :show-overflow-tooltip="true" width="180px"></el-table-column>
|
|
|
- <el-table-column prop="expiryDate" :label="$t('prepare.table.tools.expiryDate')+' (月)'" align="center" :show-overflow-tooltip="true" width="100px"></el-table-column>
|
|
|
- <el-table-column prop="joinDate" :label='$t("prepare.table.tools.joinDate")' :show-overflow-tooltip="true" width="120px"></el-table-column>
|
|
|
-
|
|
|
- <!--<el-table-column prop="specification" :label='$t("prepare.table.tools.specification")' :show-overflow-tooltip="true" width="250px"></el-table-column>-->
|
|
|
-<!-- <el-table-column prop="brand.data" :label='$t("prepare.table.tools.brand")' align="center" :show-overflow-tooltip="true" width="120px"></el-table-column>-->
|
|
|
-<!-- <el-table-column prop="category.data" :label='$t("prepare.table.tools.category")' align="center" :show-overflow-tooltip="true" width="120px"></el-table-column>-->
|
|
|
- <el-table-column prop="num" :label='$t("prepare.table.tools.num")' :show-overflow-tooltip="true" align="center" width="170px"></el-table-column>
|
|
|
- <el-table-column prop="status" :label='$t("prepare.table.tools.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
|
|
|
- :label="$t('table.operation')"
|
|
|
- fixed="right"
|
|
|
- align="center"
|
|
|
- column-key="operation"
|
|
|
- width="100px"
|
|
|
- >
|
|
|
- <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("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"
|
|
|
- />
|
|
|
- <tenant-edit
|
|
|
- ref="edit"
|
|
|
- :dialog-visible="dialog.isVisible"
|
|
|
- :title="dialog.title"
|
|
|
- @close="editClose"
|
|
|
- @success="editSuccess"
|
|
|
- />
|
|
|
- <tenant-view
|
|
|
- ref="view"
|
|
|
- :dialog-visible="tenantViewVisible"
|
|
|
- @close="viewClose"
|
|
|
- />
|
|
|
-
|
|
|
- <!-- 设置可存放托盘 -->
|
|
|
- <setting-tray
|
|
|
- ref="editTray"
|
|
|
- :dialog-visible="dialogTray.isVisible"
|
|
|
- :title="dialogTray.title"
|
|
|
- @close="editTrayClose"
|
|
|
- @success="editTraySuccess"
|
|
|
- />
|
|
|
-
|
|
|
- <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 TenantEdit from "./components/Edit"
|
|
|
- import TenantView from "./components/View"
|
|
|
- // 【工装管理】-API
|
|
|
- import frockMgrApi from "@/api/prepareProductMgr/frockMgr"
|
|
|
- import elDragDialog from '@/directive/el-drag-dialog'
|
|
|
- import { downloadFile, initEnums, initDicts, initQueryParams } from '@/utils/commons'
|
|
|
- // 共通工具方法(字典分解)
|
|
|
- import { convertEnum } from '@/utils/utils'
|
|
|
- import axios from 'axios'
|
|
|
- export default {
|
|
|
- name: "ToolsClamp",
|
|
|
- directives: { elDragDialog },
|
|
|
- components: { Pagination, TenantEdit, TenantView },
|
|
|
- props: {
|
|
|
- },
|
|
|
- data () {
|
|
|
- return {
|
|
|
- audioStatus: [],
|
|
|
- dialog: {
|
|
|
- isVisible: false,
|
|
|
- title: ""
|
|
|
- },
|
|
|
- dialogTray: {
|
|
|
- isVisible: false,
|
|
|
- title: ""
|
|
|
- },
|
|
|
- brand: {
|
|
|
- key: ''
|
|
|
- },
|
|
|
- preview: {
|
|
|
- isVisible: false,
|
|
|
- context: ''
|
|
|
- },
|
|
|
- tenantViewVisible: false,
|
|
|
- tableKey: 0,
|
|
|
- queryParams: initQueryParams({}),
|
|
|
- selection: [],
|
|
|
- loading: false,
|
|
|
- tableData: {
|
|
|
- total: 0
|
|
|
- },
|
|
|
- dicts: {
|
|
|
- METERIAL_BRAND: {}, //工具材料品牌
|
|
|
- METERIAL_CATEGORY: {}, //工具材料分类
|
|
|
- MATERIAL_TYPE: {} //工具材料毛坯成品分类
|
|
|
- },
|
|
|
- enums: {
|
|
|
- TenantTypeEnum: {},
|
|
|
- TenantStatusEnum: {}
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
|
|
|
- created() {
|
|
|
- // 调用常量-审核状态
|
|
|
- this.audioStatus = this.$constWKS.STATUSORTHERLIST
|
|
|
- // 加载【字典】
|
|
|
- initDicts(['METERIAL_BRAND', 'METERIAL_CATEGORY', 'MATERIAL_TYPE'], this.dicts);
|
|
|
- // 加载列表数据
|
|
|
- this.fetch()
|
|
|
- },
|
|
|
- computed: {
|
|
|
- currentUser () {
|
|
|
- return this.$store.state.account.user
|
|
|
- },
|
|
|
- metbrandList() {
|
|
|
- return convertEnum(this.dicts.METERIAL_BRAND)
|
|
|
- },
|
|
|
- metcatgList() {
|
|
|
- return convertEnum(this.dicts.METERIAL_CATEGORY)
|
|
|
- },
|
|
|
- materialTypeList() {
|
|
|
- return convertEnum(this.dicts.MATERIAL_TYPE)
|
|
|
- }
|
|
|
- },
|
|
|
- mounted () {
|
|
|
-
|
|
|
- },
|
|
|
- methods: {
|
|
|
- viewClose () {
|
|
|
- this.tenantViewVisible = false
|
|
|
- },
|
|
|
- editClose () {
|
|
|
- this.dialog.isVisible = false
|
|
|
- },
|
|
|
- editSuccess () {
|
|
|
- this.search()
|
|
|
- },
|
|
|
- editTrayClose () {
|
|
|
- this.dialogTray.isVisible = false
|
|
|
- },
|
|
|
- editTraySuccess () {
|
|
|
- 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)
|
|
|
- this.batchDelete()
|
|
|
- },
|
|
|
- batchDelete () {
|
|
|
- if (!this.selection.length) {
|
|
|
- this.$message({
|
|
|
- message: this.$t("tips.noDataSelected"),
|
|
|
- type: "warning"
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- const readonlyIndex = this.selection.findIndex(item => item.readonly)
|
|
|
-
|
|
|
- if (readonlyIndex > -1) {
|
|
|
- this.$message({
|
|
|
- message: this.$t("tips.systemData"),
|
|
|
- type: "warning"
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- this.$confirm(this.$t("prepare.tips.toolTips"), this.$t("common.tips"), {
|
|
|
- distinguishCancelAndClose: true,
|
|
|
- confirmButtonText: this.$t("common.confirm"),
|
|
|
- cancelButtonText: this.$t("common.cancel"),
|
|
|
- type: "warning"
|
|
|
- }).then(() => {
|
|
|
- const ids = []
|
|
|
- let contain = false
|
|
|
- this.selection.forEach(item => {
|
|
|
- if (item.readonly) {
|
|
|
- contain = true
|
|
|
- return
|
|
|
- }
|
|
|
- ids.push(item.id)
|
|
|
- })
|
|
|
- if (contain) {
|
|
|
- this.$message({
|
|
|
- message: this.$t("tips.systemData"),
|
|
|
- type: "warning"
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.delete(ids)
|
|
|
- }
|
|
|
- }).catch(() => {})
|
|
|
- },
|
|
|
- clearSelections () {
|
|
|
- this.$refs.table.clearSelection()
|
|
|
- },
|
|
|
- delete (ids) {
|
|
|
- frockMgrApi.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
|
|
|
- },
|
|
|
- // 【设置可存放托盘】表头上Btn-事件
|
|
|
- trayOne() {
|
|
|
- if (!this.selection.length) {
|
|
|
- // 新增
|
|
|
- this.addTray();
|
|
|
- return
|
|
|
- }
|
|
|
- if (this.selection.length > 1) {
|
|
|
- this.$message({
|
|
|
- message: this.$t("tips.mustOne"),
|
|
|
- type: "warning"
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
- // 打开弹出
|
|
|
- this.tray(this.selection[0]);
|
|
|
- },
|
|
|
-
|
|
|
- // 修改【设置可存放托盘】
|
|
|
- tray(row) {
|
|
|
- this.$refs.editTray.setTenant(row)
|
|
|
- this.$refs.editTray.type = "edit"
|
|
|
- this.dialogTray.title = this.$t("lineSide.common.editTray")
|
|
|
- this.dialogTray.isVisible = true
|
|
|
- },
|
|
|
-
|
|
|
- // 新增【设置可存放托盘】
|
|
|
- addTray() {
|
|
|
- this.$refs.editTray.type = "add"
|
|
|
- this.dialogTray.title = this.$t("lineSide.common.addTray")
|
|
|
- this.dialogTray.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.model.brand = this.brand
|
|
|
- frockMgrApi.page(this.queryParams).then(response => {
|
|
|
- const res = response.data
|
|
|
- if (res.isSuccess) {
|
|
|
- this.tableData = 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>
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <!-- 搜索模块 -->
|
|
|
+ <div class="filter-container">
|
|
|
+ <span>
|
|
|
+ <span>{{$t("prepare.table.tools.no")}}:</span>
|
|
|
+ <el-input v-model="queryParams.model.no" :placeholder='$t("common.pleaseEnter")' style="width: 150px;" size="medium"/>
|
|
|
+ </span>
|
|
|
+ <span style="margin-left: 15px;" >
|
|
|
+ <span>{{$t("prepare.table.tools.materialType")}}:</span>
|
|
|
+ <el-input v-model="queryParams.model.materialType" :placeholder='$t("common.pleaseEnter")' style="width: 150px;" size="medium"/>
|
|
|
+ </span>
|
|
|
+ <span style="margin-left: 15px;" >
|
|
|
+ <span>{{$t("prepare.table.tools.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("prepare.searchForm.status")}}:</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 type="primary" icon="el-icon-plus" size="medium" v-has-permission="['frock:add']" @click="add">{{ $t("common.add") }}</el-button>
|
|
|
+ <el-button type="success" icon="el-icon-edit" size="medium" v-has-permission="['frock:update']" @click="editOne">
|
|
|
+ {{ $t("common.edit") }}
|
|
|
+ </el-button>
|
|
|
+ <el-button type="danger" icon="el-icon-delete" size="medium" v-has-permission="['frock:delete']" @click="batchDelete">
|
|
|
+ {{ $t("table.delete") }}
|
|
|
+ </el-button>
|
|
|
+ <!-- 设置可存放托盘 -->
|
|
|
+ <el-button type="success" icon="el-icon-edit" size="medium" v-has-permission="['frock:set']" @click="trayOne" v-show="false">
|
|
|
+ {{ $t("lineSide.common.trayBtn") }}
|
|
|
+ </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 prop="no" :label='$t("prepare.table.tools.no")' :show-overflow-tooltip="true" width="120px"></el-table-column>
|
|
|
+ <el-table-column prop="name" :label='$t("prepare.table.tools.name")' :show-overflow-tooltip="true" width="150px"></el-table-column>
|
|
|
+ <el-table-column prop="materialType" :label='$t("prepare.table.tools.materialType")' :show-overflow-tooltip="true" width="150px"></el-table-column>
|
|
|
+
|
|
|
+ <el-table-column prop="mapNo" :label='$t("prepare.table.tools.mapNo")' :show-overflow-tooltip="true" width="100px"></el-table-column>
|
|
|
+ <el-table-column prop="factory" :label="$t('prepare.table.tools.factory')" align="center" :show-overflow-tooltip="true" width="180px"></el-table-column>
|
|
|
+ <el-table-column prop="expiryDate" :label="$t('prepare.table.tools.expiryDate')+' (月)'" align="center" :show-overflow-tooltip="true" width="100px"></el-table-column>
|
|
|
+ <el-table-column prop="joinDate" :label='$t("prepare.table.tools.joinDate")' :show-overflow-tooltip="true" width="120px"></el-table-column>
|
|
|
+
|
|
|
+ <!--<el-table-column prop="specification" :label='$t("prepare.table.tools.specification")' :show-overflow-tooltip="true" width="250px"></el-table-column>-->
|
|
|
+<!-- <el-table-column prop="brand.data" :label='$t("prepare.table.tools.brand")' align="center" :show-overflow-tooltip="true" width="120px"></el-table-column>-->
|
|
|
+<!-- <el-table-column prop="category.data" :label='$t("prepare.table.tools.category")' align="center" :show-overflow-tooltip="true" width="120px"></el-table-column>-->
|
|
|
+ <el-table-column prop="num" :label='$t("prepare.table.tools.num")' :show-overflow-tooltip="true" align="center" width="170px"></el-table-column>
|
|
|
+ <el-table-column prop="status" :label='$t("prepare.table.tools.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
|
|
|
+ :label="$t('table.operation')"
|
|
|
+ fixed="right"
|
|
|
+ align="center"
|
|
|
+ column-key="operation"
|
|
|
+ width="100px"
|
|
|
+ >
|
|
|
+ <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("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"
|
|
|
+ />
|
|
|
+ <tenant-edit
|
|
|
+ ref="edit"
|
|
|
+ :dialog-visible="dialog.isVisible"
|
|
|
+ :title="dialog.title"
|
|
|
+ @close="editClose"
|
|
|
+ @success="editSuccess"
|
|
|
+ />
|
|
|
+ <tenant-view
|
|
|
+ ref="view"
|
|
|
+ :dialog-visible="tenantViewVisible"
|
|
|
+ @close="viewClose"
|
|
|
+ />
|
|
|
+
|
|
|
+ <!-- 设置可存放托盘 -->
|
|
|
+ <!--<setting-tray
|
|
|
+ ref="editTray"
|
|
|
+ :dialog-visible="dialogTray.isVisible"
|
|
|
+ :title="dialogTray.title"
|
|
|
+ @close="editTrayClose"
|
|
|
+ @success="editTraySuccess"
|
|
|
+ />-->
|
|
|
+
|
|
|
+ <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 TenantEdit from "./components/Edit"
|
|
|
+ import TenantView from "./components/View"
|
|
|
+ // 【工装管理】-API
|
|
|
+ import frockMgrApi from "@/api/prepareProductMgr/frockMgr"
|
|
|
+ import elDragDialog from '@/directive/el-drag-dialog'
|
|
|
+ import { downloadFile, initEnums, initDicts, initQueryParams } from '@/utils/commons'
|
|
|
+ // 共通工具方法(字典分解)
|
|
|
+ import { convertEnum } from '@/utils/utils'
|
|
|
+ import axios from 'axios'
|
|
|
+ export default {
|
|
|
+ name: "ToolsClamp",
|
|
|
+ directives: { elDragDialog },
|
|
|
+ components: { Pagination, TenantEdit, TenantView },
|
|
|
+ props: {
|
|
|
+ },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ audioStatus: [],
|
|
|
+ dialog: {
|
|
|
+ isVisible: false,
|
|
|
+ title: ""
|
|
|
+ },
|
|
|
+ dialogTray: {
|
|
|
+ isVisible: false,
|
|
|
+ title: ""
|
|
|
+ },
|
|
|
+ brand: {
|
|
|
+ key: ''
|
|
|
+ },
|
|
|
+ preview: {
|
|
|
+ isVisible: false,
|
|
|
+ context: ''
|
|
|
+ },
|
|
|
+ tenantViewVisible: false,
|
|
|
+ tableKey: 0,
|
|
|
+ queryParams: initQueryParams({}),
|
|
|
+ selection: [],
|
|
|
+ loading: false,
|
|
|
+ tableData: {
|
|
|
+ total: 0
|
|
|
+ },
|
|
|
+ dicts: {
|
|
|
+ METERIAL_BRAND: {}, //工具材料品牌
|
|
|
+ METERIAL_CATEGORY: {}, //工具材料分类
|
|
|
+ MATERIAL_TYPE: {} //工具材料毛坯成品分类
|
|
|
+ },
|
|
|
+ enums: {
|
|
|
+ TenantTypeEnum: {},
|
|
|
+ TenantStatusEnum: {}
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
|
|
|
+ created() {
|
|
|
+ // 调用常量-审核状态
|
|
|
+ this.audioStatus = this.$constWKS.STATUSORTHERLIST
|
|
|
+ // 加载【字典】
|
|
|
+ initDicts(['METERIAL_BRAND', 'METERIAL_CATEGORY', 'MATERIAL_TYPE'], this.dicts);
|
|
|
+ // 加载列表数据
|
|
|
+ this.fetch()
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ currentUser () {
|
|
|
+ return this.$store.state.account.user
|
|
|
+ },
|
|
|
+ metbrandList() {
|
|
|
+ return convertEnum(this.dicts.METERIAL_BRAND)
|
|
|
+ },
|
|
|
+ metcatgList() {
|
|
|
+ return convertEnum(this.dicts.METERIAL_CATEGORY)
|
|
|
+ },
|
|
|
+ materialTypeList() {
|
|
|
+ return convertEnum(this.dicts.MATERIAL_TYPE)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
+
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ viewClose () {
|
|
|
+ this.tenantViewVisible = false
|
|
|
+ },
|
|
|
+ editClose () {
|
|
|
+ this.dialog.isVisible = false
|
|
|
+ },
|
|
|
+ editSuccess () {
|
|
|
+ this.search()
|
|
|
+ },
|
|
|
+ editTrayClose () {
|
|
|
+ this.dialogTray.isVisible = false
|
|
|
+ },
|
|
|
+ editTraySuccess () {
|
|
|
+ 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)
|
|
|
+ this.batchDelete()
|
|
|
+ },
|
|
|
+ batchDelete () {
|
|
|
+ if (!this.selection.length) {
|
|
|
+ this.$message({
|
|
|
+ message: this.$t("tips.noDataSelected"),
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ const readonlyIndex = this.selection.findIndex(item => item.readonly)
|
|
|
+
|
|
|
+ if (readonlyIndex > -1) {
|
|
|
+ this.$message({
|
|
|
+ message: this.$t("tips.systemData"),
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$confirm(this.$t("prepare.tips.toolTips"), this.$t("common.tips"), {
|
|
|
+ distinguishCancelAndClose: true,
|
|
|
+ confirmButtonText: this.$t("common.confirm"),
|
|
|
+ cancelButtonText: this.$t("common.cancel"),
|
|
|
+ type: "warning"
|
|
|
+ }).then(() => {
|
|
|
+ const ids = []
|
|
|
+ let contain = false
|
|
|
+ this.selection.forEach(item => {
|
|
|
+ if (item.readonly) {
|
|
|
+ contain = true
|
|
|
+ return
|
|
|
+ }
|
|
|
+ ids.push(item.id)
|
|
|
+ })
|
|
|
+ if (contain) {
|
|
|
+ this.$message({
|
|
|
+ message: this.$t("tips.systemData"),
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.delete(ids)
|
|
|
+ }
|
|
|
+ }).catch(() => {})
|
|
|
+ },
|
|
|
+ clearSelections () {
|
|
|
+ this.$refs.table.clearSelection()
|
|
|
+ },
|
|
|
+ delete (ids) {
|
|
|
+ frockMgrApi.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
|
|
|
+ },
|
|
|
+ // 【设置可存放托盘】表头上Btn-事件
|
|
|
+ trayOne() {
|
|
|
+ if (!this.selection.length) {
|
|
|
+ // 新增
|
|
|
+ this.addTray();
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.selection.length > 1) {
|
|
|
+ this.$message({
|
|
|
+ message: this.$t("tips.mustOne"),
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 打开弹出
|
|
|
+ this.tray(this.selection[0]);
|
|
|
+ },
|
|
|
+
|
|
|
+ // 修改【设置可存放托盘】
|
|
|
+ tray(row) {
|
|
|
+ this.$refs.editTray.setTenant(row)
|
|
|
+ this.$refs.editTray.type = "edit"
|
|
|
+ this.dialogTray.title = this.$t("lineSide.common.editTray")
|
|
|
+ this.dialogTray.isVisible = true
|
|
|
+ },
|
|
|
+
|
|
|
+ // 新增【设置可存放托盘】
|
|
|
+ addTray() {
|
|
|
+ this.$refs.editTray.type = "add"
|
|
|
+ this.dialogTray.title = this.$t("lineSide.common.addTray")
|
|
|
+ this.dialogTray.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.model.brand = this.brand
|
|
|
+ frockMgrApi.page(this.queryParams).then(response => {
|
|
|
+ const res = response.data
|
|
|
+ if (res.isSuccess) {
|
|
|
+ this.tableData = 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>
|