glj_col.js 11 KB

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