|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<hc-new-card title="合同材料">
|
|
|
<template #header>
|
|
|
- <el-tabs v-model="headerTabsKey" class="hc-header-tabs" @tab-click="headerTabsClick">
|
|
|
+ <el-tabs v-model="headerTabsKey" class="hc-header-tabs" @tab-change="headerTabsClick">
|
|
|
<el-tab-pane label="合同材料基准数据" name="data" />
|
|
|
<el-tab-pane label="材料实时价格" name="price" />
|
|
|
</el-tabs>
|
|
@@ -53,16 +53,16 @@
|
|
|
<el-input v-model="infoData.price" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="材料损耗:">
|
|
|
- <el-input v-model="infoData.key1" placeholder="材料损耗率" />
|
|
|
+ <el-input v-model="infoData.wastageRatio" placeholder="材料损耗率" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="调差限额:">
|
|
|
- <el-input v-model="infoData.key2" placeholder="调差限额百分比" />
|
|
|
+ <el-input v-model="infoData.quotaRatio" placeholder="调差限额百分比" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="收益/承担:">
|
|
|
- <el-input v-model="infoData.key4" placeholder="业主收益/承担百分比" />
|
|
|
+ <el-input v-model="infoData.ownerRatio" placeholder="业主收益/承担百分比" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="综合抵扣:">
|
|
|
- <el-input v-model="infoData.key3" placeholder="材料综合抵扣率" />
|
|
|
+ <el-input v-model="infoData.deductionRatio" placeholder="材料综合抵扣率" />
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</hc-card-item>
|
|
@@ -72,7 +72,7 @@
|
|
|
<hc-body v-else split padding="0">
|
|
|
<template #left>
|
|
|
<hc-card-item scrollbar>
|
|
|
- <hc-data-tree :auto-expand-keys="treeExpandKeys" :h-props="treeProps" :datas="treeLoadNode" @node-tap="treeNodeTap" />
|
|
|
+ <hc-data-tree tree-key="id" :auto-expand-keys="treeExpandKeys" :h-props="treeProps" :datas="treeLoadNode" @node-tap="treeNodeTap" />
|
|
|
</hc-card-item>
|
|
|
</template>
|
|
|
<hc-card-item v-if="isTablePrice">
|
|
@@ -84,11 +84,11 @@
|
|
|
</template>
|
|
|
<template #extra>
|
|
|
<el-button @click="priceCancelClick">取消</el-button>
|
|
|
- <el-button type="success" @click="tablePriceSave">提交保存</el-button>
|
|
|
+ <el-button type="success" :loading="saveLoaing1" @click="tablePriceSave">提交保存</el-button>
|
|
|
</template>
|
|
|
<hc-table :column="tableColumn1" :datas="tableData2" :loading="tableLoading2" :is-index="false">
|
|
|
- <template #key4="{ row }">
|
|
|
- <hc-table-input v-model="row.key4" />
|
|
|
+ <template #price="{ row }">
|
|
|
+ <hc-table-input v-model="row.price" />
|
|
|
</template>
|
|
|
</hc-table>
|
|
|
</hc-card-item>
|
|
@@ -122,22 +122,22 @@
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="材料损耗率:">
|
|
|
- <el-input v-model="infoData.key1" />
|
|
|
+ <el-input v-model="formModel.wastageRatio" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="调差限额百分比:">
|
|
|
- <el-input v-model="infoData.key2" />
|
|
|
+ <el-input v-model="formModel.quotaRatio" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="业主收益/承担百分比:">
|
|
|
- <el-input v-model="infoData.key4" />
|
|
|
+ <el-input v-model="formModel.ownerRatio" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="材料综合抵扣率:">
|
|
|
- <el-input v-model="infoData.key3" />
|
|
|
+ <el-input v-model="formModel.deductionRatio" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -156,7 +156,7 @@ import { onActivated, ref } from 'vue'
|
|
|
import { HcDelMsg } from 'hc-vue3-ui'
|
|
|
import { getStoreValue, setStoreValue } from '~uti/storage'
|
|
|
import { deepClone, formValidate, getArrValue, getObjValue, isNullES } from 'js-fast-way'
|
|
|
-import mainApi from '~api/debit-pay/material/contract.js'
|
|
|
+import mainApi from '~api/debit-pay/material/contract'
|
|
|
import { useAppStore } from '~src/store'
|
|
|
|
|
|
const useAppState = useAppStore()
|
|
@@ -175,9 +175,12 @@ onActivated(() => {
|
|
|
//标签页
|
|
|
const headerTabsKey = ref('data')
|
|
|
const headerTabsClick = (tab) => {
|
|
|
+ console.log(tab)
|
|
|
if (tab === 'data') {
|
|
|
searchForm.value.current = 1
|
|
|
getTableData()
|
|
|
+ } else if (tab === 'price') {
|
|
|
+ getDateTree()
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -200,9 +203,9 @@ const tableColumn = ref([
|
|
|
{ key: 'specification', name: '规格型号' },
|
|
|
{ key: 'unit', name: '单位' },
|
|
|
{ key: 'price', name: '单价' },
|
|
|
- { key: 'key1', name: '材料损耗率(%)' },
|
|
|
- { key: 'key2', name: '调差限额百分比(%)' },
|
|
|
- { key: 'key3', name: '材料综合抵扣率(%)' },
|
|
|
+ { key: 'wastageRatio', name: '材料损耗率(%)' },
|
|
|
+ { key: 'quotaRatio', name: '调差限额百分比(%)' },
|
|
|
+ { key: 'deductionRatio', name: '材料综合抵扣率(%)' },
|
|
|
{ key: 'action', name: '操作', width: 100 },
|
|
|
])
|
|
|
|
|
@@ -334,53 +337,23 @@ const modalClose = () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//数据格式
|
|
|
const treeStore = 'debit-pay-material-contract-tree-keys'
|
|
|
const treeExpandKeys = ref(getStoreValue(treeStore) || [])
|
|
|
const treeProps = {
|
|
|
- label: 'label',
|
|
|
+ label: 'nodeName',
|
|
|
children: 'children',
|
|
|
}
|
|
|
|
|
|
//数据
|
|
|
-const treeLoadNode = ref([
|
|
|
- {
|
|
|
- label: 'Level one 1',
|
|
|
- children: [
|
|
|
- {
|
|
|
- label: 'Level two 1-1',
|
|
|
- children: [
|
|
|
- { label: 'Level three 1-1-1' },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- label: 'Level two 2-1',
|
|
|
- children: [
|
|
|
- { label: 'Level three 2-1-1' },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- label: 'Level two 2-2',
|
|
|
- children: [
|
|
|
- { label: 'Level three 2-2-1' },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- label: 'Level two 3-1',
|
|
|
- children: [
|
|
|
- { label: 'Level three 3-1-1' },
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- label: 'Level two 3-2',
|
|
|
- children: [
|
|
|
- { label: 'Level three 3-2-1' },
|
|
|
- ],
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
-])
|
|
|
+const treeLoadNode = ref([])
|
|
|
+const getDateTree = async () => {
|
|
|
+ const { data } = await mainApi.dateTree({
|
|
|
+ projectId: projectId.value,
|
|
|
+ contractId: contractId.value,
|
|
|
+ })
|
|
|
+ treeLoadNode.value = getArrValue(data)
|
|
|
+}
|
|
|
|
|
|
//树节点被点击
|
|
|
const treeInfo = ref({})
|
|
@@ -393,19 +366,21 @@ const treeNodeTap = ({ data, keys }) => {
|
|
|
|
|
|
//材料实时价格
|
|
|
const tableColumn1 = [
|
|
|
- { key: 'key1', name: '材料编码' },
|
|
|
- { key: 'key2', name: '材料名称' },
|
|
|
- { key: 'key3', name: '材料单位' },
|
|
|
- { key: 'key4', name: '单价(元)' },
|
|
|
+ { key: 'materialNumber', name: '材料编码' },
|
|
|
+ { key: 'materialName', name: '材料名称' },
|
|
|
+ { key: 'unit', name: '材料单位' },
|
|
|
+ { key: 'price', name: '单价(元)' },
|
|
|
]
|
|
|
-const tableData1 = ref([
|
|
|
- { key1:'CL01', key2: '懒得写', key3: '懒得复制', key4: '懒得粘贴' },
|
|
|
-])
|
|
|
+const tableData1 = ref([])
|
|
|
|
|
|
//获取数据
|
|
|
const tableLoading1 = ref(false)
|
|
|
-const getTableData1 = () => {
|
|
|
-
|
|
|
+const getTableData1 = async () => {
|
|
|
+ const { id } = treeInfo.value
|
|
|
+ tableLoading1.value = true
|
|
|
+ const { data } = await mainApi.dateTreeTable(id)
|
|
|
+ tableData1.value = getArrValue(data)
|
|
|
+ tableLoading1.value = false
|
|
|
}
|
|
|
|
|
|
//新增
|
|
@@ -416,24 +391,46 @@ const tablePriceClick = () => {
|
|
|
}
|
|
|
|
|
|
//获取数据
|
|
|
-const tableData2 = ref([
|
|
|
- { key1:'CL01', key2: '懒得写', key3: '1', key4: '' },
|
|
|
-])
|
|
|
+const tableData2 = ref([])
|
|
|
const tableLoading2 = ref(false)
|
|
|
-const getTableData2 = () => {
|
|
|
-
|
|
|
+const getTableData2 = async () => {
|
|
|
+ tableLoading2.value = true
|
|
|
+ const { data } = await mainApi.getAllMaterial(contractId.value)
|
|
|
+ tableData2.value = getArrValue(data)
|
|
|
+ tableLoading2.value = false
|
|
|
}
|
|
|
|
|
|
//日期选择
|
|
|
const betweenTime = ref(null)
|
|
|
+const dateFormInfo = ref({ startDate:'', endDate:'' })
|
|
|
const betweenTimeUpdate = ({ arr }) => {
|
|
|
- console.log('startTime:', arr[0])
|
|
|
- console.log('endTime:', arr[1])
|
|
|
+ dateFormInfo.value = { startDate:arr[0], endDate:arr[1] }
|
|
|
}
|
|
|
|
|
|
//保存
|
|
|
-const tablePriceSave = () => {
|
|
|
- priceCancelClick()
|
|
|
+const saveLoaing1 = ref(false)
|
|
|
+const tablePriceSave = async () => {
|
|
|
+ const { startDate, endDate } = dateFormInfo.value
|
|
|
+ if (isNullES(startDate) || isNullES(endDate)) {
|
|
|
+ window.$message.error('请先选择日期')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ saveLoaing1.value = true
|
|
|
+ const { error, code, msg } = await mainApi.addDateTreeTable({
|
|
|
+ startDate: startDate,
|
|
|
+ endDate: endDate,
|
|
|
+ projectId: projectId.value,
|
|
|
+ contractId: contractId.value,
|
|
|
+ materials: tableData2.value,
|
|
|
+ })
|
|
|
+ saveLoaing1.value = false
|
|
|
+ if (!error && code === 200) {
|
|
|
+ window.$message.success('删除成功')
|
|
|
+ getDateTree()
|
|
|
+ priceCancelClick()
|
|
|
+ } else {
|
|
|
+ window.$message.error(msg ?? '操作失败')
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//取消
|