|
@@ -321,24 +321,75 @@ function successTrigger(field, info) {
|
|
switch (field) {
|
|
switch (field) {
|
|
case 'unit_price.market_price':
|
|
case 'unit_price.market_price':
|
|
let row = info.row;
|
|
let row = info.row;
|
|
- let basePriceColumn = getFieldColumn(header, 'unit_price.base_price');
|
|
|
|
- let adjustPriceColumn = getFieldColumn(header, 'adjust_price');
|
|
|
|
-
|
|
|
|
// 获取类型
|
|
// 获取类型
|
|
let typeColumn = getFieldColumn(header, 'unit_price.type');
|
|
let typeColumn = getFieldColumn(header, 'unit_price.type');
|
|
let type = sheet.getValue(row, typeColumn);
|
|
let type = sheet.getValue(row, typeColumn);
|
|
|
|
|
|
- // 主材、设备自动赋值基价单价=市场单价、调整基价=市场单价
|
|
|
|
- if (autoChangeGLJType.indexOf(type + '') >= 0) {
|
|
|
|
- sheet.setValue(info.row, basePriceColumn, info.newValue);
|
|
|
|
- sheet.setValue(info.row, adjustPriceColumn, info.newValue);
|
|
|
|
- }
|
|
|
|
|
|
+ // 基价单价的计算
|
|
|
|
+ basePriceCalculate(type, info);
|
|
|
|
+ // 调整基价的计算
|
|
|
|
+ adjustPriceCalculate(type, info);
|
|
|
|
+ // 市场单价的计算
|
|
|
|
+ marketPriceCalculate(type, info);
|
|
|
|
|
|
- // 人工、材料(普通材料)触发 需计算混凝土、砂浆、配合比、机械的市场单价 @todo 后续添加
|
|
|
|
- if (triggerCalculateGLJType.indexOf(type + '') >= 0) {
|
|
|
|
- // 计算
|
|
|
|
- console.log('触发计算');
|
|
|
|
- }
|
|
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 基价单价计算
|
|
|
|
+ *
|
|
|
|
+ * @param {Number} type
|
|
|
|
+ * @param {object} info
|
|
|
|
+ * @return {void}
|
|
|
|
+ */
|
|
|
|
+function basePriceCalculate(type, info) {
|
|
|
|
+ let basePriceColumn = getFieldColumn(header, 'unit_price.base_price');
|
|
|
|
+ switch (type) {
|
|
|
|
+ // 主材、设备自动赋值基价单价=市场单价
|
|
|
|
+ case 6:
|
|
|
|
+ case 7:
|
|
|
|
+ sheet.setValue(info.row, basePriceColumn, info.newValue);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 调整基价计算
|
|
|
|
+ *
|
|
|
|
+ * @param {Number} type
|
|
|
|
+ * @param {object} info
|
|
|
|
+ * @return {void}
|
|
|
|
+ */
|
|
|
|
+function adjustPriceCalculate(type, info) {
|
|
|
|
+ let basePriceColumn = getFieldColumn(header, 'unit_price.base_price');
|
|
|
|
+ let adjustPriceColumn = getFieldColumn(header, 'adjust_price');
|
|
|
|
+ switch (type) {
|
|
|
|
+ // 材料、主材、设备 调整基价=基价单价
|
|
|
|
+ case 5:
|
|
|
|
+ case 6:
|
|
|
|
+ case 7:
|
|
|
|
+ let basePrice = sheet.getValue(row, basePriceColumn);
|
|
|
|
+ sheet.setValue(info.row, adjustPriceColumn, basePrice);
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 市场单价计算
|
|
|
|
+ *
|
|
|
|
+ * @param {Number} type
|
|
|
|
+ * @param {object} info
|
|
|
|
+ * @return {void}
|
|
|
|
+ */
|
|
|
|
+function marketPriceCalculate(type, info) {
|
|
|
|
+ switch (type) {
|
|
|
|
+ // 人工、材料(普通材料)触发 需计算混凝土、砂浆、配合比、机械的市场单价 @todo 后续添加
|
|
|
|
+ case 2:
|
|
|
|
+ case 5:
|
|
|
|
+ // 计算
|
|
|
|
+ console.log('触发计算');
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|