This commit is contained in:
2026-01-29 18:39:50 +08:00
26 changed files with 2357 additions and 78 deletions

View File

@ -0,0 +1,104 @@
import { LngPngApproPageModel, LngPngApproPageParams, LngPngApproPageResult } from './model/PngApproGdModel';
import { defHttp } from '/@/utils/http/axios';
import { ErrorMessageMode } from '/#/axios';
enum Api {
// Page = '/dayPlan/pngApproGd/page',
Page = '/magic-api//dayPlan/pngApproGd/page',
List = '/dayPlan/pngApproGd/list',
Info = '/dayPlan/pngApproGd/info',
LngPngAppro = '/dayPlan/pngApproGd',
approve = '/dayPlan/pngAppro/approveGD',
}
/**
* @description: 审批LngPngAppro
*/
export async function approveLngPngAppro(lngPngAppro: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.post<boolean>(
{
url: Api.approve,
params: lngPngAppro,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 查询LngPngAppro分页列表
*/
export async function getLngPngApproPage(params: LngPngApproPageParams, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngPngApproPageResult>(
{
url: Api.Page,
params,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 获取LngPngAppro信息
*/
export async function getLngPngAppro(id: String, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngPngApproPageModel>(
{
url: Api.Info,
params: { id },
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 新增LngPngAppro
*/
export async function addLngPngAppro(lngPngAppro: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.post<boolean>(
{
url: Api.LngPngAppro,
params: lngPngAppro,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 更新LngPngAppro
*/
export async function updateLngPngAppro(lngPngAppro: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.put<boolean>(
{
url: Api.LngPngAppro,
params: lngPngAppro,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 删除LngPngAppro批量删除
*/
export async function deleteLngPngAppro(ids: string[], mode: ErrorMessageMode = 'modal') {
return defHttp.delete<boolean>(
{
url: Api.LngPngAppro,
data: ids,
},
{
errorMessageMode: mode,
},
);
}

View File

@ -0,0 +1,26 @@
import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
/**
* @description: LngPngAppro分页参数 模型
*/
export interface LngPngApproPageParams extends BasicPageParams {
id: string;
datePlan: string;
}
/**
* @description: LngPngAppro分页返回值模型
*/
export interface LngPngApproPageModel {
id: string;
datePlan: string;
}
0;
/**
* @description: LngPngAppro分页返回值结构
*/
export type LngPngApproPageResult = BasicFetchResult<LngPngApproPageModel>;

View File

@ -0,0 +1,101 @@
import { LngPngApproPageModel, LngPngApproPageParams, LngPngApproPageResult } from './model/PngApproJszModel';
import { defHttp } from '/@/utils/http/axios';
import { ErrorMessageMode } from '/#/axios';
enum Api {
// Page = '/dayPlan/pngApproJsz/page',
Page = '/magic-api/dayPlan/pngApproJsz/page',
List = '/dayPlan/pngApproJsz/list',
Info = '/dayPlan/pngApproJsz/info',
LngPngAppro = '/dayPlan/pngApproJsz',
approve = '/dayPlan/pngAppro/approveJSZ',
}
export async function approveLngPngAppro(lngPngAppro: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.post<boolean>(
{
url: Api.approve,
params: lngPngAppro,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 查询LngPngAppro分页列表
*/
export async function getLngPngApproPage(params: LngPngApproPageParams, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngPngApproPageResult>(
{
url: Api.Page,
params,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 获取LngPngAppro信息
*/
export async function getLngPngAppro(id: String, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngPngApproPageModel>(
{
url: Api.Info,
params: { id },
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 新增LngPngAppro
*/
export async function addLngPngAppro(lngPngAppro: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.post<boolean>(
{
url: Api.LngPngAppro,
params: lngPngAppro,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 更新LngPngAppro
*/
export async function updateLngPngAppro(lngPngAppro: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.put<boolean>(
{
url: Api.LngPngAppro,
params: lngPngAppro,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 删除LngPngAppro批量删除
*/
export async function deleteLngPngAppro(ids: string[], mode: ErrorMessageMode = 'modal') {
return defHttp.delete<boolean>(
{
url: Api.LngPngAppro,
data: ids,
},
{
errorMessageMode: mode,
},
);
}

View File

@ -0,0 +1,26 @@
import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
/**
* @description: LngPngAppro分页参数 模型
*/
export interface LngPngApproPageParams extends BasicPageParams {
id: string;
datePlan: string;
}
/**
* @description: LngPngAppro分页返回值模型
*/
export interface LngPngApproPageModel {
id: string;
datePlan: string;
}
0;
/**
* @description: LngPngAppro分页返回值结构
*/
export type LngPngApproPageResult = BasicFetchResult<LngPngApproPageModel>;

View File

@ -1,19 +1,21 @@
<template>
<BasicModal v-bind="$attrs" destroyOnClose @register="registerModal" showFooter :title="getTitle" width="40%" @ok="handleSubmit" @cancel="handleCancel">
<a-form ref="formRef" :model="formState" :rules="rules" v-bind="{labelCol: { span: 8 },wrapperCol: { span: 16 },}">
<a-row>
<a-col :span="24">
<a-form-item label="批复意见" name="reply" :label-col="{ span: 4 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.reply" placeholder="请输入" :auto-size="{ minRows: 2, maxRows: 5 }"/>
</a-form-item>
</a-col>
</a-row>
</a-form>
</BasicModal>
<a-modal :mask-closable="false" title="驳回意见" :visible="isOpen" :width="500" centered class="geg" @cancel="handleCancel">
<a-form ref="formRef" :model="formState" :rules="rules" :label-col="{ span: 5 }">
<div class="dialog-wrap">
<a-form-item label="批复意见" name="reply">
<a-textarea v-model:value="formState.reply" placeholder="请输入" :auto-size="{ minRows: 2, maxRows: 5 }"/>
</a-form-item>
</div>
</a-form>
<template #footer>
<a-button :disabled="loading" @click="handleCancel">取消</a-button>
<a-button :loading="loading" type="primary" @click="handleSubmit">确定</a-button>
</template>
</a-modal>
</template>
<script setup lang="ts">
import { ref, onMounted, computed, unref,reactive } from 'vue';
import { ref, onMounted, computed, unref,reactive,watch } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { Form, message } from 'ant-design-vue';
import { useI18n } from '/@/hooks/web/useI18n';
@ -24,36 +26,49 @@ const { t } = useI18n();
const isUpdate = ref(true);
const formRef = ref()
const { notification } = useMessage();
const loading = ref(false)
const emit = defineEmits(['success','register']);
const getTitle = computed(() => t('驳回意见') )
let formState = reactive({
});
const isOpen = ref(false)
const rules = {
reply: [{ required: true, message: "该项为必填项", trigger: 'change' }],
};
const props = defineProps({
type: String
type: String,
visible: Boolean
})
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
setModalProps({ confirmLoading: false });
isUpdate.value = !!data?.isUpdate;
});
onMounted(() => {
});
watch(
() => props.visible,
(val) => {
isOpen.value = val
},
{
immediate: true,
deep: true,
}
);
const handleCancel = () => {
formRef.value.resetFields();
isOpen.value = false
}
const handleSubmit = async () => {
try {
await formRef.value.validate();
emit('success', formState);
formRef.value.resetFields();
closeModal();
} catch (error) {
console.log('验证失败:', error);
}
};
</script>
</script>
<style lang="less" scoped>
.dialog-wrap {
padding: 10px 15px 0 0;
}
</style>

View File

@ -56,7 +56,7 @@ span {
opacity: 0;
}
}
input.ant-input-disabled:placeholder-shown{
input.ant-input-disabled:placeholder-shown, .ant-input-disabled:placeholder-shown{
opacity: 0 !important;
}
.ant-picker-input > input[disabled], .ant-radio-disabled + span {

View File

@ -0,0 +1,10 @@
export function numToThousands(number) {
if (number === null || number === undefined || number === '') return ''
let arr = number.toString().split('.')
let num = arr[0]
let float = arr[1]
let str = num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")
return float ? (str + '.'+ float) : str;
}

View File

@ -25,7 +25,7 @@
<a-form-item label="合同量(吉焦)" name="qtyContractGj" :class="diffResultList.includes('qtyContractGj')?'changeStyle':''">{{ formState.qtyContractGj }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="合同量(方)" name="qtyContractM3" :class="diffResultList.includes('qtyContractM3')?'changeStyle':''">{{ formState.qtyContractM3 }}</a-form-item>
<a-form-item label="合同量(方)" name="qtyContractM3" :class="diffResultList.includes('qtyContractM3')?'changeStyle':''">{{ formState.qtyContractM3 }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="月合同量执行进度%" name="rateK" :class="diffResultList.includes('rateK')?'changeStyle':''">{{ formState.rateK }}</a-form-item>
@ -34,7 +34,7 @@
<a-form-item label="计划量(吉焦)" name="qtyPlanGj" :class="diffResultList.includes('qtyPlanGj')?'changeStyle':''">{{ formState.qtyPlanGj }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="计划量(方)" name="qtyPlanM3" :class="diffResultList.includes('qtyPlanM3')?'changeStyle':''">{{ formState.qtyPlanM3 }}</a-form-item>
<a-form-item label="计划量(方)" name="qtyPlanM3" :class="diffResultList.includes('qtyPlanM3')?'changeStyle':''">{{ formState.qtyPlanM3 }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="月计划量执行进度%" name="rateMp" :class="diffResultList.includes('rateMp')?'changeStyle':''">{{ formState.rateMp }}</a-form-item>
@ -43,7 +43,7 @@
<a-form-item label="指定量(吉焦)" name="qtyDemandGj" :class="diffResultList.includes('qtyDemandGj')?'changeStyle':''">{{ formState.qtyDemandGj }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="指定量(方)" name="qtyDemandM3" :class="diffResultList.includes('qtyDemandM3')?'changeStyle':''">{{ formState.qtyDemandM3 }}</a-form-item>
<a-form-item label="指定量(方)" name="qtyDemandM3" :class="diffResultList.includes('qtyDemandM3')?'changeStyle':''">{{ formState.qtyDemandM3 }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="月时间进度%" name="rateS" :class="diffResultList.includes('rateS')?'changeStyle':''">{{ formState.rateS }}</a-form-item>
@ -52,7 +52,7 @@
<a-form-item label="批复量(吉焦)" name="qtySalesGj" :class="diffResultList.includes('qtySalesGj')?'changeStyle':''">{{ formState.qtySalesGj }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="批复量(方)" name="qtySalesM3" :class="diffResultList.includes('qtySalesM3')?'changeStyle':''">{{ formState.qtySalesM3 }}</a-form-item>
<a-form-item label="批复量(方)" name="qtySalesM3" :class="diffResultList.includes('qtySalesM3')?'changeStyle':''">{{ formState.qtySalesM3 }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="比值(方/吉焦)" name="rateM3Gj" :class="diffResultList.includes('rateM3Gj')?'changeStyle':''">{{ formState.rateM3Gj }}</a-form-item>
@ -170,9 +170,9 @@
{ title: t('供应商'), dataIndex: 'suName', width: 300},
{ title: t('上载点'), dataIndex: 'pointUpName', width:300},
{ title: t('指定量(吉焦)'), dataIndex: 'qtyDemandGj', width: 200},
{ title: t('指定量(方)'), dataIndex: 'qtyDemandM3', width: 200},
{ title: t('指定量(方)'), dataIndex: 'qtyDemandM3', width: 200},
{ title: t('批复量(吉焦)'), dataIndex: 'qtySalesGj', width: 200},
{ title: t('批复量(方)'), dataIndex: 'qtySalesM3', width: 200},
{ title: t('批复量(方)'), dataIndex: 'qtySalesM3', width: 200},
{ title: t('备注'), dataIndex: 'note', width: 200},
]);
const formState = ref({})

View File

@ -13,7 +13,7 @@
<a-form-item label="合同量(吉焦)" name="qtyContractGj" :class="diffResultList.includes('qtyContractGj') ? 'changeStyle': ''">{{ formState.qtyContractGj }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="合同量(方)" name="qtyContractM3" :class="diffResultList.includes('qtyContractM3') ? 'changeStyle': ''">{{ formState.qtyContractM3 }}</a-form-item>
<a-form-item label="合同量(方)" name="qtyContractM3" :class="diffResultList.includes('qtyContractM3') ? 'changeStyle': ''">{{ formState.qtyContractM3 }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="月合同量执行进度%" name="rateK" :class="diffResultList.includes('rateK') ? 'changeStyle': ''">{{ formState.rateK }}</a-form-item>
@ -22,7 +22,7 @@
<a-form-item label="计划量(吉焦)" name="qtyPlanGj" :class="diffResultList.includes('qtyPlanGj') ? 'changeStyle': ''">{{ formState.qtyPlanGj }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="计划量(方)" name="qtyPlanM3" :class="diffResultList.includes('qtyPlanM3') ? 'changeStyle': ''">{{ formState.qtyPlanM3 }}</a-form-item>
<a-form-item label="计划量(方)" name="qtyPlanM3" :class="diffResultList.includes('qtyPlanM3') ? 'changeStyle': ''">{{ formState.qtyPlanM3 }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="月计划量执行进度%" name="rateMp" :class="diffResultList.includes('rateMp') ? 'changeStyle': ''">{{ formState.rateMp }}</a-form-item>
@ -31,7 +31,7 @@
<a-form-item label="指定量(吉焦)" name="qtyDemandGj" :class="diffResultList.includes('qtyDemandGj') ? 'changeStyle': ''">{{ formState.qtyDemandGj }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="指定量(方)" name="qtyDemandM3" :class="diffResultList.includes('qtyDemandM3') ? 'changeStyle': ''">{{ formState.qtyDemandM3 }}</a-form-item>
<a-form-item label="指定量(方)" name="qtyDemandM3" :class="diffResultList.includes('qtyDemandM3') ? 'changeStyle': ''">{{ formState.qtyDemandM3 }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="月时间进度%" name="rateS" :class="diffResultList.includes('rateS') ? 'changeStyle': ''">{{ formState.rateS }}</a-form-item>
@ -40,7 +40,7 @@
<a-form-item label="批复量(吉焦)" name="qtySalesGj" :class="diffResultList.includes('qtySalesGj') ? 'changeStyle': ''">{{ formState.qtySalesGj }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="批复量(方)" name="qtySalesM3" :class="diffResultList.includes('qtySalesM3') ? 'changeStyle': ''">{{ formState.qtySalesM3 }}</a-form-item>
<a-form-item label="批复量(方)" name="qtySalesM3" :class="diffResultList.includes('qtySalesM3') ? 'changeStyle': ''">{{ formState.qtySalesM3 }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="比值(方/吉焦)" name="rateM3Gj" :class="diffResultList.includes('rateM3Gj') ? 'changeStyle': ''">{{ formState.rateM3Gj }}</a-form-item>
@ -126,9 +126,9 @@
{ title: t('供应商'), dataIndex: 'suName', width: 400},
{ title: t('采购合同'), dataIndex: 'kpName', width: 400},
{ title: t('指定量(吉焦)'), dataIndex: 'qtyDemandGj', width: 300},
{ title: t('指定量(方)'), dataIndex: 'qtyDemandM3', width: 200},
{ title: t('指定量(方)'), dataIndex: 'qtyDemandM3', width: 200},
{ title: t('批复量(吉焦)'), dataIndex: 'qtySalesGj', width: 200},
{ title: t('批复量(方)'), dataIndex: 'qtySalesM3', width: 200},
{ title: t('批复量(方)'), dataIndex: 'qtySalesM3', width: 200},
{ title: t('备注'), dataIndex: 'note', width: 300},
]);
const formState = ref()

View File

@ -234,7 +234,7 @@ export const columns: BasicColumn[] = [
{
dataIndex: 'qtyDemandM3',
title: '指定量(方)',
title: '指定量(方)',
componentType: 'input',
align: 'left',
@ -252,7 +252,7 @@ export const columns: BasicColumn[] = [
{
dataIndex: 'qtySalesM3',
title: '批复量(方)',
title: '批复量(方)',
componentType: 'input',
align: 'left',

View File

@ -193,18 +193,8 @@
return
}
}
let request = ''
if (formPath.includes('dayPlan/PngAppro/index')) {
request = approveLngPngAppro
}
if (formPath.includes('dayPlan/pngPipeAppro/index')) {
request = approveLngPngApproGD
}
if (formPath.includes('dayPlan/pngReceiveStationAppro/index')) {
request = approveLngPngApproSZ
}
spinning.value = true;
await request(params);
await approveLngPngAppro(params);
spinning.value = false;
notification.success({
message: 'Tip',

View File

@ -117,29 +117,9 @@
let formName='管道气销售审批';
let curPath = 'dayPlan/PngAppro/index'
let request = ''
let requestApprove = ''
if (path.includes('dayPlan/PngAppro/index')) {
formName='管道气销售审批'
curPath = 'dayPlan/PngAppro/index'
request = getLngPngApproPage
requestApprove = approveLngPngAppro
}
if (path.includes('dayPlan/pngPipeAppro/index')) {
formName='管道气管道审批'
curPath = 'dayPlan/pngPipeAppro'
request = getLngPngApproPageGd
requestApprove = approveLngPngApproGD
}
if (path.includes('dayPlan/pngReceiveStationAppro/index')) {
formName='管道气接收站审批'
curPath = 'dayPlan/pngReceiveStationAppro'
request = getLngPngApproPageJsz
requestApprove = approveLngPngApproSZ
}
const [registerTable, { reload, clearSelectedRowKeys, setTableData }] = useTable({
title: '' || (formName + '列表'),
api: request,
api: getLngPngApproPage,
rowKey: 'id',
columns: customConfigColums,
formConfig: {
@ -304,7 +284,7 @@
"remark": "",
"data": arr
}
await requestApprove(obj)
await approveLngPngAppro(obj)
handleSuccess();
notification.success({
message: 'Tip',

View File

@ -26,7 +26,7 @@
<PngApproModal @register="registerModal" @success="handleSuccess" />
<DataLog :logId="logId" :logPath="logPath" v-model:visible="modalVisible"/>
<approStatusModal @register="registerApproStatus" ></approStatusModal>
<rejectReplyModal @register="registerRejectReply" @success="handleRejectReply" />
<rejectReplyModal :visible="isOpen" @success="handleRejectReply" />
</PageWrapper>
</template>
<script lang="ts" setup>
@ -78,22 +78,27 @@
const tableRef = ref();
//所有按钮
const buttons = ref([{"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":"reject","icon":"ant-design:stop-outlined","isDefault":true},{"isUse":true,"name":"审批通过","code":"batchapprove","icon":"ant-design:check-outlined","isDefault":true}]);
const buttons = ref([{"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":"approveGD","icon":"ant-design:check-outlined","isDefault":true},
{"isUse":true,"name":"驳回","code":"reject","icon":"ant-design:stop-outlined","isDefault":true},
]);
//展示在列表内的按钮
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord','approve','reject']);
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord','approveGD','reject']);
const buttonConfigs = computed(()=>{
return filterButtonAuth(buttons.value);
})
const tableButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
// return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
return [{"isUse":true,"name":"审批通过","code":"approveGD","icon":"ant-design:check-outlined","isDefault":true}]
});
const actionButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
});
const btnEvent = {refresh : handleRefresh,view : handleView,startwork : handleStartwork,flowRecord : handleFlowRecord,approve : handleApprove,reject: handleReject,batchapprove: handleBatchApprove}
const btnEvent = {refresh : handleRefresh,view : handleView,startwork : handleStartwork,flowRecord : handleFlowRecord,approveGD : handleApprove,reject: handleReject}
const { currentRoute } = useRouter();
const router = useRouter();
@ -117,6 +122,7 @@
const [registerModal, { openModal}] = useModal();
const [registerApproStatus, { openModal: openModalApproStatus}] = useModal();
const [registerRejectReply, { openModal: openModalRejectReply}] = useModal();
const isOpen = ref(false)
const curData = ref({})
let formName='管道气销售审批';
@ -269,7 +275,7 @@
}
function handleReject (record: Recordable) {
curData.value = record
openModalRejectReply(true,{isUpdate: false});
isOpen.value = true
}
const handleRejectReply = async (val) => {
let obj = {
@ -278,6 +284,7 @@
"data": [{datePlan: curData.value.datePlan}]
}
await requestApprove(obj)
isOpen.value = false
handleSuccess();
notification.success({
message: 'Tip',

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 { addLngPngAppro, getLngPngAppro, updateLngPngAppro, deleteLngPngAppro } from '/@/api/dayPlan/PngApproGd';
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 getLngPngAppro(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 updateLngPngAppro(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 addLngPngAppro(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 deleteLngPngAppro([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,227 @@
import { FormProps, FormSchema } from '/@/components/Form';
import { BasicColumn } from '/@/components/Table';
export const formConfig = {
useCustomConfig: false,
};
export const searchFormSchema: FormSchema[] = [
{
field: 'datePlan',
label: '计划日期',
component: 'RangePicker',
componentProps: {
format: 'YYYY-MM-DD',
style: { width: '100%' },
getPopupContainer: () => document.body,
},
},
];
export const columns: BasicColumn[] = [
{
dataIndex: 'datePlan',
title: '计划日期',
componentType: 'input',
align: 'left',
width: 100,
sorter: true,
},
{
dataIndex: 'daysSign',
title: '当日/次日',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'pointName',
title: '下载点',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'qtyGjGd',
title: '待管道审批量(吉焦)',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'qtyGjXs',
title: '前审中量(吉焦)',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'qtyGjYsp',
title: '管道已审批量(吉焦)',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'staName',
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: '683f135952ab475cad8bdc56eb65b221',
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: '3240cd9a50ec42e6817bf147488e8cdc',
field: 'datePlan',
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,32 @@
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: '683f135952ab475cad8bdc56eb65b221',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '计划日期',
fieldId: 'datePlan',
isSubTable: false,
showChildren: true,
type: 'input',
key: '3240cd9a50ec42e6817bf147488e8cdc',
children: [],
},
];

View File

@ -0,0 +1,399 @@
<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>
<PngApproGdModal @register="registerModal" @success="handleSuccess" />
<DataLog :logId="logId" :logPath="logPath" v-model:visible="modalVisible"/>
<rejectReplyModal :visible="isOpen" @success="handleRejectReply" />
</PageWrapper>
</template>
<script lang="ts" setup>
const modalVisible = ref(false);
const logId = ref('')
const logPath = ref('/dayPlan/pngApproGd/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 { getLngPngApproPage, deleteLngPngAppro,approveLngPngAppro} from '/@/api/dayPlan/PngApproGd';
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 { useModal } from '/@/components/Modal';
import PngApproGdModal from './components/PngApproGdModal.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 rejectReplyModal from '/@/components/common/rejectReplyModal.vue';
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":"refresh","icon":"ant-design:reload-outlined","isDefault":true,"isUse":true},
{"isUse":true,"name":"审批","code":"approveGd","icon":"ant-design:check-outlined","isDefault":true},
{"isUse":true,"name":"驳回","code":"reject","icon":"ant-design:stop-outlined","isDefault":true},]);
//展示在列表内的按钮
const actionButtons = ref<string[]>(['reject', 'approveGd']);
const buttonConfigs = computed(()=>{
return filterButtonAuth(buttons.value);
})
const tableButtonConfig = computed(() => {
// return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
return [{"isUse":true,"name":"审批通过","code":"approveGD","icon":"ant-design:check-outlined","isDefault":true}]
});
const actionButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
});
const btnEvent = {refresh : handleRefresh,view : handleView,approveGd : handleApprove,reject: handleReject}
const isOpen = ref(false)
const selectedKeys = ref([])
const curData = ref({})
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='管道气管道审批';
const [registerTable, { reload, clearSelectedRowKeys }] = useTable({
title: '' || (formName + '列表'),
api: getLngPngApproPage,
rowKey: 'datePlan',
columns: customConfigColums,
formConfig: {
rowProps: {
gutter: 16,
},
schemas: customSearchFormSchema,
fieldMapToTime: [['datePlan', ['startDate', 'endDate'], 'YYYY-MM-DD HH:mm:ss ', true],],
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' },
},
rowSelection: {
type: 'checkbox',
onChange: onSelectChange
},
tableSetting: {
size: false,
setting: false,
},
});
function onSelectChange(rowKeys: string[]) {
selectedKeys.value = rowKeys;
}
async function handleApprove(record: Recordable) {
let obj = {
"result": "C",
"remark": "",
"data": [{datePlan: record.datePlan}]
}
await approveLngPngAppro(obj)
handleSuccess();
notification.success({
message: 'Tip',
description: t('审批成功!'),
});
}
function handleReject (record: Recordable) {
curData.value = record
isOpen.value = true
}
const handleRejectReply = async (val) => {
let obj = {
"result": "R",
"remark": val.reply,
"data": [{datePlan: curData.value.datePlan}]
}
await approveLngPngAppro(obj)
isOpen.value = false
handleSuccess();
notification.success({
message: 'Tip',
description: t('已驳回!'),
});
}
async function handleBatchApprove () {
if (!selectedKeys.value.length) {
notification.warning({
message: 'Tip',
description: t('请选择需要审批的数据'),
});
return;
}
let arr = selectedKeys.value.map(v=> {
return {
datePlan: v
}
})
let obj = {
"result": "C",
"remark": "",
"data": arr
}
await approveLngPngAppro(obj)
handleSuccess();
notification.success({
message: 'Tip',
description: t('审批成功!'),
});
clearSelectedRowKeys()
}
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/PngApproGd/' + record.id + '/viewForm',
query: {
formPath: 'dayPlan/PngApproGd',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
}
}
function buttonClick(code) {
// btnEvent[code]();
handleBatchApprove()
}
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/PngApproGd/0/createForm',
query: {
formPath: 'dayPlan/PngApproGd',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
}
}
function handleEdit(record: Recordable) {
router.push({
path: '/form/PngApproGd/' + record.id + '/updateForm',
query: {
formPath: 'dayPlan/PngApproGd',
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() {
deleteLngPngAppro(ids).then((_) => {
handleSuccess();
notification.success({
message: 'Tip',
description: t('删除成功!'),
});
});
},
onCancel() {},
});
}
function handleRefresh() {
reload();
}
function handleSuccess() {
reload();
}
function handleView(record: Recordable) {
dbClickRow(record);
}
onMounted(() => {
if (schemaIdComputedRef.value) {
bus.on(FLOW_PROCESSED, handleRefresh);
bus.on(CREATE_FLOW, handleRefresh);
} else {
bus.on(FORM_LIST_MODIFIED, handleRefresh);
}
// 合并渲染覆盖配置中的列表配置,包括展示字段配置、搜索字段配置、按钮配置
mergeCustomListRenderConfig();
});
onUnmounted(() => {
if (schemaIdComputedRef.value) {
bus.off(FLOW_PROCESSED, handleRefresh);
bus.off(CREATE_FLOW, handleRefresh);
} else {
bus.off(FORM_LIST_MODIFIED, handleRefresh);
}
});
function getActions(record: Recordable):ActionItem[] {
let actionsList: ActionItem[] = [];
let editAndDelBtn: ActionItem[] = [];
let hasFlowRecord = false;
actionButtonConfig.value?.map((button) => {
if (['view', 'copyData', 'approveGd', 'reject'].includes(button.code)) {
actionsList.push({
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
});
}
if (['edit', 'delete'].includes(button.code)) {
editAndDelBtn.push({
icon: button?.icon,
tooltip: button?.name,
color: button.code === 'delete' ? 'error' : undefined,
onClick: btnEvent[button.code].bind(null, record),
});
}
if (button.code === 'flowRecord') hasFlowRecord = true;
});
// if (record.workflowData?.enabled) {
// //与工作流有关联的表单
// if (record.workflowData.status) {
// actionsList.unshift(setIndexFlowStatus(record.workflowData))
// } else {
// actionsList = actionsList.concat(editAndDelBtn);
// }
// } else {
// if (!record.workflowData?.processId) {
// //与工作流没有关联的表单并且在当前页面新增的数据 如选择编辑、删除按钮则加上
// actionsList = actionsList.concat(editAndDelBtn);
// }
// }
return actionsList;
}
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 { addLngPngAppro, getLngPngAppro, updateLngPngAppro, deleteLngPngAppro } from '/@/api/dayPlan/PngApproJsz';
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 getLngPngAppro(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 updateLngPngAppro(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 addLngPngAppro(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 deleteLngPngAppro([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,247 @@
import { FormProps, FormSchema } from '/@/components/Form';
import { BasicColumn } from '/@/components/Table';
export const formConfig = {
useCustomConfig: false,
};
export const searchFormSchema: FormSchema[] = [
{
field: 'datePlan',
label: '计划日期',
component: 'RangePicker',
componentProps: {
format: 'YYYY-MM-DD',
style: { width: '100%' },
getPopupContainer: () => document.body,
},
},
];
export const columns: BasicColumn[] = [
{
dataIndex: 'catName',
title: '品种',
componentType: 'input',
align: 'left',
width: 80,
sorter: true,
},
{
dataIndex: 'datePlan',
title: '计划日期',
componentType: 'input',
align: 'left',
width: 100,
sorter: true,
},
{
dataIndex: 'daysSign',
title: '当日/次日',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'qtyGjAll',
title: '全部上报量(吉焦)',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'qtyGjJsz',
title: '待接收站审批量(吉焦)',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'qtyGjXs',
title: '前审中量(吉焦)',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'qtyGjYsp',
title: '管道已审批量(吉焦)',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'staName',
title: '接收站',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'uomName',
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: '4987e77a40b84fc5839e8320a4a03262',
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: 'e05e379e525741a6854f46976655539f',
field: 'datePlan',
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,32 @@
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: '4987e77a40b84fc5839e8320a4a03262',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '计划日期',
fieldId: 'datePlan',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'e05e379e525741a6854f46976655539f',
children: [],
},
];

View File

@ -0,0 +1,393 @@
<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>
<PngApproJszModal @register="registerModal" @success="handleSuccess" />
<DataLog :logId="logId" :logPath="logPath" v-model:visible="modalVisible"/>
<rejectReplyModal :visible="isOpen" @success="handleRejectReply" />
</PageWrapper>
</template>
<script lang="ts" setup>
const modalVisible = ref(false);
const logId = ref('')
const logPath = ref('/dayPlan/pngApproJsz/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 { getLngPngApproPage, deleteLngPngAppro, approveLngPngAppro} from '/@/api/dayPlan/PngApproJsz';
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 { getLngPngAppro } from '/@/api/dayPlan/PngApproJsz';
import { useModal } from '/@/components/Modal';
import PngApproJszModal from './components/PngApproJszModal.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 rejectReplyModal from '/@/components/common/rejectReplyModal.vue';
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":"refresh","icon":"ant-design:reload-outlined","isDefault":true,"isUse":true},
{"isUse":true,"name":"审批","code":"approveJsz","icon":"ant-design:check-outlined","isDefault":true},
{"isUse":true,"name":"驳回","code":"reject","icon":"ant-design:stop-outlined","isDefault":true}]);
//展示在列表内的按钮
const actionButtons = ref<string[]>(['reject', 'approveJsz']);
const buttonConfigs = computed(()=>{
return filterButtonAuth(buttons.value);
})
const tableButtonConfig = computed(() => {
return [{"isUse":true,"name":"审批通过","code":"approveGD","icon":"ant-design:check-outlined","isDefault":true}]
// 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 = {refresh : handleRefresh,view : handleView,approveJsz : handleApprove,reject: handleReject,}
const isOpen = ref(false)
const selectedKeys = ref([])
const curData = ref({})
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='管道气接收站审批';
const [registerTable, { reload, clearSelectedRowKeys }] = useTable({
title: '' || (formName + '列表'),
api: getLngPngApproPage,
rowKey: 'datePlan',
columns: customConfigColums,
formConfig: {
rowProps: {
gutter: 16,
},
schemas: customSearchFormSchema,
fieldMapToTime: [['datePlan', ['startDate', 'endDate'], 'YYYY-MM-DD HH:mm:ss ', true],],
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' },
},
rowSelection: {
type: 'checkbox',
onChange: onSelectChange
},
tableSetting: {
size: false,
setting: false,
},
});
function onSelectChange(rowKeys: string[]) {
selectedKeys.value = rowKeys;
}
async function handleApprove(record: Recordable) {
let obj = {
"result": "C",
"remark": "",
"data": [{datePlan: record.datePlan}]
}
await approveLngPngAppro(obj)
handleSuccess();
notification.success({
message: 'Tip',
description: t('审批成功!'),
});
}
function handleReject (record: Recordable) {
curData.value = record
isOpen.value = true
}
const handleRejectReply = async (val) => {
let obj = {
"result": "R",
"remark": val.reply,
"data": [{datePlan: curData.value.datePlan}]
}
await approveLngPngAppro(obj)
isOpen.value = false
handleSuccess();
notification.success({
message: 'Tip',
description: t('已驳回!'),
});
}
async function handleBatchApprove () {
if (!selectedKeys.value.length) {
notification.warning({
message: 'Tip',
description: t('请选择需要审批的数据'),
});
return;
}
let arr = selectedKeys.value.map(v=> {
return {
datePlan: v
}
})
let obj = {
"result": "C",
"remark": "",
"data": arr
}
await approveLngPngAppro(obj)
handleSuccess();
notification.success({
message: 'Tip',
description: t('审批成功!'),
});
clearSelectedRowKeys()
}
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/PngApproJsz/' + record.id + '/viewForm',
query: {
formPath: 'dayPlan/PngApproJsz',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
}
}
function buttonClick(code) {
handleBatchApprove()
// 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/PngApproJsz/0/createForm',
query: {
formPath: 'dayPlan/PngApproJsz',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
}
}
function handleEdit(record: Recordable) {
router.push({
path: '/form/PngApproJsz/' + record.id + '/updateForm',
query: {
formPath: 'dayPlan/PngApproJsz',
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() {
deleteLngPngAppro(ids).then((_) => {
handleSuccess();
notification.success({
message: 'Tip',
description: t('删除成功!'),
});
});
},
onCancel() {},
});
}
function handleRefresh() {
reload();
}
function handleSuccess() {
reload();
}
function handleView(record: Recordable) {
dbClickRow(record);
}
onMounted(() => {
if (schemaIdComputedRef.value) {
bus.on(FLOW_PROCESSED, handleRefresh);
bus.on(CREATE_FLOW, handleRefresh);
} else {
bus.on(FORM_LIST_MODIFIED, handleRefresh);
}
// 合并渲染覆盖配置中的列表配置,包括展示字段配置、搜索字段配置、按钮配置
mergeCustomListRenderConfig();
});
onUnmounted(() => {
if (schemaIdComputedRef.value) {
bus.off(FLOW_PROCESSED, handleRefresh);
bus.off(CREATE_FLOW, handleRefresh);
} else {
bus.off(FORM_LIST_MODIFIED, handleRefresh);
}
});
function getActions(record: Recordable):ActionItem[] {
let actionsList: ActionItem[] = [];
let editAndDelBtn: ActionItem[] = [];
let hasFlowRecord = false;
actionButtonConfig.value?.map((button) => {
if (['view', 'copyData', 'approveJsz', 'reject'].includes(button.code)) {
actionsList.push({
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
});
}
if (['edit', 'delete'].includes(button.code)) {
editAndDelBtn.push({
icon: button?.icon,
tooltip: button?.name,
color: button.code === 'delete' ? 'error' : undefined,
onClick: btnEvent[button.code].bind(null, record),
});
}
if (button.code === 'flowRecord') hasFlowRecord = true;
});
// if (record.workflowData?.enabled) {
// //与工作流有关联的表单
// if (record.workflowData.status) {
// actionsList.unshift(setIndexFlowStatus(record.workflowData))
// } else {
// actionsList = actionsList.concat(editAndDelBtn);
// }
// } else {
// if (!record.workflowData?.processId) {
// //与工作流没有关联的表单并且在当前页面新增的数据 如选择编辑、删除按钮则加上
// actionsList = actionsList.concat(editAndDelBtn);
// }
// }
return actionsList;
}
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;
}
</style>

View File

@ -101,7 +101,7 @@ export const columns: BasicColumn[] = [
{
dataIndex: 'qtySalesM3',
title: '批复量(方)',
title: '批复量(方)',
componentType: 'input',
align: 'left',
width: 120,
@ -119,7 +119,7 @@ export const columns: BasicColumn[] = [
{
dataIndex: 'qtyMeaM3',
title: '完成量(方)',
title: '完成量(方)',
componentType: 'input',
align: 'left',
width: 120,

View File

@ -10,7 +10,16 @@
</a-button>
</div>
<searchForm @search="onSearch" @reset="onReset" ></searchForm>
<BasicTable @register="registerTable"></BasicTable>
<BasicTable @register="registerTable">
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'qtySalesM3'">
{{ NP.divide(Number(record.qtySalesM3), 10000) }}
</template>
<template v-if="column.dataIndex === 'qtyMeaM3'">
{{ NP.divide(Number(record.qtyMeaM3), 10000) }}
</template>
</template>
</BasicTable>
</div>
</a-spin>
</template>
@ -31,6 +40,7 @@
import { getLngPngMeasureSalesPurPageAdd, addLngPngMeasureSalesPur } from '/@/api/dayPlan/PngMeasureSalesPur';
import {formConfig, searchFormSchema, columns } from './config';
import searchForm from './searchForm.vue';
import NP from 'number-precision';
const userStore = useUserStore();

View File

@ -83,7 +83,7 @@
import { downloadByUrl } from '/@/utils/file/download';
import { DeleteOutlined } from '@ant-design/icons-vue';
import searchForm from './components/searchForm.vue'
import NP from 'number-precision';
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
@ -168,6 +168,10 @@
...formState.value,
});
tableData.value = res.list || [];
tableData.value.forEach(v=> {
v.qtySalesM3 = NP.divide(Number(v.qtySalesM3), 10000)
v.qtyMeaM3 = NP.divide(Number(v.qtyMeaM3), 10000)
})
total.value = res.total || res.length || 0;
} catch (error) {
console.error('获取列表失败:', error);
@ -260,6 +264,10 @@
});
return;
}
selectedRowsData.value.forEach(v => {
v.qtyMeaM3 = NP.times(Number(v.qtyMeaM3), 10000)
v.qtySalesM3 = NP.times(Number(v.qtySalesM3), 10000)
})
await updateLngPngMeasureSalesPur(selectedRowsData.value)
handleSuccess();
notification.success({
@ -275,6 +283,10 @@
});
return;
}
selectedRowsData.value.forEach(v => {
v.qtyMeaM3 = NP.times(Number(v.qtyMeaM3), 10000)
v.qtySalesM3 = NP.times(Number(v.qtySalesM3), 10000)
})
await addLngPngMeasureSalesPur(selectedRowsData.value)
handleSuccess();
notification.success({