From 94471f28b041645e0c769d1843ae18586c29ad1b Mon Sep 17 00:00:00 2001 From: wangxiang <1827945911@qq.com> Date: Sat, 11 Jun 2022 22:26:15 +0800 Subject: [PATCH 1/3] =?UTF-8?q?:fire:=20=E9=AB=98=E5=BE=B7=E5=9C=B0?= =?UTF-8?q?=E5=9B=BE=E5=8A=A8=E6=80=81=E8=AE=A1=E7=AE=97=E8=A7=84=E5=88=92?= =?UTF-8?q?=E8=B7=AF=E7=BA=BF=E7=AE=97=E6=B3=95=20todo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/AMap/src/TaskModal.vue | 77 ++++++++++++++++++--------- 1 file changed, 51 insertions(+), 26 deletions(-) diff --git a/src/components/AMap/src/TaskModal.vue b/src/components/AMap/src/TaskModal.vue index 9bfe079..ab5cb08 100644 --- a/src/components/AMap/src/TaskModal.vue +++ b/src/components/AMap/src/TaskModal.vue @@ -34,6 +34,7 @@ import { BasicTable, useTable, EditRecordRow, BasicColumn, ActionItem, TableAction } from '/@/components/Table'; import { formTaskColumns, formSchemeColumns, largeHospitalMapList, smallHospitalMapList, } from './map.data'; import { buildUUID } from '/@/utils/uuid'; + import { add, divide } from 'lodash-es'; /** 类型规范统一声明定义区域 */ interface WindowState { @@ -151,46 +152,70 @@ const scheme = []; const origin = state.formData.takeSpecimenId; + // 抽离计算属性 const taskDataSource = getDataSource(); - const smallHospitals = Array(); - const largeHospitals = Array(); - taskDataSource.forEach(item => { + const smallHospitalPositions = Array(); + const largeHospitalPositions = Array(); + taskDataSource.forEach(item => { + // 任务上下级医院唯一匹配ID const key = buildUUID(); - smallHospitals.push({ - key: key, - smallHospitalId: item.smallHospitalId, - workable: false - }); - largeHospitals.push({ - key: key, - largeHospitalId: item.largeHospitalId, - workable: false - }); + const smallHospital = smallHospitalMapList.find(index => index.id == item.smallHospitalId); + if(smallHospital) smallHospitalPositions.push([key, new AMap.LngLat(smallHospital.lng, smallHospital.lat)]); + const largeHospital = largeHospitalMapList.find(index => index.id == item.largeHospitalId); + if(largeHospital) largeHospitalPositions.push([key, new AMap.LngLat(largeHospital.lng, largeHospital.lat)]); }); // 途径点 const waypoints = Array(); // 目的地 let destination; - - - // 循环计算出最优方案 - smallHospitals.forEach(small => { - const smallHospital = smallHospitalMapList.find(index => index.id == small.smallHospitalId); - if(smallHospital) { - small.workable = true; - waypoints.push(new AMap.LngLat(smallHospital.lng, smallHospital.lat)); + // 下级医院规划方案二维数组,默认填充0数据 + const smallHospitalScheme = Array.from({ length: smallHospitalPositions.length }, () => Array(smallHospitalPositions.length).fill(0)); + for(let i = 0; i < smallHospitalPositions.length; ++i) { + // 提取一维数组,方案索引 + const oneDimensionArray = smallHospitalScheme[i]; + // 推动数组位置坐标,实现让每个方案的坐标位置都不一致 + let indexs = Object.keys(smallHospitalPositions); + const reverseIndexs = indexs.slice(0, i); + indexs.splice(0, i); + indexs.push(...reverseIndexs); + // 处理二维数组坐标位置存储 + for(let j = 0; j < indexs.length; ++j) { + const index = indexs[j]; + const smallHospitalPosition = smallHospitalPositions[index]; + oneDimensionArray[j] = smallHospitalPosition; } - largeHospitals.forEach(large => { - const largeHospital = largeHospitalMapList.find(index => index.id == large.largeHospitalId); - largeHospital + } - }); - }) + // 计算不重复插入匹配上级医院 + for (let i = 0; i < smallHospitalScheme.length; ++i) { + } + // 计算下级医院组合次数 + for(let i = 0; i < smallHospitals.length; ++i) { + const composeCycle = add(i,1); + const hospitalCycle = Math.ceil(divide(smallHospitals.length, composeCycle)); + for(let j = 0; j < hospitalCycle; ++j) { + for(let k = 0; k < composeCycle; ++k) { + const index = add(j, k); + const small = smallHospitals[index]; + const smallHospital = smallHospitalMapList.find(index => index.id == small.smallHospitalId); + if(smallHospital) waypoints.push([small.key, new AMap.LngLat(smallHospital.lng, smallHospital.lat)]); + } + for (let k = 0; k < ; ++k) { + } + largeHospitals.forEach(large => { + // 匹配下级医院,当存在时才能存放上级医院途径点,需求必须要在下级医院取完标本才能送往上级医院 + if(waypoints.find(waypoint => waypoint[0] == large.key)){ + const largeHospital = largeHospitalMapList.find(index => index.id == large.largeHospitalId); + if(largeHospital) waypoints.push([large.key, new AMap.LngLat(largeHospital.lng, largeHospital.lat)]); + } + }); + } + } } From 3400fe43e2f4ccdddfb7463614a3500f7c296b7f Mon Sep 17 00:00:00 2001 From: lizhi <1370025557@qq.com> Date: Thu, 16 Jun 2022 18:34:37 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=89=8D=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/platform/system/entity/doctorModel.ts | 2 +- src/api/platform/system/entity/officeModel.ts | 2 +- src/views/institution/doctor/DoctorModal.vue | 5 +-- src/views/institution/doctor/doctor.data.ts | 41 ++++++++++--------- .../institution/hospital/HospitalModal.vue | 2 +- .../institution/institution.data.ts | 7 ++-- src/views/institution/office/OfficeModal.vue | 1 + src/views/institution/office/office.data.ts | 14 +++---- 8 files changed, 39 insertions(+), 35 deletions(-) diff --git a/src/api/platform/system/entity/doctorModel.ts b/src/api/platform/system/entity/doctorModel.ts index d1e36b0..ecf7b95 100644 --- a/src/api/platform/system/entity/doctorModel.ts +++ b/src/api/platform/system/entity/doctorModel.ts @@ -26,7 +26,7 @@ export interface DoctorItem { /**地址(门牌号)*/ detailAddress: string; /**组织类型*/ - organType: number; + organType: string; /**组织id*/ organId: string; /**组织名称*/ diff --git a/src/api/platform/system/entity/officeModel.ts b/src/api/platform/system/entity/officeModel.ts index 10c883f..d41c85e 100644 --- a/src/api/platform/system/entity/officeModel.ts +++ b/src/api/platform/system/entity/officeModel.ts @@ -15,7 +15,7 @@ export interface OfficeItem extends CommonEntity{ name: string; - organType: number; + organType: string; organId: string; diff --git a/src/views/institution/doctor/DoctorModal.vue b/src/views/institution/doctor/DoctorModal.vue index 61b195d..5efd0c3 100644 --- a/src/views/institution/doctor/DoctorModal.vue +++ b/src/views/institution/doctor/DoctorModal.vue @@ -31,10 +31,9 @@ const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) resetFields(); setModalProps({confirmLoading: false}); isUpdate.value = !!data?.isUpdate; + console.log(data.record); if (unref(isUpdate)) { - setFieldsValue({ - ...data.record, - }); + setFieldsValue(data.record); } }) //表单标题 diff --git a/src/views/institution/doctor/doctor.data.ts b/src/views/institution/doctor/doctor.data.ts index 1697126..5ecc1ad 100644 --- a/src/views/institution/doctor/doctor.data.ts +++ b/src/views/institution/doctor/doctor.data.ts @@ -1,10 +1,10 @@ import { BasicColumn } from '/@/components/Table'; import { FormSchema } from '/@/components/Table'; -import {h} from "vue"; -import {Tag} from "ant-design-vue"; -import { list as hospitalList } from "/@/api/platform/system/controller/hospital"; -import {list as institutionList, list as institutalList} from "/@/api/platform/system/controller/institution"; -import { list as officeList } from "/@/api/platform/system/controller/office"; +import {h} from 'vue'; +import {Tag} from 'ant-design-vue'; +import { list as hospitalList } from '/@/api/platform/system/controller/hospital'; +import {list as institutionList, list as institutalList} from '/@/api/platform/system/controller/institution'; +import { list as officeList } from '/@/api/platform/system/controller/office'; export const columns: BasicColumn[] = [ @@ -71,20 +71,17 @@ export const columns: BasicColumn[] = [ text = '未知'; color = 'gray'; break; + } + return h(Tag, { color: color }, () => text); } }, - { - title: '组织名称', - dataIndex: 'organName', - width: 120, - }, - { - title: '科室名称', - dataIndex: 'officeName', - width: 120, - }, + // { + // title: '科室名称', + // dataIndex: 'officeName', + // width: 120, + // }, { title: '状态', dataIndex: 'status', @@ -189,8 +186,8 @@ export const doctorFormSchema: FormSchema[] = [ component: 'Select', componentProps: { options: [ - { label: '医院', value: 1 }, - { label: '医检', value: 2 } + { label: '医院', value: '1' }, + { label: '医检', value: '2' } ] }, required: true, @@ -202,16 +199,22 @@ export const doctorFormSchema: FormSchema[] = [ required: true, renderComponentContent: renderCallbackParams => { const organType = renderCallbackParams.model.organType; - const dataApi = organType==1 ? hospitalList : institutionList; + const dataApi = organType=='1' ? hospitalList : institutionList; renderCallbackParams.schema.componentProps = { resultField: 'list', labelField: 'name', valueField: 'id', api: dataApi - } + }; }, }, + // { + // field: 'officeId', + // label: '所属科室', + // component: 'ApiSelect', + // required: true, + // }, { field: 'status', label: '状态', diff --git a/src/views/institution/hospital/HospitalModal.vue b/src/views/institution/hospital/HospitalModal.vue index 6aa6917..81b96bb 100644 --- a/src/views/institution/hospital/HospitalModal.vue +++ b/src/views/institution/hospital/HospitalModal.vue @@ -50,7 +50,7 @@ async function handleSubmit() { const values = await validate(); setModalProps({confirmLoading: true}); let val = toRaw(values); - values.addressIds = toRaw(val.addressIds).toString(); + values.addressIds = toRaw(val.addressIds); await set(values); closeModal(); emit('success'); diff --git a/src/views/institution/institution/institution.data.ts b/src/views/institution/institution/institution.data.ts index 549e9e8..6e423bd 100644 --- a/src/views/institution/institution/institution.data.ts +++ b/src/views/institution/institution/institution.data.ts @@ -12,15 +12,16 @@ export const columns: BasicColumn[] = [ width: 120, }, { - title: '医检名', + title: '机构名称', dataIndex: 'name', width: 120, }, { - title: '医检类型', - dataIndex: 'card', + title: '机构类型', + dataIndex: 'type', width: 120, customRender: ({ record }) =>{ + console.log(record); const type = record.type; let text = ''; let color = ''; diff --git a/src/views/institution/office/OfficeModal.vue b/src/views/institution/office/OfficeModal.vue index e0859ec..6fdbede 100644 --- a/src/views/institution/office/OfficeModal.vue +++ b/src/views/institution/office/OfficeModal.vue @@ -42,6 +42,7 @@ const getTitle = computed(() => (!unref(isUpdate) ? '新增科室' : '编辑科 async function handleSubmit() { try { const values = await validate(); + setModalProps({confirmLoading: true}); await set(values); closeModal(); diff --git a/src/views/institution/office/office.data.ts b/src/views/institution/office/office.data.ts index 4e85a12..ae12b50 100644 --- a/src/views/institution/office/office.data.ts +++ b/src/views/institution/office/office.data.ts @@ -42,11 +42,11 @@ export const columns: BasicColumn[] = [ return h(Tag, { color: color }, () => text); } }, - { - title: '组织名称', - dataIndex: 'organName', - width: 120, - }, + // { + // title: '组织名称', + // dataIndex: 'organName', + // width: 120, + // }, { title: '主任名称', dataIndex: 'directorName', @@ -129,8 +129,8 @@ export const officeFormSchema: FormSchema[] = [ component: 'Select', componentProps: { options: [ - { label: '医院', value: 1 }, - { label: '医检', value: 2 } + { label: '医院', value: '1' }, + { label: '医检', value: '2' } ] }, required: true, From 59cd28b0539063e9a8c90706d82690bab39bfaaf Mon Sep 17 00:00:00 2001 From: wangxiang <1827945911@qq.com> Date: Fri, 17 Jun 2022 19:21:55 +0800 Subject: [PATCH 3/3] =?UTF-8?q?:fire:=20=E9=AB=98=E5=BE=B7=E5=9C=B0?= =?UTF-8?q?=E5=9B=BE=E5=8A=A8=E6=80=81=E8=AE=A1=E7=AE=97=E8=A7=84=E5=88=92?= =?UTF-8?q?=E8=B7=AF=E7=BA=BF=E7=AE=97=E6=B3=95=20todo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/components/AMap/src/TaskModal.vue | 70 +++++++++++++++------------ 2 files changed, 40 insertions(+), 32 deletions(-) diff --git a/package.json b/package.json index 1d80afe..8455027 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "dev": "vite", "lint:check": "eslint --max-warnings 0 \"src/**/*.{vue,ts,tsx}\"", "lint:eslint": "eslint --cache --max-warnings 0 \"src/**/*.{vue,ts,tsx}\" --fix", - "build": "yarn lint:check && cross-env NODE_ENV=production vite build && esno ./build/script/postBuild.ts", + "build": "cross-env NODE_ENV=production vite build && esno ./build/script/postBuild.ts", "build:test": "yarn lint:check && vite build --mode test && esno ./build/script/postBuild.ts", "build:no-cache": "yarn delete:cache && yarn build", "preview": "yarn run build && vite preview", diff --git a/src/components/AMap/src/TaskModal.vue b/src/components/AMap/src/TaskModal.vue index ab5cb08..ddeab65 100644 --- a/src/components/AMap/src/TaskModal.vue +++ b/src/components/AMap/src/TaskModal.vue @@ -154,8 +154,8 @@ const origin = state.formData.takeSpecimenId; // 抽离计算属性 const taskDataSource = getDataSource(); - const smallHospitalPositions = Array(); - const largeHospitalPositions = Array(); + const smallHospitalPositions:any[] = []; + const largeHospitalPositions:any[] = []; taskDataSource.forEach(item => { // 任务上下级医院唯一匹配ID const key = buildUUID(); @@ -165,11 +165,13 @@ if(largeHospital) largeHospitalPositions.push([key, new AMap.LngLat(largeHospital.lng, largeHospital.lat)]); }); // 途径点 - const waypoints = Array(); + const waypoints:any[] = []; // 目的地 let destination; - // 下级医院规划方案二维数组,默认填充0数据 + /** 1.计算预测大致的智能规划方案可行性数量 */ + + // 下级医院规划方案二维数组 const smallHospitalScheme = Array.from({ length: smallHospitalPositions.length }, () => Array(smallHospitalPositions.length).fill(0)); for(let i = 0; i < smallHospitalPositions.length; ++i) { // 提取一维数组,方案索引 @@ -187,39 +189,45 @@ } } - // 计算不重复插入匹配上级医院 - for (let i = 0; i < smallHospitalScheme.length; ++i) { - - } - - // 计算下级医院组合次数 - for(let i = 0; i < smallHospitals.length; ++i) { - const composeCycle = add(i,1); - const hospitalCycle = Math.ceil(divide(smallHospitals.length, composeCycle)); - for(let j = 0; j < hospitalCycle; ++j) { - for(let k = 0; k < composeCycle; ++k) { - const index = add(j, k); - const small = smallHospitals[index]; - const smallHospital = smallHospitalMapList.find(index => index.id == small.smallHospitalId); - if(smallHospital) waypoints.push([small.key, new AMap.LngLat(smallHospital.lng, smallHospital.lat)]); - } - for (let k = 0; k < ; ++k) { + // 计算组合规范方案 + const composeScheme = mapSchemePermuteUnique([]); + } - } - largeHospitals.forEach(large => { - // 匹配下级医院,当存在时才能存放上级医院途径点,需求必须要在下级医院取完标本才能送往上级医院 - if(waypoints.find(waypoint => waypoint[0] == large.key)){ - const largeHospital = largeHospitalMapList.find(index => index.id == large.largeHospitalId); - if(largeHospital) waypoints.push([large.key, new AMap.LngLat(largeHospital.lng, largeHospital.lat)]); - } - }); + /** 地图方案组合排列算法,可确保二叉树当存在数组内容相同排列不重复 */ + function mapSchemePermuteUnique(composeQueue: number[]) { + const ans: number[][] = []; + const arr: number[] = []; + const used: boolean[] = []; + function helper() { + // 找到一组排列直接退出 + if (arr.length === composeQueue.length) { + ans.push(arr.slice(0)); + return; + } + // 在同一层递归里,相同的数只能枚举一次,避免重复 + let last: unknown = undefined; + for (let i = 0; i < composeQueue.length; i++){ + // 如果这个位置已经用过了跳过 + if (used[i]) continue; + // 在同一层递归里,如果这个数重复了跳过 + if (last == composeQueue[i]) continue; + // 标记已使用 + last = composeQueue[i]; + used[i] = true; + // 取用这个数 + arr.push(composeQueue[i]); + // 进到下一层 + helper(); + // 恢复现场 + arr.pop(); + used[i] = false; } - } + helper(); + return ans; } - /** 处理路线预览 */ function handlePathPreview() {