| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225 |
- var cur_status;
- var cur_page;
- var is_save;
- var updateid = null;
- var user = $.zui.store.get("user")
- $("#fileupload").change(function() {
- UpladFile();
- });
- 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("FWQ")) {
- checked_dept = getCurrentUser().organid;
- }
- setWreckerGroupSelect("#deptlist", checked_dept);
- 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_QZD_ADMIN) || hasRole(ROLE_QZD) || hasRole(ROLE_JICHA) || roleContains('QZD')) {
- 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'}
- ];
- user.roles[0].id = 1;
- if (user.roles[0].id == 1) {
- 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: 'pics', 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
- },
- });
- $.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 UpladFile() {
- var fileObj = document.getElementById("fileupload").files[0]; // 获取文件对象
- // var FileController = base_image_server_url +'fileServer/file/upload';// 接收上传文件的后台地址
- // FormData 对象
- // var form = new FormData();
- // form.append("name", "hooyes"); // 可以增加表单数据
- // form.append("file", fileObj); // 文件对象
- uploadFile(fileObj, "file", function(data) {
- addPic(base_image_server_url + data.path);
- }, function(error) {
- console.log(error)
- }, "task");
- }
- function checkUpdate(id) {
- 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('');
- $("#startTime").val('');
- $("#carUserinfo").val('');
- $("#dept").val('');
- $("#carUserSatisfaction").val('');
- $(".ComboTreeItemChlid").find("input").prop('checked', false);
- $("#recordUser").val('');
- $("#addr").val('');
- }
- function getRecord() {
- var data = {
- // "startTime": new Date(getMomentTimeFormat(t.starttime)),
- // "endTime":new Date(getMomentTimeFormat(t.endtime)),
- "dept": $("#deptlist").val(),
- // "check_status": cur_status
- };
- post_common_service('q/record/getall/0/0', data, function(redata) {
- console.log(redata);
- });
- }
|