|
@@ -125,11 +125,12 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref, watch } from 'vue'
|
|
|
+import { nextTick, ref, watch } from 'vue'
|
|
|
+import { isNumberReg } from '~uti/tools'
|
|
|
import AddCheckList from './addCheckList.vue'
|
|
|
import unitApi from '~api/project/debit/contract/unit.js'
|
|
|
import { getDictionary } from '~api/other'
|
|
|
-import { getArrValue } from 'js-fast-way'
|
|
|
+import { getArrValue, isNullES } from 'js-fast-way'
|
|
|
import { delMessageV2 } from '~com/message/index.js'
|
|
|
import BigNumber from 'bignumber.js'
|
|
|
|
|
@@ -162,33 +163,18 @@ const formModel = ref({})
|
|
|
const tableData = ref([])
|
|
|
|
|
|
//设置某一行的样式
|
|
|
+const isCanSave = ref(false)
|
|
|
const tableRowStyle = ({ row }) => {
|
|
|
- let poseNum = new BigNumber(row.poseNum) //a
|
|
|
- let contractTotal = new BigNumber(row.contractTotal) //b
|
|
|
+ let contract = new BigNumber('0') //a
|
|
|
+ let residueNum = new BigNumber(row.residueNum) //b
|
|
|
//a 大于 b = 1,a 等于 b = 0,a 小于 b = -1, a 或 b 的值异常时 = null
|
|
|
- const isCompared = poseNum.comparedTo(contractTotal)
|
|
|
+ const isCompared = contract.comparedTo(residueNum)
|
|
|
if (!isCompared || isCompared === 1) {
|
|
|
isCanSave.value = true
|
|
|
return '--el-table-tr-bg-color: #fe0000; --el-table-row-hover-bg-color: #fe0000; color: white;'
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-const isCanSave = ref(false)
|
|
|
-const changeBuildPictureTotal = (row) => {
|
|
|
- row.residueNum = row.changeTotal - row.poseNum
|
|
|
- if (row.poseNum > row.contractTotal) {
|
|
|
- isCanSave.value = true
|
|
|
} else {
|
|
|
isCanSave.value = false
|
|
|
}
|
|
|
- //计算施工金额
|
|
|
- let sum = tableData.value.reduce((accumulator, current) => {
|
|
|
- if (current.poseNum && current.currentPrice) {
|
|
|
- return accumulator + (current.poseNum * current.currentPrice)
|
|
|
- }
|
|
|
- return accumulator
|
|
|
- }, 0)
|
|
|
- formModel.value.buildPictureMoney = sum
|
|
|
}
|
|
|
|
|
|
//获节点类型
|
|
@@ -235,7 +221,7 @@ watch(() => props.curTreeData, (cur) => {
|
|
|
deep: true,
|
|
|
})
|
|
|
|
|
|
-watch(tableData, (val) => {
|
|
|
+/*watch(tableData, (val) => {
|
|
|
if (val) {
|
|
|
//计算变更后金额
|
|
|
let sum1 = tableData.value.reduce((accumulator, current) => {
|
|
@@ -246,11 +232,10 @@ watch(tableData, (val) => {
|
|
|
}, 0)
|
|
|
formModel.value.changeMoney = sum1
|
|
|
}
|
|
|
-}, { deep: true })
|
|
|
+}, { deep: true })*/
|
|
|
|
|
|
watch(isShow, (val) => {
|
|
|
if (val) {
|
|
|
- console.log('isShow', val)
|
|
|
// getNodeType()
|
|
|
getStakeype()
|
|
|
}
|
|
@@ -262,6 +247,7 @@ const formRef = ref(null)
|
|
|
const formRules = ref({})
|
|
|
|
|
|
//列表
|
|
|
+const addNodeLoading = ref(false)
|
|
|
const tableColumn = ref([
|
|
|
{ key: 'formNumber', name: '清单编号' },
|
|
|
{ key: 'formName', name: '清单名称' },
|
|
@@ -274,10 +260,49 @@ const tableColumn = ref([
|
|
|
{ key: 'changeBuildPictureTotal', name: '施工图变更后数量' },
|
|
|
{ key: 'action', name: '操作', width: 80, align: 'center' },
|
|
|
])
|
|
|
-// const tableData = ref([
|
|
|
-// { key1: '101-1-a' },
|
|
|
-// ])
|
|
|
-const addNodeLoading = ref(false)
|
|
|
+
|
|
|
+//计算数据
|
|
|
+const changeBuildPictureTotal = (row) => {
|
|
|
+ //如果为空
|
|
|
+ let buildPictureTotal = row.buildPictureTotal
|
|
|
+ const isMeter = isNumberReg(buildPictureTotal)
|
|
|
+ if (isNullES(buildPictureTotal) || !isMeter) {
|
|
|
+ buildPictureTotal = 0
|
|
|
+ }
|
|
|
+ //计算相关数量和金额
|
|
|
+ nextTick(() => {
|
|
|
+ //更新值
|
|
|
+ row.buildPictureTotal = buildPictureTotal
|
|
|
+ row.changeBuildPictureTotal = buildPictureTotal
|
|
|
+
|
|
|
+ //计算数量
|
|
|
+ // poseNum 已分解量, otherPoseNum 其他节点分解量, buildPictureTotal 施工图数量
|
|
|
+ // poseNum = otherPoseNum + buildPictureTotal
|
|
|
+ row.poseNum = (BigNumber(row.otherPoseNum).plus(buildPictureTotal)).toString()
|
|
|
+
|
|
|
+ // residueNum 分解剩余量, changeTotal 变更后合同数量
|
|
|
+ // residueNum = changeTotal - poseNum
|
|
|
+ row.residueNum = (BigNumber(row.changeTotal).minus(row.poseNum)).toString()
|
|
|
+
|
|
|
+ // buildPictureMoney 施工图金额
|
|
|
+ // buildPictureMoney = buildPictureTotal * currentPrice(单价)
|
|
|
+ row.buildPictureMoney = (BigNumber(buildPictureTotal).multipliedBy(row.currentPrice)).toString()
|
|
|
+
|
|
|
+ // changeBuildPictureMoney 变更后施工图金额, changeBuildPictureTotal 变更后施工图数量
|
|
|
+ // changeBuildPictureMoney = changeBuildPictureTotal * currentPrice(单价)
|
|
|
+ row.changeBuildPictureMoney = (BigNumber(row.changeBuildPictureTotal).multipliedBy(row.currentPrice)).toString()
|
|
|
+
|
|
|
+ //计算表单上的总金额
|
|
|
+ let buildPictureMoney = 0, changeMoney = 0
|
|
|
+ for (let i = 0; i < tableData.value.length; i++) {
|
|
|
+ const item = tableData.value[i]
|
|
|
+ buildPictureMoney = (BigNumber(buildPictureMoney).plus(item.buildPictureMoney)).toString()
|
|
|
+ changeMoney = (BigNumber(changeMoney).plus(item.changeBuildPictureMoney)).toString()
|
|
|
+ }
|
|
|
+ formModel.value.buildPictureMoney = buildPictureMoney
|
|
|
+ formModel.value.changeMoney = changeMoney
|
|
|
+ })
|
|
|
+}
|
|
|
|
|
|
const modalSave = async () => {
|
|
|
if (isCanSave.value) {
|