12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202 |
- <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 #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">
- <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
- 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
- >
- <byForm
- :formConfig="formConfigTwo"
- :formOption="formOption"
- v-model="formData.dataTwo"
- :rules="rules"
- ref="byformOne"
- >
- <template #detailSlot>
- <div style="width: 100%">
- <el-table :data="formData.dataTwo.purchaseDetailVoList">
- <el-table-column prop="productCustomCode" label="物品编码" />
- <el-table-column prop="productName" label="物品名称" />
- <el-table-column prop="count" label="采购数量" />
- <el-table-column prop="deliverGoodsQuantity" label="已发货">
- <template #default="{ row }">
- <div>
- <el-popover
- placement="bottom-start"
- title="发货详情"
- :width="500"
- trigger="hover"
- >
- <div default>
- <el-table :data="row.deliverGoodsDetailList">
- <el-table-column
- label="发货时间"
- prop="createTime"
- width="155"
- />
- <el-table-column
- label="物流单号"
- prop="logisticsCode"
- />
- <el-table-column
- label="数量"
- prop="deliverGoodsQuantity"
- width="100"
- />
- </el-table>
- </div>
- <template #reference>
- <div style="cursor: pointer; color: #0084ff">
- {{ row.deliverGoodsQuantity }}
- </div>
- </template>
- </el-popover>
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="receiptQuantity" label="已入库">
- <template #default="{ row }">
- <div>
- <el-popover
- placement="bottom-start"
- title="入库详情"
- :width="500"
- trigger="hover"
- >
- <div default>
- <el-table :data="row.receiptList">
- <el-table-column
- label="入库时间"
- prop="createTime"
- width="155"
- />
- <el-table-column
- label="入库单号"
- prop="logisticsCode"
- />
- <el-table-column
- label="数量"
- prop="quantity"
- width="100"
- />
- </el-table>
- </div>
- <template #reference>
- <div style="cursor: pointer; color: #0084ff">
- {{ row.receiptQuantity }}
- </div>
- </template>
- </el-popover>
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="purchaseBackQuantity" label="退货">
- <template #default="{ row }">
- <div>
- <el-popover
- placement="bottom-start"
- title="退货详情"
- :width="500"
- trigger="hover"
- >
- <div default>
- <el-table :data="row.purchaseBackDetailsList">
- <el-table-column label="申请时间" prop="createTime" />
- <el-table-column label="申请数量" prop="quantity" />
- <el-table-column
- label="已退数量"
- prop="returnedQuantity"
- />
- </el-table>
- </div>
- <template #reference>
- <div style="cursor: pointer; color: #0084ff">
- {{ row.purchaseBackQuantity }}
- </div>
- </template>
- </el-popover>
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="qualityQuantity" label="已质检数量" />
- <el-table-column prop="noQualifiedCount" label="不合格数量" />
- </el-table>
- </div>
- </template>
- </byForm>
- <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";
- 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: "到货状态",
- prop: "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,
- },
- ]);
- let formConfigTwo = computed(() => [
- {
- type: "title",
- title: "基础信息",
- },
- {
- type: "input",
- prop: "supplyName",
- label: "供应商",
- disabled: true,
- itemWidth: 50,
- },
- {
- type: "input",
- prop: "purchaseCode",
- label: "采购单号",
- disabled: true,
- itemWidth: 50,
- },
- {
- type: "title",
- title: "采购明细",
- },
- {
- type: "slot",
- slotName: "detailSlot",
- label: "",
- },
- ]);
- 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
- // .post("/deliverGoods/arrivalDetail", { purchaseId: row.id })
- // .then((res) => {
- // formData.dataTwo = {
- // supplyName: row.supplyName,
- // purchaseCode: row.contractCode,
- // purchaseDetailVoList: res.purchaseDetailVoList,
- // };
- // dialogVisibleThree.value = true;
- // });
- 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);
- }
- };
- </script>
-
- <style lang="scss" scoped>
- .tenant {
- padding: 20px;
- }
- :deep(.el-table__header-wrapper .el-checkbox) {
- display: none;
- }
- </style>
|