自能必填校验,开发合同管理页面功能
This commit is contained in:
@@ -165,7 +165,29 @@
|
||||
|
||||
tableRows: {},
|
||||
|
||||
dataRule: {},
|
||||
dataRule: {
|
||||
project_type_code: [
|
||||
{
|
||||
required: true,
|
||||
message: t('sys.validate.textRequiredSuffix','不能为空'),
|
||||
trigger: 'blur'
|
||||
},
|
||||
],
|
||||
project_type_name: [
|
||||
{
|
||||
required: true,
|
||||
message: t('sys.validate.textRequiredSuffix','不能为空'),
|
||||
trigger: 'blur'
|
||||
},
|
||||
],
|
||||
seq_num: [
|
||||
{
|
||||
required: true,
|
||||
message: t('sys.validate.textRequiredSuffix','不能为空'),
|
||||
trigger: ["blur","change"]
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
optionsObj: {
|
||||
pidOptions: [],
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
50
src/views/cm/contract/SelectContractModal.vue
Normal file
50
src/views/cm/contract/SelectContractModal.vue
Normal file
@@ -0,0 +1,50 @@
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" title="选择合同模板" @ok="handleOk" width="1000px" :minHeight="200">
|
||||
<BasicTable @register="registerTable" :rowSelection="{ type: 'radio', onChange: handleSelectChange }" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { BasicModal, useModalInner } from '@/components/Modal';
|
||||
import { BasicTable, useTable } from '@/components/Table';
|
||||
// 假设你有一个获取所有合同的API,这里需要根据你的项目实际情况引入
|
||||
// 如果返回的数据结构和 index 页面的 getList 一样,甚至可以复用
|
||||
import { getList as getContractList } from '@/views/mdm/asset/helper/api';
|
||||
|
||||
const emit = defineEmits(['confirm']);
|
||||
const selectedRow = ref({});
|
||||
|
||||
const [registerModal, { closeModal }] = useModalInner();
|
||||
|
||||
// 注册表格,配置你的表格列和API
|
||||
const [registerTable] = useTable({
|
||||
api: getContractList, // 复用获取列表的API
|
||||
immediate: true, // 弹框打开后立即加载数据
|
||||
showIndexColumn: false,
|
||||
rowKey: 'id',
|
||||
columns: [
|
||||
// 这里配置你想在弹框中显示的列,尽量精简
|
||||
{ title: '合同编码', dataIndex: 'contract_code', width: 150 },
|
||||
{ title: '合同名称', dataIndex: 'contract_name' },
|
||||
{ title: '我方单位', dataIndex: 'our_company_name', width: 200 },
|
||||
{ title: '合作单位', dataIndex: 'second_party_name', width: 200 },
|
||||
// ... 其他需要的列
|
||||
],
|
||||
});
|
||||
|
||||
const handleSelectChange = (selectedRowKeys, rows) => {
|
||||
if (rows && rows.length) {
|
||||
selectedRow.value = rows[0];
|
||||
}
|
||||
};
|
||||
|
||||
const handleOk = () => {
|
||||
if (!selectedRow.value.id) {
|
||||
// 可以在这里加一个提示,请选择一条数据
|
||||
return;
|
||||
}
|
||||
emit('confirm', selectedRow.value);
|
||||
closeModal();
|
||||
};
|
||||
</script>
|
||||
@@ -2,7 +2,7 @@ import { defHttp } from '@/utils/http/axios';
|
||||
|
||||
// 获取列表
|
||||
export function getList(data) {
|
||||
return defHttp.post({ url: '/api/4/Contract/getList', data });
|
||||
return defHttp.post({ url: '/api/cm/Contract/getList', data });
|
||||
}
|
||||
// 新建
|
||||
export function create(data) {
|
||||
|
||||
@@ -98,10 +98,14 @@
|
||||
<RelationDetail ref="relationDetailRef" />
|
||||
<SuperQueryModal @register="registerSuperQueryModal" @superQuery="handleSuperQuery" />
|
||||
<FlowParser @register="registerFlowParser" @reload="reload" />
|
||||
<SelectContractModal @register="registerSelectModal" @confirm="handleSelectConfirm" />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import SelectContractModal from './SelectContractModal.vue';
|
||||
|
||||
|
||||
import { getList, del, exportData, batchDelete } from './helper/api';
|
||||
import { getConfigData,getViewList } from '@/api/onlineDev/visualDev';
|
||||
@@ -194,6 +198,8 @@
|
||||
const [registerExportModal, { openModal: openExportModal, closeModal: closeExportModal, setModalProps: setExportModalProps }] = useModal();
|
||||
const [registerImportModal, { openModal: openImportModal }] = useModal();
|
||||
const [registerSuperQueryModal, { openModal: openSuperQuery }] = useModal();
|
||||
const [registerSelectModal, { openModal: openSelectModal }] = useModal();
|
||||
|
||||
// 工作流
|
||||
const { close } = useTabs();
|
||||
const router = useRouter();
|
||||
@@ -206,7 +212,7 @@
|
||||
|
||||
const state = reactive<State>({
|
||||
config: {},
|
||||
flowId:'',//请在这里填写流程模板id
|
||||
flowId:'826818224476657349',//请在这里填写流程模板id
|
||||
columnList: [],
|
||||
printListOptions: [],
|
||||
columnBtnsList: [],
|
||||
@@ -578,15 +584,41 @@
|
||||
};
|
||||
openFlowParser(true, data);
|
||||
}
|
||||
// 新增
|
||||
// // 新增
|
||||
// function addHandle() {
|
||||
// // 带流程新增
|
||||
// const data = {
|
||||
// id: '',
|
||||
// flowId: state.flowId,
|
||||
// opType: '-1',
|
||||
// };
|
||||
// openFlowParser(true, data);
|
||||
// }
|
||||
function addHandle() {
|
||||
// 带流程新增
|
||||
const data = {
|
||||
id: '',
|
||||
// 打开选择合同的弹框,而不是直接打开表单
|
||||
openSelectModal(true);
|
||||
}
|
||||
|
||||
// 4. 新增确认选择后的处理方法
|
||||
function handleSelectConfirm(selectedRow) {
|
||||
// 准备传递给 form 页面的数据
|
||||
// 关键点:你需要将选中的数据,构造成和通过工作流表单提交时相同的数据结构
|
||||
// 因为 form 页面的 selfGetInfo 方法会根据传入的 data 来填充表单。
|
||||
// 最简单的做法是,把 selectedRow 里的所有字段都放进去。
|
||||
const dataForForm = {
|
||||
id: '', // 新增时 id 为空
|
||||
flowId: state.flowId,
|
||||
opType: '-1',
|
||||
// 将选中的合同数据传递下去
|
||||
data: {
|
||||
...selectedRow,
|
||||
// 你可能还需要处理一些特殊字段,比如日期格式等
|
||||
// contract_date: selectedRow.contract_date ? dayjs(selectedRow.contract_date) : undefined,
|
||||
}
|
||||
};
|
||||
openFlowParser(true, data);
|
||||
|
||||
// 打开工作流表单,并将数据传进去
|
||||
openFlowParser(true, dataForForm);
|
||||
}
|
||||
// 导出
|
||||
function handleDownload(data) {
|
||||
|
||||
@@ -299,7 +299,7 @@
|
||||
import { create, update, getInfo } from './helper/api';
|
||||
import { reactive, toRefs, nextTick, ref, unref, computed, toRaw, inject } from 'vue';
|
||||
import { BasicPopup, usePopup } from '@/components/Popup';
|
||||
import { YunzhupaasRelationFormByUrl } from '@/components/yunzhupaas';
|
||||
import { YunzhupaasRelationFormByUrl } from '@/components/Yunzhupaas';
|
||||
import { useMessage } from '@/hooks/web/useMessage';
|
||||
import { useI18n } from '@/hooks/web/useI18n';
|
||||
import { useUserStore } from '@/store/modules/user';
|
||||
|
||||
@@ -197,7 +197,29 @@
|
||||
|
||||
tableRows: {},
|
||||
|
||||
dataRule: {},
|
||||
dataRule: {
|
||||
project_code: [
|
||||
{
|
||||
required: true,
|
||||
message: t('sys.validate.textRequiredSuffix','不能为空'),
|
||||
trigger: 'blur'
|
||||
},
|
||||
],
|
||||
project_name: [
|
||||
{
|
||||
required: true,
|
||||
message: t('sys.validate.textRequiredSuffix','不能为空'),
|
||||
trigger: 'blur'
|
||||
},
|
||||
],
|
||||
org_id: [
|
||||
{
|
||||
required: true,
|
||||
message: t('sys.validate.arrayRequiredPrefix ','请至少选择一个'),
|
||||
trigger: 'change'
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
optionsObj: {
|
||||
project_type_idOptions: [],
|
||||
|
||||
Reference in New Issue
Block a user