This commit is contained in:
2026-02-12 09:50:08 +08:00
12 changed files with 2191 additions and 42 deletions

View File

@ -0,0 +1,90 @@
import { LngPngSettleHdrPageModel, LngPngSettleHdrPageParams, LngPngSettleHdrPageResult } from './model/PngSettleHdrPurModel';
import { defHttp } from '/@/utils/http/axios';
import { ErrorMessageMode } from '/#/axios';
enum Api {
Page = '/dayPlan/pngSettleHdrPur/page',
List = '/dayPlan/pngSettleHdrPur/list',
Info = '/dayPlan/pngSettleHdrPur/info',
LngPngSettleHdr = '/dayPlan/pngSettleHdrPur',
DataLog = '/dayPlan/pngSettleHdrPur/datalog',
}
/**
* @description: 查询LngPngSettleHdr分页列表
*/
export async function getLngPngSettleHdrPage(params: LngPngSettleHdrPageParams, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngPngSettleHdrPageResult>(
{
url: Api.Page,
params,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 获取LngPngSettleHdr信息
*/
export async function getLngPngSettleHdr(id: String, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngPngSettleHdrPageModel>(
{
url: Api.Info,
params: { id },
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 新增LngPngSettleHdr
*/
export async function addLngPngSettleHdr(lngPngSettleHdr: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.post<boolean>(
{
url: Api.LngPngSettleHdr,
params: lngPngSettleHdr,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 更新LngPngSettleHdr
*/
export async function updateLngPngSettleHdr(lngPngSettleHdr: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.put<boolean>(
{
url: Api.LngPngSettleHdr,
params: lngPngSettleHdr,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 删除LngPngSettleHdr批量删除
*/
export async function deleteLngPngSettleHdr(ids: string[], mode: ErrorMessageMode = 'modal') {
return defHttp.delete<boolean>(
{
url: Api.LngPngSettleHdr,
data: ids,
},
{
errorMessageMode: mode,
},
);
}

View File

@ -0,0 +1,238 @@
import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
/**
* @description: LngPngSettleHdr分页参数 模型
*/
export interface LngPngSettleHdrPageParams extends BasicPageParams {
id: string;
settleMonthStart: string;
settleMonthEnd: string;
dateFromStart: string;
dateFromEnd: string;
dateToStart: string;
dateToEnd: string;
cpCode: string;
settleDesc: string;
qtySettleGj: string;
qtySettleM3: string;
amount: string;
note: string;
approCode: string;
}
/**
* @description: LngPngSettleHdr分页返回值模型
*/
export interface LngPngSettleHdrPageModel {
id: string;
settleMonth: string;
dateFrom: string;
dateTo: string;
cpCode: string;
settleDesc: string;
qtySettleGj: string;
qtySettleM3: string;
amount: string;
note: string;
approCode: string;
}
/**
* @description: LngPngSettleHdr表类型
*/
export interface LngPngSettleHdrModel {
id: number;
settleMonth: string;
dateFrom: string;
dateTo: string;
settleTypeCode: string;
cpCode: string;
comId: number;
qtySettleGj: number;
qtySettleM3: number;
amount: number;
rpSign: string;
billAccount: string;
approCode: string;
settleDesc: string;
note: string;
createUserId: number;
createDate: string;
modifyUserId: number;
modifyDate: string;
tenantId: number;
deptId: number;
ruleUserId: number;
lngPngSettlePurList?: LngPngSettlePurModel;
lngPngSettlePurDtlList?: LngPngSettlePurDtlModel;
}
/**
* @description: LngPngSettlePur表类型
*/
export interface LngPngSettlePurModel {
id: number;
settleHdrId: number;
salesId: number;
salesPurId: number;
meaId: number;
settleMonth: string;
settleTypeCode: string;
datePlan: string;
dateMea: string;
suCode: string;
kpId: number;
kpppId: number;
pointUpCode: string;
uomCode: string;
cuCode: string;
ksId: number;
ksppId: number;
pointDelyCode: string;
rateM3Gj: number;
qtyMeaGj: number;
qtyMeaM3: number;
qtySettleGj: number;
qtySettleM3: number;
priceGj: number;
priceM3: number;
amount: number;
priceDesc: string;
settleTimes: number;
note: string;
createUserId: number;
createDate: string;
modifyUserId: number;
modifyDate: string;
tenantId: number;
deptId: number;
ruleUserId: number;
}
/**
* @description: LngPngSettlePurDtl表类型
*/
export interface LngPngSettlePurDtlModel {
id: number;
settleId: number;
priceCode: string;
sort: number;
uomCode: string;
rateQtyGj: number;
rateQtyM3: number;
rateM3Gj: number;
qtySettleGj: number;
qtySettleM3: number;
priceM3: number;
amount: number;
note: string;
createUserId: number;
createDate: string;
modifyUserId: number;
modifyDate: string;
tenantId: number;
deptId: number;
ruleUserId: number;
}
/**
* @description: LngPngSettleHdr分页返回值结构
*/
export type LngPngSettleHdrPageResult = BasicFetchResult<LngPngSettleHdrPageModel>;

View File

@ -9,12 +9,12 @@
<template v-if="column.dataIndex === 'settledSign'">
{{ Number(record.settledSign) == 1 ? '已结算': '未结算' }}
</template>
</template>
<template v-if="column.dataIndex === 'file'">
<div v-for="item in (record.lngFileUploadList )" class="fileCSS">
<a @click="handleDownload(item)">{{item.fileOrg}}</a>
</div>
</template>
</template>
</BasicTable>
</div>
</BasicModal>
@ -57,7 +57,7 @@
{ dataIndex: 'qtyMeaM3', title: '完成量(方)', align: 'left',width: 120},
{ dataIndex: 'rateM3Gj', title: '比值(方/吉焦)', align: 'left',width: 120},
{ dataIndex: 'ksName', title: '销售合同', align: 'left',},
{ dataIndex: 'file', title: '附件', align: 'left',},
{ dataIndex: 'file', title: '附件', align: 'left',width: 200},
{ dataIndex: 'settledSign', title: '已结算', align: 'left',width: 100},
];
@ -102,6 +102,16 @@
},
afterFetch: (res) => {
tableData.value = res || []
tableData.value.forEach(v => {
let a = v.attachList ? v.attachList.split(',') : []
v.lngFileUploadList = []
a.forEach(k => {
v.lngFileUploadList.push({
fileOrg: k.split('@')[0],
fileUrl: k.split('@')[1]
})
})
})
},
rowSelection: {
type: props.selectType,

View File

@ -43,8 +43,8 @@
{ title: t('价格描述'), dataIndex: 'priceDesc', width:130},
{ title: t('数量(吉焦)'), dataIndex: 'qtySettleGj', width: 120},
{ title: t('数量(方)'), dataIndex: 'qtySettleM3', width: 120},
{ title: t('价格(元/方)'), dataIndex: 'priceM3', width: 120},
{ title: t('价格(元/吉焦)'), dataIndex: 'priceGj', width: 120},
{ title: t('价格(元/方)'), dataIndex: 'priceM3', width: 120},
{ title: t('金额(元)'), dataIndex: 'amount', width: 120},
];

View File

@ -294,6 +294,14 @@ export const PAGE_CUSTOM_ROUTE: AppRouteRecordRaw[] = [{
title: (route) => route.query.formName
}
},
{
path: '/contract/ContractSales/viewForm',
name: 'ContractSalesviewForm',
component: () => import('/@/views/contract/ContractSales/components/createForm.vue'),
meta: {
title: (route) => ('管道气销售合同详情')
}
},
]

View File

@ -1,6 +1,6 @@
<template>
<a-spin :spinning="spinning" tip="加载中...">
<div class="page-bg-wrap formViewStyle">
<div class="page-bg-wrap formViewStyle" :class="isViewForm ? 'viewPage':''">
<a-form ref="formRef" :model="formState" :rules="rules" v-bind="layout">
<Card title="合同档案" :bordered="false" >
<a-row>
@ -230,7 +230,7 @@
const formId = ref(currentRoute.value?.params?.id);
const pageType = ref(currentRoute.value.query?.type);
const pageId = ref(currentRoute.value.query?.id)
const isViewForm = currentRoute.value.path.includes('viewForm')
const contractQty = ref()
const spinning = ref(false);
const curIdx = ref(null)
@ -332,6 +332,9 @@
getOption()
if (pageId.value) {
getInfo(pageId.value)
if (currentRoute.value.query?.disabled) {
isDisable.value = true
}
} else {
formState.empName = userInfo.name
formState.empId = userInfo.id
@ -688,5 +691,7 @@
padding: 10px;
margin-bottom: 10px;
}
.viewPage {
padding: 6px 12px !important;
}
</style>

View File

@ -79,11 +79,15 @@
</a-row>
</Card>
<Card>
<div>
<div class="btnBox">
<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>
<span>一次结算量吉焦</span>
<span>二次结算量吉焦</span>
<span>结算总量(吉焦)</span>
<span>结算总金额</span>
</div>
<a-table :columns="columns" :data-source="dataList" :scroll="{x: 1500}" rowKey="salesId" :pagination="false" :row-selection="{ selectedRowKeys: selectedKeys, onChange: onSelectChange }">
<a-table :columns="columns" :data-source="dataList" :scroll="{x: 1800}" rowKey="salesId" :pagination="false" :row-selection="{ selectedRowKeys: selectedKeys, onChange: onSelectChange }">
<template #bodyCell="{ column, record, index }">
<template v-if="column.dataIndex === 'operation'">
<a v-if="!isDisable" @click="btnCheck(record, index, 'delete')">删除</a>
@ -91,6 +95,9 @@
<template v-if="column.dataIndex === 'priceDesc'">
<a @click="btnCheck(record, index, 'price')">{{record.priceDesc}}</a>
</template>
<template v-if="column.dataIndex === 'ksName'">
<a @click="btnCheck(record, index, 'ksName')">{{record.ksName}}</a>
</template>
</template>
</a-table>
</Card>
@ -191,20 +198,20 @@
const selectedKeys = ref([])
const columns = ref([
{ title: t('序号'), dataIndex: 'index', key: 'index', customRender: (column) => `${column.index + 1}` ,width: 80},
{ title: t('计划日期'), dataIndex: 'datePlan', width:130},
{ title: t('提气日期'), dataIndex: 'dateMea', width: 130},
{ title: t('客户'), dataIndex: 'cuName', width: 200},
{ title: t('计划日期'), dataIndex: 'datePlan', width:120},
{ title: t('提气日期'), dataIndex: 'dateMea', width: 120},
{ title: t('合同名称'), dataIndex: 'ksName', width: 200},
{ title: t('下载点'), dataIndex: 'pointDelyName',width: 150 },
{ title: t('完成量(吉焦)'), dataIndex: 'qtyMeaGj', width: 150},
{ title: t('完成量(方)'), dataIndex: 'qtyMeaM3', width: 120},
{ title: t('结算量(吉焦)'), dataIndex: 'qtySettleGj', width: 140},
{ title: t('结算量(方)'), dataIndex: 'qtySettleM3', width: 130},
{ title: t('结算价格(元/吉焦)'), dataIndex: 'priceGj', width: 190},
{ title: t('结算价格(元/吉焦)'), dataIndex: 'priceGj', width: 180},
{ title: t('结算价格(元/方)'), dataIndex: 'priceM3', width: 170},
{ title: t('结算金额(元)'), dataIndex: 'amount', width: 140},
{ title: t('价格组成'), dataIndex: 'priceDesc', width: 120},
{ title: t('合同名称'), dataIndex: 'ksName', width: 170},
{ title: t('操作'), dataIndex: 'operation', width: 100},
{ title: t('价格组成'), dataIndex: 'priceDesc', width: 180},
{ title: t('结算次数'), dataIndex: 'settleTimes', width: 100},
{ title: t('操作'), dataIndex: 'operation', width: 80},
]);
watch(
() => props.id,
@ -247,20 +254,20 @@
try {
let data = await getLngPngSettleHdr(id)
spinning.value = false
let a = DataFormat.format({...data}, [
FormatOption.createQty('qtySettleGj'),
FormatOption.createQty('qtySettleM3'),
FormatOption.createAmt('amount'),
]);
Object.assign(formState, a)
Object.assign(formState, {...data})
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.dateTo = formState.dateTo ? dayjs(formState.dateTo) : null
numFormat()
} catch (error) {
console.log(error, 'error')
spinning.value = false
}
}
const numFormat = () => {
dataList.value = DataFormat.format(dataList.value, [
FormatOption.createQty('qtySettleGj'),
FormatOption.createQty('qtySettleM3'),
@ -270,11 +277,19 @@
FormatOption.createQty('priceGj',4),
FormatOption.createQty('priceM3',4),
]);
} catch (error) {
console.log(error, 'error')
spinning.value = false
let obj = {
qtySettleGj: formState.qtySettleGj,
qtySettleM3: formState.qtySettleM3,
amount: formState.amount
}
let a = DataFormat.format({...obj}, [
FormatOption.createQty('qtySettleGj'),
FormatOption.createQty('qtySettleM3'),
FormatOption.createAmt('amount'),
]);
formState.qtySettleGj = a.qtySettleGj
formState.qtySettleM3 = a.qtySettleM3
formState.amount = a.amount
}
const comIdChange = (val) => {
if (!val)return
@ -288,7 +303,7 @@
if (!pageId.value && formState.cpCode && formState.comId && !formState.dateFrom) {
let data = await getLngPngSettleHdrDate(obj) || []
if (data.length) {
formState.dateFrom = data[0]
formState.dateFrom = data[0]?.dateTo ? dayjs(data[0]?.dateTo) : null
formState.dateTo = null
}
}
@ -335,28 +350,48 @@
});
setTimeout(() => {
selectedKeys.value = []
}, 8000);
numClear()
}, 1000);
}
}
const numClear = () => {
if (!dataList.value.length) {
formState.qtySettleGj = ''
formState.qtySettleM3 = ''
formState.amount = ''
}
}
const handleSuccessMeasure = (val) => {
val.forEach(i =>{
delete i.lngFileUploadList
})
if (!dataList.value.length) {
dataList.value = val
return
}
val.forEach(v=> {
dataList.value.forEach(k=> {
if (v.salesId!==k.salesId) {
dataList.value.push(v)
}
})
let idx = dataList.value.findIndex(k=>k.salesId==v.salesId)
idx<0&&dataList.value.push(v)
})
}
const btnCheck = (record, index, type) => {
if (type == 'delete') {
dataList.value.splice(index, 1)
} else {
numClear()
}
if (type == 'price'){
openModalPrice(true,{isUpdate: false, record,isDisable: isDisable.value})
}
if (type == 'ksName'){
router.push({
path: '/contract/ContractSales/viewForm',
query: {
formPath: 'dayPlan/PngSettleHdr',
id: record.ksId,
disabled: true
}
});
}
}
const handleSuccessPrice = (arr, curRecord) => {
let qtySettleGj = 0
@ -367,7 +402,7 @@
qtySettleGj+=Number(v.qtySettleGj) || 0
qtySettleM3+=Number(v.qtySettleM3) || 0
amount+=Number(v.amount) || 0
if (!pageId.value &&idx>-1&& !(dataList.value[idx].lngPngSettleSalesDtlList || []).length) {
if (idx>-1&&!dataList.value[idx].id) {
v.id = ''
}
})
@ -400,6 +435,7 @@
formState.qtySettleGj = qtySettleGj.toFixed(3)
formState.qtySettleM3 = qtySettleM3.toFixed(3)
formState.amount = amount.toFixed(2)
numFormat()
}
const onSearchCustomer = () => {
openModalCustomer(true,{isUpdate: false})
@ -481,5 +517,9 @@
margin-bottom: 12px;
border-bottom: 1px solid #eee;
}
.btnBox {
span {
margin: 0 30px;
}
}
</style>

View File

@ -0,0 +1,224 @@
<template>
<SimpleForm
ref="systemFormRef"
:formProps="data.formDataProps"
:formModel="{}"
:isWorkFlow="props.fromPage!=FromPageType.MENU"
/>
</template>
<script lang="ts" setup>
import { reactive, ref,onBeforeMount,onMounted } from 'vue';
import { formProps, formEventConfigs ,formConfig} from './config';
import SimpleForm from '/@/components/SimpleForm/src/SimpleForm.vue';
import { addLngPngSettleHdr, getLngPngSettleHdr, updateLngPngSettleHdr, deleteLngPngSettleHdr } from '/@/api/dayPlan/PngSettleHdrPur';
import { cloneDeep } from 'lodash-es';
import { FormDataProps } from '/@/components/Designer/src/types';
import { usePermission } from '/@/hooks/web/usePermission';
import { useFormConfig } from '/@/hooks/web/useFormConfig';
import { FromPageType } from '/@/enums/workflowEnum';
import { createFormEvent, getFormDataEvent, loadFormEvent, submitFormEvent,} from '/@/hooks/web/useFormEvent';
import { changeWorkFlowForm, changeSchemaDisabled } from '/@/hooks/web/useWorkFlowForm';
import { WorkFlowFormParams } from '/@/model/workflow/bpmnConfig';
import { useRouter } from 'vue-router';
const { filterFormSchemaAuth } = usePermission();
const { mergeFormSchemas,mergeFormEventConfigs } = useFormConfig();
const { currentRoute } = useRouter();
const RowKey = 'id';
const emits = defineEmits(['changeUploadComponentIds','loadingCompleted', 'form-mounted']);
const props = defineProps({
fromPage: {
type: Number,
default: FromPageType.MENU,
},
});
const systemFormRef = ref();
const data: { formDataProps: FormDataProps } = reactive({
formDataProps: {schemas:[]} as FormDataProps,
});
const state = reactive({
formModel: {},
});
let customFormEventConfigs=[];
onMounted(async () => {
try {
// 合并渲染覆盖配置中的字段配置、表单事件配置
await mergeCustomFormRenderConfig();
if (props.fromPage == FromPageType.MENU) {
setMenuPermission();
await createFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:初始化表单
await loadFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:加载表单
} else if (props.fromPage == FromPageType.FLOW) {
emits('loadingCompleted'); //告诉系统表单已经加载完毕
// loadingCompleted后 工作流页面直接利用Ref调用setWorkFlowForm方法
} else if (props.fromPage == FromPageType.PREVIEW) {
// 预览 无需权限,表单事件也无需执行
} else if (props.fromPage == FromPageType.DESKTOP) {
// 桌面设计 表单事件需要执行
emits('loadingCompleted'); //告诉系统表单已经加载完毕
await createFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:初始化表单
await loadFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:加载表单
}
emits('form-mounted', formProps);
} catch (error) {
}
});
async function mergeCustomFormRenderConfig() {
let cloneProps=cloneDeep(formProps);
let fEventConfigs=cloneDeep(formEventConfigs);
if (formConfig.useCustomConfig) {
if(props.fromPage !== FromPageType.FLOW){
let formPath=currentRoute.value.query.formPath;
//1.合并字段配置
cloneProps.schemas=await mergeFormSchemas({formSchema:cloneProps.schemas!,formPath:formPath});
//2.合并表单事件配置
fEventConfigs=await mergeFormEventConfigs({formEventConfigs:fEventConfigs,formPath:formPath});
}
}
data.formDataProps=cloneProps;
customFormEventConfigs=fEventConfigs;
}
// 根据菜单页面权限,设置表单属性(必填,禁用,显示)
function setMenuPermission() {
data.formDataProps.schemas = filterFormSchemaAuth(data.formDataProps.schemas!);
}
// 校验form 通过返回表单数据
async function validate() {
let values = [];
try {
values = await systemFormRef.value?.validate();
//添加隐藏组件
if (data.formDataProps.hiddenComponent?.length) {
data.formDataProps.hiddenComponent.forEach((component) => {
values[component.bindField] = component.value;
});
}
} finally {
}
return values;
}
// 根据行唯一ID查询行数据并设置表单数据 【编辑】
async function setFormDataFromId(rowId, skipUpdate) {
try {
const record = await getLngPngSettleHdr(rowId);
if (skipUpdate) {
return record;
}
setFieldsValue(record);
state.formModel = record;
await getFormDataEvent(customFormEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:获取表单数据
return record;
} catch (error) {
}
}
// 辅助设置表单数据
function setFieldsValue(record) {
systemFormRef.value.setFieldsValue(record);
}
// 重置表单数据
async function resetFields() {
await systemFormRef.value.resetFields();
}
// 设置表单数据全部为Disabled 【查看】
async function setDisabledForm(isDisabled) {
data.formDataProps.schemas = changeSchemaDisabled(cloneDeep(data.formDataProps.schemas),isDisabled);
}
// 获取行键值
function getRowKey() {
return RowKey;
}
// 更新api表单数据
async function update({ values, rowId }) {
try {
values[RowKey] = rowId;
state.formModel = values;
let saveVal = await updateLngPngSettleHdr(values);
await submitFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:提交表单
return saveVal;
} catch (error) {}
}
// 新增api表单数据
async function add(values) {
try {
state.formModel = values;
let saveVal = await addLngPngSettleHdr(values);
await submitFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:提交表单
return saveVal;
} catch (error) {}
}
// 根据工作流页面权限,设置表单属性(必填,禁用,显示)
async function setWorkFlowForm(obj: WorkFlowFormParams) {
try {
const cloneProps=cloneDeep(formProps);
customFormEventConfigs=cloneDeep(formEventConfigs);
if (formConfig.useCustomConfig) {
const parts = obj.formConfigKey.split('_');
const formId=parts[1];
cloneProps.schemas=await mergeFormSchemas({formSchema:cloneProps.schemas!,formId:formId});
customFormEventConfigs=await mergeFormEventConfigs({formEventConfigs:customFormEventConfigs,formId:formId});
}
let flowData = changeWorkFlowForm(cloneProps, obj);
let { buildOptionJson, uploadComponentIds, formModels, isViewProcess } = flowData;
data.formDataProps = buildOptionJson;
emits('changeUploadComponentIds', uploadComponentIds); //工作流中必须保存上传组件id【附件汇总需要】
if (isViewProcess) {
setDisabledForm(); //查看
}
state.formModel = formModels;
if(formModels[RowKey]) {
setFormDataFromId(formModels[RowKey], false)
} else {
setFieldsValue(formModels)
}
} catch (error) {}
await createFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:初始化表单
await loadFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:加载表单
}
function getFormModel() {
return systemFormRef.value.formModel
}
async function handleDelete(id) {
return await deleteLngPngSettleHdr([id]);
}
defineExpose({
setFieldsValue,
resetFields,
validate,
add,
update,
setFormDataFromId,
setDisabledForm,
setMenuPermission,
setWorkFlowForm,
getRowKey,
getFormModel,
handleDelete
});
</script>

View File

@ -0,0 +1,110 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit" @cancel="handleClose" :paddingRight="15" :bodyStyle="{ minHeight: '400px !important' }">
<ModalForm ref="formRef" :fromPage="FromPageType.MENU" />
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, computed, reactive } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { formProps } from './config';
import ModalForm from './Form.vue';
import { FromPageType } from '/@/enums/workflowEnum';
const emit = defineEmits(['success', 'register']);
const { notification } = useMessage();
const formRef = ref();
const state = reactive({
formModel: {},
isUpdate: true,
isView: false,
isCopy: false,
rowId: '',
});
const { t } = useI18n();
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
state.isUpdate = !!data?.isUpdate;
state.isView = !!data?.isView;
state.isCopy = !!data?.isCopy;
setModalProps({
destroyOnClose: true,
maskClosable: false,
showCancelBtn: !state.isView,
showOkBtn: !state.isView,
canFullscreen: true,
width: 900,
});
if (state.isUpdate || state.isView || state.isCopy) {
state.rowId = data.id;
if (state.isView) {
await formRef.value.setDisabledForm();
}
await formRef.value.setFormDataFromId(state.rowId);
} else {
formRef.value.resetFields();
}
});
const getTitle = computed(() => (state.isView ? '查看' : !state.isUpdate ? '新增' : '编辑'));
async function saveModal() {
let saveSuccess = false;
try {
const values = await formRef.value?.validate();
//添加隐藏组件
if (formProps.hiddenComponent?.length) {
formProps.hiddenComponent.forEach((component) => {
values[component.bindField] = component.value;
});
}
if (values !== false) {
try {
if (!state.isUpdate || state.isCopy) {
saveSuccess = await formRef.value.add(values);
} else {
saveSuccess = await formRef.value.update({ values, rowId: state.rowId });
}
return saveSuccess;
} catch (error) {}
}
} catch (error) {
return saveSuccess;
}
}
async function handleSubmit() {
try {
const saveSuccess = await saveModal();
setModalProps({ confirmLoading: true });
if (saveSuccess) {
if (!state.isUpdate || state.isCopy) {
//false 新增
notification.success({
message: 'Tip',
description: t('新增成功!'),
}); //提示消息
} else {
notification.success({
message: 'Tip',
description: t('修改成功!'),
}); //提示消息
}
closeModal();
formRef.value.resetFields();
emit('success');
}
} finally {
setModalProps({ confirmLoading: false });
}
}
function handleClose() {
formRef.value.resetFields();
}
</script>

View File

@ -0,0 +1,686 @@
import { FormProps, FormSchema } from '/@/components/Form';
import { BasicColumn } from '/@/components/Table';
export const formConfig = {
useCustomConfig: false,
};
export const searchFormSchema: FormSchema[] = [
{
field: 'datePlan',
label: '结算月',
component: 'RangePicker',
componentProps: {
format: 'YYYY-MM',
picker: 'month',
style: { width: '100%' },
getPopupContainer: () => document.body,
},
},
{
field: 'cpName',
label: '供应商名称',
component: 'Input',
},
];
export const columns: BasicColumn[] = [
{
dataIndex: 'settleMonth',
title: '结算月',
componentType: 'input',
align: 'left',
width: 100,
sorter: true,
},
{
dataIndex: 'dateFrom',
title: '结算月开始日期',
componentType: 'input',
align: 'left',
width: 140,
sorter: true,
},
{
dataIndex: 'dateTo',
title: '结算月结束日期',
componentType: 'input',
align: 'left',
width: 140,
sorter: true,
},
{
dataIndex: 'cpName',
title: '供应商简称',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'settleDesc',
title: '结算说明',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'qtySettleGj',
title: '结算总数量(吉焦)',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'qtySettleM3',
title: '结算总数量(方)',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'amount',
title: '结算总金额(元)',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'note',
title: '备注',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'approName',
title: '审批状态',
componentType: 'input',
align: 'left',
width: 100,
sorter: true,
},
];
//表单事件
export const formEventConfigs = {
0: [
{
type: 'circle',
color: '#2774ff',
text: '开始节点',
icon: '#icon-kaishi',
bgcColor: '#D8E5FF',
isUserDefined: false,
},
{
color: '#F6AB01',
icon: '#icon-chushihua',
text: '初始化表单',
bgcColor: '#f9f5ea',
isUserDefined: false,
nodeInfo: { processEvent: [] },
},
],
1: [
{
color: '#B36EDB',
icon: '#icon-shujufenxi',
text: '获取表单数据',
detail: '(新增无此操作)',
bgcColor: '#F8F2FC',
isUserDefined: false,
nodeInfo: { processEvent: [] },
},
],
2: [
{
color: '#F8625C',
icon: '#icon-jiazai',
text: '加载表单',
bgcColor: '#FFF1F1',
isUserDefined: false,
nodeInfo: { processEvent: [] },
},
],
3: [
{
color: '#6C6AE0',
icon: '#icon-jsontijiao',
text: '提交表单',
bgcColor: '#F5F4FF',
isUserDefined: false,
nodeInfo: { processEvent: [] },
},
],
4: [
{
type: 'circle',
color: '#F8625C',
text: '结束节点',
icon: '#icon-jieshuzhiliao',
bgcColor: '#FFD6D6',
isLast: true,
isUserDefined: false,
},
],
};
export const formProps: FormProps = {
labelCol: { span: 3, offset: 0 },
labelAlign: 'right',
layout: 'horizontal',
size: 'default',
schemas: [
{
key: '467cd7195a684296b4b60a3c3b7158c6',
field: 'id',
label: 'id',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入id',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '91760a4f5c554515bb65828e62bc9d1e',
field: 'settleMonth',
label: '结算月',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入结算月',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '6bc3fa96e2cc40acbb2fdead9406c943',
field: 'dateFrom',
label: '结算月开始日期',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入结算月开始日期',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: 'a9e28be90c0d40a1985283a7a2d464b7',
field: 'dateTo',
label: '结算月结束日期',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入结算月结束日期',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: 'a3e4b515881f460b87675fe09dafdadd',
field: 'cpCode',
label: '供应商简称',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入供应商简称',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '336fb3cf758347c8ae2d2c8047747f88',
field: 'settleDesc',
label: '结算说明',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入结算说明',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '5d6f2d25c9ac4215822eba9c17424dd4',
field: 'qtySettleGj',
label: '结算总数量 (吉焦)',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入结算总数量 (吉焦)',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '8c97393756524ff58e1d9ce3416d794e',
field: 'qtySettleM3',
label: '结算总数量 (方)',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入结算总数量 (方)',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '1913cff6de1048a8bf7c51f26c720663',
field: 'amount',
label: '结算总金额 (元)',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入结算总金额 (元)',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '7871e6d89d3847d3b0ca768a0465f7d4',
field: 'note',
label: '备注',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入备注',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '628b2ea58b654aeaa2e0c6cdc286eccc',
field: 'approCode',
label: '审批状态',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入审批状态',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '5b4e462f91dd4c58b1263647ea357ef1',
label: '表格组件',
field: 'lngPngSettlePurList',
type: 'form',
component: 'SubForm',
required: true,
colProps: { span: 24 },
componentProps: {
mainKey: 'lngPngSettlePurList',
columns: [
{
key: '5c88e8b2a3bf49c887a57b50b7c715ce',
title: 'id',
dataIndex: 'id',
componentType: 'Input',
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入id',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
},
},
{ title: '操作', key: 'action', fixed: 'right', width: '50px' },
],
span: '24',
preloadType: 'api',
apiConfig: {},
itemId: '',
dicOptions: [],
useSelectButton: false,
buttonName: '选择数据',
showLabel: true,
showComponentBorder: true,
showFormBorder: true,
showIndex: false,
isShow: true,
multipleHeads: [],
},
},
{
key: 'd9100edc043c4894826b24631c97f667',
label: '表格组件',
field: 'lngPngSettlePurDtlList',
type: 'form',
component: 'SubForm',
required: true,
colProps: { span: 24 },
componentProps: {
mainKey: 'lngPngSettlePurDtlList',
columns: [
{
key: '7664c252f8c3459799062975824c2813',
title: 'id',
dataIndex: 'id',
componentType: 'Input',
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入id',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
},
},
{ title: '操作', key: 'action', fixed: 'right', width: '50px' },
],
span: '24',
preloadType: 'api',
apiConfig: {},
itemId: '',
dicOptions: [],
useSelectButton: false,
buttonName: '选择数据',
showLabel: true,
showComponentBorder: true,
showFormBorder: true,
showIndex: false,
isShow: true,
multipleHeads: [],
},
},
],
showActionButtonGroup: false,
buttonLocation: 'center',
actionColOptions: { span: 24 },
showResetButton: false,
showSubmitButton: false,
hiddenComponent: [],
};

