glj_col.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  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. rowHeaderWidth: 25
  69. }
  70. },
  71. scopeSetting:{
  72. "emptyRows":0,
  73. "headRows":1,
  74. "headRowHeight":[30],
  75. "defaultRowHeight": 21,
  76. "treeCol": 1,
  77. "cols":[
  78. {
  79. "width":40,
  80. "readOnly": true,
  81. "head":{
  82. "titleNames":["选择"],
  83. "spanCols":[1],
  84. "spanRows":[1],
  85. "vAlign":[1],
  86. "hAlign":[1],
  87. "font":["Arial"]
  88. },
  89. "data":{
  90. "field":"selected",
  91. "vAlign":1,
  92. "hAlign":1,
  93. "font":"Arial",
  94. "cellType":function (node) {
  95. return new GC.Spread.Sheets.CellTypes.CheckBox();
  96. }
  97. }
  98. },
  99. {
  100. "width":140,
  101. "readOnly": true,
  102. "head":{
  103. "titleNames":["编号"],
  104. "spanCols":[1],
  105. "spanRows":[1],
  106. "vAlign":[1],
  107. "hAlign":[1],
  108. "font":["Arial"]
  109. },
  110. "data":{
  111. "field":"code",
  112. "vAlign":1,
  113. "hAlign":0,
  114. "font":"Arial"
  115. }
  116. },
  117. {
  118. "width":240,
  119. "readOnly": true,
  120. "head":{
  121. "titleNames":["名称"],
  122. "spanCols":[1],
  123. "spanRows":[1],
  124. "vAlign":[1],
  125. "hAlign":[1],
  126. "font":["Arial"]
  127. },
  128. "data":{
  129. "field":"name",
  130. "vAlign":0,
  131. "hAlign":0,
  132. "font":"Arial"
  133. }
  134. },
  135. {
  136. "width":70,
  137. "readOnly": true,
  138. "head":{
  139. "titleNames":["单位"],
  140. "spanCols":[1],
  141. "spanRows":[1],
  142. "vAlign":[1],
  143. "hAlign":[1],
  144. "font":["Arial"]
  145. },
  146. "data":{
  147. "field":"unit",
  148. "vAlign":1,
  149. "hAlign":1,
  150. "font":"Arial"
  151. }
  152. },
  153. {
  154. "width":80,
  155. "readOnly": true,
  156. "head":{
  157. "titleNames":["工程量"],
  158. "spanCols":[1],
  159. "spanRows":[1],
  160. "vAlign":[1],
  161. "hAlign":[1],
  162. "font":["Arial"]
  163. },
  164. "data":{
  165. "field":"quantity",
  166. "vAlign":1,
  167. "hAlign":2,
  168. "font":"Arial"
  169. }
  170. },
  171. {
  172. "width":80,
  173. "readOnly": true,
  174. "head":{
  175. "titleNames":["单价"],
  176. "spanCols":[1],
  177. "spanRows":[1],
  178. "vAlign":[1],
  179. "hAlign":[1],
  180. "font":["Arial"]
  181. },
  182. "data":{
  183. "field":"unitPrice",
  184. "vAlign":1,
  185. "hAlign":2,
  186. "font":"Arial"
  187. }
  188. },
  189. {
  190. "width":80,
  191. "readOnly": true,
  192. "head":{
  193. "titleNames":["金额"],
  194. "spanCols":[1],
  195. "spanRows":[1],
  196. "vAlign":[1],
  197. "hAlign":[1],
  198. "font":["Arial"]
  199. },
  200. "data":{
  201. "field":"totalPrice",
  202. "vAlign":1,
  203. "hAlign":2,
  204. "font":"Arial"
  205. }
  206. }
  207. ]
  208. },
  209. removeCol:function (dataCode,setting) {
  210. let colIndex = _.findIndex(setting.header,{'dataCode':dataCode});
  211. if(colIndex != -1){
  212. setting.header.splice(colIndex,1);//去掉列;
  213. let newArray = [];
  214. for(let l of setting.view.lockColumns){
  215. if(_.isString(l)) return;//如果是用dataCode表示的,不用处理
  216. if(l == colIndex) continue;
  217. if(l > colIndex) l = l -1;
  218. newArray.push(l);
  219. }
  220. setting.view.lockColumns = newArray;
  221. }
  222. },
  223. initGljCol:function (showAdjustPrice) {
  224. let me = gljCol;
  225. if(showAdjustPrice !== true){
  226. me.removeCol('adjustPrice',me.ration_glj_setting);
  227. me.removeCol('adjustPrice',me.project_glj_setting);
  228. me.removeCol('adjustPrice',me.mixRatio_Setting);
  229. }
  230. if(projectObj.project.projectInfo.property && projectObj.project.projectInfo.property.valuationType == "bill"){
  231. me.removeCol('is_adjust_price',me.project_glj_setting);
  232. }
  233. gljOprObj.setting = me.ration_glj_setting;
  234. projectGljObject.projectGljSetting = me.project_glj_setting;
  235. projectGljObject.mixRatioSetting = me.mixRatio_Setting;
  236. me.setScopeFormater();
  237. gljOprObj.scopeSetting = me.scopeSetting;
  238. },
  239. setScopeFormater:function () {
  240. // 综合单价、综合合价,小数部分应补0对齐。 CSL
  241. for(let col of this.scopeSetting.cols){
  242. if (col.data.field=="totalPrice") col.data.formatter = MainTreeCol.getNumberFormatter(decimalObj.ration.totalPrice, true);
  243. if (col.data.field== "unitPrice") col.data.formatter = MainTreeCol.getNumberFormatter(decimalObj.ration.unitPrice, true);
  244. }
  245. }
  246. };
  247. /*
  248. $(function () {
  249. $('#fullpath').click(function () {
  250. checkfeeRate();
  251. });
  252. })
  253. async function checkfeeRate() {
  254. let result = await ajaxPost('/feeRates/checkFeeRateName', data = {name: '编辑工程量表达式', rootProjectID: 3163});
  255. console.log(result);
  256. }*/