|
|
|
@ -23,14 +23,16 @@
|
|
|
|
|
.leftBox {
|
|
|
|
|
float: left;
|
|
|
|
|
width: 750px;
|
|
|
|
|
height: 600px;
|
|
|
|
|
height: 500px;
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
margin-top: 0px;
|
|
|
|
|
clear: both;
|
|
|
|
|
border: 1px solid #cccccc;
|
|
|
|
|
border-radius: 6px;
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#span {
|
|
|
|
|
float: right;
|
|
|
|
|
top: 30px;
|
|
|
|
@ -38,7 +40,6 @@
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.nameBox {
|
|
|
|
|
width: 100px;
|
|
|
|
|
height: 40px;
|
|
|
|
@ -54,15 +55,11 @@
|
|
|
|
|
.selectedName {
|
|
|
|
|
float: right;
|
|
|
|
|
width: 430px;
|
|
|
|
|
height: 600px;
|
|
|
|
|
height: 500px;
|
|
|
|
|
border: 1px solid #cccccc;
|
|
|
|
|
border-radius: 6px;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
h1 {
|
|
|
|
|
text-align: center;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
</head>
|
|
|
|
|
|
|
|
|
@ -86,14 +83,18 @@
|
|
|
|
|
<label class="layui-form-label" style="width: auto;">分类:</label>
|
|
|
|
|
<div class="layui-input-inline" id="fenlei" style="width: 446px;"></div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="layui-form-item layui-inline">
|
|
|
|
|
<button type="button" class="layui-btn" id="screen"><i
|
|
|
|
|
class="layui-icon layui-icon-search"></i>专家筛选</button>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- <div class="layui-form-item layui-inline">
|
|
|
|
|
<label class="layui-form-label" style="width: auto;">抽取人数:</label>
|
|
|
|
|
<div class="layui-input-inline" style="width: 100px;">
|
|
|
|
|
<input type="number" id="personCount" value="3" placeholder="" autocomplete="off"
|
|
|
|
|
class="layui-input" min="1" max="20" step="1" lay-affix="number">
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div> -->
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
@ -116,43 +117,32 @@
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<button type="button" class="layui-btn layui-bg-orange" id="btn" value="开始抽取">开始抽取</button>
|
|
|
|
|
<button type="button" class="layui-btn layui-bg-blue" id="save">保存结果</button>
|
|
|
|
|
<div class="layui-form-item layui-inline">
|
|
|
|
|
<label class="layui-form-label" style="width: auto;padding: 9px 0 !important;">抽取人数:</label>
|
|
|
|
|
<div class="layui-input-inline" style="width: 63px;">
|
|
|
|
|
<input type="number" id="personCount" value="3" placeholder="" autocomplete="off" class="layui-input"
|
|
|
|
|
min="1" max="20" step="1" lay-affix="number">
|
|
|
|
|
</div>
|
|
|
|
|
<button type="button" class="layui-btn layui-bg-orange" id="btn" value="开始抽取">开始抽取</button>
|
|
|
|
|
<button type="button" class="layui-btn layui-bg-blue" id="save">保存结果</button>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
layui.use('table', function () {
|
|
|
|
|
var table = layui.table;
|
|
|
|
|
var arr = [
|
|
|
|
|
{ "id": "1", "name": "吉帆", "tel": "13888888881", "org_name": "单位1" },
|
|
|
|
|
{ "id": "2", "name": "静慧", "tel": "13888888882", "org_name": "单位2" },
|
|
|
|
|
{ "id": "3", "name": "嘉歆", "tel": "13888888883", "org_name": "单位3" },
|
|
|
|
|
{ "id": "4", "name": "金枝", "tel": "13888888884", "org_name": "单位4" },
|
|
|
|
|
{ "id": "5", "name": "王大妈", "tel": "13888888885", "org_name": "单位5" },
|
|
|
|
|
{ "id": "6", "name": "老王", "tel": "13888888886", "org_name": "单位6" },
|
|
|
|
|
{ "id": "7", "name": "刘疙瘩", "tel": "13888888887", "org_name": "单位7" },
|
|
|
|
|
{ "id": "8", "name": "杨伟", "tel": "13888888888", "org_name": "单位8" },
|
|
|
|
|
{ "id": "9", "name": "韩晁", "tel": "13888888889", "org_name": "单位9" },
|
|
|
|
|
{ "id": "10", "name": "静涵", "tel": "13888888810", "org_name": "单位10" },
|
|
|
|
|
{ "id": "11", "name": "静曼", "tel": "13888888811", "org_name": "单位11" },
|
|
|
|
|
{ "id": "12", "name": "晶晶", "tel": "13888888812", "org_name": "单位12" },
|
|
|
|
|
{ "id": "13", "name": "靓影", "tel": "13888888813", "org_name": "单位13" },
|
|
|
|
|
{ "id": "14", "name": "嘉宝", "tel": "13888888814", "org_name": "单位14" },
|
|
|
|
|
{ "id": "15", "name": "李静", "tel": "13888888815", "org_name": "单位15" },
|
|
|
|
|
{ "id": "16", "name": "李志", "tel": "13888888816", "org_name": "单位16" },
|
|
|
|
|
{ "id": "17", "name": "李伟", "tel": "13888888817", "org_name": "单位17" },
|
|
|
|
|
{ "id": "18", "name": "家美", "tel": "13888888818", "org_name": "单位18" },
|
|
|
|
|
{ "id": "19", "name": "玉叶", "tel": "13888888819", "org_name": "单位19" },
|
|
|
|
|
{ "id": "20", "name": "静恬", "tel": "13888888820", "org_name": "单位20" },
|
|
|
|
|
{ "id": "21", "name": "王飞", "tel": "13888888821", "org_name": "单位21" }
|
|
|
|
|
];
|
|
|
|
|
var arr = [];
|
|
|
|
|
|
|
|
|
|
var tableData = [];
|
|
|
|
|
|
|
|
|
|
var lingyuSelectArr = [1, 2, 3, 4, 5, 6, 7, 8];
|
|
|
|
|
var fenleiSelectArr = [3, 4];
|
|
|
|
|
|
|
|
|
|
var orgArrCount = arr.length;
|
|
|
|
|
var currentSelectNum = 0;
|
|
|
|
|
|
|
|
|
|
initForm();
|
|
|
|
|
var ysId = GetQueryString("ys_id");
|
|
|
|
|
|
|
|
|
|
var lingyuSelect = xmSelect.render({
|
|
|
|
|
el: '#lingyu',
|
|
|
|
@ -185,7 +175,7 @@
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
lingyuSelect.setValue([1, 2, 3, 4, 5, 6, 7, 8]);
|
|
|
|
|
lingyuSelect.setValue(lingyuSelectArr);
|
|
|
|
|
|
|
|
|
|
var fenleiSelect = xmSelect.render({
|
|
|
|
|
el: '#fenlei',
|
|
|
|
@ -216,7 +206,9 @@
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
fenleiSelect.setValue([1, 2, 3, 4, 5, 6]);
|
|
|
|
|
fenleiSelect.setValue(fenleiSelectArr);
|
|
|
|
|
|
|
|
|
|
initForm();
|
|
|
|
|
|
|
|
|
|
// 初始化表单
|
|
|
|
|
function initForm() {
|
|
|
|
@ -227,11 +219,18 @@
|
|
|
|
|
// 动态创建层
|
|
|
|
|
function dynamicCreateBox() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: "GET",
|
|
|
|
|
async: false,
|
|
|
|
|
url: "/QingLong/zjcq/getZjcqList?lx_ids=" + fenleiSelectArr.join(',') + "&ly_ids=" + lingyuSelectArr.join(','),
|
|
|
|
|
success: function (res) {
|
|
|
|
|
arr = res;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < arr.length; i++) {
|
|
|
|
|
var div = document.createElement("div");
|
|
|
|
|
div.innerText = arr[i].name;
|
|
|
|
|
div.innerText = arr[i].xm;
|
|
|
|
|
div.className = "nameBox";
|
|
|
|
|
$("#leftBox").append(div);
|
|
|
|
|
};
|
|
|
|
@ -252,7 +251,7 @@
|
|
|
|
|
function setBoxColor() {
|
|
|
|
|
$("#leftBox").children("div").each(function () {
|
|
|
|
|
var thisText = ($(this).text());
|
|
|
|
|
var selectedName = arr[currentSelectNum].name;
|
|
|
|
|
var selectedName = arr[currentSelectNum].xm;
|
|
|
|
|
|
|
|
|
|
if (thisText == selectedName) {
|
|
|
|
|
$(this).css({
|
|
|
|
@ -266,7 +265,7 @@
|
|
|
|
|
function setFinalColor(_index) {
|
|
|
|
|
$("#leftBox").children("div").each(function () {
|
|
|
|
|
var thisText = ($(this).text());
|
|
|
|
|
var selectedName = arr[_index].name;
|
|
|
|
|
var selectedName = arr[_index].xm;
|
|
|
|
|
|
|
|
|
|
if (thisText == selectedName) {
|
|
|
|
|
// $(this).css("background-color", "#ffb800");
|
|
|
|
@ -295,11 +294,6 @@
|
|
|
|
|
} while (arrTemp.includes(num));
|
|
|
|
|
arrTemp.push(num);
|
|
|
|
|
|
|
|
|
|
// var div = document.createElement("div");
|
|
|
|
|
// div.innerText = arr[num].name;
|
|
|
|
|
// div.className = "nameBox";
|
|
|
|
|
// $("#selectedName").append(div);
|
|
|
|
|
|
|
|
|
|
tableData.push(arr[num]);
|
|
|
|
|
|
|
|
|
|
setFinalColor(num);
|
|
|
|
@ -307,9 +301,62 @@
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("#screen").click(function () {
|
|
|
|
|
if (lingyuSelect.getValue().length == 0 || fenleiSelect.getValue().length == 0) {
|
|
|
|
|
alert("请选择领域或分类");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var fenleiSelectIds = fenleiSelect.getValue().map(function (item) {
|
|
|
|
|
return item.id;
|
|
|
|
|
}).join(',');
|
|
|
|
|
|
|
|
|
|
var lingyuSelectIds = lingyuSelect.getValue().map(function (item) {
|
|
|
|
|
return item.id;
|
|
|
|
|
}).join(',');
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: "GET",
|
|
|
|
|
async: false,
|
|
|
|
|
url: "/QingLong/zjcq/getZjcqList?lx_ids=" + fenleiSelectIds + "&ly_ids=" + lingyuSelectIds,
|
|
|
|
|
success: function (res) {
|
|
|
|
|
arr = res;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('#leftBox').empty();
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < arr.length; i++) {
|
|
|
|
|
var div = document.createElement("div");
|
|
|
|
|
div.innerText = arr[i].xm;
|
|
|
|
|
div.className = "nameBox";
|
|
|
|
|
$("#leftBox").append(div);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$("#save").click(function () {
|
|
|
|
|
console.log(lingyuSelect.getValue());
|
|
|
|
|
console.log(tableData);
|
|
|
|
|
if (tableData.length == 0) {
|
|
|
|
|
alert("请先抽取专家");
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
var personIds = tableData.map(function (item) {
|
|
|
|
|
return item.person_id;
|
|
|
|
|
}).join(',');
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
type: "POST",
|
|
|
|
|
dataType: "json",
|
|
|
|
|
url: "/QingLong/zjcq/saveZjcq",
|
|
|
|
|
data: {
|
|
|
|
|
"ys_id": ysId,
|
|
|
|
|
"person_ids": personIds
|
|
|
|
|
},
|
|
|
|
|
success: function (res) {
|
|
|
|
|
console.log(res);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('#btn').click(function () {
|
|
|
|
@ -332,7 +379,7 @@
|
|
|
|
|
// 设置选中小方格颜色
|
|
|
|
|
setBoxColor();
|
|
|
|
|
|
|
|
|
|
}, 30);
|
|
|
|
|
}, 10);
|
|
|
|
|
this.value = "停止";
|
|
|
|
|
this.innerHTML = "停止";
|
|
|
|
|
|
|
|
|
@ -356,11 +403,11 @@
|
|
|
|
|
elem: '#tableData',
|
|
|
|
|
cols: [[ //标题栏
|
|
|
|
|
{ title: '序号', align: 'center', type: 'numbers', width: 50 },
|
|
|
|
|
{ field: 'name', align: 'center', title: '姓名', width: 75 },
|
|
|
|
|
{ field: 'tel', align: 'center', title: '电话', width: 125 },
|
|
|
|
|
{ field: 'org_name', title: '单位', width: 175 }
|
|
|
|
|
{ field: 'xm', align: 'center', title: '姓名', width: 75 },
|
|
|
|
|
{ field: 'telephone', align: 'center', title: '电话', width: 125 },
|
|
|
|
|
{ field: 'dw', title: '单位', width: 175 }
|
|
|
|
|
]],
|
|
|
|
|
height: '600',
|
|
|
|
|
height: '500',
|
|
|
|
|
data: tableData,
|
|
|
|
|
cellExpandedMode: "tips",
|
|
|
|
|
page: false, // 是否显示分页
|
|
|
|
@ -374,6 +421,15 @@
|
|
|
|
|
return Math.floor(Math.random() * (max - min + 1)) + min; // 返回介于min和max之间的整数
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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>
|
|
|
|
|
|
|
|
|
|