From cc6914dff1a91dd00e3a86d5daae2c3dba2d6ba8 Mon Sep 17 00:00:00 2001
From: gaoluyang <gaoluyang@rengu.cc>
Date: 星期三, 24 七月 2024 16:28:00 +0800
Subject: [PATCH] 检测中心-班次时间配置功能

---
 src/components/view/a6-device-management.vue |  209 ++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 186 insertions(+), 23 deletions(-)

diff --git a/src/components/view/a6-device-management.vue b/src/components/view/a6-device-management.vue
index 7fc51d6..04f59c8 100644
--- a/src/components/view/a6-device-management.vue
+++ b/src/components/view/a6-device-management.vue
@@ -51,15 +51,15 @@
 
 <template>
 	<div class="role_manage">
-		<div>
+		<div v-if="!showData">
 			<el-row class="title">
-				<el-col :span="12" style="padding-left: 20px;">璁惧宸ュ叿鏄庣粏</el-col>
+				<el-col :span="12" style="padding-left: 20px;text-align: left;">璁惧宸ュ叿鏄庣粏</el-col>
 				<el-col :span="12" style="text-align: right;">
 					<el-button size="medium" type="primary" @click="dialogVisible2 = true">鏂板</el-button>
 				</el-col>
 			</el-row>
 		</div>
-		<div class="search">
+		<div class="search" v-if="!showData">
 			<div class="search_thing">
 				<div class="search_label">鐘舵�侊細</div>
 				<el-select v-model="componentData.entity.deviceStatus" placeholder="鍏ㄩ儴" size="small">
@@ -82,7 +82,7 @@
 				<el-button size="small" type="primary" @click="refreshTable()">鏌� 璇�</el-button>
 			</div>
 		</div>
-		<div class="table">
+		<div class="table" v-if="!showData">
 			<!-- 璇硶 瀛愮粍浠堕�氳繃 this.$emit +浼犲叆鏂规硶鍚� 璋冪敤鐖剁粍浠舵柟娉� 渚嬪  this.$emit锛坰electAllByOne锛� 灏遍渶鍦ㄧ埗缁勪欢澹版槑骞朵紶鍏�  @selectAllByOne="selectAllByOne"-->
 			<ValueTable @selectAllByOne="selectAllByOne" @isUpdate="isUpdate" ref="ValueTable"
 				:url="$api.deviceScope.selectDeviceParameter" :upUrl="$api.deviceScope.upDeviceParameter"
@@ -162,7 +162,7 @@
 				</el-col>
 				<!-- 鍙宠竟甯冨眬 -->
 				<el-col :span="7">
-					<el-form :label-position="labelPosition" :model="formData" label-width="120px" ref="ruleForm">
+					<el-form :label-position="labelPosition" :model="formData" label-width="140px" ref="ruleForm">
             <!-- 瀹為獙瀹ゅ垪琛� -->
             <el-form-item label="鎵�灞為儴闂�:">
               <el-select :disabled="isUp" v-model="formData.subordinateDepartmentsId" placeholder="璇烽�夋嫨" size="small" style="width:100%">
@@ -378,17 +378,73 @@
 				</el-row>
 			</span>
 		</el-dialog>
+    <el-dialog title="鏁伴噰閰嶇疆" :visible.sync="dialogVisible3" width="400px">
+      <div class="search_thing" style="margin-bottom: 14px;">
+				<div class="search_label"><span style="color:red;margin-right: 4px;">*</span>IP锛�</div>
+				<el-input size="small" placeholder="璇疯緭鍏�" clearable
+						v-model="configForm.ip"></el-input>
+			</div>
+      <div class="search_thing" style="margin-bottom: 14px;">
+				<div class="search_label"><span style="color:red;margin-right: 4px;">*</span>閲囬泦鍦板潃锛�</div>
+				<el-input size="small" placeholder="璇疯緭鍏�" clearable
+						v-model="configForm.collectUrl"></el-input>
+			</div>
+      <div class="search_thing" style="margin-bottom: 14px;">
+				<div class="search_label"><span style="color:red;margin-right: 4px;">*</span>鍌ㄥ瓨鍦板潃锛�</div>
+				<el-input size="small" placeholder="璇疯緭鍏�" clearable
+						v-model="configForm.storageUrl"></el-input>
+			</div>
+      <div class="search_thing" style="margin-bottom: 14px;">
+				<div class="search_label"><span style="color:red;margin-right: 4px;">*</span>鍙傜収锛�</div>
+				<el-input size="small" placeholder="璇疯緭鍏�" clearable
+						v-model="configForm.refer"></el-input>
+			</div>
+      <div class="search_thing" style="margin-bottom: 14px;">
+				<div class="search_label"><span style="color:red;margin-right: 4px;">*</span>X锛�</div>
+				<el-input size="small" placeholder="璇疯緭鍏�" clearable
+						v-model="configForm.x"></el-input>
+			</div>
+      <div class="search_thing" style="margin-bottom: 14px;">
+				<div class="search_label"><span style="color:red;margin-right: 4px;">*</span>Y锛�</div>
+				<el-input size="small" placeholder="璇疯緭鍏�" clearable
+						v-model="configForm.y"></el-input>
+			</div>
+      <div class="search_thing">
+				<div class="search_label">鍏紡锛�</div>
+				<el-input size="small" placeholder="璇疯緭鍏�" clearable
+						v-model="configForm.formula"></el-input>
+			</div>
+      <span slot="footer" class="dialog-footer">
+				<el-row>
+					<el-button @click="dialogVisible3=false">鍙� 娑�</el-button>
+					<el-button type="primary" @click="submitForm3" :loading="upLoad3">纭� 瀹�</el-button>
+				</el-row>
+			</span>
+    </el-dialog>
+    <dataAcquisitionConfig v-if="showData" :deviceId="deviceId"/>
 	</div>
 </template>
 
 <script>
 	import ValueTable from '../tool/value-table.vue'
