//智能表单 var Params = { pageNumber: 1, pageSize: 999, FLID: 0, BDXXID: "", QDID: "", XMID: "", BDJLID: "", BZ: "0",//用于传状态 TBSJ_START: "", TBSJ_END:"" }; var viewModel = function () { //初始化 this.init = function () { let _getTime = this.getTime(1).split(","); Params.TBSJ_START = _getTime[0]; Params.TBSJ_END = _getTime[1]; $('#start_date').datebox('setValue', Params.TBSJ_START); $('#end_date').datebox('setValue', Params.TBSJ_END); this.getChannel(); $("#TBBD").combobox({ url: '/SmartForm/BdxxSelectList?FLID=' + 0, valueField: "ID", textField: "MC", onSelect: function (data) { Params.BDXXID = data.ID; $('#dgProblems').datagrid('reload', Params); } }); $("#IncludeSearchContent").checkbox(function () { alert("checked"); }); $("#XM").combobox({ valueField: "ID", textField: "名称", onLoadSuccess: function (data) { //加载完成后,设置选中第一项 var val = $(this).combobox("getData"); $(this).combobox("select", val[0].ID); }, onSelect: function (data) { Params.XMID = data.ID; $('#dgProblems').datagrid('reload', Params); } }); $("#fbtn-ref").click(function () { Params.TBSJ_START = $('#start_date').datebox('getValue'); Params.TBSJ_END = $('#end_date').datebox('getValue'); Params.XMID = $('#XM').combobox('getValue'); Params.QDID = $('#QD').combobox('getValue'); Params.BDXXID = $('#TBBD').combobox('getValue'); Params.BZ = ""; Params.BZ += $("#IncludeSearchContent").checkbox('options').checked == true? '0,':''; Params.BZ += $("#terminissues").checkbox('options').checked == true ? '1,' : ''; Params.BZ += $("#ckclose").checkbox('options').checked == true ? '2,' : ''; if (Params.BZ == "") {//一个不选的情况下,默认只显示 Params.BZ = "0,1,2"; } $('#dgProblems').datagrid('reload', Params); }); //删除 $("#fbtn-del").click(function () { var row = $('#dgProblems').datagrid('getSelected'); if (!row) { top.ZLPMS.Msg("请选择列"); return; } if (row.TBZT == 1||row.TBZT == 2) { top.ZLPMS.Msg("当前记录不能被删除!"); return; } top.ZLPMS.Confirm('您确定要删除选中的记录吗?', 3, function () { var param = { ID: row.ID, BZ: 4 }; $.post("/SmartForm/UpdateRecord", param, function (data) { if (data.code == 200) { $('#dgProblems').datagrid('reload', Params); top.ZLPMS.Msg(data.msg); } else { top.ZLPMS.Msg(data.msg); } }) }); }); //通过 $("#fbtn-tg").click(function () { var row = $('#dgProblems').datagrid('getSelected'); if (!row) { top.ZLPMS.Msg("请选择列"); return; } if (row.TBZT == 1) { top.ZLPMS.Msg("当前记录已被通过!"); return; } if (row.SHBHFJ == 1)//需要上传附件 { top.ZLPMS.OpenNewWindow("审核", "/SmartForm/UploadFileInfo?id=" + row.ID + "&BDXXID=" + row.BDXXID + "&XM=" + row.XMMC, '388px', '340px', function () { $('#dgProblems').datagrid('reload', Params); }); } else { var param = { ID: row.ID, TBZT: 1, BZ: 2 }; $.post("/SmartForm/UpdateRecord", param, function (data) { if (data.code == 200) { $('#dgProblems').datagrid('reload', Params); top.ZLPMS.Msg(data.msg); } else { top.ZLPMS.Msg(data.msg); } }) } }); //退回 $("#fbtn-th").click(function () { var row = $('#dgProblems').datagrid('getSelected'); if (!row) { top.ZLPMS.Msg("请选择列"); return; } if (row.TBZT == 2) { top.ZLPMS.Msg("当前记录已被退回!"); return; } var param = { ID: row.ID, TBZT: 2, BZ: 2 }; $.post("/SmartForm/UpdateRecord", param, function (data) { if (data.code == 200) { $('#dgProblems').datagrid('reload', Params); top.ZLPMS.Msg(data.msg); } else { top.ZLPMS.Msg(data.msg); } }) }); }, this.getTime = function getRecentMonth_Date(n) { let result = ''; const datenow = new Date(); const dateend = datenow.getFullYear().toString() + '-' + (datenow.getMonth() + 1).toString() + '-' + datenow.getDate().toString(); datenow.setMonth(datenow.getMonth() - n); let dyear = datenow.getFullYear(); let dmonth = datenow.getMonth() + 1; dmonth = dmonth < 10 ? 0 + dmonth : dmonth; let dday = datenow.getDate(); const datestart = dyear.toString() + '-' + dmonth.toString() + '-' + dday.toString(); result += datestart + ','; result += dateend; console.log(datestart); return result; }, //初始化datagrid this.initdatagrid = function () { var fill = new Vue({ el: "#fill", data: { jsonData: {}, editData: {}, isshow: false, }, methods: { setFillJson(setFillJson, editJsonData) { this.jsonData = setFillJson; this.editData = editJsonData; this.isshow = false this.$nextTick(() => { this.isshow = true }) }, }, computed: { }, mounted() { }, created() { //json = { "list": [{ "type": "number", "icon": "icon-number", "options": { "width": "", "required": false, "requiredMessage": "", "validatorCheck": false, "validator": "", "defaultValue": 0, "min": 0, "max": 9, "step": 1, "disabled": false, "controls": true, "controlsPosition": "", "customClass": "", "labelWidth": 100, "isLabelWidth": false, "hidden": false, "dataBind": true, "precision": 0, "remoteFunc": "func_9c2xzpdm", "remoteOption": "option_9c2xzpdm", "tableColumn": false, "subform": false }, "events": { "onChange": "", "onFocus": "", "onBlur": "" }, "name": "计数器", "key": "9c2xzpdm", "model": "number_9c2xzpdm", "rules": [] }, { "type": "checkbox", "icon": "icon-check-box", "options": { "inline": false, "defaultValue": [], "showLabel": false, "options": [{ "value": "Option 1" }, { "value": "Option 2" }, { "value": "Option 3" }], "required": false, "requiredMessage": "", "validatorCheck": false, "validator": "", "width": "", "remote": false, "remoteType": "datasource", "remoteOption": "option_8p3ftzrv", "remoteOptions": [], "props": { "value": "value", "label": "label" }, "remoteFunc": "func_8p3ftzrv", "customClass": "", "labelWidth": 100, "isLabelWidth": false, "hidden": false, "dataBind": true, "disabled": false, "tableColumn": false, "subform": false }, "events": { "onChange": "" }, "name": "多选框组", "key": "8p3ftzrv", "model": "checkbox_8p3ftzrv", "rules": [] }], "config": { "labelWidth": 100, "labelPosition": "right", "size": "default", "customClass": "", "ui": "element", "layout": "horizontal", "width": "100%", "hideLabel": false, "hideErrorMessage": false, "eventScript": [{ "key": "mounted", "name": "mounted", "func": "" }, { "key": "refresh", "name": "refresh", "func": "" }] } }; //this.setFillJson(json); } }); var reply = new Vue({ el: "#reply", data: { jsonData: {}, editData: {}, isreplyshow: false, }, methods: { setReplyJson(setReplyJson, editJsonData) { this.jsonData = setReplyJson; this.editData = editJsonData; this.isreplyshow = false this.$nextTick(() => { this.isreplyshow = true }) }, getReplyData() { this.$refs.fillitem.getData().then(data => { var param = { ID: Params.BDJLID, BDCLJG: escape(JSON.stringify(data)), BZ: 1 }; $.post("/SmartForm/UpdateRecord", param, function (data) { if (data.code == 200) { $('#dgProblems').datagrid('reload', Params); top.ZLPMS.Msg(data.msg); } else { top.ZLPMS.Msg(data.msg); } }) }) }, }, computed: { }, created() { //json = { "list": [{ "type": "number", "icon": "icon-number", "options": { "width": "", "required": false, "requiredMessage": "", "validatorCheck": false, "validator": "", "defaultValue": 0, "min": 0, "max": 9, "step": 1, "disabled": false, "controls": true, "controlsPosition": "", "customClass": "", "labelWidth": 100, "isLabelWidth": false, "hidden": false, "dataBind": true, "precision": 0, "remoteFunc": "func_9c2xzpdm", "remoteOption": "option_9c2xzpdm", "tableColumn": false, "subform": false }, "events": { "onChange": "", "onFocus": "", "onBlur": "" }, "name": "计数器", "key": "9c2xzpdm", "model": "number_9c2xzpdm", "rules": [] }, { "type": "checkbox", "icon": "icon-check-box", "options": { "inline": false, "defaultValue": [], "showLabel": false, "options": [{ "value": "Option 1" }, { "value": "Option 2" }, { "value": "Option 3" }], "required": false, "requiredMessage": "", "validatorCheck": false, "validator": "", "width": "", "remote": false, "remoteType": "datasource", "remoteOption": "option_8p3ftzrv", "remoteOptions": [], "props": { "value": "value", "label": "label" }, "remoteFunc": "func_8p3ftzrv", "customClass": "", "labelWidth": 100, "isLabelWidth": false, "hidden": false, "dataBind": true, "disabled": false, "tableColumn": false, "subform": false }, "events": { "onChange": "" }, "name": "多选框组", "key": "8p3ftzrv", "model": "checkbox_8p3ftzrv", "rules": [] }], "config": { "labelWidth": 100, "labelPosition": "right", "size": "default", "customClass": "", "ui": "element", "layout": "horizontal", "width": "100%", "hideLabel": false, "hideErrorMessage": false, "eventScript": [{ "key": "mounted", "name": "mounted", "func": "" }, { "key": "refresh", "name": "refresh", "func": "" }] } }; //this.setFillJson(json); } }); $("#dgProblems").datagrid({ fit: true, width: '100%', toolbar: '#toolbar', pageSize: 20, pageList: [10, 20, 30, 40, 50, 1000], rownumbers: true, pagination: true, border: true, singleSelect: true, //单行选择 queryParams: Params, loadMsg: "正在查询数据,请稍候...", url: '/SmartForm/SelectRecordList', method: "post", columns: [[ { field: 'ID', title: 'ID', width: 20, align: 'center', fixed: true, hidden: true }, { field: 'FLID', title: '分类id', width: 20, align: 'center', fixed: true, hidden: true }, { field: 'QDMC', title: '渠道名称', align: 'left', fixed: true, width: 150 }, { field: 'XMMC', title: '项目名称', align: 'left', fixed: true, width: 200 }, { field: 'BDM', title: '填写表单', align: 'left', fixed: true, width: 80, }, { field: 'TBR', title: '填报人', align: 'left', fixed: true, width: 80, }, { field: 'TBSJ', title: '填报时间', width: 140, align: 'center', fixed: true, }, { field: 'TBZT', title: '状态', align: 'left', fixed: true, width: 80, formatter: function (value, rowData, index) { if (rowData.TBZT == 0) { return "填报"; } else if (rowData.TBZT == 1) { return "通过"; } else { return "退回"; } }, styler: function (value, rowData, index) { if (rowData.TBZT == 0) { return "color:#007aff"; } else if (rowData.TBZT == 1) { return "color:#4cd964"; } else { return "color: red"; } }, }, { field: 'SHR', title: '审核人', align: 'left', fixed: true, width: 80, }, { field: 'SHSJ', title: '审核时间', width: 140, align: 'center', fixed: true, }, ]], rowStyler: function (index, row) { }, onClickRow: function (rowIndex, rowData) { fill.setFillJson(JSON.parse(rowData.BDNR == "" ? "{}" : rowData.BDNR), JSON.parse(rowData.BDJG == "" ? "{}" : rowData.BDJG)); reply.setReplyJson(JSON.parse(rowData.BDCLNR == "" ? "{}" : rowData.BDCLNR), JSON.parse(rowData.BDCLJG == "" ? "{}" : rowData.BDCLJG)); Params.BDJLID = rowData.ID; } }); //保存问题处理信息 $("#save").click(function(){ reply.getReplyData(); }); }, this.getChannel = function () { $.ajax({ url: '/Channel/SearchModuleInfos?search=&page=1&rows=200', method: 'post', success: function (data) { $("#QD").combobox({ valueField: 'ID', textField: '名称', data: data.rows, onSelect: function (e) { $('#XM').combobox('clear'); $('#XM').combobox('reload', '/ProManager/BingProData?ChannelID=' + e.ID + '&Search='); // reload list data using new URL Params.QDID = e.ID; }, }); } }) }, this.refresh = function () { $('#dgProblems').datagrid('reload', Params); }, //加载问题处理过程 this.DealProcess=function (ID) { var url = "/Problem/GetClc?ID=" + ID; $.post(url, {}, function (data) { $("#timeLine").empty(); $.each(data, function (idx, json) { if (json != undefined) { var attfile = ""; if (json.附件 != undefined) { attfile = ""; } json.描述 = json.描述 != undefined ? json.描述 : "无"; if (json.描述 != "无") { var arrEntities = { 'lt': '<', 'gt': '>', 'nbsp': ' ', 'amp': '&', 'quot': '"' }; json.描述 = json.描述.replace(/<[^>]+>/g, "").replace(/&(lt|gt|nbsp|amp|quot);/ig, function (all, t) { return arrEntities[t] }); if (json.描述.length == 0) { json.描述 = "内有图片,点击该过程即可查看"; } } if (json.描述.length > 25) { json.描述 = json.描述.substring(0, 25) + "..."; } var html = "
  • " + json.处理状态 + " " + attfile + "

    " + json.处理人员 + "(" + json.职务 + ")
    " + json.记录时间 + (json.耗时 != undefined ? "(" + json.耗时 + ")小时" : "") + "
    " + "描述:" + (json.描述) + "

  • "; $("#timeLine").append(html); } }); }); } }