diff --git a/.env.development b/.env.development index aaa71a7..742f90b 100644 --- a/.env.development +++ b/.env.development @@ -5,6 +5,7 @@ # VITE_APP_API_BASEURL = http://111.198.10.15:21409 VITE_APP_API_BASEURL = http://111.198.10.15:21609 # VITE_APP_API_BASEURL = http://192.168.83.213:8085 +# VITE_APP_API_BASEURL = http://192.168.83.30:5909 # 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空 VITE_APP_DEBUG_TOOL = diff --git a/.env.development b/.env.development index aaa71a7..742f90b 100644 --- a/.env.development +++ b/.env.development @@ -5,6 +5,7 @@ # VITE_APP_API_BASEURL = http://111.198.10.15:21409 VITE_APP_API_BASEURL = http://111.198.10.15:21609 # VITE_APP_API_BASEURL = http://192.168.83.213:8085 +# VITE_APP_API_BASEURL = http://192.168.83.30:5909 # 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空 VITE_APP_DEBUG_TOOL = diff --git a/src/api/business/lab/primitiveLogList.ts b/src/api/business/lab/primitiveLogList.ts index f8143b7..95eb183 100644 --- a/src/api/business/lab/primitiveLogList.ts +++ b/src/api/business/lab/primitiveLogList.ts @@ -2,7 +2,7 @@ * 原始记录接口 */ import request from '../../index' -import type { IListQuery } from '@/views/business/lab/primitiveLog/primitiveLogList' +import type { IListQuery, IListQuerySample } from '@/views/business/lab/primitiveLog/primitiveLogList' const prefix = '/business/originalRecord' // 列表查询 @@ -60,3 +60,12 @@ }) } +// 根据委托单id查询关联样品信息(分页) +export function getSamplesByOderId(data: IListQuerySample) { + return request({ + url: `${prefix}/samplesByOderId?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} + diff --git a/.env.development b/.env.development index aaa71a7..742f90b 100644 --- a/.env.development +++ b/.env.development @@ -5,6 +5,7 @@ # VITE_APP_API_BASEURL = http://111.198.10.15:21409 VITE_APP_API_BASEURL = http://111.198.10.15:21609 # VITE_APP_API_BASEURL = http://192.168.83.213:8085 +# VITE_APP_API_BASEURL = http://192.168.83.30:5909 # 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空 VITE_APP_DEBUG_TOOL = diff --git a/src/api/business/lab/primitiveLogList.ts b/src/api/business/lab/primitiveLogList.ts index f8143b7..95eb183 100644 --- a/src/api/business/lab/primitiveLogList.ts +++ b/src/api/business/lab/primitiveLogList.ts @@ -2,7 +2,7 @@ * 原始记录接口 */ import request from '../../index' -import type { IListQuery } from '@/views/business/lab/primitiveLog/primitiveLogList' +import type { IListQuery, IListQuerySample } from '@/views/business/lab/primitiveLog/primitiveLogList' const prefix = '/business/originalRecord' // 列表查询 @@ -60,3 +60,12 @@ }) } +// 根据委托单id查询关联样品信息(分页) +export function getSamplesByOderId(data: IListQuerySample) { + return request({ + url: `${prefix}/samplesByOderId?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} + diff --git a/src/api/business/lab/report.ts b/src/api/business/lab/report.ts index a027580..0e05759 100644 --- a/src/api/business/lab/report.ts +++ b/src/api/business/lab/report.ts @@ -42,14 +42,14 @@ }) } -// // 新建 -// export function addPrimitiveLog(data: any) { -// return request({ -// url: `${prefix}/add`, -// method: 'post', -// data, -// }) -// } +// 新建 +export function addReport(data: any) { + return request({ + url: `${prefix}/save`, + method: 'post', + data, + }) +} // // 编辑 // export function updatePrimitiveLog(data: any) { diff --git a/.env.development b/.env.development index aaa71a7..742f90b 100644 --- a/.env.development +++ b/.env.development @@ -5,6 +5,7 @@ # VITE_APP_API_BASEURL = http://111.198.10.15:21409 VITE_APP_API_BASEURL = http://111.198.10.15:21609 # VITE_APP_API_BASEURL = http://192.168.83.213:8085 +# VITE_APP_API_BASEURL = http://192.168.83.30:5909 # 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空 VITE_APP_DEBUG_TOOL = diff --git a/src/api/business/lab/primitiveLogList.ts b/src/api/business/lab/primitiveLogList.ts index f8143b7..95eb183 100644 --- a/src/api/business/lab/primitiveLogList.ts +++ b/src/api/business/lab/primitiveLogList.ts @@ -2,7 +2,7 @@ * 原始记录接口 */ import request from '../../index' -import type { IListQuery } from '@/views/business/lab/primitiveLog/primitiveLogList' +import type { IListQuery, IListQuerySample } from '@/views/business/lab/primitiveLog/primitiveLogList' const prefix = '/business/originalRecord' // 列表查询 @@ -60,3 +60,12 @@ }) } +// 根据委托单id查询关联样品信息(分页) +export function getSamplesByOderId(data: IListQuerySample) { + return request({ + url: `${prefix}/samplesByOderId?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} + diff --git a/src/api/business/lab/report.ts b/src/api/business/lab/report.ts index a027580..0e05759 100644 --- a/src/api/business/lab/report.ts +++ b/src/api/business/lab/report.ts @@ -42,14 +42,14 @@ }) } -// // 新建 -// export function addPrimitiveLog(data: any) { -// return request({ -// url: `${prefix}/add`, -// method: 'post', -// data, -// }) -// } +// 新建 +export function addReport(data: any) { + return request({ + url: `${prefix}/save`, + method: 'post', + data, + }) +} // // 编辑 // export function updatePrimitiveLog(data: any) { diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index cfcbfaf..45b4fe4 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -4,6 +4,7 @@ import { doLogin, getConfig, getInfo, getUserMenus } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' +import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' const useUserStore = defineStore( // 唯一ID @@ -20,6 +21,7 @@ attr1: '', // 备用属性 tenantId: '', // 租户id publicKey: localStorage.publicKey || '', // 公钥 + privateKey: getPrivateKey() || '', // 私钥 roleList: [] as string[], // 角色id集合 roleNames: [] as string[], // 角色名称集合 roleTips: [] as string[], // 角色标签集合 @@ -47,6 +49,9 @@ getPublicKey: (state) => { return state.publicKey }, + getPrivateKey: (state) => { + return state.privateKey + }, getMenus: (state): Menu.menu[] => { return state.menus }, @@ -61,6 +66,9 @@ getConfig().then((res) => { this.publicKey = res.data.publicKey localStorage.setItem('publicKey', res.data.publicKey) + // 保存私钥 + setPrivateKey(privateStr) + this.privateKey = privateStr resolve(res.data) }).catch((e) => { reject(e) diff --git a/.env.development b/.env.development index aaa71a7..742f90b 100644 --- a/.env.development +++ b/.env.development @@ -5,6 +5,7 @@ # VITE_APP_API_BASEURL = http://111.198.10.15:21409 VITE_APP_API_BASEURL = http://111.198.10.15:21609 # VITE_APP_API_BASEURL = http://192.168.83.213:8085 +# VITE_APP_API_BASEURL = http://192.168.83.30:5909 # 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空 VITE_APP_DEBUG_TOOL = diff --git a/src/api/business/lab/primitiveLogList.ts b/src/api/business/lab/primitiveLogList.ts index f8143b7..95eb183 100644 --- a/src/api/business/lab/primitiveLogList.ts +++ b/src/api/business/lab/primitiveLogList.ts @@ -2,7 +2,7 @@ * 原始记录接口 */ import request from '../../index' -import type { IListQuery } from '@/views/business/lab/primitiveLog/primitiveLogList' +import type { IListQuery, IListQuerySample } from '@/views/business/lab/primitiveLog/primitiveLogList' const prefix = '/business/originalRecord' // 列表查询 @@ -60,3 +60,12 @@ }) } +// 根据委托单id查询关联样品信息(分页) +export function getSamplesByOderId(data: IListQuerySample) { + return request({ + url: `${prefix}/samplesByOderId?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} + diff --git a/src/api/business/lab/report.ts b/src/api/business/lab/report.ts index a027580..0e05759 100644 --- a/src/api/business/lab/report.ts +++ b/src/api/business/lab/report.ts @@ -42,14 +42,14 @@ }) } -// // 新建 -// export function addPrimitiveLog(data: any) { -// return request({ -// url: `${prefix}/add`, -// method: 'post', -// data, -// }) -// } +// 新建 +export function addReport(data: any) { + return request({ + url: `${prefix}/save`, + method: 'post', + data, + }) +} // // 编辑 // export function updatePrimitiveLog(data: any) { diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index cfcbfaf..45b4fe4 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -4,6 +4,7 @@ import { doLogin, getConfig, getInfo, getUserMenus } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' +import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' const useUserStore = defineStore( // 唯一ID @@ -20,6 +21,7 @@ attr1: '', // 备用属性 tenantId: '', // 租户id publicKey: localStorage.publicKey || '', // 公钥 + privateKey: getPrivateKey() || '', // 私钥 roleList: [] as string[], // 角色id集合 roleNames: [] as string[], // 角色名称集合 roleTips: [] as string[], // 角色标签集合 @@ -47,6 +49,9 @@ getPublicKey: (state) => { return state.publicKey }, + getPrivateKey: (state) => { + return state.privateKey + }, getMenus: (state): Menu.menu[] => { return state.menus }, @@ -61,6 +66,9 @@ getConfig().then((res) => { this.publicKey = res.data.publicKey localStorage.setItem('publicKey', res.data.publicKey) + // 保存私钥 + setPrivateKey(privateStr) + this.privateKey = privateStr resolve(res.data) }).catch((e) => { reject(e) diff --git a/src/utils/auth.ts b/src/utils/auth.ts new file mode 100644 index 0000000..fb2046a --- /dev/null +++ b/src/utils/auth.ts @@ -0,0 +1,14 @@ +const PrivateKey = 'private_key' // 私钥 +export const privateStr = 'MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAK7mTyBxMUnLlS0x+a0qJHd/8RxR73eTN+15GPr6wzl8dG86Jvzb66pAyOBpFmIxyvceIcgVjm8Dpz5F9vlHYI6K2g6HHID1TZ4teSfPEtRAgCpcC8pA7wqd6sDVCNx2zvGEkHZc+FYWVjhFW0xPbCvaUx3b1AMTgX+TPIOE0GnHAgMBAAECgYEAhJApfzRsIDu++L99N4POmgiOLmHn+CDMbiCwD2LLX6H1+mwAKv1hVOy/lF/ySEDnToA3KJk2GOyS8X9EH1K7WmxRcJ1am1JLwy+spHkExQzvAO9mrEhtavpwAZLiBoCUB4uQazETHncM0lNXtUYY8Ydd/zKodCMVPN4tql84f0kCQQDrPEgk6vdAc8vW1JL3ldhRkbl7DKuvDhhoixGEbXrsXXiKN6iB0A3lNTptMxcd1TjSJz8CF8piGRpVyLGoZOYLAkEAvlaXoVXndT+hbsStjORp2RGxZWMPyyyJ4Kw2TnMaUuODXA0PtnYcSA5lI6SpVAvTthSX7VDi5C9xLyc+QRvMtQJAVjzhTfd98XkCL536yx16El1UHFJG1oRaWmkxYNUqDWEvAazp770weukKpGHohZ1XmWOd68yA+3msd+p9hviGhQJAUIntgUwLM3aoRWmdkhd4nmw5JxCCt1LySIo2NH3J7rbsd3/jXS6fCvJkY2+iYrjabZpLKxTl3O4iM3SkiAJOXQJBAN++IAMMs7HVTQnsIN+L+tQwcWM5jn0sSRLGFvSkPjlT2W++qJNTW/oswmcQTPFn7Vf3GaE5JF6XAxrZMOZBG00=' +// 获取私钥 +export function getPrivateKey() { + return window.localStorage.getItem(PrivateKey) +} +// 设置私钥 +export function setPrivateKey(privateKey: string) { + return window.localStorage.setItem(PrivateKey, privateKey) +} +// 移除私钥 +export function removePrivateKey() { + return window.localStorage.removeItem(PrivateKey) +} diff --git a/.env.development b/.env.development index aaa71a7..742f90b 100644 --- a/.env.development +++ b/.env.development @@ -5,6 +5,7 @@ # VITE_APP_API_BASEURL = http://111.198.10.15:21409 VITE_APP_API_BASEURL = http://111.198.10.15:21609 # VITE_APP_API_BASEURL = http://192.168.83.213:8085 +# VITE_APP_API_BASEURL = http://192.168.83.30:5909 # 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空 VITE_APP_DEBUG_TOOL = diff --git a/src/api/business/lab/primitiveLogList.ts b/src/api/business/lab/primitiveLogList.ts index f8143b7..95eb183 100644 --- a/src/api/business/lab/primitiveLogList.ts +++ b/src/api/business/lab/primitiveLogList.ts @@ -2,7 +2,7 @@ * 原始记录接口 */ import request from '../../index' -import type { IListQuery } from '@/views/business/lab/primitiveLog/primitiveLogList' +import type { IListQuery, IListQuerySample } from '@/views/business/lab/primitiveLog/primitiveLogList' const prefix = '/business/originalRecord' // 列表查询 @@ -60,3 +60,12 @@ }) } +// 根据委托单id查询关联样品信息(分页) +export function getSamplesByOderId(data: IListQuerySample) { + return request({ + url: `${prefix}/samplesByOderId?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} + diff --git a/src/api/business/lab/report.ts b/src/api/business/lab/report.ts index a027580..0e05759 100644 --- a/src/api/business/lab/report.ts +++ b/src/api/business/lab/report.ts @@ -42,14 +42,14 @@ }) } -// // 新建 -// export function addPrimitiveLog(data: any) { -// return request({ -// url: `${prefix}/add`, -// method: 'post', -// data, -// }) -// } +// 新建 +export function addReport(data: any) { + return request({ + url: `${prefix}/save`, + method: 'post', + data, + }) +} // // 编辑 // export function updatePrimitiveLog(data: any) { diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index cfcbfaf..45b4fe4 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -4,6 +4,7 @@ import { doLogin, getConfig, getInfo, getUserMenus } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' +import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' const useUserStore = defineStore( // 唯一ID @@ -20,6 +21,7 @@ attr1: '', // 备用属性 tenantId: '', // 租户id publicKey: localStorage.publicKey || '', // 公钥 + privateKey: getPrivateKey() || '', // 私钥 roleList: [] as string[], // 角色id集合 roleNames: [] as string[], // 角色名称集合 roleTips: [] as string[], // 角色标签集合 @@ -47,6 +49,9 @@ getPublicKey: (state) => { return state.publicKey }, + getPrivateKey: (state) => { + return state.privateKey + }, getMenus: (state): Menu.menu[] => { return state.menus }, @@ -61,6 +66,9 @@ getConfig().then((res) => { this.publicKey = res.data.publicKey localStorage.setItem('publicKey', res.data.publicKey) + // 保存私钥 + setPrivateKey(privateStr) + this.privateKey = privateStr resolve(res.data) }).catch((e) => { reject(e) diff --git a/src/utils/auth.ts b/src/utils/auth.ts new file mode 100644 index 0000000..fb2046a --- /dev/null +++ b/src/utils/auth.ts @@ -0,0 +1,14 @@ +const PrivateKey = 'private_key' // 私钥 +export const privateStr = 'MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAK7mTyBxMUnLlS0x+a0qJHd/8RxR73eTN+15GPr6wzl8dG86Jvzb66pAyOBpFmIxyvceIcgVjm8Dpz5F9vlHYI6K2g6HHID1TZ4teSfPEtRAgCpcC8pA7wqd6sDVCNx2zvGEkHZc+FYWVjhFW0xPbCvaUx3b1AMTgX+TPIOE0GnHAgMBAAECgYEAhJApfzRsIDu++L99N4POmgiOLmHn+CDMbiCwD2LLX6H1+mwAKv1hVOy/lF/ySEDnToA3KJk2GOyS8X9EH1K7WmxRcJ1am1JLwy+spHkExQzvAO9mrEhtavpwAZLiBoCUB4uQazETHncM0lNXtUYY8Ydd/zKodCMVPN4tql84f0kCQQDrPEgk6vdAc8vW1JL3ldhRkbl7DKuvDhhoixGEbXrsXXiKN6iB0A3lNTptMxcd1TjSJz8CF8piGRpVyLGoZOYLAkEAvlaXoVXndT+hbsStjORp2RGxZWMPyyyJ4Kw2TnMaUuODXA0PtnYcSA5lI6SpVAvTthSX7VDi5C9xLyc+QRvMtQJAVjzhTfd98XkCL536yx16El1UHFJG1oRaWmkxYNUqDWEvAazp770weukKpGHohZ1XmWOd68yA+3msd+p9hviGhQJAUIntgUwLM3aoRWmdkhd4nmw5JxCCt1LySIo2NH3J7rbsd3/jXS6fCvJkY2+iYrjabZpLKxTl3O4iM3SkiAJOXQJBAN++IAMMs7HVTQnsIN+L+tQwcWM5jn0sSRLGFvSkPjlT2W++qJNTW/oswmcQTPFn7Vf3GaE5JF6XAxrZMOZBG00=' +// 获取私钥 +export function getPrivateKey() { + return window.localStorage.getItem(PrivateKey) +} +// 设置私钥 +export function setPrivateKey(privateKey: string) { + return window.localStorage.setItem(PrivateKey, privateKey) +} +// 移除私钥 +export function removePrivateKey() { + return window.localStorage.removeItem(PrivateKey) +} diff --git a/src/utils/security.ts b/src/utils/security.ts index 9252b14..160b4b0 100644 --- a/src/utils/security.ts +++ b/src/utils/security.ts @@ -28,4 +28,25 @@ } return enRes } - +/** + * 解密 + * @param value 待解密数据 + * @returns 解密结果 + */ +export async function RSAdecrypt(value: string): Promise { + var encrypt = new JsEncrypt() + let enRes = '' + if (userStore.getPrivateKey && userStore.getPrivateKey === '') { + const res = await userStore.getBaseConfig() + if (res && res.privateKey) { + const privateKey = res.privateKey + encrypt.setPrivateKey(privateKey) + enRes = encrypt.decrypt(value) || '' + } + } + else { + encrypt.setPrivateKey(userStore.getPrivateKey) + enRes = encrypt.decrypt(value) || '' + } + return enRes +} diff --git a/.env.development b/.env.development index aaa71a7..742f90b 100644 --- a/.env.development +++ b/.env.development @@ -5,6 +5,7 @@ # VITE_APP_API_BASEURL = http://111.198.10.15:21409 VITE_APP_API_BASEURL = http://111.198.10.15:21609 # VITE_APP_API_BASEURL = http://192.168.83.213:8085 +# VITE_APP_API_BASEURL = http://192.168.83.30:5909 # 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空 VITE_APP_DEBUG_TOOL = diff --git a/src/api/business/lab/primitiveLogList.ts b/src/api/business/lab/primitiveLogList.ts index f8143b7..95eb183 100644 --- a/src/api/business/lab/primitiveLogList.ts +++ b/src/api/business/lab/primitiveLogList.ts @@ -2,7 +2,7 @@ * 原始记录接口 */ import request from '../../index' -import type { IListQuery } from '@/views/business/lab/primitiveLog/primitiveLogList' +import type { IListQuery, IListQuerySample } from '@/views/business/lab/primitiveLog/primitiveLogList' const prefix = '/business/originalRecord' // 列表查询 @@ -60,3 +60,12 @@ }) } +// 根据委托单id查询关联样品信息(分页) +export function getSamplesByOderId(data: IListQuerySample) { + return request({ + url: `${prefix}/samplesByOderId?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} + diff --git a/src/api/business/lab/report.ts b/src/api/business/lab/report.ts index a027580..0e05759 100644 --- a/src/api/business/lab/report.ts +++ b/src/api/business/lab/report.ts @@ -42,14 +42,14 @@ }) } -// // 新建 -// export function addPrimitiveLog(data: any) { -// return request({ -// url: `${prefix}/add`, -// method: 'post', -// data, -// }) -// } +// 新建 +export function addReport(data: any) { + return request({ + url: `${prefix}/save`, + method: 'post', + data, + }) +} // // 编辑 // export function updatePrimitiveLog(data: any) { diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index cfcbfaf..45b4fe4 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -4,6 +4,7 @@ import { doLogin, getConfig, getInfo, getUserMenus } from '@/api/system/login' import { changePwd } from '@/api/system/user' import type { Menu } from '@/global' +import { getPrivateKey, privateStr, setPrivateKey } from '@/utils/auth' const useUserStore = defineStore( // 唯一ID @@ -20,6 +21,7 @@ attr1: '', // 备用属性 tenantId: '', // 租户id publicKey: localStorage.publicKey || '', // 公钥 + privateKey: getPrivateKey() || '', // 私钥 roleList: [] as string[], // 角色id集合 roleNames: [] as string[], // 角色名称集合 roleTips: [] as string[], // 角色标签集合 @@ -47,6 +49,9 @@ getPublicKey: (state) => { return state.publicKey }, + getPrivateKey: (state) => { + return state.privateKey + }, getMenus: (state): Menu.menu[] => { return state.menus }, @@ -61,6 +66,9 @@ getConfig().then((res) => { this.publicKey = res.data.publicKey localStorage.setItem('publicKey', res.data.publicKey) + // 保存私钥 + setPrivateKey(privateStr) + this.privateKey = privateStr resolve(res.data) }).catch((e) => { reject(e) diff --git a/src/utils/auth.ts b/src/utils/auth.ts new file mode 100644 index 0000000..fb2046a --- /dev/null +++ b/src/utils/auth.ts @@ -0,0 +1,14 @@ +const PrivateKey = 'private_key' // 私钥 +export const privateStr = 'MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAK7mTyBxMUnLlS0x+a0qJHd/8RxR73eTN+15GPr6wzl8dG86Jvzb66pAyOBpFmIxyvceIcgVjm8Dpz5F9vlHYI6K2g6HHID1TZ4teSfPEtRAgCpcC8pA7wqd6sDVCNx2zvGEkHZc+FYWVjhFW0xPbCvaUx3b1AMTgX+TPIOE0GnHAgMBAAECgYEAhJApfzRsIDu++L99N4POmgiOLmHn+CDMbiCwD2LLX6H1+mwAKv1hVOy/lF/ySEDnToA3KJk2GOyS8X9EH1K7WmxRcJ1am1JLwy+spHkExQzvAO9mrEhtavpwAZLiBoCUB4uQazETHncM0lNXtUYY8Ydd/zKodCMVPN4tql84f0kCQQDrPEgk6vdAc8vW1JL3ldhRkbl7DKuvDhhoixGEbXrsXXiKN6iB0A3lNTptMxcd1TjSJz8CF8piGRpVyLGoZOYLAkEAvlaXoVXndT+hbsStjORp2RGxZWMPyyyJ4Kw2TnMaUuODXA0PtnYcSA5lI6SpVAvTthSX7VDi5C9xLyc+QRvMtQJAVjzhTfd98XkCL536yx16El1UHFJG1oRaWmkxYNUqDWEvAazp770weukKpGHohZ1XmWOd68yA+3msd+p9hviGhQJAUIntgUwLM3aoRWmdkhd4nmw5JxCCt1LySIo2NH3J7rbsd3/jXS6fCvJkY2+iYrjabZpLKxTl3O4iM3SkiAJOXQJBAN++IAMMs7HVTQnsIN+L+tQwcWM5jn0sSRLGFvSkPjlT2W++qJNTW/oswmcQTPFn7Vf3GaE5JF6XAxrZMOZBG00=' +// 获取私钥 +export function getPrivateKey() { + return window.localStorage.getItem(PrivateKey) +} +// 设置私钥 +export function setPrivateKey(privateKey: string) { + return window.localStorage.setItem(PrivateKey, privateKey) +} +// 移除私钥 +export function removePrivateKey() { + return window.localStorage.removeItem(PrivateKey) +} diff --git a/src/utils/security.ts b/src/utils/security.ts index 9252b14..160b4b0 100644 --- a/src/utils/security.ts +++ b/src/utils/security.ts @@ -28,4 +28,25 @@ } return enRes } - +/** + * 解密 + * @param value 待解密数据 + * @returns 解密结果 + */ +export async function RSAdecrypt(value: string): Promise { + var encrypt = new JsEncrypt() + let enRes = '' + if (userStore.getPrivateKey && userStore.getPrivateKey === '') { + const res = await userStore.getBaseConfig() + if (res && res.privateKey) { + const privateKey = res.privateKey + encrypt.setPrivateKey(privateKey) + enRes = encrypt.decrypt(value) || '' + } + } + else { + encrypt.setPrivateKey(userStore.getPrivateKey) + enRes = encrypt.decrypt(value) || '' + } + return enRes +} diff --git a/src/views/business/lab/components/selectSample.vue b/src/views/business/lab/components/selectSample.vue index 6ff117e..e21a8dc 100644 --- a/src/views/business/lab/components/selectSample.vue +++ b/src/views/business/lab/components/selectSample.vue @@ -3,10 +3,10 @@ import { ref } from 'vue' import type { Ref } from 'vue' import { ElMessage } from 'element-plus' -import type { ISampleListQuery } from '@/views/business/schedule/interchangeReceipt/receiptList-interface' +import type { IListQuerySample } from '@/views/business/lab/primitiveLog/primitiveLogList' import type { ISampleList } from '@/views/customer/sample/list/sample_list_interface' import type { TableColumn } from '@/components/NormalTable/table_interface' -import { getSampleList } from '@/api/business/schedule/interchangeReceipt' +import { getSamplesByOderId } from '@/api/business/lab/primitiveLogList' const props = defineProps({ visible: { @@ -17,14 +17,23 @@ type: String, default: '', }, + orderId: { + type: String, + default: '', + }, }) const emits = defineEmits(['changeVisible', 'clickConfirmSample']) // 查询条件 -const listQuery: Ref = ref({ +const listQuery: Ref = ref({ + id: '', // 原始记录单id----(在这里后端要求传委托书id) + manufacturingNo: '', // 出厂编号 + measureCategory: '', // 校验类别 + originalRecordCode: '', // 原始记录单编号 + sampleModel: '', // 样品型号 + sampleName: '', // 样品名称 + sampleNo: '', // 样品编号 customerId: '', // 委托方id - sampleName: '', // 样品名称 - sampleNo: '', // 样品编号 offset: 1, limit: 20, }) @@ -58,13 +67,9 @@ listQuery.value.offset = 1 } listQuery.value.customerId = props.customerId - getSampleList(listQuery.value).then((response) => { - list.value = response.data.rows.map((item: any) => { - return { - ...item, - id: item.sampleId, - } - }) + listQuery.value.id = props.orderId + getSamplesByOderId(listQuery.value).then((response) => { + list.value = response.data.rows total.value = parseInt(response.data.total) loadingTable.value = false }) @@ -86,9 +91,14 @@ // 点击重置 const clearList = () => { listQuery.value = { + id: '', // 原始记录单id----(在这里后端要求传委托书id) + manufacturingNo: '', // 出厂编号 + measureCategory: '', // 校验类别 + originalRecordCode: '', // 原始记录单编号 + sampleModel: '', // 样品型号 + sampleName: '', // 样品名称 + sampleNo: '', // 样品编号 customerId: '', // 委托方id - sampleName: '', // 样品名称 - sampleNo: '', // 样品编号 offset: 1, limit: 20, } @@ -162,7 +172,7 @@ is-showmulti-select :is-multi="false" @change="changePage" - @multiSelect="handleSelectionChange" + @multi-select="handleSelectionChange" >