iZaiZaiA 2 лет назад
Родитель
Сommit
edc94bf7dc

+ 2 - 2
src/views/ledger/components/table-form.vue

@@ -1,5 +1,5 @@
 <template>
-    <div class="hc-layout-content">
+    <div class="hc-table-form-content">
         <div class="hc-content-box">
             <div class="hc-table-forem-box">
                 <el-scrollbar v-if="excelIdVal && isTableForm">
@@ -380,7 +380,7 @@ const getBussPdfInfo = async () => {
 </script>
 
 <style lang="scss" scoped>
-.hc-layout-content {
+.hc-table-form-content {
     flex: 1;
     display: flex;
     flex-direction: column;

+ 193 - 0
src/views/ledger/components/table-list.vue

@@ -0,0 +1,193 @@
+<template>
+    <div class="hc-table-list-content">
+        <HcCard>
+            <template #header>
+                <div class="w-64">
+                    <HcDatePicker :dates="betweenTime" size="large" clearable @change="betweenTimeUpdate"/>
+                </div>
+                <div class="w-40 ml-3">
+                    <el-select v-model="searchForm.createUser" block clearable size="large" placeholder="请选择记录人">
+                        <el-option v-for="item in recordData" :label="item['userName']" :value="item['userId']"/>
+                    </el-select>
+                </div>
+                <div class="ml-2">
+                    <el-button type="primary" size="large" @click="searchClick">
+                        <HcIcon name="search-2"/>
+                        <span>搜索</span>
+                    </el-button>
+                </div>
+            </template>
+            <template #extra>
+                <HcTooltip keys="ledger_query_report">
+                    <el-button hc-btn type="primary" :disabled="tableCheckedKeys.length <= 0" @click="reportModalClick">
+                        <HcIcon name="send-plane-2"/>
+                        <span>批量上报</span>
+                    </el-button>
+                </HcTooltip>
+                <HcTooltip keys="ledger_query_abolish">
+                    <el-button hc-btn :disabled="tableCheckedKeys.length <= 0" @click="batchAbolishClick">
+                        <HcIcon name="delete-bin-3"/>
+                        <span>批量废除</span>
+                    </el-button>
+                </HcTooltip>
+                <HcTooltip keys="ledger_query_print">
+                    <el-button hc-btn :disabled="tableCheckedKeys.length <= 0">
+                        <HcIcon name="printer"/>
+                        <span>预览/打印</span>
+                    </el-button>
+                </HcTooltip>
+            </template>
+            <HcTable ref="tableListRef" :column="tableListColumn" :datas="tableListData" :loading="tableLoading" isCheck @selection-change="tableSelectionChange"/>
+            <template #action>
+                <HcPages :pages="searchForm" @change="pageChange"/>
+            </template>
+        </HcCard>
+
+    </div>
+</template>
+
+<script setup>
+import {ref, watch, nextTick} from "vue";
+import queryApi from '~api/ledger/query';
+import {getArrValue} from "vue-utils-plus"
+
+//参数
+const props = defineProps({
+    projectId: {
+        type: [String,Number],
+        default: ''
+    },
+    contractId: {
+        type: [String,Number],
+        default: ''
+    },
+    items: {
+        type: Object,
+        default: () => ({})
+    }
+})
+
+//变量
+const projectId = ref(props.projectId);
+const contractId = ref(props.contractId);
+const menuItem = ref(props.items);
+
+//监听
+watch(() => [
+    props.projectId,
+    props.contractId,
+    props.items,
+], ([pid, cid, item]) => {
+    projectId.value = pid
+    contractId.value = cid
+    menuItem.value = item
+    getQueryData()
+})
+
+//渲染完成
+nextTick(() => {
+    getQueryData()
+})
+
+//获取相关数据
+const getQueryData = () => {
+    searchClick()
+    queryFillUser()
+}
+
+//获取记录人数据
+const recordData = ref([])
+const queryFillUser = async () => {
+    const { primaryKeyId } = menuItem.value
+    const { data } = await queryApi.queryFillUser({
+        contractId: contractId.value,
+        primaryKeyId: primaryKeyId
+    })
+    recordData.value = getArrValue(data)
+}
+
+//搜索表单
+const searchForm = ref({queryTime: '', createUser: null, current: 1, size: 20, total: 0})
+
+//日期时间被选择
+const betweenTime = ref(null)
+const betweenTimeUpdate = ({val,arr}) => {
+    betweenTime.value = arr
+    searchForm.value.queryTime = `${val['start']}~${val['end']}`
+}
+
+//搜索
+const searchClick = () => {
+    searchForm.value.current = 1;
+    getTableData()
+}
+
+//分页被点击
+const pageChange = ({current, size}) => {
+    searchForm.value.current = current
+    searchForm.value.size = size
+    getTableData()
+}
+
+//获取数据
+const tableLoading = ref(false)
+const tableListColumn = ref([
+    {key:'recordTime', name: '施工日期'},
+    {key:'projectPileno', name: '分项工程'},
+    {key:'projectPart', name: '施工部位'},
+    {key:'statusValue', name: '流程状态'},
+    {key:'createUserName', name: '记录人'}
+])
+const tableListData = ref([])
+const getTableData = async () => {
+    //初始数据处理
+    tableLoading.value = true
+    const {primaryKeyId} = menuItem.value
+    tableListRef.value?.clearSelection()
+    tableCheckedKeys.value = []
+    //请求数据
+    const { error, code, data } = await queryApi.constructionLogPage({
+        ...searchForm.value,
+        wbsNodeId: primaryKeyId,
+        projectId: projectId.value,
+        contractId: contractId.value,
+    })
+    //处理数据
+    tableLoading.value = false
+    if (!error && code === 200) {
+        tableListData.value = getArrValue(data['records'])
+        searchForm.value.total = data.total || 0
+    } else {
+        tableListData.value = []
+        searchForm.value.total = 0
+    }
+}
+
+//多选
+const tableListRef = ref(null)
+const tableCheckedKeys = ref([])
+const tableSelectionChange = (rows) => {
+    tableCheckedKeys.value = rows.filter((item) => {
+        return (item??'') !== '';
+    })
+}
+
+//批量上报
+const reportModalClick = () => {
+
+}
+
+//批量废除
+const batchAbolishClick = () => {
+
+}
+</script>
+
+<style lang="scss" scoped>
+.hc-table-list-content {
+    flex: 1;
+    position: relative;
+    margin-left: 24px;
+    height: 100%;
+}
+</style>

+ 5 - 8
src/views/ledger/query.vue

@@ -15,12 +15,8 @@
                     </el-menu>
                 </el-scrollbar>
             </div>
-            <transition name="fade-transform">
-                <HcTableForm :projectId="projectId" :contractId="contractId" :items="menuItem" v-if="menuType === 'form'"/>
-                <div v-else>
-                    等待开发
-                </div>
-            </transition>
+            <HcTableForm :projectId="projectId" :contractId="contractId" :items="menuItem" v-if="menuType === 'form'"/>
+            <HcTableList :projectId="projectId" :contractId="contractId" :items="menuItem" v-if="menuType === 'table'"/>
         </template>
     </div>
 </template>
@@ -31,6 +27,7 @@ import {useAppStore} from "~src/store";
 import queryApi from '~api/ledger/query';
 import {getArrValue} from "vue-utils-plus"
 import HcTableForm from "./components/table-form.vue"
+import HcTableList from "./components/table-list.vue"
 
 //初始变量
 const useAppState = useAppStore()
@@ -75,9 +72,9 @@ const queryLogList = async () => {
 
 //菜单被点击
 const handleMenuValue = (type,item) => {
-    menuType.value = type
     menuItem.value = item
-    menuKey.value = `${item?.primaryKeyId}-${item?.type}`
+    menuKey.value = `${item?.primaryKeyId}-${type}`
+    menuType.value = type
 }
 </script>