Newer
Older
KaiFengPC / src / views / project / processControl / planPermission / index.vue
@鲁yixuan 鲁yixuan on 21 Aug 9 KB updata
  1. <template>
  2. <div class="planPermission">
  3. <div class="top">
  4. <el-form ref="ruleForm" :model="form" v-show="showSearch">
  5. <el-row :gutter="20">
  6. <el-col :span="6">
  7. <el-form-item label="项目名称:" prop="projectName">
  8. <el-input v-model="form.projectName" placeholder="请输入项目名称" style="width: 100%"></el-input>
  9. </el-form-item>
  10. </el-col>
  11. <el-col :span="6">
  12. <el-form-item label="用地类型:" prop="spongeLandType">
  13. <el-select v-model="form.spongeLandType" placeholder="请选择用地类型" style="width: 100%">
  14. <el-option label="全部" value=""></el-option>
  15. <el-option v-for="dict in sponge_land_type" :key="dict.value" :label="dict.label" :value="dict.value" />
  16. </el-select>
  17. </el-form-item>
  18. </el-col>
  19. <el-col :span="6">
  20. <el-form-item label="建设单位:" prop="chargeDepartment">
  21. <el-input v-model="form.chargeDepartment" placeholder="请输入建设单位" style="width: 100%"></el-input>
  22. </el-form-item>
  23. </el-col>
  24. </el-row>
  25. <el-row :gutter="20">
  26. <el-col :span="6">
  27. <el-form-item label="项目类型:" prop="projectTypeId">
  28. <el-select v-model="form.projectTypeId" placeholder="请选择项目类型" style="width: 100%">
  29. <el-option label="全部" value="" />
  30. <el-option v-for="dict in projectTypes" :key="dict.id" :label="dict.projectTypeName" :value="dict.id" />
  31. </el-select>
  32. </el-form-item>
  33. </el-col>
  34. <el-col :span="6">
  35. <el-form-item label="建设状态:" prop="buildStatus">
  36. <el-select v-model="form.buildStatus" placeholder="请选择建设状态" style="width: 100%">
  37. <el-option label="全部" value=""></el-option>
  38. <el-option v-for="dict in build_status" :key="dict.value" :label="dict.label" :value="dict.value" />
  39. </el-select>
  40. </el-form-item>
  41. </el-col>
  42. <el-col :span="6">
  43. <el-form-item>
  44. <el-button type="primary" icon="Search" @click="search"> 搜索</el-button>
  45. <el-button icon="Refresh" @click="resetQuery">重置</el-button>
  46. </el-form-item>
  47. </el-col>
  48. </el-row>
  49. </el-form>
  50. </div>
  51. <el-row class="row">
  52. <el-button type="primary" plain icon="Plus" @click="openDialog({}, 'add')">新增规划许可</el-button>
  53. <el-button type="danger" plain icon="Delete" @click="batchDel">批量删除</el-button>
  54. <right-toolbar v-model:showSearch="showSearch" @queryTable="resetQuery"></right-toolbar>
  55. </el-row>
  56. <div class="table" ref="table_box">
  57. <el-table :data="tableData" v-loading="loading" stripe :max-height="maxHeight" ref="multipleTableRef">
  58. <el-table-column type="selection" width="55" />
  59. <el-table-column label="项目编码" prop="projectNo" show-overflow-tooltip />
  60. <el-table-column label="项目类型" prop="projectTypeId" show-overflow-tooltip>
  61. <template #default="{ row }">
  62. <span>{{ projectTypes.find(item => item.id === row.projectTypeId)?.projectTypeName || '' }}</span>
  63. </template>
  64. </el-table-column>
  65. <el-table-column label="项目名称" prop="projectName" show-overflow-tooltip>
  66. <template #default="{ row }">
  67. <span>{{ row.projectName }}</span>
  68. </template>
  69. </el-table-column>
  70. <el-table-column label="项目面积" prop="projectArea" show-overflow-tooltip>
  71. <template #default="{ row }">
  72. <span>{{ row.projectArea + 'm²' }}</span>
  73. </template>
  74. </el-table-column>
  75. <el-table-column label="用地类型" prop="spongeLandType" show-overflow-tooltip>
  76. <template #default="{ row }">
  77. <span>{{ findText('sponge_land_type', row.spongeLandType) }}</span>
  78. </template>
  79. </el-table-column>
  80. <el-table-column label="绿地率%" prop="greenRate" show-overflow-tooltip />
  81. <el-table-column label="建设单位" prop="chargeDepartment" show-overflow-tooltip />
  82. <el-table-column label="年径流总量控制率%" prop="annualRunoffTotalControlRate" show-overflow-tooltip />
  83. <el-table-column label="年径流污染去除率%" prop="annualRunoffPollutionControlRate" show-overflow-tooltip />
  84. <el-table-column label="硬化地面率%" prop="hardGroundRate" show-overflow-tooltip />
  85. <el-table-column label="建设状态" prop="buildStatus" show-overflow-tooltip>
  86. <template #default="{ row }">
  87. <span>{{ findText('build_status', row.buildStatus) }}</span>
  88. </template>
  89. </el-table-column>
  90. <el-table-column label="操作" show-overflow-tooltip width="240">
  91. <template #default="{ row }">
  92. <el-button icon="View" type="primary" link @click="openDialog(row, 'view')">详情</el-button>
  93. <el-button type="warning" icon="Edit" link @click="openDialog(row, 'edit')">修改</el-button>
  94.  
  95. <el-button type="danger" icon="Delete" link @click="del(row)">删除</el-button>
  96. </template>
  97. </el-table-column>
  98. </el-table>
  99. <pagination class="pagination" :total="total" v-model:page="pageNum" v-model:limit="pageSize" @pagination="getTableList" />
  100. </div>
  101. <el-dialog
  102. v-model="visible"
  103. :title="`${opts.text}规划许可`"
  104. :close-on-click-modal="false"
  105. width="70%"
  106. :before-close="close"
  107. class="dialog"
  108. >
  109. <operate ref="operateRef" :cur-row="curRow" :opts="opts" :types="projectTypes" @close="close" v-if="visible" />
  110. <template #footer v-if="opts.type !== 'view'">
  111. <div class="dialog-footer">
  112. <el-button type="primary" @click="submit">确 定</el-button>
  113. <el-button @click="close">取 消</el-button>
  114. </div>
  115. </template>
  116. </el-dialog>
  117. </div>
  118. </template>
  119.  
  120. <script setup>
  121. import { ref, reactive, watch, onMounted, shallowRef } from 'vue';
  122. import { usePagination, useAdaption, useDicts } from '@/hooks';
  123. import operate from './operate.vue';
  124. import { optTextMap } from '@/utils/map';
  125. import { getProjectPlanningPermissionPage, projectPlanningPermissionDel } from '@/api/project/planPermission';
  126. import { projectTypeList } from '@/api/project/projectInformationNew';
  127. const { proxy } = getCurrentInstance();
  128. const { sponge_land_type, build_status, findText } = useDicts(proxy);
  129. const { maxHeight, onResize } = useAdaption(proxy, 'table_box');
  130. const showSearch = ref(true);
  131. const visible = ref(false);
  132. const opts = reactive({
  133. type: '',
  134. text: '',
  135. });
  136. const curRow = shallowRef({});
  137. const form = reactive({
  138. projectName: '',
  139. spongeLandType: '',
  140. chargeDepartment: '',
  141. projectTypeId: '',
  142. buildStatus: '',
  143. });
  144.  
  145. const params = computed(() => {
  146. return JSON.parse(JSON.stringify(form));
  147. });
  148.  
  149. const { pageNum, pageSize, tableData, total, loading, getTableList } = usePagination(getProjectPlanningPermissionPage, params);
  150.  
  151. const projectTypes = ref([]);
  152.  
  153. const getProjectTypeList = async () => {
  154. const res = await projectTypeList({ status: '0' });
  155. if (res?.code !== 200) return;
  156. projectTypes.value = res?.data || [];
  157. };
  158.  
  159. const openDialog = (data, type) => {
  160. visible.value = true;
  161. opts.type = type;
  162. opts.text = optTextMap.get(type);
  163. curRow.value = data;
  164. };
  165.  
  166. const close = () => {
  167. visible.value = false;
  168. opts.type = '';
  169. opts.text = '';
  170. getTableList();
  171. };
  172.  
  173. const search = () => {
  174. pageNum.value = 1;
  175. getTableList();
  176. };
  177. const resetQuery = () => {
  178. proxy.$refs.ruleForm.resetFields();
  179. search();
  180. };
  181.  
  182. const batchDel = () => {
  183. const checkedList = proxy.$refs.multipleTableRef.getSelectionRows();
  184. if (!checkedList.length) return proxy.$modal.msgError('请选择一条数据!');
  185. const ids = checkedList.map(item => item.id).join();
  186. proxy.$modal
  187. .confirm('是否确认删除?')
  188. .then(async () => {
  189. const res = await projectPlanningPermissionDel(ids);
  190. if (res?.code !== 200) return;
  191. proxy.$modal.msgSuccess('操作成功!');
  192. getTableList();
  193. })
  194. .catch(() => {});
  195. };
  196.  
  197. const del = row => {
  198. proxy.$modal
  199. .confirm('是否确认删除?')
  200. .then(async () => {
  201. const res = await projectPlanningPermissionDel(row.id);
  202. if (res?.code !== 200) return;
  203. proxy.$modal.msgSuccess('操作成功!');
  204. getTableList();
  205. })
  206. .catch(() => {});
  207. };
  208.  
  209. const submit = () => {
  210. proxy.$refs.operateRef.submit();
  211. };
  212.  
  213. watch(showSearch, onResize);
  214.  
  215. onMounted(() => {
  216. getTableList();
  217. getProjectTypeList();
  218. });
  219. </script>
  220.  
  221. <style lang="scss" scoped>
  222. .planPermission {
  223. padding: 20px;
  224. height: 90vh;
  225. display: flex;
  226. flex-direction: column;
  227. .top,
  228. .row {
  229. flex-shrink: 0;
  230. }
  231. .table {
  232. flex: 1;
  233. margin-top: 10px;
  234. :deep(.pagination) {
  235. margin-top: 0;
  236. margin-right: 10px;
  237. .el-pagination {
  238. right: 20px;
  239. }
  240. }
  241. }
  242. :deep(.formItem110) {
  243. .el-form-item__label {
  244. width: 110px;
  245. word-break: keep-all;
  246. white-space: nowrap;
  247. }
  248. }
  249.  
  250. :deep(.formItem140) {
  251. .el-form-item__label {
  252. width: 140px;
  253. word-break: keep-all;
  254. white-space: nowrap;
  255. }
  256. }
  257. }
  258. </style>