|
|
@@ -0,0 +1,273 @@
|
|
|
+<!-- 预收款新增/编辑弹窗 -->
|
|
|
+<template>
|
|
|
+ <ele-modal
|
|
|
+ width="70%"
|
|
|
+ :visible="visible"
|
|
|
+ :maxable="true"
|
|
|
+ :append-to-body="true"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ custom-class="ele-dialog-form"
|
|
|
+ title="收款条件"
|
|
|
+ @update:visible="updateVisible"
|
|
|
+ >
|
|
|
+ <ele-pro-table
|
|
|
+ ref="table"
|
|
|
+ :columns="columns"
|
|
|
+ :datasource="datasource"
|
|
|
+ height="calc(100vh - 375px)"
|
|
|
+ full-height="calc(100vh - 116px)"
|
|
|
+ tool-class="ele-toolbar-form"
|
|
|
+ :selection.sync="selection"
|
|
|
+ :page-size="20"
|
|
|
+ @columns-change="handleColumnChange"
|
|
|
+ @cell-click="cellClick"
|
|
|
+ :cache-key="cacheKeyUrl"
|
|
|
+ >
|
|
|
+ <!-- 表头工具栏 -->
|
|
|
+ <!-- <template v-slot:toolbar>
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-plus"
|
|
|
+ class="ele-btn-icon"
|
|
|
+ @click="openEdit('add', {})"
|
|
|
+ >
|
|
|
+ 新增
|
|
|
+ </el-button>
|
|
|
+ </template> -->
|
|
|
+ <!-- 表头工具栏 -->
|
|
|
+ <template v-slot:action="{ row }">
|
|
|
+ <el-radio class="radio" v-model="radio" :label="row.id"
|
|
|
+ ><i></i
|
|
|
+ ></el-radio>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-slot:ruleState="{ row }">
|
|
|
+ <el-switch
|
|
|
+ v-model="row.ruleState"
|
|
|
+ active-color="#13ce66"
|
|
|
+ inactive-color="#ff4949"
|
|
|
+ active-value="1"
|
|
|
+ inactive-value="0"
|
|
|
+ @change="(val) => handleStatus(row, val)"
|
|
|
+ >
|
|
|
+ </el-switch>
|
|
|
+ </template>
|
|
|
+ </ele-pro-table>
|
|
|
+
|
|
|
+ <template v-slot:footer>
|
|
|
+ <el-button type="primary" :loading="loading" @click="selected">
|
|
|
+ 选择
|
|
|
+ </el-button>
|
|
|
+ <el-button @click="updateVisible(false)">取消</el-button>
|
|
|
+ </template>
|
|
|
+ </ele-modal>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import {
|
|
|
+ receiveTermsPageList
|
|
|
+ } from '@/api/financialManage/advanceReceipt';
|
|
|
+ import tabMixins from '@/mixins/tableColumnsMixin';
|
|
|
+ import { calcReceiveDateTypeOp, payConfirmTypeOp, dateUnitOptions } from '@/enum/dict';
|
|
|
+
|
|
|
+ export default {
|
|
|
+ mixins: [tabMixins],
|
|
|
+ components: {
|
|
|
+
|
|
|
+ },
|
|
|
+ props: {
|
|
|
+ isAll: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false
|
|
|
+ },
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ selection: [],
|
|
|
+ cacheKeyUrl: 'eom-202608101410-receiveTerms',
|
|
|
+ visible: false,
|
|
|
+ loading: false,
|
|
|
+ radio: '',
|
|
|
+ current: null,
|
|
|
+ currentIndex: null,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ columns() {
|
|
|
+ let selection = null;
|
|
|
+ if (this.isAll) {
|
|
|
+ selection = {
|
|
|
+ width: 45,
|
|
|
+ type: 'selection',
|
|
|
+ columnKey: 'selection',
|
|
|
+ align: 'center',
|
|
|
+ reserveSelection: true
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ selection = {
|
|
|
+ action: 'action',
|
|
|
+ slot: 'action',
|
|
|
+ align: 'center',
|
|
|
+ label: '选择',
|
|
|
+ minWidth: 100
|
|
|
+ };
|
|
|
+ }
|
|
|
+ return [
|
|
|
+ // {
|
|
|
+ // width: 45,
|
|
|
+ // type: 'selection',
|
|
|
+ // columnKey: 'selection',
|
|
|
+ // align: 'center'
|
|
|
+ // },
|
|
|
+ selection,
|
|
|
+ {
|
|
|
+ columnKey: 'index',
|
|
|
+ label: '序号',
|
|
|
+ type: 'index',
|
|
|
+ width: 55,
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'code',
|
|
|
+ label: '编码',
|
|
|
+ align: 'center',
|
|
|
+ // sortable: true,
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 160
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'name',
|
|
|
+ label: '收款条件名称',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 160
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'dateType',
|
|
|
+ label: '收款日计算日期',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 160,
|
|
|
+ formatter: (row) => {
|
|
|
+ return calcReceiveDateTypeOp.find(item => item.value === row.dateType)?.label || '';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'rulesTypePOList',
|
|
|
+ label: '支付方式',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 140,
|
|
|
+ formatter: (row) => {
|
|
|
+ return this.buildPaymentMethod(row.rulesTypePOList);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'determinationMethod',
|
|
|
+ label: '收款日确认方式',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 140,
|
|
|
+ formatter: (row) => {
|
|
|
+ return payConfirmTypeOp.find(item => item.value === row.determinationMethod)?.label || '';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'remark',
|
|
|
+ label: '备注',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 180
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'createUserId',
|
|
|
+ label: '创建人',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 120
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'createTime',
|
|
|
+ label: '创建时间',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 120
|
|
|
+ },
|
|
|
+ // {
|
|
|
+ // prop: 'ruleState',
|
|
|
+ // slot: 'ruleState',
|
|
|
+ // label: '状态',
|
|
|
+ // align: 'center',
|
|
|
+ // showOverflowTooltip: true,
|
|
|
+ // minWidth: 120
|
|
|
+ // },
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 单击获取id
|
|
|
+ cellClick(row) {
|
|
|
+ this.current = row;
|
|
|
+ console.log(row);
|
|
|
+ this.radio = row.id;
|
|
|
+ },
|
|
|
+ // 构建支付方式字符串
|
|
|
+ buildPaymentMethod(list) {
|
|
|
+ return list
|
|
|
+ .map(item => {
|
|
|
+ const unit =
|
|
|
+ (dateUnitOptions.find(opt => opt.value === item.dateType) || {}).label ||
|
|
|
+ '月';
|
|
|
+ return `${item.percentage}% ${item.paymentSum}${unit} ${item.paymentType}`;
|
|
|
+ })
|
|
|
+ .join(',');
|
|
|
+ },
|
|
|
+ /* 表格数据源 */
|
|
|
+ async datasource({ page, limit, where, order }) {
|
|
|
+
|
|
|
+ const res = await receiveTermsPageList({
|
|
|
+ pageNum: page,
|
|
|
+ size: limit,
|
|
|
+ conditionConfigurationType: 'rules',
|
|
|
+ ruleState: 1,
|
|
|
+ ...where
|
|
|
+ });
|
|
|
+ console.log('res', res);
|
|
|
+ return res
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ async open() {
|
|
|
+ this.visible = true;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.form && this.$refs.form.clearValidate();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ selected() {
|
|
|
+ if (!this.current && !this.isAll) {
|
|
|
+ return this.$message.warning('请至少选择一条数据');
|
|
|
+ }
|
|
|
+ if (this.isAll) {
|
|
|
+ if (!this.selection.length) {
|
|
|
+ return this.$message.warning('请至少选择一条数据');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.$emit(
|
|
|
+ 'changeParent',
|
|
|
+ this.isAll ? this.selection : this.current,
|
|
|
+ this.currentIndex
|
|
|
+ );
|
|
|
+ this.updateVisible();
|
|
|
+ },
|
|
|
+
|
|
|
+ updateVisible(value) {
|
|
|
+ this.visible = value;
|
|
|
+ this.current = null;
|
|
|
+ this.radio = '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+</script>
|