You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

333 lines
16 KiB

  1. /* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn)
  2. * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2021-06-21 18:39
  5. * 描 述:质量目标管理体系指标模块
  6. */
  7. var refreshGirdData;
  8. var bootstrap = function ($, learun) {
  9. "use strict";
  10. var page = {
  11. init: function () {
  12. page.initGird();
  13. page.bind();
  14. },
  15. bind: function () {
  16. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  17. page.search(queryJson);
  18. }, 220, 400);
  19. $('#FillingCycle').lrDataItemSelect({ code: 'ThisCycle' });
  20. $('#FillingDept').lrDataSourceSelect({ code: 'classdata', value: 'id', text: 'name', maxHeight: '150px' });
  21. // 刷新
  22. $('#lr_refresh').on('click', function () {
  23. location.reload();
  24. });
  25. // 新增
  26. $('#lr_add').on('click', function () {
  27. learun.layerForm({
  28. id: 'form',
  29. title: '新增',
  30. url: top.$.rootUrl + '/EducationalAdministration/FillinFrom/Form',
  31. width: 600,
  32. height: 400,
  33. callBack: function (id) {
  34. return top[id].acceptClick(refreshGirdData);
  35. }
  36. });
  37. });
  38. // 编辑
  39. $('#lr_edit').on('click', function () {
  40. var keyValue = $('#gridtable').jfGridValue('Id');
  41. if (learun.checkrow(keyValue)) {
  42. if (keyValue.indexOf(",") != -1) {
  43. learun.alert.warning("只能选择一条记录进行操作!");
  44. return false;
  45. }
  46. var State = $('#gridtable').jfGridValue('State');
  47. if (State !== 0) {
  48. learun.alert.warning("只有草稿状态可以修改!");
  49. return;
  50. }
  51. learun.layerConfirm('是否确认修改该项,修改成后会影响数据!', function (res) {
  52. if (res) {
  53. learun.layerForm({
  54. id: 'form',
  55. title: '编辑',
  56. url: top.$.rootUrl + '/EducationalAdministration/FillinFrom/Form?keyValue=' + keyValue,
  57. width: 600,
  58. height: 400,
  59. callBack: function (id) {
  60. learun.layerConfirm('确定要修改当前项吗!', function (res) {
  61. if (res) {
  62. return top[id].acceptClick(refreshGirdData);
  63. }
  64. })
  65. }
  66. });
  67. }
  68. })
  69. }
  70. });
  71. // 提交
  72. $('#lr_submit').on('click', function () {
  73. var keyValue = $('#gridtable').jfGridValue('Id');
  74. if (learun.checkrow(keyValue)) {
  75. var States = $('#gridtable').jfGridValue('State');
  76. var IsFlags = $('#gridtable').jfGridValue('IsFlag');
  77. if (States.indexOf('1') != -1) {
  78. learun.alert.warning("选中记录中包含已提交项目,不可重复提交!");
  79. return false;
  80. } else if (States.indexOf('-1') != -1) {
  81. learun.alert.warning("选中记录中包含已作废项目,不能提交!");
  82. return false;
  83. }
  84. if (IsFlags.indexOf('1') != -1) {
  85. learun.alert.warning("选中记录中包含已隐藏项目,不能提交!");
  86. return false;
  87. }
  88. learun.layerConfirm('是否确认提交该项!', function (res) {
  89. if (res) {
  90. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/FillinFrom/Submit', { keyValue: keyValue }, function () {
  91. refreshGirdData();
  92. });
  93. }
  94. });
  95. }
  96. });
  97. //作废
  98. $('#lr_delete').on('click', function () {
  99. var keyValue = $('#gridtable').jfGridValue('Id');
  100. if (learun.checkrow(keyValue)) {
  101. var States = $('#gridtable').jfGridValue('State');
  102. if (States.indexOf('-1') != -1) {
  103. learun.alert.warning("选中记录包含已作废项目,请勿重复操作 !");
  104. return false;
  105. }
  106. learun.layerConfirm('是否确认作废该项,此操作将改变数据!', function (res) {
  107. if (res) {
  108. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/FillinFrom/DeleteForm', { keyValue: keyValue }, function () {
  109. refreshGirdData();
  110. });
  111. }
  112. });
  113. }
  114. });
  115. //撤回
  116. $('#lr_cancel').on('click', function () {
  117. var keyValue = $('#gridtable').jfGridValue('Id');
  118. if (learun.checkrow(keyValue)) {
  119. var States = $('#gridtable').jfGridValue('State');
  120. if (States.indexOf('-1') != -1) {
  121. learun.alert.warning("当前项已撤回或作废,请勿重复操作!");
  122. return;
  123. }
  124. learun.layerConfirm('是否确认撤回该项!', function (res) {
  125. if (res) {
  126. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/FillinFrom/DoCancel', { keyValue: keyValue }, function () {
  127. refreshGirdData();
  128. });
  129. }
  130. });
  131. }
  132. });
  133. //设置填报人
  134. $('#lr_people').on('click', function () {
  135. var keyValue = $('#gridtable').jfGridValue('Id');
  136. if (learun.checkrow(keyValue)) {
  137. var RStatus = $('#gridtable').jfGridValue('State');
  138. if (RStatus !== 1) {
  139. learun.alert.warning("当前项不能设置填报人!");
  140. return false;
  141. }
  142. learun.layerForm({
  143. id: 'form',
  144. title: '设置填报人',
  145. url: top.$.rootUrl + '/EducationalAdministration/FillinFrom/FormPeople?keyValue=' + keyValue,
  146. width: 600,
  147. height: 500,
  148. callBack: function (id) {
  149. return top[id].acceptClick(refreshGirdData);
  150. }
  151. });
  152. }
  153. });
  154. //隐藏显示
  155. $('#lr_hide').on('click', function () {
  156. var keyValue = $('#gridtable').jfGridValue('Id');
  157. if (learun.checkrow(keyValue)) {
  158. if (keyValue.indexOf(",") != -1) {
  159. learun.alert.warning("只能选择一条记录进行操作!");
  160. return false;
  161. }
  162. learun.layerConfirm('是否确认隐藏/显示该项!', function (res) {
  163. if (res) {
  164. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/FillinFrom/HideList', { keyValue: keyValue }, function () {
  165. refreshGirdData();
  166. });
  167. }
  168. });
  169. }
  170. });
  171. //归档
  172. $('#lr_file').on('click', function () {
  173. var keyValue = $('#gridtable').jfGridValue('Id');
  174. if (learun.checkrow(keyValue)) {
  175. if (keyValue.indexOf(",") != -1) {
  176. learun.alert.warning("只能选择一条记录进行操作!");
  177. return false;
  178. }
  179. var Status = $('#gridtable').jfGridValue('State');
  180. if (Status != 2) {
  181. learun.alert.warning("当前项未执行到此处,暂不能归档!");
  182. return false;
  183. }
  184. learun.layerConfirm('确定要归档么!', function (res) {
  185. if (res) {
  186. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/FillinFrom/IsFile', { keyValue: keyValue }, function () {
  187. refreshGirdData();
  188. });
  189. }
  190. });
  191. }
  192. });
  193. },
  194. // 初始化列表
  195. initGird: function () {
  196. $('#gridtable').lrAuthorizeJfGrid({
  197. url: top.$.rootUrl + '/EducationalAdministration/FillinFrom/GetPageList',
  198. headData: [
  199. { label: "核心工作模块", name: "WorderModule", width: 250, align: "center" },
  200. { label: "序号", name: "SerialNo", width: 100, align: "center" },
  201. { label: "项目名称", name: "ProjectName", width: 250, align: "center" },
  202. {
  203. label: "填报周期", name: "FillingCycle", width: 80, align: "center",
  204. formatterAsync: function (callback, value, row, op, $cell) {
  205. learun.clientdata.getAsync('dataItem', {
  206. key: value,
  207. code: 'ThisCycle',
  208. callback: function (_data) {
  209. callback(_data.text);
  210. }
  211. });
  212. }
  213. },
  214. {
  215. label: "公式", name: "Formula", width: 200, align: "center",
  216. formatterAsync: function (callback, value, row, op, $cell) {
  217. learun.clientdata.getAsync('custmerData', {
  218. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'FormulaMain',
  219. key: value,
  220. keyId: 'id',
  221. callback: function (_data) {
  222. callback(_data['name']);
  223. }
  224. });
  225. }
  226. },
  227. {
  228. label: "填报时间", name: "FillingTime", width: 100, align: "left",
  229. formatterAsync: function (callback, value, row, op, $cell) {
  230. if (value && value.indexOf(',') != -1) {
  231. var content = '';
  232. var timearr = value.split(',');
  233. for (var i = 0; i < timearr.length; i++) {
  234. learun.clientdata.getAsync('dataItem',
  235. {
  236. key: timearr[i],
  237. code: 'CycleTime',
  238. callback: function (_data) {
  239. content += _data.text + ',';
  240. }
  241. });
  242. }
  243. content = content.substring(0, content.length - 1);
  244. callback(content);
  245. } else {
  246. learun.clientdata.getAsync('dataItem',
  247. {
  248. key: value,
  249. code: 'CycleTime',
  250. callback: function (_data) {
  251. callback(_data.text);
  252. }
  253. });
  254. }
  255. }
  256. },
  257. {
  258. label: "填报部门", name: "FillingDept", width: 100, align: "center",
  259. formatterAsync: function (callback, value, row, op, $cell) {
  260. learun.clientdata.getAsync('custmerData', {
  261. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'classdata',
  262. key: value,
  263. keyId: 'id',
  264. callback: function (_data) {
  265. callback(_data['name']);
  266. }
  267. });
  268. }
  269. },
  270. {
  271. label: "填报人", name: "FillingPeople", width: 100, align: "center",
  272. formatterAsync: function (callback, value, row, op, $cell) {
  273. learun.clientdata.getAsync('custmerData', {
  274. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'teacheruserdata',
  275. key: value,
  276. keyId: 'f_userid',
  277. callback: function (_data) {
  278. callback(_data['f_realname']);
  279. }
  280. });
  281. }
  282. },
  283. {
  284. label: "状态", name: "State", width: 150, align: "center",
  285. formatter: function (cellvalue) {
  286. if (cellvalue === -1) {
  287. return '<span class=\"label label-danger\">作废</span>';
  288. } else if (cellvalue === 0) {
  289. return '<span class=\"label label-warning\">草稿</span>';
  290. } else if (cellvalue === 1) {
  291. return '<span class=\"label label-success\">已提交</span>';
  292. } else if (cellvalue === 2) {
  293. return '<span class=\"label label-success\">待填报</span>';
  294. } else if (cellvalue === 3) {
  295. return '<span class=\"label label-default\">已完成<pan>';
  296. }
  297. }
  298. },
  299. { label: "备注", name: "Demo", width: 240, align: "center" },
  300. {
  301. label: "隐藏/显示", name: "IsFlag", width: 100, align: "center",
  302. formatter: function (cellvalue) {
  303. if (cellvalue === 0) {
  304. return '<span class=\"label label-success\">显示</span>';
  305. } else if (cellvalue === 1) {
  306. return '<span class=\"label label-default\">隐藏</span>';
  307. }
  308. }
  309. },
  310. ],
  311. mainId: 'Id',
  312. isPage: true,
  313. isMultiselect: true
  314. });
  315. page.search();
  316. },
  317. search: function (param) {
  318. param = param || {};
  319. param.departmentId = departmentId;
  320. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  321. }
  322. };
  323. refreshGirdData = function () {
  324. $('#gridtable').jfGridSet('reload');
  325. };
  326. page.init();
  327. }