|
@@ -1,638 +1,638 @@
|
|
|
-<template>
|
|
|
- <div class="app-container">
|
|
|
- <div class="filter-container">
|
|
|
- <span>
|
|
|
- <el-radio-group v-model="queryParams.model.auditStatus" @change="search()">
|
|
|
- <el-radio-button label="2">{{$t("prepare.searchForm.auditStatuss.two")}}</el-radio-button>
|
|
|
- <el-radio-button label="1">{{$t("prepare.searchForm.auditStatuss.one")}}</el-radio-button>
|
|
|
- <el-radio-button label="3">{{$t("prepare.searchForm.auditStatuss.three")}}</el-radio-button>
|
|
|
- <el-radio-button label="0">{{$t("prepare.searchForm.auditStatuss.zero")}}</el-radio-button>
|
|
|
- </el-radio-group>
|
|
|
- </span>
|
|
|
- <span style="margin-left: 15px;">
|
|
|
- <span>{{$t("prepare.searchForm.qiyongStatus")}}:</span>
|
|
|
- <el-select v-model="queryParams.model.status" :placeholder='$t("common.pleaseSelect")' size="medium" style="width: 150px;">
|
|
|
- <el-option
|
|
|
- v-for="item in statusList"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </span>
|
|
|
- <!--<span>
|
|
|
- <span>{{$t("prepare.searchForm.productName")}}:</span>
|
|
|
- <el-input v-model="queryParams.model.name" :placeholder='$t("common.pleaseEnter")' style="width: 180px;" size="medium"/>
|
|
|
- </span>
|
|
|
- <span style="margin-left: 15px;">
|
|
|
- <span v-html="$t('prepare.searchForm.specification')"></span>
|
|
|
- <el-input v-model="queryParams.model.specifications" :placeholder='$t("common.pleaseEnter")' style="width: 180px;" size="medium"/>
|
|
|
- </span>
|
|
|
- <span style="margin-left: 15px;">
|
|
|
- <span v-html="$t('prepare.searchForm.models')"></span>
|
|
|
- <el-input v-model="queryParams.model.model" :placeholder='$t("common.pleaseEnter")' style="width: 180px;" size="medium"/>
|
|
|
- </span>-->
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="filter-container">
|
|
|
- <!--<span>
|
|
|
- <span>{{$t("prepare.searchForm.audit_status")}}:</span>
|
|
|
- <el-select v-model="queryParams.model.audit_status" :placeholder='$t("common.pleaseSelect")' size="medium" style="width: 180px;">
|
|
|
- <el-option
|
|
|
- v-for="item in qiyongStatus"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </span>-->
|
|
|
- <span>
|
|
|
- <span>{{$t("prepare.searchForm.parts_no")}}:</span>
|
|
|
- <el-input v-model="queryParams.model.partsNo" :placeholder='$t("common.pleaseEnter")' style="width: 150px;" size="medium"/>
|
|
|
- </span>
|
|
|
- <span style="margin-left: 15px;">
|
|
|
- <span>{{$t("prepare.searchForm.bomAlias")}}:</span>
|
|
|
- <el-input v-model="queryParams.model.bomAlias" :placeholder='$t("common.pleaseEnter")' style="width: 150px;" size="medium"/>
|
|
|
- </span>
|
|
|
- <span style="margin-left: 15px;">
|
|
|
- <span>{{$t("prepare.searchForm.parts_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.partsAlias")}}:</span>
|
|
|
- <el-input v-model="queryParams.model.partsAlias" :placeholder='$t("common.pleaseEnter")' style="width: 150px;" size="medium"/>
|
|
|
- </span>
|
|
|
- <span style="margin-left: 15px;">
|
|
|
- <el-button plain type="primary" icon="el-icon-search" size="medium" @click="search">
|
|
|
- {{ $t("table.search") }}
|
|
|
- </el-button>
|
|
|
- <el-button plain type="warning" icon="el-icon-refresh" size="medium" @click="reset">
|
|
|
- {{ $t("table.reset") }}
|
|
|
- </el-button>
|
|
|
- </span>
|
|
|
- </div>
|
|
|
-
|
|
|
- <el-row class="filter-container">
|
|
|
- <el-col>
|
|
|
- <el-button type="primary" icon="el-icon-plus" size="medium" v-has-permission="['bom:add']" @click="add">
|
|
|
- {{ $t("table.add") }}
|
|
|
- </el-button>
|
|
|
- <el-button type="success" icon="el-icon-edit" size="medium" v-has-permission="['bom:update']" @click="editOne">
|
|
|
- {{ $t("common.edit") }}
|
|
|
- </el-button>
|
|
|
- <el-button type="danger" icon="el-icon-delete" size="medium" v-has-permission="['bom:delete']" @click="batchDelete">
|
|
|
- {{ $t("table.delete") }}
|
|
|
- </el-button>
|
|
|
-<!-- <el-button type="primary" icon="el-icon-finished" size="medium" @click="expandsEve()">{{$t("prepare.buttons.expandsEve")}}</el-button>-->
|
|
|
- <el-button type="primary" icon="el-icon-thumb" size="medium" v-has-permission="['bom:examine']" @click="audioStatus('1')">{{$t("prepare.buttons.audioStatus")}}</el-button>
|
|
|
- <el-button type="primary" icon="el-icon-suitcase" size="medium" v-has-permission="['bom:exproduct']" @click="audioBtn()">{{$t("prepare.buttons.audioBtn")}}</el-button>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
-
|
|
|
- <el-table
|
|
|
- :key="tableKey"
|
|
|
- ref="table"
|
|
|
- v-loading="loading"
|
|
|
- :data="tableData.records"
|
|
|
- border
|
|
|
- fit
|
|
|
- row-key="id"
|
|
|
- highlight-current-row
|
|
|
- :expand-row-keys="expands"
|
|
|
- :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
|
|
- style="width: 100%;"
|
|
|
- @selection-change="onSelectChange"
|
|
|
- @sort-change="sortChange"
|
|
|
- @cell-click="cellClick"
|
|
|
- >
|
|
|
- <el-table-column align="center" type="selection" width="40px" :reserve-selection="true" />
|
|
|
- <el-table-column v-for="item in titleList" :key="item.id" :prop="item.field" :label='item.text' :show-overflow-tooltip="true" width="180px" :formatter="textFormatter"></el-table-column>
|
|
|
- <!--<el-table-column prop="name" label="名称" :show-overflow-tooltip="true" width="250px"></el-table-column>
|
|
|
- <el-table-column prop="status" label="状态" align="center" width="90px">
|
|
|
- <template slot-scope="{ row }">
|
|
|
- <el-tag :type="row.status=='1' ? 'success' : 'info'">
|
|
|
- {{ row.status=='1' ? '启用' : '暂停' }}
|
|
|
- </el-tag>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="createTime" label="创建日期" :show-overflow-tooltip="true"></el-table-column>
|
|
|
- <el-table-column prop="updateTime" label="修改日期" :show-overflow-tooltip="true"></el-table-column>-->
|
|
|
- <el-table-column
|
|
|
- :label="$t('table.operation')"
|
|
|
- fixed="right"
|
|
|
- align="center"
|
|
|
- column-key="operation"
|
|
|
- width="120px"
|
|
|
- >
|
|
|
- <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="editRow(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>
|
|
|
- <el-tooltip class="item" :content='$t("prepare.buttons.audioBtn")' effect="dark" placement="top-start">
|
|
|
- <i
|
|
|
- class="el-icon-suitcase table-operation"
|
|
|
- style="color: #f50;"
|
|
|
- @click="audioBtnRow(row)"
|
|
|
- />
|
|
|
- </el-tooltip>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- <pagination
|
|
|
- v-show="tableData.count > 0"
|
|
|
- :limit.sync="queryParams.size"
|
|
|
- :page.sync="queryParams.current"
|
|
|
- :total="Number(tableData.count)"
|
|
|
- @pagination="fetch"
|
|
|
- />
|
|
|
- <tenant-edit
|
|
|
- ref="edit"
|
|
|
- :dialog-visible="dialog.isVisible"
|
|
|
- :title="dialog.title"
|
|
|
- @close="editClose"
|
|
|
- @success="editSuccess"
|
|
|
- />
|
|
|
- <tenant-view
|
|
|
- ref="view"
|
|
|
- :dialog-visible="tenantViewVisible"
|
|
|
- @close="viewClose"
|
|
|
- />
|
|
|
- <el-dialog
|
|
|
- v-el-drag-dialog
|
|
|
- :close-on-click-modal="false"
|
|
|
- :close-on-press-escape="true"
|
|
|
- :title='$t("common.preview")'
|
|
|
- width="80%"
|
|
|
- top="50px"
|
|
|
- :visible.sync="preview.isVisible"
|
|
|
- >
|
|
|
- <el-scrollbar>
|
|
|
- <div v-html="preview.context" />
|
|
|
- </el-scrollbar>
|
|
|
- </el-dialog>
|
|
|
-
|
|
|
- <el-dialog
|
|
|
- v-el-drag-dialog
|
|
|
- :close-on-click-modal="false"
|
|
|
- :close-on-press-escape="true"
|
|
|
- :title='$t("prepare.buttons.audioBtn")'
|
|
|
- width="400px"
|
|
|
- top="150px"
|
|
|
- :visible.sync="audioIsVisible"
|
|
|
- >
|
|
|
- <template>
|
|
|
- <el-row>
|
|
|
- <el-radio v-model="audioVal" label="2">{{$t("common.audio.audioOk")}}</el-radio>
|
|
|
- <el-radio v-model="audioVal" label="3">{{$t("common.audio.aduioFail")}}</el-radio>
|
|
|
- </el-row>
|
|
|
- <el-row style="margin-top: 30px;text-align: center;">
|
|
|
- <el-button plain type="primary" size="medium" @click="audioOk">
|
|
|
- {{ $t("common.confirm") }}
|
|
|
- </el-button>
|
|
|
- <el-button plain type="danger" size="medium" @click="colseAudio">
|
|
|
- {{ $t("common.cancel") }}
|
|
|
- </el-button>
|
|
|
- </el-row>
|
|
|
- </template>
|
|
|
- </el-dialog>
|
|
|
- </div>
|
|
|
-</template>
|
|
|
-
|
|
|
-<script>
|
|
|
-import i18n from '@/lang'
|
|
|
-import Pagination from "@/components/Pagination"
|
|
|
-import TenantEdit from "./components/Edit"
|
|
|
-import TenantView from "./components/View"
|
|
|
-// 【BOM管理】-API
|
|
|
-import bomMgrApi from "@/api/prepareProductMgr/bomMgr"
|
|
|
-import elDragDialog from '@/directive/el-drag-dialog'
|
|
|
-import { downloadFile, initEnums, initQueryParams } from '@/utils/commons'
|
|
|
-
|
|
|
-export default {
|
|
|
- name: "BomMgr",
|
|
|
- directives: { elDragDialog },
|
|
|
- components: { Pagination, TenantEdit, TenantView },
|
|
|
- data () {
|
|
|
- return {
|
|
|
- expands: [], // 展开行的key
|
|
|
- qiyongStatus: [], //状态
|
|
|
- statusList: [], // 启用状态
|
|
|
- titleList: [{"field":"partsNo","text":i18n.t("prepare.searchForm.parts_no")},{"field":"bomAlias","text":i18n.t("prepare.searchForm.bomAlias")},{"field":"name","text":i18n.t("prepare.searchForm.name")},{"field":"partsAlias","text":i18n.t("prepare.searchForm.partsAlias")},{"field":"batchNo","text":i18n.t("prepare.searchForm.batchNo")},{"field":"materialBrandName","text":i18n.t("prepare.searchForm.materialBrandName")},{"field":"batchNo","text":i18n.t("prepare.searchForm.batchNo")},
|
|
|
- {"field":"keyFlag","text":i18n.t("prepare.searchForm.keyFlag")},{"field":"importantFlag","text":i18n.t("prepare.searchForm.importantFlag")},{"field":"remark","text":i18n.t("prepare.searchForm.remark")},{"field":"status","text":i18n.t("prepare.searchForm.status")},{"field":"auditStatus","text":i18n.t("prepare.searchForm.auditStatus")}],
|
|
|
- dialog: {
|
|
|
- isVisible: false,
|
|
|
- title: ""
|
|
|
- },
|
|
|
- preview: {
|
|
|
- isVisible: false,
|
|
|
- context: ''
|
|
|
- },
|
|
|
- audioIsVisible: false,
|
|
|
- audioVal: '2', //默认【审核通过】
|
|
|
- tenantViewVisible: false,
|
|
|
- tableKey: 0,
|
|
|
- queryParams: initQueryParams({}),
|
|
|
- selection: [],
|
|
|
- loading: false,
|
|
|
- tableData: {
|
|
|
- count: 0
|
|
|
- },
|
|
|
- enums: {
|
|
|
- TenantTypeEnum: {},
|
|
|
- TenantStatusEnum: {}
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
|
|
|
- created() {
|
|
|
- // 调用常量-初始化值
|
|
|
- this.qiyongStatus = this.$constWKS.AUDIOLIST;
|
|
|
- this.statusList = this.$constWKS.STATUSORTHERLIST;
|
|
|
- },
|
|
|
- computed: {
|
|
|
- currentUser () {
|
|
|
- return this.$store.state.account.user
|
|
|
- }
|
|
|
- },
|
|
|
- mounted () {
|
|
|
- this.fetch()
|
|
|
- },
|
|
|
- methods: {
|
|
|
- // 暂开产品所以节点
|
|
|
- expandsEve(){
|
|
|
- let arr = []
|
|
|
- this.tableData.data.forEach((item) => {
|
|
|
- // 如果有第二级数据,继续添加
|
|
|
- if(item.children.length > 0){
|
|
|
- arr.push(item.id)
|
|
|
- // 如果有第三级数据,继续添加
|
|
|
- item.children.forEach((obj) => {
|
|
|
- if(obj.children.length > 0){
|
|
|
- arr.push(obj.id)
|
|
|
- // 如果有第四级数据,继续添加
|
|
|
- item.children.forEach((obj2) => {
|
|
|
- if(obj2.children.length > 0){
|
|
|
- arr.push(obj2.id)
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- this.expands = arr
|
|
|
- },
|
|
|
- // 【提交审核】按钮-事件
|
|
|
- audioStatus(status){
|
|
|
- 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
|
|
|
- // }
|
|
|
- // 调用API
|
|
|
- this.audio(status)
|
|
|
- },
|
|
|
- // 【取消】审核按钮-事件
|
|
|
- colseAudio(){
|
|
|
- this.audioIsVisible = false
|
|
|
- },
|
|
|
- // 【确定】审核按钮-事件
|
|
|
- audioOk(){
|
|
|
- // 调用审核
|
|
|
- this.audio(false)
|
|
|
- },
|
|
|
- // 【审核产品】-按钮事件
|
|
|
- audioBtn(){
|
|
|
- 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.audioIsVisible = true
|
|
|
- },
|
|
|
- // 【审核产品】-Table的Row操作事件
|
|
|
- audioBtnRow(row) {
|
|
|
- // 清除所有的选择数据
|
|
|
- this.$refs.table.clearSelection()
|
|
|
- // 设置当前行为选中的数据
|
|
|
- this.$refs.table.toggleRowSelection(row, true)
|
|
|
- // 弹出审核页面
|
|
|
- this.audioIsVisible = true
|
|
|
- },
|
|
|
- // 【审核通过/审核不通过】接口-事件
|
|
|
- audio(status){
|
|
|
- if(!status){
|
|
|
- status = this.audioVal
|
|
|
- }
|
|
|
- // 赋值
|
|
|
- this.selection[0].status = status
|
|
|
- let msg = this.$t("common.audio.addAudioTips")
|
|
|
- if(status == "2"){
|
|
|
- msg = this.$t("common.audio.audioOk")+"!"
|
|
|
- }
|
|
|
- if(status == "3"){
|
|
|
- msg = this.$t("common.audio.aduioFail")+"!"
|
|
|
- }
|
|
|
-
|
|
|
- const ids = []
|
|
|
- this.selection.forEach(item => {
|
|
|
- ids.push(item.id)
|
|
|
- })
|
|
|
-
|
|
|
- bomMgrApi.audioStatus({ ids: ids, audit_status: status}).then(response => {
|
|
|
- if (response.status == 200) {
|
|
|
- // 如果是审核,成功后,关闭弹出框
|
|
|
- if(status == '2' || status == '3'){
|
|
|
- this.audioIsVisible = false
|
|
|
- // 审核成功后,改成默认值
|
|
|
- this.audioVal = '2'
|
|
|
- }
|
|
|
- this.$message({
|
|
|
- message: msg,
|
|
|
- type: "success"
|
|
|
- })
|
|
|
- // 重新查询列表数据
|
|
|
- this.search()
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- viewClose () {
|
|
|
- this.tenantViewVisible = false
|
|
|
- },
|
|
|
- editClose () {
|
|
|
- this.dialog.isVisible = false
|
|
|
- },
|
|
|
- editSuccess () {
|
|
|
- this.search()
|
|
|
- },
|
|
|
- onSelectChange (selection) {
|
|
|
- this.selection = selection
|
|
|
- },
|
|
|
- textFormatter(row, column){
|
|
|
- if (column.property == "keyFlag"){
|
|
|
- return (row.keyFlag === '1')? "是" : "否"
|
|
|
- }
|
|
|
- else if (column.property == "importantFlag"){
|
|
|
- return (row.importantFlag === '1')? "是" : "否"
|
|
|
- }else if (column.property == "status"){
|
|
|
- return (row.status === '1')? "启用" : "冻结"
|
|
|
- }else if (column.property == "auditStatus"){
|
|
|
- return (row.auditStatus === '0')? "新增" : (row.auditStatus === '1')? "待审核":(row.auditStatus === '2')? "审核通过" : "审核未通过"
|
|
|
- }else{
|
|
|
- return row[column.property]
|
|
|
- }
|
|
|
-
|
|
|
- },
|
|
|
- // 搜索
|
|
|
- search () {
|
|
|
- // 清空,table的选中函数
|
|
|
- this.$refs.table.clearSelection();
|
|
|
- // 查询数据
|
|
|
- this.fetch({
|
|
|
- ...this.queryParams
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
- reset () {
|
|
|
- this.queryParams = initQueryParams({})
|
|
|
- this.$refs.table.clearSort()
|
|
|
- this.$refs.table.clearFilter()
|
|
|
- this.search()
|
|
|
- },
|
|
|
- add () {
|
|
|
- if (this.selection.length > 1) {
|
|
|
- this.$message({
|
|
|
- message: this.$t("tips.mustOne"),
|
|
|
- type: "warning"
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
- // 如果选中一条数据
|
|
|
- if(this.selection.length == 1){
|
|
|
- this.$refs.edit.tenant.parent_name = this.selection[0].name
|
|
|
- this.$refs.edit.tenant.parent_id = this.selection[0].id
|
|
|
- }
|
|
|
- this.$refs.edit.type = "add"
|
|
|
- this.$refs.edit.setTenant({})
|
|
|
- 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.bomTips"), 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) {
|
|
|
- bomMgrApi.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
|
|
|
- }
|
|
|
- // 查询数据
|
|
|
- bomMgrApi.get(this.selection[0]).then(res => {
|
|
|
- console.log("根据id,查询详情BOM1111:", res.data);
|
|
|
- res = res.data
|
|
|
- if(res.isSuccess){
|
|
|
- this.edit(res.data);
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
- // Table的操作-修改
|
|
|
- editRow(row){
|
|
|
- // 查询数据
|
|
|
- bomMgrApi.get(row).then(res => {
|
|
|
- console.log("根据id,查询详情BOM22222:", res.data);
|
|
|
- res = res.data
|
|
|
- if(res.isSuccess){
|
|
|
- this.edit(res.data);
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
- edit (row) {
|
|
|
- if (row.readonly) {
|
|
|
- this.$message({
|
|
|
- message: this.$t("tips.systemData"),
|
|
|
- type: "warning"
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
- this.$refs.edit.type = "edit"
|
|
|
- this.$refs.edit.setTenant(row)
|
|
|
- // this.$refs.edit.tenant.parent_name = row.name
|
|
|
- // this.$refs.edit.tenant.parent_id = row.id
|
|
|
- this.dialog.title = this.$t("common.edit")
|
|
|
- this.dialog.isVisible = true
|
|
|
- },
|
|
|
- fetch (params = {}) {
|
|
|
- this.loading = true
|
|
|
-
|
|
|
- // 分页信息
|
|
|
- this.queryParams.current = params.current ? params.current : this.queryParams.current
|
|
|
- this.queryParams.size = params.size ? params.size : this.queryParams.size
|
|
|
-
|
|
|
- // 测试数据,真实数据,请使用page
|
|
|
- bomMgrApi.page(this.queryParams).then(response => {
|
|
|
- const res = response.data
|
|
|
- console.log("列表的数据:", res)
|
|
|
- if (res.isSuccess) {
|
|
|
- // 总数
|
|
|
- this.tableData = res.data
|
|
|
- }
|
|
|
- // eslint-disable-next-line no-return-assign
|
|
|
- }).finally(() => this.loading = false)
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- sortChange (val) {
|
|
|
- this.queryParams.sort = val.prop
|
|
|
- this.queryParams.order = val.order
|
|
|
- if (this.queryParams.sort) {
|
|
|
- this.search()
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- filterChange (filters) {
|
|
|
- for (const key in filters) {
|
|
|
- if (key.includes('.')) {
|
|
|
- const val = {}
|
|
|
- val[key.split('.')[1]] = filters[key][0]
|
|
|
- this.queryParams.model[key.split('.')[0]] = val
|
|
|
- } else {
|
|
|
- this.queryParams.model[key] = filters[key][0]
|
|
|
- }
|
|
|
- }
|
|
|
- this.search()
|
|
|
- },
|
|
|
-
|
|
|
- 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>
|
|
|
+ <el-radio-group v-model="queryParams.model.auditStatus" @change="search()">
|
|
|
+ <el-radio-button label="2">{{$t("prepare.searchForm.auditStatuss.two")}}</el-radio-button>
|
|
|
+ <el-radio-button label="1">{{$t("prepare.searchForm.auditStatuss.one")}}</el-radio-button>
|
|
|
+ <el-radio-button label="3">{{$t("prepare.searchForm.auditStatuss.three")}}</el-radio-button>
|
|
|
+ <el-radio-button label="0">{{$t("prepare.searchForm.auditStatuss.zero")}}</el-radio-button>
|
|
|
+ </el-radio-group>
|
|
|
+ </span>
|
|
|
+ <span style="margin-left: 15px;">
|
|
|
+ <span>{{$t("prepare.searchForm.qiyongStatus")}}:</span>
|
|
|
+ <el-select v-model="queryParams.model.status" :placeholder='$t("common.pleaseSelect")' size="medium" style="width: 150px;">
|
|
|
+ <el-option
|
|
|
+ v-for="item in statusList"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </span>
|
|
|
+ <!--<span>
|
|
|
+ <span>{{$t("prepare.searchForm.productName")}}:</span>
|
|
|
+ <el-input v-model="queryParams.model.name" :placeholder='$t("common.pleaseEnter")' style="width: 180px;" size="medium"/>
|
|
|
+ </span>
|
|
|
+ <span style="margin-left: 15px;">
|
|
|
+ <span v-html="$t('prepare.searchForm.specification')"></span>
|
|
|
+ <el-input v-model="queryParams.model.specifications" :placeholder='$t("common.pleaseEnter")' style="width: 180px;" size="medium"/>
|
|
|
+ </span>
|
|
|
+ <span style="margin-left: 15px;">
|
|
|
+ <span v-html="$t('prepare.searchForm.models')"></span>
|
|
|
+ <el-input v-model="queryParams.model.model" :placeholder='$t("common.pleaseEnter")' style="width: 180px;" size="medium"/>
|
|
|
+ </span>-->
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="filter-container">
|
|
|
+ <!--<span>
|
|
|
+ <span>{{$t("prepare.searchForm.audit_status")}}:</span>
|
|
|
+ <el-select v-model="queryParams.model.audit_status" :placeholder='$t("common.pleaseSelect")' size="medium" style="width: 180px;">
|
|
|
+ <el-option
|
|
|
+ v-for="item in qiyongStatus"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </span>-->
|
|
|
+ <span>
|
|
|
+ <span>{{$t("prepare.searchForm.parts_no")}}:</span>
|
|
|
+ <el-input v-model="queryParams.model.partsNo" :placeholder='$t("common.pleaseEnter")' style="width: 150px;" size="medium"/>
|
|
|
+ </span>
|
|
|
+ <span style="margin-left: 15px;">
|
|
|
+ <span>{{$t("prepare.searchForm.bomAlias")}}:</span>
|
|
|
+ <el-input v-model="queryParams.model.bomAlias" :placeholder='$t("common.pleaseEnter")' style="width: 150px;" size="medium"/>
|
|
|
+ </span>
|
|
|
+ <span style="margin-left: 15px;">
|
|
|
+ <span>{{$t("prepare.searchForm.parts_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.partsAlias")}}:</span>
|
|
|
+ <el-input v-model="queryParams.model.partsAlias" :placeholder='$t("common.pleaseEnter")' style="width: 150px;" size="medium"/>
|
|
|
+ </span>
|
|
|
+ <span style="margin-left: 15px;">
|
|
|
+ <el-button plain type="primary" icon="el-icon-search" size="medium" @click="search">
|
|
|
+ {{ $t("table.search") }}
|
|
|
+ </el-button>
|
|
|
+ <el-button plain type="warning" icon="el-icon-refresh" size="medium" @click="reset">
|
|
|
+ {{ $t("table.reset") }}
|
|
|
+ </el-button>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <el-row class="filter-container">
|
|
|
+ <el-col>
|
|
|
+ <el-button type="primary" icon="el-icon-plus" size="medium" v-has-permission="['bom:add']" @click="add">
|
|
|
+ {{ $t("table.add") }}
|
|
|
+ </el-button>
|
|
|
+ <el-button type="success" icon="el-icon-edit" size="medium" v-has-permission="['bom:update']" @click="editOne">
|
|
|
+ {{ $t("common.edit") }}
|
|
|
+ </el-button>
|
|
|
+ <el-button type="danger" icon="el-icon-delete" size="medium" v-has-permission="['bom:delete']" @click="batchDelete">
|
|
|
+ {{ $t("table.delete") }}
|
|
|
+ </el-button>
|
|
|
+<!-- <el-button type="primary" icon="el-icon-finished" size="medium" @click="expandsEve()">{{$t("prepare.buttons.expandsEve")}}</el-button>-->
|
|
|
+ <el-button type="primary" icon="el-icon-thumb" size="medium" v-has-permission="['bom:examine']" @click="audioStatus('1')">{{$t("prepare.buttons.audioStatus")}}</el-button>
|
|
|
+ <el-button type="primary" icon="el-icon-suitcase" size="medium" v-has-permission="['bom:exproduct']" @click="audioBtn()">{{$t("prepare.buttons.audioBtn")}}</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-table
|
|
|
+ :key="tableKey"
|
|
|
+ ref="table"
|
|
|
+ v-loading="loading"
|
|
|
+ :data="tableData.records"
|
|
|
+ border
|
|
|
+ fit
|
|
|
+ row-key="id"
|
|
|
+ highlight-current-row
|
|
|
+ :expand-row-keys="expands"
|
|
|
+ :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
|
|
+ style="width: 100%;"
|
|
|
+ @selection-change="onSelectChange"
|
|
|
+ @sort-change="sortChange"
|
|
|
+ @cell-click="cellClick"
|
|
|
+ >
|
|
|
+ <el-table-column align="center" type="selection" width="40px" :reserve-selection="true" />
|
|
|
+ <el-table-column v-for="item in titleList" :key="item.id" :prop="item.field" :label='item.text' :show-overflow-tooltip="true" width="180px" :formatter="textFormatter"></el-table-column>
|
|
|
+ <!--<el-table-column prop="name" label="名称" :show-overflow-tooltip="true" width="250px"></el-table-column>
|
|
|
+ <el-table-column prop="status" label="状态" align="center" width="90px">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <el-tag :type="row.status=='1' ? 'success' : 'info'">
|
|
|
+ {{ row.status=='1' ? '启用' : '暂停' }}
|
|
|
+ </el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="createTime" label="创建日期" :show-overflow-tooltip="true"></el-table-column>
|
|
|
+ <el-table-column prop="updateTime" label="修改日期" :show-overflow-tooltip="true"></el-table-column>-->
|
|
|
+ <el-table-column
|
|
|
+ :label="$t('table.operation')"
|
|
|
+ fixed="right"
|
|
|
+ align="center"
|
|
|
+ column-key="operation"
|
|
|
+ width="120px"
|
|
|
+ >
|
|
|
+ <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="editRow(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>
|
|
|
+ <el-tooltip class="item" :content='$t("prepare.buttons.audioBtn")' effect="dark" placement="top-start">
|
|
|
+ <i
|
|
|
+ class="el-icon-suitcase table-operation"
|
|
|
+ style="color: #f50;"
|
|
|
+ @click="audioBtnRow(row)"
|
|
|
+ />
|
|
|
+ </el-tooltip>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <pagination
|
|
|
+ v-show="tableData.count > 0"
|
|
|
+ :limit.sync="queryParams.size"
|
|
|
+ :page.sync="queryParams.current"
|
|
|
+ :total="Number(tableData.count)"
|
|
|
+ @pagination="fetch"
|
|
|
+ />
|
|
|
+ <tenant-edit
|
|
|
+ ref="edit"
|
|
|
+ :dialog-visible="dialog.isVisible"
|
|
|
+ :title="dialog.title"
|
|
|
+ @close="editClose"
|
|
|
+ @success="editSuccess"
|
|
|
+ />
|
|
|
+ <tenant-view
|
|
|
+ ref="view"
|
|
|
+ :dialog-visible="tenantViewVisible"
|
|
|
+ @close="viewClose"
|
|
|
+ />
|
|
|
+ <el-dialog
|
|
|
+ v-el-drag-dialog
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :close-on-press-escape="true"
|
|
|
+ :title='$t("common.preview")'
|
|
|
+ width="80%"
|
|
|
+ top="50px"
|
|
|
+ :visible.sync="preview.isVisible"
|
|
|
+ >
|
|
|
+ <el-scrollbar>
|
|
|
+ <div v-html="preview.context" />
|
|
|
+ </el-scrollbar>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <el-dialog
|
|
|
+ v-el-drag-dialog
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :close-on-press-escape="true"
|
|
|
+ :title='$t("prepare.buttons.audioBtn")'
|
|
|
+ width="400px"
|
|
|
+ top="150px"
|
|
|
+ :visible.sync="audioIsVisible"
|
|
|
+ >
|
|
|
+ <template>
|
|
|
+ <el-row>
|
|
|
+ <el-radio v-model="audioVal" label="2">{{$t("common.audio.audioOk")}}</el-radio>
|
|
|
+ <el-radio v-model="audioVal" label="3">{{$t("common.audio.aduioFail")}}</el-radio>
|
|
|
+ </el-row>
|
|
|
+ <el-row style="margin-top: 30px;text-align: center;">
|
|
|
+ <el-button plain type="primary" size="medium" @click="audioOk">
|
|
|
+ {{ $t("common.confirm") }}
|
|
|
+ </el-button>
|
|
|
+ <el-button plain type="danger" size="medium" @click="colseAudio">
|
|
|
+ {{ $t("common.cancel") }}
|
|
|
+ </el-button>
|
|
|
+ </el-row>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import i18n from '@/lang'
|
|
|
+import Pagination from "@/components/Pagination"
|
|
|
+import TenantEdit from "./components/Edit"
|
|
|
+import TenantView from "./components/View"
|
|
|
+// 【BOM管理】-API
|
|
|
+import bomMgrApi from "@/api/prepareProductMgr/bomMgr"
|
|
|
+import elDragDialog from '@/directive/el-drag-dialog'
|
|
|
+import { downloadFile, initEnums, initQueryParams } from '@/utils/commons'
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "BomMgr",
|
|
|
+ directives: { elDragDialog },
|
|
|
+ components: { Pagination, TenantEdit, TenantView },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ expands: [], // 展开行的key
|
|
|
+ qiyongStatus: [], //状态
|
|
|
+ statusList: [], // 启用状态
|
|
|
+ titleList: [{"field":"partsNo","text":i18n.t("prepare.searchForm.parts_no")},{"field":"bomAlias","text":i18n.t("prepare.searchForm.bomAlias")},{"field":"name","text":i18n.t("prepare.searchForm.name")},{"field":"partsAlias","text":i18n.t("prepare.searchForm.partsAlias")},{"field":"batchNo","text":i18n.t("prepare.searchForm.batchNo")},{"field":"materialBrandName","text":i18n.t("prepare.searchForm.materialBrandName")},{"field":"trayName","text":i18n.t("prepare.searchForm.trayName")},{"field":"batchNo","text":i18n.t("prepare.searchForm.batchNo")},
|
|
|
+ {"field":"keyFlag","text":i18n.t("prepare.searchForm.keyFlag")},{"field":"groupNo","text":i18n.t("prepare.searchForm.groupNo")},{"field":"importantFlag","text":i18n.t("prepare.searchForm.importantFlag")},{"field":"remark","text":i18n.t("prepare.searchForm.remark")},{"field":"status","text":i18n.t("prepare.searchForm.status")},{"field":"auditStatus","text":i18n.t("prepare.searchForm.auditStatus")}],
|
|
|
+ dialog: {
|
|
|
+ isVisible: false,
|
|
|
+ title: ""
|
|
|
+ },
|
|
|
+ preview: {
|
|
|
+ isVisible: false,
|
|
|
+ context: ''
|
|
|
+ },
|
|
|
+ audioIsVisible: false,
|
|
|
+ audioVal: '2', //默认【审核通过】
|
|
|
+ tenantViewVisible: false,
|
|
|
+ tableKey: 0,
|
|
|
+ queryParams: initQueryParams({}),
|
|
|
+ selection: [],
|
|
|
+ loading: false,
|
|
|
+ tableData: {
|
|
|
+ count: 0
|
|
|
+ },
|
|
|
+ enums: {
|
|
|
+ TenantTypeEnum: {},
|
|
|
+ TenantStatusEnum: {}
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
|
|
|
+ created() {
|
|
|
+ // 调用常量-初始化值
|
|
|
+ this.qiyongStatus = this.$constWKS.AUDIOLIST;
|
|
|
+ this.statusList = this.$constWKS.STATUSORTHERLIST;
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ currentUser () {
|
|
|
+ return this.$store.state.account.user
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
+ this.fetch()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 暂开产品所以节点
|
|
|
+ expandsEve(){
|
|
|
+ let arr = []
|
|
|
+ this.tableData.data.forEach((item) => {
|
|
|
+ // 如果有第二级数据,继续添加
|
|
|
+ if(item.children.length > 0){
|
|
|
+ arr.push(item.id)
|
|
|
+ // 如果有第三级数据,继续添加
|
|
|
+ item.children.forEach((obj) => {
|
|
|
+ if(obj.children.length > 0){
|
|
|
+ arr.push(obj.id)
|
|
|
+ // 如果有第四级数据,继续添加
|
|
|
+ item.children.forEach((obj2) => {
|
|
|
+ if(obj2.children.length > 0){
|
|
|
+ arr.push(obj2.id)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.expands = arr
|
|
|
+ },
|
|
|
+ // 【提交审核】按钮-事件
|
|
|
+ audioStatus(status){
|
|
|
+ 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
|
|
|
+ // }
|
|
|
+ // 调用API
|
|
|
+ this.audio(status)
|
|
|
+ },
|
|
|
+ // 【取消】审核按钮-事件
|
|
|
+ colseAudio(){
|
|
|
+ this.audioIsVisible = false
|
|
|
+ },
|
|
|
+ // 【确定】审核按钮-事件
|
|
|
+ audioOk(){
|
|
|
+ // 调用审核
|
|
|
+ this.audio(false)
|
|
|
+ },
|
|
|
+ // 【审核产品】-按钮事件
|
|
|
+ audioBtn(){
|
|
|
+ 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.audioIsVisible = true
|
|
|
+ },
|
|
|
+ // 【审核产品】-Table的Row操作事件
|
|
|
+ audioBtnRow(row) {
|
|
|
+ // 清除所有的选择数据
|
|
|
+ this.$refs.table.clearSelection()
|
|
|
+ // 设置当前行为选中的数据
|
|
|
+ this.$refs.table.toggleRowSelection(row, true)
|
|
|
+ // 弹出审核页面
|
|
|
+ this.audioIsVisible = true
|
|
|
+ },
|
|
|
+ // 【审核通过/审核不通过】接口-事件
|
|
|
+ audio(status){
|
|
|
+ if(!status){
|
|
|
+ status = this.audioVal
|
|
|
+ }
|
|
|
+ // 赋值
|
|
|
+ this.selection[0].status = status
|
|
|
+ let msg = this.$t("common.audio.addAudioTips")
|
|
|
+ if(status == "2"){
|
|
|
+ msg = this.$t("common.audio.audioOk")+"!"
|
|
|
+ }
|
|
|
+ if(status == "3"){
|
|
|
+ msg = this.$t("common.audio.aduioFail")+"!"
|
|
|
+ }
|
|
|
+
|
|
|
+ const ids = []
|
|
|
+ this.selection.forEach(item => {
|
|
|
+ ids.push(item.id)
|
|
|
+ })
|
|
|
+
|
|
|
+ bomMgrApi.audioStatus({ ids: ids, audit_status: status}).then(response => {
|
|
|
+ if (response.status == 200) {
|
|
|
+ // 如果是审核,成功后,关闭弹出框
|
|
|
+ if(status == '2' || status == '3'){
|
|
|
+ this.audioIsVisible = false
|
|
|
+ // 审核成功后,改成默认值
|
|
|
+ this.audioVal = '2'
|
|
|
+ }
|
|
|
+ this.$message({
|
|
|
+ message: msg,
|
|
|
+ type: "success"
|
|
|
+ })
|
|
|
+ // 重新查询列表数据
|
|
|
+ this.search()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ viewClose () {
|
|
|
+ this.tenantViewVisible = false
|
|
|
+ },
|
|
|
+ editClose () {
|
|
|
+ this.dialog.isVisible = false
|
|
|
+ },
|
|
|
+ editSuccess () {
|
|
|
+ this.search()
|
|
|
+ },
|
|
|
+ onSelectChange (selection) {
|
|
|
+ this.selection = selection
|
|
|
+ },
|
|
|
+ textFormatter(row, column){
|
|
|
+ if (column.property == "keyFlag"){
|
|
|
+ return (row.keyFlag === '1')? "是" : "否"
|
|
|
+ }
|
|
|
+ else if (column.property == "importantFlag"){
|
|
|
+ return (row.importantFlag === '1')? "是" : "否"
|
|
|
+ }else if (column.property == "status"){
|
|
|
+ return (row.status === '1')? "启用" : "冻结"
|
|
|
+ }else if (column.property == "auditStatus"){
|
|
|
+ return (row.auditStatus === '0')? "新增" : (row.auditStatus === '1')? "待审核":(row.auditStatus === '2')? "审核通过" : "审核未通过"
|
|
|
+ }else{
|
|
|
+ return row[column.property]
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ // 搜索
|
|
|
+ search () {
|
|
|
+ // 清空,table的选中函数
|
|
|
+ this.$refs.table.clearSelection();
|
|
|
+ // 查询数据
|
|
|
+ this.fetch({
|
|
|
+ ...this.queryParams
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ reset () {
|
|
|
+ this.queryParams = initQueryParams({})
|
|
|
+ this.$refs.table.clearSort()
|
|
|
+ this.$refs.table.clearFilter()
|
|
|
+ this.search()
|
|
|
+ },
|
|
|
+ add () {
|
|
|
+ if (this.selection.length > 1) {
|
|
|
+ this.$message({
|
|
|
+ message: this.$t("tips.mustOne"),
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 如果选中一条数据
|
|
|
+ if(this.selection.length == 1){
|
|
|
+ this.$refs.edit.tenant.parent_name = this.selection[0].name
|
|
|
+ this.$refs.edit.tenant.parent_id = this.selection[0].id
|
|
|
+ }
|
|
|
+ this.$refs.edit.type = "add"
|
|
|
+ this.$refs.edit.setTenant({})
|
|
|
+ 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.bomTips"), 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) {
|
|
|
+ bomMgrApi.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
|
|
|
+ }
|
|
|
+ // 查询数据
|
|
|
+ bomMgrApi.get(this.selection[0]).then(res => {
|
|
|
+ console.log("根据id,查询详情BOM1111:", res.data);
|
|
|
+ res = res.data
|
|
|
+ if(res.isSuccess){
|
|
|
+ this.edit(res.data);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ // Table的操作-修改
|
|
|
+ editRow(row){
|
|
|
+ // 查询数据
|
|
|
+ bomMgrApi.get(row).then(res => {
|
|
|
+ console.log("根据id,查询详情BOM22222:", res.data);
|
|
|
+ res = res.data
|
|
|
+ if(res.isSuccess){
|
|
|
+ this.edit(res.data);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ edit (row) {
|
|
|
+ if (row.readonly) {
|
|
|
+ this.$message({
|
|
|
+ message: this.$t("tips.systemData"),
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.$refs.edit.type = "edit"
|
|
|
+ this.$refs.edit.setTenant(row)
|
|
|
+ // this.$refs.edit.tenant.parent_name = row.name
|
|
|
+ // this.$refs.edit.tenant.parent_id = row.id
|
|
|
+ this.dialog.title = this.$t("common.edit")
|
|
|
+ this.dialog.isVisible = true
|
|
|
+ },
|
|
|
+ fetch (params = {}) {
|
|
|
+ this.loading = true
|
|
|
+
|
|
|
+ // 分页信息
|
|
|
+ this.queryParams.current = params.current ? params.current : this.queryParams.current
|
|
|
+ this.queryParams.size = params.size ? params.size : this.queryParams.size
|
|
|
+
|
|
|
+ // 测试数据,真实数据,请使用page
|
|
|
+ bomMgrApi.page(this.queryParams).then(response => {
|
|
|
+ const res = response.data
|
|
|
+ console.log("列表的数据:", res)
|
|
|
+ if (res.isSuccess) {
|
|
|
+ // 总数
|
|
|
+ this.tableData = res.data
|
|
|
+ }
|
|
|
+ // eslint-disable-next-line no-return-assign
|
|
|
+ }).finally(() => this.loading = false)
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ sortChange (val) {
|
|
|
+ this.queryParams.sort = val.prop
|
|
|
+ this.queryParams.order = val.order
|
|
|
+ if (this.queryParams.sort) {
|
|
|
+ this.search()
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ filterChange (filters) {
|
|
|
+ for (const key in filters) {
|
|
|
+ if (key.includes('.')) {
|
|
|
+ const val = {}
|
|
|
+ val[key.split('.')[1]] = filters[key][0]
|
|
|
+ this.queryParams.model[key.split('.')[0]] = val
|
|
|
+ } else {
|
|
|
+ this.queryParams.model[key] = filters[key][0]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.search()
|
|
|
+ },
|
|
|
+
|
|
|
+ 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>
|