feat 添加省市区管理
This commit is contained in:
parent
b7b3306f22
commit
3cebbb54c7
40
src/api/business/Regions/region.js
Normal file
40
src/api/business/Regions/region.js
Normal file
@ -0,0 +1,40 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
/**
|
||||
* 省市区数据表树形查询列表
|
||||
* @param {查询条件} data
|
||||
*/
|
||||
export function regionTreeList(query) {
|
||||
return request({
|
||||
url: '/business/Region/getRegionTreeList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 省市区数据表新增或修改
|
||||
export function addOrUpdateRegion(data) {
|
||||
return request({
|
||||
url: '/business/Region/addOrUpdateRegion',
|
||||
method: 'post',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
// 省市区数据表删除
|
||||
export function delRegion(ids) {
|
||||
return request({
|
||||
url: '/business/Region/'+ ids,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 省市区数据表导出
|
||||
export function exportRegion(query) {
|
||||
return request({
|
||||
url: 'business/Region/exportRegion',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
@ -1,17 +1,12 @@
|
||||
<template>
|
||||
<el-aside :data-theme="sideTheme" class="sidebar" :class="{ 'has-logo': showLogo }">
|
||||
<logo v-if="showLogo" :collapse="isCollapse" />
|
||||
<el-aside :data-theme="sideTheme" class="sidebar sidebar-bg" :class="{ 'has-logo': showLogo }">
|
||||
<logo v-if="showLogo" class="sidebar-bg" :collapse="isCollapse" />
|
||||
|
||||
<el-scrollbar wrap-class="scrollbar-wrapper">
|
||||
<el-menu
|
||||
:default-active="activeMenu"
|
||||
:collapse="isCollapse"
|
||||
:unique-opened="true"
|
||||
:active-text-color="theme"
|
||||
:collapse-transition="false"
|
||||
background-color="transparent"
|
||||
mode="vertical">
|
||||
<sidebar-item v-for="(route, index) in sidebarRouters" :key="route.path + index" :item="route" :base-path="route.path" />
|
||||
<el-menu :default-active="activeMenu" :collapse="isCollapse" :unique-opened="true" :active-text-color="theme"
|
||||
:collapse-transition="false" background-color="transparent" mode="vertical">
|
||||
<sidebar-item v-for="(route, index) in sidebarRouters" :key="route.path + index" :item="route"
|
||||
:base-path="route.path" />
|
||||
</el-menu>
|
||||
</el-scrollbar>
|
||||
</el-aside>
|
||||
@ -49,3 +44,10 @@ watch(route, (val) => {
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// 菜单背景颜色
|
||||
.sidebar-bg {
|
||||
// background-color: #2b333e !important;
|
||||
}
|
||||
</style>
|
129
src/views/business/Regions/components/AddDialog.vue
Normal file
129
src/views/business/Regions/components/AddDialog.vue
Normal file
@ -0,0 +1,129 @@
|
||||
<template>
|
||||
<el-dialog v-model="props.modelValue" title="添加省市区数据表信息" width="900px" @closed="closeDialog" @open="openDialog">
|
||||
<el-form ref="formRef" :model="formData" :rules="rules">
|
||||
<el-row :gutter="20">
|
||||
|
||||
<el-col :lg="24">
|
||||
<el-form-item :label-width="labelWidth" label="上级菜单" prop="RegionPid">
|
||||
<el-cascader class="w100" :options="dataList"
|
||||
:props="{ checkStrictly: true, value: 'regionId', label: 'regionName', emitPath: false }"
|
||||
placeholder="请选择上级菜单" clearable v-model="formData.regionPid">
|
||||
<template #default="{ node, data }">
|
||||
<span>{{ data.regionName }}</span>
|
||||
<span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
|
||||
</template>
|
||||
</el-cascader>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="区划名称" prop="regionName">
|
||||
<el-input v-model="formData.regionName" placeholder="请输入区划名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="区划编码" prop="regionCode">
|
||||
<el-input v-model="formData.regionCode" placeholder="请输入区划编码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="层级(1省级 2市级 3区/县级)" prop="regionLevel">
|
||||
<el-input v-model="formData.regionLevel" placeholder="请输入层级(1省级 2市级 3区/县级)" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<div key="dialog-footer">
|
||||
<el-button type="primary" @click="handleAddClick(formRef)">添加</el-button>
|
||||
<el-button @click="handleResetClick(formRef)">重置</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import { ElMessage } from 'element-plus'
|
||||
import modal from '@/plugins/modal.js'
|
||||
import { regionTreeList, addOrUpdateRegion } from '@/api/business/Regions/region.js';
|
||||
|
||||
|
||||
// 打开弹窗时回调
|
||||
const openDialog = async () => {
|
||||
|
||||
|
||||
await getTreeList()
|
||||
}
|
||||
|
||||
// -业务参数
|
||||
const dataList = ref([])
|
||||
|
||||
|
||||
// -业务方法
|
||||
|
||||
|
||||
|
||||
// -基础参数
|
||||
const labelWidth = 100;
|
||||
const formRef = ref();
|
||||
const { proxy } = getCurrentInstance()
|
||||
const emits = defineEmits(["update:modelValue"]);
|
||||
const formData = reactive({
|
||||
});
|
||||
const props = defineProps({
|
||||
modelValue: Boolean,
|
||||
done: Function,
|
||||
});
|
||||
const imgData = ref({
|
||||
fileDir: "Region"
|
||||
})
|
||||
|
||||
// 验证
|
||||
const rules = reactive({
|
||||
regionName: [{ required: true, message: "区划名称不能为空", trigger: "blur" }],
|
||||
regionCode: [{ required: true, message: "区划编码不能为空", trigger: "blur" }],
|
||||
regionLevel: [{ required: true, message: "层级(1省级 2市级 3区/县级)不能为空", trigger: "blur", type: "number" }],
|
||||
});
|
||||
|
||||
// -基础方法
|
||||
async function getTreeList() {
|
||||
regionTreeList().then((res) => {
|
||||
if (res.code == 200) {
|
||||
dataList.value = res.data
|
||||
}
|
||||
})
|
||||
}
|
||||
watch(props, async (v) => {
|
||||
|
||||
});
|
||||
|
||||
// 提交
|
||||
const handleAddClick = async (formEl) => {
|
||||
if (!formEl) return;
|
||||
formEl.validate(async (valid) => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const { code } = await addOrUpdateRegion(formData);
|
||||
if (code == 200) {
|
||||
modal.msgSuccess('添加成功')
|
||||
closeDialog();
|
||||
}
|
||||
});
|
||||
};
|
||||
const closeDialog = () => {
|
||||
handleResetClick(formRef.value);
|
||||
props.done();
|
||||
emits("update:modelValue", false);
|
||||
};
|
||||
const handleResetClick = async (formEl) => {
|
||||
if (!formEl) return;
|
||||
formEl.resetFields();
|
||||
};
|
||||
</script>
|
104
src/views/business/Regions/components/DetailDialog.vue
Normal file
104
src/views/business/Regions/components/DetailDialog.vue
Normal file
@ -0,0 +1,104 @@
|
||||
<template>
|
||||
<el-dialog v-model="props.modelValue" title="省市区数据表信息详情" width="900px" @closed="closeDialog" @open="openDialog">
|
||||
<el-form ref="formRef" :model="formData" :disabled="true">
|
||||
|
||||
<el-row :gutter="20">
|
||||
|
||||
<el-col :lg="24">
|
||||
<el-form-item :label-width="labelWidth" label="上级菜单" prop="RegionPid">
|
||||
<el-cascader
|
||||
class="w100"
|
||||
:options="dataList"
|
||||
:props="{ checkStrictly: true, value: 'regionId', label: 'regionName', emitPath: false }"
|
||||
placeholder="请选择上级菜单"
|
||||
clearable
|
||||
v-model="formData.regionPid">
|
||||
<template #default="{ node, data }">
|
||||
<span>{{ data.regionName }}</span>
|
||||
<span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
|
||||
</template>
|
||||
</el-cascader>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="区划名称" >
|
||||
<el-input v-model="formData.regionName" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="区划编码" >
|
||||
<el-input v-model="formData.regionCode" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="层级(1省级 2市级 3区/县级)" >
|
||||
<el-input v-model="formData.regionLevel" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import { regionTreeList } from "@/api/business/Regions/region.js";
|
||||
|
||||
|
||||
// 打开弹窗时回调
|
||||
const openDialog = async () => {
|
||||
|
||||
await getTreeList()
|
||||
}
|
||||
|
||||
const formData = ref({
|
||||
...props.data,
|
||||
});
|
||||
watch(props, async (v) => {
|
||||
formData.value = v.data;
|
||||
});
|
||||
|
||||
// -业务参数
|
||||
const dataList = ref([])
|
||||
|
||||
// -业务方法
|
||||
|
||||
|
||||
|
||||
// 基础参数
|
||||
const formRef = ref();
|
||||
const labelWidth = 100;
|
||||
const { proxy } = getCurrentInstance()
|
||||
const props = defineProps({
|
||||
modelValue: Boolean,
|
||||
data: Object,
|
||||
done: Function,
|
||||
});
|
||||
const emits = defineEmits(["update:modelValue"]);
|
||||
|
||||
|
||||
// -基础方法
|
||||
async function getTreeList() {
|
||||
regionTreeList().then((res) => {
|
||||
if (res.code == 200) {
|
||||
dataList.value = res.data
|
||||
}
|
||||
})
|
||||
}
|
||||
const closeDialog = () => {
|
||||
emits("update:modelValue", false);
|
||||
};
|
||||
|
||||
</script>
|
144
src/views/business/Regions/components/EditDialog.vue
Normal file
144
src/views/business/Regions/components/EditDialog.vue
Normal file
@ -0,0 +1,144 @@
|
||||
<template>
|
||||
<el-dialog v-model="props.modelValue" title="修改省市区数据表信息" width="900px" @closed="closeDialog" @open="openDialog">
|
||||
<el-form ref="formRef" :model="formData" :rules="rules">
|
||||
<el-row :gutter="20">
|
||||
|
||||
<el-col :lg="24">
|
||||
<el-form-item :label-width="labelWidth" label="上级菜单" prop="RegionPid">
|
||||
<el-cascader
|
||||
class="w100"
|
||||
:options="dataList"
|
||||
:props="{ checkStrictly: true, value: 'regionId', label: 'regionName', emitPath: false }"
|
||||
placeholder="请选择上级菜单"
|
||||
clearable
|
||||
v-model="formData.regionPid">
|
||||
<template #default="{ node, data }">
|
||||
<span>{{ data.regionName }}</span>
|
||||
<span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
|
||||
</template>
|
||||
</el-cascader>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="区划名称" prop="regionName">
|
||||
<el-input v-model="formData.regionName" placeholder="请输入区划名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="区划编码" prop="regionCode">
|
||||
<el-input v-model="formData.regionCode" placeholder="请输入区划编码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="12">
|
||||
<el-form-item :label-width="labelWidth" label="层级(1省级 2市级 3区/县级)" prop="regionLevel">
|
||||
<el-input v-model="formData.regionLevel" placeholder="请输入层级(1省级 2市级 3区/县级)" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="handleEditClick(formRef)">编辑</el-button>
|
||||
<el-button @click="handleResetClick(formRef)">重置</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ElMessage } from 'element-plus'
|
||||
import modal from '@/plugins/modal.js'
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import { regionTreeList, addOrUpdateRegion } from "@/api/business/Regions/region.js";
|
||||
|
||||
|
||||
// 打开弹窗时回调
|
||||
const openDialog = async () => {
|
||||
|
||||
await getTreeList()
|
||||
}
|
||||
|
||||
const formData = ref({
|
||||
...props.data,
|
||||
});
|
||||
watch(props, async (v) => {
|
||||
formData.value = v.data;
|
||||
|
||||
});
|
||||
|
||||
// 业务参数
|
||||
const dataList = ref([])
|
||||
|
||||
// -业务方法
|
||||
|
||||
|
||||
|
||||
// -基础参数
|
||||
const props = defineProps({
|
||||
modelValue: Boolean,
|
||||
data: Object,
|
||||
done: Function,
|
||||
});
|
||||
|
||||
const labelWidth = 100;
|
||||
const formRef = ref();
|
||||
const { proxy } = getCurrentInstance()
|
||||
const emits = defineEmits(["update:modelValue"]);
|
||||
const imgData = ref({
|
||||
fileDir: "Region"
|
||||
})
|
||||
|
||||
// 验证
|
||||
const rules = reactive({
|
||||
regionName: [{ required: true, message: "区划名称不能为空", trigger: "blur" }],
|
||||
regionCode: [{ required: true, message: "区划编码不能为空", trigger: "blur" }],
|
||||
regionLevel: [{ required: true, message: "层级(1省级 2市级 3区/县级)不能为空", trigger: "blur", type: "number" }],
|
||||
});
|
||||
|
||||
// -基础方法
|
||||
async function getTreeList() {
|
||||
regionTreeList().then((res) => {
|
||||
if (res.code == 200) {
|
||||
dataList.value = res.data
|
||||
}
|
||||
})
|
||||
}
|
||||
// 提交
|
||||
const handleEditClick = async (formEl) => {
|
||||
if (!formEl) return;
|
||||
formEl.validate(async (valid) => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const { code } = await addOrUpdateRegion(formData.value);
|
||||
if (code == 200) {
|
||||
modal.msgSuccess('修改成功')
|
||||
closeDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const handleResetClick = async (formEl) => {
|
||||
if (!formEl) return;
|
||||
formEl.resetFields();
|
||||
}
|
||||
const closeDialog = () => {
|
||||
props.done();
|
||||
emits("update:modelValue", false);
|
||||
};
|
||||
|
||||
</script>
|
250
src/views/business/Regions/index.vue
Normal file
250
src/views/business/Regions/index.vue
Normal file
@ -0,0 +1,250 @@
|
||||
<!--
|
||||
* @Descripttion: (省市区数据表/tb_region)
|
||||
* @version: (1.0)
|
||||
* @Author: (admin)
|
||||
* @Date: (2023-06-05)
|
||||
* @LastEditors: (admin)
|
||||
* @LastEditTime: (2023-06-05)
|
||||
-->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-row :gutter="24">
|
||||
<!-- 搜索框 queryParams.需要搜索的字段 -->
|
||||
<el-form :model="queryParams" label-position="left" style="margin:15px;" inline ref="queryForm" label-width="68px" v-show="showSearch"
|
||||
@submit.prevent>
|
||||
<el-form-item label="区划名称" prop="regionName">
|
||||
<el-input v-model="queryParams.regionName" placeholder="请输入区划名称" clearable @keyup.enter="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button icon="search" type="primary" @click="handleQuery">{{ $t('btn.search') }}</el-button>
|
||||
<el-button icon="refresh" @click="resetQuery">{{ $t('btn.reset') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
|
||||
<!-- 工具按钮 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="info" plain icon="sort" @click="toggleExpandAll">展开/折叠</el-button>
|
||||
</el-col>
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button type="primary" v-hasPermi="['business:region:addOrUpdateKey']" plain icon="plus" @click="AddDialogVisible = true">
|
||||
{{ $t('btn.add') }}
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" :disabled="multiple" v-hasPermi="['business:region:delete']" plain icon="delete" @click="handleDelete">
|
||||
{{ $t('btn.delete') }}
|
||||
</el-button>
|
||||
</el-col> -->
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="download" @click="handleExport" v-hasPermi="['business:region:export']">
|
||||
{{ $t('btn.export') }}
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<!-- 表格渲染 prop="对应的字段"-->
|
||||
<el-table v-loading="loading" :data="dataList" ref="tableRef" highlight-current-row @selection-change="handleSelectionChange" v-if="refreshTable" :default-expand-all="isExpandAll" row-key="regionId" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
|
||||
<!-- <el-table-column type="selection" width="50" align="center" /> -->
|
||||
|
||||
<el-table-column prop="regionName" label="区划名称" align="left" :show-overflow-tooltip="true" />
|
||||
<el-table-column prop="regionCode" label="区划编码" align="center" :show-overflow-tooltip="true" />
|
||||
<el-table-column prop="regionLevel" label="层级(1省级 2市级 3区/县级)" align="center" />
|
||||
|
||||
<!-- <el-table-column label="操作" width="350" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" size="small" icon="edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['business:region:addOrUpdateKey']">编辑</el-button>
|
||||
<el-button type="danger" size="small" icon="delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['business:region:delete']">删除</el-button>
|
||||
<el-button size="small" icon="view" @click="handleDetail(scope.row)">查看</el-button>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<!-- 添加 -->
|
||||
<AddDialog v-model="AddDialogVisible" :done="() => resetQuery()"></AddDialog>
|
||||
<!-- 编辑 -->
|
||||
<EditDialog v-model="EditDialogVisible" :data="EditDialogRow" :done="() => resetQuery()"></EditDialog>
|
||||
<!-- 详情 -->
|
||||
<DetailDialog v-model="DetailDialogVisible" :data="DetailDialogRow" :done="() => resetQuery()"></DetailDialog>
|
||||
</template>
|
||||
<script setup name="region">
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
import modal from '@/plugins/modal.js'
|
||||
import { exportRegion, regionTreeList , delRegion } from '@/api/business/Regions/region.js'
|
||||
import AddDialog from "./components/AddDialog.vue";
|
||||
import EditDialog from "./components/EditDialog.vue";
|
||||
import DetailDialog from "./components/DetailDialog.vue";
|
||||
|
||||
const AddDialogVisible = ref(false);
|
||||
const EditDialogVisible = ref(false);
|
||||
const EditDialogRow = ref({});
|
||||
const DetailDialogVisible = ref(false);
|
||||
const DetailDialogRow = ref({});
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
// 选中categoryId数组数组
|
||||
const ids = ref([])
|
||||
// 非单选禁用
|
||||
const single = ref(true)
|
||||
// 非多个禁用
|
||||
const multiple = ref(true)
|
||||
// 显示搜索条件
|
||||
const showSearch = ref(true)
|
||||
// 数据列表
|
||||
const dataList = ref([])
|
||||
// 总记录数
|
||||
const total = ref(0)
|
||||
// 是否加载
|
||||
const loading = ref(true)
|
||||
// 是否展开,默认全部折叠
|
||||
const isExpandAll = ref(false)
|
||||
const refreshTable = ref(true)
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
},
|
||||
})
|
||||
const { queryParams } = toRefs(data)
|
||||
|
||||
|
||||
// 业务参数
|
||||
|
||||
|
||||
// 业务方法
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//基础方法
|
||||
|
||||
// 树形搜索
|
||||
function selectChild(str, tag, res, parent) {
|
||||
isExpandAll.value = true
|
||||
for (let item of tag) {
|
||||
if (item.regionName.indexOf(str) !== -1) {
|
||||
if (parent) {
|
||||
res.push(parent)
|
||||
} else {
|
||||
res.push(item)
|
||||
}
|
||||
} else if (item.children && item.children.length) {
|
||||
selectChild(str, item.children, res, parent || item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 查询数据
|
||||
function getList() {
|
||||
loading.value = true
|
||||
regionTreeList(queryParams.value).then((res) => {
|
||||
if (res.code == 200) {
|
||||
loading.value = false
|
||||
|
||||
if (queryParams.value.regionName == undefined) {
|
||||
isExpandAll.value = false
|
||||
dataList.value = res.data
|
||||
} else {
|
||||
dataList.value = []
|
||||
selectChild(queryParams.value.regionName, res.data, dataList.value)
|
||||
}
|
||||
|
||||
total.value = res.data.totalNum
|
||||
}
|
||||
})
|
||||
}
|
||||
// 折叠/展开
|
||||
function toggleExpandAll() {
|
||||
refreshTable.value = false
|
||||
isExpandAll.value = !isExpandAll.value
|
||||
nextTick(() => {
|
||||
refreshTable.value = true
|
||||
})
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map((item) => item.regionId)
|
||||
single.value = selection.length != 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 重置查询操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm('queryForm')
|
||||
handleQuery()
|
||||
}
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
getList()
|
||||
}
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const Ids = row.regionId || ids.value
|
||||
|
||||
ElMessageBox.confirm("是否确认删除?", "系统提示", {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: "warning",
|
||||
})
|
||||
.then(function () {
|
||||
return delRegion(Ids)
|
||||
})
|
||||
.then(() => {
|
||||
handleQuery()
|
||||
modal.msgSuccess("删除成功")
|
||||
})
|
||||
.catch(() => { })
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport(row) {
|
||||
const Ids = row.regionId || ids.value
|
||||
const name = ref("所有")
|
||||
|
||||
if (Ids.length != 0) {
|
||||
let str = ''
|
||||
for (const key in Ids) {
|
||||
str += Ids[key] + ','
|
||||
}
|
||||
str = str.slice(0, str.length - 1)
|
||||
queryParams.value.ids = str
|
||||
name.value = "选中"
|
||||
}
|
||||
|
||||
ElMessageBox.confirm('是否确认导出' + name.value + '数据?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
})
|
||||
.then(function () {
|
||||
return exportRegion(queryParams.value)
|
||||
})
|
||||
.then((response) => {
|
||||
proxy.download(response.data.path)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 修改
|
||||
function handleUpdate(row) {
|
||||
EditDialogVisible.value = true
|
||||
EditDialogRow.value = row
|
||||
}
|
||||
|
||||
// 详情
|
||||
function handleDetail(row) {
|
||||
DetailDialogVisible.value = true
|
||||
DetailDialogRow.value = row
|
||||
}
|
||||
|
||||
handleQuery()
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user