员工权限校验

This commit is contained in:
GaoHao
2024-10-17 11:35:03 +08:00
parent b2a3854f2b
commit c75ff0ee68
8 changed files with 206 additions and 10 deletions

View File

@@ -189,9 +189,7 @@
style="margin-left: 20px !important;">
<el-button type="text" icon="el-icon-edit">编辑</el-button>
</router-link> -->
<router-link :to="{ path: '/product/add_shop', query: { goods_id: scope.row.id } }">
<el-button type="text" icon="el-icon-edit">编辑</el-button>
</router-link>
<el-button type="text" icon="el-icon-edit" @click="toPath( '/product/add_shop' ,scope.row )">编辑</el-button>
<el-popconfirm title="确定删除吗?" @confirm="delTableHandle([scope.row.id])">
<el-button type="text" icon="el-icon-delete" style="margin-left: 20px !important;"
slot="reference">删除</el-button>
@@ -243,6 +241,8 @@ import settings from '@/settings'
import BindCons from './components/bindCons.vue'
import StockHistory from './components/stockHistory.vue'
import { tbProductListV2, tbShopCategoryGet, tbProductDelete, tbProductIsHot, upProSort, updateProductData, tbProductStockDetailStockCount, stockWarnLine } from '@/api/shop'
import { hasPermission } from '@/utils/limits.js'
export default {
components: {
BindCons,
@@ -314,6 +314,12 @@ export default {
this.tbProductStockDetailStockCount()
},
methods: {
// 是否允许修改商品
async toPath ( path , row) {
let res = await hasPermission('允许修改商品');
if ( !res) { return; }
this.$router.push({path: path, query: { goods_id: row.id }})
},
// 显示修改商品警告线
showStockWarningHandle() {
this.showStockWarning = true
@@ -371,7 +377,16 @@ export default {
this.getTableData()
},
changeGrounding(event, row, key) {
async changeGrounding(event, row, key) {
let text;
if (key == 'grounding') { text = "允许上下架商品"}
if (key == 'pauseSale') { text = "允许售罄商品"}
let res = await hasPermission(text);
if ( !res) {
if (key == 'grounding') { row.isGrounding = (event == 0 ? 1 : 0);}
if (key == 'pauseSale') { row.isPauseSale = (event == 0 ? 1 : 0);}
return;
}
this.editorForm.key = key
this.editorForm.id = row.id
this.editorForm.isSku = !row.typeEnum
@@ -393,8 +408,10 @@ export default {
this.editorFormLoading = false
}
},
// 修改售价
changePrice(type, row) {
// 修改库存
async changePrice(type, row) {
let res = await hasPermission('允许修改商品库存');
if ( !res) { return; }
this.editorVisable = true
this.editorForm.key = type
this.editorForm.id = row.id