diff --git a/components/company-dept-dialog/company-dept-dialog.vue b/components/company-dept-dialog/company-dept-dialog.vue new file mode 100644 index 0000000..08e2799 --- /dev/null +++ b/components/company-dept-dialog/company-dept-dialog.vue @@ -0,0 +1,196 @@ + + + + + diff --git a/components/n-layout/n-layout.vue b/components/n-layout/n-layout.vue new file mode 100644 index 0000000..0f09f85 --- /dev/null +++ b/components/n-layout/n-layout.vue @@ -0,0 +1,10 @@ + + + + + diff --git a/defaultBaseUrl.js b/defaultBaseUrl.js index 537b5ee..5e209e7 100644 --- a/defaultBaseUrl.js +++ b/defaultBaseUrl.js @@ -1,8 +1,8 @@ // 在此不用配置接口前缀 const isDev = process.env.NODE_ENV === 'development' -// const BaseUrl = isDev ? 'http://192.168.26.116:888/admin-api' : 'http://192.168.26.116:888/admin-api' -const BaseUrl = isDev ? 'http://192.168.26.163:48080/admin-api' : 'http://192.168.26.116:888/admin-api' -// +const BaseUrl = isDev ? 'http://192.168.26.116:888/admin-api' : 'http://192.168.26.116:888/admin-api' +// const BaseUrl = isDev ? 'http://192.168.26.163:48080/admin-api' : 'http://192.168.26.116:888/admin-api' +// // const BaseUrl = isDev ? 'http://localhost:9999' : '' const upgradeBaseUrl = 'http://192.168.26.116:888' diff --git a/nx/api/sampleWarehouse.js b/nx/api/sampleWarehouse.js index 5ca4fde..d3706ca 100644 --- a/nx/api/sampleWarehouse.js +++ b/nx/api/sampleWarehouse.js @@ -63,6 +63,7 @@ export default { method: 'GET', params }), + //调拨归还执行 execGiveback: data => request({ diff --git a/nx/config/index.js b/nx/config/index.js index dbdbe19..a5146a6 100644 --- a/nx/config/index.js +++ b/nx/config/index.js @@ -25,6 +25,11 @@ export const apiCrypto = { export const clientSecret = ' 2E1TFEkR8YaOcLhp' // 附件前缀 export const attachmentKey = 'lims_attachment' +// 公司部门重试请求头 +export const COMPANY_DEPT_RETRY_HEADER = '__companyDeptRetried' +export const VISIT_COMPANY_STORAGE_KEY = 'visit-company-info' +export const VISIT_DEPT_STORAGE_KEY = 'visit-dept-info' + export default { apiPath, apiCrypto, diff --git a/nx/request/index.js b/nx/request/index.js index 474cf7c..d730b71 100644 --- a/nx/request/index.js +++ b/nx/request/index.js @@ -7,6 +7,7 @@ import Request from 'luch-request' import { getBaseUrl, getTenantId } from '@/defaultBaseUrl' import $store from '@/nx/store' import qs from 'qs' +import { COMPANY_DEPT_RETRY_HEADER, VISIT_COMPANY_STORAGE_KEY, VISIT_DEPT_STORAGE_KEY } from '@/nx/config' const options = { // 显示操作成功消息 默认不显示 @@ -27,9 +28,6 @@ const options = { isTransformResponse: true } -const COMPANY_DEPT_RETRY_HEADER = '__companyDeptRetried' -const VISIT_COMPANY_STORAGE_KEY = 'visit-company-info' -const VISIT_DEPT_STORAGE_KEY = 'visit-dept-info' // Loading全局实例 let LoadingInstance = { target: null, @@ -99,27 +97,19 @@ http.interceptors.request.use( config.header['Pragma'] = 'no-cache' } - let params = config.params || {} - let data = config.data || false - // if (process.env.NODE_ENV == 'development') console.log('development--params', params) - // if (process.env.NODE_ENV == 'development') console.log('development--data', data) - - // const visitCompanyId = getVisitCompanyId() - const visitCompanyId = '101' + const visitCompanyId = getVisitCompanyId() if (visitCompanyId !== undefined && visitCompanyId !== null && visitCompanyId !== '') { config.header['visit-company-id'] = visitCompanyId - // const visitCompanyName = getVisitCompanyName() - const visitCompanyName = '"深圳总公司' + const visitCompanyName = getVisitCompanyName() if (visitCompanyName !== undefined && visitCompanyName !== null) { config.header['visit-company-name'] = encodeURIComponent(visitCompanyName || '') } } - // const visitDeptId = getVisitDeptId() - const visitDeptId = '103' + const visitDeptId = getVisitDeptId() if (visitDeptId !== undefined && visitDeptId !== null && visitDeptId !== '') { config.header['visit-dept-id'] = visitDeptId - // const visitDeptName = getVisitDeptName() - const visitDeptName = '研发部门' + const visitDeptName = getVisitDeptName() + if (visitDeptName !== undefined && visitDeptName !== null) { config.header['visit-dept-name'] = encodeURIComponent(visitDeptName || '') } @@ -153,7 +143,6 @@ http.interceptors.response.use( // 统一处理【公司/部门二次选择】:参考 PC 端逻辑,自动补全或提示选择后重试 if (code === 400 && Array.isArray(data)) { - debugger const companyDeptList = data const config = response.config config.header = config.header || {} @@ -161,7 +150,7 @@ http.interceptors.response.use( const item = companyDeptList[0] if (!config.header[COMPANY_DEPT_RETRY_HEADER]) { applyCompanyDeptSelection(item, config) - return request(config) + return http.request(config) } uni.showToast({ title: '公司/部门信息缺失,且自动补全失败,请联系管理员', @@ -187,7 +176,7 @@ http.interceptors.response.use( }, config ) - resolve(request(config)) + resolve(http.request(config)) }, onCancel: () => { uni.showToast({ diff --git a/nx/store/company-dept.js b/nx/store/company-dept.js index daa1b54..f48acda 100644 --- a/nx/store/company-dept.js +++ b/nx/store/company-dept.js @@ -1,4 +1,4 @@ -import { defineStore } from 'pinia'; +import { defineStore } from 'pinia' const defaultState = () => ({ show: false, @@ -7,60 +7,69 @@ const defaultState = () => ({ selectedCompanyId: null, selectedDeptId: null, onConfirm: null, - onCancel: null, -}); + onCancel: null +}) const companyDeptStore = defineStore({ id: 'company-dept', state: defaultState, actions: { - open({ companyList = [], onConfirm = null, onCancel = null, defaultCompanyId = null, defaultDeptId = null, title = null }) { - this.companyList = companyList; - this.onConfirm = onConfirm; - this.onCancel = onCancel; - this.title = title || '请选择当前业务办理归属的公司部门信息'; - this.show = true; - this.selectedCompanyId = defaultCompanyId; - this.selectedDeptId = defaultDeptId; + open({ + companyList = [], + onConfirm = null, + onCancel = null, + defaultCompanyId = null, + defaultDeptId = null, + title = null + }) { + this.companyList = companyList + this.onConfirm = onConfirm + this.onCancel = onCancel + this.title = title || '请选择当前业务办理归属的公司部门信息' + this.show = true + this.selectedCompanyId = defaultCompanyId + this.selectedDeptId = defaultDeptId if (!this.selectedCompanyId && this.companyList.length > 0) { - this.selectedCompanyId = this.companyList[0].companyId; + this.selectedCompanyId = this.companyList[0].companyId } if (!this.selectedDeptId) { - const depts = this.getDeptsByCompanyId(this.selectedCompanyId); - this.selectedDeptId = depts.length > 0 ? depts[0].deptId : null; + const depts = this.getDeptsByCompanyId(this.selectedCompanyId) + this.selectedDeptId = depts.length > 0 ? depts[0].deptId : null } }, close() { - Object.assign(this, defaultState()); + this.show = false }, getDeptsByCompanyId(companyId) { - const company = this.companyList.find((item) => item.companyId === companyId); - return company?.depts || []; + const company = this.companyList.find(item => item.companyId === companyId) + return company?.depts || [] }, setSelectedCompany(companyId) { - this.selectedCompanyId = companyId; - const depts = this.getDeptsByCompanyId(companyId); - const currentDeptIds = depts.map((dept) => dept.deptId); + console.log(companyId) + + this.selectedCompanyId = companyId + const depts = this.getDeptsByCompanyId(companyId) + const currentDeptIds = depts.map(dept => dept.deptId) if (!currentDeptIds.includes(this.selectedDeptId)) { - this.selectedDeptId = depts.length > 0 ? depts[0].deptId : null; + this.selectedDeptId = depts.length > 0 ? depts[0].deptId : null } }, setSelectedDept(deptId) { - this.selectedDeptId = deptId; + this.selectedDeptId = deptId }, confirm() { if (this.onConfirm) { - this.onConfirm({ companyId: this.selectedCompanyId, deptId: this.selectedDeptId }); + this.onConfirm({ companyId: this.selectedCompanyId, deptId: this.selectedDeptId }) } - this.close(); + this.close() }, cancel() { if (this.onCancel) { - this.onCancel(); + this.onCancel() } - this.close(); - }, - }, -}); + this.close() + } + } +}) -export default companyDeptStore; +export default companyDeptStore diff --git a/nx/store/user.js b/nx/store/user.js index 9548284..757da71 100644 --- a/nx/store/user.js +++ b/nx/store/user.js @@ -3,6 +3,7 @@ import userApi from '@/nx/api/user' import { getSysParameterBizByName } from '@/nx/api/sys' import md5 from 'md5' import nx from '@/nx' +import { COMPANY_DEPT_RETRY_HEADER, VISIT_COMPANY_STORAGE_KEY, VISIT_DEPT_STORAGE_KEY } from '@/nx/config' // 默认用户信息 const defaultUserInfo = { avatar: '', // 头像 @@ -128,6 +129,10 @@ const user = defineStore({ this.roleMenus = [] uni.setStorageSync('roleMenus', []) this.setToken() + // 清空部门信息 + uni.removeStorageSync(COMPANY_DEPT_RETRY_HEADER) + uni.removeStorageSync(VISIT_COMPANY_STORAGE_KEY) + uni.removeStorageSync(VISIT_DEPT_STORAGE_KEY) } } }) diff --git a/pages/analysis/index/index.vue b/pages/analysis/index/index.vue index 8e6e9e4..d44eda4 100644 --- a/pages/analysis/index/index.vue +++ b/pages/analysis/index/index.vue @@ -57,7 +57,7 @@ const goTo = url => { } // 生命周期 -onMounted(() => {}) + // 动态设置 grid 列数 const { gridCol } = useGridCol([400], [2, 3]) diff --git a/pages/analysis/sample/sample-report-search.vue b/pages/analysis/sample/sample-report-search.vue index f729bf1..dc3c5bd 100644 --- a/pages/analysis/sample/sample-report-search.vue +++ b/pages/analysis/sample/sample-report-search.vue @@ -96,7 +96,6 @@ import SampleDetailPopup from '@/components/sample/sample-detail-popup.vue' import TaskItem from './components/task-item.vue' import nx from '@/nx' import { useListData } from '@/nx/hooks/usePageListData' -import { getDataSourceTypeShow } from '../common' // 响应式数据 const scrollTop = ref(0) @@ -136,7 +135,8 @@ const showSampleDetail = (id, index) => { } const searchParams = computed(() => ({ taskAssignStatus: 'submitted', - taskAssayStatus: 'submitted' + taskAssayStatus: 'submitted', + assayOperator: userInfo.value.nickname })) const { listData, scrollToLower, loadStatus, getInitData } = useListData({ diff --git a/pages/analysis/sample/sample-work-list.vue b/pages/analysis/sample/sample-work-list.vue index e2cb133..5000bad 100644 --- a/pages/analysis/sample/sample-work-list.vue +++ b/pages/analysis/sample/sample-work-list.vue @@ -214,8 +214,8 @@ const getAssayTask = async () => { rollbackContent.value = '' const param = { taskAssignStatus: 'submitted', - taskAssayStatusList: ['not_start', 'saved'] - // assayOper: userInfo.value.nickname + taskAssayStatusList: ['not_start', 'saved'], + assayOperator: userInfo.value.nickname } const res = await nx.$api.assayTask.getAssayTaskList(param) if (res) { diff --git a/pages/index/index.vue b/pages/index/index.vue index 6fa3e54..ee4d6de 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -7,6 +7,7 @@ + diff --git a/pages/index/me-popup.vue b/pages/index/me-popup.vue index b3be615..d28141d 100644 --- a/pages/index/me-popup.vue +++ b/pages/index/me-popup.vue @@ -1,14 +1,19 @@ - + diff --git a/pages/me/index.vue b/pages/me/index.vue index 5bae3a8..eb1b632 100644 --- a/pages/me/index.vue +++ b/pages/me/index.vue @@ -1,6 +1,6 @@