From bfb838d1c3aba72fe6b3de37f065902279a7d40c Mon Sep 17 00:00:00 2001 From: zhouwx <1175765986@qq.com> Date: 星期四, 06 三月 2025 08:30:56 +0800 Subject: [PATCH] 需求新增 --- src/views/hazardousChemicals/warehouseManage/components/productTable.vue | 89 ++++++++++ src/views/hazardousChemicals/useCount/index.vue | 192 ++++++++++++++++++++++++ src/layout/components/Sidebar/menu.js | 22 ++ src/views/hazardousChemicals/finishedBasicInfo/index.vue | 8 src/assets/icons/svg/alarm.svg | 1 src/assets/icons/svg/caution.svg | 1 src/router/index.js | 13 + src/api/hazardousChemicals/useCount.js | 18 ++ src/views/hazardousChemicals/basicInfon/index.vue | 8 .env.development | 4 src/views/hazardousChemicals/avoidWarning/index.vue | 10 + src/views/hazardousChemicals/warehouseManage/components/rawTable.vue | 90 ++++++++++ src/assets/icons/svg/warehousing.svg | 1 src/assets/icons/svg/analysis.svg | 1 14 files changed, 439 insertions(+), 19 deletions(-) diff --git a/.env.development b/.env.development index 19560f9..855a986 100644 --- a/.env.development +++ b/.env.development @@ -11,10 +11,10 @@ VITE_APP_RESOURCE_API = 'http://192.168.2.16:9000/trainexam/' #董 -#VITE_APP_BASE_API = 'http://192.168.2.24:8083/api' +VITE_APP_BASE_API = 'http://192.168.2.24:8083/api' #贺 -VITE_APP_BASE_API = 'http://192.168.2.11:5812/api' +#VITE_APP_BASE_API = 'http://192.168.2.11:5812/api' #线上 #VITE_APP_BASE_API = 'http://47.108.222.15:8001/api' diff --git a/src/api/hazardousChemicals/useCount.js b/src/api/hazardousChemicals/useCount.js new file mode 100644 index 0000000..434d799 --- /dev/null +++ b/src/api/hazardousChemicals/useCount.js @@ -0,0 +1,18 @@ +import request from "@/utils/request"; + +export function getUseStatistic(params) { + return request({ + url: '/statistic/hazmatUseStatistic', + method: 'get', + params: params + }) +} + +export function importBaiscUse(params) { + return request({ + url: '/statistic/importBaiscUse', + method: 'post', + data: params + }) +} + diff --git a/src/assets/icons/svg/alarm.svg b/src/assets/icons/svg/alarm.svg new file mode 100644 index 0000000..b15964f --- /dev/null +++ b/src/assets/icons/svg/alarm.svg @@ -0,0 +1 @@ +<?xml version="1.0" encoding="UTF-8"?><svg width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M14 25C14 19.4772 18.4772 15 24 15C29.5228 15 34 19.4772 34 25V41H14V25Z" fill="none" stroke="#333" stroke-width="4" stroke-linejoin="round"/><path d="M24 5V8" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M35.8918 9.32823L33.9634 11.6264" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M42.2187 20.2873L39.2642 20.8083" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M5.78116 20.2874L8.73558 20.8083" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M12.1086 9.32802L14.037 11.6262" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M6 41H43" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/></svg> \ No newline at end of file diff --git a/src/assets/icons/svg/analysis.svg b/src/assets/icons/svg/analysis.svg new file mode 100644 index 0000000..10f3749 --- /dev/null +++ b/src/assets/icons/svg/analysis.svg @@ -0,0 +1 @@ +<?xml version="1.0" encoding="UTF-8"?><svg width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M44 5H3.99998V17H44V5Z" fill="none" stroke="#333" stroke-width="4" stroke-linejoin="round"/><path d="M3.99998 41.0301L16.1756 28.7293L22.7549 35.0301L30.7982 27L35.2786 31.368" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M44 16.1719V42.1719" stroke="#333" stroke-width="4" stroke-linecap="round"/><path d="M3.99998 16.1719V30.1719" stroke="#333" stroke-width="4" stroke-linecap="round"/><path d="M13.0155 43H44" stroke="#333" stroke-width="4" stroke-linecap="round"/><path d="M17 11H38" stroke="#333" stroke-width="4" stroke-linecap="round"/><path d="M9.99998 10.9966H11" stroke="#333" stroke-width="4" stroke-linecap="round"/></svg> \ No newline at end of file diff --git a/src/assets/icons/svg/caution.svg b/src/assets/icons/svg/caution.svg new file mode 100644 index 0000000..89d2dbf --- /dev/null +++ b/src/assets/icons/svg/caution.svg @@ -0,0 +1 @@ +<?xml version="1.0" encoding="UTF-8"?><svg width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M24 5L2 43H46L24 5Z" fill="none" stroke="#333" stroke-width="4" stroke-linejoin="round"/><path d="M24 35V36" stroke="#333" stroke-width="4" stroke-linecap="round"/><path d="M24 19.0005L24.0083 29" stroke="#333" stroke-width="4" stroke-linecap="round"/></svg> \ No newline at end of file diff --git a/src/assets/icons/svg/warehousing.svg b/src/assets/icons/svg/warehousing.svg new file mode 100644 index 0000000..fdce0d0 --- /dev/null +++ b/src/assets/icons/svg/warehousing.svg @@ -0,0 +1 @@ +<?xml version="1.0" encoding="UTF-8"?><svg width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M34 24L18 24" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M24 18L18 24L24 30" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><circle cx="38" cy="24" r="4" fill="none" stroke="#333" stroke-width="4"/><path d="M40.706 13C39.9214 11.8109 39.0133 10.7105 38 9.71713C34.3925 6.18064 29.4509 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44C29.4509 44 34.3925 41.8194 38 38.2829C39.0133 37.2895 39.9214 36.1891 40.706 35" stroke="#333" stroke-width="4" stroke-linecap="round"/></svg> \ No newline at end of file diff --git a/src/layout/components/Sidebar/menu.js b/src/layout/components/Sidebar/menu.js index f86f3aa..cba7689 100644 --- a/src/layout/components/Sidebar/menu.js +++ b/src/layout/components/Sidebar/menu.js @@ -102,12 +102,17 @@ { path: '/warehouseManage', name: 'warehouseManage', - meta: { title: '入库管理',icon: 'form',affix: true } + meta: { title: '入库管理',icon: 'warehousing',affix: true } }, { path: '/electronicWarehouse', name: 'electronicWarehouse', meta: { title: '电子仓库',icon: 'build',affix: true } + }, + { + path: '/useCount', + name: 'useCount', + meta: { title: '用量统计',icon: 'analysis',affix: true } }, // { // path: '/detailList', @@ -127,12 +132,12 @@ { path: '/overdueWarning', name: 'overdueWarning', - meta: { title: '超期预警',icon: 'peoples',affix: true } + meta: { title: '超期预警',icon: 'alarm',affix: true } }, { path: '/avoidWarning', name: 'avoidWarning', - meta: { title: '危化品相忌报警',icon: 'form',affix: true } + meta: { title: '危化品相忌报警',icon: 'caution',affix: true } }, { path: '/basicInfo', @@ -189,12 +194,17 @@ { path: '/warehouseManage', name: 'warehouseManage', - meta: { title: '入库管理',icon: 'form',affix: true } + meta: { title: '入库管理',icon: 'warehousing',affix: true } }, { path: '/electronicWarehouse', name: 'electronicWarehouse', meta: { title: '电子仓库',icon: 'build',affix: true } + }, + { + path: '/useCount', + name: 'useCount', + meta: { title: '用量统计',icon: 'analysis',affix: true } }, // { // path: '/detailList', @@ -214,12 +224,12 @@ { path: '/overdueWarning', name: 'overdueWarning', - meta: { title: '超期预警',icon: 'peoples',affix: true } + meta: { title: '超期预警',icon: 'alarm',affix: true } }, { path: '/avoidWarning', name: 'avoidWarning', - meta: { title: '危化品相忌报警',icon: 'form',affix: true } + meta: { title: '危化品相忌报警',icon: 'caution',affix: true } }, { path: '/basicInfo', diff --git a/src/router/index.js b/src/router/index.js index d963cbf..9a9c99a 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -196,6 +196,19 @@ ] }, { + path: '/useCount', + component: Layout, + redirect: '/useCount', + children: [ + { + path: '/useCount', + component: () => import('@/views/hazardousChemicals/useCount/index.vue'), + name: 'useCount', + meta: { title: '用量统计',icon: 'form', affix: true } + } + ] + }, + { path: '/basicInfo', component: Layout, redirect: '/basicInfo', diff --git a/src/views/hazardousChemicals/avoidWarning/index.vue b/src/views/hazardousChemicals/avoidWarning/index.vue index 0502bb2..941b711 100644 --- a/src/views/hazardousChemicals/avoidWarning/index.vue +++ b/src/views/hazardousChemicals/avoidWarning/index.vue @@ -42,9 +42,15 @@ <el-table-column label="时间" prop="createTime" align="center" /> <el-table-column label="品名" prop="basicName" align="center" /> <el-table-column label="相忌试剂" prop="tabooBasicName" align="center" /> - <el-table-column label="储存位置" align="center" > + <el-table-column label="储存位置" align="center" width="160"> <template #default="scope"> - <span>{{scope.row.warehouseName}}——{{scope.row.cupboardName}}</span> + <span>{{scope.row.warehouseName}}—{{scope.row.cupboardName}}</span> + </template> + </el-table-column> + <el-table-column label="当前位置" align="center" width="160"> + <template #default="scope"> + <span v-if="scope.row.state == 1">{{scope.row.reWarehouseName}}—{{scope.row.reCupboardName}}</span> + <span v-else>—</span> </template> </el-table-column> <el-table-column label="风险等级" align="center" > diff --git a/src/views/hazardousChemicals/basicInfon/index.vue b/src/views/hazardousChemicals/basicInfon/index.vue index eac0e60..580be0c 100644 --- a/src/views/hazardousChemicals/basicInfon/index.vue +++ b/src/views/hazardousChemicals/basicInfon/index.vue @@ -71,7 +71,13 @@ <el-table-column label="CAS" prop="cas" align="center"/> <el-table-column label="试剂类型" prop="hazmatType" align="center"/> <el-table-column label="危险性质" prop="hazmatCharacter" align="center" width="140"/> - <el-table-column label="危化品特性" prop="peculiarityType" align="center" width="140"/> +<!-- <el-table-column label="危化品特性" prop="peculiarityType" align="center" width="140"/>--> + <el-table-column label="危险性类别" prop="riskType" align="center" width="140"> + <template #default="scope"> + <div v-html="scope.row.riskType"></div> + </template> + </el-table-column> + <el-table-column label="危化品分类编号" prop="peculiarityNumber" align="center" /> <el-table-column label="供应商" prop="supplier" align="center"/> <el-table-column label="厂家" prop="manufacturer" align="center"/> <el-table-column label="规格" prop="hazmatFormat" align="center"/> diff --git a/src/views/hazardousChemicals/finishedBasicInfo/index.vue b/src/views/hazardousChemicals/finishedBasicInfo/index.vue index f9d130e..23f2c50 100644 --- a/src/views/hazardousChemicals/finishedBasicInfo/index.vue +++ b/src/views/hazardousChemicals/finishedBasicInfo/index.vue @@ -70,7 +70,13 @@ <el-table-column label="CAS" prop="cas" align="center"/> <el-table-column label="试剂类型" prop="productType" align="center"/> <el-table-column label="危险性质" prop="productCharacter" align="center"/> - <el-table-column label="危化品特性" prop="peculiarityType" align="center" width="140"/> +<!-- <el-table-column label="危化品特性" prop="peculiarityType" align="center" width="140"/>--> + <el-table-column label="危险性类别" prop="riskType" align="center" width="140"> + <template #default="scope"> + <div v-html="scope.row.riskType"></div> + </template> + </el-table-column> + <el-table-column label="危化品分类编号" prop="peculiarityNumber" align="center" /> <el-table-column label="供应商" prop="supplier" align="center"/> <el-table-column label="厂家" prop="manufacturer" align="center"/> <el-table-column label="规格" prop="productFormat" align="center"/> diff --git a/src/views/hazardousChemicals/useCount/index.vue b/src/views/hazardousChemicals/useCount/index.vue new file mode 100644 index 0000000..434bb8b --- /dev/null +++ b/src/views/hazardousChemicals/useCount/index.vue @@ -0,0 +1,192 @@ +<template> + <div class="app-container"> + <div style="display: flex;justify-content: space-between"> + <el-form :inline="true" style="display: flex;align-items: center;flex-wrap: wrap;" > + <el-form-item label="按时间查询:" > + <el-date-picker + v-model="state.tableData.listQuery.time" + type="datetimerange" + range-separator="~" + start-placeholder="开始时间" + end-placeholder="结束时间" + format="YYYY-MM-DD HH:mm:ss" + /> + </el-form-item> + <el-form-item > + <el-button + plain + type="primary" + @click="reset" + >重置</el-button> + <el-button + icon="Search" + type="primary" + @click="getList" + >查询</el-button> + +<!-- <vue3-json-excel--> +<!-- class="ml10"--> +<!-- :json-data="state.tableData.data"--> +<!-- :fields="fields"--> +<!-- :name="state.tableData.excelName"--> +<!-- >--> + <el-button type="primary" icon="Download" size="default" @click="downloadExcel">导出</el-button> +<!-- </vue3-json-excel>--> + </el-form-item> + </el-form> + </div> + <el-table v-loading="loading" :data="state.tableData.data" :border="true"> + <el-table-column label="序号" type="index" align="center" width="80" /> + <el-table-column label="危化品品名" prop="hazmatBasic.name" align="center" /> + <el-table-column label="CAS" prop="hazmatBasic.cas" align="center" /> + <el-table-column label="试剂类型" prop="hazmatBasic.hazmatType" align="center" /> + <el-table-column label="危险性质" prop="hazmatBasic.hazmatCharacter" align="center" /> + <el-table-column label="供应商" prop="hazmatBasic.supplier" align="center" width="180" /> + <el-table-column label="规格" prop="hazmatBasic.hazmatFormat" align="center"/> + <el-table-column label="最小包装类型" prop="" align="center" width="180" > + <template #default="scope"> + <span> {{scope.row.hazmatBasic.minPackage == 0 ? '瓶' :scope.row.hazmatBasic.minPackage == 1?'袋':scope.row.hazmatBasic.minPackage == 2?'桶 ':scope.row.hazmatBasic.minPackage == 3?'盒':scope.row.hazmatBasic.minPackage == 4?'箱':'其他'}}</span> + </template> + </el-table-column> + <el-table-column label="用量" prop="count" align="center" /> + </el-table> + <pagination + v-show="state.tableData.total > 0" + :total="state.tableData.total" + v-model:page="state.tableData.listQuery.pageNum" + v-model:limit="state.tableData.listQuery.pageSize" + @pagination="getList" + /> + </div> +</template> + +<script setup> +import {onMounted, reactive, ref} from "vue"; +import {getUseStatistic, importBaiscUse} from "@/api/hazardousChemicals/useCount"; +import {ElMessage} from "element-plus"; +import moment from "moment"; +import axios from "axios"; +import {getToken} from "@/utils/auth"; + +const loading = ref(false) +const state = reactive({ + tableData: { + data: [], + total: 0, + loading: false, + listQuery: { + pageNum: 1, + pageSize: 10, + startTime: null, + endTime: null, + time: [], + }, + excelName: '' + }, +}); +const fields = ref({ + '名称':'hazmatBasic.name', + 'CAS': 'hazmatBasic.cas', + '试剂类型':'hazmatBasic.hazmatType', + '危险性质':'hazmatBasic.hazmatCharacter', + '供应商':'hazmatBasic.supplier', + '规格':'hazmatBasic.hazmatFormat', + '最小包装': 'minPack', + '用量':'count', +}); + +onMounted( + () => { + getNowTime(); + getList() + } +); +const getNowTime = () => { + let isDate = new Date() + let sTime = `${isDate.getFullYear()}-${isDate.getMonth()}-${isDate.getDate()}` + let eTime = `${isDate.getFullYear()}-${isDate.getMonth()+1}-${isDate.getDate()}` + sTime = `${sTime} 00:00:00` + eTime = `${eTime} ` + moment().format('HH:mm:ss') + state.tableData.listQuery.time = [sTime ,eTime]; +} + +const getList = async () => { + loading.value = true + state.tableData.listQuery.startTime = state.tableData.listQuery.time[0] + state.tableData.listQuery.endTime = state.tableData.listQuery.time[1] + const {time, ...data} = JSON.parse(JSON.stringify(state.tableData.listQuery)) + const res = await getUseStatistic(data) + if(res.code == 200){ + state.tableData.data = res.data.list.map(item => { + return { + ...item, + minPack: `${item.hazmatBasic.metering}${item.hazmatBasic.unit}/${item.hazmatBasic.minPackage == 0 ? '瓶' : item.hazmatBasic.minPackage == 1?'袋':item.hazmatBasic.minPackage == 2?'桶 ':item.hazmatBasic.minPackage == 3?'盒':item.hazmatBasic.minPackage == 4?'箱':'其他'}` + } + }) + console.log('1',state.tableData.data) + state.tableData.total = res.data.total + }else{ + ElMessage.warning(res.message) + } + loading.value = false +} +const downloadExcel = async() => { + + state.tableData.listQuery.startTime = moment(state.tableData.listQuery.time[0]).format('YYYY-MM-DD HH:mm:ss').substring(0,10) + state.tableData.listQuery.endTime = moment(state.tableData.listQuery.time[1]).format('YYYY-MM-DD HH:mm:ss').substring(0,10) + console.log('time', state.tableData.listQuery.startTime, state.tableData.listQuery.endTime) + state.tableData.excelName = state.tableData.listQuery.startTime + '至' +state.tableData.listQuery.endTime + '__用量统计.xls' + // state.tableData.listQuery.startTime = state.tableData.listQuery.time[0] + // state.tableData.listQuery.endTime = state.tableData.listQuery.time[1] + const data = { + startTime:state.tableData.listQuery.startTime, + endTime: state.tableData.listQuery.endTime + } + const url = import.meta.env.VITE_APP_BASE_API + '/statistic/importBaiscUse' + axios( + { + method: 'get', + url: url, + responseType: 'blob', + params: data, + headers: { 'Authorization':getToken() } + } + ).then(res => { + if(res){ + const link = document.createElement('a') + let blob = new Blob([res.data],{type: res.data.type}) + link.style.display = "none"; + link.href = URL.createObjectURL(blob); // 创建URL + link.setAttribute("download", state.tableData.excelName); + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + }else { + ElMessage.warning('获取文件失败') + } + }) + // const res = await importBaiscUse(data) + // if(res.code == 200){ + // const link = document.createElement('a') + // let blob = new Blob([res.data],{type: res.data.type}) + // link.style.display = "none"; + // link.href = URL.createObjectURL(blob); // 创建URL + // link.setAttribute("download",state.tableData.excelName ); + // document.body.appendChild(link); + // link.click(); + // document.body.removeChild(link); + // }else{ + // ElMessage.warning(res.message) + // } + +} +const reset = () => { + getNowTime(); + getList(); +} +</script> + + +<style scoped lang="scss"> + +</style> diff --git a/src/views/hazardousChemicals/warehouseManage/components/productTable.vue b/src/views/hazardousChemicals/warehouseManage/components/productTable.vue index 16bb840..c6854c4 100644 --- a/src/views/hazardousChemicals/warehouseManage/components/productTable.vue +++ b/src/views/hazardousChemicals/warehouseManage/components/productTable.vue @@ -16,6 +16,42 @@ <el-form-item label="产品编号:" > <el-input v-model="data.queryParams.params.productSn" placeholder="请输入产品编号" clearable></el-input> </el-form-item> + <el-form-item label="仓库:" prop="warehouseName" > + <el-select + clearable + v-model="data.queryParams.params.warehouseName" + filterable + remote + reserve-keyword + placeholder="请输入所入仓库" + remote-show-suffix + :remote-method="getWareHouseList" + style="width: 100%" + @change="selectWareValue" + > + <el-option + v-for="item in data.wareHouseList" + :key="item.id" + :label="item.name" + :value="item.name" + /> + </el-select> + </el-form-item> + <el-form-item label="存储柜:" prop="cupboardId" > + <el-select + clearable + v-model="data.queryParams.params.cupboardId" + placeholder="请选择存储柜" + style="width: 100%" + > + <el-option + v-for="item in data.cupList" + :key="item.id" + :label="item.cupboardName" + :value="item.id" + /> + </el-select> + </el-form-item> <el-form-item > <el-button type="primary" @@ -84,7 +120,7 @@ import {ElMessage, ElMessageBox} from "element-plus"; import proDialog from "./addProDialog.vue"; import printcode from './printCode.vue' -import {delWarehouse, getWarehouse} from "@/api/hazardousChemicals/warehouse"; +import {delWarehouse, getCupById, getWarehouse} from "@/api/hazardousChemicals/warehouse"; import { delProductRecord, doEntryPro, @@ -105,17 +141,22 @@ pageSize: 10, params :{ name: '', - productSn: '' + productSn: '', + cupboardId: null, + warehouseId: null } }, total: 0, - dataList: [] + dataList: [], + wareHouseList: [], + cupList: [] }); const { queryParams, total, dataList } = toRefs(data); const classHourRef = ref(); onMounted(()=>{ getList() + getWareHouseList("") }) const getList = async () => { @@ -141,10 +182,14 @@ pageSize: 10, params :{ name: '', - productSn: '' + productSn: '', + cupboardId: null, + warehouseId: null } } + data.cupList = [] getList() + getWareHouseList("") } const handleDelete = (val) => { ElMessageBox.confirm( @@ -198,6 +243,42 @@ const v = JSON.stringify(obj) router.push({ path: "/whProDetail", query: { val: v } }); } +const getWareHouseList = async (val) => { + let param = {} + if(val != ""){ + param = { + name: val + } + }else { + param = { + pageNum: 1, + pageSize: 10 + } + } + const res = await getWarehouse(param) + if(res.code == 200){ + data.wareHouseList = res.data.list + }else{ + ElMessage.warning(res.message) + } +} +const selectWareValue = (val) => { + data.queryParams.params.cupboardId = null + data.wareHouseList.forEach(item => { + if(item.name === val){ + data.queryParams.params.warehouseId = item.id + getCupList(item.id) + } + }) +} +const getCupList = async (val) => { + const res = await getCupById(val) + if(res.code == 200) { + data.cupList = res.data + }else { + ElMessage.warning(res.message) + } +} defineExpose({ getList diff --git a/src/views/hazardousChemicals/warehouseManage/components/rawTable.vue b/src/views/hazardousChemicals/warehouseManage/components/rawTable.vue index 8af5238..348c595 100644 --- a/src/views/hazardousChemicals/warehouseManage/components/rawTable.vue +++ b/src/views/hazardousChemicals/warehouseManage/components/rawTable.vue @@ -16,6 +16,43 @@ <el-form-item label="产品编号:" > <el-input v-model="data.queryParams.params.productSn" placeholder="请输入产品编号" clearable></el-input> </el-form-item> + <el-form-item label="仓库:" prop="warehouseName" > + <el-select + clearable + v-model="data.queryParams.params.warehouseName" + filterable + remote + reserve-keyword + placeholder="请输入所入仓库" + remote-show-suffix + :remote-method="getWareHouseList" + style="width: 100%" + @change="selectWareValue" + > + <el-option + v-for="item in data.wareHouseList" + :key="item.id" + :label="item.name" + :value="item.name" + /> + </el-select> + </el-form-item> + <el-form-item label="存储柜:" prop="cupboardId" > + <el-select + clearable + v-model="data.queryParams.params.cupboardId" + placeholder="请选择存储柜" + style="width: 100%" + > + <el-option + + v-for="item in data.cupList" + :key="item.id" + :label="item.cupboardName" + :value="item.id" + /> + </el-select> + </el-form-item> <el-form-item > <el-button type="primary" @@ -89,6 +126,7 @@ import printcode from './printCode.vue' import {delRawRecord, doEntryRaw, getRawRecord, getRawWarehouseRecord} from "@/api/hazardousChemicals/rawRecord"; import {useRoute, useRouter} from "vue-router"; +import {getCupById, getWarehouse} from "@/api/hazardousChemicals/warehouse"; const { proxy } = getCurrentInstance(); const loading = ref(false); const dialogRef = ref(); @@ -101,17 +139,23 @@ pageSize: 10, params :{ name: '', - productSn: '' + productSn: '', + cupboardId: null, + warehouseId: null } }, total: 0, - dataList: [] + dataList: [], + wareHouseList: [], + cupList: [] + }); const { queryParams, total, dataList } = toRefs(data); const classHourRef = ref(); onMounted(()=>{ getList() + getWareHouseList("") }) const getList = async () => { @@ -137,10 +181,14 @@ pageSize: 10, params :{ name: '', - productSn: '' + productSn: '', + cupboardId: null, + warehouseId: null } } + data.cupList = [] getList() + getWareHouseList("") } const handleDelete = (val) => { ElMessageBox.confirm( @@ -197,6 +245,42 @@ router.push({ path: "/whRawDetail", query: { val: v } }); } +const getWareHouseList = async (val) => { + let param = {} + if(val != ""){ + param = { + name: val + } + }else { + param = { + pageNum: 1, + pageSize: 10 + } + } + const res = await getWarehouse(param) + if(res.code == 200){ + data.wareHouseList = res.data.list + }else{ + ElMessage.warning(res.message) + } +} +const selectWareValue = (val) => { + data.queryParams.params.cupboardId = null + data.wareHouseList.forEach(item => { + if(item.name === val){ + data.queryParams.params.warehouseId = item.id + getCupList(item.id) + } + }) +} +const getCupList = async (val) => { + const res = await getCupById(val) + if(res.code == 200) { + data.cupList = res.data + }else { + ElMessage.warning(res.message) + } +} defineExpose({ getList -- Gitblit v1.9.2