+  import dataAcquisitionConfig from '../do/b6-device-management/b6-data-acquisition-config.vue'
 	export default {
 		components: {
-			ValueTable
+			ValueTable,
+      dataAcquisitionConfig
 		},
 		data() {
 			return {
+				deviceId: '',
+				fileTypeOptions: [
+					{label: 'csv', value: '.csv'},
+					{label: 'db', value: '.db'},
+					{label: 'mdb', value: '.mdb'},
+					{label: 'word', value: '.docx'},
+					{label: 'excel', value: '.xlsx'},
+					{label: 'txt', value: '.txt'},
+					{label: 'png', value: '.png'},
+				],
 				//鏄惁鏄。妗堜慨璁�  true涓嶆槸 false鏄�
 				isUp: true,
 				formData: {
@@ -404,6 +460,8 @@
 				dialogVisible: false,
 				dialogVisible2: false,
 				addPower: false,
+        showData: false, // 鏁伴噰閰嶇疆椤甸潰
+        tableList: [],
 				componentData: {
 					entity: {
 						deviceStatus: null,
@@ -412,7 +470,7 @@
 						largeCategory: null,
 						orderBy: {
 							field: 'id',
-							order: 'desc'
+							order: 'asc'
 						}
 					},
 					isIndex: true,
@@ -428,7 +486,16 @@
 						font: '妗f淇',
 						type: 'text',
 						method: 'isUpdate'
+					}, {
+						id: 'handleConfig',
+						font: '鏁伴噰閰嶇疆',
+						type: 'text',
+						method: 'handleConfig',
+            disabFun: (row, index) => {
+              return row.insProductItem === ''
+            }
 					}],
+          headNoShow:['enDeviceName'],
 					tagField: {
 						deviceStatus: {
 							select: []
@@ -480,6 +547,9 @@
 				subordinateDepartmentsList: [],
 				upLoad: false,
 				upLoad2: false,
+        dialogVisible3:false,
+        upLoad3:false,
+        configForm:{}
 			}
 		},
 		computed: {
@@ -514,8 +584,8 @@
 					this.subordinateDepartmentsList = data
 				})
 			},
-			refreshTable() {
-				this.$refs['ValueTable'].selectList()
+			refreshTable(e) {
+				this.$refs['ValueTable'].selectList(e)
 			},
 			refresh() {
 				this.componentData.entity = this.HaveJson(this.entityCopy)
@@ -527,6 +597,7 @@
 				let up = false
 				let del = false
 				let add = false
+        let config = false
 				for (var i = 0; i < power.length; i++) {
 					if (power[i].menuMethod == 'upDeviceParameter') {
 						up = true
@@ -537,15 +608,21 @@
 					if (power[i].menuMethod == 'addDeviceParameter') {
 						add = true
 					}
+          			if (power[i].menuMethod == 'saveDataAcquisitionConfiguration') {
+						config = true
+					}
 				}
-				if (!up) {
-					this.componentData.do.splice(1, 1)
-				}
-				if (!del) {
-					this.componentData.do.splice(0, 1)
-				}
-				this.addPower = add
-			},
+				if (!config) {
+							this.componentData.do.splice(2, 1)
+						}
+						if (!up) {
+							this.componentData.do.splice(1, 1)
+						}
+						if (!del) {
+							this.componentData.do.splice(0, 1)
+						}
+						this.addPower = add
+					},
 			// 鑾峰彇瀛楀吀
 			selectEnumByCategory() {
 				this.$axios.post(this.$api.enums.selectEnumByCategory, {
@@ -595,6 +672,23 @@
             this.componentData.tagField.insProductIds.select = [...this.componentData.tagField.insProductIds.select,...children]
             this.componentData.selectField.insProductIds.select = [...this.componentData.selectField.insProductIds.select,...children]
             return m
+          })
+          this.options.forEach(item=>{
+            if(item.children.length==0){
+              item.children = null;
+            }else{
+              item.children.forEach(m=>{
+                if(m.children.length==0){
+                  m.children = null;
+                }else{
+                  m.children.forEach(n=>{
+                    if(n.children&&n.children.length==0){
+                      n.children = null;
+                    }
+                  })
+                }
+              })
+            }
           })
 				})
       },
