FillingManagement.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. //智能表单
  2. var Params = {
  3. pageNumber: 1,
  4. pageSize: 999,
  5. FLID: 0,
  6. BDXXID: "",
  7. QDID: "",
  8. XMID: "",
  9. BDJLID: "",
  10. BZ: "0",//用于传状态
  11. TBSJ_START: "",
  12. TBSJ_END:""
  13. };
  14. var viewModel = function () {
  15. //初始化
  16. this.init = function () {
  17. let _getTime = this.getTime(1).split(",");
  18. Params.TBSJ_START = _getTime[0];
  19. Params.TBSJ_END = _getTime[1];
  20. $('#start_date').datebox('setValue', Params.TBSJ_START);
  21. $('#end_date').datebox('setValue', Params.TBSJ_END);
  22. this.getChannel();
  23. $("#TBBD").combobox({
  24. url: '/SmartForm/BdxxSelectList?FLID=' + 0,
  25. valueField: "ID",
  26. textField: "MC",
  27. onSelect: function (data) {
  28. Params.BDXXID = data.ID;
  29. $('#dgProblems').datagrid('reload', Params);
  30. }
  31. });
  32. $("#IncludeSearchContent").checkbox(function () {
  33. alert("checked");
  34. });
  35. $("#XM").combobox({
  36. valueField: "ID",
  37. textField: "名称",
  38. onLoadSuccess: function (data) { //加载完成后,设置选中第一项
  39. var val = $(this).combobox("getData");
  40. $(this).combobox("select", val[0].ID);
  41. },
  42. onSelect: function (data) {
  43. Params.XMID = data.ID;
  44. $('#dgProblems').datagrid('reload', Params);
  45. }
  46. });
  47. $("#fbtn-ref").click(function () {
  48. Params.TBSJ_START = $('#start_date').datebox('getValue');
  49. Params.TBSJ_END = $('#end_date').datebox('getValue');
  50. Params.XMID = $('#XM').combobox('getValue');
  51. Params.QDID = $('#QD').combobox('getValue');
  52. Params.BDXXID = $('#TBBD').combobox('getValue');
  53. Params.BZ = "";
  54. Params.BZ += $("#IncludeSearchContent").checkbox('options').checked == true? '0,':'';
  55. Params.BZ += $("#terminissues").checkbox('options').checked == true ? '1,' : '';
  56. Params.BZ += $("#ckclose").checkbox('options').checked == true ? '2,' : '';
  57. if (Params.BZ == "") {//一个不选的情况下,默认只显示
  58. Params.BZ = "0,1,2";
  59. }
  60. $('#dgProblems').datagrid('reload', Params);
  61. });
  62. //删除
  63. $("#fbtn-del").click(function () {
  64. var row = $('#dgProblems').datagrid('getSelected');
  65. if (!row) {
  66. top.ZLPMS.Msg("请选择列");
  67. return;
  68. }
  69. if (row.TBZT == 1||row.TBZT == 2) {
  70. top.ZLPMS.Msg("当前记录不能被删除!");
  71. return;
  72. }
  73. top.ZLPMS.Confirm('您确定要删除选中的记录吗?', 3, function () {
  74. var param = {
  75. ID: row.ID,
  76. BZ: 4
  77. };
  78. $.post("/SmartForm/UpdateRecord", param, function (data) {
  79. if (data.code == 200) {
  80. $('#dgProblems').datagrid('reload', Params);
  81. top.ZLPMS.Msg(data.msg);
  82. } else {
  83. top.ZLPMS.Msg(data.msg);
  84. }
  85. })
  86. });
  87. });
  88. //通过
  89. $("#fbtn-tg").click(function () {
  90. var row = $('#dgProblems').datagrid('getSelected');
  91. if (!row) {
  92. top.ZLPMS.Msg("请选择列");
  93. return;
  94. }
  95. if (row.TBZT == 1) {
  96. top.ZLPMS.Msg("当前记录已被通过!");
  97. return;
  98. }
  99. if (row.SHBHFJ == 1)//需要上传附件
  100. {
  101. top.ZLPMS.OpenNewWindow("审核", "/SmartForm/UploadFileInfo?id=" + row.ID + "&BDXXID=" + row.BDXXID + "&XM=" + row.XMMC, '388px', '340px', function () {
  102. $('#dgProblems').datagrid('reload', Params);
  103. });
  104. }
  105. else {
  106. var param = {
  107. ID: row.ID,
  108. TBZT: 1,
  109. BZ: 2
  110. };
  111. $.post("/SmartForm/UpdateRecord", param, function (data) {
  112. if (data.code == 200) {
  113. $('#dgProblems').datagrid('reload', Params);
  114. top.ZLPMS.Msg(data.msg);
  115. } else {
  116. top.ZLPMS.Msg(data.msg);
  117. }
  118. })
  119. }
  120. });
  121. //退回
  122. $("#fbtn-th").click(function () {
  123. var row = $('#dgProblems').datagrid('getSelected');
  124. if (!row) {
  125. top.ZLPMS.Msg("请选择列");
  126. return;
  127. }
  128. if (row.TBZT == 2) {
  129. top.ZLPMS.Msg("当前记录已被退回!");
  130. return;
  131. }
  132. var param = {
  133. ID: row.ID,
  134. TBZT: 2,
  135. BZ: 2
  136. };
  137. $.post("/SmartForm/UpdateRecord", param, function (data) {
  138. if (data.code == 200) {
  139. $('#dgProblems').datagrid('reload', Params);
  140. top.ZLPMS.Msg(data.msg);
  141. } else {
  142. top.ZLPMS.Msg(data.msg);
  143. }
  144. })
  145. });
  146. },
  147. this.getTime = function getRecentMonth_Date(n) {
  148. let result = '';
  149. const datenow = new Date();
  150. const dateend =
  151. datenow.getFullYear().toString() +
  152. '-' +
  153. (datenow.getMonth() + 1).toString() +
  154. '-' +
  155. datenow.getDate().toString();
  156. datenow.setMonth(datenow.getMonth() - n);
  157. let dyear = datenow.getFullYear();
  158. let dmonth = datenow.getMonth() + 1;
  159. dmonth = dmonth < 10 ? 0 + dmonth : dmonth;
  160. let dday = datenow.getDate();
  161. const datestart =
  162. dyear.toString() + '-' + dmonth.toString() + '-' + dday.toString();
  163. result += datestart + ',';
  164. result += dateend;
  165. console.log(datestart);
  166. return result;
  167. },
  168. //初始化datagrid
  169. this.initdatagrid = function () {
  170. var fill = new Vue({
  171. el: "#fill",
  172. data: {
  173. jsonData: {},
  174. editData: {},
  175. isshow: false,
  176. },
  177. methods: {
  178. setFillJson(setFillJson, editJsonData) {
  179. this.jsonData = setFillJson;
  180. this.editData = editJsonData;
  181. this.isshow = false
  182. this.$nextTick(() => {
  183. this.isshow = true
  184. })
  185. },
  186. },
  187. computed: {
  188. }, mounted() {
  189. }, created() {
  190. //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": "" }] } };
  191. //this.setFillJson(json);
  192. }
  193. });
  194. var reply = new Vue({
  195. el: "#reply",
  196. data: {
  197. jsonData: {},
  198. editData: {},
  199. isreplyshow: false,
  200. },
  201. methods: {
  202. setReplyJson(setReplyJson, editJsonData) {
  203. this.jsonData = setReplyJson;
  204. this.editData = editJsonData;
  205. this.isreplyshow = false
  206. this.$nextTick(() => {
  207. this.isreplyshow = true
  208. })
  209. },
  210. getReplyData() {
  211. this.$refs.fillitem.getData().then(data => {
  212. var param = {
  213. ID: Params.BDJLID,
  214. BDCLJG: escape(JSON.stringify(data)),
  215. BZ: 1
  216. };
  217. $.post("/SmartForm/UpdateRecord", param, function (data) {
  218. if (data.code == 200) {
  219. $('#dgProblems').datagrid('reload', Params);
  220. top.ZLPMS.Msg(data.msg);
  221. } else {
  222. top.ZLPMS.Msg(data.msg);
  223. }
  224. })
  225. })
  226. },
  227. },
  228. computed: {
  229. }, created() {
  230. //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": "" }] } };
  231. //this.setFillJson(json);
  232. }
  233. });
  234. $("#dgProblems").datagrid({
  235. fit: true,
  236. width: '100%',
  237. toolbar: '#toolbar',
  238. pageSize: 20,
  239. pageList: [10, 20, 30, 40, 50, 1000],
  240. rownumbers: true,
  241. pagination: true,
  242. border: true,
  243. singleSelect: true, //单行选择
  244. queryParams: Params,
  245. loadMsg: "正在查询数据,请稍候...",
  246. url: '/SmartForm/SelectRecordList',
  247. method: "post",
  248. columns: [[
  249. { field: 'ID', title: 'ID', width: 20, align: 'center', fixed: true, hidden: true },
  250. { field: 'FLID', title: '分类id', width: 20, align: 'center', fixed: true, hidden: true },
  251. { field: 'QDMC', title: '渠道名称', align: 'left', fixed: true, width: 150 },
  252. { field: 'XMMC', title: '项目名称', align: 'left', fixed: true, width: 200 },
  253. {
  254. field: 'BDM', title: '填写表单', align: 'left', fixed: true, width: 80,
  255. },
  256. {
  257. field: 'TBR', title: '填报人', align: 'left', fixed: true, width: 80,
  258. },
  259. {
  260. field: 'TBSJ', title: '填报时间', width: 140, align: 'center', fixed: true,
  261. },
  262. {
  263. field: 'TBZT', title: '状态', align: 'left', fixed: true, width: 80,
  264. formatter: function (value, rowData, index) {
  265. if (rowData.TBZT == 0) {
  266. return "填报";
  267. }
  268. else if (rowData.TBZT == 1) {
  269. return "通过";
  270. }
  271. else {
  272. return "退回";
  273. }
  274. }, styler: function (value, rowData, index) {
  275. if (rowData.TBZT == 0) {
  276. return "color:#007aff";
  277. }
  278. else if (rowData.TBZT == 1) {
  279. return "color:#4cd964";
  280. }
  281. else {
  282. return "color: red";
  283. }
  284. },
  285. },
  286. {
  287. field: 'SHR', title: '审核人', align: 'left', fixed: true, width: 80,
  288. },
  289. {
  290. field: 'SHSJ', title: '审核时间', width: 140, align: 'center', fixed: true,
  291. },
  292. ]],
  293. rowStyler: function (index, row) {
  294. },
  295. onClickRow: function (rowIndex, rowData) {
  296. fill.setFillJson(JSON.parse(rowData.BDNR == "" ? "{}" : rowData.BDNR), JSON.parse(rowData.BDJG == "" ? "{}" : rowData.BDJG));
  297. reply.setReplyJson(JSON.parse(rowData.BDCLNR == "" ? "{}" : rowData.BDCLNR), JSON.parse(rowData.BDCLJG == "" ? "{}" : rowData.BDCLJG));
  298. Params.BDJLID = rowData.ID;
  299. }
  300. });
  301. //保存问题处理信息
  302. $("#save").click(function(){
  303. reply.getReplyData();
  304. });
  305. },
  306. this.getChannel = function () {
  307. $.ajax({
  308. url: '/Channel/SearchModuleInfos?search=&page=1&rows=200',
  309. method: 'post',
  310. success: function (data) {
  311. $("#QD").combobox({
  312. valueField: 'ID',
  313. textField: '名称',
  314. data: data.rows,
  315. onSelect: function (e) {
  316. $('#XM').combobox('clear');
  317. $('#XM').combobox('reload', '/ProManager/BingProData?ChannelID=' + e.ID + '&Search='); // reload list data using new URL
  318. Params.QDID = e.ID;
  319. },
  320. });
  321. }
  322. })
  323. },
  324. this.refresh = function () {
  325. $('#dgProblems').datagrid('reload', Params);
  326. },
  327. //加载问题处理过程
  328. this.DealProcess=function (ID) {
  329. var url = "/Problem/GetClc?ID=" + ID;
  330. $.post(url, {}, function (data) {
  331. $("#timeLine").empty();
  332. $.each(data, function (idx, json) {
  333. if (json != undefined) {
  334. var attfile = "";
  335. if (json.附件 != undefined) {
  336. attfile = "<i class='fa fa-paperclip' style='color:blue' title='包含过程附件'></i>";
  337. }
  338. json.描述 = json.描述 != undefined ? json.描述 : "无";
  339. if (json.描述 != "无") {
  340. var arrEntities = {
  341. 'lt': '<',
  342. 'gt': '>',
  343. 'nbsp': ' ',
  344. 'amp': '&',
  345. 'quot': '"'
  346. };
  347. json.描述 = json.描述.replace(/<[^>]+>/g, "").replace(/&(lt|gt|nbsp|amp|quot);/ig, function (all, t) {
  348. return arrEntities[t]
  349. });
  350. if (json.描述.length == 0) {
  351. json.描述 = "内有图片,点击该过程即可查看";
  352. }
  353. }
  354. if (json.描述.length > 25) {
  355. json.描述 = json.描述.substring(0, 25) + "...";
  356. }
  357. var html = "<li onclick='viewProcess(\"" + json.ID + "\")' class='layui-timeline-item timelineDetail'><i class='layui-icon layui-timeline-axis'></i><div class='layui-timeline-content layui-text'><h3 class='layui-timeline-title'><a href='#' >" + json.处理状态 + "</a> " + attfile + "</h3><p>" + json.处理人员 + "(" + json.职务 + ")<br>" + json.记录时间 + (json.耗时 != undefined ? "(" + json.耗时 + ")小时" : "") + "<br>" + "描述:" + (json.描述) + "</p></div></li>";
  358. $("#timeLine").append(html);
  359. }
  360. });
  361. });
  362. }
  363. }