coe.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536
  1. /**
  2. * Created by CSL on 2017-05-18.
  3. */
  4. //modiyied by zhong on 2017/9/21
  5. var pageObj = {
  6. libID: null,
  7. gljLibID: null,
  8. initPage: function (){
  9. $("#drirect-dinge").click(function(){
  10. $(this).attr('href', "/rationRepository/ration" + "?repository=" + getQueryString("repository"))
  11. });
  12. $("#gongliao").click(function(){
  13. $(this).attr('href', "/rationRepository/lmm" + "?repository=" + getQueryString("repository"))
  14. });
  15. var libID = getQueryString("repository");
  16. var libName = storageUtil.getSessionCache("RationGrp","repositoryID_" + libID);
  17. if (libName) {
  18. var html = $("#rationname")[0].outerHTML;
  19. html = html.replace("XXX定额库", libName);
  20. $("#rationname")[0].outerHTML = html;
  21. };
  22. this.gljLibID = storageUtil.getSessionCache("gljLib", "repositoryID_" + libID);
  23. this.libID = libID;
  24. coeOprObj.buildSheet($('#mainSpread')[0]);
  25. gljAdjOprObj.buildSheet($('#contentSpread')[0]);
  26. coeOprObj.getCoeList();
  27. gljAdjOprObj.getGljItemsOcc();
  28. },
  29. showData: function(sheet, setting, data) {
  30. let me = pageObj, ch = GC.Spread.Sheets.SheetArea.viewport;
  31. sheet.suspendPaint();
  32. sheet.suspendEvent();
  33. sheet.clear(0, 0, sheet.getRowCount(), sheet.getColumnCount(), GC.Spread.Sheets.SheetArea.viewport, GC.Spread.Sheets.StorageType.data);
  34. sheet.setRowCount(data.length + 3);
  35. for (let col = 0; col < setting.header.length; col++) {
  36. var hAlign = "left", vAlign = "center";
  37. if (setting.header[col].hAlign) {
  38. hAlign = setting.header[col].hAlign;
  39. } else if (setting.header[col].dataType !== "String"){
  40. hAlign = "right";
  41. }
  42. if(setting.header[col].readOnly){
  43. sheet.getRange(-1, col, -1, 1).locked(true);
  44. }
  45. else{
  46. sheet.getRange(-1, col, -1, 1).locked(false);
  47. }
  48. vAlign = setting.header[col].vAlign?setting.header[col].vAlign:vAlign;
  49. sheetCommonObj.setAreaAlign(sheet.getRange(-1, col, -1, 1), hAlign, vAlign);
  50. if (setting.header[col].formatter) {
  51. sheet.setFormatter(-1, col, setting.header[col].formatter, GC.Spread.Sheets.SheetArea.viewport);
  52. }
  53. for (let row = 0; row < data.length; row++) {
  54. let val = data[row][setting.header[col].dataCode];
  55. sheet.setValue(row, col, val, ch);
  56. }
  57. }
  58. sheet.resumeEvent();
  59. sheet.resumePaint();
  60. }
  61. };
  62. let coeOprObj = {
  63. workBook: null,
  64. workSheet: null,
  65. currentCoeList: [],
  66. currentCoe: null,
  67. //currentMaxNo: null,
  68. setting: {
  69. header: [
  70. {headerName:"编号", headerWidth:60, dataCode:"ID", dataType: "String", hAlign: "center", vAlign: "center", readOnly: true},
  71. {headerName:"名称", headerWidth:280, dataCode:"name", dataType: "String", hAlign: "left", vAlign: "center", readOnly: false},
  72. {headerName:"内容", headerWidth:250, dataCode:"content", dataType: "String", hAlign: "left", vAlign: "center", readOnly: false},
  73. ]
  74. },
  75. buildSheet: function (container) {
  76. let me = coeOprObj;
  77. me.workBook = sheetCommonObj.buildSheet(container, me.setting, 30);
  78. me.workSheet = me.workBook.getSheet(0);
  79. me.workSheet.options.isProtected = true;
  80. me.onDelOpr(me.workBook, me.setting);
  81. me.workSheet.bind(GC.Spread.Sheets.Events.SelectionChanged, me.onSelectionChanged);
  82. me.workSheet.bind(GC.Spread.Sheets.Events.EditEnded, me.onEditEnded);
  83. me.workBook.bind(GC.Spread.Sheets.Events.ClipboardPasting, me.onClipboardPasting);
  84. me.workBook.bind(GC.Spread.Sheets.Events.ClipboardPasted, me.onClipboardPasted);
  85. },
  86. onSelectionChanged: function (sender, info) {
  87. let me = coeOprObj, that = gljAdjOprObj;
  88. if(info.oldSelections.length === 0 && info.newSelections.length > 0 || info.oldSelections[0].row !== info.newSelections[0].row){
  89. let row = info.newSelections[0].row;
  90. if(row < me.currentCoeList.length){
  91. me.currentCoe = me.currentCoeList[row];
  92. that.currentGljAdjList = me.currentCoe.coes;
  93. }
  94. else{
  95. me.currentCoe = null;
  96. that.currentGljAdjList = [];
  97. }
  98. //refresh & show coes
  99. sheetCommonObj.cleanSheet(that.workSheet, that.setting, -1);
  100. me.workBook.focus(true);
  101. that.show(that.currentGljAdjList);
  102. }
  103. },
  104. onEditEnded: function (sender, args) {
  105. let me = coeOprObj, addArr = [], updateArr = [], dataCode = me.setting.header[args.col].dataCode;
  106. if(args.editingText && args.editingText.toString().trim().length > 0){
  107. //update
  108. if(args.row < me.currentCoeList.length){
  109. let updateObj = me.currentCoeList[args.row];
  110. if(updateObj[dataCode] !== args.editingText.toString().trim()){
  111. updateObj[dataCode] = args.editingText;
  112. updateArr.push(updateObj);
  113. me.save([], updateArr, [], true);
  114. }
  115. }
  116. //insert
  117. else{
  118. let newCoe = {};
  119. //me.currentMaxNo ++;
  120. newCoe.libID = pageObj.libID;
  121. //newCoe.serialNo = me.currentMaxNo;
  122. newCoe[dataCode] = args.editingText;
  123. addArr.push(newCoe);
  124. me.save(addArr, [], [], true, function (result) {
  125. me.updateCurrentCoeList(result);
  126. });
  127. }
  128. }
  129. },
  130. onClipboardPasting: function (sender, info) {
  131. let me = coeOprObj, maxCol = info.cellRange.col + info.cellRange.colCount - 1;
  132. if(maxCol > me.setting.header.length){
  133. info.cancel = true;
  134. }
  135. },
  136. onClipboardPasted: function (sender, info) {
  137. let me = coeOprObj, addArr = [], updateArr = [];
  138. let items = sheetCommonObj.analyzePasteData(me.setting, info);
  139. for(let i = 0, len = items.length; i < len; i++){
  140. let row = i + info.cellRange.row;
  141. //update
  142. if(row < me.currentCoeList.length){
  143. let updateObj = me.currentCoeList[row];
  144. for(let attr in items[i]){
  145. updateObj[attr] = items[i][attr];
  146. }
  147. updateArr.push(updateObj);
  148. }
  149. //insert
  150. else {
  151. //items[i].serialNo = ++ me.currentMaxNo;
  152. items[i].libID = pageObj.libID;
  153. addArr.push(items[i]);
  154. }
  155. }
  156. if(addArr.length > 0 || updateArr.length > 0){
  157. me.save(addArr, updateArr, [], true, function (result) {
  158. me.updateCurrentCoeList(result)
  159. });
  160. }
  161. },
  162. onDelOpr: function (workBook, setting) {
  163. let me = coeOprObj, that = gljAdjOprObj;
  164. workBook.commandManager().register('coeListDel', function () {
  165. let deleteArr = [];
  166. let sheet = workBook.getSheet(0);
  167. let sels = sheet.getSelections();
  168. let idx = sels[0].row;
  169. for(let i = 0, len = sels.length; i < len; i++){
  170. if(idx > sels[i].row){
  171. idx = sels[i].row;
  172. }
  173. if(sels[i].colCount === setting.header.length){//can del
  174. for(let r = 0, rLen = sels[i].rowCount; r < rLen; r++){
  175. let row = sels[i].row + r;
  176. if(row < me.currentCoeList.length){
  177. deleteArr.push({libID: me.currentCoeList[row].libID, ID: me.currentCoeList[row].ID});
  178. }
  179. }
  180. me.currentCoeList.splice(sels[i].row, sels[i].rowCount);
  181. }
  182. }
  183. if(deleteArr.length > 0){
  184. me.save([], [], deleteArr, true);
  185. me.currentCoe = typeof me.currentCoeList[idx] !== 'undefined' ? me.currentCoeList[idx] : null;
  186. that.currentGljAdjList = me.currentCoe ? me.currentCoe.coes : [];
  187. gljAdjOprObj.show(that.currentGljAdjList);
  188. }
  189. });
  190. workBook.commandManager().setShortcutKey(null, GC.Spread.Commands.Key.del, false, false, false, false);
  191. workBook.commandManager().setShortcutKey('coeListDel', GC.Spread.Commands.Key.del, false, false, false, false);
  192. },
  193. updateCurrentCoeList: function (newCoeList) {
  194. let me = coeOprObj;
  195. me.currentCoeList = me.currentCoeList.concat(newCoeList);
  196. me.sortCoeList(me.currentCoeList);
  197. },
  198. sortCoeList: function (coeList) {
  199. coeList.sort(function (a, b) {
  200. let rst = 0;
  201. if(a.ID > b.ID) rst = 1;
  202. else if(a.ID < b.ID) rst = -1;
  203. return rst;
  204. });
  205. },
  206. getCoeList: function () {
  207. let me = coeOprObj;
  208. $.ajax({
  209. type: 'post',
  210. url: '/rationRepository/api/getCoeList',
  211. data: {libID: pageObj.libID},
  212. dataType: 'json',
  213. timeout:20000,
  214. success: function (result) {
  215. if(!result.error){
  216. me.currentCoeList = result.data;
  217. me.sortCoeList(me.currentCoeList);
  218. //me.currentMaxNo = me.currentCoeList.length > 0 ? me.currentCoeList[me.currentCoeList.length - 1].serialNo : 0;
  219. pageObj.showData(me.workSheet, me.setting, me.currentCoeList);
  220. me.workSheet.clearSelection();
  221. }
  222. },
  223. error:function(err){
  224. alert("内部程序错误!");
  225. }
  226. });
  227. },
  228. save: function (addArr, updateArr, deleteArr, refresh, callback) {
  229. let me = coeOprObj;
  230. $.ajax({
  231. type:"POST",
  232. url:"api/saveCoeList",
  233. data: {data: JSON.stringify({addArr: addArr, updateArr: updateArr, deleteArr: deleteArr})},
  234. dataType:"json",
  235. timeout:5000,
  236. success:function(result){
  237. if (result.error) {
  238. alert(result.message);
  239. } else{
  240. if(callback){
  241. if(result.message === 'mixed'){
  242. for(let i = 0, len = result.data.length; i < len; i++){
  243. if(result.data[i][0] === 'addSc'){
  244. result.data = result.data[i][1];
  245. break;
  246. }
  247. }
  248. }
  249. callback(result.data);
  250. }
  251. if(refresh){
  252. pageObj.showData(me.workSheet, me.setting, me.currentCoeList);
  253. }
  254. }
  255. },
  256. error:function(err){
  257. alert("内部程序错误!");
  258. }
  259. });
  260. }
  261. };
  262. let gljAdjOprObj = {
  263. workBook: null,
  264. workSheet: null,
  265. currentGljAdjList: [],
  266. gljList: [],//只含编号和名称的总工料机列表
  267. setting: {
  268. header: [
  269. {headerName:"调整类型", headerWidth:100, dataCode:"coeType", dataType: "String", hAlign: "center", vAlign: "center", readOnly: false},
  270. {headerName:"工料机编码", headerWidth:100, dataCode:"gljCode", dataType: "String", formatter: '@', hAlign: "center", vAlign: "center", readOnly: false},
  271. {headerName:"名称", headerWidth:100, dataCode:"gljName", dataType: "String", hAlign: "center", vAlign: "center", readOnly: true},
  272. {headerName:"操作符", headerWidth:60, dataCode:"operator", dataType: "String", hAlign: "center", vAlign: "center", readOnly: false},
  273. {headerName:"数量", headerWidth:80, dataCode:"amount", dataType: "String", hAlign: "center", vAlign: "center" , readOnly: false},
  274. ],
  275. comboItems: {
  276. //调整类型下拉菜单
  277. coeType: ['定额子目', '人工类', '材料类', '机械类', '主材类', '设备类', '单个工料机'],
  278. //操作符下拉菜单
  279. operator: ['+', '-', '*', '/', '=']
  280. }
  281. },
  282. buildSheet: function (container) {
  283. let me = gljAdjOprObj;
  284. me.workBook = sheetCommonObj.buildSheet(container, me.setting, 3);
  285. me.workSheet = me.workBook.getSheet(0);
  286. me.workSheet.options.isProtected = true;
  287. me.onDelOpr(me.workBook, me.setting);
  288. me.workSheet.clearSelection();
  289. me.buildComboBox(me.workSheet);
  290. me.workSheet.bind(GC.Spread.Sheets.Events.EditStarting, me.onEditStart);
  291. me.workSheet.bind(GC.Spread.Sheets.Events.EditEnded, me.onEditEnded);
  292. me.workSheet.bind(GC.Spread.Sheets.Events.ClipboardPasting, me.onClipboardPasting);
  293. me.workSheet.bind(GC.Spread.Sheets.Events.ClipboardPasted, me.onClipboardPasted);
  294. },
  295. buildComboBox: function (sheet) {
  296. let me = gljAdjOprObj;
  297. sheet.suspendPaint();
  298. sheet.suspendEvent();
  299. let comboType = new GC.Spread.Sheets.CellTypes.ComboBox();
  300. comboType.items(me.setting.comboItems.coeType);
  301. let comboOpr = new GC.Spread.Sheets.CellTypes.ComboBox();
  302. comboOpr.items(me.setting.comboItems.operator);
  303. sheet.getCell(-1, 0).cellType(comboType);
  304. sheet.getCell(-1, 3).cellType(comboOpr);
  305. sheet.resumePaint();
  306. sheet.resumeEvent();
  307. },
  308. onEditStart: function (sender, args) {
  309. let me = gljAdjOprObj;
  310. if(!coeOprObj.currentCoe || args.row >= me.currentGljAdjList.length && args.col === 1
  311. || args.row < me.currentGljAdjList.length && args.col === 1 && me.currentGljAdjList[args.row].coeType !== '单个工料机'){
  312. args.cancel = true;
  313. }
  314. }
  315. ,
  316. onEditEnded: function (sender, args) {
  317. let me = gljAdjOprObj, isUpdate = false,
  318. dataCode = me.setting.header[args.col].dataCode;
  319. if(args.editingText && args.editingText.toString().trim().length > 0){
  320. if(dataCode === 'amount' && isNaN(args.editingText)){
  321. args.sheet.setValue(args.row, args.col, typeof me.currentGljAdjList[args.row] !== 'undefined' && typeof me.currentGljAdjList[args.row][dataCode] !== 'undefined'
  322. ? me.currentGljAdjList[args.row][dataCode] + '' : '');
  323. alert("只能输入数值!");
  324. }
  325. else {
  326. //update
  327. if(args.row < me.currentGljAdjList.length && args.editingText.toString().trim() !== me.currentGljAdjList[args.row][dataCode]){
  328. let updateObj = me.currentGljAdjList[args.row];
  329. if(dataCode === 'gljCode' && typeof updateObj.coeType !== 'undefined' && updateObj.coeType === '单个工料机'){
  330. let gljName = me.getGljName(args.editingText, me.gljList);
  331. if(gljName){
  332. updateObj.gljCode = args.editingText;
  333. updateObj.gljName = gljName;
  334. isUpdate = true;
  335. }
  336. else {
  337. alert("不存在编号为"+ args.editingText +"的工料机");
  338. }
  339. }
  340. else if(dataCode !== 'gljCode') {
  341. isUpdate = true;
  342. updateObj[dataCode] = args.editingText;
  343. }
  344. }
  345. //insert
  346. else if(args.row >= me.currentGljAdjList.length){
  347. isUpdate = true;
  348. let newAdjGlj = {};
  349. newAdjGlj[dataCode] = args.editingText;
  350. me.currentGljAdjList.push(newAdjGlj);
  351. }
  352. if(isUpdate){
  353. coeOprObj.save([], [coeOprObj.currentCoe], [], false, function () {
  354. me.show(me.currentGljAdjList);
  355. });
  356. }
  357. else {
  358. args.sheet.setValue(args.row, args.col, typeof me.currentGljAdjList[args.row] !== 'undefined' && typeof me.currentGljAdjList[args.row][dataCode] !== 'undefined'
  359. ? me.currentGljAdjList[args.row][dataCode] + '' : '');
  360. }
  361. }
  362. }
  363. },
  364. onClipboardPasting: function (sender, info) {
  365. },
  366. getValidPasteDatas: function (pasteItems, info) {
  367. let me = gljAdjOprObj;
  368. let rst = [];
  369. for(let i = 0, len = pasteItems.length; i < len; i++){
  370. let row = i + info.cellRange.row;
  371. let validObj = {};
  372. //update
  373. if(row < me.currentGljAdjList.length){
  374. let updateObj = me.currentGljAdjList[row];
  375. if(typeof pasteItems[i].coeType !== 'undefined' && typeof pasteItems[i].gljCode !== 'undefined'){
  376. let gljName = me.getGljName(pasteItems[i].gljCode, me.gljList);
  377. if(pasteItems[i].coeType === '单个工料机' && gljName){
  378. validObj.coeType = pasteItems[i].coeType;
  379. validObj.gljCode = pasteItems[i].gljCode;
  380. validObj.gljName = gljName;
  381. }
  382. else if(pasteItems[i].coeType !== '单个工料机' && me.setting.comboItems.coeType.indexOf(pasteItems[i].coeType) !== -1){
  383. validObj.coeType = pasteItems[i].coeType;
  384. }
  385. }
  386. else if(typeof pasteItems[i].coeType === 'undefined' && typeof pasteItems[i].gljCode !== 'undefined'){
  387. let gljName = me.getGljName(pasteItems[i].gljCode, me.gljList);
  388. if(typeof updateObj.coeType !== 'undefined' && updateObj.coeType === '单个工料机' && gljName){
  389. validObj.gljCode = pasteItems[i].gljCode;
  390. validObj.gljName = gljName;
  391. }
  392. }
  393. else if(typeof pasteItems[i].coeType !== 'undefined' && typeof pasteItems[i].gljCode === 'undefined'){
  394. if(me.setting.comboItems.coeType.indexOf(pasteItems[i].coeType) !== -1){
  395. validObj.coeType = pasteItems[i].coeType;
  396. if(validObj.coeType !== '单个工料机' && typeof updateObj.gljCode !== '单个工料机' && updateObj.gljCode.toString().trim().length > 0){
  397. validObj.gljCode = '';
  398. validObj.gljName = '';
  399. }
  400. }
  401. }
  402. else {
  403. if(typeof pasteItems[i].operator !== 'undefined' && me.setting.comboItems.operator.indexOf(pasteItems[i].operator) !== -1){
  404. validObj.operator = pasteItems[i].operator;
  405. }
  406. if(typeof pasteItems[i].amount !== 'undefined' && !isNaN(pasteItems[i].amount)){
  407. validObj.amount = pasteItems[i].amount;
  408. }
  409. }
  410. }
  411. else {
  412. if(typeof pasteItems[i].coeType !== 'undefined' && typeof pasteItems[i].gljCode !== 'undefined'){
  413. let gljName = me.getGljName(pasteItems[i].gljCode, me.gljList);
  414. if(pasteItems[i].coeType === '单个工料机' && gljName){
  415. validObj.coeType = pasteItems[i].coeType;
  416. validObj.gljCode = pasteItems[i].gljCode;
  417. validObj.gljName = gljName;
  418. }
  419. else if(pasteItems[i].coeType !== '单个工料机' && me.setting.comboItems.coeType.indexOf(pasteItems[i].coeType) !== -1){
  420. validObj.coeType = pasteItems[i].coeType;
  421. }
  422. }
  423. else if(typeof pasteItems[i].gljCode === 'undefined') {
  424. if(typeof pasteItems[i].coeType !== 'undefined' && me.setting.comboItems.coeType.indexOf(pasteItems[i].coeType) !== -1){
  425. validObj.coeType = pasteItems[i].coeType;
  426. }
  427. if(typeof pasteItems[i].operator !== 'undefined' && me.setting.comboItems.operator.indexOf(pasteItems[i].operator) !== -1){
  428. validObj.operator = pasteItems[i].operator;
  429. }
  430. if(typeof pasteItems[i].amount !== 'undefined' && !isNaN(pasteItems[i].amount)){
  431. validObj.amount = pasteItems[i].amount;
  432. }
  433. }
  434. }
  435. if(Object.keys(validObj).length > 0){
  436. rst.push(validObj);
  437. }
  438. }
  439. return rst;
  440. },
  441. onClipboardPasted: function (sender, info) {
  442. let me = gljAdjOprObj, row;
  443. let items = sheetCommonObj.analyzePasteData(me.setting, info);
  444. let validDatas = me.getValidPasteDatas(items, info);
  445. for(let i = 0, len = validDatas.length; i < len; i++){
  446. row = i + info.cellRange.row;
  447. //update
  448. if(row < me.currentGljAdjList.length){
  449. let updateObj = me.currentGljAdjList[row];
  450. for(let attr in validDatas[i]){
  451. updateObj[attr] = validDatas[i][attr];
  452. }
  453. }
  454. //insert
  455. else{
  456. me.currentGljAdjList.push(validDatas[i]);
  457. }
  458. }
  459. if(validDatas.length > 0){
  460. coeOprObj.save([], [coeOprObj.currentCoe], [], false, function () {
  461. me.show(me.currentGljAdjList);
  462. });
  463. }
  464. else {
  465. me.show(me.currentGljAdjList);
  466. }
  467. },
  468. onDelOpr: function (workBook, setting) {
  469. let me = gljAdjOprObj;
  470. workBook.commandManager().register('gljAdjDel', function () {
  471. let sheet = workBook.getSheet(0);
  472. let sels = sheet.getSelections();
  473. let isUpdate = false;
  474. for(let i = 0, len = sels.length; i < len; i++){
  475. if(sels[i].colCount === setting.header.length){//can del
  476. if(sels[i].row < me.currentGljAdjList.length){
  477. isUpdate = true;
  478. me.currentGljAdjList.splice(sels[i].row, sels[i].rowCount);
  479. }
  480. }
  481. }
  482. if(isUpdate){
  483. coeOprObj.save([], [coeOprObj.currentCoe], [], false, function () {
  484. me.show(me.currentGljAdjList);
  485. });
  486. }
  487. });
  488. workBook.commandManager().setShortcutKey(null, GC.Spread.Commands.Key.del, false, false, false, false);
  489. workBook.commandManager().setShortcutKey('gljAdjDel', GC.Spread.Commands.Key.del, false, false, false, false);
  490. },
  491. getGljName: function (gljCode, gljList) {
  492. let rst = null;
  493. for(let i = 0, len = gljList.length; i < len; i++){
  494. if(gljCode === gljList[i].code){
  495. rst = gljList[i].name;
  496. break;
  497. }
  498. }
  499. return rst;
  500. },
  501. show: function (coes) {
  502. let me = gljAdjOprObj;
  503. pageObj.showData(me.workSheet, me.setting, coes)
  504. },
  505. getGljItemsOcc: function () {
  506. let me = gljAdjOprObj;
  507. $.ajax({
  508. type: 'post',
  509. url: '/stdGljRepository/api/getGljItemsOccupied',
  510. data: {repId: pageObj.gljLibID, occupation: '-_id code name'},
  511. dataType: 'json',
  512. timeout: 5000,
  513. success:function(result){
  514. if (result.error) {
  515. alert(result.message);
  516. } else{
  517. me.gljList = result.data;
  518. }
  519. },
  520. error:function(err){
  521. alert("内部程序错误!");
  522. }
  523. });
  524. }
  525. };