This commit is contained in:
2026-03-23 09:33:55 +08:00
25 changed files with 3628 additions and 139 deletions

View File

@ -3,16 +3,50 @@ import { defHttp } from '/@/utils/http/axios';
import { ErrorMessageMode } from '/#/axios'; import { ErrorMessageMode } from '/#/axios';
enum Api { enum Api {
Page = '/dayPlan/lngSettleHdr/page', // Page = '/dayPlan/lngSettleHdr/page',
Page = '/magic-api/dayPlan/lngSettleHdr/page',
List = '/dayPlan/lngSettleHdr/list', List = '/dayPlan/lngSettleHdr/list',
Info = '/dayPlan/lngSettleHdr/info', Info = '/dayPlan/lngSettleHdr/info',
LngLngSettleHdr = '/dayPlan/lngSettleHdr', LngLngSettleHdr = '/dayPlan/lngSettleHdr',
querySettList = '/magic-api/dayPlan/querySettList',
cancel = '/dayPlan/lngSettleHdr/cancel',
getSettMonth = '/magic-api/dayPlan/getSettMonth'
} }
export async function cancelLngSettleHdr(ids: string[], mode: ErrorMessageMode = 'modal') {
return defHttp.post<LngLngSettleHdrPageModel>(
{
url: Api.cancel,
data: ids,
},
{
errorMessageMode: mode,
},
);
}
export async function getLngLngSettleHdrMonth(params: LngLngSettleHdrPageParams, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngLngSettleHdrPageModel>(
{
url: Api.getSettMonth,
params
},
{
errorMessageMode: mode,
},
);
}
export async function getLngLngSettleHdrPageAdd(params: LngLngSettleHdrPageParams, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngLngSettleHdrPageResult>(
{
url: Api.querySettList,
params,
},
{
errorMessageMode: mode,
},
);
}
/** /**
* @description: 查询LngLngSettleHdr分页列表 * @description: 查询LngLngSettleHdr分页列表
*/ */

View File

