8
0
ZaiZai 1 жил өмнө
parent
commit
09cd52b2d4

+ 114 - 0
src/api/modules/project/index.js

@@ -0,0 +1,114 @@
+import { HcApi } from '../../request/index'
+
+export default {
+    //分页
+    async page(form) {
+        return HcApi({
+            url: '/api/blade-manager/projectInfo/list',
+            method: 'get',
+            params: form,
+        }, false)
+    },
+    //详情
+    async detail(id) {
+        return HcApi({
+            url: '/api/blade-manager/projectInfo/detail',
+            method: 'get',
+            params: {
+                id,
+            },
+        }, false)
+    },
+    //合同段详情
+    async detail2(id) {
+        return HcApi({
+            url: '/api/blade-manager/contractInfo/detail2',
+            method: 'get',
+            params: {
+                id,
+            },
+        }, false)
+    },
+    //新增和编辑
+    async submit(form) {
+        return HcApi({
+            url: '/api/blade-manager/projectInfo/submit',
+            method: 'post',
+            data: form,
+        }, false)
+    },
+    //删除
+    async del(ids) {
+        return HcApi({
+            url: '/api/blade-manager/projectInfo/remove',
+            method: 'post',
+            params: {
+                ids,
+            },
+        }, false)
+    },
+    async getProjectDeatilWbsId(id, ReferenceWbsTemplateId, ReferenceWbsTemplateType) {
+        return HcApi({
+            url: '/api/blade-manager/projectInfo/detail2',
+            method: 'get',
+            params: { id, ReferenceWbsTemplateId, ReferenceWbsTemplateType },
+        }, false)
+    },
+    async findLogWbsTreeList() {
+        return HcApi({
+            url: '/api/blade-manager/wbsInfo/queryLogTree',
+            method: 'get',
+            params: {},
+        }, false)
+    },
+    async findWbsTreeList(type) {
+        return HcApi({
+            url: '/api/blade-manager/projectInfo/get-wbsTree-list',
+            method: 'get',
+            params: { type },
+        }, false)
+    },
+    async findProjectTree(projectId, wbsId) {
+        return HcApi({
+            url: '/api/blade-manager/projectInfo/tree',
+            method: 'get',
+            params: { projectId, wbsId },
+        }, false)
+    },
+    //获取试验配合比树接口
+    async findProjectTreeTrial(form) {
+        return HcApi({
+            url: '/api/blade-manager/projectInfo/tree-record-trial',
+            method: 'get',
+            params: form,
+        }, false)
+    },
+    async getContractRelation(contractId) {
+        return HcApi({
+            url: '/api/blade-manager/contractInfo/get-contract-relationInfo',
+            method: 'get',
+            params: { contractId },
+        }, false)
+    },
+    async submitLogWbsTreeInProject(form) {
+        return HcApi({
+            url: '/api/blade-manager/wbsPrivate/saveContractLogNode',
+            method: 'post',
+            data: form,
+        }, false)
+    },
+    async submitWbsTreeInProject(form) {
+        return HcApi({
+            url: '/api/blade-manager/projectInfo/submit-wbsTree-project',
+            method: 'post',
+            data: form,
+        }, false)
+    },
+    async treeAllConstruction(form) {
+        return HcApi({
+            url: '/api/blade-manager/contractInfo/tree-all-construction',
+            method: 'get',
+            params: form,
+        }, false)
+    },
+}

+ 1 - 1
src/layout/modules/mainBody.vue

@@ -28,7 +28,7 @@ watch(() => useRoutes?.name, (name) => {
 })
 
 //判断数据
