|
@@ -96,8 +96,8 @@
|
|
<template #allMeterTotal="{ row }">
|
|
<template #allMeterTotal="{ row }">
|
|
<hc-table-input v-model="row.allMeterTotal" disabled />
|
|
<hc-table-input v-model="row.allMeterTotal" disabled />
|
|
</template>
|
|
</template>
|
|
- <template #action="{ row }">
|
|
|
|
- <el-link type="danger" @click="delAddTableClick(row)">删除</el-link>
|
|
|
|
|
|
+ <template #action="{ row, index }">
|
|
|
|
+ <el-link type="danger" @click="delAddTableClick(row, index)">删除</el-link>
|
|
</template>
|
|
</template>
|
|
</hc-table>
|
|
</hc-table>
|
|
</hc-card-item>
|
|
</hc-card-item>
|
|
@@ -113,22 +113,22 @@
|
|
</el-form>
|
|
</el-form>
|
|
</hc-card-item>
|
|
</hc-card-item>
|
|
<!-- 添加分解清单 -->
|
|
<!-- 添加分解清单 -->
|
|
- <HcBillBaseModal v-model="addBillBaseModalShow" :ids="billBaseIds" :idn="nodeId" :period-id="baseForm.contractPeriodId" :contract-id="cid" @finish="finishChange" />
|
|
|
|
|
|
+ <HcBillBase v-model="addBillBaseShow" :info="taskInfo" :table="tableInfo" :ids="billBaseIds" :contract-id="contractId" @finish="finishChange" />
|
|
<!-- 文件上传组件 -->
|
|
<!-- 文件上传组件 -->
|
|
<hc-upload-file ref="uploadFileRef" :echo-params="uploadFileParams" :options="uploadFileOptions" @success="uploadFileSuccess" />
|
|
<hc-upload-file ref="uploadFileRef" :echo-params="uploadFileParams" :options="uploadFileOptions" @success="uploadFileSuccess" />
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
-import { getArrValue, getObjVal, getObjValue, isNullES } from 'js-fast-way'
|
|
|
|
|
|
+import { arrToId, getArrValue, getObjVal, getObjValue, isNullES } from 'js-fast-way'
|
|
import { nextTick, onMounted, ref, watch } from 'vue'
|
|
import { nextTick, onMounted, ref, watch } from 'vue'
|
|
import { useAppStore } from '~src/store'
|
|
import { useAppStore } from '~src/store'
|
|
-import HcBillBaseModal from '~src/views/debit-pay/admin/components/middlepay/addBillBaseModal.vue'
|
|
|
|
|
|
+import HcBillBase from './addBillBase.vue'
|
|
import middlepayApi from '~api/debit-pay/admin/middlepay'
|
|
import middlepayApi from '~api/debit-pay/admin/middlepay'
|
|
import mainApi from '~api/tasks/hc-data'
|
|
import mainApi from '~api/tasks/hc-data'
|
|
import BigNumber from 'bignumber.js'
|
|
import BigNumber from 'bignumber.js'
|
|
import { getHeader } from 'hc-vue3-ui'
|
|
import { getHeader } from 'hc-vue3-ui'
|
|
-import { isNumberReg } from '~uti/tools'
|
|
|
|
|
|
+import { delMessage, isNumberReg } from '~uti/tools'
|
|
|
|
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
isEdit: {
|
|
isEdit: {
|
|
@@ -258,6 +258,17 @@ const currentMeterTotalBlur = (row) => {
|
|
meterMoney = (BigNumber(meterMoney).plus(table[i].currentMeterMoney)).toString()
|
|
meterMoney = (BigNumber(meterMoney).plus(table[i].currentMeterMoney)).toString()
|
|
}
|
|
}
|
|
baseForm.value.meterMoney = meterMoney
|
|
baseForm.value.meterMoney = meterMoney
|
|
|
|
+
|
|
|
|
+ //计算是否超计
|
|
|
|
+ let allMeterTotal = new BigNumber(row.allMeterTotal) //a 累计计量量
|
|
|
|
+ let changeTotal = new BigNumber(row.changeTotal) //b 变更后数量
|
|
|
|
+ //a 大于 b = 1,a 等于 b = 0,a 小于 b = -1, a 或 b 的值异常时 = null
|
|
|
|
+ const isCompared = allMeterTotal.comparedTo(changeTotal)
|
|
|
|
+ if (isCompared === 1 || isCompared === null) {
|
|
|
|
+ console.log('超计了')
|
|
|
|
+ } else {
|
|
|
|
+ meterTableUpdate(row)
|
|
|
|
+ }
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
@@ -270,21 +281,43 @@ const containChangeTotalBlur = (row) => {
|
|
}
|
|
}
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
row.containChangeTotal = val
|
|
row.containChangeTotal = val
|
|
|
|
+ meterTableUpdate(row)
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
-//删除清单
|
|
|
|
-const delAddTableClick = (row) => {
|
|
|
|
|
|
+//清单数据修改
|
|
|
|
+const meterTableUpdate = async (form) => {
|
|
|
|
+ const { error, msg, code } = await mainApi.tableUpdate(form)
|
|
|
|
+ if (!error && code === 200) {
|
|
|
|
+ window.$message.success('更新成功')
|
|
|
|
+ } else {
|
|
|
|
+ window.$message.error(msg ?? '更新失败')
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
|
|
|
|
+//删除清单
|
|
|
|
+const delAddTableClick = (row, index) => {
|
|
|
|
+ delMessage(async () => {
|
|
|
|
+ const dataId = tableInfo.value.id
|
|
|
|
+ const { code, msg } = await mainApi.remove({
|
|
|
|
+ id: row.id,
|
|
|
|
+ dataId,
|
|
|
|
+ })
|
|
|
|
+ if (code === 200) {
|
|
|
|
+ window.$message.success('删除成功')
|
|
|
|
+ tableData.value.splice(index, 1)
|
|
|
|
+ } else {
|
|
|
|
+ window.$message.error(msg ?? '删除失败')
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
|
|
|
|
//添加计量清单
|
|
//添加计量清单
|
|
|
|
+const addBillBaseShow = ref(false)
|
|
const billBaseIds = ref('')
|
|
const billBaseIds = ref('')
|
|
-const nodeId = ref('')
|
|
|
|
-const cid = ref('')
|
|
|
|
-const addBillBaseModalShow = ref(false)
|
|
|
|
const addBillModalClick = () => {
|
|
const addBillModalClick = () => {
|
|
-
|
|
|
|
|
|
+ addBillBaseShow.value = true
|
|
|
|
+ billBaseIds.value = arrToId(tableData.value)
|
|
}
|
|
}
|
|
|
|
|
|
const finishChange = () => {
|
|
const finishChange = () => {
|