From c8b65690b946b28b179796fbe2f020e732043c58 Mon Sep 17 00:00:00 2001
From: 张诺 <zhang_12370@163.com>
Date: 星期四, 08 一月 2026 18:10:16 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_天津军泰伟业' into dev_天津军泰伟业
---
src/views/basicData/product/index.vue | 133 +++++++++++++++++++++++++++----------------
1 files changed, 83 insertions(+), 50 deletions(-)
diff --git a/src/views/basicData/product/index.vue b/src/views/basicData/product/index.vue
index 3aa263e..f9a61cd 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
/>
@@ -165,6 +177,24 @@
</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>-->
</el-form>
<template #footer>
<div class="dialog-footer">
@@ -212,6 +242,10 @@
label: "鍗曚綅",
prop: "unit",
},
+ // {
+ // label: "缁戝畾鏈哄櫒",
+ // prop: "speculativeTradingName",
+ // },
{
dataType: "action",
label: "鎿嶄綔",
@@ -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(',');
+ }
}
};
// 鎻愪氦浜у搧鍚嶇О淇敼
@@ -319,53 +368,17 @@
proxy.$refs.formRef.resetFields();
productDia.value = false;
};
-// 灏佽涓�涓畨鍏ㄧ殑纭妗嗭紝褰诲簳闃绘Enter閿Е鍙�
-const safeConfirm = (message, title) => {
- // 鏍囪鏄惁鏄紶鏍囩偣鍑伙紙鐐瑰嚮鎸夐挳浼氳Е鍙慺ocus浜嬩欢锛�
- let isMouseClick = false;
- return new Promise((resolve, reject) => {
- const box = ElMessageBox.confirm(message, title, {
- confirmButtonText: "纭",
- cancelButtonText: "鍙栨秷",
- type: "warning",
- beforeClose: (action, instance, done) => {
- if (action === "confirm") {
- // 鍙湁榧犳爣鐐瑰嚮鏃舵墠鍏佽纭
- if (isMouseClick) {
- done();
- resolve();
- } else {
- // Enter閿Е鍙戞椂闃绘
- done(false);
- }
- } else {
- // 鍙栨秷鎿嶄綔鐩存帴鍏佽
- done();
- reject();
- }
- }
- });
-
- // 鐩戝惉纭鎸夐挳鐨刦ocus浜嬩欢锛堥紶鏍囩偣鍑讳細瑙﹀彂锛孍nter閿笉浼氾級
- setTimeout(() => {
- const confirmBtn = document.querySelector('.el-message-box__btns .el-button--primary');
- if (confirmBtn) {
- confirmBtn.addEventListener('focus', () => {
- isMouseClick = true;
- });
- }
- }, 0); // 寤惰繜鑾峰彇锛岀‘淇滵OM宸叉覆鏌�
- });
-};
-// 鍒犻櫎浜у搧
// 鍒犻櫎浜у搧
const remove = (node, data) => {
- let ids = [data.id];
- // 浣跨敤灏佽鐨剆afeConfirm
- safeConfirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎鎻愮ず")
+ let ids = [];
+ ids.push(data.id);
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎鎻愮ず", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
.then(() => {
- // 纭鍒犻櫎閫昏緫
tableLoading.value = true;
delProduct(ids)
.then((res) => {
@@ -394,8 +407,24 @@
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;
+ // 纭繚 speculativeTradingName 鏄暟缁勭被鍨嬶紝鐒跺悗杞崲涓洪�楀彿鍒嗛殧鐨勫瓧绗︿覆
+ let speculativeTradingNameValue = modelForm.value.speculativeTradingName;
+ if (!Array.isArray(speculativeTradingNameValue)) {
+ // 濡傛灉涓嶆槸鏁扮粍锛岃浆鎹负鏁扮粍
+ speculativeTradingNameValue = speculativeTradingNameValue.split(',').filter(item => item);
+ }
+ const submitData = {
+ ..._modelForm,
+ productId: currentId.value,
+ speculativeTradingName: speculativeTradingNameValue.join(',')
+ };
+ addOrEditProductModel(submitData).then((res) => {
proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
closeModelDia();
getModelList();
@@ -441,7 +470,11 @@
proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
return;
}
- safeConfirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎鎻愮ず")
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎鎻愮ず", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
.then(() => {
tableLoading.value = true;
delProductModel(ids)
--
Gitblit v1.9.3