-const routes = ['/certificate/management', '/certificate/list']
+const routes = ['/certificate/management', '/certificate/list', 'projectinfo/list']
 const isPadding = ref(true)
 const setBarRoutesData = (name) => {
     isPadding.value = routes.indexOf(name) === -1

+ 158 - 3
src/views/project/list.vue

@@ -1,13 +1,168 @@
 <template>
-    <div>项目列表</div>
+    <hc-new-card v-loading="tableLoading" id-ref="hc-project-list" div-p="12px" scrollbar>
+        <template #header>
+            <div class="w-[354px]">
+                <el-select v-model="projectId" filterable clearable block placeholder="选择项目" @change="projectClick">
+                    <el-option v-for="item in projectData" :key="item.id" :label="item.projectAlias" :value="item.id" />
+                </el-select>
+            </div>
+        </template>
+        <template #extra>
+            <el-button hc-btn type="primary" @click="addProjectClick">创建项目</el-button>
+        </template>
+        <hc-card-item v-for="item in tableData" :key="item.id" class="hc-project-list-card" @click="projectClick(item.id)">
+            <div class="alias">{{ item.projectAlias }}</div>
+            <div class="name">{{ item.projectName }}</div>
+            <div class="footer">
+                <div class="id">{{ item.id }}</div>
+                <div class="time">{{ item.updateTime }}</div>
+            </div>
+        </hc-card-item>
+        <template #action>
+            <hc-pages :pages="searchForm" @change="pageChange" />
+        </template>
+        <!-- 查看项目信息 -->
+        <InfoDialog v-model="isProjectInfoDialog" :ids="projectInfoId" />
+        <!-- 创建或编辑项目信息 -->
+        <hc-new-drawer v-model="isProjectDrawer" is-close to-id="hc-project-list">
+            创建或编辑项目信息
+        </hc-new-drawer>
+    </hc-new-card>
 </template>
 
 <script setup>
+import { nextTick, onActivated, ref } from 'vue'
+import { getArrValue } from 'js-fast-way'
+import InfoDialog from './modules/list/info-dialog.vue'
+import mainApi from '~api/project/index'
+
 defineOptions({
     name: 'ProjectList',
 })
-</script>
 
-<style scoped lang="scss">
+//激活
+onActivated(() => {
+    getDataApi()
+})
+
+const getDataApi = async () => {
+    await getProjectData()
+    searchClick()
+}
+
+//项目列表
+const projectData = ref([])
+const projectId = ref('')
+const getProjectData = async () => {
+    const { data } = await mainApi.page({
+        current: 1,
+        size: 999,
+    })
+    projectData.value = getArrValue(data?.records)
+}
+
+//搜索条件
+const searchForm = ref({ current: 1, size: 20, total: 0 })
+
+//搜索
+const searchClick = () => {
+    searchForm.value.current = 1
+    getTableData()
+}
+
+//分页
+const pageChange = ({ current, size }) => {
+    searchForm.value.current = current
+    searchForm.value.size = size
+    getTableData()
+}
+
+//项目数据
+const tableData = ref([])
+//获取表格数据
+const tableLoading = ref(true)
+const getTableData = async () => {
+    tableData.value = []
+    tableLoading.value = true
+    const { error, code, data } = await mainApi.page({
+        ...searchForm.value,
+        total: null,
+    })
+    tableLoading.value = false
+    if (!error && code === 200) {
+        tableData.value = getArrValue(data['records'])
+        searchForm.value.total = data['total']
+    } else {
+        tableData.value = []
+        searchForm.value.total = 0
+    }
+}
+
+//查看项目信息
+const isProjectInfoDialog = ref(false)
+const projectInfoId = ref('')
+
+//项目被选择
+const projectClick = (id) => {
+    projectInfoId.value = id
+    nextTick(() => {
+        isProjectInfoDialog.value = true
+    })
+}
+
+//创建项目或修改项目
+const isProjectDrawer = ref(false)
+const projectDrawerId = ref('')
+
+//创建项目
+const addProjectClick = () => {
+    projectDrawerId.value = ''
+    nextTick(() => {
+        isProjectDrawer.value = true
+    })
+}
+</script>
 
+<style lang="scss">
+.hc-card-item-box.hc-project-list-card {
+    width: 354px;
+    height: 120px;
+    display: inline-block;
+    border-radius: 4px;
+    margin-right: 14px;
+    margin-bottom: 14px;
+    cursor: pointer;
+    background: #f3f3f3 !important;
+    transition: all 0.3s;
+    .alias {
+        font-size: 16px;
+        white-space:nowrap;
+        overflow:hidden;
+        text-overflow:ellipsis;
+    }
+    .name {
+        font-size: 14px;
+        color: #747474;
+        margin-top: 10px;
+        overflow: hidden;
+        text-overflow: ellipsis;  /* 超出部分省略号 */
+        word-break: break-all;  /* 设置省略字母数字 */
+        display: -webkit-box;
+        -webkit-box-orient: vertical;
+        -webkit-line-clamp: 2; /* 显示的行数 */
+    }
+    .footer {
+        position: absolute;
+        color: #747474;
+        display: flex;
+        align-items: center;
+        font-size: 14px;
+        justify-content: space-between;
+        bottom: 0;
+        width: 100%;
+    }
+    &:hover {
+        box-shadow: 2px 2px var(--el-color-primary-light-7);
+    }
+}
 </style>

+ 54 - 0
src/views/project/modules/list/info-dialog.vue

@@ -0,0 +1,54 @@
+<template>
+    <hc-new-dialog v-model="isShow" widths="800px" is-table title="项目信息" :footer="false" @close="dialogClose">
+        111111
+    </hc-new-dialog>
+</template>
+
+<script setup>
+import { nextTick, ref, watch } from 'vue'
+import { getArrValue, isNullES } from 'js-fast-way'
+import mainApi from '~api/project/index'
+
+const props = defineProps({
+    ids: {
+        type: [String, Number],
+        default: () => '',
+    },
+})
+
+//双向绑定
+// eslint-disable-next-line no-undef
+const isShow = defineModel('modelValue', {
+    default: false,
+})
+
+//监听数据
+const projectId = ref(props.ids)
+watch(() => props.ids, (id) => {
+    projectId.value = id
+}, { immediate: true, deep: true })
+
+//监听显示
+watch(isShow, (val) => {
+    if (val) {
+        getProjectInfo()
+    } else {
+        projectId.value = ''
+    }
+})
+
+//获取项目信息
+const getProjectInfo = async () => {
+    if (isNullES(projectId.value)) return
+    console.log(projectId.value)
+}
+
+//关闭弹窗
+const dialogClose = () => {
+    isShow.value = false
+}
+</script>
+
+<style scoped lang="scss">
+
+</style>