销售结算
This commit is contained in:
@ -10,9 +10,21 @@ enum Api {
|
|||||||
LngPngSettleHdr = '/dayPlan/pngSettleHdr',
|
LngPngSettleHdr = '/dayPlan/pngSettleHdr',
|
||||||
PageAdd = '/magic-api/dayPlan/pngSettleSalesHdrSelectPage',
|
PageAdd = '/magic-api/dayPlan/pngSettleSalesHdrSelectPage',
|
||||||
date = '/magic-api/dayPlan/pngSettleSalesHdrSelectDateTo',
|
date = '/magic-api/dayPlan/pngSettleSalesHdrSelectDateTo',
|
||||||
|
DtlList = '/magic-api/dayPlan/pngSettleSalesHdrDtlList',
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
export async function getLngPngSettleHdrDtlList(params, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.get<LngPngSettleHdrPageModel>(
|
||||||
|
{
|
||||||
|
url: Api.DtlList,
|
||||||
|
params,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
export async function getLngPngSettleHdrDate(params, mode: ErrorMessageMode = 'modal') {
|
export async function getLngPngSettleHdrDate(params, mode: ErrorMessageMode = 'modal') {
|
||||||
return defHttp.get<LngPngSettleHdrPageModel>(
|
return defHttp.get<LngPngSettleHdrPageModel>(
|
||||||
|
|||||||
@ -72,12 +72,14 @@
|
|||||||
selectType: { type: String, default: 'checkbox' },
|
selectType: { type: String, default: 'checkbox' },
|
||||||
|
|
||||||
});
|
});
|
||||||
|
const searchParams = ref({})
|
||||||
const tableData = ref([])
|
const tableData = ref([])
|
||||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||||
|
|
||||||
setModalProps({ confirmLoading: false });
|
setModalProps({ confirmLoading: false });
|
||||||
|
|
||||||
isUpdate.value = !!data?.isUpdate;
|
isUpdate.value = !!data?.isUpdate;
|
||||||
|
searchParams.value = data.searchParams || {}
|
||||||
});
|
});
|
||||||
|
|
||||||
const [registerTable, { getDataSource, setTableData, updateTableDataRecord, reload }] = useTable({
|
const [registerTable, { getDataSource, setTableData, updateTableDataRecord, reload }] = useTable({
|
||||||
@ -96,7 +98,7 @@
|
|||||||
},
|
},
|
||||||
immediate: false, // 设置为不立即调用
|
immediate: false, // 设置为不立即调用
|
||||||
beforeFetch: (params) => {
|
beforeFetch: (params) => {
|
||||||
return { ...params,page:params.limit};
|
return { ...params,page:params.limit,...searchParams.value};
|
||||||
},
|
},
|
||||||
afterFetch: (res) => {
|
afterFetch: (res) => {
|
||||||
tableData.value = res || []
|
tableData.value = res || []
|
||||||
|
|||||||
@ -3,6 +3,9 @@
|
|||||||
<BasicModal v-bind="$attrs" @register="registerModal" width="60%" :title="getTitle" @ok="handleSubmit">
|
<BasicModal v-bind="$attrs" @register="registerModal" width="60%" :title="getTitle" @ok="handleSubmit">
|
||||||
<a-table :columns="columns" :data-source="tableData" :scroll="{x: 300}" :pagination="false">
|
<a-table :columns="columns" :data-source="tableData" :scroll="{x: 300}" :pagination="false">
|
||||||
<template #bodyCell="{ column, record, index }">
|
<template #bodyCell="{ column, record, index }">
|
||||||
|
<template v-if="column.dataIndex === 'priceDesc'">
|
||||||
|
{{ record.uomName + (record.uomCode == 'M3' ? record.rateQtyM3 : record.rateQtyGj) + record.priceName }}
|
||||||
|
</template>
|
||||||
<template v-if="column.dataIndex === 'qtySettleGj'">
|
<template v-if="column.dataIndex === 'qtySettleGj'">
|
||||||
<a-input-number v-model:value="record.qtySettleGj" :min="0" :precision="3" @change="numChange('qtySettleGj', record, index)" style="width: 100%" />
|
<a-input-number v-model:value="record.qtySettleGj" :min="0" :precision="3" @change="numChange('qtySettleGj', record, index)" style="width: 100%" />
|
||||||
</template>
|
</template>
|
||||||
@ -28,12 +31,10 @@
|
|||||||
import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
|
import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
|
||||||
import { useMessage } from '/@/hooks/web/useMessage';
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
import { useI18n } from '/@/hooks/web/useI18n';
|
import { useI18n } from '/@/hooks/web/useI18n';
|
||||||
|
import { getLngPngSettleHdrDtlList} from '/@/api/dayPlan/PngSettleHdr';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const tableData = ref([
|
const tableData = ref([])
|
||||||
{priceDesc: '基础量300000方'},
|
|
||||||
{priceDesc: '增量'}
|
|
||||||
])
|
|
||||||
const curRecord = ref({})
|
const curRecord = ref({})
|
||||||
const columns= [
|
const columns= [
|
||||||
{ title: t('序号'), dataIndex: 'index', key: 'index', customRender: (column) => `${column.index + 1}` ,width: 80},
|
{ title: t('序号'), dataIndex: 'index', key: 'index', customRender: (column) => `${column.index + 1}` ,width: 80},
|
||||||
@ -54,25 +55,35 @@
|
|||||||
setModalProps({ confirmLoading: false });
|
setModalProps({ confirmLoading: false });
|
||||||
curRecord.value = data.record || {}
|
curRecord.value = data.record || {}
|
||||||
isUpdate.value = !!data?.isUpdate;
|
isUpdate.value = !!data?.isUpdate;
|
||||||
|
if (!(curRecord.value.lngPngSettleSalesDtlList || []).length) {
|
||||||
|
getList()
|
||||||
|
} else {
|
||||||
|
tableData.value = curRecord.value.lngPngSettleSalesDtlList || []
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const getTitle = computed(() => (!unref(isUpdate) ? t('价格组成') : t('')));
|
const getTitle = computed(() => (!unref(isUpdate) ? t('价格组成') : t('')));
|
||||||
const numChange = (k, record, idx) => {
|
const numChange = (k, record, idx) => {
|
||||||
if (curRecord.value.uomCode == 'M3') {
|
if (record.uomCode == 'M3') {
|
||||||
if (k=='amount') {
|
if (k=='amount') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
record.amount = ((Number(record.qtySettleM3) || 0) * (Number(record.priceM3) || 0)).toFixed(2)
|
record.amount = ((Number(record.qtySettleM3) || 0) * (Number(record.priceM3) || 0)).toFixed(2)
|
||||||
}
|
}
|
||||||
if (curRecord.value.uomCode == 'GJ') {
|
if (record.uomCode == 'GJ') {
|
||||||
if (k=='amount') {
|
if (k=='amount') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
record.amount = ((Number(record.qtySettleGj) || 0) * (Number(record.priceGj) || 0)).toFixed(2)
|
record.amount = ((Number(record.qtySettleGj) || 0) * (Number(record.priceGj) || 0)).toFixed(2)
|
||||||
}
|
}
|
||||||
// if (curRecord.value.uomCode == 'TON') {
|
}
|
||||||
|
const getList = async () => {
|
||||||
|
let res = await getLngPngSettleHdrDtlList({})
|
||||||
|
tableData.value = res || []
|
||||||
|
// tableData.value.forEach(v => {
|
||||||
|
// v.priceDesc = v.uomName + (v.uomCode == 'M3' ? v.rateQtyM3 : v.rateQtyGj) + v.priceName
|
||||||
|
// })
|
||||||
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
async function handleSubmit() {
|
async function handleSubmit() {
|
||||||
closeModal();
|
closeModal();
|
||||||
|
|||||||
@ -215,8 +215,8 @@
|
|||||||
formState.value.alterSign = 'I'
|
formState.value.alterSign = 'I'
|
||||||
formState.value.approCode = 'WTJ'
|
formState.value.approCode = 'WTJ'
|
||||||
const res = await getCompDept(userInfo.id)
|
const res = await getCompDept(userInfo.id)
|
||||||
formState.value.cuCode = res?.comp?.code
|
formState.value.cuCode = res?.dept?.code
|
||||||
formState.value.comId = res?.comp?.id
|
formState.value.comId = res?.dept?.id
|
||||||
const res1 = await getLngPngDemandRate({}) || []
|
const res1 = await getLngPngDemandRate({}) || []
|
||||||
formState.value.rateM3Gj = res1[0]?.rateM3Gj
|
formState.value.rateM3Gj = res1[0]?.rateM3Gj
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,7 +54,7 @@ export const columns: BasicColumn[] = [
|
|||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
dataIndex: 'cpName',
|
dataIndex: 'cuSname',
|
||||||
title: '客户简称',
|
title: '客户简称',
|
||||||
componentType: 'input',
|
componentType: 'input',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
|||||||
@ -83,13 +83,13 @@
|
|||||||
<a-button v-if="!isDisable" type="primary" style="margin-bottom: 10px;margin-right: 10px;" @click="handleBtn('add')">新增</a-button>
|
<a-button v-if="!isDisable" type="primary" style="margin-bottom: 10px;margin-right: 10px;" @click="handleBtn('add')">新增</a-button>
|
||||||
<a-button v-if="!isDisable" @click="handleBtn('del')">删除</a-button>
|
<a-button v-if="!isDisable" @click="handleBtn('del')">删除</a-button>
|
||||||
</div>
|
</div>
|
||||||
<a-table :columns="columns" :data-source="dataList" :scroll="{x: 1300}" rowKey="salesId" :pagination="false" :row-selection="{ selectedRowKeys: selectedKeys, onChange: onSelectChange }">
|
<a-table :columns="columns" :data-source="dataList" :scroll="{x: 1500}" rowKey="salesId" :pagination="false" :row-selection="{ selectedRowKeys: selectedKeys, onChange: onSelectChange }">
|
||||||
<template #bodyCell="{ column, record, index }">
|
<template #bodyCell="{ column, record, index }">
|
||||||
<template v-if="column.dataIndex === 'operation'">
|
<template v-if="column.dataIndex === 'operation'">
|
||||||
<a v-if="!isDisable" @click="btnCheck(record, index, 'delete')">删除</a>
|
<a v-if="!isDisable" @click="btnCheck(record, index, 'delete')">删除</a>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="column.dataIndex === 'priceDesc'">
|
<template v-if="column.dataIndex === 'priceDesc'">
|
||||||
<a v-if="!isDisable" @click="btnCheck(record, index, 'price')">增量</a>
|
<a v-if="!isDisable" @click="btnCheck(record, index, 'price')">{{record.priceDesc}}</a>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</a-table>
|
</a-table>
|
||||||
@ -129,9 +129,10 @@
|
|||||||
import measureListModal from '/@/components/common/measureListModal.vue';
|
import measureListModal from '/@/components/common/measureListModal.vue';
|
||||||
import priceComposeListModal from '/@/components/common/priceComposeListModal.vue';
|
import priceComposeListModal from '/@/components/common/priceComposeListModal.vue';
|
||||||
import { getAllCom} from '/@/api/contract/ContractPurInt';
|
import { getAllCom} from '/@/api/contract/ContractPurInt';
|
||||||
|
import { DataFormat, FormatOption, DATE_FORMAT, FormatType } from '/@/utils/dataFormat';
|
||||||
|
|
||||||
const tableName = 'ContractSalesInt';
|
const tableName = 'PngSettleHdr';
|
||||||
const columnName = 'ContractSalesInt'
|
const columnName = 'PngSettleHdr'
|
||||||
|
|
||||||
const formType = ref('2'); // 0 新建 1 修改 2 查看
|
const formType = ref('2'); // 0 新建 1 修改 2 查看
|
||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
@ -194,16 +195,16 @@
|
|||||||
{ title: t('提气日期'), dataIndex: 'dateMea', width: 130},
|
{ title: t('提气日期'), dataIndex: 'dateMea', width: 130},
|
||||||
{ title: t('客户'), dataIndex: 'cuName', width: 200},
|
{ title: t('客户'), dataIndex: 'cuName', width: 200},
|
||||||
{ title: t('下载点'), dataIndex: 'pointDelyName',width: 150 },
|
{ title: t('下载点'), dataIndex: 'pointDelyName',width: 150 },
|
||||||
{ title: t('完成量(吉焦)'), dataIndex: 'qtyMeaGj', width: 120},
|
{ title: t('完成量(吉焦)'), dataIndex: 'qtyMeaGj', width: 150},
|
||||||
{ title: t('完成量(方)'), dataIndex: 'qtyMeaM3', width: 120},
|
{ title: t('完成量(方)'), dataIndex: 'qtyMeaM3', width: 120},
|
||||||
{ title: t('结算量(吉焦)'), dataIndex: 'qtySettleGj', width: 120},
|
{ title: t('结算量(吉焦)'), dataIndex: 'qtySettleGj', width: 140},
|
||||||
{ title: t('结算量(方)'), dataIndex: 'qtySettleM3', width: 120},
|
{ title: t('结算量(方)'), dataIndex: 'qtySettleM3', width: 130},
|
||||||
{ title: t('结算价格(元/吉焦)'), dataIndex: 'priceGj', width: 120},
|
{ title: t('结算价格(元/吉焦)'), dataIndex: 'priceGj', width: 190},
|
||||||
{ title: t('结算价格(元/方)'), dataIndex: 'priceM3', width: 120},
|
{ title: t('结算价格(元/方)'), dataIndex: 'priceM3', width: 170},
|
||||||
{ title: t('结算金额(元)'), dataIndex: 'amount', width: 120},
|
{ title: t('结算金额(元)'), dataIndex: 'amount', width: 140},
|
||||||
{ title: t('价格组成'), dataIndex: 'priceDesc', width: 120},
|
{ title: t('价格组成'), dataIndex: 'priceDesc', width: 120},
|
||||||
{ title: t('合同名称'), dataIndex: 'kName', width: 120},
|
{ title: t('合同名称'), dataIndex: 'ksName', width: 170},
|
||||||
{ title: t('操作'), dataIndex: 'operation', width: 220},
|
{ title: t('操作'), dataIndex: 'operation', width: 100},
|
||||||
]);
|
]);
|
||||||
watch(
|
watch(
|
||||||
() => props.id,
|
() => props.id,
|
||||||
@ -246,11 +247,30 @@
|
|||||||
try {
|
try {
|
||||||
let data = await getLngPngSettleHdr(id)
|
let data = await getLngPngSettleHdr(id)
|
||||||
spinning.value = false
|
spinning.value = false
|
||||||
Object.assign(formState, {...data})
|
let a = DataFormat.format({...data}, [
|
||||||
|
FormatOption.createQty('qtySettleGj'),
|
||||||
|
FormatOption.createQty('qtySettleM3'),
|
||||||
|
FormatOption.createAmt('amount'),
|
||||||
|
]);
|
||||||
|
Object.assign(formState, a)
|
||||||
Object.assign(dataFile.value, formState.lngFileUploadList || [])
|
Object.assign(dataFile.value, formState.lngFileUploadList || [])
|
||||||
|
Object.assign(dataFileAccount.value, formState.billList || [])
|
||||||
|
Object.assign(dataList.value, formState.lngPngSettleSalesList || [])
|
||||||
|
formState.settleMonth = formState.settleMonth ? dayjs(formState.settleMonth) : null
|
||||||
formState.dateFrom = formState.dateFrom ? dayjs(formState.dateFrom) : null
|
formState.dateFrom = formState.dateFrom ? dayjs(formState.dateFrom) : null
|
||||||
formState.dateTo = formState.dateTo ? dayjs(formState.dateTo) : null
|
formState.dateTo = formState.dateTo ? dayjs(formState.dateTo) : null
|
||||||
|
|
||||||
|
|
||||||
|
dataList.value = DataFormat.format(dataList.value, [
|
||||||
|
FormatOption.createQty('qtySettleGj'),
|
||||||
|
FormatOption.createQty('qtySettleM3'),
|
||||||
|
FormatOption.createQty('qtyMeaGj'),
|
||||||
|
FormatOption.createQty('qtyMeaM3'),
|
||||||
|
FormatOption.createAmt('amount'),
|
||||||
|
FormatOption.createQty('priceGj',4),
|
||||||
|
FormatOption.createQty('priceM3',4),
|
||||||
|
]);
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error, 'error')
|
console.log(error, 'error')
|
||||||
spinning.value = false
|
spinning.value = false
|
||||||
@ -295,7 +315,15 @@
|
|||||||
}
|
}
|
||||||
const handleBtn = (type) => {
|
const handleBtn = (type) => {
|
||||||
if (type === 'add') {
|
if (type === 'add') {
|
||||||
openModalMeasure(true,{isUpdate: false})
|
if (!formState.cpCode || !formState.comId) {
|
||||||
|
message.warn('请选择客户和交易主体')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let obj = {
|
||||||
|
cpCode: formState.cpCode,
|
||||||
|
comId: formState.comId
|
||||||
|
}
|
||||||
|
openModalMeasure(true,{isUpdate: false, searchParams: obj})
|
||||||
} else {
|
} else {
|
||||||
if (!selectedKeys.value.length) {
|
if (!selectedKeys.value.length) {
|
||||||
message.warn('请选择删除数据')
|
message.warn('请选择删除数据')
|
||||||
@ -334,16 +362,20 @@
|
|||||||
let qtySettleGj = 0
|
let qtySettleGj = 0
|
||||||
let qtySettleM3 = 0
|
let qtySettleM3 = 0
|
||||||
let amount = 0
|
let amount = 0
|
||||||
|
let idx = dataList.value.findIndex(v =>v.salesId == curRecord.salesId)
|
||||||
arr.forEach(v=> {
|
arr.forEach(v=> {
|
||||||
qtySettleGj+=Number(v.qtySettleGj) || 0
|
qtySettleGj+=Number(v.qtySettleGj) || 0
|
||||||
qtySettleM3+=Number(v.qtySettleM3) || 0
|
qtySettleM3+=Number(v.qtySettleM3) || 0
|
||||||
amount+=Number(v.amount) || 0
|
amount+=Number(v.amount) || 0
|
||||||
|
if (!pageId.value &&idx>-1&& !(dataList.value[idx].lngPngSettleSalesDtlList || []).length) {
|
||||||
|
v.id = ''
|
||||||
|
}
|
||||||
})
|
})
|
||||||
// price_gj=amount/qty_settle_gj,保留4位小数
|
// price_gj=amount/qty_settle_gj,保留4位小数
|
||||||
// price_m3=amount/qty_settle_m3,保留4位小数
|
// price_m3=amount/qty_settle_m3,保留4位小数
|
||||||
let priceGj = qtySettleGj ? Number(amount) / Number(qtySettleGj) : '0'
|
let priceGj = qtySettleGj ? Number(amount) / Number(qtySettleGj) : '0'
|
||||||
let priceM3 = qtySettleM3 ? Number(amount) / Number(qtySettleM3) : '0'
|
let priceM3 = qtySettleM3 ? Number(amount) / Number(qtySettleM3) : '0'
|
||||||
let idx = dataList.value.findIndex(v =>v.salesId == curRecord.salesId)
|
|
||||||
if (idx > -1) {
|
if (idx > -1) {
|
||||||
dataList.value[idx].qtySettleGj = qtySettleGj.toFixed(3)
|
dataList.value[idx].qtySettleGj = qtySettleGj.toFixed(3)
|
||||||
dataList.value[idx].qtySettleM3 = qtySettleM3.toFixed(3)
|
dataList.value[idx].qtySettleM3 = qtySettleM3.toFixed(3)
|
||||||
@ -374,7 +406,7 @@
|
|||||||
}
|
}
|
||||||
const handleSuccessCustomer = (val) => {
|
const handleSuccessCustomer = (val) => {
|
||||||
formState.cpCode = val[0].cuCode
|
formState.cpCode = val[0].cuCode
|
||||||
formState.cpName = val[0].cuName
|
formState.cpName = val[0].cuSname
|
||||||
getDate()
|
getDate()
|
||||||
}
|
}
|
||||||
function close() {
|
function close() {
|
||||||
|
|||||||
@ -18,6 +18,11 @@
|
|||||||
<template v-if="column.dataIndex === 'action'">
|
<template v-if="column.dataIndex === 'action'">
|
||||||
<TableAction :actions="getActions(record)" />
|
<TableAction :actions="getActions(record)" />
|
||||||
</template>
|
</template>
|
||||||
|
<template v-if="column.dataIndex === 'lngFileUploadList'">
|
||||||
|
<div v-for="(item, idx) in record.lngFileUploadList">
|
||||||
|
<a @click="handleDownload(item)">{{item.fileOrg}}</a>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</BasicTable>
|
</BasicTable>
|
||||||
<PngSettleHdrModal @register="registerModal" @success="handleSuccess" />
|
<PngSettleHdrModal @register="registerModal" @success="handleSuccess" />
|
||||||
@ -49,6 +54,7 @@
|
|||||||
import ApprovalProcess from '/@/views/workflow/task/components/ApprovalProcess.vue';
|
import ApprovalProcess from '/@/views/workflow/task/components/ApprovalProcess.vue';
|
||||||
import { getDraftInfo } from '/@/api/workflow/process';
|
import { getDraftInfo } from '/@/api/workflow/process';
|
||||||
import { isValidJSON } from '/@/utils/event/design';
|
import { isValidJSON } from '/@/utils/event/design';
|
||||||
|
import { downloadByUrl } from '/@/utils/file/download';
|
||||||
|
|
||||||
import PngSettleHdrModal from './components/PngSettleHdrModal.vue';
|
import PngSettleHdrModal from './components/PngSettleHdrModal.vue';
|
||||||
import {formConfig, searchFormSchema, columns } from './components/config';
|
import {formConfig, searchFormSchema, columns } from './components/config';
|
||||||
@ -57,6 +63,9 @@
|
|||||||
import { DataFormat, FormatOption, DATE_FORMAT, FormatType } from '/@/utils/dataFormat';
|
import { DataFormat, FormatOption, DATE_FORMAT, FormatType } from '/@/utils/dataFormat';
|
||||||
import useEventBus from '/@/hooks/event/useEventBus';
|
import useEventBus from '/@/hooks/event/useEventBus';
|
||||||
import { cloneDeep } from 'lodash-es';
|
import { cloneDeep } from 'lodash-es';
|
||||||
|
import { useUserStore } from '/@/store/modules/user';
|
||||||
|
const userStore = useUserStore();
|
||||||
|
const userInfo = userStore.getUserInfo;
|
||||||
|
|
||||||
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
|
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
|
||||||
|
|
||||||
@ -72,7 +81,7 @@
|
|||||||
|
|
||||||
const tableRef = ref();
|
const tableRef = ref();
|
||||||
//所有按钮
|
//所有按钮
|
||||||
const buttons = ref([{"isUse":true,"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"type":"primary"},{"isUse":true,"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true},{"isUse":true,"name":"生成对账单","code":"check","icon":"ant-design:check-outlined","isDefault":true},{"isUse":true,"name":"取消结算","code":"cancel","icon":"ant-design:close-outlined","isDefault":false},{"isUse":true,"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true},{"isUse":true,"name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true},{"isUse":true,"name":"发起审批","code":"startwork","icon":"ant-design:form-outlined","isDefault":true},{"isUse":true,"name":"查看流转记录","code":"flowRecord","icon":"ant-design:form-outlined","isDefault":true},{"isUse":true,"name":"审批","code":"approve","icon":"ant-design:check-outlined","isDefault":true},{"isUse":true,"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true}]);
|
const buttons = ref([{"isUse":true,"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"type":"primary"},{"isUse":true,"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true},{"isUse":true,"name":"生成对账单","code":"check","icon":"ant-design:check-outlined","isDefault":true},{"isUse":true,"name":"取消结算","code":"cancel","icon":"ant-design:close-outlined","isDefault":false},{"isUse":true,"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true},{"isUse":true,"name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true},{"isUse":true,"name":"发起审批","code":"startwork","icon":"ant-design:form-outlined","isDefault":true},{"isUse":true,"name":"查看流转记录","code":"flowRecord","icon":"ant-design:form-outlined","isDefault":true},{"isUse":true,"name":"审批","code":"approve","icon":"ant-design:check-outlined","isDefault":true},{"isUse":true,"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true},{"name":"数据日志","code":"datalog","icon":"ant-design:profile-outlined","isDefault":true,"isUse":true}]);
|
||||||
//展示在列表内的按钮
|
//展示在列表内的按钮
|
||||||
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord','approve']);
|
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord','approve']);
|
||||||
const buttonConfigs = computed(()=>{
|
const buttonConfigs = computed(()=>{
|
||||||
@ -87,7 +96,7 @@
|
|||||||
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
|
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
|
||||||
});
|
});
|
||||||
|
|
||||||
const btnEvent = {add : handleAdd,edit : handleEdit,refresh : handleRefresh,view : handleView,startwork : handleStartwork,flowRecord : handleFlowRecord,approve : handleApprove,delete : handleDelete,}
|
const btnEvent = {add : handleAdd,edit : handleEdit,refresh : handleRefresh,view : handleView,startwork : handleStartwork,flowRecord : handleFlowRecord,approve : handleApprove,delete : handleDelete,datalog : handleDatalog}
|
||||||
|
|
||||||
const { currentRoute } = useRouter();
|
const { currentRoute } = useRouter();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@ -107,6 +116,7 @@
|
|||||||
|
|
||||||
const visibleApproveProcessRef = ref(false);
|
const visibleApproveProcessRef = ref(false);
|
||||||
const taskIdRef = ref('');
|
const taskIdRef = ref('');
|
||||||
|
const selectedKeys = ref([])
|
||||||
const visibleFlowRecordModal = ref(false);
|
const visibleFlowRecordModal = ref(false);
|
||||||
const [registerModal, { openModal }] = useModal();
|
const [registerModal, { openModal }] = useModal();
|
||||||
const formName=currentRoute.value.meta?.title
|
const formName=currentRoute.value.meta?.title
|
||||||
@ -141,6 +151,14 @@
|
|||||||
dataIndex: 'action',
|
dataIndex: 'action',
|
||||||
slots: { customRender: 'action' },
|
slots: { customRender: 'action' },
|
||||||
},
|
},
|
||||||
|
rowSelection: {
|
||||||
|
type: 'checkbox',
|
||||||
|
onChange: onSelectChange,
|
||||||
|
getCheckboxProps: (record) => ({
|
||||||
|
disabled: record.approCode !== 'YSP',
|
||||||
|
name: record.name,
|
||||||
|
}),
|
||||||
|
},
|
||||||
tableSetting: {
|
tableSetting: {
|
||||||
size: false,
|
size: false,
|
||||||
setting: false,
|
setting: false,
|
||||||
@ -166,6 +184,14 @@
|
|||||||
deep: true,
|
deep: true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const handleDownload = (info) => {
|
||||||
|
const url = parseDownloadUrl(info.response ? info.response.data.fileUrl : info.fileUrl);
|
||||||
|
const fileName = info.response ? info.response.data.fileOrg : info.fileOrg;
|
||||||
|
downloadByUrl({ url, fileName: fileName});
|
||||||
|
};
|
||||||
|
function onSelectChange(rowKeys: string[]) {
|
||||||
|
selectedKeys.value = rowKeys;
|
||||||
|
}
|
||||||
function dbClickRow(record) {
|
function dbClickRow(record) {
|
||||||
if (!actionButtonConfig?.value.some(element => element.code == 'view')) {
|
if (!actionButtonConfig?.value.some(element => element.code == 'view')) {
|
||||||
return;
|
return;
|
||||||
@ -177,7 +203,9 @@
|
|||||||
query: {
|
query: {
|
||||||
taskId: taskIds[0],
|
taskId: taskIds[0],
|
||||||
formName: formName,
|
formName: formName,
|
||||||
formId:currentRoute.value.meta.formId
|
formId:currentRoute.value.meta.formId,
|
||||||
|
id: record.id,
|
||||||
|
readonly: 1,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (schemaId && !taskIds && processId) {
|
} else if (schemaId && !taskIds && processId) {
|
||||||
@ -187,18 +215,32 @@
|
|||||||
readonly: 1,
|
readonly: 1,
|
||||||
taskId: '',
|
taskId: '',
|
||||||
formName: formName,
|
formName: formName,
|
||||||
formId:currentRoute.value.meta.formId
|
formId:currentRoute.value.meta.formId,
|
||||||
|
id: record.id,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
router.push({
|
if (schemaIdComputedRef.value) {
|
||||||
path: '/form/PngSettleHdr/' + record.id + '/viewForm',
|
router.push({
|
||||||
query: {
|
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow',
|
||||||
formPath: 'dayPlan/PngSettleHdr',
|
query: {
|
||||||
formName: formName,
|
formPath: 'dayPlan/PngSettleHdr',
|
||||||
formId:currentRoute.value.meta.formId
|
formName: "查看"+formName,
|
||||||
}
|
formId:currentRoute.value.meta.formId,
|
||||||
});
|
type:'edit',
|
||||||
|
id: record.id,
|
||||||
|
disabled: 1,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// router.push({
|
||||||
|
// path: '/form/PngSettleHdr/' + record.id + '/viewForm',
|
||||||
|
// query: {
|
||||||
|
// formPath: 'dayPlan/PngSettleHdr',
|
||||||
|
// formName: formName,
|
||||||
|
// formId:currentRoute.value.meta.formId
|
||||||
|
// }
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,18 +275,42 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleEdit(record: Recordable) {
|
function handleEdit(record: Recordable) {
|
||||||
|
if (schemaIdComputedRef.value) {
|
||||||
router.push({
|
router.push({
|
||||||
path: '/form/PngSettleHdr/' + record.id + '/updateForm',
|
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow',
|
||||||
query: {
|
query: {
|
||||||
formPath: 'dayPlan/PngSettleHdr',
|
formPath: 'dayPlan/PngSettleHdr',
|
||||||
formName: formName,
|
formName: "编辑"+formName,
|
||||||
formId:currentRoute.value.meta.formId
|
formId:currentRoute.value.meta.formId,
|
||||||
}
|
type:'edit',
|
||||||
});
|
id: record.id
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
router.push({
|
||||||
|
path: '/form/PngSettleHdr/' + record.id + '/updateForm',
|
||||||
|
query: {
|
||||||
|
formPath: 'dayPlan/PngSettleHdr',
|
||||||
|
formName: formName,
|
||||||
|
formId:currentRoute.value.meta.formId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
function handleApprove () {
|
function handleApprove () {
|
||||||
|
const { processId, taskIds, schemaId } = record.workflowData || {};
|
||||||
|
if (taskIds && taskIds.length) {
|
||||||
|
router.push({
|
||||||
|
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
|
||||||
|
query: {
|
||||||
|
taskId: taskIds[0],
|
||||||
|
formName: "审批"+formName,
|
||||||
|
formId:currentRoute.value.meta.formId,
|
||||||
|
id: record.id
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function handleDelete(record: Recordable) {
|
function handleDelete(record: Recordable) {
|
||||||
deleteList([record.id]);
|
deleteList([record.id]);
|
||||||
@ -305,9 +371,10 @@
|
|||||||
|
|
||||||
let actionsList: ActionItem[] = [];
|
let actionsList: ActionItem[] = [];
|
||||||
let editAndDelBtn: ActionItem[] = [];
|
let editAndDelBtn: ActionItem[] = [];
|
||||||
let hasFlowRecord = false;
|
let approveBtn: ActionItem[] = [];
|
||||||
|
let hasFlowRecord = false;
|
||||||
actionButtonConfig.value?.map((button) => {
|
actionButtonConfig.value?.map((button) => {
|
||||||
if (['view', 'copyData'].includes(button.code)) {
|
if (['view', 'copyData','datalog'].includes(button.code)) {
|
||||||
actionsList.push({
|
actionsList.push({
|
||||||
icon: button?.icon,
|
icon: button?.icon,
|
||||||
tooltip: button?.name,
|
tooltip: button?.name,
|
||||||
@ -322,21 +389,41 @@
|
|||||||
onClick: btnEvent[button.code].bind(null, record),
|
onClick: btnEvent[button.code].bind(null, record),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (['approve'].includes(button.code)) {
|
||||||
|
approveBtn.push({
|
||||||
|
icon: button?.icon,
|
||||||
|
tooltip: button?.name,
|
||||||
|
onClick: btnEvent[button.code].bind(null, record),
|
||||||
|
});
|
||||||
|
}
|
||||||
if (button.code === 'flowRecord') hasFlowRecord = true;
|
if (button.code === 'flowRecord') hasFlowRecord = true;
|
||||||
});
|
});
|
||||||
if (record.workflowData?.enabled) {
|
// 未提交或已驳回
|
||||||
//与工作流有关联的表单
|
if (record.approCode == 'WTJ' || record.approCode == 'YBH' ) {
|
||||||
if (record.workflowData.status) {
|
actionsList = actionsList.concat(editAndDelBtn);
|
||||||
actionsList.unshift(setIndexFlowStatus(record.workflowData))
|
|
||||||
} else {
|
if (record.createUserId !== userInfo.id) {
|
||||||
actionsList = actionsList.concat(editAndDelBtn);
|
let idx = actionsList.findIndex(v =>v.tooltip == '删除')
|
||||||
}
|
idx > -1 && actionsList.splice(idx, 1)
|
||||||
} else {
|
|
||||||
if (!record.workflowData?.processId) {
|
|
||||||
//与工作流没有关联的表单并且在当前页面新增的数据 如选择编辑、删除按钮则加上
|
|
||||||
actionsList = actionsList.concat(editAndDelBtn);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 审批中SPZ
|
||||||
|
if (record.workflowData?.editable) {
|
||||||
|
actionsList = actionsList.concat(approveBtn);
|
||||||
|
}
|
||||||
|
// if (record.workflowData?.enabled) {
|
||||||
|
// //与工作流有关联的表单
|
||||||
|
// if (record.workflowData.status) {
|
||||||
|
// actionsList.unshift(setIndexFlowStatus(record.workflowData))
|
||||||
|
// } else {
|
||||||
|
// actionsList = actionsList.concat(editAndDelBtn);
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// if (!record.workflowData?.processId) {
|
||||||
|
// //与工作流没有关联的表单并且在当前页面新增的数据 如选择编辑、删除按钮则加上
|
||||||
|
// actionsList = actionsList.concat(editAndDelBtn);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
return actionsList;
|
return actionsList;
|
||||||
}
|
}
|
||||||
function handleStartwork(record: Recordable) {
|
function handleStartwork(record: Recordable) {
|
||||||
|
|||||||
Reference in New Issue
Block a user