|
|
@@ -74,9 +74,21 @@
|
|
|
<el-table-column prop="notes" header-align="center" align="center" min-width="180" :show-overflow-tooltip="true"
|
|
|
label="备注">
|
|
|
</el-table-column>
|
|
|
- <el-table-column fixed="right" header-align="center" align="center" width="150" label="操作">
|
|
|
+ <el-table-column prop="state" header-align="center" align="center" width="100" label="状态">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button type="text" size="small" @click="detailHandle(scope.row.drawingId)">删除</el-button>
|
|
|
+ <el-tag :type="Number(scope.row.state) === 1 ? 'success' : 'danger'" disable-transitions>
|
|
|
+ {{ Number(scope.row.state) === 1 ? '启用' : '停用' }}
|
|
|
+ </el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column fixed="right" header-align="center" align="center" width="100" label="操作">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <!-- 查看 -->
|
|
|
+ <el-button type="text" size="small" @click="detailHandle(scope.row.drawingId)">查看</el-button>
|
|
|
+ <!-- 启用/停用 -->
|
|
|
+ <el-button v-if="isAuth('pro:drawing:update')" type="text" size="small" @click="toggleState(scope.row)">
|
|
|
+ {{ Number(scope.row.state) === 1 ? '停用' : '启用' }}
|
|
|
+ </el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
@@ -102,6 +114,7 @@ import ProductComponent from '@/views/modules/common/product-component'
|
|
|
import PreviewComponent from '@/views/modules/common/preview-component.vue'
|
|
|
import ImagePreview from '@/views/modules/common/image-preview.vue'
|
|
|
import ImageViewerMixin from '@/views/modules/common/mixins/image-viewer-mixin'
|
|
|
+import { isAuth } from '@/utils'
|
|
|
export default {
|
|
|
name: 'draw-management',
|
|
|
mixins: [ImageViewerMixin],
|
|
|
@@ -216,6 +229,40 @@ export default {
|
|
|
})
|
|
|
}).catch(() => { })
|
|
|
},
|
|
|
+ // 启用/停用
|
|
|
+ toggleState(row) {
|
|
|
+ if (!row || !row.drawingId) return
|
|
|
+ const current = Number(row.state)
|
|
|
+ const targetState = current === 1 ? 2 : 1
|
|
|
+ const actionText = targetState === 1 ? '启用' : '停用'
|
|
|
+ this.$confirm(`确定${actionText}该图纸?`, '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ this.$http({
|
|
|
+ url: this.$http.adornUrl('/biz-service/drawing/update'),
|
|
|
+ method: 'POST',
|
|
|
+ data: {
|
|
|
+ drawingId: row.drawingId,
|
|
|
+ state: targetState
|
|
|
+ }
|
|
|
+ }).then(({ data }) => {
|
|
|
+ if (data && data.code === '200') {
|
|
|
+ this.$message({
|
|
|
+ message: '操作成功',
|
|
|
+ type: 'success',
|
|
|
+ duration: 1500,
|
|
|
+ onClose: () => {
|
|
|
+ this.getDataList()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$message.error(data && data.msg ? data.msg : '操作失败')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }).catch(() => { })
|
|
|
+ },
|
|
|
// 预览
|
|
|
previewFile(fileName, url) {
|
|
|
this.previewVisible = true
|