@ -0,0 +1,90 @@
import { LngInventoryInPageModel, LngInventoryInPageParams, LngInventoryInPageResult } from './model/LngInventoryInModel';
import { defHttp } from '/@/utils/http/axios';
import { ErrorMessageMode } from '/#/axios';
enum Api {
Page = '/inventory/lngInventoryIn/page',
List = '/inventory/lngInventoryIn/list',
Info = '/inventory/lngInventoryIn/info',
LngInventoryIn = '/inventory/lngInventoryIn',
DataLog = '/inventory/lngInventoryIn/datalog',
}
/**
* @description: 查询LngInventoryIn分页列表
*/
export async function getLngInventoryInPage(params: LngInventoryInPageParams, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngInventoryInPageResult>(
{
url: Api.Page,
params,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 获取LngInventoryIn信息
*/
export async function getLngInventoryIn(id: String, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngInventoryInPageModel>(
{
url: Api.Info,
params: { id },
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 新增LngInventoryIn
*/
export async function addLngInventoryIn(lngInventoryIn: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.post<boolean>(
{
url: Api.LngInventoryIn,
params: lngInventoryIn,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 更新LngInventoryIn
*/
export async function updateLngInventoryIn(lngInventoryIn: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.put<boolean>(
{
url: Api.LngInventoryIn,
params: lngInventoryIn,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 删除LngInventoryIn批量删除
*/
export async function deleteLngInventoryIn(ids: string[], mode: ErrorMessageMode = 'modal') {
return defHttp.delete<boolean>(
{
url: Api.LngInventoryIn,
data: ids,
},
{
errorMessageMode: mode,
},
);
}

View File

@ -0,0 +1,58 @@
import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
/**
* @description: LngInventoryIn分页参数 模型
*/
export interface LngInventoryInPageParams extends BasicPageParams {
typeCode: string;
staCode: string;
dateIn: string;
suCode: string;
id: string;
qtyUnloadMmbtu: string;
qtyUnloadTon: string;
qtyUnloadM3L: string;
qtyUnloadM3: string;
qtyUnloadGj: string;
}
/**
* @description: LngInventoryIn分页返回值模型
*/
export interface LngInventoryInPageModel {
id: string;
typeCode: string;
staCode: string;
dateIn: string;
qtyUnloadMmbtu: string;
qtyUnloadTon: string;
qtyUnloadM3L: string;
qtyUnloadM3: string;
qtyUnloadGj: string;
suCode: string;
}
0;
/**
* @description: LngInventoryIn分页返回值结构
*/
export type LngInventoryInPageResult = BasicFetchResult<LngInventoryInPageModel>;

View File

@ -0,0 +1,90 @@
import { LngInventoryOutPageModel, LngInventoryOutPageParams, LngInventoryOutPageResult } from './model/LngInventoryOutModel';
import { defHttp } from '/@/utils/http/axios';
import { ErrorMessageMode } from '/#/axios';
enum Api {
Page = '/inventory/lngInventoryOut/page',
List = '/inventory/lngInventoryOut/list',
Info = '/inventory/lngInventoryOut/info',
LngInventoryOut = '/inventory/lngInventoryOut',
DataLog = '/inventory/lngInventoryOut/datalog',
}
/**
* @description: 查询LngInventoryOut分页列表
*/
export async function getLngInventoryOutPage(params: LngInventoryOutPageParams, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngInventoryOutPageResult>(
{
url: Api.Page,
params,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 获取LngInventoryOut信息
*/
export async function getLngInventoryOut(id: String, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngInventoryOutPageModel>(
{
url: Api.Info,
params: { id },
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 新增LngInventoryOut
*/
export async function addLngInventoryOut(lngInventoryOut: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.post<boolean>(
{
url: Api.LngInventoryOut,
params: lngInventoryOut,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 更新LngInventoryOut
*/
export async function updateLngInventoryOut(lngInventoryOut: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.put<boolean>(
{
url: Api.LngInventoryOut,
params: lngInventoryOut,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 删除LngInventoryOut批量删除
*/
export async function deleteLngInventoryOut(ids: string[], mode: ErrorMessageMode = 'modal') {
return defHttp.delete<boolean>(
{
url: Api.LngInventoryOut,
data: ids,
},
{
errorMessageMode: mode,
},
);
}

View File

@ -0,0 +1,50 @@
import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
/**
* @description: LngInventoryOut分页参数 模型
*/
export interface LngInventoryOutPageParams extends BasicPageParams {
typeCode: string;
staCode: string;
dateOut: string;
id: string;
qtyGj: string;
qtyTon: string;
qtyM3: string;
amount: string;
}
/**
* @description: LngInventoryOut分页返回值模型
*/
export interface LngInventoryOutPageModel {
id: string;
typeCode: string;
staCode: string;
dateOut: string;
qtyGj: string;
qtyTon: string;
qtyM3: string;
amount: string;
}
0;
/**
* @description: LngInventoryOut分页返回值结构
*/
export type LngInventoryOutPageResult = BasicFetchResult<LngInventoryOutPageModel>;

View File

@ -4,16 +4,11 @@
@visible-change="handleVisibleChange" > @visible-change="handleVisibleChange" >
<div class="box"> <div class="box">
<a-checkbox class="checkItem" v-model:checked="checked" @change="checkChange">仅显示未结算</a-checkbox> <a-checkbox class="checkItem" v-model:checked="checked" @change="checkChange">仅显示未结算</a-checkbox>
<BasicTable @register="registerTable" class="measureListModal"> <BasicTable @register="registerTable" class="priceLngHdrListModal">
<template #bodyCell="{ column, record, index }"> <template #bodyCell="{ column, record, index }">
<template v-if="column.dataIndex === 'settledSign'"> <template v-if="column.dataIndex === 'settledSign'">
{{ Number(record.settledSign) == 1 ? '已结算': '未结算' }} {{ Number(record.settledSign) == 1 ? '已结算': '未结算' }}
</template> </template>
<template v-if="column.dataIndex === 'file'">
<div v-for="item in (record.lngFileUploadList )" class="fileCSS">
<a @click="handleDownload(item)">{{item.fileOrg}}</a>
</div>
</template>
</template> </template>
</BasicTable> </BasicTable>
</div> </div>
@ -27,12 +22,10 @@
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 { getLngPngSettleHdrPageAdd} from '/@/api/dayPlan/PngSettleHdr';
import { getLngPngSettleHdrPageAddPur} from '/@/api/dayPlan/PngSettleHdrPur'
import { parseDownloadUrl} from '/@/api/system/file';
import { downloadByUrl } from '/@/utils/file/download';
import { DataFormat, FormatOption, DATE_FORMAT, FormatType } from '/@/utils/dataFormat'; import { DataFormat, FormatOption, DATE_FORMAT, FormatType } from '/@/utils/dataFormat';
import { getLngLngSettleHdrPageAdd, } from '/@/api/dayPlan/LngSettleHdr';
import {formConfig, searchFormSchema, columns } from '/@/views/dayPlan/LngMeasurePur/components/config';
import { cloneDeep } from 'lodash-es';
const props = defineProps({ const props = defineProps({
selectType: { type: String, default: 'checkbox' }, selectType: { type: String, default: 'checkbox' },
pageType: String pageType: String
@ -52,36 +45,12 @@
}, },
}, },
]; ];
let columnsNew = cloneDeep(columns)
const columns: BasicColumn[] = [ columnsNew.splice(-5,5)
{ dataIndex: 'datePlan', title: '计划日期', align: 'left', width: 100}, columnsNew.push(
{ dataIndex: 'dateMea', title: '计量日期', align: 'left',width: 100}, {dataIndex: 'kName',title: '销售合同',componentType: 'input',align: 'left',width: 180,sorter: true},
{ dataIndex: 'cuSname', title: '客户', align: 'left', }, {dataIndex: 'comName',title: '供应商',componentType: 'input',align: 'left',width: 180,sorter: true,},
{ dataIndex: 'pointDelyName', title: '下载点', align: 'left',}, { dataIndex: 'settledSign', title: '已结算', align: 'left',width: 100})
{ dataIndex: 'comName', title: '交易主体', align: 'left',},
{ dataIndex: 'qtyMeaSalesGj', title: '完成量(吉焦)', align: 'left',width: 120},
{ dataIndex: 'qtyMeaPurM3', title: '完成量(方)', align: 'left',width: 120},
{ dataIndex: 'rateM3Gj', title: '比值(方/吉焦)', align: 'left',width: 120},
{ dataIndex: 'ksName', title: '销售合同', align: 'left',},
{ dataIndex: 'file', title: '附件', align: 'left',width: 200},
{ dataIndex: 'settledSign', title: '已结算', align: 'left',width: 100},
];
const columnsPur: BasicColumn[] = [
{ dataIndex: 'datePlan', title: '计划日期', align: 'left', width: 100},
{ dataIndex: 'dateMea', title: '计量日期', align: 'left',width: 100},
{ dataIndex: 'suSname', title: '供应商', align: 'left', },
{ dataIndex: 'pointUpName', title: '上载点', align: 'left',},
{ dataIndex: 'cuSname', title: '客户', align: 'left',},
{ dataIndex: 'pointDelyName', title: '下载点', align: 'left',},
{ dataIndex: 'comName', title: '交易主体', align: 'left',},
{ dataIndex: 'qtyMeaPurGj', title: '完成量(吉焦)', align: 'left',width: 120},
{ dataIndex: 'qtyMeaPurM3', title: '完成量(方)', align: 'left',width: 120},
{ dataIndex: 'rateM3Gj', title: '比值(方/吉焦)', align: 'left',width: 120},
{ dataIndex: 'kpName', title: '采购合同', align: 'left',},
{ dataIndex: 'file', title: '附件', align: 'left',width: 200},
{ dataIndex: 'settledSign', title: '已结算', align: 'left',width: 100},
];
const emit = defineEmits(['success', 'register']); const emit = defineEmits(['success', 'register']);
const { notification } = useMessage(); const { notification } = useMessage();
@ -101,9 +70,9 @@
const [registerTable, { getDataSource, setTableData, updateTableDataRecord, reload,clearSelectedRowKeys }] = useTable({ const [registerTable, { getDataSource, setTableData, updateTableDataRecord, reload,clearSelectedRowKeys }] = useTable({
title: t('待结算记录'), title: t('待结算记录'),
api: props.pageType=='supplier'?getLngPngSettleHdrPageAddPur: getLngPngSettleHdrPageAdd, api: getLngLngSettleHdrPageAdd,
rowKey: props.pageType=='supplier' ? 'salesPurId': 'salesId', rowKey: 'salesId',
columns: props.pageType=='supplier' ? columnsPur: columns, columns: columnsNew,
bordered: true, bordered: true,
pagination: true, pagination: true,
@ -126,16 +95,6 @@
}, },
afterFetch: (res) => { afterFetch: (res) => {
tableData.value = res || [] tableData.value = res || []
tableData.value.forEach(v => {
let a = v.attachList ? v.attachList.split(',') : []
v.lngFileUploadList = []
a.forEach(k => {
v.lngFileUploadList.push({
fileOrg: k.split('@')[0],
fileUrl: k.split('@')[1]
})
})
})
}, },
rowSelection: { rowSelection: {
type: props.selectType, type: props.selectType,
@ -147,8 +106,8 @@
(val) => { (val) => {
if (val) { if (val) {
let arr = DataFormat.format(val, [ let arr = DataFormat.format(val, [
FormatOption.createQty('qtyMeaGj'), FormatOption.createQty('qtyMeaGjSales'),
FormatOption.createQty('qtyMeaM3'), FormatOption.createQty('qtyMeaM3Sales'),
]); ]);
if (arr.length) { if (arr.length) {
setTableData(arr) setTableData(arr)
@ -170,11 +129,6 @@
const checkChange = (val) => { const checkChange = (val) => {
reload(); reload();
} }
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) { function onSelectChange(rowKeys: string[], e) {
selectedKeys.value = rowKeys; selectedKeys.value = rowKeys;
selectedValues.value = e selectedValues.value = e
@ -202,11 +156,11 @@
</script> </script>
<style > <style >
.measureListModal .basicCol{ .priceLngHdrListModal .basicCol{
position: inherit !important; position: inherit !important;
top: 0; top: 0;
} }
.measureListModal .ant-col-8 { .priceLngHdrListModal .ant-col-8 {
width: 450px !important; width: 450px !important;
max-width: 450px !important;; max-width: 450px !important;;
} }
@ -221,10 +175,4 @@
left: 17px; left: 17px;
z-index: 104; z-index: 104;
} }
.fileCSS a{
width: 100%;
white-space: normal;
word-wrap: break-word;
overflow-wrap: break-word;
}
</style> </style>

View File

@ -8,7 +8,7 @@
<span>结算总量(吉焦){{ numObj.qtySettleGjAll }}</span> <span>结算总量(吉焦){{ numObj.qtySettleGjAll }}</span>
<span>结算总金额(){{ numObj.amount }}</span> <span>结算总金额(){{ numObj.amount }}</span>
</div> </div>
<div class="price-box"> <div class="price-box" v-if="!disabled">
<div> <div>
<span class="btn-title">修改价格/吉焦</span> <span class="btn-title">修改价格/吉焦</span>
<a-input-search type="number" enter-button="批量修改" style="width: 200px" :min="0" v-model:value="formData.priceGj" placeholder="请输入" @search="editBtn('priceGj')"/> <a-input-search type="number" enter-button="批量修改" style="width: 200px" :min="0" v-model:value="formData.priceGj" placeholder="请输入" @search="editBtn('priceGj')"/>
@ -24,6 +24,21 @@
</div> </div>
<a-table :columns="columns" :data-source="dataList" :scroll="{x: 1800}" :rowKey="rowKey" :pagination="false" :row-selection="{ selectedRowKeys: selectedKeys, onChange: onSelectChange }"> <a-table :columns="columns" :data-source="dataList" :scroll="{x: 1800}" :rowKey="rowKey" :pagination="false" :row-selection="{ selectedRowKeys: selectedKeys, onChange: onSelectChange }">
<template #bodyCell="{ column, record, index }"> <template #bodyCell="{ column, record, index }">
<template v-if="column.dataIndex === 'qtySettleGj'">
<input-number v-model:value="record.qtySettleGj" :disabled="disabled" :digits="3" :min="0" style="width: 100%" />
</template>
<template v-if="column.dataIndex === 'qtySettleTon'">
<input-number v-model:value="record.qtySettleTon" :disabled="disabled" :digits="3" :min="0" style="width: 100%" />
</template>
<template v-if="column.dataIndex === 'priceGj'">
<input-number v-model:value="record.priceGj" :disabled="disabled" :digits="4" :min="0" style="width: 100%" />
</template>
<template v-if="column.dataIndex === 'priceTon'">
<input-number v-model:value="record.priceTon" :disabled="disabled" :digits="4" :min="0" style="width: 100%" />
</template>
<template v-if="column.dataIndex === 'amount'">
<input-number v-model:value="record.amount" :disabled="disabled" :digits="2" :min="0" style="width: 100%" />
</template>
<template v-if="column.dataIndex === 'operation'"> <template v-if="column.dataIndex === 'operation'">
<a v-if="!disabled" @click="btnCheck(record, index, 'delete')">删除</a> <a v-if="!disabled" @click="btnCheck(record, index, 'delete')">删除</a>
</template> </template>
@ -45,7 +60,6 @@
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import priceLngHdrListModal from '/@/components/common/priceLngHdrListModal.vue'; import priceLngHdrListModal from '/@/components/common/priceLngHdrListModal.vue';
import { DataFormat, FormatOption, DATE_FORMAT, FormatType } from '/@/utils/dataFormat'; import { DataFormat, FormatOption, DATE_FORMAT, FormatType } from '/@/utils/dataFormat';
import { kStringMaxLength } from 'node:buffer';
const router = useRouter(); const router = useRouter();
const { t } = useI18n(); const { t } = useI18n();
@ -58,12 +72,12 @@ import { kStringMaxLength } from 'node:buffer';
{ title: t('计划日期'), dataIndex: 'datePlan', width:120}, { title: t('计划日期'), dataIndex: 'datePlan', width:120},
{ title: t('车头号'), dataIndex: 'noTractor', width:120}, { title: t('车头号'), dataIndex: 'noTractor', width:120},
{ title: t('挂车号'), dataIndex: 'noTrailer', width:120}, { title: t('挂车号'), dataIndex: 'noTrailer', width:120},
{ title: t('进厂皮重时间'), dataIndex: 'timeIn', width:120}, { title: t('进厂皮重时间'), dataIndex: 'timeIn', width:160},
{ title: t('出厂毛重时间'), dataIndex: 'timeOut', width:120}, { title: t('出厂毛重时间'), dataIndex: 'timeOut', width:160},
{ title: t('装车量(吉焦)'), dataIndex: 'qtyMeaGj', width:120}, { title: t('装车量(吉焦)'), dataIndex: 'qtyMeaGj', width:140},
{ title: t('装车量(吨)'), dataIndex: 'qtyMeaTon', width:120}, { title: t('装车量(吨)'), dataIndex: 'qtyMeaTon', width:140},
{ title: t('结算量(吉焦)'), dataIndex: 'qtySettleGj', width: 140}, { title: t('结算量(吉焦)'), dataIndex: 'qtySettleGj', width: 150},
{ title: t('结算量(吨)'), dataIndex: 'qtySettleTon', width: 130}, { title: t('结算量(吨)'), dataIndex: 'qtySettleTon', width: 140},
{ title: t('结算价格(元/吉焦)'), dataIndex: 'priceGj', width: 180}, { title: t('结算价格(元/吉焦)'), dataIndex: 'priceGj', width: 180},
{ title: t('结算价格(元/吨)'), dataIndex: 'priceTon', width: 170}, { title: t('结算价格(元/吨)'), dataIndex: 'priceTon', width: 170},
{ title: t('结算金额(元)'), dataIndex: 'amount', width: 140}, { title: t('结算金额(元)'), dataIndex: 'amount', width: 140},
@ -95,7 +109,7 @@ import { kStringMaxLength } from 'node:buffer';
} }
dataList.value.forEach(v=> { dataList.value.forEach(v=> {
selectedKeys.value.forEach(i => { selectedKeys.value.forEach(i => {
if (v.id == i) { if (v.salesId == i) {
v[k] = formData[k] v[k] = formData[k]
} }
}) })
@ -109,7 +123,7 @@ import { kStringMaxLength } from 'node:buffer';
} }
let obj = { let obj = {
cpCode: props.formState.cpCode, cpCode: props.formState.cpCode,
comId: props.formState.comId // comId: props.formState.comId
} }
openModalHdr(true,{isUpdate: false, searchParams: obj}) openModalHdr(true,{isUpdate: false, searchParams: obj})
} else { } else {
@ -128,8 +142,8 @@ import { kStringMaxLength } from 'node:buffer';
} }
} }
const handleSuccessHdr = (val) => { const handleSuccessHdr = (val) => {
val.forEach(i =>{ val.forEach(v =>{
delete i.lngFileUploadList v.cpCode = v.cuCode
}) })
if (!dataList.value.length) { if (!dataList.value.length) {
dataList.value = val dataList.value = val
@ -171,11 +185,11 @@ import { kStringMaxLength } from 'node:buffer';
let amount = 0 let amount = 0
val.forEach(v => { val.forEach(v => {
if (Number(v.settleTimes) == 1){ if (Number(v.settleTimes) == 1){
qtySettleGjOne+=Number((v.qtySettleGj || '').replace(/,/g, '')) || 0 qtySettleGjOne+=Number(v.qtySettleGj || 0)
} else { } else {
qtySettleGjNum+=Number((v.qtySettleGj || '').replace(/,/g, '')) || 0 qtySettleGjNum+=Number(v.qtySettleGj || 0)
} }
amount+=Number((v.amount || '').replace(/,/g, '')) || 0 amount+=Number(v.amount|| 0)
}) })
numObj.value.qtySettleGjOne = qtySettleGjOne.toFixed(3) numObj.value.qtySettleGjOne = qtySettleGjOne.toFixed(3)
numObj.value.qtySettleGjNum = qtySettleGjNum.toFixed(3) numObj.value.qtySettleGjNum = qtySettleGjNum.toFixed(3)

View File

@ -366,6 +366,14 @@ export const PAGE_CUSTOM_ROUTE: AppRouteRecordRaw[] = [{
title: (route) => (route.query.formName || '短信记录') title: (route) => (route.query.formName || '短信记录')
} }
}, },
{
path: '/inventory/LngInventoryIn/createForm',
name: 'LngInventoryIn',
component: () => import('/@/views/inventory/LngInventoryIn/components/createForm.vue'),
meta: {
title: (route) => (route.query.formName)
}
},
] ]

View File

@ -112,7 +112,7 @@
const taskIdRef = ref(''); const taskIdRef = ref('');
const visibleFlowRecordModal = ref(false); const visibleFlowRecordModal = ref(false);
const [registerModal, { openModal }] = useModal(); const [registerModal, { openModal }] = useModal();
const formName='国内LNG采购合同'; const formName=currentRoute.value.meta?.title;
const [registerTable, { reload, }] = useTable({ const [registerTable, { reload, }] = useTable({
title: '' || (formName + '列表'), title: '' || (formName + '列表'),
api: getLngContractPage, api: getLngContractPage,
@ -123,7 +123,7 @@
gutter: 16, gutter: 16,
}, },
schemas: customSearchFormSchema, schemas: customSearchFormSchema,
fieldMapToTime: [], fieldMapToTime: [['dateFrom', ['startDate', 'endDate'], 'YYYY-MM-DD']],
showResetButton: false, showResetButton: false,
}, },
beforeFetch: (params) => { beforeFetch: (params) => {

View File

@ -18,7 +18,7 @@ export const searchFormSchema: FormSchema[] = [
}, },
}, },
{ {
field: 'cuName', field: 'cpName',
label: '客户', label: '客户',
component: 'Input', component: 'Input',
}, },
@ -30,7 +30,7 @@ export const columns: BasicColumn[] = [
title: '结算月', title: '结算月',
componentType: 'input', componentType: 'input',
align: 'left', align: 'left',
width: 100,
sorter: true, sorter: true,
}, },
@ -39,7 +39,7 @@ export const columns: BasicColumn[] = [
title: '结算月开始日期', title: '结算月开始日期',
componentType: 'input', componentType: 'input',
align: 'left', align: 'left',
width: 120,
sorter: true, sorter: true,
}, },
@ -48,16 +48,16 @@ export const columns: BasicColumn[] = [
title: '结算月结束日期', title: '结算月结束日期',
componentType: 'input', componentType: 'input',
align: 'left', align: 'left',
width: 120,
sorter: true, sorter: true,
}, },
{ {
dataIndex: 'cuSname', dataIndex: 'cpName',
title: '客户简称', title: '客户简称',
componentType: 'input', componentType: 'input',
align: 'left', align: 'left',
width: 140,
sorter: true, sorter: true,
}, },
@ -66,7 +66,7 @@ export const columns: BasicColumn[] = [
title: '结算总数量(吨)', title: '结算总数量(吨)',
componentType: 'input', componentType: 'input',
align: 'left', align: 'left',
width: 130,
sorter: true, sorter: true,
}, },
@ -75,7 +75,7 @@ export const columns: BasicColumn[] = [
title: '结算总金额(元)', title: '结算总金额(元)',
componentType: 'input', componentType: 'input',
align: 'left', align: 'left',
width: 130,
sorter: true, sorter: true,
}, },
@ -84,7 +84,7 @@ export const columns: BasicColumn[] = [
title: '交易主体', title: '交易主体',
componentType: 'input', componentType: 'input',
align: 'left', align: 'left',
width: 120,
sorter: true, sorter: true,
}, },
@ -93,7 +93,7 @@ export const columns: BasicColumn[] = [
title: '结算说明', title: '结算说明',
componentType: 'input', componentType: 'input',
align: 'left', align: 'left',
width: 150,
sorter: true, sorter: true,
}, },
@ -102,7 +102,7 @@ export const columns: BasicColumn[] = [
title: '附件', title: '附件',
componentType: 'input', componentType: 'input',
align: 'left', align: 'left',
width: 150,
sorter: true, sorter: true,
}, },
@ -111,7 +111,7 @@ export const columns: BasicColumn[] = [
title: '审批状态', title: '审批状态',
componentType: 'input', componentType: 'input',
align: 'left', align: 'left',
width: 80,
sorter: true, sorter: true,
}, },
]; ];

View File

@ -48,8 +48,8 @@
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-item label="结算总数量()" name="qtySettleM3"> <a-form-item label="结算总数量()" name="qtySettleTon">
<a-input v-model:value="formState.qtySettleM3" disabled/> <a-input v-model:value="formState.qtySettleTon" disabled/>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
@ -98,7 +98,7 @@
import type { Rule } from 'ant-design-vue/es/form'; import type { Rule } from 'ant-design-vue/es/form';
import { getDictionary } from '/@/api/sales/Customer'; import { getDictionary } from '/@/api/sales/Customer';
import { useModal } from '/@/components/Modal'; import { useModal } from '/@/components/Modal';
import { addLngPngSettleHdr,updateLngPngSettleHdr, getLngPngSettleHdr, getLngPngSettleHdrDate} from '/@/api/dayPlan/PngSettleHdr'; import { addLngLngSettleHdr,updateLngLngSettleHdr, getLngLngSettleHdr,getLngLngSettleHdrMonth} from '/@/api/dayPlan/LngSettleHdr';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { getAppEnvConfig } from '/@/utils/env'; import { getAppEnvConfig } from '/@/utils/env';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
@ -109,8 +109,8 @@
import { getAllCom} from '/@/api/contract/ContractPurInt'; import { getAllCom} from '/@/api/contract/ContractPurInt';
import { DataFormat, FormatOption, DATE_FORMAT, FormatType } from '/@/utils/dataFormat'; import { DataFormat, FormatOption, DATE_FORMAT, FormatType } from '/@/utils/dataFormat';
const tableName = 'PngSettleHdr'; const tableName = 'LngSettleHdr';
const columnName = 'PngSettleHdr' const columnName = 'LngSettleHdr'
const formType = ref('2'); // 0 新建 1 修改 2 查看 const formType = ref('2'); // 0 新建 1 修改 2 查看
const formRef = ref(); const formRef = ref();
@ -196,20 +196,26 @@
}); });
const uploadChange = (val) => { const uploadChange = (val) => {
val.forEach(v=> {
v.tableId = ''
})
dataFileAccount.value = val dataFileAccount.value = val
} }
const uploadListChange = (val) => { const uploadListChange = (val) => {
val.forEach(v=> {
v.tableId = ''
})
dataFile.value = val dataFile.value = val
} }
async function getInfo(id) { async function getInfo(id) {
spinning.value = true spinning.value = true
try { try {
let data = await getLngPngSettleHdr(id) let data = await getLngLngSettleHdr(id)
spinning.value = false spinning.value = false
Object.assign(formState, {...data}) Object.assign(formState, {...data})
Object.assign(dataFile.value, formState.lngFileUploadList || []) Object.assign(dataFile.value, formState.lngFileUploadList || [])
Object.assign(dataFileAccount.value, formState.billList || []) Object.assign(dataFileAccount.value, formState.billList || [])
Object.assign(dataList.value, formState.lngPngSettleSalesList || []) Object.assign(dataList.value, formState.lngLngSettleList || [])
formState.settleMonth = formState.settleMonth ? dayjs(formState.settleMonth) : null formState.settleMonth = formState.settleMonth ? dayjs(formState.settleMonth) : null
formState.dateFrom = formState.dateFrom ? dayjs(formState.dateFrom) : null formState.dateFrom = formState.dateFrom ? dayjs(formState.dateFrom) : null
formState.dateTo = formState.dateTo ? dayjs(formState.dateTo) : null formState.dateTo = formState.dateTo ? dayjs(formState.dateTo) : null
@ -222,7 +228,7 @@
const numFormat = () => { const numFormat = () => {
dataList.value = DataFormat.format(dataList.value, [ dataList.value = DataFormat.format(dataList.value, [
FormatOption.createQty('qtySettleGj'), FormatOption.createQty('qtySettleGj'),
FormatOption.createQty('qtySettleM3'), FormatOption.createQty('qtySettleTon'),
FormatOption.createQty('qtyMeaGj'), FormatOption.createQty('qtyMeaGj'),
FormatOption.createQty('qtyMeaM3'), FormatOption.createQty('qtyMeaM3'),
FormatOption.createAmt('amount'), FormatOption.createAmt('amount'),
@ -231,16 +237,16 @@
]); ]);
let obj = { let obj = {
qtySettleGj: formState.qtySettleGj, qtySettleGj: formState.qtySettleGj,
qtySettleM3: formState.qtySettleM3, qtySettleTon: formState.qtySettleTon,
amount: formState.amount amount: formState.amount
} }
let a = DataFormat.format({...obj}, [ let a = DataFormat.format({...obj}, [
FormatOption.createQty('qtySettleGj'), FormatOption.createQty('qtySettleGj'),
FormatOption.createQty('qtySettleM3'), FormatOption.createQty('qtySettleTon'),
FormatOption.createAmt('amount'), FormatOption.createAmt('amount'),
]); ]);
formState.qtySettleGj = a.qtySettleGj formState.qtySettleGj = a.qtySettleGj
formState.qtySettleM3 = a.qtySettleM3 formState.qtySettleTon = a.qtySettleTon
formState.amount = a.amount formState.amount = a.amount
} }
const settleChange = (val) => { const settleChange = (val) => {
@ -251,23 +257,23 @@
const numClear = () => { const numClear = () => {
if (!dataList.value.length) { if (!dataList.value.length) {
formState.qtySettleGj = '' formState.qtySettleGj = ''
formState.qtySettleM3 = '' formState.qtySettleTon = ''
formState.amount = '' formState.amount = ''
} }
} }
const tableCount = () => { const tableCount = () => {
let qtySettleGj = 0 let qtySettleGj = 0
let qtySettleM3 = 0 let qtySettleTon = 0
let amount = 0 let amount = 0
dataList.value.forEach(v => { dataList.value.forEach(v => {
if (Number(v.settleTimes) == 1){ if (Number(v.settleTimes) == 1){
qtySettleGj+=Number(v.qtySettleGj) || 0 qtySettleGj+=Number(v.qtySettleGj) || 0
qtySettleM3+=Number(v.qtySettleM3) || 0 qtySettleTon+=Number(v.qtySettleTon) || 0
} }
amount+=Number(v.amount) || 0 amount+=Number(v.amount) || 0
}) })
formState.qtySettleGj = qtySettleGj.toFixed(3) formState.qtySettleGj = qtySettleGj.toFixed(3)
formState.qtySettleM3 = qtySettleM3.toFixed(3) formState.qtySettleTon = qtySettleTon.toFixed(3)
formState.amount = amount.toFixed(2) formState.amount = amount.toFixed(2)
numFormat() numFormat()
} }
@ -280,12 +286,11 @@
cpCode: formState.cpCode, cpCode: formState.cpCode,
comId: formState.comId comId: formState.comId
} }
if (!pageId.value && formState.cpCode && formState.comId && !formState.dateFrom) { if (formState.cpCode && formState.comId && !formState.dateFrom) {
let data = await getLngPngSettleHdrDate(obj) || [] let data = await getLngLngSettleHdrMonth(obj) || []
if (data.length) { formState.dateFrom = data?.dateFrom ? dayjs(data?.dateFrom) : null
formState.dateFrom = data[0]?.dateTo ? dayjs(data[0]?.dateTo) : null formState.dateTo = null
formState.dateTo = null
}
} }
}) })
async function getOption() { async function getOption() {
@ -333,10 +338,10 @@
...formState, ...formState,
lngFileUploadList: dataFile.value, lngFileUploadList: dataFile.value,
billList: dataFileAccount.value, billList: dataFileAccount.value,
lngPngSettleSalesList: dataList.value, lngLngSettleList: dataList.value,
} }
spinning.value = true; spinning.value = true;
let request = !formState.id ? addLngPngSettleHdr :updateLngPngSettleHdr let request = !formState.id ? addLngLngSettleHdr :updateLngLngSettleHdr
try { try {
const data = await request(obj); const data = await request(obj);
@ -347,7 +352,7 @@
// 同意保存不提示 // 同意保存不提示
if (!type) { if (!type) {
notification.success({ notification.success({
message: 'Tip', message: '提示',
description: data?.id ? t('新增成功!') : t('修改成功!') description: data?.id ? t('新增成功!') : t('修改成功!')
}); //提示消息 }); //提示消息
} }

View File

@ -39,7 +39,7 @@
import { Modal } from 'ant-design-vue'; import { Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue'; import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table'; import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
import { getLngLngSettleHdrPage, deleteLngLngSettleHdr} from '/@/api/dayPlan/LngSettleHdr'; import { getLngLngSettleHdrPage, deleteLngLngSettleHdr,cancelLngSettleHdr} from '/@/api/dayPlan/LngSettleHdr';
import { PageWrapper } from '/@/components/Page'; import { PageWrapper } from '/@/components/Page';
import { useMessage } from '/@/hooks/web/useMessage'; import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n'; import { useI18n } from '/@/hooks/web/useI18n';
@ -82,7 +82,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":"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":"check","icon":"ant-design:check-outlined","isDefault":false},{"isUse":true,"name":"数据日志","code":"datalog","icon":"ant-design:profile-outlined","isDefault":true},{"isUse":true,"name":"取消对账单","code":"cancel","icon":"ant-design:rollback-outlined","isDefault":false},{"isUse":true,"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true},{"isUse":true,"name":"刷新","code":"refresh","icon":"ant-design:reload-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":"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":"check","icon":"ant-design:check-outlined","isDefault":false},{"isUse":true,"name":"数据日志","code":"datalog","icon":"ant-design:profile-outlined","isDefault":true},{"isUse":true,"name":"取消对账单","code":"cancel","icon":"ant-design:rollback-outlined","isDefault":true},{"isUse":true,"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true},{"isUse":true,"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true}]);
//展示在列表内的按钮 //展示在列表内的按钮
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord','approve']); const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord','approve']);
const buttonConfigs = computed(()=>{ const buttonConfigs = computed(()=>{
@ -97,7 +97,7 @@
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code)); return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
}); });
const btnEvent = {add : handleAdd,edit : handleEdit,refresh : handleRefresh,view : handleView,startwork : handleStartwork,flowRecord : handleFlowRecord,approve : handleApprove,delete : handleDelete,} const btnEvent = {add : handleAdd,edit : handleEdit,refresh : handleRefresh,view : handleView,startwork : handleStartwork,flowRecord : handleFlowRecord,approve : handleApprove,delete : handleDelete,datalog: handleDatalog, cancel: handelCancel}
const { currentRoute } = useRouter(); const { currentRoute } = useRouter();
const router = useRouter(); const router = useRouter();
@ -115,11 +115,13 @@
const draftsId = ref(); const draftsId = ref();
const visibleApproveProcessRef = ref(false); const visibleApproveProcessRef = ref(false);
const tableData = ref([])
const selectedKeys = ref([])
const taskIdRef = ref(''); const taskIdRef = ref('');
const visibleFlowRecordModal = ref(false); const visibleFlowRecordModal = ref(false);
const [registerModal, { openModal }] = useModal(); const [registerModal, { openModal }] = useModal();
const formName=currentRoute.value.meta?.title; const formName=currentRoute.value.meta?.title;
const [registerTable, { reload, setTableData }] = useTable({ const [registerTable, { reload, setTableData,clearSelectedRowKeys }] = useTable({
title: '' || (formName + '列表'), title: '' || (formName + '列表'),
api: getLngLngSettleHdrPage, api: getLngLngSettleHdrPage,
rowKey: 'id', rowKey: 'id',
@ -150,6 +152,10 @@
dataIndex: 'action', dataIndex: 'action',
slots: { customRender: 'action' }, slots: { customRender: 'action' },
}, },
rowSelection: {
type: 'checkbox',
onChange: onSelectChange
},
tableSetting: { tableSetting: {
size: false, size: false,
setting: false, setting: false,
@ -174,6 +180,9 @@
deep: true, deep: true,
} }
); );
function onSelectChange(rowKeys: string[]) {
selectedKeys.value = rowKeys;
}
const handleDownload = (info) => { const handleDownload = (info) => {
const url = parseDownloadUrl(info.response ? info.response.data.fileUrl : info.fileUrl); const url = parseDownloadUrl(info.response ? info.response.data.fileUrl : info.fileUrl);
const fileName = info.response ? info.response.data.fileOrg : info.fileOrg; const fileName = info.response ? info.response.data.fileOrg : info.fileOrg;
@ -235,6 +244,22 @@
btnEvent[code](); btnEvent[code]();
} }
async function handelCancel() {
if(!selectedKeys.value.length) {
notification.warning({
message: '提示',
description: t('请选择需要取消对账的数据'),
});
return
}
await cancelLngSettleHdr(selectedKeys.value)
handleSuccess();
notification.success({
message: '提示',
description: t('取消成功!'),
});
clearSelectedRowKeys()
}
function handleDatalog (record: Recordable) { function handleDatalog (record: Recordable) {
modalVisible.value = true modalVisible.value = true
logId.value = record.id logId.value = record.id
@ -262,17 +287,30 @@
} }
function handleEdit(record: Recordable) { function handleEdit(record: Recordable) {
if (schemaIdComputedRef.value) {
router.push({ router.push({
path: '/form/LngSettleHdr/' + record.id + '/updateForm', path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow',
query: { query: {
formPath: 'dayPlan/LngSettleHdr', formPath: 'dayPlan/LngSettleHdr',
formName: "编辑"+formName, formName: "编辑"+formName,
formId:currentRoute.value.meta.formId, formId:currentRoute.value.meta.formId,
type:'edit', type:'edit',
id: record.id id: record.id
} }
}); });
} else {
router.push({
path: '/form/LngSettleHdr/' + record.id + '/updateForm',
query: {
formPath: 'dayPlan/LngSettleHdr',
formName: "编辑"+formName,
formId:currentRoute.value.meta.formId,
type:'edit',
id: record.id
}
});
}
} }
function handleApprove () { function handleApprove () {
const { processId, taskIds, schemaId } = record.workflowData || {}; const { processId, taskIds, schemaId } = record.workflowData || {};
@ -302,7 +340,7 @@
deleteLngLngSettleHdr(ids).then((_) => { deleteLngLngSettleHdr(ids).then((_) => {
handleSuccess(); handleSuccess();
notification.success({ notification.success({
message: 'Tip', message: '提示',
description: t('删除成功!'), description: t('删除成功!'),
}); });
}); });

View File

@ -288,7 +288,7 @@
cpCode: formState.cpCode, cpCode: formState.cpCode,
comId: formState.comId comId: formState.comId
} }
if (!pageId.value && formState.cpCode && formState.comId && !formState.dateFrom) { if ( formState.cpCode && formState.comId && !formState.dateFrom) {
let data = await getLngPngSettleHdrDate(obj) || [] let data = await getLngPngSettleHdrDate(obj) || []
if (data.length) { if (data.length) {
formState.dateFrom = data[0]?.dateTo ? dayjs(data[0]?.dateTo) : null formState.dateFrom = data[0]?.dateTo ? dayjs(data[0]?.dateTo) : null

View File

@ -288,7 +288,7 @@
cpCode: formState.cpCode, cpCode: formState.cpCode,
comId: formState.comId comId: formState.comId
} }
if (!pageId.value && formState.cpCode && formState.comId && !formState.dateFrom) { if ( formState.cpCode && formState.comId && !formState.dateFrom) {
let data = await getLngPngSettleHdrDate(obj) || [] let data = await getLngPngSettleHdrDate(obj) || []
if (data.length) { if (data.length) {
formState.dateFrom = data[0]?.dateTo ? dayjs(data[0]?.dateTo) : null formState.dateFrom = data[0]?.dateTo ? dayjs(data[0]?.dateTo) : null

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 { addLngInventoryIn, getLngInventoryIn, updateLngInventoryIn, deleteLngInventoryIn } from '/@/api/inventory/LngInventoryIn';
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 getLngInventoryIn(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 updateLngInventoryIn(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 addLngInventoryIn(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 deleteLngInventoryIn([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,556 @@
import { FormProps, FormSchema } from '/@/components/Form';
import { BasicColumn } from '/@/components/Table';
export const formConfig = {
useCustomConfig: false,
};
export const searchFormSchema: FormSchema[] = [
{
field: 'dateFrom',
label: '入库日期',
component: 'RangePicker',
componentProps: {
format: 'YYYY-MM-DD',
style: { width: '100%' },
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: [],
placeholder: '请选择',
allowClear: true,
getPopupContainer: () => document.body,
}
},
{
field: 'staName',
label: '接收站',
component: 'Input',
},
];
export const columns: BasicColumn[] = [
{
dataIndex: 'typeName',
title: '入库类型',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'ssNo',
title: '船期编号',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'staName',
title: '接收站',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'dateIn',
title: '入库日期',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'qtyMmbtu',
title: '入库热值(MMBtu)',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'qtyTon',
title: '入库重量(吨)',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'qtyM3L',
title: '入库体积(标方)',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'qtyM3',
title: '入库体积(方)',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'qtyGj',
title: '入库热值(吉焦)',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'kName',
title: '合同',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'suName',
title: '供应商',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'comName',
title: '公司',
componentType: 'input',
align: 'left',
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: 'ac1418db9f3f4c6f8914a5e8efe5434d',
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',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '466d90ea02e44444b372eb326c6fa5cc',
field: 'typeCode',
label: '入库类型',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入入库类型',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '468932b802e349c6a860b3f4f11bedd2',
field: 'staCode',
label: '接收站',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入接收站',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: 'f6a0ca29c2de4e1c8f4cfdc1cb2589e3',
field: 'dateIn',
label: '入库日期',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入入库日期',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: 'aa14d4672e9f4d799ac9df94222bd34c',
field: 'qtyUnloadMmbtu',
label: '入库热值MMBtu',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入入库热值MMBtu',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: 'bfa65959cbd0461a883b9e68312af2ed',
field: 'qtyUnloadTon',
label: '入库重量(吨)',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入入库重量(吨)',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '2a8f62a8ebda4ff989fa25d8d54e7e09',
field: 'qtyUnloadM3L',
label: '入库体积(标方)',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入入库体积(标方)',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: 'd8b3ed3faa4447429d21e02b7cd7e04a',
field: 'qtyUnloadM3',
label: '入库体积(方)',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入入库体积(方)',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '2207b761f3174315b7aa1210e46520ad',
field: 'qtyUnloadGj',
label: '入库热值(吉焦)',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入入库热值(吉焦)',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: 'd0586501498a4919af8468af574fdd83',
field: 'suCode',
label: '供应商',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入供应商',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
],
showActionButtonGroup: false,
buttonLocation: 'center',
actionColOptions: { span: 24 },
showResetButton: false,
showSubmitButton: false,
hiddenComponent: [],
};

View File

@ -0,0 +1,529 @@
<template>
<a-spin :spinning="spinning" tip="加载中...">
<div class="page-bg-wrap formViewStyle pdcss">
<div class="top-toolbar" >
<a-button style="margin-right: 10px" @click="close">
<slot name="icon"><close-outlined /></slot>关闭
</a-button>
<template v-if="pageType!=='view'">
<a-button style="margin-right: 10px" type="primary" @click="handleSubmit">
<slot name="icon"><save-outlined /></slot>保存
</a-button>
</template>
</div>
<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="comName">
<a-select v-model:value="formState.comId" disabled placeholder="请选择" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.comIdList" :key="item.value" :value="item.value">
{{ item.label }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="接收站" name="staName">
<a-input-search v-model:value="formState.staName" :disabled="isDisable" placeholder="请选择接收站" readonly @search="onSearchStation"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="入库存类型" name="typeCode">
<a-select v-model:value="formState.typeCode" disabled placeholder="" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.typeCodeList" :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="ssNo">
<a-input-search v-model:value="formState.ssNo" :disabled="Boolean(isDisable || pageType ) " placeholder="请选择船期" readonly @search="onSearchShip"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="采购合同" name="kName">
<a-input-search v-model:value="formState.kName" :disabled="isDisable" placeholder="请选择合同" readonly @search="onContract"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="供应商" name="suName">
<a-input-search v-model:value="formState.suName" disabled/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="入库" name="dateIn">
<a-date-picker :inputReadOnly="true" v-model:value="formState.dateIn" style="width: 100%" :disabled="isDisable" placeholder="请选择日期" />
</a-form-item>
</a-col>
</a-row>
</Card>
<Card title="" :bordered="false" >
<a-row>
<a-col :span="8">
<a-form-item label="卸港热值(MMBtu)" name="qtyUnloadMmbtu">
<input-number v-model:value="formState.qtyUnloadMmbtu" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="卸港热值(吉焦)" name="qtyUnloadGj">
<input-number v-model:value="formState.qtyUnloadGj" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="卸港重量(吨)" name="qtyUnloadTon">
<input-number v-model:value="formState.qtyUnloadTon" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="卸港体积(标方)" name="qtyUnloadM3L">
<input-number v-model:value="formState.qtyUnloadM3L" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="卸港体积(方)" name="qtyUnloadM3">
<input-number v-model:value="formState.qtyUnloadM3" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col :span="8">
<a-form-item label="损耗比例%" name="rateLost">
<input-number v-model:value="formState.rateLost" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="损耗热值(MMBtu)" name="qtyLostMmbtu">
<input-number v-model:value="formState.qtyLostMmbtu" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="损耗热值(吉焦)" name="qtyLostGj">
<input-number v-model:value="formState.qtyLostGj" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="损耗重量(吨)" name="qtyLostTon">
<input-number v-model:value="formState.qtyLostTon" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="损耗体积(标方)" name="qtyLostM3L">
<input-number v-model:value="formState.qtyLostM3L" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="损耗体积(方)" name="qtyLostM3">
<input-number v-model:value="formState.qtyLostM3" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="入库热值(MMBtu)" name="qtyMmbtu">
<input-number v-model:value="formState.qtyMmbtu" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="入库热值(吉焦)" name="qtyGj">
<input-number v-model:value="formState.qtyGj" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="入库重量(吨)" name="qtyTon">
<input-number v-model:value="formState.qtyTon" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="入库体积(标方)" name="qtyM3L">
<input-number v-model:value="formState.qtyM3L" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="入库体积(方)" name="qtyM3">
<input-number v-model:value="formState.qtyM3" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
</a-form-item>
</a-col>
</a-row>
</Card>
<Card title="" :bordered="false" >
<a-row>
<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="结算币种单价(/MMBtu)" name="priceMmbtu">
<input-number v-model:value="formState.priceMmbtu" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="结算币种金额" name="amountCurr">
<input-number v-model:value="formState.amountCurr" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="购汇汇率" name="rateExPur">
<input-number v-model:value="formState.rateExPur" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="入库金额/纯货值(元)" name="amount">
<input-number v-model:value="formState.amount" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col :span="8">
<a-form-item label="入库价格(元/吨)" name="priceTon">
<input-number v-model:value="formState.priceTon" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="入库价格(元/吉焦)" name="priceGj">
<input-number v-model:value="formState.priceGj" :disabled="isDisable" :digits="3" :min="0" style="width: 100%" />
</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" :maxLength="200" placeholder="请输入内容最多200字" :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>
</a-form>
</div>
<contractPurIntListModal @register="registerContractPurInt" @success="handleSuccessContractPurInt" selectType="radio" pageType="pur"/>
<lngStationModal @register="registerStation" @success="handleSuccessStation"/>
<shipScheduleListModal @register="registerShip" @success="handleSuccessShip" />
</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 { SendOutlined, SaveOutlined, CloseOutlined, } from '@ant-design/icons-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 { addLngOpsPurInt,updateLngOpsPurInt, getLngOpsPurInt} from '/@/api/ship/OpsPurInt';
import { getAllCurrency } from '/@/api/contract/ContractFact';
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 contractPurIntListModal from '../../../../components/common/contractPurIntListModal.vue';
import lngStationModal from '/@/components/common/lngStationModal.vue';
import shipScheduleListModal from '/@/components/common/shipScheduleListModal.vue';
import { useUserStore } from '/@/store/modules/user';
import { getAllCom} from '/@/api/contract/ContractPurInt';
import type { CascaderProps } from 'ant-design-vue';
import { getAreaList, getAreaInfo} from '/@/api/mdm/CountryRegion';
import {getCompDept } from '/@/api/approve/Appro';
import { getLngShipSchedule} from '/@/api/ship/ShipSchedule';
const userStore = useUserStore();
const userInfo = userStore.getUserInfo;
const tableName = 'OpsPurInt';
const columnName = 'OpsPurInt'
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 pageSource = ref(currentRoute.value.query?.pageSource)
const spinning = ref(false);
const { notification } = useMessage();
const { t } = useI18n()
const formState = reactive({
approCode: 'WTJ',
frtSign: 'N'
});
const [register, { openModal:openModal}] = useModal();
const [registerContractPurInt, { openModal:openModalContractPurInt}] = useModal();
const [registerStation, { openModal:openModalStation}] = useModal();
const [registerPort, { openModal:openModalPort}] = useModal();
const [registerShip, { openModal:openModalShip}] = useModal();
const rules= reactive({
ssNo: [{ required: true, message: "该项为必填项", trigger: 'change' }],
comId: [{ required: true, message: "该项为必填项", trigger: 'change' }],
ssTypeCode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
curCode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
dateEta: [{ required: true, message: "该项为必填项", trigger: 'change' }],
kName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
staName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
dateOps: [{ required: true, message: "该项为必填项", trigger: 'change' }],
frtSign: [{ required: true, message: "该项为必填项", trigger: 'change' }],
insurSign: [{ required: true, message: "该项为必填项", trigger: 'change' }],
});
const layout = {
labelCol: { span: 8 },
wrapperCol: { span: 16 },
}
const dataFile = ref([]);
let optionSelect= reactive({
signList: [],
comIdList: [],
ssTypeCodeList: [],
typeCodeList: [],
curCodeList: [],
prcTermCodeList: [],
});
watch(
() => props.id,
(val) => {
if (val) {
getInfo(val)
}
},
{
immediate: true
}
);
watch(
() => props.disabled,
(val) => {
isDisable.value = val
},
{
immediate: true
}
);
onMounted(() => {
isDisable.value = pageType.value == 'view'
getOption()
if (pageId.value) {
pageSource.value ? getLngShipInfo(pageId.value) :getInfo(pageId.value)
} else {
getOptionParams()
}
});
const uploadListChange = (val) => {
dataFile.value = val
}
async function getInfo(id) {
spinning.value = true
try {
let data = await getLngOpsPurInt(id)
spinning.value = false
Object.assign(formState, {...data})
Object.assign(dataFile.value, formState.lngFileUploadList || [])
formState.dateNor = formState.dateNor ? dayjs(formState.dateNor) : null
getOptionParams()
} catch (error) {
spinning.value = false
}
}
async function getOption() {
optionSelect.signList = await getDictionary('LNG_YN')
optionSelect.ssTypeCodeList = await getDictionary('LNG_SHP_S')
optionSelect.approCodeList = await getDictionary('LNG_APPRO')
optionSelect.typeCodeList = await getDictionary('LNG_INV_I')
if (!pageId.value) {
getCompDeptInfo(userInfo.id)
}
let res = await getAllCom() || []
optionSelect.comIdList = res.map(v=> {
return {
label: v.shortName,
value: v.id
}
})
}
async function getOptionParams() {
optionSelect.curCodeList = await getAllCurrency({eid: formState.curCode})
}
const numCount = () => {
formState.amountCurrEst = (Number(formState.qtyMmbtu) || 0) * (Number(formState.priceCurrEst) || 0)
formState.amountCurrEst = formState.amountCurrEst ? formState.amountCurrEst.toFixed(2) : ''
}
const numChange = () => {
formState.amountCurr = (Number(formState.qtySettleMmbtu) || 0) * (Number(formState.priceCurr) || 0)
formState.amountCurr = formState.amountCurr ? formState.amountCurr.toFixed(2) : ''
}
const onSearchShip = () => {
openModalShip(true,{isUpdate: false})
}
const onSearchStation = (val)=> {
openModalStation(true,{isUpdate: false})
}
const onContract = (val)=> {
openModalContractPurInt(true,{isUpdate: false})
}
const handleSuccessStation = (val) => {
formState.staCode = val[0].code
formState.staName = val[0].fullName
}
const handleSuccessShip = (val) => {
formState.ssNo = val[0].ssNo
formState.ssId = val[0].id
getLngShipInfo(val[0].id)
}
const getLngShipInfo = async (id) => {
try {
spinning.value = true
let data = await getLngShipSchedule(id)
spinning.value = false
formState.ssNo = data.ssNo
formState.ssId = data.id
formState.comId = data.comId
formState.kId = data.kId
formState.kName = data.kName
formState.longSpotCode = data.longSpotCode
formState.suCode = data.suCode
formState.suName = data.suName
formState.staCode = data.staCode
formState.staName = data.staName
formState.sourceName = data.sourceName
formState.empId = data.empId
formState.empName = data.empName
formState.empTel = data.empTel
formState.prcTermCode = data.prcTermCode
formState.shipCode = data.shipCode
formState.shipName = data.shipName
formState.dateNor = data.dateNor ? dayjs(data.dateNor) : null
formState.portUnloading1Code = data.portUnloading1Code
formState.portUnloading1Name = data.portUnloading1Name
formState.dateEta = data.dateEta ? dayjs(data.dateEta) : null
formState.dateEtb = data.dateEtb ? dayjs(data.dateEtb) : null
formState.dateEtc = data.dateEtc ? dayjs(data.dateEtc) : null
formState.dateEtd = data.dateEtd ? dayjs(data.dateEtd) : null
formState.qtyMmbtu = data.qtyMmbtu
formState.qtyGj = data.qtyGj
formState.qtyTon = data.qtyTon
formState.qtyM3 = data.qtyM3
formState.curCode = data.curCode
formState.rateEx = data.rateEx
formState.priceCurrEst = data.priceCurrEst
formState.amountCurrEst = data.amountCurrEst
if (pageSource.value) {
getOptionParams()
}
} catch (error) {
spinning.value = false
}
}
const handleSuccessContractPurInt = (val) => {
formState.kId = val[0].id
formState.kName = val[0].kName
formState.comId = val[0].comId
formState.suCode = val[0].suCode
formState.suName = val[0].suSname
formState.longSpotCode = val[0].longSpotCode
formState.prcTermCode = val[0].prcTermCode
formState.sourceName = val[0].sourceName
}
function close() {
tabStore.closeTab(currentRoute.value, router);
}
async function getFormValue() {
return formState
}
async function handleSubmit(type) {
try {
await formRef.value.validateFields();
let obj = {
...formState,
salesAreaCode: formState.salesAreaCode ? formState.salesAreaCode[formState.salesAreaCode.length -1] : '',
lngFileUploadList: dataFile.value,
}
spinning.value = true;
let request = !formState.id ? addLngOpsPurInt :updateLngOpsPurInt
try {
const data = await request(obj);
notification.success({
message: '提示',
description: data?.id ? t('新增成功!') : t('修改成功!')
}); //提示消息
setTimeout(() => {
bus.emit(FORM_LIST_MODIFIED, {});
close();
}, 500);
} finally {
spinning.value = false;
}
} catch (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;
}
.pdcss {
padding:0px 12px 6px 12px !important;
}
:deep(.formItemWarp .ant-form-item-label > label) {
white-space: normal !important;
word-break: break-word !important;
}
</style>

View File

@ -0,0 +1,152 @@
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: 'ac1418db9f3f4c6f8914a5e8efe5434d',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '入库类型',
fieldId: 'typeCode',
isSubTable: false,
showChildren: true,
type: 'input',
key: '466d90ea02e44444b372eb326c6fa5cc',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '接收站',
fieldId: 'staCode',
isSubTable: false,
showChildren: true,
type: 'input',
key: '468932b802e349c6a860b3f4f11bedd2',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '入库日期',
fieldId: 'dateIn',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'f6a0ca29c2de4e1c8f4cfdc1cb2589e3',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '入库热值MMBtu',
fieldId: 'qtyUnloadMmbtu',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'aa14d4672e9f4d799ac9df94222bd34c',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '入库重量(吨)',
fieldId: 'qtyUnloadTon',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'bfa65959cbd0461a883b9e68312af2ed',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '入库体积(标方)',
fieldId: 'qtyUnloadM3L',
isSubTable: false,
showChildren: true,
type: 'input',
key: '2a8f62a8ebda4ff989fa25d8d54e7e09',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '入库体积(方)',
fieldId: 'qtyUnloadM3',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'd8b3ed3faa4447429d21e02b7cd7e04a',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '入库热值(吉焦)',
fieldId: 'qtyUnloadGj',
isSubTable: false,
showChildren: true,
type: 'input',
key: '2207b761f3174315b7aa1210e46520ad',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '供应商',
fieldId: 'suCode',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'd0586501498a4919af8468af574fdd83',
children: [],
},
];

View File

@ -0,0 +1,327 @@
<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>
<LngInventoryInModal @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('/inventory/lngInventoryIn/datalog');
import { DataLog } from '/@/components/pcitc';
import { ref, computed, onMounted, onUnmounted, createVNode,
} from 'vue';
import { Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
import { getLngInventoryInPage, deleteLngInventoryIn} from '/@/api/inventory/LngInventoryIn';
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 { getLngInventoryIn } from '/@/api/inventory/LngInventoryIn';
import { useModal } from '/@/components/Modal';
import LngInventoryInModal from './components/LngInventoryInModal.vue';
import {formConfig, searchFormSchema, columns } from './components/config';
import Icon from '/@/components/Icon/index';
import useEventBus from '/@/hooks/event/useEventBus';
import { cloneDeep } from 'lodash-es';
import { getAllCom} from '/@/api/contract/ContractPurInt';
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([{"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":"datalog","icon":"ant-design:profile-outlined","isDefault":true,"isUse":true},{"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true,"isUse":true}]);
//展示在列表内的按钮
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord']);
const buttonConfigs = computed(()=>{
return filterButtonAuth(buttons.value);
})
const tableButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
});
const actionButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
});
const btnEvent = {add : handleAdd,edit : handleEdit,refresh : handleRefresh,view : handleView,datalog : handleDatalog,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 [registerModal, { openModal }] = useModal();
const formName=currentRoute.value.meta?.title;
const [registerTable, { reload, }] = useTable({
title: '' || (formName + '列表'),
api: getLngInventoryInPage,
rowKey: 'id',
columns: customConfigColums,
formConfig: {
rowProps: {
gutter: 16,
},
schemas: customSearchFormSchema,
fieldMapToTime: [['dateFrom', ['startDate', 'endDate'], 'YYYY-MM-DD']],
showResetButton: true,
},
beforeFetch: (params) => {
return { ...params, FormId: formIdComputedRef.value, PK: 'id',page:params.limit };
},
afterFetch: (res) => {
tableRef.value.setToolBarWidth();
},
useSearchForm: true,
showTableSetting: true,
striped: false,
actionColumn: {
width: 160,
title: '操作',
dataIndex: 'action',
slots: { customRender: 'action' },
},
tableSetting: {
size: false,
setting: false,
},
});
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/LngInventoryIn/' + record.id + '/viewForm',
query: {
formPath: 'inventory/LngInventoryIn',
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'
});
} else {
router.push({
path: '/inventory/LngInventoryIn/createForm',
query: {
formPath: 'inventory/LngInventoryIn',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
}
}
function handleEdit(record: Recordable) {
router.push({
path: '/form/LngInventoryIn/' + record.id + '/updateForm',
query: {
formPath: 'inventory/LngInventoryIn',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
}
function handleDelete(record: Recordable) {
deleteList([record.id]);
}
function deleteList(ids) {
Modal.confirm({
title: '提示信息',
icon: createVNode(ExclamationCircleOutlined),
content: '是否确认删除?',
okText: '确认',
cancelText: '取消',
onOk() {
deleteLngInventoryIn(ids).then((_) => {
handleSuccess();
notification.success({
message: 'Tip',
description: t('删除成功!'),
});
});
},
onCancel() {},
});
}
function handleRefresh() {
reload();
}
function handleSuccess() {
reload();
}
function handleView(record: Recordable) {
dbClickRow(record);
}
onMounted(async () => {
let res = await getAllCom() || []
customSearchFormSchema.value.forEach(v => {
if (v.field == 'comId') {
v.componentProps.options = res.map(v=> {
return {
label: v.shortName,
value: v.id
}
})
}
});
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[] {
const actionsList: ActionItem[] = actionButtonConfig.value?.map((button) => {
if (!record.workflowData?.processId) {
return {
icon: button?.icon,
tooltip: button?.name,
color: button.code === 'delete' ? 'error' : undefined,
onClick: btnEvent[button.code].bind(null, record),
};
} else {
if (button.code === 'view') {
return {
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
};
} else {
return {};
}
}
});
return actionsList;
}
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

@ -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 { addLngInventoryOut, getLngInventoryOut, updateLngInventoryOut, deleteLngInventoryOut } from '/@/api/inventory/LngInventoryOut';
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 getLngInventoryOut(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 updateLngInventoryOut(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 addLngInventoryOut(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 deleteLngInventoryOut([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,473 @@
import { FormProps, FormSchema } from '/@/components/Form';
import { BasicColumn } from '/@/components/Table';
export const formConfig = {
useCustomConfig: false,
};
export const searchFormSchema: FormSchema[] = [
{
field: 'dateFrom',
label: '出库日期',
component: 'RangePicker',
componentProps: {
format: 'YYYY-MM-DD',
style: { width: '100%' },
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: [],
placeholder: '请选择',
allowClear: true,
getPopupContainer: () => document.body,
}
},
{
field: 'staName',
label: '接收站',
component: 'Input',
},
];
export const columns: BasicColumn[] = [
{
dataIndex: 'typeName',
title: '出库类型',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'staName',
title: '接收站',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'dateOut',
title: '出库日期',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'qtyGj',
title: '出库量(吉焦)',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'qtyTon',
title: '出库量(吨)',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'qtyM3',
title: '出库量(方)',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'amount',
title: '出库金额',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'kName',
title: '销售合同',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'cuName',
title: '客户名称',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'comName',
title: '公司名称',
componentType: 'input',
align: 'left',
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: '31d714b2242944c2b841b67eb3346877',
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',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '4241e590fd0e4a40ac09928d19ccdd49',
field: 'typeCode',
label: '出库类型',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入出库类型',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '7adf7ffe4cc147cd9cc9dc3a13ecf1ef',
field: 'staCode',
label: '接收站',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入接收站',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: 'b6775a5591a343ae98a6aab8f7ea43a4',
field: 'dateOut',
label: '出库日期',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入出库日期',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '918370e0dca4403e85270a20c9bc866e',
field: 'qtyGj',
label: '出库量 (吉焦)',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入出库量 (吉焦)',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: 'e35ba05e28004b649b15d1a03a077d3a',
field: 'qtyTon',
label: '出库量(吨)',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入出库量(吨)',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '87b5481c8c22422f84f7d5800b0158ba',
field: 'qtyM3',
label: '出库量(方)',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入出库量(方)',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: 'cad682d905e24396b00ed2f1178d6ac3',
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: '请输入出库金额',
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
],
showActionButtonGroup: false,
buttonLocation: 'center',
actionColOptions: { span: 24 },
showResetButton: false,
showSubmitButton: false,
hiddenComponent: [],
};

View File

@ -0,0 +1,122 @@
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: '31d714b2242944c2b841b67eb3346877',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '出库类型',
fieldId: 'typeCode',
isSubTable: false,
showChildren: true,
type: 'input',
key: '4241e590fd0e4a40ac09928d19ccdd49',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '接收站',
fieldId: 'staCode',
isSubTable: false,
showChildren: true,
type: 'input',
key: '7adf7ffe4cc147cd9cc9dc3a13ecf1ef',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '出库日期',
fieldId: 'dateOut',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'b6775a5591a343ae98a6aab8f7ea43a4',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '出库量 (吉焦)',
fieldId: 'qtyGj',
isSubTable: false,
showChildren: true,
type: 'input',
key: '918370e0dca4403e85270a20c9bc866e',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '出库量(吨)',
fieldId: 'qtyTon',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'e35ba05e28004b649b15d1a03a077d3a',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '出库量(方)',
fieldId: 'qtyM3',
isSubTable: false,
showChildren: true,
type: 'input',
key: '87b5481c8c22422f84f7d5800b0158ba',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '出库金额',
fieldId: 'amount',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'cad682d905e24396b00ed2f1178d6ac3',
children: [],
},
];

View File

@ -0,0 +1,327 @@
<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>
<LngInventoryOutModal @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('/inventory/lngInventoryOut/datalog');
import { DataLog } from '/@/components/pcitc';
import { ref, computed, onMounted, onUnmounted, createVNode,
} from 'vue';
import { Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
import { getLngInventoryOutPage, deleteLngInventoryOut} from '/@/api/inventory/LngInventoryOut';
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 { getLngInventoryOut } from '/@/api/inventory/LngInventoryOut';
import { useModal } from '/@/components/Modal';
import LngInventoryOutModal from './components/LngInventoryOutModal.vue';
import {formConfig, searchFormSchema, columns } from './components/config';
import Icon from '/@/components/Icon/index';
import useEventBus from '/@/hooks/event/useEventBus';
import { cloneDeep } from 'lodash-es';
import { getAllCom} from '/@/api/contract/ContractPurInt';
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([{"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":"datalog","icon":"ant-design:profile-outlined","isDefault":true,"isUse":true},{"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true,"isUse":true}]);
//展示在列表内的按钮
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord']);
const buttonConfigs = computed(()=>{
return filterButtonAuth(buttons.value);
})
const tableButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
});
const actionButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
});
const btnEvent = {add : handleAdd,edit : handleEdit,refresh : handleRefresh,view : handleView,datalog : handleDatalog,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 [registerModal, { openModal }] = useModal();
const formName=currentRoute.value.meta?.title;
const [registerTable, { reload, }] = useTable({
title: '' || (formName + '列表'),
api: getLngInventoryOutPage,
rowKey: 'id',
columns: customConfigColums,
formConfig: {
rowProps: {
gutter: 16,
},
schemas: customSearchFormSchema,
fieldMapToTime: [['dateFrom', ['startDate', 'endDate'], 'YYYY-MM-DD']],
showResetButton: true,
},
beforeFetch: (params) => {
return { ...params, FormId: formIdComputedRef.value, PK: 'id',page:params.limit };
},
afterFetch: (res) => {
tableRef.value.setToolBarWidth();
},
useSearchForm: true,
showTableSetting: true,
striped: false,
actionColumn: {
width: 160,
title: '操作',
dataIndex: 'action',
slots: { customRender: 'action' },
},
tableSetting: {
size: false,
setting: false,
},
});
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/LngInventoryOut/' + record.id + '/viewForm',
query: {
formPath: 'inventory/LngInventoryOut',
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'
});
} else {
router.push({
path: '/form/LngInventoryOut/0/createForm',
query: {
formPath: 'inventory/LngInventoryOut',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
}
}
function handleEdit(record: Recordable) {
router.push({
path: '/form/LngInventoryOut/' + record.id + '/updateForm',
query: {
formPath: 'inventory/LngInventoryOut',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
}
function handleDelete(record: Recordable) {
deleteList([record.id]);
}
function deleteList(ids) {
Modal.confirm({
title: '提示信息',
icon: createVNode(ExclamationCircleOutlined),
content: '是否确认删除?',
okText: '确认',
cancelText: '取消',
onOk() {
deleteLngInventoryOut(ids).then((_) => {
handleSuccess();
notification.success({
message: 'Tip',
description: t('删除成功!'),
});
});
},
onCancel() {},
});
}
function handleRefresh() {
reload();
}
function handleSuccess() {
reload();
}
function handleView(record: Recordable) {
dbClickRow(record);
}
onMounted(async () => {
let res = await getAllCom() || []
customSearchFormSchema.value.forEach(v => {
if (v.field == 'comId') {
v.componentProps.options = res.map(v=> {
return {
label: v.shortName,
value: v.id
}
})
}
});
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[] {
const actionsList: ActionItem[] = actionButtonConfig.value?.map((button) => {
if (!record.workflowData?.processId) {
return {
icon: button?.icon,
tooltip: button?.name,
color: button.code === 'delete' ? 'error' : undefined,
onClick: btnEvent[button.code].bind(null, record),
};
} else {
if (button.code === 'view') {
return {
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
};
} else {
return {};
}
}
});
return actionsList;
}
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>