|
@@ -0,0 +1,243 @@
|
|
|
+<template>
|
|
|
+ <div style="max-height: calc(100vh - 184px); overflow-y: auto; overflow-x: hidden; margin-bottom: -40px" v-loading="loading">
|
|
|
+ <div style="display: flex; flex-wrap: wrap; justify-content: space-between">
|
|
|
+ <div v-for="item in codeList" :key="item.key" style="margin-bottom: 40px">
|
|
|
+ <div style="margin-bottom: 16px; font-size: 24px; font-weight: 700; color: black">
|
|
|
+ <span>{{ item.value }}</span>
|
|
|
+ <el-button type="primary" style="margin-left: 10px" @click="clickModal(item.key, item.table)" text v-preReClick>新增</el-button>
|
|
|
+ </div>
|
|
|
+ <template v-if="['yoga_mat_depletion_config', 'skip_mat_depletion_config'].includes(item.key)">
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-table :data="getData(sourceList.data[item.key], 0)">
|
|
|
+ <template v-for="column in item.table1">
|
|
|
+ <el-table-column :label="column.label" :prop="column.prop" :width="column.width" />
|
|
|
+ </template>
|
|
|
+ <el-table-column label="操作" align="center" width="80">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-button type="text" @click="clickEdit(row, item.table1)">修改</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-table :data="getData(sourceList.data[item.key], 1)">
|
|
|
+ <template v-for="column in item.table2">
|
|
|
+ <el-table-column :label="column.label" :prop="column.prop" :width="column.width" />
|
|
|
+ </template>
|
|
|
+ <el-table-column label="操作" align="center" width="80">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-button type="text" @click="clickEdit(row, item.table2)">修改</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <el-table :data="sourceList.data[item.key]">
|
|
|
+ <template v-for="column in item.table">
|
|
|
+ <el-table-column :label="column.label" :prop="column.prop" :width="column.width" />
|
|
|
+ </template>
|
|
|
+ <el-table-column label="操作" align="center" width="80">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-button type="text" @click="clickEdit(row, item.table)">修改</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <el-dialog :title="modalType == 'add' ? '新增' : '修改'" v-if="openDialog" v-model="openDialog" width="500">
|
|
|
+ <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
|
|
|
+ <template #parentId>
|
|
|
+ <div style="width: 100%">
|
|
|
+ <el-cascader
|
|
|
+ v-model="formData.data.parentId"
|
|
|
+ :options="sourceList.data"
|
|
|
+ :props="{ checkStrictly: true, value: 'id', label: 'name', emitPath: false }"
|
|
|
+ clearable
|
|
|
+ style="width: 100%" />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </byForm>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="openDialog = false" size="large">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="submitForm()" size="large" v-preReClick>确 定</el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import byForm from "/src/components/byForm/index";
|
|
|
+import { ElMessage } from "element-plus";
|
|
|
+
|
|
|
+const { proxy } = getCurrentInstance();
|
|
|
+const sourceList = reactive({
|
|
|
+ data: {},
|
|
|
+});
|
|
|
+const loading = ref(false);
|
|
|
+const codeList = ref([
|
|
|
+ {
|
|
|
+ key: "base_material_price",
|
|
|
+ value: "基材价格",
|
|
|
+ table: [
|
|
|
+ { type: "input", prop: "name", label: "级别", width: 120, itemType: "text" },
|
|
|
+ { type: "number", prop: "price", label: "价格(每m2)", width: 120, min: 0, precision: 2, controls: false },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: "category_price",
|
|
|
+ value: "品类",
|
|
|
+ table: [
|
|
|
+ { type: "input", prop: "name", label: "品类", width: 120, itemType: "text" },
|
|
|
+ { type: "number", prop: "price", label: "价格", width: 100, min: 0, precision: 2, controls: false },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: "character_price",
|
|
|
+ value: "特性",
|
|
|
+ table: [
|
|
|
+ { type: "input", prop: "name", label: "特性", width: 120, itemType: "text" },
|
|
|
+ { type: "number", prop: "price", label: "价格", width: 100, min: 0, precision: 2, controls: false },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: "crop_config",
|
|
|
+ value: "裁切配置",
|
|
|
+ table: [
|
|
|
+ { type: "input", prop: "name", label: "品类", width: 120, itemType: "text" },
|
|
|
+ { type: "number", prop: "length", label: "加长(cm)", width: 120, min: 0, precision: 0, controls: false },
|
|
|
+ { type: "number", prop: "width", label: "加宽(cm)", width: 120, min: 0, precision: 0, controls: false },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: "embossing_config",
|
|
|
+ value: "压纹配置",
|
|
|
+ table: [
|
|
|
+ { type: "input", prop: "name", label: "品类", width: 120, itemType: "text" },
|
|
|
+ { type: "number", prop: "height", label: "加厚(mm)", width: 120, min: 0, precision: 2, controls: false },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: "yoga_mat_depletion_config",
|
|
|
+ value: "瑜伽垫损耗配置",
|
|
|
+ table1: [
|
|
|
+ { type: "input", prop: "name", label: "品类", width: 100, itemType: "text" },
|
|
|
+ { type: "number", prop: "depletion", label: "损耗", width: 100, min: 0, precision: 0, controls: false },
|
|
|
+ ],
|
|
|
+ table2: [
|
|
|
+ { type: "input", prop: "name", label: "成品宽度", width: 100, itemType: "text" },
|
|
|
+ { type: "number", prop: "depletion", label: "特定损耗", width: 100, min: 0, precision: 0, controls: false },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: "skip_mat_depletion_config",
|
|
|
+ value: "跳绳垫损耗配置",
|
|
|
+ table1: [
|
|
|
+ { type: "input", prop: "name", label: "品类", width: 100, itemType: "text" },
|
|
|
+ { type: "number", prop: "depletion", label: "损耗", width: 100, min: 0, precision: 0, controls: false },
|
|
|
+ ],
|
|
|
+ table2: [
|
|
|
+ { type: "input", prop: "name", label: "级别", width: 100, itemType: "text" },
|
|
|
+ { type: "number", prop: "depletion", label: "特定损耗", width: 100, min: 0, precision: 0, controls: false },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+]);
|
|
|
+const getList = () => {
|
|
|
+ loading.value = true;
|
|
|
+ proxy.post("/bomSpecPriceConfig/getAllConfigMap").then(
|
|
|
+ (res) => {
|
|
|
+ sourceList.data = res;
|
|
|
+ loading.value = false;
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ console.log(err);
|
|
|
+ loading.value = false;
|
|
|
+ }
|
|
|
+ );
|
|
|
+};
|
|
|
+getList();
|
|
|
+const modalType = ref("add");
|
|
|
+const submit = ref(null);
|
|
|
+const openDialog = ref(false);
|
|
|
+const formOption = reactive({
|
|
|
+ inline: true,
|
|
|
+ labelWidth: "120px",
|
|
|
+ itemWidth: 100,
|
|
|
+ rules: [],
|
|
|
+ labelPosition: "right",
|
|
|
+});
|
|
|
+const formData = reactive({
|
|
|
+ data: {},
|
|
|
+});
|
|
|
+const rules = ref({
|
|
|
+ name: [{ required: true, message: "请输入名称", trigger: "blur" }],
|
|
|
+});
|
|
|
+const formConfig = ref([]);
|
|
|
+const acquiesce = ref([
|
|
|
+ {
|
|
|
+ type: "select",
|
|
|
+ label: "类型",
|
|
|
+ prop: "type",
|
|
|
+ data: [
|
|
|
+ {
|
|
|
+ dictKey: "0",
|
|
|
+ dictValue: "正常配置",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ dictKey: "1",
|
|
|
+ dictValue: "附加配置",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ // fn: (e) => {
|
|
|
+ // if (e === 1) {
|
|
|
+ // formConfig.value = acquiesce.value.concat(codeList.value.filter((item) => item.key === formData.data.code)[0].table2);
|
|
|
+ // } else {
|
|
|
+ // formConfig.value = acquiesce.value.concat(codeList.value.filter((item) => item.key === formData.data.code)[0].table1);
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ },
|
|
|
+]);
|
|
|
+const clickModal = (code, list) => {
|
|
|
+ modalType.value = "add";
|
|
|
+ formData.data = {
|
|
|
+ code: code,
|
|
|
+ };
|
|
|
+ if (["yoga_mat_depletion_config", "skip_mat_depletion_config"].includes(code)) {
|
|
|
+ formData.data.type = "0";
|
|
|
+ formConfig.value = acquiesce.value.concat(codeList.value.filter((item) => item.key === code)[0].table1);
|
|
|
+ } else {
|
|
|
+ formConfig.value = list;
|
|
|
+ }
|
|
|
+ openDialog.value = true;
|
|
|
+};
|
|
|
+const submitForm = () => {
|
|
|
+ submit.value.handleSubmit(() => {
|
|
|
+ proxy.post("/bomSpecPriceConfig/" + modalType.value, formData.data).then(() => {
|
|
|
+ ElMessage({
|
|
|
+ message: modalType.value == "add" ? "添加成功" : "编辑成功",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ openDialog.value = false;
|
|
|
+ getList();
|
|
|
+ });
|
|
|
+ });
|
|
|
+};
|
|
|
+const clickEdit = (row, list) => {
|
|
|
+ modalType.value = "edit";
|
|
|
+ formData.data = JSON.parse(JSON.stringify(row));
|
|
|
+ formConfig.value = list;
|
|
|
+ openDialog.value = true;
|
|
|
+};
|
|
|
+const getData = (list, type) => {
|
|
|
+ if (list && list.length > 0) {
|
|
|
+ return list.filter((item) => item.type === type);
|
|
|
+ }
|
|
|
+ return [];
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped></style>
|