parent
458c9fec6e
commit
29da002650
@ -0,0 +1,172 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title></title>
|
||||||
|
<link rel="stylesheet" href="../layui/css/layui.css" />
|
||||||
|
<style>
|
||||||
|
.require-star {
|
||||||
|
position: absolute;
|
||||||
|
width: 3px;
|
||||||
|
height: 14px;
|
||||||
|
background-color: #ea4335;
|
||||||
|
top: 12px;
|
||||||
|
right: 8px;
|
||||||
|
border-radius: 1.5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-width {
|
||||||
|
width: 340px
|
||||||
|
}
|
||||||
|
|
||||||
|
.label-width {
|
||||||
|
width: 128px
|
||||||
|
}
|
||||||
|
|
||||||
|
.mainBox {
|
||||||
|
width: 100%;
|
||||||
|
position: absolute;
|
||||||
|
top: 0px;
|
||||||
|
left: 0px;
|
||||||
|
bottom: 50px;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-container {
|
||||||
|
margin: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-container {
|
||||||
|
position: absolute;
|
||||||
|
right: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom {
|
||||||
|
width: 100%;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0px;
|
||||||
|
left: 0px;
|
||||||
|
height: 50px;
|
||||||
|
line-height: 50px;
|
||||||
|
background-color: #F8F8F8;
|
||||||
|
border-top: 1px solid #eee;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<form class="layui-form" action="">
|
||||||
|
|
||||||
|
<div class="main-container">
|
||||||
|
|
||||||
|
<div id="ID-transfer-demo-showSearch"></div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="bottom">
|
||||||
|
<div class="button-container">
|
||||||
|
<button type="button" class="layui-btn layui-btn-sm" lay-submit="" lay-filter="save">
|
||||||
|
<i class="layui-icon layui-icon-ok"></i>
|
||||||
|
提 交
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<script src="../layui/layui.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
layui.use(function () {
|
||||||
|
var form = layui.form;
|
||||||
|
var $ = layui.jquery;
|
||||||
|
var laytpl = layui.laytpl;
|
||||||
|
|
||||||
|
var labelId = GetQueryString("label_id");
|
||||||
|
|
||||||
|
var selectedStation = [];
|
||||||
|
|
||||||
|
var transfer = layui.transfer;
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
async: false,
|
||||||
|
url: "/ZhuQue/label/getStationListByLabelId?label_id=" + labelId,
|
||||||
|
success: function (res) {
|
||||||
|
if (res.count > 0) {
|
||||||
|
selectedStation = res.data.map(item => item.station_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
async: false,
|
||||||
|
url: "/ZhuQue/label/getStationList",
|
||||||
|
success: function (res) {
|
||||||
|
transfer.render({
|
||||||
|
elem: '#ID-transfer-demo-showSearch',
|
||||||
|
id: 'station',
|
||||||
|
data: res.data,
|
||||||
|
value: selectedStation,
|
||||||
|
width: 300,
|
||||||
|
title: ['未设置', '已设置'],
|
||||||
|
showSearch: true,
|
||||||
|
parseData: function (res) { // 解析成规定的 data 格式
|
||||||
|
return {
|
||||||
|
"value": res.statinon_id,
|
||||||
|
"title": res.station_name
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
form.on('submit(save)', function (data) {
|
||||||
|
var getData = transfer.getData('station');
|
||||||
|
var resIds = getData.map(item => item.value).join(',');
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
async: false,
|
||||||
|
url: "/ZhuQue/label/saveStationListByLabelId",
|
||||||
|
data: {
|
||||||
|
"label_id": labelId,
|
||||||
|
"station_ids": resIds
|
||||||
|
},
|
||||||
|
success: function (res) {
|
||||||
|
if (res.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(res.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>
|
Loading…
Reference in new issue