@@ -658,9 +752,11 @@
 					this.formData.imageName = response.data.name;
 				}
 			},
-			handleSuccessUpImg2(response, ) {
+			handleSuccessUpImg2(response) {
 				if (response.code == 200) {
 					this.$nextTick(() => {
+            this.formData.imageUpload = response.data.url;
+            this.formData.imageName = response.data.name;
 						this.formData2.imageUpload = response.data.url;
 						this.formData2.imageName = response.data.name;
 					})
@@ -687,7 +783,7 @@
           this.$message.error('鏈緭鍏ュ惎鐢ㄦ棩鏈�')
           return
         }
-        if(!this.formData.deviceStatus){
+        if(this.formData.deviceStatus==='' || this.formData.deviceStatus===null){
           this.$message.error('鏈�夋嫨褰撳墠鐘舵��')
           return
         }
@@ -699,7 +795,7 @@
 				delete this.formData.updateTime
 				delete this.formData.createUser
 				delete this.formData.updateUser
-        this.formData.insProductIds = this.formData.insProductIds.join()
+        this.formData.insProductIds = this.formData.insProductIds?this.formData.insProductIds.join():''
         this.upLoad = true;
 				this.$axios.post(this.$api.deviceScope.upDeviceParameter, this.formData, {
 					headers: {
@@ -712,7 +808,7 @@
 					}
 					this.$message.success('淇敼鎴愬姛')
 					this.upLoad = false
-					this.refreshTable()
+					this.refreshTable('page')
 					this.dialogVisible = false
 				}).catch(e => {
 					this.$message.error('淇敼澶辫触')
@@ -762,7 +858,7 @@
 					}
 					this.$message.success('鎻愪氦鎴愬姛')
 					this.upLoad2 = false
-					this.refreshTable()
+					this.refreshTable('page')
 					this.dialogVisible2 = false
 					this.formData2 = {
 						imageUpload: '',
@@ -773,7 +869,74 @@
 					this.dialogVisible2 = false
 					this.upLoad2 = false
 				})
-			}
+			},
+      handleConfig(row){
+        // this.configForm = {}
+        // this.dialogVisible3 = true
+        // this.$axios.post(this.$api.deviceScope.getNumberCollect+'?id='+row.id).then(res => {
+        //   this.configForm = res.data
+        // })
+        this.showData = true
+        const list = row.insProductItem.split(';')
+        let list2 = []
+        list.map((item) => {
+          const obj = Object.assign({
+			deviceId: row.id,
+            insProductItem: item,
+          })
+          list2.push(obj)
+        })
+        this.tableList = list2
+		this.deviceId = row.id
+      },
+      closeDataVue () {
+        this.showData = false
+      },
+      submitForm3(){
+        if(!this.configForm.ip){
+          this.$message.error('璇峰~鍐橧P');
+          return
+        }
+        if(!this.configForm.collectUrl){
+          this.$message.error('璇峰~鍐欓噰闆嗗湴鍧�');
+          return
+        }
+        if(!this.configForm.storageUrl){
+          this.$message.error('璇峰~鍐欏偍瀛樺湴鍧�');
+          return
+        }
+        if(!this.configForm.refer){
+          this.$message.error('璇峰~鍐欏弬鐓�');
+          return
+        }
+        if(!this.configForm.x){
+          this.$message.error('璇峰~鍐橷');
+          return
+        }
+        if(!this.configForm.y){
+          this.$message.error('璇峰~鍐橸');
+          return
+        }
+
+        this.upLoad3 = true
+        this.$axios.post(this.$api.deviceScope.numberCollect, this.configForm, {
+					headers: {
+						'Content-Type': 'application/json'
+					}
+				}).then(res => {
+          this.upLoad3 = false
+					if (res.code === 201) {
+						return
+					}
+					this.$message.success('鎿嶄綔鎴愬姛')
+					this.refreshTable('page')
+					this.dialogVisible3 = false
+				}).catch(e => {
+					this.$message.error('鎿嶄綔澶辫触')
+					this.dialogVisible3 = false
+					this.upLoad3 = false
+				})
+      }
 		}
 	}
 </script>

--
Gitblit v1.9.3