...
|
...
|
@@ -40,7 +40,7 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common', |
|
|
function initTable() {
|
|
|
inspectionTaskTable = table.render({
|
|
|
elem: '#inspectionTask_table'
|
|
|
, url: domainName + '/api-web/inspectiontask/findPage?accessToken=' + accessToken
|
|
|
, url: domainName + '/api-web/inspectiontask/findPage'
|
|
|
, where: whereSearch()
|
|
|
, height: 'full-210'
|
|
|
, cellMinWidth: 80
|
...
|
...
|
@@ -270,7 +270,7 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common', |
|
|
publishStatus = '0'
|
|
|
}
|
|
|
admin.req({
|
|
|
url: domainName + '/api-web/inspectiontask/publishTask?accessToken=' + accessToken,
|
|
|
url: domainName + '/api-web/inspectiontask/publishTask',
|
|
|
type: 'get',
|
|
|
data: {taskId: taskId, publishStatus: publishStatus},
|
|
|
contentType: 'application/json',
|
...
|
...
|
@@ -300,24 +300,22 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common', |
|
|
data: {
|
|
|
taskId: taskId,
|
|
|
taskStatus: taskStatus
|
|
|
},
|
|
|
success: function (response) {
|
|
|
layer.closeAll('loading');
|
|
|
if (response && response.success) {
|
|
|
layer.msg('操作成功!', {icon: 1});
|
|
|
reloadTable();
|
|
|
} else {
|
|
|
obj.elem.checked = !obj.elem.checked;
|
|
|
form.render();
|
|
|
layer.msg(response.msg, {icon: 2});
|
|
|
}
|
|
|
},
|
|
|
error: function (error) {
|
|
|
layer.closeAll('loading');
|
|
|
}
|
|
|
}).done(function (response) {
|
|
|
layer.closeAll('loading');
|
|
|
if (response && response.success) {
|
|
|
layer.msg('操作成功!', {icon: 1});
|
|
|
reloadTable();
|
|
|
} else {
|
|
|
obj.elem.checked = !obj.elem.checked;
|
|
|
form.render();
|
|
|
layer.msg('操作失败!', {icon: 2});
|
|
|
layer.msg(response.msg, {icon: 2});
|
|
|
}
|
|
|
}).error(function (error) {
|
|
|
layer.closeAll('loading');
|
|
|
obj.elem.checked = !obj.elem.checked;
|
|
|
form.render();
|
|
|
layer.msg('操作失败!', {icon: 2});
|
|
|
});
|
|
|
});
|
|
|
// 查看巡检任务执行详情
|
...
|
...
|
@@ -465,13 +463,13 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common', |
|
|
// 上传模板事件
|
|
|
upload.render({
|
|
|
elem: '#upload_tasktemp' //绑定元素
|
|
|
, url: common.domainName + '/api-web/inspectiontask/upload?accessToken=' + accessToken //上传接口
|
|
|
, url: common.domainName + '/api-web/inspectiontask/upload' //上传接口
|
|
|
, accept: 'file' //允许上传的文件类型
|
|
|
, exts: 'docx|doc'
|
|
|
, multiple: false
|
|
|
, before: function () {
|
|
|
layer.load(2);
|
|
|
this.url = domainName + '/api-web/inspectiontask/upload?taskId=' + selectTaskId + '&accessToken=' + accessToken;
|
|
|
this.url = domainName + '/api-web/inspectiontask/upload?taskId=' + selectTaskId;
|
|
|
}
|
|
|
, done: function (res) {
|
|
|
layer.closeAll("loading");
|
...
|
...
|
@@ -492,17 +490,10 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common', |
|
|
function sync(taskIds, elem) {
|
|
|
layer.load(2);
|
|
|
admin.req({
|
|
|
url: domainName + '/api-web/inspectiontask/sync?accessToken=' + accessToken,
|
|
|
url: domainName + '/api-web/inspectiontask/sync',
|
|
|
type: 'get',
|
|
|
data: {taskIds: taskIds},
|
|
|
contentType: 'application/json',
|
|
|
error: function (e) {
|
|
|
layer.closeAll('loading');
|
|
|
if (elem) {
|
|
|
elem.checked = !elem.checked;
|
|
|
form.render();
|
|
|
}
|
|
|
}
|
|
|
contentType: 'application/json'
|
|
|
}).done(function (response) {
|
|
|
layer.closeAll('loading');
|
|
|
if (response.success) {
|
...
|
...
|
@@ -515,13 +506,19 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common', |
|
|
form.render();
|
|
|
}
|
|
|
}
|
|
|
}).error(function (e) {
|
|
|
layer.closeAll('loading');
|
|
|
if (elem) {
|
|
|
elem.checked = !elem.checked;
|
|
|
form.render();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
//获取巡检结果PDF
|
|
|
function inspectionResultPDF(batchNo) {
|
|
|
admin.req({
|
|
|
url: domainName + '/api-web/inspectiontask/getPdfPath?accessToken=' + accessToken + '&batchNo=' + batchNo
|
|
|
url: domainName + '/api-web/inspectiontask/getPdfPath?batchNo=' + batchNo
|
|
|
}).done(function (response) {
|
|
|
if ("success" == response.msg) {
|
|
|
window.open("/src/lib/extend/pdfjs/web/viewer.html?test=" + encodeURIComponent(response.pdfPath));
|
...
|
...
|
@@ -532,13 +529,10 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common', |
|
|
function exec(taskId) {
|
|
|
layer.load(2);
|
|
|
admin.req({
|
|
|
url: domainName + '/api-web/inspectiontask/exec?accessToken=' + accessToken,
|
|
|
url: domainName + '/api-web/inspectiontask/exec',
|
|
|
type: 'get',
|
|
|
data: {taskId: taskId},
|
|
|
contentType: 'application/json',
|
|
|
error: function (error) {
|
|
|
layer.closeAll('loading');
|
|
|
}
|
|
|
contentType: 'application/json'
|
|
|
}).done(function (response) {
|
|
|
layer.closeAll('loading');
|
|
|
if (response && response.success) {
|
...
|
...
|
@@ -555,6 +549,8 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common', |
|
|
} else {
|
|
|
layer.msg(response.msg, {icon: 2});
|
|
|
}
|
|
|
}).error(function (error) {
|
|
|
layer.closeAll('loading');
|
|
|
});
|
|
|
}
|
|
|
|
...
|
...
|
@@ -659,27 +655,22 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common', |
|
|
element: elementInfo
|
|
|
}
|
|
|
var url = `${common.domainName}/api-web/inspectiontask/saveOrUpdate`
|
|
|
$.ajax({
|
|
|
admin.req({
|
|
|
url: url,
|
|
|
headers: {
|
|
|
"Authorization": "Bearer " + accessToken + ""
|
|
|
},
|
|
|
type: 'post',
|
|
|
contentType: "application/json;charset=utf-8",
|
|
|
data: JSON.stringify(param),
|
|
|
success: function (res) {
|
|
|
layer.close(load);
|
|
|
if (res && res.success) {
|
|
|
layer.msg('保存成功!', {offset: '15px', icon: 1});
|
|
|
layer.close(index);
|
|
|
reloadTable();
|
|
|
} else {
|
|
|
layer.msg(res.msg, {offset: '15px', icon: 2});
|
|
|
}
|
|
|
},
|
|
|
error: function () {
|
|
|
layer.close(load);
|
|
|
data: JSON.stringify(param)
|
|
|
}).done(function (res) {
|
|
|
layer.close(load);
|
|
|
if (res && res.success) {
|
|
|
layer.msg('保存成功!', {offset: '15px', icon: 1});
|
|
|
layer.close(index);
|
|
|
reloadTable();
|
|
|
} else {
|
|
|
layer.msg(res.msg, {offset: '15px', icon: 2});
|
|
|
}
|
|
|
}).error(function () {
|
|
|
layer.close(load);
|
|
|
})
|
|
|
|
|
|
|
...
|
...
|
@@ -757,10 +748,7 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common', |
|
|
layer.close(index);
|
|
|
layer.load(2);
|
|
|
admin.req({
|
|
|
url: common.domainName + '/api-web/inspectiontask/deleteByIds?taskIds=' + ids,
|
|
|
error: function (e) {
|
|
|
layer.closeAll('loading');
|
|
|
}
|
|
|
url: common.domainName + '/api-web/inspectiontask/deleteByIds?taskIds=' + ids
|
|
|
}).done(function (response) {
|
|
|
layer.closeAll('loading');
|
|
|
if (response && response.success) {
|
...
|
...
|
@@ -829,34 +817,33 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common', |
|
|
admin.req({
|
|
|
url: domainName + '/api-web/inspectiontask/findPage',
|
|
|
data: lastSearchCondition,
|
|
|
async: false,
|
|
|
success: function (response) {
|
|
|
if (response && response.success) {
|
|
|
for (var i = 0; i < response.data.length; i++) {
|
|
|
var taskId = response.data[i].taskId;
|
|
|
var status = response.data[i].status;
|
|
|
var $statusDom = $('div[inspectiontask-status-taskid="' + taskId + '"]');
|
|
|
if ($statusDom.length) {
|
|
|
var statusStr = '未执行';
|
|
|
if (statusEnum[status]) {
|
|
|
statusStr = statusEnum[status];
|
|
|
}
|
|
|
if (statusStr != $statusDom.text()) {
|
|
|
changeTextSoftly($statusDom, statusStr);
|
|
|
if (statusStr == '未执行') {
|
|
|
$statusDom.removeClass('link');
|
|
|
} else {
|
|
|
$statusDom.addClass('link');
|
|
|
$statusDom.attr('batchno', response.data[i].batchNo);
|
|
|
}
|
|
|
var index = $statusDom.parents('tr[data-index]').data('index');
|
|
|
tableData[index].status = status;
|
|
|
async: false
|
|
|
}).done(function (response) {
|
|
|
if (response && response.success) {
|
|
|
for (var i = 0; i < response.data.length; i++) {
|
|
|
var taskId = response.data[i].taskId;
|
|
|
var status = response.data[i].status;
|
|
|
var $statusDom = $('div[inspectiontask-status-taskid="' + taskId + '"]');
|
|
|
if ($statusDom.length) {
|
|
|
var statusStr = '未执行';
|
|
|
if (statusEnum[status]) {
|
|
|
statusStr = statusEnum[status];
|
|
|
}
|
|
|
if (statusStr != $statusDom.text()) {
|
|
|
changeTextSoftly($statusDom, statusStr);
|
|
|
if (statusStr == '未执行') {
|
|
|
$statusDom.removeClass('link');
|
|
|
} else {
|
|
|
$statusDom.addClass('link');
|
|
|
$statusDom.attr('batchno', response.data[i].batchNo);
|
|
|
}
|
|
|
var index = $statusDom.parents('tr[data-index]').data('index');
|
|
|
tableData[index].status = status;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
setTimeout(refreshTaskStatus, 7000);
|
|
|
}
|
|
|
setTimeout(refreshTaskStatus, 7000);
|
|
|
});
|
|
|
}
|
|
|
}
|
...
|
...
|
|