Browse Source

feat: 更新水厂和设备禁用筛选.

sunxiao 1 week ago
parent
commit
d21362644b

+ 6 - 4
src/api/client/manage.js

@@ -46,20 +46,22 @@ export function getRegion(params) {
 
 
 // 机构管理 - list - 全部水厂
-export function getAllWaterFactoryList(params) {
+// type 0集团  1水厂
+// status 0=正常, 1=停用
+export function getAllWaterFactoryList(params = { type:1, status: 0 }) {
   return request({
     url: '/business/organization/all',
     method: 'get',
-    params: { type: 1 }
+    params
   })
 }
 
-// 设备管理 - list - 全部水厂
+// 设备管理 - list - 全部设备
 export function getAllDeviceList(params) {
   return request({
     url: '/business/device/all',
     method: 'get',
-    params
+    params: { deviceStatus: 0, ...params, }
   })
 }
 

+ 0 - 10
src/api/configuration/index.js

@@ -147,16 +147,6 @@ export function delWorkFlow(id) {
   })
 }
 
-
-// 机构管理 - list - 全部水厂
-export function getAllWaterFactoryList(params) {
-  return request({
-    url: '/business/organization/all',
-    method: 'get',
-    params: { type: 1 }
-  })
-}
-
 // -------------------------------------------------------
 
 // 质控样 - list

+ 10 - 23
src/views/client/device/index.vue

@@ -1,7 +1,8 @@
 <script setup>
 import { CirclePlus} from '@element-plus/icons-vue'
-import { ElMessage, ElMessageBox } from 'element-plus'
-import { getDeviceList, getAllWaterFactoryList, postDevice, putDevice, delDevice } from '@/api/client/manage'
+import { ElMessageBox } from 'element-plus'
+import { getDeviceList, postDevice, putDevice, delDevice, getAllWaterFactoryList } from '@/api/client/manage'
+import { ref } from 'vue';
 
 const { proxy } = getCurrentInstance();
 
@@ -20,24 +21,12 @@ const formRef = ref(null);
 const dialogVisible = ref(false);
 
 const rules = {
-  deviceWorks: [
-    { required: true, message: '请选择水厂', trigger: 'change' }
-  ],
-  deviceSn: [
-    { required: true, message: '请输入设备SN', trigger: 'blur' },
-  ],
-  deviceName: [
-    { required: true, message: '请输入设备名称', trigger: 'blur' },
-  ],
-  deviceModel: [
-    { required: true, message: '请输入设备型号', trigger: 'blur' },
-  ],
-  type: [
-    { required: true, message: '请选择设备型号', trigger: 'blur' },
-  ],
-  deviceStatus: [
-    { required: true, message: '请选择设备状态', trigger: 'blur' },
-  ]
+  deviceWorks:{ required: true, message: '请选择水厂', trigger: 'change' },
+  deviceSn:{ required: true, message: '请输入设备SN', trigger: 'blur' },
+  deviceName: { required: true, message: '请输入设备名称', trigger: 'blur' },
+  deviceModel: { required: true, message: '请输入设备型号', trigger: 'blur' },
+  type: { required: true, message: '请选择设备型号', trigger: 'blur' },
+  deviceStatus: { required: true, message: '请选择设备状态', trigger: 'blur' }
 }
 
 // 设备用途 select 数据
@@ -139,9 +128,7 @@ const handleDialogConfirm = async () => {
 }
 
 onMounted(() => {
-  getAllWaterFactoryList().then(({ data }) => {
-    waterFactoryOptions.value = data;
-  })
+  getAllWaterFactoryList().then(({ data }) => waterFactoryOptions.value = data);
   initPageData();
 })
 </script>

+ 20 - 6
src/views/configuration/flow/index.vue

@@ -1,8 +1,8 @@
 <script setup>
 import { CirclePlus } from '@element-plus/icons-vue'
 import { ElMessageBox } from 'element-plus'
