| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553 |
- var selectedData = { cols: [], array: [] };
- var checkusersselect = null;
- var checkuserlist = new Array();
- var tabledatagride = null;
- var rowsDate;
- $(document).ready(function() {
- $.jeDate("#month_date", {
- isinitVal: true,
- format: 'YYYY/MM' // 分隔符可以任意定义,该例子表示只显示年月
- });
- $("#month_date").val(getCurrentTimeFormat());
- var checked_dept = null;
- if (roleContains("ROLE_WRECKER")) {
- checked_dept = getCurrentUser().organid;
- }
- setWreckerGroupSelect("#qzd", checked_dept);
- getpeople();
- //默认值 $("#qzd").val()
- var dd = 89;
- if ($("#qzd").val() != "") {
- dd = $("#qzd").val();
- }
- inittAreaable($("#month_date").val(), $("#qzd").val());
- initselecttable();
- laydate.render({
- elem: '#starttime',
- type: 'time'
- });
- laydate.render({
- elem: '#endtime',
- type: 'time'
- });
- });
- var recordlist = null;
- var stimemonth = null;
- function initselecttable() {
- selectedData = { cols: [], array: [], cache: false };
- selectedData.cols.push({ width: 0.3, name: "usernames", label: '人员', style: { 'text-align': 'center', 'line-height': '34px' } });
- selectedData.cols.push({ width: 0.5, name: "taskname", label: '任务名称', style: { 'text-align': 'center', 'line-height': '34px' } });
- selectedData.cols.push({ width: 0.1, name: "option", label: '操作', html: true, style: { 'text-align': 'center', 'line-height': '34px' } });
- reloadtable();
- }
- function reloadtable() {
- $('#selected_table').datagrid({
- dataSource: selectedData,
- states: { fixedTopUntil: 0 },
- rowDefaultHeight: 50,
- height: 200,
- });
- }
- var layindex = null;
- var taskMap = new HashMap();
- function inittAreaable(time, dept) {
- layindex = layer.load(0, { shade: false });
- var t = time.replace("/", "-") + "";
- var endtime = moment(t + "-25T23:00:00", "YYYY-MM-DD HH:mm:ss");
- var starttime = moment(moment(t + "-25T23:00:00", "YYYY-MM-DD HH:mm:ss").subtract(1, 'month'));
- var param1 = { "startTime": getMomentTimeFormat(starttime), "endTime": getMomentTimeFormat(endtime), "checked_dept": dept,"isComplete":1 }
- console.log(param1);
- //获取排班情况
- post_common_service("/q/record/getall/0/0", param1, function(redatatemp) {
- // console.log(redatatemp)
- var recodedata = redatatemp.records;
- //获取任务情况
- post_common_service("/q/task/getall/0/0", param1, function(taskdata) {
- taskMap = new HashMap();
- console.log(recodedata);
- recodedata.forEach(r => {
- taskdata.forEach(t => {
- if (r.id == t.record_id) {
- //该记录的任务
- r["task"] = t;
- }
- });
- var user = r.users.split(",");
- for (var i = 0; i < user.length; i++) {
- var key = user[i] + "_" + "" + moment(r.received_time).format("YYYY-MM-DD");
- if (taskMap.get(key) != null) {
- var list = taskMap.get(key);
- list.push(r);
- taskMap.set(key, list);
- } else {
- var list = [];
- list.push(r);
- taskMap.set(key, list);
- }
- }
- });
- });
- checkuserlist = redatatemp.checkusers;
- var userData = {
- "organid": dept
- };
- UserGetList(userData, function(redata) {
- layer.close(layer.index);
- var data = redata;
- datatemp = {
- data: data,
- t: t,
- starttime: starttime,
- endtime: endtime,
- time: time,
- records: recodedata
- };
- reloadtableData();
- $(".completec").mouseover(function() {
- var ids = this.id.split("_");
- var temp = moment(moment(t + "-25T23:00:00", "YYYY-MM-DD HH:mm:ss").subtract(1, 'month'));
- var currentday = temp.add(ids[1], "day");
- var key = ids[0] + "_" + currentday.format("YYYY-MM-DD");
- var temphtml = '';
- for(var i in taskMap.get(key)){
- if(taskMap.get(key)[i].id == ids[2]){
- var typename = '';
- if(taskMap.get(key)[i].type == 1){
- typename="抛锚";
- }else if(taskMap.get(key)[i].type == 2){
- typename="事故";
- }
- temphtml = '<tr><th>'+typename+'</th><th>'+taskMap.get(key)[i].addr+'</th><th>'+taskMap.get(key)[i].task.check_status_name+'</th></tr>';
- }
- }
- var titlehtml = '<table border=1 style="border:solid 1px;width:180px;"><tr><th>事件</th><th>桩号</th><th>状态</th></tr>' + temphtml + '</table>';
- layer.tips(titlehtml, "#" + this.id, {
- tips: [1, '#8e8e8e'],
- time: 0,
- width: '240px'
- });
- });
- $(".doingc").mouseover(function() {
- var ids = this.id.split("_");
- var temp = moment(moment(t + "-25T23:00:00", "YYYY-MM-DD HH:mm:ss").subtract(1, 'month'));
- var currentday = temp.add(ids[1], "day");
- var key = ids[0] + "_" + currentday.format("YYYY-MM-DD");
- for(var i in taskMap.get(key)){
- if(taskMap.get(key)[i].id == ids[2]){
- var typename = '';
- if(taskMap.get(key)[i].type == 1){
- typename="抛锚";
- }else if(taskMap.get(key)[i].type == 2){
- typename="事故";
- }
- temphtml = '<tr><th>'+typename+'</th><th>'+taskMap.get(key)[i].addr+'</th><th>'+taskMap.get(key)[i].task.check_status_name+'</th></tr>';
- }
- }
- var titlehtml = '<table border=1 style="border:solid 1px;width:180px;"><tr><th>事件</th><th>桩号</th><th>状态</th></tr>' + temphtml + '</table>';
- layer.tips(titlehtml, "#" + this.id, {
- tips: [1, '#8e8e8e'],
- time: 0,
- width: '240px'
- });
- });
- $(".unusec").mouseover(function() {
- var ids = this.id.split("_");
- var temp = moment(moment(t + "-25T23:00:00", "YYYY-MM-DD HH:mm:ss").subtract(1, 'month'));
- var currentday = temp.add(ids[1], "day");
- var key = ids[0] + "_" + currentday.format("YYYY-MM-DD");
- for(var i in taskMap.get(key)){
- if(taskMap.get(key)[i].id == ids[2]){
- var typename = '';
- if(taskMap.get(key)[i].type == 1){
- typename="抛锚";
- }else if(taskMap.get(key)[i].type == 2){
- typename="事故";
- }
- temphtml = '<tr><th>'+typename+'</th><th>'+taskMap.get(key)[i].addr+'</th><th>'+'无效'+'</th></tr>';
- }
- }
- var titlehtml = '<table border=1 style="border:solid 1px;width:180px;"><tr><th>事件</th><th>桩号</th><th>状态</th></tr>' + temphtml + '</table>';
- layer.tips(titlehtml, "#" + this.id, {
- tips: [1, '#8e8e8e'],
- time: 0,
- width: '240px'
- });
- });
- $(".novideoc").mouseover(function() {
- var ids = this.id.split("_");
- var temp = moment(moment(t + "-25T23:00:00", "YYYY-MM-DD HH:mm:ss").subtract(1, 'month'));
- var currentday = temp.add(ids[1], "day");
- var key = ids[0] + "_" + currentday.format("YYYY-MM-DD");
- for(var i in taskMap.get(key)){
- if(taskMap.get(key)[i].id == ids[2]){
- var typename = '';
- if(taskMap.get(key)[i].type == 1){
- typename="抛锚";
- }else if(taskMap.get(key)[i].type == 2){
- typename="事故";
- }
- temphtml = '<tr><th>'+typename+'</th><th>'+taskMap.get(key)[i].addr+'</th><th>'+'未上传视频'+'</th></tr>';
- }
- }
- var titlehtml = '<table border=1 style="border:solid 1px;width:180px;"><tr><th>事件</th><th>桩号</th><th>状态</th></tr>' + temphtml + '</table>';
- layer.tips(titlehtml, "#" + this.id, {
- tips: [1, '#8e8e8e'],
- time: 0,
- width: '240px'
- });
- });
- $(".btn,.btc").mouseout(function() {
- layer.close(layer.index);
- });
- $('#myTable05').fixedHeaderTable({ altClass: 'odd', footer: false, fixedColumns: 1 });
- for (var index in checkuserlist) {
- var p = checkuserlist[index];
- p.title = p.truename;
- }
- if (checkusersselect != null) {
- reset();
- checkusersselect = null;
- }
- checkusersselect = $('#check_users').comboTree({
- source: checkuserlist,
- isMultiple: true
- });
- });
- });
- }
- function setdatagrid() {
- }
- function reset() {
- initselecttable();
- var myDataGrid = $('#selected_table').data('zui.datagrid');
- myDataGrid.dataSource.data = null;
- myDataGrid.setDataSource(selectedData);
- myDataGrid.setPager(1, selectedData.array.length, selectedData.array.length);
- myDataGrid.render();
- if (checkusersselect != null) {
- $("#check_users").val("");
- checkusersselect.destroy();
- checkusersselect = null;
- }
- }
- function selectedTask(obj) {
- changeListItem(obj.id);
- }
- function removeListItem(obj) {
- var ids = obj.id.split("delete_");
- $("#" + ids[1]).parent().removeClass("active");
- $("#" + ids[1]).prop("checked", false);
- changeListItem(ids[1]);
- }
- function changeListItem(id) {
- var cobj;
- var tempids = id.split("_");
- var t = stimemonth.replace("/", "-") + "";
- var temp = moment(moment(t + "-25T23:00:00", "YYYY-MM-DD HH:mm:ss").subtract(1, 'month'));
- var currentday = temp.add(tempids[1], "day");
- var taskMapid = tempids[0] + "_" + currentday.format("YYYY-MM-DD");
- var cpeople;
- for (var index in datatemp.data) {
- var user = datatemp.data[index];
- if (user.id == tempids[0]) {
- cpeople = user;
- }
- }
- for (var i in taskMap.get(taskMapid)) {
- if (taskMap.get(taskMapid)[i].id == tempids[2]) {
- cobj = taskMap.get(taskMapid)[i];
- }
- }
- if ($("#" + id).prop('checked')) {
- activteChange(cobj, tempids);
- addlisttable(cobj, id);
- } else {
- activteRemove(cobj, tempids);
- removelisttable(cobj);
- }
- }
- function addlisttable(record, id) {
- var tempids = id.split("_");
- var t = stimemonth.replace("/", "-") + "";
- var temp = moment(moment(t + "-25T23:00:00", "YYYY-MM-DD HH:mm:ss").subtract(1, 'month'));
- var currentday = temp.add(tempids[1], "day");
- var typename;
- var stime = moment(record.received_time).format("HH:mm");
- var etime = moment(record.back_time).format("HH:mm");
- if(record.type == 1){
- typename="抛锚";
- }else if(record.type == 2){
- typename="事故";
- }
- var taskname = currentday.format("YYYY-MM-DD") + " " + stime + "~" + etime + " " + record.addr+"号桩" + typename+"清障任务";
- record.rname = taskname;
- var feeList = $.zui.store.get("cache_wrecker_group_list");
- var dept_info = null;
- for (var index in feeList) {
- var dept = feeList[index];
- if (record.dept == dept.deptid) {
- dept_info = dept;
- }
- }
- id = trim(id);
- var btn = '<button class="btn btn-primary" type="button" onclick="removeListItem(this)" id="delete_' + id + '">删除</button>';
- selectedData.array.push({ "usernames": record.userNames, "time": currentday.format("YYYY-MM-DD"), "dept_name": dept_info.name, "taskname": taskname, "option": btn, recordInfo: record, deptInfo: dept_info });
- var myDataGrid = $('#selected_table').data('zui.datagrid');
- myDataGrid.dataSource.data = null;
- myDataGrid.setDataSource(selectedData);
- myDataGrid.setPager(1, selectedData.array.length, selectedData.array.length);
- myDataGrid.render();
- }
- function removelisttable(record) {
- // console.log(record)
- for (var index in selectedData.array) {
- var o = selectedData.array[index];
- if (o != null && o.recordInfo.id == record.id) {
- selectedData.array.splice(index, 1);
- }
- }
- var myDataGrid = $('#selected_table').data('zui.datagrid');
- myDataGrid.dataSource.data = null;
- myDataGrid.setDataSource(selectedData);
- myDataGrid.setPager(1, selectedData.array.length, selectedData.array.length);
- myDataGrid.render();
- //reloadtable();
- }
- function search() {
- inittAreaable($("#month_date").val(), $("#qzd").val());
- }
- function addTask() {
- //获取列表
- var tasklist = selectedData.array;
- if (tasklist.length < 1) {
- layer.msg('未选择清障记录!', {
- time: 2000, //20s后自动关闭
- });
- return;
- }
- var check_user_list = checkusersselect.getSelectedItemsId();
- // var param = {
- // "name": obj.car,
- // "check_status": 2,
- // "start_time": moment(obj.peopleinfo.received_time).format("YYYY-MM-DD HH:mm:ss"),
- // "end_time": moment(obj.peopleinfo.back_time).format("YYYY-MM-DD HH:mm:ss"),
- // "checked_dept": obj.peopleinfo.dept,
- // "checkman": parseInt(check_user_list[u_index]),
- // "record_id": parseInt(obj.peopleinfo.id),
- // "checked_users": obj.peopleinfo.users,
- // "rule_id": 6
- // }
- // console.log(param);
- var plist = []
- tasklist.forEach(t => {
- plist.push(t.recordInfo);
- });
- // console.log(plist)
- var param = { "userids": check_user_list, "qzdRecord": plist };
- post_common_service('/q/task/add', param, function(redata) {
- layer.msg('已添加', { icon: 1 });
- inittAreaable($("#month_date").val(), $("#qzd").val());
- });
- // post_common_service('/f/task/add', param, function(redata) {
- // // layer.msg('已添加', { icon: 1 });
- // inittAreaable($("#month_date").val(), $("#qzd").val());
- // });
- }
- function getpeople() {
- // var orginid = $("#qzd").val();
- // var userData = {
- // "organid": orginid
- // }
- }
- function activteChange(cobj, tempids) {
- var usersids = cobj.users.split(",");
- if (usersids.length > 1) {
- for (var j in usersids) {
- var objid = usersids[j] + "_" + tempids[1] + "_" + tempids[2];
- if ($("#" + objid).prop('checked') == false) {
- $("#" + objid).parent().addClass("active");
- $("#" + objid).prop("checked", true);
- }
- }
- }
- }
- function activteRemove(cobj, tempids) {
- var usersids = cobj.users.split(",");
- if (usersids.length > 1) {
- for (var j in usersids) {
- var objid = usersids[j] + "_" + tempids[1] + "_" + tempids[2];
- if ($("#" + objid).prop('checked')) {
- $("#" + objid).parent().removeClass("active");
- $("#" + objid).prop("checked", false);
- }
- }
- }
- }
- var userlist = null;
- var stimemonth = null;
- var datatemp = {};
- function reloadtableData() {
- var data = datatemp.data;
- var t = datatemp.t;
- var starttime = datatemp.starttime;
- var endtime = datatemp.endtime;
- var time = datatemp.time;
- datac = { cols: [], array: [] };
- var days = endtime.diff(starttime, 'days');
- datac.cols.push({ width: 200, name: 'type', label: "", });
- var tbhtml = "";
- var thhtml = "<thead><tr>";
- var tbodyhtml = "<tbody>";
- thhtml += "<th>" + "<button class='datatime' onclick='selectedall(this)' id='datatimebtn_" + i + "' style='width:100px;height:100%;background:rgba(0,0,0,0)'></button>" + "</th>";
- for (var i = 1; i <= days; i++) {
- var temp = moment(moment(t + "-25T23:00:00", "YYYY-MM-DD HH:mm:ss").subtract(1, 'month'));
- var currentday = temp.add(i, "day");
- var day = currentday.date();
- thhtml += "<th>" + "<button class='datatime' onclick='selectedall(this)' id='datatimebtn_" + i + "' style='width:100px;height:100%;background:rgba(0,0,0,0)'>" + currentday.format("MM-DD") + "</button>" + "</th>";
- // datac.cols.push({ width: 80, name: "day_" + i, label: "<button class='datatime' onclick='selectedall(this)' id='datatimebtn_" + i + "' style='width:100%;height:100%;background:rgba(0,0,0,0)'>" + currentday.format("MM-DD") + "</button>", html: true, className: "table_content" });
- }
- thhtml += "</tr></thead>";
- tbhtml += thhtml;
- userlist = data;
- stimemonth = time;
- for (var index in data) {
- var user = data[index];
- tbodyhtml += "<tr>";
- tbodyhtml += "<td style='vertical-align:middle'><label style='width:100px;margin:0'>" + user.truename + "</label></td>";
- for (var i = 1; i <= days; i++) {
- //内容
- var temp = moment(moment(t + "-25T23:00:00", "YYYY-MM-DD HH:mm:ss").subtract(1, 'month'));
- var currentday = temp.add(i, "day");
- var key = user.id + "_" + currentday.format("YYYY-MM-DD");
- var temphtml = "";
- tbodyhtml += "<td>";
- if (taskMap.get(key) != null) {
- //存在稽查记录
- var list = taskMap.get(key);
- list.forEach(r => {
- var t = r.task;
- //未生成任务
- if (t == null) {
- // if(r.isApply == 1){
- // temphtml += '<button data-toggle="button" class="btc noAppy" style="margin:10px;background:#FFDEAD;border-color:#FFDEAD;color:#fff" type="button" id="' + user.id + '_' + i + '_' + r.id + '">' + moment(r.received_time).format("HH:mm") + "放空任务" + '</button>';
- // }else{
- if (r.videos == null || r.videos == undefined || r.videos == "") {
- if(r.pics == null || r.pics == undefined || r.pics == ""){
- temphtml += '<button data-toggle="button" class="btc novideoc" style="margin:10px;background:#fff;border-color:#fff;color:#03b8cf" type="button" id="' + user.id + '_' + i + '_' + r.id + '">' + moment(r.received_time).format("HH:mm") + "~" + moment(r.back_time).format("HH:mm") + '</button>';
- }else{
- temphtml += '<div class="btn-group normal" style="margin:10px;" data-toggle="buttons" id="btn_u_' + user.id + '_r_' + r.id + '"> <label class="btn btn-info7 "> <input type="checkbox" onchange="selectedTask(this)" id="' + user.id + '_' + i + '_' + r.id + '">' + moment(r.received_time).format("HH:mm") + "~" + moment(r.back_time).format("HH:mm") + '</label></div>';
- }
- } else {
- temphtml += '<div class="btn-group normal" style="margin:10px;" data-toggle="buttons" id="btn_u_' + user.id + '_r_' + r.id + '"> <label class="btn btn-info2 "> <input type="checkbox" onchange="selectedTask(this)" id="' + user.id + '_' + i + '_' + r.id + '">' + moment(r.received_time).format("HH:mm") + "~" + moment(r.back_time).format("HH:mm") + '</label></div>';
- //temphtml += '<button data-toggle="button" class="btc normal" style="margin:10px" onclick="selectedTask(this)" type="button" id="' + user.id + '_' + i + '_' + r.id + '">' + moment(r.received_time).format("HH:mm") + "~" + moment(r.back_time).format("HH:mm") + '</button>';
- }
- // }
-
- } else
- if (t.check_status == 2 || t.check_status == 7) {
- //考核进行中
- temphtml += '<button data-toggle="button" class="btc doingc" style="margin:10px" type="button" id="' + user.id + '_' + i + '_' + r.id + '">' + moment(r.received_time).format("HH:mm") + "~" + moment(r.back_time).format("HH:mm") + '</button>';
- } else
- if (t.check_status == 22) {
- //存在无效任务
- temphtml += '<button data-toggle="button" class="btc unusec" style="margin:10px" type="button" id="' + user.id + '_' + i + '_' + r.id + '">' + moment(r.received_time).format("HH:mm") + "~" + moment(r.back_time).format("HH:mm") + '</button>';
- } else {
- //完成稽查
- temphtml += '<button data-toggle="button" class="btc completec" style="margin:10px;" type="button" id="' + user.id + '_' + i + '_' + r.id + '">' + moment(r.received_time).format("HH:mm") + "~" + moment(r.back_time).format("HH:mm") + '</button>';
- }
- });
- }
- tbodyhtml += temphtml;
- tbodyhtml += "</td>";
- }
- tbodyhtml += "</tr>";
- }
- tbodyhtml += "</tbody>";
- tbhtml += tbodyhtml;
- $("#table_html").html('<table class="fancyTable" id="myTable05" cellpadding="0" cellspacing="0"> </table>');
- $("#myTable05").html(tbhtml)
- }
|