This commit is contained in:
2026-02-06 18:11:12 +08:00
30 changed files with 4082 additions and 118 deletions

View File

@ -11,9 +11,21 @@ enum Api {
queryAllCurrency ='/magic-api/mdm/queryAllCurrency', queryAllCurrency ='/magic-api/mdm/queryAllCurrency',
queryAllUser ='/magic-api/mdm/queryAllUser', queryAllUser ='/magic-api/mdm/queryAllUser',
queryBankByCode ='/magic-api/sales/queryBankByCode' queryBankByCode ='/magic-api/sales/queryBankByCode',
PageModal ='/magic-api/contract/lngContractFact/page/modal'
} }
export async function getLngContractFactPageModal(params: LngContractFactPageParams, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngContractFactPageResult>(
{
url: Api.PageModal,
params,
},
{
errorMessageMode: mode,
},
);
}
export async function getBankBList(code:String, type:String, mode: ErrorMessageMode = 'modal') { export async function getBankBList(code:String, type:String, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngContractFactPageResult>( return defHttp.get<LngContractFactPageResult>(
{ {

View File

@ -3,7 +3,8 @@ import { defHttp } from '/@/utils/http/axios';
import { ErrorMessageMode } from '/#/axios'; import { ErrorMessageMode } from '/#/axios';
enum Api { enum Api {
Page = '/contract/contractSalesInt/page', // Page = '/contract/contractSalesInt/page',
Page = '/magic-api/contract/contractSalesInt/page',
List = '/contract/contractSalesInt/list', List = '/contract/contractSalesInt/list',
Info = '/contract/contractSalesInt/info', Info = '/contract/contractSalesInt/info',
LngContract = '/contract/contractSalesInt', LngContract = '/contract/contractSalesInt',

View File

@ -0,0 +1,113 @@
import { LngPngSettleHdrPageModel, LngPngSettleHdrPageParams, LngPngSettleHdrPageResult } from './model/PngSettleHdrModel';
import { defHttp } from '/@/utils/http/axios';
import { ErrorMessageMode } from '/#/axios';
enum Api {
// Page = '/dayPlan/pngSettleHdr/page',
Page = '/magic-api/dayPlan/pngSettleSalesHdrPage',
List = '/dayPlan/pngSettleHdr/list',
Info = '/dayPlan/pngSettleHdr/info',
LngPngSettleHdr = '/dayPlan/pngSettleHdr',
PageAdd = '/magic-api/dayPlan/pngSettleSalesHdrSelectPage',
date = '/magic-api/dayPlan/pngSettleSalesHdrSelectDateTo',
}
export async function getLngPngSettleHdrDate(params, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngPngSettleHdrPageModel>(
{
url: Api.date,
params,
},
{
errorMessageMode: mode,
},
);
}
export async function getLngPngSettleHdrPageAdd(params: LngPngSettleHdrPageParams, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngPngSettleHdrPageResult>(
{
url: Api.PageAdd,
params,
},
{
errorMessageMode: mode,
},
);
}
/**
* @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,232 @@
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;
qtySettleGj: string;
qtySettleM3: string;
amount: string;
comId: string;
settleDesc: string;
deptId: string;
approCode: string;
}
/**
* @description: LngPngSettleHdr分页返回值模型
*/
export interface LngPngSettleHdrPageModel {
id: string;
settleMonth: string;
dateFrom: string;
dateTo: string;
cpCode: string;
qtySettleGj: string;
qtySettleM3: string;
amount: string;
comId: string;
settleDesc: string;
deptId: 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;
lngPngSettleSalesList?: LngPngSettleSalesModel;
lngPngSettleSalesDtlList?: LngPngSettleSalesDtlModel;
}
/**
* @description: LngPngSettleSales表类型
*/
export interface LngPngSettleSalesModel {
id: number;
settleHdrId: number;
salesId: number;
settleMonth: string;
settleTypeCode: string;
datePlan: string;
dateMea: string;
cuCode: string;
ksId: number;
ksppId: number;
pointDelyCode: string;
uomCode: 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: LngPngSettleSalesDtl表类型
*/
export interface LngPngSettleSalesDtlModel {
id: number;
settleId: number;
priceCode: string;
sort: number;
uomCode: string;
rateQtyGj: number;
rateQtyM3: number;
rateM3Gj: number;
qtySettleGj: number;
qtySettleM3: number;
priceGj: 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

@ -32,10 +32,10 @@
const dataFile = ref([]); const dataFile = ref([]);
const { t } = useI18n(); const { t } = useI18n();
const columns = ref([ const columns = ref([
{ title: t('序号'), dataIndex: 'index', sorter: true, customRender: (column) => `${column.index + 1}`}, { title: t('序号'), dataIndex: 'index', customRender: (column) => `${column.index + 1}`},
{ title: t('附件名称'), dataIndex: 'fileOrg', sorter: true}, { title: t('附件名称'), dataIndex: 'fileOrg'},
{ title: t('附件说明'), dataIndex: 'remark', sorter: true}, { title: t('附件说明'), dataIndex: 'remark'},
{ title: t('操作'), dataIndex: 'operation', sorter: true}, { title: t('操作'), dataIndex: 'operation', width: 140},
]); ]);
const tableId = ref<string>(); const tableId = ref<string>();
const tableName = ref<string>(); const tableName = ref<string>();

View File

@ -208,7 +208,7 @@
let res = await getRejectNodeList(_processId, _taskId); let res = await getRejectNodeList(_processId, _taskId);
if (res && Array.isArray(res) && res.length > 0) { if (res && Array.isArray(res) && res.length > 0) {
rejectNodeList.value = res; rejectNodeList.value = res;
dialogTitle.value = `退`; dialogTitle.value = ``;
if (res?.length) { if (res?.length) {
res.forEach((nNode) => { res.forEach((nNode) => {
if (!nNode.userList?.length) { if (!nNode.userList?.length) {

View File

@ -13,7 +13,7 @@
import { BasicTable, useTable, FormSchema, BasicColumn, TableAction } from '/@/components/Table'; import { BasicTable, useTable, FormSchema, BasicColumn, TableAction } from '/@/components/Table';
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 { getLngContractFactPage,} from '/@/api/contract/ContractFact'; import { getLngContractFactPageModal,} from '/@/api/contract/ContractFact';
const { t } = useI18n(); const { t } = useI18n();
const codeFormSchema: FormSchema[] = [ const codeFormSchema: FormSchema[] = [
@ -62,7 +62,7 @@
const [registerTable, { getDataSource, setTableData, updateTableDataRecord, reload }] = useTable({ const [registerTable, { getDataSource, setTableData, updateTableDataRecord, reload }] = useTable({
title: t('合同列表'), title: t('合同列表'),
api: getLngContractFactPage, api: getLngContractFactPageModal,
columns, columns,
bordered: true, bordered: true,
@ -76,7 +76,7 @@
}, },
immediate: false, // 设置为不立即调用 immediate: false, // 设置为不立即调用
beforeFetch: (params) => { beforeFetch: (params) => {
return { ...params, valid: 'Y',approCode: 'YSP'}; return { ...params, valid: 'Y',approCode: 'YSP',page:params.limit};
}, },
rowSelection: { rowSelection: {
type: props.selectType, type: props.selectType,

View File

@ -0,0 +1,193 @@
<template>
<div>
<BasicModal v-bind="$attrs" @register="registerModal" width="60%" :title="getTitle" @ok="handleSubmit"
@visible-change="handleVisibleChange" >
<div class="box">
<a-checkbox class="checkItem" v-model:checked="checked" @change="checkChange">仅显示未结算</a-checkbox>
<BasicTable @register="registerTable" class="measureListModal">
<template #bodyCell="{ column, record, index }">
<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>
</BasicTable>
</div>
</BasicModal>
</div>
</template>
<script lang="ts" setup>
import { ref, computed, unref, nextTick, watch } from 'vue';
import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form/index';
import { BasicTable, useTable, FormSchema, BasicColumn, TableAction } from '/@/components/Table';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { getLngPngSettleHdrPageAdd} from '/@/api/dayPlan/PngSettleHdr';
import { parseDownloadUrl} from '/@/api/system/file';
import { downloadByUrl } from '/@/utils/file/download';
import { DataFormat, FormatOption, DATE_FORMAT, FormatType } from '/@/utils/dataFormat';
const { t } = useI18n();
const checked = ref(false)
const codeFormSchema: FormSchema[] = [
{
field: 'datePlan',
label: '计划日期',
component: 'RangePicker',
componentProps: {
format: 'YYYY-MM-DD',
style: { width: '100%' },
getPopupContainer: () => document.body,
},
},
];
const columns: BasicColumn[] = [
{ dataIndex: 'datePlan', title: '计划日期', align: 'left', width: 100},
{ dataIndex: 'dateMea', title: '计量日期', align: 'left',width: 100},
{ dataIndex: 'cuSname', title: '客户', align: 'left', },
{ dataIndex: 'pointDelyName', title: '下载点', align: 'left',},
{ dataIndex: 'comName', title: '交易主体', align: 'left',},
{ dataIndex: 'qtyMeaGj', title: '完成量(吉焦)', align: 'left',width: 120},
{ 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: 'settledSign', title: '已结算', align: 'left',width: 100},
];
const emit = defineEmits(['success', 'register']);
const { notification } = useMessage();
const isUpdate = ref(true);
const rowId = ref('');
const selectedKeys = ref<string[]>([]);
const selectedValues = ref([]);
const props = defineProps({
selectType: { type: String, default: 'checkbox' },
});
const tableData = ref([])
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
setModalProps({ confirmLoading: false });
isUpdate.value = !!data?.isUpdate;
});
const [registerTable, { getDataSource, setTableData, updateTableDataRecord, reload }] = useTable({
title: t('待结算记录'),
api: getLngPngSettleHdrPageAdd,
columns,
bordered: true,
pagination: true,
canResize: false,
formConfig: {
labelCol:{span: 12},
schemas: codeFormSchema,
fieldMapToTime: [['datePlan', ['startDate', 'endDate'], 'YYYY-MM-DD']],
showResetButton: true,
},
immediate: false, // 设置为不立即调用
beforeFetch: (params) => {
return { ...params,page:params.limit};
},
afterFetch: (res) => {
tableData.value = res || []
},
rowSelection: {
type: props.selectType,
onChange: onSelectChange
},
});
watch(
() => tableData.value,
(val) => {
if (val) {
let arr = DataFormat.format(val, [
FormatOption.createQty('qtyMeaGj'),
FormatOption.createQty('qtyMeaM3'),
]);
if (arr.length) {
setTableData(arr)
}
}
},
{
immediate: true,
deep: true,
}
);
const handleVisibleChange = (visible: boolean) => {
if (visible) {
nextTick(() => {
reload();
});
}
};
const checkChange = (val) => {
reload({ searchInfo: { settledSign: checked.value ? 0 : null } });
}
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[], e) {
selectedKeys.value = rowKeys;
selectedValues.value = e
}
const getTitle = computed(() => (!unref(isUpdate) ? t('待结算记录') : t('')));
async function handleSubmit() {
if (!selectedValues.value.length) {
notification.warning({
message: t('提示'),
description: t('请选择数据')
});
return
}
closeModal();
emit('success', selectedValues.value);
}
</script>
<style >
.measureListModal .basicCol{
position: inherit !important;
top: 0;
}
.measureListModal .ant-col-8 {
width: 450px !important;
max-width: 450px !important;;
}
</style>
<style lang="less" scoped>
.box {
position: relative;
}
.checkItem {
position: absolute;
top: 12px;
left: 17px;
z-index: 104;
}
.fileCSS a{
width: 100%;
white-space: normal;
word-wrap: break-word;
overflow-wrap: break-word;
}
</style>

View File

@ -0,0 +1,92 @@
<template>
<div>
<BasicModal v-bind="$attrs" @register="registerModal" width="60%" :title="getTitle" @ok="handleSubmit">
<a-table :columns="columns" :data-source="tableData" :scroll="{x: 300}" :pagination="false">
<template #bodyCell="{ column, record, index }">
<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%" />
</template>
<template v-if="column.dataIndex === 'qtySettleM3'">
<a-input-number v-model:value="record.qtySettleM3" :min="0" :precision="3" @change="numChange('qtySettleM3', record, index)" style="width: 100%" />
</template>
<template v-if="column.dataIndex === 'priceM3'">
<a-input-number v-model:value="record.priceM3" :min="0" :precision="4" @change="numChange('priceM3', record, index)" style="width: 100%" />
</template>
<template v-if="column.dataIndex === 'priceGj'">
<a-input-number v-model:value="record.priceGj" :min="0" :precision="4" @change="numChange('priceGj', record, index)" style="width: 100%" />
</template>
<template v-if="column.dataIndex === 'amount'">
<a-input-number v-model:value="record.amount" :min="0" :precision="2" @change="numChange('amount', record, index)" style="width: 100%" />
</template>
</template>
</a-table>
</BasicModal>
</div>
</template>
<script lang="ts" setup>
import { ref, computed, unref, nextTick } from 'vue';
import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
const { t } = useI18n();
const tableData = ref([
{priceDesc: '基础量300000方'},
{priceDesc: '增量'}
])
const curRecord = ref({})
const columns= [
{ title: t('序号'), dataIndex: 'index', key: 'index', customRender: (column) => `${column.index + 1}` ,width: 80},
{ 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: 'amount', width: 120},
];
const emit = defineEmits(['success', 'register']);
const { notification } = useMessage();
const isUpdate = ref(true);
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
setModalProps({ confirmLoading: false });
curRecord.value = data.record || {}
isUpdate.value = !!data?.isUpdate;
});
const getTitle = computed(() => (!unref(isUpdate) ? t('价格组成') : t('')));
const numChange = (k, record, idx) => {
if (curRecord.value.uomCode == 'M3') {
if (k=='amount') {
return
}
record.amount = ((Number(record.qtySettleM3) || 0) * (Number(record.priceM3) || 0)).toFixed(2)
}
if (curRecord.value.uomCode == 'GJ') {
if (k=='amount') {
return
}
record.amount = ((Number(record.qtySettleGj) || 0) * (Number(record.priceGj) || 0)).toFixed(2)
}
// if (curRecord.value.uomCode == 'TON') {
// }
}
async function handleSubmit() {
closeModal();
emit('success', tableData.value, curRecord.value);
}
</script>
<style >
</style>
<style lang="less" scoped>
</style>

View File

@ -454,8 +454,18 @@
} }
const dateChange = (val, k) => { const dateChange = (val, k) => {
if (!val) { if (!val) {
k=='dateFrom' && (formState.dateFrom = null) if (k=='dateFrom') {
k=='dateTo' && (formState.dateTo = null) formState.dateFrom = dayjs(new Date())
setTimeout(() => {
formState.dateFrom = null
}, );
}
if (k=='dateTo') {
formState.dateTo = dayjs(new Date())
setTimeout(() => {
formState.dateTo = null
}, );
}
} }
} }
const disabledDateStart = (startValue) => { const disabledDateStart = (startValue) => {

View File

@ -91,7 +91,7 @@
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="销售区域" name="salesAreaCode"> <a-form-item label="销售区域" name="salesAreaCode">
<a-cascader v-model:value="formState.salesAreaCode" :options="options" :load-data="loadData" @change="onChange" change-on-select <a-cascader v-model:value="formState.salesAreaCode" :options="options" :load-data="loadData" :disabled="isDisable" @change="onChange" change-on-select
:field-names="{label: 'fullName', value: 'code', children: 'children'}" placeholder="请选择区域"/> :field-names="{label: 'fullName', value: 'code', children: 'children'}" placeholder="请选择区域"/>
</a-form-item> </a-form-item>
</a-col> </a-col>
@ -334,9 +334,9 @@
const formState = reactive({ const formState = reactive({
approCode: 'WTJ', approCode: 'WTJ',
typeCode: 'SP', typeCode: 'PI',
onlineSign: 'N', onlineSign: 'N',
cpTableName: 'lng_customer', cpTableName: 'lng_supplier',
lngContractPurIntList: [{}] lngContractPurIntList: [{}]
}); });
const [register, { openModal:openModal}] = useModal(); const [register, { openModal:openModal}] = useModal();
@ -532,8 +532,18 @@
} }
const dateChange = (val, k) => { const dateChange = (val, k) => {
if (!val) { if (!val) {
k=='dateFrom' && (formState.dateFrom = null) if (k=='dateFrom') {
k=='dateTo' && (formState.dateTo = null) formState.dateFrom = dayjs(new Date())
setTimeout(() => {
formState.dateFrom = null
}, );
}
if (k=='dateTo') {
formState.dateTo = dayjs(new Date())
setTimeout(() => {
formState.dateTo = null
}, );
}
} }
} }
const disabledDateStart = (startValue) => { const disabledDateStart = (startValue) => {

View File

@ -6,7 +6,16 @@ export const formConfig = {
}; };
export const searchFormSchema: FormSchema[] = [ export const searchFormSchema: FormSchema[] = [
{
field: 'dateFrom',
label: '有效期',
component: 'RangePicker',
componentProps: {
format: 'YYYY-MM-DD',
style: { width: '100%' },
getPopupContainer: () => document.body,
},
},
{ {
field: 'kName', field: 'kName',
label: '合同号/名称', label: '合同号/名称',
@ -17,29 +26,29 @@ export const searchFormSchema: FormSchema[] = [
label: '供应商', label: '供应商',
component: 'Input', component: 'Input',
}, },
{
field: 'comId',
label: '合同主体',
component: 'Input',
},
{ {
field: 'pointUpName', field: 'pointUpName',
label: '上载点', label: '上载点',
component: 'Input', component: 'Input',
// componentProps: { },
// showSearch: true, {
// optionFilterProp: 'label', field: 'comId',
// filterOption: (input: string, option: any) => { label: '合同主体',
// return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0; component: 'Select',
// }, componentProps: {
// options: [ showSearch: true,
// // { label: '全部', value: '' }, optionFilterProp: 'label',
// ], filterOption: (input: string, option: any) => {
// placeholder: '请选择', return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
// allowClear: true, },
options: [
// { label: '全部', value: '' },
],
placeholder: '请选择',
allowClear: true,
// getPopupContainer: () => document.body, getPopupContainer: () => document.body,
// }, },
}, },
{ {
field: 'approCode', field: 'approCode',

View File

@ -25,12 +25,12 @@
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="有效期开始" name="dateFrom"> <a-form-item label="有效期开始" name="dateFrom">
<a-date-picker v-model:value="formState.dateFrom" style="width: 100%" :disabled="isDisable" :disabled-date="disabledDateStart" placeholder="请选择开始日期" /> <a-date-picker v-model:value="formState.dateFrom" style="width: 100%" @change="dateChange(formState.dateFrom, 'dateFrom')" :disabled="isDisable" :disabled-date="disabledDateStart" placeholder="请选择开始日期" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="有效期结束" name="dateTo"> <a-form-item label="有效期结束" name="dateTo">
<a-date-picker v-model:value="formState.dateTo" style="width: 100%" :disabled="isDisable" :disabled-date="disabledDateEnd" placeholder="请选择结束日期" /> <a-date-picker v-model:value="formState.dateTo" style="width: 100%" @change="dateChange(formState.dateTo, 'dateTo')" :disabled="isDisable" :disabled-date="disabledDateEnd" placeholder="请选择结束日期" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
@ -243,7 +243,7 @@
onlineSign: 'N', onlineSign: 'N',
cpTableName: 'lng_supplier', cpTableName: 'lng_supplier',
curCode: 'CNY', curCode: 'CNY',
lngContractPurPngList: [{}] lngContractPurPngList: [{}],
}); });
const [register, { openModal:openModal}] = useModal(); const [register, { openModal:openModal}] = useModal();
const [registerDept, { openModal:openModalDept}] = useModal(); const [registerDept, { openModal:openModalDept}] = useModal();
@ -390,6 +390,22 @@
const getApproContractFactList = (val) => { const getApproContractFactList = (val) => {
dataListContractFact.value = val dataListContractFact.value = val
} }
const dateChange = (val, k) => {
if (!val) {
if (k=='dateFrom') {
formState.dateFrom = dayjs(new Date())
setTimeout(() => {
formState.dateFrom = null
}, );
}
if (k=='dateTo') {
formState.dateTo = dayjs(new Date())
setTimeout(() => {
formState.dateTo = null
}, );
}
}
}
const disabledDateStart = (startValue) => { const disabledDateStart = (startValue) => {
const endValue = formState?.dateTo; const endValue = formState?.dateTo;
if (!startValue || !endValue) { if (!startValue || !endValue) {

View File

@ -58,6 +58,7 @@
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'; import { useUserStore } from '/@/store/modules/user';
import { getAllCom} from '/@/api/contract/ContractPurInt';
const userStore = useUserStore(); const userStore = useUserStore();
const userInfo = userStore.getUserInfo; const userInfo = userStore.getUserInfo;
@ -76,7 +77,7 @@
const tableRef = ref(); const tableRef = ref();
//所有按钮 //所有按钮
const buttons = ref([{"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"isUse":true,"type":"primary"},{"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true,"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":false,"isUse":true},{"name":"变更","code":"update","icon":"ant-design:edit-filled","isDefault":false,"isUse":true},{"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true,"isUse":true}]); const buttons = ref([{"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"isUse":true,"type":"primary"},{"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true,"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":false,"isUse":true},{"name":"变更","code":"update","icon":"ant-design:edit-filled","isDefault":false,"isUse":true},{"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true,"isUse":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', 'update']); const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord', 'approve', 'update']);
const buttonConfigs = computed(()=>{ const buttonConfigs = computed(()=>{
@ -91,7 +92,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,delete : handleDelete, update:handleUpdate, approve:handleApprove} const btnEvent = {add : handleAdd,edit : handleEdit,refresh : handleRefresh,view : handleView,startwork : handleStartwork,flowRecord : handleFlowRecord,delete : handleDelete, update:handleUpdate, approve:handleApprove, datalog : handleDatalog}
const { currentRoute } = useRouter(); const { currentRoute } = useRouter();
const router = useRouter(); const router = useRouter();
@ -124,7 +125,7 @@
gutter: 16, gutter: 16,
}, },
schemas: customSearchFormSchema, schemas: customSearchFormSchema,
fieldMapToTime: [], fieldMapToTime: [['dateFrom', ['startDate', 'endDate'], 'YYYY-MM-DD']],
showResetButton: true, showResetButton: true,
}, },
beforeFetch: (params) => { beforeFetch: (params) => {
@ -322,8 +323,18 @@
dbClickRow(record); dbClickRow(record);
} }
onMounted(() => { onMounted(async() => {
let res = await getAllCom() || []
customSearchFormSchema.value.forEach(v => {
if (v.field == 'comId') {
v.componentProps.options = res.map(v=> {
return {
label: v.name,
value: v.id
}
})
}
});
if (schemaIdComputedRef.value) { if (schemaIdComputedRef.value) {
bus.on(FLOW_PROCESSED, handleRefresh); bus.on(FLOW_PROCESSED, handleRefresh);
bus.on(CREATE_FLOW, handleRefresh); bus.on(CREATE_FLOW, handleRefresh);
@ -350,7 +361,7 @@
let approveBtn: ActionItem[] = []; let approveBtn: ActionItem[] = [];
let hasFlowRecord = false; let hasFlowRecord = false;
actionButtonConfig.value?.map((button) => { actionButtonConfig.value?.map((button) => {
if (['view', 'copyData', 'enable', 'disable'].includes(button.code)) { if (['view', 'copyData', 'enable', 'disable','datalog'].includes(button.code)) {
actionsList.push({ actionsList.push({
icon: button?.icon, icon: button?.icon,
tooltip: button?.name, tooltip: button?.name,
@ -504,4 +515,22 @@
.hide{ .hide{
display: none !important; 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;
}
:deep( .ant-col-8:nth-child(4)) {
width: 320px !important;
max-width: 320px !important;;
}
:deep(.ant-col-8:nth-child(4) .ant-form-item-label) {
width: 80px !important;
}
:deep(.ant-col-8:nth-child(5) .ant-select-selector) {
width: 172px !important;
}
</style> </style>

View File

@ -6,6 +6,16 @@ export const formConfig = {
}; };
export const searchFormSchema: FormSchema[] = [ export const searchFormSchema: FormSchema[] = [
{
field: 'dateFrom',
label: '有效期',
component: 'RangePicker',
componentProps: {
format: 'YYYY-MM-DD',
style: { width: '100%' },
getPopupContainer: () => document.body,
},
},
{ {
field: 'kName', field: 'kName',
label: '合同号/名称', label: '合同号/名称',
@ -16,16 +26,30 @@ export const searchFormSchema: FormSchema[] = [
label: '客户', label: '客户',
component: 'Input', component: 'Input',
}, },
{
field: 'comId',
label: '合同主体',
component: 'Input',
},
{ {
field: 'pointUpName', field: 'pointUpName',
label: '交割点', label: '交割点',
component: 'Input', component: 'Input',
}, },
{
field: 'comId',
label: '合同主体',
component: 'Select',
componentProps: {
showSearch: true,
optionFilterProp: 'label',
filterOption: (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
},
options: [
// { label: '全部', value: '' },
],
placeholder: '请选择',
allowClear: true,
getPopupContainer: () => document.body,
},
},
{ {
field: 'approCode', field: 'approCode',
label: '审批状态', label: '审批状态',

View File

@ -25,12 +25,12 @@
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="有效期开始" name="dateFrom"> <a-form-item label="有效期开始" name="dateFrom">
<a-date-picker v-model:value="formState.dateFrom" style="width: 100%" :disabled="isDisable" :disabled-date="disabledDateStart" placeholder="请选择开始日期" /> <a-date-picker v-model:value="formState.dateFrom" style="width: 100%" @change="dateChange(formState.dateFrom, 'dateFrom')" :disabled="isDisable" :disabled-date="disabledDateStart" placeholder="请选择开始日期" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="有效期结束" name="dateTo"> <a-form-item label="有效期结束" name="dateTo">
<a-date-picker v-model:value="formState.dateTo" style="width: 100%" :disabled="isDisable" :disabled-date="disabledDateEnd" placeholder="请选择结束日期" /> <a-date-picker v-model:value="formState.dateTo" style="width: 100%" @change="dateChange(formState.dateTo, 'dateTo')" :disabled="isDisable" :disabled-date="disabledDateEnd" placeholder="请选择结束日期" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
@ -419,9 +419,24 @@
dataListAppro.value = val dataListAppro.value = val
} }
const getApproContractFactList = (val) => { const getApproContractFactList = (val) => {
console.log(val, 'dataListContractFact')
dataListContractFact.value = val dataListContractFact.value = val
} }
const dateChange = (val, k) => {
if (!val) {
if (k=='dateFrom') {
formState.dateFrom = dayjs(new Date())
setTimeout(() => {
formState.dateFrom = null
}, );
}
if (k=='dateTo') {
formState.dateTo = dayjs(new Date())
setTimeout(() => {
formState.dateTo = null
}, );
}
}
}
const disabledDateStart = (startValue) => { const disabledDateStart = (startValue) => {
const endValue = formState?.dateTo; const endValue = formState?.dateTo;
if (!startValue || !endValue) { if (!startValue || !endValue) {

View File

@ -58,7 +58,7 @@
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'; import { useUserStore } from '/@/store/modules/user';
import { getAllCom} from '/@/api/contract/ContractPurInt';
const userStore = useUserStore(); const userStore = useUserStore();
const userInfo = userStore.getUserInfo; const userInfo = userStore.getUserInfo;
@ -76,7 +76,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":"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":false},{"isUse":true,"name":"变更","code":"update","icon":"ant-design:edit-filled","isDefault":false},{"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":"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":false},{"isUse":true,"name":"变更","code":"update","icon":"ant-design:edit-filled","isDefault":false},{"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', 'update', 'approve']); const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord', 'update', 'approve']);
const buttonConfigs = computed(()=>{ const buttonConfigs = computed(()=>{
@ -91,7 +91,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,delete : handleDelete, update:handleUpdate, approve:handleApprove} const btnEvent = {add : handleAdd,edit : handleEdit,refresh : handleRefresh,view : handleView,startwork : handleStartwork,flowRecord : handleFlowRecord,delete : handleDelete, update:handleUpdate, approve:handleApprove,datalog : handleDatalog}
const { currentRoute } = useRouter(); const { currentRoute } = useRouter();
const router = useRouter(); const router = useRouter();
@ -124,7 +124,7 @@
gutter: 16, gutter: 16,
}, },
schemas: customSearchFormSchema, schemas: customSearchFormSchema,
fieldMapToTime: [], fieldMapToTime: [['dateFrom', ['startDate', 'endDate'], 'YYYY-MM-DD']],
showResetButton: true, showResetButton: true,
}, },
beforeFetch: (params) => { beforeFetch: (params) => {
@ -321,8 +321,18 @@
dbClickRow(record); dbClickRow(record);
} }
onMounted(() => { onMounted(async() => {
let res = await getAllCom() || []
customSearchFormSchema.value.forEach(v => {
if (v.field == 'comId') {
v.componentProps.options = res.map(v=> {
return {
label: v.name,
value: v.id
}
})
}
});
if (schemaIdComputedRef.value) { if (schemaIdComputedRef.value) {
bus.on(FLOW_PROCESSED, handleRefresh); bus.on(FLOW_PROCESSED, handleRefresh);
bus.on(CREATE_FLOW, handleRefresh); bus.on(CREATE_FLOW, handleRefresh);
@ -349,7 +359,7 @@
let approveBtn: ActionItem[] = []; let approveBtn: ActionItem[] = [];
let hasFlowRecord = false; let hasFlowRecord = false;
actionButtonConfig.value?.map((button) => { actionButtonConfig.value?.map((button) => {
if (['view', 'copyData', 'enable', 'disable'].includes(button.code)) { if (['view', 'copyData', 'enable', 'disable', 'datalog'].includes(button.code)) {
actionsList.push({ actionsList.push({
icon: button?.icon, icon: button?.icon,
tooltip: button?.name, tooltip: button?.name,
@ -502,4 +512,21 @@
.hide{ .hide{
display: none !important; 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;
}
:deep( .ant-col-8:nth-child(4)) {
width: 320px !important;
max-width: 320px !important;;
}
:deep(.ant-col-8:nth-child(4) .ant-form-item-label) {
width: 80px !important;
}
:deep(.ant-col-8:nth-child(5) .ant-select-selector) {
width: 172px !important;
}
</style> </style>

View File

@ -6,6 +6,16 @@ export const formConfig = {
}; };
export const searchFormSchema: FormSchema[] = [ export const searchFormSchema: FormSchema[] = [
{
field: 'dateFrom',
label: '有效期',
component: 'RangePicker',
componentProps: {
format: 'YYYY-MM-DD',
style: { width: '100%' },
getPopupContainer: () => document.body,
},
},
{ {
field: 'kName', field: 'kName',
label: '合同号/名称', label: '合同号/名称',
@ -16,6 +26,51 @@ export const searchFormSchema: FormSchema[] = [
label: '客户', label: '客户',
component: 'Input', component: 'Input',
}, },
{
field: 'longSpotCode',
label: '长协现货',
component: 'XjrSelect',
componentProps: {
datasourceType: 'dic',
params: { itemId: '2018871666841546754' },
labelField: 'name',
valueField: 'value',
getPopupContainer: () => document.body,
},
},
{
field: 'comId',
label: '合同主体',
component: 'Select',
componentProps: {
showSearch: true,
optionFilterProp: 'label',
filterOption: (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
},
options: [
// { label: '全部', value: '' },
],
placeholder: '请选择',
allowClear: true,
getPopupContainer: () => document.body,
},
},
{
field: 'approCode',
label: '审批状态',
component: 'XjrSelect',
componentProps: {
datasourceType: 'dic',
params: { itemId: '1990669393069129729' },
labelField: 'name',
valueField: 'value',
getPopupContainer: () => document.body,
},
},
]; ];
export const columns: BasicColumn[] = [ export const columns: BasicColumn[] = [
@ -25,7 +80,7 @@ export const columns: BasicColumn[] = [
title: '合同号', title: '合同号',
componentType: 'input', componentType: 'input',
align: 'left', align: 'left',
width:150,
sorter: true, sorter: true,
}, },
@ -39,7 +94,7 @@ export const columns: BasicColumn[] = [
}, },
{ {
dataIndex: 'cpCode', dataIndex: 'cpName',
title: '客户', title: '客户',
componentType: 'input', componentType: 'input',
align: 'left', align: 'left',
@ -52,7 +107,7 @@ export const columns: BasicColumn[] = [
title: '有效期开始', title: '有效期开始',
componentType: 'input', componentType: 'input',
align: 'left', align: 'left',
width: 120,
sorter: true, sorter: true,
}, },
@ -61,30 +116,30 @@ export const columns: BasicColumn[] = [
title: '有效期结束', title: '有效期结束',
componentType: 'input', componentType: 'input',
align: 'left', align: 'left',
width: 120,
sorter: true, sorter: true,
}, },
{ {
dataIndex: 'approCode', dataIndex: 'approName',
title: '状态', title: '状态',
componentType: 'input', componentType: 'input',
align: 'left', align: 'left',
width: 100,
sorter: true, sorter: true,
}, },
{ {
dataIndex: 'onlineSign', dataIndex: 'longSpotName',
title: ' 长协/现货', title: ' 长协/现货',
componentType: 'input', componentType: 'input',
align: 'left', align: 'left',
width: 100,
sorter: true, sorter: true,
}, },
{ {
dataIndex: 'comId', dataIndex: 'comName',
title: '合同主体', title: '合同主体',
componentType: 'input', componentType: 'input',
align: 'left', align: 'left',

View File

@ -0,0 +1,729 @@
<template>
<a-spin :spinning="spinning" tip="加载中...">
<div class="page-bg-wrap formViewStyle">
<a-form ref="formRef" :model="formState" :rules="rules" v-bind="layout">
<Card title="合同档案" :bordered="false" >
<a-row>
<a-col :span="8">
<a-form-item label="合同号" name="kNo">
<a-input v-model:value="formState.kNo" :disabled="isDisable" style="width: 65%" /><a-button v-if="!isDisable" type="primary" @click="onContract">关联合同</a-button>
</a-form-item>
</a-col>
<a-col :span="16">
<a-form-item label="合同名称" name="kName" :label-col="{ span: 4 }" :wrapper-col="{ span: 24 }">
<a-input v-model:value="formState.kName" placeholder="请输入合同名称" :disabled="isDisable"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="合同期限" name="kPeriod">
<a-select v-model:value="formState.kPeriod" :disabled="isDisable" placeholder="请选择合同期限" style="width: 100%" allow-clear @change="periodTypeCodeChange">
<a-select-option v-for="item in optionSelect.kPeriodList" :key="item.code" :value="item.code">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="有效期开始" name="dateFrom">
<a-date-picker v-model:value="formState.dateFrom" style="width: 100%" @change="dateChange(formState.dateFrom, 'dateFrom')" :disabled="isDisable" :disabled-date="disabledDateStart" placeholder="请选择开始日期" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="有效期结束" name="dateTo">
<a-date-picker v-model:value="formState.dateTo" style="width: 100%" @change="dateChange(formState.dateTo, 'dateTo')" :disabled="isDisable" :disabled-date="disabledDateEnd" placeholder="请选择结束日期" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="客户" name="cpName">
<a-input-search v-model:value="formState.cpName" :disabled="isDisable" placeholder="请选择客户" readonly @search="onSearchCustomer"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="业务人员" name="empName">
<a-input-search v-model:value="formState.empName" :disabled="isDisable" placeholder="请选择业务联系人" readonly @search="onSearchUser"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="业务部门" name="bDeptName">
<a-input-search v-model:value="formState.bDeptName" :disabled="isDisable" placeholder="请选择业务部门" readonly @search="onSearch"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="合同主体" name="comName">
<a-input v-model:value="formState.comName" disabled />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="币种" name="curCode">
<a-select v-model:value="formState.curCode" :disabled="isDisable" placeholder="请选择币种" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.curCodeList" :key="item.code" :value="item.code">
{{ item.fullName }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="状态" name="approCode">
<a-select v-model:value="formState.approCode" disabled style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.approCodeList" :key="item.code" :value="item.code">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
</a-row>
</Card>
<Card title="业务信息" :bordered="false" >
<a-row>
<a-col :span="8">
<a-form-item label="长协/现货" name="longSpotCode">
<a-select v-model:value="formState.longSpotCode" :disabled="isDisable" placeholder="请选择" style="width: 100%" allow-clear @change="periodTypeCodeChange">
<a-select-option v-for="item in optionSelect.longSpotCodeList" :key="item.code" :value="item.code">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="气源地" name="sourceName">
<a-input v-model:value="formState.lngContractSalesIntList[0].sourceName" :disabled="isDisable" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="销售区域" name="salesAreaCode">
<a-cascader v-model:value="formState.salesAreaCode" :options="options" :load-data="loadData" :disabled="isDisable" @change="onChange" change-on-select
:field-names="{label: 'fullName', value: 'code', children: 'children'}" placeholder="请选择区域"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="价格条款" name="prcTermCode">
<a-select v-model:value="formState.prcTermCode" :disabled="isDisable" placeholder="请选择" style="width: 100%" allow-clear @change="periodTypeCodeChange">
<a-select-option v-for="item in optionSelect.prcTermCodeList" :key="item.code" :value="item.code">
{{ item.fullName }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="价格说明" name="prcDesc" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.lngContractSalesIntList[0].prcDesc" :disabled="isDisable" :auto-size="{ minRows: 2, maxRows: 5 }"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="信用担保" name="crTermCode">
<a-select v-model:value="formState.crTermCode" :disabled="isDisable" placeholder="请选择" style="width: 100%" allow-clear @change="periodTypeCodeChange">
<a-select-option v-for="item in optionSelect.crTermCodeList" :key="item.code" :value="item.code">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="担保说明" name="crDesc" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.lngContractSalesIntList[0].crDesc" :disabled="isDisable" :auto-size="{ minRows: 2, maxRows: 5 }"/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="合同量" name="qtyFrom" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-input-number v-model:value="formState.lngContractSalesIntList[0].qtyFrom" style="width: 120px" :disabled="isDisable" :precision="3" :min="0" :max="formState.lngContractSalesIntList[0].qtyTo ? formState.lngContractSalesIntList[0].qtyTo : 999999999999999"/>
-
<a-input-number v-model:value="formState.lngContractSalesIntList[0].qtyTo" style="width: 120px" :disabled="isDisable" :precision="3" :min="formState.lngContractSalesIntList[0].qtyFrom ? formState.lngContractSalesIntList[0].qtyFrom : 0"></a-input-number>
<span>百万英热</span>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="合同约定" name="qtyDesc" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.qtyDesc" :disabled="isDisable" :auto-size="{ minRows: 2, maxRows: 5 }"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="甲烷最低含量" name="specCh4From">
<a-input-number v-model:value="formState.specCh4From" :disabled="isDisable" style="width: 100%" :precision="3" :min="0" />
</a-form-item>
</a-col>
<a-col :span="13">
<a-form-item label="热值范围" name="specMmbtuFrom">
<div class="inputCss">
<div> <a-input-number v-model:value="formState.specMmbtuFrom" :disabled="isDisable" :precision="3" :min="0" :max="formState.specMmbtuTo ? formState.specMmbtuTo : 999999999999999"/> </div>
<div style="margin: 0 5px">-</div>
<a-form-item name="specMmbtuTo">
<a-input-number v-model:value="formState.specMmbtuTo" :disabled="isDisable" :precision="3" :min="formState.specMmbtuFrom ? formState.specMmbtuFrom : 0"/>
百万英热/立方英尺
</a-form-item>
</div>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="气质约定" name="specDesc" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.lngContractSalesIntList[0].specDesc" :disabled="isDisable" :auto-size="{ minRows: 2, maxRows: 5 }"/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="付款日" name="afterInv" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<div style="display: flex;align-items: center;">
收到发票后
<a-input-number v-model:value="formState.lngContractSalesIntList[0].afterInv" :disabled="isDisable" :min="0" :precision="0" />
<a-select v-model:value="formState.lngContractSalesIntList[0].calTypeCode" :disabled="isDisable" placeholder="请选择" allow-clear style="width: 100px;margin-left: 10px;">
<a-select-option v-for="item in optionSelect.calTypeCodeList" :key="item.code" :value="item.code">
{{ item.name }}
</a-select-option>
</a-select>
</div>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="付款说明" name="paymentDesc" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.paymentDesc" :disabled="isDisable" :auto-size="{ minRows: 2, maxRows: 5 }"/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="装港" name="loadingPort" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-input v-model:value="formState.lngContractSalesIntList[0].loadingPort" :disabled="isDisable" />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="装港描述" name="loadingPortDesc" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.lngContractSalesIntList[0].loadingPortDesc" :disabled="isDisable" :auto-size="{ minRows: 2, maxRows: 5 }"/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="卸港" name="unloadingPort" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-input v-model:value="formState.lngContractSalesIntList[0].unloadingPort" :disabled="isDisable" />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="卸港描述" name="unloadingPortDesc" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.lngContractSalesIntList[0].unloadingPortDesc" :disabled="isDisable" :auto-size="{ minRows: 2, maxRows: 5 }"/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="装卸港条款" name="loadUnloadDesc" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.lngContractSalesIntList[0].loadUnloadDesc" :disabled="isDisable" :auto-size="{ minRows: 2, maxRows: 5 }"/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="滞期费说明" name="dmDesc" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.dmDesc" :disabled="isDisable" :auto-size="{ minRows: 2, maxRows: 5 }"/>
</a-form-item>
</a-col>
</a-row>
<div class="tip" @click="tipCheck">{{isExpend ? '其他说明收起' : '其他说明展开'}}</div>
<a-row v-show="isExpend">
<a-col :span="24">
<a-form-item label="交付说明" name="deliveryDesc" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.lngContractSalesIntList[0].deliveryDesc" :disabled="isDisable" :auto-size="{ minRows: 2, maxRows: 5 }"/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="计量说明" name="meaDesc" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.lngContractSalesIntList[0].meaDesc" :disabled="isDisable" :auto-size="{ minRows: 2, maxRows: 5 }"/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="保险说明" name="insurDesc" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.lngContractSalesIntList[0].insurDesc" :disabled="isDisable" :auto-size="{ minRows: 2, maxRows: 5 }"/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="所有权和风险说明" name="riskDesc" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.lngContractSalesIntList[0].riskDesc" :disabled="isDisable" :auto-size="{ minRows: 2, maxRows: 5 }"/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="GT&C" name="gtc" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.lngContractSalesIntList[0].gtc" :disabled="isDisable" :auto-size="{ minRows: 2, maxRows: 5 }"/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="法律仲裁" name="legalDesc" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.lngContractSalesIntList[0].legalDesc" :disabled="isDisable" :auto-size="{ minRows: 2, maxRows: 5 }"/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="违约条款" name="defaultDesc" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.lngContractSalesIntList[0].defaultDesc" :disabled="isDisable" :auto-size="{ minRows: 2, maxRows: 5 }"/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="备注" name="note" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.lngContractSalesIntList[0].note" :disabled="isDisable" :auto-size="{ minRows: 2, maxRows: 5 }"/>
</a-form-item>
</a-col>
</a-row>
</Card>
<Card title="附件信息" :bordered="false" >
<UploadList :disabled="isDisable" :list="dataFile" :value="formState.filePath" :tableName="tableName" :columnName="columnName" @change="uploadListChange"/>
</Card>
<Card title="关联合同信息" :bordered="false" >
<correlationContractFactList :list="dataListContractFact" :disabled="isDisable" @change="getApproContractFactList"></correlationContractFactList>
</Card>
<Card title="签报列表" :bordered="false" >
<correlationApproList :list="dataListAppro" :disabled="isDisable" @change="getApproList"></correlationApproList>
</Card>
</a-form>
</div>
<deptUserModal @register="register" @success="handleSuccess"/>
<deptListModal @register="registerDept" @success="handleSuccessDept" />
<contractFactListModal @register="registerContractFact" @success="handleSuccessContractFact" />
<customerListModal @register="registerCustomer" @success="handleSuccessCustomer" selectType="radio" />
</a-spin>
</template>
<script lang="ts" setup>
import { Card } from 'ant-design-vue';
import { useRouter } from 'vue-router';
import { FromPageType, RecordType } from '/@/enums/workflowEnum';
import { ref, computed, onMounted, onBeforeMount, nextTick, defineAsyncComponent, reactive, defineComponent, watch} from 'vue';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { useMultipleTabStore } from '/@/store/modules/multipleTab';
import useEventBus from '/@/hooks/event/useEventBus';
import type { Rule } from 'ant-design-vue/es/form';
import { getDictionary } from '/@/api/sales/Customer';
import { useModal } from '/@/components/Modal';
import {getAllPriceTerm} from '/@/api/contract/ContractPurInt';
import { addLngContract,updateLngContract, getLngContract} from '/@/api/contract/ContractSalesInt';
import { getAllCurrency } from '/@/api/contract/ContractFact';
import { getLngAppro,getCompDept } from '/@/api/approve/Appro';
import dayjs from 'dayjs';
import { getAppEnvConfig } from '/@/utils/env';
import { message } from 'ant-design-vue';
import UploadList from '/@/components/Form/src/components/UploadList.vue';
import deptUserModal from '/@/components/common/deptUserModal.vue';
import deptListModal from '/@/components/common/deptListModal.vue';
import correlationApproList from '/@/components/common/correlationApproList.vue';
import correlationContractFactList from '/@/components/common/correlationContractFactList.vue';
import contractFactListModal from '/@/components/common/contractFactListModal.vue';
import customerListModal from '/@/components/common/customerListModal.vue';
import { useUserStore } from '/@/store/modules/user';
import type { CascaderProps } from 'ant-design-vue';
import { getAreaList, getAreaInfo} from '/@/api/mdm/CountryRegion';
const userStore = useUserStore();
const userInfo = userStore.getUserInfo;
const tableName = 'ContractSalesInt';
const columnName = 'ContractSalesInt'
const formType = ref('2'); // 0 新建 1 修改 2 查看
const formRef = ref();
const props = defineProps({
disabled: false,
id: ''
});
const { bus, FORM_LIST_MODIFIED } = useEventBus();
const router = useRouter();
const { currentRoute } = router;
const isDisable = ref(false);
const { formPath } = currentRoute.value.query;
const pathArr = [];
const tabStore = useMultipleTabStore();
const formProps = ref(null);
const formId = ref(currentRoute.value?.params?.id);
const pageType = ref(currentRoute.value.query?.type);
const pageId = ref(currentRoute.value.query?.id)
const contractQty = ref()
const spinning = ref(false);
const curIdx = ref(null)
const { notification } = useMessage();
const { t } = useI18n();
const isExpend=ref(false)
const formState = reactive({
approCode: 'WTJ',
typeCode: 'SI',
onlineSign: 'N',
cpTableName: 'lng_customer',
lngContractSalesIntList: [{}]
});
const [register, { openModal:openModal}] = useModal();
const [registerDept, { openModal:openModalDept}] = useModal();
const [registerContractFact, { openModal:openModalContractFact}] = useModal();
const [registerCustomer, { openModal:openModalCustomer}] = useModal();
const rules= reactive({
kNo: [{ required: true, message: "该项为必填项", trigger: 'change' }],
kName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
cpName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
curCode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
empName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
bDeptName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
dateTo:[{ required: true, message: "该项为必填项", trigger: 'change' }],
dateFrom:[{ required: true, message: "该项为必填项", trigger: 'change' }],
longSpotCode:[{ required: true, message: "该项为必填项", trigger: 'change' }],
prcTermCode:[{ required: true, message: "该项为必填项", trigger: 'change' }],
crTermCode:[{ required: true, message: "该项为必填项", trigger: 'change' }],
qtyDesc:[{ required: true, message: "该项为必填项", trigger: 'change' }],
specCh4From:[{ required: true, message: "该项为必填项", trigger: 'change' }],
specMmbtuFrom:[{ required: true, message: "该项为必填项", trigger: 'change' }],
specMmbtuTo:[{ required: true, message: "该项为必填项", trigger: 'change' }],
paymentDesc:[{ required: true, message: "该项为必填项", trigger: 'change' }],
dmDesc:[{ required: true, message: "该项为必填项", trigger: 'change' }],
});
const layout = {
labelCol: { span: 8 },
wrapperCol: { span: 16 },
}
const dataFile = ref([]);
const dataListAppro = ref([])
const dataListContractFact = ref([])
let optionSelect= reactive({
approCodeList: [],
kPeriodList: [],
crTermCodeList: [],
longSpotCodeList: [],
curCodeList: [],
prcTermCodeList: [],
calTypeCodeList: []
});
watch(
() => props.id,
(val) => {
if (val) {
getInfo(val)
}
},
{
immediate: true
}
);
watch(
() => props.disabled,
(val) => {
isDisable.value = val
},
{
immediate: true
}
);
onMounted(() => {
getOption()
if (pageId.value) {
getInfo(pageId.value)
} else {
formState.empName = userInfo.name
formState.empId = userInfo.id
formState.tel = userInfo.mobile
}
initialFetch()
});
const options = ref<CascaderProps['options']>([]);
const loadData: CascaderProps['loadData'] = async (selectedOptions) => {
const targetOption = selectedOptions[selectedOptions.length - 1];
targetOption.loading = true;
try {
const res = await getAreaList({pid: targetOption.id, excludeType:'CONTINENT'});
if (Array.isArray(res)) {
const children = (res || []).map(item => {
return {
...item,
isLeaf: !item.hasChild,
}
});
targetOption.children = children;
return;
}
} catch (e) {
console.error(e);
} finally {
targetOption.loading = false;
}
};
async function initialFetch() {
try {
const res = await getAreaList({pid: '', excludeType:'CONTINENT'});
options.value = (res || []).map(item => {
return {
...item,
isLeaf: !item.hasChild,
}
})
} catch (error) {}
}
const onChange = (value, selectedOptions) => {
}
const getArea = async (val) => {
const resData = await getAreaInfo({code: val,excludeType:'CONTINENT' });
options.value = resData.areaList
formState.salesAreaCode = resData.regionCode
}
const periodTypeCodeChange = (val) => {
if (val !== 'Y') {
formState.dateFrom = dayjs('2000-01-01')
formState.dateTo = dayjs('2999-12-31')
}
}
const uploadListChange = (val) => {
dataFile.value = val
}
async function getInfo(id) {
spinning.value = true
try {
let data = await getLngContract(id)
spinning.value = false
Object.assign(formState, {...data})
Object.assign(dataFile.value, formState.lngFileUploadList || [])
Object.assign(dataListContractFact.value, formState.lngContractFactList || [])
Object.assign(dataListAppro.value, formState.lngApproVoList || [])
formState.dateFrom = formState.dateFrom ? dayjs(formState.dateFrom) : null
formState.dateTo = formState.dateTo ? dayjs(formState.dateTo) : null
formState.lngContractSalesIntList = formState?.lngContractSalesIntList || [{}]
formState.longSpotCode = (formState?.lngContractSalesIntList[0] || {}).longSpotCode
formState.prcTermCode = (formState?.lngContractSalesIntList[0] || {}).prcTermCode
formState.crTermCode = (formState?.lngContractSalesIntList[0] || {}).crTermCode
formState.qtyDesc = (formState?.lngContractSalesIntList[0] || {}).qtyDesc
formState.specCh4From = (formState?.lngContractSalesIntList[0] || {}).specCh4From
formState.specMmbtuFrom = (formState?.lngContractSalesIntList[0] || {}).specMmbtuFrom
formState.specMmbtuTo = (formState?.lngContractSalesIntList[0] || {}).specMmbtuTo
formState.paymentDesc = (formState?.lngContractSalesIntList[0] || {}).paymentDesc
formState.dmDesc = (formState?.lngContractSalesIntList[0] || {}).dmDesc
if ((formState?.lngContractSalesIntList[0] || {}).salesAreaCode) {
getArea((formState?.lngContractSalesIntList[0] || {}).salesAreaCode)
}
dataListAppro.value.forEach(v => {
v.approId = v.id
})
dataListContractFact.value.forEach(v => {
v.kFactId = v.id
})
} catch (error) {
console.log(error, 'error')
spinning.value = false
}
}
async function getOption() {
optionSelect.kPeriodList = await getDictionary('LNG_K_PER')
optionSelect.uomCodeList = await getDictionary('LNG_UOM')
optionSelect.approCodeList = await getDictionary('LNG_APPRO')
optionSelect.curCodeList = await getAllCurrency()
optionSelect.prcTermCodeList = await getAllPriceTerm()
optionSelect.longSpotCodeList = await getDictionary('LNG_LONG')
optionSelect.crTermCodeList = await getDictionary('LNG_CREDIT')
optionSelect.calTypeCodeList = await getDictionary('LNG_CAL')
if (!pageId.value) {
const res = await getCompDept(userInfo.id)
formState.bDeptName = res?.dept?.name
formState.bDeptId = res?.dept?.id
formState.comName = res?.comp?.name
formState.comId = res?.comp?.id
}
}
const tipCheck = () => {
isExpend.value = !isExpend.value
}
const getApproList = (val) => {
dataListAppro.value = val
}
const getApproContractFactList = (val) => {
dataListContractFact.value = val
}
const dateChange = (val, k) => {
if (!val) {
if (k=='dateFrom') {
formState.dateFrom = dayjs(new Date())
setTimeout(() => {
formState.dateFrom = null
}, );
}
if (k=='dateTo') {
formState.dateTo = dayjs(new Date())
setTimeout(() => {
formState.dateTo = null
}, );
}
}
}
const disabledDateStart = (startValue) => {
const endValue = formState?.dateTo;
if (!startValue || !endValue) {
return false
}
return startValue.valueOf() >= endValue.valueOf();
}
const disabledDateEnd = (endValue) => {
const startValue = formState?.dateFrom;
if (!endValue || !startValue) {
return false
}
return endValue.valueOf() <= startValue.valueOf();
}
const onSearch = (val)=> {
openModalDept(true,{isUpdate: false})
}
const onSearchCustomer = () => {
openModalCustomer(true,{isUpdate: false})
}
const onSearchUser = (val)=> {
openModal(true,{isUpdate: false})
}
const onContract = (val)=> {
openModalContractFact(true,{isUpdate: false})
}
const handleSuccess = (val) => {
formState.empName = val[0].name
formState.empId = val[0].id
formState.tel = val[0].mobile
}
const handleSuccessDept = (val, info) => {
formState.bDeptName = val[0].name
formState.bDeptId = val[0].id
formState.comName = info.name
formState.comId = info.id
}
const handleSuccessCustomer = (val) => {
formState.cpCode = val[0].cuCode
formState.cpName = val[0].cuName
}
const handleSuccessContractFact = (val) => {
val.forEach(v => {
v.kFactId = v.id
v.id = null
})
if (!dataListContractFact.value.length) {
dataListContractFact.value = val
return
}
let arr = []
val.forEach(v => {
dataListContractFact.value.forEach(i => {
if (v.kNo == i.kNo){
message.warning(v.kNo + '已重复, 合同不需要重复选择')
} else {
arr.push(v)
}
})
})
dataListContractFact.value = unique([...dataListContractFact.value, ...arr], 'kNo')
}
function unique(arr, u_key) {
const map = new Map()
arr.forEach((item, index) => {
if (!map.has(item[u_key])) {
map.set(item[u_key], item)
}
})
return [...map.values()]
}
function close() {
tabStore.closeTab(currentRoute.value, router);
}
async function getFormValue() {
return formState
}
async function handleSubmit(type) {
try {
await formRef.value.validateFields();
dataListAppro.value.forEach((v,idx)=>{
v.tableName = 'Ing_contract'
v.sort = idx
})
dataListContractFact.value.forEach((v,idx)=> {
v.sort = idx
})
let obj = {
...formState,
lngFileUploadList: dataFile.value,
lngContractFactRelList: dataListContractFact.value,
lngContractApproRelList: dataListAppro.value,
lngContractSalesIntList: [
{
...formState.lngContractSalesIntList[0],
"kId": formState.id,
"longSpotCode": formState.longSpotCode,
"prcTermCode": formState.prcTermCode,
"crTermCode": formState.crTermCode,
'qtyDesc': formState.qtyDesc,
'specCh4From': formState.specCh4From,
specMmbtuFrom: formState.specMmbtuFrom,
specMmbtuTo: formState.specMmbtuTo,
paymentDesc: formState.paymentDesc,
dmDesc: formState.dmDesc,
salesAreaCode: formState.salesAreaCode ? formState.salesAreaCode[formState.salesAreaCode.length -1] : ''
}
],
salesAreaCode: '',
approCode: pageType.value=='update' ? 'WTJ' : formState.approCode
}
spinning.value = true;
let request = !formState.id ? addLngContract :updateLngContract
try {
const data = await request(obj);
// 新增保存
if (data?.id) {
getInfo(data?.id)
}
// 同意保存不提示
if (!type) {
notification.success({
message: 'Tip',
description: data?.id ? t('新增成功!') : t('修改成功!')
}); //提示消息
}
return data?.id ? data : obj
} finally {
spinning.value = false;
}
} catch (errorInfo) {
console.log(errorInfo, 'errorInfo')
spinning.value = false;
errorInfo?.errorFields?.length && notification.warning({
message: 'Tip',
description: '请完善信息'
});
return false
}
}
defineExpose({
handleSubmit,
getFormValue
});
</script>
<style lang="less" scoped>
:deep(.ant-form-item .ant-form-item-label) {
width: 135px !important;
max-width: 135px !important;
}
.page-bg-wrap {
background-color: #fff;
}
.top-toolbar {
min-height: 44px;
margin-bottom: 12px;
border-bottom: 1px solid #eee;
}
.inputCss {
display: flex;
margin-bottom: -24px;
}
.tip {
text-align: center;
margin-bottom: 15px;
color: #5e95ff;
cursor: pointer;
}
</style>

View File

@ -57,6 +57,10 @@
import useEventBus from '/@/hooks/event/useEventBus'; import useEventBus from '/@/hooks/event/useEventBus';
import { cloneDeep } from 'lodash-es'; import { cloneDeep } from 'lodash-es';
import { getAllCom} from '/@/api/contract/ContractPurInt';
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 +76,7 @@
const tableRef = ref(); const tableRef = ref();
//所有按钮 //所有按钮
const buttons = ref([{"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"isUse":true, "type":"primary"},{"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true,"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":"update","icon":"ant-design:edit-filled","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,"isUse":true}]); const buttons = ref([{"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"isUse":true, "type":"primary"},{"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true,"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":"update","icon":"ant-design:edit-filled","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,"isUse":true},{"name":"数据日志","code":"datalog","icon":"ant-design:profile-outlined","isDefault":true,"isUse":true}]);
//展示在列表内的按钮 //展示在列表内的按钮
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord', 'update', 'approve']); const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord', 'update', 'approve']);
const buttonConfigs = computed(()=>{ const buttonConfigs = computed(()=>{
@ -87,7 +91,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,update : handleUpdate,approve : handleApprove,delete : handleDelete,} const btnEvent = {add : handleAdd,edit : handleEdit,refresh : handleRefresh,view : handleView,startwork : handleStartwork,flowRecord : handleFlowRecord,update : handleUpdate,approve : handleApprove,delete : handleDelete,datalog : handleDatalog}
const { currentRoute } = useRouter(); const { currentRoute } = useRouter();
const router = useRouter(); const router = useRouter();
@ -119,7 +123,7 @@
gutter: 16, gutter: 16,
}, },
schemas: customSearchFormSchema, schemas: customSearchFormSchema,
fieldMapToTime: [], fieldMapToTime: [['dateFrom', ['startDate', 'endDate'], 'YYYY-MM-DD']],
showResetButton: true, showResetButton: true,
}, },
beforeFetch: (params) => { beforeFetch: (params) => {
@ -157,7 +161,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) {
@ -167,18 +173,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/ContractSalesInt/' + record.id + '/viewForm', router.push({
query: { path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow',
formPath: 'contract/ContractSalesInt', query: {
formName: formName, formPath: 'contract/ContractSalesInt',
formId:currentRoute.value.meta.formId formName: "查看"+formName,
} formId:currentRoute.value.meta.formId,
}); type:'edit',
id: record.id,
disabled: 1,
}
});
}
// router.push({
// path: '/form/ContractSalesInt/' + record.id + '/viewForm',
// query: {
// formPath: 'contract/ContractSalesInt',
// formName: formName,
// formId:currentRoute.value.meta.formId
// }
// });
} }
} }
@ -213,21 +233,57 @@
} }
function handleEdit(record: Recordable) { function handleEdit(record: Recordable) {
if (schemaIdComputedRef.value) {
router.push({ router.push({
path: '/form/ContractSalesInt/' + record.id + '/updateForm', path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow',
query: { query: {
formPath: 'contract/ContractSalesInt', formPath: 'contract/ContractSalesInt',
formName: formName, formName: "编辑"+formName,
formId:currentRoute.value.meta.formId formId:currentRoute.value.meta.formId,
} type:'edit',
}); id: record.id
}
});
} else {
router.push({
path: '/form/ContractSalesInt/' + record.id + '/updateForm',
query: {
formPath: 'contract/ContractSalesInt',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
}
} }
function handleUpdate(record: Recordable) { function handleUpdate(record: Recordable) {
const { processId, taskIds, schemaId } = record.workflowData || {};
if (schemaIdComputedRef.value) {
router.push({
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow',
query: {
formPath: 'contract/ContractSalesInt',
formName: "变更"+formName,
formId:currentRoute.value.meta.formId,
type:'update',
id: record.id,
processId: processId
}
});
}
} }
function handleApprove(record: Recordable) { 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 handleDelete(record: Recordable) { function handleDelete(record: Recordable) {
deleteList([record.id]); deleteList([record.id]);
@ -264,8 +320,18 @@
dbClickRow(record); dbClickRow(record);
} }
onMounted(() => { onMounted(async() => {
let res = await getAllCom() || []
customSearchFormSchema.value.forEach(v => {
if (v.field == 'comId') {
v.componentProps.options = res.map(v=> {
return {
label: v.name,
value: v.id
}
})
}
});
if (schemaIdComputedRef.value) { if (schemaIdComputedRef.value) {
bus.on(FLOW_PROCESSED, handleRefresh); bus.on(FLOW_PROCESSED, handleRefresh);
bus.on(CREATE_FLOW, handleRefresh); bus.on(CREATE_FLOW, handleRefresh);
@ -288,9 +354,11 @@
let actionsList: ActionItem[] = []; let actionsList: ActionItem[] = [];
let editAndDelBtn: ActionItem[] = []; let editAndDelBtn: ActionItem[] = [];
let hasFlowRecord = false; let updateBtn: ActionItem[] = [];
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,
@ -304,22 +372,53 @@
color: button.code === 'delete' ? 'error' : undefined, color: button.code === 'delete' ? 'error' : undefined,
onClick: btnEvent[button.code].bind(null, record), onClick: btnEvent[button.code].bind(null, record),
}); });
}
if (['update'].includes(button.code)) {
updateBtn.push({
icon: button?.icon,
tooltip: button?.name,
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.approCode == 'YSP') {
actionsList = actionsList.concat(updateBtn);
}
// 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) {
@ -410,4 +509,21 @@
.hide{ .hide{
display: none !important; 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;
}
:deep( .ant-col-8:nth-child(4)) {
width: 320px !important;
max-width: 320px !important;;
}
:deep(.ant-col-8:nth-child(4) .ant-form-item-label) {
width: 80px !important;
}
:deep(.ant-col-8:nth-child(5) .ant-select-selector) {
width: 172px !important;
}
</style> </style>

View File

@ -6,7 +6,16 @@ export const formConfig = {
}; };
export const searchFormSchema: FormSchema[] = [ export const searchFormSchema: FormSchema[] = [
{
field: 'dateFrom',
label: '有效期',
component: 'RangePicker',
componentProps: {
format: 'YYYY-MM-DD',
style: { width: '100%' },
getPopupContainer: () => document.body,
},
},
{ {
field: 'kName', field: 'kName',
label: '合同号/名称', label: '合同号/名称',
@ -17,6 +26,38 @@ export const searchFormSchema: FormSchema[] = [
label: '客户', label: '客户',
component: 'Input', component: 'Input',
}, },
{
field: 'comId',
label: '合同主体',
component: 'Select',
componentProps: {
showSearch: true,
optionFilterProp: 'label',
filterOption: (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
},
options: [
// { label: '全部', value: '' },
],
placeholder: '请选择',
allowClear: true,
getPopupContainer: () => document.body,
},
},
{
field: 'approCode',
label: '审批状态',
component: 'XjrSelect',
componentProps: {
datasourceType: 'dic',
params: { itemId: '1990669393069129729' },
labelField: 'name',
valueField: 'value',
getPopupContainer: () => document.body,
},
},
]; ];
export const columns: BasicColumn[] = [ export const columns: BasicColumn[] = [

View File

@ -30,12 +30,12 @@
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="有效期开始" name="dateFrom"> <a-form-item label="有效期开始" name="dateFrom">
<a-date-picker v-model:value="formState.dateFrom" style="width: 100%" :disabled="isDisable" :disabled-date="disabledDateStart" placeholder="请选择开始日期" /> <a-date-picker v-model:value="formState.dateFrom" style="width: 100%" @change="dateChange(formState.dateFrom, 'dateFrom')" :disabled="isDisable" :disabled-date="disabledDateStart" placeholder="请选择开始日期" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="有效期结束" name="dateTo"> <a-form-item label="有效期结束" name="dateTo">
<a-date-picker v-model:value="formState.dateTo" style="width: 100%" :disabled="isDisable" :disabled-date="disabledDateEnd" placeholder="请选择结束日期" /> <a-date-picker v-model:value="formState.dateTo" style="width: 100%" @change="dateChange(formState.dateTo, 'dateTo')" :disabled="isDisable" :disabled-date="disabledDateEnd" placeholder="请选择结束日期" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
@ -366,9 +366,24 @@
dataListAppro.value = val dataListAppro.value = val
} }
const getApproContractFactList = (val) => { const getApproContractFactList = (val) => {
console.log(val, 'dataListContractFact')
dataListContractFact.value = val dataListContractFact.value = val
} }
const dateChange = (val, k) => {
if (!val) {
if (k=='dateFrom') {
formState.dateFrom = dayjs(new Date())
setTimeout(() => {
formState.dateFrom = null
}, );
}
if (k=='dateTo') {
formState.dateTo = dayjs(new Date())
setTimeout(() => {
formState.dateTo = null
}, );
}
}
}
const disabledDateStart = (startValue) => { const disabledDateStart = (startValue) => {
const endValue = formState?.dateTo; const endValue = formState?.dateTo;
if (!startValue || !endValue) { if (!startValue || !endValue) {

View File

@ -59,6 +59,7 @@
import useEventBus from '/@/hooks/event/useEventBus'; import useEventBus from '/@/hooks/event/useEventBus';
import { cloneDeep } from 'lodash-es'; import { cloneDeep } from 'lodash-es';
import { getAllCom} from '/@/api/contract/ContractPurInt';
import { useUserStore } from '/@/store/modules/user'; import { useUserStore } from '/@/store/modules/user';
const userStore = useUserStore(); const userStore = useUserStore();
const userInfo = userStore.getUserInfo; const userInfo = userStore.getUserInfo;
@ -77,7 +78,7 @@
const tableRef = ref(); const tableRef = ref();
//所有按钮 //所有按钮
const buttons = ref([{"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"isUse":true,"type":"primary"},{"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true,"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":"update","icon":"ant-design:edit-filled","isDefault":true,"isUse":true},{"name":"审批","code":"approve","icon":"ant-design:check-outlined","isDefault":true,"isUse":true},{"name":"提交","code":"submit","icon":"ant-design:send-outlined","isDefault":false,"isUse":true},{"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true,"isUse":true}]); const buttons = ref([{"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"isUse":true,"type":"primary"},{"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true,"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":"update","icon":"ant-design:edit-filled","isDefault":true,"isUse":true},{"name":"审批","code":"approve","icon":"ant-design:check-outlined","isDefault":true,"isUse":true},{"name":"提交","code":"submit","icon":"ant-design:send-outlined","isDefault":false,"isUse":true},{"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true,"isUse":true},{"name":"数据日志","code":"datalog","icon":"ant-design:profile-outlined","isDefault":true,"isUse":true}]);
//展示在列表内的按钮 //展示在列表内的按钮
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord','update', 'approve','submit']); const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord','update', 'approve','submit']);
const buttonConfigs = computed(()=>{ const buttonConfigs = computed(()=>{
@ -92,7 +93,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,update : handleUpdate,approve : handleApprove,delete : handleDelete,} const btnEvent = {add : handleAdd,edit : handleEdit,refresh : handleRefresh,view : handleView,startwork : handleStartwork,flowRecord : handleFlowRecord,update : handleUpdate,approve : handleApprove,delete : handleDelete,datalog : handleDatalog}
const { currentRoute } = useRouter(); const { currentRoute } = useRouter();
const router = useRouter(); const router = useRouter();
@ -124,7 +125,7 @@
gutter: 16, gutter: 16,
}, },
schemas: customSearchFormSchema, schemas: customSearchFormSchema,
fieldMapToTime: [], fieldMapToTime: [['dateFrom', ['startDate', 'endDate'], 'YYYY-MM-DD']],
showResetButton: true, showResetButton: true,
}, },
beforeFetch: (params) => { beforeFetch: (params) => {
@ -323,8 +324,18 @@
dbClickRow(record); dbClickRow(record);
} }
onMounted(() => { onMounted(async() => {
let res = await getAllCom() || []
customSearchFormSchema.value.forEach(v => {
if (v.field == 'comId') {
v.componentProps.options = res.map(v=> {
return {
label: v.name,
value: v.id
}
})
}
});
if (schemaIdComputedRef.value) { if (schemaIdComputedRef.value) {
bus.on(FLOW_PROCESSED, handleRefresh); bus.on(FLOW_PROCESSED, handleRefresh);
bus.on(CREATE_FLOW, handleRefresh); bus.on(CREATE_FLOW, handleRefresh);
@ -351,7 +362,7 @@
let approveBtn: ActionItem[] = []; let approveBtn: ActionItem[] = [];
let hasFlowRecord = false; 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,
@ -503,4 +514,22 @@
.hide{ .hide{
display: none !important; 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;
}
:deep( .ant-col-8:nth-child(4)) {
width: 320px !important;
max-width: 320px !important;;
}
:deep(.ant-col-8:nth-child(4) .ant-form-item-label) {
width: 80px !important;
}
:deep(.ant-col-8:nth-child(4) .ant-select-selector) {
width: 232px !important;
}
</style> </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/PngSettleHdr';
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,730 @@
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: '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: 'comName',
title: '交易主体',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'settleDesc',
title: '结算说明',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'deptId',
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: '0e5177531b9440538e5db1d02a4afa95',
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: 'd5345f2f5c10465c8e8f071c5fcda584',
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: '79b1cdf4156a4477a19edcec99d81d56',
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: 'b95db041a20a486cbfec71480fb8aa8b',
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: '23202591851543e6952e6a1c8b7a906a',
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: '8085c8a6f656473eb050a094b5edc506',
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: '4ea1df548ccd4277ac271319f90f98c3',
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: '7278b21860fa4ae4a37824424919d58f',
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: '874e0a0e29ae40ed94e6b5e04597a739',
field: 'comId',
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: '3fff1f671839416091a04863bf9fc03a',
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: '5597f98607194b2badd2b7469b56deab',
field: 'deptId',
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: 'ce05d6adcf1a4e8bbd107db8b21a6b04',
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: 'a15631219b3e4f87bdc6dd027c088aaf',
label: '表格组件',
field: 'lngPngSettleSalesList',
type: 'form',
component: 'SubForm',
required: true,
colProps: { span: 24 },
componentProps: {
mainKey: 'lngPngSettleSalesList',
columns: [
{
key: '0e65269b143b4a539075fc0645c0754f',
title: '单行文本',
dataIndex: 'settleMonth',
componentType: 'Input',
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,
},
},
{ 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: 'cd4b0b5719ff4c5fb8bdb179b49fd545',
label: '表格组件',
field: 'lngPngSettleSalesDtlList',
type: 'form',
component: 'SubForm',
required: true,
colProps: { span: 24 },
componentProps: {
mainKey: 'lngPngSettleSalesDtlList',
columns: [
{
key: 'f3c19f1b49f94470b9ebe7e28be90c62',
title: '单行文本',
dataIndex: 'priceCode',
componentType: 'Input',
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,
},
},
{ 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,453 @@
<template>
<a-spin :spinning="spinning" tip="加载中...">
<div class="page-bg-wrap formViewStyle">
<a-form ref="formRef" :model="formState" :rules="rules" v-bind="layout">
<Card title="" :bordered="false" >
<a-row>
<a-col :span="8">
<a-form-item label="结算月" name="settleMonth">
<a-date-picker v-model:value="formState.settleMonth" style="width: 100%" picker="month" :disabled="isDisable" placeholder="请选择结算月" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="结算月开始日期" name="dateFrom">
<a-date-picker v-model:value="formState.dateFrom" style="width: 100%" :disabled="isDisable" :disabled-date="disabledDateStart" placeholder="请选择开始日期" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="结算月结束日期" name="dateTo">
<a-date-picker v-model:value="formState.dateTo" style="width: 100%" :disabled="isDisable" :disabled-date="disabledDateEnd" placeholder="请选择结束日期" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="客户" name="cpName">
<a-input-search v-model:value="formState.cpName" :disabled="isDisable || dataList.length" placeholder="请选择客户" readonly @search="onSearchCustomer"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="交易主体" name="comId">
<a-select v-model:value="formState.comId" :disabled="isDisable || dataList.length" @change="comIdChange" placeholder="请选择" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.comIdList" :key="item.id" :value="item.id">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="账期内含预收付款" name="rpSign">
<a-select v-model:value="formState.rpSign" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.signList" :key="item.code" :value="item.code">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="结算总数量(吉焦)" name="qtySettleGj">
<a-input v-model:value="formState.qtySettleGj" disabled/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="结算总数量(方)" name="qtySettleM3">
<a-input v-model:value="formState.qtySettleM3" disabled/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="结算总金额(元)" name="amount">
<a-input v-model:value="formState.amount" disabled/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="状态" name="approCode">
<a-select v-model:value="formState.approCode" disabled style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.approCodeList" :key="item.code" :value="item.code">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="结算说明" name="settleDesc" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.settleDesc" :disabled="isDisable" :auto-size="{ minRows: 2, maxRows: 5 }"/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="备注" name="note" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.note" :disabled="isDisable" :auto-size="{ minRows: 2, maxRows: 5 }"/>
</a-form-item>
</a-col>
</a-row>
</Card>
<Card>
<div>
<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>
</div>
<a-table :columns="columns" :data-source="dataList" :scroll="{x: 1300}" 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>
</template>
<template v-if="column.dataIndex === 'priceDesc'">
<a v-if="!isDisable" @click="btnCheck(record, index, 'price')">增量</a>
</template>
</template>
</a-table>
</Card>
<Card title="对账单" :bordered="false" >
<UploadList :disabled="isDisable" btnTip="上传对账单" :list="dataFileAccount" :value="formState.filePath" :tableName="tableName" :columnName="columnName" @change="uploadChange"/>
</Card>
<Card title="附件信息" :bordered="false" >
<UploadList :disabled="isDisable" :list="dataFile" :value="formState.filePath" :tableName="tableName" :columnName="columnName" @change="uploadListChange"/>
</Card>
</a-form>
</div>
<customerListModal @register="registerCustomer" @success="handleSuccessCustomer" selectType="radio" />
<measureListModal @register="registerMeasure" @success="handleSuccessMeasure"></measureListModal>
<priceComposeListModal @register="registerPrice" @success="handleSuccessPrice"></priceComposeListModal>
</a-spin>
</template>
<script lang="ts" setup>
import { Card } from 'ant-design-vue';
import { useRouter } from 'vue-router';
import { FromPageType, RecordType } from '/@/enums/workflowEnum';
import { ref, computed, onMounted, onBeforeMount, nextTick, defineAsyncComponent, reactive, defineComponent, watch} from 'vue';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { useMultipleTabStore } from '/@/store/modules/multipleTab';
import useEventBus from '/@/hooks/event/useEventBus';
import type { Rule } from 'ant-design-vue/es/form';
import { getDictionary } from '/@/api/sales/Customer';
import { useModal } from '/@/components/Modal';
import { addLngPngSettleHdr,updateLngPngSettleHdr, getLngPngSettleHdr, getLngPngSettleHdrDate} from '/@/api/dayPlan/PngSettleHdr';
import dayjs from 'dayjs';
import { getAppEnvConfig } from '/@/utils/env';
import { message } from 'ant-design-vue';
import UploadList from '/@/components/Form/src/components/UploadList.vue';
import customerListModal from '/@/components/common/customerListModal.vue';
import measureListModal from '/@/components/common/measureListModal.vue';
import priceComposeListModal from '/@/components/common/priceComposeListModal.vue';
import { getAllCom} from '/@/api/contract/ContractPurInt';
const tableName = 'ContractSalesInt';
const columnName = 'ContractSalesInt'
const formType = ref('2'); // 0 新建 1 修改 2 查看
const formRef = ref();
const props = defineProps({
disabled: false,
id: ''
});
const { bus, FORM_LIST_MODIFIED } = useEventBus();
const router = useRouter();
const { currentRoute } = router;
const isDisable = ref(false);
const { formPath } = currentRoute.value.query;
const pathArr = [];
const tabStore = useMultipleTabStore();
const formProps = ref(null);
const formId = ref(currentRoute.value?.params?.id);
const pageType = ref(currentRoute.value.query?.type);
const pageId = ref(currentRoute.value.query?.id)
const spinning = ref(false);
const { notification } = useMessage();
const { t } = useI18n();
const formState = reactive({
approCode: 'WTJ',
settleMonth: dayjs(new Date()),
settleTypeCode: 'I',
rpSign: 'Y'
});
const [registerMeasure, { openModal:openModalMeasure}] = useModal();
const [registerCustomer, { openModal:openModalCustomer}] = useModal();
const [registerPrice, { openModal:openModalPrice}] = useModal();
const rules= reactive({
settleMonth: [{ required: true, message: "该项为必填项", trigger: 'change' }],
dateFrom: [{ required: true, message: "该项为必填项", trigger: 'change' }],
dateTo: [{ required: true, message: "该项为必填项", trigger: 'change' }],
cpName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
rpSign: [{ required: true, message: "该项为必填项", trigger: 'change' }],
comId: [{ required: true, message: "该项为必填项", trigger: 'change' }],
});
const layout = {
labelCol: { span: 8 },
wrapperCol: { span: 16 },
}
const dataFile = ref([]);
const dataFileAccount = ref([])
const dataList = ref([])
let optionSelect= reactive({
approCodeList: [],
comIdList: [],
signList: []
});
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: 'pointDelyName',width: 150 },
{ title: t('完成量(吉焦)'), dataIndex: 'qtyMeaGj', width: 120},
{ title: t('完成量(方)'), dataIndex: 'qtyMeaM3', width: 120},
{ title: t('结算量(吉焦)'), dataIndex: 'qtySettleGj', width: 120},
{ title: t('结算量(方)'), dataIndex: 'qtySettleM3', width: 120},
{ title: t('结算价格(元/吉焦)'), dataIndex: 'priceGj', width: 120},
{ title: t('结算价格(元/方)'), dataIndex: 'priceM3', width: 120},
{ title: t('结算金额(元)'), dataIndex: 'amount', width: 120},
{ title: t('价格组成'), dataIndex: 'priceDesc', width: 120},
{ title: t('合同名称'), dataIndex: 'kName', width: 120},
{ title: t('操作'), dataIndex: 'operation', width: 220},
]);
watch(
() => props.id,
(val) => {
if (val) {
getInfo(val)
}
},
{
immediate: true
}
);
watch(
() => props.disabled,
(val) => {
isDisable.value = val
},
{
immediate: true
}
);
onMounted(() => {
getOption()
if (pageId.value) {
getInfo(pageId.value)
}
});
const onSelectChange = (rowKeys) => {
selectedKeys.value = rowKeys;
}
const uploadChange = (val) => {
dataFileAccount.value = val
}
const uploadListChange = (val) => {
dataFile.value = val
}
async function getInfo(id) {
spinning.value = true
try {
let data = await getLngPngSettleHdr(id)
spinning.value = false
Object.assign(formState, {...data})
Object.assign(dataFile.value, formState.lngFileUploadList || [])
formState.dateFrom = formState.dateFrom ? dayjs(formState.dateFrom) : null
formState.dateTo = formState.dateTo ? dayjs(formState.dateTo) : null
} catch (error) {
console.log(error, 'error')
spinning.value = false
}
}
const comIdChange = (val) => {
if (!val)return
getDate()
}
const getDate=(async () => {
let obj = {
cpCode: formState.cpCode,
comId: formState.comId
}
if (!pageId.value && formState.cpCode && formState.comId && !formState.dateFrom) {
let data = await getLngPngSettleHdrDate(obj) || []
if (data.length) {
formState.dateFrom = data[0]
formState.dateTo = null
}
}
})
async function getOption() {
optionSelect.approCodeList = await getDictionary('LNG_APPRO')
optionSelect.comIdList = await getAllCom() || []
optionSelect.signList = await getDictionary('LNG_YN')
}
const disabledDateStart = (startValue) => {
const endValue = formState?.dateTo;
if (!startValue || !endValue) {
return false
}
return startValue.valueOf() >= endValue.valueOf();
}
const disabledDateEnd = (endValue) => {
const startValue = formState?.dateFrom;
if (!endValue || !startValue) {
return false
}
return endValue.valueOf() <= startValue.valueOf();
}
const handleBtn = (type) => {
if (type === 'add') {
openModalMeasure(true,{isUpdate: false})
} else {
if (!selectedKeys.value.length) {
message.warn('请选择删除数据')
return
}
selectedKeys.value.forEach(i => {
let idx = dataList.value.findIndex(v=>v.salesId == i)
idx>-1&&dataList.value.splice(idx, 1)
});
setTimeout(() => {
selectedKeys.value = []
}, 8000);
}
}
const handleSuccessMeasure = (val) => {
if (!dataList.value.length) {
dataList.value = val
return
}
val.forEach(v=> {
dataList.value.forEach(k=> {
if (v.salesId!==k.salesId) {
dataList.value.push(v)
}
})
})
}
const btnCheck = (record, index, type) => {
if (type == 'delete') {
dataList.value.splice(index, 1)
} else {
openModalPrice(true,{isUpdate: false, record})
}
}
const handleSuccessPrice = (arr, curRecord) => {
let qtySettleGj = 0
let qtySettleM3 = 0
let amount = 0
arr.forEach(v=> {
qtySettleGj+=Number(v.qtySettleGj) || 0
qtySettleM3+=Number(v.qtySettleM3) || 0
amount+=Number(v.amount) || 0
})
// price_gj=amount/qty_settle_gj保留4位小数
// price_m3=amount/qty_settle_m3保留4位小数
let priceGj = qtySettleGj ? Number(amount) / Number(qtySettleGj) : '0'
let priceM3 = qtySettleM3 ? Number(amount) / Number(qtySettleM3) : '0'
let idx = dataList.value.findIndex(v =>v.salesId == curRecord.salesId)
if (idx > -1) {
dataList.value[idx].qtySettleGj = qtySettleGj.toFixed(3)
dataList.value[idx].qtySettleM3 = qtySettleM3.toFixed(3)
dataList.value[idx].amount = amount.toFixed(2)
dataList.value[idx].priceGj = priceGj.toFixed(4)
dataList.value[idx].priceM3 = priceM3.toFixed(4)
dataList.value[idx].lngPngSettleSalesDtlList = arr
tableCount()
}
}
const tableCount = () => {
let qtySettleGj = 0
let qtySettleM3 = 0
let amount = 0
dataList.value.forEach(v => {
if (Number(v.settleTimes) == 1){
qtySettleGj+=Number(v.qtySettleGj) || 0
qtySettleM3+=Number(v.qtySettleM3) || 0
}
amount+=Number(v.amount) || 0
})
formState.qtySettleGj = qtySettleGj.toFixed(3)
formState.qtySettleM3 = qtySettleM3.toFixed(3)
formState.amount = amount.toFixed(2)
}
const onSearchCustomer = () => {
openModalCustomer(true,{isUpdate: false})
}
const handleSuccessCustomer = (val) => {
formState.cpCode = val[0].cuCode
formState.cpName = val[0].cuName
getDate()
}
function close() {
tabStore.closeTab(currentRoute.value, router);
}
async function getFormValue() {
return formState
}
async function handleSubmit(type) {
try {
await formRef.value.validateFields();
dataList.value.forEach(v => {
v.settleTypeCode = 'I'
})
let obj = {
...formState,
lngFileUploadList: dataFile.value,
billList: dataFileAccount.value,
lngPngSettleSalesList: dataList.value,
}
spinning.value = true;
let request = !formState.id ? addLngPngSettleHdr :updateLngPngSettleHdr
try {
const data = await request(obj);
// 新增保存
if (data?.id) {
getInfo(data?.id)
}
// 同意保存不提示
if (!type) {
notification.success({
message: 'Tip',
description: data?.id ? t('新增成功!') : t('修改成功!')
}); //提示消息
}
return data?.id ? data : obj
} finally {
spinning.value = false;
}
} catch (errorInfo) {
console.log(errorInfo, 'errorInfo')
spinning.value = false;
errorInfo?.errorFields?.length && notification.warning({
message: '提示',
description: '请完善信息'
});
return false
}
}
defineExpose({
handleSubmit,
getFormValue
});
</script>
<style lang="less" scoped>
:deep(.ant-form-item .ant-form-item-label) {
width: 135px !important;
max-width: 135px !important;
}
.page-bg-wrap {
background-color: #fff;
}
.top-toolbar {
min-height: 44px;
margin-bottom: 12px;
border-bottom: 1px solid #eee;
}
</style>

View File

@ -0,0 +1,240 @@
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: '0e5177531b9440538e5db1d02a4afa95',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '结算月',
fieldId: 'settleMonth',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'd5345f2f5c10465c8e8f071c5fcda584',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '结算月开始日期',
fieldId: 'dateFrom',
isSubTable: false,
showChildren: true,
type: 'input',
key: '79b1cdf4156a4477a19edcec99d81d56',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '结算月结束日期',
fieldId: 'dateTo',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'b95db041a20a486cbfec71480fb8aa8b',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '客户简称',
fieldId: 'cpCode',
isSubTable: false,
showChildren: true,
type: 'input',
key: '23202591851543e6952e6a1c8b7a906a',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '结算总数量(吉焦)',
fieldId: 'qtySettleGj',
isSubTable: false,
showChildren: true,
type: 'input',
key: '8085c8a6f656473eb050a094b5edc506',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '结算总数量 (方)',
fieldId: 'qtySettleM3',
isSubTable: false,
showChildren: true,
type: 'input',
key: '4ea1df548ccd4277ac271319f90f98c3',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '结算总金额 (元)',
fieldId: 'amount',
isSubTable: false,
showChildren: true,
type: 'input',
key: '7278b21860fa4ae4a37824424919d58f',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '交易主体',
fieldId: 'comId',
isSubTable: false,
showChildren: true,
type: 'input',
key: '874e0a0e29ae40ed94e6b5e04597a739',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '结算说明',
fieldId: 'settleDesc',
isSubTable: false,
showChildren: true,
type: 'input',
key: '3fff1f671839416091a04863bf9fc03a',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '附件',
fieldId: 'deptId',
isSubTable: false,
showChildren: true,
type: 'input',
key: '5597f98607194b2badd2b7469b56deab',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '审批状态',
fieldId: 'approCode',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'ce05d6adcf1a4e8bbd107db8b21a6b04',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: true,
showChildren: false,
tableName: 'lngPngSettleSalesList',
fieldName: '表格组件',
fieldId: 'lngPngSettleSalesList',
type: 'form',
key: 'a15631219b3e4f87bdc6dd027c088aaf',
children: [
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: true,
isSaveTable: false,
showChildren: false,
tableName: 'lngPngSettleSalesList',
fieldName: '单行文本',
fieldId: 'settleMonth',
key: '0e65269b143b4a539075fc0645c0754f',
children: [],
},
],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: true,
showChildren: false,
tableName: 'lngPngSettleSalesDtlList',
fieldName: '表格组件',
fieldId: 'lngPngSettleSalesDtlList',
type: 'form',
key: 'cd4b0b5719ff4c5fb8bdb179b49fd545',
children: [
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: true,
isSaveTable: false,
showChildren: false,
tableName: 'lngPngSettleSalesDtlList',
fieldName: '单行文本',
fieldId: 'priceCode',
key: 'f3c19f1b49f94470b9ebe7e28be90c62',
children: [],
},
],
},
];

View File

@ -0,0 +1,437 @@
<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>
<PngSettleHdrModal @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/pngSettleHdr/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/PngSettleHdr';
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/PngSettleHdr';
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 PngSettleHdrModal from './components/PngSettleHdrModal.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';
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":"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 actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord','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,startwork : handleStartwork,flowRecord : handleFlowRecord,approve : handleApprove,delete : handleDelete,}
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 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 }] = useTable({
title: '' || (formName + '列表'),
api: getLngPngSettleHdrPage,
rowKey: 'id',
columns: customConfigColums,
formConfig: {
rowProps: {
gutter: 16,
},
schemas: customSearchFormSchema,
fieldMapToTime: [['datePlan', ['startDate', 'endDate'], 'YYYY-MM']],
showResetButton: true,
},
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' },
},
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 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
}
});
} else if (schemaId && !taskIds && processId) {
router.push({
path: '/flow/' + schemaId + '/' + processId + '/approveFlow',
query: {
readonly: 1,
taskId: '',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
} else {
router.push({
path: '/form/PngSettleHdr/' + record.id + '/viewForm',
query: {
formPath: 'dayPlan/PngSettleHdr',
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/PngSettleHdr',
formName: "新建"+formName,
}
});
} else {
router.push({
path: '/form/PngSettleHdr/0/createForm',
query: {
formPath: 'dayPlan/PngSettleHdr',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
}
}
function handleEdit(record: Recordable) {
router.push({
path: '/form/PngSettleHdr/' + record.id + '/updateForm',
query: {
formPath: 'dayPlan/PngSettleHdr',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
}
function handleApprove () {
}
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 hasFlowRecord = false;
actionButtonConfig.value?.map((button) => {
if (['view', 'copyData'].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 (button.code === 'flowRecord') hasFlowRecord = true;
});
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>

View File

@ -9,6 +9,8 @@ export const customFormConfig = {
'addContractPurPng', 'addContractPurPng',
'addContractSales', 'addContractSales',
'addContractSalesLng', 'addContractSalesLng',
'ContractPurInt' 'ContractPurInt',
'ContractSalesInt',
'addDayPlanPngSettleSales'
], ],
}; };