Commit 620d4f7e by sunhaiwei

Merge remote-tracking branch 'origin/hongshun' into hongshun

# Conflicts:
#	xjrsoft-vue3/src/api/jcsj/cjx/model/CjxModel.ts
parents ffdcaddd 36e62166
......@@ -180,14 +180,6 @@ export interface MesCollectionScItOptionModel {
modifyUserId: string;
}
modifyUserId: string;
sc: string;
dt: string;
bb: string;
}
/**
* @description: MesCollectionItem分页返回值结构
......
......@@ -123,7 +123,7 @@
};
let res = await getDesignPage(params);
page.total = res.total;
template.list = res.list;
// template.list = res.list;
} catch (error) {}
}
function submit() {
......
<template>
<div class="pt-4">
<SimpleForm
ref="systemFormRef"
:formProps="data.formDataProps"
:formModel="state.formModel"
:isWorkFlow="props.fromPage!=FromPageType.MENU"
:isWorkFlow="props.fromPage != FromPageType.MENU"
:isCamelCase="true"
@model-change="handleChange"
/>
......@@ -15,13 +14,22 @@
import { reactive, ref, onMounted, nextTick, watch } from 'vue';
import { formProps, formEventConfigs } from './config';
import SimpleForm from '/@/components/SimpleForm/src/SimpleForm.vue';
import { addMesTrqxunjianRecord, getMesTrqxunjianRecord, updateMesTrqxunjianRecord } from '/@/api/scgl/trqxjd';
import {
addMesTrqxunjianRecord,
getMesTrqxunjianRecord,
updateMesTrqxunjianRecord,
} from '/@/api/scgl/trqxjd';
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 {
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';
......@@ -29,7 +37,7 @@
const { filterFormSchemaAuth } = usePermission();
const RowKey = 'id';
const emits = defineEmits(['changeUploadComponentIds','loadingCompleted', 'update:value']);
const emits = defineEmits(['changeUploadComponentIds', 'loadingCompleted', 'update:value']);
const props = defineProps({
fromPage: {
type: Number,
......@@ -42,7 +50,7 @@
});
const state = reactive({
formModel: {},
formInfo:{formId:'',formName:''}
formInfo: { formId: '', formName: '' },
});
const { currentRoute } = useRouter();
watch(
......@@ -59,17 +67,35 @@
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:'';
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,
await createFormEvent(
formEventConfigs,
state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:初始化表单
formProps.schemas,
true,
state.formInfo.formName,
state.formInfo.formId,
); //表单事件:初始化表单
await nextTick();
await loadFormEvent(formEventConfigs, state.formModel,
await loadFormEvent(
formEventConfigs,
state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:加载表单
formProps.schemas,
true,
state.formInfo.formName,
state.formInfo.formId,
); //表单事件:加载表单
} else if (props.fromPage == FromPageType.FLOW) {
emits('loadingCompleted'); //告诉系统表单已经加载完毕
// loadingCompleted后 工作流页面直接利用Ref调用setWorkFlowForm方法
......@@ -78,15 +104,28 @@
} else if (props.fromPage == FromPageType.DESKTOP) {
// 桌面设计 表单事件需要执行
emits('loadingCompleted'); //告诉系统表单已经加载完毕
await createFormEvent(formEventConfigs, state.formModel,
await createFormEvent(
formEventConfigs,
state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:初始化表单
await loadFormEvent(formEventConfigs, state.formModel,
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); //表单事件:加载表单
formProps.schemas,
true,
state.formInfo.formName,
state.formInfo.formId,
); //表单事件:加载表单
}
} catch (error) {}
});
// 根据菜单页面权限,设置表单属性(必填,禁用,显示)
function setMenuPermission() {
data.formDataProps.schemas = filterFormSchemaAuth(data.formDataProps.schemas!);
......@@ -107,19 +146,25 @@
}
return values;
}
// 根据行唯一ID查询行数据,并设置表单数据 【编辑】
async function setFormDataFromId(rowId) {
try {
const record = await getMesTrqxunjianRecord(rowId);
setFieldsValue(record);
state.formModel = record;
await getFormDataEvent(formEventConfigs, state.formModel,
await getFormDataEvent(
formEventConfigs,
state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:获取表单数据
} catch (error) {
}
formProps.schemas,
true,
state.formInfo.formName,
state.formInfo.formId,
); //表单事件:获取表单数据
} catch (error) {}
}
// 辅助返回表单数据
async function getFieldsValue() {
let values = [];
......@@ -135,45 +180,64 @@
}
return values;
}
// 辅助设置表单数据
function setFieldsValue(record) {
systemFormRef.value.setFieldsValue(record);
}
// 重置表单数据
async function resetFields() {
await systemFormRef.value.resetFields();
}
// 设置表单数据全部为Disabled 【查看】
async function setDisabledForm( ) {
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 updateMesTrqxunjianRecord(values);
await submitFormEvent(formEventConfigs, state.formModel,
await submitFormEvent(
formEventConfigs,
state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:提交表单
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 addMesTrqxunjianRecord(values);
await submitFormEvent(formEventConfigs, state.formModel,
await submitFormEvent(
formEventConfigs,
state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:提交表单
formProps.schemas,
true,
state.formInfo.formName,
state.formInfo.formId,
); //表单事件:提交表单
return saveVal;
} catch (error) {}
}
// 根据工作流页面权限,设置表单属性(必填,禁用,显示)
async function setWorkFlowForm(obj: WorkFlowFormParams) {
try {
......@@ -189,16 +253,30 @@
state.formModel = formModels;
setFieldsValue(formModels);
} catch (error) {}
await createFormEvent(formEventConfigs, state.formModel,
await createFormEvent(
formEventConfigs,
state.formModel,
systemFormRef.value,
formProps.schemas, true, state.formInfo.formName,state.formInfo.formId); //表单事件:初始化表单
await loadFormEvent(formEventConfigs, state.formModel,
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); //表单事件:加载表单
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) {
......@@ -206,6 +284,7 @@
}
} catch (error) {}
}
defineExpose({
setFieldsValue,
resetFields,
......@@ -218,8 +297,6 @@
setWorkFlowForm,
getRowKey,
getFieldsValue,
sendMessageForAllIframe
sendMessageForAllIframe,
});
</script>
\ No newline at end of file
......@@ -210,15 +210,37 @@ export const formProps: FormProps = {
style: { width: '100%' },
},
},
],
},
{
span: 12,
list: [
key: '2e56c34cf7564c8b94e4362f576852ad',
field: 'createDate',
label: '巡检时间',
type: 'date',
component: 'DatePicker',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
span: 7,
defaultValue: '',
width: '100%',
placeholder: '',
format: 'YYYY-MM-DD HH:mm:ss',
showLabel: true,
allowClear: true,
disabled: false,
required: false,
isShow: true,
rules: [],
events: {},
isGetCurrent: false,
tooltipConfig: { visible: false, title: '提示文本' },
searchType: 'time',
style: { width: '100%' },
},
},
{
key: 'f9d86621c3354428b91bfa63ffc6f3b8',
field: 'mc',
label: '名称',
key: '47a71bc316a94794bbf45ec7b26ce391',
field: 'bz',
label: '备注',
type: 'input',
component: 'Input',
colProps: { span: 24 },
......@@ -343,36 +365,9 @@ export const formProps: FormProps = {
span: 12,
list: [
{
key: '2e56c34cf7564c8b94e4362f576852ad',
field: 'createDate',
label: '巡检时间',
type: 'date',
component: 'DatePicker',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
span: 7,
defaultValue: '',
width: '100%',
placeholder: '',
format: 'YYYY-MM-DD HH:mm:ss',
showLabel: true,
allowClear: true,
disabled: false,
required: false,
isShow: true,
rules: [],
events: {},
isGetCurrent: false,
tooltipConfig: { visible: false, title: '提示文本' },
searchType: 'time',
style: { width: '100%' },
},
},
{
key: '47a71bc316a94794bbf45ec7b26ce391',
field: 'bz',
label: '备注',
key: 'f9d86621c3354428b91bfa63ffc6f3b8',
field: 'mc',
label: '名称',
type: 'input',
component: 'Input',
colProps: { span: 24 },
......@@ -394,7 +389,7 @@ export const formProps: FormProps = {
events: {},
listStyle: '',
isSave: false,
isShow: true,
isShow: false,
scan: false,
bordered: true,
isShowAi: false,
......
......@@ -150,7 +150,7 @@ export const columns: BasicColumn[] = [
{
resizable: true,
dataIndex: 'lydjlx',
title: '来源单据',
title: '来源单据111',
componentType: 'input',
fixed: false,
......
......@@ -28,11 +28,36 @@
<template v-if="column.dataIndex === 'action'">
<div style="display: flex; align-items: center;">
<!-- 其他按钮使用TableAction组件 -->
<TableAction
:actions="getLessActions(record)"
:dropDownActions="getMoreActions(record)"
/>
<!-- 单独渲染流程按钮 -->
<template v-if="!record.taskId">
<a-button
type="text"
size="small"
style="margin-left: 8px;color: #1c8dff; "
@click="openFlowLaunchModal(record.id)"
>
<template #icon><Icon style="color: #1c8dff;" :icon="'ant-design:rocket-outlined'" /></template>
发起流程
</a-button>
</template>
<template v-else>
<a-button
type="text"
size="small"
style="margin-left: 8px;color: #1c8dff;"
@click="viewProcess(record)"
>
<template #icon><Icon style="color: #1c8dff;" :icon="'ant-design:eye-outlined'" /></template>
查看流程
</a-button>
</template>
</div>
</template>
<template v-else-if="column.dataIndex && column?.listStyle">
......@@ -84,13 +109,73 @@
@success="handleExportSuccess"
/>
<!-- 流程发起对话框 -->
<a-modal
v-model:visible="visibleFlowLaunchModal"
title="流程模板列表"
width="80%"
:bodyStyle="{ height: '620px', padding: '0' }"
:footer="null"
@cancel="visibleFlowLaunchModal = false"
>
<a-spin :spinning="loading" tip="发起流程中..." style="min-height: 500px;">
<PageLayout
:title="'流程模板列表'"
:searchConfig="searchConfig"
@search="searchFlowTemplate"
@scroll-height="scrollHeight"
>
<template #search> </template>
<template #right>
<div v-if="flowLaunchData.list.length > 0" style="height: 550px;padding: 10px;" class="list-page-box relative">
<div
class="flex flex-wrap my-10px overflow-y-auto"
style="height: calc(100% - 62px); align-content: baseline"
>
<TemplateCard
v-for="(item, index) in flowLaunchData.list"
:key="index"
:item="item"
:width="'calc((100% - 39px) / 4)'"
@click="launchProcess(item.id)"
/>
</div>
<div class="page-box">
<a-pagination
v-model:current="flowLaunchData.pagination.current"
:total="flowLaunchData.pagination.total"
v-model:pageSize="flowLaunchData.pagination.pageSize"
:showSizeChanger="true"
:showQuickJumper="true"
:show-total="(total) => `共 ${total} 条数据`"
@change="handleFlowTemplatePageChange"
/></div>
</div>
<div v-else>
<EmptyBox />
</div>
</template>
</PageLayout>
</a-spin>
</a-modal>
<!-- 查看流程组件 -->
<LookProcess
v-if="visibleLookProcess"
:visible="visibleLookProcess"
:taskId="taskIdProcess"
:processId="processIdProcess"
@close="visibleLookProcess = false"
/>
</ResizePageWrapper>
</template>
<script lang="ts" setup>
import { ref, computed,provide,Ref, onMounted,createVNode,
import { ref, computed,provide,Ref, onMounted,createVNode, reactive
} from 'vue';
import { Modal } from 'ant-design-vue';
......@@ -134,16 +219,162 @@
import { moneyChineseData,camelCaseString, } from '/@/utils/event/design';
import { FormSchema } from '/@/components/Form/src/types/form';
import LookProcess from '/@/views/workflow/task/components/LookProcess.vue';
import TemplateCard from '/@bpmn/components/card/TemplateCard.vue';
import { EmptyBox } from '/@/components/ModalPanel/index';
import { getDesignPage } from '/@/api/workflow/design';
import { WorkflowPageModel } from '/@/api/workflow/model';
import { PageLayout } from '/@/components/ModalPanel';
import userTableScrollHeight from '/@/hooks/setting/userTableScrollHeight';
import { getAppEnvConfig } from '/@/utils/env';
import { getToken } from '/@/utils/auth';
const listSpliceNum = ref(3); //操作列最先展示几个
const listSpliceNum = ref(4); //操作列最先展示几个
const visibleFlowLaunchModal = ref(false);
const { scrollHeight } = userTableScrollHeight();
const fromId = ref('');
const loading = ref(false);
// 查看流程相关变量
const visibleLookProcess = ref(false);
const taskIdProcess = ref('');
const processIdProcess = ref('');
// 流程模板数据
const flowLaunchData = reactive({
list: [] as WorkflowPageModel[],
pagination: {
current: 1,
total: 0,
pageSize: 20,
},
});
// 搜索配置
const searchConfig = [
{
field: 'code',
label: '模板编码',
type: 'input',
},
{
field: 'name',
label: '模板名称',
type: 'input',
},
];
// 打开流程发起对话框
function openFlowLaunchModal(id) {
fromId.value = id;
visibleFlowLaunchModal.value = true;
// 初始化数据
flowLaunchData.pagination.current = 1;
flowLaunchData.pagination.total = 0;
getFlowTemplateList();
}
// 获取流程模板列表
async function getFlowTemplateList(params?: any) {
const searchParams = {
...{
limit: flowLaunchData.pagination.current,
size: flowLaunchData.pagination.pageSize,
},
...params,
...{ enabledMark: 1 }, // 流程发起list 需要隐藏 禁用的模板[enabledMark=1]
};
try {
let res = await getDesignPage(searchParams);
flowLaunchData.list = res.list;
flowLaunchData.pagination.total = res.total;
} catch (error) {
console.error('获取流程模板列表失败:', error);
}
}
// 搜索流程模板
function searchFlowTemplate(params: any) {
flowLaunchData.pagination.current = 1;
getFlowTemplateList(params);
}
// 分页变化
function handleFlowTemplatePageChange(page: number, pageSize: number) {
flowLaunchData.pagination.current = page;
flowLaunchData.pagination.pageSize = pageSize;
getFlowTemplateList();
}
// 发起流程
function launchProcess(schemaId: string) {
Modal.confirm({
title: '提示信息',
icon: createVNode(ExclamationCircleOutlined),
content: '是否确认发起流程?',
okText: '确认',
cancelText: '取消',
onOk() {
// 开始加载
loading.value = true;
// 调用接口发起流程
fetch( getAppEnvConfig().VITE_GLOB_API_URL + '/zlgl/bhgpcl/launchProcess', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${getToken()}`
},
body: JSON.stringify({
type: 1,
schemaId: schemaId,
fromId: fromId.value
})
})
.then(response => response.json())
.then(data => {
// 结束加载
loading.value = false;
if (data.code == 0) {
notification.success({
message: '提示',
description: '流程发起成功!',
});
visibleFlowLaunchModal.value = false;
// 刷新不合格品列表数据
reload();
} else {
notification.error({
message: '提示',
description: data.msg || '流程发起失败',
});
}
})
.catch(error => {
// 结束加载
loading.value = false;
console.error('流程发起失败:', error);
notification.error({
message: '提示',
description: '流程发起失败,请稍后重试',
});
});
},
onCancel() {},
});
}
// 查看流程
function viewProcess(record) {
visibleLookProcess.value = true;
taskIdProcess.value = record.taskId;
processIdProcess.value = record.processId;
}
import { useConcurrentLock } from '/@/hooks/web/useConcurrentLock';
......@@ -234,7 +465,7 @@
striped: false,
actionColumn: {
width: 195,
width: 320,
title: '操作',
dataIndex: 'action',
slots: { customRender: 'action' },
......@@ -443,6 +674,7 @@
}
}
});
return actionsList;
}
......@@ -496,4 +728,26 @@
}
}
/* 流程模板列表样式 */
.list-page-box {
height: calc(100% - 62px);
}
.page-box {
height: 52px;
border-top: 1px solid rgb(238 238 238 / 93%);
text-align: right;
padding: 10px 16px;
background: #fff;
position: absolute;
right: 0;
bottom: 0;
left: 0;
border-radius: 16px;
}
.my-10px {
margin: 10px 0;
}
</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