通用的评论组件
流程图中可查看当前流程审批人 首页使用配置项中的后端地址 列表字段默认左对齐
This commit is contained in:
15
index.html
15
index.html
@ -7,13 +7,19 @@
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0" />
|
||||
<title></title>
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
<!-- <link rel="stylesheet" href="./public/static/WSPlayer/player.css" />
|
||||
<link rel="stylesheet" href="./public/static/WSPlayer/window.division.css" /> -->
|
||||
</head>
|
||||
<body>
|
||||
<div id="GLOB_API_URL" style="display: none">%VITE_GLOB_API_URL%</div>
|
||||
<!-- <div id="GLOB_API_URL" style="display: none">%VITE_GLOB_API_URL%</div>-->
|
||||
<script src="/iconfont.js"></script>
|
||||
<script src="/desktopIconfont.js"></script>
|
||||
<!-- <script type="text/javascript" src="./public/static/WSPlayer/PlaySDKInterface.js"></script>
|
||||
<script type="text/javascript" src="./public/static/WSPlayer/WSPlayer.js"></script>
|
||||
<script type="text/javascript" src="/public/static/jquery-3.6.0.min.js"></script> -->
|
||||
<script type="module">
|
||||
import {getAppEnvConfig} from "./src/utils/env";
|
||||
|
||||
<script>
|
||||
(async () => {
|
||||
var htmlRoot = document.getElementById('htmlRoot');
|
||||
var theme = window.localStorage.getItem('__APP__DARK__MODE__');
|
||||
@ -24,9 +30,10 @@
|
||||
window._AMapSecurityConfig = {
|
||||
securityJsCode: '1b21905551519807626f2bcd191a6036'
|
||||
};
|
||||
var url = document.getElementById('GLOB_API_URL');
|
||||
//var url = document.getElementById('GLOB_API_URL');
|
||||
const url=getAppEnvConfig().VITE_GLOB_API_URL;
|
||||
try {
|
||||
const responseStream = await fetch(url.innerText + '/system/logoConfig/logo-info');
|
||||
const responseStream = await fetch(url + '/system/logoConfig/logo-info');
|
||||
const { data } = await responseStream.json();
|
||||
if (data.shortName) {
|
||||
document.title = data.shortName;
|
||||
|
||||
110
src/api/system/comment/index.ts
Normal file
110
src/api/system/comment/index.ts
Normal file
@ -0,0 +1,110 @@
|
||||
import { XjrCommentPageModel, XjrCommentPageParams, XjrCommentPageResult } from './model/CommentModel';
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { ErrorMessageMode } from '/#/axios';
|
||||
|
||||
enum Api {
|
||||
Page = '/system/comment/page',
|
||||
List = '/system/comment/list',
|
||||
Info = '/system/comment/info',
|
||||
XjrComment = '/system/comment',
|
||||
|
||||
|
||||
Export = '/system/comment/export',
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 查询XjrComment分页列表
|
||||
*/
|
||||
export async function getXjrCommentPage(params: XjrCommentPageParams, mode: ErrorMessageMode = 'modal') {
|
||||
return defHttp.get<XjrCommentPageResult>(
|
||||
{
|
||||
url: Api.Page,
|
||||
params,
|
||||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 获取XjrComment信息
|
||||
*/
|
||||
export async function getXjrComment(id: String, mode: ErrorMessageMode = 'modal') {
|
||||
return defHttp.get<XjrCommentPageModel>(
|
||||
{
|
||||
url: Api.Info,
|
||||
params: { id },
|
||||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 新增XjrComment
|
||||
*/
|
||||
export async function addXjrComment(xjrComment: Recordable, mode: ErrorMessageMode = 'modal') {
|
||||
return defHttp.post<boolean>(
|
||||
{
|
||||
url: Api.XjrComment,
|
||||
params: xjrComment,
|
||||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 更新XjrComment
|
||||
*/
|
||||
export async function updateXjrComment(xjrComment: Recordable, mode: ErrorMessageMode = 'modal') {
|
||||
return defHttp.put<boolean>(
|
||||
{
|
||||
url: Api.XjrComment,
|
||||
params: xjrComment,
|
||||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 删除XjrComment(批量删除)
|
||||
*/
|
||||
export async function deleteXjrComment(ids: string[], mode: ErrorMessageMode = 'modal') {
|
||||
return defHttp.delete<boolean>(
|
||||
{
|
||||
url: Api.XjrComment,
|
||||
data: ids,
|
||||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @description: 导出XjrComment
|
||||
*/
|
||||
export async function exportXjrComment(
|
||||
params?: object,
|
||||
mode: ErrorMessageMode = 'modal'
|
||||
) {
|
||||
return defHttp.download(
|
||||
{
|
||||
url: Api.Export,
|
||||
method: 'GET',
|
||||
params,
|
||||
responseType: 'blob',
|
||||
},
|
||||
{
|
||||
errorMessageMode: mode,
|
||||
},
|
||||
);
|
||||
}
|
||||
84
src/api/system/comment/model/CommentModel.ts
Normal file
84
src/api/system/comment/model/CommentModel.ts
Normal file
@ -0,0 +1,84 @@
|
||||
import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
|
||||
|
||||
/**
|
||||
* @description: XjrComment分页参数 模型
|
||||
*/
|
||||
export interface XjrCommentPageParams extends BasicPageParams {
|
||||
businessCode: string;
|
||||
|
||||
businessId: string;
|
||||
|
||||
content: string;
|
||||
|
||||
createUserId: string;
|
||||
|
||||
createDateStart: string;
|
||||
createDateEnd: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: XjrComment分页返回值模型
|
||||
*/
|
||||
export interface XjrCommentPageModel {
|
||||
id: string;
|
||||
|
||||
businessCode: string;
|
||||
|
||||
businessId: string;
|
||||
|
||||
content: string;
|
||||
|
||||
createUserId: string;
|
||||
|
||||
createDate: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: XjrComment表类型
|
||||
*/
|
||||
export interface XjrCommentModel {
|
||||
id: number;
|
||||
|
||||
businessCode: string;
|
||||
|
||||
businessId: number;
|
||||
|
||||
content: string;
|
||||
|
||||
attachs: number;
|
||||
|
||||
status: number;
|
||||
|
||||
createUserId: number;
|
||||
|
||||
createUserName: string;
|
||||
|
||||
createUserAvatar: string;
|
||||
|
||||
createDate: string;
|
||||
|
||||
modifyUserId: number;
|
||||
|
||||
modifyUserName: string;
|
||||
|
||||
modifyUserAvatar: string;
|
||||
|
||||
modifyDate: string;
|
||||
|
||||
deleteMark: number;
|
||||
|
||||
enabledMark: number;
|
||||
|
||||
deptId: number;
|
||||
|
||||
tenantId: number;
|
||||
|
||||
ruleUserId: number;
|
||||
|
||||
range: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: XjrComment分页返回值结构
|
||||
*/
|
||||
export type XjrCommentPageResult = BasicFetchResult<XjrCommentPageModel>;
|
||||
4
src/components/Comment/index.ts
Normal file
4
src/components/Comment/index.ts
Normal file
@ -0,0 +1,4 @@
|
||||
import { withInstall } from '/@/utils';
|
||||
import comment from './src/Comment.vue';
|
||||
|
||||
export const Comment = withInstall(comment);
|
||||
158
src/components/Comment/src/Comment.vue
Normal file
158
src/components/Comment/src/Comment.vue
Normal file
@ -0,0 +1,158 @@
|
||||
<template>
|
||||
<a-modal
|
||||
v-model:visible="visible"
|
||||
:title="title"
|
||||
@cancel="handleCancel"
|
||||
width="800px"
|
||||
:footer="null"
|
||||
:destroyOnClose="true"
|
||||
>
|
||||
<a-empty style="padding:20px;" v-if="comments.length<=0"/>
|
||||
<a-list style="padding:20px;height:400px"
|
||||
v-if="comments.length"
|
||||
:data-source="comments"
|
||||
:header="`共有${comments.length}个${title}`"
|
||||
item-layout="horizontal"
|
||||
>
|
||||
<template #renderItem="{ item }">
|
||||
<a-list-item>
|
||||
<a-comment
|
||||
:author="item.createUserName"
|
||||
:avatar="item.createUserAvatar||headerImg"
|
||||
:content="item.content"
|
||||
:datetime="item.createDate"
|
||||
/>
|
||||
</a-list-item>
|
||||
</template>
|
||||
</a-list>
|
||||
<a-comment style="margin:50px 20px 0 20px;height:240px" v-if="canAdd">
|
||||
<template #avatar>
|
||||
<a-avatar :src="userImage" :alt="userInfo.name" :title="userInfo.name" />
|
||||
</template>
|
||||
<template #content>
|
||||
<a-form-item>
|
||||
<a-textarea v-model:value="value" :placeholder="placeholder" :rows="4" />
|
||||
</a-form-item>
|
||||
<a-form-item>
|
||||
<a-button html-type="submit" :loading="submitting" type="primary" @click="handleSubmit">
|
||||
添加{{title}}
|
||||
</a-button>
|
||||
</a-form-item>
|
||||
</template>
|
||||
</a-comment>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
|
||||
import {defineComponent, ref} from "vue";
|
||||
import dayjs from 'dayjs';
|
||||
import relativeTime from 'dayjs/plugin/relativeTime';
|
||||
import {XjrCommentModel} from "/@/api/system/comment/model/CommentModel";
|
||||
import {string} from "vue-types";
|
||||
import {useUserStore} from "/@/store/modules/user";
|
||||
import headerImg from '/@/assets/images/header.jpg';
|
||||
import {getXjrCommentPage,addXjrComment} from "/@/api/system/comment";
|
||||
|
||||
const props = {
|
||||
title: {
|
||||
type: string,
|
||||
default: '评论'
|
||||
},
|
||||
placeholder:{
|
||||
type: string,
|
||||
default(props){
|
||||
return "请输入"+props.title+"内容";
|
||||
}
|
||||
},
|
||||
businessType:{
|
||||
type: string
|
||||
}
|
||||
};
|
||||
|
||||
export default defineComponent({
|
||||
name: 'Comment',
|
||||
props,
|
||||
emits: ['onStarted', 'onFinished'],
|
||||
setup(props, { emit }) {
|
||||
|
||||
dayjs.extend(relativeTime);
|
||||
|
||||
const visible = ref(false);
|
||||
const comments = ref<XjrCommentModel[]>([]);
|
||||
const submitting = ref<boolean>(false);
|
||||
const value = ref<string>('');
|
||||
const userStore = useUserStore();
|
||||
const userInfo = userStore.getUserInfo;
|
||||
const userImage=userInfo.avatar||headerImg;
|
||||
const businessId=ref<string>('');
|
||||
const canAdd=ref<boolean>(false);
|
||||
|
||||
const handleSubmit = () => {
|
||||
if (!value.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
submitting.value = true;
|
||||
|
||||
const submitResultId=addXjrComment({
|
||||
businessCode:props.businessType,
|
||||
businessId:businessId.value,
|
||||
content:value.value
|
||||
});
|
||||
|
||||
submitting.value = false;
|
||||
comments.value = [
|
||||
{
|
||||
createUserName: userInfo.name,
|
||||
createUserAvatar: userImage,
|
||||
content: value.value,
|
||||
createDate: dayjs().fromNow(),
|
||||
id:submitResultId
|
||||
},
|
||||
...comments.value,
|
||||
];
|
||||
value.value = '';
|
||||
};
|
||||
|
||||
const showComment=(commentBusinessId:string,canAddVal:boolean)=>{
|
||||
businessId.value=commentBusinessId;
|
||||
canAdd.value=canAddVal;
|
||||
const commentPage=getXjrCommentPage({
|
||||
businessCode:props.businessType,
|
||||
businessId:businessId.value,
|
||||
size: 99
|
||||
}).then((commentPage)=>{
|
||||
comments.value=commentPage.total>0?[
|
||||
...commentPage.list
|
||||
]:[];
|
||||
showCommentModal();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
const showCommentModal = () => {
|
||||
visible.value = true;
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
visible.value = false;
|
||||
};
|
||||
|
||||
return {
|
||||
visible,
|
||||
comments,
|
||||
handleSubmit,
|
||||
submitting,
|
||||
canAdd,
|
||||
showCommentModal,
|
||||
showComment,
|
||||
handleCancel,
|
||||
value,
|
||||
userInfo,
|
||||
userImage,
|
||||
headerImg
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
@ -922,7 +922,7 @@
|
||||
columnName: component.value,
|
||||
label: component.label,
|
||||
columnWidth: '100',
|
||||
alignType: '',
|
||||
alignType: 'left',
|
||||
autoWidth: true,
|
||||
isTotal: false,
|
||||
isFilter: false,
|
||||
@ -1084,7 +1084,7 @@
|
||||
label: '',
|
||||
columnName: '',
|
||||
columnWidth: '100',
|
||||
alignType: '',
|
||||
alignType: 'left',
|
||||
autoWidth: true,
|
||||
isTotal: false,
|
||||
isFilter: false,
|
||||
|
||||
@ -1363,7 +1363,7 @@
|
||||
title: o.title,
|
||||
dataIndex: o.dataIndex,
|
||||
children: [],
|
||||
align: 'center'
|
||||
align: 'left'
|
||||
};
|
||||
if (obj) {
|
||||
obj.push(com);
|
||||
|
||||
@ -50,6 +50,7 @@ export interface FormInfoItem {
|
||||
formType: FormType;
|
||||
}
|
||||
export interface FlowInfo {
|
||||
currentTaskAssigneeNames: string;
|
||||
isCountersign: boolean;
|
||||
isAddOrSubSign: boolean;
|
||||
schemaInfo: {
|
||||
@ -97,6 +98,7 @@ export interface TaskApproveOpinion {
|
||||
}
|
||||
export interface BpmnFlowForm {
|
||||
// schemaId: string;
|
||||
currentTaskAssignee: string;
|
||||
item: BpmnFlowFormItem;
|
||||
xml: string;
|
||||
formInfos: Array<FormInfoItem>;
|
||||
|
||||
@ -52,7 +52,7 @@
|
||||
<opinion-dialog ref="opinionDlg" />
|
||||
<transfer-dialog ref="transferDlg" />
|
||||
<a-modal :closable="false" :visible="showFlowChart" centered class="geg" title="流程图" width="1200px" @cancel="closeFlowChart">
|
||||
<process-information :process-id="processId" :xml="data.xml" />
|
||||
<process-information :process-id="processId" :xml="data.xml" :currentTaskAssignee="data.currentTaskAssignee"/>
|
||||
<template #footer>
|
||||
<a-button type="primary" @click="closeFlowChart">关闭</a-button>
|
||||
</template>
|
||||
|
||||
@ -224,6 +224,12 @@
|
||||
async function approvalCreate() {
|
||||
const params = await getApproveParams();
|
||||
const nextNodes = await postGetNextTaskMaybeArrival(params);
|
||||
if(nextNodes.length==0){
|
||||
message.error('流程没有可以选择的下一节点');
|
||||
loading.value = false;
|
||||
data.submitLoading = false;
|
||||
return;
|
||||
}
|
||||
opinionDlg.value.toggleDialog({
|
||||
action: 'agree',
|
||||
nextNodes,
|
||||
|
||||
@ -156,8 +156,8 @@
|
||||
const authorizeUrl = ref('');
|
||||
|
||||
const formData = reactive({
|
||||
account: 'admin',
|
||||
password: '123456',
|
||||
account: '',
|
||||
password: '',
|
||||
tenantCode: 'system',
|
||||
});
|
||||
|
||||
|
||||
110
src/views/system/comment/components/CommentModal.vue
Normal file
110
src/views/system/comment/components/CommentModal.vue
Normal file
@ -0,0 +1,110 @@
|
||||
<template>
|
||||
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit" @cancel="handleClose" :paddingRight="15" :bodyStyle="{ minHeight: '400px !important' }">
|
||||
<ModalForm ref="formRef" :fromPage="FromPageType.MENU" />
|
||||
</BasicModal>
|
||||
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed, reactive } from 'vue';
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
import { formProps } from './config';
|
||||
import ModalForm from './Form.vue';
|
||||
import { FromPageType } from '/@/enums/workflowEnum';
|
||||
|
||||
const emit = defineEmits(['success', 'register']);
|
||||
|
||||
const { notification } = useMessage();
|
||||
const formRef = ref();
|
||||
const state = reactive({
|
||||
formModel: {},
|
||||
isUpdate: true,
|
||||
isView: false,
|
||||
isCopy: false,
|
||||
rowId: '',
|
||||
});
|
||||
|
||||
const { t } = useI18n();
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
state.isUpdate = !!data?.isUpdate;
|
||||
state.isView = !!data?.isView;
|
||||
state.isCopy = !!data?.isCopy;
|
||||
|
||||
setModalProps({
|
||||
destroyOnClose: true,
|
||||
maskClosable: false,
|
||||
showCancelBtn: !state.isView,
|
||||
showOkBtn: !state.isView,
|
||||
canFullscreen: true,
|
||||
width: 900,
|
||||
});
|
||||
if (state.isUpdate || state.isView || state.isCopy) {
|
||||
state.rowId = data.id;
|
||||
if (state.isView) {
|
||||
await formRef.value.setDisabledForm();
|
||||
}
|
||||
await formRef.value.setFormDataFromId(state.rowId);
|
||||
} else {
|
||||
formRef.value.resetFields();
|
||||
}
|
||||
});
|
||||
|
||||
const getTitle = computed(() => (state.isView ? '查看' : !state.isUpdate ? '新增' : '编辑'));
|
||||
|
||||
async function saveModal() {
|
||||
let saveSuccess = false;
|
||||
try {
|
||||
const values = await formRef.value?.validate();
|
||||
//添加隐藏组件
|
||||
if (formProps.hiddenComponent?.length) {
|
||||
formProps.hiddenComponent.forEach((component) => {
|
||||
values[component.bindField] = component.value;
|
||||
});
|
||||
}
|
||||
if (values !== false) {
|
||||
try {
|
||||
if (!state.isUpdate || state.isCopy) {
|
||||
saveSuccess = await formRef.value.add(values);
|
||||
} else {
|
||||
saveSuccess = await formRef.value.update({ values, rowId: state.rowId });
|
||||
}
|
||||
return saveSuccess;
|
||||
} catch (error) {}
|
||||
}
|
||||
} catch (error) {
|
||||
return saveSuccess;
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const saveSuccess = await saveModal();
|
||||
setModalProps({ confirmLoading: true });
|
||||
if (saveSuccess) {
|
||||
if (!state.isUpdate || state.isCopy) {
|
||||
//false 新增
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
description: t('新增成功!'),
|
||||
}); //提示消息
|
||||
} else {
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
description: t('修改成功!'),
|
||||
}); //提示消息
|
||||
}
|
||||
closeModal();
|
||||
formRef.value.resetFields();
|
||||
emit('success');
|
||||
}
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
|
||||
function handleClose() {
|
||||
formRef.value.resetFields();
|
||||
}
|
||||
</script>
|
||||
175
src/views/system/comment/components/Form.vue
Normal file
175
src/views/system/comment/components/Form.vue
Normal file
@ -0,0 +1,175 @@
|
||||
<template>
|
||||
<SimpleForm
|
||||
ref="systemFormRef"
|
||||
:formProps="data.formDataProps"
|
||||
:formModel="{}"
|
||||
:isWorkFlow="props.fromPage!=FromPageType.MENU"
|
||||
/>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { reactive, ref, onMounted } from 'vue';
|
||||
import { formProps, formEventConfigs } from './config';
|
||||
import SimpleForm from '/@/components/SimpleForm/src/SimpleForm.vue';
|
||||
import { addXjrComment, getXjrComment, updateXjrComment } from '/@/api/system/comment';
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
import { FormDataProps } from '/@/components/Designer/src/types';
|
||||
import { usePermission } from '/@/hooks/web/usePermission';
|
||||
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';
|
||||
const { filterFormSchemaAuth } = usePermission();
|
||||
|
||||
const RowKey = 'id';
|
||||
const emits = defineEmits(['changeUploadComponentIds','loadingCompleted', 'form-mounted']);
|
||||
const props = defineProps({
|
||||
fromPage: {
|
||||
type: Number,
|
||||
default: FromPageType.MENU,
|
||||
},
|
||||
});
|
||||
const systemFormRef = ref();
|
||||
const data: { formDataProps: FormDataProps } = reactive({
|
||||
formDataProps: cloneDeep(formProps),
|
||||
});
|
||||
const state = reactive({
|
||||
formModel: {},
|
||||
});
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
if (props.fromPage == FromPageType.MENU) {
|
||||
setMenuPermission();
|
||||
await createFormEvent(formEventConfigs, state.formModel,
|
||||
systemFormRef.value,
|
||||
formProps.schemas); //表单事件:初始化表单
|
||||
await loadFormEvent(formEventConfigs, state.formModel,
|
||||
systemFormRef.value,
|
||||
formProps.schemas); //表单事件:加载表单
|
||||
} else if (props.fromPage == FromPageType.FLOW) {
|
||||
emits('loadingCompleted'); //告诉系统表单已经加载完毕
|
||||
// loadingCompleted后 工作流页面直接利用Ref调用setWorkFlowForm方法
|
||||
} else if (props.fromPage == FromPageType.PREVIEW) {
|
||||
// 预览 无需权限,表单事件也无需执行
|
||||
} else if (props.fromPage == FromPageType.DESKTOP) {
|
||||
// 桌面设计 表单事件需要执行
|
||||
emits('loadingCompleted'); //告诉系统表单已经加载完毕
|
||||
await createFormEvent(formEventConfigs, state.formModel,
|
||||
systemFormRef.value,
|
||||
formProps.schemas); //表单事件:初始化表单
|
||||
await loadFormEvent(formEventConfigs, state.formModel,
|
||||
systemFormRef.value,
|
||||
formProps.schemas); //表单事件:加载表单
|
||||
}
|
||||
emits('form-mounted', formProps);
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
});
|
||||
// 根据菜单页面权限,设置表单属性(必填,禁用,显示)
|
||||
function setMenuPermission() {
|
||||
data.formDataProps.schemas = filterFormSchemaAuth(formProps.schemas!);
|
||||
}
|
||||
|
||||
// 校验form 通过返回表单数据
|
||||
async function validate() {
|
||||
let values = [];
|
||||
try {
|
||||
values = await systemFormRef.value?.validate();
|
||||
//添加隐藏组件
|
||||
if (data.formDataProps.hiddenComponent?.length) {
|
||||
data.formDataProps.hiddenComponent.forEach((component) => {
|
||||
values[component.bindField] = component.value;
|
||||
});
|
||||
}
|
||||
} finally {
|
||||
}
|
||||
return values;
|
||||
}
|
||||
// 根据行唯一ID查询行数据,并设置表单数据 【编辑】
|
||||
async function setFormDataFromId(rowId, skipUpdate) {
|
||||
try {
|
||||
const record = await getXjrComment(rowId);
|
||||
if (skipUpdate) {
|
||||
return record;
|
||||
}
|
||||
setFieldsValue(record);
|
||||
state.formModel = record;
|
||||
await getFormDataEvent(formEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:获取表单数据
|
||||
return record;
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
}
|
||||
// 辅助设置表单数据
|
||||
function setFieldsValue(record) {
|
||||
systemFormRef.value.setFieldsValue(record);
|
||||
}
|
||||
// 重置表单数据
|
||||
async function resetFields() {
|
||||
await systemFormRef.value.resetFields();
|
||||
}
|
||||
// 设置表单数据全部为Disabled 【查看】
|
||||
async function setDisabledForm() {
|
||||
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 updateXjrComment(values);
|
||||
await submitFormEvent(formEventConfigs, state.formModel,
|
||||
systemFormRef.value,
|
||||
formProps.schemas); //表单事件:提交表单
|
||||
return saveVal;
|
||||
} catch (error) {}
|
||||
}
|
||||
// 新增api表单数据
|
||||
async function add(values) {
|
||||
try {
|
||||
state.formModel = values;
|
||||
let saveVal = await addXjrComment(values);
|
||||
await submitFormEvent(formEventConfigs, state.formModel,
|
||||
systemFormRef.value,
|
||||
formProps.schemas); //表单事件:提交表单
|
||||
return saveVal;
|
||||
} catch (error) {}
|
||||
}
|
||||
// 根据工作流页面权限,设置表单属性(必填,禁用,显示)
|
||||
async function setWorkFlowForm(obj: WorkFlowFormParams) {
|
||||
try {
|
||||
let flowData = 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); //表单事件:初始化表单
|
||||
await loadFormEvent(formEventConfigs, state.formModel,
|
||||
systemFormRef.value,
|
||||
formProps.schemas); //表单事件:加载表单
|
||||
}
|
||||
defineExpose({
|
||||
setFieldsValue,
|
||||
resetFields,
|
||||
validate,
|
||||
add,
|
||||
update,
|
||||
setFormDataFromId,
|
||||
setDisabledForm,
|
||||
setMenuPermission,
|
||||
setWorkFlowForm,
|
||||
getRowKey,
|
||||
});
|
||||
</script>
|
||||
361
src/views/system/comment/components/config.ts
Normal file
361
src/views/system/comment/components/config.ts
Normal file
@ -0,0 +1,361 @@
|
||||
import { FormProps, FormSchema } from '/@/components/Form';
|
||||
import { BasicColumn } from '/@/components/Table';
|
||||
import { uploadApi } from '/@/api/sys/upload';
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
field: 'businessCode',
|
||||
label: '评论对象编码',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
field: 'businessId',
|
||||
label: '评论对象ID',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
field: 'content',
|
||||
label: '评论内容',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
field: 'createUserId',
|
||||
label: '评论人',
|
||||
component: 'User',
|
||||
componentProps: {
|
||||
suffix: 'ant-design:setting-outlined',
|
||||
placeholder: '请选择',
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
field: 'createDate',
|
||||
label: '评论时间',
|
||||
component: 'RangePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
style: { width: '100%' },
|
||||
getPopupContainer: () => document.body,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
dataIndex: 'businessCode',
|
||||
title: '评论对象编码',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
width: 100,
|
||||
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'businessId',
|
||||
title: '评论对象ID',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
width: 100,
|
||||
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'content',
|
||||
title: '评论内容',
|
||||
componentType: 'textarea',
|
||||
align: 'left',
|
||||
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'createUserId',
|
||||
title: '评论人',
|
||||
componentType: 'info',
|
||||
align: 'left',
|
||||
|
||||
width: 100,
|
||||
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'createDate',
|
||||
title: '评论时间',
|
||||
componentType: 'info',
|
||||
align: 'left',
|
||||
|
||||
width: 155,
|
||||
|
||||
sorter: true,
|
||||
},
|
||||
];
|
||||
//表单事件
|
||||
export const formEventConfigs = {
|
||||
0: [
|
||||
{
|
||||
type: 'circle',
|
||||
color: '#2774ff',
|
||||
text: '开始节点',
|
||||
icon: '#icon-kaishi',
|
||||
bgcColor: '#D8E5FF',
|
||||
isUserDefined: false,
|
||||
},
|
||||
{
|
||||
color: '#F6AB01',
|
||||
icon: '#icon-chushihua',
|
||||
text: '初始化表单',
|
||||
bgcColor: '#f9f5ea',
|
||||
isUserDefined: false,
|
||||
nodeInfo: { processEvent: [] },
|
||||
},
|
||||
],
|
||||
1: [
|
||||
{
|
||||
color: '#B36EDB',
|
||||
icon: '#icon-shujufenxi',
|
||||
text: '获取表单数据',
|
||||
detail: '(新增无此操作)',
|
||||
bgcColor: '#F8F2FC',
|
||||
isUserDefined: false,
|
||||
nodeInfo: { processEvent: [] },
|
||||
},
|
||||
],
|
||||
2: [
|
||||
{
|
||||
color: '#F8625C',
|
||||
icon: '#icon-jiazai',
|
||||
text: '加载表单',
|
||||
bgcColor: '#FFF1F1',
|
||||
isUserDefined: false,
|
||||
nodeInfo: { processEvent: [] },
|
||||
},
|
||||
],
|
||||
3: [
|
||||
{
|
||||
color: '#6C6AE0',
|
||||
icon: '#icon-jsontijiao',
|
||||
text: '提交表单',
|
||||
bgcColor: '#F5F4FF',
|
||||
isUserDefined: false,
|
||||
nodeInfo: { processEvent: [] },
|
||||
},
|
||||
],
|
||||
4: [
|
||||
{
|
||||
type: 'circle',
|
||||
color: '#F8625C',
|
||||
text: '结束节点',
|
||||
icon: '#icon-jieshuzhiliao',
|
||||
bgcColor: '#FFD6D6',
|
||||
isLast: true,
|
||||
isUserDefined: false,
|
||||
},
|
||||
],
|
||||
};
|
||||
export const formProps: FormProps = {
|
||||
labelCol: { span: 3, offset: 0 },
|
||||
labelAlign: 'right',
|
||||
layout: 'horizontal',
|
||||
size: 'default',
|
||||
schemas: [
|
||||
{
|
||||
key: '12e79f0dec5844aaa838379519fb6f53',
|
||||
field: '',
|
||||
label: '标题',
|
||||
type: 'title',
|
||||
component: 'Title',
|
||||
colProps: { span: 24 },
|
||||
defaultValue: '评论',
|
||||
componentProps: {
|
||||
defaultValue: '评论',
|
||||
color: '',
|
||||
align: 'left',
|
||||
fontSize: 18,
|
||||
isShow: true,
|
||||
style: {},
|
||||
},
|
||||
},
|
||||
{
|
||||
key: '8cdb900d6f1e43da9b9bf9eff0dc6676',
|
||||
field: 'businessCode',
|
||||
label: '评论对象编码',
|
||||
type: 'input',
|
||||
component: 'Input',
|
||||
colProps: { span: 24 },
|
||||
defaultValue: '',
|
||||
componentProps: {
|
||||
width: '100%',
|
||||
span: '',
|
||||
defaultValue: '',
|
||||
labelWidthMode: 'fix',
|
||||
labelFixWidth: 120,
|
||||
responsive: true,
|
||||
respNewRow: false,
|
||||
placeholder: '请输入评论对象编码',
|
||||
maxlength: null,
|
||||
prefix: '',
|
||||
suffix: '',
|
||||
addonBefore: '',
|
||||
addonAfter: '',
|
||||
disabled: true,
|
||||
allowClear: false,
|
||||
showLabel: true,
|
||||
required: false,
|
||||
rules: [],
|
||||
events: {},
|
||||
isSave: false,
|
||||
isShow: true,
|
||||
scan: false,
|
||||
style: { width: '100%' },
|
||||
},
|
||||
},
|
||||
{
|
||||
key: '8467356e88b1493da72c18031759dff6',
|
||||
field: 'businessId',
|
||||
label: '评论对象ID',
|
||||
type: 'input',
|
||||
component: 'Input',
|
||||
colProps: { span: 24 },
|
||||
defaultValue: '',
|
||||
componentProps: {
|
||||
width: '100%',
|
||||
span: '',
|
||||
defaultValue: '',
|
||||
labelWidthMode: 'fix',
|
||||
labelFixWidth: 120,
|
||||
responsive: false,
|
||||
respNewRow: false,
|
||||
placeholder: '请输入评论对象ID',
|
||||
maxlength: null,
|
||||
prefix: '',
|
||||
suffix: '',
|
||||
addonBefore: '',
|
||||
addonAfter: '',
|
||||
disabled: true,
|
||||
allowClear: false,
|
||||
showLabel: true,
|
||||
required: false,
|
||||
rules: [],
|
||||
events: {},
|
||||
isSave: false,
|
||||
isShow: true,
|
||||
scan: false,
|
||||
style: { width: '100%' },
|
||||
},
|
||||
},
|
||||
{
|
||||
key: '89b3809558b24be4b227c5fac140efb1',
|
||||
field: 'content',
|
||||
label: '评论内容',
|
||||
type: 'textarea',
|
||||
component: 'InputTextArea',
|
||||
colProps: { span: 24 },
|
||||
defaultValue: '',
|
||||
componentProps: {
|
||||
width: '100%',
|
||||
span: '',
|
||||
defaultValue: '',
|
||||
labelWidthMode: 'fix',
|
||||
labelFixWidth: 120,
|
||||
responsive: true,
|
||||
respNewRow: true,
|
||||
placeholder: '请输入评论内容',
|
||||
maxlength: null,
|
||||
rows: 4,
|
||||
autoSize: true,
|
||||
showCount: true,
|
||||
disabled: false,
|
||||
showLabel: true,
|
||||
allowClear: false,
|
||||
required: true,
|
||||
isShow: true,
|
||||
rules: [],
|
||||
events: {},
|
||||
style: { width: '100%' },
|
||||
},
|
||||
},
|
||||
{
|
||||
key: '218eb20ead9d44288d41411a2addf8b4',
|
||||
field: 'attachs',
|
||||
label: '附件',
|
||||
type: 'upload',
|
||||
component: 'Upload',
|
||||
colProps: { span: 24 },
|
||||
componentProps: {
|
||||
api: uploadApi,
|
||||
labelWidthMode: 'fix',
|
||||
labelFixWidth: 120,
|
||||
span: '',
|
||||
defaultValue: [],
|
||||
accept: '',
|
||||
maxNumber: 5,
|
||||
maxSize: 5,
|
||||
showLabel: true,
|
||||
multiple: true,
|
||||
disabled: false,
|
||||
required: false,
|
||||
isShow: true,
|
||||
events: {},
|
||||
listType: 'text',
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'af68831756f44504906f8ede2f968ff4',
|
||||
field: 'createUserId',
|
||||
label: '评论人',
|
||||
type: 'info',
|
||||
component: 'Info',
|
||||
colProps: { span: 24 },
|
||||
componentProps: {
|
||||
span: '',
|
||||
width: '100%',
|
||||
placeholder: '',
|
||||
infoType: 0,
|
||||
labelWidthMode: 'fix',
|
||||
labelFixWidth: 120,
|
||||
responsive: true,
|
||||
respNewRow: false,
|
||||
loadAgain: false,
|
||||
showLabel: true,
|
||||
disabled: true,
|
||||
isShow: true,
|
||||
respBreakLine: true,
|
||||
style: { width: '100%' },
|
||||
},
|
||||
},
|
||||
{
|
||||
key: 'fc322d37de464b51a16a09290a19219c',
|
||||
field: 'createDate',
|
||||
label: '评论时间',
|
||||
type: 'info',
|
||||
component: 'Info',
|
||||
colProps: { span: 24 },
|
||||
componentProps: {
|
||||
span: '',
|
||||
width: '100%',
|
||||
placeholder: '',
|
||||
infoType: 2,
|
||||
labelWidthMode: 'fix',
|
||||
labelFixWidth: 120,
|
||||
responsive: true,
|
||||
respNewRow: false,
|
||||
loadAgain: false,
|
||||
showLabel: true,
|
||||
disabled: true,
|
||||
isShow: true,
|
||||
style: { width: '100%' },
|
||||
},
|
||||
},
|
||||
],
|
||||
showActionButtonGroup: false,
|
||||
buttonLocation: 'center',
|
||||
actionColOptions: { span: 24 },
|
||||
showResetButton: false,
|
||||
showSubmitButton: false,
|
||||
hiddenComponent: [],
|
||||
};
|
||||
107
src/views/system/comment/components/workflowPermission.ts
Normal file
107
src/views/system/comment/components/workflowPermission.ts
Normal file
@ -0,0 +1,107 @@
|
||||
export const permissionList = [
|
||||
{
|
||||
required: false,
|
||||
view: true,
|
||||
edit: false,
|
||||
disabled: true,
|
||||
isSaveTable: false,
|
||||
tableName: '',
|
||||
fieldName: '标题',
|
||||
fieldId: '',
|
||||
isSubTable: false,
|
||||
showChildren: true,
|
||||
type: 'title',
|
||||
key: '12e79f0dec5844aaa838379519fb6f53',
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSaveTable: false,
|
||||
tableName: '',
|
||||
fieldName: '评论对象编码',
|
||||
fieldId: 'businessCode',
|
||||
isSubTable: false,
|
||||
showChildren: true,
|
||||
type: 'input',
|
||||
key: '8cdb900d6f1e43da9b9bf9eff0dc6676',
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSaveTable: false,
|
||||
tableName: '',
|
||||
fieldName: '评论对象ID',
|
||||
fieldId: 'businessId',
|
||||
isSubTable: false,
|
||||
showChildren: true,
|
||||
type: 'input',
|
||||
key: '8467356e88b1493da72c18031759dff6',
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSaveTable: false,
|
||||
tableName: '',
|
||||
fieldName: '评论内容',
|
||||
fieldId: 'content',
|
||||
isSubTable: false,
|
||||
showChildren: true,
|
||||
type: 'textarea',
|
||||
key: '89b3809558b24be4b227c5fac140efb1',
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
required: true,
|
||||
view: true,
|
||||
edit: true,
|
||||
disabled: false,
|
||||
isSaveTable: false,
|
||||
tableName: '',
|
||||
fieldName: '附件',
|
||||
fieldId: 'attachs',
|
||||
isSubTable: false,
|
||||
showChildren: true,
|
||||
type: 'upload',
|
||||
key: '218eb20ead9d44288d41411a2addf8b4',
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
required: false,
|
||||
view: true,
|
||||
edit: false,
|
||||
disabled: true,
|
||||
isSaveTable: false,
|
||||
tableName: '',
|
||||
fieldName: '评论人',
|
||||
fieldId: 'createUserId',
|
||||
isSubTable: false,
|
||||
showChildren: true,
|
||||
type: 'info',
|
||||
key: 'af68831756f44504906f8ede2f968ff4',
|
||||
children: [],
|
||||
},
|
||||
{
|
||||
required: false,
|
||||
view: true,
|
||||
edit: false,
|
||||
disabled: true,
|
||||
isSaveTable: false,
|
||||
tableName: '',
|
||||
fieldName: '评论时间',
|
||||
fieldId: 'createDate',
|
||||
isSubTable: false,
|
||||
showChildren: true,
|
||||
type: 'info',
|
||||
key: 'fc322d37de464b51a16a09290a19219c',
|
||||
children: [],
|
||||
},
|
||||
];
|
||||
419
src/views/system/comment/index.vue
Normal file
419
src/views/system/comment/index.vue
Normal file
@ -0,0 +1,419 @@
|
||||
<template>
|
||||
<PageWrapper dense fixedHeight contentFullHeight contentClass="flex">
|
||||
|
||||
|
||||
<BasicTable @register="registerTable" ref="tableRef" :row-selection="{ selectedRowKeys: selectedKeys, onChange: onSelectChange }" @row-dbClick="dbClickRow">
|
||||
|
||||
<template #toolbar>
|
||||
<template v-for="button in tableButtonConfig" :key="button.code">
|
||||
<a-button v-if="button.isDefault" :type="button.type" @click="buttonClick(button.code)">
|
||||
<template #icon><Icon :icon="button.icon" /></template>
|
||||
{{ button.name }}
|
||||
</a-button>
|
||||
<a-button v-else :type="button.type">
|
||||
<template #icon><Icon :icon="button.icon" /></template>
|
||||
{{ button.name }}
|
||||
</a-button>
|
||||
</template>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
|
||||
|
||||
|
||||
<template v-if="column.dataIndex === 'action'">
|
||||
<TableAction :actions="getActions(record)" />
|
||||
</template>
|
||||
</template>
|
||||
</BasicTable>
|
||||
|
||||
|
||||
|
||||
<CommentModal @register="registerModal" @success="handleSuccess" />
|
||||
<ImportModal @register="registerImportModal" importUrl="/system/comment/import" @success="handleImportSuccess"/>
|
||||
|
||||
</PageWrapper>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed, onMounted, onUnmounted, createVNode,
|
||||
|
||||
} from 'vue';
|
||||
|
||||
import { Modal } from 'ant-design-vue';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
|
||||
import { getXjrCommentPage, deleteXjrComment, exportXjrComment} from '/@/api/system/comment';
|
||||
import { PageWrapper } from '/@/components/Page';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
import { usePermission } from '/@/hooks/web/usePermission';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { getXjrComment } from '/@/api/system/comment';
|
||||
|
||||
|
||||
|
||||
|
||||
import { useModal } from '/@/components/Modal';
|
||||
|
||||
|
||||
|
||||
import CommentModal from './components/CommentModal.vue';
|
||||
|
||||
|
||||
import { ImportModal } from '/@/components/Import';
|
||||
import { downloadByData } from '/@/utils/file/download';
|
||||
|
||||
|
||||
import { searchFormSchema, columns } from './components/config';
|
||||
import Icon from '/@/components/Icon/index';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import useEventBus from '/@/hooks/event/useEventBus';
|
||||
|
||||
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
|
||||
|
||||
const { notification } = useMessage();
|
||||
const { t } = useI18n();
|
||||
defineEmits(['register']);
|
||||
const { filterColumnAuth, filterButtonAuth } = usePermission();
|
||||
|
||||
const filterColumns = filterColumnAuth(columns);
|
||||
const tableRef = ref();
|
||||
|
||||
//展示在列表内的按钮
|
||||
const actionButtons = ref<string[]>(['view', 'edit', 'copyData', 'delete', 'startwork','flowRecord']);
|
||||
const buttonConfigs = computed(()=>{
|
||||
const list = [{"isUse":true,"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"type":"primary"},{"isUse":true,"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true},{"isUse":true,"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true},{"isUse":true,"name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true},{"isUse":true,"name":"批量删除","code":"batchdelete","icon":"ant-design:delete-outlined","isDefault":true},{"isUse":true,"name":"复制数据","code":"copyData","icon":"ant-design:copy-outlined","isDefault":true},{"isUse":true,"name":"快速导入","code":"import","icon":"ant-design:import-outlined","isDefault":true},{"isUse":true,"name":"快速导出","code":"export","icon":"ant-design:export-outlined","isDefault":true},{"isUse":true,"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true}]
|
||||
return filterButtonAuth(list);
|
||||
})
|
||||
|
||||
const tableButtonConfig = computed(() => {
|
||||
return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
|
||||
});
|
||||
|
||||
const actionButtonConfig = computed(() => {
|
||||
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
|
||||
});
|
||||
|
||||
const btnEvent = {add : handleAdd,edit : handleEdit,refresh : handleRefresh,view : handleView,batchdelete : handleBatchdelete,copyData : handleCopyData,import : handleImport,export : handleExport,delete : handleDelete,}
|
||||
|
||||
const { currentRoute } = useRouter();
|
||||
const router = useRouter();
|
||||
|
||||
|
||||
const formIdComputedRef = ref();
|
||||
formIdComputedRef.value = currentRoute.value.meta.formId
|
||||
const schemaIdComputedRef = ref();
|
||||
schemaIdComputedRef.value = currentRoute.value.meta.schemaId
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const selectedKeys = ref<string[]>([]);
|
||||
const selectedRowsData = ref<any[]>([]);
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const [registerImportModal, { openModal: openImportModal }] = useModal();
|
||||
|
||||
const formName='评论';
|
||||
const [registerTable, { reload, }] = useTable({
|
||||
title: '' || (formName + '列表'),
|
||||
api: getXjrCommentPage,
|
||||
rowKey: 'id',
|
||||
columns: filterColumns,
|
||||
formConfig: {
|
||||
rowProps: {
|
||||
gutter: 16,
|
||||
},
|
||||
schemas: searchFormSchema,
|
||||
fieldMapToTime: [['createDate', ['createDateStart', 'createDateEnd'], 'YYYY-MM-DD HH:mm:ss ', true],],
|
||||
showResetButton: false,
|
||||
},
|
||||
beforeFetch: (params) => {
|
||||
return { ...params, FormId: formIdComputedRef.value, PK: 'id' };
|
||||
},
|
||||
afterFetch: (res) => {
|
||||
tableRef.value.setToolBarWidth();
|
||||
|
||||
},
|
||||
useSearchForm: true,
|
||||
showTableSetting: true,
|
||||
|
||||
striped: false,
|
||||
actionColumn: {
|
||||
width: 160,
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
slots: { customRender: 'action' },
|
||||
},
|
||||
tableSetting: {
|
||||
size: false,
|
||||
setting: false,
|
||||
},
|
||||
customRow,
|
||||
});
|
||||
|
||||
function dbClickRow(record) {
|
||||
const { processId, taskIds, schemaId } = record.workflowData || {};
|
||||
if (taskIds && taskIds.length) {
|
||||
router.push({
|
||||
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
|
||||
query: {
|
||||
taskId: taskIds[0],
|
||||
formName: formName
|
||||
}
|
||||
});
|
||||
} else if (schemaId && !taskIds && processId) {
|
||||
router.push({
|
||||
path: '/flow/' + schemaId + '/' + processId + '/approveFlow',
|
||||
query: {
|
||||
readonly: 1,
|
||||
taskId: '',
|
||||
formName: formName
|
||||
}
|
||||
});
|
||||
} else {
|
||||
router.push({
|
||||
path: '/form/comment/' + record.id + '/viewForm',
|
||||
query: {
|
||||
formPath: 'system/comment',
|
||||
formName: formName
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function buttonClick(code) {
|
||||
|
||||
btnEvent[code]();
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
if (schemaIdComputedRef.value) {
|
||||
router.push({
|
||||
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow'
|
||||
});
|
||||
} else {
|
||||
router.push({
|
||||
path: '/form/comment/0/createForm',
|
||||
query: {
|
||||
formPath: 'system/comment',
|
||||
formName: formName
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function handleEdit(record: Recordable) {
|
||||
|
||||
router.push({
|
||||
path: '/form/comment/' + record.id + '/updateForm',
|
||||
query: {
|
||||
formPath: 'system/comment',
|
||||
formName: formName
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function handleCopyData(record: Recordable) {
|
||||
/*//弹框添加数据
|
||||
|
||||
openModal(true, {
|
||||
id: record.id,
|
||||
isCopy: true,
|
||||
});*/
|
||||
|
||||
const result = await getXjrComment(record['id']);
|
||||
const form={};
|
||||
const key="form_copy_"+record['id'];
|
||||
form[key]=result;
|
||||
localStorage.setItem('formJsonStr', JSON.stringify(form));
|
||||
|
||||
const schemaId=record.workflowData?.schemaId||schemaIdComputedRef.value;
|
||||
if(schemaId){
|
||||
router.push({
|
||||
path: '/flow/' + schemaId + '/0/createFlow',
|
||||
query: {
|
||||
fromKey: key
|
||||
}
|
||||
});
|
||||
}else{
|
||||
router.push({
|
||||
path: '/form/comment/0/createForm',
|
||||
query: {
|
||||
formPath: 'system/comment',
|
||||
formName: formName,
|
||||
fromKey: key
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function handleDelete(record: Recordable) {
|
||||
deleteList([record.id]);
|
||||
}
|
||||
|
||||
function handleBatchdelete() {
|
||||
if (!selectedKeys.value.length) {
|
||||
notification.warning({
|
||||
message: 'Tip',
|
||||
description: t('请选择需要删除的数据'),
|
||||
});
|
||||
return;
|
||||
}
|
||||
//与工作流相关的数据不能进行批量删除
|
||||
const cantDelete = selectedRowsData.value.filter((x) => {
|
||||
return (
|
||||
(x.workflowData?.enabled && x.workflowData?.status) ||
|
||||
(!x.workflowData?.enabled && !!x.workflowData?.processId)
|
||||
);
|
||||
});
|
||||
if (cantDelete.length) {
|
||||
notification.warning({
|
||||
message: 'Tip',
|
||||
description: t('含有不能删除的数据'),
|
||||
});
|
||||
return;
|
||||
}
|
||||
deleteList(selectedKeys.value);
|
||||
}
|
||||
function deleteList(ids) {
|
||||
Modal.confirm({
|
||||
title: '提示信息',
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
content: '是否确认删除?',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk() {
|
||||
deleteXjrComment(ids).then((_) => {
|
||||
handleSuccess();
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
description: t('删除成功!'),
|
||||
});
|
||||
});
|
||||
},
|
||||
onCancel() {},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function onSelectChange(selectedRowKeys: [], selectedRows) {
|
||||
selectedKeys.value = selectedRowKeys;
|
||||
selectedRowsData.value = selectedRows;
|
||||
}
|
||||
|
||||
function customRow(record: Recordable) {
|
||||
return {
|
||||
onClick: () => {
|
||||
let selectedRowKeys = [...selectedKeys.value];
|
||||
if (selectedRowKeys.indexOf(record.id) >= 0) {
|
||||
let index = selectedRowKeys.indexOf(record.id);
|
||||
selectedRowKeys.splice(index, 1);
|
||||
} else {
|
||||
selectedRowKeys.push(record.id);
|
||||
}
|
||||
selectedKeys.value = selectedRowKeys;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function handleRefresh() {
|
||||
reload();
|
||||
}
|
||||
function handleSuccess() {
|
||||
|
||||
selectedKeys.value = [];
|
||||
selectedRowsData.value = [];
|
||||
reload();
|
||||
}
|
||||
|
||||
function handleView(record: Recordable) {
|
||||
|
||||
dbClickRow(record);
|
||||
|
||||
}
|
||||
|
||||
async function handleExport() {
|
||||
const res = await exportXjrComment({ isTemplate: false });
|
||||
downloadByData(
|
||||
res.data,
|
||||
'Comment.xlsx',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
);
|
||||
}
|
||||
|
||||
function handleImport() {
|
||||
openImportModal(true, {
|
||||
title: '快速导入',
|
||||
downLoadUrl:'/system/comment/export',
|
||||
});
|
||||
}
|
||||
function handleImportSuccess(){
|
||||
reload()
|
||||
}
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
if (schemaIdComputedRef.value) {
|
||||
bus.on(FLOW_PROCESSED, handleRefresh);
|
||||
bus.on(CREATE_FLOW, handleRefresh);
|
||||
} else {
|
||||
bus.on(FORM_LIST_MODIFIED, handleRefresh);
|
||||
}
|
||||
});
|
||||
onUnmounted(() => {
|
||||
if (schemaIdComputedRef.value) {
|
||||
bus.off(FLOW_PROCESSED, handleRefresh);
|
||||
bus.off(CREATE_FLOW, handleRefresh);
|
||||
} else {
|
||||
bus.off(FORM_LIST_MODIFIED, handleRefresh);
|
||||
}
|
||||
});
|
||||
function getActions(record: Recordable):ActionItem[] {
|
||||
|
||||
const actionsList: ActionItem[] = actionButtonConfig.value?.map((button) => {
|
||||
if (!record.workflowData?.processId) {
|
||||
return {
|
||||
icon: button?.icon,
|
||||
tooltip: button?.name,
|
||||
color: button.code === 'delete' ? 'error' : undefined,
|
||||
onClick: btnEvent[button.code].bind(null, record),
|
||||
};
|
||||
} else {
|
||||
if (button.code === 'view') {
|
||||
return {
|
||||
icon: button?.icon,
|
||||
tooltip: button?.name,
|
||||
onClick: btnEvent[button.code].bind(null, record),
|
||||
};
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
});
|
||||
return actionsList;
|
||||
}
|
||||
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
:deep(.ant-table-selection-col) {
|
||||
width: 50px;
|
||||
}
|
||||
.show{
|
||||
display: flex;
|
||||
}
|
||||
.hide{
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
@ -87,7 +87,7 @@
|
||||
//展示在列表内的按钮
|
||||
const actionButtons = ref<string[]>(['view', 'edit', 'copyData', 'delete', 'startwork','flowRecord']);
|
||||
const buttonConfigs = computed(()=>{
|
||||
const list = [{"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"isUse":true},{"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true,"isUse":true},{"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true,"isUse":true},{"name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true,"isUse":true},{"name":"批量删除","code":"batchdelete","icon":"ant-design:delete-outlined","isDefault":true,"isUse":true},{"name":"复制数据","code":"copyData","icon":"ant-design:copy-outlined","isDefault":true,"isUse":true},{"name":"快速导入","code":"import","icon":"ant-design:import-outlined","isDefault":true,"isUse":true},{"name":"快速导出","code":"export","icon":"ant-design:export-outlined","isDefault":true,"isUse":true},{"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true,"isUse":true}]
|
||||
const list = [{"name":"新增","type":"primary","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"isUse":true},{"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true,"isUse":true},{"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true,"isUse":true},{"name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true,"isUse":true},{"name":"批量删除","code":"batchdelete","icon":"ant-design:delete-outlined","isDefault":true,"isUse":true},{"name":"复制数据","code":"copyData","icon":"ant-design:copy-outlined","isDefault":true,"isUse":true},{"name":"快速导入","code":"import","icon":"ant-design:import-outlined","isDefault":true,"isUse":true},{"name":"快速导出","code":"export","icon":"ant-design:export-outlined","isDefault":true,"isUse":true},{"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true,"isUse":true}]
|
||||
return filterButtonAuth(list);
|
||||
})
|
||||
|
||||
|
||||
@ -87,7 +87,7 @@
|
||||
//展示在列表内的按钮
|
||||
const actionButtons = ref<string[]>(['view', 'edit', 'copyData', 'delete', 'startwork','flowRecord']);
|
||||
const buttonConfigs = computed(()=>{
|
||||
const list = [{"isUse":true,"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"type":"primary"},{"isUse":true,"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true},{"isUse":true,"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true},{"isUse":true,"name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true},{"isUse":true,"name":"复制数据","code":"copyData","icon":"ant-design:copy-outlined","isDefault":true},{"isUse":true,"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true}]
|
||||
const list = [{"isUse":true,"name":"新增","type":"primary","code":"add","icon":"ant-design:plus-outlined","isDefault":true},{"isUse":true,"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true},{"isUse":true,"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true},{"isUse":true,"name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true},{"isUse":true,"name":"复制数据","code":"copyData","icon":"ant-design:copy-outlined","isDefault":true},{"isUse":true,"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true}]
|
||||
return filterButtonAuth(list);
|
||||
})
|
||||
|
||||
|
||||
@ -1,4 +1,7 @@
|
||||
<template>
|
||||
<div style="margin:20px;">
|
||||
当前流程审批人:{{currentTaskAssignee.replaceAll(",","、")}}
|
||||
</div>
|
||||
<!-- 流程信息 -->
|
||||
<div class="flow-record-box">
|
||||
<div id="bpmnCanvas" class="canvas" ref="bpmnCanvas"></div>
|
||||
@ -18,10 +21,12 @@
|
||||
defineProps<{
|
||||
xml: string;
|
||||
processId: string;
|
||||
currentTaskAssignee: string;
|
||||
}>(),
|
||||
{
|
||||
xml: '',
|
||||
processId: '',
|
||||
currentTaskAssignee:'无'
|
||||
},
|
||||
);
|
||||
const bpmnCanvas = ref();
|
||||
|
||||
@ -31,6 +31,7 @@ export default function () {
|
||||
hasStampPassword: false,
|
||||
submitLoading: false,
|
||||
formAssignmentData: null,
|
||||
currentTaskAssignee: '',
|
||||
});
|
||||
function initProcessData(res: FlowInfo) {
|
||||
data.item.id = res.schemaInfo.id;
|
||||
@ -44,6 +45,10 @@ export default function () {
|
||||
data.hasStamp = false;
|
||||
data.hasStampPassword = false;
|
||||
data.submitLoading = false;
|
||||
data.currentTaskAssignee = '无';
|
||||
if (res.currentTaskAssigneeNames) {
|
||||
data.currentTaskAssignee = res.currentTaskAssigneeNames;
|
||||
}
|
||||
data.xml = '';
|
||||
if (res.schemaInfo.xmlContent) {
|
||||
data.xml = res.schemaInfo.xmlContent;
|
||||
|
||||
Reference in New Issue
Block a user