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.
302 lines
13 KiB
302 lines
13 KiB
<!DOCTYPE html>
|
|
<html lang="cn">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Title</title>
|
|
<link rel="stylesheet" href="../../../lib/layui/css/layui.css">
|
|
<link rel="stylesheet" href="./projectList.css">
|
|
<style>
|
|
.bottom {
|
|
width: 100%;
|
|
position: absolute;
|
|
bottom: 0px;
|
|
left: 0px;
|
|
height: 50px;
|
|
line-height: 50px;
|
|
background-color: #FFF;
|
|
border-top: 1px solid #eee;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div class="layui-bg-gray" style="padding: 16px;">
|
|
|
|
<div class="layui-card" style="margin-bottom: 6px;">
|
|
<div class="layui-card-body">
|
|
<div style="display: flex;align-items: center;justify-content:start;">
|
|
<div
|
|
style="display: flex;align-items: center;justify-content:start;width: 50%;padding: 0 10px 0 10px;">
|
|
<label style="width: 100px;font-weight: bold;">任务名称:</label>
|
|
<input class="layui-input" id="subject_name" placeholder="请输入任务名称" />
|
|
</div>
|
|
<div
|
|
style="display: flex;align-items: center;justify-content:start;width: 10%;padding: 0 10px 0 10px;">
|
|
<button type="button" class="layui-btn layui-btn-radius layui-btn-sm" id="save"><i
|
|
class="layui-icon layui-icon-ok "
|
|
style="font-size: 20px;color: #fff;"></i> 确定</button>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="layui-card" style="margin-bottom: 6px;">
|
|
<div class="layui-card-header" style="font-weight: bold;">已选项目</div>
|
|
<div class="layui-card-body">
|
|
<div style="padding-left: 10px;padding-right: 10px;">
|
|
<table id="selectTableView" lay-filter="selectTableFilter"></table>
|
|
<script type="text/html" id="selectedDel">
|
|
<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" lay-event="delSelected">
|
|
<i class="layui-icon layui-icon-delete"></i>
|
|
</button>
|
|
</script>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="layui-card" style="margin-bottom: 6px;">
|
|
<div class="layui-card-header" style="font-weight: bold;">选择项目</div>
|
|
<div class="layui-card-body">
|
|
<div style="display: flex;align-items: center;justify-content:start;">
|
|
<div
|
|
style="display: flex;align-items: center;justify-content:start;width: 30%;padding: 0 10px 0 10px;">
|
|
<label style="width: 100px;">申报时间:</label>
|
|
<div id="sbsj" style="display: flex;align-items: center;width: 100%;">
|
|
<input type="text" autocomplete="off" id="startDate" class="layui-input" placeholder="开始日期">
|
|
  -  
|
|
<input type="text" autocomplete="off" id="endDate" class="layui-input" placeholder="结束日期">
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div
|
|
style="display: flex;align-items: center;justify-content:start;width: 20%;padding: 0 10px 0 10px;">
|
|
<label style="width: 100px;">关键字:</label>
|
|
<input class="layui-input" id="keyWord" placeholder="项目名称/项目单位" />
|
|
</div>
|
|
|
|
|
|
<div
|
|
style="display: flex;align-items: center;justify-content:start;width: 10%;padding: 0 10px 0 10px;">
|
|
<button type="button" class="layui-btn layui-btn-radius layui-btn-sm" id="search"><i
|
|
class="layui-icon layui-icon-search "
|
|
style="font-size: 20px;color: #fff;"></i> 查询</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div style="padding-left: 10px;padding-right: 10px;">
|
|
<table id="projectListTableView" lay-filter="tableFilter"></table>
|
|
</div>
|
|
|
|
<script type="text/html" id="switchOperate">
|
|
<input type="checkbox" name="status" value="{{= d.subject_id }}" lay-text="已选|未选" lay-skin="switch"
|
|
lay-filter="selectStatus" {{=d.selected == 1 ? "checked" : "" }} {{=d.in_ys > 0 ? "disabled lay-title=该项目已被其它任务使用!" : "" }} >
|
|
</script>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="../../../lib/layui/layui.js"></script>
|
|
<script src="../../../lib/jquery.min.js"></script>
|
|
<script src="../../../lib/layer/layer.js"></script>
|
|
|
|
<script>
|
|
layui.use(['table', 'laydate', 'form'], function () {
|
|
var table = layui.table
|
|
, laydate = layui.laydate
|
|
, element = layui.element
|
|
, form = layui.form
|
|
, $ = layui.jquery;
|
|
|
|
var stepCode = GetQueryString("step_code");
|
|
|
|
//定义已选择项目的数组
|
|
var selectedProjectList = [];
|
|
var selectedTableData = [];
|
|
var currentTableData;
|
|
|
|
|
|
$('body').on('mouseenter', '.layui-form-switch', function () {
|
|
var content = $(this).prev().attr('lay-title');
|
|
if (content != undefined) {
|
|
this.index = layer.tips(content, this, {
|
|
time: 2500,
|
|
maxWidth: 200,
|
|
tips: [1, '#3A3D49']
|
|
});
|
|
}
|
|
});
|
|
|
|
|
|
|
|
// 初始化
|
|
tableRender(stepCode);
|
|
|
|
function tableRender(stepCode) {
|
|
var subject_step_code = "0";
|
|
if(stepCode=="0203"){
|
|
subject_step_code = "0201";
|
|
}else{
|
|
subject_step_code = "0306";
|
|
}
|
|
table.render({
|
|
elem: '#projectListTableView'
|
|
, url: "/dsBase/expert/getSubjectListForSettingExpert"
|
|
, where: {
|
|
step_code: subject_step_code
|
|
, data_type: -1
|
|
, begin_date: $("#startDate").val()
|
|
, end_date: $("#endDate").val()
|
|
, keyword: $("#keyWord").val()
|
|
}
|
|
, cols: [[
|
|
{ field: '', title: '序号', align: 'center', type: 'numbers', width: "5%" }
|
|
, { field: 'task_number', width: "10%", title: '项目编号' }
|
|
, { field: 'xmmc', title: '项目名称' }
|
|
, { field: 'subject_type_name', width: "8%", title: '项目类型' }
|
|
, { field: 'xmdw', width: "18%", title: '项目单位' }
|
|
, { field: 'lixiang_time', width: "8%", title: '申报时间' }
|
|
, { width: "7%", title: '操作', templet: '#switchOperate', align: 'center' }
|
|
]]
|
|
, height: "full-470"
|
|
, autoSort: false //禁用前端自动排序
|
|
// ,skin: 'line' //表格风格
|
|
, even: true
|
|
, page: {
|
|
limit: 15
|
|
, layout: ['count', 'prev', 'page', 'next', 'skip']
|
|
, prev: "上一页"
|
|
, next: "下一页"
|
|
}
|
|
, parseData: function (res) { //res 即为原始返回的数据
|
|
for (var i in res.data) {
|
|
for (var element of selectedProjectList) {
|
|
if (element == res.data[i].subject_id) {
|
|
res.data[i]["selected"] = 1;
|
|
}
|
|
}
|
|
}
|
|
return {
|
|
"code": res.code,
|
|
"msg": res.msg,
|
|
"count": res.count,
|
|
"data": res.data
|
|
};
|
|
}, done: function () {
|
|
currentTableData = table.cache.projectListTableView;
|
|
}
|
|
});
|
|
}
|
|
|
|
selectedTableRender();
|
|
|
|
function selectedTableRender() {
|
|
table.render({
|
|
elem: '#selectTableView',
|
|
cols: [[
|
|
{ field: 'xmmc', title: '项目名称' },
|
|
{ field: 'subject_type_name', title: '项目类型', width: "15%" },
|
|
{ field: 'xmdw', title: '项目单位', width: "20%" },
|
|
{ field: 'money', title: '预算金额', width: "15%" },
|
|
{ title: '操作', width: "10%", toolbar: '#selectedDel', align: 'center' }
|
|
]],
|
|
height: "158",
|
|
data: selectedTableData
|
|
});
|
|
}
|
|
|
|
|
|
// 为弹出页调用
|
|
window.parentTableRender = function (stepCode) {
|
|
tableRender(stepCode);
|
|
};
|
|
|
|
form.on('switch(selectStatus)', function (obj) {
|
|
var subject_id = this.value;
|
|
if (obj.elem.checked) {
|
|
selectedProjectList.push(subject_id);
|
|
var selectedObj = currentTableData.find(item => item.subject_id == subject_id);
|
|
selectedTableData.push(selectedObj);
|
|
} else {
|
|
selectedProjectList = selectedProjectList.filter(item => item != subject_id);
|
|
selectedTableData = selectedTableData.filter(item => item.subject_id != subject_id);
|
|
}
|
|
selectedTableRender();
|
|
});
|
|
|
|
table.on('tool(selectTableFilter)', function (obj) {
|
|
if (obj.event === 'delSelected') {
|
|
var subject_id = obj.data.subject_id;
|
|
selectedProjectList = selectedProjectList.filter(item => item != subject_id);
|
|
selectedTableData = selectedTableData.filter(item => item.subject_id != subject_id);
|
|
selectedTableRender();
|
|
table.reload("projectListTableView");
|
|
}
|
|
});
|
|
|
|
laydate.render({
|
|
elem: '#sbsj'
|
|
, range: ['#startDate', '#endDate']
|
|
});
|
|
|
|
// 点击查询
|
|
$("#search").click(function () {
|
|
tableRender(stepCode);
|
|
});
|
|
|
|
|
|
$("#save").click(function () {
|
|
//判断数组selectedProjectList是否为空
|
|
if (selectedProjectList.length == 0) {
|
|
layer.msg('请选择项目!', {
|
|
icon: 2,
|
|
time: 2000
|
|
});
|
|
return;
|
|
}
|
|
//将数组selectedProjectList转换为字符串
|
|
var selectedProjectListStr = selectedProjectList.join(",");
|
|
$.ajax({
|
|
url: '/dsBase/gtzz/addYs',
|
|
data: { "ys_name": $("#subject_name").val(), "step_code": stepCode, "subject_ids": selectedProjectListStr },
|
|
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("schoolListTableView");
|
|
});
|
|
} else {
|
|
layer.msg(result.message, {
|
|
icon: 2,
|
|
time: 2000
|
|
});
|
|
}
|
|
}
|
|
})
|
|
});
|
|
|
|
|
|
// 获取参数值
|
|
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> |