| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333 |
- var cur_status;
- var cur_page;
- var is_save;
- var updateid = null;
- var user = $.zui.store.get("user");
- var recordId = '';
- var recordVideos = '';
- function initTaskPage() {
- initQueryParams();
- initTableRowBtn();
- queryTask();
- getRecord();
- }
- function initQueryParams() {
- // 仅选择日期
- $.jeDate("#start_time", {
- isinitVal: true,
- format: 'YYYY/MM' // 分隔符可以任意定义,该例子表示只显示年月
- });
- $("#start_time").val(getCurrentTimeFormat());
- var page_params = $.zui.store.get("page_params");
- if (page_params && page_params.status) {
- cur_status = page_params.status;
- }
- var checked_dept = null;
- if (roleContains("WRECKER")) {
- checked_dept = getCurrentUser().organid;
- }
- if (checked_dept) {
- var optStr = '<option value="' + checked_dept + '" selected="selected">' + getCurrentUser().organname + '</option>';
- $("#deptlist").html('');
- $("#deptlist").html(optStr);
- $("#deptlist").attr('disabled', 'disabled')
- } else {
- setWreckerGroupAllSelect("#deptlist");
- }
- setWreckerGroupSelect("#dept", checked_dept);
- if (hasRole(ROLE_JICHA_ADMIN) && cur_status == 4) {
- $("#dispatchPatchBtn").show();
- $("#dispatchAllNoScoreBtn").show();
- }
- if (roleContains("STATION") && cur_status == 5) {
- $("#confirmPatchBtn").show();
- }
- $("#checkPersonDiv").show();
- if (cur_status == 4 || cur_status == 5 || cur_status == 6) {
- $("#hasScoreDiv").show();
- }
- }
- //初始化表行按钮
- function initTableRowBtn() {
- $.zui.store.set("task_table_btn_1", [{ func: 'checkUpdate', text: '修改', icon_class: '' },
- { func: 'deleteRecord', text: '删除', icon_class: 'text-center' }
- ]);
- $.zui.store.set("task_table_btn_2", [{ func: 'showCheck', text: '开始稽查', icon_class: 'icon-eye-open' }]);
- // $.zui.store.set("task_table_btn_2", [{ func: 'showCheck', text: '开始稽查', icon_class: 'icon-eye-open' }]);
- // $.zui.store.set("task_table_btn_3", [{ func: 'showCheck', text: '开始稽查', icon_class: 'icon-eye-open' }]);
- // $.zui.store.set("task_table_btn_7", [{ func: 'showContinueCheck', text: '继续稽查', icon_class: 'icon-eye-open' }]);
- // $.zui.store.set("task_table_btn_4", [{ func: 'showTaskDetail', text: '详情', icon_class: 'icon-tasks' },
- // { func: 'dispatchTaskById', text: '下发', icon_class: 'icon-signin' }
- // ]);
- // $.zui.store.set("task_table_btn_5", [{ func: 'showTaskDetail', text: '详情', icon_class: 'icon-tasks' }]);
- // $.zui.store.set("task_table_btn_6", [{ func: 'showTaskDetail', text: '详情', icon_class: 'icon-tasks' }]);
- // $.zui.store.set("task_table_btn_21", [{ func: 'showApplyDetail', text: '处理', icon_class: 'icon-hand-up' }]);
- }
- //查询任务
- function queryTask() {
- console.log(user.roles[0]);
- var t = getTimeByMonth(GV("#start_time"));
- var data = {
- "startTime": getMomentTimeFormat(t.starttime),
- "endTime": getMomentTimeFormat(t.endtime),
- "dept": $("#deptlist").val(),
- // "check_status": cur_status
- };
- var hide = false;
- if (hasRole(ROLE_WRECKER_MANAGER) || hasRole(ROLE_WRECKER) || hasRole(ROLE_JICHA) || roleContains('ROLE_WRECKER')) {
- hide = true;
- }
- var cols = [
- { width: 80, text: '序号', type: 'number', flex: true, colClass: 'text-center', field: 'num' },
- { width: 80, text: '清障队', type: 'string', flex: true, colClass: 'text-center', sort: 'down', field: 'deptName' },
- { width: 80, text: '桩号', type: 'string', flex: true, colClass: 'text-center', sort: 'down', field: 'addr' },
- { width: 80, text: '车牌号', type: 'string', flex: true, hide: hide, colClass: 'text-center', field: 'car_info' },
- { width: 80, text: '客户信息', type: 'string', flex: true, sort: 'down', colClass: 'text-center', field: 'car_user_info' },
- { width: 120, text: '接警时间', type: 'string', flex: true, sort: 'down', colClass: 'text-center', field: 'received_time' },
- { width: 160, text: '出勤人员', type: 'string', flex: true, sort: 'down', colClass: 'text-center', field: 'userNames' },
- // {width: 120, text: '状态', type: 'string', flex: true, colClass: '',field: 'check_status_name'}
- ];
- if (user.roles[0].id == 20 || user.roles[0].id == 21) {
- var colFunc = { width: 160, text: '操作', type: 'string', flex: true, field: 'id', colClass: 'text-center' };
- colFunc.oper = $.zui.store.get("task_table_btn_1");
- cols.push(colFunc);
- $("#saveButton").show();
- } else if (user.roles[0].id == 16 || user.roles[0].id == 17) {
- var colFunc = { width: 160, text: '操作', type: 'imagebutton', flex: true, field: 'videos', colClass: 'text-center' };
- colFunc.oper = $.zui.store.get("task_table_btn_1");
- cols.push(colFunc);
- }
- //只有下发才显示复选框
- var checkable = false;
- if ((hasRole(ROLE_JICHA_ADMIN) && cur_status == 4) || (roleContains("STATION") && cur_status == 5)) {
- checkable = true;
- }
- // console.log("checkable:" + checkable);
- // if (cur_status == 2 || cur_status == 3) {
- // data.check_status_arr = [2, 3];
- // data.check_status = null;
- // }
- taskTableObj = $('#task_list_table').mytable({
- 'cols': cols,
- 'checkable': checkable,
- 'url': "/q/record/getall/",
- 'param': data,
- 'pager': {
- 'p_cur': cur_page
- },
- renderfunction: function() {
- // console.log("-------------------------")
- $(".uploadervideo").each(function() {
- $(this).uploader({
- autoUpload: true, // 当选择文件后立即自动进行上传操作
- url: base_image_server_url + 'fileServer/file/upload', // 文件上传提交地址
- chunk_size: 0,
- filters: {
- mime_types: [{
- title: '视频',
- extensions: 'mp4,avi'
- }],
- // 不允许上传重复文件
- prevent_duplicates: true
- },
- onFileUploaded: function(file, responseObject) {
- var file_src = recordVideos;
- var datas = eval('(' + responseObject.response + ')');
- if (file_src != '' && file_src != null && file_src != undefined) {
- file_src += "," + datas.result_data.path;
- } else {
- file_src += datas.result_data.path;
- }
- var data = {
- "videos": file_src,
- "id": recordId
- };
- post_common_service('q/record/update', data, function(redata) {
- queryTask();
- });
- },
- onFilesRemoved: function(files) {
- // alert(files);
- }
- });
- });
- }
- });
- $.zui.store.set('store_param_' + current_url, data);
- }
- function addTask() {
- is_save = 0;
- resert();
- // var contenthtml = base_ui_url+'qzd/view/task/addtask.html';
- // document.getElementById("addrecord").href = contenthtml;
- $('#addModal').modal('show');
- }
- function openUpload() {
- return $("#fileupload").click();
- }
- function checkUpdate(id) {
- resert();
- is_save = "_" + id;
- var data = {
- "id": id
- };
- post_common_service('q/record/one', data, function(redata) {
- $('#addModal').modal('show');
- $("#type").val(redata.type);
- $("#carinfo").val(redata.car_info);
- var time = moment(redata.arrive_time).format("YYYY-MM-DD HH:mm:ss");
- $("#arrive_time").val(time);
- time = moment(redata.received_time).format("YYYY-MM-DD HH:mm:ss");
- $("#received_time").val(time);
- time = moment(redata.start_time).format("YYYY-MM-DD HH:mm:ss");
- $("#startTime").val(time);
- time = moment(redata.back_time).format("YYYY-MM-DD HH:mm:ss");
- $("#back_time").val(time);
- time = moment(redata.backfield_time).format("YYYY-MM-DD HH:mm:ss");
- $("#backfield_time").val(time);
- time = moment(redata.delivery_time).format("YYYY-MM-DD HH:mm:ss");
- $("#delivery_time").val(time);
- time = moment(redata.accept_time).format("YYYY-MM-DD HH:mm:ss");
- $("#accept_time").val(time);
- time = moment(redata.rescue_time).format("YYYY-MM-DD HH:mm:ss");
- $("#rescue_time").val(time);
- time = moment(redata.relief_time).format("YYYY-MM-DD HH:mm:ss");
- $("#relief_time").val(time);
- $("#carUserinfo").val(redata.car_user_info);
- $("#dept").val(redata.dept);
- $("#carUserSatisfaction").val(redata.car_user_satisfaction);
- var userids = redata.users.split(",");
- for (var i in userids) {
- $('span[data-id="' + userids[i] + '"] input').click();
- }
- $("#recordUser").val(redata.userNames);
- $("#addr").val(redata.addr);
- })
- }
- function deleteRecord(id) {
- var data = {
- "id": id
- };
- post_common_service('q/record/delete', data, function(redata) {
- queryTask();
- });
- }
- function resert() {
- $("#type").val('1');
- $("#carinfo").val('');
- $("#arrive_time").val('');
- $("#received_time").val('');
- $("#startTime").val('');
- $("#back_time").val('');
- $("#backfield_time").val('');
- $("#delivery_time").val('');
- $("#accept_time").val('');
- $("#rescue_time").val('');
- $("#carUserinfo").val('');
- $("#dept").val('');
- $("#carUserSatisfaction").val('');
- $(".ComboTreeItemChlid").find("input").prop('checked', false);
- $("#recordUser").val('');
- $("#addr").val('');
- }
- function getRecord() {
- // var t = getTimeByMonth(GV("#start_time"));
- // var data = {
- // "startTime": getMomentTimeFormat(t.starttime),
- // "endTime": getMomentTimeFormat(t.endtime),
- // "dept": $("#deptlist").val(),
- // // "check_status": cur_status
- // };
- // post_common_service('q/record/getall/0/0', data, function(redata) {
- // console.log(redata);
- // for (var index in redata.records) {
- // var obj = redata.records[index];
- // var file_src = recordVideos;
- // $("#uploaderExample_" + obj.id).uploader({
- // autoUpload: true, // 当选择文件后立即自动进行上传操作
- // url: base_image_server_url + 'fileServer/file/upload', // 文件上传提交地址
- // chunk_size: 0,
- // filters: {
- // mime_types: [{
- // title: '视频',
- // extensions: 'mp4,avi'
- // }],
- // // 不允许上传重复文件
- // prevent_duplicates: true
- // },
- // onFileUploaded: function(file, responseObject) {
- // var datas = eval('(' + responseObject.response + ')');
- // if (file_src != '' && file_src != null) {
- // file_src += "," + datas.result_data.path;
- // } else {
- // file_src += datas.result_data.path;
- // }
- // var data = {
- // "videos": file_src,
- // "id": recordId
- // };
- // post_common_service('q/record/update', data, function(redata) {
- // queryTask();
- // });
- // },
- // onFilesRemoved: function(files) {
- // // alert(files);
- // }
- // });
- // }
- // });
- }
- function setRecordId(id, videos) {
- recordVideos = videos;
- recordId = id;
- }
- function removeVideo(id, videos, index) {
- var p = "";
- var recordVideos = videos;
- var recordId = id;
- var vvs = recordVideos.split(",");
- for (var i = 0; i < vvs.length; i++) {
- console.log(vvs)
- if (vvs[i].length > 0 && i != index) {
- p += vvs[i] + ",";
- }
- }
- p = p.substring(0, p.length - 1);
- var data = {
- "videos": p,
- "id": recordId
- };
- post_common_service('q/record/update', data, function(redata) {
- queryTask();
- });
- }
|