|
|
@@ -1,191 +1,464 @@
|
|
|
<template>
|
|
|
- <el-form ref="form" :model="form" :rules="rules">
|
|
|
- <el-row>
|
|
|
- <el-col :span="3">
|
|
|
+ <el-form ref="form" :model="form" :rules="{}">
|
|
|
+ <ele-pro-table show-summary :summary-method="getSummaries" ref="table" row-key="id" :needPage="false"
|
|
|
+ :columns="columns" max-height="500px" :toolkit="[]" :datasource="form.datasource"
|
|
|
+ cache-key="systemRoleTable17-1111" class="time-form">
|
|
|
+ <!-- 表头工具栏 -->
|
|
|
+ <template v-slot:action="{ row,$index }">
|
|
|
+ <el-popconfirm class="ele-action" title="确定要删除吗?" @confirm="remove(index,$index,'line')">
|
|
|
+ <template v-slot:reference>
|
|
|
+ <el-link type="danger" v-if="dialogType!=='view'" :underline="false" icon="el-icon-delete">
|
|
|
+ 删除
|
|
|
+ </el-link>
|
|
|
+ </template>
|
|
|
+ </el-popconfirm>
|
|
|
+ </template>
|
|
|
+ <template v-slot:productCode="{ row,$index }">
|
|
|
+ <el-popover
|
|
|
+ placement="right"
|
|
|
+ width="80%"
|
|
|
+ trigger="hover">
|
|
|
+ <ele-pro-table ref="childrenTable"
|
|
|
+ row-key="id"
|
|
|
+ max-height="300px"
|
|
|
+ :needPage="false" :columns="childrenColumns" :toolkit="[]"
|
|
|
+ :datasource="row.productList"
|
|
|
+ cache-key="systemRoleTable17-222" class="time-form">
|
|
|
+ </ele-pro-table>
|
|
|
+ <el-button type="text" slot="reference">{{ row.productCode }}</el-button>
|
|
|
+ </el-popover>
|
|
|
+ </template>
|
|
|
+ <template v-if="taskDefinitionKey=='financeLeader'" v-slot:receivedPrice="{row,$index}">
|
|
|
<el-form-item
|
|
|
- label="订单量:"
|
|
|
- prop="orderNum"
|
|
|
- style="margin-bottom: 22px"
|
|
|
- >
|
|
|
- {{ datasource.length }}
|
|
|
+ :prop="'datasource.'+$index+'.receivedPrice'"
|
|
|
+ :rules="{required:true,trigger:'change',message:'请选择'}">
|
|
|
+ <el-input-number :controls="false"
|
|
|
+ style="width: 100%"
|
|
|
+ v-model="row.receivedPrice"
|
|
|
+ :precision="2"
|
|
|
+ @blur="(val)=>handleEditCost(row,'receivedPrice','receivablePrice')"
|
|
|
+ :max="row.totalPrice"></el-input-number>
|
|
|
</el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="4">
|
|
|
+
|
|
|
+ </template>
|
|
|
+ <template v-if="taskDefinitionKey=='financeLeader'" v-slot:receivableDate="{row,$index}">
|
|
|
<el-form-item
|
|
|
- label="产品总金额:"
|
|
|
- prop="totalPrice"
|
|
|
- style="margin-bottom: 22px">
|
|
|
- {{ price.totalPrice }}元
|
|
|
+ :prop="'datasource.'+$index+'.receivableDate'"
|
|
|
+ :rules="{required:true,trigger:'change',message:'请选择'}">
|
|
|
+ <el-date-picker
|
|
|
+ type="date"
|
|
|
+ style="width: 100%"
|
|
|
+ v-model="row.receivableDate"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ placeholder="选择日期">
|
|
|
+ </el-date-picker>
|
|
|
</el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="4">
|
|
|
+
|
|
|
+
|
|
|
+ </template>
|
|
|
+ <template v-if="taskDefinitionKey=='financeLeader'" v-slot:invoicedPrice="{row,$index}">
|
|
|
<el-form-item
|
|
|
- label="产品优惠总金额:"
|
|
|
- prop="totalPrice"
|
|
|
- style="margin-bottom: 22px">
|
|
|
- {{ price.discountTotalPrice }}元
|
|
|
+ :prop="'datasource.'+$index+'.invoicedPrice'"
|
|
|
+ :rules="{required:true,trigger:'change',message:'请选择'}">
|
|
|
+ <el-input-number :controls="false"
|
|
|
+ style="width: 100%"
|
|
|
+ v-model="row.invoicedPrice"
|
|
|
+ :precision="2"
|
|
|
+ @blur="(val)=>handleEditCost(row,'invoicedPrice','notInvoicedPrice')"
|
|
|
+ :max="row.totalPrice"></el-input-number>
|
|
|
</el-form-item>
|
|
|
+ </template>
|
|
|
+ <template v-slot:headerReceivedPrice="{ column }">
|
|
|
+ <span class="is-required">{{ column.label }}</span>
|
|
|
+ </template>
|
|
|
+ <template v-slot:headerReceivableDate="{ column }">
|
|
|
+ <span class="is-required">{{ column.label }}</span>
|
|
|
+ </template>
|
|
|
+ <template v-slot:headerInvoicedPrice="{ column }">
|
|
|
+ <span class="is-required">{{ column.label }}</span>
|
|
|
+ </template>
|
|
|
+ </ele-pro-table>
|
|
|
+
|
|
|
+ <el-row style="margin-top: 10px">
|
|
|
+ <el-col :span="6" style="float: right;">
|
|
|
+ <el-descriptions class="margin-top" direction="vertical" :column="3" size="small" border>
|
|
|
+ <el-descriptions-item label="本期应收款总额" >{{ priceObj.amountReceivablePrice }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="截止上期欠款">
|
|
|
+ <el-input-number v-if="taskDefinitionKey=='financeLeader'" :controls="false"
|
|
|
+ style="width: 100%"
|
|
|
+ v-model="priceObj.previousPeriodEndDebt"
|
|
|
+ :precision="2"></el-input-number>
|
|
|
+ <template v-else>{{ priceObj.previousPeriodEndDebt }}</template>
|
|
|
+ </el-descriptions-item>
|
|
|
+ </el-descriptions>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
|
|
|
- <template v-for="(item,index) in datasource">
|
|
|
- <ele-pro-table ref="table" :needPage="false" :columns="columns" :toolkit="[]" :datasource="item.detailList"
|
|
|
- cache-key="systemRoleTable17" class="time-form">
|
|
|
- <!-- 表头工具栏 -->
|
|
|
- <template v-slot:toolbar>
|
|
|
- <el-col :span="6">
|
|
|
- <el-form-item
|
|
|
- label="销售订单:"
|
|
|
- prop="orderNum"
|
|
|
- style="margin-bottom: 22px">
|
|
|
- {{ item.orderNo }}
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="4">
|
|
|
- <el-form-item
|
|
|
- label="总金额:"
|
|
|
- prop="totalPrice"
|
|
|
- style="margin-bottom: 22px">
|
|
|
- {{ item.totalPrice }}元
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item
|
|
|
- style="display: flex"
|
|
|
- label="优惠总金额:"
|
|
|
- class="is-required"
|
|
|
- prop="discountTotalPrice">
|
|
|
- <el-input :disabled="dialogType=='view'" v-model="item.discountTotalPrice"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </template>
|
|
|
- <template v-slot:action="{ row }">
|
|
|
- <el-popconfirm class="ele-action" title="确定要删除吗?" @confirm="remove(row)">
|
|
|
- <template v-slot:reference>
|
|
|
- <el-link type="danger" v-if="dialogType!=='view'" :underline="false" icon="el-icon-delete">
|
|
|
- 删除
|
|
|
- </el-link>
|
|
|
- </template>
|
|
|
- </el-popconfirm>
|
|
|
- </template>
|
|
|
- </ele-pro-table>
|
|
|
-
|
|
|
- </template>
|
|
|
-
|
|
|
-
|
|
|
</el-form>
|
|
|
|
|
|
</template>
|
|
|
<script>
|
|
|
+
|
|
|
export default {
|
|
|
components: {},
|
|
|
- props: ['datasource','dialogType','price'],
|
|
|
- data() {
|
|
|
-
|
|
|
- return {
|
|
|
- rules: {},
|
|
|
- form: {},
|
|
|
- columns: [
|
|
|
+ props: ['datasource', 'dialogType', 'taskDefinitionKey', 'priceObj'],
|
|
|
+ computed: {
|
|
|
+ columns() {
|
|
|
+ let basicFields = [
|
|
|
{
|
|
|
- width: 45,
|
|
|
+ width: 60,
|
|
|
+ label: '序号',
|
|
|
type: 'index',
|
|
|
columnKey: 'index',
|
|
|
align: 'center',
|
|
|
- fixed: 'left'
|
|
|
},
|
|
|
{
|
|
|
- width: 160,
|
|
|
+ minWidth: 130,
|
|
|
+ prop: 'sendDate',
|
|
|
+ label: '发货日期',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'sendDate',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 120,
|
|
|
+ prop: 'productCode',
|
|
|
+ label: '产品编码',
|
|
|
+ slot: 'productCode',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 140,
|
|
|
+ prop: 'productName',
|
|
|
+ label: '产品名称',
|
|
|
+ slot: 'productName',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 100,
|
|
|
+ prop: 'specification',
|
|
|
+ label: '规格',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'specification',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 100,
|
|
|
+ prop: 'modelType',
|
|
|
+ label: '型号',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'modelType',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 100,
|
|
|
+ prop: 'orderNo',
|
|
|
+ label: '销售订单编码',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'orderNo',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 120,
|
|
|
+ prop: 'totalCount',
|
|
|
+ label: '验收数量',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'totalCount',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 120,
|
|
|
+ prop: 'measuringUnit',
|
|
|
+ label: '计量单位',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'measuringUnit',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 100,
|
|
|
+ prop: 'singlePrice',
|
|
|
+ label: '单价',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'singlePrice',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 120,
|
|
|
+ prop: 'totalPrice',
|
|
|
+ label: '合计金额',
|
|
|
+ slot: 'totalPrice',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ let permissionType = {
|
|
|
+ 'financeLeader': [
|
|
|
+ {
|
|
|
+ minWidth: 130,
|
|
|
+ prop: 'receivedPrice',
|
|
|
+ label: '已收款金额',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'receivedPrice',
|
|
|
+ headerSlot: 'headerReceivedPrice'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 130,
|
|
|
+ prop: 'receivablePrice',
|
|
|
+ label: '应收款金额',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'receivablePrice',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 140,
|
|
|
+ prop: 'receivableDate',
|
|
|
+ label: '应收款日期',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'receivableDate',
|
|
|
+ headerSlot: 'headerReceivableDate'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 130,
|
|
|
+ prop: 'invoicedPrice',
|
|
|
+ label: '已开票金额',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'invoicedPrice',
|
|
|
+ headerSlot: 'headerInvoicedPrice'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 130,
|
|
|
+ prop: 'notInvoicedPrice',
|
|
|
+ label: '未开票金额',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'notInvoicedPrice'
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ 'leader': [
|
|
|
+ {
|
|
|
+ minWidth: 130,
|
|
|
+ prop: 'receivedPrice',
|
|
|
+ label: '已收款金额',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'receivedPrice'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 130,
|
|
|
+ prop: 'receivablePrice',
|
|
|
+ label: '应收款金额',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'receivablePrice'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 140,
|
|
|
+ prop: 'receivableDate',
|
|
|
+ label: '应收款日期',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'receivableDate'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 130,
|
|
|
+ prop: 'invoicedPrice',
|
|
|
+ label: '已开票金额',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'invoicedPrice'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 130,
|
|
|
+ prop: 'notInvoicedPrice',
|
|
|
+ label: '未开票金额',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'notInvoicedPrice'
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ 'uploadReceipt': [
|
|
|
+ {
|
|
|
+ minWidth: 130,
|
|
|
+ prop: 'receivedPrice',
|
|
|
+ label: '已收款金额',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'receivedPrice'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 130,
|
|
|
+ prop: 'receivablePrice',
|
|
|
+ label: '应收款金额',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'receivablePrice'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 140,
|
|
|
+ prop: 'receivableDate',
|
|
|
+ label: '应收款日期',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'receivableDate'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 130,
|
|
|
+ prop: 'invoicedPrice',
|
|
|
+ label: '已开票金额',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'invoicedPrice'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ minWidth: 130,
|
|
|
+ prop: 'notInvoicedPrice',
|
|
|
+ label: '未开票金额',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'notInvoicedPrice'
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ }
|
|
|
+ permissionType[this.taskDefinitionKey] && basicFields.push(...permissionType[this.taskDefinitionKey])
|
|
|
+ return basicFields
|
|
|
+ },
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ rules: {},
|
|
|
+ form: {
|
|
|
+ datasource: []
|
|
|
+ },
|
|
|
+ childrenColumns: [
|
|
|
+ {
|
|
|
+ minWidth: 120,
|
|
|
prop: 'orderNo',
|
|
|
- label: '主单据编码',
|
|
|
+ label: '单据编码',
|
|
|
+ align: 'center',
|
|
|
slot: 'orderNo'
|
|
|
},
|
|
|
{
|
|
|
- width: 140,
|
|
|
+ minWidth: 120,
|
|
|
prop: 'orderType',
|
|
|
- label: '主单据类型',
|
|
|
+ label: '单据类型',
|
|
|
slot: 'orderType',
|
|
|
+ align: 'center',
|
|
|
formatter: (_row, _column, cellValue) => {
|
|
|
return _row.orderType === 1 ? '销售发货' : _row.orderType === 2 ? '销售退货' : ""
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
- width: 200,
|
|
|
+ minWidth: 140,
|
|
|
prop: 'productName',
|
|
|
- label: '名称',
|
|
|
- slot: 'productName'
|
|
|
+ label: '产品名称',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'productName',
|
|
|
},
|
|
|
{
|
|
|
- width: 120,
|
|
|
+ minWidth: 100,
|
|
|
prop: 'productCode',
|
|
|
label: '编码',
|
|
|
+ align: 'center',
|
|
|
slot: 'productCode'
|
|
|
},
|
|
|
{
|
|
|
- width: 200,
|
|
|
- prop: 'productCategoryName',
|
|
|
- label: '类型',
|
|
|
- slot: 'productCategoryName'
|
|
|
- },
|
|
|
- {
|
|
|
- width: 160,
|
|
|
+ minWidth: 100,
|
|
|
prop: 'productBrand',
|
|
|
label: '牌号',
|
|
|
+ align: 'center',
|
|
|
slot: 'productBrand'
|
|
|
},
|
|
|
{
|
|
|
- width: 120,
|
|
|
+ minWidth: 100,
|
|
|
prop: 'modelType',
|
|
|
label: '型号',
|
|
|
+ align: 'center',
|
|
|
slot: 'modelType'
|
|
|
},
|
|
|
{
|
|
|
- width: 120,
|
|
|
+ minWidth: 100,
|
|
|
prop: 'specification',
|
|
|
label: '规格',
|
|
|
+ align: 'center',
|
|
|
slot: 'specification'
|
|
|
},
|
|
|
-
|
|
|
-
|
|
|
{
|
|
|
- width: 120,
|
|
|
+ minWidth: 100,
|
|
|
prop: 'totalCount',
|
|
|
label: '数量',
|
|
|
+ align: 'center',
|
|
|
slot: 'totalCount'
|
|
|
},
|
|
|
{
|
|
|
- width: 80,
|
|
|
+ minWidth: 120,
|
|
|
prop: 'measuringUnit',
|
|
|
label: '计量单位',
|
|
|
+ align: 'center',
|
|
|
slot: 'measuringUnit'
|
|
|
},
|
|
|
{
|
|
|
- width: 160,
|
|
|
+ minWidth: 100,
|
|
|
prop: 'singlePrice',
|
|
|
label: '单价',
|
|
|
+ align: 'center',
|
|
|
slot: 'singlePrice'
|
|
|
},
|
|
|
{
|
|
|
- width: 120,
|
|
|
+ minWidth: 100,
|
|
|
prop: 'totalPrice',
|
|
|
label: '金额',
|
|
|
- slot: 'totalPrice'
|
|
|
- },
|
|
|
-
|
|
|
-
|
|
|
- {
|
|
|
- columnKey: 'action',
|
|
|
- label: '操作',
|
|
|
- width: 120,
|
|
|
align: 'center',
|
|
|
- resizable: false,
|
|
|
- slot: 'action',
|
|
|
- fixed: 'right',
|
|
|
- showOverflowTooltip: true
|
|
|
+ slot: 'totalPrice'
|
|
|
}
|
|
|
],
|
|
|
};
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ datasource: {
|
|
|
+ handler(val) {
|
|
|
+ this.form.datasource = this.datasource
|
|
|
+ },
|
|
|
+ deep: true,
|
|
|
+ immediate: true
|
|
|
+ },
|
|
|
+ form: {
|
|
|
+ handler(val) {
|
|
|
+ this.$emit('update:datasource', this.form.datasource)
|
|
|
+ },
|
|
|
+ deep: true,
|
|
|
+ immediate: true
|
|
|
+ },
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ handleEditCost(row, p1, p2) {
|
|
|
+ if (!row[p1]) return row[p2] = row.totalPrice.toFixed(2)
|
|
|
+ row[p2] = (row.totalPrice - row[p1]).toFixed(2)
|
|
|
+ },
|
|
|
+ remove(tableIndex, lineIndex, delType) {
|
|
|
+ let params = {
|
|
|
+ tableIndex,
|
|
|
+ lineIndex,
|
|
|
+ delType
|
|
|
+ }
|
|
|
+ this.$emit('handleRemove', params)
|
|
|
+ },
|
|
|
+ getSummaries(param) {
|
|
|
+ const {columns, data} = param;
|
|
|
+ const sums = [];
|
|
|
+ let fields = ['totalPrice', 'notInvoicedPrice', 'invoicedPrice', 'receivablePrice', 'receivedPrice']
|
|
|
+ columns.forEach((column, index) => {
|
|
|
+ if (index === 0) {
|
|
|
+ sums[index] = '合计';
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const values = fields.includes(column.property) ? data.map(item => Number(item[column.property])) : []
|
|
|
+ if (!values.every(value => isNaN(value))) {
|
|
|
+ sums[index] = values.reduce((prev, curr) => {
|
|
|
+ const value = Number(curr);
|
|
|
+ if (!isNaN(value)) {
|
|
|
+ return prev + curr;
|
|
|
+ } else {
|
|
|
+ return prev;
|
|
|
+ }
|
|
|
+ }, 0);
|
|
|
+ sums[index] = sums[index].toFixed(2)
|
|
|
+ } else {
|
|
|
+ sums[index] = '';
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ return sums;
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
</script>
|