Parcourir la source

table刷新bug,以及部分静态页面,部分功能调整

cz il y a 1 an
Parent
commit
0c2f685eed

+ 0 - 1
src/components/byTable/ElementsMapping.vue

@@ -79,7 +79,6 @@ export default defineComponent({
       };
     };
     if (getCellList.value.length > 3) {
-      console.log(getCellList, "asdasda");
       return {
         getCellList,
       };

+ 20 - 12
src/components/byTable/index.vue

@@ -150,7 +150,14 @@
 import { isFunction as isFn, isBoolean } from "./type";
 import ElementsMapping from "./ElementsMapping";
 import ComponentsMapping from "./ComponentsMapping";
-import { computed, defineComponent, getCurrentInstance, ref, watch } from "vue";
+import {
+  computed,
+  defineComponent,
+  getCurrentInstance,
+  ref,
+  toRaw,
+  watch,
+} from "vue";
 import expand from "./expand";
 import Sortable from "sortablejs";
 export default defineComponent({
@@ -308,7 +315,6 @@ export default defineComponent({
     // const configData = ref([]);
     // configData.value = proxy.config.filter((x) => x && x.attrs);
     const configData = computed(() => proxy.config.filter((x) => x && x.attrs));
-    // console.log(configData.value, "ssssssssss");
     const selectConfigCopy = computed(() => {
       return props.selectConfig.map((item) => {
         if (!item.labelCopy) item.labelCopy = { ...item }.label;
@@ -357,21 +363,23 @@ export default defineComponent({
       return proxy.$parent;
     });
     // 复制过滤条件
-    // const firstValue = ref(true);
-    const paginationCopy = ref({});
-    // if (firstValue.value) {
-    //   paginationCopy.value = Object.freeze(proxy.deepClone(props.pagination));
-    //   firstValue.value = false;
-    // }
 
-    paginationCopy.value = Object.freeze(proxy.deepClone(props.pagination));
+    let paginationCopy = {};
+    paginationCopy = Object.assign(
+      {},
+      proxy.deepClone(toRaw(props.pagination))
+    );
 
+    const paginationTotalData = new Set();
     const getPagination = computed(() => {
       const params = {
         pageNum: 1,
         pageSize: 10,
         total: 0,
       };
+      paginationTotalData.add(
+        props.pagination.total ? props.pagination.total : 0
+      );
       return Object.assign({}, params, props.pagination);
     });
     const getActionList = computed(() => {
@@ -436,12 +444,12 @@ export default defineComponent({
     };
 
     const searchReset = () => {
+      // total 取最大值是为了防止分页组件total值为0的时候会触发一次current-change事件
       proxy.$emit(
         "getList",
         Object.assign(props.filterParams, {
-          type: "",
-          status: "",
-          ...paginationCopy.value,
+          ...paginationCopy,
+          total: Math.max(...Array.from(paginationTotalData)),
         })
       );
     };

+ 165 - 0
src/components/process/SF/ReturnGood.vue

@@ -0,0 +1,165 @@
+<template>
+  <div style="width: 100%; padding: 0px 15px">
+    <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="formDom" v-loading="submitLoading">
+      <template #btn>
+        <div style="width:100%;display:flex">
+          <div style="width:calc(100% - 105px)">
+            <el-form-item label="订单号" prop="code" class="margin-b-0">
+              <el-input disabled v-model="formData.data.code" placeholder="请选择"></el-input>
+            </el-form-item>
+          </div>
+          <el-button type="primary" style="width:88px;margin-left:15px" @click="openMaterial = true" plain>选择订单</el-button>
+        </div>
+      </template>
+      <template #details>
+        <div style="width:100%">
+          <el-table :data="formData.data.claimContractList">
+            <el-table-column prop="contractCode" label="物料编码" width="140" />
+            <el-table-column prop="sumContractNotClaimMoney" label="物料名称" width="100" />
+            <el-table-column prop="sumContractNotClaimMoney" label="尺寸 (cm)" width="100" />
+            <el-table-column prop="sumContractNotClaimMoney" label="采购数量" width="100" />
+            <el-table-column prop="contractMoney" label="退货数量" min-width="150">
+              <template #default="{ row, $index }">
+                <el-form-item :prop="'claimContractList.' + $index + '.contractMoney'" :rules="rules.contractMoney" :inline-message="true">
+                  <el-input v-model="row.contractMoney" />
+                </el-form-item>
+              </template>
+            </el-table-column>
+            <el-table-column prop="contractMoney" label="退货原因" min-width="150">
+              <template #default="{ row, $index }">
+                <el-form-item :prop="'claimContractList.' + $index + '.contractMoney'" :rules="rules.contractMoney" :inline-message="true">
+                  <el-input v-model="row.contractMoney" />
+                </el-form-item>
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
+      </template>
+    </byForm>
+
+    <el-dialog v-model="openMaterial" title="采购订单" width="80%" append-to-body show-close>
+      <SelectPurchased @handleSelect="handleSelect"></SelectPurchased>
+    </el-dialog>
+
+  </div>
+</template>
+
+<script setup>
+import byForm from "@/components/byForm/index";
+import SelectPurchased from "@/views/EHSD/procurement/purchasedEHSD/selectPurchased.vue";
+const { proxy } = getCurrentInstance();
+const formData = reactive({
+  data: {},
+});
+const openMaterial = ref(false);
+const formDom = ref(null);
+const formOption = reactive({
+  inline: true,
+  labelWidth: 90,
+  itemWidth: 100,
+  rules: [],
+});
+const formConfig = computed(() => {
+  return [
+    {
+      type: "title",
+      title: "订单信息",
+      haveLine: false,
+    },
+    {
+      type: "slot",
+      slotName: "btn",
+      // prop: "code",
+      label: "",
+      itemWidth: 50,
+      disabled: true,
+    },
+    {
+      type: "input",
+      prop: "supplyName",
+      label: "供应商",
+      itemWidth: 50,
+      disabled: true,
+    },
+    {
+      type: "number",
+      prop: "amount",
+      label: "采购金额",
+      precision: 2,
+      min: 0,
+      controls: false,
+      itemWidth: 50,
+      disabled: true,
+    },
+    {
+      type: "number",
+      prop: "sumPayMoney",
+      label: "已付款金额",
+      precision: 2,
+      min: 0,
+      controls: false,
+      itemWidth: 50,
+      disabled: true,
+    },
+    {
+      type: "title",
+      title: "退货明细",
+      haveLine: true,
+    },
+    {
+      type: "slot",
+      slotName: "details",
+      label: "",
+    },
+  ];
+});
+
+const rules = ref({
+  code: [{ required: true, message: "请选择订单", trigger: "blur" }],
+  quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
+});
+
+const handleSelect = (row) => {
+  console.log(row, "ssa");
+  formData.data = {
+    code: row.code,
+    supplyName: row.supplyName,
+    amount: row.amount,
+    sumPayMoney: row.sumPayMoney,
+    id: row.id,
+  };
+  openMaterial.value = false;
+};
+const handleSubmit = async () => {
+  let flag = await formDom.value.handleSubmit(() => {});
+  if (flag) {
+    if (
+      formData.data.contractProductList &&
+      formData.data.contractProductList.length > 0
+    ) {
+      return true;
+    } else {
+      proxy.msgTip("请添加至少一件商品", 2);
+      return false;
+    }
+  } else {
+    // setTimeout(() => {
+    //   const errorDiv = document.getElementsByClassName("is-error");
+    //   errorDiv[0].scrollIntoView();
+    // }, 0);
+  }
+  return flag;
+};
+
+const getFormData = () => {
+  return proxy.deepClone(formData.data);
+};
+// 向父组件暴露
+defineExpose({
+  getFormData,
+  handleSubmit,
+});
+</script>
+
+<style lang="scss" scoped>
+</style>

+ 383 - 0
src/views/EHSD/procurement/purchasedEHSD/selectPurchased.vue

@@ -0,0 +1,383 @@
+<template>
+  <div class="pageIndexClass">
+    <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" :selectConfig="selectConfig"
+             :row-class-name="getRowClass" highlight-current-row @get-list="getList">
+      <template #code="{ item }">
+        <div v-if="Number(item.sumPayMoney) > Number(item.amount)" style="cursor: pointer; color: #f54a45" @click="handleClickCode(item)">
+          {{ item.code }}
+        </div>
+        <div v-else style="cursor: pointer; color: #409eff" @click="handleClickCode(item)">
+          {{ item.code }}
+        </div>
+      </template>
+      <template #amount="{ item }">
+        <div>
+          <span style="padding-right: 4px">{{ item.currency }}</span>
+          <span>{{ moneyFormat(item.amount, 2) }}</span>
+        </div>
+      </template>
+      <template #sumPayMoney="{ item }">
+        <div>
+          <span style="padding-right: 4px">{{ item.currency }}</span>
+          <span>{{ moneyFormat(item.sumPayMoney, 2) }}</span>
+        </div>
+      </template>
+
+      <template #payStatus="{ item }">
+        <div style="width:100%">
+          <span :class="{'tag-active':item.payStatus==20,'tag-active-1':item.payStatus==10}">{{dictValueLabel(item.payStatus, payStatus)}}</span>
+        </div>
+      </template>
+
+    </byTable>
+    <el-dialog title="打印" v-if="openPdf" v-model="openPdf" width="920px">
+      <PurchasePDF :rowData="rowData"></PurchasePDF>
+      <!-- <PurchasePDFOne :rowData="rowData"></PurchasePDFOne> -->
+      <!-- <PurchasePDFOneNew :rowData="rowData" ref="PdfDom"></PurchasePDFOneNew> -->
+      <!-- <template #footer ref="printBtn">
+        <el-button @click="openPdf = false" size="default">关闭</el-button>
+        <el-button type="primary" v-print="printObj" size="default">打印</el-button>
+        <el-button type="primary" @click="clickDownload()" size="default">下载PDF</el-button>
+        <el-button type="primary" @click="exportExcel()" size="default">导出Excel</el-button>
+      </template> -->
+    </el-dialog>
+  </div>
+</template>
+
+<script setup>
+import { computed, ref } from "vue";
+import byTable from "@/components/byTable/index";
+import { ElMessage, ElMessageBox } from "element-plus";
+import PurchasePDF from "@/components/PDF/purchasePDF.vue";
+// import PurchasePDFOne from "@/components/PDF/purchasePDFOne.vue";
+// import PurchasePDFOneNew from "@/components/PDF/purchasePDFOneNew.vue";
+
+const route = useRoute();
+const { proxy } = getCurrentInstance();
+const supplierList = ref([]);
+const status = ref([
+  {
+    label: "草稿",
+    value: 0,
+  },
+  {
+    label: "审批中",
+    value: 10,
+  },
+  {
+    label: "驳回",
+    value: 20,
+  },
+  {
+    label: "已采购",
+    value: 30,
+  },
+  {
+    label: "变更中",
+    value: 60,
+  },
+  {
+    label: "已变更",
+    value: 70,
+  },
+  {
+    label: "作废",
+    value: 88,
+  },
+  {
+    label: "终止",
+    value: 99,
+  },
+]);
+const payStatus = ref([
+  {
+    label: "未付款",
+    value: 0,
+  },
+  {
+    label: "部分付款",
+    value: 10,
+  },
+  {
+    label: "已付款",
+    value: 20,
+  },
+]);
+const sourceList = ref({
+  data: [],
+  pagination: {
+    total: 0,
+    pageNum: 1,
+    pageSize: 10,
+    keyword: "",
+    status: "30",
+    payStatus: "",
+  },
+});
+const loading = ref(false);
+const companyData = ref([]);
+const selectConfig = computed(() => {
+  return [
+    {
+      label: "归属公司",
+      prop: "companyId",
+      data: companyData.value,
+    },
+    // {
+    //   label: "采购状态",
+    //   prop: "status",
+    //   data: status.value,
+    // },
+    {
+      label: "付款状态",
+      prop: "payStatus",
+      data: payStatus.value,
+    },
+  ];
+});
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "归属公司",
+        prop: "companyName",
+        width: 130,
+      },
+    },
+    {
+      attrs: {
+        label: "采购单号",
+        slot: "code",
+        width: 180,
+      },
+    },
+    {
+      attrs: {
+        label: "供应商",
+        prop: "sellCorporationId",
+        "min-width": 220,
+      },
+      render(type) {
+        return proxy.dictValueLabel(type, supplierList.value);
+      },
+    },
+    {
+      attrs: {
+        label: "采购金额",
+        slot: "amount",
+        width: 140,
+      },
+    },
+    {
+      attrs: {
+        label: "已付款金额",
+        slot: "sumPayMoney",
+        width: 140,
+      },
+    },
+    {
+      attrs: {
+        label: "采购人",
+        prop: "userName",
+        width: 140,
+      },
+    },
+    {
+      attrs: {
+        label: "采购时间",
+        prop: "createTime",
+        width: 160,
+      },
+    },
+    {
+      attrs: {
+        label: "采购状态",
+        prop: "status",
+        width: 140,
+      },
+      render(type) {
+        return proxy.dictValueLabel(type, status.value);
+      },
+    },
+    {
+      attrs: {
+        label: "付款状态",
+        prop: "payStatus",
+        slot: "payStatus",
+        width: 140,
+      },
+      // render(type) {
+      //   return proxy.dictValueLabel(type, payStatus.value);
+      // },
+    },
+    {
+      attrs: {
+        label: "操作",
+        width: 80,
+        align: "center",
+        fixed: "right",
+      },
+      renderHTML(row) {
+        return [
+          {
+            attrs: {
+              label: "选择",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              handleSelect(row);
+            },
+          },
+        ];
+      },
+    },
+  ];
+});
+const getDict = () => {
+  proxy
+    .post("/supplierInfo/page", { pageNum: 1, pageSize: 999 })
+    .then((res) => {
+      supplierList.value = res.rows.map((item) => {
+        return {
+          ...item,
+          label: item.name,
+          value: item.id,
+        };
+      });
+    });
+
+  proxy
+    .get("/tenantDept/list", {
+      pageNum: 1,
+      pageSize: 9999,
+      keyword: "",
+      tenantId: proxy.useUserStore().user.tenantId,
+      type: 0,
+    })
+    .then((res) => {
+      companyData.value = res.data.map((x) => ({
+        ...x,
+        label: x.deptName,
+        value: x.deptId,
+      }));
+      // treeData.value = proxy.handleTree(res.data, "deptId");
+    });
+};
+const getList = async (req) => {
+  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  loading.value = true;
+  proxy.post("/ehsdPurchase/page", sourceList.value.pagination).then((res) => {
+    console.log(res);
+    sourceList.value.data = res.rows;
+    sourceList.value.pagination.total = res.total;
+    setTimeout(() => {
+      loading.value = false;
+    }, 200);
+  });
+};
+getDict();
+if (route.query.code) {
+  sourceList.value.pagination.keyword = route.query.code;
+}
+getList();
+
+const openPdf = ref(false);
+const pdfData = ref({});
+const rowData = ref({});
+const handlePrintPdf = (row) => {
+  rowData.value = {
+    id: row.id,
+    code: row.code,
+  };
+  rowData.value = row;
+  openPdf.value = true;
+};
+const clickDownload = () => {
+  proxy.getPdf("购销合同" + rowData.value.code);
+};
+const pdfDom = ref(null);
+const printObj = ref({
+  id: "pdfDom",
+  popTitle: "",
+  extraCss:
+    "https://cdn.bootcdn.net/ajax/libs/animate.css/4.1.1/animate.compat.css, https://cdn.bootcdn.net/ajax/libs/hover.css/2.3.1/css/hover-min.css",
+  extraHead: '<meta http-equiv="Content-Language"content="zh-cn"/>',
+});
+
+const handleClickCode = (row) => {
+  // let submitType = row.dataResource > 0 ? "10" : "20";
+  proxy.$router.push({
+    path: "/platform_manage/process/processApproval",
+    query: {
+      flowKey: "purchase_flow",
+      id: row.flowId,
+      processType: 20,
+      businessId: row.id,
+      // submitType,
+    },
+  });
+};
+
+const getRowClass = ({ row }) => {
+  if (Number(row.sumPayMoney) > Number(row.amount)) {
+    return "redClass";
+  }
+  return "";
+};
+
+const handleChange = (row) => {
+  let submitType = row.dataResource > 0 ? "10" : "20";
+  let type = "";
+  if (row.dataResource == 1) {
+    type = 1;
+  } else if (row.dataResource == 2) {
+    type = 2;
+  }
+  proxy.$router.push({
+    path: "/platform_manage/process/processApproval",
+    query: {
+      flowKey: "purchase_update_flow",
+      flowName: "采购合同变更",
+      random: proxy.random(),
+      businessId: row.id,
+      submitType,
+      type,
+    },
+  });
+};
+
+const PdfDom = ref(null);
+const exportExcel = () => {
+  PdfDom.value.exportExcel();
+};
+
+const handleSelect = (row) => {
+  proxy.$emit("handleSelect", row);
+};
+</script>
+
+<style lang="scss" scoped>
+.tenant {
+  padding: 20px;
+}
+::v-deep(.el-input-number .el-input__inner) {
+  text-align: left;
+}
+.baseRow {
+  min-height: 24px;
+  border-top: 1px solid black;
+  border-left: 1px solid black;
+}
+.contentRow {
+  border-right: 1px solid black;
+  line-height: 24px;
+  padding-left: 4px;
+}
+</style>
+<style>
+.redClass {
+  color: #f54a45 !important;
+}
+</style>

+ 327 - 0
src/views/EHSD/procurement/returnGood/index.vue

@@ -0,0 +1,327 @@
+<template>
+  <div class="pageIndexClass">
+
+    <div>
+      <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" highlight-current-row
+               :selectConfig="selectConfig" :table-events="{
+          //element talbe事件都能传
+        }" :action-list="[
+          {
+            text: '添加退货',
+            disabled: false,
+            action: () => clickAdd(),
+          },
+        ]" @get-list="getList">
+      </byTable>
+    </div>
+
+    <el-dialog title="添加退货" v-model="dialogVisible" width="70%" destroy-on-close>
+      <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="formDom" v-loading="submitLoading">
+        <template #btn>
+          <div style="width:100%">
+            <el-button type="primary" @click="openMaterial = true" plain>选择订单</el-button>
+          </div>
+        </template>
+        <template #details>
+          <div style="width:100%">
+            <el-table :data="formData.data.claimContractList">
+              <el-table-column prop="contractCode" label="产品编码" width="140" />
+              <el-table-column prop="sumContractNotClaimMoney" label="产品名称" width="100" />
+              <el-table-column prop="sumContractNotClaimMoney" label="尺寸" width="100" />
+              <el-table-column prop="sumContractNotClaimMoney" label="采购数量" width="100" />
+              <el-table-column prop="contractMoney" label="退货数量" min-width="150">
+                <template #default="{ row, $index }">
+                  <el-form-item :prop="'claimContractList.' + $index + '.contractMoney'" :rules="rules.contractMoney" :inline-message="true">
+                    <el-input v-model="row.contractMoney" />
+                  </el-form-item>
+                </template>
+              </el-table-column>
+              <el-table-column prop="contractMoney" label="退货原因" min-width="150">
+                <template #default="{ row, $index }">
+                  <el-form-item :prop="'claimContractList.' + $index + '.contractMoney'" :rules="rules.contractMoney" :inline-message="true">
+                    <el-input v-model="row.contractMoney" />
+                  </el-form-item>
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+        </template>
+      </byForm>
+      <template #footer>
+        <el-button @click="dialogVisible = false" size="defualt" v-debounce>取 消</el-button>
+        <el-button type="primary" @click="submitForm()" size="defualt" v-debounce>
+          确 定
+        </el-button>
+      </template>
+    </el-dialog>
+
+    <el-dialog v-model="openMaterial" title="选择采购订单" width="80%" append-to-body>
+      <SelectPurchased @handleSelect="handleSelect"></SelectPurchased>
+      <!-- <template #footer>
+        <span class="dialog-footer">
+          <el-button @click="openMaterial = false">取消</el-button>
+        </span>
+      </template> -->
+    </el-dialog>
+
+  </div>
+</template>
+  
+<script setup>
+import byTable from "@/components/byTable/index";
+import byForm from "@/components/byForm/index";
+import SelectPurchased from "@/views/EHSD/procurement/purchasedEHSD/selectPurchased.vue";
+const { proxy } = getCurrentInstance();
+const loading = ref(false);
+const submitLoading = ref(false);
+const sourceList = ref({
+  data: [],
+  pagination: {
+    total: 3,
+    pageNum: 1,
+    pageSize: 10,
+    keyword: "",
+  },
+});
+const openMaterial = ref(false);
+const dialogVisible = ref(false);
+const openFollow = ref(false);
+const rules = ref({
+  productSn: [{ required: true, message: "请输入产品Sn", trigger: "blur" }],
+  type: [{ required: true, message: "请选择售后类型", trigger: "change" }],
+  remark: [{ required: true, message: "请输入售后说明", trigger: "blur" }],
+  contactName: [
+    { required: true, message: "请输入客户联系人", trigger: "blur" },
+  ],
+  contactInfo: [
+    { required: true, message: "请输入客户联系方式", trigger: "blur" },
+  ],
+  afterSalesPersonId: [
+    { required: true, message: "请选择售后人员", trigger: "change" },
+  ],
+  quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
+});
+const userList = ref([]);
+const afterSalesType = computed(
+  () => proxy.useUserStore().allDict["after_sales_type"]
+);
+const selectConfig = computed(() => [
+  // {
+  //   label: "售后类型",
+  //   prop: "type",
+  //   data: afterSalesType.value,
+  // },
+  // {
+  //   label: "售后状态",
+  //   prop: "status",
+  //   data: [
+  //     {
+  //       label: "进行中",
+  //       value: 0,
+  //     },
+  //     {
+  //       label: "完成",
+  //       value: 1,
+  //     },
+  //   ],
+  // },
+]);
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "售后编码",
+        prop: "code",
+      },
+    },
+    {
+      attrs: {
+        label: "产品Sn",
+        prop: "productSn",
+      },
+    },
+
+    {
+      attrs: {
+        label: "产品名称",
+        prop: "productName",
+      },
+    },
+
+    {
+      attrs: {
+        label: "规格型号",
+        prop: "productSpec",
+      },
+    },
+    {
+      attrs: {
+        label: "售后金额",
+        prop: "amount",
+      },
+    },
+    {
+      attrs: {
+        label: "售后状态",
+        prop: "status",
+      },
+      render(status) {
+        return status == "0" ? "进行中" : "完成";
+      },
+    },
+    {
+      attrs: {
+        label: "操作",
+        width: "200",
+        align: "center",
+        fixed: "right",
+      },
+      renderHTML(row) {
+        return [];
+      },
+    },
+  ];
+});
+const formData = reactive({
+  data: {
+    afterSalesDetailList: [],
+  },
+  followData: {},
+  detailData: {},
+});
+const formOption = reactive({
+  inline: true,
+  labelWidth: 110,
+  itemWidth: 100,
+  rules: [],
+});
+const formConfig = computed(() => {
+  return [
+    {
+      type: "title1",
+      title: "订单信息",
+    },
+    {
+      type: "slot",
+      slotName: "btn",
+      label: " ",
+    },
+    {
+      type: "input",
+      prop: "code",
+      label: "订单号",
+      itemWidth: 50,
+      disabled: true,
+    },
+    {
+      type: "input",
+      prop: "supplyName",
+      label: "供应商",
+      itemWidth: 50,
+      disabled: true,
+    },
+    {
+      type: "title1",
+      title: "退货明细",
+    },
+    {
+      type: "slot",
+      slotName: "details",
+      label: " ",
+    },
+  ];
+});
+
+const formDom = ref(null);
+
+const getList = (req) => {
+  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  loading.value = true;
+  proxy
+    .post("/sale/accountRunningWater/page", sourceList.value.pagination)
+    .then((res) => {
+      sourceList.value.data = res.rows;
+      sourceList.value.pagination.total = res.total;
+      setTimeout(() => {
+        loading.value = false;
+      }, 200);
+    });
+};
+
+const submitForm = () => {
+  formDom.value.handleSubmit(() => {
+    submitLoading.value = true;
+    proxy.post("/afterSalesRecord/add", formData.data).then(
+      (res) => {
+        ElMessage({
+          message: "操作成功",
+          type: "success",
+        });
+        dialogVisible.value = false;
+        submitLoading.value = false;
+        getList();
+      },
+      (err) => {
+        submitLoading.value = false;
+      }
+    );
+  });
+};
+
+const getDict = () => {
+  proxy
+    .get("/tenantUser/list", {
+      pageNum: 1,
+      pageSize: 10000,
+      companyId: proxy.useUserStore().user.companyId,
+    })
+    .then((res) => {
+      userList.value = res.rows.map((item) => {
+        return {
+          label: item.nickName,
+          value: item.userId,
+        };
+      });
+    });
+};
+getDict();
+getList();
+
+const clickAdd = (type) => {
+  // formData.data = {
+  //   claimContractList: [],
+  //   claimContractList: [],
+  // };
+  // dialogVisible.value = true;
+
+  proxy.$router.replace({
+    path: "/platform_manage/process/processApproval",
+    query: {
+      flowKey: "return_good_flow",
+      flowName: "采购退货审批流程",
+      random: proxy.random(),
+    },
+  });
+};
+
+const handleSelect = (row) => {
+  console.log(row, "ssa");
+  formData.data = {
+    code: row.code,
+    supplyName: row.supplyName,
+    id: row.id,
+  };
+  openMaterial.value = false;
+};
+
+const handleRemove = (index, type) => {
+  formData.followData.afterSalesMaterialsList.splice(index, 1);
+  return ElMessage({
+    message: "删除成功",
+    type: "success",
+  });
+};
+</script>
+  
+<style lang="scss" scoped>
+</style>

+ 1 - 1
src/views/EHSD/productLibrary/companyProduct/index.vue

@@ -891,7 +891,7 @@ getTreeList();
 getList();
 
 const exportExcel = () => {
-  proxy.msgTip("请稍后", 2);
+  proxy.msgTip("正在导出,请稍后", 2);
   proxy
     .postTwo("/productInfo/exportExcel", sourceList.value.pagination)
     .then((res) => {

+ 3 - 1
src/views/EHSD/saleContract/contractEHSD/index.vue

@@ -238,7 +238,7 @@
 </template>
 
 <script setup>
-import { computed, ref } from "vue";
+import { computed, ref, watch } from "vue";
 import byTable from "@/components/byTable/index";
 import byForm from "@/components/byForm/index";
 import useUserStore from "@/store/modules/user";
@@ -322,6 +322,8 @@ const sourceList = ref({
     isSettled: "",
     beginTime: "",
     endTime: "",
+    deliveryTimeSta: "",
+    deliveryTimeEnd: "",
   },
 });
 const loading = ref(false);

+ 26 - 2
src/views/EHSD/saleContract/dailyReport/index.vue

@@ -230,9 +230,32 @@ const scrollIntoEle = () => {
 };
 
 const exportExcel = () => {
-  proxy.msgTip("请稍后", 2);
+  proxy.msgTip("正在导出,请稍后", 2);
   const wb = XLSX.utils.table_to_book(document.querySelector("#my-table")); // 关联dom节点
-  /* get binary string as output */
+  // 设置百分比列的单元格样式
+  const percentStyle = {
+    font: { bold: true },
+    fill: { fgColor: { rgb: "FFFF00" } },
+    border: { top: { style: "thin" }, bottom: { style: "thin" } },
+  };
+
+  if (wb.Sheets.Sheet1) {
+    // 达成率单元格的key开头
+    let cellKey = "";
+    for (const key in wb.Sheets.Sheet1) {
+      let value = wb.Sheets.Sheet1[key];
+      if (value && value.v == "月达成率") {
+        cellKey = key.match(/[a-zA-Z]+/g)[0];
+      }
+      // key有包含cellKey的
+      if (cellKey && key.includes(cellKey)) {
+        // 单元格的样式
+        wb.Sheets.Sheet1[key].s = percentStyle;
+        // 用于指定单元格中显示值的格式,例如日期格式、百分比格式等
+        wb.Sheets.Sheet1[key].z = "0.00%";
+      }
+    }
+  }
   const wbout = XLSX.write(wb, {
     bookType: "xlsx",
     bookSST: true,
@@ -267,6 +290,7 @@ const exportExcel = () => {
 }
 :deep(.el-table .cell) {
   padding: 0 6px !important;
+  font-size: 12px !important;
 }
 .query {
   background: #20b2aa;

+ 2 - 0
src/views/JST/order/index.vue

@@ -53,6 +53,8 @@ const sourceList = ref({
     pageNum: 1,
     pageSize: 10,
     keyword: "",
+    startTime: "",
+    endTime: "",
   },
 });
 const treeData = ref([]);

+ 58 - 25
src/views/index.vue

@@ -20,7 +20,7 @@
           </div>
         </li>
         <li class="theme3" @click="toUrl(3)">
-          <div class="num">{{ allData[0].total }}</div>
+          <div class="num">{{ allData[1].total }}</div>
           <div class="label">待投产</div>
           <div class="icon-box">
             <svg-icon :icon-class="'touchang'" className="svg-class" />
@@ -48,7 +48,7 @@
           </div>
         </li>
         <li class="theme6" @click="toUrl(6)" v-else>
-          <div class="num">{{ allData[4].total }}</div>
+          <div class="num">{{ allData[5].total }}</div>
           <div class="label">库存预警</div>
           <div class="icon-box">
             <svg-icon :icon-class="'kucun'" className="svg-class1" />
@@ -74,10 +74,9 @@
         </el-card>
         <el-card style="width:32%">
           <TitleInfo :content="'待投产'"></TitleInfo>
-          <el-table :data="tableData" style="width: 100%" :height="tableHeight">
-            <el-table-column prop="date" label="Date" />
-            <el-table-column prop="name" label="Name" />
-            <el-table-column prop="address" label="Address" />
+          <el-table :data="allData[1].rows" style="width: 100%" :height="tableHeight">
+            <el-table-column prop="code" label="订单号" />
+            <el-table-column prop="deliveryPeriod" label="交期" width="150" />
           </el-table>
 
         </el-card>
@@ -87,7 +86,7 @@
         <el-card style="width:32%">
           <TitleInfo :content="'待入库'"></TitleInfo>
           <el-table :data="allData[2].rows" style="width: 100%" :height="tableHeight">
-            <el-table-column prop="businessCode" label="单号" />
+            <el-table-column prop="productName" label="产品名称" />
             <el-table-column prop="quantity" label="数量" width="100" />
           </el-table>
 
@@ -95,7 +94,7 @@
         <el-card style="width:32%">
           <TitleInfo :content="'待出库'"></TitleInfo>
           <el-table :data="allData[3].rows" style="width: 100%" :height="tableHeight">
-            <el-table-column prop="businessCode" label="单号" />
+            <el-table-column prop="productName" label="产品名称" />
             <el-table-column prop="quantity" label="数量" width="100" />
           </el-table>
 
@@ -111,12 +110,11 @@
         </el-card>
         <el-card style="width:32%" v-else>
           <TitleInfo :content="'库存预警'"></TitleInfo>
-          <el-table :data="allData[4].rows" style="width: 100%" :height="tableHeight">
-            <el-table-column prop="date" label="Date" />
-            <el-table-column prop="name" label="Name" />
-            <el-table-column prop="address" label="Address" />
+          <el-table :data="allData[5].rows" style="width: 100%" :height="tableHeight">
+            <el-table-column prop="productCode" label="产品编码" />
+            <el-table-column prop="productName" label="产品名称" />
+            <el-table-column prop="stockThreshold" label="安全库存" width="100" />
           </el-table>
-
         </el-card>
       </div>
 
@@ -126,11 +124,10 @@
         <TitleInfo :content="'监控告警'"></TitleInfo>
       </div>
       <el-card style="margin-bottom:20px">
-        <TitleInfo :content="'逾期订单'"></TitleInfo>
-        <el-table :data="tableData" style="width: 100%" :height="tableHeightOne">
-          <el-table-column prop="date" label="Date" />
-          <el-table-column prop="name" label="Name" />
-          <el-table-column prop="address" label="Address" />
+        <TitleInfo :content="'逾期生产订单'+` (${allData[6].total})`"></TitleInfo>
+        <el-table :data="allData[6].rows" style="width: 100%" :height="tableHeightOne">
+          <el-table-column prop="code" label="订单号" />
+          <el-table-column prop="deliveryPeriod" label="交期" width="150" />
         </el-table>
       </el-card>
       <el-card style="margin-bottom:20px">
@@ -138,11 +135,11 @@
         <div class="baosun">
           <div class="theme2 q" @click="toUrl(7)">
             <span class="label">补单</span>
-            <span class="num">{{ toBeProcessedData.total }}</span>
+            <span class="num">{{ reportLossesData.replenishSumQuantity }}</span>
           </div>
           <div class="theme3 q" @click="toUrl(7)">
             <span class="label">丢失</span>
-            <span class="num">{{ toBeProcessedData.total }}</span>
+            <span class="num">{{ reportLossesData.lossSumQuantity }}</span>
           </div>
         </div>
       </el-card>
@@ -196,8 +193,11 @@ const allData = ref({
   2: { total: 0, rows: [] },
   3: { total: 0, rows: [] },
   4: { total: 0, rows: [] },
+  5: { total: 0, rows: [] },
+  6: { total: 0, rows: [] },
 });
 
+const reportLossesData = ref({});
 const pushProcessApproval = (row) => {
   if (row.status != 1 && row.status != 0) {
     proxy.$router.push({
@@ -268,6 +268,18 @@ const getData = () => {
     .then((res) => {
       allData.value[0] = res;
     });
+
+  // 待投产
+  proxy
+    .post("/produceOrder/page", {
+      pageNum: 1,
+      pageSize: 5,
+      isProduce: "0",
+    })
+    .then((res) => {
+      allData.value[1] = res;
+    });
+
   // 待入库
   proxy
     .post("/stockWaitDetails/page", {
@@ -300,6 +312,31 @@ const getData = () => {
     .then((res) => {
       allData.value[4] = res;
     });
+
+  // 库存预警
+  proxy
+    .post("/stock/stockWarningPage", {
+      pageNum: 1,
+      pageSize: 5,
+    })
+    .then((res) => {
+      allData.value[5] = res;
+    });
+
+  // 逾期生产订单
+  proxy
+    .post("/produceOrder/page", {
+      pageNum: 1,
+      pageSize: 10,
+      isOverdue: "1",
+    })
+    .then((res) => {
+      allData.value[6] = res;
+    });
+  // 报损统计
+  proxy.post("/reportLossesDetails/lossesStatistics").then((res) => {
+    reportLossesData.value = res;
+  });
 };
 const toUrl = (att) => {
   //获取name为name的路由的基础信息
@@ -406,11 +443,6 @@ onMounted(() => {
   pie_1Chart.resize();
 });
 </script>
-<style>
-.table-warp .el-table .cell {
-  line-height: 24px !important;
-}
-</style>
 <style scoped lang="scss">
 .app-container {
   display: flex;
@@ -677,6 +709,7 @@ onMounted(() => {
 }
 :deep(.el-table .cell) {
   font-size: 12px !important;
+  line-height: 24px !important;
 }
 </style>
 

+ 2 - 0
src/views/process/processApproval/index.vue

@@ -33,6 +33,7 @@
         <!-- 请款 -->
         <SendFunds ref="makeDom" v-else-if="flowForm.flowKey == 'account_request_funds_flow'" :queryData="queryData.data"></SendFunds>
 
+        <ReturnGood ref="makeDom" v-else-if="flowForm.flowKey == 'return_good_flow'" :queryData="queryData.data"></ReturnGood>
         <!-- 取消到账认领 -->
         <!-- <CancelClaim ref="makeDom" v-else-if="flowForm.flowKey == 'claim_del_flow'" :queryData="queryData.data"></CancelClaim> -->
       </div>
@@ -150,6 +151,7 @@ import ContractChange from "@/components/process/SF/ContractChange";
 import Subscribe from "@/components/process/SF/Subscribe";
 import Purchase from "@/components/process/SF/Purchase";
 import PurchaseChange from "@/components/process/SF/PurchaseChange";
+import ReturnGood from "@/components/process/SF/ReturnGood";
 
 import PurchasePayment from "@/components/process/PurchasePayment";
 import SendFunds from "@/components/process/SendFunds";

+ 383 - 0
src/views/salesMange/afterSales/index.vue

@@ -0,0 +1,383 @@
+<template>
+  <div class="pageIndexClass">
+
+    <div>
+      <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" highlight-current-row
+               :selectConfig="selectConfig" :table-events="{
+          //element talbe事件都能传
+        }" :action-list="[
+          {
+            text: '添加售后',
+            disabled: false,
+            action: () => clickAdd(),
+          },
+        ]" @get-list="getList">
+      </byTable>
+    </div>
+
+    <el-dialog title="添加售后" v-model="dialogVisible" width="70%" destroy-on-close v-if="dialogVisible">
+      <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="formDom" v-loading="submitLoading">
+        <template #btn>
+          <div style="width:100%;display:flex">
+            <div style="width:calc(100% - 105px)">
+              <el-form-item label="订单号" prop="code" class="margin-b-0">
+                <el-input disabled v-model="formData.data.code" placeholder="请选择"></el-input>
+              </el-form-item>
+            </div>
+            <el-button type="primary" style="width:88px;margin-left:15px" @click="openMaterial = true" plain>选择产品</el-button>
+          </div>
+        </template>
+
+        <template #image>
+          <div style="width:100%">
+            aaa
+          </div>
+        </template>
+      </byForm>
+      <template #footer>
+        <el-button @click="dialogVisible = false" size="defualt" v-debounce>取 消</el-button>
+        <el-button type="primary" @click="submitForm()" size="defualt" v-debounce>
+          确 定
+        </el-button>
+      </template>
+    </el-dialog>
+
+    <!-- <el-dialog v-model="openMaterial" title="选择物料/半成品" width="70%" append-to-body>
+      <SelectMaterial @handleSelect="handleSelect"></SelectMaterial>
+      <template #footer>
+        <span class="dialog-footer">
+          <el-button @click="openMaterial = false">取消</el-button>
+        </span>
+      </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: "",
+  },
+});
+const openMaterial = ref(false);
+const dialogVisible = ref(false);
+const openFollow = ref(false);
+const rules = ref({
+  productSn: [{ required: true, message: "请输入产品Sn", trigger: "blur" }],
+  type: [{ required: true, message: "请选择售后类型", trigger: "change" }],
+  remark: [{ required: true, message: "请输入售后说明", trigger: "blur" }],
+  contactName: [
+    { required: true, message: "请输入客户联系人", trigger: "blur" },
+  ],
+  contactInfo: [
+    { required: true, message: "请输入客户联系方式", trigger: "blur" },
+  ],
+  afterSalesPersonId: [
+    { required: true, message: "请选择售后人员", trigger: "change" },
+  ],
+  quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
+});
+const userList = ref([]);
+const afterSalesType = computed(
+  () => proxy.useUserStore().allDict["after_sales_type"]
+);
+const selectConfig = computed(() => [
+  // {
+  //   label: "售后类型",
+  //   prop: "type",
+  //   data: afterSalesType.value,
+  // },
+  // {
+  //   label: "售后状态",
+  //   prop: "status",
+  //   data: [
+  //     {
+  //       label: "进行中",
+  //       value: 0,
+  //     },
+  //     {
+  //       label: "完成",
+  //       value: 1,
+  //     },
+  //   ],
+  // },
+]);
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "售后编码",
+        prop: "code",
+      },
+    },
+    {
+      attrs: {
+        label: "产品Sn",
+        prop: "productSn",
+      },
+    },
+
+    {
+      attrs: {
+        label: "产品名称",
+        prop: "productName",
+      },
+    },
+
+    {
+      attrs: {
+        label: "规格型号",
+        prop: "productSpec",
+      },
+    },
+    {
+      attrs: {
+        label: "售后金额",
+        prop: "amount",
+      },
+    },
+    {
+      attrs: {
+        label: "售后状态",
+        prop: "status",
+      },
+      render(status) {
+        return status == "0" ? "进行中" : "完成";
+      },
+    },
+    {
+      attrs: {
+        label: "操作",
+        width: "200",
+        align: "center",
+        fixed: "right",
+      },
+      renderHTML(row) {
+        return [];
+      },
+    },
+  ];
+});
+const formData = reactive({
+  data: {
+    afterSalesDetailList: [],
+  },
+  followData: {},
+  detailData: {},
+});
+const formOption = reactive({
+  inline: true,
+  labelWidth: 110,
+  itemWidth: 100,
+  rules: [],
+});
+const formConfig = computed(() => {
+  return [
+    {
+      type: "title1",
+      title: "售后产品",
+    },
+    {
+      type: "slot",
+      slotName: "btn",
+      // prop: "code",
+      label: "",
+      itemWidth: 50,
+      disabled: true,
+    },
+    {
+      type: "number",
+      prop: "amount",
+      label: "售后数量",
+      precision: 2,
+      min: 0,
+      controls: false,
+      itemWidth: 50,
+    },
+    {
+      type: "input",
+      itemType: "text",
+      prop: "remark",
+      label: "产品编码",
+      itemWidth: 50,
+      disabled: true,
+    },
+    {
+      type: "input",
+      itemType: "text",
+      prop: "remark",
+      label: "产品名称",
+      itemWidth: 50,
+      disabled: true,
+    },
+    {
+      type: "input",
+      itemType: "text",
+      prop: "remark",
+      label: "尺寸 (cm)",
+      itemWidth: 50,
+      disabled: true,
+    },
+    {
+      type: "slot",
+      slotName: "image",
+      label: "产品图片",
+      itemWidth: 100,
+    },
+    {
+      type: "title1",
+      title: "基本信息",
+    },
+    {
+      type: "select",
+      prop: "type",
+      label: "售后类型",
+      required: true,
+      itemWidth: 50,
+      data: afterSalesType.value,
+      disabled: false,
+    },
+    {
+      type: "select",
+      prop: "afterSalesPersonId",
+      label: "售后人员",
+      itemWidth: 50,
+      filterable: true,
+      data: userList.value,
+      disabled: false,
+    },
+    {
+      type: "input",
+      itemType: "text",
+      prop: "contactName",
+      label: "客户联系人",
+      disabled: false,
+      itemWidth: 50,
+    },
+    {
+      type: "input",
+      itemType: "text",
+      prop: "contactInfo",
+      label: "客户联系方式",
+      disabled: false,
+      itemWidth: 50,
+    },
+    {
+      type: "input",
+      itemType: "textarea",
+      prop: "remark",
+      label: "售后说明",
+      required: true,
+      itemWidth: 50,
+    },
+  ];
+});
+
+const formDom = ref(null);
+
+const getList = (req) => {
+  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  loading.value = true;
+  proxy
+    .post("/sale/accountRunningWater/page", sourceList.value.pagination)
+    .then((res) => {
+      sourceList.value.data = res.rows;
+      sourceList.value.pagination.total = res.total;
+      setTimeout(() => {
+        loading.value = false;
+      }, 200);
+    });
+};
+
+const submitForm = () => {
+  formDom.value.handleSubmit(() => {
+    submitLoading.value = true;
+    proxy.post("/afterSalesRecord/add", formData.data).then(
+      (res) => {
+        ElMessage({
+          message: "操作成功",
+          type: "success",
+        });
+        dialogVisible.value = false;
+        submitLoading.value = false;
+        getList();
+      },
+      (err) => {
+        submitLoading.value = false;
+      }
+    );
+  });
+};
+
+const getDict = () => {
+  proxy
+    .get("/tenantUser/list", {
+      pageNum: 1,
+      pageSize: 10000,
+      companyId: proxy.useUserStore().user.companyId,
+    })
+    .then((res) => {
+      userList.value = res.rows.map((item) => {
+        return {
+          label: item.nickName,
+          value: item.userId,
+        };
+      });
+    });
+};
+getDict();
+getList();
+const clickAdd = (type) => {
+  formData.data = {
+    afterSalesPersonId: proxy.useUserStore().user.userId,
+    fileList: [],
+  };
+  dialogVisible.value = true;
+};
+
+const handleSelect = (row) => {
+  const flag = formData.followData.afterSalesMaterialsList.some(
+    (x) => x.productId === row.id
+  );
+  if (flag) {
+    return ElMessage({
+      message: "该物料已选择",
+      type: "info",
+    });
+  } else {
+    formData.followData.afterSalesMaterialsList.push({
+      productId: row.id,
+      productCode: row.code,
+      productName: row.name,
+      productSpec: row.spec,
+      quantity: null,
+    });
+    return ElMessage({
+      message: "选择成功",
+      type: "success",
+    });
+  }
+};
+
+const handleRemove = (index, type) => {
+  formData.followData.afterSalesMaterialsList.splice(index, 1);
+  return ElMessage({
+    message: "删除成功",
+    type: "success",
+  });
+};
+</script>
+  
+<style lang="scss" scoped>
+</style>