Ver código fonte

复制功能

cz 1 ano atrás
pai
commit
dd3f60be11

+ 807 - 0
src/components/contractCom/selectSample.vue

@@ -0,0 +1,807 @@
+<template>
+  <div class="tenant">
+    <byTable
+      :source="sourceList.data"
+      :pagination="sourceList.pagination"
+      :config="config"
+      :loading="loading"
+      :selectConfig="selectConfig"
+      highlight-current-row
+      :action-list="[]"
+      @get-list="getList"
+    >
+      <template #code="{ item }">
+        <div style="width: 100%">
+          <a
+            style="color: #409eff; cursor: pointer; word-break: break-all"
+            @click="openDetails(item)"
+            >{{ item.code }}</a
+          >
+        </div>
+      </template>
+
+      <template #amount="{ item }">
+        <div style="width: 100%">
+          <span style="padding-right: 4px">{{ item.currency }}</span>
+          <span>{{ moneyFormat(item.amount, 2) }}</span>
+        </div>
+      </template>
+      <template #buyCorporationName="{ item }">
+        <div style="width: 100%">
+          <a
+            style="color: #409eff; cursor: pointer"
+            @click="clickCorporationName(item)"
+            >{{ item.buyCorporationName }}</a
+          >
+        </div>
+      </template>
+      <template #tags="{ item }">
+        <div style="width: 100%">
+          <el-tag
+            style="margin-right: 8px"
+            type="success"
+            v-for="(tag, index) in item.tags"
+            closable
+            :key="index"
+            @close="tagClose(tag, item)"
+          >
+            {{ dictValueLabel(tag, customerTag) }}
+          </el-tag>
+          <template v-if="item.tags.length !== customerTag.length">
+            <el-select
+              v-if="item.addTagShow"
+              v-model="addTag"
+              style="width: 100%"
+              @change="
+                (val) => {
+                  return changeTag(val, item);
+                }
+              "
+            >
+              <el-option
+                v-for="tag in customerTag"
+                :key="tag.value"
+                :label="tag.label"
+                :value="tag.value"
+                :disabled="judgeTagSelect(item.tags, tag.value)"
+              />
+            </el-select>
+            <el-tag
+              style="cursor: pointer"
+              type="success"
+              @click="showSelect(item)"
+              v-else
+            >
+              +
+            </el-tag>
+          </template>
+        </div>
+      </template>
+      <template #advanceRatio="{ item }">
+        <div style="width: 100%">
+          <span>{{ item.advanceRatio }}%</span>
+        </div>
+      </template>
+      <template #scale="{ item }">
+        <div>
+          {{ computeScale(item) }}
+        </div>
+      </template>
+    </byTable>
+
+    <el-dialog
+      title="交接单"
+      v-if="openHandoverSlip"
+      v-model="openHandoverSlip"
+      width="600"
+    >
+      <byForm
+        :formConfig="formConfig"
+        :formOption="formOption"
+        v-model="handoverSlipForm"
+      >
+        <template #file>
+          <div style="width: 100%">
+            <el-upload
+              v-model:fileList="handoverSlipForm.fileList"
+              action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
+              :data="uploadData"
+              multiple
+              :before-upload="uploadFile"
+              :on-success="handleSuccess"
+              :on-preview="onPreviewFile"
+            >
+              <el-button type="primary" plain>选择</el-button>
+            </el-upload>
+          </div>
+        </template>
+        <template #indication>
+          <div style="width: 100%">
+            <el-upload
+              v-model:fileList="handoverSlipForm.packageFileList"
+              action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
+              :data="indicationUploadData"
+              multiple
+              :before-upload="indicationUploadFile"
+              :on-success="handleSuccess"
+              :on-preview="onPreviewFile"
+            >
+              <el-button type="primary" plain>选择</el-button>
+            </el-upload>
+          </div>
+        </template>
+      </byForm>
+      <template #footer>
+        <el-button @click="openHandoverSlip = false" size="large"
+          >关 闭</el-button
+        >
+        <el-button type="primary" @click="submitHandoverSlip()" size="large"
+          >确 定</el-button
+        >
+      </template>
+    </el-dialog>
+
+    <el-dialog
+      title="样品单详情"
+      v-if="openDetailsDialog"
+      v-model="openDetailsDialog"
+      width="1100"
+    >
+      <ContractDetailsOne
+        :sampleId="currentSampleId"
+        :code="currentCode"
+      ></ContractDetailsOne>
+    </el-dialog>
+
+    <el-dialog title="打印" v-if="openPrint" v-model="openPrint" width="920">
+      <!-- <SamplePDF :rowData="rowData"></SamplePDF> -->
+      <SamplePDFNew :rowData="rowData" ref="PdfDom"></SamplePDFNew>
+      <template #footer>
+        <el-button @click="openPrint = false" size="large">取消</el-button>
+        <el-button type="primary" v-print="printObj" size="large"
+          >打印</el-button
+        >
+        <el-button type="primary" @click="clickDownload()" size="large"
+          >下载PDF</el-button
+        >
+        <el-button type="primary" @click="exportExcel()" size="large"
+          >导出Excel</el-button
+        >
+      </template>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup>
+import { computed, ref } from "vue";
+import byTable from "@/components/byTable/index";
+import byForm from "@/components/byForm/index";
+import useUserStore from "@/store/modules/user";
+import { ElMessage, ElMessageBox } from "element-plus";
+import ContractDetailsOne from "@/components/contractCom/contractDetailsOne.vue";
+import SamplePDF from "@/components/PDF/samplePDF.vue";
+import SamplePDFNew from "@/components/PDF/samplePDFNew.vue";
+
+const route = useRoute();
+const { proxy } = getCurrentInstance();
+const accountCurrency = ref([]);
+const tradeMethods = ref([]);
+const corporationList = ref([]);
+const customerList = ref([]);
+const userList = ref([]);
+const shippingMethod = ref([]);
+const customerTag = ref([]);
+const openDetailsDialog = ref(false);
+
+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 sourceList = ref({
+  data: [],
+  pagination: {
+    total: 0,
+    pageNum: 1,
+    pageSize: 10,
+    keyword: "",
+    status: "",
+    sellCorporationId: "",
+  },
+});
+const loading = ref(false);
+const selectConfig = computed(() => {
+  return [
+    {
+      label: "审批状态",
+      prop: "status",
+      data: status.value,
+    },
+    {
+      label: "归属公司",
+      prop: "sellCorporationId",
+      data: corporationList.value,
+    },
+    {
+      label: "业务员",
+      prop: "userId",
+      data: userList.value,
+    },
+  ];
+});
+
+const config = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "样品单号",
+        slot: "code",
+        width: 180,
+      },
+    },
+    {
+      attrs: {
+        label: "归属公司",
+        prop: "sellCorporationId",
+        "min-width": 220,
+      },
+      render(type) {
+        return proxy.dictValueLabel(type, corporationList.value);
+      },
+    },
+    {
+      attrs: {
+        label: "业务员",
+        prop: "createUser",
+        width: 140,
+      },
+      render(type) {
+        return proxy.dictValueLabel(type, userList.value);
+      },
+    },
+    {
+      attrs: {
+        label: "下单时间",
+        prop: "createTime",
+        width: 160,
+      },
+    },
+    {
+      attrs: {
+        label: "客户名称",
+        slot: "buyCorporationName",
+        "min-width": 220,
+      },
+    },
+    {
+      attrs: {
+        label: "客户标签",
+        slot: "tags",
+        width: 180,
+      },
+    },
+    {
+      attrs: {
+        label: "预付比例",
+        slot: "advanceRatio",
+        width: 140,
+        align: "right",
+      },
+    },
+    {
+      attrs: {
+        label: "样品单金额",
+        slot: "amount",
+        width: 140,
+        align: "right",
+      },
+    },
+    {
+      attrs: {
+        label: "汇率",
+        prop: "rate",
+        width: 80,
+        align: "right",
+      },
+      render(rate) {
+        return proxy.moneyFormat(rate, 4);
+      },
+    },
+    {
+      attrs: {
+        label: "样品单金额(CNY)",
+        prop: "amountCNY",
+        width: 160,
+        align: "right",
+      },
+      render(amountCNY) {
+        return proxy.moneyFormat(amountCNY, 2);
+      },
+    },
+    {
+      attrs: {
+        label: "到账金额(CNY)",
+        prop: "sumClaimMoney",
+        width: 160,
+        align: "right",
+      },
+      render(sumClaimMoney) {
+        return proxy.moneyFormat(sumClaimMoney, 2);
+      },
+    },
+    {
+      attrs: {
+        label: "到账比例",
+        slot: "scale",
+        width: 100,
+        align: "right",
+      },
+    },
+    {
+      attrs: {
+        label: "审批状态",
+        prop: "status",
+        width: 140,
+      },
+      render(type) {
+        return proxy.dictValueLabel(type, status.value);
+      },
+    },
+    {
+      attrs: {
+        label: "操作",
+        width: 80,
+        align: "center",
+        fixed: "right",
+      },
+      renderHTML(row) {
+        return [
+          {
+            attrs: {
+              label: "选择",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              clickSelect(row);
+            },
+          },
+        ];
+      },
+    },
+  ];
+});
+const getDict = () => {
+  proxy
+    .getDictOne([
+      "customer_tag",
+      "trade_mode",
+      "account_currency",
+      "shipping_method",
+    ])
+    .then((res) => {
+      customerTag.value = res["customer_tag"].map((x) => ({
+        label: x.dictValue,
+        value: x.dictKey,
+      }));
+      tradeMethods.value = res["trade_mode"].map((x) => ({
+        label: x.dictValue,
+        value: x.dictKey,
+      }));
+      accountCurrency.value = res["account_currency"].map((x) => ({
+        label: x.dictValue,
+        value: x.dictKey,
+      }));
+      shippingMethod.value = res["shipping_method"].map((x) => ({
+        label: x.dictValue,
+        value: x.dictKey,
+      }));
+    });
+  proxy.post("/corporation/page", { pageNum: 1, pageSize: 999 }).then((res) => {
+    corporationList.value = res.rows.map((item) => {
+      return {
+        ...item,
+        label: item.name,
+        value: item.id,
+      };
+    });
+  });
+  proxy.post("/customer/page", { pageNum: 1, pageSize: 999 }).then((res) => {
+    customerList.value = res.rows.map((item) => {
+      return {
+        ...item,
+        label: item.name,
+        value: item.id,
+      };
+    });
+  });
+  proxy
+    .get("/tenantUser/list", {
+      pageNum: 1,
+      pageSize: 10000,
+      tenantId: useUserStore().user.tenantId,
+    })
+    .then((res) => {
+      userList.value = res.rows.map((item) => {
+        return {
+          label: item.nickName,
+          value: item.userId,
+        };
+      });
+    });
+};
+const getList = async (req) => {
+  sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
+  loading.value = true;
+  proxy.post("/sample/page", sourceList.value.pagination).then((res) => {
+    res.rows.forEach((x) => {
+      x.addTagShow = false;
+      if (x.tag) {
+        x.tags = x.tag.split(",");
+      } else {
+        x.tags = [];
+      }
+    });
+    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 newSample = () => {
+  proxy.$router.replace({
+    path: "/platform_manage/process/processApproval",
+    query: {
+      flowKey: "sample_flow",
+      flowName: "样品单审批流程",
+      random: proxy.random(),
+      tenantType: "EHSD",
+    },
+  });
+};
+const openHandoverSlip = ref(false);
+const handoverSlipForm = ref({
+  id: "",
+  code: "",
+  buyCorporationName: "",
+  fileList: [],
+  packageFileList: [],
+});
+const formOption = reactive({
+  inline: true,
+  labelWidth: 100,
+  itemWidth: 100,
+  rules: [],
+});
+const formConfig = computed(() => {
+  return [
+    {
+      type: "input",
+      prop: "code",
+      label: "样品单编号",
+      itemType: "text",
+      disabled: true,
+    },
+    {
+      type: "input",
+      prop: "buyCorporationName",
+      label: "客户名称",
+      itemType: "text",
+      disabled: true,
+    },
+    {
+      type: "slot",
+      slotName: "file",
+      label: "交接单",
+    },
+    {
+      type: "slot",
+      slotName: "indication",
+      label: "包装指示",
+    },
+  ];
+});
+const uploadData = ref({});
+const indicationUploadData = ref({});
+const clickHandoverSlip = (item) => {
+  handoverSlipForm.value.id = item.id;
+  handoverSlipForm.value.code = item.code;
+  handoverSlipForm.value.buyCorporationName = item.buyCorporationName;
+  if (item.fileInfoVos && item.fileInfoVos.length > 0) {
+    handoverSlipForm.value.fileList = item.fileInfoVos.map((item) => {
+      return {
+        raw: item,
+        name: item.fileName,
+        url: item.fileUrl,
+      };
+    });
+  } else {
+    handoverSlipForm.value.fileList = [];
+  }
+  if (item.packageFileInfoVOList && item.packageFileInfoVOList.length > 0) {
+    handoverSlipForm.value.packageFileList = item.packageFileInfoVOList.map(
+      (item) => {
+        return {
+          raw: item,
+          name: item.fileName,
+          url: item.fileUrl,
+        };
+      }
+    );
+  } else {
+    handoverSlipForm.value.packageFileList = [];
+  }
+  openHandoverSlip.value = true;
+};
+const uploadFile = async (file) => {
+  const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
+  uploadData.value = res.uploadBody;
+  file.id = res.id;
+  file.fileName = res.fileName;
+  file.fileUrl = res.fileUrl;
+  file.uploadState = true;
+  return true;
+};
+const indicationUploadFile = async (file) => {
+  const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
+  indicationUploadData.value = res.uploadBody;
+  file.id = res.id;
+  file.fileName = res.fileName;
+  file.fileUrl = res.fileUrl;
+  file.uploadState = true;
+  return true;
+};
+const handleSuccess = (any, UploadFile) => {
+  UploadFile.raw.uploadState = false;
+};
+const onPreviewFile = (file) => {
+  window.open(file.raw.fileUrl, "_blank");
+};
+const submitHandoverSlip = () => {
+  if (
+    handoverSlipForm.value.fileList &&
+    handoverSlipForm.value.fileList.length > 0
+  ) {
+    for (let i = 0; i < handoverSlipForm.value.fileList.length; i++) {
+      if (handoverSlipForm.value.fileList[i].raw.uploadState) {
+        return ElMessage("文件上传中,请稍后提交");
+      }
+    }
+  }
+  if (
+    handoverSlipForm.value.packageFileList &&
+    handoverSlipForm.value.packageFileList.length > 0
+  ) {
+    for (let i = 0; i < handoverSlipForm.value.packageFileList.length; i++) {
+      if (handoverSlipForm.value.packageFileList[i].raw.uploadState) {
+        return ElMessage("文件上传中,请稍后提交");
+      }
+    }
+  }
+  let data = proxy.deepClone(handoverSlipForm.value);
+  if (data.fileList && data.fileList.length > 0) {
+    data.fileList = data.fileList.map((item) => {
+      return {
+        id: item.raw.id,
+        fileName: item.raw.fileName,
+        fileUrl: item.raw.fileUrl,
+      };
+    });
+  } else {
+    data.fileList = [];
+  }
+  if (data.packageFileList && data.packageFileList.length > 0) {
+    data.packageFileList = data.packageFileList.map((item) => {
+      return {
+        id: item.raw.id,
+        fileName: item.raw.fileName,
+        fileUrl: item.raw.fileUrl,
+      };
+    });
+  } else {
+    data.packageFileList = [];
+  }
+  proxy.post("/sample/sampleHandover", data).then(() => {
+    ElMessage({
+      message: "操作成功!",
+      type: "success",
+    });
+    openHandoverSlip.value = false;
+    getList();
+  });
+};
+const addTag = ref("");
+const judgeTagSelect = (data, val) => {
+  if (data && data.length > 0) {
+    if (data.includes(val)) {
+      return true;
+    }
+  }
+  return false;
+};
+const changeTag = (val, item) => {
+  let data = {
+    id: item.buyCorporationId,
+    tag: proxy.deepClone(item.tags),
+  };
+  data.tag.push(val);
+  data.tag = data.tag.join(",");
+  proxy.post("/customer/editTag", data).then(() => {
+    ElMessage({
+      message: "添加成功",
+      type: "success",
+    });
+    item.addTagShow = false;
+    addTag.value = "";
+    getList();
+  });
+};
+const tagClose = (val, item) => {
+  let data = {
+    id: item.buyCorporationId,
+    tag: proxy.deepClone(item.tags),
+  };
+  data.tag = data.tag.filter((row) => row !== val);
+  if (data.tag && data.tag.length > 0) {
+    data.tag = data.tag.join(",");
+  } else {
+    data.tag = "";
+  }
+  proxy.post("/customer/editTag", data).then(() => {
+    ElMessage({
+      message: "删除成功",
+      type: "success",
+    });
+    item.addTagShow = false;
+    addTag.value = "";
+    getList();
+  });
+};
+
+const currentSampleId = ref("");
+const currentCode = ref("");
+const openDetails = (row) => {
+  // currentSampleId.value = row.id;
+  // currentCode.value = row.code;
+  // openDetailsDialog.value = true;
+
+  // 新页面打开方式
+  // const page = proxy.$router.resolve({
+  //   name: "sampleDetails",
+  //   query: {
+  //     currentSampleId: row.id,
+  //   },
+  // });
+  // window.open(page.href, "_blank");
+
+  proxy.$router.push({
+    name: "sampleDetails",
+    query: {
+      currentSampleId: row.id,
+    },
+  });
+};
+
+const showSelect = (item) => {
+  item.addTagShow = true;
+};
+
+const computeScale = (item) => {
+  let text = 0;
+  if (
+    item.sumClaimMoney &&
+    Number(item.sumClaimMoney) > 0 &&
+    item.amountCNY &&
+    Number(item.amountCNY) > 0
+  ) {
+    text = parseFloat(
+      (Number(item.sumClaimMoney) / Number(item.amountCNY)) * 100
+    ).toFixed(2);
+  }
+  return text + "%";
+};
+const clickCorporationName = (row) => {
+  proxy.$router.push({
+    name: "Portrait",
+    query: {
+      id: row.buyCorporationId,
+    },
+  });
+};
+
+const openPrint = ref(false);
+const rowData = ref({});
+const clickPrint = (row) => {
+  rowData.value = {
+    id: row.id,
+  };
+  openPrint.value = true;
+};
+
+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 clickDownload = () => {
+  proxy.getPdf("样品单PDF文件");
+};
+
+const clickAlteration = (row) => {
+  proxy.$router.push({
+    path: "/platform_manage/process/processApproval",
+    query: {
+      flowKey: "sample_update_flow",
+      flowName: "样品单变更流程",
+      random: proxy.random(),
+      businessId: row.id,
+    },
+  });
+};
+
+const PdfDom = ref(null);
+const exportExcel = () => {
+  PdfDom.value.exportExcel();
+};
+
+const clickSelect = (row) => {
+  proxy.$emit("select", row.id);
+};
+</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>

+ 262 - 113
src/components/process/EHSD/Contract.vue

@@ -14,9 +14,17 @@
             v-if="
               [30].includes(route.query.processType) || !route.query.processType
             "
-            @click="clickCopy"
+            @click="clickCopy(1)"
             >复制合同</el-button
           >
+          <el-button
+            type="primary"
+            v-if="
+              [30].includes(route.query.processType) || !route.query.processType
+            "
+            @click="clickCopy(2)"
+            >复制样品单</el-button
+          >
         </div>
       </template>
       <template #seller>
@@ -931,11 +939,18 @@
     <el-dialog
       v-if="copyContract"
       v-model="copyContract"
-      title="合同选择"
+      :title="copyType === 1 ? '合同选择' : '样品单选择'"
       width="90%"
       append-to-body
     >
-      <SelectContract @select="selectContract"></SelectContract>
+      <SelectContract
+        @select="selectContract"
+        v-if="copyType === 1"
+      ></SelectContract>
+      <SelectSample
+        @select="selectContract"
+        v-if="copyType === 2"
+      ></SelectSample>
     </el-dialog>
   </div>
 </template>
@@ -948,6 +963,7 @@ import { ElMessage } from "element-plus";
 import selectCity from "@/components/selectCity/index.vue";
 import { useRoute } from "vue-router";
 import SelectContract from "@/components/contractCom/selectContract.vue";
+import SelectSample from "@/components/contractCom/selectSample.vue";
 import useUserStore from "@/store/modules/user";
 import { nextTick, watch } from "vue";
 const userInfo = useUserStore();
@@ -970,6 +986,7 @@ const cityData = ref([]);
 const customerUserList = ref([]);
 const openProductCompany = ref(false);
 const openProductCustomer = ref(false);
+const copyType = ref(1);
 const copyContract = ref(false);
 const activeName = ref("1");
 const formData = reactive({
@@ -2040,133 +2057,265 @@ watch(
   }
 );
 
-const clickCopy = () => {
+const clickCopy = (type) => {
+  copyType.value = type;
   copyContract.value = true;
 };
 const selectContract = (businessId) => {
   if (businessId) {
-    proxy.post("/contract/detail", { id: businessId }).then((res) => {
-      // if (res && res.dataJson) {
-      //   res = { ...res, ...JSON.parse(res.dataJson) };
-      // }
-      if (res && res.buyCorporationName) {
+    if (copyType.value === 1) {
+      proxy.post("/contract/detail", { id: businessId }).then((res) => {
+        if (res && res.buyCorporationName) {
+          proxy
+            .post("/customer/selPage", { keyword: res.buyCorporationName })
+            .then((res) => {
+              customerList.value = res.rows.map((x) => ({
+                ...x,
+                label: x.name,
+                value: x.id,
+              }));
+            });
+        }
+        if (!res.fileList) {
+          res.fileList = [];
+        }
+        if (!res.packageFileList) {
+          res.packageFileList = [];
+        }
+        res.countryId = res.buyCountryId;
+        res.provinceId = res.buyProvinceId;
+        res.cityId = res.buyCityId;
+        for (const key in res) {
+          formData.data[key] = res[key];
+        }
+        delete formData.data.oldContractId;
+        delete formData.data.id;
+        delete formData.data.code;
         proxy
-          .post("/customer/selPage", { keyword: res.buyCorporationName })
-          .then((res) => {
-            customerList.value = res.rows.map((x) => ({
-              ...x,
-              label: x.name,
-              value: x.id,
-            }));
+          .post("/fileInfo/getList", {
+            businessIdList: [businessId],
+          })
+          .then((fileObj) => {
+            if (fileObj[businessId] && fileObj[businessId].length > 0) {
+              formData.data.fileList = fileObj[businessId]
+                .filter((x) => x.businessType === "1")
+                .map((x) => ({ raw: x, name: x.fileName, url: x.fileUrl }));
+              formData.data.packageFileList = fileObj[businessId]
+                .filter((x) => x.businessType === "2")
+                .map((x) => ({ raw: x, name: x.fileName, url: x.fileUrl }));
+            }
           });
-      }
-      if (!res.fileList) {
-        res.fileList = [];
-      }
-      if (!res.packageFileList) {
-        res.packageFileList = [];
-      }
-      res.countryId = res.buyCountryId;
-      res.provinceId = res.buyProvinceId;
-      res.cityId = res.buyCityId;
-      for (const key in res) {
-        formData.data[key] = res[key];
-      }
-      delete formData.data.oldContractId;
-      delete formData.data.id;
-      delete formData.data.code;
-      proxy
-        .post("/fileInfo/getList", {
-          businessIdList: [businessId],
-        })
-        .then((fileObj) => {
-          if (fileObj[businessId] && fileObj[businessId].length > 0) {
-            formData.data.fileList = fileObj[businessId]
-              .filter((x) => x.businessType === "1")
-              .map((x) => ({ raw: x, name: x.fileName, url: x.fileUrl }));
-            formData.data.packageFileList = fileObj[businessId]
-              .filter((x) => x.businessType === "2")
-              .map((x) => ({ raw: x, name: x.fileName, url: x.fileUrl }));
-          }
-        });
-      if (
-        formData.data.contractProductList &&
-        formData.data.contractProductList.length > 0
-      ) {
-        for (let i = 0; i < formData.data.contractProductList.length; i++) {
-          const e = formData.data.contractProductList[i];
-          delete e.id;
-          delete e.contractId;
-          if (e.ehsdJson) {
-            let obj = JSON.parse(e.ehsdJson);
-            e.packMethod = obj.packMethod;
-            e.tradeMethods = obj.tradeMethods;
+        if (
+          formData.data.contractProductList &&
+          formData.data.contractProductList.length > 0
+        ) {
+          for (let i = 0; i < formData.data.contractProductList.length; i++) {
+            const e = formData.data.contractProductList[i];
+            delete e.id;
+            delete e.contractId;
+            if (e.ehsdJson) {
+              let obj = JSON.parse(e.ehsdJson);
+              e.packMethod = obj.packMethod;
+              e.tradeMethods = obj.tradeMethods;
+            }
           }
-        }
-        formData.data.contractWaitShipmentList =
-          formData.data.contractProductList.map((x) => ({
-            productCode: x.productCode,
-            productId: x.productId,
-            productName: x.productName,
-            quantity: 0,
-            waitQuantity: "",
-          }));
-        changeWaitQuantity();
+          formData.data.contractWaitShipmentList =
+            formData.data.contractProductList.map((x) => ({
+              productCode: x.productCode,
+              productId: x.productId,
+              productName: x.productName,
+              quantity: 0,
+              waitQuantity: "",
+            }));
+          changeWaitQuantity();
 
-        let ids = formData.data.contractProductList.map((x) => x.productId);
+          let ids = formData.data.contractProductList.map((x) => x.productId);
+          proxy
+            .post("/fileInfo/getList", {
+              businessIdList: ids,
+            })
+            .then((fileObj) => {
+              for (
+                let i = 0;
+                i < formData.data.contractProductList.length;
+                i++
+              ) {
+                const e = formData.data.contractProductList[i];
+                for (const key in fileObj) {
+                  if (e.productId === key) {
+                    e.fileList = fileObj[key] || [];
+                    if (e.fileList && e.fileList.length > 0) {
+                      e.fileUrl = e.fileList[0].fileUrl;
+                    }
+                  }
+                }
+              }
+            });
+        }
+        if (
+          formData.data.contractProjectList &&
+          formData.data.contractProjectList.length > 0
+        ) {
+          formData.data.contractProjectList =
+            formData.data.contractProjectList.map((x) => {
+              delete x.id;
+              delete x.contractId;
+              return x;
+            });
+        }
+        if (
+          formData.data.contractShipmentList &&
+          formData.data.contractShipmentList.length > 0
+        ) {
+          formData.data.contractShipmentList =
+            formData.data.contractShipmentList.map((x) => {
+              delete x.id;
+              delete x.contractId;
+              return x;
+            });
+        }
+        if (formData.data.countryId) {
+          getCityData(formData.data.countryId, "20");
+        }
+        if (formData.data.provinceId) {
+          getCityData(formData.data.provinceId, "30");
+        }
+      });
+    } else if (copyType.value === 2) {
+      proxy.post("/sample/detail", { id: businessId }).then((res) => {
+        if (res && res.dataJson) {
+          res = { ...res, ...JSON.parse(res.dataJson) };
+        }
+        if (res && res.buyCorporationName) {
+          proxy
+            .post("/customer/selPage", { keyword: res.buyCorporationName })
+            .then((res) => {
+              customerList.value = res.rows.map((x) => ({
+                ...x,
+                label: x.name,
+                value: x.id,
+              }));
+            });
+        }
+        res.contractShipmentList = res.sampleShipmentLists;
+        res.contractProductList = res.sampleProductList;
+        res.contractProjectList = res.sampleProjectList;
+        delete res.sampleShipmentLists;
+        delete res.sampleProductList;
+        delete res.sampleProjectList;
+        res.countryId = res.buyCountryId;
+        res.provinceId = res.buyProvinceId;
+        res.cityId = res.buyCityId;
+        if (!res.fileList) {
+          res.fileList = [];
+        }
+        if (!res.packageFileList) {
+          res.packageFileList = [];
+        }
+        for (const key in res) {
+          formData.data[key] = res[key];
+        }
+        delete formData.data.oldSampleId;
+        delete formData.data.id;
+        delete formData.data.code;
         proxy
           .post("/fileInfo/getList", {
-            businessIdList: ids,
+            businessIdList: [businessId],
           })
           .then((fileObj) => {
-            for (let i = 0; i < formData.data.contractProductList.length; i++) {
-              const e = formData.data.contractProductList[i];
-              for (const key in fileObj) {
-                if (e.productId === key) {
-                  e.fileList = fileObj[key] || [];
-                  if (e.fileList && e.fileList.length > 0) {
-                    e.fileUrl = e.fileList[0].fileUrl;
+            if (fileObj[businessId] && fileObj[businessId].length > 0) {
+              formData.data.fileList = fileObj[businessId]
+                .filter((x) => x.businessType === "1")
+                .map((x) => ({ raw: x, name: x.fileName, url: x.fileUrl }));
+              formData.data.packageFileList = fileObj[businessId]
+                .filter((x) => x.businessType === "2")
+                .map((x) => ({ raw: x, name: x.fileName, url: x.fileUrl }));
+            }
+          });
+        if (
+          formData.data.contractProductList &&
+          formData.data.contractProductList.length > 0
+        ) {
+          for (let i = 0; i < formData.data.contractProductList.length; i++) {
+            const e = formData.data.contractProductList[i];
+            if (e.ehsdJson) {
+              let obj = JSON.parse(e.ehsdJson);
+              e.packMethod = obj.packMethod;
+              e.tradeMethods = obj.tradeMethods;
+            }
+          }
+
+          formData.data.contractWaitShipmentList =
+            formData.data.contractProductList.map((x) => ({
+              productCode: x.productCode,
+              productId: x.productId,
+              productName: x.productName,
+              quantity: 0,
+              waitQuantity: "",
+            }));
+          changeWaitQuantity();
+
+          let ids = formData.data.contractProductList.map((x) => x.productId);
+          proxy
+            .post("/fileInfo/getList", {
+              businessIdList: ids,
+            })
+            .then((fileObj) => {
+              for (
+                let i = 0;
+                i < formData.data.contractProductList.length;
+                i++
+              ) {
+                const e = formData.data.contractProductList[i];
+                for (const key in fileObj) {
+                  if (e.productId === key) {
+                    e.fileList = fileObj[key] || [];
+                    if (e.fileList && e.fileList.length > 0) {
+                      e.fileUrl = e.fileList[0].fileUrl;
+                    }
                   }
                 }
               }
-            }
-          });
-      }
-      if (
-        formData.data.contractProjectList &&
-        formData.data.contractProjectList.length > 0
-      ) {
-        formData.data.contractProjectList =
-          formData.data.contractProjectList.map((x) => {
-            delete x.id;
-            delete x.contractId;
-            return x;
-          });
-      }
-      if (
-        formData.data.contractShipmentList &&
-        formData.data.contractShipmentList.length > 0
-      ) {
-        formData.data.contractShipmentList =
-          formData.data.contractShipmentList.map((x) => {
-            delete x.id;
-            delete x.contractId;
-            return x;
-          });
-      }
-      if (formData.data.countryId) {
-        getCityData(formData.data.countryId, "20");
-      }
-      if (formData.data.provinceId) {
-        getCityData(formData.data.provinceId, "30");
-      }
+            });
+        }
+
+        if (
+          formData.data.contractProjectList &&
+          formData.data.contractProjectList.length > 0
+        ) {
+          formData.data.contractProjectList =
+            formData.data.contractProjectList.map((x) => {
+              delete x.id;
+              delete x.sampleId;
+              return x;
+            });
+        }
+        if (
+          formData.data.contractShipmentList &&
+          formData.data.contractShipmentList.length > 0
+        ) {
+          formData.data.contractShipmentList =
+            formData.data.contractShipmentList.map((x) => {
+              delete x.id;
+              delete x.sampleId;
+              return x;
+            });
+        }
+
+        if (formData.data.countryId) {
+          getCityData(formData.data.countryId, "20");
+        }
+        if (formData.data.provinceId) {
+          getCityData(formData.data.provinceId, "30");
+        }
+      });
+    }
+    copyContract.value = false;
+    ElMessage({
+      message: "选择成功!",
+      type: "success",
     });
   }
-  copyContract.value = false;
-  ElMessage({
-    message: "选择成功!",
-    type: "success",
-  });
 };
 
 const selectShipmentData = ref([]);

+ 166 - 0
src/components/process/EHSD/Sample.vue

@@ -7,6 +7,18 @@
       :rules="rules"
       ref="submit"
     >
+      <template #btn>
+        <div>
+          <el-button
+            type="primary"
+            v-if="
+              [30].includes(route.query.processType) || !route.query.processType
+            "
+            @click="clickCopy"
+            >复制样品单</el-button
+          >
+        </div>
+      </template>
       <template #seller>
         <div style="width: 100%">
           <el-form-item prop="sellCorporationId">
@@ -911,6 +923,16 @@
         @selectProduct="selectProduct"
       ></CustomerProduct>
     </el-dialog>
+
+    <el-dialog
+      v-if="copyContract"
+      v-model="copyContract"
+      title="样品单选择"
+      width="90%"
+      append-to-body
+    >
+      <SelectSample @select="selectSample"></SelectSample>
+    </el-dialog>
   </div>
 </template>
 
@@ -918,6 +940,8 @@
 import byForm from "@/components/byForm/index";
 import CompanyProduct from "@/views/EHSD/productLibrary/companyProduct/index";
 import CustomerProduct from "@/views/EHSD/productLibrary/customerProduct/index";
+import SelectSample from "@/components/contractCom/selectSample.vue";
+
 import { ElMessage } from "element-plus";
 import selectCity from "@/components/selectCity/index.vue";
 import { useRoute } from "vue-router";
@@ -942,6 +966,7 @@ const cityData = ref([]);
 const customerUserList = ref([]);
 const openProductCompany = ref(false);
 const openProductCustomer = ref(false);
+const copyContract = ref(false);
 const activeName = ref("1");
 const formData = reactive({
   data: {
@@ -983,6 +1008,12 @@ const indicationUploadData = ref({});
 const formConfig = computed(() => {
   return [
     {
+      type: "slot",
+      slotName: "btn",
+      label: "",
+      itemWidth: 50,
+    },
+    {
       type: "title",
       title: "合同模板",
       label: "",
@@ -1987,6 +2018,141 @@ const objectSpanMethod = ({ rowIndex, columnIndex }) => {
     };
   }
 };
+
+const clickCopy = () => {
+  copyContract.value = true;
+};
+const selectSample = (businessId) => {
+  if (businessId) {
+    proxy.post("/sample/detail", { id: businessId }).then((res) => {
+      if (res && res.dataJson) {
+        res = { ...res, ...JSON.parse(res.dataJson) };
+      }
+
+      if (res && res.buyCorporationName) {
+        proxy
+          .post("/customer/selPage", { keyword: res.buyCorporationName })
+          .then((res) => {
+            customerList.value = res.rows.map((x) => ({
+              ...x,
+              label: x.name,
+              value: x.id,
+            }));
+          });
+      }
+      res.sampleShipmentList = res.sampleShipmentLists;
+      res.countryId = res.buyCountryId;
+      res.provinceId = res.buyProvinceId;
+      res.cityId = res.buyCityId;
+      if (!res.fileList) {
+        res.fileList = [];
+      }
+      if (!res.packageFileList) {
+        res.packageFileList = [];
+      }
+      for (const key in res) {
+        formData.data[key] = res[key];
+      }
+      delete formData.data.oldSampleId;
+      delete formData.data.id;
+      delete formData.data.code;
+      proxy
+        .post("/fileInfo/getList", {
+          businessIdList: [businessId],
+        })
+        .then((fileObj) => {
+          if (fileObj[businessId] && fileObj[businessId].length > 0) {
+            formData.data.fileList = fileObj[businessId]
+              .filter((x) => x.businessType === "1")
+              .map((x) => ({ raw: x, name: x.fileName, url: x.fileUrl }));
+            formData.data.packageFileList = fileObj[businessId]
+              .filter((x) => x.businessType === "2")
+              .map((x) => ({ raw: x, name: x.fileName, url: x.fileUrl }));
+          }
+        });
+      if (
+        formData.data.sampleProductList &&
+        formData.data.sampleProductList.length > 0
+      ) {
+        for (let i = 0; i < formData.data.sampleProductList.length; i++) {
+          const e = formData.data.sampleProductList[i];
+          if (e.ehsdJson) {
+            let obj = JSON.parse(e.ehsdJson);
+            e.packMethod = obj.packMethod;
+            e.tradeMethods = obj.tradeMethods;
+          }
+        }
+
+        formData.data.sampleWaitShipmentList =
+          formData.data.sampleProductList.map((x) => ({
+            productCode: x.productCode,
+            productId: x.productId,
+            productName: x.productName,
+            quantity: 0,
+            waitQuantity: "",
+          }));
+        changeWaitQuantity();
+
+        let ids = formData.data.sampleProductList.map((x) => x.productId);
+        proxy
+          .post("/fileInfo/getList", {
+            businessIdList: ids,
+          })
+          .then((fileObj) => {
+            for (let i = 0; i < formData.data.sampleProductList.length; i++) {
+              const e = formData.data.sampleProductList[i];
+              for (const key in fileObj) {
+                if (e.productId === key) {
+                  e.fileList = fileObj[key] || [];
+
+                  if (e.fileList && e.fileList.length > 0) {
+                    e.fileUrl = e.fileList[0].fileUrl;
+                  }
+                }
+              }
+            }
+          });
+      }
+
+      if (
+        formData.data.sampleProjectList &&
+        formData.data.sampleProjectList.length > 0
+      ) {
+        formData.data.sampleProjectList = formData.data.sampleProjectList.map(
+          (x) => {
+            delete x.id;
+            delete x.sampleId;
+            return x;
+          }
+        );
+      }
+      if (
+        formData.data.sampleShipmentList &&
+        formData.data.sampleShipmentList.length > 0
+      ) {
+        formData.data.sampleShipmentList = formData.data.sampleShipmentList.map(
+          (x) => {
+            delete x.id;
+            delete x.sampleId;
+            return x;
+          }
+        );
+      }
+
+      if (formData.data.countryId) {
+        getCityData(formData.data.countryId, "20");
+      }
+      if (formData.data.provinceId) {
+        getCityData(formData.data.provinceId, "30");
+      }
+    });
+    copyContract.value = false;
+    ElMessage({
+      message: "选择成功!",
+      type: "success",
+    });
+  }
+};
 </script>
 
 <style lang="scss" scoped>

+ 4 - 2
src/views/EHSD/saleContract/exportTracking/index.vue

@@ -162,7 +162,7 @@
               align-items: center;
             "
             @click="handleClickHeader(documentary.value)"
-            ><span>({{ headerData[documentary.value] }})</span>
+            ><span>({{ headerData[documentary.value] || 0 }})</span>
             <span
               v-if="documentary.value == currentHeader && clickNum == 1"
               class="iconfont icon-iconm_shanchu"
@@ -783,6 +783,7 @@ const getDict = () => {
 const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
   loading.value = true;
+  getHeaderData();
   proxy
     .post("/contract/exportCopy/page", sourceList.value.pagination)
     .then((res) => {
@@ -908,7 +909,7 @@ const getHeaderData = () => {
 };
 getDict();
 getList();
-getHeaderData();
+
 const formData = reactive({
   remarksFormData: {},
   recordsFormData: {},
@@ -1170,6 +1171,7 @@ const submitRecords = () => {
         });
         getRecordsData();
         getList();
+
         formLoading.value = false;
         openAddRecords.value = false;
       });

+ 1 - 1
src/views/finance/fundManage/accountPayment/index.vue

@@ -17,7 +17,7 @@
       >
         <template #amount="{ item }">
           <div style="width: 100%">
-            <span>{{ item.currency }} {{ item.amount }}</span>
+            <span>{{ item.currency }} {{ item.incomeAmount }}</span>
           </div>
         </template>
         <template #file="{ item }">