-import { getWorkFlowList, getAllWaterFactoryList, getPositionList, getAssayList, putWorkFlow, postWorkFlow, delWorkFlow } from '@/api/configuration'
-import { getAllDeviceList} from '@/api/client/manage'
+import { getWorkFlowList, getPositionList, getAssayList, putWorkFlow, postWorkFlow, delWorkFlow } from '@/api/configuration'
+import { getAllDeviceList, getAllWaterFactoryList} from '@/api/client/manage'
 
 const { proxy } = getCurrentInstance();
 
@@ -17,6 +17,7 @@ const tableData = ref([]);
 
 const waterFactoryOptions = ref([]);
 const deviceOptions = ref([]);
+const deviceSelectOptions = ref([]);
 const pointOptions = ref([]);
 const assayOptions = ref([]);
 
@@ -40,6 +41,11 @@ const rules = {
   }, trigger: 'blur'}
 }
 
+// 设备 - list - Search
+const initDeviceSearchOptions = (deviceWorks = '') => {
+  getAllDeviceList({ deviceWorks }).then(({ data }) => deviceSelectOptions.value = data)
+}
+
 // 设备 - list
 const initDeviceOptions = (deviceWorks) => {
   deviceOptions.value = [];
@@ -73,6 +79,11 @@ const initPageData = async () => {
   loading.value = false;
 }
 
+// 水厂名称
+const onWaterFactorySearchChange = (deviceWorks) => {
+  queryParams.value.deviceId = ''
+  initDeviceSearchOptions(deviceWorks);
+}
 
 // 查询
 const handleQuery = async() => {
@@ -85,6 +96,7 @@ const handleReset = () => {
     pageNum: 1,
     pageSize: 10
   }
+  initDeviceSearchOptions();
   initPageData();
 }
 
@@ -212,7 +224,10 @@ const onDeviceSelectChange = (deviceId) => {
 
 onMounted(async () => {
   // 水厂
-  getAllWaterFactoryList().then(({ data }) => waterFactoryOptions.value = data)
+  getAllWaterFactoryList().then(({ data }) => {
+    waterFactoryOptions.value = data
+  })
+  initDeviceSearchOptions()
   // 化验项目
   getAssayList({ pageNum: 1, pageSize: 9999 }).then(({ rows }) => assayOptions.value = rows)
   // 初始化数据
@@ -231,7 +246,7 @@ onMounted(async () => {
       <el-row class="pt-[5px]" justify="space-between" :gutter="20">
         <el-col :span="6">
           <el-form-item label="水厂名称">
-            <el-select v-model="queryParams.organizationId" placeholder="请选择水厂名称" filterable clearable>
+            <el-select v-model="queryParams.organizationId" placeholder="请选择水厂名称" filterable clearable @change="onWaterFactorySearchChange">
               <el-option v-for="item in waterFactoryOptions" :key="item.id" :label="item.name" :value="item.id" />
             </el-select>
           </el-form-item>
@@ -239,7 +254,7 @@ onMounted(async () => {
         <el-col :span="6">
           <el-form-item label="设备SN / 名称">
             <el-select v-model="queryParams.deviceId" placeholder="请选择设备SN" filterable clearable>
-              <el-option v-for="item in deviceOptions" :key="item.deviceId" :label="(item.deviceSn ? item.deviceSn + '-' : '') + item.deviceName  || ''" :value="item.deviceId" />
+              <el-option v-for="item in deviceSelectOptions" :key="item.deviceId" :label="(item.deviceSn ? item.deviceSn + '-' : '') + item.deviceName  || ''" :value="item.deviceId" />
             </el-select>
           </el-form-item>
         </el-col>
@@ -342,7 +357,6 @@ onMounted(async () => {
               </el-select>
             </el-col>
             <el-col :span="8">
-              {{ formData.itemId }}
               <el-select v-model="formData.itemId" placeholder="请选择化验项目" filterable clearable>
                 <el-option v-for="item in assayOptions" :key="item.id" :label="item.name" :value="item.id" />
               </el-select>

+ 17 - 6
src/views/configuration/point/index.vue

@@ -1,7 +1,7 @@
 <script setup>
 import { CirclePlus } from '@element-plus/icons-vue'
-import { getPositionList, getAllWaterFactoryList, postPosition, putPosition, delPosition } from '@/api/configuration'
-import { getAllDeviceList} from '@/api/client/manage'
+import { getPositionList, postPosition, putPosition, delPosition } from '@/api/configuration'
+import { getAllDeviceList, getAllWaterFactoryList} from '@/api/client/manage'
 
 
 const { proxy } = getCurrentInstance();
@@ -16,6 +16,7 @@ const loading = ref(false);
 const tableData = ref([]);
 
 const waterFactoryOptions = ref([]);
+const deviceSelectOptions = ref([]);
 const deviceOptions = ref([]);
 
 const formData = ref({});
@@ -29,7 +30,10 @@ const rules = {
   code: { required: true, message: '请输入取样点位编号', trigger: 'blur' }
 }
 
-
+// 设备 - list - Search
+const initDeviceSearchOptions = (deviceWorks = '') => {
+  getAllDeviceList({ deviceWorks }).then(({ data }) => deviceSelectOptions.value = data)
+}
 // 设备 - list
 const initDeviceOptions = (deviceWorks) => {
   deviceOptions.value = [];
@@ -74,6 +78,12 @@ const initPageData = async () => {
   
 }
 
+// 水厂名称
+const onWaterFactorySearchChange = (deviceWorks) => {
+  queryParams.value.deviceId = ''
+  initDeviceSearchOptions(deviceWorks);
+}
+
 // 查询
 const handleQuery = async() => {
   initPageData();
@@ -85,6 +95,7 @@ const handleReset = () => {
     pageNum: 1,
     pageSize: 10
   }
+  initDeviceSearchOptions();
   initPageData();
 }
 
@@ -113,7 +124,7 @@ const handleDialogReset = () => {
 
 onMounted(() => {
   getAllWaterFactoryList().then(({ data }) => waterFactoryOptions.value = data);
-  
+  initDeviceSearchOptions();
   initPageData();
 })
 </script>
@@ -129,7 +140,7 @@ onMounted(() => {
       <el-row class="pt-[5px]" justify="space-between" :gutter="20">
         <el-col :span="6">
           <el-form-item label="水厂名称" prop="organizationId">
-            <el-select v-model="queryParams.organizationId" placeholder="请选择水厂名称" filterable clearable>
+            <el-select v-model="queryParams.organizationId" placeholder="请选择水厂名称" filterable clearable @change="onWaterFactorySearchChange">
               <el-option v-for="item in waterFactoryOptions" :key="item.id" :label="item.name" :value="item.id" />
             </el-select>
           </el-form-item>
@@ -137,7 +148,7 @@ onMounted(() => {
         <el-col :span="6">
           <el-form-item label="设备SN" prop="deviceId">
             <el-select v-model="queryParams.deviceId" placeholder="请选择设备SN" filterable clearable>
-              <el-option v-for="item in deviceOptions" :key="item.deviceId" :label="item.deviceName" :value="item.deviceId" />
+              <el-option v-for="item in deviceSelectOptions" :key="item.deviceId" :label="item.deviceName" :value="item.deviceId" />
             </el-select>
           </el-form-item>
         </el-col>

+ 2 - 1
src/views/configuration/sample/index.vue

@@ -1,6 +1,7 @@
 <script setup>
 import { CirclePlus } from '@element-plus/icons-vue'
-import { getSampleList, getAllWaterFactoryList, postSample, putSample, getAssayList, delSample, delWorkFlow } from '@/api/configuration'
+import { getSampleList, postSample, putSample, getAssayList, delSample } from '@/api/configuration'
+import { getAllWaterFactoryList} from '@/api/client/manage'
 
 const { proxy } = getCurrentInstance();