zmhs_view.js 23 KB

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