|
@@ -53,8 +53,19 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="颜色" width="120">
|
|
|
<template #default="{ row, $index }">
|
|
|
- <el-form-item :prop="'bomSpecList.' + $index + '.colour'" style="width: 100%">
|
|
|
- <el-input v-model="row.colour" placeholder="请输入颜色" />
|
|
|
+ <el-form-item :prop="'bomSpecList.' + $index + '.colourOne'" :rules="rules.colourOne" style="width: 100%">
|
|
|
+ <el-select v-model="row.colourOne" placeholder="颜色" style="width: 100%" @change="changeColour(row)">
|
|
|
+ <el-option v-for="item in useUserStore().allDict['bom_colour']" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="颜色" width="120" v-if="formData.data.chromatophore != 10">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <el-form-item :prop="'bomSpecList.' + $index + '.colourTwo'" :rules="rules.colourTwo" style="width: 100%">
|
|
|
+ <el-select v-model="row.colourTwo" placeholder="颜色" style="width: 100%" @change="changeColour(row)">
|
|
|
+ <el-option v-for="item in useUserStore().allDict['bom_colour']" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -68,7 +79,8 @@
|
|
|
style="width: 100%"
|
|
|
:controls="false"
|
|
|
:min="0"
|
|
|
- :precision="2" />
|
|
|
+ :precision="2"
|
|
|
+ :disabled="judgeDisabled(row)" />
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -82,7 +94,8 @@
|
|
|
style="width: 100%"
|
|
|
:controls="false"
|
|
|
:min="0"
|
|
|
- :precision="2" />
|
|
|
+ :precision="2"
|
|
|
+ :disabled="judgeDisabled(row)" />
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -96,7 +109,8 @@
|
|
|
style="width: 100%"
|
|
|
:controls="false"
|
|
|
:min="0"
|
|
|
- :precision="2" />
|
|
|
+ :precision="2"
|
|
|
+ :disabled="judgeDisabled(row)" />
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -126,7 +140,8 @@
|
|
|
style="width: 100%"
|
|
|
:controls="false"
|
|
|
:min="0"
|
|
|
- :precision="2" />
|
|
|
+ :precision="2"
|
|
|
+ @change="calculatePrice(row)" />
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-input-number
|
|
@@ -136,7 +151,8 @@
|
|
|
style="width: 100%"
|
|
|
:controls="false"
|
|
|
:min="0"
|
|
|
- :precision="2" />
|
|
|
+ :precision="2"
|
|
|
+ @change="calculatePrice(row)" />
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-input-number
|
|
@@ -146,7 +162,8 @@
|
|
|
style="width: 100%"
|
|
|
:controls="false"
|
|
|
:min="0"
|
|
|
- :precision="2" />
|
|
|
+ :precision="2"
|
|
|
+ @change="calculatePrice(row)" />
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</el-form-item>
|
|
@@ -215,6 +232,7 @@
|
|
|
import byForm from "/src/components/byForm/index";
|
|
|
import { ElMessage } from "element-plus";
|
|
|
import Editor from "/src/components/Editor/index.vue";
|
|
|
+import { nextTick } from "vue";
|
|
|
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
const emit = defineEmits(["clickCancel"]);
|
|
@@ -345,6 +363,13 @@ const formConfig = computed(() => {
|
|
|
},
|
|
|
{
|
|
|
type: "select",
|
|
|
+ label: "角度",
|
|
|
+ prop: "angle",
|
|
|
+ data: proxy.useUserStore().allDict["bom_angle"],
|
|
|
+ itemWidth: 50,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "select",
|
|
|
label: "售价体系",
|
|
|
prop: "sellingPriceSystem",
|
|
|
data: proxy.useUserStore().allDict["bom_sellingPriceSystem"],
|
|
@@ -352,9 +377,9 @@ const formConfig = computed(() => {
|
|
|
},
|
|
|
{
|
|
|
type: "select",
|
|
|
- label: "角度",
|
|
|
- prop: "angle",
|
|
|
- data: proxy.useUserStore().allDict["bom_angle"],
|
|
|
+ label: "等级",
|
|
|
+ prop: "level",
|
|
|
+ data: proxy.useUserStore().allDict["bom_level"],
|
|
|
itemWidth: 50,
|
|
|
},
|
|
|
{
|
|
@@ -397,6 +422,8 @@ const rules = ref({
|
|
|
bomClassifyId: [{ required: true, message: "请选择类目", trigger: "change" }],
|
|
|
name: [{ required: true, message: "请输入品名", trigger: "blur" }],
|
|
|
code: [{ required: true, message: "请输入品号", trigger: "blur" }],
|
|
|
+ colourTwo: [{ required: true, message: "请选择颜色", trigger: "change" }],
|
|
|
+ colourOne: [{ required: true, message: "请选择颜色", trigger: "change" }],
|
|
|
});
|
|
|
const classifyList = ref([]);
|
|
|
const getBomClassify = () => {
|
|
@@ -518,29 +545,48 @@ onMounted(() => {
|
|
|
formOption.disabled = props.detailStatus;
|
|
|
if (props.rowData && props.rowData.id) {
|
|
|
proxy.post("/bom/detail", { id: props.rowData.id }).then((res) => {
|
|
|
- for (var text in res) {
|
|
|
- formData.data[text] = res[text];
|
|
|
- }
|
|
|
- if (!props.detailStatus) {
|
|
|
- editor.value.changeHtml(formData.data.detailText);
|
|
|
- }
|
|
|
- let list = [props.rowData.id];
|
|
|
if (res.bomSpecList && res.bomSpecList.length > 0) {
|
|
|
- list = list.concat(res.bomSpecList.map((item) => item.id));
|
|
|
- }
|
|
|
- proxy.post("/fileInfo/getList", { businessIdList: list }).then((fileObj) => {
|
|
|
- if (fileObj) {
|
|
|
- if (fileObj[props.rowData.id] && fileObj[props.rowData.id].length > 0) {
|
|
|
- formData.data.mainImgFile = fileObj[props.rowData.id][0];
|
|
|
+ res.bomSpecList = res.bomSpecList.map((item) => {
|
|
|
+ if (item.colour.includes("+")) {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ colourOne: item.colour.split("+")[0],
|
|
|
+ colourTwo: item.colour.split("+")[1],
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ colourOne: item.colour,
|
|
|
+ };
|
|
|
}
|
|
|
- if (formData.data.bomSpecList && formData.data.bomSpecList.length > 0) {
|
|
|
- for (let i = 0; i < formData.data.bomSpecList.length; i++) {
|
|
|
- if (fileObj[formData.data.bomSpecList[i].id] && fileObj[formData.data.bomSpecList[i].id].length > 0) {
|
|
|
- formData.data.bomSpecList[i].imgFile = fileObj[formData.data.bomSpecList[i].id][0];
|
|
|
+ });
|
|
|
+ }
|
|
|
+ nextTick(() => {
|
|
|
+ for (var text in res) {
|
|
|
+ formData.data[text] = res[text];
|
|
|
+ }
|
|
|
+ console.log(proxy.deepClone(formData.data));
|
|
|
+ if (!props.detailStatus) {
|
|
|
+ editor.value.changeHtml(formData.data.detailText);
|
|
|
+ }
|
|
|
+ let list = [props.rowData.id];
|
|
|
+ if (res.bomSpecList && res.bomSpecList.length > 0) {
|
|
|
+ list = list.concat(res.bomSpecList.map((item) => item.id));
|
|
|
+ }
|
|
|
+ proxy.post("/fileInfo/getList", { businessIdList: list }).then((fileObj) => {
|
|
|
+ if (fileObj) {
|
|
|
+ if (fileObj[props.rowData.id] && fileObj[props.rowData.id].length > 0) {
|
|
|
+ formData.data.mainImgFile = fileObj[props.rowData.id][0];
|
|
|
+ }
|
|
|
+ if (formData.data.bomSpecList && formData.data.bomSpecList.length > 0) {
|
|
|
+ for (let i = 0; i < formData.data.bomSpecList.length; i++) {
|
|
|
+ if (fileObj[formData.data.bomSpecList[i].id] && fileObj[formData.data.bomSpecList[i].id].length > 0) {
|
|
|
+ formData.data.bomSpecList[i].imgFile = fileObj[formData.data.bomSpecList[i].id][0];
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ });
|
|
|
});
|
|
|
});
|
|
|
}
|
|
@@ -552,6 +598,52 @@ const getStyle = (text) => {
|
|
|
return "";
|
|
|
}
|
|
|
};
|
|
|
+const judgeDisabled = (item) => {
|
|
|
+ if (
|
|
|
+ formData.data.chromatophore &&
|
|
|
+ formData.data.sellingPriceSystem &&
|
|
|
+ formData.data.level &&
|
|
|
+ formData.data.embossingProcess &&
|
|
|
+ formData.data.bomClassifyId &&
|
|
|
+ item.colour &&
|
|
|
+ item.length &&
|
|
|
+ item.width &&
|
|
|
+ item.height
|
|
|
+ ) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+};
|
|
|
+const calculatePrice = (item) => {
|
|
|
+ if (item.colour && item.length && item.width && item.height) {
|
|
|
+ proxy
|
|
|
+ .post("/bomSpec/getPriceByParam", {
|
|
|
+ bomClassifyId: formData.data.bomClassifyId,
|
|
|
+ chromatophore: formData.data.chromatophore,
|
|
|
+ level: formData.data.level,
|
|
|
+ sellingPriceSystem: formData.data.sellingPriceSystem,
|
|
|
+ embossingProcess: formData.data.embossingProcess,
|
|
|
+ colour: item.colour,
|
|
|
+ length: item.length,
|
|
|
+ width: item.width,
|
|
|
+ height: item.height,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ item.costPrice = res;
|
|
|
+ item.internalSellingPrice = res;
|
|
|
+ item.externalSellingPrice = res;
|
|
|
+ });
|
|
|
+ }
|
|
|
+};
|
|
|
+const changeColour = (item) => {
|
|
|
+ nextTick(() => {
|
|
|
+ if (item.colourOne && item.colourTwo) {
|
|
|
+ item.colour = item.colourOne + "+" + item.colourTwo;
|
|
|
+ } else {
|
|
|
+ item.colour = item.colourOne ? item.colourOne : item.colourTwo;
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
@@ -608,4 +700,7 @@ const getStyle = (text) => {
|
|
|
text-align: center;
|
|
|
border: 1px dashed var(--el-border-color);
|
|
|
}
|
|
|
+::v-deep(.el-table .cell) {
|
|
|
+ padding: 0 4px;
|
|
|
+}
|
|
|
</style>
|