|
|
@@ -0,0 +1,323 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <el-form ref="form" :model="dialogForm">
|
|
|
+ <div>
|
|
|
+ <el-divider direction="vertical"></el-divider>
|
|
|
+ <span>应付金额:</span>
|
|
|
+ <span>{{ form.payableTotalPrice }}</span>
|
|
|
+ <el-divider direction="vertical"></el-divider>
|
|
|
+ <span>已付金额:</span>
|
|
|
+ <span>{{ paidTotalPrice }}</span>
|
|
|
+ <el-divider direction="vertical"></el-divider>
|
|
|
+ <span>未付金额:</span>
|
|
|
+ <span>{{ unpaidTotalPrice < 0 ? 0 : unpaidTotalPrice }}</span>
|
|
|
+ </div>
|
|
|
+ <!-- 数据表格 -->
|
|
|
+ <ele-pro-table
|
|
|
+ ref="table"
|
|
|
+ :columns="columns"
|
|
|
+ :datasource="dialogForm.detailList"
|
|
|
+ :needPage="false"
|
|
|
+ :toolkit="[]"
|
|
|
+ :minHeight="100"
|
|
|
+ tool-class="ele-toolbar-form"
|
|
|
+ cache-key="collectionDialogTable"
|
|
|
+ >
|
|
|
+ <!-- 表头工具栏 -->
|
|
|
+ <template v-slot:toolbar>
|
|
|
+ <el-button
|
|
|
+ v-if="dialogType !== 'view'"
|
|
|
+ :disabled="unpaidTotalPrice <= 0"
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-plus"
|
|
|
+ class="ele-btn-icon"
|
|
|
+ @click="handleAddInfo"
|
|
|
+ >
|
|
|
+ 新增付款信息
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-slot:action="{ row, $index }">
|
|
|
+ <el-link
|
|
|
+ v-if="
|
|
|
+ dialogType == 'view' && !row.invoiceStatus && !form.invoiceCode
|
|
|
+ "
|
|
|
+ type="primary"
|
|
|
+ :underline="false"
|
|
|
+ @click="addInvoice(row)"
|
|
|
+ >
|
|
|
+ 新增发票
|
|
|
+ </el-link>
|
|
|
+ <el-popconfirm
|
|
|
+ class="ele-action"
|
|
|
+ title="确定要删除此信息吗?"
|
|
|
+ v-if="dialogType !== 'view'"
|
|
|
+ @confirm="handleDelInfo($index)"
|
|
|
+ >
|
|
|
+ <template v-slot:reference>
|
|
|
+ <el-link type="danger" :underline="false" icon="el-icon-delete">
|
|
|
+ 删除
|
|
|
+ </el-link>
|
|
|
+ </template>
|
|
|
+ </el-popconfirm>
|
|
|
+ </template>
|
|
|
+ <template
|
|
|
+ v-slot:paidDate="{ row, $index }"
|
|
|
+ v-if="dialogType !== 'view'"
|
|
|
+ >
|
|
|
+ <el-form-item
|
|
|
+ :prop="'detailList.' + $index + '.paidDate'"
|
|
|
+ :rules="{
|
|
|
+ required: true,
|
|
|
+ message: '请选择',
|
|
|
+ trigger: ['blur', 'change']
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <el-date-picker
|
|
|
+ style="width: 95%"
|
|
|
+ v-model="row.paidDate"
|
|
|
+ type="date"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ placeholder="选择日期"
|
|
|
+ >
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ <template
|
|
|
+ v-slot:paidTotalPrice="{ row, $index }"
|
|
|
+ v-if="dialogType !== 'view'"
|
|
|
+ >
|
|
|
+ <el-form-item
|
|
|
+ :prop="'detailList.' + $index + '.paidTotalPrice'"
|
|
|
+ :rules="{
|
|
|
+ required: true,
|
|
|
+ message: '请输入',
|
|
|
+ trigger: ['blur', 'change']
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <el-input-number
|
|
|
+ @change="(val, oldVal) => handlePrice(val, oldVal, row, $index)"
|
|
|
+ v-model="row.paidTotalPrice"
|
|
|
+ :controls="false"
|
|
|
+ :precision="2"
|
|
|
+ :min="0.0"
|
|
|
+ ></el-input-number>
|
|
|
+ <!-- :max="getMAXPrice" -->
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ <template v-slot:files="{ row, $index }">
|
|
|
+ <el-form-item :prop="'detailList.' + $index + '.files'">
|
|
|
+ <fileMain v-model="row.files" :type="dialogType"></fileMain>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ <template v-slot:remark="{ row, $index }" v-if="dialogType !== 'view'">
|
|
|
+ <el-form-item>
|
|
|
+ <el-input v-model="row.remark" type="textarea"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ <template v-slot:columnRequired="{ column }">
|
|
|
+ <span class="is-required">{{ column.label }}</span>
|
|
|
+ </template>
|
|
|
+ <!-- 开票信息 -->
|
|
|
+ <template v-slot:invoiceCode="{ row }">
|
|
|
+ <el-link
|
|
|
+ type="primary"
|
|
|
+ :underline="false"
|
|
|
+ @click="handleInvoiceDetail(row, 'view')"
|
|
|
+ >
|
|
|
+ {{ row.invoiceCode }}
|
|
|
+ </el-link>
|
|
|
+ </template>
|
|
|
+ </ele-pro-table>
|
|
|
+ </el-form>
|
|
|
+ <add-or-edit-dialog
|
|
|
+ :add-or-edit-dialog-flag.sync="addOrEditDialogFlag"
|
|
|
+ ref="addOrEditDialogRef"
|
|
|
+ v-if="addOrEditDialogFlag"
|
|
|
+ @reload="reload"
|
|
|
+ ></add-or-edit-dialog>
|
|
|
+ <!--开票详情-->
|
|
|
+ <invoice-detail-dialog
|
|
|
+ ref="invoiceDetailDialogRef"
|
|
|
+ v-if="invoiceDetailDialogFlag"
|
|
|
+ :detailDialogFlag.sync="invoiceDetailDialogFlag"
|
|
|
+ ></invoice-detail-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import { deepClone } from '@/utils';
|
|
|
+ import fileMain from '@/components/addDoc/index.vue';
|
|
|
+ import addOrEditDialog from '@/views/financialManage/invoiceManage/components/addOrEditDialog.vue';
|
|
|
+ import invoiceDetailDialog from '@/views/financialManage/invoiceManage/components/detailDialog.vue';
|
|
|
+
|
|
|
+ export default {
|
|
|
+ name: 'relatedInfoTable',
|
|
|
+ components: { fileMain, addOrEditDialog,invoiceDetailDialog },
|
|
|
+ props: {
|
|
|
+ form: {
|
|
|
+ type: Object,
|
|
|
+ default: () => {}
|
|
|
+ },
|
|
|
+ dialogType: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ editIndex: undefined, //当前修改数据的下标
|
|
|
+ dialogForm: {
|
|
|
+ detailList: []
|
|
|
+ },
|
|
|
+ paidTotalPrice: 0,
|
|
|
+ unpaidTotalPrice: 0,
|
|
|
+ oldVal: 0,
|
|
|
+ MAXPrice: 0,
|
|
|
+ addOrEditDialogFlag: false,
|
|
|
+ invoiceDetailDialogFlag: false
|
|
|
+
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ columns() {
|
|
|
+ let list = [
|
|
|
+ {
|
|
|
+ columnKey: 'index',
|
|
|
+ label: '序号',
|
|
|
+ type: 'index',
|
|
|
+ width: 55,
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 120,
|
|
|
+ prop: 'code',
|
|
|
+ label: '编码',
|
|
|
+ align: 'center',
|
|
|
+ show: this.dialogType == 'view',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'paidDate',
|
|
|
+ label: '付款时间',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 120,
|
|
|
+ slot: 'paidDate',
|
|
|
+ headerSlot: 'columnRequired'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'paidTotalPrice',
|
|
|
+ label: '已付金额',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 130,
|
|
|
+ slot: 'paidTotalPrice',
|
|
|
+ headerSlot: 'columnRequired'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 120,
|
|
|
+ prop: 'invoiceCode',
|
|
|
+ label: '发票编码',
|
|
|
+ slot: 'invoiceCode',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ show: !this.form.invoiceCode
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'files',
|
|
|
+ label: '附件',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'files',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 150
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'remark',
|
|
|
+ label: '备注',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 130,
|
|
|
+ slot: 'remark'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ columnKey: 'action',
|
|
|
+ slot: 'action',
|
|
|
+ label: '操作',
|
|
|
+ resizable: false,
|
|
|
+ width: 160,
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ fixed: 'right'
|
|
|
+ }
|
|
|
+ ];
|
|
|
+ // let action = [
|
|
|
+ // {
|
|
|
+ // columnKey: 'action',
|
|
|
+ // slot: 'action',
|
|
|
+ // label: '操作',
|
|
|
+ // resizable: false,
|
|
|
+ // width: 80,
|
|
|
+ // align: 'center',
|
|
|
+ // showOverflowTooltip: true,
|
|
|
+ // fixed: 'right'
|
|
|
+ // }
|
|
|
+ // ];
|
|
|
+ // this.dialogType === 'view'
|
|
|
+ // ? (list = [...list])
|
|
|
+ // : (list = [...list, ...action]);
|
|
|
+ return list;
|
|
|
+ },
|
|
|
+ getMAXPrice() {
|
|
|
+ return this.MAXPrice;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.init();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ init() {
|
|
|
+ this.dialogForm = deepClone(this.form);
|
|
|
+ this.unpaidTotalPrice = Number(this.dialogForm.unpaidTotalPrice);
|
|
|
+ this.dialogForm.detailList.forEach((item) => {
|
|
|
+ this.MAXPrice =
|
|
|
+ this.unpaidTotalPrice + (Number(item.paidTotalPrice) || 0);
|
|
|
+ });
|
|
|
+ this.paidTotalPrice = Number(this.dialogForm.paidTotalPrice);
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ addInvoice(row) {
|
|
|
+ this.$emit('success', {
|
|
|
+ data: { row, form: this.dialogForm },
|
|
|
+ type: 2,
|
|
|
+ sourceType:4
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleInvoiceDetail(row = {}, type) {
|
|
|
+ this.invoiceDetailDialogFlag = true;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ let params = {
|
|
|
+ id: row.invoiceId
|
|
|
+ };
|
|
|
+ this.$refs.invoiceDetailDialogRef.init(params, type);
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ }
|
|
|
+ };
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped lang="scss">
|
|
|
+ :deep(.el-form-item) {
|
|
|
+ margin-bottom: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ ::v-deep.el-divider {
|
|
|
+ margin: 10px;
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+</style>
|