zmc
2023-10-12 ef10dea2a96d68a00a9a316f8594e0636103a6ab
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<script>
import TimeSelectWithShortCuts from '@/sfc/TimeSelectWithShortCuts.vue'
import settingApi from '@/api/data_access_setting/settingApi.js'
import dayjs from 'dayjs'
import { ElMessage } from 'element-plus'
// import exceptionApi from '@/api/exceptionApi.js'
 
export default {
  components: {
    TimeSelectWithShortCuts
  },
  data() {
    return {
      // 区域
      radio: 0,
      // 定时
      radio1: '',
      beginTime: '',
      endTime: '',
 
      // a :[],
      // exception: {
      //   // 断电或断网
      //   exception0: [],
      //   // 数据超低
      //   exception1: [],
      //   // 超标
      //   exception2: [],
      //   // 数据长时段无波动
      //   exception3: [],
      //   // 量级突变异常
      //   exception4: [],
      // }
    }
  },
  mounted() {
    // this.get()
    // this.getAll()
    console.log('时间',new Date().getMilliseconds()); 
  },
  methods: {
    giveTime(val) {
      //将中国标准时间转为指定格式(该组件返回的标准时间的格式,所以必须的加这个函数)
      this.beginTime = dayjs(val[0]).format('YYYY-MM-DD HH:mm:ss')
      this.endTime = dayjs(val[1]).format('YYYY-MM-DD HH:mm:ss')
    },
    set() {
      const params = {}
      params.user = 'admin'
      params.beginTime = this.beginTime
      params.endTime = this.endTime
      params.region = '金山'
      params.isRegularTime = this.radio1
      settingApi.submitSetting(params).then((res) => {
        if (res.data.code == 1) {
          ElMessage.success('设置成功')
        } else {
          ElMessage('设置失败')
        }
      })
    },
  //   get(){
 
  //     exceptionApi.analysisdata('金山区金山新城JSC1-0401单元1-11-01地块项目09','2023-07-01 00:00:00','2023-07-03 00:00:00').then((res)=>{
  //       this.a = res.data.data
  //       // console.log('数据为:',res.data.data);
  //       return res.data.data
  //     }).then(result =>{
  //       console.log('链:',result);
  //       exceptionApi.analysisdata('上海国林建材有限公司','2023-07-01 00:00:00','2023-07-03 00:00:00')
  //     }
  //     )
  //   },
 
  //  async getAll(){
  //    const a = await this.$http
  //       .get('/dust/sitenamecode', {
  //         params: {
  //           exceptionType: '0',
  //           beginTime: this.beginTime,
  //           endTime: this.endTime
  //         }
  //       }).then((result) => {
  //         this.exception.exception0 = result.data.data
  //       })
        
  //       const b = await this.$http
  //       .get('/dust/sitenamecode', {
  //         params: {
  //           exceptionType: '1',
  //           beginTime: this.beginTime,
  //           endTime: this.endTime
  //         }
  //       }).then((result) => {
  //         this.exception.exception1 = result.data.data
  //       })
       
        
  //       const c = await this.$http
  //       .get('/dust/sitenamecode', {
  //         params: {
  //           exceptionType: '2',
  //           beginTime: this.beginTime,
  //           endTime: this.endTime
  //         }
  //       }).then((result) => {
  //         this.exception.exception2 = result.data.data
  //       })
  //       const d = await this.$http
  //       .get('/dust/sitenamecode', {
  //         params: {
  //           exceptionType: '3',
  //           beginTime: this.beginTime,
  //           endTime: this.endTime
  //         }
  //       }).then((result) => {
  //         this.exception.exception3 = result.data.data
  //       })
        
  //      console.log('外1:',this.exception.exception0);
  //      console.log('外2:',this.exception.exception1);
  //      console.log('外3:',this.exception.exception2);
  //      console.log('外4:',this.exception.exception3);
  //       // Promise.all([a,b,c,d,e,f,g,h]).then((responses)=>{
  //       //   console.log('全部数据为:');
  //       //   for (const response of responses) {
  //       //     console.log('数据:',response.data.data);
 
  //       // }
  //       // })
  //   }
  }
}
</script>
 
<template>
  <el-card> 
  <el-form>
    <div>生成配置文件</div>
    <el-form-item label="区域:">
      <el-radio-group v-model="radio">
        <el-radio :label="0">金山</el-radio>
      </el-radio-group>
    </el-form-item>
    <el-form-item>
      <TimeSelectWithShortCuts @submit-time="giveTime"></TimeSelectWithShortCuts>
    </el-form-item>
 
    <el-form-item label="是否定时:">
      <el-radio-group v-model="radio1">
        <el-radio label="1" size="large">是</el-radio>
        <el-radio label="2" size="large">否</el-radio>
      </el-radio-group>
    </el-form-item>
 
    <el-form-item> <el-button type="success" @click="set">设置</el-button></el-form-item>
  </el-form>
  <correct theme="outline" size="24" fill="#333"/>
 
</el-card>
</template>
 
<style scoped>
.el-card {
  margin: 10px;
}
div {
  margin-bottom: 10px;
  color: #333333;
}
:deep(.el-form-item__label) {
  font-weight: bold;
  font-size: 16px;
  color: #333333;
}
</style>