| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909 |
- <template>
- <div class="content">
- <div class="tabs">
- <ul>
- <li v-for="(tab,i) in tabs" @click="goTab(tab.url)" :class="{'active':tabIndex == i}">
- {{tab.name}}
- </li>
- </ul>
- </div>
- <div class="panel">
- <div class="panel-body">
- <div class=" panel_control">
- <div class="pline">
- <em>扫描区域:</em>
- <el-select v-model="panel.regionid">
- <el-option
- v-for="item in panel.regionidOptions"
- :key="item.Id"
- :label="item.Name"
- :value="item.Id">
- </el-option>
- </el-select>
- </div>
- <div class="pline">
- <em>扫描策略:</em>
- <el-select v-model="panel.scanStrategyId">
- <el-option
- v-for="item in panel.scanStrategyIdOptions"
- :key="item.Id"
- :label="item.Name"
- :value="item.Id">
- </el-option>
- </el-select>
- </div>
- <div class="pline">
- <el-button size="medium" type="primary" @click="query">查询</el-button>
- </div>
- <div class="pline pull-right">
- <el-button size="medium" type="primary" @click="addList">添加</el-button>
- <el-button size="medium" type="primary" @click="editList">修改</el-button>
- <el-button size="medium" type="primary" @click="delList">删除</el-button>
- </div>
- </div>
- </div>
- </div>
- <el-table
- :data="tableData"
- is-horizontal-resize
- :default-sort="{prop: 'date', order: 'descending'}"
- v-loading="loading"
- element-loading-background="rgba(0, 0, 0, 0.8)"
- class=""
- @selection-change="handleSelectionChange"
- stripe
- ref="multipleTable"
- @row-click="handle"
- >
- <el-table-column
- type="selection"
- width="55">
- </el-table-column>
- <el-table-column
- type="index"
- label="序号"
- width="60"
- sortable
- >
- </el-table-column>
- <el-table-column
- prop="RegionName"
- label="区域名称"
- sortable
- >
- </el-table-column>
- <el-table-column
- prop="Begin"
- label="开始时间"
- :formatter="filterTime"
- sortable
- >
- </el-table-column>
- <el-table-column
- prop="Duration"
- label="持续时间(秒)"
- sortable
- >
- </el-table-column>
- <el-table-column
- prop="InterDays"
- label="间隔天数"
- sortable
- >
- </el-table-column>
- <el-table-column
- prop="ExecCount"
- label="已执行次数"
- sortable
- >
- </el-table-column>
- <el-table-column
- prop="ScanStrategyName"
- label="扫描策略"
- sortable
- >
- </el-table-column>
- <el-table-column
- prop="UserName"
- label="创建者"
- sortable
- >
- </el-table-column>
- <el-table-column
- prop="CreateAt"
- label="创建时间"
- :formatter="filterTime"
- sortable
- >
- </el-table-column>
- </el-table>
- <br>
- <el-pagination
- background
- :total="pageination.total"
- :page-size="pageination.pageItem"
- @current-change="pageChange"
- ></el-pagination>
- <!--<el-button class="down_btn" type="primary" @click="goPoster(scope.row)">下载驱动器todo</el-button>-->
- <dialog_referrer_list
- :show="dialog_state"
- :title="dialog_title"
- :large="true"
- @dialog_cancel="dialog_cancel"
- @dialog_ok="dialog_ok"
- >
- <div class="dialogContent">
- <el-row :gutter="24">
- <el-col :span="12">
- <label>
- *区域
- </label>
- <el-select v-model="dialog.regionid">
- <el-option
- v-for="item in dialog.regionidOptions"
- :key="item.Id"
- :label="item.Name"
- :value="item.Id">
- </el-option>
- </el-select>
- </el-col>
- <el-col :span="12">
- <label>
- *扫描策略
- </label>
- <el-select v-model="dialog.scanStrategyId">
- <el-option
- v-for="item in dialog.scanStrategyIdOptions"
- :key="item.Id"
- :label="item.Name"
- :value="item.Id">
- </el-option>
- </el-select>
- </el-col>
- <el-col :span="12">
- <label>
- *开始时间
- </label>
- <el-date-picker
- v-model="dialog.bt"
- type="date"
- placeholder="选择日期">
- </el-date-picker>
- </el-col>
- <el-col :span="12">
- <label>
- *扫描时间
- </label>
- <el-input v-model="dialog.duration" type="number"></el-input>
- </el-col>
- <el-col :span="12">
- <label>
- *间隔天数
- </label>
- <el-input v-model="dialog.interDays" type="number" placeholder="0为单次扫描"></el-input>
- </el-col>
- <el-col :span="12">
- <label>
- *备注
- </label>
- <el-input v-model="dialog.memo" type="text"></el-input>
- </el-col>
- </el-row>
- </div>
- </dialog_referrer_list>
- </div>
- </template>
- <script>
- import Global from '../Global.js'
- import dialog_referrer_list from '../components/dialog_referrer_list'
- import {
- DetectorAdd,
- RegionList,
- DetectorEdit,
- ScheduledTaskList,
- ScanStrategyListDetail,
- ScheduledTaskAdd,
- ScheduledTaskDel,
- ScheduledTaskEdit,
- } from '../api/getApiRes.js'
- let qs = require('qs');
- export default {
- data() {
- return {
- // dialog
- dialog_state: false,
- dialog_title: '',
- dialog_type: '',//类型,1是添加,2是修改
- dialog: {
- id : '',
- mac: '',
- regionid: '',
- scanStrategyId: '',
- bt: globalBt3(0)[0],
- duration: 0,
- interDays: 0,
- memo: '',
- regionidOptions: [],
- scanStrategyIdOptions: [],
- },
- tabIndex: 0,
- tabs: [
- {name: '任务计划管理', url: 'plan'},
- ],
- // panel 配置项目
- panel: {
- scanStrategyId: '',
- usercode: '',
- username: '',
- compname: '',
- keyword: '',
- USERCODE: '',
- taskstatus: 99,
- regionid: "",
- regionid2: '',
- regionidOptions: [],
- scanStrategyIdOptions: [],
- options: [
- {value: 99, label: '全部'},
- {value: 1, label: '进行中'},
- {value: 2, label: '已完成'},
- ],
- time1: globalBt3(2),
- },
- pageination: {
- pageItem: 100,
- pageoptions: pageOptions(),
- total: 500,
- pageIndex: 1,
- },
- draw: 1,
- start: 0,
- recordsTotal: 0,
- tableData: [],
- allTableData: [],
- limit: '10',
- multipleSort: false,
- loading: true,
- fileList: [],
- multipleSelection: [],
- detectedmac: '',
- }
- },
- mounted() {
- this.getTableQuery();
- },
- methods: {
- handle(row, column, event) {
- this.$refs.multipleTable.toggleRowSelection(row);
- },
- // 页面数据查询
- getTableQuery() {
- let that = this;
- this.getGeFullRegionSelect();
- this.getGeFullScanStrategySelect();
- that.loading = true;
- let param = {
- token: localStorage.token,
- scanStrategyId: this.panel.scanStrategyId,//
- regionId: that.panel.regionid,//
- };
- let postdata = qs.stringify(param);
- ScheduledTaskList(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.loading = false;
- if (json.Rs) {
- that.allTableData = json.Rs;
- that.recordsTotal = json.Rs.length;
- } else {
- that.allTableData = [];
- that.recordsTotal = 0;
- }
- // 设置分页数据
- that.setPaginations();
- } else {
- that.$message.error(json.Memo + ',错误代码:' + json.Code);
- }
- })
- },
- // 获取扫描区域列表
- getGeFullRegionSelect() {
- let that = this;
- let param = {
- token: localStorage.token,
- };
- let postdata = qs.stringify(param);
- RegionList(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- if (!json.Rs) {
- that.$message.error('区域列表为空,请先添加有效区域');
- return false
- }
- that.panel.regionidOptions = json.Rs;
- that.dialog.regionidOptions = json.Rs;
- that.panel.regionidOptions.unshift({Id: "", Name: "全部", DisplayName: "全部"});
- that.dialog.regionidOptions.shift();
- } else {
- that.$message.error(json.Memo + ',错误代码:' + json.Code);
- }
- })
- },
- // 获取扫描策略下拉列表
- getGeFullScanStrategySelect() {
- let that = this;
- let param = {
- token: localStorage.token,
- };
- let postdata = qs.stringify(param);
- ScanStrategyListDetail(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- if (!json.Rs) {
- that.$message.error('区域列表为空,请先添加有效区域');
- return false
- }
- that.panel.scanStrategyIdOptions = json.Rs;
- that.dialog.scanStrategyIdOptions = json.Rs;
- that.panel.scanStrategyIdOptions.unshift({Id: "", Name: "全部", DisplayName: "全部"});
- that.dialog.scanStrategyIdOptions.shift();
- } else {
- that.$message.error(json.Memo + ',错误代码:' + json.Code);
- }
- })
- },
- // dialog获取下级列表
- dialoggetGeFullRegionSelect() {
- let that = this;
- let param = {
- token: localStorage.token,
- };
- let postdata = qs.stringify(param);
- RegionList(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.dialog.regionlevelOneIdOptions = json.Rs;
- that.dialog.regionId = json.Rs[0].Id;
- } else {
- that.$message.error(json.Memo + ',错误代码:' + json.Code);
- }
- })
- },
- // 跳转tab页面
- goTab(url) {
- this.$router.push({path: url});
- },
- // 查询按钮
- query() {
- this.getTableQuery();
- this.$message.success('查询完毕');
- },
- handleSelectionChange(val) {
- this.multipleSelection = val;
- },
- // 设置分页数据
- setPaginations() {
- // 分页属性
- let that = this;
- that.pageination.total = that.recordsTotal;
- // 默认分页
- that.tableData = that.allTableData.filter((item, index) => {
- return index < that.pageination.pageItem;
- });
- },
- // 每页显示数量
- handleSizeChange() {
- let that = this;
- that.tableData = that.allTableData.filter((item, index) => {
- return index < that.pageination.pageItem;
- });
- that.draw = that.pageination.pageItem;
- // that.getTableQuery();
- },
- // 翻页
- pageChange(pageIndex) {
- let that = this;
- // 获取当前页
- let index = that.pageination.pageItem * (pageIndex - 1);
- // 数据总数
- let nums = that.pageination.pageItem * pageIndex;
- // 容器
- let tables = [];
- for (var i = index; i < nums; i++) {
- if (that.allTableData[i]) {
- tables.push(that.allTableData[i])
- }
- this.tableData = tables;
- }
- that.start = index * that.draw;
- // that.getTableQuery();
- },
- // 自动排序
- sortChange(params) {
- console.log(params)
- },
- // 过滤时间
- filterFmtDate(value, row, column) {
- return globalfmtDate(column, 11);
- },
- addList() {
- this.dialog_state = true;
- this.dialog_title = '添加任务计划';
- this.dialog_type = 1;
- // 重载地区列表
- this.getGeFullRegionSelect();
- this.getGeFullScanStrategySelect();
- // clear dialog
- this.dialog.regionid = '';
- this.dialog.scanStrategyId = '';
- this.dialog.bt = globalBt3(0)[0];
- this.dialog.duration = 0;
- this.dialog.interDays = 0;
- this.dialog.memo = '';
- },
- delList() {
- let that = this;
- // checkNum
- if (!this.multipleSelection.length) {
- that.$message({
- showClose: true,
- message: '错了哦,需要先选中至少一条记录',
- type: 'error'
- });
- return false
- }
- let detectorid = that.multipleSelection[0].Id;
- let param = {
- token: localStorage.token,
- id: detectorid,
- };
- let postdata = qs.stringify(param);
- this.$confirm('此操作将永久删除该任务计划, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- ScheduledTaskDel(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.$message({
- showClose: true,
- message: '选中的任务计划已删除!',
- type: 'success'
- });
- // 重载列表
- that.getTableQuery();
- that.dialog_state = false;
- } else {
- that.$message.error(json.Memo + ',错误代码:' + json.Code);
- }
- });
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消删除'
- });
- });
- },
- editList() {
- let that = this;
- // checkNum
- if (!this.multipleSelection.length) {
- this.$message({
- showClose: true,
- message: '错了哦,需要先选中一条记录',
- type: 'error'
- });
- return false
- }
- if (this.multipleSelection.length > 1) {
- this.$message({
- showClose: true,
- message: '错了哦,只能选中一条记录',
- type: 'error'
- });
- return false
- }
- this.dialog_state = true;
- this.dialog_title = '修改任务计划信息';
- this.dialog_type = 2;
- // 读取本条记录
- let row = this.multipleSelection[0];
- 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();
- },
- // 探测记录
- goPhoneRecord(row) {
- this.$router.push({
- path: '/phoneSign',
- query:
- {
- detectorid: row.Id,
- comId: 1,
- regionId: row.RegionId,
- }
- });
- },
- // 探测记录
- goWifiRecord(row) {
- this.$router.push({
- path: '/wifiSign',
- query:
- {
- detectorid: row.Id,
- comId: 1,
- regionId: row.RegionId,
- }
- });
- },
- dialog_cancel() {
- let that = this;
- that.dialog_state = false;
- },
- dialog_ok() {
- if (this.dialog_type == 1) {
- this.confirmAddEquip();
- } else {
- this.confirmEditEquip();
- }
- },
- // 提交增加新任务计划
- confirmAddEquip() {
- let that = this;
- // checkVal
- if (!that.dialog.regionid) {
- this.$message.error('错了哦,区域不能为空');
- return false
- }
- if (!that.dialog.scanStrategyId) {
- this.$message.error('错了哦,扫描策略不能为空');
- return false
- }
- if (!that.dialog.bt) {
- this.$message.error('错了哦,开始时间不能为空');
- return false
- }
- if (!that.dialog.duration) {
- this.$message.error('错了哦,扫描时间不能为空');
- return false
- }
- if (that.dialog.duration.length > 86400) {
- this.$message.error('错了哦,扫描时间不能超过86400秒(24小时)');
- return false
- }
- if (that.dialog.interDays < 0) {
- this.$message.error('错了哦,间隔天数不能小于0');
- return false
- }
- if (that.dialog.memo) {
- if (that.dialog.memo.length > 200) {
- this.$message.error('错了哦,备注不能超过200字');
- return false
- }
- }
- let param = {
- token: localStorage.token,
- 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,
- };
- let postdata = qs.stringify(param);
- ScheduledTaskAdd(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.$message({
- showClose: true,
- message: '任务计划添加成功!',
- type: 'success'
- });
- // 重载列表
- that.getTableQuery();
- that.dialog_state = false;
- } else {
- that.$message.error(json.Memo + ',错误代码:' + json.Code);
- }
- });
- },
- // 提交修改任务计划信息
- confirmEditEquip() {
- let that = this;
- if (!that.dialog.regionid) {
- this.$message.error('错了哦,区域不能为空');
- return false
- }
- if (!that.dialog.scanStrategyId) {
- this.$message.error('错了哦,扫描策略不能为空');
- return false
- }
- if (!that.dialog.bt) {
- this.$message.error('错了哦,开始时间不能为空');
- return false
- }
- if (!that.dialog.duration) {
- this.$message.error('错了哦,扫描时间不能为空');
- return false
- }
- if (that.dialog.duration.length > 86400) {
- this.$message.error('错了哦,扫描时间不能超过86400秒(24小时)');
- return false
- }
- if (that.dialog.interDays < 0) {
- this.$message.error('错了哦,间隔天数不能小于0');
- return false
- }
- if (that.dialog.memo) {
- if (that.dialog.memo.length > 200) {
- this.$message.error('错了哦,备注不能超过200字');
- return false
- }
- }
- let param = {
- token: localStorage.token,
- 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,
- };
- let postdata = qs.stringify(param);
- ScheduledTaskEdit(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.$message({
- showClose: true,
- message: '任务计划添加成功!',
- type: 'success'
- });
- // 重载列表
- that.getTableQuery();
- that.dialog_state = false;
- } else {
- that.$message.error(json.Memo + ',错误代码:' + json.Code);
- }
- });
- },
- // 修改任务计划状态
- getDetectorEditStatus(detectorid, status, text) {
- let that = this;
- let param = {
- token: localStorage.token,
- detectorid: detectorid,
- status: status,
- };
- let postdata = qs.stringify(param);
- DetectorEditStatus(postdata).then(res => {
- let json = res;
- if (json.Code == 0) {
- that.$message({
- showClose: true,
- message: text + '成功!',
- type: 'success'
- });
- // table 重载
- that.getTableQuery();
- } else {
- that.$message.error(json.Memo + ',错误代码:' + json.Code);
- }
- })
- },
- // 禁用
- pauseRow(row) {
- let that = this;
- this.$confirm('是否禁用' + row.TagName + '任务计划?', '禁用操作', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- that.getDetectorEditStatus(row.Id, 0, '禁用');
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消禁用'
- });
- });
- },
- // 获取区域位置的平面图
- getRegionPictureGetByRegionId(regionID) {
- let that = this;
- let param = {
- token: localStorage.token,
- regionID: regionID,
- regionId: regionID,
- };
- let postdata = qs.stringify(param);
- that.dialog.plateImgSrc = '../assets/img/main/grid.png'
- // RegionPictureGetByRegionId(postdata).then(res => {
- // let json = res;
- // that.dialog.plateImgSrc = '';
- // if (json.Code == 0) {
- // that.dialog.plateImgSrc = json.EncodeString;
- // } else {
- // that.$message.error(json.Memo + ',错误代码:' + json.Code);
- // }
- // })
- },
- // 启用
- runRow(row) {
- console.log(row);
- let that = this;
- this.$confirm('是否启用' + row.TagName + '任务计划?', '启用操作', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- that.getDetectorEditStatus(row.Id, 1, '启用');
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消启用'
- });
- });
- },
- // 添加探测器位置的点坐标
- addPoint(e) {
- let x = e.offsetX;
- let y = e.offsetY;
- this.dialog.points = [{x: x, y: y}];
- },
- // 获取位置的文字内容
- selectRegionLabel(id) {
- let that = this;
- let selectedWorkName = {};
- // selectedWorkName = that.dialog.regionIdRoomOptions.filter(item => {
- selectedWorkName = that.dialog.regionlevelOneIdOptions.filter(item => {
- if (item.Id === id) {
- console.log(item.Name);
- that.dialog.location = item.Name;
- }
- });
- },
- filterTime(val, row, column) {
- return nonTfmtDate(column, 11);
- }
- },
- watch: {
- 'dialog.regionId': function (val) {
- if (val) {
- this.getRegionPictureGetByRegionId(val);
- }
- },
- },
- components: {
- dialog_referrer_list
- }
- }
- </script>
- <style scoped>
- @import "../assets/css/panel.css";
- @import "../assets/css/dialog.css";
- .tabs ul {
- width: 168px;
- float: left;
- }
- table span {
- cursor: pointer;
- }
- .down_btn {
- float: left;
- }
- .content {
- width: 98%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- padding-left: 20px;
- }
- .selectStyle {
- width: 100%;
- color: #005EA2;
- }
- .selectStyle ::placeholder {
- color: #005EA2;
- }
- /deep/ .modal .el-select .el-input .el-select__caret {
- position: relative;
- top: 35px;
- }
- .imgContianer {
- width: 100%;
- height: 340px;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- }
- .imgContianer img {
- width: 100%;
- height: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- }
- .pointers {
- position: relative;
- bottom: 340px;
- width: 100%;
- height: 100%;
- overflow: hidden;
- display: block;
- margin: 0 auto;
- }
- .imgContianer i {
- position: relative;
- width: 10px;
- height: 10px;
- float: left;
- border-radius: 250px;
- background: #FFDD00;
- }
- /deep/ .modal-dialog {
- height: 80px;
- margin-top: 20px;
- }
- /deep/ textarea {
- color: #6DC1FF;
- }
- /deep/ .el-table__empty-text {
- color: #015B9E;
- }
- /deep/ .el-input.is-disabled .el-input__inner {
- background-color: #015B9E;
- }
- .red {
- color: red;
- }
- .yellow {
- color: #fd0;
- }
- /deep/ .modal-dialog .el-select {
- width: 100%;
- }
- /deep/ .modal-dialog .el-date-editor {
- width: 100%;
- }
- </style>
|