You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

171 lines
5.4 KiB

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="../../../component/pear/css/pear.css" />
<style>
.require-star {
position: absolute;
width: 3px;
height: 14px;
background-color: #ea4335;
top: 12px;
right: 8px;
border-radius: 1.5px;
}
.input-width {
max-width: 455px
}
.layui-form-select {
width: 455px;
}
.layui-btn-container .layui-btn {
margin-right: 10px;
margin-top: 4px;
word-spacing: normal;
}
.layui-table-view .layui-table th {
padding: 0;
border-top: 1px solid #EEEEEE !important;
/* border-left: 1px solid #EEEEEE !important; */
}
.layui-input-block {
margin-left: 86px;
min-height: 36px;
}
</style>
</head>
<body>
<form class="layui-form" action="">
<div class="mainBox">
<div class="main-container">
<div class="layui-form-item">
<label class="layui-form-label" style="width: auto !important;">订阅系统:</label>
<div class="layui-input-inline" id="system" style="width: 455px;"></div>
</div>
</div>
</div>
<div class="bottom">
<div class="button-container">
<button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit="" lay-filter="save">
<i class="layui-icon layui-icon-ok"></i>
提交
</button>
</div>
</div>
</form>
<script src="../../../component/layui/layui.js"></script>
<script src="../../../component/pear/pear.js"></script>
<script src="../../../component/pear/xm-select.js"></script>
<script>
layui.use(['form', 'jquery', 'tag', 'laytpl'], function () {
var form = layui.form;
var $ = layui.jquery;
var tag = layui.tag;
var laytpl = layui.laytpl;
var systemId = GetQueryString("system_id");
var systemSelect = xmSelect.render({
el: '#system',
name: 'subscribe_system_ids',
theme: {
color: localStorage.getItem("theme-color-color"),
},
toolbar: {
show: true,
showIcon: true,
},
data: [],
prop: {
value: "system_id",
name: "system_name"
}
});
//获取职务下拉框
$.ajax({
type: 'GET',
async: false,
url: '/dsBase/dataShare/listSystem?page=1&limit=100&exclude=' + systemId,
success: function (res) {
systemSelect.update({
data: res.data
});
systemSelect.changeExpandedKeys(true);
getSubscribe();
}
});
function getSubscribe() {
$.ajax({
type: 'GET',
async: false,
url: '/dsBase/dataShare/getSystemById?system_id=' + systemId,
success: function (res) {
if (res.subscribe_system_ids != null) {
systemSelect.setValue(res.subscribe_system_ids.split(','));
}
}
});
}
form.on('submit(save)', function (data) {
console.log(data.field['subscribe_system_ids']);
var _data = {};
_data.system_id = systemId;
_data.subscribe_system_ids = data.field['subscribe_system_ids'];
$.ajax({
url: '/dsBase/dataShare/subscribe',
data: _data,
type: 'post',
success: function (result) {
if (result.success) {
layer.msg("保存成功!", {
icon: 1,
time: 1300
}, function () {
parent.layer.close(parent.layer.getFrameIndex(window.name));
parent.layui.table.reload("data-table");
});
} else {
layer.msg(result.message, {
icon: 2,
time: 2000
});
}
}
});
return false;
});
function GetQueryString(name, istop) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (typeof (istop) != "undefined") r = top.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
}
});
</script>
</body>
</html>