|
@@ -0,0 +1,391 @@
|
|
|
+<template>
|
|
|
+ <div class="pageIndexClass">
|
|
|
+ <div>
|
|
|
+ <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" highlight-current-row
|
|
|
+ :selectConfig="selectConfig" :action-list="[
|
|
|
+
|
|
|
+ ]" @get-list="getList" :span-method="objectSpanMethod">
|
|
|
+
|
|
|
+ <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>
|
|
|
+ <span>{{ item.productLength }}</span>*
|
|
|
+ <span>{{ item.productWidth }}</span>*
|
|
|
+ <span>{{ item.productHeight }}</span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ </byTable>
|
|
|
+ </div>
|
|
|
+ <el-dialog :title="modalType == 'add' ? '添加店铺' : '编辑店铺'" v-model="dialogVisible" width="500px" destroy-on-close>
|
|
|
+ <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="formDom" v-loading="submitLoading">
|
|
|
+ </byForm>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="dialogVisible = false" size="defualt">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="submitForm()" size="defualt" :loading="submitLoading">
|
|
|
+ 确 定
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import byTable from "@/components/byTable/index";
|
|
|
+import byForm from "@/components/byForm/index";
|
|
|
+const { proxy } = getCurrentInstance();
|
|
|
+const loading = ref(false);
|
|
|
+const submitLoading = ref(false);
|
|
|
+const sourceList = ref({
|
|
|
+ data: [],
|
|
|
+ pagination: {
|
|
|
+ total: 3,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ keyword: "",
|
|
|
+ produceStatus: "",
|
|
|
+ staDeliveryPeriod: "",
|
|
|
+ endDeliveryPeriod: "",
|
|
|
+ beginTime: "",
|
|
|
+ endTime: "",
|
|
|
+ },
|
|
|
+});
|
|
|
+const treeData = ref([]);
|
|
|
+const dialogVisible = ref(false);
|
|
|
+const modalType = ref("add");
|
|
|
+const selectConfig = computed(() => [
|
|
|
+ // {
|
|
|
+ // label: "工序",
|
|
|
+ // prop: "productionProcessesId",
|
|
|
+ // data: processesData.value,
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // type: "time",
|
|
|
+ // label: "交期",
|
|
|
+ // placeholder: "开始日期",
|
|
|
+ // prop: "staDeliveryPeriod",
|
|
|
+ // placeholderOne: "结束日期",
|
|
|
+ // propOne: "endDeliveryPeriod",
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // type: "time",
|
|
|
+ // label: "下单日期",
|
|
|
+ // placeholder: "开始日期",
|
|
|
+ // prop: "beginTime",
|
|
|
+ // placeholderOne: "结束日期",
|
|
|
+ // propOne: "endTime",
|
|
|
+ // },
|
|
|
+]);
|
|
|
+const config = computed(() => {
|
|
|
+ return [
|
|
|
+ // {
|
|
|
+ // attrs: {
|
|
|
+ // label: "任务编号",
|
|
|
+ // prop: "orderCode",
|
|
|
+ // // width: 150,
|
|
|
+ // },
|
|
|
+ // },
|
|
|
+
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "订单号",
|
|
|
+ prop: "orderCode",
|
|
|
+ width: 130,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "物料图片",
|
|
|
+ slot: "pic",
|
|
|
+ width: 80,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "物料编码",
|
|
|
+ prop: "productCode",
|
|
|
+ // width: 160,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "物料名称",
|
|
|
+ prop: "productName",
|
|
|
+ // "min-width": 200,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "规格尺寸(cm)",
|
|
|
+ slot: "size",
|
|
|
+ width: 130,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "物料颜色",
|
|
|
+ prop: "productColor",
|
|
|
+ // width: 160,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ // {
|
|
|
+ // attrs: {
|
|
|
+ // label: "标准用量",
|
|
|
+ // prop: "productColor",
|
|
|
+ // },
|
|
|
+ // },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "订单量",
|
|
|
+ prop: "orderQuantity",
|
|
|
+ width: 100,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "总需求",
|
|
|
+ prop: "demandQuantity",
|
|
|
+ width: 100,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "库存",
|
|
|
+ prop: "stockQuantity",
|
|
|
+ width: 100,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ // {
|
|
|
+ // attrs: {
|
|
|
+ // label: "安全库存",
|
|
|
+ // prop: "productColor",
|
|
|
+ // },
|
|
|
+ // },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "已领料",
|
|
|
+ prop: "prodOutQuantity",
|
|
|
+ width: 100,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "采购在途",
|
|
|
+ prop: "transitQuantity",
|
|
|
+ width: 100,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "净需求欠量",
|
|
|
+ prop: "lackQuantity",
|
|
|
+ width: 100,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ // {
|
|
|
+ // attrs: {
|
|
|
+ // label: "操作",
|
|
|
+ // width: "100",
|
|
|
+ // align: "center",
|
|
|
+ // fixed: "right",
|
|
|
+ // },
|
|
|
+ // renderHTML(row) {
|
|
|
+ // return [
|
|
|
+ // {
|
|
|
+ // attrs: {
|
|
|
+ // label: "删除",
|
|
|
+ // type: "danger",
|
|
|
+ // text: true,
|
|
|
+ // },
|
|
|
+ // el: "button",
|
|
|
+ // click() {
|
|
|
+ // proxy
|
|
|
+ // .msgConfirm()
|
|
|
+ // .then((res) => {
|
|
|
+ // proxy
|
|
|
+ // .post("/productionReporting/delete", {
|
|
|
+ // id: row.id,
|
|
|
+ // })
|
|
|
+ // .then((res) => {
|
|
|
+ // proxy.msgTip("操作成功", 1);
|
|
|
+ // getList();
|
|
|
+ // });
|
|
|
+ // })
|
|
|
+ // .catch((err) => {});
|
|
|
+ // },
|
|
|
+ // },
|
|
|
+ // ];
|
|
|
+ // },
|
|
|
+ // },
|
|
|
+ ];
|
|
|
+});
|
|
|
+const formData = reactive({
|
|
|
+ data: {},
|
|
|
+});
|
|
|
+const formOption = reactive({
|
|
|
+ inline: true,
|
|
|
+ labelWidth: 100,
|
|
|
+ itemWidth: 100,
|
|
|
+});
|
|
|
+const formDom = ref(null);
|
|
|
+const formConfig = computed(() => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ prop: "code",
|
|
|
+ label: "店铺编号",
|
|
|
+ itemWidth: 100,
|
|
|
+ disabled: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "input",
|
|
|
+ prop: "name",
|
|
|
+ label: "店铺名称",
|
|
|
+ itemWidth: 100,
|
|
|
+ disabled: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "treeSelect",
|
|
|
+ prop: "deptId",
|
|
|
+ label: "负责部门",
|
|
|
+ data: treeData.value,
|
|
|
+ propsTreeLabel: "deptName",
|
|
|
+ propsTreeValue: "deptId",
|
|
|
+ itemWidth: 100,
|
|
|
+ disabled: false,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+});
|
|
|
+const rules = ref({
|
|
|
+ deptId: [{ required: true, message: "请选择负责部门", trigger: "change" }],
|
|
|
+ name: [{ required: true, message: "请输入店铺名称", trigger: "blur" }],
|
|
|
+ code: [{ required: true, message: "请输入店铺编号", trigger: "blur" }],
|
|
|
+});
|
|
|
+
|
|
|
+const getList = async (req) => {
|
|
|
+ sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
|
|
|
+ loading.value = true;
|
|
|
+ proxy
|
|
|
+ .post("/contractMrpInfo/page", sourceList.value.pagination)
|
|
|
+ .then((res) => {
|
|
|
+ sourceList.value.data = res.rows;
|
|
|
+ sourceList.value.pagination.total = res.total;
|
|
|
+ setTimeout(() => {
|
|
|
+ loading.value = false;
|
|
|
+ }, 200);
|
|
|
+
|
|
|
+ const productIds = sourceList.value.data.map((x) => x.materialId);
|
|
|
+ proxy.getFileData({
|
|
|
+ businessIdList: productIds,
|
|
|
+ data: sourceList.value.data,
|
|
|
+ att: "materialId",
|
|
|
+ businessType: "0",
|
|
|
+ fileAtt: "fileList",
|
|
|
+ filePathAtt: "fileUrl",
|
|
|
+ });
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const openModal = () => {
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+const submitForm = () => {
|
|
|
+ formDom.value.handleSubmit((valid) => {
|
|
|
+ submitLoading.value = true;
|
|
|
+ proxy.post("/shopInfo/" + modalType.value, formData.data).then(
|
|
|
+ (res) => {
|
|
|
+ proxy.msgTip("操作成功", 1);
|
|
|
+ dialogVisible.value = false;
|
|
|
+ submitLoading.value = false;
|
|
|
+ getList();
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ submitLoading.value = false;
|
|
|
+ }
|
|
|
+ );
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const getDtl = (row) => {
|
|
|
+ modalType.value = "edit";
|
|
|
+ proxy.post("/shopInfo/detail", { id: row.id }).then((res) => {
|
|
|
+ formData.data = res;
|
|
|
+ dialogVisible.value = true;
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+getList();
|
|
|
+
|
|
|
+const processesData = ref([]);
|
|
|
+const getProcesses = () => {
|
|
|
+ proxy
|
|
|
+ .post("/productionProcesses/page", { pageNum: 1, pageSize: 9999 })
|
|
|
+ .then((res) => {
|
|
|
+ processesData.value = res.rows.map((x) => ({
|
|
|
+ ...x,
|
|
|
+ label: x.name,
|
|
|
+ value: x.id,
|
|
|
+ }));
|
|
|
+ });
|
|
|
+};
|
|
|
+// getProcesses();
|
|
|
+
|
|
|
+const flitterData = (arr) => {
|
|
|
+ let spanOneArr = [];
|
|
|
+ let concatOne = 0;
|
|
|
+ arr.forEach((item, index) => {
|
|
|
+ if (index === 0) {
|
|
|
+ spanOneArr.push(1);
|
|
|
+ } else {
|
|
|
+ //注意这里的contractId是表格绑定的字段,根据自己的需求来改
|
|
|
+ if (item.contractId === arr[index - 1].contractId) {
|
|
|
+ //第一列需合并相同内容的判断条件
|
|
|
+ spanOneArr[concatOne] += 1;
|
|
|
+ spanOneArr.push(0);
|
|
|
+ } else {
|
|
|
+ spanOneArr.push(1);
|
|
|
+ concatOne = index;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return {
|
|
|
+ one: spanOneArr,
|
|
|
+ };
|
|
|
+};
|
|
|
+
|
|
|
+const objectSpanMethod = ({ rowIndex, columnIndex }) => {
|
|
|
+ if (columnIndex === 0) {
|
|
|
+ const _row = flitterData(sourceList.value.data).one[rowIndex];
|
|
|
+ const _col = _row > 0 ? 1 : 0;
|
|
|
+ return {
|
|
|
+ rowspan: _row,
|
|
|
+ colspan: _col,
|
|
|
+ };
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+::v-deep(.el-progress__text) {
|
|
|
+ font-size: 14px !important;
|
|
|
+}
|
|
|
+.content {
|
|
|
+ padding: 20px;
|
|
|
+}
|
|
|
+</style>
|