|
@@ -10,12 +10,22 @@
|
|
|
|
|
|
<script setup>
|
|
|
import { ref, watch } from 'vue'
|
|
|
+import { arrToId, getArrValue } from 'js-fast-way'
|
|
|
+import mainApi from '~api/debit-pay/admin/middlepay'
|
|
|
|
|
|
const props = defineProps({
|
|
|
ids: {
|
|
|
type: [String, Number],
|
|
|
default: '',
|
|
|
},
|
|
|
+ idn: {
|
|
|
+ type: [String, Number],
|
|
|
+ default: '',
|
|
|
+ },
|
|
|
+ contractId: {
|
|
|
+ type: [String, Number],
|
|
|
+ default: '',
|
|
|
+ },
|
|
|
})
|
|
|
|
|
|
//事件
|
|
@@ -28,47 +38,76 @@ const isShow = defineModel('modelValue', {
|
|
|
})
|
|
|
|
|
|
//监听
|
|
|
+const dataId = ref(props.ids)
|
|
|
+const nodeId = ref(props.idn)
|
|
|
+const cid = ref(props.contractId)
|
|
|
+
|
|
|
watch(() => [
|
|
|
props.ids,
|
|
|
-], ([ids]) => {
|
|
|
- console.log('ids', ids)
|
|
|
+ props.idn,
|
|
|
+ props.contractId,
|
|
|
+], ([ids, idn, contractId]) => {
|
|
|
+ dataId.value = ids
|
|
|
+ nodeId.value = idn
|
|
|
+ cid.value = contractId
|
|
|
}, { immediate: true })
|
|
|
|
|
|
//监听
|
|
|
watch(isShow, (val) => {
|
|
|
if (val) {
|
|
|
- console.log('处理数据')
|
|
|
+ getTableData()
|
|
|
}
|
|
|
})
|
|
|
+
|
|
|
//表格数据
|
|
|
const tableLoading = ref(false)
|
|
|
const tableColumn = [
|
|
|
- { key: 'key1', name: '清单编号' },
|
|
|
- { key: 'key2', name: '清单名称' },
|
|
|
- { key: 'key3', name: '单价(元)' },
|
|
|
- { key: 'key4', name: '合同数量' },
|
|
|
- { key: 'key5', name: '合同变更后数量' },
|
|
|
- { key: 'key6', name: '施工图变更后数量' },
|
|
|
- { key: 'key7', name: '分解剩余量' },
|
|
|
+ { key: 'formNumber', name: '清单编号' },
|
|
|
+ { key: 'formName', name: '清单名称' },
|
|
|
+ { key: 'currentPrice', name: '单价(元)' },
|
|
|
+ { key: 'contractTotal', name: '合同数量' },
|
|
|
+ { key: 'changeTotal', name: '合同变更后数量' },
|
|
|
+ { key: 'buildChangeTotal', name: '施工图变更后数量' },
|
|
|
+ { key: 'resolveResidueTotal', name: '分解剩余量' },
|
|
|
]
|
|
|
-const tableData = ref([
|
|
|
- { key1: '1111' },
|
|
|
-])
|
|
|
+const tableData = ref([])
|
|
|
+const getTableData = async () => {
|
|
|
+ tableData.value = []
|
|
|
+ tableLoading.value = true
|
|
|
+ const { data } = await mainApi.addFormList({
|
|
|
+ contractId: cid.value,
|
|
|
+ ids: dataId.value,
|
|
|
+ nodeId: nodeId.value,
|
|
|
+ })
|
|
|
+ tableData.value = getArrValue(data)
|
|
|
+ tableLoading.value = false
|
|
|
+}
|
|
|
|
|
|
//表格选择
|
|
|
-const tableCheckChange = (checks) => {
|
|
|
- console.log(checks)
|
|
|
+const checksData = ref([])
|
|
|
+const tableCheckChange = (data) => {
|
|
|
+ checksData.value = data
|
|
|
}
|
|
|
-const modalSave = () => {
|
|
|
- emit('finish')
|
|
|
+
|
|
|
+//确定保存
|
|
|
+const modalSave = async () => {
|
|
|
+ const rows = checksData.value
|
|
|
+ if (rows.length <= 0) {
|
|
|
+ window.$message.warning('请先选择清单')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ const rowIds = arrToId(rows)
|
|
|
+ const { data } = await mainApi.addResolveForm({
|
|
|
+ contractId: cid.value,
|
|
|
+ ids: rowIds,
|
|
|
+ })
|
|
|
+ emit('finish', getArrValue(data))
|
|
|
modalClose()
|
|
|
}
|
|
|
+
|
|
|
+//取消关闭
|
|
|
const modalClose = () => {
|
|
|
isShow.value = false
|
|
|
emit('close')
|
|
|
}
|
|
|
</script>
|
|
|
-
|
|
|
-<style scoped lang="scss">
|
|
|
-
|
|
|
-</style>
|