glj_view.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563
  1. /**
  2. * Created by CSL on 2017-05-12.
  3. */
  4. var gljOprObj = {
  5. sheet: null,
  6. libID: null,
  7. ration: null,
  8. sheetData:[],
  9. coeSheetData:[],
  10. checkb:null,
  11. coeSheet:null,
  12. assSheet:null,
  13. assSheetData:[],
  14. setting: {
  15. header: [
  16. {headerName: "编码", headerWidth: 100, dataCode: "code", dataType: "String", formatter: "@"},
  17. {headerName: "名称", headerWidth: 120, dataCode: "name", dataType: "String"},
  18. {headerName: "规格型号", headerWidth: 80, dataCode: "specs", dataType: "String", hAlign: "center"},
  19. {headerName: "单位", headerWidth: 60, dataCode: "unit", dataType: "String", hAlign: "center"},
  20. {headerName: "类别", headerWidth: 50, dataCode: "gljDistType", dataType: "String", hAlign: "center"},
  21. {headerName: "定额消耗量", headerWidth: 80, dataCode: "rationItemQuantity", dataType: "Number", hAlign: "right"}, // dataType: "Number", formatter: "0.00"
  22. {headerName: "自定义消耗量", headerWidth: 80, dataCode: "customQuantity", dataType: "Number", hAlign: "right"},
  23. {headerName: "消耗量", headerWidth: 80, dataCode: "quantity", dataType: "Number", hAlign: "right"},
  24. {headerName: "基价单价", headerWidth: 80, dataCode: "basePrice", dataType: "Number", hAlign: "right"},
  25. {headerName: "调整基价", headerWidth: 80, dataCode: "adjustPrice", dataType: "String", hAlign: "right"},
  26. {headerName: "市场单价", headerWidth: 80, dataCode: "marketPrice", dataType: "String", hAlign: "right"},
  27. {headerName: "市场单价调整", headerWidth: 80, dataCode: "marketPriceAdjust", dataType: "String", hAlign: "right"},
  28. {headerName: "是否暂估", headerWidth: 80, dataCode: "isEstimate", dataType: "String", hAlign: "center",vAlign:"center",cellType:"checkBox"}
  29. ],
  30. view: {
  31. comboBox: [{row: -1, col: 12, rowCount: -1, colCount: 1}],
  32. lockedCells: [{row: -1, col: 3, rowCount: -1, colCount: 1}],
  33. lockColumns:[0,1,2,3,4,5,7,8,9,10,12]
  34. },
  35. notEditedType: ['混凝土','砂浆','配合比','机械']
  36. },
  37. coeSetting:{
  38. header:[
  39. {headerName: "调整", headerWidth: 100, dataCode: "isAdjust", dataType: "String",cellType:"checkBox"},
  40. {headerName: "条件", headerWidth: 120, dataCode: "name", dataType: "String",cellType:"button"},
  41. {headerName: "内容", headerWidth: 350, dataCode: "content", dataType: "String", hAlign: "center"}
  42. ],
  43. view:{
  44. lockColumns:[0,1,2]
  45. }
  46. },
  47. assSetting:{
  48. header:[
  49. {headerName: "调整名称", headerWidth: 100, dataCode: "name", dataType: "String"},
  50. {headerName: "定额值", headerWidth: 120, dataCode: "stdValue", dataType: "Number"},
  51. {headerName: "实际值", headerWidth: 120, dataCode: "actualValue", dataType: "Number"}
  52. ],
  53. view:{
  54. lockColumns:[0,1]
  55. }
  56. },
  57. initSheet: function(sheet) {
  58. var me = this;
  59. me.sheet = sheet;
  60. sheetCommonObj.initSheet(me.sheet, me.setting, 30);
  61. me.bindSheetEvent(sheet);
  62. sheet.bind(GC.Spread.Sheets.Events.CellClick, me.onCellClick);
  63. this.loadGLJSpreadContextMenu();
  64. },
  65. initCoeSheet:function (sheet) {
  66. var me = this;
  67. me.coeSheet = sheet;
  68. sheetCommonObj.initSheet(me.coeSheet, me.coeSetting, 30);
  69. me.bindSheetEvent(sheet);
  70. sheet.bind(GC.Spread.Sheets.Events.CellClick, me.onCoeCellClick);
  71. subSpread.bind(GC.Spread.Sheets.Events.ButtonClicked,me.onButtonClick);
  72. },
  73. initAssSheet: function(sheet) {
  74. var me = this;
  75. me.assSheet = sheet;
  76. sheetCommonObj.initSheet(me.assSheet, me.assSetting, 30);
  77. me.bindSheetEvent(sheet);
  78. },
  79. showCoeData:function(sheet,setting,datas){
  80. sheet.floatingObjects.remove("customerCoe");
  81. sheetCommonObj.showData(sheet,setting,datas);
  82. if(datas.length>0){
  83. var cus_index= _.findIndex(datas,function(item){
  84. return item.coeID==-1;
  85. })
  86. if(cus_index!=-1){
  87. this.addDropDownList();
  88. this.addCusButton(cus_index,1,datas[cus_index].name);
  89. }
  90. }
  91. },
  92. bindSheetEvent:function (sheet) {
  93. var me = this;
  94. sheet.bind(GC.Spread.Sheets.Events.ClipboardPasting, me.onClipboardPasting);
  95. sheet.bind(GC.Spread.Sheets.Events.ClipboardPasted, me.onClipboardPasted);
  96. sheet.bind(GC.Spread.Sheets.Events.EditEnded, me.onEditEnded);
  97. sheet.bind(GC.Spread.Sheets.Events.RangeChanged, me.onRangeChanged);
  98. // sheet.bind(GC.Spread.Sheets.Events.CellClick, me.onCellClick);
  99. },
  100. onClipboardPasting: function(sender, args) {
  101. var me = gljOprObj;
  102. if (!me.ration) {
  103. args.cancel = true;
  104. }
  105. },
  106. onClipboardPasted: function(e, info) {
  107. var me = gljOprObj;
  108. if (!me.ration) {return;};
  109. // your code...
  110. },
  111. onEditEnded: function(sender,args){
  112. var me = gljOprObj;
  113. if(subSpread.getActiveSheetIndex()==0){
  114. me.onEditGLJSheet(args)
  115. }
  116. if(subSpread.getActiveSheetIndex()==1){
  117. me.onEditAssSheet(args);
  118. }
  119. },
  120. onEditGLJSheet(args){
  121. var me = gljOprObj;
  122. if(args.row>=me.sheetData.length){
  123. me.sheet.getCell(args.row, args.col).value(null);
  124. return;
  125. }
  126. var ration_glj = projectObj.project.ration_glj;
  127. var updateFunction =null;
  128. if(me.setting.header[args.col].dataCode=='marketPriceAdjust'){//市场单价调整
  129. updateFunction = ration_glj.marketPriceAdjustUpdate;
  130. }
  131. if(me.setting.header[args.col].dataCode=='customQuantity'){//自定义消耗量
  132. updateFunction = ration_glj.customQuantityUpdate;
  133. }
  134. me.updateRationGLJ(args,updateFunction);
  135. },
  136. onEditAssSheet(args){
  137. var me = gljOprObj;
  138. if(args.row>=me.assSheetData.length){
  139. me.assSheet.getCell(args.row, args.col).value(null);
  140. return;
  141. }
  142. if(me.assSetting.header[args.col].dataCode=='actualValue'){//自定义消耗量
  143. me.updateRationAss(args);
  144. }
  145. },
  146. onButtonClick:function (sender,args) {
  147. var me = gljOprObj;
  148. var sheet = args.sheet, row = args.row, col = args.col;
  149. var cellType = sheet.getCellType(row, col);
  150. if (cellType instanceof GC.Spread.Sheets.CellTypes.Button) {
  151. me.onCusButtonClick(sender,args);
  152. }else {
  153. me.onCoeCheckBoxClick(sender,args)
  154. }
  155. },
  156. onCoeCheckBoxClick:function(sender,args){
  157. if(subSpread.getActiveSheetIndex()==2){
  158. var checkboxValue = gljOprObj.coeSheet.getCell(args.row, args.col).value();
  159. var newval = 0;
  160. if(checkboxValue){
  161. newval = 0;
  162. gljOprObj.coeSheet.getCell(args.row, args.col).value(newval);
  163. }else {
  164. newval=1
  165. gljOprObj.coeSheet.getCell(args.row, args.col).value(newval);
  166. }
  167. gljOprObj.updateRationCoe(args,newval)
  168. }
  169. },
  170. onCusButtonClick:function (sender,args){
  171. var me = gljOprObj;
  172. var floatingObject = me.coeSheet.floatingObjects.get('customerCoe');
  173. var isVisable = floatingObject.isVisible();
  174. if(!isVisable){
  175. me.coeSheet.getCell(args.row, args.col, GC.Spread.Sheets.SheetArea.viewport).locked(false);
  176. me.showFloationObject(floatingObject,me.coeSheetData[args.row]);
  177. }else {
  178. var result = me.checkIfNeedUpdate();
  179. if(result.isNeed){
  180. projectObj.project.ration_coe.updateCustomerCoe(result);
  181. }
  182. floatingObject.isVisible(false);
  183. }
  184. },
  185. onCellClick: function(sender,args){
  186. var me = gljOprObj;
  187. if(args.row>=me.sheetData.length){
  188. return;
  189. }
  190. if(me.setting.header[args.col].dataCode=='marketPriceAdjust'){//市场单价调整
  191. var type = me.sheetData[args.row].gljDistType;
  192. var index= _.indexOf(me.setting.notEditedType,type);
  193. if(index!=-1){
  194. me.sheet.getCell(args.row, args.col, GC.Spread.Sheets.SheetArea.viewport).locked(true);
  195. }
  196. }
  197. },
  198. onCoeCellClick:function (sender,args) {
  199. var me = gljOprObj;
  200. var floatingObject = me.coeSheet.floatingObjects.get('customerCoe');
  201. var isVisable = floatingObject.isVisible();
  202. /* if($('#dropdown').css("display") == 'none'){
  203. if(args.col==1&&me.coeSheetData.length>args.row&&me.coeSheetData[args.row].coeID==-1){
  204. me.showFloationObject(floatingObject,me.coeSheetData[args.row]);
  205. }
  206. }*/
  207. if(isVisable){
  208. var result = me.checkIfNeedUpdate();
  209. if(result.isNeed){
  210. projectObj.project.ration_coe.updateCustomerCoe(result);
  211. }
  212. floatingObject.isVisible(false);
  213. // $('#dropdown').hide();
  214. }
  215. },
  216. showFloationObject(floatingObject,data){
  217. floatingObject.isVisible(true);
  218. var sheet = this.coeSheet;
  219. var startRow = this.coeSheetData.length;
  220. var endRow = startRow+7;
  221. floatingObject.startRow(startRow);
  222. floatingObject.startColumn(1);
  223. floatingObject.endColumn(2);
  224. floatingObject.endRow(endRow);
  225. this.bindFloadingObjectValue(data);
  226. sheet.repaint();
  227. // var editPosition = $("#edit").offset();
  228. //$('#dropdown').show();
  229. //var top =editPosition.top>=825?825:editPosition.top
  230. //$('#dropdown').offset({left:editPosition.left,top:top});//top: 791px; left:70px;
  231. },
  232. bindFloadingObjectValue(data){
  233. $('#coe_ration').val(data.coes[0].amount);
  234. $('#manual').val(data.coes[1].amount);
  235. $('#material').val(data.coes[2].amount);
  236. $('#manchine').val(data.coes[3].amount);
  237. $('#main').val(data.coes[4].amount);
  238. $('#equipment').val(data.coes[5].amount);
  239. },
  240. onInputChange(id,name){
  241. var coe = _.find(gljOprObj.coeSheetData,function (c) {
  242. return c.coeID == -1;
  243. });
  244. var newValue = gljOprObj.numberValueChecking($('#'+id).val());
  245. if(newValue){
  246. newValue=_.round(newValue,2);
  247. if(newValue==coe.coes[name].amount) return;
  248. if(id=='coe_ration'){
  249. $('#coe_ration').val(newValue);
  250. $('#manual').val(newValue);
  251. $('#material').val(newValue);
  252. $('#manchine').val(newValue);
  253. $('#main').val(newValue);
  254. $('#equipment').val(newValue);
  255. }
  256. }else {
  257. $('#'+id).val(coe.coes[name].amount);
  258. }
  259. },
  260. checkIfNeedUpdate(){
  261. var data = _.find(gljOprObj.coeSheetData,function (c) {
  262. return c.coeID == -1;
  263. });
  264. var result = {
  265. isNeed:false
  266. }
  267. var coe_ration = $('#coe_ration').val();
  268. var manual=$('#manual').val();
  269. var material = $('#material').val();
  270. var manchine= $('#manchine').val();
  271. var main = $('#main').val();
  272. var equipment=$('#equipment').val();
  273. if(coe_ration!=data.coes[0].amount){
  274. result.isNeed =true;
  275. data.coes[0].amount =coe_ration;
  276. }
  277. if(manual!=data.coes[1].amount){
  278. result.isNeed =true;
  279. data.coes[1].amount =manual;
  280. }
  281. if(material!=data.coes[2].amount){
  282. result.isNeed =true;
  283. data.coes[2].amount =material;
  284. }
  285. if(manchine!=data.coes[3].amount){
  286. result.isNeed =true;
  287. data.coes[3].amount =manchine;
  288. }
  289. if(main!=data.coes[4].amount){
  290. result.isNeed =true;
  291. data.coes[4].amount =main;
  292. }
  293. if(equipment!=data.coes[5].amount){
  294. result.isNeed =true;
  295. data.coes[5].amount =equipment;
  296. }
  297. if(result.isNeed){
  298. result.doc = {
  299. coes:data.coes
  300. };
  301. result.query = {
  302. projectID:data.projectID,
  303. ID:data.ID,
  304. rationID:data.rationID
  305. };
  306. }
  307. return result;
  308. },
  309. addDropDownList:function () {
  310. var sheet = this.coeSheet;
  311. sheet.suspendPaint();
  312. var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("customerCoe");
  313. var div = document.createElement('div');
  314. div.innerHTML = this.generateHtmlString();
  315. customFloatingObject.startRow(1);
  316. customFloatingObject.startColumn(1);
  317. customFloatingObject.endColumn(2);
  318. customFloatingObject.endRow(2);
  319. $(div).css('background', 'white');
  320. customFloatingObject.content(div);
  321. sheet.floatingObjects.add(customFloatingObject);
  322. customFloatingObject.isVisible(false);
  323. sheet.resumePaint();
  324. },
  325. addCusButton:function(row,col,text){
  326. var cus_button = new GC.Spread.Sheets.CellTypes.Button();
  327. gljOprObj.coeSheet.setCellType(row, col, cus_button, GC.Spread.Sheets.SheetArea.viewport);
  328. cus_button.marginLeft(0);
  329. cus_button.marginTop(0);
  330. cus_button.marginRight(0);
  331. cus_button.marginBottom(0);
  332. cus_button.text(text);
  333. cus_button.buttonBackColor('white');
  334. gljOprObj.coeSheet.repaint();
  335. },
  336. onRangeChanged: function(sender, args) {
  337. if (args.action == GC.Spread.Sheets.RangeChangedAction.clear) {
  338. if (!confirm(`确定要删除选中的 ${args.rowCount} 条辅助定额吗?`)){return; }
  339. // your code...
  340. };
  341. },
  342. generateHtmlString:function () {
  343. // return "<div id='edit'><div>";
  344. var newString = "<form ><table border='1px' bordercolor='#CCCCCC' cellspacing='0px' style='border-collapse:collapse;font-size: 10px;>";
  345. //newString +="<tr><td style='height:15px' colspan='2'>自定义系数</td></tr>"
  346. newString += this.getOneRow('定额',0,'coe_ration');
  347. newString += this.getOneRow('人工',1,'manual');
  348. newString += this.getOneRow('材料',2,'material');
  349. newString += this.getOneRow('机械',3,'manchine');
  350. newString += this.getOneRow('主材',4,'main');
  351. newString += this.getOneRow('设备',5,'equipment');
  352. newString +="</table></form>";
  353. return newString;
  354. //"<form id='edit'><table border='1px' bordercolor='#CCCCCC' cellspacing='0px' style='border-collapse:collapse;font-size: 10px;><tr style='height:10px'><td style='width: 50px'>定额:</td><td style='width: 70px' align='right'><input type='text'value='1' name='ration' style='width:30px;border:0;height:14px' align='right'></td></tr><tr><td>定额:</td><td><input type='text' style='width:50px;border:0;height:10px'></td></tr><tr><td>定额:</td><td><input type='text' style='width:50px;border:0;height:10px'></td></tr><tr ><td>定额:</td><td><input type='text' style='width:50px;border:0;height:10px'></td></tr><tr><td>定额:</td><td><input type='text' style='width:50px;border:0;height:10px'></td></tr></table></form>";
  355. },
  356. getOneRow:function (text,name,id) {
  357. var rowstr = "<tr style='height:10px'><td style='width: 50px'>"+text
  358. +":</td><td style='width: 70px' align='right'><input type='text'value='1' name="+name
  359. +" style='width:30px;border:0;height:14px' align='right' id="+id+" onchange='gljOprObj.onInputChange(this.id,this.name)'></td></tr>";
  360. return rowstr;
  361. },
  362. showDataIfRationSelect:function (node) {
  363. var isShow = false;
  364. if(node){
  365. if(this.selectedNodeId&&this.selectedNodeId==node.getID()){
  366. return;
  367. }else {
  368. this.selectedNodeId=node.getID();
  369. }
  370. if(node.sourceType=="ration"){
  371. this.showRationGLJData(node);
  372. this.showRationCoeData(node);
  373. this.showRationAssData(node);
  374. isShow=true;
  375. }
  376. }else {
  377. this.selectedNodeId=null;
  378. }
  379. if(!isShow){
  380. this.clearSheetData();
  381. }
  382. /* this.lockRationGLJCell();
  383. this.lockRationCoeCell();*/
  384. //hide floatingObject
  385. var floatingObject = this.coeSheet.floatingObjects.get('customerCoe');
  386. floatingObject.isVisible(false);
  387. // $('#dropdown').hide();
  388. },
  389. showRationGLJData:function (node) {
  390. let gljList = [];
  391. let ration_glj = projectObj.project.ration_glj;
  392. let ration = node.data;
  393. if(ration_glj.datas&&ration_glj.datas.length>0){
  394. gljList = _.filter(ration_glj.datas,{'projectID':ration.projectID,'rationID':ration.ID})
  395. }
  396. sheetCommonObj.showData(this.sheet,this.setting,gljList);
  397. this.sheetData=gljList;
  398. },
  399. showRationCoeData:function (node) {
  400. let coeList = [];
  401. let ration_coe= projectObj.project.ration_coe;
  402. let ration = node.data;
  403. if(ration_coe.datas&&ration_coe.datas.length>0){
  404. coeList = _.filter(ration_coe.datas,{'projectID':ration.projectID,'rationID':ration.ID})
  405. }
  406. this.showCoeData(this.coeSheet,this.coeSetting,coeList);
  407. this.coeSheetData=coeList;
  408. },
  409. showRationAssData:function (node) {
  410. let assList = node.data.rationAssList;
  411. sheetCommonObj.showData(this.assSheet,this.assSetting,assList);
  412. this.assSheetData =assList;
  413. },
  414. clearSheetData:function () {
  415. sheetCommonObj.showData(this.sheet,this.setting,[]);
  416. sheetCommonObj.showData(this.coeSheet,this.coeSetting,[]);
  417. sheetCommonObj.showData(this.assSheet,this.assSetting,[]);
  418. this.sheetData = [];
  419. this.coeSheetData = [];
  420. this.assSheetData = [];
  421. },
  422. /* lockRationGLJCell:function(){
  423. sheetCommonObj.lockCells(this.sheet,this.setting);
  424. },
  425. lockRationCoeCell:function () {
  426. sheetCommonObj.lockCells(this.coeSheet,this.coeSetting);
  427. /!* if(this.coeSheetData){
  428. for(var i =0;i<this.coeSheetData.length;i++){
  429. if(this.coeSheetData[i].coeID==-1){
  430. this.coeSheet.getCell(i, 1, GC.Spread.Sheets.SheetArea.viewport).locked(false);
  431. }
  432. }
  433. }*!/
  434. },
  435. lockRationGLJCell:function(){
  436. sheetCommonObj.lockCells(this.sheet,this.setting);
  437. },*/
  438. loadGLJSpreadContextMenu: function () {
  439. var project =projectObj.project, spread =subSpread;
  440. var selectedRow =null;
  441. $.contextMenu({
  442. selector: '#subSpread',
  443. build: function ($trigger, e) {
  444. var target = SheetDataHelper.safeRightClickSelection($trigger, e, spread);
  445. selectedRow = target.row;
  446. //controller.setTreeSelected(controller.tree.items[target.row]);
  447. return target.hitTestType === GC.Spread.Sheets.SheetArea.viewport || target.hitTestType === GC.Spread.Sheets.SheetArea.rowHeader;
  448. },
  449. items: {
  450. "delete_glj": {
  451. name: '删除工料机',
  452. icon: 'fa-remove',
  453. disabled: function () {
  454. //var selected = project.mainTree.selected;
  455. var disable = true;
  456. if(subSpread.getActiveSheetIndex()==0&&gljOprObj.sheetData!=null&&gljOprObj.sheetData.length>0&&selectedRow<gljOprObj.sheetData.length){
  457. disable=false
  458. }
  459. return disable;
  460. },
  461. callback: function () {
  462. var deleteRow = gljOprObj.sheetData[selectedRow];
  463. projectObj.project.ration_glj.updataOrdelete(deleteRow);
  464. }
  465. }
  466. }
  467. });
  468. },
  469. updateRationGLJ:function (args,updateFunction) {
  470. if(!updateFunction){
  471. return
  472. }
  473. var me = gljOprObj;
  474. var newval = this.numberValueChecking(args.editingText);
  475. var recode = me.sheetData[args.row];
  476. updateFunction.apply(projectObj.project.ration_glj,[recode,newval,args.editingText]);
  477. if(newval){
  478. newval = parseFloat(recode.customQuantity).toFixed(2);
  479. }
  480. if(args.editingText===null){
  481. newval=null;
  482. }
  483. me.sheet.getCell(args.row, args.col).value(newval);
  484. },
  485. updateRationAss:function (args) {
  486. var me = gljOprObj;
  487. var newval = me.numberValueChecking(args.editingText);
  488. var recode = me.assSheetData[args.row];
  489. var isValidate = false;
  490. if(newval){
  491. isValidate = me.checkingActualValue(recode,newval)
  492. }
  493. if(isValidate){
  494. projectObj.project.ration_ass.updateActualValue(me.assSheetData,args.row,newval)
  495. }else {
  496. newval = recode.actualValue;
  497. me.assSheet.getCell(args.row, args.col).value(newval);
  498. }
  499. },
  500. updateRationCoe:function (args,newval) {
  501. var me = gljOprObj;
  502. var recode = me.coeSheetData[args.row];
  503. projectObj.project.ration_coe.adjustCoeClick(recode,newval);
  504. },
  505. numberValueChecking:function (val) {
  506. var newval = Number(val);
  507. if(number_util.isNumber(newval)){
  508. newval = newval.toFixed(2);
  509. }else {
  510. if(val){
  511. alert('您输入的数据类型不正确,请重新输入。');
  512. }
  513. newval = null;
  514. }
  515. return newval;
  516. },
  517. checkingActualValue(record,newval){
  518. var minExist = record.minValue&&record.minValue!='0'?true:false;
  519. var maxExist = record.maxValue&&record.maxValue!='0'?true:false;
  520. var minValue = parseFloat(record.minValue);
  521. var maxValue = parseFloat(record.maxValue);
  522. var stdVale = parseFloat(record.stdValue);
  523. if(stdVale==newval){
  524. return false;
  525. }
  526. if(!maxExist&&minExist){
  527. if(newval<minValue){
  528. alert('实际值应≥'+minValue);
  529. return false;
  530. }
  531. }
  532. if(maxExist&&!minExist){
  533. if(newval>maxValue){
  534. alert('实际值应≤'+maxValue);
  535. return false;
  536. }
  537. }
  538. if(maxExist&&minExist){
  539. if(newval<minValue||newval>maxValue){
  540. alert('实际值应介于'+minValue+'~'+maxValue+'之间');
  541. return false;
  542. }
  543. }
  544. return true;
  545. }
  546. }