From 2162dec5e0acc98f8e22fa9907cdc5f70eba6dcc Mon Sep 17 00:00:00 2001
From: zmc <zmc_li@foxmail.com>
Date: 星期四, 23 十一月 2023 17:57:39 +0800
Subject: [PATCH] 1.修改了风险模型页面有效率,在线率的展示百分比 2.站点审核辅助页面增加了标识

---
 src/sfc/InputSearch.vue |  192 ++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 146 insertions(+), 46 deletions(-)

diff --git a/src/sfc/InputSearch.vue b/src/sfc/InputSearch.vue
index c0a5d13..d7d10d7 100644
--- a/src/sfc/InputSearch.vue
+++ b/src/sfc/InputSearch.vue
@@ -1,7 +1,10 @@
 <!-- 
   杩滅▼鎼滅储 绔欑偣鍚嶇О 杈撳叆妗嗙粍浠�
   鏍规嵁杈撳叆绔欑偣鐨勫唴瀹规彁渚涘搴旂殑杈撳叆寤鸿
-
+  1.鍚戠埗缁勪欢浼犲叆绔欑偣鍚嶅瓧 鍜� 璁惧缂栫爜
+  2.鍙互閫夋嫨寤鸿鎴栬�呬换鎰忚緭鍏�
+  3.鐖剁粍浠跺彲浠ヨ缃緭鍏ユ鏈夋棤榛樿鐨勭珯鐐瑰悕绉�
+  4.鐖剁粍浠跺彲浠ヨ缃槸鍚﹂渶瑕佹牴鎹�変腑鐨勫紓甯哥被鍨嬫潵缁欏嚭绔欑偣寤鸿
   ** 
   鍦ㄧ埗缁勪欢涓缃�
   <InputSearch :isNeedDefaultSite="1" @submit-value="(n)=>form.name=n"> </InputSearch>
@@ -9,35 +12,100 @@
   鐖剁粍浠堕�氳繃娉ㄥ叆 :isNeedDefaultSite="1"鎴�  :isNeedDefaultSite="0"鏉ヤ唬琛ㄨ杈撳叆妗嗘湁鏃犻粯璁ょ殑绔欑偣鍚嶇О
   1浠h〃闇�瑕侀粯璁ゅ�� 锛�0浠h〃涓嶉渶瑕侀粯璁ゅ��
  -->
+
+
+ 
 <script>
