|
@@ -1,15 +1,19 @@
|
|
|
<template>
|
|
|
<div class="user">
|
|
|
<div class="tree">
|
|
|
- <treeList title="物料分类" submitType="2" :hiddenBtn="true" :data="treeListData" v-model="sourceList.pagination.productClassifyId"
|
|
|
- @change="treeChange" @changeTreeList="getTreeList">
|
|
|
+ <treeList title="物料分类" submitType="2" :data="treeListData" v-model="sourceList.pagination.productClassifyId" @change="treeChange"
|
|
|
+ @changeTreeList="getTreeList">
|
|
|
</treeList>
|
|
|
</div>
|
|
|
<div class="content">
|
|
|
<byTable :source="sourceList.data" :tableHeight="tableHeight" :pagination="sourceList.pagination" :config="config" :loading="loading"
|
|
|
highlight-current-row :selectConfig="selectConfig" :action-list="[
|
|
|
-
|
|
|
- ]" @get-list="getList">
|
|
|
+ {
|
|
|
+ text: '添加物料',
|
|
|
+ action: () => openModal('add'),
|
|
|
+ disabled: false,
|
|
|
+ },
|
|
|
+ ]" @get-list="getList" v-if="!isShowNoAttributes">
|
|
|
<template #pic="{ item }">
|
|
|
<div v-if="item.fileList.length > 0">
|
|
|
<img :src="item.fileList[0].fileUrl" class="pic" @click="handleClickFile(item.fileList[0])" />
|
|
@@ -23,9 +27,50 @@
|
|
|
</template>
|
|
|
<template #size="{ item }">
|
|
|
<div v-if="item['length'] && item.width && item.height">
|
|
|
- <span>{{ item['length'] }}cm</span>*
|
|
|
- <span>{{ item.width }}cm</span>*
|
|
|
- <span>{{ item.height }}cm</span>
|
|
|
+ <span>{{ item['length'] }}</span>*
|
|
|
+ <span>{{ item.width }}</span>*
|
|
|
+ <span>{{ item.height }}</span>
|
|
|
+ </div>
|
|
|
+ <div v-else></div>
|
|
|
+ </template>
|
|
|
+ <template #price="{ item }">
|
|
|
+ <div v-if="item.price">
|
|
|
+ <span>{{ item.currency }} {{ moneyFormat(item.price ,2)}}</span>
|
|
|
+ </div>
|
|
|
+ <div v-else></div>
|
|
|
+ </template>
|
|
|
+ <template #costPrice="{ item }">
|
|
|
+ <div v-if="item.costPrice">
|
|
|
+ <span>{{ item.currency }} {{ moneyFormat(item.costPrice ,2)}}</span>
|
|
|
+ </div>
|
|
|
+ <div v-else></div>
|
|
|
+ </template>
|
|
|
+ </byTable>
|
|
|
+
|
|
|
+ <byTable :source="sourceList.data" :tableHeight="tableHeight" :pagination="sourceList.pagination" :config="configOne" :loading="loading"
|
|
|
+ highlight-current-row :selectConfig="selectConfig" :action-list="[
|
|
|
+ {
|
|
|
+ text: '添加物料',
|
|
|
+ action: () => openModal('add'),
|
|
|
+ disabled: false,
|
|
|
+ },
|
|
|
+ ]" @get-list="getList" v-else>
|
|
|
+ <template #pic="{ item }">
|
|
|
+ <div v-if="item.fileList.length > 0">
|
|
|
+ <img :src="item.fileList[0].fileUrl" class="pic" @click="handleClickFile(item.fileList[0])" />
|
|
|
+ </div>
|
|
|
+ <div v-else></div>
|
|
|
+ </template>
|
|
|
+ <template #name="{ item }">
|
|
|
+ <div>
|
|
|
+ <span class="el-click">{{ item.name }}</span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template #size="{ item }">
|
|
|
+ <div v-if="item['length'] && item.width && item.height">
|
|
|
+ <span>{{ item['length'] }}</span>*
|
|
|
+ <span>{{ item.width }}</span>*
|
|
|
+ <span>{{ item.height }}</span>
|
|
|
</div>
|
|
|
<div v-else></div>
|
|
|
</template>
|
|
@@ -48,38 +93,90 @@
|
|
|
<byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="formDom" v-loading="submitLoading">
|
|
|
<template #size>
|
|
|
<div style="width: 100%">
|
|
|
- <el-row>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item prop="length" label-width="0px" class="margin-b-0 wid100">
|
|
|
- <el-input-number v-model="formData.data.length" placeholder="请输入" style="width: 100%" :precision="2" :controls="false" :min="0"
|
|
|
- onmousewheel="return false;" />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item prop="width" label-width="0px" class="margin-b-0 wid100">
|
|
|
- <el-input-number v-model="formData.data.width" placeholder="请输入" style="width: 100%" :precision="2" :controls="false" :min="0"
|
|
|
- onmousewheel="return false;" />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item prop="height" label-width="0px" class="margin-b-0 wid100">
|
|
|
- <el-input-number v-model="formData.data.height" placeholder="请输入" style="width: 100%" :precision="2" :controls="false" :min="0"
|
|
|
- onmousewheel="return false;" />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
+ <el-form-item label="尺寸" class="margin-b-0 wid100" required>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item prop="length" label-width="0px" class="margin-b-0 wid100">
|
|
|
+ <el-input-number v-model="formData.data.length" placeholder="请输入" style="width: 100%" :precision="2" :controls="false" :min="0"
|
|
|
+ onmousewheel="return false;" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item prop="width" label-width="0px" class="margin-b-0 wid100">
|
|
|
+ <el-input-number v-model="formData.data.width" placeholder="请输入" style="width: 100%" :precision="2" :controls="false" :min="0"
|
|
|
+ onmousewheel="return false;" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item prop="height" label-width="0px" class="margin-b-0 wid100">
|
|
|
+ <el-input-number v-model="formData.data.height" placeholder="请输入" style="width: 100%" :precision="2" :controls="false" :min="0"
|
|
|
+ onmousewheel="return false;" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
</div>
|
|
|
</template>
|
|
|
</byForm>
|
|
|
</div>
|
|
|
|
|
|
<template #footer>
|
|
|
- <el-button @click="dialogVisible = false" size="defualt">取 消</el-button>
|
|
|
- <el-button type="primary" @click="submitForm()" size="defualt" :loading="submitLoading">
|
|
|
+ <el-button @click="dialogVisible = false" size="defualt" v-debounce>取 消</el-button>
|
|
|
+ <el-button type="primary" @click="submitForm()" size="defualt" :loading="submitLoading" v-debounce>
|
|
|
确 定
|
|
|
</el-button>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <el-dialog :title="'关联产品'" v-model="openAssociationProduct" width="70%" destroy-on-close>
|
|
|
+ <div>
|
|
|
+ <!-- class="public_height_dialog" -->
|
|
|
+ <!-- <el-table :data="associationProductData" style="width: 100%;">
|
|
|
+ <el-table-column label="产品图片" width="80">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <div v-if="row.fileUrl">
|
|
|
+ <img :src="row.fileUrl" class="pic" @click="openImg(row.fileUrl)" />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="name" label="产品名称" min-width="130" />
|
|
|
+ <el-table-column prop="customCode" label="产品编码" width="180" />
|
|
|
+ <el-table-column label="规格尺寸 (cm)" width="130">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <div style="width: 100%">
|
|
|
+ {{row['length']}} * {{row.width}} * {{row.height}}
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="color" label="颜色" width="150" />
|
|
|
+ </el-table> -->
|
|
|
+ <byTable :source="associationData.data" :pagination="associationData.pagination" :config="associationConfig" :loading="loading"
|
|
|
+ highlight-current-row :selectConfig="[]" :action-list="[]" @get-list="getAssociationList">
|
|
|
+
|
|
|
+ <template #pic="{ item }">
|
|
|
+ <div v-if="item.fileUrl">
|
|
|
+ <img :src="item.fileUrl" class="pic" @click="openImg(item.fileUrl)" />
|
|
|
+ </div>
|
|
|
+ <div v-else></div>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template #size="{ item }">
|
|
|
+ <div v-if="item['length'] && item.width && item.height">
|
|
|
+ <span>{{ item['length'] }}</span>*
|
|
|
+ <span>{{ item.width }}</span>*
|
|
|
+ <span>{{ item.height }}</span>
|
|
|
+ </div>
|
|
|
+ <div v-else></div>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ </byTable>
|
|
|
+ </div>
|
|
|
+ <!-- <template #footer>
|
|
|
+ <el-button @click="openAssociationProduct = false" size="defualt" v-debounce>关 闭</el-button>
|
|
|
+ </template> -->
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -88,14 +185,6 @@ import byTable from "@/components/byTable/index";
|
|
|
import byForm from "@/components/byForm/index";
|
|
|
import treeList from "@/components/product/treeList";
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
-// 接收父组件的传值
|
|
|
-const props = defineProps({
|
|
|
- // 过滤是否是原料的数据
|
|
|
- isNeRawMaterial: {
|
|
|
- type: String,
|
|
|
- default: "0",
|
|
|
- },
|
|
|
-});
|
|
|
const currencyData = computed(
|
|
|
() => proxy.useUserStore().allDict["account_currency"]
|
|
|
);
|
|
@@ -131,7 +220,6 @@ const sourceList = ref({
|
|
|
productClassifyId: "",
|
|
|
keyword: "",
|
|
|
definition: "2",
|
|
|
- isNeRawMaterial: props.isNeRawMaterial,
|
|
|
},
|
|
|
});
|
|
|
const dialogVisible = ref(false);
|
|
@@ -143,9 +231,14 @@ const rules = ref({
|
|
|
],
|
|
|
name: [{ required: true, message: "请输入物料名称", trigger: "blur" }],
|
|
|
customCode: [{ required: true, message: "请输入物料编码", trigger: "blur" }],
|
|
|
+ length: [{ required: true, message: "请输入长 (cm)", trigger: "blur" }],
|
|
|
+ width: [{ required: true, message: "请输入宽 (cm)", trigger: "blur" }],
|
|
|
+ height: [{ required: true, message: "请输入高 (cm)", trigger: "blur" }],
|
|
|
+ price: [{ required: true, message: "请输入销售价", trigger: "blur" }],
|
|
|
});
|
|
|
+
|
|
|
const selectConfig = computed(() => []);
|
|
|
-const config = computed(() => {
|
|
|
+const configOne = computed(() => {
|
|
|
return [
|
|
|
{
|
|
|
attrs: {
|
|
@@ -159,52 +252,125 @@ const config = computed(() => {
|
|
|
attrs: {
|
|
|
label: "物料分类",
|
|
|
prop: "classifyName",
|
|
|
- "min-width": 150,
|
|
|
+ "min-width": 200,
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "物料编码",
|
|
|
prop: "customCode",
|
|
|
- width: 120,
|
|
|
+ width: 190,
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
- label: " 物料名称",
|
|
|
+ label: "物料名称",
|
|
|
slot: "name",
|
|
|
- "min-width": 150,
|
|
|
+ "min-width": 300,
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
- label: "物料材质",
|
|
|
- prop: "material",
|
|
|
- width: 120,
|
|
|
+ label: "销售价",
|
|
|
+ prop: "price",
|
|
|
+ width: 100,
|
|
|
+ },
|
|
|
+ render(val) {
|
|
|
+ return proxy.moneyFormat(val, 2);
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
- label: "物料型号",
|
|
|
- prop: "spec",
|
|
|
- width: 120,
|
|
|
+ label: "操作",
|
|
|
+ width: "180",
|
|
|
+ align: "center",
|
|
|
+ fixed: "right",
|
|
|
+ },
|
|
|
+ renderHTML(row) {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "选择",
|
|
|
+ type: "primary",
|
|
|
+ text: true,
|
|
|
+ },
|
|
|
+ el: "button",
|
|
|
+ click() {
|
|
|
+ clickSelect(row);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ];
|
|
|
},
|
|
|
},
|
|
|
+ ];
|
|
|
+});
|
|
|
+const config = computed(() => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "图片",
|
|
|
+ slot: "pic",
|
|
|
+ align: "center",
|
|
|
+ width: 80,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "物料分类",
|
|
|
+ prop: "classifyName",
|
|
|
+ "min-width": 200,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "物料编码",
|
|
|
+ prop: "customCode",
|
|
|
+ width: 190,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "物料名称",
|
|
|
+ slot: "name",
|
|
|
+ "min-width": 300,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "安全库存",
|
|
|
+ prop: "stockThreshold",
|
|
|
+ width: 100,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ // {
|
|
|
+ // attrs: {
|
|
|
+ // label: "物料材质",
|
|
|
+ // prop: "material",
|
|
|
+ // width: 120,
|
|
|
+ // },
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // attrs: {
|
|
|
+ // label: "物料型号",
|
|
|
+ // prop: "spec",
|
|
|
+ // width: 120,
|
|
|
+ // },
|
|
|
+ // },
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "单位",
|
|
|
prop: "unit",
|
|
|
width: 80,
|
|
|
},
|
|
|
- render(val) {
|
|
|
- return proxy.dictKeyValue(val, materialUnitData.value);
|
|
|
- },
|
|
|
+ // render(val) {
|
|
|
+ // return proxy.dictKeyValue(val, materialUnitData.value);
|
|
|
+ // },
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "尺寸",
|
|
|
slot: "size",
|
|
|
- width: 180,
|
|
|
+ width: 130,
|
|
|
},
|
|
|
},
|
|
|
{
|
|
@@ -222,16 +388,22 @@ const config = computed(() => {
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "成本价",
|
|
|
- slot: "costPrice",
|
|
|
+ prop: "costPrice",
|
|
|
width: 100,
|
|
|
},
|
|
|
+ render(val) {
|
|
|
+ return proxy.moneyFormat(val, 2);
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
label: "销售价",
|
|
|
- slot: "price",
|
|
|
+ prop: "price",
|
|
|
width: 100,
|
|
|
},
|
|
|
+ render(val) {
|
|
|
+ return proxy.moneyFormat(val, 2);
|
|
|
+ },
|
|
|
},
|
|
|
|
|
|
{
|
|
@@ -269,6 +441,27 @@ const formOption = reactive({
|
|
|
});
|
|
|
const formDom = ref(null);
|
|
|
const treeListData = ref([]);
|
|
|
+function findNodeById(treeData, nodeId) {
|
|
|
+ // 遍历当前层级的所有节点
|
|
|
+ for (let i = 0; i < treeData.length; i++) {
|
|
|
+ let node = treeData[i];
|
|
|
+ // 如果当前节点的 ID 匹配目标节点的 ID,则返回当前节点
|
|
|
+ if (node.id === nodeId) {
|
|
|
+ return node;
|
|
|
+ }
|
|
|
+ // 如果当前节点有子节点,则递归调用当前函数继续查找子节点
|
|
|
+ if (node.children && node.children.length > 0) {
|
|
|
+ let foundNode = findNodeById(node.children, nodeId);
|
|
|
+ // 如果在子节点中找到了目标节点,则返回找到的节点
|
|
|
+ if (foundNode) {
|
|
|
+ return foundNode;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 如果遍历完所有节点仍未找到目标节点,则返回 null
|
|
|
+ return null;
|
|
|
+}
|
|
|
+const isShowLabel = ref(false);
|
|
|
const formConfig = computed(() => {
|
|
|
return [
|
|
|
{
|
|
@@ -282,6 +475,9 @@ const formConfig = computed(() => {
|
|
|
data: treeData.value,
|
|
|
itemWidth: 100,
|
|
|
disabled: false,
|
|
|
+ fn: (val) => {
|
|
|
+ changeProductClassifyId(val);
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
@@ -298,6 +494,16 @@ const formConfig = computed(() => {
|
|
|
disabled: false,
|
|
|
},
|
|
|
{
|
|
|
+ type: "number",
|
|
|
+ prop: "price",
|
|
|
+ label: "销售价(cm²)",
|
|
|
+ precision: 2,
|
|
|
+ min: 0.01,
|
|
|
+ controls: false,
|
|
|
+ itemWidth: 50,
|
|
|
+ isShow: isSpecial.value,
|
|
|
+ },
|
|
|
+ {
|
|
|
type: "uploadImg",
|
|
|
// limit: 1,
|
|
|
// listType: "picture-card",
|
|
@@ -305,22 +511,26 @@ const formConfig = computed(() => {
|
|
|
imgProp: "imageUrl",
|
|
|
prop: "fileList",
|
|
|
label: "物料缩略图",
|
|
|
+ // isShow: !isSpecial.value,
|
|
|
},
|
|
|
{
|
|
|
type: "title1",
|
|
|
title: "材质特征",
|
|
|
+ isShow: !isSpecial.value,
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
|
prop: "material",
|
|
|
label: "材质",
|
|
|
itemWidth: 50,
|
|
|
+ isShow: !isSpecial.value,
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
|
prop: "spec",
|
|
|
label: "型号",
|
|
|
itemWidth: 50,
|
|
|
+ isShow: !isSpecial.value,
|
|
|
},
|
|
|
{
|
|
|
type: "select",
|
|
@@ -328,6 +538,7 @@ const formConfig = computed(() => {
|
|
|
label: "正面纹路",
|
|
|
data: frontLinesData.value,
|
|
|
itemWidth: 50,
|
|
|
+ isShow: !isSpecial.value,
|
|
|
},
|
|
|
{
|
|
|
type: "select",
|
|
@@ -335,20 +546,30 @@ const formConfig = computed(() => {
|
|
|
label: "背面纹路",
|
|
|
data: backLinesData.value,
|
|
|
itemWidth: 50,
|
|
|
+ isShow: !isSpecial.value,
|
|
|
},
|
|
|
{
|
|
|
- type: "select",
|
|
|
+ type: "input",
|
|
|
prop: "unit",
|
|
|
label: "单位",
|
|
|
- data: materialUnitData.value,
|
|
|
+ // data: materialUnitData.value,
|
|
|
itemWidth: 50,
|
|
|
+ isShow: !isSpecial.value,
|
|
|
},
|
|
|
+ // {
|
|
|
+ // type: "select",
|
|
|
+ // prop: "unit",
|
|
|
+ // label: "单位",
|
|
|
+ // data: materialUnitData.value,
|
|
|
+ // itemWidth: 50,
|
|
|
+ // },
|
|
|
{
|
|
|
type: "select",
|
|
|
prop: "colorLayer",
|
|
|
label: "色层",
|
|
|
data: colorLayerData.value,
|
|
|
itemWidth: 50,
|
|
|
+ isShow: !isSpecial.value,
|
|
|
},
|
|
|
// {
|
|
|
// type: "input",
|
|
@@ -359,47 +580,71 @@ const formConfig = computed(() => {
|
|
|
{
|
|
|
type: "title1",
|
|
|
title: "规格",
|
|
|
+ isShow: !isSpecial.value,
|
|
|
},
|
|
|
{
|
|
|
type: "input",
|
|
|
prop: "color",
|
|
|
label: "颜色",
|
|
|
itemWidth: 50,
|
|
|
+ isShow: !isSpecial.value,
|
|
|
},
|
|
|
{
|
|
|
type: "number",
|
|
|
prop: "stockThreshold",
|
|
|
label: "安全库存",
|
|
|
- precision: 2,
|
|
|
+ precision: 0,
|
|
|
min: 0,
|
|
|
controls: false,
|
|
|
itemWidth: 50,
|
|
|
+ isShow: !isSpecial.value,
|
|
|
},
|
|
|
{
|
|
|
- type: "selectInput",
|
|
|
+ type: "number",
|
|
|
prop: "costPrice",
|
|
|
- selectProp: "costCurrency",
|
|
|
- label: "成本价",
|
|
|
+ label: "成本价" + (isShowLabel.value ? "(cm²)" : ""),
|
|
|
+ precision: 2,
|
|
|
+ min: 0.01,
|
|
|
+ controls: false,
|
|
|
itemWidth: 50,
|
|
|
- disabledSelect: true,
|
|
|
- data: currencyData.value,
|
|
|
+ isShow: !isSpecial.value,
|
|
|
},
|
|
|
+ // {
|
|
|
+ // type: "selectInput",
|
|
|
+ // prop: "costPrice",
|
|
|
+ // selectProp: "costCurrency",
|
|
|
+ // label: "成本价",
|
|
|
+ // itemWidth: 50,
|
|
|
+ // disabledSelect: true,
|
|
|
+ // data: currencyData.value,
|
|
|
+ // },
|
|
|
{
|
|
|
- type: "selectInput",
|
|
|
+ type: "number",
|
|
|
prop: "price",
|
|
|
- selectProp: "currency",
|
|
|
- label: "销售价",
|
|
|
+ label: "销售价" + (isShowLabel.value ? "(cm²)" : ""),
|
|
|
+ precision: 2,
|
|
|
+ min: 0.01,
|
|
|
+ controls: false,
|
|
|
itemWidth: 50,
|
|
|
- disabledSelect: true,
|
|
|
- data: currencyData.value,
|
|
|
+ isShow: !isSpecial.value,
|
|
|
},
|
|
|
+ // {
|
|
|
+ // type: "selectInput",
|
|
|
+ // prop: "price",
|
|
|
+ // selectProp: "currency",
|
|
|
+ // label: "销售价",
|
|
|
+ // itemWidth: 50,
|
|
|
+ // disabledSelect: true,
|
|
|
+ // data: currencyData.value,
|
|
|
+ // },
|
|
|
{
|
|
|
type: "slot",
|
|
|
slotName: "size",
|
|
|
prop: "size",
|
|
|
- label: "尺寸",
|
|
|
+ label: "",
|
|
|
itemWidth: 50,
|
|
|
disabled: false,
|
|
|
+ isShow: !isSpecial.value,
|
|
|
},
|
|
|
{
|
|
|
type: "number",
|
|
@@ -409,6 +654,7 @@ const formConfig = computed(() => {
|
|
|
min: 0,
|
|
|
controls: false,
|
|
|
itemWidth: 50,
|
|
|
+ isShow: !isSpecial.value,
|
|
|
},
|
|
|
];
|
|
|
});
|
|
@@ -430,25 +676,37 @@ const getList = async (req) => {
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
-
|
|
|
+const isShowNoAttributes = ref(false);
|
|
|
const treeChange = (e) => {
|
|
|
+ console.log(e, "asa");
|
|
|
if (e.id != undefined) {
|
|
|
sourceList.value.pagination.productClassifyId = e.id;
|
|
|
getList({ productClassifyId: e.id });
|
|
|
+ if (e.id == "110") {
|
|
|
+ isShowNoAttributes.value = true;
|
|
|
+ } else {
|
|
|
+ if (e.parentIdSet) {
|
|
|
+ isShowNoAttributes.value = e.parentIdSet.includes("110");
|
|
|
+ } else {
|
|
|
+ isShowNoAttributes.value = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+const isSpecial = ref(false);
|
|
|
const openModal = () => {
|
|
|
+ isSpecial.value = false;
|
|
|
dialogVisible.value = true;
|
|
|
modalType.value = "add";
|
|
|
formData.data = {
|
|
|
definition: "2",
|
|
|
fileList: [],
|
|
|
};
|
|
|
- if (currencyData.value && currencyData.value.length > 0) {
|
|
|
- formData.data.currency = currencyData.value[0].dictKey;
|
|
|
- formData.data.costCurrency = currencyData.value[0].dictKey;
|
|
|
- }
|
|
|
+ // if (currencyData.value && currencyData.value.length > 0) {
|
|
|
+ // formData.data.currency = currencyData.value[0].dictKey;
|
|
|
+ // formData.data.costCurrency = currencyData.value[0].dictKey;
|
|
|
+ // }
|
|
|
};
|
|
|
|
|
|
const submitForm = () => {
|
|
@@ -473,13 +731,9 @@ const submitForm = () => {
|
|
|
|
|
|
const getTreeList = () => {
|
|
|
proxy
|
|
|
- .post("/productClassify/tree", {
|
|
|
- parentId: "",
|
|
|
- name: "",
|
|
|
- definition: "2",
|
|
|
- isNeRawMaterial: props.isNeRawMaterial,
|
|
|
- })
|
|
|
+ .post("/productClassify/tree", { parentId: "", name: "", definition: "2" })
|
|
|
.then((message) => {
|
|
|
+ message = message.map((x) => ({ ...x, id: x.id + "" }));
|
|
|
treeListData.value = [
|
|
|
{
|
|
|
id: "",
|
|
@@ -492,10 +746,58 @@ const getTreeList = () => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+const changeProductClassifyId = (val) => {
|
|
|
+ let current = findNodeById(treeData.value, val);
|
|
|
+ if (current) {
|
|
|
+ // 判断是否是无属性原材料
|
|
|
+ if (current.id == 110) {
|
|
|
+ isSpecial.value = true;
|
|
|
+ } else {
|
|
|
+ if (current.parentIdSet) {
|
|
|
+ // 判断父级id是否包含无属性原材料
|
|
|
+ isSpecial.value = current.parentIdSet.includes("110");
|
|
|
+ } else {
|
|
|
+ // 不是无属性原材料
|
|
|
+ isSpecial.value = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (isSpecial.value == true) {
|
|
|
+ for (const key in formData.data) {
|
|
|
+ if (
|
|
|
+ [
|
|
|
+ "id",
|
|
|
+ "name",
|
|
|
+ "customCode",
|
|
|
+ "price",
|
|
|
+ "productClassifyId",
|
|
|
+ "definition",
|
|
|
+ "fileList",
|
|
|
+ ].includes(key)
|
|
|
+ ) {
|
|
|
+ } else {
|
|
|
+ delete formData.data[key];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (current.id == 100) {
|
|
|
+ isShowLabel.value = true;
|
|
|
+ } else {
|
|
|
+ if (current.parentIdSet) {
|
|
|
+ isShowLabel.value = current.parentIdSet.includes("100");
|
|
|
+ } else {
|
|
|
+ isShowLabel.value = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
const getDtl = (row) => {
|
|
|
modalType.value = "edit";
|
|
|
proxy.post("/productInfo/detail", { id: row.id }).then((res) => {
|
|
|
formData.data = res;
|
|
|
+ changeProductClassifyId(res.productClassifyId);
|
|
|
formData.data.fileList = row.fileList.map((x) => ({
|
|
|
...x,
|
|
|
url: x.fileUrl,
|
|
@@ -528,6 +830,93 @@ const handleClickFile = (file) => {
|
|
|
getTreeList();
|
|
|
getList();
|
|
|
|
|
|
+const associationConfig = computed(() => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "产品图片",
|
|
|
+ slot: "pic",
|
|
|
+ align: "center",
|
|
|
+ width: 80,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "产品编码",
|
|
|
+ prop: "customCode",
|
|
|
+ width: 190,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "产品名称",
|
|
|
+ prop: "name",
|
|
|
+ "min-width": 300,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "尺寸",
|
|
|
+ slot: "size",
|
|
|
+ width: 130,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "产品颜色",
|
|
|
+ prop: "color",
|
|
|
+ width: 160,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ];
|
|
|
+});
|
|
|
+const associationData = ref({
|
|
|
+ data: [],
|
|
|
+ pagination: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ total: 3,
|
|
|
+ },
|
|
|
+});
|
|
|
+const openAssociationProduct = ref(false);
|
|
|
+const getAssociationList = (req = {}) => {
|
|
|
+ associationData.value.pagination = {
|
|
|
+ ...associationData.value.pagination,
|
|
|
+ ...req,
|
|
|
+ };
|
|
|
+ proxy
|
|
|
+ .post(
|
|
|
+ "/productInfo/getProductByMaterialId",
|
|
|
+ associationData.value.pagination
|
|
|
+ )
|
|
|
+ .then((res) => {
|
|
|
+ associationData.value.data = res.rows;
|
|
|
+ associationData.value.pagination.total = res.total;
|
|
|
+ let productIds = associationData.value.data.map((x) => x.id);
|
|
|
+ if (productIds && productIds.length > 0) {
|
|
|
+ proxy.getFileData({
|
|
|
+ businessIdList: productIds,
|
|
|
+ data: associationData.value.data,
|
|
|
+ att: "id",
|
|
|
+ businessType: "0",
|
|
|
+ fileAtt: "fileList",
|
|
|
+ filePathAtt: "fileUrl",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const getAssociationProduct = (row) => {
|
|
|
+ openAssociationProduct.value = true;
|
|
|
+ associationData.value.pagination = {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ total: 3,
|
|
|
+ materialId: row.id,
|
|
|
+ };
|
|
|
+ getAssociationList();
|
|
|
+};
|
|
|
+
|
|
|
const clickSelect = (item) => {
|
|
|
proxy.$emit("selectMaterial", item);
|
|
|
};
|
|
@@ -535,12 +924,11 @@ const clickSelect = (item) => {
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
.user {
|
|
|
- // padding: 20px;
|
|
|
+ padding: 10px;
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|
|
|
.tree {
|
|
|
width: 300px;
|
|
|
- border-right: 1px solid rgb(223, 221, 221);
|
|
|
}
|
|
|
.content {
|
|
|
width: calc(100% - 310px);
|