Commit 729b11af by 宋春膨

feat(zlgl): 添加不合格品处理模块功能

- 定义了质量不合格相关的数据模型接口,包括分页参数、返回值模型和表类型
- 实现了完整的CRUD API接口,支持查询、新增、更新、删除和导出功能
- 创建了表单配置文件,定义搜索表单字段、表格列和表单布局
- 构建了弹窗组件,集成表单验证、提交和自定义按钮功能
- 配置了子表单用于管理质检明细数据
- 实现了多层嵌套的表单布局和字段验证规则
parent 4cca7f66
import { MesQualityUnqualifiedPageModel, MesQualityUnqualifiedPageParams, MesQualityUnqualifiedPageResult } from './model/BhgpclModel';
import { defHttp } from '/@/utils/http/axios';
import { ErrorMessageMode } from '/#/axios';
enum Api {
Page = '/zlgl/bhgpcl/page',
List = '/zlgl/bhgpcl/list',
Info = '/zlgl/bhgpcl/info',
MesQualityUnqualified = '/zlgl/bhgpcl',
Export = '/zlgl/bhgpcl/export',
ListChildren = '/zlgl/bhgpcl/list-children'
}
/**
* @description: 查询MesQualityUnqualified分页列表
*/
export async function getMesQualityUnqualifiedPage(params: MesQualityUnqualifiedPageParams, mode: ErrorMessageMode = 'modal') {
return defHttp.get<MesQualityUnqualifiedPageResult>(
{
url: Api.Page,
params,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 获取MesQualityUnqualified信息
*/
export async function getMesQualityUnqualified(id: String, mode: ErrorMessageMode = 'modal') {
return defHttp.get<MesQualityUnqualifiedPageModel>(
{
url: Api.Info,
params: { id },
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 新增MesQualityUnqualified
*/
export async function addMesQualityUnqualified(mesQualityUnqualified: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.post<boolean>(
{
url: Api.MesQualityUnqualified,
params: mesQualityUnqualified,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 更新MesQualityUnqualified
*/
export async function updateMesQualityUnqualified(mesQualityUnqualified: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.put<boolean>(
{
url: Api.MesQualityUnqualified,
params: mesQualityUnqualified,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 删除MesQualityUnqualified(批量删除)
*/
export async function deleteMesQualityUnqualified(ids: string[], mode: ErrorMessageMode = 'modal') {
return defHttp.delete<boolean>(
{
url: Api.MesQualityUnqualified,
data: ids,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 导出MesQualityUnqualified
*/
export async function exportMesQualityUnqualified(
params?: object,
mode: ErrorMessageMode = 'modal'
) {
return defHttp.download(
{
url: Api.Export,
method: 'GET',
params,
responseType: 'blob',
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 查询子表数据
*/
export async function getChildrenMesQualityUnqualified(params: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.get(
{
url: Api.ListChildren,
params,
},
{
errorMessageMode: mode,
},
);
}
import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
/**
* @description: MesQualityUnqualified分页参数 模型
*/
export interface MesQualityUnqualifiedPageParams extends BasicPageParams {
djrq: string;
clr: string;
sszz: string;
}
/**
* @description: MesQualityUnqualified分页返回值模型
*/
export interface MesQualityUnqualifiedPageModel {
id: string;
djbh: string;
djrq: string;
clr: string;
modifyDate: string;
createDate: string;
sszz: string;
}
/**
* @description: MesQualityUnqualified表类型
*/
export interface MesQualityUnqualifiedModel {
id: string;
deleteMark: string;
djbh: string;
djrq: string;
clr: string;
sszz: string;
bz: string;
p1: string;
p2: string;
p3: string;
p4: string;
p5: string;
p6: string;
p7: string;
p8: string;
p9: string;
p10: string;
p11: string;
p12: string;
p13: string;
p14: string;
p15: string;
p16: string;
p17: string;
p18: string;
p19: string;
p20: string;
p21: string;
p22: string;
p23: string;
p24: string;
p25: string;
p26: string;
p27: string;
p28: string;
p29: string;
p30: string;
createDate: string;
createUserId: string;
modifyDate: string;
modifyUserId: string;
mesQualityUnqualifiedRelaList?: MesQualityUnqualifiedRelaModel;
}
/**
* @description: MesQualityUnqualifiedRela表类型
*/
export interface MesQualityUnqualifiedRelaModel {
id: string;
deleteMark: string;
bhgid: string;
wlid: string;
djbh: string;
djrq: string;
wlbh: string;
wlmc: string;
lph: string;
jybz: string;
sjsl: string;
jcsl: string;
zjr: string;
zjzt: string;
bhgs: string;
bhgyy: string;
clfs: string;
bz: string;
p1: string;
p2: string;
p3: string;
p4: string;
p5: string;
p6: string;
p7: string;
p8: string;
p9: string;
p10: string;
p11: string;
p12: string;
p13: string;
p14: string;
p15: string;
p16: string;
p17: string;
p18: string;
p19: string;
p20: string;
p21: string;
p22: string;
p23: string;
p24: string;
p25: string;
p26: string;
p27: string;
p28: string;
p29: string;
p30: string;
createDate: string;
createUserId: string;
modifyDate: string;
modifyUserId: string;
}
/**
* @description: MesQualityUnqualified分页返回值结构
*/
export type MesQualityUnqualifiedPageResult = BasicFetchResult<MesQualityUnqualifiedPageModel>;
<template>
<BasicModal
:height="1080"
v-bind="$attrs" @register="registerModal" :title="getTitle"
@ok="handleSubmit" @cancel="handleClose" >
<ModalForm ref="formRef" v-model:value="state.formModel" :fromPage="FromPageType.MENU" />
<template #footer v-if=" !state.isView">
<template v-for="(item, index) in sortBy(formButtons, 'index')" :key="item.key">
<template v-if="item.isShow">
<CustomButtonModal v-if="item.type == CustomButtonModalType.Modal" :info="item" />
<a-button
:type="item.style"
v-else
:style="{ marginLeft: index > 0 ? '10px' : 0 }"
@click="customClick(item)"
>
{{ t(item.name) }}
</a-button>
</template>
</template>
</template>
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, computed, reactive, provide, Ref } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { CustomButtonModalType } from '/@/enums/userEnum';
import CustomButtonModal from '/@/components/Form/src/components/CustomButtonModal.vue';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { formProps ,formButtons } from './config';
import ModalForm from './Form.vue';
import { FromPageType } from '/@/enums/workflowEnum';
import { sortBy } from 'lodash-es';
import { executeCurFormEvent } from '/@/utils/event/data';
const emit = defineEmits(['success', 'register']);
const { notification } = useMessage();
const formRef = ref();
const isCopy = ref<boolean>(false)
const state = reactive({
formModel: {},
isUpdate: true,
isView: false,
rowId: '',
});
provide<Ref<boolean>>('isCopy', isCopy);
const { t } = useI18n();
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
await handleInner(data);
});
const getTitle = computed(() => (state.isView ? '查看' : state.isUpdate ? '编辑' : isCopy.value ? '复制数据' : '新增'));
async function handleInner(data){
state.isUpdate = !!data?.isUpdate;
state.isView = !!data?.isView;
isCopy.value = !!data?.isCopy;
setModalProps({
destroyOnClose: true,
maskClosable: false,
showCancelBtn: false,
showOkBtn: false,
canFullscreen: true,
width: 1980,
footer: state.isView ? null : undefined,defaultFullscreen:true,
});
if (state.isUpdate || state.isView || isCopy.value) {
state.rowId = data.id;
if (state.isView) {
await formRef.value.setDisabledForm();
}
await formRef.value.setFormDataFromId(state.rowId);
} else {
formRef.value.resetFields();
}
}
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 || isCopy.value) {
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 || isCopy.value) {
//false 新增
notification.success({
message: 'Tip',
description: isCopy.value ? '复制成功' : t('新增成功!'),
}); //提示消息
} else {
notification.success({
message: 'Tip',
description: t('修改成功!'),
}); //提示消息
}
closeModal();
formRef.value.resetFields();
emit('success');
}
} finally {
setModalProps({ confirmLoading: false });
}
}
function customClick(item) {
if (item.key == 'confirm') {
handleSubmit();
} else if (item.key == 'cancel' && props.formType !== 'normal') {
handleClose();
closeModal();
} else if (item.key == 'reset') {
formRef.value.resetFields();
} else {
executeCurFormEvent(item.event, state.formModel, true);
}
}
function handleClose() {
formRef.value.resetFields();
}
</script>
\ No newline at end of file
<template>
<div class="pt-4">
<SimpleForm
ref="systemFormRef"
:formProps="data.formDataProps"
:formModel="state.formModel"
:isWorkFlow="props.fromPage!=FromPageType.MENU"
:isCamelCase="true"
@model-change="handleChange"
/>
</div>
</template>
<script lang="ts" setup>
import { reactive, ref, onMounted, nextTick, watch } from 'vue';
import { formProps, formEventConfigs } from './config';
import SimpleForm from '/@/components/SimpleForm/src/SimpleForm.vue';
import { addMesQualityUnqualified, getMesQualityUnqualified, updateMesQualityUnqualified } from '/@/api/zlgl/bhgpcl';
import { cloneDeep, isString } from 'lodash-es';
import { FormDataProps } from '/@/components/Designer/src/types';
import { usePermission } from '/@/hooks/web/usePermission';
import CustomButtonModal from '/@/components/Form/src/components/CustomButtonModal.vue';
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 RowKey = 'id';
const emits = defineEmits(['changeUploadComponentIds','loadingCompleted', 'update:value']);
const props = defineProps({
fromPage: {
type: Number,
default: FromPageType.MENU,
},
});
const systemFormRef = ref();
const data: { formDataProps: FormDataProps } = reactive({
formDataProps: cloneDeep(formProps),
});
const state = reactive({
formModel: {},
formInfo:{formId:'',formName:''}
});
const { currentRoute } = useRouter();
watch(
() => state.formModel,
(val) => {
emits('update:value', val);
},
{
deep: true,
},
);
onMounted(async () => {
try {
if (props.fromPage == FromPageType.MENU) {
setMenuPermission();
if(currentRoute.value.meta){
state.formInfo.formName = currentRoute.value.meta.title&&isString(currentRoute.value.meta.title)?currentRoute.value.meta.title:'';
state.formInfo.formId = currentRoute.value.meta.formId&&isString(currentRoute.value.meta.formId)?currentRoute.value.meta.formId:'';
}
await createFormEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:初始化表单
await nextTick();
await loadFormEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:加载表单
} 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(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:初始化表单
await loadFormEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:加载表单
}
} catch (error) {}
});
// 根据菜单页面权限,设置表单属性(必填,禁用,显示)
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) {
try {
const record = await getMesQualityUnqualified(rowId);
setFieldsValue(record);
state.formModel = record;
await getFormDataEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:获取表单数据
} catch (error) {
}
}
// 辅助返回表单数据
async function getFieldsValue() {
let values = [];
try {
values = await systemFormRef.value?.getFieldsValue();
//添加隐藏组件
if (data.formDataProps.hiddenComponent?.length) {
data.formDataProps.hiddenComponent.forEach((component) => {
values[component.bindField] = component.value;
});
}
} finally {
}
return values;
}
// 辅助设置表单数据
function setFieldsValue(record) {
systemFormRef.value.setFieldsValue(record);
}
// 重置表单数据
async function resetFields() {
await systemFormRef.value.resetFields();
}
// 设置表单数据全部为Disabled 【查看】
async function setDisabledForm( ) {
data.formDataProps.schemas = changeSchemaDisabled(cloneDeep(data.formDataProps.schemas));
}
// 获取行键值
function getRowKey() {
return RowKey;
}
// 更新api表单数据
async function update({ values, rowId }) {
try {
values[RowKey] = rowId;
state.formModel = values;
let saveVal = await updateMesQualityUnqualified(values);
await submitFormEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:提交表单
return saveVal;
} catch (error) {}
}
// 新增api表单数据
async function add(values) {
try {
state.formModel = values;
let saveVal = await addMesQualityUnqualified(values);
await submitFormEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:提交表单
return saveVal;
} catch (error) {}
}
// 根据工作流页面权限,设置表单属性(必填,禁用,显示)
async function setWorkFlowForm(obj: WorkFlowFormParams) {
try {
if (obj.formId) state.formInfo.formId = obj.formId;
if (obj.formName) state.formInfo.formName = obj.formName;
let flowData = await changeWorkFlowForm(cloneDeep(formProps), obj);
let { buildOptionJson, uploadComponentIds, formModels, isViewProcess } = flowData;
data.formDataProps = buildOptionJson;
emits('changeUploadComponentIds', uploadComponentIds); //工作流中必须保存上传组件id【附件汇总需要】
if (isViewProcess) {
setDisabledForm(); //查看
}
state.formModel = formModels;
setFieldsValue(formModels);
} catch (error) {}
await createFormEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:初始化表单
await loadFormEvent(formEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:加载表单
}
function handleChange(val) {
emits('update:value', val);
}
async function sendMessageForAllIframe() {
try {
if (systemFormRef.value && systemFormRef.value.sendMessageForAllIframe) {
systemFormRef.value.sendMessageForAllIframe();
}
} catch (error) {}
}
defineExpose({
setFieldsValue,
resetFields,
validate,
add,
update,
setFormDataFromId,
setDisabledForm,
setMenuPermission,
setWorkFlowForm,
getRowKey,
getFieldsValue,
sendMessageForAllIframe
});
</script>
\ No newline at end of file
import { FormProps, FormSchema } from '/@/components/Form';
import { BasicColumn } from '/@/components/Table';
export const searchFormSchema: FormSchema[] = [
{
field: 'djrq',
label: '单据日期',
defaultValue: undefined,
component: 'RangePicker',
componentProps: {
format: 'YYYY-MM-DD HH:mm:ss',
style: { width: '100%' },
getPopupContainer: () => document.body,
},
},
{
field: 'clr',
label: '处理人',
defaultValue: undefined,
component: 'User',
componentProps: {
suffix: 'ant-design:setting-outlined',
placeholder: '请选择',
},
},
{
field: 'sszz',
label: '所属组织',
defaultValue: undefined,
component: 'Dept',
componentProps: {
placeholder: '请选择',
getPopupContainer: () => document.body,
},
},
];
export const columns: BasicColumn[] = [
{
resizable: true,
dataIndex: 'djbh',
title: '单据编号',
componentType: 'input',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: '',
},
{
resizable: true,
dataIndex: 'djrq',
title: '单据日期',
componentType: 'date',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: undefined,
},
{
resizable: true,
dataIndex: 'clr',
title: '处理人',
componentType: 'user',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: undefined,
},
{
resizable: true,
dataIndex: 'modifyDate',
title: '处理日期',
componentType: 'date',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: undefined,
},
{
resizable: true,
dataIndex: 'createDate',
title: '创建日期',
componentType: 'date',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: undefined,
},
{
resizable: true,
dataIndex: 'sszz',
title: '所属组织',
componentType: 'organization',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: undefined,
},
];
//表头合并配置
export const headerMergingData = [];
//表单事件
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: '43514ab9ca2849e0a15b47508a26affb',
field: '',
label: '',
type: 'grid',
colProps: { span: 24 },
component: 'Grid',
children: [
{
span: 8,
list: [
{
key: '8a0b1b090265471babfd8fb5068a3781',
field: 'djbh',
label: '单据编号',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: 4,
defaultValue: '',
placeholder: '请输入单据编号单据编号',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: true,
rules: [],
events: {},
listStyle: '',
isSave: false,
isShow: true,
scan: false,
bordered: true,
isShowAi: false,
tooltipConfig: { visible: false, title: '提示文本' },
style: { width: '100%' },
},
},
],
},
{
span: 8,
list: [
{
key: '13c73d2d8d71455cb0be06371bbdaddd',
field: 'djrq',
label: '单据日期',
type: 'date',
component: 'DatePicker',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
span: 4,
defaultValue: '',
width: '100%',
placeholder: '请选择单据日期',
format: 'YYYY-MM-DD HH:mm:ss',
showLabel: true,
allowClear: true,
disabled: false,
required: false,
isShow: true,
rules: [],
events: {},
isGetCurrent: false,
tooltipConfig: { visible: false, title: '提示文本' },
searchType: 'time',
style: { width: '100%' },
},
},
],
},
{
span: 8,
list: [
{
key: 'de9efe3a5f734b6bb6ede5fc6e5c23c9',
field: 'clr',
label: '处理人',
type: 'user',
component: 'User',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
span: 4,
width: '100%',
defaultValue: '',
placeholder: '请选择处理人',
userType: 0,
prefix: '',
suffix: 'ant-design:usergroup-add-outlined',
showLabel: true,
disabled: false,
required: true,
multiple: true,
isShow: true,
events: {},
tooltipConfig: { visible: false, title: '提示文本' },
style: { width: '100%' },
},
},
],
},
{
span: 8,
list: [
{
key: '226c633a8ed645c7874663c603ac68f5',
field: 'modifyDate',
label: '处理日期',
type: 'date',
component: 'DatePicker',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
span: 4,
defaultValue: '',
width: '100%',
placeholder: '请选择处理日期',
format: 'YYYY-MM-DD HH:mm:ss',
showLabel: true,
allowClear: true,
disabled: false,
required: false,
isShow: true,
rules: [],
events: {},
isGetCurrent: true,
tooltipConfig: { visible: false, title: '提示文本' },
searchType: 'time',
style: { width: '100%' },
},
},
],
},
{
span: 8,
list: [
{
key: '47e825566c424771bdb773c64173ea76',
field: 'createDate',
label: '创建日期',
type: 'date',
component: 'DatePicker',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
span: 4,
defaultValue: '',
width: '100%',
placeholder: '请选择创建日期',
format: 'YYYY-MM-DD HH:mm:ss',
showLabel: true,
allowClear: false,
disabled: true,
required: false,
isShow: true,
rules: [],
events: {},
isGetCurrent: true,
tooltipConfig: { visible: false, title: '提示文本' },
searchType: 'time',
style: { width: '100%' },
},
},
],
},
{
span: 8,
list: [
{
key: 'b961eae9a32b4e9e872950f1b178fbfb',
field: 'sszz',
label: '所属组织',
type: 'organization',
component: 'Dept',
colProps: { span: 24 },
componentProps: {
span: 4,
width: '100%',
orgzType: 0,
placeholder: '请选择所属组织',
isShowAllName: false,
showLabel: true,
disabled: false,
required: false,
isShow: true,
events: {},
tooltipConfig: { visible: false, title: '提示文本' },
style: { width: '100%' },
},
},
],
},
{
span: 24,
list: [
{
key: '61888c9b5fd64d41b09ae2b012949d81',
field: 'bz',
label: '备注',
type: 'textarea',
component: 'InputTextArea',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: 1,
defaultValue: '',
placeholder: '请输入备注',
maxlength: null,
rows: 4,
autoSize: false,
showCount: false,
disabled: false,
showLabel: true,
allowClear: false,
required: false,
isShow: true,
isShowAi: false,
rules: [],
events: {},
tooltipConfig: { visible: false, title: '提示文本' },
style: { width: '100%' },
},
},
],
},
],
componentProps: {
gutter: 16,
justify: 'start',
align: 'top',
isShow: true,
showBorder: false,
bordercolor: '#d9d9d9',
bordershowtype: [true, true, true, true],
borderwidth: 1,
padding: '10px',
margin: '10px',
},
},
{
key: '213924f5313b4d45a8b4f750d43153d7',
field: '',
label: '',
type: 'tab',
colProps: { span: 24 },
component: 'Tab',
children: [
{
span: 24,
name: '质检明细',
prefix: '',
suffix: '',
activeColor: '#1c8dff',
folderId: '',
imageUrl: '',
conFolderId: '',
conImageUrl: '',
list: [
{
key: '87cc5a35158547959a7b529ab5ff1eb1',
label: '',
field: 'mesQualityUnqualifiedRelaList',
type: 'form',
component: 'SubForm',
required: true,
colProps: { span: 24 },
componentProps: {
mainKey: 'mesQualityUnqualifiedRelaList',
columns: [
{
key: 'e613548f2de84a17b4bca54b2bfa5e5a',
title: '单据编号',
dataIndex: 'djbh',
componentType: 'Input',
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
placeholder: '请输入单据编号',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: true,
rules: [],
events: {},
listStyle: '',
isSave: false,
isShow: true,
scan: false,
bordered: true,
isShowAi: false,
tooltipConfig: { visible: false, title: '提示文本' },
},
},
{
key: '44de1157b89d42d5a26acd3e3e380e13',
title: '单据日期',
dataIndex: 'djrq',
componentType: 'DatePicker',
defaultValue: '',
componentProps: {
span: '',
defaultValue: '',
width: '100%',
placeholder: '请选择单据日期',
format: 'YYYY-MM-DD HH:mm:ss',
showLabel: true,
allowClear: true,
disabled: false,
required: false,
isShow: true,
rules: [],
events: {},
isGetCurrent: false,
tooltipConfig: { visible: false, title: '提示文本' },
searchType: 'time',
},
},
{
key: '80339f4ee04e4eb486b2bd02c5df14d6',
title: '物料编号',
dataIndex: 'wlbh',
componentType: 'Input',
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
placeholder: '请输入物料编号',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
listStyle: '',
isSave: false,
isShow: true,
scan: false,
bordered: true,
isShowAi: false,
tooltipConfig: { visible: false, title: '提示文本' },
},
},
{
key: '52bbeea35e75496094f2b4139bdd5a6f',
title: '物料名称',
dataIndex: 'wlmc',
componentType: 'Input',
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
placeholder: '请输入物料名称',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
listStyle: '',
isSave: false,
isShow: true,
scan: false,
bordered: true,
isShowAi: false,
tooltipConfig: { visible: false, title: '提示文本' },
},
},
{
key: 'cf4ba5d21db146128a1470633424e465',
title: '炉批号',
dataIndex: 'lph',
componentType: 'Input',
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
placeholder: '请输入炉批号',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
listStyle: '',
isSave: false,
isShow: true,
scan: false,
bordered: true,
isShowAi: false,
tooltipConfig: { visible: false, title: '提示文本' },
},
},
{
key: '61926e5bff6944578afe5ca68f45495a',
title: '检验标准',
dataIndex: 'jybz',
componentType: 'Input',
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
placeholder: '请输入检验标准',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
listStyle: '',
isSave: false,
isShow: true,
scan: false,
bordered: true,
isShowAi: false,
tooltipConfig: { visible: false, title: '提示文本' },
},
},
{
key: 'c231765d287d47c689fa1a979de36588',
title: '送检数量',
dataIndex: 'sjsl',
componentType: 'InputNumber',
defaultValue: 0,
componentProps: {
width: '100%',
span: '',
defaultValue: 0,
min: 0,
max: null,
step: 1,
maxlength: null,
disabled: false,
showLabel: true,
controls: true,
required: false,
subTotal: false,
isShow: true,
rules: [],
events: {},
tooltipConfig: { visible: false, title: '提示文本' },
listStyle: "return 'width:100%'",
},
},
{
key: '68691f5b06bb4c2cb6e3a14a4758100a',
title: '检查数量',
dataIndex: 'jcsl',
componentType: 'InputNumber',
defaultValue: 0,
componentProps: {
width: '100%',
span: '',
defaultValue: 0,
min: 0,
max: null,
step: 1,
maxlength: null,
disabled: false,
showLabel: true,
controls: true,
required: false,
subTotal: false,
isShow: true,
rules: [],
events: {},
tooltipConfig: { visible: false, title: '提示文本' },
listStyle: "return 'width:100%'",
},
},
{
key: '559986b7045641a48266913776aa0ac3',
title: '质检人',
dataIndex: 'zjr',
componentType: 'User',
defaultValue: '',
componentProps: {
span: '',
width: '100%',
defaultValue: '',
placeholder: '请选择质检人',
userType: 0,
prefix: '',
suffix: 'ant-design:user-outlined',
showLabel: true,
disabled: false,
required: false,
multiple: true,
isShow: true,
events: {},
tooltipConfig: { visible: false, title: '提示文本' },
},
},
{
key: '2b8bac1dae81498880e7df1f9df863b1',
title: '质检状态',
dataIndex: 'zjzt',
componentType: 'XjrSelect',
componentProps: {
width: '100%',
span: '',
placeholder: '请选择质检状态',
showLabel: true,
showSearch: false,
isMultiple: false,
clearable: false,
disabled: false,
staticOptions: [
{ key: 1, label: 'Option 1', value: 'Option 1' },
{ key: 2, label: 'Option 2', value: 'Option 2' },
{ key: 3, label: 'Option 3', value: 'Option 3' },
],
defaultSelect: null,
datasourceType: 'dic',
params: { itemId: '2010885273788829698' },
labelField: 'name',
valueField: 'value',
apiConfig: {
path: 'CodeGeneration/selection',
method: 'GET',
apiId: '93d735dcb7364a0f8102188ec4d77ac7',
},
dicOptions: [],
required: false,
rules: [],
events: {},
isShow: true,
tooltipConfig: { visible: false, title: '提示文本' },
itemId: '2010885273788829698',
listStyle: "return 'border: 0'",
},
},
{
key: '448db681d3b94fae8172be46e297b512',
title: '不合格数',
dataIndex: 'bhgs',
componentType: 'InputNumber',
defaultValue: 0,
componentProps: {
width: '100%',
span: '',
defaultValue: 0,
min: 0,
max: null,
step: 1,
maxlength: null,
disabled: false,
showLabel: true,
controls: true,
required: false,
subTotal: false,
isShow: true,
rules: [],
events: {},
tooltipConfig: { visible: false, title: '提示文本' },
listStyle: "return 'width:100%'",
},
},
{
key: 'd2bd69bdf1664619849c2752445622d1',
title: '不合格原因',
dataIndex: 'bhgyy',
componentType: 'Input',
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
placeholder: '请输入不合格原因',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
listStyle: '',
isSave: false,
isShow: true,
scan: false,
bordered: true,
isShowAi: false,
tooltipConfig: { visible: false, title: '提示文本' },
},
},
{
key: 'df7880cff284461885fa5a4afe31a43d',
title: '处理方式',
dataIndex: 'clfs',
componentType: 'Input',
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
placeholder: '请输入处理方式',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
listStyle: '',
isSave: false,
isShow: true,
scan: false,
bordered: true,
isShowAi: false,
tooltipConfig: { visible: false, title: '提示文本' },
},
},
{
key: '214a1a0deb4e41d1adeb348f67192f66',
title: '备注',
dataIndex: 'bz',
componentType: 'Input',
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
placeholder: '请输入备注',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
listStyle: '',
isSave: false,
isShow: true,
scan: false,
bordered: true,
isShowAi: false,
tooltipConfig: { visible: false, title: '提示文本' },
},
},
{ title: '操作', key: 'action', fixed: 'right', width: '50px' },
],
span: '24',
preloadType: 'api',
apiConfig: {},
itemId: '',
dicOptions: [],
useSelectButton: false,
buttonName: '选择数据',
showLabel: true,
showComponentBorder: true,
showBorder: false,
bordercolor: '#f0f0f0',
bordershowtype: [true, true, true, true],
borderwidth: 1,
showIndex: false,
isShow: true,
multipleHeads: [],
buttonList: [],
topButtonList: [],
isExport: false,
isImport: false,
isDeleteSelected: false,
isListView: true,
viewList: [
{
key: 'e613548f2de84a17b4bca54b2bfa5e5a',
label: '单据编号',
field: 'djbh',
componentType: 'input',
checked: false,
},
{
key: '44de1157b89d42d5a26acd3e3e380e13',
label: '单据日期',
field: 'djrq',
componentType: 'date',
checked: false,
},
{
key: '80339f4ee04e4eb486b2bd02c5df14d6',
label: '物料编号',
field: 'wlbh',
componentType: 'input',
checked: false,
},
{
key: '52bbeea35e75496094f2b4139bdd5a6f',
label: '物料名称',
field: 'wlmc',
componentType: 'input',
checked: true,
},
{
key: 'cf4ba5d21db146128a1470633424e465',
label: '炉批号',
field: 'lph',
componentType: 'input',
checked: true,
},
{
key: '61926e5bff6944578afe5ca68f45495a',
label: '检验标准',
field: 'jybz',
componentType: 'input',
checked: false,
},
{
key: 'c231765d287d47c689fa1a979de36588',
label: '送检数量',
field: 'sjsl',
componentType: 'number',
checked: true,
},
{
key: '68691f5b06bb4c2cb6e3a14a4758100a',
label: '检查数量',
field: 'jcsl',
componentType: 'number',
checked: true,
},
{
key: '559986b7045641a48266913776aa0ac3',
label: '质检人',
field: 'zjr',
componentType: 'user',
checked: false,
},
{
key: '2b8bac1dae81498880e7df1f9df863b1',
label: '质检状态',
field: 'zjzt',
componentType: 'select',
checked: true,
},
{
key: '448db681d3b94fae8172be46e297b512',
label: '不合格数',
field: 'bhgs',
componentType: 'number',
checked: true,
},
{
key: 'd2bd69bdf1664619849c2752445622d1',
label: '不合格原因',
field: 'bhgyy',
componentType: 'input',
checked: false,
},
{
key: 'df7880cff284461885fa5a4afe31a43d',
label: '处理方式',
field: 'clfs',
componentType: 'input',
checked: false,
},
{
key: '214a1a0deb4e41d1adeb348f67192f66',
label: '备注',
field: 'bz',
componentType: 'input',
checked: false,
},
],
isShowAdd: false,
isShowDelete: true,
hasCheckedCol: false,
events: {},
showPagenation: true,
},
},
],
},
],
componentProps: { tabPosition: 'top', size: 'default', type: 'card', isShow: true },
},
],
showActionButtonGroup: false,
buttonLocation: 'center',
actionColOptions: { span: 24 },
showResetButton: false,
showSubmitButton: false,
hiddenComponent: [],
};
export const formButtons = [
{
key: 'confirm',
code: 'confirm',
name: '确定',
style: 'primary',
event: [],
isShow: true,
index: 2,
type: 1,
modal: null,
},
{
key: 'cancel',
code: 'cancel',
name: '取消',
style: 'default',
event: [],
isShow: true,
index: 1,
type: 1,
modal: null,
},
{
key: 'reset',
code: 'reset',
name: '重置',
style: 'default',
event: [],
isShow: true,
index: 0,
type: 1,
modal: null,
},
];
export const permissionList = [
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '单据编号',
fieldId: 'djbh',
isSubTable: false,
showChildren: true,
type: 'input',
key: '8a0b1b090265471babfd8fb5068a3781',
children: [],
options: {},
defaultValue: '',
},
{
required: false,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '单据日期',
fieldId: 'djrq',
isSubTable: false,
showChildren: true,
type: 'date',
key: '13c73d2d8d71455cb0be06371bbdaddd',
children: [],
options: {},
defaultValue: '',
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '处理人',
fieldId: 'clr',
isSubTable: false,
showChildren: true,
type: 'user',
key: 'de9efe3a5f734b6bb6ede5fc6e5c23c9',
children: [],
options: {},
defaultValue: '',
},
{
required: false,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '处理日期',
fieldId: 'modifyDate',
isSubTable: false,
showChildren: true,
type: 'date',
key: '226c633a8ed645c7874663c603ac68f5',
children: [],
options: {},
defaultValue: '',
},
{
required: false,
view: true,
edit: false,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '创建日期',
fieldId: 'createDate',
isSubTable: false,
showChildren: true,
type: 'date',
key: '47e825566c424771bdb773c64173ea76',
children: [],
options: {},
defaultValue: '',
},
{
required: false,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '所属组织',
fieldId: 'sszz',
isSubTable: false,
showChildren: true,
type: 'organization',
key: 'b961eae9a32b4e9e872950f1b178fbfb',
children: [],
options: {},
},
{
required: false,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '备注',
fieldId: 'bz',
isSubTable: false,
showChildren: true,
type: 'textarea',
key: '61888c9b5fd64d41b09ae2b012949d81',
children: [],
options: {},
defaultValue: '',
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: true,
showChildren: false,
tableName: 'mesQualityUnqualifiedRelaList',
fieldName: '',
fieldId: 'mesQualityUnqualifiedRelaList',
type: 'form',
key: '87cc5a35158547959a7b529ab5ff1eb1',
children: [
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: false,
isSaveTable: false,
showChildren: false,
tableName: 'mesQualityUnqualifiedRelaList',
fieldName: '单据编号',
fieldId: 'djbh',
type: 'Input',
key: 'e613548f2de84a17b4bca54b2bfa5e5a',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: false,
isSaveTable: false,
showChildren: false,
tableName: 'mesQualityUnqualifiedRelaList',
fieldName: '单据日期',
fieldId: 'djrq',
type: 'DatePicker',
key: '44de1157b89d42d5a26acd3e3e380e13',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: false,
isSaveTable: false,
showChildren: false,
tableName: 'mesQualityUnqualifiedRelaList',
fieldName: '物料编号',
fieldId: 'wlbh',
type: 'Input',
key: '80339f4ee04e4eb486b2bd02c5df14d6',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: false,
isSaveTable: false,
showChildren: false,
tableName: 'mesQualityUnqualifiedRelaList',
fieldName: '物料名称',
fieldId: 'wlmc',
type: 'Input',
key: '52bbeea35e75496094f2b4139bdd5a6f',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: false,
isSaveTable: false,
showChildren: false,
tableName: 'mesQualityUnqualifiedRelaList',
fieldName: '炉批号',
fieldId: 'lph',
type: 'Input',
key: 'cf4ba5d21db146128a1470633424e465',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: false,
isSaveTable: false,
showChildren: false,
tableName: 'mesQualityUnqualifiedRelaList',
fieldName: '检验标准',
fieldId: 'jybz',
type: 'Input',
key: '61926e5bff6944578afe5ca68f45495a',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: false,
isSaveTable: false,
showChildren: false,
tableName: 'mesQualityUnqualifiedRelaList',
fieldName: '送检数量',
fieldId: 'sjsl',
type: 'InputNumber',
key: 'c231765d287d47c689fa1a979de36588',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: false,
isSaveTable: false,
showChildren: false,
tableName: 'mesQualityUnqualifiedRelaList',
fieldName: '检查数量',
fieldId: 'jcsl',
type: 'InputNumber',
key: '68691f5b06bb4c2cb6e3a14a4758100a',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: false,
isSaveTable: false,
showChildren: false,
tableName: 'mesQualityUnqualifiedRelaList',
fieldName: '质检人',
fieldId: 'zjr',
type: 'User',
key: '559986b7045641a48266913776aa0ac3',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: false,
isSaveTable: false,
showChildren: false,
tableName: 'mesQualityUnqualifiedRelaList',
fieldName: '质检状态',
fieldId: 'zjzt',
type: 'XjrSelect',
key: '2b8bac1dae81498880e7df1f9df863b1',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: false,
isSaveTable: false,
showChildren: false,
tableName: 'mesQualityUnqualifiedRelaList',
fieldName: '不合格数',
fieldId: 'bhgs',
type: 'InputNumber',
key: '448db681d3b94fae8172be46e297b512',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: false,
isSaveTable: false,
showChildren: false,
tableName: 'mesQualityUnqualifiedRelaList',
fieldName: '不合格原因',
fieldId: 'bhgyy',
type: 'Input',
key: 'd2bd69bdf1664619849c2752445622d1',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: false,
isSaveTable: false,
showChildren: false,
tableName: 'mesQualityUnqualifiedRelaList',
fieldName: '处理方式',
fieldId: 'clfs',
type: 'Input',
key: 'df7880cff284461885fa5a4afe31a43d',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSubTable: false,
isSaveTable: false,
showChildren: false,
tableName: 'mesQualityUnqualifiedRelaList',
fieldName: '备注',
fieldId: 'bz',
type: 'Input',
key: '214a1a0deb4e41d1adeb348f67192f66',
children: [],
},
],
},
];
<template>
<ResizePageWrapper :hasLeft="false">
<template #resizeRight>
<BasicTable @register="registerTable" isMenuTable ref="tableRef" @expand="expandedRowsChange"
>
<template #toolbar>
<template v-for="button in tableButtonConfig" :key="button.code">
<a-button v-if="button.isDefault" type="primary" @click="buttonClick(button.code)">
<template #icon><Icon :icon="button.icon" /></template>
{{ button.name }}
</a-button>
<CustomButtonModal v-else-if="button.buttonType == 'modal'" :info="button" />
<a-button v-else :type="button.buttonType === 'danger' ? 'default' : button.buttonType || 'primary'" :danger="button.buttonType === 'danger'" >
<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="getLessActions(record)"
:dropDownActions="getMoreActions(record)"
/>
</template>
<template v-else-if="column.dataIndex && column?.listStyle">
<span :style="executeListStyle(getValue(record, column, 'style'), column?.listStyle)">{{
getValue(record, column, 'value')
}}</span>
</template>
</template>
<template #expandedRowRender="{ record }">
<a-table
v-for="item in subFormList"
:key="item.key"
:columns="innerColumns[item.field]"
:data-source="getInnerDataSource(record.id, item.field)"
:pagination="false"
:scroll="{ x: 'max-content' }"
>
<template #bodyCell="{ column, record: innerRecord }">
<template v-if="column.componentType === 'picker-color'">
<ColorPicker v-model:value="innerRecord[column.dataIndex]" :disabled="true" />
</template>
<template v-else-if="column.componentType === 'labelComponent'">
<XjrLabelComponentInfo
:value="innerRecord[column.dataIndex]"
:styleConfig="column.styleConfig"
/>
</template>
<template v-else-if="column.componentType === 'money-chinese'">
{{ moneyChineseData(innerRecord[column.dataIndex]) }}
</template>
</template>
</a-table>
</template>
</BasicTable>
</template>
<BhgpclModal @register="registerModal" @success="handleFormSuccess" @cancel="handleFormCancel"/>
<ExportModal
v-if="visibleExport"
@close="visibleExport = false"
:columns="columns"
@success="handleExportSuccess"
/>
</ResizePageWrapper>
</template>
<script lang="ts" setup>
import { ref, computed,provide,Ref, onMounted,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 { getMesQualityUnqualifiedPage, deleteMesQualityUnqualified, exportMesQualityUnqualified, getChildrenMesQualityUnqualified} from '/@/api/zlgl/bhgpcl';
import { ResizePageWrapper } from '/@/components/Page';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { usePermission } from '/@/hooks/web/usePermission';
import CustomButtonModal from '/@/components/Form/src/components/CustomButtonModal.vue';
import { executeListStyle, getValue } from '/@/hooks/web/useListStyle';//列表样式配置
import { useRouter } from 'vue-router';
import { useModal } from '/@/components/Modal';
import BhgpclModal from './components/BhgpclModal.vue';
import { downloadByData } from '/@/utils/file/download';
import ExportModal from '/@/views/form/template/components/ExportModal.vue';
import { ColorPicker } from '/@/components/ColorPicker';
import { XjrLabelComponentInfo } from '/@/components/LabelComponent';
import { searchFormSchema, columns , formProps } from './components/config';
import Icon from '/@/components/Icon/index';
import { moneyChineseData,camelCaseString, } from '/@/utils/event/design';
import { FormSchema } from '/@/components/Form/src/types/form';
const listSpliceNum = ref(3); //操作列最先展示几个
import { useConcurrentLock } from '/@/hooks/web/useConcurrentLock';
const pageParamsInfo = ref<any>({});
const { enableLockeData,handleOpenFormEnableLockeData, handleCloseFormEnableLocke, handleHasEnableLocke } =
useConcurrentLock();
const { notification } = useMessage();
const { t } = useI18n();
defineEmits(['register']);
const { filterColumnAuth, filterButtonAuth, hasPermission } = usePermission();
const filterColumns = filterColumnAuth(columns);
const tableRef = ref();
const innerColumns = ref({});
const innerDataSource = ref({});
const subFormList = ref<any[]>([]);
const visibleExport = ref(false);
//展示在列表内的按钮
const actionButtons = ref<string[]>(["view","edit","delete"]);
const buttonConfigs = computed(()=>{
const list = [{"isUse":true,"name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true},{"isUse":true,"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true},{"isUse":true,"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true,"isEnableLock":true},{"isUse":true,"name":"快速导出","code":"export","icon":"ant-design:export-outlined","isDefault":true},{"isUse":true,"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true}]
return filterButtonAuth(list);
})
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 = {view : handleView,add : handleAdd,edit : handleEdit,export : handleExport,delete : handleDelete,}
const { currentRoute } = useRouter();
const formIdComputedRef = computed(() => currentRoute.value.meta.formId as string);
provide<Ref<string>>('currentFormId', formIdComputedRef);
const [registerModal, { openModal }] = useModal();
const [registerTable, { reload, }] = useTable({
title: 'Bhgpcl列表',
api: getMesQualityUnqualifiedPage,
rowKey: 'id',
columns: filterColumns,
pagination: {
pageSize: 10,
},
formConfig: {
labelWidth: 100,
schemas: searchFormSchema,
fieldMapToTime: [['djrq', ['djrqStart', 'djrqEnd'], 'YYYY-MM-DD HH:mm:ss ', true],],
showResetButton: false,
},
bordered:false,
beforeFetch: (params) => {
pageParamsInfo.value = {...params, FormId: formIdComputedRef.value,PK: 'id' }
return pageParamsInfo.value;
},
afterFetch: (res) => {
},
useSearchForm: true,
showTableSetting: true,
striped: false,
actionColumn: {
width: 195,
title: '操作',
dataIndex: 'action',
slots: { customRender: 'action' },
},
tableSetting: {
size: false,
},
customRow,
isAdvancedQuery: false,
querySelectOption: JSON.stringify(searchFormSchema),
objectId: formIdComputedRef.value, ////系统表单formId,自定义表单releaseId的id值
});
const getSubFormList = (list) => {
list?.map((item) => {
if (['tab', 'grid', 'card'].includes(item.type)) {
for (const child of item.children!) {
getSubFormList(child.list);
}
} else if (item.type == 'table-layout') {
for (const child of item.children!) {
for (const sub of child.list) {
getSubFormList(sub.children);
}
}
} else if (item.type === 'form') {
if (item.componentProps.isListView) {
subFormList.value.push(item);
innerColumns.value[item.field] = (item.componentProps! as FormSchema)
.viewList!.filter((sub) => sub.checked)
.map((sub) => {
return {
title: sub.label,
dataIndex: camelCaseString(sub.field),
componentType: sub.componentType,
};
});
}
}
});
};
onMounted(() => {
getSubFormList(formProps.schemas);
});
function buttonClick(code) {
btnEvent[code]();
}
function handleAdd() {
openModal(true, { isUpdate: false, });
}
async function handleEdit(record: Recordable) {
let field = 'id';
try {
let hasIn = handleHasEnableLocke(buttonConfigs.value, 'edit');
if (hasIn) {
let res = await handleOpenFormEnableLockeData(
record[field],
formIdComputedRef.value,
);
if (res !== null) {
return;
}
}
let info = {
id: record[field],
isUpdate: true,
};
openModal(true, info);
} catch (error) {}
}
function handleDelete(record: Recordable) {
deleteList([record.id]);
}
function deleteList(ids) {
Modal.confirm({
title: '提示信息',
icon: createVNode(ExclamationCircleOutlined),
content: '是否确认删除?',
okText: '确认',
cancelText: '取消',
onOk() {
deleteMesQualityUnqualified(ids).then((_) => {
handleSuccess();
notification.success({
message: 'Tip',
description: t('删除成功!'),
});
});
},
onCancel() {},
});
}
function customRow(record: Recordable) {
return {
ondblclick: () => {
if (record.isCanEdit && hasPermission("bhgpcl:edit")) {
handleEdit(record);
}
},
};
}
function handleSuccess() {
reload();
}
function handleFormSuccess() {
handleSuccess();
handleCloseFormEnableLocke(buttonConfigs.value, 'edit');
}
function handleFormCancel() {
handleCloseFormEnableLocke(buttonConfigs.value, 'edit');
}
function handleView(record: Recordable) {
let info={
isView: true,
id: record.id,
}
openModal(true, info);
}
async function handleExport() {
visibleExport.value = true;
}
async function handleExportSuccess(cols) {
const res = await exportMesQualityUnqualified({ isTemplate: false, columns: cols.toString(), ...pageParamsInfo.value});
visibleExport.value = false;
downloadByData(
res.data,
'Bhgpcl.xlsx',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
);
reload();
}
function getLessActions(record: Recordable) {
let list = getActions(record);
return list.slice(0, listSpliceNum.value);
}
function getMoreActions(record: Recordable) {
let list = getActions(record);
return list.slice(listSpliceNum.value);
}
function getActions(record: Recordable):ActionItem[] {
record.isCanEdit = false;
let actionsList: ActionItem[] = [];
actionButtonConfig.value?.map((button) => {
if (!record?.workflowData?.processId) {
record.isCanEdit = true;
actionsList.push({
...button,
auth: `bhgpcl:${button.code}`,
label: button?.name,
color: button.code === 'delete' ? 'error' : undefined,
onClick: btnEvent[button.code]?.bind(null, record),
});
} else {
if (!['edit', 'delete'].includes(button.code)) {
actionsList.push({
auth: `bhgpcl:${button.code}`,
label: button?.name,
onClick: btnEvent[button.code]?.bind(null, record),
});
}
}
});
return actionsList;
}
function getInnerDataSource(id, field) {
if (innerDataSource.value[id]) {
return innerDataSource.value[id][field];
}
return [];
}
async function expandedRowsChange(isOpen, record) {
if (!isOpen) return;
const tableInfo = await getChildrenMesQualityUnqualified({
id: record.id,
});
innerDataSource.value[record.id] = tableInfo;
}
</script>
<style lang="less" scoped>
:deep(.ant-table-selection-col) {
width: 50px;
}
.show{
display: flex;
}
.hide{
display: none !important;
}
:deep(.ant-table-expanded-row) {
.ant-table {
margin: 0 !important;
height: 100%;
.ant-table-thead {
height: 40px;
}
.ant-empty-normal {
margin: 16px 0;
}
}
.ant-table-wrapper {
height: 200px;
}
}
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment