1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-10 12:01:57 +08:00

优化巡检表检索BUG

This commit is contained in:
dengfuchuan 2021-04-11 15:49:40 +08:00
parent 87c919d0e1
commit c02520bf98
6 changed files with 26 additions and 12 deletions

View File

@ -145,6 +145,7 @@ export default {
search() {
let whereValue
let whereSql
console.log(this.wvalue, 'wvalue')
if (this.searchVal) {
if (this.control === 'date') {
if (this.wsql) {
@ -161,7 +162,7 @@ export default {
} else {
if (this.wsql) {
const Value = encodeURI(`\%${this.searchVal}\%`)
const where_sql = `(${this.wsql}=?) and ${Value} >= ?`
const where_sql = `(${this.wsql}) and (${this.where_sql} like ?)`
const whereValue = `${this.wvalue};${Value}`
const where_type = `${this.wtype};${this.where_type}`
whereSql = `where_sql=${where_sql}&where_value=${whereValue}&where_type=${where_type}`
@ -171,9 +172,13 @@ export default {
}
}
} else {
whereSql = `where_sql=&where_value=&where_type=`
if (this.wsql) {
whereSql = `where_sql=${this.wsql}&where_value=${this.wvalue}&where_type=${this.wtype}`
} else {
whereSql = `where_sql=&where_value=&where_type=`
}
}
console.log(whereSql)
console.log(whereSql, '1231')
this.$emit('search', `${whereSql}`)
}
}

View File

@ -1,7 +1,11 @@
import request from '@/utils/request'
export default {
getDate(id, pageSize, pageNo, whereSql) {
getDate(id, pageSize, pageNo, whereSql, isWhereSql) {
console.log(isWhereSql, 'isWhereSql')
if (!isWhereSql) {
whereSql = `where_sql=insp_item.insp_name_id = ?&where_value=${id}&where_type=string`
}
return request({
url: `/commonAction.do?eventcode=query_data&funid=queryevent&pagetype=subeditgrid&query_funid=insp_item&user_id=administrator`,
method: 'post',

View File

@ -5,7 +5,7 @@
<div>
<buttons funid="insp_item" style="margin-bottom:10px" @editCreate="editCreate" @editDelete="editDelete" />
</div>
<Search funid="insp_item" @search="search" />
<Search funid="insp_item" :wsql="where_sql" :wvalue="id" :wtype="where_type" @search="search" />
</div>
<el-table
ref="deptTable"
@ -145,6 +145,9 @@ export default {
treeList: [],
whereSql: '',
whereValue: '',
where_sql: 'insp_item.insp_name_id = ?',
where_value: this.id,
where_type: 'string',
title: ''
}
},
@ -157,7 +160,7 @@ export default {
mounted() {
},
methods: {
getList(id) {
getList(id, isWhereSql) {
this.id = id
this.loading = true
let pageNo = this.pager.pageNo * this.pager.pageSize - this.pager.pageSize
@ -168,7 +171,8 @@ export default {
this.id,
this.pager.pageSize,
pageNo,
this.whereSql
this.whereSql,
isWhereSql
).then(data => {
if (data.success) {
this.data = data.data.root
@ -183,7 +187,7 @@ export default {
},
search(sql) {
this.whereSql = sql
this.getList()
this.getList(this.id, true)
},
editCreate() {
this.title = '新增'

View File

@ -255,7 +255,7 @@ export default {
},
rowClick(row) {
this.id = row.insp_name__insp_name_id
this.$refs.inspItem.getList(this.id)
this.$refs.inspItem.getList(this.id, false)
},
closeDialog() {
this.dialogFormVisible = false

View File

@ -1,11 +1,11 @@
import request from '@/utils/request'
export default {
getDate(id, pageSize, pageNo, isWhereSql, whereValue) {
getDate(id, pageSize, pageNo, whereSql) {
return request({
url: `/commonAction.do?eventcode=query_data&funid=queryevent&pagetype=subeditgrid&query_funid=insp_det&user_id=administrator`,
method: 'post',
data: `start=${pageNo}&limit=${pageSize}&where_sql=insp_det.safe_insp_id = ?&where_value=${id}&where_type=string&is_query=1&query_type=0`
data: `start=${pageNo}&limit=${pageSize}&${whereSql}&is_query=1&query_type=0`
}).then(response => response.data)
},
getDeptTree() {

View File

@ -196,7 +196,7 @@ export default {
treeList: [],
whereSql: '',
whereValue: '',
where_sql: 'insp_item.insp_name_id = ?',
where_sql: 'insp_det.safe_insp_id = ?',
where_value: this.$props.id,
where_type: 'string',
dialogUploadVisible: false
@ -233,6 +233,7 @@ export default {
})
},
search(sql) {
console.log(sql, 'sqlsql ')
this.whereSql = sql
this.getList()
},