View File

@ -0,0 +1,225 @@
export const permissionList = [
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: 'id',
fieldId: 'id',
isSubTable: false,
showChildren: true,
type: 'input',
key: '467cd7195a684296b4b60a3c3b7158c6',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '结算月',
fieldId: 'settleMonth',
isSubTable: false,
showChildren: true,
type: 'input',
key: '91760a4f5c554515bb65828e62bc9d1e',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '结算月开始日期',
fieldId: 'dateFrom',
isSubTable: false,
showChildren: true,
type: 'input',
key: '6bc3fa96e2cc40acbb2fdead9406c943',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '结算月结束日期',
fieldId: 'dateTo',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'a9e28be90c0d40a1985283a7a2d464b7',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '供应商简称',
fieldId: 'cpCode',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'a3e4b515881f460b87675fe09dafdadd',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '结算说明',
fieldId: 'settleDesc',
isSubTable: false,
showChildren: true,
type: 'input',
key: '336fb3cf758347c8ae2d2c8047747f88',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '结算总数量 (吉焦)',
fieldId: 'qtySettleGj',
isSubTable: false,
showChildren: true,
type: 'input',
key: '5d6f2d25c9ac4215822eba9c17424dd4',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '结算总数量 (方)',
fieldId: 'qtySettleM3',
isSubTable: false,
showChildren: true,
type: 'input',
key: '8c97393756524ff58e1d9ce3416d794e',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '结算总金额 (元)',
fieldId: 'amount',
isSubTable: false,
showChildren: true,
type: 'input',
key: '1913cff6de1048a8bf7c51f26c720663',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '备注',
fieldId: 'note',
isSubTable: false,
showChildren: true,
type: 'input',
key: '7871e6d89d3847d3b0ca768a0465f7d4',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '审批状态',
fieldId: 'approCode',
isSubTable: false,
showChildren: true,
type: 'input',
key: '628b2ea58b654aeaa2e0c6cdc286eccc',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: true,
showChildren: false,
tableName: 'lngPngSettlePurList',
fieldName: '表格组件',
fieldId: 'lngPngSettlePurList',
type: 'form',
key: '5b4e462f91dd4c58b1263647ea357ef1',
children: [
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: true,
isSaveTable: false,
showChildren: false,
tableName: 'lngPngSettlePurList',
fieldName: 'id',
fieldId: 'id',
key: '5c88e8b2a3bf49c887a57b50b7c715ce',
children: [],
},
],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: true,
showChildren: false,
tableName: 'lngPngSettlePurDtlList',
fieldName: '表格组件',
fieldId: 'lngPngSettlePurDtlList',
type: 'form',
key: 'd9100edc043c4894826b24631c97f667',
children: [
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: true,
isSaveTable: false,
showChildren: false,
tableName: 'lngPngSettlePurDtlList',
fieldName: 'id',
fieldId: 'id',
key: '7664c252f8c3459799062975824c2813',
children: [],
},
],
},
];

