From 076bb96b437258f0e8cdbe184040e1e302b60d4b Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 22 十二月 2025 14:10:12 +0800
Subject: [PATCH] 1.军泰伟业代码初始化
---
src/views/basicData/product/index.vue | 72 +++++++++++++++++++++++++++++++++---
1 files changed, 66 insertions(+), 6 deletions(-)
diff --git a/src/views/basicData/product/index.vue b/src/views/basicData/product/index.vue
index b88d678..b331a61 100644
--- a/src/views/basicData/product/index.vue
+++ b/src/views/basicData/product/index.vue
@@ -146,7 +146,19 @@
<el-form-item label="瑙勬牸鍨嬪彿锛�" prop="model">
<el-input
v-model="modelForm.model"
- placeholder="璇疯緭鍏ヨ鏍煎瀷鍙�"
+ placeholder="璇疯緭鍏ヨ鏍煎瀷鍙�(g*琚嬫暟)"
+ clearable
+ @keydown.enter.prevent
+ />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row>
+ <el-col :span="24">
+ <el-form-item label="鍏朵粬瑙勬牸鍨嬪彿锛�" prop="otherModel">
+ <el-input
+ v-model="modelForm.otherModel"
+ placeholder="璇疯緭鍏ュ叾浠栬鏍煎瀷鍙�"
clearable
@keydown.enter.prevent
/>
@@ -162,6 +174,24 @@
clearable
@keydown.enter.prevent
/>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row>
+ <el-col :span="24">
+ <el-form-item label="缁戝畾鏈哄櫒锛�" prop="speculativeTradingName">
+ <el-select
+ v-model="modelForm.speculativeTradingName"
+ placeholder="璇烽�夋嫨缁戝畾鏈哄櫒"
+ multiple
+ clearable
+ style="width: 100%"
+ >
+ <el-option label="鐐掓満1" value="鐐掓満1" />
+ <el-option label="鐐掓満2" value="鐐掓満2" />
+ <el-option label="鐐掓満3" value="鐐掓満3" />
+ <el-option label="鐐掓満4" value="鐐掓満4" />
+ </el-select>
</el-form-item>
</el-col>
</el-row>
@@ -213,6 +243,10 @@
prop: "unit",
},
{
+ label: "缁戝畾鏈哄櫒",
+ prop: "speculativeTradingName",
+ },
+ {
dataType: "action",
label: "鎿嶄綔",
align: "center",
@@ -244,12 +278,22 @@
productName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
},
modelForm: {
+ otherModel:'',
model: "",
unit: "",
+ speculativeTradingName: [],
},
modelRules: {
- model: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- unit: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ model: [
+ // { required: true, message: "璇疯緭鍏�", trigger: "blur" },
+ {
+ pattern: /^[0-9*]*$/,
+ message: "鍙兘杈撳叆鏁板瓧鍜�*鍙�",
+ trigger: "blur"
+ }
+ ],
+ // unit: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ // speculativeTradingName: [{ required: false, message: "璇烽�夋嫨缁戝畾鏈哄櫒", trigger: "change" }],
},
});
const { form, rules, modelForm, modelRules } = toRefs(data);
@@ -286,10 +330,15 @@
modelOperationType.value = type;
modelDia.value = true;
modelForm.value.model = "";
- modelForm.value.model = "";
+ modelForm.value.unit = "";
+ modelForm.value.speculativeTradingName = [];
modelForm.value.id = "";
if (type === "edit") {
modelForm.value = { ...data };
+ // 濡傛灉鍚庣杩斿洖鐨勬槸瀛楃涓诧紝闇�瑕佽浆鎹负鏁扮粍
+ if (data.speculativeTradingName && typeof data.speculativeTradingName === 'string') {
+ modelForm.value.speculativeTradingName = data.speculativeTradingName.split(',');
+ }
}
};
// 鎻愪氦浜у搧鍚嶇О淇敼
@@ -358,8 +407,19 @@
const submitModelForm = () => {
proxy.$refs.modelFormRef.validate((valid) => {
if (valid) {
- modelForm.value.productId = currentId.value;
- addOrEditProductModel(modelForm.value).then((res) => {
+ let _modelForm = { ...modelForm.value };
+
+ if(_modelForm.otherModel){
+ _modelForm.model = _modelForm.otherModel;
+ }
+ delete _modelForm.otherModel;
+ // 灏嗛�変腑鐨勬満鍣ㄦ暟缁勮浆鎹负閫楀彿鍒嗛殧鐨勫瓧绗︿覆
+ const submitData = {
+ ..._modelForm,
+ productId: currentId.value,
+ speculativeTradingName: modelForm.value.speculativeTradingName.join(',')
+ };
+ addOrEditProductModel(submitData).then((res) => {
proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
closeModelDia();
getModelList();
--
Gitblit v1.9.3