diff --git a/.env.production b/.env.production index e2c31c4..3a10e4e 100644 --- a/.env.production +++ b/.env.production @@ -2,7 +2,7 @@ VITE_USE_MOCK = false # 发布路径 -VITE_PUBLIC_PATH = /biz101 +VITE_PUBLIC_PATH = /biz103 # 是否启用gzip或brotli压缩 # 选项值: gzip | brotli | none @@ -13,10 +13,10 @@ VITE_BUILD_COMPRESS = 'gzip' VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false #后台接口父地址(必填) -VITE_GLOB_API_URL=/nursingunit101 +VITE_GLOB_API_URL=/nursingunit103 #后台接口全路径地址(必填) -VITE_GLOB_DOMAIN_URL=https://www.focusnu.com/nursingunit101 +VITE_GLOB_DOMAIN_URL=https://www.focusnu.com/nursingunit103 # 接口父路径前缀 VITE_GLOB_API_URL_PREFIX= diff --git a/src/api/common/api.ts b/src/api/common/api.ts index 28a4478..98c8372 100644 --- a/src/api/common/api.ts +++ b/src/api/common/api.ts @@ -16,7 +16,7 @@ enum Api { getTableList = '/sys/user/queryUserComponentData', getCategoryData = '/sys/category/loadAllData', getNuList = '/iot/tplink/cameraInfo/nuList', - getOrgName = '/sys/api/getOrgName', + getOrgInfo = '/sys/api/getOrgInfo', } /** @@ -89,6 +89,14 @@ export const loadDictItem = (params?) => { export const getDictItems = (dictCode) => { return defHttp.get({ url: Api.getDictItems + dictCode }, { joinTime: false }); }; + +/** + * 根据字典code加载字典text + */ +export const getDictItemsByOrgCode = (dictCode, orgCode) => { + return defHttp.get({ url: Api.getDictItems + dictCode + '/' + orgCode }, { joinTime: false }); +}; + /** * 部门用户modal选择列表加载list */ @@ -164,6 +172,6 @@ export const uploadMyFile = (url, data) => { * 获取机构名称 * @param params */ -export const getOrgName = () => { - return defHttp.get({ url: Api.getOrgName }); +export const getOrgInfo = () => { + return defHttp.get({ url: Api.getOrgInfo }); }; diff --git a/src/components/Form/src/jeecg/components/JCheckbox.vue b/src/components/Form/src/jeecg/components/JCheckbox.vue index 408052b..14b63bf 100644 --- a/src/components/Form/src/jeecg/components/JCheckbox.vue +++ b/src/components/Form/src/jeecg/components/JCheckbox.vue @@ -11,7 +11,7 @@ import { defineComponent, computed, watch, watchEffect, ref, unref } from 'vue'; import { propTypes } from '/@/utils/propTypes'; import { useAttrs } from '/@/hooks/core/useAttrs'; -import { getDictItems } from "@/api/common/api"; +import { getDictItems, getDictItemsByOrgCode } from "@/api/common/api"; export default defineComponent({ name: 'JCheckbox', @@ -23,6 +23,7 @@ export default defineComponent({ type: Array, default: () => [], }, + orgCode: '',//组织机构编码 会切换数据源 }, emits: ['change', 'update:value', 'upDictCode'], setup(props, { emit }) { @@ -82,16 +83,27 @@ export default defineComponent({ temp = encodeURI(temp); } //update-end-author:taoyan date:2022-6-21 for: 字典数据请求前将参数编码处理,但是不能直接编码,因为可能之前已经编码过了 - getDictItems(temp).then((res) => { - if (res) { - checkOptions.value = res.map((item) => ({ value: item.value, label: item.text, disabled: item.status == 1 && !checkboxArray.value.includes(item.value), color: item.color })); - //console.info('res', dictOptions.value); - emit('upDictCode', checkOptions.value) - } else { - console.error('getDictItems error: : ', res); - checkOptions.value = []; - } - }); + if (!!props.orgCode) { + getDictItemsByOrgCode(temp, props.orgCode).then((res) => { + if (res) { + checkOptions.value = res.map((item) => ({ value: item.value, label: item.text, disabled: item.status == 1 && !checkboxArray.value.includes(item.value), color: item.color })); + //console.info('res', dictOptions.value); + } else { + console.error('getDictItems error: : ', res); + checkOptions.value = []; + } + }); + } else { + getDictItems(temp).then((res) => { + if (res) { + checkOptions.value = res.map((item) => ({ value: item.value, label: item.text, disabled: item.status == 1 && !checkboxArray.value.includes(item.value), color: item.color })); + //console.info('res', dictOptions.value); + } else { + console.error('getDictItems error: : ', res); + checkOptions.value = []; + } + }); + } } /** diff --git a/src/components/Form/src/jeecg/components/JDictSelectTag.vue b/src/components/Form/src/jeecg/components/JDictSelectTag.vue index e470cd3..9cd3eec 100644 --- a/src/components/Form/src/jeecg/components/JDictSelectTag.vue +++ b/src/components/Form/src/jeecg/components/JDictSelectTag.vue @@ -77,6 +77,7 @@ export default defineComponent({ }, style: propTypes.any, ignoreDisabled: propTypes.bool.def(false), + orgCode: '',//组织机构编码 会切换数据源 }, emits: ['options-change', 'change', 'update:value', 'upDictCode'], setup(props, { emit, refs }) { @@ -127,7 +128,7 @@ export default defineComponent({ async function initDictData() { let { dictCode, stringToNumber } = props; //根据字典Code, 初始化字典数组 - const dictData = await initDictOptions(dictCode); + const dictData = await initDictOptions(dictCode, props.orgCode); dictOptions.value = dictData.reduce((prev, next) => { if (next) { const value = next['value']; diff --git a/src/layouts/default/header/index.vue b/src/layouts/default/header/index.vue index 0d7a36d..b360007 100644 --- a/src/layouts/default/header/index.vue +++ b/src/layouts/default/header/index.vue @@ -76,7 +76,7 @@ import LoginSelect from '/@/views/sys/login/LoginSelect.vue'; import { useUserStore } from '/@/store/modules/user'; import { useI18n } from '/@/hooks/web/useI18n'; import Aide from "@/views/dashboard/ai/components/aide/index.vue" -import { getOrgName } from '@/api/common/api' +import { getOrgInfo } from '@/api/common/api' const { t } = useI18n(); export default defineComponent({ @@ -187,7 +187,7 @@ export default defineComponent({ } onMounted(() => { - getOrgName().then(res => { + getOrgInfo().then(res => { orgName.value = res.orgName }) showLoginSelect(); diff --git a/src/utils/cache/cacheUtil.ts b/src/utils/cache/cacheUtil.ts new file mode 100644 index 0000000..0fe7fec --- /dev/null +++ b/src/utils/cache/cacheUtil.ts @@ -0,0 +1,17 @@ +import { refreshCache, queryAllDictItems } from '/@/views/system/dict/dict.api'; +import { removeAuthCache, setAuthCache } from '/@/utils/auth'; +import { DB_DICT_DATA_KEY } from '/@/enums/cacheEnum'; +import { useUserStore } from '/@/store/modules/user'; +const userStore = useUserStore(); + +//刷新缓存 +export async function clearCache() { + const result = await refreshCache(); + if (result.success) { + const res = await queryAllDictItems(); + removeAuthCache(DB_DICT_DATA_KEY); + setAuthCache(DB_DICT_DATA_KEY, res.result); + userStore.setAllDictItems(res.result); + } else { + } +} diff --git a/src/utils/dict/index.ts b/src/utils/dict/index.ts index cdf4f8a..02fe45a 100644 --- a/src/utils/dict/index.ts +++ b/src/utils/dict/index.ts @@ -27,11 +27,12 @@ export const getDictItemsByCode = (code) => { /** * 获取字典数组 * @param dictCode 字典Code + * @param orgCode 机构编码 查询相应数据源字典 * @return List */ -export const initDictOptions = (code) => { +export const initDictOptions = (code, orgCode = '') => { //1.优先从缓存中读取字典配置 - if (getDictItemsByCode(code)) { + if (getDictItemsByCode(code) && !orgCode) { return new Promise((resolve, reject) => { resolve(getDictItemsByCode(code)); }); @@ -43,7 +44,11 @@ export const initDictOptions = (code) => { code = encodeURI(code); } //update-end-author:taoyan date:2022-6-21 for: 字典数据请求前将参数编码处理,但是不能直接编码,因为可能之前已经编码过了 - return defHttp.get({ url: `/sys/dict/getDictItems/${code}` }); + if (!orgCode) { + return defHttp.get({ url: `/sys/dict/getDictItems/${code}` }); + } else { + return defHttp.get({ url: `/sys/dict/getDictItems/${code}/${orgCode}` }); + } }; /** * 获取字典数组 diff --git a/src/views/admin/sysconfig/SysConfig.api.ts b/src/views/admin/sysconfig/SysConfig.api.ts index 145477d..37f51a8 100644 --- a/src/views/admin/sysconfig/SysConfig.api.ts +++ b/src/views/admin/sysconfig/SysConfig.api.ts @@ -1,16 +1,17 @@ import { defHttp } from '/@/utils/http/axios'; -import { useMessage } from "/@/hooks/web/useMessage"; +import { useMessage } from '/@/hooks/web/useMessage'; const { createConfirm } = useMessage(); enum Api { list = '/sysconfig/sysConfig/list', - save='/sysconfig/sysConfig/add', - edit='/sysconfig/sysConfig/edit', + save = '/sysconfig/sysConfig/add', + edit = '/sysconfig/sysConfig/edit', deleteOne = '/sysconfig/sysConfig/delete', deleteBatch = '/sysconfig/sysConfig/deleteBatch', importExcel = '/sysconfig/sysConfig/importExcel', exportXls = '/sysconfig/sysConfig/exportXls', + queryByKey = '/sysconfig/sysConfig/queryByKey', } /** @@ -30,16 +31,23 @@ export const getImportUrl = Api.importExcel; */ export const list = (params) => defHttp.get({ url: Api.list, params }); +/** + * 根据key获取数据 + * @param params key + * @returns + */ +export const queryByKey = (params) => defHttp.get({ url: Api.queryByKey, params }); + /** * 删除单个 * @param params * @param handleSuccess */ -export const deleteOne = (params,handleSuccess) => { - return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { +export const deleteOne = (params, handleSuccess) => { + return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => { handleSuccess(); }); -} +}; /** * 批量删除 @@ -54,12 +62,12 @@ export const batchDelete = (params, handleSuccess) => { okText: '确认', cancelText: '取消', onOk: () => { - return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { + return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => { handleSuccess(); }); - } + }, }); -} +}; /** * 保存或者更新 @@ -69,4 +77,4 @@ export const batchDelete = (params, handleSuccess) => { export const saveOrUpdate = (params, isUpdate) => { let url = isUpdate ? Api.edit : Api.save; return defHttp.post({ url: url, params }, { isTransformResponse: false }); -} +}; diff --git a/src/views/services/serviceDirective/ConfigServiceDirective.api.ts b/src/views/services/serviceDirective/ConfigServiceDirective.api.ts index ee5141b..05fdc39 100644 --- a/src/views/services/serviceDirective/ConfigServiceDirective.api.ts +++ b/src/views/services/serviceDirective/ConfigServiceDirective.api.ts @@ -1,12 +1,12 @@ import { defHttp } from '/@/utils/http/axios'; -import { useMessage } from "/@/hooks/web/useMessage"; +import { useMessage } from '/@/hooks/web/useMessage'; const { createConfirm } = useMessage(); enum Api { list = '/services/serviceDirective/list', - save='/services/serviceDirective/add', - edit='/services/serviceDirective/edit', + save = '/services/serviceDirective/add', + edit = '/services/serviceDirective/edit', deleteOne = '/services/serviceDirective/delete', deleteBatch = '/services/serviceDirective/deleteBatch', importExcel = '/services/serviceDirective/importExcel', @@ -16,9 +16,25 @@ enum Api { tree = '/services/serviceDirective/tree', queryById = '/services/serviceDirective/queryById', syncMediaForBiz = '/services/serviceDirective/syncMediaForBiz', - syncMediaForAllBiz= '/services/serviceDirective/syncMediaForAllBiz', + syncMediaForAllBiz = '/services/serviceDirective/syncMediaForAllBiz', + listByDS = '/services/serviceDirective/listByDS', + idListByDS = '/services/serviceDirective/idListByDS', + syncDirective = '/services/serviceDirective/syncDirective', } +/** + * 列表接口 - 变更数据源 + * @param params + */ +export const listByDS = (params) => defHttp.get({ url: Api.listByDS, params }); + +/** + * + * @param params 获取对应机构已有指令id + * @returns + */ +export const idListByDS = (params) => defHttp.get({ url: Api.idListByDS, params }); + /** * 导出api * @param params @@ -42,11 +58,11 @@ export const queryById = (params) => defHttp.get({ url: Api.queryById, params }) * @param params * @param handleSuccess */ -export const deleteOne = (params,handleSuccess) => { - return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { +export const deleteOne = (params, handleSuccess) => { + return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => { handleSuccess(); }); -} +}; /** * 批量删除 @@ -61,12 +77,12 @@ export const batchDelete = (params, handleSuccess) => { okText: '确认', cancelText: '取消', onOk: () => { - return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { + return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => { handleSuccess(); }); - } + }, }); -} +}; /** * 保存或者更新 @@ -76,7 +92,7 @@ export const batchDelete = (params, handleSuccess) => { export const saveOrUpdate = (params, isUpdate) => { let url = isUpdate ? Api.edit : Api.save; return defHttp.post({ url: url, params }, { isTransformResponse: false }); -} +}; /** * 同步数据 @@ -84,12 +100,12 @@ export const saveOrUpdate = (params, isUpdate) => { */ export const asyncFunc = (params) => { return defHttp.post({ url: Api.async, params }, { isTransformResponse: false }); -} +}; /** * 获取树结构 - * @param params - * @returns + * @param params + * @returns */ export const tree = () => defHttp.get({ url: Api.tree }); @@ -107,4 +123,13 @@ export const syncMediaForBiz = (params) => { */ export const syncMediaForAllBiz = (params) => { return defHttp.post({ url: Api.syncMediaForAllBiz, params }); -}; \ No newline at end of file +}; + +/** + * 同步 + * @param params + * @returns + */ +export const syncDirective = (dataSourceCode: string, params: any) => { + return defHttp.post({ url: `${Api.syncDirective}?sourceOrgCode=${encodeURIComponent(dataSourceCode)}`, params }); +}; diff --git a/src/views/services/serviceDirective/ConfigServiceDirectiveList.vue b/src/views/services/serviceDirective/ConfigServiceDirectiveList.vue index dcea80c..96cc707 100644 --- a/src/views/services/serviceDirective/ConfigServiceDirectiveList.vue +++ b/src/views/services/serviceDirective/ConfigServiceDirectiveList.vue @@ -128,6 +128,8 @@ preIcon="tabler:settings">配置情绪标签 + 指令库 - + + :formBpm="false" :mainOrgCode="mainOrgCode"> + + + + diff --git a/src/views/services/serviceDirective/components/DirectiveRespositoryList.vue b/src/views/services/serviceDirective/components/DirectiveRespositoryList.vue new file mode 100644 index 0000000..a9abfa2 --- /dev/null +++ b/src/views/services/serviceDirective/components/DirectiveRespositoryList.vue @@ -0,0 +1,376 @@ + + + + +