glj_col.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. /**
  2. * Created by zhang on 2018/7/3.
  3. */
  4. let gljCol = {
  5. ration_glj_setting: {
  6. header: [
  7. {headerName: "编号", headerWidth: 110, dataCode: "code", dataType: "String", formatter: "@"},
  8. {headerName: "名称", headerWidth: 160, dataCode: "name", dataType: "String",cellType:'tipsCell'},
  9. {headerName: "规格", headerWidth: 120, dataCode: "specs", dataType: "String", hAlign: "left",cellType:'tipsCell'},
  10. {headerName: "单位", headerWidth: 45, dataCode: "unit", dataType: "String", hAlign: "center"},
  11. {headerName: "预算价", headerWidth: 65, dataCode: "marketPrice", dataType: "Number", validator:"number",hAlign: "right"},//, decimalField: "glj.unitPrice"
  12. {headerName: "调整价", headerWidth: 65, dataCode: "adjustPrice", dataType: "Number",validator:"number", hAlign: "right"},//, decimalField: "glj.unitPrice"1
  13. {headerName: "自定消耗", headerWidth: 65, dataCode: "customQuantity", dataType: "Number",validator:"number", hAlign: "right", decimalField: "glj.quantity"},
  14. {headerName: "消耗量", headerWidth: 65, dataCode: "quantity", dataType: "Number", hAlign: "right", decimalField: "glj.quantity"},
  15. {headerName: "定额价", headerWidth: 65, dataCode: "basePrice", dataType: "Number", hAlign: "right"},//, decimalField: "glj.unitPrice"
  16. {headerName: "定额消耗", headerWidth: 65, dataCode: "rationItemQuantity", dataType: "Number", hAlign: "right", decimalField: "glj.quantity"}, // dataType: "Number", formatter: "0.00"
  17. {headerName: "总消耗量", headerWidth: 80, dataCode: "totalQuantity", dataType: "Number", hAlign: "right", decimalField: "glj.quantity"},
  18. // {headerName: "暂估", headerWidth: 45, dataCode: "isEstimate", dataType: "String", hAlign: "center", vAlign: "center", cellType: "checkBox"},
  19. {headerName: "调后市场价", headerWidth: 80, dataCode: "tenderPrice", dataType: "Number", hAlign: "right", visible: false},
  20. {headerName: "调后消耗量", headerWidth: 80, dataCode: "tenderQuantity", dataType: "Number", hAlign: "right", decimalField: "glj.quantity", visible: false}
  21. ],
  22. view: {
  23. lockColumns: [ "adjustPrice", "rationItemQuantity", "quantity", "totalQuantity", "isEstimate", "tenderPrice", "tenderQuantity"],
  24. rowHeaderWidth:25
  25. },
  26. getStyle:function (data) {
  27. if(data&&data.type == gljType.MAIN_MATERIAL){//是主材的话字体蓝色显示
  28. return {foreColor:"#4D7BFF"};
  29. }
  30. return null;
  31. },
  32. navigationRightCol:['name','specs','unit'],//选中这几列时,按enter键跳到右边一列
  33. // 工料机类型是混凝土、砂浆、配合比、机械台班时,价格不可编辑。
  34. editedTyep:[GLJTypeConst.MAIN_MATERIAL,GLJTypeConst.EQUIPMENT]//主材设备
  35. },
  36. project_glj_setting:{
  37. header: [
  38. {headerName: "编号", headerWidth: 80, dataCode: "code", dataType: "String",spanRows: [2]},
  39. {headerName: "名称", headerWidth: 160, dataCode: "name", dataType: "String",cellType:'tipsCell',spanRows: [2]},
  40. {headerName: "单位", headerWidth: 45, dataCode: "unit", hAlign: "center", dataType: "String",spanRows: [2]},
  41. {headerName: "总消耗量", headerWidth: 90, dataCode: "quantity", hAlign: "right", dataType: "Number",decimalField:'glj.quantity',spanRows: [2]},
  42. {headerName: "定额价", headerWidth: 70, dataCode: "basePrice", hAlign: "right", dataType: "Number",validator:"number", spanRows: [2]},
  43. {headerName: "预算价", headerWidth: 70, dataCode: "marketPrice", hAlign: "right", dataType: "Number",validator:"number",spanRows: [2]},
  44. {headerName: "规格", headerWidth: 120, dataCode: "specs", hAlign: "left", dataType: "String",cellType:'tipsCell',spanRows: [2]},
  45. {headerName: "暂估", headerWidth: 45, dataCode: "is_evaluate", hAlign: "center", dataType: "String",cellType:'checkBox',spanRows: [2]},
  46. {headerName: "评标材料", headerWidth: 35, dataCode: "is_eval_material", dataType: "String",cellType: "checkBox",spanRows: [2]},
  47. {headerName: "主要\n材料", headerWidth: 45, dataCode: "is_main_material", hAlign: "center", dataType: "String",cellType:'checkBox',spanRows: [2]},
  48. {headerName: "新工料机", headerWidth: 50, dataCode: "is_add", hAlign: "center", dataType: "String",cellType:'checkBox',spanRows: [2]},
  49. {headerName: "不调价", headerWidth: 55, dataCode: "is_adjust_price", dataType: "String",cellType: "checkBox",spanRows: [2]},
  50. {headerName: "类型", headerWidth: 45, dataCode: "short_name", hAlign: "center", dataType: "String",spanRows: [2]},
  51. {headerName: "备注", headerWidth: 100, dataCode: "remark", hAlign: "left", dataType: "String",spanRows: [2]},
  52. // {headerName: ["调价后","市场价"], headerWidth: 75, dataCode: "tenderPrice", hAlign: "right", dataType: "Number",validator:"number",spanCols: [2,1], visible: false},
  53. // {headerName: ["","总消耗量"], headerWidth: 90, dataCode: "tenderQuantity", hAlign: "right", dataType: "Number",decimalField:'glj.quantity',spanCols: [0,1], visible: false}
  54. {headerName: ["调价后\n市场价"], headerWidth: 75, dataCode: "tenderPrice", hAlign: "right", dataType: "Number",validator:"number",spanCols: [2,1], visible: false},
  55. {headerName: ["调价后\n总消耗量"], headerWidth: 90, dataCode: "tenderQuantity", hAlign: "right", dataType: "Number",decimalField:'glj.quantity',spanCols: [0,1], visible: false}
  56. ],
  57. view: {
  58. lockColumns: ["code","name","specs","unit","short_name","quantity","is_add","tenderPrice","tenderQuantity"]
  59. },
  60. getStyle:function (data,row,activeRow) {
  61. if(row == activeRow){//选中黄色显示
  62. return {backColor:"#FFFACD"};
  63. }
  64. return null;
  65. },
  66. frozenCols:4
  67. },
  68. mixRatio_Setting:{
  69. header:[
  70. {headerName: "编号", headerWidth: 80, dataCode: "code", dataType: "String"},
  71. {headerName: "名称", headerWidth: 240, dataCode: "name", dataType: "String"},
  72. {headerName: "规格", headerWidth: 190, dataCode: "specs", dataType: "String"},
  73. {headerName: "单位", headerWidth: 45, dataCode: "unit", hAlign: "center", dataType: "String"},
  74. {headerName: "类型", headerWidth: 45, dataCode: "short_name", hAlign: "center", dataType: "String"},
  75. {headerName: "定额价", headerWidth: 80, dataCode: "basePrice", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:'glj.unitPrice'
  76. {headerName: "调整价", headerWidth: 80, dataCode: "adjustPrice", hAlign: "right", dataType: "Number"},//,decimalField:"glj.unitPrice"
  77. {headerName: "预算价", headerWidth: 80, dataCode: "marketPrice", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:"glj.unitPrice"
  78. {headerName: "消耗量", headerWidth: 80, dataCode: "consumption", hAlign: "right", dataType: "Number",decimalField:"glj.quantity",validator:"number"}
  79. ],
  80. view: {
  81. lockColumns: [0,1,2,3,4,5,6,7],
  82. rowHeaderWidth: 25
  83. }
  84. },
  85. scopeSetting:{
  86. "emptyRows":0,
  87. "headRows":1,
  88. "headRowHeight":[30],
  89. "defaultRowHeight": 21,
  90. "treeCol": 1,
  91. "cols":[
  92. {
  93. "width":40,
  94. "readOnly": true,
  95. "head":{
  96. "titleNames":["选择"],
  97. "spanCols":[1],
  98. "spanRows":[1],
  99. "vAlign":[1],
  100. "hAlign":[1],
  101. "font":["Arial"]
  102. },
  103. "data":{
  104. "field":"selected",
  105. "vAlign":1,
  106. "hAlign":1,
  107. "font":"Arial",
  108. "cellType":function (node) {
  109. return new GC.Spread.Sheets.CellTypes.CheckBox();
  110. }
  111. }
  112. },
  113. {
  114. "width":140,
  115. "readOnly": true,
  116. "head":{
  117. "titleNames":["编号"],
  118. "spanCols":[1],
  119. "spanRows":[1],
  120. "vAlign":[1],
  121. "hAlign":[1],
  122. "font":["Arial"]
  123. },
  124. "data":{
  125. "field":"code",
  126. "vAlign":1,
  127. "hAlign":0,
  128. "font":"Arial"
  129. }
  130. },
  131. {
  132. "width":240,
  133. "readOnly": true,
  134. "head":{
  135. "titleNames":["名称"],
  136. "spanCols":[1],
  137. "spanRows":[1],
  138. "vAlign":[1],
  139. "hAlign":[1],
  140. "font":["Arial"]
  141. },
  142. "data":{
  143. "field":"name",
  144. "vAlign":0,
  145. "hAlign":0,
  146. "font":"Arial"
  147. }
  148. },
  149. {
  150. "width":70,
  151. "readOnly": true,
  152. "head":{
  153. "titleNames":["单位"],
  154. "spanCols":[1],
  155. "spanRows":[1],
  156. "vAlign":[1],
  157. "hAlign":[1],
  158. "font":["Arial"]
  159. },
  160. "data":{
  161. "field":"unit",
  162. "vAlign":1,
  163. "hAlign":1,
  164. "font":"Arial"
  165. }
  166. },
  167. {
  168. "width":80,
  169. "readOnly": true,
  170. "head":{
  171. "titleNames":["工程量"],
  172. "spanCols":[1],
  173. "spanRows":[1],
  174. "vAlign":[1],
  175. "hAlign":[1],
  176. "font":["Arial"]
  177. },
  178. "data":{
  179. "field":"quantity",
  180. "vAlign":1,
  181. "hAlign":2,
  182. "font":"Arial"
  183. }
  184. },
  185. {
  186. "width":80,
  187. "readOnly": true,
  188. "head":{
  189. "titleNames":["单价"],
  190. "spanCols":[1],
  191. "spanRows":[1],
  192. "vAlign":[1],
  193. "hAlign":[1],
  194. "font":["Arial"]
  195. },
  196. "data":{
  197. "field":"unitPrice",
  198. "vAlign":1,
  199. "hAlign":2,
  200. "font":"Arial"
  201. }
  202. },
  203. {
  204. "width":80,
  205. "readOnly": true,
  206. "head":{
  207. "titleNames":["金额"],
  208. "spanCols":[1],
  209. "spanRows":[1],
  210. "vAlign":[1],
  211. "hAlign":[1],
  212. "font":["Arial"]
  213. },
  214. "data":{
  215. "field":"totalPrice",
  216. "vAlign":1,
  217. "hAlign":2,
  218. "font":"Arial"
  219. }
  220. }
  221. ]
  222. },
  223. removeCol:function (dataCode,setting) {
  224. let colIndex = _.findIndex(setting.header,{'dataCode':dataCode});
  225. if(colIndex != -1){
  226. setting.header.splice(colIndex,1);//去掉列;
  227. let newArray = [];
  228. for(let l of setting.view.lockColumns){
  229. if(_.isString(l)) return;//如果是用dataCode表示的,不用处理
  230. if(l == colIndex) continue;
  231. if(l > colIndex) l = l -1;
  232. newArray.push(l);
  233. }
  234. setting.view.lockColumns = newArray;
  235. }
  236. },
  237. initGljCol:function (showAdjustPrice, showTenderFields) {
  238. let me = gljCol;
  239. if(showAdjustPrice !== true){
  240. me.removeCol('adjustPrice',me.ration_glj_setting);
  241. me.removeCol('adjustPrice',me.project_glj_setting);
  242. me.removeCol('adjustPrice',me.mixRatio_Setting);
  243. }
  244. if(projectObj.project.projectInfo.property && projectObj.project.projectInfo.property.valuationType == "bill"){
  245. me.removeCol('is_adjust_price',me.project_glj_setting);
  246. }
  247. me.showTenderFields(showTenderFields, false);
  248. gljOprObj.setting = me.ration_glj_setting;
  249. projectGljObject.projectGljSetting = me.project_glj_setting;
  250. projectGljObject.mixRatioSetting = me.mixRatio_Setting;
  251. me.setScopeFormater();
  252. gljOprObj.scopeSetting = me.scopeSetting;
  253. },
  254. showTenderFields: function (showFields = false, needRefresh = false){
  255. let me = gljCol;
  256. let PGLJHeader = me.project_glj_setting.header;
  257. for (let e of PGLJHeader){
  258. if (e.dataCode == 'tenderPrice' || e.dataCode == 'tenderQuantity'){
  259. e.visible = showFields;
  260. }
  261. };
  262. let RGLJHeader = me.ration_glj_setting.header;
  263. for (let e of RGLJHeader){
  264. if (e.dataCode == 'tenderPrice' || e.dataCode == 'tenderQuantity'){
  265. e.visible = showFields;
  266. }
  267. };
  268. let CalcProgramHeader = calcProgramObj.setting.header;
  269. for (let e of CalcProgramHeader){
  270. if (e.dataCode == 'tenderUnitFee' || e.dataCode == 'tenderTotalFee'){
  271. e.visible = showFields;
  272. }
  273. };
  274. if (needRefresh){
  275. if(projectGljObject.projectGljSpread) {
  276. projectGljObject.projectGljSheet = projectGljObject.projectGljSpread .getSheet(0);
  277. projectGljObject.initSheet(projectGljObject.projectGljSheet, projectGljObject.projectGljSetting);
  278. }
  279. if (subSpread) {
  280. gljOprObj.refreshView();
  281. calcProgramObj.refreshCalcProgram(projectObj.project.mainTree.selected);
  282. //gljOprObj.initSheet(subSpread.getSheet(0), false);
  283. //gljOprObj.initSheet(subSpread.getSheet(2), false);
  284. }
  285. };
  286. },
  287. setScopeFormater:function () {
  288. // 综合单价、综合合价,小数部分应补0对齐。 CSL
  289. for(let col of this.scopeSetting.cols){
  290. if (col.data.field=="totalPrice") col.data.formatter = MainTreeCol.getNumberFormatter(decimalObj.ration.totalPrice, true);
  291. if (col.data.field== "unitPrice") col.data.formatter = MainTreeCol.getNumberFormatter(decimalObj.ration.unitPrice, true);
  292. }
  293. }
  294. };
  295. /*
  296. $(function () {
  297. $('#fullpath').click(function () {
  298. checkfeeRate();
  299. });
  300. })
  301. async function checkfeeRate() {
  302. let result = await ajaxPost('/feeRates/checkFeeRateName', data = {name: '编辑工程量表达式', rootProjectID: 3163});
  303. console.log(result);
  304. }*/