ProductVerInfoManage.module.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  1. 
  2. function viewModel(PersonProperty) {
  3. var that = this
  4. var PersonProperty = PersonProperty
  5. this.init = function () {
  6. $('#productVersionInfo').treegrid({
  7. idField: 'ID',
  8. treeField: '版本号',
  9. fit: true,
  10. toolbar: '#tb',
  11. singleSelect: true,
  12. border: false,
  13. rownumbers: true,
  14. columns: [[
  15. { field: '版本号', title: '版本号', width: 200, align: 'center' },
  16. { field: '类型', title: '类型', width: 100, align: 'center' },
  17. { field: '状态', title: '状态', width: 60, align: 'center', halign: 'center' }
  18. //{ field: '申请人', title: '申请人', width: 100, align: 'center' },
  19. //{ field: '申请日期', title: '申请日期', width: 150, align: 'center' },
  20. //{ field: '计划日期', title: '计划日期', width: 150, align: 'center' },
  21. //{ field: '发布日期', title: '发布日期', width: 150, align: 'center' },
  22. // { field: '负责人', title: '负责人', width: 100, align: 'center' },
  23. ]],
  24. onSelect: function (row) {
  25. $("#VersionID").html(row.版本号);
  26. $("#InCharge").html(row.负责人);
  27. $("#Versiontype").html(row.类型);
  28. $("#SealingDate").html(row.封版日期);
  29. $("#PlanDate").html(row.计划日期);
  30. $("#ReleaseDate").html(row.发布日期);
  31. $("#Detail").html(row.版本概述);
  32. $("#Attention").html(row.注意事项);
  33. $("#Configuration").html(row.配置信息);
  34. Refresh("1");
  35. //初始化版本问题
  36. that.InitVersionProblem();
  37. },
  38. onLoadSuccess(row, data) {
  39. if (data) {
  40. var rootNode = $('#productVersionInfo').treegrid("getRoot");
  41. if (rootNode) {
  42. $('#productVersionInfo').treegrid("select", rootNode['ID']);
  43. }
  44. }
  45. }
  46. });
  47. //$("#QD").combobox({
  48. // valueField: 'ID',
  49. // textField: '名称',
  50. // data: data.rows,
  51. // onSelect: function (e) {
  52. // $('#XM').combobox('clear');
  53. // $('#XM').combobox('reload', '/ProManager/BingProData?ChannelID=' + e.ID + '&Search='); // reload list data using new URL
  54. // Params.QDID = e.ID;
  55. // },
  56. //});
  57. //项目
  58. $("#XMID").combobox({
  59. url: '/Problem/GetProjectByInfo',
  60. valueField: 'ID',
  61. textField: '名称',
  62. limitToList: true,
  63. });
  64. $("#SLRID").combobox({
  65. url: "/Problem/GetFKR",
  66. valueField: 'ID',
  67. textField: '姓名'
  68. })
  69. $("#Product").combobox({
  70. url: '/Product/ProductInfoCombobox',
  71. valueField: 'ID',
  72. textField: '名称',
  73. editable: false,
  74. onLoadSuccess: function (data) {
  75. $("#Product").combobox('setValue', data[0].ID);
  76. },
  77. onChange: function () {
  78. Refresh("0");
  79. }
  80. });
  81. //状态选择事件
  82. $("input:radio[name='radio']").on('click', function () {
  83. Refresh("0");
  84. });
  85. //增加
  86. $('#btn-add').click(function () {
  87. var productID = $("#Product").combobox('getValue');
  88. top.ZLPMS.OpenWindow({
  89. title: '新建产品版本',
  90. url: '/Product/ProductVerInfoEdit?ProID=' + productID,
  91. area: ['750px', '650px'],
  92. yes: function (index, layero) {
  93. Forms.Submit(index, layero);
  94. },
  95. });
  96. });
  97. //修改
  98. $('#btn-edit').click(function () {
  99. var Node = $('#productVersionInfo').treegrid("getSelected");
  100. var productID = $("#Product").combobox('getValue');
  101. if (Node != null) {
  102. //打开编辑窗口
  103. top.ZLPMS.OpenWindow({
  104. title: '修改产品线',
  105. url: '/Product/ProductVerInfoEdit/' + Node.ID + '?ProID=' + productID,
  106. area: ['650px', '550px'],
  107. yes: function (index, layero) {
  108. Forms.Submit(index, layero);
  109. },
  110. });
  111. } else {
  112. top.ZLPMS.Msg("请选择一行记录后执行操作", 0);
  113. }
  114. });
  115. //删除
  116. $('#btn-del').click(function () {
  117. var Node = $('#productVersionInfo').treegrid("getSelected");
  118. if (Node != null) {
  119. //确认删除对话框
  120. top.ZLPMS.Confirm('您确定要删除选择的版本吗?删除后不可还原!', 3, function () {
  121. //执行删除
  122. var url = '/Product/PostDelProductVer';
  123. $.post(url, { "id": Node.ID }, function (data) {
  124. if (data.code == 200) {
  125. //刷新
  126. top.ZLPMS.Msg(data.msg);
  127. Refresh("0");
  128. } else {
  129. ZLPMS.Msg(data.msg, 2);
  130. }
  131. });
  132. });
  133. } else {
  134. top.ZLPMS.Msg("请选择一行记录后执行操作", 0);
  135. }
  136. });
  137. //刷新
  138. $('#btn-ref').click(function () {
  139. Refresh("0");
  140. });
  141. //版本问题检索
  142. $('#btn-problemsearch').click(function () {
  143. top.ZLPMS.OpenNewWindow("版本问题检索", "/Product/ProductProblemWindow", '880px', '600px', function () {
  144. });
  145. })
  146. //增加
  147. $('#fbtn-add').click(function () {
  148. var Node = $('#productVersionInfo').treegrid("getSelected");
  149. if (Node != null) {
  150. //打开编辑窗口
  151. top.ZLPMS.OpenNewWindow(
  152. "产品版本附件上传",
  153. "/Product/ProductVerFlieUpload/" + Node.ID,
  154. '650px', '650px'
  155. );
  156. } else {
  157. top.ZLPMS.Msg("请选择一行产品版本后执行操作", 0);
  158. }
  159. });
  160. $('#fbtn-del').click(function () {
  161. var Node = $('#VerisonFile').datagrid("getSelected");
  162. if (Node != null) {
  163. top.ZLPMS.Confirm('确定删除该附件吗?', 3, function (idx) {
  164. var index = top.ZLPMS.Loading3(2);
  165. $.post("/Product/DeleteProductVersionFile/" + Node.ID, function (res) {
  166. top.ZLPMS.UnLoading(index);
  167. if (res.code == 200) {
  168. top.ZLPMS.Msg("删除成功");
  169. $('#VerisonFile').datagrid("reload");
  170. } else {
  171. top.ZLPMS.Msg("删除失败", 0);
  172. }
  173. })
  174. })
  175. } else {
  176. top.ZLPMS.Msg("请选择一行记录后执行操作", 0);
  177. }
  178. })
  179. $('#fbtn-download').click(function () {
  180. var Node = $('#VerisonFile').datagrid("getSelected");
  181. if (Node != null) {
  182. window.open('/MobileProblem/DownLoadVersionFile/' + Node["附件ID"] + "?flieVersionId=" + Node["ID"], '_blank')
  183. } else {
  184. top.ZLPMS.Msg("请选择一行记录后执行操作", 0);
  185. }
  186. })
  187. },
  188. //绑定数据(产品版本)
  189. this.bindData = function (id) {
  190. this.id = id;
  191. //加载修改内容
  192. $.ajax({
  193. url: '/Product/GetProductVerInfo/' + id,
  194. method: 'GET',
  195. success: function (data) {
  196. if (data.code == 200) {
  197. $('#id').val(id);
  198. $('#parentid').combotree('setValue', data.obj[0].主版本ID);
  199. $('#VersionNumber').textbox('setValue', data.obj[0].版本号);
  200. $('#VersionTypeID').combobox('setValue', data.obj[0].类型);
  201. $('#VersionStatusID').combobox('setValue', data.obj[0].状态);
  202. $('#ChargePersonID').combobox('setValue', data.obj[0].负责人ID);
  203. $('#PlaintTime').datebox('setValue', data.obj[0].计划日期);
  204. $('#ReleaseTime').datebox('setValue', data.obj[0].发布日期);
  205. $('#ShroudingTime').datebox('setValue', data.obj[0].封版日期);
  206. $('#VersionDetail').textbox('setValue', data.obj[0].版本概述);
  207. $('#needingAttention').textbox('setValue', data.obj[0].注意事项);
  208. $('#ConfigurationInformation').textbox('setValue', data.obj[0].配置信息);
  209. } else {
  210. //弹出错误消息
  211. ZLPMS.Alert(data.msg, 1);
  212. }
  213. }
  214. })
  215. },
  216. this.loadmenus = function (ProID) {
  217. $('#parentid').combotree({
  218. url: '/Product/GetProdutVersionTree?ProID=' + ProID,
  219. method: 'GET'
  220. });
  221. $('#VersionTypeID').combobox({
  222. url: '/Product/GetCodeCombobox?ClassificationID=F4A05E7C-634B-46D9-83BE-6A70FFBB1672',
  223. valueField: '代码',
  224. textField: '显示名',
  225. editable: false,
  226. });
  227. $('#VersionStatusID').combobox({
  228. valueField: 'ID',
  229. textField: '名称',
  230. editable: false,
  231. data: [{
  232. ID: '',
  233. 名称: '请选择版本状态'
  234. }, {
  235. ID: '1',
  236. 名称: '未发布'
  237. }, {
  238. ID: '5',
  239. 名称: '已发布'
  240. }]
  241. });
  242. $('#ChargePersonID').combobox({
  243. url: '/PersonManager/GetPersonByJob?Nature=1',
  244. method: 'GET',
  245. valueField: 'ID',
  246. textField: '姓名',
  247. editable: true,
  248. onSelect: function (record) {
  249. $('#ChargePerson').val(record.姓名);
  250. }
  251. });
  252. },
  253. this.InitVersionProblem = function () {
  254. var version = $('#productVersionInfo').treegrid("getSelected").ID;
  255. var product = $("#Product").combobox('getValue');
  256. var search = $('#dtn-search-Problem').searchbox('getValue');
  257. var XMID = $("#XMID").val();
  258. if (XMID == undefined) {
  259. XMID = "";
  260. }
  261. var AcceptedId = $("#SLRID").combobox('getValue');
  262. //初始化版本问题列表
  263. $("#VersionProblem").datagrid({
  264. url: "/Problem/GetVersionProblem",
  265. method: 'Get',
  266. pagination: true,
  267. singleSelect: true,
  268. fit: true,
  269. rownumbers: true,
  270. toolbar: '#btn_promb',
  271. queryParams: { ProductId: product, VersionId: version, SearchText: search, projectId: XMID, AcceptedId: AcceptedId },
  272. columns: [[
  273. {
  274. field: '编号', title: '编号', sortable: true, width: 60, align: 'center', styler: function (val, row, index) {
  275. if (row.是否紧急 == 1) {
  276. return " font-weight: bold ; ";
  277. }
  278. }
  279. },
  280. {
  281. field: '问题性质', title: '性质', width: 60, align: 'center', formatter: function (val, row, index) {
  282. switch (val) {
  283. case 1:
  284. return "<i class='fa fa-bug' title='Bug' style='color:red'>Bug</i>";
  285. case 2:
  286. return "<i class='fa fa-commenting-o' title='咨询'>咨询</i>";
  287. case 3:
  288. return "<i class='fa fa-dropbox' title='需求' style='color:#3279b6'>需求</i>";
  289. case 4:
  290. return "<i class='fa fa-history' title='任务'>任务</i>";
  291. default:
  292. break;
  293. }
  294. }
  295. },
  296. {
  297. field: '问题标题', title: '【问题标题】', width: 300, halign: 'center', styler: function (val, row, index) {
  298. if (row.是否紧急 == 1) {
  299. return " font-weight: bold ; ";
  300. }
  301. }
  302. },
  303. { field: '版本', title: '版本号', width: 150, align: 'center' },
  304. { field: '产品', title: '产品类型', width: 100, align: 'center' },
  305. { field: '模块', title: '产品模块', width: 100, align: 'center' },
  306. { field: '解决版本状态', title: '状态', width: 60, sortable: true, align: 'center' },
  307. { field: '受理人', title: '当前受理人', sortable: true, width: 60, align: 'center' },
  308. { field: '紧急补丁时间', title: '紧急补丁时间', sortable: true, width: 90, align: 'center' },
  309. { field: '说明', title: '说明', width: 300, align: 'center' },
  310. { field: '登记人', title: '登记人', width: 60, align: 'center' },
  311. { field: '登记日期', title: '登记日期', sortable: true, width: 140, align: 'center' },
  312. { field: '渠道', title: '分公司(渠道)', width: 100, align: 'center' },
  313. { field: '项目', title: '所在项目', width: 100, sortable: true, align: 'center' },
  314. { field: '机构', title: '医疗机构', width: 100, align: 'center' }
  315. ]],
  316. onDblClickRow: function (rowIndex, rowData) {
  317. that.checkproblem();
  318. }
  319. })
  320. },
  321. //查看问题弹窗
  322. this.checkproblem = function () {
  323. var that = this
  324. var WT = $('#VersionProblem').datagrid("getSelected");
  325. if (WT == null) {
  326. top.ZLPMS.Msg("请选择一行数据!");
  327. }
  328. else {
  329. top.ZLPMS.OpenNewWindow("查看问题", "/Problem/CheckProblemWindow/" + WT["ID"], '880px', '600px', function () {
  330. that.DealProblem(1,1, WT["ID"]);
  331. });
  332. }
  333. },
  334. //处理问题
  335. this.DealProblem = function (showAtt, IsSupport, ProblemId) {
  336. var that = this
  337. //是否为技术支持处理
  338. IsSupport = IsSupport || 0;
  339. //受理问题
  340. var receiveProblem = function (title, HJID) {
  341. var index = top.ZLPMS.Loading3(2);
  342. //受理问题
  343. $.ajax({
  344. url: '/Support/ReceiveProblem',
  345. data: { id: ProblemId },
  346. method: 'post',
  347. success: function (data) {
  348. top.ZLPMS.UnLoading(index);
  349. var url = "/Problem/ProductionPdeal?id=" + ProblemId + "&showAtt=" + showAtt + '&workflowid=' + HJID + '&IsSupport=' + IsSupport;
  350. //成功后调用
  351. if (data.code == 200) {
  352. top.ZLPMS.OpenNewWindow("处理问题:" + title, url, '1000px', '640px', function () {
  353. //回调用刷新(只有确定后才刷新)
  354. });
  355. } else {//显示具体原因,并提示是否强制处理
  356. top.ZLPMS.Confirm('该问题已被他人受理,您确定要继续处理吗?', 3, function (idx) {
  357. top.ZLPMS.CloseWindow(idx);
  358. top.ZLPMS.OpenNewWindow("处理问题", url, '1000px', '640px');
  359. })
  360. }
  361. }
  362. });
  363. };
  364. $.post('/Problem/GetProblemById/' + ProblemId, function (data) {
  365. var row = data[0];
  366. if (row) {
  367. /*已关闭的问题,已解决的问题,已受理的问题, 不需要处理*/
  368. if (row.是否终止 == 1) {
  369. top.ZLPMS.Msg('已终止的问题不需要再处理!');
  370. return;
  371. }
  372. if (row.是否解决 == 1) {
  373. top.ZLPMS.Msg('已解决的问题不需要再处理!');
  374. return;
  375. }
  376. if (row.环节ID > 3 && that.PersonProperty != '1') {
  377. top.ZLPMS.Msg('非本部人员不能处理技术支持与研发处理环节问题,仅能查阅!');
  378. return;
  379. }
  380. if (row.环节ID == 3 && (that.PersonProperty == '3' || that.PersonProperty == '4' || that.PersonProperty == '5')) {//客户,机构管理员,卫计委人员无法处理项目问题
  381. top.ZLPMS.Msg('客户,机构管理员,卫计委人员无法处理项目问题,仅能查阅!');
  382. return;
  383. }
  384. //打开处理窗口
  385. receiveProblem(row.编号, row.环节ID);
  386. } else {//提醒用户没有选择问题记录
  387. top.ZLPMS.Msg('没有选择需要处理的问题记录,请选择后再处理!');
  388. }
  389. })
  390. }
  391. }
  392. function Refresh(_mode) {
  393. if (_mode == "0") {
  394. var product = $("#Product").combobox('getValue');
  395. var type = $('input:radio:checked').val();
  396. var Params = {
  397. ProductID: product,
  398. States: type
  399. }
  400. $('#productVersionInfo').treegrid({
  401. url: '/Product/productVersionInfoTreeGrid',
  402. method: 'GET',
  403. queryParams: Params
  404. });
  405. }
  406. if (_mode == "1") {
  407. var Node = $('#productVersionInfo').treegrid("getSelected");
  408. var Params = {
  409. ProductVerID: Node.ID
  410. }
  411. $('#VerisonFile').datagrid({
  412. url: '/Product/ProductVerAnnexDataGrid',
  413. method: 'GET',
  414. queryParams: Params,
  415. fit: true,
  416. toolbar: '#ftb',
  417. rownumbers: true,
  418. pagination: false,
  419. singleSelect: true,
  420. border: false,
  421. columns: [[
  422. { field: '添加人', title: '添加人', width: 200, align: 'center' },
  423. { field: '添加时间', title: '添加时间', width: 300, align: 'center', halign: 'center' },
  424. {
  425. field: '类型', title: '类型', width: 200, align: 'center', formatter: function (value, row, index) {
  426. if (value == "1") {
  427. return "脚本";
  428. }
  429. else if (value == "2") {
  430. return "对象";
  431. } else if (value == "3") {
  432. return "其他";
  433. }
  434. }
  435. }
  436. ]],
  437. onLoadSuccess: function () {
  438. }
  439. });
  440. }
  441. }
  442. //表单操作(产品版本)
  443. var Forms = {
  444. //表单提交
  445. Submit: function (index, layero) {
  446. var iframeWin = ZLPMS.GetChildFrame(layero);//得到iframe页的窗口对象,执行iframe页的方法:
  447. var param = iframeWin.Forms.PostData();//调用子页面的方法,得到子页面返回的ids
  448. if (param != null) {
  449. var url = '/Product/PostSaveProductVersion';
  450. $.post(url, param, function (data) {
  451. if (data.code == 200) {
  452. top.ZLPMS.CloseWindow(index);
  453. top.ZLPMS.Msg(data.msg);
  454. //刷新
  455. Refresh("0");
  456. } else {
  457. ZLPMS.Msg(data.msg, 2);
  458. }
  459. });
  460. }
  461. },
  462. //加载数据
  463. Load: function (data) {
  464. $('#ff').form('load', data);
  465. },
  466. //读取数据
  467. PostData: function () {
  468. //执行提交验证
  469. var r = $('#ff').form('validate');
  470. if (r) {//post到后台
  471. var param = ZLPMS.FormToObject('ff');
  472. return param;
  473. }
  474. return null;
  475. }
  476. };