diff --git a/src/views/product/product/add_edit.vue b/src/views/product/product/add_edit.vue index b62ed5d..317b472 100644 --- a/src/views/product/product/add_edit.vue +++ b/src/views/product/product/add_edit.vue @@ -3,7 +3,8 @@ - + @@ -11,6 +12,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -48,6 +111,60 @@ const props = defineProps({ }); const baseUrl = import.meta.env.VITE_APP_BASE_API; + +//添加针号 +function handleAddNeedle() { + let needle = props.form.needle || []; + needle.push({ + needleNum: needle.length + 1, + surfacelineCode: "", + bottomlineCode: "", + min: "", + max: "", + }); + emit("update:form", { ...props.form, needle }); +} + +//删除针号 +function handleDeleteNeedle(i) { + let needle = props.form.needle || []; + let length = needle.length; + needle.splice(i, 1); + if (needle.length>0 && i != length - 1) { + needle = needle.map((item, index) => { + item.needleNum = index + 1; + return item; + }); + } + emit("update:form", { ...props.form, needle }); +} + +//添加加工次数 +function handleAddWorking() { + const working = props.form.working || []; + working.push({ + num: working.length + 1, + step: "", + min: "", + max: "", + }); + emit("update:form", { ...props.form, working }); +} + +//删除加工次数 +function handleDeleteWorking(i) { + let working = props.form.working || []; + let length = working.length; + working.splice(i, 1); + if (working.length>0 &&i != length - 1) { + working = working.map((item, index) => { + item.num = index + 1; + return item; + }); + } + emit("update:form", { ...props.form, working }); +} + //验证加工针数 function validateWorking(rule, value, callback) { if (value[0].min === "" || value[0].max === "" || value[1].min === "" || value[1].max === "") { diff --git a/src/views/product/product/index.vue b/src/views/product/product/index.vue index 205a4f1..8de9e31 100644 --- a/src/views/product/product/index.vue +++ b/src/views/product/product/index.vue @@ -73,7 +73,7 @@ layout="total, sizes, prev, pager, next, jumper" :total="total" @size-change="getList" @current-change="getList" /> - +