This commit is contained in:
z9130 2024-09-30 19:03:00 +08:00
parent bedd30704e
commit 4ffd6dfb64
9 changed files with 119 additions and 86 deletions

View File

@ -213,8 +213,6 @@ async function handleChooseUserConfirm(e) {
}
async function handleSave() {
isLoading.value = true;
try {
await formRef.value.submit();
} catch {
@ -223,6 +221,8 @@ async function handleSave() {
}
try {
isLoading.value = true;
let newForm: any = {};
//

View File

@ -2,10 +2,10 @@ import { dict } from '@fast-crud/fast-crud';
import { message } from 'ant-design-vue';
import dayjs, { type Dayjs } from 'dayjs';
import { DICT_TYPE, getDictObj, getDictOptions } from '#/utils/dict';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
export function getFormSchema(params: any = {}) {
const { chooseCompanyModalApi, formRef } = params || {};
const { chooseCompanyModalApi, formRef, dictMap } = params || {};
const disabledDate = (current: Dayjs) => {
const form = formRef.value.form;
@ -43,7 +43,7 @@ export function getFormSchema(params: any = {}) {
vModel: 'value',
allowClear: false,
},
rules: [{ required: true }],
rules: [{ required: true, message: '请输入合同标的' }],
},
objectsSum: {
title: '标的金额',
@ -57,10 +57,7 @@ export function getFormSchema(params: any = {}) {
suffixRender({ form }) {
return (
<span class="mr-2">
{
getDictObj(DICT_TYPE.contract_currency_unit, form.priceType)
?.label
}
{dictMap[DICT_TYPE.contract_currency_unit]?.label}
</span>
);
},
@ -74,7 +71,7 @@ export function getFormSchema(params: any = {}) {
vModel: 'value',
allowClear: false,
dict: dict({
data: getDictOptions(DICT_TYPE.common_whether),
data: dictMap[DICT_TYPE.common_whether],
}),
},
},
@ -145,10 +142,8 @@ export function getFormSchema(params: any = {}) {
},
render({ form }) {
// 注意此处的v-model写法
const options1 = getDictOptions(
DICT_TYPE.contract_authorization_period,
'string',
);
const options1 = dictMap[DICT_TYPE.contract_authorization_period];
return (
<div class="flex">

View File

@ -15,6 +15,7 @@ import { logger } from 'common-utils';
import Apis from '#/api';
import { useVxeTable } from '#/hooks/vxeTable';
import { DICT_TYPE, getDictDatasAsync } from '#/utils/dict';
import { FileUploader } from '#/utils/file';
import chooseUserModal from '#/views/system/user/choose-user-modal.vue';
@ -53,9 +54,7 @@ const formBindingByBaseInfo = ref({
columns: {},
});
const formBinding = ref({
...getFormSchema({ chooseCompanyModalApi, formRef }),
});
const formBinding = ref<any>(null);
function getColumns(): any {
return [
@ -223,6 +222,10 @@ async function handleSave() {
// newForm.fileUuid = (files.map((item) => item.fileUuid) || []).join(',')
// }
form.ctrBaseId = form.contractId;
form.ctrName = form.contractName;
delete form.guid;
const data = await Apis.sbCtrBasePt.post_save({ data: form });
id.value = data.value;
message.success('保存成功');
@ -271,6 +274,18 @@ onMounted(async () => {
});
contractTypeData.value = contractReferTypeData.rows || [];
//
const dictMap = await getDictDatasAsync([
DICT_TYPE.contract_currency_unit,
DICT_TYPE.common_whether,
DICT_TYPE.contract_authorization_period,
]);
formBinding.value = getFormSchema({
chooseCompanyModalApi,
formRef,
dictMap,
});
formBindingByBaseInfo.value.columns = getFormSchemaByBaseInfo({
contractTypeData: contractTypeData.value,
});

View File

@ -281,6 +281,7 @@ export function getFormSchemaByAuthRange(params?: any): any {
col: { span: 8 },
component: {
...unitComponentProps,
disabled: readOnly,
},
rules: [{ required: true, message: '请选择承办部门' }],
},
@ -293,6 +294,7 @@ export function getFormSchemaByAuthRange(params?: any): any {
vModel: 'value',
class: 'min-w-[180px]',
prototype: true,
disabled: readOnly,
dict: dict({
async getData(_context) {
return filterContractTypes(contractTypeData, '-1');
@ -306,20 +308,7 @@ export function getFormSchemaByAuthRange(params?: any): any {
getComponentRef('ctrTwoType').reloadDict(); // 执行city的select组件的reloadDict()方法触发“city”重新加载字典
},
},
conditionalRender: {
match(_context) {
return readOnly;
},
render({ form }) {
const data = filterContractTypes(contractTypeData, '-1');
for (const item of data) {
if (item.value === form.ctrType) {
return <span>{item.label}</span>;
}
}
return <span></span>;
},
},
rules: [{ required: true, message: '请选择合同类别' }],
},
ctrTwoType: {
title: '二级类别',
@ -330,26 +319,14 @@ export function getFormSchemaByAuthRange(params?: any): any {
vModel: 'value',
class: 'min-w-[180px]',
prototype: true,
disabled: readOnly,
dict: dict({
async getData({ form = {} }) {
return filterContractTypes(contractTypeData, form.ctrType);
},
}),
},
conditionalRender: {
match(_context) {
return readOnly;
},
render({ form }) {
const data = filterContractTypes(contractTypeData, form.ctrType);
for (const item of data) {
if (item.value === form.ctrTwoType) {
return <span>{item.label}</span>;
}
}
return <span></span>;
},
},
rules: [{ required: true, message: '请选择二级类别' }],
},
price: {
title: '标的金额',

View File

@ -118,7 +118,10 @@ async function handleSave() {
const form = formRef.value.form;
const formByAuthRange = formRefByAuthRange.value.form;
console.log('提交表单', form, formBindingByAuthRange);
console.log('提交表单', form, formByAuthRange);
console.log('contractTypeData', contractTypeData.value);
try {
await formRef.value.submit();
await formRefByAuthRange.value.submit();
@ -143,13 +146,16 @@ async function handleSave() {
}
}
debugger;
console.log('提交表单', form, formByAuthRange);
// name
for (const item of contractTypeData.value) {
if (item.contrLevelId === form.ctrType) {
form.ctrTypeName = item.contrLevelName;
if (item.contrLevelId === formByAuthRange.ctrType) {
formByAuthRange.ctrTypeName = item.contrLevelName;
}
if (item.contrLevelId === form.ctrTwoType) {
form.ctrTwoTypeName = item.contrLevelName;
if (item.contrLevelId === formByAuthRange.ctrTwoType) {
formByAuthRange.ctrTwoTypeName = item.contrLevelName;
}
}
@ -184,19 +190,19 @@ async function handleSave() {
},
RlHtSqConsignCqtype: {
consignCqtypeId: '',
contractOneTypeId: form.ctrType,
contractOneTypeName: form.ctrTypeName,
contractTwoTypeId: form.ctrTwoType,
contractTwoTypeName: form.ctrTwoTypeName,
contractOneTypeId: formByAuthRange.ctrType,
contractOneTypeName: formByAuthRange.ctrTypeName,
contractTwoTypeId: formByAuthRange.ctrTwoType,
contractTwoTypeName: formByAuthRange.ctrTwoTypeName,
// inputDepartId: '2024',
// inputDepartName: 'xxxx',
// remark: '',
contractMoneyDown: form.contractMoneyDown,
contractMoneyUp: form.contractMoneyUp,
priceTypeId: form.priceType,
contractMoneyDown: formByAuthRange.contractMoneyDown,
contractMoneyUp: formByAuthRange.contractMoneyUp,
priceTypeId: formByAuthRange.priceType,
priceTypeName: getDictObj(
DICT_TYPE.contract_currency_unit,
form.priceType,
formByAuthRange.priceType,
)?.label,
},
RlHtSqConsignDxtype: {

View File

@ -30,34 +30,28 @@ const formBinding = ref({
initialForm: {},
labelCol: { style: { width: '120px' } },
columns: {
// unitId: {
// title: '',
// key: 'unitId',
// col: { span: 12 },
// component: unitComponentProps,
// },
// userName: {
// title: '',
// key: 'userId',
// col: { span: 12 },
// component: {
// name: 'a-input',
// vModel: 'value',
// readOnly: true,
// onClick: () => {
// chooseUserModalApi.open();
// },
// },
// },
name: {
title: '单位/人员名称',
title: '单位/人员选择',
key: 'name',
component: {
name: 'a-input',
vModel: 'value',
readOnly: true,
onClick: () => {
chooseUserModalApi.open();
},
},
},
id: {
title: '单位/人员id',
key: 'id',
component: {
name: 'a-input',
vModel: 'value',
disabled: true,
},
helper: '无需填写,完成上一步单位/人员选择后自动带出',
},
sort: {
title: '发言顺序',
key: 'sort',
@ -84,12 +78,24 @@ const currUser = ref({});
function handleChooseUserRowClick(row) {
formRef.value?.setFormData({
userName: row.label,
name: row.EMPLOYEE_NAME,
id: row.ACCOUNT_ID,
});
currUser.value = row;
chooseUserModalApi.close();
}
function handleChooseUserDeptClick(rows) {
if (rows.length > 0) {
const row = rows[0];
formRef.value?.setFormData({
name: row.label,
id: row.key,
});
chooseUserModalApi.close();
}
}
const [Modal, modalApi] = useVbenModal({
async onOpenChange(isOpen: boolean) {
if (isOpen) {
@ -132,7 +138,12 @@ const [Modal, modalApi] = useVbenModal({
:loading="isConfirmLoading"
:title="data.isUpdate ? '修改会议发言人顺序' : '新增会议发言人顺序'"
>
<ChooseUserModal class="w-[950px]" @row-click="handleChooseUserRowClick" />
<ChooseUserModal
class="w-[950px]"
tree-checkable
@dept-click="handleChooseUserDeptClick"
@row-click="handleChooseUserRowClick"
/>
<div v-if="false" class="mb-4 w-full">
<a-alert
message="单位或人员选择其中一个即可,同时存在时,以单位为准"

View File

@ -1,7 +1,7 @@
<script setup lang="ts">
import { computed, nextTick, onMounted, onUnmounted, reactive, ref } from 'vue';
import { Page, useVbenModal } from '@vben/common-ui';
import { useVbenModal } from '@vben/common-ui';
import {
MdiExport,
MdiRadioChecked,
@ -166,7 +166,7 @@ onUnmounted(() => {
</script>
<template>
<Page content-class="h-full flex flex-col">
<div class="ml-4 flex h-full flex-col">
<EditModal
class="w-[600px] max-w-[80vw]"
@success="triggerProxy('reload')"
@ -233,7 +233,7 @@ onUnmounted(() => {
</template>
</vxe-grid>
</div>
</Page>
</div>
</template>
<style scoped>

View File

@ -373,8 +373,14 @@ function downloadFile(fileUrl) {
>
<div
:class="[textColor, textSize, { 'font-bold': isBold }]"
class="h-full text-left"
style="white-space: pre-line"
class="text-left"
style="
white-space: pre-line;
display: flex;
align-items: center;
justify-content: center;
height: 100%;
"
>
{{ currentSpeaker.abstracts }}
</div>

View File

@ -1,7 +1,7 @@
<script lang="ts" setup>
import type { VxeGridPropTypes } from 'vxe-table';
import { reactive, ref } from 'vue';
import { reactive, ref, watch } from 'vue';
import { useVbenModal } from '@vben/common-ui';
@ -15,15 +15,18 @@ const props = withDefaults(
defineProps<{
multiple?: boolean;
showDepartment?: boolean;
treeCheckable?: boolean;
}>(),
{
multiple: false,
showDepartment: true,
treeCheckable: false,
},
);
const emit = defineEmits<{
(e: 'confirm', row: any[]): any[];
(e: 'deptClick', row: any): any;
(e: 'rowClick', row: any): any;
}>();
@ -252,6 +255,8 @@ const currTypeData = ref<any>({});
const treeItemTitle = ref('');
function handleTreeSelectChange(keys) {
emit('deptClick', keys);
if (keys.length > 0) {
const treeItem = keys[0];
treeItemKey.value = keys;
@ -338,6 +343,20 @@ const [Modal, modalApi] = useVbenModal({
modalApi.close();
},
});
const treeExpandedKeys = ref([]);
const treeSelectedKeys = ref([]);
const treeCheckedKeys = ref([]);
watch(treeExpandedKeys, () => {
console.log('treeExpandedKeys', treeExpandedKeys);
});
watch(treeSelectedKeys, () => {
console.log('treeSelectedKeys', treeSelectedKeys);
});
watch(treeCheckedKeys, () => {
console.log('treeCheckedKeys', treeCheckedKeys);
});
</script>
<template>
<Modal :title="title">
@ -359,6 +378,10 @@ const [Modal, modalApi] = useVbenModal({
<a-row class="h-full">
<a-col :span="5" class="">
<a-tree
v-model:checked-keys="treeCheckedKeys"
v-model:expanded-keys="treeExpandedKeys"
v-model:selected-keys="treeSelectedKeys"
:checkable="props.treeCheckable"
:tree-data="treeData"
auto-expand-parent
block-node