搜索条件
This commit is contained in:
parent
dafa5b03a0
commit
9d80412e83
|
|
@ -288,7 +288,6 @@
|
|||
v-else-if="item.inputType == 'SELECT'"
|
||||
v-model="form[item.propertyCode]"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
|
|
@ -813,9 +812,11 @@ export default {
|
|||
if (!item.propertyCode) return // 避免空字段
|
||||
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 {
|
||||
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">
|
||||
<el-form
|
||||
:inline="true"
|
||||
label-width="70px"
|
||||
label-width="120px"
|
||||
label-position="right"
|
||||
ref="searchFormRef"
|
||||
:model="searchParams"
|
||||
class="search-form"
|
||||
>
|
||||
<el-form-item prop="pro_name" label="项目名称">
|
||||
<el-input
|
||||
clearable
|
||||
placeholder="请输入项目名称"
|
||||
v-model="searchParams.pro_name"
|
||||
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-row>
|
||||
<el-form-item prop="pro_code" label="项目编号">
|
||||
<el-input
|
||||
clearable
|
||||
placeholder="请输入项目编号"
|
||||
v-model="searchParams.pro_code"
|
||||
style="width: 200px"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item prop="project_status" label="项目状态">
|
||||
<el-select
|
||||
clearable
|
||||
placeholder="选择项目状态"
|
||||
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-form-item>
|
||||
<el-form-item prop="pro_name" label="项目名称">
|
||||
<el-input
|
||||
clearable
|
||||
placeholder="请输入项目名称"
|
||||
v-model="searchParams.pro_name"
|
||||
style="width: 200px"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item prop="voltage" label="电压等级">
|
||||
<el-select
|
||||
clearable
|
||||
placeholder="选择电压等级"
|
||||
v-model="searchParams.voltage"
|
||||
style="width: 180px"
|
||||
>
|
||||
<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>
|
||||
<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-form-item>
|
||||
<el-form-item prop="propertyUnitIds" label="施工单位">
|
||||
<el-cascader
|
||||
clearable
|
||||
v-model="propertyUnitIds"
|
||||
placeholder="请选择施工单位"
|
||||
:options="propertyUnitList"
|
||||
:props="{ label: 'label', value: 'id', children: 'children', checkStrictly: true }"
|
||||
style="width: 200px"
|
||||
@change="handleUnitChange"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item prop="project_source" label="项目来源">
|
||||
<el-select v-model="searchParams.project_source" placeholder="请选择项目来源" clearable
|
||||
style="width: 200px"
|
||||
>
|
||||
<el-option v-for="dict in dict.type.project_source" :key="dict.value" :label="dict.label"
|
||||
:value="dict.label"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item prop="project_type" label="项目类型">
|
||||
<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>
|
||||
</div>
|
||||
|
||||
|
|
@ -301,7 +326,7 @@ import {
|
|||
getProjectTypeList,
|
||||
delProjectBatch // 新增:导入批量删除API
|
||||
} from '@/api/system/project'
|
||||
|
||||
import { deptTreeSelect } from '@/api/system/user'
|
||||
export default {
|
||||
name: 'ProjectManagement',
|
||||
dicts: ['voltage_type', 'project_status', 'project_type', 'project_source'],
|
||||
|
|
@ -312,10 +337,15 @@ export default {
|
|||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
pro_name: '',
|
||||
pro_code: '',
|
||||
project_source: '',
|
||||
|
||||
project_type: '',
|
||||
project_status: '',
|
||||
voltage: ''
|
||||
},
|
||||
propertyUnitIds:[],
|
||||
propertyUnitList: [], // 施工单位
|
||||
// 列表数据
|
||||
projectList: [],
|
||||
total: 0,
|
||||
|
|
@ -353,12 +383,54 @@ export default {
|
|||
}
|
||||
},
|
||||
created() {
|
||||
this.getDeptTreeSelect()
|
||||
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: {
|
||||
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() {
|
||||
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)
|
||||
if (res.code === 200) {
|
||||
this.projectList = res.data.rows || []
|
||||
|
|
@ -485,6 +557,7 @@ export default {
|
|||
// 重置搜索
|
||||
onReset() {
|
||||
this.$refs.searchFormRef.resetFields()
|
||||
this.propertyUnitIds=[]
|
||||
this.searchParams = {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
|
|
|
|||
Loading…
Reference in New Issue