|
@@ -210,12 +210,23 @@
|
|
|
fixed="right"
|
|
|
header-align="center"
|
|
|
align="center"
|
|
|
- width="150"
|
|
|
+ min-width="80"
|
|
|
+ :formatter="formatState"
|
|
|
+ :show-overflow-tooltip="true"
|
|
|
+ label="状态">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ fixed="right"
|
|
|
+ header-align="center"
|
|
|
+ align="center"
|
|
|
+ width="200"
|
|
|
label="操作">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button v-if="isAuth('pro:product:info')" type="text" size="small" @click="detailHandle(scope.row.productId)">查看</el-button>
|
|
|
<el-button v-if="isAuth('pro:product:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.productId, false)">编辑</el-button>
|
|
|
<el-button v-if="isAuth('pro:product:change')" type="text" size="small" @click="changeHandle(scope.row.productId)">变更</el-button>
|
|
|
+ <el-button v-if="isAuth('pro:product:pause') && Number(scope.row.state) === 1" type="text" size="small" @click="pauseHandle(scope.row.productId)">暂停生产</el-button>
|
|
|
+ <el-button v-if="isAuth('pro:product:regain') && Number(scope.row.state) === 2" type="text" size="small" @click="regainHandle(scope.row.productId)">恢复生产</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -251,6 +262,7 @@
|
|
|
import AttachDetail from '../common/attach-detail'
|
|
|
import NoticeChangeSetting from './product-notice-change-setting'
|
|
|
import ChangeForm from './product-change'
|
|
|
+ import {bomStateOption} from '@/utils/enums'
|
|
|
export default {
|
|
|
name: 'product-management',
|
|
|
components: {
|
|
@@ -279,7 +291,8 @@ export default {
|
|
|
totalPage: 0,
|
|
|
dataListLoading: false,
|
|
|
dataListSelections: [],
|
|
|
- optionsType: []
|
|
|
+ optionsType: [],
|
|
|
+ bomStateOption: bomStateOption
|
|
|
}
|
|
|
},
|
|
|
created () {
|
|
@@ -455,6 +468,69 @@ export default {
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs.attachDetail.init(row.listingList)
|
|
|
})
|
|
|
+ },
|
|
|
+ // 状态
|
|
|
+ formatState (row) {
|
|
|
+ if (!row.state) return ''
|
|
|
+ let option = this.bomStateOption.find(t => t.value === row.state)
|
|
|
+ if (option != null) {
|
|
|
+ return option.label
|
|
|
+ }
|
|
|
+ return ''
|
|
|
+ },
|
|
|
+ pauseHandle (id) {
|
|
|
+ if (!id) return
|
|
|
+ this.$confirm(`确定暂停?`, '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ this.$http({
|
|
|
+ url: this.$http.adornUrl(`/biz-service/product/pause`),
|
|
|
+ method: 'POST',
|
|
|
+ data: {id: id}
|
|
|
+ }).then(({data}) => {
|
|
|
+ if (data && data.code === '200') {
|
|
|
+ this.$message({
|
|
|
+ message: '操作成功',
|
|
|
+ type: 'success',
|
|
|
+ duration: 1500,
|
|
|
+ onClose: () => {
|
|
|
+ this.getDataList()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$message.error(data.msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }).catch(() => {})
|
|
|
+ },
|
|
|
+ regainHandle (id) {
|
|
|
+ if (!id) return
|
|
|
+ this.$confirm(`确定恢复?`, '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ this.$http({
|
|
|
+ url: this.$http.adornUrl(`/biz-service/product/regain`),
|
|
|
+ method: 'POST',
|
|
|
+ data: {id: id}
|
|
|
+ }).then(({data}) => {
|
|
|
+ if (data && data.code === '200') {
|
|
|
+ this.$message({
|
|
|
+ message: '操作成功',
|
|
|
+ type: 'success',
|
|
|
+ duration: 1500,
|
|
|
+ onClose: () => {
|
|
|
+ this.getDataList()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$message.error(data.msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }).catch(() => {})
|
|
|
}
|
|
|
}
|
|
|
}
|