Changpeng Duan 4 anni fa
parent
commit
bd14408699
2 ha cambiato i file con 61 aggiunte e 97 eliminazioni
  1. 9 0
      README.md
  2. 52 97
      src/views/plan.vue

+ 9 - 0
README.md

@@ -5,6 +5,15 @@
 
 ## todo
 
+01/30
+todo
+
+/ScheduledTask/Edit
+接口效果不是编辑,而是直接添加了
+
+
+
+
 1.监控区域查询,没有宽高返回值
 2.监控区域删除接口
 3.无线设备

+ 52 - 97
src/views/plan.vue

@@ -206,6 +206,8 @@
         ScheduledTaskList,
         ScanStrategyListDetail,
         ScheduledTaskAdd,
+        ScheduledTaskDel,
+        ScheduledTaskEdit,
     } from '../api/getApiRes.js'
 
     let qs = require('qs');
@@ -217,6 +219,7 @@
                 dialog_title: '',
                 dialog_type: '',//类型,1是添加,2是修改
                 dialog: {
+                    id : '',
                     mac: '',
                     regionid: '',
                     scanStrategyId: '',
@@ -458,22 +461,21 @@
 
                 let param = {
                     token: localStorage.token,
-                    detectorid: detectorid,
-                    status: 9,//0禁用1启用9删除
+                    id: detectorid,
                 };
                 let postdata = qs.stringify(param);
 
-                this.$confirm('此操作将永久删除该设备, 是否继续?', '提示', {
+                this.$confirm('此操作将永久删除该任务计划, 是否继续?', '提示', {
                     confirmButtonText: '确定',
                     cancelButtonText: '取消',
                     type: 'warning'
                 }).then(() => {
-                    DetectorEditStatus(postdata).then(res => {
+                    ScheduledTaskDel(postdata).then(res => {
                         let json = res;
                         if (json.Code == 0) {
                             that.$message({
                                 showClose: true,
-                                message: '选中的设备已删除!',
+                                message: '选中的任务计划已删除!',
                                 type: 'success'
                             });
                             // 重载列表
@@ -510,63 +512,22 @@
                     return false
                 }
                 this.dialog_state = true;
-                this.dialog_title = '修改设备信息';
+                this.dialog_title = '修改任务计划信息';
                 this.dialog_type = 2;
 
                 // 读取本条记录
                 let row = this.multipleSelection[0];
-                this.dialog.eqId = row.Id;
-                this.dialog.mac = row.Mac;
-                this.dialog.regionId = row.RegionId;
-                this.dialog.tagname = row.TagName;
-                this.dialog.HardwareVersion = row.HardwareVersion;
-                this.dialog.FirmwareVersion = row.FirmwareVersion;
-                this.dialog.FirmwareScanM4Version = row.FirmwareScanM4Version;
-                this.dialog.FirmwareScanM0Version = row.FirmwareScanM0Version;
-                this.dialog.location = row.Location;
-                this.dialog.purchasesrc = row.PurchaseSrc;
-                this.dialog.memo = row.Memo;
-                this.dialog.regionlevelOneId = row.RegionId;
-                this.dialog.status = row.Status;
-                // this.dialog.coords_memo = row.coords_memo;
+                this.dialog.id  = row.Id ;
+                this.dialog.regionid = row.RegionId;
+                this.dialog.scanStrategyId = row.ScanStrategyId;
+                this.dialog.bt = filterTimeToString(row.Begin, 11);
+                this.dialog.duration = row.Duration;
+                this.dialog.interDays = row.InterDays;
 
                 // 重载地区列表
                 this.getGeFullRegionSelect();
+                this.getGeFullScanStrategySelect();
 
-                that.dialog.points = [{x: row.X, y: row.Y}];
-
-                // let param = {
-                //     token: localStorage.token,
-                //     detectorId: row.Id,
-                // };
-                // let postdata = qs.stringify(param);
-                // GetDetectorCoords(postdata).then(res => {
-                //     let json = res;
-                //     if (json.Code == 0) {
-                //         if (json.Rs.length != 0) {
-                //             console.log(json.Rs[0]);
-                //             // that.dialog.points = [{x: json.Rs[0].X, y: json.Rs[0].Y}];
-                //             that.dialog.points = [{x: json.Rs.X, y: json.Rs.Y}];
-                //             // that.dialog.CoordsId = json.Rs[0].CoordsId;
-                //             // that.dialog.coords_memo = json.Rs[0].Memo;
-                //         } else {
-                //             that.dialog.points = [{x: 0, y: 0}];
-                //             that.dialog.CoordsId = 0;
-                //         }
-                //     } else {
-                //         that.$message.error(json.Memo + ',错误代码:' + json.Code);
-                //     }
-                // })
-            },
-            // 自动补全MAC
-            autoCompleteMac() {
-                let text = this.dialog.mac;
-                if (text.length == 2 || text.length == 5 || text.length == 8 || text.length == 11 || text.length == 14) {
-                    this.dialog.mac = this.dialog.mac.toUpperCase() + ":"
-                }
-                if (text.length > 14) {
-                    this.dialog.mac = this.dialog.mac.toUpperCase()
-                }
             },
             // 探测记录
             goPhoneRecord(row) {
@@ -603,7 +564,7 @@
                     this.confirmEditEquip();
                 }
             },
-            // 提交增加新设备
+            // 提交增加新任务计划
             confirmAddEquip() {
                 let that = this;
                 // checkVal
@@ -627,9 +588,8 @@
                     this.$message.error('错了哦,扫描时间不能超过86400秒(24小时)');
                     return false
                 }
-                console.log(that.dialog.interDays);
-                if (that.dialog.interDays == '') {
-                    this.$message.error('错了哦,间隔天数不能为空');
+                if (that.dialog.interDays < 0) {
+                    this.$message.error('错了哦,间隔天数不能小于0');
                     return false
                 }
 
@@ -639,12 +599,11 @@
                         return false
                     }
                 }
-                console.log(nonTfmtDate(that.dialog.bt,10));
                 let param = {
                     token: localStorage.token,
                     scanStrategyId: that.dialog.scanStrategyId,
                     regionId: that.dialog.regionid,
-                    bt: nonTfmtDate(that.dialog.bt,10),
+                    bt: parseInt(new Date(that.dialog.bt).getTime() / 1000),
                     duration: that.dialog.duration,
                     interDays: that.dialog.interDays,
                     memo: that.dialog.memo,
@@ -655,7 +614,7 @@
                     if (json.Code == 0) {
                         that.$message({
                             showClose: true,
-                            message: '设备添加成功!',
+                            message: '任务计划添加成功!',
                             type: 'success'
                         });
                         // 重载列表
@@ -667,61 +626,57 @@
                     }
                 });
             },
-            // 提交修改设备信息
+            // 提交修改任务计划信息
             confirmEditEquip() {
                 let that = this;
-                // checkVal
-                if (!that.dialog.mac) {
-                    this.$message.error('错了哦,mac不能为空');
+                if (!that.dialog.regionid) {
+                    this.$message.error('错了哦,区域不能为空');
                     return false
                 }
-                if (!checkMac(that.dialog.mac)) {
-                    this.$message.error('错了哦,mac格式不正确');
+                if (!that.dialog.scanStrategyId) {
+                    this.$message.error('错了哦,扫描策略不能为空');
                     return false
                 }
-
-                if (!that.dialog.regionId) {
-                    this.$message.error('错了哦,所属区域不能为空');
+                if (!that.dialog.bt) {
+                    this.$message.error('错了哦,开始时间不能为空');
                     return false
                 }
-                if (!that.dialog.tagname) {
-                    this.$message.error('错了哦,标签名不能为空');
+                if (!that.dialog.duration) {
+                    this.$message.error('错了哦,扫描时间不能为空');
                     return false
                 }
-                if (that.dialog.tagname.length > 20) {
-                    this.$message.error('错了哦,标签名不能超过20个字符');
+                if (that.dialog.duration.length > 86400) {
+                    this.$message.error('错了哦,扫描时间不能超过86400秒(24小时)');
+                    return false
+                }
+                if (that.dialog.interDays < 0) {
+                    this.$message.error('错了哦,间隔天数不能小于0');
                     return false
                 }
-                this.selectRegionLabel(that.dialog.regionId);
+                if (that.dialog.memo) {
+                    if (that.dialog.memo.length > 200) {
+                        this.$message.error('错了哦,备注不能超过200字');
+                        return false
+                    }
+                }
                 let param = {
                     token: localStorage.token,
-                    id: that.dialog.eqId,
-                    mac: that.dialog.mac,
-                    comId: 1,
-                    regionId: that.dialog.regionId,
-                    name: that.dialog.tagname,
-                    HardwareVersion: that.dialog.HardwareVersion,
-                    FirmwareVersion: that.dialog.FirmwareVersion,
-                    FirmwareScanM4Version: that.dialog.FirmwareScanM4Version,
-                    FirmwareScanM0Version: that.dialog.FirmwareScanM0Version,
-                    location: that.dialog.location,
-                    purchasesrc: that.dialog.purchasesrc,
-                    x: that.dialog.points[0].x,
-                    y: that.dialog.points[0].y,
-                    coords_memo: that.dialog.coords_memo,
+                    id: that.dialog.id,
+                    scanStrategyId: that.dialog.scanStrategyId,
+                    regionId: that.dialog.regionid,
+                    bt: parseInt(new Date(that.dialog.bt).getTime() / 1000),
+                    duration: that.dialog.duration,
+                    interDays: that.dialog.interDays,
                     memo: that.dialog.memo,
-                    coordsType: 1,//坐标状态 0:禁用, 1:启用, 9:删除,没有就传0
-                    coordsID: that.dialog.CoordsId,
-                    status: that.dialog.status,
                 };
 
                 let postdata = qs.stringify(param);
-                DetectorEdit(postdata).then(res => {
+                ScheduledTaskEdit(postdata).then(res => {
                     let json = res;
                     if (json.Code == 0) {
                         that.$message({
                             showClose: true,
-                            message: '设备添加成功!',
+                            message: '任务计划添加成功!',
                             type: 'success'
                         });
                         // 重载列表
@@ -733,7 +688,7 @@
                     }
                 });
             },
-            // 修改设备状态
+            // 修改任务计划状态
             getDetectorEditStatus(detectorid, status, text) {
                 let that = this;
                 let param = {
@@ -760,7 +715,7 @@
             // 禁用
             pauseRow(row) {
                 let that = this;
-                this.$confirm('是否禁用' + row.TagName + '设备?', '禁用操作', {
+                this.$confirm('是否禁用' + row.TagName + '任务计划?', '禁用操作', {
                     confirmButtonText: '确定',
                     cancelButtonText: '取消',
                     type: 'warning'
@@ -797,7 +752,7 @@
             runRow(row) {
                 console.log(row);
                 let that = this;
-                this.$confirm('是否启用' + row.TagName + '设备?', '启用操作', {
+                this.$confirm('是否启用' + row.TagName + '任务计划?', '启用操作', {
                     confirmButtonText: '确定',
                     cancelButtonText: '取消',
                     type: 'warning'