Commit 02d778ab by sunguoxiang

feat(zlgl):生产部门样品委托单、成品不合格处理流程单、出厂产品放行审批单

parent 9765a358
import { MesQualityInspectionLeaveFactoryWorkflowPageModel, MesQualityInspectionLeaveFactoryWorkflowPageParams, MesQualityInspectionLeaveFactoryWorkflowPageResult } from './model/CccpfxspdModel';
import { defHttp } from '/@/utils/http/axios';
import { ErrorMessageMode } from '/#/axios';
enum Api {
Page = '/zlgl/cccpfxspd/page',
List = '/zlgl/cccpfxspd/list',
Info = '/zlgl/cccpfxspd/info',
MesQualityInspectionLeaveFactoryWorkflow = '/zlgl/cccpfxspd',
}
/**
* @description: 查询MesQualityInspectionLeaveFactoryWorkflow分页列表
*/
export async function getMesQualityInspectionLeaveFactoryWorkflowPage(params: MesQualityInspectionLeaveFactoryWorkflowPageParams, mode: ErrorMessageMode = 'modal') {
return defHttp.get<MesQualityInspectionLeaveFactoryWorkflowPageResult>(
{
url: Api.Page,
params,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 获取MesQualityInspectionLeaveFactoryWorkflow信息
*/
export async function getMesQualityInspectionLeaveFactoryWorkflow(id: String, mode: ErrorMessageMode = 'modal') {
return defHttp.get<MesQualityInspectionLeaveFactoryWorkflowPageModel>(
{
url: Api.Info,
params: { id },
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 新增MesQualityInspectionLeaveFactoryWorkflow
*/
export async function addMesQualityInspectionLeaveFactoryWorkflow(mesQualityInspectionLeaveFactoryWorkflow: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.post<boolean>(
{
url: Api.MesQualityInspectionLeaveFactoryWorkflow,
params: mesQualityInspectionLeaveFactoryWorkflow,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 更新MesQualityInspectionLeaveFactoryWorkflow
*/
export async function updateMesQualityInspectionLeaveFactoryWorkflow(mesQualityInspectionLeaveFactoryWorkflow: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.put<boolean>(
{
url: Api.MesQualityInspectionLeaveFactoryWorkflow,
params: mesQualityInspectionLeaveFactoryWorkflow,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 删除MesQualityInspectionLeaveFactoryWorkflow(批量删除)
*/
export async function deleteMesQualityInspectionLeaveFactoryWorkflow(ids: string[], mode: ErrorMessageMode = 'modal') {
return defHttp.delete<boolean>(
{
url: Api.MesQualityInspectionLeaveFactoryWorkflow,
data: ids,
},
{
errorMessageMode: mode,
},
);
}
import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
/**
* @description: MesQualityInspectionLeaveFactoryWorkflow分页参数 模型
*/
export interface MesQualityInspectionLeaveFactoryWorkflowPageParams extends BasicPageParams {
jyrq: string;
hjph: string;
lch: string;
jyy: string;
gkmc: string;
cpms: string;
gkyj: string;
}
/**
* @description: MesQualityInspectionLeaveFactoryWorkflow分页返回值模型
*/
export interface MesQualityInspectionLeaveFactoryWorkflowPageModel {
id: string;
jyrq: string;
hjph: string;
lch: string;
jyy: string;
gkmc: string;
cpms: string;
gkyj: string;
}
/**
* @description: MesQualityInspectionLeaveFactoryWorkflow表类型
*/
export interface MesQualityInspectionLeaveFactoryWorkflowModel {
id: string;
deleteMark: string;
gkyj: string;
images: string;
cpms: string;
gkmc: string;
jyy: string;
lch: string;
hjph: string;
jyrq: string;
createDate: string;
createUserId: string;
modifyDate: string;
modifyUserId: string;
}
/**
* @description: MesQualityInspectionLeaveFactoryWorkflow分页返回值结构
*/
export type MesQualityInspectionLeaveFactoryWorkflowPageResult =
BasicFetchResult<MesQualityInspectionLeaveFactoryWorkflowPageModel>;
import { MesQualityUnqualifiedWorkflowPageModel, MesQualityUnqualifiedWorkflowPageParams, MesQualityUnqualifiedWorkflowPageResult } from './model/CpbhgcllcdModel';
import { defHttp } from '/@/utils/http/axios';
import { ErrorMessageMode } from '/#/axios';
enum Api {
Page = '/zlgl/cpbhgcllcd/page',
List = '/zlgl/cpbhgcllcd/list',
Info = '/zlgl/cpbhgcllcd/info',
MesQualityUnqualifiedWorkflow = '/zlgl/cpbhgcllcd',
}
/**
* @description: 查询MesQualityUnqualifiedWorkflow分页列表
*/
export async function getMesQualityUnqualifiedWorkflowPage(params: MesQualityUnqualifiedWorkflowPageParams, mode: ErrorMessageMode = 'modal') {
return defHttp.get<MesQualityUnqualifiedWorkflowPageResult>(
{
url: Api.Page,
params,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 获取MesQualityUnqualifiedWorkflow信息
*/
export async function getMesQualityUnqualifiedWorkflow(id: String, mode: ErrorMessageMode = 'modal') {
return defHttp.get<MesQualityUnqualifiedWorkflowPageModel>(
{
url: Api.Info,
params: { id },
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 新增MesQualityUnqualifiedWorkflow
*/
export async function addMesQualityUnqualifiedWorkflow(mesQualityUnqualifiedWorkflow: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.post<boolean>(
{
url: Api.MesQualityUnqualifiedWorkflow,
params: mesQualityUnqualifiedWorkflow,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 更新MesQualityUnqualifiedWorkflow
*/
export async function updateMesQualityUnqualifiedWorkflow(mesQualityUnqualifiedWorkflow: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.put<boolean>(
{
url: Api.MesQualityUnqualifiedWorkflow,
params: mesQualityUnqualifiedWorkflow,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 删除MesQualityUnqualifiedWorkflow(批量删除)
*/
export async function deleteMesQualityUnqualifiedWorkflow(ids: string[], mode: ErrorMessageMode = 'modal') {
return defHttp.delete<boolean>(
{
url: Api.MesQualityUnqualifiedWorkflow,
data: ids,
},
{
errorMessageMode: mode,
},
);
}
import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
/**
* @description: MesQualityUnqualifiedWorkflow分页参数 模型
*/
export interface MesQualityUnqualifiedWorkflowPageParams extends BasicPageParams {
bhgid: string;
jyrq: string;
hjph: string;
lch: string;
jyy: string;
gkmc: string;
qxmc: string;
qxms: string;
qxmssfss: string;
jzyfcsyz1: string;
jzcsyz2: string;
jzcsssyxxyz: string;
jzyfcs: string;
gbyyfx: string;
}
/**
* @description: MesQualityUnqualifiedWorkflow分页返回值模型
*/
export interface MesQualityUnqualifiedWorkflowPageModel {
id: string;
bhgid: string;
jyrq: string;
hjph: string;
lch: string;
jyy: string;
gkmc: string;
qxmc: string;
qxms: string;
qxmssfss: string;
jzyfcsyz1: string;
jzcsyz2: string;
jzcsssyxxyz: string;
jzyfcs: string;
gbyyfx: string;
}
/**
* @description: MesQualityUnqualifiedWorkflow表类型
*/
export interface MesQualityUnqualifiedWorkflowModel {
id: string;
deleteMark: string;
bhgid: string;
jzcsssyxxyz: string;
jzyfcs: string;
gbyyfx: string;
spr: string;
jzcsyz2: string;
jzyfcsyz1: string;
qxmssfss: string;
images: string;
qxms: string;
qxmc: string;
gkmc: string;
jyy: string;
lch: string;
hjph: string;
jyrq: string;
createDate: string;
createUserId: string;
modifyDate: string;
modifyUserId: string;
}
/**
* @description: MesQualityUnqualifiedWorkflow分页返回值结构
*/
export type MesQualityUnqualifiedWorkflowPageResult =
BasicFetchResult<MesQualityUnqualifiedWorkflowPageModel>;
import { MesQualityInspectionOtherWorkflowPageModel, MesQualityInspectionOtherWorkflowPageParams, MesQualityInspectionOtherWorkflowPageResult } from './model/ScbmypwtdModel';
import { defHttp } from '/@/utils/http/axios';
import { ErrorMessageMode } from '/#/axios';
enum Api {
Page = '/zlgl/scbmypwtd/page',
List = '/zlgl/scbmypwtd/list',
Info = '/zlgl/scbmypwtd/info',
MesQualityInspectionOtherWorkflow = '/zlgl/scbmypwtd',
}
/**
* @description: 查询MesQualityInspectionOtherWorkflow分页列表
*/
export async function getMesQualityInspectionOtherWorkflowPage(params: MesQualityInspectionOtherWorkflowPageParams, mode: ErrorMessageMode = 'modal') {
return defHttp.get<MesQualityInspectionOtherWorkflowPageResult>(
{
url: Api.Page,
params,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 获取MesQualityInspectionOtherWorkflow信息
*/
export async function getMesQualityInspectionOtherWorkflow(id: String, mode: ErrorMessageMode = 'modal') {
return defHttp.get<MesQualityInspectionOtherWorkflowPageModel>(
{
url: Api.Info,
params: { id },
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 新增MesQualityInspectionOtherWorkflow
*/
export async function addMesQualityInspectionOtherWorkflow(mesQualityInspectionOtherWorkflow: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.post<boolean>(
{
url: Api.MesQualityInspectionOtherWorkflow,
params: mesQualityInspectionOtherWorkflow,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 更新MesQualityInspectionOtherWorkflow
*/
export async function updateMesQualityInspectionOtherWorkflow(mesQualityInspectionOtherWorkflow: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.put<boolean>(
{
url: Api.MesQualityInspectionOtherWorkflow,
params: mesQualityInspectionOtherWorkflow,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 删除MesQualityInspectionOtherWorkflow(批量删除)
*/
export async function deleteMesQualityInspectionOtherWorkflow(ids: string[], mode: ErrorMessageMode = 'modal') {
return defHttp.delete<boolean>(
{
url: Api.MesQualityInspectionOtherWorkflow,
data: ids,
},
{
errorMessageMode: mode,
},
);
}
import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
/**
* @description: MesQualityInspectionOtherWorkflow分页参数 模型
*/
export interface MesQualityInspectionOtherWorkflowPageParams extends BasicPageParams {
wtbm: string;
jcmd: string;
ypmc: string;
syr: string;
lxfs: string;
ypsl: string;
ypzl: string;
jcxm: string;
pdbz: string;
jsbz: string;
}
/**
* @description: MesQualityInspectionOtherWorkflow分页返回值模型
*/
export interface MesQualityInspectionOtherWorkflowPageModel {
id: string;
wtbm: string;
jcmd: string;
ypmc: string;
syr: string;
lxfs: string;
ypsl: string;
ypzl: string;
jcxm: string;
pdbz: string;
jsbz: string;
}
/**
* @description: MesQualityInspectionOtherWorkflow表类型
*/
export interface MesQualityInspectionOtherWorkflowModel {
id: string;
deleteMark: string;
jsbz: string;
images: string;
pdbz: string;
jcxm: string;
ypzl: string;
ypsl: string;
lxfs: string;
syr: string;
ypmc: string;
jcmd: string;
wtbm: string;
createDate: string;
createUserId: string;
modifyDate: string;
modifyUserId: string;
}
/**
* @description: MesQualityInspectionOtherWorkflow分页返回值结构
*/
export type MesQualityInspectionOtherWorkflowPageResult =
BasicFetchResult<MesQualityInspectionOtherWorkflowPageModel>;
<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" />
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, computed, reactive, provide, Ref } 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 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: !state.isView,
showOkBtn: !state.isView,
canFullscreen: true,
width: 1960,
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 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 { addMesQualityInspectionLeaveFactoryWorkflow, getMesQualityInspectionLeaveFactoryWorkflow, updateMesQualityInspectionLeaveFactoryWorkflow } from '/@/api/zlgl/cccpfxspd';
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 getMesQualityInspectionLeaveFactoryWorkflow(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 updateMesQualityInspectionLeaveFactoryWorkflow(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 addMesQualityInspectionLeaveFactoryWorkflow(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';
import { uploadApi } from '/@/api/sys/upload';
export const searchFormSchema: FormSchema[] = [
{
field: 'jyrq',
label: '检验日期',
defaultValue: undefined,
component: 'RangePicker',
componentProps: {
format: 'YYYY-MM-DD HH:mm:ss',
style: { width: '100%' },
getPopupContainer: () => document.body,
},
},
{
field: 'hjph',
label: '合金牌号',
defaultValue: undefined,
component: 'Input',
},
{
field: 'lch',
label: '炉次号',
defaultValue: undefined,
component: 'Input',
},
{
field: 'jyy',
label: '检验员',
defaultValue: undefined,
component: 'User',
componentProps: {
suffix: 'ant-design:setting-outlined',
placeholder: '请选择',
},
},
{
field: 'gkmc',
label: '顾客名称',
defaultValue: undefined,
component: 'Input',
},
{
field: 'cpms',
label: '产品描述',
defaultValue: undefined,
component: 'Input',
},
{
field: 'gkyj',
label: '顾客意见',
defaultValue: undefined,
component: 'Input',
},
];
export const columns: BasicColumn[] = [
{
resizable: true,
dataIndex: 'jyrq',
title: '检验日期',
componentType: 'date',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: undefined,
},
{
resizable: true,
dataIndex: 'hjph',
title: '合金牌号',
componentType: 'input',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: '',
},
{
resizable: true,
dataIndex: 'lch',
title: '炉次号',
componentType: 'input',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: '',
},
{
resizable: true,
dataIndex: 'jyy',
title: '检验员',
componentType: 'user',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: undefined,
},
{
resizable: true,
dataIndex: 'gkmc',
title: '顾客名称',
componentType: 'input',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: '',
},
{
resizable: true,
dataIndex: 'cpms',
title: '产品描述',
componentType: 'input',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: '',
},
{
resizable: true,
dataIndex: 'gkyj',
title: '顾客意见',
componentType: 'input',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: '',
},
];
//表头合并配置
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: 'f188e9692087462aac6a522020688c2e',
field: 'jyrq',
label: '检验日期',
type: 'date',
component: 'DatePicker',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
span: '',
defaultValue: '',
width: '100%',
placeholder: '请选择检验日期',
format: 'YYYY-MM-DD HH:mm:ss',
showLabel: true,
allowClear: false,
disabled: false,
required: true,
isShow: true,
rules: [],
events: {},
isGetCurrent: false,
tooltipConfig: { visible: false, title: '提示文本' },
searchType: 'time',
style: { width: '100%' },
},
},
{
key: '799a93464b4b49c6bd2909d456e7a4c8',
field: 'hjph',
label: '合金牌号',
type: 'input',
component: 'Input',
colProps: { span: 24 },
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: '提示文本' },
style: { width: '100%' },
},
},
{
key: '201aed5bcd0e40babdb96ab36de532a7',
field: 'lch',
label: '炉次号',
type: 'input',
component: 'Input',
colProps: { span: 24 },
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: '提示文本' },
style: { width: '100%' },
},
},
{
key: '363aba04d8ba4b02949fbebbf583bcfb',
field: 'jyy',
label: '检验员',
type: 'user',
component: 'User',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
span: '',
width: '100%',
defaultValue: '',
placeholder: '请选择人员',
userType: 0,
prefix: '',
suffix: 'ant-design:setting-outlined',
showLabel: true,
disabled: false,
required: true,
multiple: true,
isShow: true,
events: {},
tooltipConfig: { visible: false, title: '提示文本' },
style: { width: '100%' },
},
},
{
key: '0d94de8ad3534799929c749459c66718',
field: 'gkmc',
label: '顾客名称',
type: 'input',
component: 'Input',
colProps: { span: 24 },
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: '提示文本' },
style: { width: '100%' },
},
},
{
key: '3fb1db349e604818b34ec80d42822db8',
field: 'cpms',
label: '产品描述',
type: 'input',
component: 'Input',
colProps: { span: 24 },
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: '提示文本' },
style: { width: '100%' },
},
},
{
key: '44070e74294f42ae9d45125821791884',
field: 'images',
label: '附件',
type: 'upload',
component: 'Upload',
colProps: { span: 24 },
componentProps: {
api: uploadApi,
span: '',
defaultValue: '',
accept: '',
maxNumber: 5,
maxSize: 5,
showLabel: true,
multiple: false,
disabled: false,
required: false,
isShow: true,
events: {},
listType: 'text',
sourceType: 'album,camera',
tooltipConfig: { visible: false, title: '提示文本' },
},
},
{
key: '2908e95b40994ef4aa819972bd840713',
field: '',
label: '分割线',
colProps: { span: 24 },
type: 'divider',
component: 'Divider',
componentProps: {
dashed: false,
orientation: 'left',
text: '审批意见',
isShow: true,
style: { marginTop: '0px', marginBottom: '0px' },
},
},
{
key: '879e17939485432c8c0dfb17101a4942',
field: 'gkyj',
label: '顾客意见',
type: 'input',
component: 'Input',
colProps: { span: 24 },
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: '提示文本' },
style: { width: '100%' },
},
},
],
showActionButtonGroup: false,
buttonLocation: 'center',
actionColOptions: { span: 24 },
showResetButton: false,
showSubmitButton: false,
hiddenComponent: [],
};
export const permissionList = [
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '检验日期',
fieldId: 'jyrq',
isSubTable: false,
showChildren: true,
type: 'date',
key: 'f188e9692087462aac6a522020688c2e',
children: [],
options: {},
defaultValue: '',
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '合金牌号',
fieldId: 'hjph',
isSubTable: false,
showChildren: true,
type: 'input',
key: '799a93464b4b49c6bd2909d456e7a4c8',
children: [],
options: {},
defaultValue: '',
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '炉次号',
fieldId: 'lch',
isSubTable: false,
showChildren: true,
type: 'input',
key: '201aed5bcd0e40babdb96ab36de532a7',
children: [],
options: {},
defaultValue: '',
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '检验员',
fieldId: 'jyy',
isSubTable: false,
showChildren: true,
type: 'user',
key: '363aba04d8ba4b02949fbebbf583bcfb',
children: [],
options: {},
defaultValue: '',
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '顾客名称',
fieldId: 'gkmc',
isSubTable: false,
showChildren: true,
type: 'input',
key: '0d94de8ad3534799929c749459c66718',
children: [],
options: {},
defaultValue: '',
},
{
required: false,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '产品描述',
fieldId: 'cpms',
isSubTable: false,
showChildren: true,
type: 'input',
key: '3fb1db349e604818b34ec80d42822db8',
children: [],
options: {},
defaultValue: '',
},
{
required: false,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '附件',
fieldId: 'images',
isSubTable: false,
showChildren: true,
type: 'upload',
key: '44070e74294f42ae9d45125821791884',
children: [],
options: {},
defaultValue: '',
},
{
required: false,
view: true,
edit: false,
disabled: true,
isSaveTable: false,
tableName: '',
fieldName: '分割线',
fieldId: '',
isSubTable: false,
showChildren: true,
type: 'divider',
key: '2908e95b40994ef4aa819972bd840713',
children: [],
options: {},
},
{
required: false,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '顾客意见',
fieldId: 'gkyj',
isSubTable: false,
showChildren: true,
type: 'input',
key: '879e17939485432c8c0dfb17101a4942',
children: [],
options: {},
defaultValue: '',
},
];
<template>
<ResizePageWrapper :hasLeft="false">
<template #resizeRight>
<BasicTable @register="registerTable" isMenuTable ref="tableRef"
>
<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>
</BasicTable>
</template>
<CccpfxspdModal @register="registerModal" @success="handleFormSuccess" @cancel="handleFormCancel"/>
</ResizePageWrapper>
</template>
<script lang="ts" setup>
import { ref, computed,provide,Ref, 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 { getMesQualityInspectionLeaveFactoryWorkflowPage, deleteMesQualityInspectionLeaveFactoryWorkflow} from '/@/api/zlgl/cccpfxspd';
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 CccpfxspdModal from './components/CccpfxspdModal.vue';
import { searchFormSchema, columns } from './components/config';
import Icon from '/@/components/Icon/index';
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 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":"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,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: 'Cccpfxspd列表',
api: getMesQualityInspectionLeaveFactoryWorkflowPage,
rowKey: 'id',
columns: filterColumns,
pagination: {
pageSize: 10,
},
formConfig: {
labelWidth: 100,
schemas: searchFormSchema,
fieldMapToTime: [['jyrq', ['jyrqStart', 'jyrqEnd'], '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值
});
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() {
deleteMesQualityInspectionLeaveFactoryWorkflow(ids).then((_) => {
handleSuccess();
notification.success({
message: 'Tip',
description: t('删除成功!'),
});
});
},
onCancel() {},
});
}
function customRow(record: Recordable) {
return {
ondblclick: () => {
if (record.isCanEdit && hasPermission("cccpfxspd: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);
}
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: `cccpfxspd:${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: `cccpfxspd:${button.code}`,
label: button?.name,
onClick: btnEvent[button.code]?.bind(null, record),
});
}
}
});
return actionsList;
}
</script>
<style lang="less" scoped>
:deep(.ant-table-selection-col) {
width: 50px;
}
.show{
display: flex;
}
.hide{
display: none !important;
}
</style>
\ No newline at end of file
<template>
<BasicModal
:height="1060"
v-bind="$attrs" @register="registerModal" :title="getTitle"
@ok="handleSubmit" @cancel="handleClose" >
<ModalForm ref="formRef" v-model:value="state.formModel" :fromPage="FromPageType.MENU" />
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, computed, reactive, provide, Ref } 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 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: !state.isView,
showOkBtn: !state.isView,
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 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 { addMesQualityUnqualifiedWorkflow, getMesQualityUnqualifiedWorkflow, updateMesQualityUnqualifiedWorkflow } from '/@/api/zlgl/cpbhgcllcd';
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 getMesQualityUnqualifiedWorkflow(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 updateMesQualityUnqualifiedWorkflow(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 addMesQualityUnqualifiedWorkflow(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';
import { uploadApi } from '/@/api/sys/upload';
export const searchFormSchema: FormSchema[] = [
{
field: 'bhgid',
label: '不合格品',
defaultValue: undefined,
component: 'XjrSelect',
componentProps: {
datasourceType: 'api',
apiConfig: {
path: '/zlgl//bhgp/getBhgp',
method: 'GET',
apiId: '716761046a754a3ba90b8911eb7c9e2c',
apiParams: [
{ key: '1', title: 'Query Params', tableInfo: [] },
{ key: '2', title: 'Header', tableInfo: [] },
{ key: '3', title: 'Body' },
],
script:
"if(keyword!=null && keyword!=''){\r\n var sql = \"select id as value,djbh as label from mes_quality_unqualified where delete_mark=0 and djbh like '%${keyword}%' \";\r\n return db.select(sql)\r\n}\r\nvar sql = 'select id as value,djbh as label from mes_quality_unqualified where delete_mark=0 ';\r\nreturn db.select(sql)",
outputParams: [
{
name: 'label',
tableTitle: '不合格品编号',
bindField: 'dan_xing_wen_ben7442',
show: true,
width: 150,
component: '09f63149f2464349b1a85ac7d1956d19',
},
],
},
labelField: 'label',
valueField: 'value',
mode: 'multiple',
showSearch: true,
getPopupContainer: () => document.body,
},
},
{
field: 'jyrq',
label: '检验日期',
defaultValue: undefined,
component: 'RangePicker',
componentProps: {
format: 'YYYY-MM-DD HH:mm:ss',
style: { width: '100%' },
getPopupContainer: () => document.body,
},
},
{
field: 'hjph',
label: '合金牌号',
defaultValue: undefined,
component: 'Input',
},
{
field: 'lch',
label: '炉次号',
defaultValue: undefined,
component: 'Input',
},
{
field: 'jyy',
label: '检验员',
defaultValue: undefined,
component: 'User',
componentProps: {
suffix: 'ant-design:setting-outlined',
placeholder: '请选择',
},
},
{
field: 'gkmc',
label: '顾客名称',
defaultValue: undefined,
component: 'Input',
},
{
field: 'qxmc',
label: '缺陷名称',
defaultValue: undefined,
component: 'Input',
},
{
field: 'qxms',
label: '缺陷描述',
defaultValue: undefined,
component: 'Input',
},
{
field: 'qxmssfss',
label: '缺陷描述是否属实',
defaultValue: undefined,
component: 'XjrSelect',
componentProps: {
datasourceType: 'staticData',
staticOptions: [
{ key: 2, label: '是', value: '1' },
{ key: 3, label: '否', value: '2' },
],
labelField: 'label',
valueField: 'value',
mode: 'multiple',
showSearch: true,
getPopupContainer: () => document.body,
},
},
{
field: 'jzyfcsyz1',
label: '纠正预防措施验证1',
defaultValue: undefined,
component: 'XjrSelect',
componentProps: {
datasourceType: 'staticData',
staticOptions: [
{ key: 1, label: '是', value: '1' },
{ key: 3, label: '否', value: '2' },
],
labelField: 'label',
valueField: 'value',
mode: 'multiple',
showSearch: true,
getPopupContainer: () => document.body,
},
},
{
field: 'jzcsyz2',
label: '纠正措施验证2',
defaultValue: undefined,
component: 'XjrSelect',
componentProps: {
datasourceType: 'staticData',
staticOptions: [
{ key: 1, label: '是', value: '1' },
{ key: 2, label: '否', value: '2' },
],
labelField: 'label',
valueField: 'value',
mode: 'multiple',
showSearch: true,
getPopupContainer: () => document.body,
},
},
{
field: 'jzcsssyxxyz',
label: '纠正措施实施有效性验证',
defaultValue: undefined,
component: 'Input',
},
{
field: 'jzyfcs',
label: '纠正预防措施',
defaultValue: undefined,
component: 'Input',
},
{
field: 'gbyyfx',
label: '根本原因分析',
defaultValue: undefined,
component: 'Input',
},
];
export const columns: BasicColumn[] = [
{
resizable: true,
dataIndex: 'bhgid',
title: '不合格品',
componentType: 'associate-popup',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: undefined,
},
{
resizable: true,
dataIndex: 'jyrq',
title: '检验日期',
componentType: 'date',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: undefined,
},
{
resizable: true,
dataIndex: 'hjph',
title: '合金牌号',
componentType: 'input',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: '',
},
{
resizable: true,
dataIndex: 'lch',
title: '炉次号',
componentType: 'input',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: '',
},
{
resizable: true,
dataIndex: 'jyy',
title: '检验员',
componentType: 'user',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: undefined,
},
{
resizable: true,
dataIndex: 'gkmc',
title: '顾客名称',
componentType: 'input',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: '',
},
{
resizable: true,
dataIndex: 'qxmc',
title: '缺陷名称',
componentType: 'input',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: '',
},
{
resizable: true,
dataIndex: 'qxms',
title: '缺陷描述',
componentType: 'input',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: '',
},
{
resizable: true,
dataIndex: 'qxmssfss',
title: '缺陷描述是否属实',
componentType: 'select',
customRender: ({ record }) => {
const staticOptions = [
{ key: 2, label: '是', value: '1' },
{ key: 3, label: '否', value: '2' },
];
return staticOptions.filter((x) => x.value == record.qxmssfss)[0]?.label;
},
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: undefined,
},
{
resizable: true,
dataIndex: 'jzyfcsyz1',
title: '纠正预防措施验证1',
componentType: 'select',
customRender: ({ record }) => {
const staticOptions = [
{ key: 1, label: '是', value: '1' },
{ key: 3, label: '否', value: '2' },
];
return staticOptions.filter((x) => x.value == record.jzyfcsyz1)[0]?.label;
},
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: undefined,
},
{
resizable: true,
dataIndex: 'jzcsyz2',
title: '纠正措施验证2',
componentType: 'select',
customRender: ({ record }) => {
const staticOptions = [
{ key: 1, label: '是', value: '1' },
{ key: 2, label: '否', value: '2' },
];
return staticOptions.filter((x) => x.value == record.jzcsyz2)[0]?.label;
},
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: undefined,
},
{
resizable: true,
dataIndex: 'jzcsssyxxyz',
title: '纠正措施实施有效性验证',
componentType: 'input',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: '',
},
{
resizable: true,
dataIndex: 'jzyfcs',
title: '纠正预防措施',
componentType: 'input',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: '',
},
{
resizable: true,
dataIndex: 'gbyyfx',
title: '根本原因分析',
componentType: 'input',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: '',
},
];
//表头合并配置
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: '7d97909d98d54826843087e98bd145fd',
field: 'bhgid',
label: '不合格品',
type: 'associate-popup',
component: 'MultiplePopup',
colProps: { span: 24 },
componentProps: {
popupType: 'associate',
width: '100%',
span: '',
placeholder: '请选择不合格品',
showLabel: true,
disabled: false,
datasourceType: 'api',
labelField: 'label',
valueField: 'value',
pageSize: 10,
assoTitle: '不合格品',
apiConfig: {
path: '/zlgl//bhgp/getBhgp',
method: 'GET',
apiId: '716761046a754a3ba90b8911eb7c9e2c',
apiParams: [
{ key: '1', title: 'Query Params', tableInfo: [] },
{ key: '2', title: 'Header', tableInfo: [] },
{ key: '3', title: 'Body' },
],
script:
"if(keyword!=null && keyword!=''){\r\n var sql = \"select id as value,djbh as label from mes_quality_unqualified where delete_mark=0 and djbh like '%${keyword}%' \";\r\n return db.select(sql)\r\n}\r\nvar sql = 'select id as value,djbh as label from mes_quality_unqualified where delete_mark=0 ';\r\nreturn db.select(sql)",
outputParams: [
{
name: 'label',
tableTitle: '不合格品编号',
bindField: 'danXingWenBen7442',
show: true,
width: 150,
component: '09f63149f2464349b1a85ac7d1956d19',
},
],
},
dicOptions: [],
required: false,
rules: [],
events: {},
isShow: true,
tooltipConfig: { visible: false, title: '提示文本' },
style: { width: '100%' },
},
},
{
key: 'e3ddb10b34544215939acd3c8e5ac645',
field: 'jyrq',
label: '检验日期',
type: 'date',
component: 'DatePicker',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
span: '',
defaultValue: '',
width: '100%',
placeholder: '请选择检验日期',
format: 'YYYY-MM-DD HH:mm:ss',
showLabel: true,
allowClear: false,
disabled: false,
required: true,
isShow: true,
rules: [],
events: {},
isGetCurrent: false,
tooltipConfig: { visible: false, title: '提示文本' },
searchType: 'time',
style: { width: '100%' },
},
},
{
key: '928a3689145b40068812ae200ef4192e',
field: 'hjph',
label: '合金牌号',
type: 'input',
component: 'Input',
colProps: { span: 24 },
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: '提示文本' },
style: { width: '100%' },
},
},
{
key: 'f27565fe96154a06b5e68bd5e738f22e',
field: 'lch',
label: '炉次号',
type: 'input',
component: 'Input',
colProps: { span: 24 },
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: '提示文本' },
style: { width: '100%' },
},
},
{
key: '086ea409b1834b86a61bf38537d80ce4',
field: 'jyy',
label: '检验员',
type: 'user',
component: 'User',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
span: '',
width: '100%',
defaultValue: '',
placeholder: '请选择人员',
userType: 0,
prefix: '',
suffix: 'ant-design:setting-outlined',
showLabel: true,
disabled: false,
required: true,
multiple: true,
isShow: true,
events: {},
tooltipConfig: { visible: false, title: '提示文本' },
style: { width: '100%' },
},
},
{
key: 'e689f5cfe2804ebc9582de1743bb493e',
field: 'gkmc',
label: '顾客名称',
type: 'input',
component: 'Input',
colProps: { span: 24 },
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: '提示文本' },
style: { width: '100%' },
},
},
{
key: '5945de2c060e43d99d44bac3c8a9e30c',
field: 'images',
label: '附件',
type: 'upload',
component: 'Upload',
colProps: { span: 24 },
componentProps: {
api: uploadApi,
span: '',
defaultValue: '',
accept: '',
maxNumber: 5,
maxSize: 5,
showLabel: true,
multiple: false,
disabled: false,
required: false,
isShow: true,
events: {},
listType: 'text',
sourceType: 'album,camera',
tooltipConfig: { visible: false, title: '提示文本' },
},
},
{
key: '9f2b5aa4478e4dc38f97f2aecc70f5e7',
field: 'qxmc',
label: '缺陷名称',
type: 'input',
component: 'Input',
colProps: { span: 24 },
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: '提示文本' },
style: { width: '100%' },
},
},
{
key: '8e00995380d0400b8873d5f598f12616',
field: 'qxms',
label: '缺陷描述',
type: 'input',
component: 'Input',
colProps: { span: 24 },
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: '提示文本' },
style: { width: '100%' },
},
},
{
key: '5dcfba711ff141f6864404a433f7fe48',
field: 'qxmssfss',
label: '缺陷描述是否属实',
type: 'select',
component: 'XjrSelect',
colProps: { span: 24 },
componentProps: {
width: '100%',
span: '',
placeholder: '缺陷描述是否属实',
showLabel: true,
showSearch: false,
isMultiple: false,
clearable: false,
disabled: false,
staticOptions: [
{ key: 2, label: '是', value: '1' },
{ key: 3, label: '否', value: '2' },
],
defaultSelect: '',
datasourceType: 'staticData',
params: null,
labelField: 'label',
valueField: 'value',
apiConfig: {
path: 'CodeGeneration/selection',
method: 'GET',
apiId: '93d735dcb7364a0f8102188ec4d77ac7',
},
dicOptions: [],
required: true,
rules: [],
events: {},
isShow: true,
tooltipConfig: { visible: false, title: '提示文本' },
style: { width: '100%' },
},
},
{
key: 'bbde2fe52b9443a1a1c77667efb60f25',
field: 'jzyfcsyz1',
label: '纠正预防措施验证1',
type: 'select',
component: 'XjrSelect',
colProps: { span: 24 },
componentProps: {
width: '100%',
span: '',
placeholder: '纠正预防措施验证1',
showLabel: true,
showSearch: false,
isMultiple: false,
clearable: false,
disabled: false,
staticOptions: [
{ key: 1, label: '是', value: '1' },
{ key: 3, label: '否', value: '2' },
],
defaultSelect: '',
datasourceType: 'staticData',
params: null,
labelField: 'label',
valueField: 'value',
apiConfig: {
path: 'CodeGeneration/selection',
method: 'GET',
apiId: '93d735dcb7364a0f8102188ec4d77ac7',
},
dicOptions: [],
required: true,
rules: [],
events: {},
isShow: true,
tooltipConfig: { visible: false, title: '提示文本' },
style: { width: '100%' },
},
},
{
key: '43f1169f500747f98ab91bf73a0b282d',
field: 'jzcsyz2',
label: '纠正措施验证2',
type: 'select',
component: 'XjrSelect',
colProps: { span: 24 },
componentProps: {
width: '100%',
span: '',
placeholder: '纠正措施验证2',
showLabel: true,
showSearch: false,
isMultiple: false,
clearable: false,
disabled: false,
staticOptions: [
{ key: 1, label: '是', value: '1' },
{ key: 2, label: '否', value: '2' },
],
defaultSelect: '',
datasourceType: 'staticData',
params: null,
labelField: 'label',
valueField: 'value',
apiConfig: {
path: 'CodeGeneration/selection',
method: 'GET',
apiId: '93d735dcb7364a0f8102188ec4d77ac7',
},
dicOptions: [],
required: true,
rules: [],
events: {},
isShow: true,
tooltipConfig: { visible: false, title: '提示文本' },
style: { width: '100%' },
},
},
{
key: '9bf3e230c5d948ca81ad5ef6d5571de3',
field: 'jzcsssyxxyz',
label: '纠正措施实施有效性验证',
type: 'input',
component: 'Input',
colProps: { span: 24 },
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: '提示文本' },
style: { width: '100%' },
},
},
{
key: '2f7507003f0b4814a8ea1ebeb56cb4d0',
field: 'jzyfcs',
label: '纠正预防措施',
type: 'input',
component: 'Input',
colProps: { span: 24 },
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: '提示文本' },
style: { width: '100%' },
},
},
{
key: '58c19e3a0f704c9b8ccd8daa42430f9c',
field: 'gbyyfx',
label: '根本原因分析',
type: 'input',
component: 'Input',
colProps: { span: 24 },
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: '提示文本' },
style: { width: '100%' },
},
},
],
showActionButtonGroup: false,
buttonLocation: 'center',
actionColOptions: { span: 24 },
showResetButton: false,
showSubmitButton: false,
hiddenComponent: [],
};
export const permissionList = [
{
required: false,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '不合格品',
fieldId: 'bhgid',
isSubTable: false,
showChildren: true,
type: 'associate-popup',
key: '7d97909d98d54826843087e98bd145fd',
children: [],
options: {},
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '检验日期',
fieldId: 'jyrq',
isSubTable: false,
showChildren: true,
type: 'date',
key: 'e3ddb10b34544215939acd3c8e5ac645',
children: [],
options: {},
defaultValue: '',
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '合金牌号',
fieldId: 'hjph',
isSubTable: false,
showChildren: true,
type: 'input',
key: '928a3689145b40068812ae200ef4192e',
children: [],
options: {},
defaultValue: '',
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '炉次号',
fieldId: 'lch',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'f27565fe96154a06b5e68bd5e738f22e',
children: [],
options: {},
defaultValue: '',
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '检验员',
fieldId: 'jyy',
isSubTable: false,
showChildren: true,
type: 'user',
key: '086ea409b1834b86a61bf38537d80ce4',
children: [],
options: {},
defaultValue: '',
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '顾客名称',
fieldId: 'gkmc',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'e689f5cfe2804ebc9582de1743bb493e',
children: [],
options: {},
defaultValue: '',
},
{
required: false,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '附件',
fieldId: 'images',
isSubTable: false,
showChildren: true,
type: 'upload',
key: '5945de2c060e43d99d44bac3c8a9e30c',
children: [],
options: {},
defaultValue: '',
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '缺陷名称',
fieldId: 'qxmc',
isSubTable: false,
showChildren: true,
type: 'input',
key: '9f2b5aa4478e4dc38f97f2aecc70f5e7',
children: [],
options: {},
defaultValue: '',
},
{
required: false,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '缺陷描述',
fieldId: 'qxms',
isSubTable: false,
showChildren: true,
type: 'input',
key: '8e00995380d0400b8873d5f598f12616',
children: [],
options: {},
defaultValue: '',
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '缺陷描述是否属实',
fieldId: 'qxmssfss',
isSubTable: false,
showChildren: true,
type: 'select',
key: '5dcfba711ff141f6864404a433f7fe48',
children: [],
options: {},
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '纠正预防措施验证1',
fieldId: 'jzyfcsyz1',
isSubTable: false,
showChildren: true,
type: 'select',
key: 'bbde2fe52b9443a1a1c77667efb60f25',
children: [],
options: {},
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '纠正措施验证2',
fieldId: 'jzcsyz2',
isSubTable: false,
showChildren: true,
type: 'select',
key: '43f1169f500747f98ab91bf73a0b282d',
children: [],
options: {},
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '纠正措施实施有效性验证',
fieldId: 'jzcsssyxxyz',
isSubTable: false,
showChildren: true,
type: 'input',
key: '9bf3e230c5d948ca81ad5ef6d5571de3',
children: [],
options: {},
defaultValue: '',
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '纠正预防措施',
fieldId: 'jzyfcs',
isSubTable: false,
showChildren: true,
type: 'input',
key: '2f7507003f0b4814a8ea1ebeb56cb4d0',
children: [],
options: {},
defaultValue: '',
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '根本原因分析',
fieldId: 'gbyyfx',
isSubTable: false,
showChildren: true,
type: 'input',
key: '58c19e3a0f704c9b8ccd8daa42430f9c',
children: [],
options: {},
defaultValue: '',
},
];
<template>
<ResizePageWrapper :hasLeft="false">
<template #resizeRight>
<BasicTable @register="registerTable" isMenuTable ref="tableRef"
>
<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>
</BasicTable>
</template>
<CpbhgcllcdModal @register="registerModal" @success="handleFormSuccess" @cancel="handleFormCancel"/>
</ResizePageWrapper>
</template>
<script lang="ts" setup>
import { ref, computed,provide,Ref, 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 { getMesQualityUnqualifiedWorkflowPage, deleteMesQualityUnqualifiedWorkflow} from '/@/api/zlgl/cpbhgcllcd';
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 CpbhgcllcdModal from './components/CpbhgcllcdModal.vue';
import { searchFormSchema, columns } from './components/config';
import Icon from '/@/components/Icon/index';
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 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":"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,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: 'Cpbhgcllcd列表',
api: getMesQualityUnqualifiedWorkflowPage,
rowKey: 'id',
columns: filterColumns,
pagination: {
pageSize: 10,
},
formConfig: {
labelWidth: 100,
schemas: searchFormSchema,
fieldMapToTime: [['jyrq', ['jyrqStart', 'jyrqEnd'], '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值
});
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() {
deleteMesQualityUnqualifiedWorkflow(ids).then((_) => {
handleSuccess();
notification.success({
message: 'Tip',
description: t('删除成功!'),
});
});
},
onCancel() {},
});
}
function customRow(record: Recordable) {
return {
ondblclick: () => {
if (record.isCanEdit && hasPermission("cpbhgcllcd: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);
}
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: `cpbhgcllcd:${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: `cpbhgcllcd:${button.code}`,
label: button?.name,
onClick: btnEvent[button.code]?.bind(null, record),
});
}
}
});
return actionsList;
}
</script>
<style lang="less" scoped>
:deep(.ant-table-selection-col) {
width: 50px;
}
.show{
display: flex;
}
.hide{
display: none !important;
}
</style>
\ 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 { addMesQualityInspectionOtherWorkflow, getMesQualityInspectionOtherWorkflow, updateMesQualityInspectionOtherWorkflow } from '/@/api/zlgl/scbmypwtd';
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 getMesQualityInspectionOtherWorkflow(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 updateMesQualityInspectionOtherWorkflow(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 addMesQualityInspectionOtherWorkflow(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
<template>
<BasicModal
:height="1060"
v-bind="$attrs" @register="registerModal" :title="getTitle"
@ok="handleSubmit" @cancel="handleClose" >
<ModalForm ref="formRef" v-model:value="state.formModel" :fromPage="FromPageType.MENU" />
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, computed, reactive, provide, Ref } 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 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: !state.isView,
showOkBtn: !state.isView,
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 handleClose() {
formRef.value.resetFields();
}
</script>
\ No newline at end of file
import { FormProps, FormSchema } from '/@/components/Form';
import { BasicColumn } from '/@/components/Table';
import { uploadApi } from '/@/api/sys/upload';
export const searchFormSchema: FormSchema[] = [
{
field: 'wtbm',
label: '委托部门',
defaultValue: undefined,
component: 'Input',
},
{
field: 'jcmd',
label: '检测目的',
defaultValue: undefined,
component: 'Input',
},
{
field: 'ypmc',
label: '样品名称',
defaultValue: undefined,
component: 'Input',
},
{
field: 'syr',
label: '送样人',
defaultValue: undefined,
component: 'User',
componentProps: {
suffix: 'ant-design:setting-outlined',
placeholder: '请选择',
},
},
{
field: 'lxfs',
label: '联系方式',
defaultValue: undefined,
component: 'Input',
},
{
field: 'ypsl',
label: '样品数量',
defaultValue: undefined,
component: 'Input',
},
{
field: 'ypzl',
label: '样品重量',
defaultValue: undefined,
component: 'Input',
},
{
field: 'jcxm',
label: '检测项目',
defaultValue: undefined,
component: 'Input',
},
{
field: 'pdbz',
label: '判定标准',
defaultValue: undefined,
component: 'Input',
},
{
field: 'jsbz',
label: '技术标准',
defaultValue: undefined,
component: 'Input',
},
];
export const columns: BasicColumn[] = [
{
resizable: true,
dataIndex: 'wtbm',
title: '委托部门',
componentType: 'input',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: '',
},
{
resizable: true,
dataIndex: 'jcmd',
title: '检测目的',
componentType: 'input',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: '',
},
{
resizable: true,
dataIndex: 'ypmc',
title: '样品名称',
componentType: 'input',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: '',
},
{
resizable: true,
dataIndex: 'syr',
title: '送样人',
componentType: 'user',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: undefined,
},
{
resizable: true,
dataIndex: 'lxfs',
title: '联系方式',
componentType: 'input',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: '',
},
{
resizable: true,
dataIndex: 'ypsl',
title: '样品数量',
componentType: 'input',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: '',
},
{
resizable: true,
dataIndex: 'ypzl',
title: '样品重量',
componentType: 'input',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: '',
},
{
resizable: true,
dataIndex: 'jcxm',
title: '检测项目',
componentType: 'input',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: '',
},
{
resizable: true,
dataIndex: 'pdbz',
title: '判定标准',
componentType: 'input',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: '',
},
{
resizable: true,
dataIndex: 'jsbz',
title: '技术标准',
componentType: 'input',
fixed: false,
sorter: true,
styleConfig: undefined,
listStyle: '',
},
];
//表头合并配置
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: '380e9579370940358950874fe9db3f2f',
field: 'wtbm',
label: '委托部门',
type: 'input',
component: 'Input',
colProps: { span: 24 },
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: '提示文本' },
style: { width: '100%' },
},
},
{
key: 'ce72b4d3a0774410bda7e7bb2ca658ad',
field: 'jcmd',
label: '检测目的',
type: 'input',
component: 'Input',
colProps: { span: 24 },
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: '提示文本' },
style: { width: '100%' },
},
},
{
key: '7417ba28c294446d9a2d775df56218bb',
field: 'ypmc',
label: '样品名称',
type: 'input',
component: 'Input',
colProps: { span: 24 },
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: '提示文本' },
style: { width: '100%' },
},
},
{
key: '13a22e4385834786abadbf6ee06dde46',
field: 'syr',
label: '送样人',
type: 'user',
component: 'User',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
span: '',
width: '100%',
defaultValue: '',
placeholder: '请选择人员',
userType: 0,
prefix: '',
suffix: 'ant-design:setting-outlined',
showLabel: true,
disabled: false,
required: true,
multiple: true,
isShow: true,
events: {},
tooltipConfig: { visible: false, title: '提示文本' },
style: { width: '100%' },
},
},
{
key: 'd992ed7bc57b4a4399430cafa9eba92b',
field: 'lxfs',
label: '联系方式',
type: 'input',
component: 'Input',
colProps: { span: 24 },
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: '提示文本' },
style: { width: '100%' },
},
},
{
key: 'b67125bada8748febf8edfe8ca516a5a',
field: 'ypsl',
label: '样品数量',
type: 'input',
component: 'Input',
colProps: { span: 24 },
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: '提示文本' },
style: { width: '100%' },
},
},
{
key: 'e5f3d7b7c7194709b8b534e6504e3032',
field: 'ypzl',
label: '样品重量',
type: 'input',
component: 'Input',
colProps: { span: 24 },
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: '提示文本' },
style: { width: '100%' },
},
},
{
key: '1c71dc18d6174668945b2084bcbe19cf',
field: 'jcxm',
label: '检测项目',
type: 'input',
component: 'Input',
colProps: { span: 24 },
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: '提示文本' },
style: { width: '100%' },
},
},
{
key: 'd95d32409ffd4e6ea0a12dab584fe729',
field: 'pdbz',
label: '判定标准',
type: 'input',
component: 'Input',
colProps: { span: 24 },
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: '提示文本' },
style: { width: '100%' },
},
},
{
key: '99d27b8f19a04b59bdf3d5d8220b84b0',
field: 'images',
label: '图片',
type: 'upload',
component: 'Upload',
colProps: { span: 24 },
componentProps: {
api: uploadApi,
span: '',
defaultValue: '',
accept: '',
maxNumber: 5,
maxSize: 5,
showLabel: true,
multiple: false,
disabled: false,
required: false,
isShow: true,
events: {},
listType: 'text',
sourceType: 'album,camera',
tooltipConfig: { visible: false, title: '提示文本' },
},
},
{
key: 'd1ca8e23c8394cc19550c34155538206',
field: 'jsbz',
label: '技术标准',
type: 'input',
component: 'Input',
colProps: { span: 24 },
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: '提示文本' },
style: { width: '100%' },
},
},
],
showActionButtonGroup: false,
buttonLocation: 'center',
actionColOptions: { span: 24 },
showResetButton: false,
showSubmitButton: false,
hiddenComponent: [],
};
export const permissionList = [
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '委托部门',
fieldId: 'wtbm',
isSubTable: false,
showChildren: true,
type: 'input',
key: '380e9579370940358950874fe9db3f2f',
children: [],
options: {},
defaultValue: '',
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '检测目的',
fieldId: 'jcmd',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'ce72b4d3a0774410bda7e7bb2ca658ad',
children: [],
options: {},
defaultValue: '',
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '样品名称',
fieldId: 'ypmc',
isSubTable: false,
showChildren: true,
type: 'input',
key: '7417ba28c294446d9a2d775df56218bb',
children: [],
options: {},
defaultValue: '',
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '送样人',
fieldId: 'syr',
isSubTable: false,
showChildren: true,
type: 'user',
key: '13a22e4385834786abadbf6ee06dde46',
children: [],
options: {},
defaultValue: '',
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '联系方式',
fieldId: 'lxfs',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'd992ed7bc57b4a4399430cafa9eba92b',
children: [],
options: {},
defaultValue: '',
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '样品数量',
fieldId: 'ypsl',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'b67125bada8748febf8edfe8ca516a5a',
children: [],
options: {},
defaultValue: '',
},
{
required: false,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '样品重量',
fieldId: 'ypzl',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'e5f3d7b7c7194709b8b534e6504e3032',
children: [],
options: {},
defaultValue: '',
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '检测项目',
fieldId: 'jcxm',
isSubTable: false,
showChildren: true,
type: 'input',
key: '1c71dc18d6174668945b2084bcbe19cf',
children: [],
options: {},
defaultValue: '',
},
{
required: false,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '判定标准',
fieldId: 'pdbz',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'd95d32409ffd4e6ea0a12dab584fe729',
children: [],
options: {},
defaultValue: '',
},
{
required: false,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '图片',
fieldId: 'images',
isSubTable: false,
showChildren: true,
type: 'upload',
key: '99d27b8f19a04b59bdf3d5d8220b84b0',
children: [],
options: {},
defaultValue: '',
},
{
required: false,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '技术标准',
fieldId: 'jsbz',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'd1ca8e23c8394cc19550c34155538206',
children: [],
options: {},
defaultValue: '',
},
];
<template>
<ResizePageWrapper :hasLeft="false">
<template #resizeRight>
<BasicTable @register="registerTable" isMenuTable ref="tableRef"
>
<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>
</BasicTable>
</template>
<ScbmypwtdModal @register="registerModal" @success="handleFormSuccess" @cancel="handleFormCancel"/>
</ResizePageWrapper>
</template>
<script lang="ts" setup>
import { ref, computed,provide,Ref, 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 { getMesQualityInspectionOtherWorkflowPage, deleteMesQualityInspectionOtherWorkflow} from '/@/api/zlgl/scbmypwtd';
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 ScbmypwtdModal from './components/ScbmypwtdModal.vue';
import { searchFormSchema, columns } from './components/config';
import Icon from '/@/components/Icon/index';
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 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":"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,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: 'Scbmypwtd列表',
api: getMesQualityInspectionOtherWorkflowPage,
rowKey: 'id',
columns: filterColumns,
pagination: {
pageSize: 10,
},
formConfig: {
labelWidth: 100,
schemas: searchFormSchema,
fieldMapToTime: [],
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值
});
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() {
deleteMesQualityInspectionOtherWorkflow(ids).then((_) => {
handleSuccess();
notification.success({
message: 'Tip',
description: t('删除成功!'),
});
});
},
onCancel() {},
});
}
function customRow(record: Recordable) {
return {
ondblclick: () => {
if (record.isCanEdit && hasPermission("scbmypwtd: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);
}
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: `scbmypwtd:${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: `scbmypwtd:${button.code}`,
label: button?.name,
onClick: btnEvent[button.code]?.bind(null, record),
});
}
}
});
return actionsList;
}
</script>
<style lang="less" scoped>
:deep(.ant-table-selection-col) {
width: 50px;
}
.show{
display: flex;
}
.hide{
display: none !important;
}
</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