| | |
| | | <a-form-item style="">
|
| | | <a-pagination
|
| | | style="margin-right: 0"
|
| | | :default-current="1"
|
| | | :pageSize="size"
|
| | | :pageSizeOptions="pageSizeOptions"
|
| | | @showSizeChange="onShowSizeChange"
|
| | | :total="total"
|
| | | @change="turnPage"
|
| | | show-quick-jumper
|
| | | showSizeChanger
|
| | | :show-total="(total) => `共有 ${total} 条数据`"
|
| | | />
|
| | | </a-form-item>
|
| | | </a-form>
|
| | |
| | | </template>
|
| | |
|
| | | <script lang="tsx">
|
| | | import {
|
| | | Component,
|
| | | Prop,
|
| | | Vue,
|
| | | Emit, Watch,
|
| | | } from 'vue-property-decorator';
|
| | | import moment from 'moment';
|
| | | import { Component, Prop, Vue, Emit, Watch } from "vue-property-decorator";
|
| | | import moment from "moment";
|
| | | import { get, post } from "@/util/request";
|
| | |
|
| | | @Component({})
|
| | | export default class Calibration extends Vue {
|
| | | private flueOfSensor: string = ''
|
| | | private flueOfSensor: string = "";
|
| | | @Prop({
|
| | | type: Boolean,
|
| | | default: false
|
| | | default: false,
|
| | | })
|
| | | private wFlag: boolean
|
| | | private wFlag: boolean;
|
| | |
|
| | | @Prop({
|
| | | type: Object,
|
| | | default: () => {
|
| | | }
|
| | | default: () => {},
|
| | | })
|
| | | private caliRecord: any
|
| | | private caliRecord: any;
|
| | |
|
| | | @Watch('wFlag', {
|
| | | deep: true
|
| | | @Watch("wFlag", {
|
| | | deep: true,
|
| | | })
|
| | | private watchFlag(newVal: boolean, oldVal: boolean) {
|
| | | this.getSensorByVersionId()
|
| | | this.getSensorByVersionId();
|
| | | }
|
| | |
|
| | | // 内部分页
|
| | | // 内部分页
|
| | | private pagination: any = {
|
| | | total: 0,
|
| | | current: 1,
|
| | | pageSize: 5,
|
| | | showSizeChanger: false,
|
| | | showQuickJumper: false
|
| | | }
|
| | | showQuickJumper: false,
|
| | | };
|
| | |
|
| | | private handleTableChange(pagination: any, filters: any, sorter: any): void {
|
| | | this.pagination.current = pagination.current
|
| | | this.getSersorFomule()
|
| | | this.pagination.current = pagination.current;
|
| | | this.getSersorFomule();
|
| | | }
|
| | | // 公式生成=========================================
|
| | | private gFormula() {
|
| | | if (this.addFlag === false && this.editFlag === true) {
|
| | | if (this.sensorCode === 'a40001') {
|
| | | const yanqi = JSON.parse(this.caliRecord.extend)
|
| | | this.editData.cel = (this.editData.val1 !== '') ? ('(currentSpeed' + this.editData.formula1 + '' + this.editData.val1 + ')') + '*' + yanqi.area : ''
|
| | | } else if (this.sensorCode === 'a01011') {
|
| | | this.editData.cel = (this.editData.val1 !== '') ? ('cel' + this.editData.formula1 + '' + this.editData.val1 ) : this.editData.cel
|
| | | }else {
|
| | | if (this.editData.val1 === '' && this.editData.val2 !== '') {
|
| | | this.editData.cel = 'cel' + this.editData.formula2 + '' + this.editData.val2
|
| | | } else if (this.editData.val1 !== '' && this.editData.val2 !== '') {
|
| | | this.editData.cel = this.editData.type1 + '' + this.editData.formula1 + '' + this.editData.val1 + '+cel' + this.editData.formula2 + '' + this.editData.val2
|
| | | } else if (this.editData.val1 !== '' && this.editData.val2 === '') {
|
| | | this.editData.cel = this.editData.type1 + '' + this.editData.formula1 + '' + this.editData.val1
|
| | | if (this.sensorCode === "a40001") {
|
| | | const yanqi = JSON.parse(this.caliRecord.extend);
|
| | | this.editData.cel =
|
| | | this.editData.val1 !== ""
|
| | | ? "(currentSpeed" +
|
| | | this.editData.formula1 +
|
| | | "" +
|
| | | this.editData.val1 +
|
| | | ")" +
|
| | | "*" +
|
| | | yanqi.area
|
| | | : "";
|
| | | } else if (this.sensorCode === "a01011") {
|
| | | this.editData.cel =
|
| | | this.editData.val1 !== ""
|
| | | ? "cel" + this.editData.formula1 + "" + this.editData.val1
|
| | | : this.editData.cel;
|
| | | } else {
|
| | | if (this.editData.val1 === "" && this.editData.val2 !== "") {
|
| | | this.editData.cel =
|
| | | "cel" + this.editData.formula2 + "" + this.editData.val2;
|
| | | } else if (this.editData.val1 !== "" && this.editData.val2 !== "") {
|
| | | this.editData.cel =
|
| | | this.editData.type1 +
|
| | | "" +
|
| | | this.editData.formula1 +
|
| | | "" +
|
| | | this.editData.val1 +
|
| | | "+cel" +
|
| | | this.editData.formula2 +
|
| | | "" +
|
| | | this.editData.val2;
|
| | | } else if (this.editData.val1 !== "" && this.editData.val2 === "") {
|
| | | this.editData.cel =
|
| | | this.editData.type1 +
|
| | | "" +
|
| | | this.editData.formula1 +
|
| | | "" +
|
| | | this.editData.val1;
|
| | | } else {
|
| | | this.editData.cel = ''
|
| | | this.editData.cel = "";
|
| | | }
|
| | | }
|
| | |
|
| | | } else {
|
| | | if(this.sensorCode === 'a40001') {
|
| | | if (this.sensorCode === "a40001") {
|
| | | if (this.caliRecord.extend !== null) {
|
| | | const yanqi = JSON.parse(this.caliRecord.extend)
|
| | | const yanqi = JSON.parse(this.caliRecord.extend);
|
| | | if (yanqi.area) {
|
| | | this.addData.cel = (this.addData.val1 !== '') ? ('(currentSpeed' + this.addData.formula1 + '' + this.addData.val1 + ')') + '*' + yanqi.area : ''
|
| | | this.addData.cel =
|
| | | this.addData.val1 !== ""
|
| | | ? "(currentSpeed" +
|
| | | this.addData.formula1 +
|
| | | "" +
|
| | | this.addData.val1 +
|
| | | ")" +
|
| | | "*" +
|
| | | yanqi.area
|
| | | : "";
|
| | | } else {
|
| | | this.$message.warning('请给该设备配置烟道面积!')
|
| | | this.$message.warning("请给该设备配置烟道面积!");
|
| | | }
|
| | | } else {
|
| | | this.$message.warning('请给该设备配置烟道面积!')
|
| | | this.$message.warning("请给该设备配置烟道面积!");
|
| | | }
|
| | | } else {
|
| | | if (this.addData.val1 === '' && this.addData.val2 !== '') {
|
| | | this.addData.cel = 'cel' + this.addData.formula2 + '' + this.addData.val2
|
| | | } else if (this.addData.val1 !== '' && this.addData.val2 !== '') {
|
| | | this.addData.cel = this.addData.type1 + '' + this.addData.formula1 + '' + this.addData.val1 + '+cel' + this.addData.formula2 + '' + this.addData.val2
|
| | | } else if (this.addData.val1 !== '' && this.addData.val2 === '') {
|
| | | this.addData.cel = this.addData.type1 + '' + this.addData.formula1 + '' + this.addData.val1
|
| | | if (this.addData.val1 === "" && this.addData.val2 !== "") {
|
| | | this.addData.cel =
|
| | | "cel" + this.addData.formula2 + "" + this.addData.val2;
|
| | | } else if (this.addData.val1 !== "" && this.addData.val2 !== "") {
|
| | | this.addData.cel =
|
| | | this.addData.type1 +
|
| | | "" +
|
| | | this.addData.formula1 +
|
| | | "" +
|
| | | this.addData.val1 +
|
| | | "+cel" +
|
| | | this.addData.formula2 +
|
| | | "" +
|
| | | this.addData.val2;
|
| | | } else if (this.addData.val1 !== "" && this.addData.val2 === "") {
|
| | | this.addData.cel =
|
| | | this.addData.type1 +
|
| | | "" +
|
| | | this.addData.formula1 +
|
| | | "" +
|
| | | this.addData.val1;
|
| | | } else {
|
| | | this.addData.cel = ''
|
| | | this.addData.cel = "";
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | // selectData
|
| | | private selectType: any[] = [
|
| | | {'key': 'aqi', 'value': 'AQI值'}, {'key': 'vocs', 'value': 'Vocs值'}
|
| | | ]
|
| | | { key: "aqi", value: "AQI值" },
|
| | | { key: "vocs", value: "Vocs值" },
|
| | | ];
|
| | | private selectSymbol: any[] = [
|
| | | {'key': '+', 'value': '加'}, {'key': '-', 'value': '减'}, {'key': '*', 'value': '乘'}, {'key': '/', 'value': '除'}
|
| | | ]
|
| | | { key: "+", value: "加" },
|
| | | { key: "-", value: "减" },
|
| | | { key: "*", value: "乘" },
|
| | | { key: "/", value: "除" },
|
| | | ];
|
| | |
|
| | | //添加数据
|
| | | private addData: any = {
|
| | | startTime: moment('00:00:00', 'HH:mm:ss'),
|
| | | endTime: moment('23:59:59', 'HH:mm:ss'),
|
| | | type1: 'aqi',
|
| | | formula1: '+',
|
| | | formula2: '+',
|
| | | val1: '',
|
| | | val2: '',
|
| | | cel: ''
|
| | | startTime: moment("00:00:00", "HH:mm:ss"),
|
| | | endTime: moment("23:59:59", "HH:mm:ss"),
|
| | | type1: "aqi",
|
| | | formula1: "+",
|
| | | formula2: "+",
|
| | | val1: "",
|
| | | val2: "",
|
| | | cel: "",
|
| | | };
|
| | | private pageSizeOptions: any = ["10", "30", "60", "100"];
|
| | |
|
| | | private onShowSizeChange(current: any, pageSize: any) {
|
| | | this.size = pageSize;
|
| | | this.getSensorByVersionId();
|
| | | }
|
| | |
|
| | | // 存放数据
|
| | | private dataSource: any = null
|
| | | // 存放数据
|
| | | private dataSource: any = null;
|
| | | // 存放sensorCode
|
| | | private sensorCode: any = ''
|
| | | private sensorCode: any = "";
|
| | |
|
| | | //监听面板状态
|
| | | //监听面板状态
|
| | | private turnState(event: any) {
|
| | | if (event !== undefined) {
|
| | | this.sensorCode = ''
|
| | | let code = ''
|
| | | this.sensorCode = "";
|
| | | let code = "";
|
| | | for (let i = 0; i < this.dataSensors.length; i++) {
|
| | | if (this.dataSensors[i].id === Number(event)) {
|
| | | code = this.dataSensors[i].code
|
| | | code = this.dataSensors[i].code;
|
| | | }
|
| | | }
|
| | | this.sensorCode = code
|
| | | this.getTimeArea()
|
| | | this.getSersorFomule()
|
| | | this.sensorCode = code;
|
| | | this.getTimeArea();
|
| | | this.getSersorFomule();
|
| | | }
|
| | | }
|
| | |
|
| | | //存放所有时间段数据
|
| | | private savaTimeArea: any = null
|
| | | private savaTimeArea: any = null;
|
| | | // 获取时间段
|
| | | private getTimeArea() {
|
| | | get('deviceAdjustValue/getTimeSlot', {
|
| | | mac: this.caliRecord.mac,
|
| | | sensor_code: this.sensorCode
|
| | | get("deviceAdjustValue/getTimeSlot", {
|
| | | mac: this.caliRecord.mac,
|
| | | sensor_code: this.sensorCode,
|
| | | }).then((res: any) => {
|
| | | this.savaTimeArea = res.data.data.timeSlotList
|
| | | })
|
| | | this.savaTimeArea = res.data.data.timeSlotList;
|
| | | });
|
| | | }
|
| | |
|
| | | // 获取因子公式数据
|
| | | private getSersorFomule() {
|
| | | get('deviceAdjustValue/getDeviceAdjustValueByCondition', {
|
| | | mac: this.caliRecord.mac,
|
| | | current: this.pagination.current,
|
| | | sensor_code: this.sensorCode,
|
| | | size: this.pagination.pageSize,
|
| | | orderType: 0
|
| | | get("deviceAdjustValue/getDeviceAdjustValueByCondition", {
|
| | | mac: this.caliRecord.mac,
|
| | | current: this.pagination.current,
|
| | | sensor_code: this.sensorCode,
|
| | | size: this.pagination.pageSize,
|
| | | orderType: 0,
|
| | | }).then((res: any) => {
|
| | | this.pagination.total = res.data.data.totalNumber
|
| | | this.dataSource = res.data.data.deviceAdjustValues
|
| | | this.pagination.total = res.data.data.totalNumber;
|
| | | this.dataSource = res.data.data.deviceAdjustValues;
|
| | | console.log(parseInt(res.data.data.deviceAdjustValues[0].value));
|
| | | })
|
| | | });
|
| | | }
|
| | |
|
| | | //规则指定
|
| | | private caliRules: any = {
|
| | | startTime: [
|
| | | {required: true, message: '请输入开始时间', trigger: ['change', 'blur']},
|
| | | {validator: this.vali(), trigger: ['change', 'blur']}
|
| | | {
|
| | | required: true,
|
| | | message: "请输入开始时间",
|
| | | trigger: ["change", "blur"],
|
| | | },
|
| | | { validator: this.vali(), trigger: ["change", "blur"] },
|
| | | ],
|
| | | endTime: [
|
| | | {required: true, message: '请输入结束时间'},
|
| | | {validator: this.vali(), trigger: ['change', 'blur']}
|
| | | { required: true, message: "请输入结束时间" },
|
| | | { validator: this.vali(), trigger: ["change", "blur"] },
|
| | | ],
|
| | | cel: [
|
| | | {required: true, message: '请生成校准公式', trigger: ['change', 'blur']},
|
| | | ]
|
| | | }
|
| | | {
|
| | | required: true,
|
| | | message: "请生成校准公式",
|
| | | trigger: ["change", "blur"],
|
| | | },
|
| | | ],
|
| | | };
|
| | |
|
| | | private vali() {
|
| | | let ru = (rule: any, value: any, callback: any) => {
|
| | | if (this.addFlag === true) {
|
| | | if (this.addData.endTime < this.addData.startTime) {
|
| | | callback(new Error('开始时间需小于结束时间'))
|
| | | callback(new Error("开始时间需小于结束时间"));
|
| | | } else {
|
| | | callback()
|
| | | callback();
|
| | | }
|
| | | } else {
|
| | | if (this.editData.endTime < this.editData.startTime) {
|
| | | callback(new Error('开始时间需小于结束时间'))
|
| | | callback(new Error("开始时间需小于结束时间"));
|
| | | } else {
|
| | | callback()
|
| | | callback();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | return ru
|
| | | };
|
| | | return ru;
|
| | | }
|
| | |
|
| | |
|
| | | // 判断时间是否在多个区间内
|
| | | // 判断时间是否在多个区间内
|
| | | private judgeTime(startTime: any, endTime: any) {
|
| | | let arr1 = []
|
| | | let arr1 = [];
|
| | | // 开始时间秒数
|
| | | let sTime = new Date(startTime)
|
| | | let sSecondNum = ''
|
| | | let sHour = sTime.getHours().toString().length === 2 ? sTime.getHours() : '0' + sTime.getHours()
|
| | | let sMinutes = sTime.getMinutes().toString().length === 2 ? sTime.getMinutes() : '0' + sTime.getMinutes()
|
| | | sSecondNum = Number(sHour) * 60 * 60 + Number(sMinutes) * 60
|
| | | let sTime = new Date(startTime);
|
| | | let sSecondNum = "";
|
| | | let sHour =
|
| | | sTime.getHours().toString().length === 2
|
| | | ? sTime.getHours()
|
| | | : "0" + sTime.getHours();
|
| | | let sMinutes =
|
| | | sTime.getMinutes().toString().length === 2
|
| | | ? sTime.getMinutes()
|
| | | : "0" + sTime.getMinutes();
|
| | | sSecondNum = Number(sHour) * 60 * 60 + Number(sMinutes) * 60;
|
| | | // 结束时间秒数
|
| | | let eTime = new Date(endTime)
|
| | | let eSecondNum = ''
|
| | | let eHour = eTime.getHours().toString().length === 2 ? eTime.getHours() : '0' + eTime.getHours()
|
| | | let eMinutes = eTime.getMinutes().toString().length === 2 ? eTime.getMinutes() : '0' + eTime.getMinutes()
|
| | | eSecondNum = Number(eHour) * 60 * 60 + Number(eMinutes) * 60
|
| | | arr1.push(sSecondNum)
|
| | | arr1.push(eSecondNum)
|
| | | let arrFlag = []
|
| | | let eTime = new Date(endTime);
|
| | | let eSecondNum = "";
|
| | | let eHour =
|
| | | eTime.getHours().toString().length === 2
|
| | | ? eTime.getHours()
|
| | | : "0" + eTime.getHours();
|
| | | let eMinutes =
|
| | | eTime.getMinutes().toString().length === 2
|
| | | ? eTime.getMinutes()
|
| | | : "0" + eTime.getMinutes();
|
| | | eSecondNum = Number(eHour) * 60 * 60 + Number(eMinutes) * 60;
|
| | | arr1.push(sSecondNum);
|
| | | arr1.push(eSecondNum);
|
| | | let arrFlag = [];
|
| | | // 判断区间
|
| | | for (let i = 0; i < this.savaTimeArea.length; i++) {
|
| | | if (this.editRecord) {
|
| | | if (this.savaTimeArea[i].id === this.editRecord.id){
|
| | | if (this.savaTimeArea[i].id === this.editRecord.id) {
|
| | | continue;
|
| | | }
|
| | | }
|
| | | let arr2 = []
|
| | | let perStartTime = this.savaTimeArea[i].startTime
|
| | | let startArray = perStartTime.split(':')
|
| | | let sNum = Number(startArray[0]) * 3600 + Number(startArray[1]) * 60
|
| | | arr2.push(sNum)
|
| | | let perEndTime = this.savaTimeArea[i].endTime
|
| | | let endArray = perEndTime.split(':')
|
| | | let eNum = Number(endArray[0]) * 3600 + Number(endArray[1]) * 60
|
| | | arr2.push(eNum)
|
| | | let flag = this.isIntersect(arr1, arr2)
|
| | | arrFlag.push(flag)
|
| | | let arr2 = [];
|
| | | let perStartTime = this.savaTimeArea[i].startTime;
|
| | | let startArray = perStartTime.split(":");
|
| | | let sNum = Number(startArray[0]) * 3600 + Number(startArray[1]) * 60;
|
| | | arr2.push(sNum);
|
| | | let perEndTime = this.savaTimeArea[i].endTime;
|
| | | let endArray = perEndTime.split(":");
|
| | | let eNum = Number(endArray[0]) * 3600 + Number(endArray[1]) * 60;
|
| | | arr2.push(eNum);
|
| | | let flag = this.isIntersect(arr1, arr2);
|
| | | arrFlag.push(flag);
|
| | | }
|
| | | return arrFlag
|
| | | return arrFlag;
|
| | | }
|
| | |
|
| | | // 判断两个集合是否有交集
|
| | | private isIntersect(arr1: Array, arr2: Array) {
|
| | | let start = [Math.min(...arr1), Math.min(...arr2)];//区间的两个最小值
|
| | | let end = [Math.max(...arr1), Math.max(...arr2)];//区间的两个最大值
|
| | | return Math.max(...start) < Math.min(...end);//最大值里的最小值 是否 小于等于 最大值的最小值
|
| | | let start = [Math.min(...arr1), Math.min(...arr2)]; //区间的两个最小值
|
| | | let end = [Math.max(...arr1), Math.max(...arr2)]; //区间的两个最大值
|
| | | return Math.max(...start) < Math.min(...end); //最大值里的最小值 是否 小于等于 最大值的最小值
|
| | | }
|
| | |
|
| | |
|
| | | // 清空公式
|
| | | private clearCel() {
|
| | | this.addData.cel = ''
|
| | | this.editData.cel = ''
|
| | | this.addData.cel = "";
|
| | | this.editData.cel = "";
|
| | | }
|
| | |
|
| | | private created() {
|
| | | }
|
| | | private created() {}
|
| | |
|
| | | // 不同时间的校准列表
|
| | | private columns: any[] = [
|
| | | {
|
| | | title: "开始时间",
|
| | | dataIndex: "startTime"
|
| | | dataIndex: "startTime",
|
| | | },
|
| | | {
|
| | | title: "结束时间",
|
| | | dataIndex: "endTime"
|
| | | dataIndex: "endTime",
|
| | | },
|
| | | {
|
| | | title: "公式",
|
| | | dataIndex: "value"
|
| | | dataIndex: "value",
|
| | | },
|
| | | {
|
| | | title: "操作",
|
| | | customRender: this.opRender
|
| | | }
|
| | | customRender: this.opRender,
|
| | | },
|
| | | ];
|
| | |
|
| | | // 时间字符串
|
| | | private startTimeString: any = ''
|
| | | private endTimeString: any = ''
|
| | | private startTimeString: any = "";
|
| | | private endTimeString: any = "";
|
| | |
|
| | | //监听时间变化
|
| | | private turnStartTime(time: any) {
|
| | | let d = new Date(time._d)
|
| | | let hour = d.getHours().toString().length === 2 ? d.getHours() : '0' + d.getHours()
|
| | | let minutes = d.getMinutes().toString().length === 2 ? d.getMinutes() : '0' + d.getMinutes()
|
| | | this.startTimeString = hour + ':' + minutes + ':00'
|
| | |
|
| | | let d = new Date(time._d);
|
| | | let hour =
|
| | | d.getHours().toString().length === 2 ? d.getHours() : "0" + d.getHours();
|
| | | let minutes =
|
| | | d.getMinutes().toString().length === 2
|
| | | ? d.getMinutes()
|
| | | : "0" + d.getMinutes();
|
| | | this.startTimeString = hour + ":" + minutes + ":00";
|
| | | }
|
| | |
|
| | | private turnEndTime(time: any) {
|
| | | let d = new Date(time._d)
|
| | | let hour = d.getHours().toString().length === 2 ? d.getHours() : '0' + d.getHours()
|
| | | let minutes = d.getMinutes().toString().length === 2 ? d.getMinutes() : '0' + d.getMinutes()
|
| | | this.endTimeString = hour + ':' + minutes + ':00'
|
| | | let d = new Date(time._d);
|
| | | let hour =
|
| | | d.getHours().toString().length === 2 ? d.getHours() : "0" + d.getHours();
|
| | | let minutes =
|
| | | d.getMinutes().toString().length === 2
|
| | | ? d.getMinutes()
|
| | | : "0" + d.getMinutes();
|
| | | this.endTimeString = hour + ":" + minutes + ":00";
|
| | | }
|
| | |
|
| | | // 分页组件所需数据--------------------------------------------------
|
| | | private currentPage: number = 1
|
| | | private total: number = 0
|
| | | private size: number = 0
|
| | | // 分页组件所需数据--------------------------------------------------
|
| | | private currentPage: number = 1;
|
| | | private total: number = 0;
|
| | | private size: number = 10;
|
| | |
|
| | | private turnPage(current: any) {
|
| | | this.currentPage = current
|
| | | this.getSensorByVersionId()
|
| | | this.currentPage = current;
|
| | | this.getSensorByVersionId();
|
| | | }
|
| | |
|
| | | // 因子数据
|
| | | private dataSensors: any = null
|
| | | private dataSensors: any = null;
|
| | |
|
| | | // 根据型号id获取因子
|
| | | private getSensorByVersionId() {
|
| | | get("version/queryById", {
|
| | | id: this.caliRecord.version.id,
|
| | | page: this.currentPage,
|
| | | size: 5
|
| | | })
|
| | | .then((res: any) => {
|
| | | this.dataSensors = res.data.data.versions[0].sensors
|
| | | this.total = res.data.data.total
|
| | | this.size = res.data.data.size
|
| | | })
|
| | | .catch(err => {
|
| | | console.log(err);
|
| | | });
|
| | | id: this.caliRecord.version.id,
|
| | | page: this.currentPage,
|
| | | size: this.size,
|
| | | })
|
| | | .then((res: any) => {
|
| | | this.dataSensors = res.data.data.versions[0].sensors;
|
| | | this.total = res.data.data.total;
|
| | | })
|
| | | .catch((err) => {
|
| | | console.log(err);
|
| | | });
|
| | | }
|
| | |
|
| | |
|
| | | private handleCancel() {
|
| | | this.sendFlag(false)
|
| | | this.currentPage = 1
|
| | | this.sendFlag(false);
|
| | | this.currentPage = 1;
|
| | | }
|
| | |
|
| | | private handleOk() {
|
| | | this.sendFlag(false)
|
| | | this.currentPage = 1
|
| | | this.sendFlag(false);
|
| | | this.currentPage = 1;
|
| | | }
|
| | |
|
| | | @Emit('cFlag')
|
| | | @Emit("cFlag")
|
| | | private sendFlag(flag: boolean) {
|
| | | return flag;
|
| | | }
|
| | |
|
| | | // 新建校准值-----------------------------------------------------------------------------
|
| | |
|
| | | private addFlag: boolean = false
|
| | | private addFlag: boolean = false;
|
| | |
|
| | | private addCalib() {
|
| | | this.addFlag = true
|
| | | this.addFlag = true;
|
| | | }
|
| | |
|
| | | private handleAddlOk() {
|
| | | this.$refs.addCaliForm.validate((valid: any) => {
|
| | | if (valid) {
|
| | | let flag = this.judgeTime(this.addData.startTime, this.addData.endTime)
|
| | | let flag = this.judgeTime(this.addData.startTime, this.addData.endTime);
|
| | | if (flag.indexOf(true) !== -1) {
|
| | | this.$message.warning('新建时间区间不能与已经存在的时间段交叉', 2)
|
| | | this.$message.warning("新建时间区间不能与已经存在的时间段交叉", 2);
|
| | | } else {
|
| | | post('deviceAdjustValue/insertOneDeviceAdjustValue', {
|
| | | mac: this.caliRecord.mac,
|
| | | startTime: this.startTimeString === '' ? '00:00:00' : this.startTimeString,
|
| | | endTime: this.endTimeString === '' ? '23:59:00' : this.endTimeString,
|
| | | value: this.addData.cel,
|
| | | sensorCode: this.sensorCode
|
| | | }
|
| | | ).then((res: any) => {
|
| | | post("deviceAdjustValue/insertOneDeviceAdjustValue", {
|
| | | mac: this.caliRecord.mac,
|
| | | startTime:
|
| | | this.startTimeString === "" ? "00:00:00" : this.startTimeString,
|
| | | endTime:
|
| | | this.endTimeString === "" ? "23:59:00" : this.endTimeString,
|
| | | value: this.addData.cel,
|
| | | sensorCode: this.sensorCode,
|
| | | }).then((res: any) => {
|
| | | if (res.data.code === 0) {
|
| | | this.addData.val1 = ''
|
| | | this.addData.val2 = ''
|
| | | this.addData.formula1 = '+'
|
| | | this.addData.formula2 = '+'
|
| | | this.addData.type1 = 'aqi'
|
| | | this.getSersorFomule()
|
| | | this.$message.success(res.data.message)
|
| | | this.startTimeString = ''
|
| | | this.endTimeString = ''
|
| | | this.addData.startTime = moment('00:00:00', 'HH:mm:ss')
|
| | | this.addData.endTime = moment('23:59:59', 'HH:mm:ss')
|
| | | this.addData.cel = ''
|
| | | this.addFlag = false
|
| | | this.getTimeArea()
|
| | | this.addData.val1 = "";
|
| | | this.addData.val2 = "";
|
| | | this.addData.formula1 = "+";
|
| | | this.addData.formula2 = "+";
|
| | | this.addData.type1 = "aqi";
|
| | | this.getSersorFomule();
|
| | | this.$message.success(res.data.message);
|
| | | this.startTimeString = "";
|
| | | this.endTimeString = "";
|
| | | this.addData.startTime = moment("00:00:00", "HH:mm:ss");
|
| | | this.addData.endTime = moment("23:59:59", "HH:mm:ss");
|
| | | this.addData.cel = "";
|
| | | this.addFlag = false;
|
| | | this.getTimeArea();
|
| | | } else {
|
| | | this.$message.warning(res.data.message)
|
| | | this.$message.warning(res.data.message);
|
| | | }
|
| | | })
|
| | | });
|
| | | }
|
| | | }
|
| | | })
|
| | |
|
| | |
|
| | | });
|
| | | }
|
| | | private handleAddCancel() {
|
| | | this.addData.startTime = moment('00:00:00', 'HH:mm:ss')
|
| | | this.addData.endTime = moment('23:59:59', 'HH:mm:ss')
|
| | | this.addData.val1 = ''
|
| | | this.addData.val2 = ''
|
| | | this.addData.formula1 = '+'
|
| | | this.addData.formula2 = '+'
|
| | | this.addData.type1 = 'aqi'
|
| | | this.addData.cel = ''
|
| | | this.startTimeString = ''
|
| | | this.endTimeString = ''
|
| | | this.addFlag = false
|
| | | this.addData.startTime = moment("00:00:00", "HH:mm:ss");
|
| | | this.addData.endTime = moment("23:59:59", "HH:mm:ss");
|
| | | this.addData.val1 = "";
|
| | | this.addData.val2 = "";
|
| | | this.addData.formula1 = "+";
|
| | | this.addData.formula2 = "+";
|
| | | this.addData.type1 = "aqi";
|
| | | this.addData.cel = "";
|
| | | this.startTimeString = "";
|
| | | this.endTimeString = "";
|
| | | this.addFlag = false;
|
| | | }
|
| | | // 编辑------------------------------------------------------------------------------------------------
|
| | | private editData: any = {
|
| | | startTime: null,
|
| | | endTime: null,
|
| | | type1: 'aqi',
|
| | | formula1: '+',
|
| | | formula2: '+',
|
| | | val1: '',
|
| | | val2: '',
|
| | | cel: ''
|
| | | }
|
| | | private editFlag: boolean = false
|
| | | private editRecord: any = null
|
| | | type1: "aqi",
|
| | | formula1: "+",
|
| | | formula2: "+",
|
| | | val1: "",
|
| | | val2: "",
|
| | | cel: "",
|
| | | };
|
| | | private editFlag: boolean = false;
|
| | | private editRecord: any = null;
|
| | |
|
| | | // 编辑保存
|
| | | private handleEditlOk() {
|
| | | this.$refs.editCaliForm.validate((valid: any) => {
|
| | | if (valid) {
|
| | | let flag = this.judgeTime(this.editData.startTime, this.editData.endTime)
|
| | | let flag = this.judgeTime(
|
| | | this.editData.startTime,
|
| | | this.editData.endTime
|
| | | );
|
| | | if (flag.indexOf(true) !== -1) {
|
| | | this.$message.warning('编辑时间区间不能与已经存在的时间段交叉', 2)
|
| | | this.$message.warning("编辑时间区间不能与已经存在的时间段交叉", 2);
|
| | | } else {
|
| | | let startTime = this.startTimeString === this.editRecord.startTime ? null : this.startTimeString === '' ? null : this.startTimeString
|
| | | let endTime = this.endTimeString === this.editRecord.endTime ? null : this.endTimeString === '' ? null : this.endTimeString
|
| | | let fomule = this.editData.cel === this.editRecord.value ? null : this.editData.cel
|
| | | if ((startTime || endTime || fomule)) {
|
| | | post('deviceAdjustValue/updateOneDeviceAdjustValue', {
|
| | | id: this.editRecord.id,
|
| | | start_time: startTime,
|
| | | end_time: endTime,
|
| | | value: fomule
|
| | | }
|
| | | ).then((res: any) => {
|
| | | let startTime =
|
| | | this.startTimeString === this.editRecord.startTime
|
| | | ? null
|
| | | : this.startTimeString === ""
|
| | | ? null
|
| | | : this.startTimeString;
|
| | | let endTime =
|
| | | this.endTimeString === this.editRecord.endTime
|
| | | ? null
|
| | | : this.endTimeString === ""
|
| | | ? null
|
| | | : this.endTimeString;
|
| | | let fomule =
|
| | | this.editData.cel === this.editRecord.value
|
| | | ? null
|
| | | : this.editData.cel;
|
| | | if (startTime || endTime || fomule) {
|
| | | post("deviceAdjustValue/updateOneDeviceAdjustValue", {
|
| | | id: this.editRecord.id,
|
| | | start_time: startTime,
|
| | | end_time: endTime,
|
| | | value: fomule,
|
| | | }).then((res: any) => {
|
| | | if (res.data.code === 0) {
|
| | | this.getSersorFomule()
|
| | | this.$message.success(res.data.message)
|
| | | this.editFlag = false
|
| | | this.startTimeString = ''
|
| | | this.endTimeString = ''
|
| | | this.editRecord = null
|
| | | this.editData.val1 = ''
|
| | | this.editData.val2 = ''
|
| | | this.editData.formula1 = '+'
|
| | | this.editData.formula2 = '+'
|
| | | this.getTimeArea()
|
| | | this.getSersorFomule();
|
| | | this.$message.success(res.data.message);
|
| | | this.editFlag = false;
|
| | | this.startTimeString = "";
|
| | | this.endTimeString = "";
|
| | | this.editRecord = null;
|
| | | this.editData.val1 = "";
|
| | | this.editData.val2 = "";
|
| | | this.editData.formula1 = "+";
|
| | | this.editData.formula2 = "+";
|
| | | this.getTimeArea();
|
| | | }
|
| | | })
|
| | | });
|
| | | } else {
|
| | | this.$message.warning('未修改')
|
| | | this.$message.warning("未修改");
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | | })
|
| | | });
|
| | | }
|
| | |
|
| | | private handleEditCancel() {
|
| | | this.editFlag = false
|
| | | this.editFlag = false;
|
| | | }
|
| | |
|
| | | private handleEditModalVisible(flag: boolean, record: any) {
|
| | | this.editFlag = flag
|
| | | this.editRecord = record
|
| | | this.editData.startTime = moment(record.startTime, 'HH:mm:ss')
|
| | | this.editData.endTime = moment(record.endTime, 'HH:mm:ss')
|
| | | this.editData.cel = record.value
|
| | | this.editFlag = flag;
|
| | | this.editRecord = record;
|
| | | this.editData.startTime = moment(record.startTime, "HH:mm:ss");
|
| | | this.editData.endTime = moment(record.endTime, "HH:mm:ss");
|
| | | this.editData.cel = record.value;
|
| | | }
|
| | |
|
| | | // 删除------------------------------------------------------------------------------------------------
|
| | | private deleteDevice(record: any) {
|
| | | post('deviceAdjustValue/deleteOneDeviceAdjustValue', {
|
| | | id: record.id,
|
| | | }
|
| | | ).then((res: any) => {
|
| | | post("deviceAdjustValue/deleteOneDeviceAdjustValue", {
|
| | | id: record.id,
|
| | | }).then((res: any) => {
|
| | | if (res.data.code === 0) {
|
| | | this.getSersorFomule()
|
| | | this.getTimeArea()
|
| | | this.$message.success(res.data.message)
|
| | | this.getSersorFomule();
|
| | | this.getTimeArea();
|
| | | this.$message.success(res.data.message);
|
| | | }
|
| | | })
|
| | | });
|
| | | }
|
| | |
|
| | | // 操作===============================================================================================
|
| | | private opRender(text: string, record: any, index: number) {
|
| | | return (
|
| | | <div>
|
| | | <a onClick={() => this.handleEditModalVisible(true, record)}>
|
| | | {" "}
|
| | | 编辑{" "}
|
| | | </a>
|
| | | <a-divider type="vertical"/>
|
| | | <a-popconfirm
|
| | | title="确认删除吗?"
|
| | | ok-text="确定"
|
| | | cancel-text="取消"
|
| | | onConfirm={() => this.deleteDevice(record)}
|
| | | >
|
| | | <a href="#">删除</a>
|
| | | </a-popconfirm>
|
| | | </div>
|
| | | )
|
| | | ;
|
| | | <div>
|
| | | <a onClick={() => this.handleEditModalVisible(true, record)}> 编辑 </a>
|
| | | <a-divider type="vertical" />
|
| | | <a-popconfirm
|
| | | title="确认删除吗?"
|
| | | ok-text="确定"
|
| | | cancel-text="取消"
|
| | | onConfirm={() => this.deleteDevice(record)}
|
| | | >
|
| | | <a href="#">删除</a>
|
| | | </a-popconfirm>
|
| | | </div>
|
| | | );
|
| | | }
|
| | | }
|
| | | </script>
|