1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-12 22:29:59 +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() { search() {
let whereValue let whereValue
let whereSql let whereSql
console.log(this.wvalue, 'wvalue')
if (this.searchVal) { if (this.searchVal) {
if (this.control === 'date') { if (this.control === 'date') {
if (this.wsql) { if (this.wsql) {
@ -161,7 +162,7 @@ export default {
} else { } else {
if (this.wsql) { if (this.wsql) {
const Value = encodeURI(`\%${this.searchVal}\%`) 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 whereValue = `${this.wvalue};${Value}`
const where_type = `${this.wtype};${this.where_type}` const where_type = `${this.wtype};${this.where_type}`
whereSql = `where_sql=${where_sql}&where_value=${whereValue}&where_type=${where_type}` whereSql = `where_sql=${where_sql}&where_value=${whereValue}&where_type=${where_type}`
@ -170,10 +171,14 @@ export default {
whereSql = `where_sql=${this.where_sql} like ?&where_value=${whereValue}&where_type=${this.where_type}` whereSql = `where_sql=${this.where_sql} like ?&where_value=${whereValue}&where_type=${this.where_type}`
} }
} }
} else {
if (this.wsql) {
whereSql = `where_sql=${this.wsql}&where_value=${this.wvalue}&where_type=${this.wtype}`
} else { } else {
whereSql = `where_sql=&where_value=&where_type=` whereSql = `where_sql=&where_value=&where_type=`
} }
console.log(whereSql) }
console.log(whereSql, '1231')
this.$emit('search', `${whereSql}`) this.$emit('search', `${whereSql}`)
} }
} }

View File

@ -1,7 +1,11 @@
import request from '@/utils/request' import request from '@/utils/request'
export default { 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({ return request({
url: `/commonAction.do?eventcode=query_data&funid=queryevent&pagetype=subeditgrid&query_funid=insp_item&user_id=administrator`, url: `/commonAction.do?eventcode=query_data&funid=queryevent&pagetype=subeditgrid&query_funid=insp_item&user_id=administrator`,
method: 'post', method: 'post',

View File

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

View File

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

View File

@ -1,11 +1,11 @@
import request from '@/utils/request' import request from '@/utils/request'
export default { export default {
getDate(id, pageSize, pageNo, isWhereSql, whereValue) { getDate(id, pageSize, pageNo, whereSql) {
return request({ return request({
url: `/commonAction.do?eventcode=query_data&funid=queryevent&pagetype=subeditgrid&query_funid=insp_det&user_id=administrator`, url: `/commonAction.do?eventcode=query_data&funid=queryevent&pagetype=subeditgrid&query_funid=insp_det&user_id=administrator`,
method: 'post', 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) }).then(response => response.data)
}, },
getDeptTree() { getDeptTree() {

View File

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