diff --git a/defaultBaseUrl.js b/defaultBaseUrl.js index c038aa6..8d4dde1 100644 --- a/defaultBaseUrl.js +++ b/defaultBaseUrl.js @@ -1,9 +1,9 @@ // 在此不用配置接口前缀 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.190: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.190:48080/admin-api' : 'http://192.168.26.116:888/admin-api' -// const BaseUrl = isDev ? 'http://localhost:9999' : '' +// const BaseUrl = isDev ? 'http://localhost:9999' : '' const upgradeBaseUrl = 'http://192.168.26.116:888' const tenantId = '1' diff --git a/nx/api/sampleWarehouse.js b/nx/api/sampleWarehouse.js index 718f22c..f925768 100644 --- a/nx/api/sampleWarehouse.js +++ b/nx/api/sampleWarehouse.js @@ -1,9 +1,66 @@ import request from '@/nx/request' export default { + // 查询归库样品 + queryReturnToStockSample: params => + request({ + url: '/qms/business-sub-sample/page-stock', + method: 'GET', + params + }), + // 样品归库 execReturnToStock: data => request({ url: '/qms/business-sub-sample/execReturnToStock', method: 'GET', data + }), + // 库位变更 + execChangeLocation: data => + request({ + url: '/qms/business-sub-sample/execChangeLocation', + method: 'POST', + data + }), + // 样品调拨申请列表 + querySampleDispatchApply: params => + request({ + url: '/qms/business-sample-dispatch/page', + method: 'GET', + params + }), + // 调拨申请明细列表 + querySampleDispatchApplyDetail: params => + request({ + url: '/qms/business-sample-dispatch-detail/page', + method: 'GET', + params + }), + // 调拨执行 + execSampleDispatch: data => + request({ + url: '/qms/business-sample-dispatch/execDispatch', + method: 'POST', + data + }), + // 查询待归还样品 + searchBySampleCode: params => + request({ + url: 'qms/business-sample-dispatch-detail/searchBySampleCode', + method: 'GET', + params + }), + //调拨归还执行 + execGiveback: data => + request({ + url: '/qms/business-sample-dispatch/execGiveback', + method: 'POST', + data + }), + // 样品下架 + execTakeOff: data => + request({ + url: 'qms/business-sub-sample/execTakeOff', + method: 'POST', + data }) } diff --git a/nx/helper/calcAnalysisValue.js b/nx/helper/calcAnalysisValue.js index 287d5cc..9301f3c 100644 --- a/nx/helper/calcAnalysisValue.js +++ b/nx/helper/calcAnalysisValue.js @@ -8,50 +8,55 @@ export { math } /* * 计算当前样品分析值*/ export function calcAnalysisValue(group) { - try { - for (const g of group) { - for (const ele of g.fields) { - if (!ele.formula || ele.formula == '' || ele.formula.startsWith('From')) continue - let formula = ele.formula - let formulas = formula.split('|') - let formulaVal = '' - let hasNullVal = false - formulas.forEach(f => { - let value = '' - if (f.charAt(0) === 'p') { - let o = findFieldInGroup(f, group, 'p') - value = o.value - } else if (f.charAt(0) === 'e') { - let o = findFieldInGroup(f, group, 'e') - value = o.value - } else if (f.charAt(0) === '<' || f.charAt(0) === '>') { - value = "'" + f + "'" + const MAX_ITERATIONS = 5 // 防止无限循环 + let iterations = 0 + let changed = true + while (changed && iterations < MAX_ITERATIONS) { + changed = false + iterations++ + try { + for (const g of group) { + for (const ele of g.fields) { + if (!ele.formula || ele.formula == '' || ele.formula.startsWith('From')) continue + let formula = ele.formula + let formulas = formula.split('|') + let formulaVal = '' + console.log(formulas) + formulas.forEach(f => { + let value = '' + if (f.charAt(0) === 'p') { + let o = findFieldInGroup(f, group, 'p') + value = o.value || 0 + } else if (f.charAt(0) === 'e') { + let o = findFieldInGroup(f, group, 'e') + value = o.value || 0 + } else if (f.charAt(0) === '<' || f.charAt(0) === '>') { + value = "'" + f + "'" + } else { + value = f + } + + formulaVal += value + }) + console.log(formulaVal) + + let v + if (formulaVal.startsWith('Get')) { + //计算公式为Get开头的,都是执行方法 + v = eval(formulaVal) } else { - value = f + v = math.evaluate(formulaVal).toString() + v = isFinite(v) ? v.toString() : 0 } - if (typeof value == 'undefined' || value == null) { - hasNullVal = true - return true - } - formulaVal += value - }) - if (hasNullVal) { - ele.value = null - continue + console.log(v) + + ele.value = handleRoundFiveNumber(v, ele.decimalPosition) + changed = true } - let v - if (formulaVal.startsWith('Get')) { - //计算公式为Get开头的,都是执行方法 - v = eval(formulaVal) - } else { - v = math.evaluate(formulaVal).toString() - v = isFinite(v) ? v.toString() : 0 - } - ele.value = handleRoundFiveNumber(v, ele.decimalPosition) } + } catch (error) { + console.log(error) } - } catch (error) { - console.log(error) } } @@ -69,7 +74,7 @@ export function calcRowAnalysisValue(row, columnObj, dynamicsColumns) { let formulaVal = '' formulas.forEach(f => { if (f.charAt(0) === 'p') { - let o = dynamicsColumns.find(i => 'p' + i.paramNo === f) + let o = dynamicsColumns.find(i => 'p' + i.paramNo === f && i.type !== 'project') formulaVal += row[o.fieldIndex]?.value ? row[o.fieldIndex].value : 0 } else if (f.charAt(0) === 'e') { let o = dynamicsColumns.find(i => 'e' + i.paramNo === f) @@ -95,6 +100,7 @@ export function calcRowAnalysisValue(row, columnObj, dynamicsColumns) { const findFieldInGroup = function (paramNo, group, p) { for (const g of group) { for (const f of g.fields) { + if (p === 'p' && f.type == 'project') continue if (p + f.paramNo === paramNo) { return f } diff --git a/nx/helper/index.js b/nx/helper/index.js index 7d02a0b..3c43f83 100644 --- a/nx/helper/index.js +++ b/nx/helper/index.js @@ -731,6 +731,17 @@ function reviver(key, value) { return value } +function isJsonString(str) { + if (typeof str !== 'string') return false + + try { + const parsed = JSON.parse(str) + return typeof parsed === 'object' && parsed !== null + } catch (e) { + return false + } +} + export default { range, getPx, @@ -765,5 +776,6 @@ export default { showToast, uuid, replacer, - reviver + reviver, + isJsonString } diff --git a/nx/scss/index.scss b/nx/scss/index.scss index 2ea3575..409ee4a 100644 --- a/nx/scss/index.scss +++ b/nx/scss/index.scss @@ -110,6 +110,9 @@ page { .white{ color:#fff ; } + .black{ + color:#000 ; + } .bg-w{ background-color: #fff; } @@ -173,5 +176,5 @@ page { font-weight:bold } .border-b{ - border-bottom: 2px solid rgba(#707070,0.11); + border-bottom: 1px solid #dadbde; } \ No newline at end of file diff --git a/nx/store/biz.js b/nx/store/biz.js index e5730e1..f9ec201 100644 --- a/nx/store/biz.js +++ b/nx/store/biz.js @@ -6,12 +6,10 @@ const biz = defineStore({ state: () => ({ deviceInfo: {}, scanQRInfo: null, - + flagInfo: {} }), - actions: { - - } + actions: {} }) export default biz diff --git a/pages.json b/pages.json index c47ec38..c2b657e 100644 --- a/pages.json +++ b/pages.json @@ -260,6 +260,41 @@ "navigationStyle": "custom" } }, + { + "path": "pages/sampleWarehouse/sampleDispatchExternal/index", + "style": { + "navigationBarTitleText": "外部调拨", + "navigationStyle": "custom" + } + }, + { + "path": "pages/sampleWarehouse/sampleDispatchExternal/detail", + "style": { + "navigationBarTitleText": "调拨详情", + "navigationStyle": "custom" + } + }, + { + "path": "pages/sampleWarehouse/sampleDispatchInternal/index", + "style": { + "navigationBarTitleText": "内部调拨", + "navigationStyle": "custom" + } + }, + { + "path": "pages/sampleWarehouse/dispatchGiveBack/index", + "style": { + "navigationBarTitleText": "调拨归还", + "navigationStyle": "custom" + } + }, + { + "path": "pages/sampleWarehouse/sampleTakeOff/index", + "style": { + "navigationBarTitleText": "样品下架", + "navigationStyle": "custom" + } + }, { "path": "pages/setting/SelectBaseData", "style": { diff --git a/pages/analysis/index/index.vue b/pages/analysis/index/index.vue index 3caf760..b7847e6 100644 --- a/pages/analysis/index/index.vue +++ b/pages/analysis/index/index.vue @@ -33,17 +33,17 @@ const popupShow = ref(false) const menuItemList = ref([ { url: '/pages/analysis/sample/sample-work-list', - otherConf: { icon: '/static/images/menus/sampleAnalysis.png' }, + otherConf: { icon: '/static/images/menus/样品分析.png' }, name: '样品分析' }, { url: '/pages/analysis/sample/sample-report-search', - otherConf: { icon: '/static/images/menus/records.png' }, + otherConf: { icon: '/static/images/menus/记录.png' }, name: '分析记录' }, { url: '/pages/analysis/auncel/auncel-status', - otherConf: { icon: '/static/images/menus/balance.png' }, + otherConf: { icon: '/static/images/menus/天平查看.png' }, name: '天平查看' } ]) diff --git a/pages/analysis/sample/sample-work-detail.vue b/pages/analysis/sample/sample-work-detail.vue index 267188a..870a70b 100644 --- a/pages/analysis/sample/sample-work-detail.vue +++ b/pages/analysis/sample/sample-work-detail.vue @@ -366,6 +366,7 @@ const parameterClassifyChange = v => { const fieldClick = (field, key) => { if (!field.isEdit) return + currentFillingIndex.value = 0 if (currentFillingWay.value === 'input') { inputValue.value = field.value } diff --git a/pages/index/index.vue b/pages/index/index.vue index ab3b480..45e9fdf 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -13,9 +13,9 @@ import { reactive, ref, computed, onMounted } from 'vue' import nx from '@/nx' import { useGridCol } from '@/nx/hooks/useGridCol' let list = reactive([ - { url: '/pages/lims/index/index', name: '设备管理', icon: 'device' }, - { url: '/pages/analysis/index/index', name: '分析管理', icon: 'analyse' }, - { url: '/pages/sampleWarehouse/index/index', name: '样品库管理', icon: 'sampleWarehouse' } + { url: '/pages/lims/index/index', name: '设备管理', icon: '设备管理' }, + { url: '/pages/analysis/index/index', name: '分析管理', icon: '分析管理' }, + { url: '/pages/sampleWarehouse/index/index', name: '样品库管理', icon: '样品库管理' } ]) // const sysMenus = computed(() => nx.$store('user').sysMenus) diff --git a/pages/sampleWarehouse/dispatchGiveBack/index.vue b/pages/sampleWarehouse/dispatchGiveBack/index.vue new file mode 100644 index 0000000..266db9b --- /dev/null +++ b/pages/sampleWarehouse/dispatchGiveBack/index.vue @@ -0,0 +1,7 @@ + + + + + diff --git a/pages/sampleWarehouse/execChangeLocation/index.vue b/pages/sampleWarehouse/execChangeLocation/index.vue index c38aec0..cd87811 100644 --- a/pages/sampleWarehouse/execChangeLocation/index.vue +++ b/pages/sampleWarehouse/execChangeLocation/index.vue @@ -1,19 +1,10 @@ @@ -61,87 +78,122 @@ const changeTypeOptions = reactive([ label: '按样品变更' }, { - name: 'location', + name: 'warehouseLocation', label: '按库位变更' } ]) -function isJsonString(str) { - if (typeof str !== 'string') return false +let targetLocation = ref('') +let changeCode = ref('') +let sampleList = ref([]) - try { - const parsed = JSON.parse(str) - return typeof parsed === 'object' && parsed !== null - } catch (e) { - return false - } -} - -const { scanQRInfo } = toRefs(nx.$store('biz')) -watch(scanQRInfo, newVal => { - if (newVal && nx.$router.getCurrentPage().route == 'pages/sampleWarehouse/returnToStock/index') { - try { - if (!isJsonString(newVal)) { - if (!locationCode.value) { - uni.showToast({ - title: '请先扫描库位码', - icon: 'none' - }) - scanQRInfo.value = '' - return - } else { - if (changeType.value == 'sample') { - sampleCode.value = newVal - } else { - } - // 执行 - // handleReturnToStock() - } - } else { - const codeObj = JSON.parse(newVal) - locationCode.value = codeObj.code - } - scanQRInfo.value = '' - } catch (error) { - scanQRInfo.value = '' - uni.showToast({ - title: '请扫描样品编码', - icon: 'none' - }) - } +watch(changeCode, newVal => { + if (newVal === '') { + sampleList.value = [] + targetLocation.value = '' + isFirstInput.value = true } }) +async function getSampleList() { + if (changeCode.value === '') return + let params = { pageSize: 999, pageNo: 1, returnStatus: 'completed' } + if (changeType.value === 'sample') { + params.sampleReturnCode = changeCode.value + } else { + params.warehouseLocationCode = changeCode.value + } + const { list } = await nx.$api.sampleWarehouse.queryReturnToStockSample(params) + sampleList.value = list + if (list.length === 0) { + uni.showToast({ title: '未查询到该样品信息', icon: 'none' }) + isFirstInput.value = true + } else { + isFirstInput.value = false + } +} +const btnLoading = ref(false) +async function handleSubmit() { + let params = { + actionWay: changeType.value, + targetLocation: targetLocation.value + } + if (changeType.value === 'sample') { + params.sampleReturnCode = changeCode.value + } else { + params.warehouseLocationCode = changeCode.value + } + btnLoading.value = true + await nx.$api.sampleWarehouse.execChangeLocation(params).finally(() => { + btnLoading.value = false + }) + uni.showToast({ title: '变更成功', icon: 'none' }) + handleReset() +} +function handleChangeType(e) { + handleReset() +} +let isFirstInput = ref(true) +const { scanQRInfo } = toRefs(nx.$store('biz')) +watch(scanQRInfo, newVal => { + if (!newVal) return + scanQRInfo.value = '' + if (nx.$router.getCurrentPage().route !== 'pages/sampleWarehouse/execChangeLocation/index') return + try { + console.log(newVal) + + const isJson = nx.$helper.isJsonString(newVal) + console.log(isJson) + + if (isFirstInput.value) { + handleFirstScan(newVal, isJson) + } else { + handleSecondScan(newVal, isJson) + } + } catch (error) { + uni.showToast({ title: '扫码内容解析失败', icon: 'none' }) + } +}) +function handleFirstScan(rawValue, isJson) { + if (changeType.value === 'sample') { + // 按样品变更:首扫应为纯字符串(样品编号) + if (isJson) { + isFirstInput.value = true + uni.showToast({ title: '请先扫描样品编号', icon: 'none' }) + return + } else { + changeCode.value = rawValue + } + } else { + // 按库位变更:首扫应为 JSON(原库位码) + if (!isJson) { + isFirstInput.value = true + uni.showToast({ title: '请先扫描(原)库位码', icon: 'none' }) + return + } else { + const codeObj = JSON.parse(rawValue) + changeCode.value = codeObj.code + } + } + getSampleList() +} +function handleSecondScan(rawValue, isJson) { + // 第二次扫描必须是 JSON(目标库位码) + if (!isJson) { + uni.showToast({ title: '请扫描变更后库位码', icon: 'none' }) + return + } + const codeObj = JSON.parse(rawValue) + targetLocation.value = codeObj.code +} onShow(() => { scanQRInfo.value = '' }) -let needPrint = ref(false) -let locationCode = ref('') -let sampleCode = ref('') - -function handleReturnToStock() { - nx.$api.sampleWarehouse - .execReturnToStock({ - warehouseLocationCode: locationCode.value, - sampleCode: sampleCode.value - }) - .then(res => { - successCount.value++ - if (res.print) { - uni.showToast({ - title: `归库成功,归库码为【${res.code}】`, - duration: 3000, - icon: 'none' - }) - // 执行打印 - } - }) -} - -const successCount = ref(2) function handleReset() { - locationCode.value = '' - sampleCode.value = '' - successCount.value = 0 + targetLocation.value = '' + changeCode.value = '' + sampleList.value = [] + btnLoading.value = false + isFirstInput.value = true } diff --git a/pages/sampleWarehouse/index/index.vue b/pages/sampleWarehouse/index/index.vue index e10aa16..1d7ad98 100644 --- a/pages/sampleWarehouse/index/index.vue +++ b/pages/sampleWarehouse/index/index.vue @@ -34,18 +34,38 @@ const popupShow = ref(false) const menuItemList = ref([ { url: '/pages/sampleWarehouse/sampleSearch/index', - otherConf: { icon: '/static/images/menus/records.png' }, + otherConf: { icon: '/static/images/menus/记录.png' }, name: '样品查询' }, { url: '/pages/sampleWarehouse/returnToStock/index', - otherConf: { icon: '/static/images/menus/returnToStock.png' }, + otherConf: { icon: '/static/images/menus/样品归库.png' }, name: '样品归库' }, { url: '/pages/sampleWarehouse/execChangeLocation/index', - otherConf: { icon: '/static/images/menus/execChangeLocation.png' }, + otherConf: { icon: '/static/images/menus/库位变更.png' }, name: '库位变更' + }, + { + url: '/pages/sampleWarehouse/sampleDispatchInternal/index', + otherConf: { icon: '/static/images/menus/内部调拨.png' }, + name: '内部调拨' + }, + { + url: '/pages/sampleWarehouse/sampleDispatchExternal/index', + otherConf: { icon: '/static/images/menus/外部调拨.png' }, + name: '外部调拨' + }, + { + url: '/pages/sampleWarehouse/dispatchGiveBack/index', + otherConf: { icon: '/static/images/menus/调拨归还.png' }, + name: '调拨归还' + }, + { + url: '/pages/sampleWarehouse/sampleTakeOff/index', + otherConf: { icon: '/static/images/menus/样品下架.png' }, + name: '样品下架' } ]) @@ -56,26 +76,26 @@ const userInfo = computed(() => nx.$store('user').userInfo) const goTo = url => { nx.$router.go(url) } -onShow(() => { - //连接打印服务 - let printList = uni.getStorageSync('KEY_PRINT_LIST') - if (printList && printList.length > 0) { - for (let print of printList) { - nx.$print.open(print.printIp, print.printPort) - } - } else { - uni.showModal({ - title: '提示', - showCancel: false, - content: '打印服务未配置,请在系统设置中配置打印服务', - success: function (res) { - uni.navigateTo({ - url: '/pages/setting/print' - }) - } - }) - } -}) +// onShow(() => { +// //连接打印服务 +// let printList = uni.getStorageSync('KEY_PRINT_LIST') +// if (printList && printList.length > 0) { +// for (let print of printList) { +// nx.$print.open(print.printIp, print.printPort) +// } +// } else { +// uni.showModal({ +// title: '提示', +// showCancel: false, +// content: '打印服务未配置,请在系统设置中配置打印服务', +// success: function (res) { +// uni.navigateTo({ +// url: '/pages/setting/print' +// }) +// } +// }) +// } +// }) // 生命周期 onMounted(() => {}) // 动态设置 grid 列数 diff --git a/pages/sampleWarehouse/returnToStock/index.vue b/pages/sampleWarehouse/returnToStock/index.vue index 2a7e6d7..8eeb156 100644 --- a/pages/sampleWarehouse/returnToStock/index.vue +++ b/pages/sampleWarehouse/returnToStock/index.vue @@ -1,7 +1,7 @@ @@ -49,18 +62,17 @@ import nx from '@/nx' const { scanQRInfo } = toRefs(nx.$store('biz')) watch(scanQRInfo, newVal => { - if (newVal && nx.$router.getCurrentPage().route == 'pages/sampleWarehouse/sampleSearch/index') { - try { - sampleCode.value = newVal - handleSearch() - scanQRInfo.value = '' - } catch (error) { - scanQRInfo.value = '' - uni.showToast({ - title: '请扫描样品编码', - icon: 'none' - }) - } + if (!newVal) return + scanQRInfo.value = '' + if (nx.$router.getCurrentPage().route !== 'pages/sampleWarehouse/sampleSearch/index') return + try { + sampleCode.value = newVal + handleSearch() + } catch (error) { + uni.showToast({ + title: '请扫描正确的样品编码', + icon: 'none' + }) } }) onShow(() => { @@ -73,7 +85,25 @@ function handleSearch() { let sampleData = ref({}) async function getSampleDetail() { - sampleData.value = await nx.$api.sample.getSampleDetail({ sampleReturnCode: sampleCode.value }) + sampleData.value = {} + const { list } = await nx.$api.sampleWarehouse.queryReturnToStockSample({ + sampleReturnCode: sampleCode.value, + pageSize: 10, + pageNo: 1 + }) + if (list.length == 0) { + uni.showToast({ + title: '未查询到该样品信息', + icon: 'none' + }) + } else if (list.length > 1) { + uni.showToast({ + title: '查询出重复的样品编号,请联系管理员', + icon: 'none' + }) + } else { + sampleData.value = list[0] + } } function handlePrint() {} diff --git a/pages/sampleWarehouse/sampleTakeOff/index.vue b/pages/sampleWarehouse/sampleTakeOff/index.vue new file mode 100644 index 0000000..6cf15ec --- /dev/null +++ b/pages/sampleWarehouse/sampleTakeOff/index.vue @@ -0,0 +1,169 @@ + + + + + diff --git a/static/images/menus/records.png b/static/images/menus/records.png deleted file mode 100644 index bc050b8..0000000 Binary files a/static/images/menus/records.png and /dev/null differ diff --git a/static/images/menus/内部调拨.png b/static/images/menus/内部调拨.png new file mode 100644 index 0000000..b61848f Binary files /dev/null and b/static/images/menus/内部调拨.png differ diff --git a/static/images/menus/analyse.png b/static/images/menus/分析管理.png similarity index 100% rename from static/images/menus/analyse.png rename to static/images/menus/分析管理.png diff --git a/static/images/menus/外部调拨.png b/static/images/menus/外部调拨.png new file mode 100644 index 0000000..908921a Binary files /dev/null and b/static/images/menus/外部调拨.png differ diff --git a/static/images/menus/balance.png b/static/images/menus/天平查看.png similarity index 100% rename from static/images/menus/balance.png rename to static/images/menus/天平查看.png diff --git a/static/images/menus/execChangeLocation.png b/static/images/menus/库位变更.png similarity index 100% rename from static/images/menus/execChangeLocation.png rename to static/images/menus/库位变更.png diff --git a/static/images/menus/样品下架.png b/static/images/menus/样品下架.png new file mode 100644 index 0000000..18c63de Binary files /dev/null and b/static/images/menus/样品下架.png differ diff --git a/static/images/menus/sampleAnalysis.png b/static/images/menus/样品分析.png similarity index 100% rename from static/images/menus/sampleAnalysis.png rename to static/images/menus/样品分析.png diff --git a/static/images/menus/sampleWarehouse.png b/static/images/menus/样品库管理.png similarity index 100% rename from static/images/menus/sampleWarehouse.png rename to static/images/menus/样品库管理.png diff --git a/static/images/menus/returnToStock.png b/static/images/menus/样品归库.png similarity index 100% rename from static/images/menus/returnToStock.png rename to static/images/menus/样品归库.png diff --git a/static/images/menus/记录.png b/static/images/menus/记录.png new file mode 100644 index 0000000..4e6c259 Binary files /dev/null and b/static/images/menus/记录.png differ diff --git a/static/images/menus/device.png b/static/images/menus/设备管理.png similarity index 100% rename from static/images/menus/device.png rename to static/images/menus/设备管理.png diff --git a/static/images/menus/调拨归还.png b/static/images/menus/调拨归还.png new file mode 100644 index 0000000..c72c8b6 Binary files /dev/null and b/static/images/menus/调拨归还.png differ