客户年度需求
This commit is contained in:
89
src/api/plan/PlanYearDemandHdr/index.ts
Normal file
89
src/api/plan/PlanYearDemandHdr/index.ts
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
import { LngPlanYearDemandHdrPageModel, LngPlanYearDemandHdrPageParams, LngPlanYearDemandHdrPageResult } from './model/PlanYearDemandHdrModel';
|
||||||
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
|
import { ErrorMessageMode } from '/#/axios';
|
||||||
|
|
||||||
|
enum Api {
|
||||||
|
Page = '/plan/planYearDemandHdr/page',
|
||||||
|
List = '/plan/planYearDemandHdr/list',
|
||||||
|
Info = '/plan/planYearDemandHdr/info',
|
||||||
|
LngPlanYearDemandHdr = '/plan/planYearDemandHdr',
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 查询LngPlanYearDemandHdr分页列表
|
||||||
|
*/
|
||||||
|
export async function getLngPlanYearDemandHdrPage(params: LngPlanYearDemandHdrPageParams, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.get<LngPlanYearDemandHdrPageResult>(
|
||||||
|
{
|
||||||
|
url: Api.Page,
|
||||||
|
params,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 获取LngPlanYearDemandHdr信息
|
||||||
|
*/
|
||||||
|
export async function getLngPlanYearDemandHdr(id: String, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.get<LngPlanYearDemandHdrPageModel>(
|
||||||
|
{
|
||||||
|
url: Api.Info,
|
||||||
|
params: { id },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 新增LngPlanYearDemandHdr
|
||||||
|
*/
|
||||||
|
export async function addLngPlanYearDemandHdr(lngPlanYearDemandHdr: Recordable, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.post<boolean>(
|
||||||
|
{
|
||||||
|
url: Api.LngPlanYearDemandHdr,
|
||||||
|
params: lngPlanYearDemandHdr,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 更新LngPlanYearDemandHdr
|
||||||
|
*/
|
||||||
|
export async function updateLngPlanYearDemandHdr(lngPlanYearDemandHdr: Recordable, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.put<boolean>(
|
||||||
|
{
|
||||||
|
url: Api.LngPlanYearDemandHdr,
|
||||||
|
params: lngPlanYearDemandHdr,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 删除LngPlanYearDemandHdr(批量删除)
|
||||||
|
*/
|
||||||
|
export async function deleteLngPlanYearDemandHdr(ids: string[], mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.delete<boolean>(
|
||||||
|
{
|
||||||
|
url: Api.LngPlanYearDemandHdr,
|
||||||
|
data: ids,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -0,0 +1,46 @@
|
|||||||
|
import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: LngPlanYearDemandHdr分页参数 模型
|
||||||
|
*/
|
||||||
|
export interface LngPlanYearDemandHdrPageParams extends BasicPageParams {
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
planYear: string;
|
||||||
|
|
||||||
|
demandVerNo: string;
|
||||||
|
|
||||||
|
cuCode: string;
|
||||||
|
|
||||||
|
note: string;
|
||||||
|
|
||||||
|
reply: string;
|
||||||
|
|
||||||
|
approCode: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: LngPlanYearDemandHdr分页返回值模型
|
||||||
|
*/
|
||||||
|
export interface LngPlanYearDemandHdrPageModel {
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
planYear: string;
|
||||||
|
|
||||||
|
demandVerNo: string;
|
||||||
|
|
||||||
|
cuCode: string;
|
||||||
|
|
||||||
|
note: string;
|
||||||
|
|
||||||
|
reply: string;
|
||||||
|
|
||||||
|
approCode: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: LngPlanYearDemandHdr分页返回值结构
|
||||||
|
*/
|
||||||
|
export type LngPlanYearDemandHdrPageResult = BasicFetchResult<LngPlanYearDemandHdrPageModel>;
|
||||||
114
src/api/plan/PlanYearDemandHdrEc/index.ts
Normal file
114
src/api/plan/PlanYearDemandHdrEc/index.ts
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
import { LngPlanYearDemandHdrPageModel, LngPlanYearDemandHdrPageParams, LngPlanYearDemandHdrPageResult } from './model/PlanYearDemandHdrEcModel';
|
||||||
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
|
import { ErrorMessageMode } from '/#/axios';
|
||||||
|
|
||||||
|
enum Api {
|
||||||
|
Page = '/plan/planYearDemandHdrEc/page',
|
||||||
|
List = '/plan/planYearDemandHdrEc/list',
|
||||||
|
Info = '/plan/planYearDemandHdrEc/info',
|
||||||
|
LngPlanYearDemandHdr = '/plan/planYearDemandHdrEc',
|
||||||
|
|
||||||
|
|
||||||
|
Export = '/plan/planYearDemandHdrEc/export',
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 查询LngPlanYearDemandHdr分页列表
|
||||||
|
*/
|
||||||
|
export async function getLngPlanYearDemandHdrPage(params: LngPlanYearDemandHdrPageParams, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.get<LngPlanYearDemandHdrPageResult>(
|
||||||
|
{
|
||||||
|
url: Api.Page,
|
||||||
|
params,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 获取LngPlanYearDemandHdr信息
|
||||||
|
*/
|
||||||
|
export async function getLngPlanYearDemandHdr(id: String, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.get<LngPlanYearDemandHdrPageModel>(
|
||||||
|
{
|
||||||
|
url: Api.Info,
|
||||||
|
params: { id },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 新增LngPlanYearDemandHdr
|
||||||
|
*/
|
||||||
|
export async function addLngPlanYearDemandHdr(lngPlanYearDemandHdr: Recordable, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.post<boolean>(
|
||||||
|
{
|
||||||
|
url: Api.LngPlanYearDemandHdr,
|
||||||
|
params: lngPlanYearDemandHdr,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 更新LngPlanYearDemandHdr
|
||||||
|
*/
|
||||||
|
export async function updateLngPlanYearDemandHdr(lngPlanYearDemandHdr: Recordable, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.put<boolean>(
|
||||||
|
{
|
||||||
|
url: Api.LngPlanYearDemandHdr,
|
||||||
|
params: lngPlanYearDemandHdr,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 删除LngPlanYearDemandHdr(批量删除)
|
||||||
|
*/
|
||||||
|
export async function deleteLngPlanYearDemandHdr(ids: string[], mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.delete<boolean>(
|
||||||
|
{
|
||||||
|
url: Api.LngPlanYearDemandHdr,
|
||||||
|
data: ids,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 导出LngPlanYearDemandHdr
|
||||||
|
*/
|
||||||
|
export async function exportLngPlanYearDemandHdr(
|
||||||
|
params?: object,
|
||||||
|
mode: ErrorMessageMode = 'modal'
|
||||||
|
) {
|
||||||
|
return defHttp.download(
|
||||||
|
{
|
||||||
|
url: Api.Export,
|
||||||
|
method: 'GET',
|
||||||
|
params,
|
||||||
|
responseType: 'blob',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -0,0 +1,42 @@
|
|||||||
|
import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: LngPlanYearDemandHdr分页参数 模型
|
||||||
|
*/
|
||||||
|
export interface LngPlanYearDemandHdrPageParams extends BasicPageParams {
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
planYear: string;
|
||||||
|
|
||||||
|
demandVerNo: string;
|
||||||
|
|
||||||
|
note: string;
|
||||||
|
|
||||||
|
reply: string;
|
||||||
|
|
||||||
|
approCode: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: LngPlanYearDemandHdr分页返回值模型
|
||||||
|
*/
|
||||||
|
export interface LngPlanYearDemandHdrPageModel {
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
planYear: string;
|
||||||
|
|
||||||
|
demandVerNo: string;
|
||||||
|
|
||||||
|
note: string;
|
||||||
|
|
||||||
|
reply: string;
|
||||||
|
|
||||||
|
approCode: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: LngPlanYearDemandHdr分页返回值结构
|
||||||
|
*/
|
||||||
|
export type LngPlanYearDemandHdrPageResult = BasicFetchResult<LngPlanYearDemandHdrPageModel>;
|
||||||
@ -406,6 +406,14 @@ export const PAGE_CUSTOM_ROUTE: AppRouteRecordRaw[] = [{
|
|||||||
title: (route) => (route.query.formName)
|
title: (route) => (route.query.formName)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/plan/PlanYearDemandHdrEc/createForm',
|
||||||
|
name: 'PlanYearDemandHdrEc',
|
||||||
|
component: () => import('/@/views/plan/PlanYearDemandHdrEc/components/createForm.vue'),
|
||||||
|
meta: {
|
||||||
|
title: (route) => (route.query.formName)
|
||||||
|
}
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
224
src/views/plan/PlanYearDemandHdr/components/Form.vue
Normal file
224
src/views/plan/PlanYearDemandHdr/components/Form.vue
Normal 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 { addLngPlanYearDemandHdr, getLngPlanYearDemandHdr, updateLngPlanYearDemandHdr, deleteLngPlanYearDemandHdr } from '/@/api/plan/PlanYearDemandHdr';
|
||||||
|
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 getLngPlanYearDemandHdr(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 updateLngPlanYearDemandHdr(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 addLngPlanYearDemandHdr(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 deleteLngPlanYearDemandHdr([id]);
|
||||||
|
}
|
||||||
|
defineExpose({
|
||||||
|
setFieldsValue,
|
||||||
|
resetFields,
|
||||||
|
validate,
|
||||||
|
add,
|
||||||
|
update,
|
||||||
|
setFormDataFromId,
|
||||||
|
setDisabledForm,
|
||||||
|
setMenuPermission,
|
||||||
|
setWorkFlowForm,
|
||||||
|
getRowKey,
|
||||||
|
getFormModel,
|
||||||
|
handleDelete
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@ -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: '提示',
|
||||||
|
description: t('新增成功!'),
|
||||||
|
}); //提示消息
|
||||||
|
} else {
|
||||||
|
notification.success({
|
||||||
|
message: '提示',
|
||||||
|
description: t('修改成功!'),
|
||||||
|
}); //提示消息
|
||||||
|
}
|
||||||
|
closeModal();
|
||||||
|
formRef.value.resetFields();
|
||||||
|
emit('success');
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
setModalProps({ confirmLoading: false });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleClose() {
|
||||||
|
formRef.value.resetFields();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
410
src/views/plan/PlanYearDemandHdr/components/config.ts
Normal file
410
src/views/plan/PlanYearDemandHdr/components/config.ts
Normal file
@ -0,0 +1,410 @@
|
|||||||
|
import { FormProps, FormSchema } from '/@/components/Form';
|
||||||
|
import { BasicColumn } from '/@/components/Table';
|
||||||
|
|
||||||
|
export const formConfig = {
|
||||||
|
useCustomConfig: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const searchFormSchema: FormSchema[] = [
|
||||||
|
{
|
||||||
|
field: 'planYear',
|
||||||
|
label: '年度',
|
||||||
|
component: 'DatePicker',
|
||||||
|
componentProps: {
|
||||||
|
format: 'YYYY',
|
||||||
|
picker: 'year',
|
||||||
|
style: { width: '100%' },
|
||||||
|
getPopupContainer: () => document.body,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'cuName',
|
||||||
|
label: '客户',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'approCode',
|
||||||
|
label: '审批状态',
|
||||||
|
component: 'XjrSelect',
|
||||||
|
componentProps: {
|
||||||
|
datasourceType: 'dic',
|
||||||
|
params: { itemId: '2041424751560290306' },
|
||||||
|
labelField: 'name',
|
||||||
|
valueField: 'value',
|
||||||
|
|
||||||
|
getPopupContainer: () => document.body,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
export const columns: BasicColumn[] = [
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'planYear',
|
||||||
|
title: '年度',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'demandVerNo',
|
||||||
|
title: '版本号',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'cuName',
|
||||||
|
title: '客户',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'note',
|
||||||
|
title: '备注',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'reply',
|
||||||
|
title: '批复意见',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'approName',
|
||||||
|
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: '0f55d4a505584be19d8e69413d6f3cf9',
|
||||||
|
field: 'id',
|
||||||
|
label: 'id',
|
||||||
|
type: 'input',
|
||||||
|
component: 'Input',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请输入id',
|
||||||
|
maxlength: null,
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
addonBefore: '',
|
||||||
|
addonAfter: '',
|
||||||
|
disabled: false,
|
||||||
|
allowClear: false,
|
||||||
|
showLabel: true,
|
||||||
|
required: false,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isSave: false,
|
||||||
|
isShow: true,
|
||||||
|
scan: false,
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: '8d4b43677c554eaaa2bddde3bc2e9f78',
|
||||||
|
field: 'planYear',
|
||||||
|
label: '年度',
|
||||||
|
type: 'input',
|
||||||
|
component: 'Input',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请输入年度',
|
||||||
|
maxlength: null,
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
addonBefore: '',
|
||||||
|
addonAfter: '',
|
||||||
|
disabled: false,
|
||||||
|
allowClear: false,
|
||||||
|
showLabel: true,
|
||||||
|
required: false,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isSave: false,
|
||||||
|
isShow: true,
|
||||||
|
scan: false,
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: '0d4dabfba38645a999d7edef890b1cea',
|
||||||
|
field: 'demandVerNo',
|
||||||
|
label: '版本号',
|
||||||
|
type: 'input',
|
||||||
|
component: 'Input',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请输入版本号',
|
||||||
|
maxlength: null,
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
addonBefore: '',
|
||||||
|
addonAfter: '',
|
||||||
|
disabled: false,
|
||||||
|
allowClear: false,
|
||||||
|
showLabel: true,
|
||||||
|
required: false,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isSave: false,
|
||||||
|
isShow: true,
|
||||||
|
scan: false,
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: '3c532771635d425d8b04a6b4656e0d91',
|
||||||
|
field: 'cuCode',
|
||||||
|
label: '客户',
|
||||||
|
type: 'input',
|
||||||
|
component: 'Input',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请输入客户',
|
||||||
|
maxlength: null,
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
addonBefore: '',
|
||||||
|
addonAfter: '',
|
||||||
|
disabled: false,
|
||||||
|
allowClear: false,
|
||||||
|
showLabel: true,
|
||||||
|
required: false,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isSave: false,
|
||||||
|
isShow: true,
|
||||||
|
scan: false,
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'a8591e27bbcc4fa4a32ab49906ddd0f9',
|
||||||
|
field: 'note',
|
||||||
|
label: '备注',
|
||||||
|
type: 'input',
|
||||||
|
component: 'Input',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请输入备注',
|
||||||
|
maxlength: null,
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
addonBefore: '',
|
||||||
|
addonAfter: '',
|
||||||
|
disabled: false,
|
||||||
|
allowClear: false,
|
||||||
|
showLabel: true,
|
||||||
|
required: false,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isSave: false,
|
||||||
|
isShow: true,
|
||||||
|
scan: false,
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: '5e7f348c8e5241719d9b9261bd58dd03',
|
||||||
|
field: 'reply',
|
||||||
|
label: '批复意见',
|
||||||
|
type: 'input',
|
||||||
|
component: 'Input',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请输入批复意见',
|
||||||
|
maxlength: null,
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
addonBefore: '',
|
||||||
|
addonAfter: '',
|
||||||
|
disabled: false,
|
||||||
|
allowClear: false,
|
||||||
|
showLabel: true,
|
||||||
|
required: false,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isSave: false,
|
||||||
|
isShow: true,
|
||||||
|
scan: false,
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: '983178cd214946c1b4e34f5fe5600eaf',
|
||||||
|
field: 'approCode',
|
||||||
|
label: '状态',
|
||||||
|
type: 'input',
|
||||||
|
component: 'Input',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请输入状态',
|
||||||
|
maxlength: null,
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
addonBefore: '',
|
||||||
|
addonAfter: '',
|
||||||
|
disabled: false,
|
||||||
|
allowClear: false,
|
||||||
|
showLabel: true,
|
||||||
|
required: false,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isSave: false,
|
||||||
|
isShow: true,
|
||||||
|
scan: false,
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
showActionButtonGroup: false,
|
||||||
|
buttonLocation: 'center',
|
||||||
|
actionColOptions: { span: 24 },
|
||||||
|
showResetButton: false,
|
||||||
|
showSubmitButton: false,
|
||||||
|
hiddenComponent: [],
|
||||||
|
};
|
||||||
@ -0,0 +1,107 @@
|
|||||||
|
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: '0f55d4a505584be19d8e69413d6f3cf9',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '年度',
|
||||||
|
fieldId: 'planYear',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'input',
|
||||||
|
key: '8d4b43677c554eaaa2bddde3bc2e9f78',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '版本号',
|
||||||
|
fieldId: 'demandVerNo',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'input',
|
||||||
|
key: '0d4dabfba38645a999d7edef890b1cea',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '客户',
|
||||||
|
fieldId: 'cuCode',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'input',
|
||||||
|
key: '3c532771635d425d8b04a6b4656e0d91',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '备注',
|
||||||
|
fieldId: 'note',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'input',
|
||||||
|
key: 'a8591e27bbcc4fa4a32ab49906ddd0f9',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '批复意见',
|
||||||
|
fieldId: 'reply',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'input',
|
||||||
|
key: '5e7f348c8e5241719d9b9261bd58dd03',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '状态',
|
||||||
|
fieldId: 'approCode',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'input',
|
||||||
|
key: '983178cd214946c1b4e34f5fe5600eaf',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
];
|
||||||
277
src/views/plan/PlanYearDemandHdr/index.vue
Normal file
277
src/views/plan/PlanYearDemandHdr/index.vue
Normal file
@ -0,0 +1,277 @@
|
|||||||
|
<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>
|
||||||
|
<PlanYearDemandHdrModal @register="registerModal" @success="handleSuccess" />
|
||||||
|
<DataLog :logId="logId" :logPath="logPath" v-model:visible="modalVisible"/>
|
||||||
|
<rejectReplyModal :visible="isOpen" @success="handleRejectReply" @cancel="handleRejectCancel"/>
|
||||||
|
</PageWrapper>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
const modalVisible = ref(false);
|
||||||
|
const logId = ref('')
|
||||||
|
const logPath = ref('/plan/planYearDemandHdr/datalog');
|
||||||
|
import { DataLog } from '/@/components/pcitc';
|
||||||
|
import { ref, computed, onMounted, onUnmounted, } from 'vue';
|
||||||
|
|
||||||
|
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
|
||||||
|
import { getLngPlanYearDemandHdrPage, deleteLngPlanYearDemandHdr} from '/@/api/plan/PlanYearDemandHdr';
|
||||||
|
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 { getLngPlanYearDemandHdr } from '/@/api/plan/PlanYearDemandHdr';
|
||||||
|
import { useModal } from '/@/components/Modal';
|
||||||
|
import PlanYearDemandHdrModal from './components/PlanYearDemandHdrModal.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 isOpen = ref(false)
|
||||||
|
const curData = ref({})
|
||||||
|
const { notification } = useMessage();
|
||||||
|
const { t } = useI18n();
|
||||||
|
defineEmits(['register']);
|
||||||
|
const { filterColumnAuth, filterButtonAuth } = usePermission();
|
||||||
|
const { mergeColumns,mergeSearchFormSchema,mergeButtons } = useFormConfig();
|
||||||
|
|
||||||
|
const filterColumns = cloneDeep(filterColumnAuth(columns));
|
||||||
|
const customConfigColums =ref(filterColumns);
|
||||||
|
const customSearchFormSchema =ref(searchFormSchema);
|
||||||
|
|
||||||
|
const tableRef = ref();
|
||||||
|
//所有按钮
|
||||||
|
const buttons = ref([{"isUse":true,"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true},{"isUse":true,"name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true},{"isUse":true,"name":"驳回","code":"reject","icon":"ant-design:stop-outlined","isDefault":false},{"isUse":true,"name":"数据日志","code":"datalog","icon":"ant-design:profile-outlined","isDefault":true}]);
|
||||||
|
//展示在列表内的按钮
|
||||||
|
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord','reject']);
|
||||||
|
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 = {refresh : handleRefresh,view : handleView, datalog:handleDatalog, reject: handleReject}
|
||||||
|
|
||||||
|
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: getLngPlanYearDemandHdrPage,
|
||||||
|
rowKey: 'id',
|
||||||
|
columns: customConfigColums,
|
||||||
|
formConfig: {
|
||||||
|
rowProps: {
|
||||||
|
gutter: 16,
|
||||||
|
},
|
||||||
|
schemas: customSearchFormSchema,
|
||||||
|
fieldMapToTime: [],
|
||||||
|
showResetButton: true,
|
||||||
|
},
|
||||||
|
beforeFetch: (params) => {
|
||||||
|
return { ...params, FormId: formIdComputedRef.value, PK: 'id' };
|
||||||
|
},
|
||||||
|
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/PlanYearDemandHdr/' + record.id + '/viewForm',
|
||||||
|
query: {
|
||||||
|
formPath: 'plan/PlanYearDemandHdr',
|
||||||
|
formName: formName,
|
||||||
|
formId:currentRoute.value.meta.formId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function buttonClick(code) {
|
||||||
|
|
||||||
|
btnEvent[code]();
|
||||||
|
}
|
||||||
|
function handleDatalog (record: Recordable) {
|
||||||
|
modalVisible.value = true
|
||||||
|
logId.value = record.id
|
||||||
|
}
|
||||||
|
function handleRefresh() {
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
function handleSuccess() {
|
||||||
|
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleView(record: Recordable) {
|
||||||
|
|
||||||
|
dbClickRow(record);
|
||||||
|
|
||||||
|
}
|
||||||
|
function handleReject (record: Recordable) {
|
||||||
|
curData.value = record
|
||||||
|
isOpen.value = true
|
||||||
|
}
|
||||||
|
const handleRejectCancel = ()=> {
|
||||||
|
isOpen.value = false
|
||||||
|
}
|
||||||
|
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: '提示',
|
||||||
|
description: t('已驳回!'),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
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[] {
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
224
src/views/plan/PlanYearDemandHdrEc/components/Form.vue
Normal file
224
src/views/plan/PlanYearDemandHdrEc/components/Form.vue
Normal 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 { addLngPlanYearDemandHdr, getLngPlanYearDemandHdr, updateLngPlanYearDemandHdr, deleteLngPlanYearDemandHdr } from '/@/api/plan/PlanYearDemandHdrEc';
|
||||||
|
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 getLngPlanYearDemandHdr(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 updateLngPlanYearDemandHdr(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 addLngPlanYearDemandHdr(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 deleteLngPlanYearDemandHdr([id]);
|
||||||
|
}
|
||||||
|
defineExpose({
|
||||||
|
setFieldsValue,
|
||||||
|
resetFields,
|
||||||
|
validate,
|
||||||
|
add,
|
||||||
|
update,
|
||||||
|
setFormDataFromId,
|
||||||
|
setDisabledForm,
|
||||||
|
setMenuPermission,
|
||||||
|
setWorkFlowForm,
|
||||||
|
getRowKey,
|
||||||
|
getFormModel,
|
||||||
|
handleDelete
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@ -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: '提示',
|
||||||
|
description: t('新增成功!'),
|
||||||
|
}); //提示消息
|
||||||
|
} else {
|
||||||
|
notification.success({
|
||||||
|
message: '提示',
|
||||||
|
description: t('修改成功!'),
|
||||||
|
}); //提示消息
|
||||||
|
}
|
||||||
|
closeModal();
|
||||||
|
formRef.value.resetFields();
|
||||||
|
emit('success');
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
setModalProps({ confirmLoading: false });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleClose() {
|
||||||
|
formRef.value.resetFields();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
349
src/views/plan/PlanYearDemandHdrEc/components/config.ts
Normal file
349
src/views/plan/PlanYearDemandHdrEc/components/config.ts
Normal file
@ -0,0 +1,349 @@
|
|||||||
|
import { FormProps, FormSchema } from '/@/components/Form';
|
||||||
|
import { BasicColumn } from '/@/components/Table';
|
||||||
|
|
||||||
|
export const formConfig = {
|
||||||
|
useCustomConfig: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const searchFormSchema: FormSchema[] = [
|
||||||
|
{
|
||||||
|
field: 'planYear',
|
||||||
|
label: '年度',
|
||||||
|
component: 'DatePicker',
|
||||||
|
componentProps: {
|
||||||
|
format: 'YYYY',
|
||||||
|
picker: 'year',
|
||||||
|
style: { width: '100%' },
|
||||||
|
getPopupContainer: () => document.body,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export const columns: BasicColumn[] = [
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'planYear',
|
||||||
|
title: '年度',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'demandVerNo',
|
||||||
|
title: '版本号',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'note',
|
||||||
|
title: '备注',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'reply',
|
||||||
|
title: '批复意见',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'approName',
|
||||||
|
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: '74ddba3c60094d51b749402f9e8e57c3',
|
||||||
|
field: 'id',
|
||||||
|
label: 'id',
|
||||||
|
type: 'input',
|
||||||
|
component: 'Input',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请输入id',
|
||||||
|
maxlength: null,
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
addonBefore: '',
|
||||||
|
addonAfter: '',
|
||||||
|
disabled: false,
|
||||||
|
allowClear: false,
|
||||||
|
showLabel: true,
|
||||||
|
required: false,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isSave: false,
|
||||||
|
isShow: true,
|
||||||
|
scan: false,
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: '764c944652104dd6a660ae05c74a0ede',
|
||||||
|
field: 'planYear',
|
||||||
|
label: '年度',
|
||||||
|
type: 'input',
|
||||||
|
component: 'Input',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请输入年度',
|
||||||
|
maxlength: null,
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
addonBefore: '',
|
||||||
|
addonAfter: '',
|
||||||
|
disabled: false,
|
||||||
|
allowClear: false,
|
||||||
|
showLabel: true,
|
||||||
|
required: false,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isSave: false,
|
||||||
|
isShow: true,
|
||||||
|
scan: false,
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'ea1d8a8a99cc4aadbf63f3ac6ed24b3d',
|
||||||
|
field: 'demandVerNo',
|
||||||
|
label: '版本号',
|
||||||
|
type: 'input',
|
||||||
|
component: 'Input',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请输入版本号',
|
||||||
|
maxlength: null,
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
addonBefore: '',
|
||||||
|
addonAfter: '',
|
||||||
|
disabled: false,
|
||||||
|
allowClear: false,
|
||||||
|
showLabel: true,
|
||||||
|
required: false,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isSave: false,
|
||||||
|
isShow: true,
|
||||||
|
scan: false,
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: '39b1078b4076431b8fbf9af2e848ebe3',
|
||||||
|
field: 'note',
|
||||||
|
label: '备注',
|
||||||
|
type: 'input',
|
||||||
|
component: 'Input',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请输入备注',
|
||||||
|
maxlength: null,
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
addonBefore: '',
|
||||||
|
addonAfter: '',
|
||||||
|
disabled: false,
|
||||||
|
allowClear: false,
|
||||||
|
showLabel: true,
|
||||||
|
required: false,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isSave: false,
|
||||||
|
isShow: true,
|
||||||
|
scan: false,
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: '74147ba379aa413c8526c44f9e35a17c',
|
||||||
|
field: 'reply',
|
||||||
|
label: '批复意见',
|
||||||
|
type: 'input',
|
||||||
|
component: 'Input',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请输入批复意见',
|
||||||
|
maxlength: null,
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
addonBefore: '',
|
||||||
|
addonAfter: '',
|
||||||
|
disabled: false,
|
||||||
|
allowClear: false,
|
||||||
|
showLabel: true,
|
||||||
|
required: false,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isSave: false,
|
||||||
|
isShow: true,
|
||||||
|
scan: false,
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'b0afca6ea5cc4bf2aa924ae235e18bd0',
|
||||||
|
field: 'approCode',
|
||||||
|
label: '状态',
|
||||||
|
type: 'input',
|
||||||
|
component: 'Input',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: false,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请输入状态',
|
||||||
|
maxlength: null,
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
addonBefore: '',
|
||||||
|
addonAfter: '',
|
||||||
|
disabled: false,
|
||||||
|
allowClear: false,
|
||||||
|
showLabel: true,
|
||||||
|
required: false,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isSave: false,
|
||||||
|
isShow: true,
|
||||||
|
scan: false,
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
showActionButtonGroup: false,
|
||||||
|
buttonLocation: 'center',
|
||||||
|
actionColOptions: { span: 24 },
|
||||||
|
showResetButton: false,
|
||||||
|
showSubmitButton: false,
|
||||||
|
hiddenComponent: [],
|
||||||
|
};
|
||||||
293
src/views/plan/PlanYearDemandHdrEc/components/createForm.vue
Normal file
293
src/views/plan/PlanYearDemandHdrEc/components/createForm.vue
Normal file
@ -0,0 +1,293 @@
|
|||||||
|
<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('save')">
|
||||||
|
<slot name="icon"><save-outlined /></slot>保存
|
||||||
|
</a-button>
|
||||||
|
<a-button style="margin-right: 10px" @click="handleSubmit('submit')">
|
||||||
|
<slot name="icon"><send-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="planYear">
|
||||||
|
<a-date-picker :inputReadOnly="true" v-model:value="formState.planYear" picker='year' style="width: 100%" :disabled="isDisable||pageType=='edit'" placeholder="请选择" @change="yearChange" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="版本号" name="demandVerNo">
|
||||||
|
{{ formState.demandVerNo }}
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="状态" name="approName">
|
||||||
|
{{ (optionSelect.approCodeList.find(v=>v.code == formState.approCode) || {}).name }}
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item label="备注" name="note">
|
||||||
|
{{ formState.note }}
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</Card>
|
||||||
|
<Card :bordered="false" >
|
||||||
|
<template #title>
|
||||||
|
<div style="display: flex; align-items: center;">
|
||||||
|
<span style="margin-left: 8px;">年度需求明细</span>
|
||||||
|
<a-button style="margin: 0 10px" v-if="!isDisable">下载模板</a-button>
|
||||||
|
<a-button type="primary" style="margin: 0 10px" v-if="!isDisable">导入</a-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<a-table style="width: 100%" :columns="columns" :data-source="dataList" :pagination="false">
|
||||||
|
<template #bodyCell="{ column, record, index }">
|
||||||
|
<template v-if="column.dataIndex === 'qty'">
|
||||||
|
<input-number v-model:value="record.qty" :disabled="isDisable || record.month=='合计'" :digits="3" :min="0" style="width: 100%" @blur="numCount(record.qty, record)"/>
|
||||||
|
</template>
|
||||||
|
<template v-if="column.dataIndex === 'lng'">
|
||||||
|
<input-number v-model:value="record.lng" :disabled="isDisable|| record.month=='合计'" :digits="3" :min="0" style="width: 100%" @blur="numCount(record.lng, record)"/>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</a-table>
|
||||||
|
</Card>
|
||||||
|
</a-form>
|
||||||
|
</div>
|
||||||
|
</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, DeleteOutlined} 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 { addLngPlanYearDemandHdr,updateLngPlanYearDemandHdr, getLngPlanYearDemandHdr, getContractScPageList} from '/@/api/plan/PlanYearDemandHdrEc';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
import { getAppEnvConfig } from '/@/utils/env';
|
||||||
|
import { message } from 'ant-design-vue';
|
||||||
|
import { useUserStore } from '/@/store/modules/user';
|
||||||
|
import { cloneDeep } from 'lodash-es';
|
||||||
|
import { getParameter } from '/@/api/contract/ContractProc';
|
||||||
|
import { DataFormat, FormatOption, DATE_FORMAT, FormatType } from '/@/utils/dataFormat';
|
||||||
|
const userStore = useUserStore();
|
||||||
|
const userInfo = userStore.getUserInfo;
|
||||||
|
|
||||||
|
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 dataList = ref([])
|
||||||
|
const curIdx = ref(null)
|
||||||
|
const curIndex = ref(null)
|
||||||
|
const spinning = ref(false);
|
||||||
|
const { notification } = useMessage();
|
||||||
|
const { t } = useI18n()
|
||||||
|
|
||||||
|
const formState = reactive({
|
||||||
|
approCode: 'WTJ'
|
||||||
|
});
|
||||||
|
const rateTonM3 = ref()
|
||||||
|
const rules= reactive({
|
||||||
|
planYear: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||||
|
});
|
||||||
|
const columns= ref([
|
||||||
|
{ title: t('序号'), dataIndex: 'index', key: 'index', customRender: (column) => `${column.index + 1}` ,width: 50},
|
||||||
|
{ title: t('月份'), dataIndex: 'month', width: 80},
|
||||||
|
{ title: t('管道气(万方)'), dataIndex: 'qty', width: 250},
|
||||||
|
{ title: t('LNG(吨)'), dataIndex: 'lng', width: 250},
|
||||||
|
{ title: t('LNG(万方)(气化率1400)'), dataIndex: 'lngNum'},
|
||||||
|
{ title: t('小计(万方)'), dataIndex: 'total'},
|
||||||
|
]);
|
||||||
|
const layout = {
|
||||||
|
labelCol: { span: 8 },
|
||||||
|
wrapperCol: { span: 16 },
|
||||||
|
}
|
||||||
|
let optionSelect= reactive({
|
||||||
|
approCodeList: [],
|
||||||
|
});
|
||||||
|
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'
|
||||||
|
if (pageId.value) {
|
||||||
|
getInfo(pageId.value)
|
||||||
|
} else {
|
||||||
|
dataList.value = []
|
||||||
|
for(let i=0;i<12;i++) {
|
||||||
|
dataList.value.push({month: i+1+'月'})
|
||||||
|
}
|
||||||
|
let arr = [{month: '合计'}]
|
||||||
|
for(let i=0;i<3;i++) {
|
||||||
|
arr.push({month: '次年'+(i+1)+'月'})
|
||||||
|
}
|
||||||
|
dataList.value = [...dataList.value, ...arr]
|
||||||
|
}
|
||||||
|
getSysRate()
|
||||||
|
getOption()
|
||||||
|
});
|
||||||
|
async function getSysRate () {
|
||||||
|
let a = await getParameter({code: 'RATE_TON_M3'})||[]
|
||||||
|
rateTonM3.value = a[0]?.valueNum1
|
||||||
|
}
|
||||||
|
async function getInfo(id) {
|
||||||
|
spinning.value = true
|
||||||
|
try {
|
||||||
|
let data = await getLngPlanYearDemandHdr(id)
|
||||||
|
|
||||||
|
Object.assign(formState, {...data})
|
||||||
|
|
||||||
|
spinning.value = false
|
||||||
|
dataList.value = data?.lngContractSalesPngPointPurList || []
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
spinning.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const numCount = (val, record) => {
|
||||||
|
if (!val) return
|
||||||
|
// LNG(万方)=LNG(吨)*气化率/10000;
|
||||||
|
record.lngNum = Number(record.lng || 0) * Number(rateTonM3.value || 0)/10000
|
||||||
|
// 小计=管道气(万方)+LNG(万方);
|
||||||
|
record.total = Number(record.qty || 0) + Number(record.lngNum || 0)
|
||||||
|
let qytTotal = 0
|
||||||
|
let lngTotal = 0
|
||||||
|
let lngNumTotal = 0
|
||||||
|
let subtotal= 0
|
||||||
|
let index = null
|
||||||
|
dataList.value.forEach((v, idx)=> {
|
||||||
|
if (idx<12) {
|
||||||
|
qytTotal+=(Number(v.qty)||0)
|
||||||
|
lngTotal+=(Number(v.lng)||0)
|
||||||
|
lngNumTotal+=(Number(v.lngNum)||0)
|
||||||
|
subtotal+=(Number(v.total)||0)
|
||||||
|
}
|
||||||
|
if (v.month == '合计') {
|
||||||
|
index = idx
|
||||||
|
}
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
dataList.value[index].qty = qytTotal
|
||||||
|
dataList.value[index].lng = lngTotal
|
||||||
|
dataList.value[index].lngNum = lngNumTotal
|
||||||
|
dataList.value[index].total = subtotal
|
||||||
|
|
||||||
|
dataList.value = DataFormat.format(dataList.value, [
|
||||||
|
FormatOption.createQty('lngNum'),
|
||||||
|
FormatOption.createQty('total'),
|
||||||
|
]);
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
async function getOption() {
|
||||||
|
optionSelect.approCodeList = await getDictionary('LNG_APPRO2')
|
||||||
|
}
|
||||||
|
const yearChange = (val) => {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function close() {
|
||||||
|
tabStore.closeTab(currentRoute.value, router);
|
||||||
|
}
|
||||||
|
async function getFormValue() {
|
||||||
|
return formState
|
||||||
|
}
|
||||||
|
async function handleSubmit(type) {
|
||||||
|
try {
|
||||||
|
spinning.value = true;
|
||||||
|
let request = !pageId.value ? addLngPlanYearDemandHdr : updateLngPlanYearDemandHdr
|
||||||
|
let obj = {}
|
||||||
|
await request(obj)
|
||||||
|
spinning.value = false;
|
||||||
|
notification.success({
|
||||||
|
message: '提示',
|
||||||
|
description: type == 'save' ? '保存成功':'已提交'
|
||||||
|
}); //提示消息
|
||||||
|
setTimeout(() => {
|
||||||
|
bus.emit(FORM_LIST_MODIFIED, {});
|
||||||
|
close();
|
||||||
|
}, 500);
|
||||||
|
|
||||||
|
} catch (errorInfo) {
|
||||||
|
spinning.value = false;
|
||||||
|
errorInfo?.errorFields?.length && notification.warning({
|
||||||
|
message: '提示',
|
||||||
|
description: '请完善信息'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -0,0 +1,92 @@
|
|||||||
|
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: '74ddba3c60094d51b749402f9e8e57c3',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '年度',
|
||||||
|
fieldId: 'planYear',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'input',
|
||||||
|
key: '764c944652104dd6a660ae05c74a0ede',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '版本号',
|
||||||
|
fieldId: 'demandVerNo',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'input',
|
||||||
|
key: 'ea1d8a8a99cc4aadbf63f3ac6ed24b3d',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '备注',
|
||||||
|
fieldId: 'note',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'input',
|
||||||
|
key: '39b1078b4076431b8fbf9af2e848ebe3',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '批复意见',
|
||||||
|
fieldId: 'reply',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'input',
|
||||||
|
key: '74147ba379aa413c8526c44f9e35a17c',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '状态',
|
||||||
|
fieldId: 'approCode',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'input',
|
||||||
|
key: 'b0afca6ea5cc4bf2aa924ae235e18bd0',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
];
|
||||||
297
src/views/plan/PlanYearDemandHdrEc/index.vue
Normal file
297
src/views/plan/PlanYearDemandHdrEc/index.vue
Normal file
@ -0,0 +1,297 @@
|
|||||||
|
<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>
|
||||||
|
<PlanYearDemandHdrEcModal @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('/plan/planYearDemandHdrEc/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 { getLngPlanYearDemandHdrPage, deleteLngPlanYearDemandHdr, exportLngPlanYearDemandHdr} from '/@/api/plan/PlanYearDemandHdrEc';
|
||||||
|
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 { getLngPlanYearDemandHdr } from '/@/api/plan/PlanYearDemandHdrEc';
|
||||||
|
import { useModal } from '/@/components/Modal';
|
||||||
|
import PlanYearDemandHdrEcModal from './components/PlanYearDemandHdrEcModal.vue';
|
||||||
|
import { downloadByData } from '/@/utils/file/download';
|
||||||
|
import {formConfig, searchFormSchema, columns } from './components/config';
|
||||||
|
import Icon from '/@/components/Icon/index';
|
||||||
|
import useEventBus from '/@/hooks/event/useEventBus';
|
||||||
|
import { cloneDeep } from 'lodash-es';
|
||||||
|
|
||||||
|
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
|
||||||
|
|
||||||
|
const { notification } = useMessage();
|
||||||
|
const { t } = useI18n();
|
||||||
|
defineEmits(['register']);
|
||||||
|
const { filterColumnAuth, filterButtonAuth } = usePermission();
|
||||||
|
const { mergeColumns,mergeSearchFormSchema,mergeButtons } = useFormConfig();
|
||||||
|
|
||||||
|
const filterColumns = cloneDeep(filterColumnAuth(columns));
|
||||||
|
const customConfigColums =ref(filterColumns);
|
||||||
|
const customSearchFormSchema =ref(searchFormSchema);
|
||||||
|
|
||||||
|
const tableRef = ref();
|
||||||
|
//所有按钮
|
||||||
|
const buttons = ref([{"isUse":true,"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"type":"primary"},{"isUse":true,"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true},{"isUse":true,"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true},{"isUse":true,"name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true},{"isUse":true,"name":"导出","code":"export","icon":"ant-design:export-outlined","isDefault":true},{"isUse":true,"name":"变更","code":"update","icon":"ant-design:edit-filled","isDefault":true},{"isUse":true,"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true},{"isUse":true,"name":"数据日志","code":"datalog","icon":"ant-design:profile-outlined","isDefault":true}]);
|
||||||
|
//展示在列表内的按钮
|
||||||
|
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord', 'export', 'update',]);
|
||||||
|
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,export : handleExport,update : handleUpdate,delete : handleDelete, datalog:handleDatalog}
|
||||||
|
|
||||||
|
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: getLngPlanYearDemandHdrPage,
|
||||||
|
rowKey: 'id',
|
||||||
|
columns: customConfigColums,
|
||||||
|
formConfig: {
|
||||||
|
rowProps: {
|
||||||
|
gutter: 16,
|
||||||
|
},
|
||||||
|
schemas: customSearchFormSchema,
|
||||||
|
fieldMapToTime: [],
|
||||||
|
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) {
|
||||||
|
router.push({
|
||||||
|
path: '/plan/PlanYearDemandHdrEc/createForm',
|
||||||
|
query: {
|
||||||
|
formPath: 'plan/PlanYearDemandHdrEc',
|
||||||
|
formName: '编辑'+formName,
|
||||||
|
formId:currentRoute.value.meta.formId,
|
||||||
|
id: record.id,
|
||||||
|
type: 'view'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
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: '/plan/PlanYearDemandHdrEc/createForm',
|
||||||
|
query: {
|
||||||
|
formPath: 'plan/PlanYearDemandHdrEc',
|
||||||
|
formName: '新建'+formName,
|
||||||
|
formId:currentRoute.value.meta.formId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleEdit(record: Recordable) {
|
||||||
|
|
||||||
|
router.push({
|
||||||
|
path: '/plan/PlanYearDemandHdrEc/createForm',
|
||||||
|
query: {
|
||||||
|
formPath: 'plan/PlanYearDemandHdrEc',
|
||||||
|
formName: '编辑'+formName,
|
||||||
|
formId:currentRoute.value.meta.formId,
|
||||||
|
id: record.id,
|
||||||
|
type: 'edit'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function handleDelete(record: Recordable) {
|
||||||
|
deleteList([record.id]);
|
||||||
|
}
|
||||||
|
function deleteList(ids) {
|
||||||
|
Modal.confirm({
|
||||||
|
title: '提示信息',
|
||||||
|
icon: createVNode(ExclamationCircleOutlined),
|
||||||
|
content: '是否确认删除?',
|
||||||
|
okText: '确认',
|
||||||
|
cancelText: '取消',
|
||||||
|
onOk() {
|
||||||
|
deleteLngPlanYearDemandHdr(ids).then((_) => {
|
||||||
|
handleSuccess();
|
||||||
|
notification.success({
|
||||||
|
message: '提示',
|
||||||
|
description: t('删除成功!'),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onCancel() {},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function handleRefresh() {
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
function handleSuccess() {
|
||||||
|
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleView(record: Recordable) {
|
||||||
|
|
||||||
|
dbClickRow(record);
|
||||||
|
|
||||||
|
}
|
||||||
|
function handleUpdate () {
|
||||||
|
|
||||||
|
}
|
||||||
|
async function handleExport() {
|
||||||
|
const res = await exportLngPlanYearDemandHdr({ isTemplate: false });
|
||||||
|
downloadByData(
|
||||||
|
res.data,
|
||||||
|
'PlanYearDemandHdrEc.xlsx',
|
||||||
|
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
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[] {
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user