+import exceptionApi from '@/api/exceptionApi.js';
 export default {
-  props:{
-  // 0浠h〃涓嶉渶瑕侀粯璁ゅ�硷紝1浠h〃闇�瑕侀粯璁ゅ��
-    isNeedDefaultSite:{
+  props: {
+    // 0浠h〃涓嶉渶瑕侀粯璁ゅ�硷紝1浠h〃闇�瑕侀粯璁ゅ��
+    isNeedDefaultSite: {
+      type: String,
+      default: '0'
+    },
+    // 0浠h〃涓嶉渶瑕侊紝1浠h〃鏍规嵁鏃舵鍜屽紓甯告潵缁欏嚭杈撳叆寤鸿
+    isNeedRealTimeAdvice:{
       type:String,
       default:'0'
+    },
+    exceptionType:{
+      type:Array,
+      default:()=>{
+        return []
+      }
+    },
+    beginTime:{
+      type:String,
+      default:''
+    },
+    endTime:{
+      type:String,
+      default:''
+    },
+    siteName:{
+      type:String,
+      default:'-1'
     }
   },
-  emits:['submitValue','submitSiteNums'],
+  emits: ['submitValue', 'submitSiteNums','submitMncode'],
   data() {
     return {
+      // 鐢ㄦ埛閫変腑鐨勫��
       state: '',
-      // 绔欑偣鍚嶇О
-      siteNames:[],
+      // 淇濆瓨杈撳叆寤鸿鐨勭珯鐐瑰悕绉�
+      siteNames: [],
+      // 淇濆瓨杈撳叆寤鸿鐨勭珯鐐硅澶囩紪鍙�
+      siteNamesAndMnCode:[]
     }
   },
-
-  mounted() {
-      // 鍔犺浇鎵�鏈夌殑绔欑偣鍚嶇О
-    this.loadAll()
-    if(this.isNeedDefaultSite == 1){
-      this.state = '閲戝北鍖洪噾灞辨柊鍩嶫SC1-0401鍗曞厓1-11-01鍦板潡椤圭洰09'
-      this.$emit('submitValue',this.state)
-    }else if(this.isNeedDefaultSite == 0){
-      this.state = ''
-      this.$emit('submitValue',this.state)
+  watch:{
+    beginTime(val,oldVal){
+      
+      if(this.isNeedRealTimeAdvice =='1' && oldVal != ''){
+        exceptionApi.getExceptionName(this.exceptionType,this.beginTime,this.endTime).then( res=>{
+          this.siteNames = []
+          const sites = res.data.data
+          sites.filter((item) => {
+          this.siteNames.push(item['name'])
+          })
+        })
+      }
+    },
+    exceptionType(){
+      if(this.isNeedRealTimeAdvice =='1' ){
+        exceptionApi.getExceptionName(this.exceptionType,this.beginTime,this.endTime).then( res=>{
+          this.siteNames = []
+          const sites = res.data.data
+          sites.filter((item) => {
+          this.siteNames.push(item['name'])
+          })
+        })
+      }
+    },
+    siteName(){
+      if(this.siteName != '-1' && this.siteName != ''){
+        this.state = this.siteName
+        this.$emit('submitValue', this.state)
+      }
+    },
+    state(){
+      if(this.state != '' && this.state != null){
+        // 鏌ユ壘瀵瑰簲鐨勮澶囩紪鍙�
+        this.onSiteNameSelected(this.state)
+      }
     }
-   
+  },
+  mounted() {
+    // 鍔犺浇鎵�鏈夌殑绔欑偣鍚嶇О
+    this.loadAll()
+    if (this.isNeedDefaultSite == 1) {
+      this.state = '閲戝北鍖洪噾灞辨柊鍩嶫SC1-0401鍗曞厓1-11-01鍦板潡椤圭洰09'
+      this.$emit('submitValue', this.state)
+    } else if (this.isNeedDefaultSite == 0) {
+      this.state = ''
+      this.$emit('submitValue', this.state)
+    }
   },
   methods: {
     querySearch(queryString, cb) {
@@ -56,45 +124,76 @@
     },
     // 鍒濆鍖栧姞杞芥墍鏈夌殑绔欑偣鍚嶅瓧
     loadAll() {
-      this.$http.get('/dust/sitename').then(response=>{
-          const sites = response.data.data
-          sites.filter(item=>{
-              this.siteNames.push(item['name'])
+      if(this.isNeedRealTimeAdvice == '1'){
+        exceptionApi.getExceptionName(this.exceptionType,this.beginTime,this.endTime).then( res=>{
+          this.siteNames = []
+          const sites = res.data.data
+          sites.filter((item) => {
+          this.siteNames.push(item['name'])
+          let temp = {}
+          temp.name = item.name
+          temp.mnCode = item.mnCode
+          this.siteNamesAndMnCode.push(temp)
           })
-          this.$emit('submitSiteNums',this.siteNames.length)
+        })
+
+    }else if(this.isNeedRealTimeAdvice == '0'){
+      exceptionApi.getSitesNum().then((response) => {
+        const sites = response.data.data
+        sites.filter((item) => {
+          this.siteNames.push(item['name'])
+          let temp = {}
+          temp.name = item.name
+          temp.mnCode = item.mnCode
+          this.siteNamesAndMnCode.push(temp)
+        })
+        this.$emit('submitSiteNums', this.siteNames.length)
       })
+    }
     },
+    // 鏍规嵁閫変腑鐨勭珯鐐规煡璇㈣澶囩紪鍙�
+    onSiteNameSelected(siteName) { 
+      const selectedSite = this.siteNamesAndMnCode.find((site) => site.name == siteName); 
+  if (selectedSite) { 
+    this.$emit('submitMncode',selectedSite.mnCode)
+  }else{
+    this.$emit('submitMncode','')
+  }
+},
+    
     // 鐐瑰嚮閫変腑寤鸿椤规椂瑙﹀彂
     handleSelect(item) {
       this.state = item
-      this.$emit('submitValue',this.state)
+      this.$emit('submitValue', this.state)
     },
     // 鍦ㄧ偣鍑荤敱 clearable 灞炴�х敓鎴愮殑娓呯┖鎸夐挳鏃惰Е鍙�
-    clearSiteName(){
-      this.state=''
-      this.$emit('submitValue',this.state)
-    }
+    clearSiteName() {
+      this.state = ''
+      this.$emit('submitValue', this.state)
+    },
+
   }
 }
 </script>
 
 <template>
   <div class="container">
-  <span class="text">鐐逛綅鍚嶇О锛�</span>
-  <el-autocomplete
-    v-model="state"
-    :fetch-suggestions="querySearch"
-    popper-class="my-autocomplete"
-    placeholder="璇疯緭鍏�"
-    @select="handleSelect"
-    clearable
-    @clear="clearSiteName"
-  >
-    <template #default="{ item }">
-      <div class="value">{{ item }}</div>
-    </template>
-  </el-autocomplete>
-</div>
+    <span class="text">鐐逛綅鍚嶇О锛�</span>
+    <el-autocomplete
+      v-model="state"
+      :fetch-suggestions="querySearch"
+      popper-class="my-autocomplete"
+      placeholder="璇疯緭鍏�"
+      @select="handleSelect"
+      @change="handleSelect"
+      clearable
+      @clear="clearSiteName"
+    >
+      <template #default="{ item }">
+        <div class="value">{{ item }}</div>
+      </template>
+    </el-autocomplete>
+  </div>
 </template>
 
 <style>
@@ -104,10 +203,11 @@
 
 .text {
   font-weight: bold;
-  margin-top: 5px;
-  font-size: 16px;
+  font-size: 14px;
+  color: #333333;
 }
 .el-autocomplete {
-  margin-top: 5px;
+  width: 200px;
 }
+
 </style>

--
Gitblit v1.9.3