zmc
2023-09-27 eeef5d4039d2b3fee6854ddc2789aa23232b2cfb
src/views/setting/SetConfiguration.vue
@@ -1,62 +1,176 @@
<script>
// import DustRadarChart from '../../sfc/DustRadarChart.vue';
import TimeSelectWithShortCuts from '../../sfc/TimeSelectWithShortCuts.vue'
import dayjs from 'dayjs';
  export default {
    components :{
    // DustRadarChart,
    // TimeSelectWithShortCuts
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{
  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')
    },
    mounted() {
    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('设置失败')
        }
      })
    },
    methods: {
  //   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>
  <div>
    <DustRadarChart></DustRadarChart>
  </div>
  <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>
  <!-- <div class="container">
    <el-space wrap :size="20" >
      <el-card v-for="i in 6" :key="i">
        111
      </el-card>
    </el-space>
    <el-card v-for="i in 5" :key="i">
        111
    </el-card>
    <el-card>
      22
    </el-card>
    <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>
  </div> -->
    <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>
.container {
  margin: 20px 20px;
  display: flex;
  flex-flow: row wrap;
  gap: 20px;
  height: 100%;
}
<style scoped>
.el-card {
 min-width: 500px;
  min-height: 400px;
  flex: 1 200px;
  /* flex: 1; */
  margin: 10px;
}
</style>
div {
  margin-bottom: 10px;
  color: #333333;
}
:deep(.el-form-item__label) {
  font-weight: bold;
  font-size: 16px;
  color: #333333;
}
</style>