!118 Merge branch 'refs/heads/master' into wsq-20260727
Merge pull request !118 from 王淑勤/wsq-20260727
This commit is contained in:
@@ -195,9 +195,11 @@ async function handleUpload() {
|
||||
});
|
||||
} else {
|
||||
failCount++;
|
||||
console.error('[SUploadFile] 上传响应未通过校验:', result);
|
||||
}
|
||||
} else {
|
||||
failCount++;
|
||||
console.error('[SUploadFile] 上传请求失败:', r.reason);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -206,12 +208,16 @@ async function handleUpload() {
|
||||
emit('upload-success', { success: true, results: successResults });
|
||||
handleCancel();
|
||||
} else {
|
||||
createMessage.error('所有文件上传失败');
|
||||
const firstResult = results.find(r => r.status === 'fulfilled')?.value?.response?.data;
|
||||
const firstReason = results.find(r => r.status === 'rejected')?.reason;
|
||||
const serverMsg = firstResult?.message ? `:${firstResult.message}` : '';
|
||||
const debugMsg = firstResult ? `:${JSON.stringify(firstResult).slice(0, 200)}` : (firstReason ? `:${firstReason?.message || firstReason}` : '');
|
||||
createMessage.error('所有文件上传失败' + serverMsg + debugMsg);
|
||||
emit('upload-error', new Error('所有文件上传失败'));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('上传失败:', error);
|
||||
createMessage.error('文件上传失败');
|
||||
createMessage.error('文件上传失败: ' + (error?.message || error));
|
||||
emit('upload-error', error);
|
||||
} finally {
|
||||
uploading.value = false;
|
||||
|
||||
@@ -14,6 +14,7 @@ enum Api {
|
||||
queryDataById = '/improvementproposal/improvementProposal/queryById',
|
||||
improvementDeptScoreList = '/improvementproposal/improvementProposal/queryImprovementDeptScoreByMainId',
|
||||
improvementInstituteVoteList = '/improvementproposal/improvementProposal/queryImprovementInstituteVoteByMainId',
|
||||
getLatestProposalSequence = '/improvementproposal/improvementProposal/getLatestProposalSequence',
|
||||
startProcess = '/improvementproposal/improvementProposal/startProcess',
|
||||
bpmInitialReview = '/improvementproposal/improvementProposal/bpm/initialReview',
|
||||
bpmLeaderAward = '/improvementproposal/improvementProposal/bpm/leaderAward',
|
||||
@@ -90,6 +91,12 @@ export const saveOrUpdate = (params, isUpdate) => {
|
||||
*/
|
||||
export const queryDataById = (id) => defHttp.get({url: Api.queryDataById, params:{ id }});
|
||||
|
||||
/**
|
||||
* 查询当前年份最新提案序号
|
||||
* @param year 年份
|
||||
*/
|
||||
export const getLatestProposalSequence = (year) => defHttp.get({url: Api.getLatestProposalSequence, params:{ year }}, { successMessageMode: 'none' });
|
||||
|
||||
/** 发起改善提案审批流程。 */
|
||||
export const startProposalProcess = (id: string) => defHttp.post({ url: Api.startProcess, params: { id } });
|
||||
|
||||
|
||||
@@ -25,21 +25,21 @@ export const columns: BasicColumn[] = [
|
||||
return text;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '提案部门ID',
|
||||
align:"center",
|
||||
dataIndex: 'proposalDeptId'
|
||||
},
|
||||
// {
|
||||
// title: '提案部门ID',
|
||||
// align:"center",
|
||||
// dataIndex: 'proposalDeptId'
|
||||
// },
|
||||
{
|
||||
title: '提案部门名称',
|
||||
align:"center",
|
||||
dataIndex: 'proposalDeptName'
|
||||
},
|
||||
{
|
||||
title: '申请人ID',
|
||||
align:"center",
|
||||
dataIndex: 'applicantId'
|
||||
},
|
||||
// {
|
||||
// title: '申请人ID',
|
||||
// align:"center",
|
||||
// dataIndex: 'applicantId'
|
||||
// },
|
||||
{
|
||||
title: '申请人姓名',
|
||||
align:"center",
|
||||
@@ -53,7 +53,7 @@ export const columns: BasicColumn[] = [
|
||||
{
|
||||
title: '提案类别',
|
||||
align:"center",
|
||||
dataIndex: 'proposalCategory'
|
||||
dataIndex: 'proposalCategory_dictText'
|
||||
},
|
||||
{
|
||||
title: '问题描述',
|
||||
@@ -65,15 +65,15 @@ export const columns: BasicColumn[] = [
|
||||
align:"center",
|
||||
dataIndex: 'improvementMethod'
|
||||
},
|
||||
{
|
||||
title: '最终奖项',
|
||||
align:"center",
|
||||
dataIndex: 'finalAward'
|
||||
},
|
||||
// {
|
||||
// title: '最终奖项',
|
||||
// align:"center",
|
||||
// dataIndex: 'finalAward'
|
||||
// },
|
||||
{
|
||||
title: '业务展示状态',
|
||||
align:"center",
|
||||
dataIndex: 'bpmStatus'
|
||||
dataIndex: 'bpmStatus_dictText'
|
||||
},
|
||||
];
|
||||
|
||||
@@ -272,9 +272,9 @@ export const superQuerySchema = {
|
||||
proposalNo: {title: '提案编号',order: 0,view: 'text', type: 'string',},
|
||||
proposalName: {title: '提案名称',order: 1,view: 'text', type: 'string',},
|
||||
proposalDate: {title: '提出日期',order: 2,view: 'date', type: 'string',},
|
||||
proposalDeptId: {title: '提案部门ID',order: 3,view: 'text', type: 'string',},
|
||||
// proposalDeptId: {title: '提案部门ID',order: 3,view: 'text', type: 'string',},
|
||||
proposalDeptName: {title: '提案部门名称',order: 4,view: 'text', type: 'string',},
|
||||
applicantId: {title: '申请人ID',order: 5,view: 'text', type: 'string',},
|
||||
// applicantId: {title: '申请人ID',order: 5,view: 'text', type: 'string',},
|
||||
applicantName: {title: '申请人姓名',order: 6,view: 'text', type: 'string',},
|
||||
teamName: {title: '团队名称',order: 7,view: 'text', type: 'string',},
|
||||
proposalCategory: {title: '提案类别',order: 8,view: 'text', type: 'string',},
|
||||
|
||||
@@ -13,7 +13,19 @@
|
||||
<a-col :lg="6">
|
||||
<a-form-item name="proposalCategory">
|
||||
<template #label><span title="提案类别">提案类别</span></template>
|
||||
<JInput v-model:value="queryParam.proposalCategory"/>
|
||||
<JDictSelectTag v-model:value="queryParam.proposalCategory" dictCode="proposal_category" placeholder="请选择提案类别" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col v-if="toggleSearchStatus" :lg="6">
|
||||
<a-form-item name="bpmStatus">
|
||||
<template #label><span title="业务展示状态">业务展示状态</span></template>
|
||||
<JDictSelectTag v-model:value="queryParam.bpmStatus" dictCode="super_status" placeholder="请选择业务展示状态" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col v-if="toggleSearchStatus" :lg="6">
|
||||
<a-form-item name="proposalDeptId">
|
||||
<template #label><span title="提案部门">提案部门</span></template>
|
||||
<JDictSelectTag v-model:value="queryParam.proposalDeptId" dictCode="sys_depart,depart_name,id" placeholder="请选择提案部门" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||
@@ -79,6 +91,7 @@
|
||||
import {list, deleteOne, batchDelete, getImportUrl, getExportUrl, startProposalProcess} from './ImprovementProposal.api';
|
||||
import {downloadFile} from '/@/utils/common/renderUtils';
|
||||
import JInput from "/@/components/Form/src/jeecg/components/JInput.vue";
|
||||
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
||||
|
||||
const [registerBpmModal, { openModal: bpmPicModal }] = useModal();
|
||||
const formRef = ref();
|
||||
|
||||
@@ -5,8 +5,13 @@
|
||||
<a-form v-bind="formItemLayout" name="ImprovementProposalForm" ref="formRef">
|
||||
<a-row>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="提案编号" v-bind="validateInfos.proposalNo" id="ImprovementProposalForm-proposalNo" name="proposalNo">
|
||||
<a-input v-model:value="formData.proposalNo" placeholder="请输入提案编号" allow-clear ></a-input>
|
||||
<a-form-item label="提案编号" :required="false" id="ImprovementProposalForm-proposalNo" name="proposalNo">
|
||||
<a-input v-model:value="formData.proposalNo" :disabled="true" allow-clear></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="提出日期" id="ImprovementProposalForm-proposalDate" name="proposalDate">
|
||||
<a-input v-model:value="formData.proposalDate" :disabled="true" allow-clear></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
@@ -14,28 +19,18 @@
|
||||
<a-input v-model:value="formData.proposalName" placeholder="请输入提案名称" allow-clear ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="提案类别" v-bind="validateInfos.proposalCategory" id="ImprovementProposalForm-proposalCategory" name="proposalCategory">
|
||||
<j-dict-select-tag v-model:value="formData.proposalCategory" dictCode="proposal_category" placeholder="请选择提案类别" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="提出日期" v-bind="validateInfos.proposalDate" id="ImprovementProposalForm-proposalDate" name="proposalDate">
|
||||
<a-date-picker placeholder="请选择提出日期" v-model:value="formData.proposalDate" value-format="YYYY-MM-DD" style="width: 100%" allow-clear />
|
||||
<a-form-item label="提案部门" :required="false" id="ImprovementProposalForm-proposalDeptId" name="proposalDeptId">
|
||||
<a-input v-model:value="formData.proposalDeptName" :disabled="true" allow-clear></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="提案部门ID" v-bind="validateInfos.proposalDeptId" id="ImprovementProposalForm-proposalDeptId" name="proposalDeptId">
|
||||
<a-input v-model:value="formData.proposalDeptId" placeholder="请输入提案部门ID" allow-clear ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="提案部门名称" v-bind="validateInfos.proposalDeptName" id="ImprovementProposalForm-proposalDeptName" name="proposalDeptName">
|
||||
<a-input v-model:value="formData.proposalDeptName" placeholder="请输入提案部门名称" allow-clear ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="申请人ID" v-bind="validateInfos.applicantId" id="ImprovementProposalForm-applicantId" name="applicantId">
|
||||
<a-input v-model:value="formData.applicantId" placeholder="请输入申请人ID" allow-clear ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="申请人姓名" v-bind="validateInfos.applicantName" id="ImprovementProposalForm-applicantName" name="applicantName">
|
||||
<a-form-item label="提案人" v-bind="validateInfos.applicantName" id="ImprovementProposalForm-applicantName" name="applicantName">
|
||||
<a-input v-model:value="formData.applicantName" placeholder="请输入申请人姓名" allow-clear ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
@@ -44,39 +39,40 @@
|
||||
<a-input v-model:value="formData.teamName" placeholder="请输入团队名称" allow-clear ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="提案类别" v-bind="validateInfos.proposalCategory" id="ImprovementProposalForm-proposalCategory" name="proposalCategory">
|
||||
<a-input v-model:value="formData.proposalCategory" placeholder="请输入提案类别" allow-clear ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="问题描述" v-bind="validateInfos.problemDesc" id="ImprovementProposalForm-problemDesc" name="problemDesc">
|
||||
|
||||
<a-col :span="24">
|
||||
<a-form-item label="问题描述" v-bind="validateInfos.problemDesc" id="ImprovementProposalForm-problemDesc" name="problemDesc" :labelCol="longLabelCol" :wrapperCol="longWrapperCol">
|
||||
<a-textarea v-model:value="formData.problemDesc" :rows="4" placeholder="请输入问题描述" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="改善方法及措施" v-bind="validateInfos.improvementMethod" id="ImprovementProposalForm-improvementMethod" name="improvementMethod">
|
||||
<a-col :span="24">
|
||||
<a-form-item label="改善方法及措施" v-bind="validateInfos.improvementMethod" id="ImprovementProposalForm-improvementMethod" name="improvementMethod" :labelCol="longLabelCol" :wrapperCol="longWrapperCol">
|
||||
<a-textarea v-model:value="formData.improvementMethod" :rows="4" placeholder="请输入改善方法及措施" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="改善前情况描述" v-bind="validateInfos.beforeDesc" id="ImprovementProposalForm-beforeDesc" name="beforeDesc">
|
||||
<a-form-item label="改善前情况描述" v-bind="validateInfos.beforeDesc" id="ImprovementProposalForm-beforeDesc" name="beforeDesc" :labelCol="halfLabelCol" :wrapperCol="halfWrapperCol">
|
||||
<a-textarea v-model:value="formData.beforeDesc" :rows="4" placeholder="请输入改善前情况描述" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="改善后情况描述" v-bind="validateInfos.afterDesc" id="ImprovementProposalForm-afterDesc" name="afterDesc">
|
||||
<a-form-item label="改善前图片" :labelCol="halfLabelCol" :wrapperCol="halfWrapperCol">
|
||||
<SUploadFile ref="beforeFileRef" :bussiness-id="formData.id ? `${formData.id}:before` : ''" :multiple="true" :disabled="disabled" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="改善后情况描述" v-bind="validateInfos.afterDesc" id="ImprovementProposalForm-afterDesc" name="afterDesc" :labelCol="halfLabelCol" :wrapperCol="halfWrapperCol">
|
||||
<a-textarea v-model:value="formData.afterDesc" :rows="4" placeholder="请输入改善后情况描述" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="改善效果" v-bind="validateInfos.improvementEffect" id="ImprovementProposalForm-improvementEffect" name="improvementEffect">
|
||||
<a-textarea v-model:value="formData.improvementEffect" :rows="4" placeholder="请输入改善效果" />
|
||||
<a-form-item label="改善后图片" :labelCol="halfLabelCol" :wrapperCol="halfWrapperCol">
|
||||
<SUploadFile ref="afterFileRef" :bussiness-id="formData.id ? `${formData.id}:after` : ''" :multiple="true" :disabled="disabled" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item label="最终奖项" v-bind="validateInfos.finalAward" id="ImprovementProposalForm-finalAward" name="finalAward">
|
||||
<a-input v-model:value="formData.finalAward" placeholder="请输入最终奖项" disabled allow-clear ></a-input>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="改善效果" v-bind="validateInfos.improvementEffect" id="ImprovementProposalForm-improvementEffect" name="improvementEffect" :labelCol="longLabelCol" :wrapperCol="longWrapperCol">
|
||||
<a-textarea v-model:value="formData.improvementEffect" :rows="4" placeholder="请输入改善效果" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
@@ -122,14 +118,17 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref, reactive, computed, toRaw, onMounted } from 'vue';
|
||||
import { defineComponent, ref, reactive, computed, toRaw, onMounted, nextTick } from 'vue';
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useValidateAntFormAndTable } from '/@/hooks/system/useJvxeMethods';
|
||||
import { queryImprovementDeptScoreListByMainId, queryImprovementInstituteVoteListByMainId, queryDataById, saveOrUpdate } from '../ImprovementProposal.api';
|
||||
import { queryImprovementDeptScoreListByMainId, queryImprovementInstituteVoteListByMainId, queryDataById, saveOrUpdate, getLatestProposalSequence } from '../ImprovementProposal.api';
|
||||
import { JVxeTable } from '/@/components/jeecg/JVxeTable';
|
||||
import {improvementDeptScoreColumns, improvementInstituteVoteColumns} from '../ImprovementProposal.data';
|
||||
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
|
||||
import { Form } from 'ant-design-vue';
|
||||
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
||||
import SUploadFile from '/@/components/semri/fileComponent/SUploadFile.vue';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
const useForm = Form.useForm;
|
||||
|
||||
export default defineComponent({
|
||||
@@ -137,6 +136,8 @@
|
||||
components:{
|
||||
JVxeTable,
|
||||
JFormContainer,
|
||||
JDictSelectTag,
|
||||
SUploadFile,
|
||||
},
|
||||
props:{
|
||||
formDisabled:{
|
||||
@@ -150,6 +151,8 @@
|
||||
setup(props, {emit}) {
|
||||
const loading = ref(false);
|
||||
const formRef = ref();
|
||||
const beforeFileRef = ref();
|
||||
const afterFileRef = ref();
|
||||
const improvementDeptScoreTableRef = ref();
|
||||
const improvementDeptScoreTable = reactive<Record<string, any>>({
|
||||
loading: false,
|
||||
@@ -163,6 +166,8 @@
|
||||
dataSource: []
|
||||
});
|
||||
const activeKey = ref('improvementDeptScore');
|
||||
const userStore = useUserStore();
|
||||
|
||||
const formData = reactive<Record<string, any>>({
|
||||
id: '',
|
||||
proposalNo: '',
|
||||
@@ -170,6 +175,7 @@
|
||||
proposalDate: '',
|
||||
proposalDeptId: '',
|
||||
proposalDeptName: '',
|
||||
proposalDeptCode: '',
|
||||
applicantId: '',
|
||||
applicantName: '',
|
||||
teamName: '',
|
||||
@@ -184,14 +190,9 @@
|
||||
|
||||
//表单验证
|
||||
const validatorRules = reactive({
|
||||
proposalNo: [{ required: true, message: '请输入提案编号!'},],
|
||||
proposalName: [{ required: true, message: '请输入提案名称!'},],
|
||||
proposalDate: [{ required: true, message: '请输入提出日期!'},],
|
||||
proposalDeptId: [{ required: true, message: '请输入提案部门ID!'},],
|
||||
proposalDeptName: [{ required: true, message: '请输入提案部门名称!'},],
|
||||
applicantId: [{ required: true, message: '请输入申请人ID!'},],
|
||||
applicantName: [{ required: true, message: '请输入申请人姓名!'},],
|
||||
proposalCategory: [{ required: true, message: '请输入提案类别!'},],
|
||||
proposalCategory: [{ required: true, message: '请选择提案类别!'},],
|
||||
problemDesc: [{ required: true, message: '请输入问题描述!'},],
|
||||
improvementMethod: [{ required: true, message: '请输入改善方法及措施!'},],
|
||||
});
|
||||
@@ -201,8 +202,23 @@
|
||||
labelCol: {xs: {span: 24}, sm: {span: 5}},
|
||||
wrapperCol: {xs: {span: 24}, sm: {span: 16}},
|
||||
};
|
||||
const longLabelCol = {
|
||||
xs: {span: 24},
|
||||
sm: {span: 4},
|
||||
};
|
||||
const longWrapperCol = {
|
||||
xs: {span: 24},
|
||||
sm: {span: 20},
|
||||
};
|
||||
const halfLabelCol = {
|
||||
xs: {span: 24},
|
||||
sm: {span: 8},
|
||||
};
|
||||
const halfWrapperCol = {
|
||||
xs: {span: 24},
|
||||
sm: {span: 16},
|
||||
};
|
||||
|
||||
// 表单禁用
|
||||
const disabled = computed(()=>{
|
||||
if(props.formBpm === true){
|
||||
if(props.formData.disabled === false){
|
||||
@@ -217,27 +233,106 @@
|
||||
// 普通新增没有业务 ID,不展示评分和投票子表;已有数据及流程表单正常展示。
|
||||
const showSubTables = computed(() => Boolean(formData.id || props.formData?.dataId));
|
||||
|
||||
function getCurrentDate() {
|
||||
const now = new Date();
|
||||
const year = now.getFullYear();
|
||||
const month = String(now.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(now.getDate()).padStart(2, '0');
|
||||
return `${year}-${month}-${day}`;
|
||||
}
|
||||
|
||||
function getCurrentLoginDepart() {
|
||||
const userInfo = (userStore.getUserInfo || {}) as Record<string, any>;
|
||||
const loginInfo = (userStore.getLoginInfo || {}) as Record<string, any>;
|
||||
let departs: any[] = [];
|
||||
if (Array.isArray(loginInfo.departs)) {
|
||||
departs = loginInfo.departs;
|
||||
} else if (Array.isArray(userInfo.departs)) {
|
||||
departs = userInfo.departs;
|
||||
} else if (loginInfo.userInfo && Array.isArray(loginInfo.userInfo.departs)) {
|
||||
departs = loginInfo.userInfo.departs;
|
||||
}
|
||||
if (userInfo.orgCode) {
|
||||
const found = departs.find((item) => item && item.orgCode === userInfo.orgCode);
|
||||
if (found) return found;
|
||||
}
|
||||
if (departs.length === 1) {
|
||||
return departs[0];
|
||||
}
|
||||
if (departs.length > 0) {
|
||||
return departs[0];
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
async function getCurrentDepartInfo() {
|
||||
const userInfo = (userStore.getUserInfo || {}) as Record<string, any>;
|
||||
const loginDepart = getCurrentLoginDepart();
|
||||
if (loginDepart) {
|
||||
return {
|
||||
id: loginDepart.id || '',
|
||||
departName: loginDepart.departName || loginDepart.name || '',
|
||||
orgCode: loginDepart.orgCode || '',
|
||||
};
|
||||
}
|
||||
if (userInfo.orgCode) {
|
||||
try {
|
||||
const depart = await defHttp.get({ url: '/sys/sysDepart/getDepartName', params: { orgCode: userInfo.orgCode } }, { successMessageMode: 'none' });
|
||||
if (depart && (depart.id || depart.departName)) {
|
||||
return {
|
||||
id: depart.id || '',
|
||||
departName: depart.departName || depart.depart_name || '',
|
||||
orgCode: userInfo.orgCode,
|
||||
};
|
||||
}
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
const deptId = userInfo.departIds || userInfo.deptId || userInfo.deptid || '';
|
||||
const deptName = userInfo.departIds_dictText || userInfo.orgCodeTxt || userInfo.deptName || '';
|
||||
return { id: deptId, departName: deptName, orgCode: userInfo.orgCode || '' };
|
||||
}
|
||||
|
||||
async function applyCurrentUserDeptInfo() {
|
||||
const departInfo = await getCurrentDepartInfo();
|
||||
formData.proposalDeptId = departInfo.id;
|
||||
formData.proposalDeptName = departInfo.departName;
|
||||
formData.proposalDeptCode = departInfo.orgCode;
|
||||
}
|
||||
|
||||
async function getProposalSequence() {
|
||||
const year = new Date().getFullYear();
|
||||
const latestSequence = await getLatestProposalSequence(year);
|
||||
// return Number(latestSequence) + 1;
|
||||
return String(Number(latestSequence) + 1).padStart(4, '0');
|
||||
}
|
||||
|
||||
async function generateProposalNo() {
|
||||
const deptCode = formData.proposalDeptName || '';
|
||||
const year = new Date().getFullYear();
|
||||
const proposalSequence = await getProposalSequence();
|
||||
return `${deptCode}-${year}年-${proposalSequence}`;
|
||||
}
|
||||
|
||||
onMounted(()=>{
|
||||
initFormData();
|
||||
});
|
||||
//渲染流程表单数据
|
||||
const queryByIdUrl = '/improvementproposal/improvementProposal/queryById';
|
||||
async function initFormData(){
|
||||
if(props.formBpm === true){
|
||||
let params = {id: props.formData.dataId};
|
||||
const row = await defHttp.get({url: queryByIdUrl, params});
|
||||
//设置表单的值
|
||||
Object.keys(row).map(k => {
|
||||
formData[k] = row[k];
|
||||
});
|
||||
//子表数据
|
||||
const improvementDeptScoreDataList = await queryImprovementDeptScoreListByMainId(row['id']);
|
||||
improvementDeptScoreTable.dataSource = [...improvementDeptScoreDataList];
|
||||
const improvementInstituteVoteDataList = await queryImprovementInstituteVoteListByMainId(row['id']);
|
||||
improvementInstituteVoteTable.dataSource = [...improvementInstituteVoteDataList];
|
||||
}
|
||||
}
|
||||
// 是否显示提交按钮
|
||||
|
||||
const showFlowSubmitButton = computed(()=>{
|
||||
if(props.formBpm === true){
|
||||
if(props.formData.disabled === false){
|
||||
@@ -247,11 +342,13 @@
|
||||
return false
|
||||
});
|
||||
|
||||
|
||||
function add() {
|
||||
async function add() {
|
||||
resetFields();
|
||||
improvementDeptScoreTable.dataSource = [];
|
||||
improvementInstituteVoteTable.dataSource = [];
|
||||
formData.proposalDate = getCurrentDate();
|
||||
await applyCurrentUserDeptInfo();
|
||||
formData.proposalNo = await generateProposalNo();
|
||||
}
|
||||
|
||||
async function edit(row) {
|
||||
@@ -308,8 +405,16 @@
|
||||
Object.assign(values, subData);
|
||||
}
|
||||
console.log('表单提交数据', values)
|
||||
await saveOrUpdate(values, isUpdate);
|
||||
//关闭弹窗
|
||||
const result = await saveOrUpdate(values, isUpdate);
|
||||
// 新增时,保存成功后绑定附件的 bussinessId
|
||||
if (!isUpdate) {
|
||||
const newId = typeof result === 'string' ? result : (result?.id || result);
|
||||
if (newId) {
|
||||
formData.id = newId;
|
||||
await beforeFileRef.value?.bindBussinessId(`${newId}:before`);
|
||||
await afterFileRef.value?.bindBussinessId(`${newId}:after`);
|
||||
}
|
||||
}
|
||||
emit('success');
|
||||
}
|
||||
|
||||
@@ -321,16 +426,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 值改变事件触发-树控件回调
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
function handleFormChange(key, value) {
|
||||
formData[key] = value;
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
improvementDeptScoreTableRef,
|
||||
improvementDeptScoreTable,
|
||||
@@ -344,6 +443,10 @@
|
||||
setFieldsValue,
|
||||
handleFormChange,
|
||||
formItemLayout,
|
||||
longLabelCol,
|
||||
longWrapperCol,
|
||||
halfLabelCol,
|
||||
halfWrapperCol,
|
||||
disabled,
|
||||
showSubTables,
|
||||
showFlowSubmitButton,
|
||||
@@ -352,6 +455,8 @@
|
||||
add,
|
||||
edit,
|
||||
formRef,
|
||||
beforeFileRef,
|
||||
afterFileRef,
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user