|
@@ -3,32 +3,39 @@
|
|
|
<hc-card-item>
|
|
|
<template #header>
|
|
|
<div class="w-60">
|
|
|
- <el-input v-model="searchForm.key1" placeholder="清单编号" />
|
|
|
+ <hc-search-input v-model="searchForm.searchValue" placeholder="请输入清单编号" @search="searchClick" />
|
|
|
</div>
|
|
|
</template>
|
|
|
<template #extra>
|
|
|
- <el-link type="primary">显示已分解</el-link>
|
|
|
+ <el-link type="primary" @click="showTypeClick">{{ searchForm.showType === 1 ? '显示已分解' : '显示所有' }}</el-link>
|
|
|
</template>
|
|
|
<hc-table
|
|
|
:column="tableColumn" :datas="tableData" :loading="tableLoading"
|
|
|
is-new :index-style="{ width: 60 }" is-check :check-style="{ width: 29 }"
|
|
|
@selection-change="tableCheckChange"
|
|
|
/>
|
|
|
- <template #action>
|
|
|
- <hc-pages :pages="searchForm" @change="pageChange" />
|
|
|
- </template>
|
|
|
</hc-card-item>
|
|
|
</hc-new-dialog>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
import { ref, watch } from 'vue'
|
|
|
+import { arrToKey, getArrValue } from 'js-fast-way'
|
|
|
+import mainApi from '~api/alter/admin/order'
|
|
|
|
|
|
const props = defineProps({
|
|
|
ids: {
|
|
|
type: [String, Number],
|
|
|
default: '',
|
|
|
},
|
|
|
+ treeId: {
|
|
|
+ type: [String, Number],
|
|
|
+ default: '',
|
|
|
+ },
|
|
|
+ contractId: {
|
|
|
+ type: [String, Number],
|
|
|
+ default: '',
|
|
|
+ },
|
|
|
})
|
|
|
|
|
|
//事件
|
|
@@ -43,50 +50,82 @@ const isShow = defineModel('modelValue', {
|
|
|
//监听
|
|
|
watch(() => [
|
|
|
props.ids,
|
|
|
-], ([ids]) => {
|
|
|
- console.log('ids', ids)
|
|
|
-}, { immediate: true })
|
|
|
+ props.treeId,
|
|
|
+ props.contractId,
|
|
|
+], ([id, tid, cid]) => {
|
|
|
+ searchForm.value.ids = id
|
|
|
+ searchForm.value.nodeId = tid
|
|
|
+ searchForm.value.contractId = cid
|
|
|
+}, { deep: true })
|
|
|
|
|
|
//监听
|
|
|
watch(isShow, (val) => {
|
|
|
if (val) {
|
|
|
- console.log('isShow', val)
|
|
|
+ getTableData()
|
|
|
}
|
|
|
})
|
|
|
|
|
|
+//搜索
|
|
|
+const searchClick = () => {
|
|
|
+ getTableData()
|
|
|
+}
|
|
|
+
|
|
|
+//显示类型
|
|
|
+const showTypeClick = () => {
|
|
|
+ const { showType } = searchForm.value
|
|
|
+ searchForm.value.showType = showType === 1 ? 2 : 1
|
|
|
+ getTableData()
|
|
|
+}
|
|
|
+
|
|
|
//搜索表单
|
|
|
const searchForm = ref({
|
|
|
- key1: null, current: 1, size: 10, total: 0,
|
|
|
+ searchValue: null, showType: 1, nodeId: props.treeId,
|
|
|
+ ids: props.ids, contractId: props.contractId,
|
|
|
})
|
|
|
|
|
|
-//分页
|
|
|
-const pageChange = ({ current, size }) => {
|
|
|
- searchForm.value.current = current
|
|
|
- searchForm.value.size = size
|
|
|
-}
|
|
|
-
|
|
|
//表格数据
|
|
|
const tableLoading = ref(false)
|
|
|
const tableColumn = ref([
|
|
|
- { key: 'key1', name: '清单编号' },
|
|
|
- { key: 'key2', name: '清单名称' },
|
|
|
- { key: 'key3', name: '单价(元)' },
|
|
|
- { key: 'key4', name: '合同数量' },
|
|
|
- { key: 'key5', name: '合同变更后数量' },
|
|
|
- { key: 'key6', name: '施工图变更后数量' },
|
|
|
- { key: 'key7', name: '分解剩余量' },
|
|
|
+ { key: 'formNumber', name: '清单编号', width: 120 },
|
|
|
+ { key: 'formName', name: '清单名称' },
|
|
|
+ { key: 'currentPrice', name: '单价(元)', width: 100 },
|
|
|
+ { key: 'contractTotal', name: '合同数量', width: 100 },
|
|
|
+ { key: 'changeTotal', name: '合同变更后数量', width: 120 },
|
|
|
+ { key: 'buildChangeTotal', name: '施工图变更后数量', width: 140 },
|
|
|
+ { key: 'resolveResidueTotal', name: '分解剩余量', width: 100 },
|
|
|
])
|
|
|
-const tableData = ref([
|
|
|
- { key1: '1111' },
|
|
|
-])
|
|
|
-
|
|
|
-const tableCheckChange = () => {
|
|
|
+const tableData = ref([])
|
|
|
+const getTableData = async () => {
|
|
|
+ tableData.value = []
|
|
|
+ tableLoading.value = true
|
|
|
+ const { data } = await mainApi.addForm({
|
|
|
+ ...searchForm.value,
|
|
|
+ contractId: props.contractId,
|
|
|
+ })
|
|
|
+ tableData.value = getArrValue(data)
|
|
|
+ tableLoading.value = false
|
|
|
+}
|
|
|
|
|
|
+//表格勾选
|
|
|
+const tableCheck = ref([])
|
|
|
+const tableCheckChange = (rows) => {
|
|
|
+ tableCheck.value = rows
|
|
|
}
|
|
|
|
|
|
-const addModalSave = () => {
|
|
|
- emit('finish')
|
|
|
- addModalClose()
|
|
|
+//保存
|
|
|
+const addModalSave = async () => {
|
|
|
+ const ids = arrToKey(tableCheck.value, 'id')
|
|
|
+ const { error, code, msg, data } = await mainApi.getSelectForm({
|
|
|
+ ids: ids,
|
|
|
+ nodeId: props.treeId,
|
|
|
+ contractId: props.contractId,
|
|
|
+ })
|
|
|
+ if (!error && code === 200) {
|
|
|
+ addModalClose()
|
|
|
+ emit('finish', getArrValue(data))
|
|
|
+ } else {
|
|
|
+ window.$message.error(msg ?? '确认失败')
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//关闭弹窗
|
|
@@ -95,7 +134,3 @@ const addModalClose = () => {
|
|
|
emit('close')
|
|
|
}
|
|
|
</script>
|
|
|
-
|
|
|
-<style scoped lang="scss">
|
|
|
-
|
|
|
-</style>
|