iot-test-task
Version:
测试包
1,313 lines (1,230 loc) • 319 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else {
var a = factory();
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
}
})(typeof self !== 'undefined' ? self : this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/dist/";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 3);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAkCAYAAAD7PHgWAAAAAXNSR0IArs4c6QAAAXFJREFUWAnNljFOw0AQRWcdUUByAbhDRMEByAEcEqXmGvS03IMaCRLJJeQAKSLfAS4AShHZy84qWOzszrr0dzdvXTy96pu715+rY0slyc/QV7UcryUuX76vm4KeJHd3XS0nD5KX68Osadp3ycmYbbW4mEVcgOJtMf4kJyM4kaVLlpd8s5rsHasld/eU5SXfzM8/WEZysvaW5SMuQMH3maGd4P48WrpJ8VFLzynuyt6n+KgwjynetDbJ///rBZErekE2Rq3YCaJW7ARRKwaCiBUDQcSKkSBaxUgQrWJSEKliUhCpoiqIUlEVRKmYFUSomBVEqNgrOHTFXkGuOOTXK+hXtVvXkaRb4b6ueDit6qnAfNanNR48+VXt1nUA+XArnNd4r6C2qrX9qK5qbYUrq/pvhWcFh67HIbOCQ9fLCiLUywoi1FMFUeqpgij1koJI9ZKCSPUiQbR6kSBavUAQsV4giFivE0St1wmi1vOCyPVY8BccNflXNQLMswAAAABJRU5ErkJggg=="
/***/ }),
/* 1 */
/***/ (function(module, exports) {
module.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAlCAYAAAAEGWqvAAAAAXNSR0IArs4c6QAABQxJREFUWAnFWF1oXEUUnjO7m4Tm7iZWJAmtiPRhk8aKkmL7oNBgVSgkWxu25kVoCFb6ZNUnUaRFpKKiFAX1RSr4UiOaH/ypraQtUij+oKlp1hClYmmiTWKzubtsY+4cz1zZ9e7dc/cv2d37sDvznXPmfGfuzJkzF0SJD55pv9VMij6BYrsQuAURtoDAzSiEr8ShilYHgKPBSOwIZwAc6MaQWJpjnVFEawAE7Ka+361TqX4+8tpnwQCSw1t3rII6LhB3VIqk17iFyOcNAMd3+c2l2eMU4iHEwoF6kSgXL4a8ZwB4uqvJTCaGaKk8VC6BtdgVS54NwN6kCXGOyHeuhUS5tqWQ1z6yNiNi1GeOTJykjJKXPG2cPwTAiAT5uQ9wpt6Qs9A9aZZCOj4cJjfZTz7yS7QXQagHQntjrzutsgJYHr30KgkfdCo420T8KvrkUcNoOQHdZ1edsrW285E3hzt2W2A9Q3tRxkfC06HIL6Npf5kstDzWvgstHE8Lcv4BRoOBpsdhz8V4jqwMwPkG8pFfHm3vUwqfyLgAoInzHW6KTM5oLPMGUIljGSVXg3L/W0bv1FPkKOe1u1RL7uYjHx/tGFRKRbMGpTMIhDVA2PMal/onMRLupTy/U7fdDzn4xIj0H642efwo6hOowm4+uo8CuxaGO7fqth2AEvCs7rgfIj1nCDwAcES5ZWvt55t5PTbsH7IgsOE1OoKSnC8/rPbbevhl50YztfoXrY2cWkYCHDAisQ+4AaqF/T3c8agU6knGn5XwGVGZuIl7OPJ69ht7t33IGFYVam5q+YLeApeifYYy75UKrYd5RnASYMjiZdVDKV2nfFKc4zzSxG+nVQJ3cELaHKc5vBYYKvkj5xcQNkuKoo0TUtTTHF4LzAfWr6xfwFsk5SQ2gPq2DVdYoxqAy0v1S5xbhbBRUqGcOY2zlBb+qcvq17DT0hBOce6JuJ/eAM5xwpRauY3Da4FdF5d5LiAWaRMLNgC1CvZJVwvCbp91AWuTG7P7SAFQhfcbJ7QUelalnH4lMSnFXdz4lIDmpQRxihMCXQ7wu64AJ6s2RkS7OZ90BPwklTRO0WbIqXXI6PbEtaRdb3DG1cL0RYb2aSvnD6R1UYZ6vp+nPHSBU0BUx3D8nmZO5sRu0IXD2V+vNr7XFQCwDvLjwUyoZ3rerkalkK9wSrQ/Npnx1DucLI1p8gCKrWbTOuX+m63moObgYT+mcTuAxsjUZ/QWvvVQ9OtPLJwsQ74Cn13iVIUqFHs5vwjiamhl2xktswOwG9L3HKVUWvr/PwDyXaO3/zHu/lsp8voiQ9fIg8iX0DY5Kf0n9H1BdzIBGD2Xv6YLo77U2w8F81IwMnWIu8xUivziSPjueN2lN+kOvC/Nw/0PEs6Heia/SeNZS6Oxqe0FMz63k4Qf08fUt9NKzv/1JK9nO1k/0WIpeZ+SeD+lbsr3WYvA6VpXPVeCwdY3hIhl8Jw6SK93bsloi/zkYTYzajENEA1Etpn45nDwML/ht+TTjX1TWX6KNS5A3sPlOsF0YP0uhf9FI/Lzn+4hiwrgvw9LlCqLny23n7L7RP6HYEPdy/DIRIIbpGAA+ZcNN+Q6YUB1Doj3jZ7YOAXhuTHyBlAb8rSXpPhqcaH10zsHzqYKTYdnAFUhr88dFAuUsq8JlNNC4fnQvlhJV9msNOqMNmCJSfrwOFh0jnAaF9FO3PSr60Isdu6fXClC3VPlXxvD2rLvjnCuAAAAAElFTkSuQmCC"
/***/ }),
/* 2 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vuedraggable__ = __webpack_require__(12);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vuedraggable___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_vuedraggable__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__myUtils__ = __webpack_require__(14);
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/* harmony default export */ __webpack_exports__["a"] = ({
name: 'helloName',
data() {
return {
searchName: '',
taskLoad: false,
// 任务库列表
taskRepository: [],
pageNo: 1,
total: 0,
pageSize: 48,
// 用于判断是新增还是编辑
isNewPtTask: true,
isNewXhTask: true,
ptTaskDetail: false,
xhTaskDetail: false,
// 控制项的下拉列表
sysList: [],
eqpList: [],
casProp: {
value: 'equipNo',
label: 'equipNm',
children: 'setInfos'
},
// 新增普通任务的表单
ptForm: {
tableId: '',
tableName: '',
comment: '',
procTaskSys: [{
time: new Date(1900, 1, 1, new Date().getHours(), new Date().getMinutes(), new Date().getSeconds()),
timeDur: new Date(1900, 1, 1, 0, 0, 5),
procCode: '',
cmdNm: ''
}],
procTaskEqp: []
},
ptRule: {
tableName: [{
type: 'string',
required: true,
message: '请输入任务名称'
}]
},
// 表格选中项
sysSelection: [],
eqpSelection: [],
// 循环任务表单
xhForm: {
tableId: '',
tableName: '',
comment: '',
cycleTask: { // 循环任务表单信息
beginTime: '1900-01-01 00:00:00', // 开始时间
endTime: '1900-01-01 00:00:00', // 结束时间
intervalTime: [new Date(2020, 1, 1, 0, 0, 0), new Date(2020, 1, 1, 23, 59, 59)], // 开始时间与结束时间
zhenDianDo: '0',
zhidingDo: '0',
implement: '1',
cycleMustFinish: '0', // 是否执行完整循环
zhidingTime: new Date(2020, 1, 1, 0, 0, 0), // 指定开始时间
isMaxCycle: false, // 最大循环次数
maxCycleNum: 0 // 最大循环次数
},
cycleTaskContent: []
},
xhRule: {
tableName: [{
type: 'string',
required: true,
message: '请输入任务名称'
}],
cycleTask: {
intervalTime: [{
type: 'array',
required: true,
message: '请输入执行时间'
}]
}
},
activeNames: [],
// 循环任务右侧新增项
xhSysForm: {
control: ''
},
xhEqpForm: {
control: [],
value: 0
},
xhTimeForm: {
day: undefined,
hour: undefined,
min: undefined,
second: undefined
},
// 用于储存表单设备控制值的diabled状态
cascaderPtArr: [],
cascaderXh: true
};
},
components: {
draggable: __WEBPACK_IMPORTED_MODULE_0_vuedraggable___default.a
},
computed: {
getTime() {
return function (val) {
let str = '';
val = Number(val);
str += Math.floor(val / (24 * 3600)) === 0 ? '' : Math.floor(val / (24 * 3600)) + 'd ';
str += Math.floor(val % (24 * 3600) / 3600) === 0 ? '' : Math.floor(val % (24 * 3600) / 3600) + 'h ';
str += Math.floor(val % 3600 / 60) === 0 ? '' : Math.floor(val % 3600 / 60) + 'm ';
str += Math.floor(val % 60) === 0 ? '' : Math.floor(val % 60) + 's';
return str;
};
},
dragOptions() {
return {
animation: 0,
group: 'description',
disabled: false,
ghostClass: 'originPosition',
dragClass: 'moveGhost',
chosenClass: 'originPosition'
};
}
},
mounted() {
this.getRepository();
this.evtSysControl();
this.GetEquipSetParmTreeList();
},
methods: {
// 获取任务库列表
getRepository() {
this.taskLoad = true;
this.$api.tkGetRepository({
pageSize: this.pageSize,
pageNo: this.pageNo,
searchName: this.searchName
}).then(res => {
let dat = res.data.data;
let code = res.data.code;
if (code !== 200) {
let msg = res.data.message;
this.$message({
type: 'error',
message: msg
});
return;
}
let list = JSON.parse(dat.list);
let target = '';
let obj = {};
this.total = dat.totalCount;
this.taskRepository = [];
for (let i = 0; i < list.length; i++) {
target = list[i];
obj = {};
obj.tableName = target.tableName;
obj.tableId = target.tableId;
obj.remark = target.remark === '' ? '-' : target.remark;
obj.tableType = target.tableType;
this.taskRepository.push(obj);
}
this.taskLoad = false;
}).catch(err => {
console.log(err);
this.taskLoad = false;
});
},
// 获取系统控制
evtSysControl() {
this.$api.evtSysControl().then(res => {
if (res.data.code === 200) {
this.sysList = res.data.data;
} else {
this.$message({
type: 'error',
message: res.data.message
});
}
}).catch(er => {
this.$message({
type: 'error',
message: '获取系统控制失败'
});
});
},
// 获取设备控制
GetEquipSetParmTreeList() {
this.$api.GetEquipSetParmTreeList().then(res => {
if (res.data.code === 200) {
let str = JSON.stringify(res.data.data.rows).replace(/setNm/g, 'equipNm');
str = str.replace(/setNo/g, 'equipNo');
this.eqpList = JSON.parse(str);
} else {
this.$message({
type: 'error',
message: res.data.message
});
}
}).catch(er => {
this.$message({
type: 'error',
message: '获取设备控制失败'
});
});
},
searchList: __WEBPACK_IMPORTED_MODULE_1__myUtils__["a" /* default */].debounce(function (item) {
this.getRepository();
}, 500),
currentChange(val) {
this.pageNo = val;
this.getRepository();
},
// 表格样式
cellStyle({ row, column, rowIndex, columnIndex }) {
if (columnIndex === 1) {
// 指定坐标
return 'color: transparent !important';
}
},
// 普通任务系统控制列表选中事件
sysSelectionChange(val) {
this.sysSelection = val;
},
// 普通任务设备控制列表选中事件
eqpSelectionChange(val) {
this.eqpSelection = val;
},
// 普通任务增加系统控制项
addPtTaskSys() {
this.ptForm.procTaskSys.push({
time: new Date(1900, 1, 1, new Date().getHours(), new Date().getMinutes(), new Date().getSeconds()),
timeDur: new Date(1900, 1, 1, 0, 0, 5),
procCode: '',
cmdNm: ''
});
},
// 普通任务删除系统控制项
deletePtTaskSys() {
if (this.sysSelection.length === 0) {
this.$message({
type: 'warning',
message: '请选择要移除的系统控制项'
});
return;
}
for (let i in this.sysSelection) {
for (let j in this.ptForm.procTaskSys) {
if (this.sysSelection[i].index === this.ptForm.procTaskSys[j].index) {
this.ptForm.procTaskSys.splice(j, 1);
}
}
}
},
// 普通任务增加设备控制项
addPtTaskEqp() {
this.ptForm.procTaskEqp.push({
time: new Date(1900, 1, 1, new Date().getHours(), new Date().getMinutes(), new Date().getSeconds()),
timeDur: new Date(1900, 1, 1, 0, 0, 5),
value: '',
equipSetNm: '',
equipSetValue: []
});
this.$set(this.cascaderPtArr, this.ptForm.procTaskEqp.length - 1, true);
},
// 普通任务删除设备控制项
deletePtTaskEqp() {
if (this.eqpSelection.length === 0) {
this.$message({
type: 'warning',
message: '请选择要移除的设备控制项'
});
return;
}
for (let i in this.eqpSelection) {
for (let j in this.ptForm.procTaskEqp) {
if (this.eqpSelection[i].index === this.ptForm.procTaskEqp[j].index) {
this.ptForm.procTaskEqp.splice(j, 1);
}
}
}
},
// 增加循环任务系统控制项
addSysItem() {
if (this.xhSysForm.control === '') {
this.$message({
type: 'warning',
message: '请先选择系统控制项'
});
return;
}
this.xhForm.cycleTaskContent.push({
type: 'S',
procCode: this.xhSysForm.control,
cmdNm: this.getCmdNm(this.xhSysForm.control)
});
this.xhSysForm.control = '';
},
// 增加循环任务设备控制项
addEqpItem() {
if (this.xhEqpForm.control.length === 0) {
this.$message({
type: 'warning',
message: '请先选择设备控制项'
});
return;
}
this.xhForm.cycleTaskContent.push({
type: 'E',
equipNo: this.xhEqpForm.control[0],
setNo: this.xhEqpForm.control[1],
value: String(this.xhEqpForm.value),
equipSetNm: `${this.$refs['xhCascader'].getCheckedNodes()[0].parent.label}-${this.$refs['xhCascader'].getCheckedNodes()[0].label}`
});
this.xhEqpForm = {
control: [],
value: 0
};
this.cascaderXh = true;
},
// 选择遥信时disabled为true
changePtCascader(ref) {
let boo = this.$refs[ref].getCheckedNodes()[0].data.setType !== 'V';
this.$set(this.cascaderPtArr, ref - 1, boo);
this.ptForm.procTaskEqp[ref - 1].value = boo ? 0 : this.ptForm.procTaskEqp[ref - 1].value;
},
changeXhCascader() {
let boo = this.$refs['xhCascader'].getCheckedNodes()[0].data.setType !== 'V';
this.cascaderXh = boo;
this.xhEqpForm.value = boo ? 0 : this.xhEqpForm.value;
},
isUndefined(val) {
let num = typeof val === 'undefined' ? 0 : Number(val);
return num;
},
// 增加循环任务时间间隔
addTimeItem() {
let totalSeconds = this.isUndefined(this.xhTimeForm.day) * 24 * 60 * 60 + this.isUndefined(this.xhTimeForm.hour) * 60 * 60 + this.isUndefined(this.xhTimeForm.min) * 60 + this.isUndefined(this.xhTimeForm.second);
if (totalSeconds === 0) {
this.$message({
type: 'warning',
message: '请先输入时间间隔'
});
return;
}
this.xhForm.cycleTaskContent.push({
type: 'T',
sleepTime: totalSeconds,
sleepUnit: 'S'
});
this.xhTimeForm = {
day: undefined,
hour: undefined,
min: undefined,
second: undefined
};
},
// 根据系统控制编号获取名称
getCmdNm(val) {
let cmdNm = '';
for (let item of this.sysList) {
if (item.procCode === val) {
cmdNm = item.procName;
}
}
return cmdNm;
},
// 编辑任务
showEdit(val, type) {
// 普通任务
if (type === 'T') {
this.$api.GetCommonTaskData({
tableId: val
}).then(res => {
if (res.data.code === 200) {
let data = res.data.data;
// 整理返回的数据赋值给表单
this.ptForm.tableId = data.tableId;
this.ptForm.tableName = data.tableName;
this.ptForm.comment = data.comment;
this.ptForm.procTaskSys = [];
this.ptForm.procTaskEqp = [];
// 系统控制项
for (let item of data.procTaskSys) {
let timeDate = new Date(item.time);
let timeDurDate = new Date(item.timeDur);
this.ptForm.procTaskSys.push({
time: new Date(1900, 1, 1, timeDate.getHours(), timeDate.getMinutes(), timeDate.getSeconds()),
timeDur: new Date(1900, 1, 1, timeDurDate.getHours(), timeDurDate.getMinutes(), timeDurDate.getSeconds()),
procCode: item.procCode,
cmdNm: item.cmdNm
});
}
// 设备控制项
for (let i = 0; i < data.procTaskEqp.length; i++) {
this.$set(this.cascaderPtArr, i, true);
let item = data.procTaskEqp[i];
let timeDate = new Date(item.time);
let timeDurDate = new Date(item.timeDur);
this.ptForm.procTaskEqp.push({
time: new Date(1900, 1, 1, timeDate.getHours(), timeDate.getMinutes(), timeDate.getSeconds()),
timeDur: new Date(1900, 1, 1, timeDurDate.getHours(), timeDurDate.getMinutes(), timeDurDate.getSeconds()),
equipSetNm: item.equipSetNm,
equipSetValue: [item.equipNo, item.setNo],
value: String(item.value)
});
}
this.ptTaskDetail = true;
this.isNewPtTask = false;
} else {
this.$message({
type: 'error',
message: res.data.message
});
}
}).catch(err => {
console.log(err);
this.$message({
type: 'error',
message: '获取普通任务信息失败'
});
});
// 循环任务
} else {
this.$api.GetCycleTaskData({
tableId: val
}).then(res => {
if (res.data.code === 200) {
let data = res.data.data;
this.xhForm.tableId = data.tableId;
this.xhForm.tableName = data.tableName;
this.xhForm.comment = data.comment;
this.xhForm.cycleTaskContent = data.cycleTaskContent;
let dateBegin = new Date(data.cycleTask.beginTime);
let dateEnd = new Date(data.cycleTask.endTime);
this.xhForm.cycleTask.intervalTime = [new Date(1900, 1, 1, dateBegin.getHours(), dateBegin.getMinutes(), dateBegin.getSeconds()), new Date(1900, 1, 1, dateEnd.getHours(), dateEnd.getMinutes(), dateEnd.getSeconds())];
if (data.cycleTask.zhenDianDo === '1') {
this.xhForm.cycleTask.implement = '2';
} else if (data.cycleTask.zhidingDo === '1') {
this.xhForm.cycleTask.implement = '3';
} else {
this.xhForm.cycleTask.implement = '1';
}
let dateZhiding = new Date(data.cycleTask.zhidingTime);
this.xhForm.cycleTask.zhidingTime = new Date(1900, 1, 1, dateZhiding.getHours(), dateZhiding.getMinutes(), dateZhiding.getSeconds());
this.xhForm.cycleTask.isMaxCycle = data.cycleTask.maxCycleNum !== 0;
this.xhForm.cycleTask.maxCycleNum = data.cycleTask.maxCycleNum;
this.xhForm.cycleTask.cycleMustFinish = data.cycleTask.cycleMustFinish === '1';
this.xhTaskDetail = true;
this.isNewXhTask = false;
} else {
this.$message({
type: 'error',
message: res.data.message
});
}
}).catch(err => {
console.log(err);
this.$message({
type: 'error',
message: '获取循环任务信息失败'
});
});
}
},
// 保存普通任务
savePtTask() {
this.$refs['ptForm'].validate(valid => {
if (valid) {
// 获取表单数据重新整理出接口参数
let obj = {};
obj.tableName = this.ptForm.tableName;
obj.comment = this.ptForm.comment;
if (!this.isNewPtTask) {
obj.tableId = this.ptForm.tableId;
}
obj.procTaskSys = [];
obj.procTaskEqp = [];
// 系统控制项
for (let item of this.ptForm.procTaskSys) {
if (item.procCode === '') {
return this.$message({
type: 'warning',
message: '请先选择系统控制项'
});
}
obj.procTaskSys.push({
procCode: item.procCode,
cmdNm: this.getCmdNm(item.procCode),
time: `1900-01-01 ${this.myUtils.addZero(item.time.getHours(), 2)}:${this.myUtils.addZero(item.time.getMinutes(), 2)}:${this.myUtils.addZero(item.time.getSeconds(), 2)}`,
timeDur: `1900-01-01 ${this.myUtils.addZero(item.timeDur.getHours(), 2)}:${this.myUtils.addZero(item.timeDur.getMinutes(), 2)}:${this.myUtils.addZero(item.timeDur.getSeconds(), 2)}`
});
}
// 设备控制项
for (let item of this.ptForm.procTaskEqp) {
if (item.equipSetValue.length === 0) {
return this.$message({
type: 'warning',
message: '请先选择设备控制项'
});
}
obj.procTaskEqp.push({
equipNo: item.equipSetValue[0],
setNo: item.equipSetValue[1],
equipSetNm: `${this.$refs[item.index].getCheckedNodes()[0].parent.label}-${this.$refs[item.index].getCheckedNodes()[0].label}`,
value: String(item.value),
time: `1900-01-01 ${this.myUtils.addZero(item.time.getHours(), 2)}:${this.myUtils.addZero(item.time.getMinutes(), 2)}:${this.myUtils.addZero(item.time.getSeconds(), 2)}`,
timeDur: `1900-01-01 ${this.myUtils.addZero(item.timeDur.getHours(), 2)}:${this.myUtils.addZero(item.timeDur.getMinutes(), 2)}:${this.myUtils.addZero(item.timeDur.getSeconds(), 2)}`
});
}
let apiName = this.isNewPtTask ? 'CreateCommonTask' : 'EditCommonTaskData';
this.$api[apiName](obj).then(res => {
if (res.data.code === 200) {
this.getRepository();
this.$message({
type: 'success',
message: this.isNewPtTask ? '新增成功' : '修改成功'
});
this.ptTaskDetail = false;
} else {
this.$message({
type: 'error',
message: res.data.message
});
}
}).catch(er => {
this.$message({
type: 'error',
message: this.isNewPtTask ? '新增失败' : '修改失败'
});
});
}
});
},
// 新增循环任务
saveXhTask() {
this.$refs['xhForm'].validate(valid => {
if (valid) {
// 获取表单数据重新整理出接口参数
let obj = {};
obj.tableName = this.xhForm.tableName;
obj.comment = this.xhForm.comment;
if (!this.isNewXhTask) {
obj.tableId = this.xhForm.tableId;
}
obj.cycleTask = {};
obj.cycleTaskContent = [];
let cycleTask = this.xhForm.cycleTask;
obj.cycleTask.beginTime = `1900-01-01 ${this.myUtils.addZero(cycleTask.intervalTime[0].getHours(), 2)}:${this.myUtils.addZero(cycleTask.intervalTime[0].getMinutes(), 2)}:${this.myUtils.addZero(cycleTask.intervalTime[0].getSeconds(), 2)}`;
obj.cycleTask.endTime = `1900-01-01 ${this.myUtils.addZero(cycleTask.intervalTime[1].getHours(), 2)}:${this.myUtils.addZero(cycleTask.intervalTime[1].getMinutes(), 2)}:${this.myUtils.addZero(cycleTask.intervalTime[1].getSeconds(), 2)}`;
obj.cycleTask.zhenDianDo = cycleTask.implement === '2' ? '1' : '0';
obj.cycleTask.zhidingDo = cycleTask.implement === '3' ? '1' : '0';
obj.cycleTask.cycleMustFinish = cycleTask.cycleMustFinish ? '1' : '0';
obj.cycleTask.zhidingTime = `1900-01-01 ${this.myUtils.addZero(cycleTask.zhidingTime.getHours(), 2)}:${this.myUtils.addZero(cycleTask.zhidingTime.getMinutes(), 2)}:${this.myUtils.addZero(cycleTask.zhidingTime.getSeconds(), 2)}`;
obj.cycleTask.maxCycleNum = Number(cycleTask.maxCycleNum);
obj.cycleTaskContent = JSON.parse(JSON.stringify(this.xhForm.cycleTaskContent));
// 判断是新增还是编辑
let apiName = this.isNewXhTask ? 'CreateCycleTask' : 'EditCycleyTaskData';
this.$api[apiName](obj).then(res => {
if (res.data.code === 200) {
this.getRepository();
this.$message({
type: 'success',
message: this.isNewXhTask ? '新增成功' : '修改成功'
});
this.xhTaskDetail = false;
} else {
this.$message({
type: 'error',
message: res.data.message
});
}
}).catch(er => {
this.$message({
type: 'error',
message: this.isNewXhTask ? '新增失败' : '修改失败'
});
});
}
});
},
// 删除任务
delData(val, type) {
let apiName = type === 'T' ? 'DelCommonData' : 'DelCycleData';
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.taskLoad = true;
this.$api[apiName]({
tableId: val
}).then(res => {
let code = res.data.code;
if (code === 200) {
this.$message({
type: 'success',
message: '删除成功'
});
this.getRepository();
} else {
this.$message({
type: 'error',
message: '删除失败'
});
}
this.taskLoad = false;
}).catch(err => {
console.log(err);
this.taskLoad = false;
});
}).catch(res => {
this.taskLoad = false;
});
},
// 关闭普通任务框回调事件
closePtDetail() {
this.isNewPtTask = true;
this.$refs['ptForm'].resetFields();
this.ptForm = {
tableId: '',
tableName: '',
comment: '',
procTaskSys: [{
time: new Date(1900, 1, 1, new Date().getHours(), new Date().getMinutes(), new Date().getSeconds()),
timeDur: new Date(1900, 1, 1, 0, 0, 5),
procCode: '',
cmdNm: ''
}],
procTaskEqp: []
};
},
// 关闭循环任务框回调事件
closeXhDetail() {
this.isNewXhTask = true;
this.$refs['xhForm'].resetFields();
this.xhForm = {
tableId: '',
tableName: '',
comment: '',
cycleTask: {
beginTime: '1900-01-01 00:00:00',
endTime: '1900-01-01 00:00:00',
intervalTime: [new Date(2020, 1, 1, 0, 0, 0), new Date(2020, 1, 1, 23, 59, 59)],
zhenDianDo: '0',
zhidingDo: '0',
implement: '1',
cycleMustFinish: '0',
zhidingTime: new Date(2020, 1, 1, 0, 0, 0),
isMaxCycle: false,
maxCycleNum: 0
},
cycleTaskContent: []
};
this.xhSysForm = {
control: ''
};
this.xhEqpForm = {
control: [],
value: 0
};
this.xhTimeForm = {
day: undefined,
hour: undefined,
min: undefined,
second: undefined
};
}
},
watch: {
xhForm: function (newVal) {
this.$forceUpdate();
}
}
});
/***/ }),
/* 3 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__taskRepository_vue__ = __webpack_require__(4);
/* harmony default export */ __webpack_exports__["default"] = (__WEBPACK_IMPORTED_MODULE_0__taskRepository_vue__["a" /* default */]);
/***/ }),
/* 4 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_13_7_3_vue_loader_lib_selector_type_script_index_0_taskRepository_vue__ = __webpack_require__(2);
/* unused harmony namespace reexport */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_13_7_3_vue_loader_lib_template_compiler_index_id_data_v_9ace4170_hasScoped_true_buble_transforms_node_modules_vue_loader_13_7_3_vue_loader_lib_selector_type_template_index_0_taskRepository_vue__ = __webpack_require__(15);
var disposed = false
function injectStyle (ssrContext) {
if (disposed) return
__webpack_require__(5)
}
var normalizeComponent = __webpack_require__(11)
/* script */
/* template */
/* template functional */
var __vue_template_functional__ = false
/* styles */
var __vue_styles__ = injectStyle
/* scopeId */
var __vue_scopeId__ = "data-v-9ace4170"
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_13_7_3_vue_loader_lib_selector_type_script_index_0_taskRepository_vue__["a" /* default */],
__WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_13_7_3_vue_loader_lib_template_compiler_index_id_data_v_9ace4170_hasScoped_true_buble_transforms_node_modules_vue_loader_13_7_3_vue_loader_lib_selector_type_template_index_0_taskRepository_vue__["a" /* default */],
__vue_template_functional__,
__vue_styles__,
__vue_scopeId__,
__vue_module_identifier__
)
Component.options.__file = "src/taskRepository.vue"
/* hot reload */
if (false) {(function () {
var hotAPI = require("vue-loader/node_modules/vue-hot-reload-api")
hotAPI.install(require("vue"), false)
if (!hotAPI.compatible) return
module.hot.accept()
if (!module.hot.data) {
hotAPI.createRecord("data-v-9ace4170", Component.options)
} else {
hotAPI.reload("data-v-9ace4170", Component.options)
}
module.hot.dispose(function (data) {
disposed = true
})
})()}
/* harmony default export */ __webpack_exports__["a"] = (Component.exports);
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
// style-loader: Adds some css to the DOM by adding a <style> tag
// load the styles
var content = __webpack_require__(6);
if(typeof content === 'string') content = [[module.i, content, '']];
if(content.locals) module.exports = content.locals;
// add the styles to the DOM
var update = __webpack_require__(9)("a4f5ab6a", content, false, {});
// Hot Module Replacement
if(false) {
// When the styles change, update the <style> tags
if(!content.locals) {
module.hot.accept("!!../node_modules/_css-loader@0.28.11@css-loader/index.js?sourceMap!../node_modules/_vue-loader@13.7.3@vue-loader/lib/style-compiler/index.js?{\"vue\":true,\"id\":\"data-v-9ace4170\",\"scoped\":true,\"hasInlineConfig\":false}!../node_modules/_sass-loader@6.0.7@sass-loader/lib/loader.js!./taskRepository.scss", function() {
var newContent = require("!!../node_modules/_css-loader@0.28.11@css-loader/index.js?sourceMap!../node_modules/_vue-loader@13.7.3@vue-loader/lib/style-compiler/index.js?{\"vue\":true,\"id\":\"data-v-9ace4170\",\"scoped\":true,\"hasInlineConfig\":false}!../node_modules/_sass-loader@6.0.7@sass-loader/lib/loader.js!./taskRepository.scss");
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
update(newContent);
});
}
// When the module is disposed, remove the <style> tags
module.hot.dispose(function() { update(); });
}
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
var escape = __webpack_require__(7);
exports = module.exports = __webpack_require__(8)(true);
// imports
// module
exports.push([module.i, "\n@charset \"UTF-8\";\nhtml[data-v-9ace4170],\nbody[data-v-9ace4170] {\n font-size: 16px;\n}\n.success[data-v-9ace4170] {\n color: #63e03f !important;\n}\n.warning[data-v-9ace4170] {\n color: #f5bb36 !important;\n}\n.purple[data-v-9ace4170] {\n color: #eb2fbc !important;\n}\n.primary[data-v-9ace4170] {\n color: #3875ff !important;\n}\n.noComm[data-v-9ace4170] {\n color: #a0a0a0 !important;\n}\n.normal[data-v-9ace4170] {\n color: #63e03f !important;\n}\n.alarm[data-v-9ace4170] {\n color: #f22433 !important;\n}\n.lsSet[data-v-9ace4170] {\n color: #bebcaa !important;\n}\n.initialize[data-v-9ace4170] {\n color: #289ac0 !important;\n}\n.withdraw[data-v-9ace4170] {\n color: pink !important;\n}\n@keyframes radar-beam-data-v-9ace4170 {\n0% {\n transform: rotate(0deg);\n}\n100% {\n transform: rotate(360deg);\n}\n}\n.el-tooltip__popper[x-placement^=\"top\"] .popper__arrow[data-v-9ace4170]:after {\n border-top-color: #595959 !important;\n}\n\n/* 组件样式 */\n.video-header-left[data-v-9ace4170] {\n padding: 8px !important;\n}\n.video-header-left .layout[data-v-9ace4170] {\n padding: 0;\n display: flex;\n justify-content: space-between;\n}\n.video-header-left .layout li[data-v-9ace4170] {\n padding: 5px;\n color: #f0f4ff;\n cursor: pointer;\n border-radius: 3px;\n border: 1px solid #252833;\n transition: all .2s;\n}\n.video-header-left .layout li[data-v-9ace4170]:nth-child(n+2) {\n margin-left: 5px;\n}\n.video-header-left .layout li[data-v-9ace4170]:hover {\n color: #3875ff;\n border: 1px solid #3875ff;\n}\n.video-header-left .layout .switchBlockNumActive[data-v-9ace4170] {\n color: #3875ff;\n border: 1px solid #3875ff;\n}\n#taskRepository[data-v-9ace4170] {\n width: 100%;\n height: 100%;\n}\n#taskRepository > .el-header[data-v-9ace4170] {\n height: 4rem !important;\n padding-left: 8px;\n}\n#taskRepository .el-button.is-circle[data-v-9ace4170] {\n border-radius: 3px;\n font-size: 1.5rem;\n background-color: transparent !important;\n border-color: transparent !important;\n}\n#taskRepository .el-header[data-v-9ace4170] {\n display: flex;\n justify-content: space-between;\n align-items: center;\n border-bottom: 0.5px solid rgba(240, 244, 255, 0.16);\n}\n#taskRepository .el-header .header-left[data-v-9ace4170] {\n display: flex;\n align-items: center;\n}\n#taskRepository .el-header .header-left h1[data-v-9ace4170] {\n font-size: 1.5rem;\n font-weight: normal;\n color: #f0f4ff;\n margin-right: 1rem;\n}\n#taskRepository .el-header .header-right[data-v-9ace4170] .el-input {\n width: 220px;\n}\n#taskRepository .el-header .header-right[data-v-9ace4170] .el-input .el-input__inner {\n width: 220px;\n background-color: #0c0e14;\n}\n#taskRepository .el-header .header-right[data-v-9ace4170] .el-input .el-input__prefix {\n top: 1px;\n}\n#taskRepository .task-header[data-v-9ace4170] {\n padding-right: 0;\n}\n#taskRepository .task-list[data-v-9ace4170] {\n height: calc(100% - 5rem - 48px);\n overflow: auto;\n margin-top: 1rem;\n}\n#taskRepository .task-list .noData[data-v-9ace4170] {\n height: 80%;\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n user-select: none;\n}\n#taskRepository .task-list .noData .tip[data-v-9ace4170] {\n font-size: 1.5rem;\n display: flex;\n line-height: 50px;\n justify-content: center;\n align-items: center;\n color: #ced2dd;\n}\n#taskRepository .task-list .noData div[data-v-9ace4170] {\n display: flex;\n justify-content: center;\n align-items: center;\n color: #646774;\n}\n#taskRepository .task-list .noData div i[data-v-9ace4170] {\n margin: 0px 10px;\n}\n#taskRepository .task-list .task-item[data-v-9ace4170] {\n height: 72px;\n font-size: 0.75rem;\n color: #ffffff;\n background: #252833;\n border: 0.5px solid rgba(240, 244, 255, 0.16);\n border-radius: 3px;\n cursor: pointer;\n display: flex;\n justify-content: space-between;\n padding: 16px 8px 0 16px;\n margin-bottom: 8px;\n}\n#taskRepository .task-list .task-item[data-v-9ace4170]:hover {\n background: #313747;\n}\n#taskRepository .task-list .task-item .task-list-name[data-v-9ace4170] {\n width: calc(100% - 3rem);\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n display: flex;\n}\n#taskRepository .task-list .task-item .task-list-name span p[data-v-9ace4170]:nth-child(1) {\n font-size: 0.875rem;\n color: #f0f4ff;\n}\n#taskRepository .task-list .task-item .task-list-name span p[data-v-9ace4170]:nth-child(2) {\n font-size: 0.875rem;\n color: rgba(240, 244, 255, 0.56);\n margin-top: 12px;\n}\n#taskRepository .task-list .task-item .task-list-name .sign[data-v-9ace4170] {\n display: inline-block;\n width: 14px;\n height: 10px;\n margin-right: 9px;\n margin-top: 2px;\n background: url(" + escape(__webpack_require__(0)) + ") no-repeat center center/100% 100%;\n}\n#taskRepository .task-list .task-item .task-list-name .circleSign[data-v-9ace4170] {\n background: url(" + escape(__webpack_require__(1)) + ") no-repeat center center/100% 100%;\n}\n#taskRepository .task-list .task-item i[data-v-9ace4170] {\n font-size: 16px;\n color: #BFBFBF;\n float: right;\n}\n#taskRepository .el-footer[data-v-9ace4170] {\n height: 48px !important;\n border-top: 1px solid rgba(240, 244, 255, 0.16);\n width: 100%;\n height: 48px;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n#taskRepository .el-footer[data-v-9ace4170] .el-pagination {\n padding: 0;\n}\n#taskRepository .el-footer[data-v-9ace4170] .el-pagination .el-pagination__sizes .el-input__inner,\n #taskRepository .el-footer[data-v-9ace4170] .el-pagination .el-pagination__editor .el-input__inner {\n height: 32px;\n}\n#taskRepository .el-footer[data-v-9ace4170] .el-pagination button {\n width: 32px;\n height: 32px;\n}\n#taskRepository .el-footer[data-v-9ace4170] .el-pagination .el-pager li {\n width: 32px;\n height: 32px;\n line-height: 32px;\n}\n#taskRepository[data-v-9ace4170] .el-dialog {\n border: 0.5px solid rgba(240, 244, 255, 0.16);\n}\n#taskRepository[data-v-9ace4170] .el-dialog .el-dialog__header {\n height: 48px;\n line-height: 48px;\n padding: 0;\n color: #f0f4ff;\n font-size: 1rem;\n border-bottom: 0.5px solid rgba(240, 244, 255, 0.16);\n}\n#taskRepository[data-v-9ace4170] .el-dialog .el-dialog__header .pt-task-logo {\n display: inline-block;\n width: 14px;\n height: 10px;\n margin-right: 10px;\n background: url(" + escape(__webpack_require__(0)) + ") no-repeat center center/100% 100%;\n}\n#taskRepository[data-v-9ace4170] .el-dialog .el-dialog__header .xh-task-logo {\n display: inline-block;\n width: 14px;\n height: 10px;\n margin-right: 10px;\n background: url(" + escape(__webpack_require__(1)) + ") no-repeat center center/100% 100%;\n}\n#taskRepository[data-v-9ace4170] .el-dialog .el-dialog__header .el-dialog__headerbtn {\n top: 0;\n}\n#taskRepository[data-v-9ace4170] .el-dialog .el-dialog__body {\n background-color: #181c29;\n padding: 8px;\n}\n#taskRepository[data-v-9ace4170] .el-dialog .el-dialog__body .flex-start-body {\n align-items: flex-start;\n}\n#taskRepository[data-v-9ace4170] .el-dialog .el-dialog__body .dialog-body {\n width: 100%;\n height: 100%;\n display: flex;\n}\n#taskRepository[data-v-9ace4170] .el-dialog .el-dialog__body .dialog-body .dialog-body-pt-left {\n width: 320px;\n margin-right: 8px;\n}\n#taskRepository[data-v-9ace4170] .el-dialog .el-dialog__body .dialog-body .dialog-body-item {\n background: #252833;\n border: 0.5px solid rgba(240, 244, 255, 0.16);\n border-radius: 3px;\n}\n#taskRepository[data-v-9ace4170] .el-dialog .el-dialog__body .dialog-body .el-header {\n height: 48px !important;\n padding: 0 24px;\n border-bottom: 0.5px solid rgba(240, 244, 255, 0.16);\n font-size: 1rem;\n color: #f0f4ff;\n}\n#taskRepository[data-v-9ace4170] .el-dialog .el-dialog__body .dialog-body .base-info {\n padding: 0 16px 16px;\n}\n#taskRepository[data-v-9ace4170] .el-dialog .el-dialog__body .dialog-body .el-form-item {\n width: 100%;\n margin-bottom: 0;\n}\n#taskRepository[data-v-9ace4170] .el-dialog .el-dialog__body .dialog-body .el-form-item .el-form-item__label {\n font-size: .875rem;\n line-height: .875rem;\n height: 38px;\n color: rgba(240, 244, 255, 0.56);\n padding: 16px 0 8px 8px;\n position: relative;\n}\n#taskRepository[data-v-9ace4170] .el-dialog .el-dialog__body .dialog-body .el-form-item .el-form-item__label:before {\n position: absolute;\n left: 0;\n}\n#taskRepository[data-v-9ace4170] .el-dialog .el-dialog__body .dialog-body .el-form-item .el-form-item__content {\n width: 100%;\n line-height: 32px;\n}\n#taskRepository[data-v-9ace4170] .el-dialog .el-dialog__body .dialog-body .el-form-item .el-form-item__content .el-input__inner {\n font-size: .875rem;\n padding: 5px 7px;\n}\n#taskRepository[data-v-9ace4170] .el-dialog .el-dialog__body .dialog-body .el-form-item .el-form-item__content .el-cascader {\n width: 100%;\n}\n#taskRepository[data-v-9ace4170] .el-dialog .el-dialog__body .dialog-body .el-form-item .el-form-item__content .el-textarea__inner {\n font-size: .875rem;\n line-height: 20px;\n padding: 5px 7px;\n}\n#taskRepository[data-v-9ace4170] .el-dialog .el-dialog__body .dialog-body .el-form-item .el-form-item__content .el-form-item__error {\n padding-top: 0;\n}\n#taskRepository[data-v-9ace4170] .el-dialog .el-dialog__body .dialog-body .el-form-item .el-form-item__content .el-date-editor {\n width: 100%;\n}\n#taskRepository[data-v-9ace4170] .el-dialog .el-dialog__body .dialog-body .el-form-item .el-form-item__content .el-date-editor .el-range-separator {\n padding: 0 16px;\n}\n#taskRepository[data-v-9ace4170] .el-dialog .el-dialog__body .dialog-body .dialog-body-pt-right {\n width: calc(100% - 328px);\n height: 646px;\n}\n#taskRepository[data-v-9ace4170] .el-dialog .el-dialog__body .dialog-body .dialog-body-pt-right