mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-10 20:39:48 +08:00
优化系统功能
This commit is contained in:
parent
78da30869b
commit
87c919d0e1
@ -9,7 +9,7 @@
|
||||
:value="item.fun_col__col_code"
|
||||
/>
|
||||
</el-select>
|
||||
<div v-if="control === 'text' || control === 'selectwin'">
|
||||
<div v-if="control === 'text' || control === 'selectwin' || control === 'combowin'">
|
||||
<el-input v-model="searchVal" clearable placeholder="请输入内容" @keyup.enter.native="search" />
|
||||
</div>
|
||||
<div v-else-if="control === 'date'" class="combo-select">
|
||||
@ -58,6 +58,18 @@ export default {
|
||||
funid: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
wsql: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
wvalue: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
wtype: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@ -85,7 +97,10 @@ export default {
|
||||
getFunCol() {
|
||||
api.getFunCol(this.funid).then(data => {
|
||||
if (data.success) {
|
||||
this.fun = data.data.root
|
||||
this.fun = data.data.root.filter(d => {
|
||||
return d.fun_col__col_index !== '10000'
|
||||
})
|
||||
console.log(this.fun, 'this.fun')
|
||||
this.funCode = this.fun[0].fun_col__col_code
|
||||
this.where_sql = `${this.fun[0].fun_col__col_code}`
|
||||
this.where_type = this.fun[0].fun_col__data_type
|
||||
@ -122,7 +137,6 @@ export default {
|
||||
api.getSelect(this.control_name).then(data => {
|
||||
if (data.success) {
|
||||
this.combo = data.data.root
|
||||
console.log(this.combo, 'this.combo')
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
@ -133,13 +147,28 @@ export default {
|
||||
let whereSql
|
||||
if (this.searchVal) {
|
||||
if (this.control === 'date') {
|
||||
const where_sql = `${this.where_sql} >= ?`
|
||||
const whereValue = `${this.searchVal}`
|
||||
const where_type = `date`
|
||||
whereSql = `where_sql=${where_sql}&where_value=${whereValue}&where_type=${where_type}`
|
||||
if (this.wsql) {
|
||||
const where_sql = `(${this.wsql}=?) and ${this.where_sql} >= ?`
|
||||
const whereValue = `${this.wvalue};${this.searchVal}`
|
||||
const where_type = `${this.wtype};date`
|
||||
whereSql = `where_sql=${where_sql}&where_value=${whereValue}&where_type=${where_type}`
|
||||
} else {
|
||||
const where_sql = `${this.where_sql} >= ?`
|
||||
const whereValue = `${this.searchVal}`
|
||||
const where_type = `date`
|
||||
whereSql = `where_sql=${where_sql}&where_value=${whereValue}&where_type=${where_type}`
|
||||
}
|
||||
} else {
|
||||
whereValue = encodeURI(`\%${this.searchVal}\%`)
|
||||
whereSql = `where_sql=${this.where_sql} like ?&where_value=${whereValue}&where_type=${this.where_type}`
|
||||
if (this.wsql) {
|
||||
const Value = encodeURI(`\%${this.searchVal}\%`)
|
||||
const where_sql = `(${this.wsql}=?) and ${Value} >= ?`
|
||||
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}`
|
||||
} else {
|
||||
whereValue = encodeURI(`\%${this.searchVal}\%`)
|
||||
whereSql = `where_sql=${this.where_sql} like ?&where_value=${whereValue}&where_type=${this.where_type}`
|
||||
}
|
||||
}
|
||||
} else {
|
||||
whereSql = `where_sql=&where_value=&where_type=`
|
||||
|
@ -19,6 +19,7 @@
|
||||
@selection-change="handleSelectionChange"
|
||||
@cell-dblclick="cellDblclick"
|
||||
>
|
||||
<el-table-column type="index" fixed="left" width="35px" />
|
||||
<template v-for="(d,i) in tableHeader">
|
||||
<el-table-column v-if="d.type && d.type === 'selection'" :key="i" :type="d.type" :fixed="d.fixed" />
|
||||
<el-table-column
|
||||
@ -34,7 +35,7 @@
|
||||
<template slot-scope="scope">
|
||||
<div v-if="d.label === '操作'">
|
||||
<el-button icon="el-icon-view" type="text" title="编辑" @click="edit(scope.row)" />
|
||||
<el-button v-if="scope.row.status !== 'NULLIFY'" icon="el-icon-delete" style="color:#F56C6C" type="text" title="删除" @click="Delete(scope.row)" />
|
||||
<!-- <el-button v-if="scope.row.status !== 'NULLIFY'" icon="el-icon-delete" style="color:#F56C6C" type="text" title="删除" @click="Delete(scope.row)" /> -->
|
||||
</div>
|
||||
<div v-else>{{ scope.row[d.prop] }}</div>
|
||||
</template>
|
||||
|
@ -108,13 +108,13 @@
|
||||
v-if="inspNameVisible"
|
||||
title="选择巡检名称"
|
||||
:visible.sync="inspNameVisible"
|
||||
width="60%"
|
||||
width="40%"
|
||||
>
|
||||
<InspName @updateInspName="updateInspName" />
|
||||
<span>
|
||||
<el-button @click="inspNameVisible = false">取 消</el-button>
|
||||
<!-- <span>
|
||||
<el-button type="primary" @click="inspNameVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="inspNameVisible = false">确 定</el-button>
|
||||
</span>
|
||||
</span> -->
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -108,13 +108,13 @@
|
||||
v-if="inspNameVisible"
|
||||
title="选择巡检名称"
|
||||
:visible.sync="inspNameVisible"
|
||||
width="60%"
|
||||
width="40%"
|
||||
>
|
||||
<InspName @updateInspName="updateInspName" />
|
||||
<span>
|
||||
<!-- <div>
|
||||
<el-button @click="inspNameVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="inspNameVisible = false">确 定</el-button>
|
||||
</span>
|
||||
<el-button type="primary" @click="inspNameVisible = false">取 消</el-button>
|
||||
</div> -->
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -1,131 +1,135 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card>
|
||||
<el-table
|
||||
ref="deptTable"
|
||||
v-loading="loading"
|
||||
:data="data"
|
||||
style="width: 100%"
|
||||
@cell-dblclick="cellDblclick"
|
||||
>
|
||||
<template v-for="(d,i) in tableHeader">
|
||||
<el-table-column v-if="d.type && d.type === 'selection'" :key="i" :type="d.type" :fixed="d.fixed" />
|
||||
<el-table-column
|
||||
v-else
|
||||
:key="i"
|
||||
:prop="d.prop"
|
||||
:label="d.label"
|
||||
/>
|
||||
</template>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
:current-page="pager.pageNo"
|
||||
:page-sizes="[10, 30, 50, 100, 500]"
|
||||
:page-size="pager.pageSize"
|
||||
:total="pager.total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@size-change="sizeChange"
|
||||
@current-change="pageChange"
|
||||
/>
|
||||
</el-card>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import api from './api'
|
||||
export default {
|
||||
name: 'SafeIdsp',
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
data: [],
|
||||
ids: [],
|
||||
pager: {
|
||||
pageNo: 0,
|
||||
pageSize: 10,
|
||||
total: 0
|
||||
},
|
||||
tableHeader: [
|
||||
{
|
||||
prop: 'insp_name__insp_name',
|
||||
label: '巡检表名称'
|
||||
}],
|
||||
id: '',
|
||||
dialogFormVisible: false,
|
||||
dialogEditVisible: false,
|
||||
formLabelWidth: '120px',
|
||||
whereSql: false,
|
||||
whereValue: ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
this.loading = true
|
||||
let pageNo = this.pager.pageNo * this.pager.pageSize - this.pager.pageSize
|
||||
if (pageNo < 0) {
|
||||
pageNo = 0
|
||||
}
|
||||
api.getDate(
|
||||
this.pager.pageSize,
|
||||
pageNo,
|
||||
this.whereSql,
|
||||
this.whereValue
|
||||
).then(data => {
|
||||
if (data.success) {
|
||||
this.data = data.data.root
|
||||
this.pager.total = data.data.total
|
||||
setTimeout(() => {
|
||||
this.loading = false
|
||||
}, 200)
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
editCreate() {
|
||||
this.title = '新增'
|
||||
this.dialogFormVisible = true
|
||||
this.form = JSON.parse(JSON.stringify(this.initForm))
|
||||
},
|
||||
create() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
const data = `funid=insp_name&keyid=${this.form.insp_name__insp_name_id}&pagetype=editgrid&eventcode=save_eg&insp_name__insp_name=${this.form.insp_name__insp_name}&insp_name__insp_name_id=${this.form.insp_name__insp_name_id}&insp_name__org_id=&insp_name__dept_id=&user_id=administrator&dataType=json`
|
||||
api.Crerte(data).then(data => {
|
||||
if (data.success) {
|
||||
this.getList()
|
||||
this.dialogFormVisible = false
|
||||
this.$refs['form'].resetFields()
|
||||
this.$message.success('保存成功!')
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
cellDblclick(row) {
|
||||
this.$emit('updateInspName', row)
|
||||
},
|
||||
sizeChange(size) {
|
||||
this.pager.pageSize = size
|
||||
this.getList()
|
||||
},
|
||||
pageChange(page) {
|
||||
this.pager.pageNo = page
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.el-card {
|
||||
margin-top: 10px;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div>
|
||||
<el-card>
|
||||
<el-table
|
||||
ref="deptTable"
|
||||
v-loading="loading"
|
||||
:data="data"
|
||||
style="width: 100%"
|
||||
@cell-dblclick="cellDblclick"
|
||||
>
|
||||
<el-table-column type="index" width="35px" />
|
||||
<template v-for="(d,i) in tableHeader">
|
||||
<el-table-column v-if="d.type && d.type === 'selection'" :key="i" :type="d.type" :fixed="d.fixed" />
|
||||
<el-table-column
|
||||
v-else
|
||||
:key="i"
|
||||
:prop="d.prop"
|
||||
:label="d.label"
|
||||
/>
|
||||
</template>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
:current-page="pager.pageNo"
|
||||
:page-sizes="[10, 30, 50, 100, 500]"
|
||||
:page-size="pager.pageSize"
|
||||
:total="pager.total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@size-change="sizeChange"
|
||||
@current-change="pageChange"
|
||||
/>
|
||||
</el-card>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import api from './api'
|
||||
export default {
|
||||
name: 'SafeIdsp',
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
data: [],
|
||||
ids: [],
|
||||
pager: {
|
||||
pageNo: 0,
|
||||
pageSize: 10,
|
||||
total: 0
|
||||
},
|
||||
tableHeader: [
|
||||
{
|
||||
prop: 'insp_name__insp_name',
|
||||
label: '巡检表名称'
|
||||
}],
|
||||
id: '',
|
||||
dialogFormVisible: false,
|
||||
dialogEditVisible: false,
|
||||
formLabelWidth: '120px',
|
||||
whereSql: false,
|
||||
whereValue: ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
this.loading = true
|
||||
let pageNo = this.pager.pageNo * this.pager.pageSize - this.pager.pageSize
|
||||
if (pageNo < 0) {
|
||||
pageNo = 0
|
||||
}
|
||||
api.getDate(
|
||||
this.pager.pageSize,
|
||||
pageNo,
|
||||
this.whereSql,
|
||||
this.whereValue
|
||||
).then(data => {
|
||||
if (data.success) {
|
||||
this.data = data.data.root
|
||||
this.pager.total = data.data.total
|
||||
setTimeout(() => {
|
||||
this.loading = false
|
||||
}, 200)
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
editCreate() {
|
||||
this.title = '新增'
|
||||
this.dialogFormVisible = true
|
||||
this.form = JSON.parse(JSON.stringify(this.initForm))
|
||||
},
|
||||
create() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
const data = `funid=insp_name&keyid=${this.form.insp_name__insp_name_id}&pagetype=editgrid&eventcode=save_eg&insp_name__insp_name=${this.form.insp_name__insp_name}&insp_name__insp_name_id=${this.form.insp_name__insp_name_id}&insp_name__org_id=&insp_name__dept_id=&user_id=administrator&dataType=json`
|
||||
api.Crerte(data).then(data => {
|
||||
if (data.success) {
|
||||
this.getList()
|
||||
this.dialogFormVisible = false
|
||||
this.$refs['form'].resetFields()
|
||||
this.$message.success('保存成功!')
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
cellDblclick(row) {
|
||||
this.$emit('updateInspName', row)
|
||||
},
|
||||
sizeChange(size) {
|
||||
this.pager.pageSize = size
|
||||
this.getList()
|
||||
},
|
||||
pageChange(page) {
|
||||
this.pager.pageNo = page
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.el-card {
|
||||
margin-top: 10px;
|
||||
}
|
||||
::v-deep .el-table .cell {
|
||||
line-height: 33px;
|
||||
}
|
||||
</style>
|
||||
|
@ -1,11 +1,11 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export default {
|
||||
getDate(id, pageSize, pageNo, whereSql) {
|
||||
getDate(id, pageSize, pageNo, isWhereSql, whereValue) {
|
||||
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}&${whereSql}&is_query=1&query_type=0`
|
||||
data: `start=${pageNo}&limit=${pageSize}&where_sql=insp_det.safe_insp_id = ?&where_value=${id}&where_type=string&is_query=1&query_type=0`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
getDeptTree() {
|
||||
|
@ -5,7 +5,7 @@
|
||||
<div>
|
||||
<buttons funid="insp_det" style="margin-bottom:10px" @Create="editCreate" @Del="editDelete" @upload="upload" />
|
||||
</div>
|
||||
<Search funid="insp_det" @search="search" />
|
||||
<Search funid="insp_det" :wsql="where_sql" :wvalue="where_value" :wtype="where_type" @search="search" />
|
||||
</div>
|
||||
<el-table
|
||||
ref="deptTable"
|
||||
@ -15,6 +15,7 @@
|
||||
@selection-change="handleSelectionChange"
|
||||
@cell-dblclick="cellDblclick"
|
||||
>
|
||||
<el-table-column type="index" fixed="left" width="35px" />
|
||||
<template v-for="(d,i) in tableHeader">
|
||||
<el-table-column v-if="d.type && d.type === 'selection'" :key="i" :type="d.type" :fixed="d.fixed" />
|
||||
<el-table-column
|
||||
@ -193,8 +194,11 @@ export default {
|
||||
label: 'sys_dept__dept_name'
|
||||
},
|
||||
treeList: [],
|
||||
whereSql: false,
|
||||
whereSql: '',
|
||||
whereValue: '',
|
||||
where_sql: 'insp_item.insp_name_id = ?',
|
||||
where_value: this.$props.id,
|
||||
where_type: 'string',
|
||||
dialogUploadVisible: false
|
||||
}
|
||||
},
|
||||
|
@ -43,7 +43,7 @@
|
||||
</div>
|
||||
<div v-else-if="d.label === '操作'">
|
||||
<el-button icon="el-icon-view" type="text" size="mini" title="编辑" @click="edit(scope.row)" />
|
||||
<el-button v-if="scope.row.status !== 'NULLIFY'" icon="el-icon-delete" style="color:#F56C6C" type="text" title="删除" @click="Delete(scope.row)" />
|
||||
<!-- <el-button v-if="scope.row.status !== 'NULLIFY'" icon="el-icon-delete" style="color:#F56C6C" type="text" title="删除" @click="Delete(scope.row)" /> -->
|
||||
</div>
|
||||
<div v-else>{{ scope.row[d.prop] }}</div>
|
||||
</template>
|
||||
|
Loading…
x
Reference in New Issue
Block a user