选择签约依据

This commit is contained in:
z9130 2024-09-12 22:17:43 +08:00
parent e22e91e8f1
commit 64cbd9e1eb
9 changed files with 254 additions and 66 deletions

View File

@ -11,6 +11,7 @@ export enum DICT_TYPE {
meeting_type = 'meeting_type', meeting_type = 'meeting_type',
meeting_facilities = 'meeting_facilities', meeting_facilities = 'meeting_facilities',
meeting_room = 'meeting_room', meeting_room = 'meeting_room',
// 订餐 // 订餐
// 主食 // 主食
canteen_staplefood = 'canteen_staplefood', canteen_staplefood = 'canteen_staplefood',
@ -62,6 +63,8 @@ export enum DICT_TYPE {
/** 综合管理-项目名称管理 */ /** 综合管理-项目名称管理 */
comprehensiveProjectName = 'comprehensive_project_name', comprehensiveProjectName = 'comprehensive_project_name',
comprehensiveConfig = 'comprehensive_config' comprehensiveConfig = 'comprehensive_config',
/** 合同管理-签约依据类型 */
contractBasisType = 'contract_basis_type',
} }

View File

@ -80,7 +80,7 @@ const searchBinding = ref({
class: 'min-w-[180px]', class: 'min-w-[180px]',
allowClear: true, allowClear: true,
dict: dict({ dict: dict({
async getData(dict, context) { async getData(form) {
return getDictOptions(DICT_TYPE.canteen_dineway); return getDictOptions(DICT_TYPE.canteen_dineway);
}, },
}), }),
@ -97,18 +97,10 @@ const searchBinding = ref({
class: 'min-w-[180px]', class: 'min-w-[180px]',
allowClear: true, allowClear: true,
dict: dict({ dict: dict({
async getData(dict, context) { data: [
return [ { label: "已结算", value: "1", },
{ { label: "未结算", value: "0", },
label: "已结算", ],
value: "1",
},
{
label: "未结算",
value: "0",
},
];
},
}), }),
}, },
autoSearchTrigger: 'enter', autoSearchTrigger: 'enter',

View File

@ -311,7 +311,7 @@ onMounted(async () => {
<template> <template>
<Page ref="pageRef" contentClass="h-full flex flex-col"> <Page ref="pageRef" contentClass="h-full flex flex-col">
<a-affix :target="() => pageRef.bodyRef" :offset-top="0" :style="{ zIndex: 999 }"> <a-affix :target="() => pageRef.bodyRef" :offset-top="0" :style="{ zIndex: 50 }">
<div class="bg-white w-full flex flex-row pt-1 pl-1"> <div class="bg-white w-full flex flex-row pt-1 pl-1">
<a-space class="flex-1"> <a-space class="flex-1">
<vben-button variant="primary" @click="handleSave()">保存</vben-button> <vben-button variant="primary" @click="handleSave()">保存</vben-button>

View File

@ -11,49 +11,15 @@ import { message } from "ant-design-vue";
import { Modal } from 'ant-design-vue'; import { Modal } from 'ant-design-vue';
import { toDetailPage } from '#/views/contract/utils.ts'; import { toDetailPage } from '#/views/contract/utils.ts';
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import chooseSigningBasisModal from '../signing-basis/choose-signing-basis-modal.vue';
const router = useRouter(); const router = useRouter();
const checkedValue = ref('all') const [ChooseSigningBasisModal, chooseSigningBasisModalApi] = useVbenModal({
const exportSearchParams = ref<any>({ connectedComponent: chooseSigningBasisModal,
daterange: getMonthStartAndEnd(),
}); });
const searchRef = ref() const searchRef = ref()
let isConfirmLoading = ref(false)
const [_Modal, modalApi] = useVbenModal({
async onConfirm() {
isConfirmLoading.value = true
try {
let params = {};
if (checkedValue.value == "daterange") {
params = {
startDate: exportSearchParams.value.daterange[0],
endDate: exportSearchParams.value.daterange[1],
};
}
let res = await Apis.zbgl.post_export({
params: params, config: {
meta: {
responseType: 'blob'
}
}
}).send();
message.success("导出成功");
modalApi.close()
showExportModal.value = false;
} catch (error) {
console.error(error);
} finally {
isConfirmLoading.value = false
}
console.info("onConfirm");
},
});
const searchFormBinding = ref({ const searchFormBinding = ref({
...getFormSchema(), ...getFormSchema(),
@ -62,10 +28,8 @@ const searchFormBinding = ref({
} }
}); });
const { xGridRef, triggerProxy, gridProps } = useVxeTable({ ref: 'xGridRef' }); const { xGridRef, triggerProxy, gridProps } = useVxeTable({ ref: 'xGridRef' });
const treeData = ref([]);
/** Hooks - 表格 */ /** Hooks - 表格 */
const gridOptions = reactive(gridProps({ const gridOptions = reactive(gridProps({
@ -139,25 +103,29 @@ function handleCellClick({ row }) {
setSelectRow(row); setSelectRow(row);
} }
function handleChooseConfirm(e) {
const $grid = xGridRef.value;
//
if ($grid) {
$grid.remove();
$grid.insert(rows).then(({ row }) => { });
} else {
console.error("xGridRef不存在");
}
}
onMounted(async () => { onMounted(async () => {
triggerProxy('reload') triggerProxy('reload')
}) })
function toPage() {
window.open("/iframe/meeting/standing-book", "_blank");
}
function toDetail(row) {
window.open("/iframe/meeting/start/" + row.guid, "_blank");
}
//
</script> </script>
<template> <template>
<Page contentClass="h-full flex flex-col"> <Page contentClass="h-full flex flex-col">
<ChooseSigningBasisModal class="w-[950px]" @confirm="handleChooseConfirm" />
<fs-search ref="searchRef" v-bind="searchFormBinding"> <fs-search ref="searchRef" v-bind="searchFormBinding">
<template #form_price="{ row }"> <template #form_price="{ row }">
<a-input-number v-model:value="row.budgetSum1" placeholder=""> <a-input-number v-model:value="row.budgetSum1" placeholder="">

View File

@ -0,0 +1,182 @@
<script lang="ts" setup>
import { reactive, ref } from "vue";
import { useVbenModal } from "@vben/common-ui";
import { message } from "ant-design-vue";
import { useVxeTable } from "#/hooks/vxeTable";
import Apis from "#/api";
import { getColumns, getFormSchema } from "./crud";
const emit = defineEmits<{
(e: "rowClick", row: any): any;
(e: "confirm", row: any[]): any[];
}>();
const props = withDefaults(
defineProps<{
multiple?: boolean;
showDepartment?: boolean;
}>(),
{
multiple: true,
}
);
let isConfirmLoading = ref(false);
const [messageApi] = message.useMessage();
const { xGridRef, triggerProxy, gridProps } = useVxeTable({ ref: "xGridRef" });
const searchRef = ref();
const data = ref({
userIds: [],
});
const checkRecords = ref([]);
const searchBinding = ref({
...getFormSchema(),
onSearch(context: any) {
triggerProxy("reload");
},
});
/** Hooks - 表格 */
const gridOptions = reactive(
gridProps({
height: "400px",
columns: getColumns(),
pagerConfig: { size: "mini" },
proxyConfig: {
autoLoad: true,
ajax: {
query: ({ page }) => {
return Apis.lxBasisSale.get_page({
params: {
pageNum: page.currentPage,
pageSize: page.pageSize,
...searchRef.value.formData,
},
});
},
querySuccess() {
for (const row of checkRecords.value) {
xGridRef.value!.setCheckboxRow(row, true);
}
},
},
},
rowConfig: {
keyField: "basisId",
},
checkboxConfig: {
labelField: "basisName",
//
showHeader: false,
highlight: true,
range: false,
//
reserve: true,
checkMethod: ({ row }) => {
let checkRecordIds = checkRecords.value.map((item) => item.guid);
if (checkRecords.value.length < 10 || checkRecordIds.includes(row.guid)) {
return true;
}
return false;
},
},
})
);
/**
* 单元行点击事件
*/
function handleCellClick({ row }) {
console.log(row);
emit("rowClick", row);
}
/**
* 复选框选中事件
* @param e
*/
function handleCheckboxChange(e) {
let currRows = xGridRef.value?.getCheckboxRecords() || [];
let otherRows = xGridRef.value?.getCheckboxReserveRecords() || [];
let allRows = [...currRows, ...otherRows];
if (e.checked) {
const existingIds = new Set(checkRecords.value.map((item) => item.guid));
if (!existingIds.has(e.row.ACCOUNT_ID)) {
checkRecords.value = [...checkRecords.value, e.row];
}
} else {
handleCloseTag(e.row);
}
console.log("[ checkRecords.value ] >", checkRecords.value);
if (allRows.length >= 10) {
messageApi.warning("最多只能选择10条数据");
}
}
function handleCloseTag(row) {
checkRecords.value = checkRecords.value.filter((item) => item.guid != row.guid);
xGridRef.value?.setCheckboxRow(row, false);
}
let title = ref("选择办公用品");
const [BaseModal, baseModalApi] = useVbenModal({
onOpenChange(isOpen: boolean) {
if (isOpen) {
isConfirmLoading.value = false;
data.value = baseModalApi.getData<Record<string, any>>() || {};
if (data.value.title) {
title.value = data.value.title;
}
console.log(data.value.userIds);
let rows: any = [];
for (const element of checkRecords.value) {
if (data.value.guids.includes(element.guid)) {
rows.push(element);
}
}
checkRecords.value = rows;
}
},
onConfirm() {
console.info("onConfirm");
emit("confirm", checkRecords.value);
baseModalApi.close();
},
onCancel() {
baseModalApi.close();
},
});
</script>
<template>
<BaseModal :title="title" :loading="isConfirmLoading" :confirm-loading="isConfirmLoading">
<div v-if="props.multiple" class="flex flex-row py-12px">
<span class="block mr-12px">已选择</span>
<div class="flex flex-row flex-1">
<a-space>
<a-tag v-for="(item, index) in checkRecords" :key="index" closable @close="handleCloseTag(item)">
{{ item.basisName }}
</a-tag>
</a-space>
</div>
</div>
<div class="h-full flex flex-col">
<fs-search ref="searchRef" v-bind="searchBinding"> </fs-search>
<div class="flex-1 min-h-300px">
<VxeGrid ref="xGridRef" class="h-420px" v-bind="gridOptions" @cell-click="handleCellClick"
@checkbox-change="handleCheckboxChange">
</VxeGrid>
</div>
</div>
</BaseModal>
</template>

View File

@ -1,5 +1,7 @@
import type { VxeGridPropTypes } from 'vxe-table'; import type { VxeGridPropTypes } from 'vxe-table';
import { useRender } from '#/hooks/useRender'; import { useRender } from '#/hooks/useRender';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
import { dict } from '@fast-crud/fast-crud';
export const PrimaryKey = 'guid'; export const PrimaryKey = 'guid';
export function getColumns(_params: any = {}): VxeGridPropTypes.Columns { export function getColumns(_params: any = {}): VxeGridPropTypes.Columns {
@ -11,6 +13,13 @@ export function getColumns(_params: any = {}): VxeGridPropTypes.Columns {
width: 200, width: 200,
}, },
{ field: 'basisNum', title: '依据编号', width: 180 }, { field: 'basisNum', title: '依据编号', width: 180 },
{
field: 'basisTypeId', title: '依据类型', width: 100, slots: {
default: ({ row }) => {
return useRender.renderDict(row.basisTypeId, DICT_TYPE.contractBasisType);
}
}
},
{ {
field: 'endDate', title: '有效期', width: 150, slots: { field: 'endDate', title: '有效期', width: 150, slots: {
default: ({ row }) => { default: ({ row }) => {
@ -59,6 +68,23 @@ export function getFormSchema(_params: any = {}) {
autoSearchTrigger: 'enter', autoSearchTrigger: 'enter',
show: true, show: true,
}, },
basisTypeId: {
title: '依据类型',
key: 'basisTypeId',
component: {
name: 'fs-dict-select',
vModel: 'value',
class: 'min-w-[180px]',
allowClear: true,
dict: dict({
async getData(form) {
return getDictOptions(DICT_TYPE.contractBasisType);
},
}),
},
autoSearchTrigger: 'enter',
show: true,
},
inputPerson: { inputPerson: {
title: '创建人', title: '创建人',
key: 'inputPerson', key: 'inputPerson',

View File

@ -5,6 +5,8 @@ import dayjs, { Dayjs } from "dayjs";
import Apis from "#/api"; import Apis from "#/api";
import { message, type UploadChangeParam } from "ant-design-vue"; import { message, type UploadChangeParam } from "ant-design-vue";
import { FileUploader } from "#/utils/file"; import { FileUploader } from "#/utils/file";
import { dict } from "@fast-crud/fast-crud";
import { DICT_TYPE, getDictOptions } from "#/utils/dict";
const emit = defineEmits<{ const emit = defineEmits<{
(e: "success"): void; (e: "success"): void;
@ -25,6 +27,21 @@ const formBinding = ref({
initialForm: {}, initialForm: {},
labelCol: { style: { width: '120px' } }, labelCol: { style: { width: '120px' } },
columns: { columns: {
basisTypeId: {
title: '依据类型',
key: 'basisTypeId',
component: {
name: 'fs-dict-radio',
vModel: 'value',
allowClear: true,
dict: dict({
async getData(form) {
return getDictOptions(DICT_TYPE.contractBasisType);
},
}),
},
rules: [{ required: true, message: "请选择依据类型" }],
},
basisNum: { basisNum: {
title: "依据编号", title: "依据编号",
key: "basisNum", key: "basisNum",

View File

@ -369,7 +369,7 @@ onMounted(async () => {
<template> <template>
<Page ref="pageRef" contentClass="h-full flex flex-col"> <Page ref="pageRef" contentClass="h-full flex flex-col">
<a-affix :target="() => pageRef.bodyRef" :offset-top="0" :style="{ zIndex: 999 }"> <a-affix :target="() => pageRef.bodyRef" :offset-top="0" :style="{ zIndex: 50 }">
<div class="bg-white w-full flex flex-row pt-1 pl-1"> <div class="bg-white w-full flex flex-row pt-1 pl-1">
<a-space class="flex-1"> <a-space class="flex-1">
<vben-button variant="primary" @click="handleSave()">保存</vben-button> <vben-button variant="primary" @click="handleSave()">保存</vben-button>

View File

@ -6,7 +6,7 @@
<a-row class="h-full"> <a-row class="h-full">
<a-col :span="5" class="min-w-[200px]"> <a-col :span="5" class="min-w-[200px]">
<a-space wrap> <a-space wrap>
<vben-button variant="default"> <vben-button variant="default" @click="handleTypeAdd()">
<MdiAdd class="text-lg mr-0.5" /> <MdiAdd class="text-lg mr-0.5" />
新增 新增
</vben-button> </vben-button>