Przeglądaj źródła

合同计量单元修改

ZaiZai 1 rok temu
rodzic
commit
38a13246a1

+ 6 - 8
src/views/project/debit/contract/components/unit/row-data.vue

@@ -106,8 +106,8 @@
                         :column="tableColumn" :datas="tableData" is-new :index-style="{ width: 60 }"
                         :row-style="tableRowStyle" :is-stripe="false"
                     >
-                        <template #poseNum="{ row }">
-                            <hc-table-input v-model="row.poseNum" @change="changePoseNum(row)" />
+                        <template #buildPictureTotal="{ row }">
+                            <hc-table-input v-model="row.buildPictureTotal" @change="changeBuildPictureTotal(row)" />
                         </template>
                         <template #action="{ row, index }">
                             <el-link type="danger" @click="delRow(row, index)">删除</el-link>
@@ -174,7 +174,7 @@ const tableRowStyle = ({ row }) => {
 }
 
 const isCanSave = ref(false)
-const changePoseNum = (row) => {
+const changeBuildPictureTotal = (row) => {
     row.residueNum = row.changeTotal - row.poseNum
     if (row.poseNum > row.contractTotal) {
         isCanSave.value = true
@@ -189,9 +189,8 @@ const changePoseNum = (row) => {
         return accumulator
     }, 0)
     formModel.value.buildPictureMoney = sum
-
-
 }
+
 //获节点类型
 const nodeOptions = ref([])
 const getNodeType = async (id) => {
@@ -271,8 +270,8 @@ const tableColumn = ref([
     { key: 'changeTotal', name: '合同变更后数量' },
     { key: 'poseNum', name: '已分解量' },
     { key: 'residueNum', name: '分解剩余量' },
-    { key: 'poseNum', name: '施工图数量' },
-    { key: 'changeTotal', name: '施工图变更后数量' },
+    { key: 'buildPictureTotal', name: '施工图数量' },
+    { key: 'changeBuildPictureTotal', name: '施工图变更后数量' },
     { key: 'action', name: '操作', width: 80, align: 'center' },
 ])
 // const tableData = ref([
@@ -281,7 +280,6 @@ const tableColumn = ref([
 const addNodeLoading = ref(false)
 
 const modalSave = async () => {
-    console.log(isCanSave.value, 'const isCanSave = ref(false)')
     if (isCanSave.value) {
         window.$message.warning('累计分解量 > 合同变更后量,不允许修改')
         return

+ 11 - 5
src/views/project/debit/contract/unit.vue

@@ -97,6 +97,7 @@ import { useAppStore } from '~src/store'
 import { getStoreValue, setStoreValue } from '~src/utils/storage'
 import { delMessageV2 } from '~com/message/index.js'
 import { getDictionary } from '~api/other'
+import BigNumber from 'bignumber.js'
 
 const useAppState = useAppStore()
 const projectId = ref(useAppState.getProjectId || '')
@@ -345,16 +346,21 @@ const tableColumn = ref([
     { key: 'currentPrice', name: '单价', width: 90, align: 'center' },
     { key: 'contractTotal', name: '合同数量', width: 100, align: 'center' },
     { key: 'changeTotal', name: '变更后数量', width: 110, align: 'center' },
-    { key: 'poseNum', name: '施工图数量', align: 'center' },
-    { key: 'changeTotal', name: '施工图变更后数量', align: 'center' },
+    { key: 'buildPictureTotal', name: '施工图数量', align: 'center' },
+    { key: 'changeBuildPictureTotal', name: '施工图变更后数量', align: 'center' },
 ])
 const tableData = ref([])
 //设置某一行的样式
-const tableRowStyle = ({ row, rowIndex }) => {
-    if (row.poseNum > row.contractTotal) {
-        return '--el-table-tr-bg-color: #fe0000; color:white'
+const tableRowStyle = ({ row }) => {
+    let poseNum = new BigNumber(row.poseNum) //a
+    let contractTotal = new BigNumber(row.contractTotal) //b
+    //a 大于 b = 1,a 等于 b = 0,a 小于 b = -1, a 或 b 的值异常时 = null
+    const isCompared = poseNum.comparedTo(contractTotal)
+    if (!isCompared || isCompared === 1) {
+        return '--el-table-tr-bg-color: #fe0000; --el-table-row-hover-bg-color: #fe0000; color: white;'
     }
 }
+
 //弹窗
 const treeModalShow = ref(false)
 const editModalShow = ref(false)