zmhs_view.js 23 KB

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