1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096 |
- <template>
- <div class="tenant">
- <!-- <Banner /> -->
- <div class="content">
- <byTable
- :source="sourceList.data"
- :pagination="sourceList.pagination"
- :config="config"
- :loading="loading"
- highlight-current-row
- :selectConfig="selectConfig"
- :table-events="{
- //element talbe事件都能传
- select: selectRow,
- }"
- :action-list="[
- {
- text: '合并付款',
- disabled: selectData.length === 0,
- action: () => handlePayment(20),
- },
- ]"
- @get-list="getList"
- >
- <!-- {
- text: '导出Excel',
- disabled: false,
- action: () => deriveExcel(),
- }, -->
- <template #contractCode="{ item }">
- <div
- style="cursor: pointer; color: #409eff"
- @click="handleClickContractCode(item)"
- >
- {{ item.contractCode }}
- </div>
- </template>
- <template #arrivalStatus="{ item }">
- <div
- style="cursor: pointer; color: #409eff"
- @click="handleClickArrivalStatus(item)"
- >
- {{ dictValueLabel(item.arrivalStatus, arrivalStatus) }}
- </div>
- </template>
- <template #payStatus="{ item }">
- <div
- style="cursor: pointer; color: #409eff"
- @click="handleClickPayStatus(item)"
- >
- {{ dictValueLabel(item.payStatus, paymentStatus) }}
- </div>
- </template>
- <template #btn="{ item }">
- <div>
- <el-button
- type="primary"
- v-if="item.payStatus != 0"
- link
- @click="handleRefund(item)"
- >退款</el-button
- >
- <el-button
- type="primary"
- link
- v-if="item.payStatus != 30"
- @click="handlePayment(10, item)"
- >付款</el-button
- >
- <el-button
- type="primary"
- link
- v-if="item.payStatus != 30"
- @click="handleEnd(item)"
- >结束</el-button
- >
- <el-button type="primary" link @click="handleClear(item)"
- >清空</el-button
- >
- </div>
- </template>
- </byTable>
- </div>
- <el-dialog
- :title="'付款'"
- v-model="dialogVisible"
- width="80%"
- v-loading="submitLoading"
- destroy-on-close
- :before-close="handleClose"
- >
- <byForm
- :formConfig="formConfig"
- :formOption="formOption"
- v-model="formData.data"
- :rules="rules"
- ref="byform"
- >
- <template #details>
- <div style="width: 100%">
- <el-table
- :data="formData.data.purchasePayRecordDetailList"
- show-summary
- :summary-method="getSummaries"
- >
- <el-table-column prop="code" label="采购单号" />
- <el-table-column
- prop="isAgreement"
- label="是否合同"
- :formatter="(row) => (row.isAgreement == 1 ? '是' : '否')"
- />
- <el-table-column
- prop="paymentMethod"
- label="付款方式"
- :formatter="
- (row) => dictValueLabel(row.paymentMethod, fundsPaymentMethod)
- "
- />
- <el-table-column prop="remark" label="采购备注" />
- <el-table-column prop="waitAmount" label="采购金额" />
- <el-table-column prop="alreadyAmount" label="已付款金额" />
- <el-table-column prop="amount" label="付款金额" min-width="150">
- <template #default="{ row, $index }">
- <el-form-item
- :prop="'purchasePayRecordDetailList.' + $index + '.amount'"
- :rules="rules.amount"
- :inline-message="true"
- >
- <el-input-number
- v-model="row.amount"
- :precision="4"
- :controls="false"
- :min="0"
- onmousewheel="return false;"
- @change="handleChangeAmount"
- />
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column prop="remark" label="备注" min-width="150">
- <template #default="{ row, $index }">
- <el-form-item
- :prop="'purchasePayRecordDetailList.' + $index + '.remark'"
- :rules="rules.remark"
- :inline-message="true"
- >
- <el-input
- v-model="row.remark"
- placeholder="请输入"
- type="textarea"
- />
- </el-form-item>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </template>
- <template #file>
- <div style="width: 100%">
- <el-upload
- v-model:fileList="formData.data.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>
- </byForm>
- <template #footer>
- <el-button @click="handleClose" size="large">取 消</el-button>
- <el-button
- v-if="modalType == 'add'"
- type="primary"
- @click="submitForm('byform')"
- size="large"
- :loading="submitLoading"
- >
- 确 定
- </el-button>
- </template>
- </el-dialog>
- <el-dialog
- :title="'退款'"
- v-model="dialogVisibleTwo"
- width="800"
- v-loading="submitLoading"
- destroy-on-close
- >
- <byForm
- :formConfig="formConfigOne"
- :formOption="formOption"
- v-model="formData.dataOne"
- :rules="rulesOne"
- ref="byformOne"
- >
- </byForm>
- <template #footer>
- <el-button @click="dialogVisibleTwo = false" size="large"
- >取 消</el-button
- >
- <el-button
- v-if="modalType == 'add'"
- type="primary"
- @click="submitFormOne()"
- size="large"
- :loading="submitLoading"
- >
- 确 定
- </el-button>
- </template>
- </el-dialog>
- <el-dialog
- v-model="dialogVisibleOne"
- title="交易记录"
- width="500"
- append-to-body
- destroy-on-close
- >
- <div>
- <el-timeline :reverse="false">
- <el-timeline-item
- placement="top"
- v-for="(activity, index) in activities"
- :key="index"
- >
- <div
- style="
- display: flex;
- justify-content: space-between;
- align-items: center;
- "
- >
- <div style="color: #909399">
- {{ activity.payUserName }}
- </div>
- <el-button type="primary" plain @click="handleGetDtl(activity)"
- >查看详情</el-button
- >
- </div>
- <div v-if="activity.type == '1'">
- <div style="margin-top: 5px">
- 类型: <span style="color: #8fe3a1">付款 </span>
- </div>
- <div style="margin-top: 5px">
- 付款账号:
- {{ dictValueLabel(activity.payAccount, accountData) }}
- </div>
- <div style="margin-top: 5px">
- 付款金额:{{ moneyFormat(activity.amount, 2) }}
- </div>
- <div style="margin-top: 5px">
- 付款时间: {{ activity.payDate }}
- </div>
- <div style="margin-top: 5px">
- 付款备注: {{ activity.remark }}
- </div>
- </div>
- <div v-if="activity.type == '2'">
- <div style="margin-top: 5px">
- 类型: <span style="color: #fc0000">退款</span>
- </div>
- <div style="margin-top: 5px">
- 退款账号:
- {{ dictValueLabel(activity.payAccount, accountData) }}
- </div>
- <div style="margin-top: 5px">
- 退款金额:{{ moneyFormat(activity.amount, 2) }}
- </div>
- <div style="margin-top: 5px">
- 退款时间: {{ activity.payDate }}
- </div>
- <div style="margin-top: 5px">
- 退款备注: {{ activity.remark }}
- </div>
- </div>
- <div
- style="width: 100%; margin-top: 5px"
- v-if="activity.fileList && activity.fileList.length > 0"
- >
- <div v-for="(item, index) in activity.fileList" :key="index">
- <div
- style="cursor: pointer; color: #409eff"
- @click="openFile(item)"
- >
- {{ item.fileName }}
- </div>
- </div>
- </div>
- </el-timeline-item>
- </el-timeline>
- </div>
- <template #footer>
- <el-button @click="dialogVisibleOne = false">关闭</el-button>
- </template>
- </el-dialog>
- <el-dialog
- :title="'到货详情'"
- v-model="dialogVisibleThree"
- width="80%"
- destroy-on-close
- >
- <ArrivalDetails
- :purchaseRow="currnetPurchaseRow"
- @handleClickStatus="handleClickStatus"
- ></ArrivalDetails>
- <template #footer>
- <el-button @click="dialogVisibleThree = false" size="large"
- >取 消</el-button
- >
- </template>
- </el-dialog>
- </div>
- </template>
-
- <script setup>
- import { ElMessage, ElMessageBox } from "element-plus";
- import byTable from "@/components/byTable/index";
- import byForm from "@/components/byForm/index";
- import ArrivalDetails from "@/views/WDLY/purchaseManage/com/ArrivalDetails.vue";
- const uploadData = ref({});
- const loading = ref(false);
- const submitLoading = ref(false);
- const sourceList = ref({
- data: [],
- pagination: {
- total: 3,
- pageNum: 1,
- pageSize: 10,
- type: "",
- keyword: "",
- purchaseStatus: "30,99",
- },
- });
- let dialogVisible = ref(false);
- let dialogVisibleOne = ref(false);
- let activities = ref([]);
- let modalType = ref("add");
- let rules = ref({
- amount: [{ required: true, message: "请输入付款金额", trigger: "blur" }],
- payDate: [{ required: true, message: "请选择付款时间", trigger: "change" }],
- payAccount: [
- { required: true, message: "请选择付款账号", trigger: "change" },
- ],
- });
- let rulesOne = ref({
- amount: [{ required: true, message: "请输入退款金额", trigger: "blur" }],
- refundDate: [
- { required: true, message: "请选择退款时间", trigger: "change" },
- ],
- refundAccount: [
- { required: true, message: "请选择退款账号", trigger: "change" },
- ],
- // remark: [{ required: true, message: "请输入备注", trigger: "blur" }],
- });
- const { proxy } = getCurrentInstance();
- const arrivalStatus = ref([
- {
- label: "未到货",
- value: "0",
- },
- {
- label: "部分到货",
- value: "10",
- },
- {
- label: "已到货",
- value: "20",
- },
- ]);
- const paymentStatus = ref([
- {
- label: "未付款",
- value: "0",
- },
- {
- label: "部分付款",
- value: "10",
- },
- {
- label: "已付款",
- value: "20",
- },
- {
- label: "付款结束",
- value: "30",
- },
- ]);
- const alreadyPurchase = ref([]);
- const deptData = ref([]);
- const selectConfig = computed(() => [
- {
- label: "到货状态",
- prop: "arrivalStatus",
- data: arrivalStatus.value,
- },
- {
- label: "付款状态",
- prop: "payStatus",
- data: paymentStatus.value,
- },
- {
- label: "采购人",
- prop: "purchaseUserId",
- data: alreadyPurchase.value,
- },
- {
- label: "项目组",
- prop: "deptId",
- data: deptData.value,
- },
- ]);
- const config = computed(() => {
- return [
- {
- type: "selection",
- attrs: {
- checkAtt: "isCheck",
- },
- },
- {
- attrs: {
- label: "采购单号",
- slot: "contractCode",
- },
- },
- {
- attrs: {
- label: "供应商",
- prop: "supplyName",
- },
- },
- {
- attrs: {
- label: "收货仓库",
- prop: "receiptWarehouseName",
- },
- },
- {
- attrs: {
- label: "项目组",
- prop: "deptName",
- width: 150,
- },
- },
- {
- attrs: {
- label: "采购金额",
- prop: "amount",
- width: 100,
- },
- render(amount) {
- return proxy.moneyFormat(amount, 2);
- },
- },
- {
- attrs: {
- label: "已付款金额",
- prop: "paidAmount",
- width: 100,
- },
- render(paidAmount) {
- return proxy.moneyFormat(paidAmount, 2);
- },
- },
- {
- attrs: {
- label: "退款金额",
- prop: "refundAmount",
- width: 100,
- },
- render(refundAmount) {
- return proxy.moneyFormat(refundAmount, 2);
- },
- },
- {
- attrs: {
- label: "采购人",
- prop: "purchaseName",
- width: 150,
- },
- },
- {
- attrs: {
- label: "采购时间",
- prop: "createTime",
- width: 155,
- },
- },
- {
- attrs: {
- label: "到货状态",
- slot: "arrivalStatus",
- width: 100,
- },
- // render(status) {
- // return proxy.dictValueLabel(status, arrivalStatus.value);
- // },
- },
- {
- attrs: {
- label: "付款状态",
- slot: "payStatus",
- width: 100,
- },
- },
- {
- attrs: {
- label: "操作",
- slot: "btn",
- width: "200",
- align: "center",
- fixed: "right",
- },
- },
- ];
- });
- let formData = reactive({
- data: {
- type: "1",
- },
- dataOne: {},
- dataTwo: {},
- });
- const formOption = reactive({
- disabled: false,
- inline: true,
- labelWidth: 100,
- itemWidth: 100,
- rules: [],
- });
- const byform = ref(null);
- let formConfig = computed(() => [
- {
- type: "input",
- prop: "supplyName",
- label: "供应商",
- disabled: true,
- },
- {
- type: "date",
- itemType: "datetime",
- prop: "payDate",
- label: "付款时间",
- format: "YYYY-MM-DD HH:mm:ss",
- itemWidth: 35,
- },
- {
- type: "select",
- prop: "payAccount",
- label: "付款账号",
- data: accountData.value,
- itemWidth: 50,
- },
- {
- type: "number",
- prop: "amount",
- label: "付款金额",
- precision: 4,
- min: 0,
- controls: false,
- disabled: true,
- },
- {
- type: "input",
- itemType: "textarea",
- prop: "remark",
- label: "备注",
- disabled: false,
- },
- {
- type: "slot",
- slotName: "file",
- label: "附件",
- },
- {
- type: "title",
- title: "付款明细",
- },
- {
- type: "slot",
- slotName: "details",
- label: "",
- },
- ]);
- const dialogVisibleTwo = ref(false);
- const dialogVisibleThree = ref(false);
- const byformOne = ref(null);
- let formConfigOne = computed(() => [
- {
- type: "input",
- prop: "supplyName",
- label: "供应商",
- disabled: true,
- },
- {
- type: "input",
- prop: "contractCode",
- label: "采购单号",
- disabled: true,
- itemWidth: 34,
- },
- {
- type: "date",
- itemType: "datetime",
- prop: "refundDate",
- label: "退款时间",
- format: "YYYY-MM-DD HH:mm:ss",
- itemWidth: 100,
- },
- {
- type: "select",
- prop: "refundAccount",
- label: "退款账号",
- data: accountData.value,
- itemWidth: 100,
- },
- {
- type: "number",
- prop: "amount",
- label: "退款金额",
- precision: 4,
- min: 1,
- controls: false,
- // disabled: true,
- },
- {
- type: "input",
- itemType: "textarea",
- prop: "remark",
- label: "备注",
- disabled: false,
- },
- ]);
- const getList = async (req) => {
- sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
- loading.value = true;
- proxy
- .post("/purchase/pageByWdly", sourceList.value.pagination)
- .then((res) => {
- sourceList.value.data = res.rows.map((x) => ({
- ...x,
- ...JSON.parse(x.victoriatouristJson),
- isCheck: true,
- }));
- sourceList.value.pagination.total = res.total;
- setTimeout(() => {
- loading.value = false;
- }, 200);
- });
- };
- const submitForm = () => {
- byform.value.handleSubmit((valid) => {
- const list = formData.data.purchasePayRecordDetailList;
- for (let i = 0; i < list.length; i++) {
- const e = list[i];
- if (Number(e.amount) + Number(e.alreadyAmount) > Number(e.waitAmount)) {
- return ElMessage({
- message: `本次付款加已付款金额不可大于采购金额`,
- type: "info",
- });
- }
- }
- // const total = list.reduce((total, x) => (total += Number(x.amount)), 0);
- // if (Number(formData.data.amount) != total) {
- // return ElMessage({
- // message: "本次付款合计必须等于上方的付款金额",
- // type: "info",
- // });
- // }
- formData.data.fileList = formData.data.fileList.map((item) => {
- return {
- id: item.raw.id,
- fileName: item.raw.fileName,
- fileUrl: item.raw.fileUrl,
- uploadState: item.raw.uploadState,
- };
- });
- proxy.post("/purchasePayRecord/add", formData.data).then(
- (res) => {
- ElMessage({
- message: "操作成功",
- type: "success",
- });
- handleClose();
- submitLoading.value = false;
- getList();
- },
- (err) => {
- submitLoading.value = false;
- }
- );
- });
- };
- const submitFormOne = () => {
- byformOne.value.handleSubmit((valid) => {
- submitLoading.value = true;
- proxy.post("/purchaseRefundRecord/add", formData.dataOne).then(
- (res) => {
- ElMessage({
- message: "操作成功",
- type: "success",
- });
- dialogVisibleTwo.value = false;
- submitLoading.value = false;
- getList();
- },
- (err) => {
- submitLoading.value = false;
- }
- );
- });
- };
- const selectData = ref([]);
- const selectRow = (data) => {
- if (data && data.length > 0) {
- selectData.value = data.map((x) => {
- if (x.victoriatouristJson) {
- let obj = JSON.parse(x.victoriatouristJson);
- if (obj.isAgreement) {
- x.isAgreement = obj.isAgreement;
- }
- if (obj.paymentMethod) {
- x.paymentMethod = obj.paymentMethod;
- }
- }
- return x;
- });
- } else {
- selectData.value = [];
- }
- };
- const handleClose = () => {
- selectData.value = [];
- dialogVisible.value = false;
- };
- watch(selectData, (newVal, oldVal) => {
- if (newVal.length == 0) {
- sourceList.value.data.forEach((x) => {
- x.isCheck = true;
- });
- } else if (newVal.length == 1) {
- const current = newVal[0];
- sourceList.value.data.forEach((x) => {
- if (x.supplyId !== current.supplyId) {
- x.isCheck = false;
- }
- });
- }
- });
- const handlePayment = (type, data) => {
- modalType.value = "add";
- formOption.disabled = false;
- if (type === 10) {
- selectData.value = [data];
- } else if (type === 20) {
- }
- formData.data = {
- type: "1",
- supplyName: selectData.value[0].supplyName,
- amount: "",
- payDate: "",
- purchasePayRecordDetailList: selectData.value.map((x) => ({
- purchaseId: x.id,
- code: x.contractCode,
- waitAmount: x.amount,
- alreadyAmount: x.paidAmount,
- amount: null,
- remark: "",
- isAgreement: x.isAgreement,
- paymentMethod: x.paymentMethod,
- remark: x.remark,
- })),
- fileList: [],
- };
- dialogVisible.value = true;
- };
- const handleRefund = (row) => {
- formOption.disabled = false;
- formData.dataOne = {
- type: "2",
- purchaseId: row.id,
- supplyName: row.supplyName,
- contractCode: row.contractCode,
- amount: "",
- refundDate: "",
- remark: "",
- };
- dialogVisibleTwo.value = true;
- };
- const currentRow = ref({});
- const handleClickPayStatus = (row) => {
- currentRow.value = row;
- proxy
- .post("/purchasePayRecordDetail/page", { purchaseId: row.id })
- .then((res) => {
- if (res && res.rows && res.rows.length > 0) {
- activities.value = res.rows;
- const idList = activities.value.map((x) => x.purchasePayRecordId);
- // 请求文件数据并回显
- if (idList.length > 0) {
- proxy
- .post("/fileInfo/getList", {
- businessIdList: idList,
- })
- .then((fileObj) => {
- if (fileObj) {
- for (let i = 0; i < activities.value.length; i++) {
- const e = activities.value[i];
- for (const key in fileObj) {
- if (e.purchasePayRecordId === key) {
- e.fileList = fileObj[key];
- }
- }
- }
- }
- });
- }
- dialogVisibleOne.value = true;
- } else {
- return ElMessage({
- message: `暂无付款记录`,
- type: "info",
- });
- }
- });
- };
- const handleEnd = (row) => {
- // 弹窗提示是否删除
- ElMessageBox.confirm("是否确认结束?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- // 删除
- proxy
- .post("/purchase/edit", {
- ...row,
- payStatus: 30,
- })
- .then((res) => {
- ElMessage({
- message: "操作成功",
- type: "success",
- });
- getList();
- });
- });
- };
- const handleClear = (row) => {
- // 弹窗提示是否删除
- ElMessageBox.confirm("是否确认清空付款记录?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- // 删除
- proxy
- .post("/purchasePayRecordDetail/empty", {
- purchaseId: row.id,
- })
- .then((res) => {
- ElMessage({
- message: "操作成功",
- type: "success",
- });
- getList();
- });
- });
- };
- const handleChangeAmount = () => {
- let amount = 0;
- for (let i = 0; i < formData.data.purchasePayRecordDetailList.length; i++) {
- const e = formData.data.purchasePayRecordDetailList[i];
- amount += e.amount;
- }
- formData.data.amount = parseFloat(amount).toFixed(4);
- };
- const accountData = ref([]);
- const fundsPaymentMethod = ref([]);
- const getDict = () => {
- proxy.get("/purchase/getPurchaseUserList").then((res) => {
- alreadyPurchase.value = res.data.map((x) => ({
- label: x.nickName,
- value: x.userId,
- }));
- });
- proxy.get("/purchase/getDepts").then((res) => {
- deptData.value = res.data.map((x) => ({
- ...x,
- label: x.deptName,
- value: x.deptId,
- }));
- });
- proxy
- .getDictOne(["purchase_payment_account", "funds_payment_method"])
- .then((res) => {
- accountData.value = res["purchase_payment_account"].map((x) => ({
- label: x.dictValue,
- value: x.dictKey,
- }));
- fundsPaymentMethod.value = res["funds_payment_method"].map((x) => ({
- label: x.dictValue,
- value: x.dictKey,
- }));
- });
- };
- const handleClickContractCode = (row) => {
- proxy.$router.push({
- path: "/platform_manage/process/processApproval",
- query: {
- flowKey: row.processInstanceId,
- id: row.flowId,
- businessId: row.id,
- processType: 20,
- },
- });
- };
- getList();
- getDict();
- // 上传文件
- 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 handleSuccess = (any, UploadFile) => {
- UploadFile.raw.uploadState = false;
- };
- const onPreviewFile = (file) => {
- window.open(file.raw.fileUrl, "_blank");
- };
- const openFile = (item) => {
- window.open(item.fileUrl, "_blank");
- };
- const handleGetDtl = (row) => {
- if (row.type == "1") {
- modalType.value = "edit";
- formOption.disabled = true;
- dialogVisible.value = true;
- proxy
- .post("/purchasePayRecord/detail", {
- id: row.purchasePayRecordId,
- })
- .then((res) => {
- res.supplyName = currentRow.value.supplyName;
- formData.data = res;
- formData.data.purchasePayRecordDetailList =
- formData.data.purchasePayRecordDetailList.map((x) => ({
- ...x,
- code: x.contractCode,
- waitAmount: x.purchaseAmount,
- alreadyAmount: x.paidAmount,
- }));
- proxy
- .post("/fileInfo/getList", {
- businessIdList: [res.id],
- })
- .then((fileObj) => {
- if (fileObj[res.id] && fileObj[res.id].length > 0) {
- formData.data.fileList = fileObj[res.id].map((x) => ({
- raw: x,
- name: x.fileName,
- url: x.fileUrl,
- }));
- }
- });
- });
- } else {
- modalType.value = "edit";
- formOption.disabled = true;
- dialogVisibleTwo.value = true;
- proxy
- .post("/purchaseRefundRecord/detail", {
- id: row.id,
- })
- .then((res) => {
- res.supplyName = currentRow.value.supplyName;
- formData.dataOne = res;
- });
- }
- };
- const deriveExcel = () => {
- ElMessage({
- message: "请稍后",
- type: "success",
- });
- proxy
- .postTwo("/purchase/purchasePayExcelExport", sourceList.value.pagination)
- .then(
- (res) => {
- exportData(res, "采购付款.xlsx");
- },
- (err) => {
- return ElMessage({
- message: "请重试",
- type: "info",
- });
- }
- );
- };
- const exportData = (res, name) => {
- const content = res;
- const blob = new Blob([content], { type: "application/ms-excel" });
- const fileName = name;
- if ("download" in document.createElement("a")) {
- // 非IE下载
- const elink = document.createElement("a");
- elink.download = fileName;
- elink.style.display = "none";
- elink.href = URL.createObjectURL(blob);
- document.body.appendChild(elink);
- elink.click();
- URL.revokeObjectURL(elink.href); // 释放URL 对象
- document.body.removeChild(elink);
- } else {
- navigator.msSaveBlob(blob, fileName);
- }
- };
- const getSummaries = (param) => {
- const { columns, data } = param; //columns是每列的信息,data是每行的信息
- const sums = [];
- columns.forEach((column, index) => {
- if (index === 0) {
- sums[index] = "合计"; //此处是在index=0的这一列显示为“合计”
- return;
- }
- const values = data.map((item) => Number(item[column.property]));
- if (
- column.property === "waitAmount" ||
- column.property === "alreadyAmount" ||
- column.property === "amount"
- ) {
- sums[index] = values.reduce((prev, curr) => {
- const value = Number(curr);
- if (!isNaN(value)) {
- return Number(parseFloat(prev + curr).toFixed(4));
- } else {
- return prev;
- }
- }, 0);
- sums[index];
- }
- });
- return sums;
- };
- const currnetPurchaseRow = ref({});
- const handleClickArrivalStatus = (row) => {
- currnetPurchaseRow.value = { ...row };
- dialogVisibleThree.value = true;
- };
- </script>
-
- <style lang="scss" scoped>
- .tenant {
- padding: 20px;
- }
- :deep(.el-table__header-wrapper .el-checkbox) {
- display: none;
- }
- </style>
|