wlcb-system-task/src/main/resources/templates/despicableconfigure/update.html
2021-11-30 17:40:20 +08:00

261 lines
14 KiB
HTML

<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<base th:href="${#request.getContextPath() + '/'}">
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
<link rel="stylesheet" type="text/css" href="assets/js/vendor/viewer/viewer.min.css">
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-card">
<div class="layui-card-header">
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
<a class="close" href="javascript:void(0);">上级列表</a><span lay-separator="">/</span>
<a href="javascript:void(0);"><cite>编辑内容</cite></a>
</span>
</div>
<div class="layui-card-body" style="padding: 15px;">
<form class="layui-form layui-form-pane" lay-filter="dataForm">
<div class="layui-form-item">
<label class="layui-form-label" style="width: 122px;">下派执行时间</label>
<div class="layui-input-block layui-form" style="margin-left: 122px;" id="implementTimeSelectTemplateBox" lay-filter="implementTimeSelectTemplateBox"></div>
<script id="implementTimeSelectTemplate" type="text/html">
<select id="implementTime" name="implementTime" lay-filter="implementTime" lay-verify="required">
<option value="">请选择下派执行时间</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dataId}}">{{item.dataName}}</option>
{{# } }}
</select>
</script>
</div>
<span style="color: red;font-size: 14px;margin-left: 9%;">*自动下派天数(小时)限制:自动下派开始时间到截止日期的间隔时长</span>
<div class="layui-form-item layui-row">
<div class="layui-col-lg6">
<label class="layui-form-label" style="width: 144px;">自动下派天数限制</label>
<div class="layui-input-block" style="margin-left: 144px;">
<input type="number" id="days" name="days" class="layui-input" value="" placeholder="请输入自动下派天数限制(正整数)" lay-verify="required|integer">
</div>
</div>
<div class="layui-col-lg6">
<label class="layui-form-label" style="width: 144px;">自动下派小时限制</label>
<div class="layui-input-block" style="margin-left: 144px;">
<input type="number" id="hours" name="hours" class="layui-input" value="" placeholder="请输入自动下派小时限制(正整数)" lay-verify="required|integer">
</div>
</div>
</div>
<div class="layui-form-item layui-row">
<div class="layui-col-lg6">
<label class="layui-form-label" style="width: 150px;">下派顺序-紧急程度</label>
<div class="layui-input-block layui-form" style="margin-left: 150px;" id="urgentlevelSelectTemplateBox" lay-filter="urgentlevelSelectTemplateBox"></div>
<script id="urgentlevelSelectTemplate" type="text/html">
<select id="urgentlevel" name="urgentlevel" lay-filter="urgentlevel">
<option value="">请选择下派执行时间</option>
{{# for(var i = 0, item; item = d[i++];) { }}
<option value="{{item.dataId}}">{{item.dataName}}</option>
{{# } }}
</select>
</script>
</div>
<div class="layui-col-lg6">
<label class="layui-form-label" style="width: 123px;">下派顺序-距离</label>
<div class="layui-input-block" style="margin-left: 123px;">
<input type="number" step="0.01" id="distance" name="distance" class="layui-input" value="" placeholder="请输入下派顺序-距离">
</div>
</div>
</div>
<div class="layui-form-item layui-row">
<div class="layui-col-lg6">
<label class="layui-form-label" style="width: 150px;">下派顺序-截止日期</label>
<div class="layui-input-block" style="margin-left: 150px;">
<input type="text" id="deadTime" name="deadTime" class="layui-input" value="" placeholder="请选择下派顺序-截止日期" readonly style="cursor: pointer;">
</div>
</div>
<div class="layui-col-lg6">
<label class="layui-form-label" style="width: 150px;">下派顺序-上报次数</label>
<div class="layui-input-block" style="margin-left: 150px;">
<input type="number" id="reportCount" name="reportCount" class="layui-input" value="" placeholder="请输入下派顺序-上报次数">
</div>
</div>
</div>
<div class="layui-form-item">
<input type="hidden" id="areaId" name="areaId" class="layui-input" value="" placeholder="请输入下派顺序-区域" maxlength="255">
<input type="hidden" id="areaCode" name="areaCode" class="layui-input" value="" placeholder="请输入下派顺序-区域" maxlength="12">
<label class="layui-form-label" style="width: 123px;">下派顺序-区域</label>
<div class="layui-input-block" style="margin-left: 123px;">
<input type="text" id="areaName" name="areaName" class="layui-input" value="" placeholder="请输入下派顺序-区域" maxlength="36">
</div>
</div>
<div class="layui-form-item layui-layout-admin">
<div class="layui-input-block">
<div class="layui-footer" style="left: 0;">
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm">提交新增</button>
<button type="button" class="layui-btn layui-btn-primary close">返回上级</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<script src="assets/js/vendor/wangEditor/wangEditor.min.js"></script>
<script src="assets/js/vendor/ckplayer/ckplayer/ckplayer.js"></script>
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
var $ = layui.$;
var form = layui.form;
var laytpl = layui.laytpl;
var laydate = layui.laydate;
var despicableConfigureId = top.restAjax.params(window.location.href).despicableConfigureId;
var wangEditor = window.wangEditor;
var wangEditorObj = {};
var viewerObj = {};
$(document).on('click', '#areaName', function() {
top.dialog.open({
title: '选择地区',
url: top.restAjax.path('route/area/get-select?areaName={areaName}', [encodeURI($('#areaName').val())]),
width: '800px',
height: '225px',
onClose: function () {
var selectedAreaArray = top.dialog.dialogData.selectedAreaArray;
var areaCode = '';
var areaName = '';
if (selectedAreaArray.length > 0) {
areaCode = selectedAreaArray[selectedAreaArray.length - 1].areaCode;
for (var i = 0, item; item = selectedAreaArray[i++];) {
if (areaName) {
areaName += ',';
}
areaName += item.areaName;
}
}
$('#areaCode').val(areaCode);
$('#areaName').val(areaName);
}
})
});
form.verify({
integer: [
/^[0-9]\d*$/
, '只能输入正整数'
]
});
function closeBox() {
parent.layer.close(parent.layer.getFrameIndex(window.name));
}
function initImplementTimeSelect(selectValue) {
top.restAjax.get(top.restAjax.path('api/mongo/data/list-all/parent-id/{dataParentId}', ['3f2b991a-e4b3-430a-89b7-e19f0385b53e']), {}, null, function(code, data, args) {
laytpl(document.getElementById('implementTimeSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('implementTimeSelectTemplateBox').innerHTML = html;
});
form.render('select', 'implementTimeeSelectTemplateBox');
var selectObj = {};
selectObj['implementTime'] = selectValue;
form.val('dataForm', selectObj);
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
function initUrgentlevelSelect(selectValue) {
top.restAjax.get(top.restAjax.path('api/mongo/data/list-all/parent-id/{dataParentId}', ['203f7283-74a6-4f05-9d5f-c6675b3a69fc']), {}, null, function(code, data, args) {
laytpl(document.getElementById('urgentlevelSelectTemplate').innerHTML).render(data, function(html) {
document.getElementById('urgentlevelSelectTemplateBox').innerHTML = html;
});
form.render('select', 'urgentlevelSelectTemplateBox');
var selectObj = {};
selectObj['urgentlevel'] = selectValue;
form.val('dataForm', selectObj);
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化下派顺序-截止日期时间戳
function initDeadTimeDateTime(value) {
laydate.render({
elem: '#deadTime',
type: 'datetime',
value: value,
trigger: 'click'
});
}
// 初始化内容
function initData() {
var loadLayerIndex;
top.restAjax.get(top.restAjax.path('api/despicableconfigure/get/{despicableConfigureId}', [despicableConfigureId]), {}, null, function(code, data) {
var dataFormData = {};
for(var i in data) {
dataFormData[i] = data[i] +'';
}
form.val('dataForm', dataFormData);
form.render(null, 'dataForm');
initDeadTimeDateTime(data['deadTime']);
initImplementTimeSelect(data['implementTime']);
initUrgentlevelSelect(data['urgentlevel']);
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
}
initData();
// 提交表单
form.on('submit(submitForm)', function(formData) {
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);
var loadLayerIndex;
top.restAjax.put(top.restAjax.path('api/despicableconfigure/update/{despicableConfigureId}', [despicableConfigureId]), formData.field, null, function(code, data) {
var layerIndex = top.dialog.msg(top.dataMessage.updateSuccess, {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function(index) {
top.dialog.close(index);
window.location.reload();
},
btn2: function() {
closeBox();
}
});
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
});
return false;
});
$('.close').on('click', function() {
closeBox();
});
});
</script>
</body>
</html>