From f4c6c3fa64a754040e6f2eee0235612205f89747 Mon Sep 17 00:00:00 2001
From: 祖安之光 <11848914+light-of-zuan@user.noreply.gitee.com>
Date: Fri, 13 Feb 2026 13:15:25 +0800
Subject: [PATCH] 添加状态
---
src/views/usermng/product.vue | 35 ++++++++++++++++++++++-------------
1 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/src/views/usermng/product.vue b/src/views/usermng/product.vue
index 9a22f0f..781739b 100644
--- a/src/views/usermng/product.vue
+++ b/src/views/usermng/product.vue
@@ -136,7 +136,8 @@
</el-table-column>
<el-table-column label="操作" align="center" width="240" class-name="small-padding fixed-width">
<template slot-scope="scope">
- <el-button v-if="getBtnPermission('edit')" type="text" @click="showEditHandle(scope.row)">查看</el-button>
+ <el-button v-if="getBtnPermission('edit')" type="text" @click="showEditHandle('update',scope.row)">修改</el-button>
+ <el-button v-if="getBtnPermission('edit')" type="text" @click="showEditHandle('editor',scope.row)">查看</el-button>
<el-button v-if="getBtnPermission('delete')" type="text" style="color:red;"
@click="deleteHandle(scope.row)">删除
</el-button>
@@ -157,7 +158,7 @@
@current-change="handleCurrentChange"
/>
</div>
- <el-dialog :title="dialogStatus==='create'|| dialogStatus === 'createNew'?'新增':'查看'" :visible.sync="dialogFormVisible"
+ <el-dialog :title="dialogStatus==='create'|| dialogStatus === 'createNew'?'新增':dialogStatus === 'update'?'修改':'查看'" :visible.sync="dialogFormVisible"
:modal-append-to-body="false" :close-on-click-modal="false" width="700px">
<el-form ref="dataForm" :rules="dataFormRules" :model="dataForm" label-position="right" label-width="140px"
style="margin-left:50px;width:500px;" element-loading-text="保存中...">
@@ -178,7 +179,7 @@
</el-option>
</el-select>
</el-form-item>
- <el-form-item label="产品小类:" prop="type">
+ <el-form-item label="产品小类:" prop="secondaryType">
<el-select v-model="dataForm.secondaryType" clearable placeholder="请选择" :disabled="dialogStatus==='editor'"
@change="selectChange">
<el-option
@@ -256,7 +257,7 @@
deleteProduct,
getMajorCategoryTree,
getManufacturerTree, getPermitLevelTree, getSecondaryCategoryTree,
- productList,
+ productList, updateOldProduct,
updateProduct
} from "../../api/product";
import {parseError} from "../../utils/messageDialog";
@@ -339,14 +340,14 @@
'username'
]),
debouncedSubmit() {
- return this.debounce(this.submitHandle, 1000);
+ return this.debounce(this.submitHandle, 800);
}
},
methods: {
- async selectChange(){
+ async selectChange(second){
this.$forceUpdate();
this.dataForm.level = '';
- let res = await getPermitLevelTree(this.dataForm.secondaryType);
+ let res = await getPermitLevelTree(second || this.dataForm.secondaryType);
this.permitLevelOptions = res.data;
},
getProductMajorCategory(){
@@ -430,8 +431,7 @@
}else if (this.dialogStatus === 'createNew') {
this.createNewHandle();
}else {
- // this.updateHandle();
- this.dialogFormVisible = false;
+ this.updateHandle();
}
},
createHandle: function () {
@@ -536,6 +536,7 @@
id: '',
name: '',
type: '',
+ secondaryType: '',
directionCode: '',
manufacturer: '',
specification: '',
@@ -569,7 +570,7 @@
const userName = Cookies.get('userName');
const name = Cookies.get('name');
_this.dataForm['modifiedBy'] = name + '(' + userName + ')';
- updateProduct(_this.dataForm).then(response => {
+ updateOldProduct(_this.dataForm).then(response => {
const res = response.data
if (res.code == 200) {
_this.dialogFormVisible = false
@@ -587,10 +588,17 @@
}
})
},
- showEditHandle: function (row) {
+ showEditHandle: async function (type,row) {
this.resetDataForm();
- this.dialogStatus = 'editor';
- this.dataFormSetValue(row);
+ if(type == 'editor'){
+ this.dialogStatus = 'editor';
+ }else{
+ this.dialogStatus = 'update';
+ }
+ await this.getProductSecondaryCategory(row.type)
+
+ await this.selectChange(row.secondaryType)
+ await this.dataFormSetValue(row);
this.dialogFormVisible = true;
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
@@ -600,6 +608,7 @@
this.dataForm.id = row.id;
this.dataForm.name = row.name;
this.dataForm.type = row.type;
+ this.dataForm.secondaryType = row.secondaryType;
this.dataForm.directionCode = row.directionCode;
this.dataForm.manufacturer = row.companyNumber;
this.dataForm.specification = row.specification;
--
Gitblit v1.9.2