zmhs_view.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. /**
  2. * Created by zhang on 2018/5/30.
  3. */
  4. let zmhs_obj = {
  5. module: 'subZmhs',
  6. coeSpread:null,
  7. coeSheet:null,
  8. coeSheetData:[],
  9. coeSetting: {
  10. header: [
  11. {headerName: "调整", headerWidth: 35, dataCode: "isAdjust", dataType: "String", cellType: "checkBox"},
  12. {headerName: "条件", headerWidth: 250, dataCode: "name", dataType: "String", cellType: "button"},
  13. {headerName: "内容", headerWidth: 160, dataCode: "content", dataType: "String", hAlign: "left",getText:'forContent'}
  14. ],
  15. view: {
  16. lockColumns:[0,1,2],
  17. rowHeaderWidth:25
  18. },
  19. getText:{
  20. forContent:function (item) {
  21. if(gljUtil.isDef(item.select_code)&&item.select_code!=""){
  22. let option = _.find(item.option_list,{"value":item.select_code})
  23. return option?option.text:item.select_code;
  24. }else {
  25. return item.content;
  26. }
  27. }
  28. },
  29. emptyRowHeader: true,
  30. autoFit:true,
  31. fitRow:['name','content']
  32. },
  33. cusSpread:null,
  34. cusSheet:null,
  35. cusSheetData:null,
  36. cusSetting:{
  37. header: [
  38. {headerName: "类型", headerWidth: 250, dataCode: "coeType", dataType: "String",hAlign: "left"},
  39. {headerName: "系数", headerWidth: 160, dataCode: "amount", dataType: "String", hAlign: "right",validator:"number"}
  40. ],
  41. view: {
  42. lockColumns:["coeType"],
  43. rowHeaderWidth:25
  44. },
  45. emptyRowHeader: true
  46. },
  47. assSpread:null,
  48. assSheet:null,
  49. assSheetData: [],
  50. assSetting: {
  51. header: [
  52. {headerName: "调整名称", headerWidth: 100, dataCode: "name", dataType: "String"},
  53. {headerName: "定额值", headerWidth: 80, dataCode: "stdValue", hAlign: "right", dataType: "String"},
  54. {headerName: "实际值", headerWidth: 80, dataCode: "actualValue", hAlign: "right", dataType: "String"}
  55. ],
  56. view: {
  57. lockColumns: [0, 1],
  58. rowHeaderWidth:25
  59. },
  60. emptyRowHeader: true
  61. },
  62. initSpread:function () {
  63. this.initCoeSpread();
  64. this.initAssSpread();
  65. },
  66. initCoeSpread:function () {
  67. if(zmhs_obj.coeSpread == null){
  68. this.coeSpread = SheetDataHelper.createNewSpread($("#coeSpread")[0]);
  69. sheetCommonObj.spreadDefaultStyle(this.coeSpread);
  70. this.coeSheet = this.coeSpread.getSheet(0);
  71. sheetCommonObj.initSheet(this.coeSheet, this.coeSetting, 30);
  72. this.coeSheet.name('ration_coe');
  73. this.coeSheet.bind(GC.Spread.Sheets.Events.CellClick, this.onCoeCellClick);
  74. this.coeSpread.bind(GC.Spread.Sheets.Events.ButtonClicked, this.onButtonClick);
  75. this.coeSheet.bind(GC.Spread.Sheets.Events.ValueChanged,this.onCoeValueChange);
  76. this.coeSheet.bind(GC.Spread.Sheets.Events.SelectionChanged, function (e,args) {
  77. args.sheet.repaint();
  78. });
  79. SheetDataHelper.protectdSheet(this.coeSheet);
  80. }
  81. },
  82. initCusSpread:function () {
  83. if(zmhs_obj.cusSpread == null){
  84. this.cusSpread = SheetDataHelper.createNewSpread($("#cusSpread")[0]);
  85. sheetCommonObj.spreadDefaultStyle(this.cusSpread);
  86. this.cusSheet = this.cusSpread.getSheet(0);
  87. sheetCommonObj.initSheet(this.cusSheet, this.cusSetting, 30);
  88. this.cusSheet.name('ration_cus');
  89. this.cusSheet.bind(GC.Spread.Sheets.Events.ValueChanged,this.onCusValueChange);
  90. this.cusSheet.bind(GC.Spread.Sheets.Events.RangeChanged, this.onCusRangeChanged);
  91. SheetDataHelper.protectdSheet(this.cusSheet);
  92. }
  93. },
  94. initAssSpread:function () {
  95. if(zmhs_obj.assSheet == null){
  96. this.assSpread = SheetDataHelper.createNewSpread($("#assSpread")[0]);
  97. sheetCommonObj.spreadDefaultStyle(this.assSpread);
  98. this.assSheet = this.assSpread.getSheet(0);
  99. sheetCommonObj.initSheet(this.assSheet, this.assSetting, 30);
  100. this.assSheet.bind(GC.Spread.Sheets.Events.EditEnded, this.onAssEditEnded);
  101. this.assSheet.bind(GC.Spread.Sheets.Events.RangeChanged, this.onAssRangeChanged);
  102. this.assSheet.name('ration_ass');
  103. SheetDataHelper.protectdSheet(this.assSheet);
  104. }
  105. },
  106. showCoeData:function (node) {
  107. let selected = node?node:projectObj.project.mainTree.selected;
  108. let ration_coe = projectObj.project.ration_coe;
  109. let coeList = [];
  110. if(selected&&selected.sourceType == "ration"){
  111. let ration = selected.data;
  112. coeList = ration_coe.getCoeByRationID(ration.ID);
  113. _.remove(coeList,{"coeID":-1})//2018-12-24 新需求,把自定义乘系数分离出来,这里排除自定义乘系数行
  114. }
  115. this.coeSheet.setRowCount(0);
  116. sheetCommonObj.showData(this.coeSheet, this.coeSetting,coeList);
  117. if (coeList.length > 0) {
  118. this.coeSheet.suspendPaint();
  119. this.coeSheet.suspendEvent();
  120. for(let i =0;i<coeList.length;i++ ){
  121. if(gljUtil.isDef(coeList[i].option_codes)&&coeList[i].option_codes!=""){
  122. this.getComboBoxForCodes(coeList[i],i);//设置可选类型的下拉框
  123. // sheet.setValue(row, col, val, ch);
  124. } else if(coeList[i].coeID == -1){ //自定义系数列
  125. this.coeSheet.getCell(i, 1, GC.Spread.Sheets.SheetArea.viewport).locked(false);
  126. this.coeSheet.setCellType(i, 1, sheetCommonObj.getCustomerCoeCellType(this.generateHtmlString,this.bindCusEditorValue,this.updateCusCoeAfterEditor), GC.Spread.Sheets.SheetArea.viewport);
  127. }
  128. }
  129. this.coeSheet.resumeEvent();
  130. this.coeSheet.resumePaint();
  131. }
  132. this.coeSheetData = coeList;
  133. if(projectReadOnly){
  134. disableSpread(zmhs_obj.coeSpread);
  135. }
  136. },
  137. showCusData:function (node) {
  138. let selected = node?node:projectObj.project.mainTree.selected;
  139. let ration_coe = projectObj.project.ration_coe;
  140. let cusList = [];
  141. if(selected&&selected.sourceType == "ration"){
  142. let ration = selected.data;
  143. let coeList = ration_coe.getCoeByRationID(ration.ID);
  144. this.cusSheetData = _.find(coeList,{"coeID":-1});
  145. if(this.cusSheetData) cusList = this.cusSheetData.coes;
  146. }
  147. sheetCommonObj.showData(this.cusSheet, this.cusSetting,cusList);
  148. this.cusSheet.getRange(cusList.length,-1,this.cusSheet.getRowCount()-cusList.length, -1, GC.Spread.Sheets.SheetArea.viewport).locked(true);
  149. if(projectReadOnly){
  150. disableSpread(zmhs_obj.cusSpread);
  151. }
  152. },
  153. getComboBoxForCodes:function (coe,i) {
  154. this.coeSheet.getCell(i, 2, GC.Spread.Sheets.SheetArea.viewport).locked(false);
  155. let options = coe.option_list; //coe.option_codes.split("|");
  156. let combo = sheetCommonObj.getDynamicCombo(true);
  157. let buttonRow = this.coeSheet.getViewportBottomRow(1);
  158. console.log(buttonRow);
  159. combo.editorValueType(GC.Spread.Sheets.CellTypes.EditorValueType.value);
  160. combo.items(options).maxDropDownItems(buttonRow - i -1 < 3 ?3:buttonRow - i -1 );//itemHeight(options.length).
  161. this.coeSheet.setCellType(i, 2, combo, GC.Spread.Sheets.SheetArea.viewport);
  162. this.coeSheet.setValue(i, 2, coe.select_code);
  163. },
  164. showAssData:function (node) {
  165. this.assSheet.suspendPaint();
  166. this.assSheet.suspendEvent();
  167. let selected = node?node:projectObj.project.mainTree.selected;
  168. let assList = selected&&selected.data.rationAssList ? selected.data.rationAssList : [];
  169. this.assSheet.setRowCount(0);
  170. sheetCommonObj.showData(this.assSheet, this.assSetting, assList);
  171. this.assSheetData = assList;
  172. this.assSheet.getRange(assList.length,-1,this.assSheet.getRowCount()-assList.length, -1, GC.Spread.Sheets.SheetArea.viewport).locked(true);
  173. this.assSheet.resumePaint();
  174. this.assSheet.resumeEvent();
  175. if(projectReadOnly){
  176. disableSpread(this.assSpread);
  177. }
  178. },
  179. refreshAfterUpdate:function(result,reload){
  180. let ration_glj = projectObj.project.ration_glj;
  181. let calcInstall = false;//是否记录安装增加费
  182. let nodes = projectObj.project.updateNodesCache([{type:ModuleNames.ration,data:result.ration}]);
  183. if(result.add && result.add.length > 0){//需添加定额工料机的情况
  184. ration_glj.datas = ration_glj.datas.concat(result.add);
  185. gljOprObj.sheetData = gljOprObj.sheetData.concat(result.add);
  186. }
  187. if(result.delete && result.delete.length > 0 && this.deleteGLJs(result.delete)) calcInstall = true; //这样保证delete返回值是true的时候才改变变量类型
  188. if(result.replace && result.replace.length > 0){ //替换工料机的情况
  189. for(let r of result.replace){//替换缓存内容
  190. ration_glj.datas.splice(_.findIndex(ration_glj.datas,{'ID': r.ID}),1,r);
  191. gljOprObj.sheetData.splice(_.findIndex(gljOprObj.sheetData,{'ID': r.ID}),1,r);
  192. let node = ration_glj.updateGLJNodeAfterReplace(r);
  193. if(node) nodes.push(node);
  194. }
  195. }
  196. projectObj.mainController.refreshTreeNode(nodes, false);
  197. let rationID= ration_glj.updateCacheAfterAdjust(result.ration_glj);
  198. if(reload == true){//有添加、替换、工料机等需重新加载的情况
  199. $.bootstrapLoading.start();
  200. projectObj.project.projectGLJ.loadData(function () {
  201. $.bootstrapLoading.end();
  202. if(result.add && result.add.length > 0) ration_glj.addToMainTree(result.add);//这个方法有再去项目工料机那里取价格,所以要在回调里调用,不像替换工料的情况
  203. ration_glj.reCalcWhenGLJChange({rationID:rationID});
  204. if(result.delete && result.delete.length > 0 && calcInstall) installationFeeObj.calcInstallationFee();//如果是删除节点的话,
  205. });
  206. }else {
  207. ration_glj.reCalcWhenGLJChange({rationID:rationID});
  208. }
  209. gljOprObj.showRationGLJSheetData(true);
  210. },
  211. deleteGLJs:function (IDs) {
  212. let ration_glj = projectObj.project.ration_glj;
  213. let glj_list = ration_glj.datas;
  214. let calcInstall = false;
  215. let oldData = _.remove(glj_list, function (o) {
  216. return _.includes(IDs,o.ID);
  217. });
  218. _.remove(gljOprObj.sheetData, function (o) {
  219. return _.includes(IDs,o.ID);
  220. });
  221. for (let o of oldData) {
  222. if (ration_glj.needShowToTree(o)) {
  223. let node = ration_glj.findGLJNodeByID(o.ID); //找到对应的树节点
  224. projectObj.mainController.deleteNode(node, null);
  225. calcInstall = true;
  226. }
  227. }
  228. return calcInstall;
  229. },
  230. refresh:function () {
  231. $('#coeSpread').is(':visible')&&this.coeSpread?this.coeSpread.refresh():'';
  232. $('#coeSpread').is(':visible')&&this.coeSpread?this.showDatas():'';//这里combobox下拉框要重新加载一下
  233. $('#cusSpread').is(':visible')&&this.cusSpread?this.cusSpread.refresh():'';
  234. $('#assSpread').is(':visible')&&this.assSpread?this.assSpread.refresh():'';
  235. },
  236. showDatas:function () {
  237. if($('#coeSpread').is(':visible')) this.showCoeData();
  238. if($('#cusSpread').is(':visible')) this.showCusData();
  239. if($('#assSpread').is(':visible')) this.showAssData();
  240. },
  241. showZMHSData:function (node) {
  242. if(this.coeSpread&& this.assSpread && $('#linkZMHS').hasClass('active')){
  243. this.showCoeData(node);
  244. this.showAssData(node);
  245. }
  246. },
  247. onCoeCellClick: function (sender, args) {
  248. let me = zmhs_obj;
  249. let sheet = args.sheet, row = args.row, col = args.col;
  250. if(sheet.getCell(row, col).locked() !=true){
  251. if(!sheet.isEditing()) sheet.startEdit();
  252. }
  253. },
  254. onButtonClick:function (sender, args) {
  255. let me = zmhs_obj;
  256. let sheet = args.sheet, row = args.row, col = args.col;
  257. let cellType = sheet.getCellType(row, col);
  258. if (args.sheetName == 'ration_coe' && cellType instanceof GC.Spread.Sheets.CellTypes.CheckBox) {
  259. me.onCoeCheckBoxClick(sender, args)
  260. }
  261. },
  262. bindCusEditorValue:function(context){
  263. let me = zmhs_obj;
  264. if(me.coeSheetData[context.row]){
  265. let data = me.coeSheetData[context.row];
  266. for(let c of data.coes){
  267. $("#"+ c.coeType).val(c.amount);
  268. }
  269. /*$('#coe_ration').val(data.coes[0].amount);
  270. $('#manual').val(data.coes[1].amount);
  271. $('#material').val(data.coes[2].amount);
  272. $('#manchine').val(data.coes[3].amount);
  273. $('#mainM').val(data.coes[4].amount);
  274. $('#equipment').val(data.coes[5].amount);*/
  275. }
  276. },
  277. updateCusCoeAfterEditor:function(){
  278. let me = zmhs_obj;
  279. let result = me.checkIfNeedUpdate();
  280. if (result.isNeed) {
  281. projectObj.project.ration_coe.updateCustomerCoe(result);
  282. }
  283. },
  284. onInputChange(id, name){
  285. var coe = _.find(zmhs_obj.coeSheetData, function (c) {
  286. return c.coeID == -1;
  287. });
  288. if(coe){
  289. let newValue = zmhs_obj.numberValueChecking($('#' + id).val());
  290. if (newValue) {
  291. newValue = _.round(newValue, 2);
  292. if (newValue == coe.coes[name].amount) return;
  293. if (id == '定额') {
  294. for(let c of coe.coes){
  295. $('#'+c.coeType).val(newValue)
  296. }
  297. } else {
  298. $('#' + id).val(newValue);
  299. }
  300. } else {
  301. $('#' + id).val(coe.coes[name].amount);
  302. }
  303. }
  304. },
  305. onInputClick(ele){//点中系数单元格,则默认选中系数值
  306. setSelection(ele,0,$(ele).val().length)
  307. },
  308. checkIfNeedUpdate(){
  309. let data = _.find(zmhs_obj.coeSheetData, function (c) {
  310. return c.coeID == -1;
  311. });
  312. let result = {isNeed: false};
  313. if(data){
  314. for(let c of data.coes){
  315. let amount = $("#"+c.coeType).val();
  316. if(amount!=c.amount){
  317. result.isNeed = true;
  318. c.amount = amount;
  319. }
  320. }
  321. if (result.isNeed) {
  322. result.doc = {
  323. coes: data.coes
  324. };
  325. result.query = {
  326. projectID: data.projectID,
  327. ID: data.ID,
  328. rationID: data.rationID
  329. };
  330. }
  331. }
  332. return result;
  333. },
  334. numberValueChecking: function (val) {
  335. var newval = Number(val);
  336. if (number_util.isNumber(newval)) {
  337. return newval;
  338. } else {
  339. if (val) {
  340. alert('您输入的数据类型不正确,请重新输入。');
  341. }
  342. newval = null;
  343. }
  344. return newval;
  345. },
  346. onCoeCheckBoxClick:function (sender, args) {
  347. let me = zmhs_obj;
  348. let checkboxValue = args.sheet.getCell(args.row, args.col).value();
  349. let newval = 0;
  350. if (checkboxValue) {
  351. newval = 0;
  352. args.sheet.getCell(args.row, args.col).value(newval);
  353. } else {
  354. newval = 1;
  355. args.sheet.getCell(args.row, args.col).value(newval);
  356. }
  357. let recode = me.coeSheetData[args.row];
  358. projectObj.project.ration_coe.adjustCoeClick(recode, newval);
  359. },
  360. generateHtmlString: function (context,cellRect,$editor) {//这里要改成动态的了,根据自定义系数内容生成对应的输入框
  361. let me = zmhs_obj;
  362. let height = cellRect.height;
  363. let offect = 0;
  364. let newString = "<form style='margin-top:1px' ><table width='100%' cellpadding='0' border='1px' bordercolor='#CCCCCC' cellspacing='0px' style='border-collapse:collapse;'>";
  365. let cus_coe = me.coeSheetData[context.row];
  366. if(cus_coe){
  367. for(let i =0;i< cus_coe.coes.length;i++){
  368. newString += me.getOneRow(cus_coe.coes[i].coeType, i, cus_coe.coes[i].coeType,height);
  369. offect += height +3
  370. }
  371. }
  372. newString += "</table></form><div style='height:"+ height+"px'><div onclick='zmhs_obj.coeSheet.endEdit()' style='margin:-1px 1px 0px'>自定义系数</div></div>";
  373. $editor.html(newString);
  374. $editor.css("margin-top",-(offect+2));
  375. return newString;
  376. },
  377. getOneRow: function (text, name, id,inputHeight) {
  378. var rowstr = "<tr ><td style='width: 50%'>" + text
  379. + ":</td><td style='width: 50%' align='right'><input class='text-right' type='text' value='1' name=" + name
  380. + " style='width:100%;border:0;height:"+ inputHeight+"px;' align='right' id=" + id + " onchange='zmhs_obj.onInputChange(this.id,this.name)' onclick='zmhs_obj.onInputClick(this)' autocomplete='off'></td></tr>";
  381. return rowstr;
  382. },
  383. coeStartEdit(){
  384. if(zmhs_obj.coeSheet.isEditing()){
  385. return;
  386. }else {
  387. zmhs_obj.coeSheet.startEdit();
  388. }
  389. },
  390. onCoeValueChange:function (e,args) {
  391. let fieldID = zmhs_obj.coeSetting.header[args.col].dataCode;
  392. let recode = zmhs_obj.coeSheetData[args.row];
  393. if(gljUtil.isDef(recode.option_codes)&&recode.option_codes!=""&& fieldID == 'content'){//说明是选择了下拉框
  394. projectObj.project.ration_coe.adjustCoeClick(recode, 1,{'select_code':args.newValue});
  395. }
  396. },
  397. onCusValueChange:function (e,args) {
  398. zmhs_obj.changeCusValue([{row:args.row,col:args.col,value:args.newValue}]);
  399. },
  400. changeCusValue:function (datas) {//[{row:,col,value}]
  401. if(this.cusSheetData){
  402. let tem_coes = _.cloneDeep(this.cusSheetData.coes);
  403. for(let d of datas){
  404. if(d.value&&!sheetCommonObj.checkData(d.col,this.cusSetting,d.value)){
  405. this.showDatas();
  406. alert('输入的数据类型不对,请重新输入!');
  407. return;
  408. }
  409. if(gljUtil.isDef(d.value)&&d.value !=""){
  410. if(tem_coes[d.row].coeType=="定额"){
  411. for(let t of tem_coes){
  412. t.amount = d.value;
  413. }
  414. }else {
  415. tem_coes[d.row].amount = d.value;
  416. }
  417. }
  418. }
  419. let doc = {'coes':tem_coes,'content':this.generationContent(tem_coes)};
  420. projectObj.project.ration_coe.adjustCoeClick(this.cusSheetData, 1,doc);
  421. }
  422. },
  423. generationContent:function (coes) {
  424. let rationAmount = coes[0].amount;
  425. let string ='';
  426. if(_.every(coes,'amount',rationAmount)){
  427. string = coes[0].coeType + 'x'+rationAmount;
  428. }else {
  429. let context_arr =[];
  430. for(let i =1;i<coes.length;i++){
  431. context_arr.push( coes[i].coeType + 'x'+coes[i].amount);
  432. }
  433. string = context_arr.join(',');
  434. }
  435. return string;
  436. },
  437. onAssEditEnded:function (e,args) {
  438. var me = zmhs_obj;
  439. if (args.row >= me.assSheetData.length) {
  440. me.assSheet.getCell(args.row, args.col).value(null);
  441. return;
  442. }
  443. if (me.assSetting.header[args.col].dataCode == 'actualValue') {//实际值
  444. me.updateRationAss(args);
  445. }
  446. },
  447. onCusRangeChanged:function (e,args) {
  448. let datas = [];
  449. for(let c of args.changedCells){
  450. let value= args.sheet.getCell(c.row, c.col).text();
  451. datas.push({row:c.row,col:c.col,value:value})
  452. }
  453. zmhs_obj.changeCusValue(datas);
  454. },
  455. onAssRangeChanged:function (e,args) {
  456. let me = zmhs_obj;
  457. if (args.action == GC.Spread.Sheets.RangeChangedAction.clear) {
  458. args.editingText = null;
  459. }else if(args.action == GC.Spread.Sheets.RangeChangedAction.paste){
  460. args.editingText = args.sheet.getCell(args.row,args.col).value();
  461. }
  462. if (args.sheetName == 'ration_ass') {
  463. me.updateRationAss(args);
  464. }
  465. },
  466. updateRationAss: function (args) {
  467. var me = zmhs_obj;
  468. var newval;
  469. newval = me.numberValueChecking(args.editingText);
  470. var recode = me.assSheetData[args.row];
  471. if (args.editingText === null) {
  472. newval = parseFloat(recode.stdValue);
  473. }
  474. var isValidate = false;
  475. if (newval) {
  476. isValidate = me.checkingActualValue(recode, newval)
  477. }
  478. if (isValidate) {
  479. newval = scMathUtil.roundTo(newval, -2);
  480. projectObj.project.ration_ass.updateActualValue(me.assSheetData, args.row, newval);
  481. } else {
  482. newval = recode.actualValue;
  483. me.assSheet.getCell(args.row, args.col).value(newval);
  484. }
  485. },
  486. checkingActualValue(record, newval){
  487. let minExist = record.minValue && record.minValue != '0' ? true : false;
  488. let maxExist = record.maxValue && record.maxValue != '0' ? true : false;
  489. let minValue = parseFloat(record.minValue);
  490. let maxValue = parseFloat(record.maxValue);
  491. if (!maxExist && minExist) {
  492. if (newval < minValue) {
  493. alert('实际值应≥' + minValue);
  494. return false;
  495. }
  496. }
  497. if (maxExist && !minExist) {
  498. if (newval > maxValue) {
  499. alert('实际值应≤' + maxValue);
  500. return false;
  501. }
  502. }
  503. if (maxExist && minExist) {
  504. if (newval < minValue || newval > maxValue) {
  505. alert('实际值应介于' + minValue + '~' + maxValue + '之间');
  506. return false;
  507. }
  508. }
  509. return true;
  510. },
  511. getSideResize: function () {
  512. let zmhs_sideResizeEles = {};
  513. zmhs_sideResizeEles.eleObj = {
  514. module: zmhs_obj.module,
  515. resize: $('#zmhsResize'),
  516. parent: $('#tabZMHS'),
  517. left: $('#coeSpread'),
  518. right: $('#assDiv')
  519. };
  520. zmhs_sideResizeEles.limit = {
  521. min: 100,
  522. max: `$('#tabZMHS').width()-100`
  523. };
  524. return zmhs_sideResizeEles;
  525. },
  526. loadSideResize: function () {
  527. let resizeObj = this.getSideResize();
  528. SlideResize.loadHorizonWidth(resizeObj.eleObj.module, [resizeObj.eleObj.resize], [resizeObj.eleObj.left, resizeObj.eleObj.right]);
  529. }
  530. };
  531. /*let zmhsResize = zmhs_obj.getSideResize();
  532. SlideResize.horizontalSlide(zmhsResize.eleObj, zmhsResize.limit, function () {
  533. zmhs_obj.refresh();
  534. });*/