|
|
@@ -1,63 +1,93 @@
|
|
|
<!-- 搜索表单 -->
|
|
|
<template>
|
|
|
<ele-card :body-style="{ paddingBottom: '8px' }">
|
|
|
- <ProSearch :columns="columns" v-model:form="form" ref="searchRef">
|
|
|
- <el-col :span="6" style="min-width: 160px">
|
|
|
- <el-button style="width: 80px" type="primary" plain @click="search"
|
|
|
- >查询</el-button
|
|
|
- >
|
|
|
- <el-button style="width: 80px" type="info" @click="reset"
|
|
|
- >重置</el-button
|
|
|
- >
|
|
|
- </el-col>
|
|
|
- </ProSearch>
|
|
|
+ <ProSearch
|
|
|
+ :items="formItems"
|
|
|
+ ref="searchRef"
|
|
|
+ @search="search"
|
|
|
+ :initKeys="initKeys"
|
|
|
+ ></ProSearch>
|
|
|
</ele-card>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
import { reactive, ref, defineEmits } from 'vue';
|
|
|
- import { useFormData } from '@/utils/use-form-data';
|
|
|
- import ProSearch from '@/components/CommonPage/ProSearch.vue';
|
|
|
-
|
|
|
+ import ProSearch from '@/components/CommonPage/ProSearch2.vue';
|
|
|
+
|
|
|
+ let { proxy } = getCurrentInstance();
|
|
|
const emit = defineEmits(['search']);
|
|
|
- const columns = reactive([
|
|
|
- { tag: 'el-input', label: '学校名称', prop: 'bookName', span: 4 },
|
|
|
- { tag: 'el-input', label: '省份', prop: 'code', span: 4 },
|
|
|
- {
|
|
|
- tag: 'el-input',
|
|
|
- label: '所在市',
|
|
|
- prop: 'senderAddress',
|
|
|
- span: 4
|
|
|
- },
|
|
|
- { tag: 'el-input', label: '办学层次', prop: 'userName', span: 4 },
|
|
|
- { tag: 'el-input', label: '主管部门', prop: 'userName', span: 4 },
|
|
|
- {
|
|
|
- tag: 'el-select',
|
|
|
- label: '标记',
|
|
|
- prop: 'receivingWarehouse',
|
|
|
- span: 4
|
|
|
- },
|
|
|
- ]);
|
|
|
+ const provinceList = ref([]);
|
|
|
+ const cityList = ref([]);
|
|
|
+ const formItems = computed(() => {
|
|
|
+ return [
|
|
|
+ { type: 'input', label: '学校名称', prop: 'schoolName' },
|
|
|
+ {
|
|
|
+ type: 'select',
|
|
|
+ label: '省份',
|
|
|
+ prop: 'provinceId',
|
|
|
+ options: provinceList.value.map((d) => {
|
|
|
+ return { label: d.district, value: d.id };
|
|
|
+ }),
|
|
|
+ props: {
|
|
|
+ filterable: true,
|
|
|
+ onChange: (val) => {
|
|
|
+ searchRef.value?.setData({ cityId: '' });
|
|
|
+ getProviceList(val).then((res) => {
|
|
|
+ cityList.value = res.data.data;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'select',
|
|
|
+ label: '所在市',
|
|
|
+ prop: 'cityId',
|
|
|
+ options: cityList.value.map((d) => {
|
|
|
+ return { label: d.district, value: d.id };
|
|
|
+ }),
|
|
|
+ props: {
|
|
|
+ filterable: true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'dictSelect',
|
|
|
+ label: '办学层次',
|
|
|
+ prop: 'schoolLevel',
|
|
|
+ props: {
|
|
|
+ code: 'school_level'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ { type: 'input', label: '主管部门', prop: 'departmentName' },
|
|
|
+ {
|
|
|
+ type: 'dictSelect',
|
|
|
+ label: '标记',
|
|
|
+ prop: 'shcoolTag',
|
|
|
+ props: {
|
|
|
+ code: 'school_tag'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ];
|
|
|
+ });
|
|
|
|
|
|
- const initKeys = {};
|
|
|
- for (let i = 0; i < columns.length; i++) {
|
|
|
- initKeys[columns[i].prop] = '';
|
|
|
+ function getProviceList(id = 1) {
|
|
|
+ return proxy.$http.get(`/baseinfo/districtInfo/findInfo/${id}`);
|
|
|
}
|
|
|
+ getProviceList().then((res) => {
|
|
|
+ provinceList.value = res.data.data;
|
|
|
+ });
|
|
|
|
|
|
- /** 表单数据 */
|
|
|
- const [form, resetFields] = useFormData({
|
|
|
- ...initKeys
|
|
|
+ const initKeys = reactive({
|
|
|
+ schoolName: '',
|
|
|
+ provinceId: '',
|
|
|
+ cityId: '',
|
|
|
+ schoolLevel: '',
|
|
|
+ departmentName: '',
|
|
|
+ shcoolTag: ''
|
|
|
});
|
|
|
|
|
|
const searchRef = ref(null);
|
|
|
/** 搜索 */
|
|
|
- const search = () => {
|
|
|
- emit('search', { ...form });
|
|
|
- };
|
|
|
-
|
|
|
- /** 重置 */
|
|
|
- const reset = () => {
|
|
|
- resetFields();
|
|
|
- search();
|
|
|
+ const search = (data) => {
|
|
|
+ emit('search', { ...data });
|
|
|
};
|
|
|
</script>
|