搜索条件
This commit is contained in:
parent
dafa5b03a0
commit
9d80412e83
|
|
@ -288,7 +288,6 @@
|
||||||
v-else-if="item.inputType == 'SELECT'"
|
v-else-if="item.inputType == 'SELECT'"
|
||||||
v-model="form[item.propertyCode]"
|
v-model="form[item.propertyCode]"
|
||||||
clearable
|
clearable
|
||||||
filterable
|
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
|
|
@ -813,9 +812,11 @@ export default {
|
||||||
if (!item.propertyCode) return // 避免空字段
|
if (!item.propertyCode) return // 避免空字段
|
||||||
if (item.inputType == 'SELECT' && item.value) {
|
if (item.inputType == 'SELECT' && item.value) {
|
||||||
// 下拉多选值可能是逗号分隔
|
// 下拉多选值可能是逗号分隔
|
||||||
this.$set(this.form, item.propertyCode, item.propertyValue ? item.propertyValue.split(',') : [])
|
// this.$set(this.form, item.propertyCode, item.propertyValue ? item.propertyValue.split(',') : [])
|
||||||
|
this.$set(this.form, item.propertyCode, item.propertyValue||'')
|
||||||
} else {
|
} else {
|
||||||
this.$set(this.form, item.propertyCode, item.propertyValue ?? '')
|
// this.$set(this.form, item.propertyCode, item.propertyValue ?? '')
|
||||||
|
this.$set(this.form, item.propertyCode, item.propertyValue||'')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,67 +4,92 @@
|
||||||
<div class="search-wrapper">
|
<div class="search-wrapper">
|
||||||
<el-form
|
<el-form
|
||||||
:inline="true"
|
:inline="true"
|
||||||
label-width="70px"
|
label-width="120px"
|
||||||
label-position="right"
|
label-position="right"
|
||||||
ref="searchFormRef"
|
ref="searchFormRef"
|
||||||
:model="searchParams"
|
:model="searchParams"
|
||||||
class="search-form"
|
class="search-form"
|
||||||
>
|
>
|
||||||
<el-form-item prop="pro_name" label="项目名称">
|
<el-row>
|
||||||
<el-input
|
<el-form-item prop="pro_code" label="项目编号">
|
||||||
clearable
|
<el-input
|
||||||
placeholder="请输入项目名称"
|
clearable
|
||||||
v-model="searchParams.pro_name"
|
placeholder="请输入项目编号"
|
||||||
style="width: 200px"
|
v-model="searchParams.pro_code"
|
||||||
/>
|
style="width: 200px"
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item prop="project_type" label="项目类型">
|
|
||||||
<el-select
|
|
||||||
clearable
|
|
||||||
placeholder="选择项目类型"
|
|
||||||
v-model="searchParams.project_type"
|
|
||||||
style="width: 180px"
|
|
||||||
>
|
|
||||||
<el-option v-for="dict in dict.type.project_type" :key="dict.value" :label="dict.label"
|
|
||||||
:value="dict.label"
|
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-form-item>
|
||||||
</el-form-item>
|
<el-form-item prop="pro_name" label="项目名称">
|
||||||
|
<el-input
|
||||||
<el-form-item prop="project_status" label="项目状态">
|
clearable
|
||||||
<el-select
|
placeholder="请输入项目名称"
|
||||||
clearable
|
v-model="searchParams.pro_name"
|
||||||
placeholder="选择项目状态"
|
style="width: 200px"
|
||||||
v-model="searchParams.project_status"
|
|
||||||
style="width: 180px"
|
|
||||||
>
|
|
||||||
<el-option v-for="dict in dict.type.project_status" :key="dict.value" :label="dict.label"
|
|
||||||
:value="dict.label"
|
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-form-item>
|
||||||
</el-form-item>
|
<el-form-item prop="propertyUnitIds" label="施工单位">
|
||||||
|
<el-cascader
|
||||||
<el-form-item prop="voltage" label="电压等级">
|
clearable
|
||||||
<el-select
|
v-model="propertyUnitIds"
|
||||||
clearable
|
placeholder="请选择施工单位"
|
||||||
placeholder="选择电压等级"
|
:options="propertyUnitList"
|
||||||
v-model="searchParams.voltage"
|
:props="{ label: 'label', value: 'id', children: 'children', checkStrictly: true }"
|
||||||
style="width: 180px"
|
style="width: 200px"
|
||||||
>
|
@change="handleUnitChange"
|
||||||
<el-option v-for="dict in dict.type.voltage_type" :key="dict.value" :label="dict.label"
|
/>
|
||||||
:value="dict.label"
|
</el-form-item>
|
||||||
/>
|
<el-form-item prop="project_source" label="项目来源">
|
||||||
</el-select>
|
<el-select v-model="searchParams.project_source" placeholder="请选择项目来源" clearable
|
||||||
</el-form-item>
|
style="width: 200px"
|
||||||
|
>
|
||||||
<el-form-item>
|
<el-option v-for="dict in dict.type.project_source" :key="dict.value" :label="dict.label"
|
||||||
<el-button @click="onReset" icon="el-icon-refresh" style="margin-left: 8px">重置</el-button>
|
:value="dict.label"
|
||||||
<el-button @click="getProjectListData" icon="el-icon-search" type="primary">
|
/>
|
||||||
查询
|
</el-select>
|
||||||
</el-button>
|
</el-form-item>
|
||||||
|
<el-form-item prop="project_type" label="项目类型">
|
||||||
</el-form-item>
|
<el-select
|
||||||
|
clearable
|
||||||
|
placeholder="选择项目类型"
|
||||||
|
v-model="searchParams.project_type"
|
||||||
|
style="width: 200px"
|
||||||
|
>
|
||||||
|
<el-option v-for="dict in dict.type.project_type" :key="dict.value" :label="dict.label"
|
||||||
|
:value="dict.label"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item prop="project_status" label="项目状态">
|
||||||
|
<el-select
|
||||||
|
clearable
|
||||||
|
placeholder="选择项目状态"
|
||||||
|
v-model="searchParams.project_status"
|
||||||
|
style="width: 200px"
|
||||||
|
>
|
||||||
|
<el-option v-for="dict in dict.type.project_status" :key="dict.value" :label="dict.label"
|
||||||
|
:value="dict.label"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item prop="voltage" label="电压等级">
|
||||||
|
<el-select
|
||||||
|
clearable
|
||||||
|
placeholder="选择电压等级"
|
||||||
|
v-model="searchParams.voltage"
|
||||||
|
style="width: 200px"
|
||||||
|
>
|
||||||
|
<el-option v-for="dict in dict.type.voltage_type" :key="dict.value" :label="dict.label"
|
||||||
|
:value="dict.label"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item style="float: right">
|
||||||
|
<el-button @click="onReset" icon="el-icon-refresh" style="margin-left: 8px">重置</el-button>
|
||||||
|
<el-button @click="getProjectListData" icon="el-icon-search" type="primary">
|
||||||
|
查询
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -301,7 +326,7 @@ import {
|
||||||
getProjectTypeList,
|
getProjectTypeList,
|
||||||
delProjectBatch // 新增:导入批量删除API
|
delProjectBatch // 新增:导入批量删除API
|
||||||
} from '@/api/system/project'
|
} from '@/api/system/project'
|
||||||
|
import { deptTreeSelect } from '@/api/system/user'
|
||||||
export default {
|
export default {
|
||||||
name: 'ProjectManagement',
|
name: 'ProjectManagement',
|
||||||
dicts: ['voltage_type', 'project_status', 'project_type', 'project_source'],
|
dicts: ['voltage_type', 'project_status', 'project_type', 'project_source'],
|
||||||
|
|
@ -312,10 +337,15 @@ export default {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
pro_name: '',
|
pro_name: '',
|
||||||
|
pro_code: '',
|
||||||
|
project_source: '',
|
||||||
|
|
||||||
project_type: '',
|
project_type: '',
|
||||||
project_status: '',
|
project_status: '',
|
||||||
voltage: ''
|
voltage: ''
|
||||||
},
|
},
|
||||||
|
propertyUnitIds:[],
|
||||||
|
propertyUnitList: [], // 施工单位
|
||||||
// 列表数据
|
// 列表数据
|
||||||
projectList: [],
|
projectList: [],
|
||||||
total: 0,
|
total: 0,
|
||||||
|
|
@ -353,12 +383,54 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
this.getDeptTreeSelect()
|
||||||
this.getProjectListData()
|
this.getProjectListData()
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
hasChildrenPropertyUnit() {
|
||||||
|
const check = (list = []) => {
|
||||||
|
return list.some(item => {
|
||||||
|
return (
|
||||||
|
Array.isArray(item.children) &&
|
||||||
|
item.children.length > 0
|
||||||
|
) || check(item.children)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return check(this.propertyUnitList)
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
handleUnitChange(value) {
|
||||||
|
if (value.length === 0) {
|
||||||
|
this.queryParams.propertyUnitId = undefined
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.queryParams.propertyUnitId = value[value.length - 1]
|
||||||
|
},
|
||||||
|
// 获取产权单位
|
||||||
|
async getDeptTreeSelect() {
|
||||||
|
const res = await deptTreeSelect()
|
||||||
|
this.propertyUnitList = this.filterTree(res.data)
|
||||||
|
console.log('🚀 ~ this.propertyUnitList:', this.propertyUnitList)
|
||||||
|
},
|
||||||
|
filterTree(nodes) {
|
||||||
|
return nodes
|
||||||
|
.map((node) => {
|
||||||
|
if (node.children) {
|
||||||
|
node.children = this.filterTree(node.children)
|
||||||
|
}
|
||||||
|
return node
|
||||||
|
})
|
||||||
|
.filter((node) => node.status !== '1')
|
||||||
|
},
|
||||||
// 获取列表数据
|
// 获取列表数据
|
||||||
async getProjectListData() {
|
async getProjectListData() {
|
||||||
try {
|
try {
|
||||||
|
if(this.propertyUnitIds&&this.propertyUnitIds.length>0){
|
||||||
|
this.searchParams.org_id = this.propertyUnitIds[this.propertyUnitIds.length-1]
|
||||||
|
}else{
|
||||||
|
this.searchParams.org_id = null
|
||||||
|
}
|
||||||
const res = await listProject(this.searchParams)
|
const res = await listProject(this.searchParams)
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
this.projectList = res.data.rows || []
|
this.projectList = res.data.rows || []
|
||||||
|
|
@ -485,6 +557,7 @@ export default {
|
||||||
// 重置搜索
|
// 重置搜索
|
||||||
onReset() {
|
onReset() {
|
||||||
this.$refs.searchFormRef.resetFields()
|
this.$refs.searchFormRef.resetFields()
|
||||||
|
this.propertyUnitIds=[]
|
||||||
this.searchParams = {
|
this.searchParams = {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue