- <template>
- <div class="planPermission">
- <div class="top">
- <el-form ref="ruleForm" :model="form" v-show="showSearch">
- <el-row :gutter="20">
- <el-col :span="6">
- <el-form-item label="项目名称:" prop="projectName">
- <el-input v-model="form.projectName" placeholder="请输入项目名称" style="width: 100%"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="用地类型:" prop="spongeLandType">
- <el-select v-model="form.spongeLandType" placeholder="请选择用地类型" style="width: 100%">
- <el-option label="全部" value=""></el-option>
- <el-option v-for="dict in sponge_land_type" :key="dict.value" :label="dict.label" :value="dict.value" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="建设单位:" prop="chargeDepartment">
- <el-input v-model="form.chargeDepartment" placeholder="请输入建设单位" style="width: 100%"></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :span="6">
- <el-form-item label="项目类型:" prop="projectTypeId">
- <el-select v-model="form.projectTypeId" placeholder="请选择项目类型" style="width: 100%">
- <el-option label="全部" value="" />
- <el-option v-for="dict in projectTypes" :key="dict.id" :label="dict.projectTypeName" :value="dict.id" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="建设状态:" prop="buildStatus">
- <el-select v-model="form.buildStatus" placeholder="请选择建设状态" style="width: 100%">
- <el-option label="全部" value=""></el-option>
- <el-option v-for="dict in build_status" :key="dict.value" :label="dict.label" :value="dict.value" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item>
- <el-button type="primary" icon="Search" @click="search"> 搜索</el-button>
- <el-button icon="Refresh" @click="resetQuery">重置</el-button>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- </div>
- <el-row class="row">
- <el-button type="primary" plain icon="Plus" @click="openDialog({}, 'add')">新增规划许可</el-button>
- <el-button type="danger" plain icon="Delete" @click="batchDel">批量删除</el-button>
- <right-toolbar v-model:showSearch="showSearch" @queryTable="resetQuery"></right-toolbar>
- </el-row>
- <div class="table" ref="table_box">
- <el-table :data="tableData" v-loading="loading" stripe :max-height="maxHeight" ref="multipleTableRef">
- <el-table-column type="selection" width="55" />
- <el-table-column label="项目编码" prop="projectNo" show-overflow-tooltip />
- <el-table-column label="项目类型" prop="projectTypeId" show-overflow-tooltip>
- <template #default="{ row }">
- <span>{{ projectTypes.find(item => item.id === row.projectTypeId)?.projectTypeName || '' }}</span>
- </template>
- </el-table-column>
- <el-table-column label="项目名称" prop="projectName" show-overflow-tooltip>
- <template #default="{ row }">
- <span>{{ row.projectName }}</span>
- </template>
- </el-table-column>
- <el-table-column label="项目面积" prop="projectArea" show-overflow-tooltip>
- <template #default="{ row }">
- <span>{{ row.projectArea + 'm²' }}</span>
- </template>
- </el-table-column>
- <el-table-column label="用地类型" prop="spongeLandType" show-overflow-tooltip>
- <template #default="{ row }">
- <span>{{ findText('sponge_land_type', row.spongeLandType) }}</span>
- </template>
- </el-table-column>
- <el-table-column label="绿地率%" prop="greenRate" show-overflow-tooltip />
- <el-table-column label="建设单位" prop="chargeDepartment" show-overflow-tooltip />
- <el-table-column label="年径流总量控制率%" prop="annualRunoffTotalControlRate" show-overflow-tooltip />
- <el-table-column label="年径流污染去除率%" prop="annualRunoffPollutionControlRate" show-overflow-tooltip />
- <el-table-column label="硬化地面率%" prop="hardGroundRate" show-overflow-tooltip />
- <el-table-column label="建设状态" prop="buildStatus" show-overflow-tooltip>
- <template #default="{ row }">
- <span>{{ findText('build_status', row.buildStatus) }}</span>
- </template>
- </el-table-column>
- <el-table-column label="操作" show-overflow-tooltip width="240">
- <template #default="{ row }">
- <el-button icon="View" type="primary" link @click="openDialog(row, 'view')">详情</el-button>
- <el-button type="warning" icon="Edit" link @click="openDialog(row, 'edit')">修改</el-button>
-
- <el-button type="danger" icon="Delete" link @click="del(row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <pagination class="pagination" :total="total" v-model:page="pageNum" v-model:limit="pageSize" @pagination="getTableList" />
- </div>
- <el-dialog
- v-model="visible"
- :title="`${opts.text}规划许可`"
- :close-on-click-modal="false"
- width="70%"
- :before-close="close"
- class="dialog"
- >
- <operate ref="operateRef" :cur-row="curRow" :opts="opts" :types="projectTypes" @close="close" v-if="visible" />
- <template #footer v-if="opts.type !== 'view'">
- <div class="dialog-footer">
- <el-button type="primary" @click="submit">确 定</el-button>
- <el-button @click="close">取 消</el-button>
- </div>
- </template>
- </el-dialog>
- </div>
- </template>
-
- <script setup>
- import { ref, reactive, watch, onMounted, shallowRef } from 'vue';
- import { usePagination, useAdaption, useDicts } from '@/hooks';
- import operate from './operate.vue';
- import { optTextMap } from '@/utils/map';
- import { getProjectPlanningPermissionPage, projectPlanningPermissionDel } from '@/api/project/planPermission';
- import { projectTypeList } from '@/api/project/projectInformationNew';
- const { proxy } = getCurrentInstance();
- const { sponge_land_type, build_status, findText } = useDicts(proxy);
- const { maxHeight, onResize } = useAdaption(proxy, 'table_box');
- const showSearch = ref(true);
- const visible = ref(false);
- const opts = reactive({
- type: '',
- text: '',
- });
- const curRow = shallowRef({});
- const form = reactive({
- projectName: '',
- spongeLandType: '',
- chargeDepartment: '',
- projectTypeId: '',
- buildStatus: '',
- });
-
- const params = computed(() => {
- return JSON.parse(JSON.stringify(form));
- });
-
- const { pageNum, pageSize, tableData, total, loading, getTableList } = usePagination(getProjectPlanningPermissionPage, params);
-
- const projectTypes = ref([]);
-
- const getProjectTypeList = async () => {
- const res = await projectTypeList({ status: '0' });
- if (res?.code !== 200) return;
- projectTypes.value = res?.data || [];
- };
-
- const openDialog = (data, type) => {
- visible.value = true;
- opts.type = type;
- opts.text = optTextMap.get(type);
- curRow.value = data;
- };
-
- const close = () => {
- visible.value = false;
- opts.type = '';
- opts.text = '';
- getTableList();
- };
-
- const search = () => {
- pageNum.value = 1;
- getTableList();
- };
- const resetQuery = () => {
- proxy.$refs.ruleForm.resetFields();
- search();
- };
-
- const batchDel = () => {
- const checkedList = proxy.$refs.multipleTableRef.getSelectionRows();
- if (!checkedList.length) return proxy.$modal.msgError('请选择一条数据!');
- const ids = checkedList.map(item => item.id).join();
- proxy.$modal
- .confirm('是否确认删除?')
- .then(async () => {
- const res = await projectPlanningPermissionDel(ids);
- if (res?.code !== 200) return;
- proxy.$modal.msgSuccess('操作成功!');
- getTableList();
- })
- .catch(() => {});
- };
-
- const del = row => {
- proxy.$modal
- .confirm('是否确认删除?')
- .then(async () => {
- const res = await projectPlanningPermissionDel(row.id);
- if (res?.code !== 200) return;
- proxy.$modal.msgSuccess('操作成功!');
- getTableList();
- })
- .catch(() => {});
- };
-
- const submit = () => {
- proxy.$refs.operateRef.submit();
- };
-
- watch(showSearch, onResize);
-
- onMounted(() => {
- getTableList();
- getProjectTypeList();
- });
- </script>
-
- <style lang="scss" scoped>
- .planPermission {
- padding: 20px;
- height: 90vh;
- display: flex;
- flex-direction: column;
- .top,
- .row {
- flex-shrink: 0;
- }
- .table {
- flex: 1;
- margin-top: 10px;
- :deep(.pagination) {
- margin-top: 0;
- margin-right: 10px;
- .el-pagination {
- right: 20px;
- }
- }
- }
- :deep(.formItem110) {
- .el-form-item__label {
- width: 110px;
- word-break: keep-all;
- white-space: nowrap;
- }
- }
-
- :deep(.formItem140) {
- .el-form-item__label {
- width: 140px;
- word-break: keep-all;
- white-space: nowrap;
- }
- }
- }
- </style>