From a4ac4f696eca98e7f6918288321ff1b1784fc803 Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期二, 21 四月 2026 14:38:01 +0800
Subject: [PATCH] 新增入库审批功能,优化审批人选择逻辑,支持动态添加审批节点
---
src/views/basicData/product/index.vue | 164 ++++++++++++++++++++++++++++--------------------------
1 files changed, 86 insertions(+), 78 deletions(-)
diff --git a/src/views/basicData/product/index.vue b/src/views/basicData/product/index.vue
index d4186c1..ef4e5ce 100644
--- a/src/views/basicData/product/index.vue
+++ b/src/views/basicData/product/index.vue
@@ -146,7 +146,7 @@
placeholder="璇疯緭鍏ュ帤搴�"
clearable
@keydown.enter.prevent
- @blur="modelForm.thickness = formatThicknessTo15(modelForm.thickness)" />
+ @blur="modelForm.thickness = formatThicknessTo4(modelForm.thickness)" />
</el-form-item>
</el-col>
</el-row>
@@ -171,7 +171,7 @@
</template>
</el-dialog>
<!-- 浜岀淮鐮佸璇濇 -->
- <el-dialog v-model="qrCodeDialog"
+ <!-- <el-dialog v-model="qrCodeDialog"
title="浜у搧浜岀淮鐮�"
width="400px">
<div class="qrcode-container">
@@ -192,15 +192,16 @@
:disabled="!qrCodeUrl">淇濆瓨涓哄浘鐗�</el-button>
</div>
</template>
- </el-dialog>
+ </el-dialog> -->
</div>
</template>
<script setup>
import { ref, getCurrentInstance, toRefs, reactive } from "vue";
import { ElMessageBox } from "element-plus";
- import QRCode from "qrcode";
- import { saveAs } from "file-saver";
+ // 浜у搧浜岀淮鐮�
+ // import QRCode from "qrcode";
+ // import { saveAs } from "file-saver";
import {
addOrEditProduct,
addOrEditProductModel,
@@ -217,9 +218,10 @@
const productDia = ref(false);
const modelDia = ref(false);
- const qrCodeDialog = ref(false);
- const qrCodeUrl = ref("");
- const currentProductId = ref("");
+ // 浜у搧浜岀淮鐮�
+ // const qrCodeDialog = ref(false);
+ // const qrCodeUrl = ref("");
+ // const currentProductId = ref("");
const modelOperationType = ref("");
const search = ref("");
const currentId = ref("");
@@ -237,7 +239,7 @@
label: "鍘氬害",
prop: "thickness",
// 鍒楄〃灞曠ず鏃剁粺涓�淇濈暀 15 浣嶅皬鏁�
- formatData: val => formatThicknessTo15(val),
+ formatData: val => formatThicknessTo4(val),
},
{
label: "鍗曚綅",
@@ -255,13 +257,14 @@
openModelDia("edit", row);
},
},
- {
- name: "鐢熸垚浜岀淮鐮�",
- type: "text",
- clickFun: row => {
- generateQrcode(row);
- },
- },
+ // 浜у搧浜岀淮鐮�
+ // {
+ // name: "鐢熸垚浜岀淮鐮�",
+ // type: "text",
+ // clickFun: row => {
+ // generateQrcode(row);
+ // },
+ // },
],
},
]);
@@ -295,15 +298,18 @@
});
const { form, rules, modelForm, modelRules } = toRefs(data);
- // 鎶婂帤搴︽牸寮忓寲鎴愬浐瀹� 15 浣嶅皬鏁帮紙鐢ㄤ簬灞曠ず/鎻愪氦锛�
- const formatThicknessTo15 = val => {
- if (val === null || val === undefined) return "";
- const s = String(val).trim();
- if (s === "") return "";
- const n = Number(s);
- if (Number.isNaN(n)) return s;
- return n.toFixed(15);
- };
+const formatThicknessTo4 = val => {
+ if (val === null || val === undefined) return "";
+ const s = String(val).trim();
+ if (s === "") return "";
+
+ let n = Number(s);
+ if (Number.isNaN(n)) return "";
+
+ if (n < 0) n = 0;
+
+ return parseFloat(n.toFixed(4)).toString();
+};
// 鏌ヨ浜у搧鏍�
const getProductTreeList = () => {
treeLoad.value = true;
@@ -412,7 +418,7 @@
proxy.$refs.modelFormRef.validate(valid => {
if (valid) {
modelForm.value.productId = currentId.value;
- modelForm.value.thickness = formatThicknessTo15(
+ modelForm.value.thickness = formatThicknessTo4(
modelForm.value.thickness
);
addOrEditProductModel(modelForm.value).then(res => {
@@ -520,61 +526,62 @@
// 娌″尮閰嶅埌杩斿洖false
return false;
};
- const qrCodeName = ref("");
+ // 浜у搧浜岀淮鐮�
+ // const qrCodeName = ref("");
- // 鐢熸垚浜岀淮鐮�
- const generateQrcode = async row => {
- try {
- currentProductId.value = row.id;
- qrCodeName.value = fatherName.value + "-" + row.model;
- // 浣跨敤row.id鐢熸垚浜岀淮鐮�
- const qrCodeData = JSON.stringify({
- id: row.id,
- productName: fatherName.value,
- model: row.model,
- unit: row.unit,
- });
- // 鐢熸垚浜岀淮鐮乁RL
- qrCodeUrl.value = await QRCode.toDataURL(qrCodeData, {
- width: 300,
- margin: 1,
- });
- // 鎵撳紑浜岀淮鐮佸璇濇
- qrCodeDialog.value = true;
- } catch (error) {
- console.error("鐢熸垚浜岀淮鐮佸け璐�:", error);
- proxy.$modal.msgError("鐢熸垚浜岀淮鐮佸け璐�");
- }
- };
+ // // 鐢熸垚浜岀淮鐮�
+ // const generateQrcode = async row => {
+ // try {
+ // currentProductId.value = row.id;
+ // qrCodeName.value = fatherName.value + "-" + row.model;
+ // // 浣跨敤row.id鐢熸垚浜岀淮鐮�
+ // const qrCodeData = JSON.stringify({
+ // id: row.id,
+ // productName: fatherName.value,
+ // model: row.model,
+ // unit: row.unit,
+ // });
+ // // 鐢熸垚浜岀淮鐮乁RL
+ // qrCodeUrl.value = await QRCode.toDataURL(qrCodeData, {
+ // width: 300,
+ // margin: 1,
+ // });
+ // // 鎵撳紑浜岀淮鐮佸璇濇
+ // qrCodeDialog.value = true;
+ // } catch (error) {
+ // console.error("鐢熸垚浜岀淮鐮佸け璐�:", error);
+ // proxy.$modal.msgError("鐢熸垚浜岀淮鐮佸け璐�");
+ // }
+ // };
- // 淇濆瓨浜岀淮鐮佷负鍥剧墖
- const saveQrCodeAsImage = () => {
- if (!qrCodeUrl.value) return;
+ // // 淇濆瓨浜岀淮鐮佷负鍥剧墖
+ // const saveQrCodeAsImage = () => {
+ // if (!qrCodeUrl.value) return;
- try {
- // 浠嶥ata URL鍒涘缓Blob
- const blob = dataURLToBlob(qrCodeUrl.value);
- // 浣跨敤file-saver淇濆瓨鍥剧墖
- saveAs(blob, `${qrCodeName.value}.png`);
- proxy.$modal.msgSuccess("淇濆瓨鎴愬姛");
- } catch (error) {
- console.error("淇濆瓨鍥剧墖澶辫触:", error);
- proxy.$modal.msgError("淇濆瓨鍥剧墖澶辫触");
- }
- };
+ // try {
+ // // 浠嶥ata URL鍒涘缓Blob
+ // const blob = dataURLToBlob(qrCodeUrl.value);
+ // // 浣跨敤file-saver淇濆瓨鍥剧墖
+ // saveAs(blob, `${qrCodeName.value}.png`);
+ // proxy.$modal.msgSuccess("淇濆瓨鎴愬姛");
+ // } catch (error) {
+ // console.error("淇濆瓨鍥剧墖澶辫触:", error);
+ // proxy.$modal.msgError("淇濆瓨鍥剧墖澶辫触");
+ // }
+ // };
- // 灏咲ata URL杞崲涓築lob
- const dataURLToBlob = dataURL => {
- const arr = dataURL.split(",");
- const mime = arr[0].match(/:(.*?);/)[1];
- const bstr = atob(arr[1]);
- let n = bstr.length;
- const u8arr = new Uint8Array(n);
- while (n--) {
- u8arr[n] = bstr.charCodeAt(n);
- }
- return new Blob([u8arr], { type: mime });
- };
+ // // 灏咲ata URL杞崲涓築lob
+ // const dataURLToBlob = dataURL => {
+ // const arr = dataURL.split(",");
+ // const mime = arr[0].match(/:(.*?);/)[1];
+ // const bstr = atob(arr[1]);
+ // let n = bstr.length;
+ // const u8arr = new Uint8Array(n);
+ // while (n--) {
+ // u8arr[n] = bstr.charCodeAt(n);
+ // }
+ // return new Blob([u8arr], { type: mime });
+ // };
getProductTreeList();
</script>
@@ -645,7 +652,7 @@
background: #909399;
}
- /* 浜岀淮鐮佹牱寮� */
+ /* 浜у搧浜岀淮鐮�
.qrcode-container {
display: flex;
justify-content: center;
@@ -663,4 +670,5 @@
font-size: 16px;
color: #606266;
}
+ */
</style>
--
Gitblit v1.9.3