View File

@ -0,0 +1,513 @@
<template>
<PageWrapper dense fixedHeight contentFullHeight contentClass="flex">
<BasicTable @register="registerTable" ref="tableRef" @row-dbClick="dbClickRow">
<template #toolbar>
<template v-for="button in tableButtonConfig" :key="button.code">
<a-button v-if="button.isDefault" :type="button.type" @click="buttonClick(button.code)">
<template #icon><Icon :icon="button.icon" /></template>
{{ button.name }}
</a-button>
<a-button v-else :type="button.type">
<template #icon><Icon :icon="button.icon" /></template>
{{ button.name }}
</a-button>
</template>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'action'">
<TableAction :actions="getActions(record)" />
</template>
</template>
</BasicTable>
<PngSettleHdrPurModal @register="registerModal" @success="handleSuccess" />
<DataLog :logId="logId" :logPath="logPath" v-model:visible="modalVisible"/>
</PageWrapper>
</template>
<script lang="ts" setup>
const modalVisible = ref(false);
const logId = ref('')
const logPath = ref('/dayPlan/pngSettleHdrPur/datalog');
import { DataLog } from '/@/components/pcitc';
import { ref, computed, onMounted, onUnmounted, createVNode, watch} from 'vue';
import { Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
import { getLngPngSettleHdrPage, deleteLngPngSettleHdr} from '/@/api/dayPlan/PngSettleHdrPur';
import { PageWrapper } from '/@/components/Page';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { usePermission } from '/@/hooks/web/usePermission';
import { useFormConfig } from '/@/hooks/web/useFormConfig';
import { useRouter } from 'vue-router';
import { setIndexFlowStatus } from '/@/utils/flow/index'
import { getLngPngSettleHdr } from '/@/api/dayPlan/PngSettleHdrPur';
import { useModal,BasicModal } from '/@/components/Modal';
import LookProcess from '/@/views/workflow/task/components/LookProcess.vue';
import LaunchProcess from '/@/views/workflow/task/components/LaunchProcess.vue';
import ApprovalProcess from '/@/views/workflow/task/components/ApprovalProcess.vue';
import { getDraftInfo } from '/@/api/workflow/process';
import { isValidJSON } from '/@/utils/event/design';
import PngSettleHdrPurModal from './components/PngSettleHdrPurModal.vue';
import {formConfig, searchFormSchema, columns } from './components/config';
import Icon from '/@/components/Icon/index';
import FlowRecord from '/@/views/workflow/task/components/flow/FlowRecord.vue';
import { DataFormat, FormatOption, DATE_FORMAT, FormatType } from '/@/utils/dataFormat';
import useEventBus from '/@/hooks/event/useEventBus';
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 { notification } = useMessage();
const { t } = useI18n();
defineEmits(['register']);
const { filterColumnAuth, filterButtonAuth } = usePermission();
const { mergeColumns,mergeSearchFormSchema,mergeButtons } = useFormConfig();
const filterColumns = cloneDeep(filterColumnAuth(columns));
const customConfigColums =ref(filterColumns);
const customSearchFormSchema =ref(searchFormSchema);
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":"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":"datalog","icon":"ant-design:profile-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 actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord','submit','approve']);
const buttonConfigs = computed(()=>{
return filterButtonAuth(buttons.value);
})
const tableButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
});
const actionButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
});
const btnEvent = {add : handleAdd,edit : handleEdit,refresh : handleRefresh,view : handleView,datalog : handleDatalog,startwork : handleStartwork,flowRecord : handleFlowRecord,approve : handleApprove,delete : handleDelete,cancel:handleCancel}
const { currentRoute } = useRouter();
const router = useRouter();
const formIdComputedRef = ref();
formIdComputedRef.value = currentRoute.value.meta.formId
const schemaIdComputedRef = ref();
schemaIdComputedRef.value = currentRoute.value.meta.schemaId
const visibleLookProcessRef = ref(false);
const processIdRef = ref('');
const selectedKeys = ref([])
const visibleLaunchProcessRef = ref(false);
const schemaIdRef = ref('');
const formDataRef = ref();
const rowKeyData = ref();
const draftsId = ref();
const tableData = ref([])
const visibleApproveProcessRef = ref(false);
const taskIdRef = ref('');
const visibleFlowRecordModal = ref(false);
const [registerModal, { openModal }] = useModal();
const formName=currentRoute.value.meta?.title
const [registerTable, { reload, setTableData, getDataSource,clearSelectedRowKeys }] = useTable({
title: '' || (formName + '列表'),
api: getLngPngSettleHdrPage,
rowKey: 'id',
columns: customConfigColums,
formConfig: {
rowProps: {
gutter: 16,
},
schemas: customSearchFormSchema,
fieldMapToTime: [['datePlan', ['startDate', 'endDate'], 'YYYY-MM']],
showResetButton: false,
},
beforeFetch: (params) => {
return { ...params, FormId: formIdComputedRef.value, PK: 'id',page:params.limit };
},
afterFetch: (res) => {
tableData.value = res || []
tableRef.value.setToolBarWidth();
},
useSearchForm: true,
showTableSetting: true,
striped: false,
actionColumn: {
width: 160,
title: '操作',
dataIndex: 'action',
slots: { customRender: 'action' },
},
rowSelection: {
type: 'checkbox',
onChange: onSelectChange,
getCheckboxProps: (record) => ({
disabled: record.approCode !== 'YSP',
name: record.name,
}),
},
tableSetting: {
size: false,
setting: false,
},
});
watch(
() => tableData.value,
(val) => {
if (val) {
let arr = DataFormat.format(val, [
FormatOption.createQty('qtySettleGj'),
FormatOption.createQty('qtySettleM3'),
FormatOption.createAmt('amount'),
]);
if (arr.length) {
setTableData(arr)
}
}
},
{
immediate: true,
deep: true,
}
);
function onSelectChange(rowKeys: string[]) {
selectedKeys.value = rowKeys;
}
function dbClickRow(record) {
if (!actionButtonConfig?.value.some(element => element.code == 'view')) {
return;
}
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,
readonly: 1,
}
});
} else if (schemaId && !taskIds && processId) {
router.push({
path: '/flow/' + schemaId + '/' + processId + '/approveFlow',
query: {
readonly: 1,
taskId: '',
formName: formName,
formId:currentRoute.value.meta.formId,
id: record.id,
}
});
} else {
if (schemaIdComputedRef.value) {
router.push({
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow',
query: {
formPath: 'dayPlan/PngSettleHdrPur',
formName: "查看"+formName,
formId:currentRoute.value.meta.formId,
type:'edit',
id: record.id,
disabled: 1,
}
});
}
// router.push({
// path: '/form/PngSettleHdrPur/' + record.id + '/viewForm',
// query: {
// formPath: 'dayPlan/PngSettleHdrPur',
// formName: formName,
// formId:currentRoute.value.meta.formId
// }
// });
}
}
function buttonClick(code) {
btnEvent[code]();
}
function handleDatalog (record: Recordable) {
modalVisible.value = true
logId.value = record.id
}
function handleAdd() {
if (schemaIdComputedRef.value) {
router.push({
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow',
query: {
formPath: 'dayPlan/PngSettleHdrPur',
formName: "新建"+formName,
}
});
} else {
router.push({
path: '/form/PngSettleHdrPur/0/createForm',
query: {
formPath: 'dayPlan/PngSettleHdrPur',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
}
}
function handleEdit(record: Recordable) {
if (schemaIdComputedRef.value) {
router.push({
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow',
query: {
formPath: 'dayPlan/PngSettleHdrPur',
formName: "编辑"+formName,
formId:currentRoute.value.meta.formId,
type:'edit',
id: record.id
}
});
} else {
router.push({
path: '/form/PngSettleHdrPur/' + record.id + '/updateForm',
query: {
formPath: 'dayPlan/PngSettleHdrPur',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
}
}
function handleApprove(record: Recordable) {
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 handleCancel() {
}
function handleDelete(record: Recordable) {
deleteList([record.id]);
}
function deleteList(ids) {
Modal.confirm({
title: '提示信息',
icon: createVNode(ExclamationCircleOutlined),
content: '是否确认删除?',
okText: '确认',
cancelText: '取消',
onOk() {
deleteLngPngSettleHdr(ids).then((_) => {
handleSuccess();
notification.success({
message: 'Tip',
description: t('删除成功!'),
});
});
},
onCancel() {},
});
}
function handleRefresh() {
reload();
}
function handleSuccess() {
reload();
}
function handleView(record: Recordable) {
dbClickRow(record);
}
onMounted(() => {
if (schemaIdComputedRef.value) {
bus.on(FLOW_PROCESSED, handleRefresh);
bus.on(CREATE_FLOW, handleRefresh);
} else {
bus.on(FORM_LIST_MODIFIED, handleRefresh);
}
// 合并渲染覆盖配置中的列表配置,包括展示字段配置、搜索字段配置、按钮配置
mergeCustomListRenderConfig();
});
onUnmounted(() => {
if (schemaIdComputedRef.value) {
bus.off(FLOW_PROCESSED, handleRefresh);
bus.off(CREATE_FLOW, handleRefresh);
} else {
bus.off(FORM_LIST_MODIFIED, handleRefresh);
}
});
function getActions(record: Recordable):ActionItem[] {
let actionsList: ActionItem[] = [];
let editAndDelBtn: ActionItem[] = [];
let approveBtn: ActionItem[] = [];
let hasFlowRecord = false;
actionButtonConfig.value?.map((button) => {
if (['view', 'copyData','datalog'].includes(button.code)) {
actionsList.push({
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
});
}
if (['edit', 'delete'].includes(button.code)) {
editAndDelBtn.push({
icon: button?.icon,
tooltip: button?.name,
color: button.code === 'delete' ? 'error' : undefined,
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 (record.approCode == 'WTJ' || record.approCode == 'YBH' ) {
actionsList = actionsList.concat(editAndDelBtn);
if (record.createUserId !== userInfo.id) {
let idx = actionsList.findIndex(v =>v.tooltip == '删除')
idx > -1 && actionsList.splice(idx, 1)
}
}
// 审批中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;
}
function handleStartwork(record: Recordable) {
const { processId, schemaId } = record.workflowData;
router.push({
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
query: {
readonly: 1,
taskId: '',
formName: formName
}
});
}
function handleFlowRecord(record: Recordable) {
if (record.workflowData) {
visibleFlowRecordModal.value = true;
processIdRef.value = record.workflowData?.processId;
}
}
async function handleLaunchProcess(record: Recordable) {
const schemaId=record.workflowData?.schemaId||schemaIdComputedRef.value;
if(schemaId){
if(record.workflowData?.draftId){
let res = await getDraftInfo(record.workflowData.draftId);
if (isValidJSON(res.formData)) {
localStorage.setItem('draftsJsonStr', res.formData);
router.push({
path: '/flow/' + schemaId + '/'+record.workflowData.draftId+'/createFlow'
});
return;
}
}
const result = await getLngPngSettleHdr(record['id']);
const form={};
const key="form_"+schemaId+"_"+record['id'];
form[key]=result;
localStorage.setItem('formJsonStr', JSON.stringify(form));
router.push({
path: '/flow/' + schemaId + '/0/createFlow',
query: {
fromKey: key
}
});
}
}
function handleApproveProcess(record: Recordable) {
const { processId, taskIds, schemaId } = record.workflowData;
router.push({
path: '/flow/' + schemaId + '/' + processId + '/approveFlow',
query: {
taskId: taskIds[0],
formName: formName
}
});
}
function handleCloseLaunch() {
visibleLaunchProcessRef.value = false;
reload();
}
function handleCloseApproval() {
visibleApproveProcessRef.value = false;
reload();
}
async function mergeCustomListRenderConfig(){
if (formConfig.useCustomConfig) {
let formId=currentRoute.value.meta.formId;
//1.合并展示字段配置
let cols= await mergeColumns(customConfigColums.value,formId);
customConfigColums.value=cols;
//2.合并搜索字段配置
let sFormSchema= await mergeSearchFormSchema(customSearchFormSchema.value,formId);
customSearchFormSchema.value=sFormSchema;
//3.合并按钮配置
let btns= await mergeButtons(buttons.value,formId);
buttons.value=btns;
}
};
</script>
<style lang="less" scoped>
:deep(.ant-table-selection-col) {
width: 50px;
}
.show{
display: flex;
}
.hide{
display: none !important;
}
:deep( .ant-col-8:nth-child(1)) {
width: 320px !important;
max-width: 320px !important;;
}
:deep(.ant-col-8:nth-child(1) .ant-form-item-label) {
width: 80px !important;
}
</style>