glj_col.js 12 KB

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