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
b9853082e5
commit
60bcb97066
@ -27,8 +27,8 @@ const roles = [
|
||||
children: [
|
||||
{
|
||||
path: 'dashboard',
|
||||
name: 'Dashboard',
|
||||
meta: { title: 'dashboard', icon: 'dashboard' }
|
||||
name: '安全生产',
|
||||
meta: { title: '安全生产', icon: 'dashboard' }
|
||||
}
|
||||
]
|
||||
}]
|
||||
|
@ -40,8 +40,8 @@ const constantRoutes = [
|
||||
{
|
||||
path: 'dashboard',
|
||||
component: 'views/dashboard/index',
|
||||
name: 'Dashboard',
|
||||
meta: { title: 'Dashboard', icon: 'dashboard', affix: true }
|
||||
name: '安全生产',
|
||||
meta: { title: '安全生产', icon: 'dashboard', affix: true }
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -7,5 +7,19 @@ export default {
|
||||
method: 'post',
|
||||
data: `funid=queryevent&eventcode=query_loadtb&selpfunid=&selfunid=${funid}&selpagetype=editgrid&user_id=administrator&dataType=json&query_type=0&has_page=0`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
getFormBtn(funid) {
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `funid=queryevent&eventcode=query_loadtb&selpfunid=&selfunid=${funid}&selpagetype=form&user_id=administrator&dataType=json&query_type=0&has_page=0`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
getTypeSel(funid) {
|
||||
return request({
|
||||
url: `/commonAction.do?eventcode=query_data&funid=queryevent&pagetype=editgrid&query_funid=sys_control&user_id=administrator`,
|
||||
method: 'post',
|
||||
data: `start=0&limit=50&where_sql=(funall_control.control_code = ? )&where_value=${funid}&where_type=string&is_query=1&query_type=0&sort=funall_control__control_code`
|
||||
}).then(response => response.data)
|
||||
}
|
||||
}
|
||||
|
BIN
src/assets/login/portrait.jpg
Normal file
BIN
src/assets/login/portrait.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
@ -37,7 +37,7 @@ export default {
|
||||
const first = matched[0]
|
||||
|
||||
if (!this.isDashboard(first)) {
|
||||
matched = [{ path: '/dashboard', meta: { title: 'Dashboard' }}].concat(matched)
|
||||
matched = [{ path: '/', meta: { title: '安全生产' }}].concat(matched)
|
||||
}
|
||||
|
||||
this.levelList = matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false)
|
||||
|
@ -48,6 +48,15 @@ export default {
|
||||
},
|
||||
upload() {
|
||||
this.$emit('upload')
|
||||
},
|
||||
save() {
|
||||
this.$emit('save')
|
||||
},
|
||||
create() {
|
||||
this.$emit('Create')
|
||||
},
|
||||
del() {
|
||||
this.$emit('Del')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ export default {
|
||||
type: Boolean
|
||||
},
|
||||
buttonTop: {
|
||||
default: 250,
|
||||
default: 650,
|
||||
type: Number
|
||||
}
|
||||
},
|
||||
|
57
src/components/formBtn/index.vue
Normal file
57
src/components/formBtn/index.vue
Normal file
@ -0,0 +1,57 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-button v-for="d in data" :key="d.method" type="primary" @click="Fn(d.method)">{{ d.text }}</el-button>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import api from '@/api/public'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
funid: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
data: []
|
||||
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getButtons()
|
||||
},
|
||||
methods: {
|
||||
getButtons() {
|
||||
api.getFormBtn(this.funid).then(data => {
|
||||
if (data.success) {
|
||||
this.data = data.data.buttons
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
Fn(method) {
|
||||
this[method]()
|
||||
},
|
||||
create() {
|
||||
this.$emit('create')
|
||||
},
|
||||
del() {
|
||||
this.$emit('del')
|
||||
},
|
||||
save() {
|
||||
this.$emit('save')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// .el-card {
|
||||
// margin-top: 10px;
|
||||
// }
|
||||
</style>
|
49
src/components/selDept/api/index.js
Normal file
49
src/components/selDept/api/index.js
Normal file
@ -0,0 +1,49 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export default {
|
||||
getDept(pageSize, pageNo, isWhereSql, whereValue) {
|
||||
let whereSql = ''
|
||||
let whereType = ''
|
||||
if (isWhereSql) {
|
||||
whereSql = `sys_dept.dept_id like ?`
|
||||
whereType = 'string'
|
||||
}
|
||||
return request({
|
||||
url: `/commonAction.do?eventcode=query_data&funid=queryevent&pagetype=editgrid&query_funid=sys_dept&user_id=administrator`,
|
||||
method: 'post',
|
||||
data: `start=${pageNo}&limit=${pageSize}&where_sql=${whereSql}&where_value=${whereValue}&where_type=${whereType}&is_query=1&query_type=0`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
getDeptTree() {
|
||||
return request({
|
||||
url: `/commonAction.do?eventcode=query_data&funid=queryevent&pagetype=editgrid&query_funid=sys_dept&user_id=administrator`,
|
||||
method: 'post',
|
||||
data: `start=0&limit=10000&where_sql=&where_value=&where_type=&is_query=1&query_type=0`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
Crerte(data) {
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `${data}`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
auditSave(data) {
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `${data}`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
Delete(ids) {
|
||||
let keys = ''
|
||||
ids.forEach(d => {
|
||||
keys += 'keyid=' + d + '&'
|
||||
})
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `funid=sys_dept&${keys}pagetype=editgrid&eventcode=delete_eg&user_id=administrator&dataType=json`
|
||||
}).then(response => response.data)
|
||||
}
|
||||
}
|
92
src/components/selDept/components/auditDept.vue
Normal file
92
src/components/selDept/components/auditDept.vue
Normal file
@ -0,0 +1,92 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card>
|
||||
<el-form ref="auditForm" :model="form" :rules="rules">
|
||||
<el-form-item label="所属部门" :label-width="formLabelWidth">
|
||||
<el-select v-model="id" placeholder="请选择" disabled>
|
||||
<el-option
|
||||
v-for="item in data"
|
||||
:key="item.sys_dept__dept_id"
|
||||
:label="item.sys_dept__dept_name"
|
||||
:value="item.sys_dept__dept_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门编码" :label-width="formLabelWidth" prop="sys_dept__dept_code">
|
||||
<el-input v-model="form.sys_dept__dept_code" @change="change" />
|
||||
</el-form-item>
|
||||
<el-form-item label="部门名称" :label-width="formLabelWidth" prop="sys_dept__dept_name">
|
||||
<el-input v-model="form.sys_dept__dept_name" @change="change" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" :label-width="formLabelWidth" prop="sys_dept__memo">
|
||||
<el-input v-model="form.sys_dept__memo" @change="change" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否注销" :label-width="formLabelWidth">
|
||||
<el-select v-model="form.sys_dept__is_novalid" placeholder="请选择" @change="change">
|
||||
<el-option
|
||||
v-for="item in novalid"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
id: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
data: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
auditForm: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
novalid: [
|
||||
{
|
||||
value: '0',
|
||||
label: '否'
|
||||
}, {
|
||||
value: '1',
|
||||
label: '是'
|
||||
}
|
||||
],
|
||||
rules: {
|
||||
sys_dept__dept_code: [
|
||||
{ required: true, message: '请输入部门编码', trigger: 'blur' }
|
||||
],
|
||||
sys_dept__dept_name: [
|
||||
{ required: true, message: '请输入部门名称', trigger: 'blur' }
|
||||
|
||||
]
|
||||
},
|
||||
formLabelWidth: '120px',
|
||||
form: {}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.form = JSON.parse(JSON.stringify(this.auditForm))
|
||||
},
|
||||
methods: {
|
||||
change() {
|
||||
this.$emit('change', this.form)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
353
src/components/selDept/index.vue
Normal file
353
src/components/selDept/index.vue
Normal file
@ -0,0 +1,353 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-row>
|
||||
<el-col :span="6">
|
||||
<el-card>
|
||||
<el-tree :data="treeData" default-expand-all :props="defaultProps" highlight-current="true" expand-on-click-node="false" @node-click="handleNodeClick" />
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="18">
|
||||
<el-card>
|
||||
<el-table
|
||||
ref="deptTable"
|
||||
v-loading="loading"
|
||||
:data="data"
|
||||
style="width: 100%"
|
||||
@selection-change="handleSelectionChange"
|
||||
@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 slot-scope="scope">
|
||||
<div v-if="d.label==='是否注销'">
|
||||
{{
|
||||
scope.row.sys_dept__is_novalid == 0 ? '否' : '是'
|
||||
}}
|
||||
</div>
|
||||
<div v-else-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)" />
|
||||
</div>
|
||||
<div v-else>{{ scope.row[d.prop] }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</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>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import api from './api'
|
||||
export default {
|
||||
name: 'SelDept',
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
data: [],
|
||||
deptTree: [],
|
||||
ids: [],
|
||||
levels: [],
|
||||
pager: {
|
||||
pageNo: 0,
|
||||
pageSize: 10,
|
||||
total: 0
|
||||
},
|
||||
tableHeader: [
|
||||
{
|
||||
prop: 'selection',
|
||||
type: 'selection',
|
||||
fixed: 'left'
|
||||
}, {
|
||||
prop: 'sys_dept__dept_code',
|
||||
label: '组织编码'
|
||||
}, {
|
||||
prop: 'sys_dept__dept_name',
|
||||
label: '组织名称'
|
||||
}, {
|
||||
prop: 'sys_dept__memo',
|
||||
label: '备注'
|
||||
}],
|
||||
value: '',
|
||||
dept_id: '',
|
||||
level: '',
|
||||
id: '',
|
||||
parent_id: '',
|
||||
form: {
|
||||
dept_name: '',
|
||||
dept_code: '',
|
||||
memo: ''
|
||||
},
|
||||
rules: {
|
||||
dept_code: [
|
||||
{ required: true, message: '请输入部门编码', trigger: 'blur' }
|
||||
],
|
||||
dept_name: [
|
||||
{ required: true, message: '请输入部门名称', trigger: 'blur' }
|
||||
|
||||
]
|
||||
},
|
||||
dialogFormVisible: false,
|
||||
dialogEditVisible: false,
|
||||
formLabelWidth: '120px',
|
||||
auditForm: {},
|
||||
saveFrom: {},
|
||||
treeData: [],
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'sys_dept__dept_name'
|
||||
},
|
||||
treeList: [],
|
||||
whereSql: false,
|
||||
whereValue: ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
this.transitionTree()
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
this.loading = true
|
||||
let pageNo = this.pager.pageNo * this.pager.pageSize - this.pager.pageSize
|
||||
if (pageNo < 0) {
|
||||
pageNo = 0
|
||||
}
|
||||
api.getDept(
|
||||
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)
|
||||
}
|
||||
})
|
||||
},
|
||||
async transitionTree() {
|
||||
await api.getDeptTree().then(data => {
|
||||
if (data.success) {
|
||||
this.deptTree = data.data.root
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
this.treeData = []
|
||||
let data = []
|
||||
data = this.deptTree.sort((a, b) => {
|
||||
return a.sys_dept__dept_id - b.sys_dept__dept_id
|
||||
})
|
||||
const oneTreeList = data.filter(d => {
|
||||
return d.sys_dept__dept_level === '1'
|
||||
})
|
||||
for (let i = 0; i < oneTreeList.length; i++) {
|
||||
const treeList = data.filter(d => {
|
||||
return d.sys_dept__dept_id.substring(0, 4).indexOf(oneTreeList[i].sys_dept__dept_id) > -1
|
||||
})
|
||||
treeList.forEach(d => {
|
||||
d.children = []
|
||||
if (d.sys_dept__dept_level === '1') {
|
||||
this.treeData.push(d)
|
||||
} else if (d.sys_dept__dept_level === '2') {
|
||||
this.treeData[i].children.push(d)
|
||||
} else if (d.sys_dept__dept_level === '3') {
|
||||
this.treeData[i].children.forEach((threeVal, three) => {
|
||||
if (d.sys_dept__dept_id.substring(0, 8).indexOf(threeVal.sys_dept__dept_id) > -1) {
|
||||
this.treeData[i].children[three].children.push(d)
|
||||
}
|
||||
})
|
||||
} else if (d.sys_dept__dept_level === '4') {
|
||||
this.treeData[i].children.forEach((threeVal, three) => {
|
||||
threeVal.children.forEach((fourVal, four) => {
|
||||
if (d.sys_dept__dept_id.substring(0, 12).indexOf(fourVal.sys_dept__dept_id) > -1) {
|
||||
this.treeData[i].children[three].children[four].children.push(d)
|
||||
}
|
||||
})
|
||||
})
|
||||
} else if (d.sys_dept__dept_level === '5') {
|
||||
this.treeData[i].children.forEach((threeVal, three) => {
|
||||
threeVal.children.forEach((fourVal, four) => {
|
||||
fourVal.children.forEach((fiveVal, five) => {
|
||||
if (d.sys_dept__dept_id.substring(0, 16).indexOf(fiveVal.sys_dept__dept_id) > -1) {
|
||||
this.treeData[i].children[three].children[four].children[five].children.push(d)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
} else if (d.sys_dept__dept_level === '6') {
|
||||
this.treeData[i].children.forEach((threeVal, three) => {
|
||||
threeVal.children.forEach((fourVal, four) => {
|
||||
fourVal.children.forEach((fiveVal, five) => {
|
||||
fiveVal.children.forEach((sixVal, six) => {
|
||||
if (d.sys_dept__dept_id.substring(0, 20).indexOf(sixVal.sys_dept__dept_id) > -1) {
|
||||
this.treeData[i].children[three].children[four].children[five].children[six].children.push(d)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
console.log(this.treeData, 'this.treeData')
|
||||
}
|
||||
},
|
||||
editCreate() {
|
||||
if (this.ids === null) {
|
||||
this.$message.warning('请选择一个组织再添加下属组织')
|
||||
} else if (this.ids.length !== 1) {
|
||||
this.$message.warning('请选择一个组织再添加下属组织')
|
||||
} else {
|
||||
this.dialogFormVisible = true
|
||||
this.dept_id = this.ids[0]
|
||||
this.level = this.levels[0]
|
||||
}
|
||||
},
|
||||
create() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
const data = `funid=sys_dept&parentId=${this.dept_id}&levelCol=sys_dept.dept_level&keyid=&pagetype=editgrid&eventcode=save_eg&sys_dept__dept_code=${this.form.dept_code}&sys_dept__dept_name=${this.form.dept_name}&sys_dept__memo=${this.form.memo}&sys_dept__is_novalid=0&sys_dept__dept_id=&sys_dept__dept_level=${Number(this.level) + 1}&user_id=administrator&dataType= json`
|
||||
api.Crerte(data).then(data => {
|
||||
if (data.success) {
|
||||
this.getList()
|
||||
this.transitionTree()
|
||||
this.dialogFormVisible = false
|
||||
this.$refs['form'].resetFields()
|
||||
this.form.dept_name = ''
|
||||
this.form.dept_code = ''
|
||||
this.$message.success('新增成功!')
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
Delete(row) {
|
||||
this.ids = []
|
||||
this.ids.push(row.sys_dept__dept_id)
|
||||
this.editDelete()
|
||||
},
|
||||
editDelete() {
|
||||
if (this.ids && this.ids.length > 0) {
|
||||
this.$confirm('确认删除部门?').then(() => {
|
||||
api.Delete(this.ids).then(data => {
|
||||
if (data.success) {
|
||||
this.getList()
|
||||
this.$message.success('删除成功!')
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
}).catch(() => {})
|
||||
} else {
|
||||
this.$message.warning('请选择数据进行删除')
|
||||
}
|
||||
},
|
||||
editSave() {
|
||||
console.log('editSave')
|
||||
},
|
||||
upload() {
|
||||
console.log('upload')
|
||||
},
|
||||
edit(row) {
|
||||
this.id = row.sys_dept__dept_id
|
||||
this.parent_id = this.id.substring(0, this.id.length - 4)
|
||||
console.log(this.parent_id, this.id)
|
||||
this.auditForm = row
|
||||
this.dialogEditVisible = true
|
||||
},
|
||||
auditFormChange(form) {
|
||||
this.saveFrom = form
|
||||
},
|
||||
save() {
|
||||
console.log(this.saveFrom, 'this.saveFrom')
|
||||
console.log(this.auditForm, 'this.auditForm')
|
||||
if (Object.keys(this.saveFrom).length === 0) {
|
||||
this.saveFrom = this.auditForm
|
||||
}
|
||||
this.$refs.auditForm.$refs.auditForm.validate(valid => {
|
||||
if (valid) {
|
||||
const _form = `funid=sys_dept&parentId=&levelCol=sys_dept.dept_level&keyid=${this.id}&pagetype=editgrid&eventcode=save_eg&sys_dept__dept_code=${this.saveFrom.sys_dept__dept_code}&sys_dept__dept_name=${this.saveFrom.sys_dept__dept_name}&sys_dept__memo=${this.saveFrom.sys_dept__memo}&sys_dept__is_novalid=${this.saveFrom.sys_dept__is_novalid}&sys_dept__dept_id=${this.id}&sys_dept__dept_level=${this.saveFrom.sys_dept__dept_level}&user_id=administrator&dataType=json`
|
||||
api.auditSave(_form).then(data => {
|
||||
if (data.success) {
|
||||
this.whereSql = false
|
||||
this.whereValue = ''
|
||||
this.getList()
|
||||
this.$message.success('保存成功!')
|
||||
this.dialogEditVisible = false
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
cellDblclick(row) {
|
||||
this.$emit('updateDept', row)
|
||||
},
|
||||
sizeChange(size) {
|
||||
this.pager.pageSize = size
|
||||
this.getList()
|
||||
},
|
||||
pageChange(page) {
|
||||
this.pager.pageNo = page
|
||||
this.getList()
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.$emit('updateDepts', val)
|
||||
},
|
||||
closeDialog() {
|
||||
this.dialogFormVisible = false
|
||||
this.$refs['form'].resetFields()
|
||||
this.form.dept_name = ''
|
||||
this.form.dept_code = ''
|
||||
},
|
||||
handleNodeClick(data) {
|
||||
this.pager.pageNo = 0
|
||||
this.pager.pageSize = 10
|
||||
this.pager.total = 0
|
||||
this.whereValue = encodeURI(`${data.sys_dept__dept_id}\%`)
|
||||
this.whereSql = true
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.el-card {
|
||||
margin-top: 0px;
|
||||
}
|
||||
.app-container{
|
||||
padding: 0px;
|
||||
}
|
||||
.el-tree{
|
||||
height: 500px;
|
||||
overflow-x:auto;
|
||||
overflow-y:auto;
|
||||
}
|
||||
</style>
|
56
src/components/selUser/api/index.js
Normal file
56
src/components/selUser/api/index.js
Normal file
@ -0,0 +1,56 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export default {
|
||||
getUser(pageSize, pageNo, isWhereSql, whereValue) {
|
||||
let whereSql = ''
|
||||
let whereType = ''
|
||||
if (isWhereSql) {
|
||||
whereSql = `sys_dept.dept_id like ?`
|
||||
whereType = 'string'
|
||||
}
|
||||
return request({
|
||||
url: `/commonAction.do?eventcode=query_data&funid=queryevent&pagetype=editgrid&query_funid=sys_user&user_id=administrator`,
|
||||
method: 'post',
|
||||
data: `start=${pageNo}&limit=${pageSize}&where_sql=${whereSql}&where_value=${whereValue}&where_type=${whereType}&is_query=1&query_type=0`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
getDeptTree() {
|
||||
return request({
|
||||
url: `/commonAction.do?eventcode=query_data&funid=queryevent&pagetype=editgrid&query_funid=sys_dept&user_id=administrator`,
|
||||
method: 'post',
|
||||
data: `start=0&limit=10000&where_sql=&where_value=&where_type=&is_query=1&query_type=0`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
Crerte(data) {
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `${data}`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
auditSave(data) {
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `${data}`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
Delete(ids) {
|
||||
let keys = ''
|
||||
ids.forEach(d => {
|
||||
keys += 'keyid=' + d + '&'
|
||||
})
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `funid=sys_user&${keys}pagetype=editgrid&eventcode=delete_eg&user_id=administrator&dataType=json`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
getSelect(control_code) {
|
||||
return request({
|
||||
url: `/commonAction.do?eventcode=query_data&funid=queryevent&pagetype=editgrid&query_funid=sys_control&user_id=administrator`,
|
||||
method: 'post',
|
||||
data: `start=0&limit=50&where_sql=(funall_control.control_code = ? )&where_value=${control_code}&where_type=string&is_query=1&query_type=0`
|
||||
}).then(response => response.data)
|
||||
}
|
||||
}
|
211
src/components/selUser/components/auditUser.vue
Normal file
211
src/components/selUser/components/auditUser.vue
Normal file
@ -0,0 +1,211 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card>
|
||||
<el-form ref="form" :model="form" label-width="80px" :rules="rules">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="姓名" prop="sys_user__user_name">
|
||||
<el-input v-model="form.sys_user__user_name" @change="change" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="工号" prop="sys_user__user_code">
|
||||
<el-input v-model="form.sys_user__user_code" @change="change" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="部门名称" prop="sys_dept__dept_name">
|
||||
<el-input v-model="form.sys_dept__dept_name" placeholder="请选择部门" class="input-with-select" disabled>
|
||||
<el-button slot="append" icon="el-icon-search" @click="selDeptVisible = !selDeptVisible" />
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="部门负责人?">
|
||||
<el-select v-model="form.sys_user__is_leader" placeholder="请选择" @change="change">
|
||||
<el-option
|
||||
v-for="item in yesno"
|
||||
:key="item.funall_control__value_data"
|
||||
:label="item.funall_control__display_data"
|
||||
:value="item.funall_control__value_data"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="职务">
|
||||
<el-input v-model="form.sys_user__duty" @change="change" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="固定电话">
|
||||
<el-input v-model="form.sys_user__phone_code" @change="change" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="手机号码">
|
||||
<el-input v-model="form.sys_user__mob_code" @change="change" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="性别">
|
||||
<el-select v-model="form.sys_user__sex" placeholder="请选择" @change="change">
|
||||
<el-option
|
||||
v-for="item in usersex"
|
||||
:key="item.funall_control__value_data"
|
||||
:label="item.funall_control__display_data"
|
||||
:value="item.funall_control__value_data"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="邮箱">
|
||||
<el-input v-model="form.sys_user__email" @change="change" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="是否注销">
|
||||
<el-select v-model="form.sys_user__is_novalid" placeholder="请选择" change="change">
|
||||
<el-option
|
||||
v-for="item in yesno"
|
||||
:key="item.funall_control__value_data"
|
||||
:label="item.funall_control__display_data"
|
||||
:value="item.funall_control__value_data"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="16">
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="form.sys_user__memo" @change="change" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-dialog
|
||||
v-if="selDeptVisible"
|
||||
class="selDept"
|
||||
title="选择部门"
|
||||
:visible.sync="selDeptVisible"
|
||||
width="60%"
|
||||
:modal="false"
|
||||
>
|
||||
<SelDept ref="seLDept" @updateDept="updateDept" @updateDepts="updateDepts" />
|
||||
<span>
|
||||
<el-button @click="selDeptVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="selDeptVisible = false">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import api from '../api'
|
||||
import SelDept from '@/components/selDept'
|
||||
export default {
|
||||
components: {
|
||||
SelDept
|
||||
},
|
||||
props: {
|
||||
id: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
data: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
auditForm: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
novalid: [
|
||||
{
|
||||
value: '0',
|
||||
label: '否'
|
||||
}, {
|
||||
value: '1',
|
||||
label: '是'
|
||||
}
|
||||
],
|
||||
rules: {
|
||||
sys_user__user_code: [
|
||||
{ required: true, message: '请输入工号', trigger: 'blur' }
|
||||
],
|
||||
sys_user__user_name: [
|
||||
{ required: true, message: '请输入用户名称', trigger: 'blur' }
|
||||
],
|
||||
sys_dept__dept_name: [
|
||||
{ required: true, message: '请选择部门名称', trigger: 'blur' }
|
||||
|
||||
]
|
||||
},
|
||||
formLabelWidth: '120px',
|
||||
form: {},
|
||||
yesno: [],
|
||||
usersex: [],
|
||||
selDeptVisible: false
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
await this.getYesNo()
|
||||
await this.getSex()
|
||||
await this.init()
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.form = JSON.parse(JSON.stringify(this.auditForm))
|
||||
},
|
||||
change() {
|
||||
console.log(this.form, 'this.form')
|
||||
this.$emit('change', this.form)
|
||||
},
|
||||
getYesNo() {
|
||||
api.getSelect('yesno').then(data => {
|
||||
if (data.success) {
|
||||
this.yesno = data.data.root
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
getSex() {
|
||||
api.getSelect('usersex').then(data => {
|
||||
if (data.success) {
|
||||
this.usersex = data.data.root
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
updateDept(data) {
|
||||
this.form.sys_dept__dept_name = data.sys_dept__dept_name
|
||||
this.form.sys_user__dept_id = data.sys_dept__dept_id
|
||||
this.selDeptVisible = false
|
||||
this.change()
|
||||
},
|
||||
updateDepts(data) {
|
||||
this.form.sys_dept__dept_name = data.map(d => { return d.sys_dept__dept_name }).join(';')
|
||||
this.form.sys_user__dept_id = data.map(d => { return d.sys_dept__dept_id }).join(';')
|
||||
this.change()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.selDept{
|
||||
margin-top: -10vh;
|
||||
}
|
||||
</style>
|
408
src/components/selUser/index.vue
Normal file
408
src/components/selUser/index.vue
Normal file
@ -0,0 +1,408 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-row>
|
||||
<el-col :span="5">
|
||||
<el-card>
|
||||
<div class="tree_title">安全组织架构</div>
|
||||
<el-tree :data="treeData" default-expand-all :props="defaultProps" @node-click="handleNodeClick" />
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="18" style="margin-left:20px">
|
||||
<el-card>
|
||||
<el-table
|
||||
ref="deptTable"
|
||||
v-loading="loading"
|
||||
:data="data"
|
||||
style="width: 100%"
|
||||
stripe
|
||||
@selection-change="handleSelectionChange"
|
||||
@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 slot-scope="scope">
|
||||
<div v-if="d.label==='部门负责人?'">
|
||||
{{
|
||||
scope.row.sys_user__is_leader == 0 ? '否' : '是'
|
||||
}}
|
||||
</div>
|
||||
<div v-else-if="d.label==='性别'">
|
||||
{{
|
||||
scope.row.sys_user__sex == 0 ? '女' : '男'
|
||||
}}
|
||||
</div>
|
||||
<div v-else-if="d.label==='是否注销'">
|
||||
{{
|
||||
scope.row.sys_user__is_novalid == 0 ? '否' : '是'
|
||||
}}
|
||||
</div>
|
||||
<div v-else-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)" />
|
||||
</div>
|
||||
<div v-else>{{ scope.row[d.prop] }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</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>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-dialog v-if="dialogFormVisible" title="新增部门" :visible.sync="dialogFormVisible" @close="closeDialog">
|
||||
<el-form ref="form" :model="form" :rules="rules">
|
||||
<el-form-item label="所属部门" :label-width="formLabelWidth">
|
||||
<el-select v-model="dept_id" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in data"
|
||||
:key="item.sys_user__dept_id"
|
||||
:label="item.sys_user__dept_name"
|
||||
:value="item.sys_user__dept_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门编码" :label-width="formLabelWidth" prop="dept_code">
|
||||
<el-input v-model="form.dept_code" />
|
||||
</el-form-item>
|
||||
<el-form-item label="部门名称" :label-width="formLabelWidth" prop="dept_name">
|
||||
<el-input v-model="form.dept_name" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" :label-width="formLabelWidth" prop="memo">
|
||||
<el-input v-model="form.memo" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="create">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<el-dialog v-if="dialogEditVisible" title="部门" :visible.sync="dialogEditVisible" width="70%" @close="closeDialog">
|
||||
<AdutiUser :id="user_id" ref="auditForm" :audit-form="auditForm" :data="deptTree" @change="auditFormChange" />
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogEditVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="save">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import api from './api'
|
||||
import AdutiUser from './components/auditUser'
|
||||
export default {
|
||||
name: 'User',
|
||||
components: {
|
||||
AdutiUser
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
data: [],
|
||||
deptTree: [],
|
||||
ids: [],
|
||||
levels: [],
|
||||
pager: {
|
||||
pageNo: 0,
|
||||
pageSize: 10,
|
||||
total: 0
|
||||
},
|
||||
tableHeader: [
|
||||
{
|
||||
prop: 'selection',
|
||||
type: 'selection',
|
||||
fixed: 'left'
|
||||
}, {
|
||||
prop: 'sys_user__user_name',
|
||||
label: '姓名'
|
||||
}, {
|
||||
prop: 'sys_user__user_code',
|
||||
label: '工号'
|
||||
}, {
|
||||
prop: 'sys_dept__dept_name',
|
||||
label: '部门名称'
|
||||
}, {
|
||||
prop: 'sys_user__memo',
|
||||
label: '备注'
|
||||
}],
|
||||
value: '',
|
||||
dept_id: '',
|
||||
level: '',
|
||||
user_id: '',
|
||||
parent_id: '',
|
||||
form: {
|
||||
dept_name: '',
|
||||
dept_code: '',
|
||||
memo: ''
|
||||
},
|
||||
rules: {
|
||||
dept_code: [
|
||||
{ required: true, message: '请输入部门编码', trigger: 'blur' }
|
||||
],
|
||||
dept_name: [
|
||||
{ required: true, message: '请输入部门名称', trigger: 'blur' }
|
||||
|
||||
]
|
||||
},
|
||||
dialogFormVisible: false,
|
||||
dialogEditVisible: false,
|
||||
formLabelWidth: '120px',
|
||||
auditForm: {},
|
||||
saveFrom: {},
|
||||
treeData: [],
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'sys_dept__dept_name'
|
||||
},
|
||||
treeList: [],
|
||||
whereSql: false,
|
||||
whereValue: ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
this.transitionTree()
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
this.loading = true
|
||||
let pageNo = this.pager.pageNo * this.pager.pageSize - this.pager.pageSize
|
||||
if (pageNo < 0) {
|
||||
pageNo = 0
|
||||
}
|
||||
api.getUser(
|
||||
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)
|
||||
}
|
||||
})
|
||||
},
|
||||
async transitionTree() {
|
||||
await api.getDeptTree().then(data => {
|
||||
if (data.success) {
|
||||
this.deptTree = data.data.root
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
this.treeData = []
|
||||
let data = []
|
||||
data = this.deptTree.sort((a, b) => {
|
||||
return a.sys_dept__dept_id - b.sys_dept__dept_id
|
||||
})
|
||||
const oneTreeList = data.filter(d => {
|
||||
return d.sys_dept__dept_level === '1'
|
||||
})
|
||||
for (let i = 0; i < oneTreeList.length; i++) {
|
||||
const treeList = data.filter(d => {
|
||||
return d.sys_dept__dept_id.substring(0, 4).indexOf(oneTreeList[i].sys_dept__dept_id) > -1
|
||||
})
|
||||
treeList.forEach(d => {
|
||||
d.children = []
|
||||
if (d.sys_dept__dept_level === '1') {
|
||||
this.treeData.push(d)
|
||||
} else if (d.sys_dept__dept_level === '2') {
|
||||
this.treeData[i].children.push(d)
|
||||
} else if (d.sys_dept__dept_level === '3') {
|
||||
this.treeData[i].children.forEach((threeVal, three) => {
|
||||
if (d.sys_dept__dept_id.substring(0, 8).indexOf(threeVal.sys_dept__dept_id) > -1) {
|
||||
this.treeData[i].children[three].children.push(d)
|
||||
}
|
||||
})
|
||||
} else if (d.sys_dept__dept_level === '4') {
|
||||
this.treeData[i].children.forEach((threeVal, three) => {
|
||||
threeVal.children.forEach((fourVal, four) => {
|
||||
if (d.sys_dept__dept_id.substring(0, 12).indexOf(fourVal.sys_dept__dept_id) > -1) {
|
||||
this.treeData[i].children[three].children[four].children.push(d)
|
||||
}
|
||||
})
|
||||
})
|
||||
} else if (d.sys_dept__dept_level === '5') {
|
||||
this.treeData[i].children.forEach((threeVal, three) => {
|
||||
threeVal.children.forEach((fourVal, four) => {
|
||||
fourVal.children.forEach((fiveVal, five) => {
|
||||
if (d.sys_dept__dept_id.substring(0, 16).indexOf(fiveVal.sys_dept__dept_id) > -1) {
|
||||
this.treeData[i].children[three].children[four].children[five].children.push(d)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
} else if (d.sys_dept__dept_level === '6') {
|
||||
this.treeData[i].children.forEach((threeVal, three) => {
|
||||
threeVal.children.forEach((fourVal, four) => {
|
||||
fourVal.children.forEach((fiveVal, five) => {
|
||||
fiveVal.children.forEach((sixVal, six) => {
|
||||
if (d.sys_dept__dept_id.substring(0, 20).indexOf(sixVal.sys_dept__dept_id) > -1) {
|
||||
this.treeData[i].children[three].children[four].children[five].children[six].children.push(d)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
console.log(this.treeData, 'this.treeData')
|
||||
}
|
||||
},
|
||||
editCreate() {
|
||||
this.id = ''
|
||||
this.auditForm = {}
|
||||
this.dialogEditVisible = true
|
||||
},
|
||||
create() {
|
||||
this.$refs.auditForm.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
const data = `funid=sys_dept&parentId=${this.dept_id}&levelCol=sys_dept.dept_level&keyid=&pagetype=editgrid&eventcode=save_eg&sys_user__dept_code=${this.form.dept_code}&sys_user__dept_name=${this.form.dept_name}&sys_user__memo=${this.form.memo}&sys_user__is_novalid=0&sys_user__dept_id=&sys_user__dept_level=${Number(this.level) + 1}&user_id=administrator&dataType= json`
|
||||
api.Crerte(data).then(data => {
|
||||
if (data.success) {
|
||||
this.getList()
|
||||
this.transitionTree()
|
||||
this.dialogFormVisible = false
|
||||
this.$refs.auditForm.$refs.form.resetFields()
|
||||
this.form.dept_name = ''
|
||||
this.form.dept_code = ''
|
||||
this.$message.success('新增成功!')
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
Delete(row) {
|
||||
this.ids = []
|
||||
this.ids.push(row.sys_user__user_id)
|
||||
this.editDelete()
|
||||
},
|
||||
editDelete() {
|
||||
if (this.ids && this.ids.length > 0) {
|
||||
this.$confirm('确认删除员工?').then(() => {
|
||||
api.Delete(this.ids).then(data => {
|
||||
if (data.success) {
|
||||
this.getList()
|
||||
this.$message.success('删除成功!')
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
}).catch(() => {})
|
||||
} else {
|
||||
this.$message.warning('请选择数据进行删除')
|
||||
}
|
||||
},
|
||||
editSave() {
|
||||
console.log('editSave')
|
||||
},
|
||||
upload() {
|
||||
console.log('upload')
|
||||
},
|
||||
edit(row) {
|
||||
this.id = row.sys_user__user_id
|
||||
this.auditForm = row
|
||||
this.dialogEditVisible = true
|
||||
},
|
||||
auditFormChange(form) {
|
||||
this.saveFrom = form
|
||||
},
|
||||
save() {
|
||||
console.log(this.$refs.auditForm, 'this.$refs.auditForm.')
|
||||
if (Object.keys(this.saveFrom).length === 0) {
|
||||
this.saveFrom = this.auditForm
|
||||
}
|
||||
this.$refs.auditForm.$refs.form.validate(valid => {
|
||||
if (valid) {
|
||||
const _form = `funid=sys_user&parentId=&levelCol=sys_dept.dept_level&keyid=${this.id}&pagetype=editgrid&eventcode=save_eg&sys_user__user_name=${this.saveFrom.sys_user__user_name}&sys_user__user_code=${this.saveFrom.sys_user__user_code}&sys_dept__dept_name=${this.saveFrom.sys_dept__dept_name}&sys_user__is_leader=${this.saveFrom.sys_user__is_leader}&sys_user__duty=${this.saveFrom.sys_user__duty}&sys_user__phone_code=${this.saveFrom.sys_user__phone_code}&sys_user__mob_code=${this.saveFrom.sys_user__mob_code}&sys_user__sex=${this.saveFrom.sys_user__sex}&sys_user__email=${this.saveFrom.sys_user__email}&sys_user__is_novalid=${this.saveFrom.sys_user__is_novalid}&sys_user__memo=${this.saveFrom.sys_user__memo}&sys_user__user_id=${this.id}&sys_user__dept_id=${this.saveFrom.sys_user__dept_id}&user_id=administrator&dataType=json`
|
||||
api.auditSave(_form).then(data => {
|
||||
if (data.success) {
|
||||
this.whereSql = false
|
||||
this.whereValue = ''
|
||||
this.getList()
|
||||
this.$message.success('保存成功!')
|
||||
this.dialogEditVisible = false
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
cellDblclick(row) {
|
||||
this.$emit('updateUser', row)
|
||||
},
|
||||
sizeChange(size) {
|
||||
this.pager.pageSize = size
|
||||
this.getList()
|
||||
},
|
||||
pageChange(page) {
|
||||
this.pager.pageNo = page
|
||||
this.getList()
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.$emit('updateUsers', val)
|
||||
},
|
||||
closeDialog() {
|
||||
this.dialogFormVisible = false
|
||||
this.$refs.auditForm.$refs.form.resetFields()
|
||||
this.form = ''
|
||||
},
|
||||
handleNodeClick(data) {
|
||||
this.pager.pageNo = 0
|
||||
this.pager.pageSize = 10
|
||||
this.pager.total = 0
|
||||
this.whereValue = encodeURI(`${data.sys_dept__dept_id}\%`)
|
||||
this.whereSql = true
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.el-card {
|
||||
margin-top: 10px;
|
||||
}
|
||||
::v-deep .el-card__body {
|
||||
padding: 0px;
|
||||
}
|
||||
.tree_title{
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
margin-bottom: 10px;
|
||||
padding: 2px;
|
||||
line-height: 30px;
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
background-color: #42b983;
|
||||
text-align: center;
|
||||
}
|
||||
.el-tree{
|
||||
height: 500px;
|
||||
overflow-x:auto;
|
||||
overflow-y:auto;
|
||||
}
|
||||
</style>
|
@ -12,15 +12,15 @@
|
||||
|
||||
<screenfull id="screenfull" class="right-menu-item hover-effect" />
|
||||
|
||||
<el-tooltip content="Global Size" effect="dark" placement="bottom">
|
||||
<!-- <el-tooltip content="Global Size" effect="dark" placement="bottom">
|
||||
<size-select id="size-select" class="right-menu-item hover-effect" />
|
||||
</el-tooltip>
|
||||
</el-tooltip> -->
|
||||
|
||||
</template>
|
||||
|
||||
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
|
||||
<div class="avatar-wrapper">
|
||||
<img :src="avatar+'?imageView2/1/w/80/h/80'" class="user-avatar">
|
||||
<img src="../../assets/login/portrait.jpg" class="user-avatar">
|
||||
<i class="el-icon-caret-bottom" />
|
||||
</div>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
@ -51,7 +51,7 @@ import Breadcrumb from '@/components/Breadcrumb'
|
||||
import Hamburger from '@/components/Hamburger'
|
||||
import ErrorLog from '@/components/ErrorLog'
|
||||
import Screenfull from '@/components/Screenfull'
|
||||
import SizeSelect from '@/components/SizeSelect'
|
||||
// import SizeSelect from '@/components/SizeSelect'
|
||||
import Search from '@/components/HeaderSearch'
|
||||
|
||||
export default {
|
||||
@ -60,7 +60,7 @@ export default {
|
||||
Hamburger,
|
||||
ErrorLog,
|
||||
Screenfull,
|
||||
SizeSelect,
|
||||
// SizeSelect,
|
||||
Search
|
||||
},
|
||||
computed: {
|
||||
@ -148,8 +148,8 @@ export default {
|
||||
|
||||
.user-avatar {
|
||||
cursor: pointer;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
width: 38px;
|
||||
height: 35px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
<logo v-if="showLogo" :collapse="isCollapse" />
|
||||
<el-scrollbar wrap-class="scrollbar-wrapper">
|
||||
<el-menu
|
||||
:default-openeds="['/insp','/hidden_danger']"
|
||||
:default-active="activeMenu"
|
||||
:collapse="isCollapse"
|
||||
:background-color="variables.menuBg"
|
||||
|
@ -6,7 +6,7 @@ import 'normalize.css/normalize.css' // a modern alternative to CSS resets
|
||||
|
||||
import Element from 'element-ui'
|
||||
import './styles/element-variables.scss'
|
||||
import enLang from 'element-ui/lib/locale/lang/en'// 如果使用中文语言包请默认支持,无需额外引入,请删除该依赖
|
||||
// import enLang from 'element-ui/lib/locale/lang/en'// 如果使用中文语言包请默认支持,无需额外引入,请删除该依赖
|
||||
|
||||
import '@/styles/index.scss' // global css
|
||||
|
||||
@ -34,8 +34,8 @@ if (process.env.NODE_ENV === 'production') {
|
||||
}
|
||||
|
||||
Vue.use(Element, {
|
||||
size: Cookies.get('size') || 'medium', // set element-ui default size
|
||||
locale: enLang // 如果使用中文,无需设置,请删除
|
||||
size: Cookies.get('size') || 'medium' // set element-ui default size
|
||||
// locale: enLang // 如果使用中文,无需设置,请删除
|
||||
})
|
||||
|
||||
// register global utility filters
|
||||
|
@ -19,7 +19,6 @@ router.beforeEach(async(to, from, next) => {
|
||||
|
||||
// determine whether the user has logged in
|
||||
const hasToken = getToken()
|
||||
|
||||
if (hasToken) {
|
||||
if (to.path === '/login') {
|
||||
// if is logged in, redirect to the home page
|
||||
|
@ -78,35 +78,94 @@ export const constantRoutes = [
|
||||
{
|
||||
path: 'dashboard',
|
||||
component: () => import('@/views/dashboard/index'),
|
||||
name: 'Dashboard',
|
||||
meta: { title: 'Dashboard', icon: 'dashboard', affix: true }
|
||||
meta: { title: '安全生产看板', icon: 'dashboard', affix: true }
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/guide',
|
||||
path: '/insp',
|
||||
component: Layout,
|
||||
redirect: '/guide/index',
|
||||
redirect: '/insp/safe_insp',
|
||||
name: '安全点巡检',
|
||||
meta: {
|
||||
title: '安全点巡检',
|
||||
icon: 'clipboard'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'index',
|
||||
component: () => import('@/views/guide/index'),
|
||||
name: 'Guide',
|
||||
meta: { title: 'Guide', icon: 'guide', noCache: true }
|
||||
path: 'safe_insp',
|
||||
component: () => import('@/views/safe_insp/index'),
|
||||
name: '安全点巡检',
|
||||
meta: { title: '安全点巡检', icon: 'list', noCache: true }
|
||||
},
|
||||
{
|
||||
path: 'edit_form/:id',
|
||||
component: () => import('@/views/safe_insp/components/edit_form/index'),
|
||||
name: 'EditForm',
|
||||
hidden: true,
|
||||
meta: { title: '安全点巡检编辑', icon: 'list', noCache: true }
|
||||
},
|
||||
{
|
||||
path: 'insp_name',
|
||||
component: () => import('@/views/insp_name/index'),
|
||||
name: '点巡检标准项',
|
||||
meta: { title: '点巡检标准项', icon: 'edit', noCache: true }
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/profile',
|
||||
path: '/hidden_danger',
|
||||
component: Layout,
|
||||
redirect: '/profile/index',
|
||||
hidden: true,
|
||||
redirect: '/hidden_danger/hidden_check',
|
||||
name: '隐患排查治理',
|
||||
meta: {
|
||||
title: '隐患排查治理',
|
||||
icon: 'el-icon-s-order'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'hidden_check',
|
||||
component: () => import('@/views/hidden_check/index'),
|
||||
name: '隐患排查',
|
||||
meta: { title: '隐患排查', icon: 'form', noCache: true }
|
||||
},
|
||||
{
|
||||
path: 'hidden_reform',
|
||||
component: () => import('@/views/hidden_reform/index'),
|
||||
name: '隐患整改',
|
||||
meta: { title: '隐患整改', icon: 'el-icon-s-management', noCache: true }
|
||||
},
|
||||
{
|
||||
path: 'hidden_review',
|
||||
component: () => import('@/views/hidden_review/index'),
|
||||
name: '隐患验收',
|
||||
meta: { title: '隐患验收', icon: 'el-icon-s-opportunity', noCache: true }
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/sys_dept',
|
||||
component: Layout,
|
||||
redirect: '/sys_dept/index',
|
||||
children: [
|
||||
{
|
||||
path: 'index',
|
||||
component: () => import('@/views/profile/index'),
|
||||
name: 'Profile',
|
||||
meta: { title: 'Profile', icon: 'user', noCache: true }
|
||||
component: () => import('@/views/sys_dept/index'),
|
||||
name: '组织管理',
|
||||
meta: { title: '组织管理', icon: 'guide', noCache: true }
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/sys_user',
|
||||
component: Layout,
|
||||
redirect: '/sys_user/index',
|
||||
children: [
|
||||
{
|
||||
path: 'index',
|
||||
component: () => import('@/views/sys_user/index'),
|
||||
name: '用户管理',
|
||||
meta: { title: '用户管理', icon: 'guide', noCache: true }
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -205,7 +264,7 @@ export const asyncRoutes = [
|
||||
path: 'list',
|
||||
component: () => import('@/views/example/list'),
|
||||
name: 'ArticleList',
|
||||
meta: { title: 'Article List', icon: 'list' }
|
||||
meta: { title: 'Article List', icon: 'v' }
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -1,3 +1,4 @@
|
||||
import Vue from 'vue'
|
||||
import { login, getInfo } from '@/api/user'
|
||||
import { getToken, setToken, removeToken } from '@/utils/auth'
|
||||
import router, { resetRouter } from '@/router'
|
||||
@ -34,13 +35,16 @@ const actions = {
|
||||
const { username, password } = userInfo
|
||||
return new Promise((resolve, reject) => {
|
||||
login(`funid=login&eventcode=login&pagetype=login&user_code=${username.trim()}&user_pass=${password}`).then(res => {
|
||||
console.log(res.data.data, 'res')
|
||||
commit('SET_ROLES', res.data.data.role_id)
|
||||
// const { data } = res.data
|
||||
commit('SET_TOKEN', '123')
|
||||
setToken('123')
|
||||
sessionStorage.setItem('ROLES', res.data.data.role_id)
|
||||
resolve()
|
||||
if (res.data.success) {
|
||||
commit('SET_ROLES', res.data.data.role_id)
|
||||
// const { data } = res.data
|
||||
commit('SET_TOKEN', '123')
|
||||
setToken('123')
|
||||
sessionStorage.setItem('ROLES', res.data.data.role_id)
|
||||
resolve()
|
||||
} else {
|
||||
Vue.prototype.$message.error(res.data.message)
|
||||
}
|
||||
}).catch(err => {
|
||||
reject(err)
|
||||
})
|
||||
|
34
src/styles/layer.scss
Normal file
34
src/styles/layer.scss
Normal file
@ -0,0 +1,34 @@
|
||||
@import "./element-variables";
|
||||
|
||||
.compact-layout{
|
||||
.v-form-item__label, .v-form-item__content{
|
||||
@include inputHeight($input-list);
|
||||
}
|
||||
// v-form
|
||||
.v-form-line{
|
||||
margin-top: -1px!important;
|
||||
}
|
||||
.v-form-item__content{
|
||||
font-size: 12px!important;
|
||||
}
|
||||
.v-form-item__label{
|
||||
font-size: 12px!important;
|
||||
height: 22px !important;
|
||||
color: #111 !important;
|
||||
line-height: 22px!important;
|
||||
padding-right: 6px !important;
|
||||
font-weight: normal;
|
||||
}
|
||||
.v-form-item__content{
|
||||
line-height: 27px!important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.el-table .v-form-line{
|
||||
margin-top: 0!important;
|
||||
}
|
||||
.v-layer {
|
||||
// height: 22px;
|
||||
line-height: 20px;
|
||||
}
|
66
src/styles/layout.scss
Normal file
66
src/styles/layout.scss
Normal file
@ -0,0 +1,66 @@
|
||||
/* layout style */
|
||||
|
||||
/* margin
|
||||
----------------*/
|
||||
$start: 1;
|
||||
$end: 6;
|
||||
@for $i from $start to $end {
|
||||
.m-t-#{$i*5} {
|
||||
margin-top: #{$i*5px}
|
||||
}
|
||||
.m-b-#{$i*5} {
|
||||
margin-bottom: #{$i*5px}
|
||||
}
|
||||
.m-r-#{$i*5} {
|
||||
margin-right: #{$i*5px}
|
||||
}
|
||||
.m-l-#{$i*5} {
|
||||
margin-left: #{$i*5px}
|
||||
}
|
||||
}
|
||||
|
||||
/* text
|
||||
----------------*/
|
||||
.t-a-l{
|
||||
text-align: left;
|
||||
}
|
||||
.t-a-c{
|
||||
text-align: center;
|
||||
}
|
||||
.t-a-r{
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* float
|
||||
----------------*/
|
||||
.f-l{
|
||||
float: left;
|
||||
}
|
||||
.f-r{
|
||||
float: right;
|
||||
}
|
||||
|
||||
/* table
|
||||
--------*/
|
||||
.table{
|
||||
display: table;
|
||||
}
|
||||
.table-cell{
|
||||
display: table-cell;
|
||||
}
|
||||
|
||||
/* flex
|
||||
--------*/
|
||||
.f-j{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.flex-y-c{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.d-f{
|
||||
display: flex;
|
||||
}
|
@ -7,7 +7,7 @@
|
||||
</div>
|
||||
<div class="card-panel-description">
|
||||
<div class="card-panel-text">
|
||||
New Visits
|
||||
安全生产
|
||||
</div>
|
||||
<count-to :start-val="0" :end-val="102400" :duration="2600" class="card-panel-num" />
|
||||
</div>
|
||||
@ -20,7 +20,7 @@
|
||||
</div>
|
||||
<div class="card-panel-description">
|
||||
<div class="card-panel-text">
|
||||
Messages
|
||||
为时不晚
|
||||
</div>
|
||||
<count-to :start-val="0" :end-val="81212" :duration="3000" class="card-panel-num" />
|
||||
</div>
|
||||
@ -33,7 +33,7 @@
|
||||
</div>
|
||||
<div class="card-panel-description">
|
||||
<div class="card-panel-text">
|
||||
Purchases
|
||||
日常巡检
|
||||
</div>
|
||||
<count-to :start-val="0" :end-val="9280" :duration="3200" class="card-panel-num" />
|
||||
</div>
|
||||
@ -46,7 +46,7 @@
|
||||
</div>
|
||||
<div class="card-panel-description">
|
||||
<div class="card-panel-text">
|
||||
Shoppings
|
||||
隐患治理
|
||||
</div>
|
||||
<count-to :start-val="0" :end-val="13600" :duration="3600" class="card-panel-num" />
|
||||
</div>
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
<el-row :gutter="8">
|
||||
<el-col :xs="{span: 24}" :sm="{span: 24}" :md="{span: 24}" :lg="{span: 12}" :xl="{span: 12}" style="padding-right:8px;margin-bottom:30px;">
|
||||
<transaction-table />
|
||||
<!-- <transaction-table /> -->
|
||||
</el-col>
|
||||
<el-col :xs="{span: 24}" :sm="{span: 12}" :md="{span: 12}" :lg="{span: 6}" :xl="{span: 6}" style="margin-bottom:30px;">
|
||||
<todo-list />
|
||||
@ -47,7 +47,6 @@ import LineChart from './components/LineChart'
|
||||
import RaddarChart from './components/RaddarChart'
|
||||
import PieChart from './components/PieChart'
|
||||
import BarChart from './components/BarChart'
|
||||
import TransactionTable from './components/TransactionTable'
|
||||
import TodoList from './components/TodoList'
|
||||
import BoxCard from './components/BoxCard'
|
||||
|
||||
@ -79,7 +78,6 @@ export default {
|
||||
RaddarChart,
|
||||
PieChart,
|
||||
BarChart,
|
||||
TransactionTable,
|
||||
TodoList,
|
||||
BoxCard
|
||||
},
|
||||
|
@ -1,11 +1,36 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export default {
|
||||
getDept() {
|
||||
getDept(pageSize, pageNo) {
|
||||
return request({
|
||||
url: `/commonAction.do?eventcode=query_data&funid=queryevent&pagetype=editgrid&query_funid=sys_dept&user_id=administrator`,
|
||||
method: 'post',
|
||||
data: `start=0&limit=50&where_sql=&where_value=&where_type=&is_query=1&query_type=0`
|
||||
data: `start=${pageNo}&limit=${pageSize}&where_sql=&where_value=&where_type=&is_query=1&query_type=0`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
Crerte(data) {
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `${data}`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
auditSave(data) {
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `${data}`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
Delete(ids) {
|
||||
let keys = ''
|
||||
ids.forEach(d => {
|
||||
keys += 'keyid=' + d + '&'
|
||||
})
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `funid=sys_dept&${keys}pagetype=editgrid&eventcode=delete_eg&user_id=administrator&dataType=json`
|
||||
}).then(response => response.data)
|
||||
}
|
||||
}
|
||||
|
92
src/views/guide/components/auditDept.vue
Normal file
92
src/views/guide/components/auditDept.vue
Normal file
@ -0,0 +1,92 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card>
|
||||
<el-form ref="auditForm" :model="form" :rules="rules">
|
||||
<el-form-item label="所属部门" :label-width="formLabelWidth">
|
||||
<el-select v-model="id" placeholder="请选择" disabled>
|
||||
<el-option
|
||||
v-for="item in data"
|
||||
:key="item.sys_dept__dept_id"
|
||||
:label="item.sys_dept__dept_name"
|
||||
:value="item.sys_dept__dept_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门编码" :label-width="formLabelWidth" prop="sys_dept__dept_code">
|
||||
<el-input v-model="form.sys_dept__dept_code" @change="change" />
|
||||
</el-form-item>
|
||||
<el-form-item label="部门名称" :label-width="formLabelWidth" prop="sys_dept__dept_name">
|
||||
<el-input v-model="form.sys_dept__dept_name" @change="change" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" :label-width="formLabelWidth" prop="sys_dept__memo">
|
||||
<el-input v-model="form.sys_dept__memo" @change="change" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否注销" :label-width="formLabelWidth">
|
||||
<el-select v-model="form.sys_dept__is_novalid" placeholder="请选择" @change="change">
|
||||
<el-option
|
||||
v-for="item in novalid"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
id: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
data: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
auditForm: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
novalid: [
|
||||
{
|
||||
value: '0',
|
||||
label: '否'
|
||||
}, {
|
||||
value: '1',
|
||||
label: '是'
|
||||
}
|
||||
],
|
||||
rules: {
|
||||
sys_dept__dept_code: [
|
||||
{ required: true, message: '请输入部门编码', trigger: 'blur' }
|
||||
],
|
||||
sys_dept__dept_name: [
|
||||
{ required: true, message: '请输入部门名称', trigger: 'blur' }
|
||||
|
||||
]
|
||||
},
|
||||
formLabelWidth: '120px',
|
||||
form: {}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.form = JSON.parse(JSON.stringify(this.auditForm))
|
||||
},
|
||||
methods: {
|
||||
change() {
|
||||
this.$emit('change', this.form)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
@ -7,10 +7,13 @@
|
||||
v-loading="loading"
|
||||
:data="data"
|
||||
style="width: 100%"
|
||||
@selection-change="handleSelectionChange"
|
||||
@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"
|
||||
@ -21,6 +24,10 @@
|
||||
scope.row.sys_dept__is_novalid == 0 ? '否' : '是'
|
||||
}}
|
||||
</div>
|
||||
<div v-else-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)" />
|
||||
</div>
|
||||
<div v-else>{{ scope.row[d.prop] }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -36,54 +43,133 @@
|
||||
@current-change="pageChange"
|
||||
/>
|
||||
</el-card>
|
||||
<el-dialog v-if="dialogFormVisible" title="新增部门" :visible.sync="dialogFormVisible" @close="closeDialog">
|
||||
<el-form ref="form" :model="form" :rules="rules">
|
||||
<el-form-item label="所属部门" :label-width="formLabelWidth">
|
||||
<el-select v-model="dept_id" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in data"
|
||||
:key="item.sys_dept__dept_id"
|
||||
:label="item.sys_dept__dept_name"
|
||||
:value="item.sys_dept__dept_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门编码" :label-width="formLabelWidth" prop="dept_code">
|
||||
<el-input v-model="form.dept_code" />
|
||||
</el-form-item>
|
||||
<el-form-item label="部门名称" :label-width="formLabelWidth" prop="dept_name">
|
||||
<el-input v-model="form.dept_name" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" :label-width="formLabelWidth" prop="memo">
|
||||
<el-input v-model="form.memo" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="create">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<el-dialog v-if="dialogEditVisible" title="部门" :visible.sync="dialogEditVisible" @close="closeDialog">
|
||||
<AdutiDept :id="parent_id" ref="auditForm" :audit-form="auditForm" :data="data" @change="auditFormChange" />
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogEditVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="save">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import api from './api'
|
||||
import buttons from '@/components/Buttons'
|
||||
|
||||
import AdutiDept from './components/auditDept'
|
||||
export default {
|
||||
name: 'Guide',
|
||||
components: {
|
||||
buttons
|
||||
buttons,
|
||||
AdutiDept
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
data: [],
|
||||
ids: [],
|
||||
pager: {
|
||||
pageNo: 1,
|
||||
pageNo: 0,
|
||||
pageSize: 10,
|
||||
total: 0
|
||||
},
|
||||
tableHeader: [{
|
||||
prop: 'sys_dept__dept_code',
|
||||
label: '组织编码'
|
||||
}, {
|
||||
prop: 'sys_dept__dept_name',
|
||||
label: '组织名称'
|
||||
}, {
|
||||
prop: 'sys_dept__memo',
|
||||
label: '备注'
|
||||
}, {
|
||||
prop: 'sys_dept__is_novalid',
|
||||
label: '是否注销'
|
||||
}]
|
||||
tableHeader: [
|
||||
{
|
||||
prop: 'selection',
|
||||
type: 'selection',
|
||||
fixed: 'left'
|
||||
}, {
|
||||
prop: 'sys_dept__dept_code',
|
||||
label: '组织编码'
|
||||
}, {
|
||||
prop: 'sys_dept__dept_name',
|
||||
label: '组织名称'
|
||||
}, {
|
||||
prop: 'sys_dept__memo',
|
||||
label: '备注'
|
||||
}, {
|
||||
prop: 'sys_dept__is_novalid',
|
||||
label: '是否注销'
|
||||
},
|
||||
{
|
||||
prop: 'opration',
|
||||
label: '操作',
|
||||
width: '70px',
|
||||
fixed: 'right',
|
||||
minWidth: '70px',
|
||||
show: true
|
||||
}],
|
||||
value: '',
|
||||
dept_id: '',
|
||||
id: '',
|
||||
parent_id: '',
|
||||
form: {
|
||||
dept_name: '',
|
||||
dept_code: '',
|
||||
memo: ''
|
||||
},
|
||||
rules: {
|
||||
dept_code: [
|
||||
{ required: true, message: '请输入部门编码', trigger: 'blur' }
|
||||
],
|
||||
dept_name: [
|
||||
{ required: true, message: '请输入部门名称', trigger: 'blur' }
|
||||
|
||||
]
|
||||
},
|
||||
dialogFormVisible: false,
|
||||
dialogEditVisible: false,
|
||||
formLabelWidth: '120px',
|
||||
auditForm: {},
|
||||
saveFrom: {}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getDate()
|
||||
this.getList()
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
getDate() {
|
||||
getList() {
|
||||
this.loading = true
|
||||
api.getDept().then(data => {
|
||||
let pageNo = this.pager.pageNo * this.pager.pageSize - this.pager.pageSize
|
||||
if (pageNo < 0) {
|
||||
pageNo = 0
|
||||
}
|
||||
api.getDept(
|
||||
this.pager.pageSize,
|
||||
pageNo
|
||||
).then(data => {
|
||||
if (data.success) {
|
||||
console.log(data)
|
||||
this.data = data.data.root
|
||||
this.pager.total = data.data.total
|
||||
setTimeout(() => {
|
||||
this.loading = false
|
||||
}, 200)
|
||||
@ -93,10 +179,54 @@ export default {
|
||||
})
|
||||
},
|
||||
editCreate() {
|
||||
console.log('editCreate')
|
||||
if (this.ids === null) {
|
||||
this.$message.warning('请选择一个组织再添加下属组织')
|
||||
} else if (this.ids.length !== 1) {
|
||||
this.$message.warning('请选择一个组织再添加下属组织')
|
||||
} else {
|
||||
this.dialogFormVisible = true
|
||||
this.dept_id = this.ids[0]
|
||||
}
|
||||
},
|
||||
create() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
const data = `funid= sys_dept&parentId= ${this.dept_id}&levelCol= sys_dept.dept_level&keyid= &pagetype= editgrid&eventcode= save_eg&sys_dept__dept_code= ${this.form.dept_code}&sys_dept__dept_name= ${this.form.dept_name}&sys_dept__memo= ${this.form.memo}&sys_dept__is_novalid= 0&sys_dept__dept_id= &sys_dept__dept_level= &user_id= administrator&dataType= json`
|
||||
api.Crerte(data).then(data => {
|
||||
if (data.success) {
|
||||
this.getList()
|
||||
this.dialogFormVisible = false
|
||||
this.$refs['form'].resetFields()
|
||||
this.form.dept_name = ''
|
||||
this.form.dept_code = ''
|
||||
this.$message.success('新增成功!')
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
Delete(row) {
|
||||
this.ids = []
|
||||
this.ids.push(row.sys_dept__dept_id)
|
||||
this.editDelete()
|
||||
},
|
||||
editDelete() {
|
||||
console.log('editDelete')
|
||||
if (this.ids && this.ids.length > 0) {
|
||||
this.$confirm('确认删除部门?').then(() => {
|
||||
api.Delete(this.ids).then(data => {
|
||||
if (data.success) {
|
||||
this.getList()
|
||||
this.$message.success('删除成功!')
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
}).catch(() => {})
|
||||
} else {
|
||||
this.$message.warning('请选择数据进行删除')
|
||||
}
|
||||
},
|
||||
editSave() {
|
||||
console.log('editSave')
|
||||
@ -104,7 +234,61 @@ export default {
|
||||
upload() {
|
||||
console.log('upload')
|
||||
},
|
||||
cellDblclick() {}
|
||||
edit(row) {
|
||||
this.id = row.sys_dept__dept_id
|
||||
this.parent_id = this.id.substring(0, this.id.length - 4)
|
||||
console.log(this.parent_id, this.id)
|
||||
this.auditForm = row
|
||||
this.dialogEditVisible = true
|
||||
},
|
||||
auditFormChange(form) {
|
||||
this.saveFrom = form
|
||||
},
|
||||
save() {
|
||||
console.log(this.saveFrom, 'this.saveFrom')
|
||||
console.log(this.auditForm, 'this.auditForm')
|
||||
if (Object.keys(this.saveFrom).length === 0) {
|
||||
this.saveFrom = this.auditForm
|
||||
}
|
||||
this.$refs.auditForm.$refs.auditForm.validate(valid => {
|
||||
if (valid) {
|
||||
const _form = `funid=sys_dept&parentId=&levelCol=sys_dept.dept_level&keyid=${this.id}&pagetype=editgrid&eventcode=save_eg&sys_dept__dept_code=${this.saveFrom.sys_dept__dept_code}&sys_dept__dept_name=${this.saveFrom.sys_dept__dept_name}&sys_dept__memo=${this.saveFrom.sys_dept__memo}&sys_dept__is_novalid=${this.saveFrom.sys_dept__is_novalid}&sys_dept__dept_id=${this.id}&sys_dept__dept_level=3&user_id=administrator&dataType=json`
|
||||
api.auditSave(_form).then(data => {
|
||||
if (data.success) {
|
||||
this.getList()
|
||||
this.$message.success('保存成功!')
|
||||
this.dialogEditVisible = false
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
cellDblclick(row) {
|
||||
console.log(row, 'row')
|
||||
this.id = row.sys_dept__dept_id
|
||||
this.auditForm = row
|
||||
this.saveFrom = []
|
||||
this.dialogEditVisible = true
|
||||
},
|
||||
sizeChange(size) {
|
||||
this.pager.pageSize = size
|
||||
this.getList()
|
||||
},
|
||||
pageChange(page) {
|
||||
this.pager.pageNo = page
|
||||
this.getList()
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.ids = val.map(d => d.sys_dept__dept_id)
|
||||
},
|
||||
closeDialog() {
|
||||
this.dialogFormVisible = false
|
||||
this.$refs['form'].resetFields()
|
||||
this.form.dept_name = ''
|
||||
this.form.dept_code = ''
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
0
src/views/hidden_check/index.vue
Normal file
0
src/views/hidden_check/index.vue
Normal file
0
src/views/hidden_reform/index.vue
Normal file
0
src/views/hidden_reform/index.vue
Normal file
0
src/views/hidden_review/index.vue
Normal file
0
src/views/hidden_review/index.vue
Normal file
13
src/views/insp_name/index.vue
Normal file
13
src/views/insp_name/index.vue
Normal file
@ -0,0 +1,13 @@
|
||||
<template>
|
||||
<div>123</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
63
src/views/safe_insp/api/index.js
Normal file
63
src/views/safe_insp/api/index.js
Normal file
@ -0,0 +1,63 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export default {
|
||||
getDate(pageSize, pageNo, isWhereSql, whereValue) {
|
||||
let whereSql = ''
|
||||
let whereType = ''
|
||||
if (isWhereSql) {
|
||||
whereSql = `dept_id like ?`
|
||||
whereType = 'string'
|
||||
}
|
||||
return request({
|
||||
url: `commonAction.do?eventcode=query_data&funid=queryevent&pagetype=grid&query_funid=safe_insp&user_id=administrator`,
|
||||
method: 'post',
|
||||
data: `start=${pageNo}&limit=${pageSize}&where_sql=${whereSql}&where_value=${whereValue}&where_type=${whereType}&is_query=1&query_type=0`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
getDeptTree() {
|
||||
return request({
|
||||
url: `/commonAction.do?eventcode=query_data&funid=queryevent&pagetype=editgrid&query_funid=sys_dept&user_id=administrator`,
|
||||
method: 'post',
|
||||
data: `start=0&limit=10000&where_sql=&where_value=&where_type=&is_query=1&query_type=0`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
Crerte(data) {
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `${data}`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
auditSave(data) {
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `${data}`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
Delete(ids) {
|
||||
let keys = ''
|
||||
ids.forEach(d => {
|
||||
keys += 'keyid=' + d + '&'
|
||||
})
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `funid=sys_dept&${keys}pagetype=editgrid&eventcode=delete_eg&user_id=administrator&dataType=json`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
getFormDate(id) {
|
||||
return request({
|
||||
url: `/commonAction.do?eventcode=query_data&funid=queryevent&pagetype=grid&query_funid=safe_insp&user_id=administrator`,
|
||||
method: 'post',
|
||||
data: `start=0&limit=10&where_sql=safe_insp.safe_insp_id = ?&where_value=${id}&where_type=string&is_query=1&query_type=0`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
Save(data) {
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `funid=safe_insp&keyid=${data.safe_insp__safe_insp_id}&safe_insp__insp_code=${data.safe_insp__insp_code}&safe_insp__insp_name=${data.safe_insp__insp_name}&safe_insp__insp_man=${data.safe_insp__insp_man}&safe_insp__insp_times=${data.safe_insp__insp_times}&safe_insp__insp_name_id=${data.safe_insp__insp_name_id}&safe_insp__org_id=${data.safe_insp__org_id}&safe_insp__insp_state=${data.safe_insp__insp_state}&safe_insp__insp_date=${data.safe_insp__insp_date}&safe_insp__insp_memo=${data.safe_insp__insp_memo}&safe_insp__safe_insp_id=${data.safe_insp__safe_insp_id}&safe_insp__dept_id=${data.safe_insp__dept_id}&safe_insp__insp_man_id=${data.safe_insp__insp_man_id}&safe_insp__insp_ed=&safe_insp__insp_ing=${data.safe_insp__insp_ing}&safe_insp__insp_non=&pagetype=form&eventcode=save&dirtyfields=safe_insp.insp_man;safe_insp.insp_times;safe_insp.insp_date;safe_insp.insp_memo;safe_insp.insp_man_id;safe_insp.insp_name;safe_insp.insp_name_id;&fkValue=&user_id=administrator&dataType=json`
|
||||
}).then(response => response.data)
|
||||
}
|
||||
}
|
196
src/views/safe_insp/components/edit_form/index.vue
Normal file
196
src/views/safe_insp/components/edit_form/index.vue
Normal file
@ -0,0 +1,196 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card>
|
||||
<buttons funid="safe_insp" style="margin-bottom:20px" @save="save" />
|
||||
<el-form ref="form" :model="form" label-width="80px">
|
||||
<el-row>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="巡检单编号">
|
||||
<el-input v-model="form.safe_insp__insp_code" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="巡检状态">
|
||||
<el-select v-model="form.safe_insp__insp_state" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
:key="item.funall_control__value_data"
|
||||
:label="item.funall_control__display_data"
|
||||
:value="item.funall_control__value_data"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="巡检名称">
|
||||
<el-input v-model="form.safe_insp__insp_name" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="巡检日期">
|
||||
<el-date-picker
|
||||
v-model="form.safe_insp__insp_date"
|
||||
type="date"
|
||||
placeholder="选择日期"
|
||||
style="width: 100%;"
|
||||
format="yyyy-MM-dd"
|
||||
value-format="yyyy-MM-dd"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="巡检人员">
|
||||
<el-input v-model="form.safe_insp__insp_man" placeholder="请输入内容" class="input-with-select" clearable>
|
||||
<el-button slot="append" icon="el-icon-search" @click="selUserVisible = !selUserVisible" />
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="form.safe_insp__insp_memo" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="巡检频率">
|
||||
<el-input v-model="form.safe_insp__insp_times" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="已巡检数量">
|
||||
<el-input v-model="form.safe_insp__insp_ed" disabled="disabled" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="待巡检数量">
|
||||
<el-input v-model="form.safe_insp__insp_ing" disabled="disabled" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="不符合数量">
|
||||
<el-input v-model="form.safe_insp__insp_non" disabled="disabled" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<InspDet :id="id" />
|
||||
<el-dialog
|
||||
v-if="selUserVisible"
|
||||
title="选择人员"
|
||||
:visible.sync="selUserVisible"
|
||||
width="60%"
|
||||
>
|
||||
<SelUser @updateUsers="updateUsers" @updateUser="updateUser" />
|
||||
<span>
|
||||
<el-button @click="selUserVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="selUserVisible = false">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import api from '../../api'
|
||||
import publicApi from '@/api/public'
|
||||
import buttons from '@/components/formBtn'
|
||||
import InspDet from '../insp_det'
|
||||
import SelUser from '@/components/selUser'
|
||||
export default {
|
||||
name: 'EditForm',
|
||||
components: {
|
||||
buttons,
|
||||
SelUser,
|
||||
InspDet
|
||||
},
|
||||
// props: {
|
||||
// id: { type: String, default: () => '' }
|
||||
// },
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
form: {},
|
||||
id: this.$route.params.id,
|
||||
disabled: false,
|
||||
options: [],
|
||||
selUserVisible: false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
console.log(this.id)
|
||||
this.getList()
|
||||
this.getTypeSel()
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
this.loading = true
|
||||
api.getFormDate(this.id).then(data => {
|
||||
if (data.success) {
|
||||
this.form = data.data.root[0]
|
||||
setTimeout(() => {
|
||||
this.loading = false
|
||||
}, 200)
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
async getTypeSel() {
|
||||
await publicApi.getTypeSel('insptimes').then(data => {
|
||||
if (data.success) {
|
||||
this.options = data.data.root
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
onSubmit() {},
|
||||
updateUser(data) {
|
||||
this.form.safe_insp__insp_man = data.sys_user__user_name
|
||||
this.form.safe_insp__insp_man_id = data.sys_user__user_id
|
||||
this.selUserVisible = false
|
||||
},
|
||||
updateUsers(data) {
|
||||
this.form.safe_insp__insp_man = data.map(d => { return d.sys_user__user_name }).join(';')
|
||||
this.form.safe_insp__insp_man_id = data.map(d => { return d.sys_user__user_id }).join(';')
|
||||
},
|
||||
save() {
|
||||
api.Save(this.form).then(data => {
|
||||
if (data.success) {
|
||||
this.$message.success('保存成功!')
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
back() {
|
||||
// this.$router.back(-1)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
::v-deep .el-dialog__body {
|
||||
padding: 10px 20px !important;
|
||||
}
|
||||
::v-deep .el-form-item__label {
|
||||
text-align: right;
|
||||
/* vertical-align: middle; */
|
||||
float: left;
|
||||
font-size: 14px;
|
||||
color: #606266;
|
||||
line-height: 40px;
|
||||
padding: 0 6px 0 0;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.el-col{
|
||||
margin-left: 2%;
|
||||
}
|
||||
</style>
|
63
src/views/safe_insp/components/insp_det/api/index.js
Normal file
63
src/views/safe_insp/components/insp_det/api/index.js
Normal file
@ -0,0 +1,63 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export default {
|
||||
getDate(id, pageSize, pageNo, isWhereSql, whereValue) {
|
||||
let whereSql = ''
|
||||
let whereType = ''
|
||||
if (isWhereSql) {
|
||||
whereSql = `dept_id like ?`
|
||||
whereType = 'string'
|
||||
}
|
||||
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 = ?)${whereSql}&where_value=${id}${whereValue}&where_type=string${whereType}&is_query=1&query_type=0`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
getDeptTree() {
|
||||
return request({
|
||||
url: `/commonAction.do?eventcode=query_data&funid=queryevent&pagetype=editgrid&query_funid=sys_dept&user_id=administrator`,
|
||||
method: 'post',
|
||||
data: `start=0&limit=10000&where_sql=&where_value=&where_type=&is_query=1&query_type=0`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
Crerte(data) {
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `${data}`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
auditSave(data) {
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `${data}`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
Delete(ids) {
|
||||
let keys = ''
|
||||
ids.forEach(d => {
|
||||
keys += 'keyid=' + d + '&'
|
||||
})
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `funid=insp_det&${keys}pagetype=editgrid&eventcode=delete_eg&user_id=administrator&dataType=json`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
getFormDate(id) {
|
||||
return request({
|
||||
url: `/commonAction.do?eventcode=query_data&funid=queryevent&pagetype=grid&query_funid=safe_insp&user_id=administrator`,
|
||||
method: 'post',
|
||||
data: `start=0&limit=10&where_sql=safe_insp.safe_insp_id = ?&where_value=${id}&where_type=string&is_query=1&query_type=0`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
Save(data) {
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `funid=safe_insp&keyid=${data.safe_insp__safe_insp_id}&safe_insp__insp_code=${data.safe_insp__insp_code}&safe_insp__insp_name=${data.safe_insp__insp_name}&safe_insp__insp_man=${data.safe_insp__insp_man}&safe_insp__insp_times=${data.safe_insp__insp_times}&safe_insp__insp_name_id=${data.safe_insp__insp_name_id}&safe_insp__org_id=${data.safe_insp__org_id}&safe_insp__insp_state=${data.safe_insp__insp_state}&safe_insp__insp_date=${data.safe_insp__insp_date}&safe_insp__insp_memo=${data.safe_insp__insp_memo}&safe_insp__safe_insp_id=${data.safe_insp__safe_insp_id}&safe_insp__dept_id=${data.safe_insp__dept_id}&safe_insp__insp_man_id=${data.safe_insp__insp_man_id}&safe_insp__insp_ed=&safe_insp__insp_ing=${data.safe_insp__insp_ing}&safe_insp__insp_non=&pagetype=form&eventcode=save&dirtyfields=safe_insp.insp_man;safe_insp.insp_times;safe_insp.insp_date;safe_insp.insp_memo;safe_insp.insp_man_id;safe_insp.insp_name;safe_insp.insp_name_id;&fkValue=&user_id=administrator&dataType=json`
|
||||
}).then(response => response.data)
|
||||
}
|
||||
}
|
303
src/views/safe_insp/components/insp_det/index.vue
Normal file
303
src/views/safe_insp/components/insp_det/index.vue
Normal file
@ -0,0 +1,303 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-card>
|
||||
<buttons funid="safe_insp" style="margin-bottom:10px" @Create="editCreate" @Del="editDelete" />
|
||||
<el-table
|
||||
ref="deptTable"
|
||||
v-loading="loading"
|
||||
:data="data"
|
||||
style="width: 100%"
|
||||
@selection-change="handleSelectionChange"
|
||||
@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 slot-scope="scope">
|
||||
<div v-if="d.label==='巡检结果'">
|
||||
{{
|
||||
scope.row.insp_det__det_result === '1' ? '符合' : scope.row.insp_det__det_result === '0' ? '不符合' : null
|
||||
}}
|
||||
</div>
|
||||
<div v-else-if="d.label==='是否已整改'">
|
||||
{{
|
||||
scope.row.insp_det__reform_flag === '1' ? '已整改' : scope.row.insp_det__reform_flag === '0' ? '未整改' : null
|
||||
}}
|
||||
</div>
|
||||
<div v-else-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)" />
|
||||
</div>
|
||||
<div v-else>{{ scope.row[d.prop] }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</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>
|
||||
|
||||
<el-dialog v-if="dialogFormVisible" :title="title" :visible.sync="dialogFormVisible" @close="closeDialog">
|
||||
<el-form ref="form" :model="form" :rules="rules">
|
||||
<el-form-item label="巡检结果" :label-width="formLabelWidth" prop="insp_det__det_result">
|
||||
<el-select v-model="form.insp_det__det_result" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in inspresult"
|
||||
:key="item.funall_control__value_data"
|
||||
:label="item.funall_control__display_data"
|
||||
:value="item.funall_control__value_data"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="不符合描述" :label-width="formLabelWidth" prop="det_desc">
|
||||
<el-input v-model="form.insp_det__det_desc" type="textarea" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="create">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import api from './api'
|
||||
import publicApi from '@/api/public'
|
||||
import buttons from '@/components/Buttons'
|
||||
export default {
|
||||
name: 'SafeIdsp',
|
||||
components: {
|
||||
buttons
|
||||
},
|
||||
props: {
|
||||
id: {
|
||||
type: String,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
data: [],
|
||||
deptTree: [],
|
||||
ids: [],
|
||||
levels: [],
|
||||
pager: {
|
||||
pageNo: 0,
|
||||
pageSize: 10,
|
||||
total: 0
|
||||
},
|
||||
tableHeader: [
|
||||
{
|
||||
prop: 'selection',
|
||||
type: 'selection',
|
||||
fixed: 'left'
|
||||
}, {
|
||||
prop: 'insp_det__det_name',
|
||||
label: '巡检项目'
|
||||
}, {
|
||||
prop: 'insp_det__det_std',
|
||||
label: '巡检标准'
|
||||
},
|
||||
{
|
||||
prop: 'insp_det__det_way',
|
||||
label: '巡检方法'
|
||||
}, {
|
||||
prop: 'insp_det__det_result',
|
||||
label: '巡检结果'
|
||||
},
|
||||
{
|
||||
prop: 'insp_det__det_desc',
|
||||
label: '不符合描述'
|
||||
},
|
||||
{
|
||||
prop: 'insp_det__reform_flag',
|
||||
label: '是否已整改'
|
||||
},
|
||||
{
|
||||
prop: 'opration',
|
||||
label: '操作',
|
||||
width: '70px',
|
||||
fixed: 'right',
|
||||
minWidth: '70px',
|
||||
show: true
|
||||
}],
|
||||
value: '',
|
||||
dept_id: '',
|
||||
level: '',
|
||||
parent_id: '',
|
||||
initFrom: {
|
||||
det_desc: '',
|
||||
insp_det__det_desc: '',
|
||||
insp_det__det_name: '',
|
||||
insp_det__det_name_id: '',
|
||||
insp_det__det_result: '',
|
||||
insp_det__det_std: '',
|
||||
insp_det__det_way: '',
|
||||
insp_det__insp_det_id: '',
|
||||
insp_det__reform_flag: '',
|
||||
insp_det__safe_insp_id: ''
|
||||
},
|
||||
form: {},
|
||||
rules: {
|
||||
insp_det__det_result: [
|
||||
{ required: true, message: '请选择巡检结果', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
dialogFormVisible: false,
|
||||
dialogEditVisible: false,
|
||||
formLabelWidth: '120px',
|
||||
auditForm: {},
|
||||
saveFrom: {},
|
||||
treeData: [],
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'sys_dept__dept_name'
|
||||
},
|
||||
treeList: [],
|
||||
whereSql: false,
|
||||
whereValue: ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
this.getTypeSel()
|
||||
},
|
||||
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.id,
|
||||
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.form = this.initFrom
|
||||
this.dialogFormVisible = true
|
||||
},
|
||||
edit(row) {
|
||||
console.log(row, 'row')
|
||||
this.title = '编辑'
|
||||
this.form = row
|
||||
this.dialogFormVisible = true
|
||||
},
|
||||
create() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
const data = `funid=insp_det&fkValue=${this.id}&pfunid=safe_insp&keyid=${this.form.insp_det__insp_det_id}&pagetype=editgrid&eventcode=save_eg&insp_det__det_name=${this.form.insp_det__det_name}&insp_det__det_std=${this.form.insp_det__det_std}&insp_det__det_way=${this.form.insp_det__det_way}&insp_det__det_result=${this.form.insp_det__det_result}&insp_det__det_desc=${this.form.insp_det__det_desc}&insp_det__reform_flag=${this.form.insp_det__reform_flag}&insp_det__safe_insp_id=${this.id}&insp_det__insp_det_id=${this.form.insp_det__insp_det_id}&insp_det__det_name_id=${this.form.insp_det__insp_det_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)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
Delete(row) {
|
||||
this.ids = []
|
||||
this.ids.push(row.insp_det__insp_det_id)
|
||||
this.editDelete()
|
||||
},
|
||||
editDelete() {
|
||||
if (this.ids && this.ids.length > 0) {
|
||||
this.$confirm('确认删除?').then(() => {
|
||||
api.Delete(this.ids).then(data => {
|
||||
if (data.success) {
|
||||
this.getList()
|
||||
this.$message.success('删除成功!')
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
}).catch(() => {})
|
||||
} else {
|
||||
this.$message.warning('请选择数据进行删除')
|
||||
}
|
||||
},
|
||||
auditFormChange(form) {
|
||||
this.saveFrom = form
|
||||
},
|
||||
cellDblclick(row) {
|
||||
this.title = '编辑'
|
||||
this.form = row
|
||||
this.dialogFormVisible = true
|
||||
},
|
||||
sizeChange(size) {
|
||||
this.pager.pageSize = size
|
||||
this.getList()
|
||||
},
|
||||
pageChange(page) {
|
||||
this.pager.pageNo = page
|
||||
this.getList()
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.ids = val.map(d => d.insp_det__insp_det_id)
|
||||
console.log(this.ids, 'this.ids')
|
||||
},
|
||||
closeDialog() {
|
||||
this.dialogFormVisible = false
|
||||
this.$refs['form'].resetFields()
|
||||
this.form.dept_name = ''
|
||||
this.form.dept_code = ''
|
||||
},
|
||||
handleNodeClick(data) {
|
||||
console.log(data)
|
||||
this.whereValue = encodeURI(`${data.sys_dept__dept_id}\%`)
|
||||
this.whereSql = true
|
||||
this.getList()
|
||||
},
|
||||
async getTypeSel() {
|
||||
await publicApi.getTypeSel('inspresult').then(data => {
|
||||
if (data.success) {
|
||||
this.inspresult = data.data.root
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.el-card {
|
||||
margin-top: 10px;
|
||||
}
|
||||
</style>
|
405
src/views/safe_insp/index.vue
Normal file
405
src/views/safe_insp/index.vue
Normal file
@ -0,0 +1,405 @@
|
||||
<template>
|
||||
<div>
|
||||
<buttons funid="insp_det" style="margin:10px 10px" @editCreate="editCreate" @editDelete="editDelete" @editSave="editSave" @upload="upload" />
|
||||
<el-card>
|
||||
<el-table
|
||||
ref="deptTable"
|
||||
v-loading="loading"
|
||||
:data="data"
|
||||
style="width: 100%"
|
||||
@selection-change="handleSelectionChange"
|
||||
@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 slot-scope="scope">
|
||||
<div v-if="d.label==='巡检状态'">
|
||||
{{
|
||||
scope.row.ssafe_insp__insp_state == 1 ? '巡检中' : '已巡检'
|
||||
}}
|
||||
</div>
|
||||
<div v-else-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)" />
|
||||
</div>
|
||||
<div v-else>{{ scope.row[d.prop] }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</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>
|
||||
|
||||
<el-dialog v-if="dialogFormVisible" title="新增部门" :visible.sync="dialogFormVisible" @close="closeDialog">
|
||||
<el-form ref="form" :model="form" :rules="rules">
|
||||
<el-form-item label="所属部门" :label-width="formLabelWidth">
|
||||
<el-select v-model="dept_id" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in data"
|
||||
:key="item.sys_dept__dept_id"
|
||||
:label="item.sys_dept__dept_name"
|
||||
:value="item.sys_dept__dept_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门编码" :label-width="formLabelWidth" prop="dept_code">
|
||||
<el-input v-model="form.dept_code" />
|
||||
</el-form-item>
|
||||
<el-form-item label="部门名称" :label-width="formLabelWidth" prop="dept_name">
|
||||
<el-input v-model="form.dept_name" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" :label-width="formLabelWidth" prop="memo">
|
||||
<el-input v-model="form.memo" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="create">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import api from './api'
|
||||
import buttons from '@/components/Buttons'
|
||||
export default {
|
||||
name: 'SafeIdsp',
|
||||
components: {
|
||||
buttons
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
data: [],
|
||||
deptTree: [],
|
||||
ids: [],
|
||||
levels: [],
|
||||
pager: {
|
||||
pageNo: 0,
|
||||
pageSize: 10,
|
||||
total: 0
|
||||
},
|
||||
tableHeader: [
|
||||
{
|
||||
prop: 'selection',
|
||||
type: 'selection',
|
||||
fixed: 'left'
|
||||
}, {
|
||||
prop: 'safe_insp__insp_code',
|
||||
label: '巡检编号'
|
||||
}, {
|
||||
prop: 'safe_insp__insp_name',
|
||||
label: '巡检名称'
|
||||
},
|
||||
{
|
||||
prop: 'safe_insp__insp_state',
|
||||
label: '巡检状态'
|
||||
}, {
|
||||
prop: 'safe_insp__insp_date',
|
||||
label: '巡检日期'
|
||||
},
|
||||
{
|
||||
prop: 'safe_insp__insp_man',
|
||||
label: '巡检人员'
|
||||
},
|
||||
{
|
||||
prop: 'safe_insp__insp_times',
|
||||
label: '巡检频率'
|
||||
},
|
||||
{
|
||||
prop: 'safe_insp__insp_memo',
|
||||
label: '备注'
|
||||
},
|
||||
{
|
||||
prop: 'safe_insp__insp_ed',
|
||||
label: '已巡检数量'
|
||||
},
|
||||
{
|
||||
prop: 'safe_insp__insp_ing',
|
||||
label: '待巡检数量'
|
||||
},
|
||||
{
|
||||
prop: 'safe_insp__insp_non',
|
||||
label: '不符合数量'
|
||||
},
|
||||
{
|
||||
prop: 'opration',
|
||||
label: '操作',
|
||||
width: '70px',
|
||||
fixed: 'right',
|
||||
minWidth: '70px',
|
||||
show: true
|
||||
}],
|
||||
value: '',
|
||||
dept_id: '',
|
||||
level: '',
|
||||
id: '',
|
||||
parent_id: '',
|
||||
form: {
|
||||
dept_name: '',
|
||||
dept_code: '',
|
||||
memo: ''
|
||||
},
|
||||
rules: {
|
||||
dept_code: [
|
||||
{ required: true, message: '请输入部门编码', trigger: 'blur' }
|
||||
],
|
||||
dept_name: [
|
||||
{ required: true, message: '请输入部门名称', trigger: 'blur' }
|
||||
|
||||
]
|
||||
},
|
||||
dialogFormVisible: false,
|
||||
dialogEditVisible: false,
|
||||
formLabelWidth: '120px',
|
||||
auditForm: {},
|
||||
saveFrom: {},
|
||||
treeData: [],
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'sys_dept__dept_name'
|
||||
},
|
||||
treeList: [],
|
||||
whereSql: false,
|
||||
whereValue: ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
this.transitionTree()
|
||||
},
|
||||
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)
|
||||
}
|
||||
})
|
||||
},
|
||||
async transitionTree() {
|
||||
await api.getDeptTree().then(data => {
|
||||
if (data.success) {
|
||||
this.deptTree = data.data.root
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
this.treeData = []
|
||||
let data = []
|
||||
data = this.deptTree.sort((a, b) => {
|
||||
return a.sys_dept__dept_id - b.sys_dept__dept_id
|
||||
})
|
||||
const oneTreeList = data.filter(d => {
|
||||
return d.sys_dept__dept_level === '1'
|
||||
})
|
||||
for (let i = 0; i < oneTreeList.length; i++) {
|
||||
const treeList = data.filter(d => {
|
||||
return d.sys_dept__dept_id.substring(0, 4).indexOf(oneTreeList[i].sys_dept__dept_id) > -1
|
||||
})
|
||||
treeList.forEach(d => {
|
||||
d.children = []
|
||||
if (d.sys_dept__dept_level === '1') {
|
||||
this.treeData.push(d)
|
||||
} else if (d.sys_dept__dept_level === '2') {
|
||||
this.treeData[i].children.push(d)
|
||||
} else if (d.sys_dept__dept_level === '3') {
|
||||
this.treeData[i].children.forEach((threeVal, three) => {
|
||||
if (d.sys_dept__dept_id.substring(0, 8).indexOf(threeVal.sys_dept__dept_id) > -1) {
|
||||
this.treeData[i].children[three].children.push(d)
|
||||
}
|
||||
})
|
||||
} else if (d.sys_dept__dept_level === '4') {
|
||||
this.treeData[i].children.forEach((threeVal, three) => {
|
||||
threeVal.children.forEach((fourVal, four) => {
|
||||
if (d.sys_dept__dept_id.substring(0, 12).indexOf(fourVal.sys_dept__dept_id) > -1) {
|
||||
this.treeData[i].children[three].children[four].children.push(d)
|
||||
}
|
||||
})
|
||||
})
|
||||
} else if (d.sys_dept__dept_level === '5') {
|
||||
this.treeData[i].children.forEach((threeVal, three) => {
|
||||
threeVal.children.forEach((fourVal, four) => {
|
||||
fourVal.children.forEach((fiveVal, five) => {
|
||||
if (d.sys_dept__dept_id.substring(0, 16).indexOf(fiveVal.sys_dept__dept_id) > -1) {
|
||||
this.treeData[i].children[three].children[four].children[five].children.push(d)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
} else if (d.sys_dept__dept_level === '6') {
|
||||
this.treeData[i].children.forEach((threeVal, three) => {
|
||||
threeVal.children.forEach((fourVal, four) => {
|
||||
fourVal.children.forEach((fiveVal, five) => {
|
||||
fiveVal.children.forEach((sixVal, six) => {
|
||||
if (d.sys_dept__dept_id.substring(0, 20).indexOf(sixVal.sys_dept__dept_id) > -1) {
|
||||
this.treeData[i].children[three].children[four].children[five].children[six].children.push(d)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
console.log(this.treeData, 'this.treeData')
|
||||
}
|
||||
},
|
||||
editCreate() {
|
||||
if (this.ids === null) {
|
||||
this.$message.warning('请选择一个组织再添加下属组织')
|
||||
} else if (this.ids.length !== 1) {
|
||||
this.$message.warning('请选择一个组织再添加下属组织')
|
||||
} else {
|
||||
this.dialogFormVisible = true
|
||||
this.dept_id = this.ids[0]
|
||||
this.level = this.levels[0]
|
||||
}
|
||||
},
|
||||
create() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
const data = `funid=sys_dept&parentId=${this.dept_id}&levelCol=sys_dept.dept_level&keyid=&pagetype=editgrid&eventcode=save_eg&sys_dept__dept_code=${this.form.dept_code}&sys_dept__dept_name=${this.form.dept_name}&sys_dept__memo=${this.form.memo}&sys_dept__is_novalid=0&sys_dept__dept_id=&sys_dept__dept_level=${Number(this.level) + 1}&user_id=administrator&dataType= json`
|
||||
api.Crerte(data).then(data => {
|
||||
if (data.success) {
|
||||
this.getList()
|
||||
this.transitionTree()
|
||||
this.dialogFormVisible = false
|
||||
this.$refs['form'].resetFields()
|
||||
this.form.dept_name = ''
|
||||
this.form.dept_code = ''
|
||||
this.$message.success('新增成功!')
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
Delete(row) {
|
||||
this.ids = []
|
||||
this.ids.push(row.sys_dept__dept_id)
|
||||
this.editDelete()
|
||||
},
|
||||
editDelete() {
|
||||
if (this.ids && this.ids.length > 0) {
|
||||
this.$confirm('确认删除部门?').then(() => {
|
||||
api.Delete(this.ids).then(data => {
|
||||
if (data.success) {
|
||||
this.getList()
|
||||
this.$message.success('删除成功!')
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
}).catch(() => {})
|
||||
} else {
|
||||
this.$message.warning('请选择数据进行删除')
|
||||
}
|
||||
},
|
||||
editSave() {
|
||||
console.log('editSave')
|
||||
},
|
||||
upload() {
|
||||
console.log('upload')
|
||||
},
|
||||
edit(row) {
|
||||
this.id = row.sys_dept__dept_id
|
||||
this.parent_id = this.id.substring(0, this.id.length - 4)
|
||||
console.log(this.parent_id, this.id)
|
||||
this.auditForm = row
|
||||
this.dialogEditVisible = true
|
||||
},
|
||||
auditFormChange(form) {
|
||||
this.saveFrom = form
|
||||
},
|
||||
save() {
|
||||
console.log(this.saveFrom, 'this.saveFrom')
|
||||
console.log(this.auditForm, 'this.auditForm')
|
||||
if (Object.keys(this.saveFrom).length === 0) {
|
||||
this.saveFrom = this.auditForm
|
||||
}
|
||||
this.$refs.auditForm.$refs.auditForm.validate(valid => {
|
||||
if (valid) {
|
||||
const _form = `funid=sys_dept&parentId=&levelCol=sys_dept.dept_level&keyid=${this.id}&pagetype=editgrid&eventcode=save_eg&sys_dept__dept_code=${this.saveFrom.sys_dept__dept_code}&sys_dept__dept_name=${this.saveFrom.sys_dept__dept_name}&sys_dept__memo=${this.saveFrom.sys_dept__memo}&sys_dept__is_novalid=${this.saveFrom.sys_dept__is_novalid}&sys_dept__dept_id=${this.id}&sys_dept__dept_level=${this.saveFrom.sys_dept__dept_level}&user_id=administrator&dataType=json`
|
||||
api.auditSave(_form).then(data => {
|
||||
if (data.success) {
|
||||
this.whereSql = false
|
||||
this.whereValue = ''
|
||||
this.getList()
|
||||
this.$message.success('保存成功!')
|
||||
this.dialogEditVisible = false
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
cellDblclick(row) {
|
||||
const param = `/insp/edit_form/${row.safe_insp__safe_insp_id}`
|
||||
this.$router.push(param)
|
||||
},
|
||||
sizeChange(size) {
|
||||
this.pager.pageSize = size
|
||||
this.getList()
|
||||
},
|
||||
pageChange(page) {
|
||||
this.pager.pageNo = page
|
||||
this.getList()
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.ids = val.map(d => d.sys_dept__dept_id)
|
||||
this.levels = val.map(d => d.sys_dept__dept_level)
|
||||
},
|
||||
closeDialog() {
|
||||
this.dialogFormVisible = false
|
||||
this.$refs['form'].resetFields()
|
||||
this.form.dept_name = ''
|
||||
this.form.dept_code = ''
|
||||
},
|
||||
handleNodeClick(data) {
|
||||
console.log(data)
|
||||
this.whereValue = encodeURI(`${data.sys_dept__dept_id}\%`)
|
||||
this.whereSql = true
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.el-card {
|
||||
margin-top: 10px;
|
||||
}
|
||||
</style>
|
49
src/views/sys_dept/api/index.js
Normal file
49
src/views/sys_dept/api/index.js
Normal file
@ -0,0 +1,49 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export default {
|
||||
getDept(pageSize, pageNo, isWhereSql, whereValue) {
|
||||
let whereSql = ''
|
||||
let whereType = ''
|
||||
if (isWhereSql) {
|
||||
whereSql = `sys_dept.dept_id like ?`
|
||||
whereType = 'string'
|
||||
}
|
||||
return request({
|
||||
url: `/commonAction.do?eventcode=query_data&funid=queryevent&pagetype=editgrid&query_funid=sys_dept&user_id=administrator`,
|
||||
method: 'post',
|
||||
data: `start=${pageNo}&limit=${pageSize}&where_sql=${whereSql}&where_value=${whereValue}&where_type=${whereType}&is_query=1&query_type=0`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
getDeptTree() {
|
||||
return request({
|
||||
url: `/commonAction.do?eventcode=query_data&funid=queryevent&pagetype=editgrid&query_funid=sys_dept&user_id=administrator`,
|
||||
method: 'post',
|
||||
data: `start=0&limit=10000&where_sql=&where_value=&where_type=&is_query=1&query_type=0`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
Crerte(data) {
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `${data}`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
auditSave(data) {
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `${data}`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
Delete(ids) {
|
||||
let keys = ''
|
||||
ids.forEach(d => {
|
||||
keys += 'keyid=' + d + '&'
|
||||
})
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `funid=sys_dept&${keys}pagetype=editgrid&eventcode=delete_eg&user_id=administrator&dataType=json`
|
||||
}).then(response => response.data)
|
||||
}
|
||||
}
|
92
src/views/sys_dept/components/auditDept.vue
Normal file
92
src/views/sys_dept/components/auditDept.vue
Normal file
@ -0,0 +1,92 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card>
|
||||
<el-form ref="auditForm" :model="form" :rules="rules">
|
||||
<el-form-item label="所属部门" :label-width="formLabelWidth">
|
||||
<el-select v-model="id" placeholder="请选择" disabled>
|
||||
<el-option
|
||||
v-for="item in data"
|
||||
:key="item.sys_dept__dept_id"
|
||||
:label="item.sys_dept__dept_name"
|
||||
:value="item.sys_dept__dept_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门编码" :label-width="formLabelWidth" prop="sys_dept__dept_code">
|
||||
<el-input v-model="form.sys_dept__dept_code" @change="change" />
|
||||
</el-form-item>
|
||||
<el-form-item label="部门名称" :label-width="formLabelWidth" prop="sys_dept__dept_name">
|
||||
<el-input v-model="form.sys_dept__dept_name" @change="change" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" :label-width="formLabelWidth" prop="sys_dept__memo">
|
||||
<el-input v-model="form.sys_dept__memo" @change="change" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否注销" :label-width="formLabelWidth">
|
||||
<el-select v-model="form.sys_dept__is_novalid" placeholder="请选择" @change="change">
|
||||
<el-option
|
||||
v-for="item in novalid"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
id: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
data: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
auditForm: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
novalid: [
|
||||
{
|
||||
value: '0',
|
||||
label: '否'
|
||||
}, {
|
||||
value: '1',
|
||||
label: '是'
|
||||
}
|
||||
],
|
||||
rules: {
|
||||
sys_dept__dept_code: [
|
||||
{ required: true, message: '请输入部门编码', trigger: 'blur' }
|
||||
],
|
||||
sys_dept__dept_name: [
|
||||
{ required: true, message: '请输入部门名称', trigger: 'blur' }
|
||||
|
||||
]
|
||||
},
|
||||
formLabelWidth: '120px',
|
||||
form: {}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.form = JSON.parse(JSON.stringify(this.auditForm))
|
||||
},
|
||||
methods: {
|
||||
change() {
|
||||
this.$emit('change', this.form)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
405
src/views/sys_dept/index.vue
Normal file
405
src/views/sys_dept/index.vue
Normal file
@ -0,0 +1,405 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<buttons funid="sys_dept" @editCreate="editCreate" @editDelete="editDelete" @editSave="editSave" @upload="upload" />
|
||||
<el-row>
|
||||
<el-col :span="5">
|
||||
<el-card>
|
||||
<el-tree :data="treeData" default-expand-all :props="defaultProps" @node-click="handleNodeClick" />
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="19">
|
||||
<el-card>
|
||||
<el-table
|
||||
ref="deptTable"
|
||||
v-loading="loading"
|
||||
:data="data"
|
||||
style="width: 100%"
|
||||
stripe
|
||||
@selection-change="handleSelectionChange"
|
||||
@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 slot-scope="scope">
|
||||
<div v-if="d.label==='是否注销'">
|
||||
{{
|
||||
scope.row.sys_dept__is_novalid == 0 ? '否' : '是'
|
||||
}}
|
||||
</div>
|
||||
<div v-else-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)" />
|
||||
</div>
|
||||
<div v-else>{{ scope.row[d.prop] }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</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>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-dialog v-if="dialogFormVisible" title="新增部门" :visible.sync="dialogFormVisible" @close="closeDialog">
|
||||
<el-form ref="form" :model="form" :rules="rules">
|
||||
<el-form-item label="所属部门" :label-width="formLabelWidth">
|
||||
<el-select v-model="dept_id" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in data"
|
||||
:key="item.sys_dept__dept_id"
|
||||
:label="item.sys_dept__dept_name"
|
||||
:value="item.sys_dept__dept_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门编码" :label-width="formLabelWidth" prop="dept_code">
|
||||
<el-input v-model="form.dept_code" />
|
||||
</el-form-item>
|
||||
<el-form-item label="部门名称" :label-width="formLabelWidth" prop="dept_name">
|
||||
<el-input v-model="form.dept_name" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" :label-width="formLabelWidth" prop="memo">
|
||||
<el-input v-model="form.memo" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="create">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<el-dialog v-if="dialogEditVisible" title="部门" :visible.sync="dialogEditVisible" @close="closeDialog">
|
||||
<AdutiDept :id="parent_id" ref="auditForm" :audit-form="auditForm" :data="deptTree" @change="auditFormChange" />
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogEditVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="save">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import api from './api'
|
||||
import buttons from '@/components/Buttons'
|
||||
import AdutiDept from './components/auditDept'
|
||||
export default {
|
||||
name: 'Guide',
|
||||
components: {
|
||||
buttons,
|
||||
AdutiDept
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
data: [],
|
||||
deptTree: [],
|
||||
ids: [],
|
||||
levels: [],
|
||||
pager: {
|
||||
pageNo: 0,
|
||||
pageSize: 10,
|
||||
total: 0
|
||||
},
|
||||
tableHeader: [
|
||||
{
|
||||
prop: 'selection',
|
||||
type: 'selection',
|
||||
fixed: 'left'
|
||||
}, {
|
||||
prop: 'sys_dept__dept_code',
|
||||
label: '组织编码'
|
||||
}, {
|
||||
prop: 'sys_dept__dept_name',
|
||||
label: '组织名称'
|
||||
}, {
|
||||
prop: 'sys_dept__memo',
|
||||
label: '备注'
|
||||
}, {
|
||||
prop: 'sys_dept__is_novalid',
|
||||
label: '是否注销'
|
||||
},
|
||||
{
|
||||
prop: 'opration',
|
||||
label: '操作',
|
||||
width: '70px',
|
||||
fixed: 'right',
|
||||
minWidth: '70px',
|
||||
show: true
|
||||
}],
|
||||
value: '',
|
||||
dept_id: '',
|
||||
level: '',
|
||||
id: '',
|
||||
parent_id: '',
|
||||
form: {
|
||||
dept_name: '',
|
||||
dept_code: '',
|
||||
memo: ''
|
||||
},
|
||||
rules: {
|
||||
dept_code: [
|
||||
{ required: true, message: '请输入部门编码', trigger: 'blur' }
|
||||
],
|
||||
dept_name: [
|
||||
{ required: true, message: '请输入部门名称', trigger: 'blur' }
|
||||
|
||||
]
|
||||
},
|
||||
dialogFormVisible: false,
|
||||
dialogEditVisible: false,
|
||||
formLabelWidth: '120px',
|
||||
auditForm: {},
|
||||
saveFrom: {},
|
||||
treeData: [],
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'sys_dept__dept_name'
|
||||
},
|
||||
treeList: [],
|
||||
whereSql: false,
|
||||
whereValue: ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
this.transitionTree()
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
this.loading = true
|
||||
let pageNo = this.pager.pageNo * this.pager.pageSize - this.pager.pageSize
|
||||
if (pageNo < 0) {
|
||||
pageNo = 0
|
||||
}
|
||||
api.getDept(
|
||||
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)
|
||||
}
|
||||
})
|
||||
},
|
||||
async transitionTree() {
|
||||
await api.getDeptTree().then(data => {
|
||||
if (data.success) {
|
||||
this.deptTree = data.data.root
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
this.treeData = []
|
||||
let data = []
|
||||
data = this.deptTree.sort((a, b) => {
|
||||
return a.sys_dept__dept_id - b.sys_dept__dept_id
|
||||
})
|
||||
const oneTreeList = data.filter(d => {
|
||||
return d.sys_dept__dept_level === '1'
|
||||
})
|
||||
for (let i = 0; i < oneTreeList.length; i++) {
|
||||
const treeList = data.filter(d => {
|
||||
return d.sys_dept__dept_id.substring(0, 4).indexOf(oneTreeList[i].sys_dept__dept_id) > -1
|
||||
})
|
||||
treeList.forEach(d => {
|
||||
d.children = []
|
||||
if (d.sys_dept__dept_level === '1') {
|
||||
this.treeData.push(d)
|
||||
} else if (d.sys_dept__dept_level === '2') {
|
||||
this.treeData[i].children.push(d)
|
||||
} else if (d.sys_dept__dept_level === '3') {
|
||||
this.treeData[i].children.forEach((threeVal, three) => {
|
||||
if (d.sys_dept__dept_id.substring(0, 8).indexOf(threeVal.sys_dept__dept_id) > -1) {
|
||||
this.treeData[i].children[three].children.push(d)
|
||||
}
|
||||
})
|
||||
} else if (d.sys_dept__dept_level === '4') {
|
||||
this.treeData[i].children.forEach((threeVal, three) => {
|
||||
threeVal.children.forEach((fourVal, four) => {
|
||||
if (d.sys_dept__dept_id.substring(0, 12).indexOf(fourVal.sys_dept__dept_id) > -1) {
|
||||
this.treeData[i].children[three].children[four].children.push(d)
|
||||
}
|
||||
})
|
||||
})
|
||||
} else if (d.sys_dept__dept_level === '5') {
|
||||
this.treeData[i].children.forEach((threeVal, three) => {
|
||||
threeVal.children.forEach((fourVal, four) => {
|
||||
fourVal.children.forEach((fiveVal, five) => {
|
||||
if (d.sys_dept__dept_id.substring(0, 16).indexOf(fiveVal.sys_dept__dept_id) > -1) {
|
||||
this.treeData[i].children[three].children[four].children[five].children.push(d)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
} else if (d.sys_dept__dept_level === '6') {
|
||||
this.treeData[i].children.forEach((threeVal, three) => {
|
||||
threeVal.children.forEach((fourVal, four) => {
|
||||
fourVal.children.forEach((fiveVal, five) => {
|
||||
fiveVal.children.forEach((sixVal, six) => {
|
||||
if (d.sys_dept__dept_id.substring(0, 20).indexOf(sixVal.sys_dept__dept_id) > -1) {
|
||||
this.treeData[i].children[three].children[four].children[five].children[six].children.push(d)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
console.log(this.treeData, 'this.treeData')
|
||||
}
|
||||
},
|
||||
editCreate() {
|
||||
if (this.ids === null) {
|
||||
this.$message.warning('请选择一个组织再添加下属组织')
|
||||
} else if (this.ids.length !== 1) {
|
||||
this.$message.warning('请选择一个组织再添加下属组织')
|
||||
} else {
|
||||
this.dialogFormVisible = true
|
||||
this.dept_id = this.ids[0]
|
||||
this.level = this.levels[0]
|
||||
}
|
||||
},
|
||||
create() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
const data = `funid=sys_dept&parentId=${this.dept_id}&levelCol=sys_dept.dept_level&keyid=&pagetype=editgrid&eventcode=save_eg&sys_dept__dept_code=${this.form.dept_code}&sys_dept__dept_name=${this.form.dept_name}&sys_dept__memo=${this.form.memo}&sys_dept__is_novalid=0&sys_dept__dept_id=&sys_dept__dept_level=${Number(this.level) + 1}&user_id=administrator&dataType= json`
|
||||
api.Crerte(data).then(data => {
|
||||
if (data.success) {
|
||||
this.getList()
|
||||
this.transitionTree()
|
||||
this.dialogFormVisible = false
|
||||
this.$refs['form'].resetFields()
|
||||
this.form.dept_name = ''
|
||||
this.form.dept_code = ''
|
||||
this.$message.success('新增成功!')
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
Delete(row) {
|
||||
this.ids = []
|
||||
this.ids.push(row.sys_dept__dept_id)
|
||||
this.editDelete()
|
||||
},
|
||||
editDelete() {
|
||||
if (this.ids && this.ids.length > 0) {
|
||||
this.$confirm('确认删除部门?').then(() => {
|
||||
api.Delete(this.ids).then(data => {
|
||||
if (data.success) {
|
||||
this.getList()
|
||||
this.$message.success('删除成功!')
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
}).catch(() => {})
|
||||
} else {
|
||||
this.$message.warning('请选择数据进行删除')
|
||||
}
|
||||
},
|
||||
editSave() {
|
||||
console.log('editSave')
|
||||
},
|
||||
upload() {
|
||||
console.log('upload')
|
||||
},
|
||||
edit(row) {
|
||||
this.id = row.sys_dept__dept_id
|
||||
this.parent_id = this.id.substring(0, this.id.length - 4)
|
||||
console.log(this.parent_id, this.id)
|
||||
this.auditForm = row
|
||||
this.dialogEditVisible = true
|
||||
},
|
||||
auditFormChange(form) {
|
||||
this.saveFrom = form
|
||||
},
|
||||
save() {
|
||||
console.log(this.saveFrom, 'this.saveFrom')
|
||||
console.log(this.auditForm, 'this.auditForm')
|
||||
if (Object.keys(this.saveFrom).length === 0) {
|
||||
this.saveFrom = this.auditForm
|
||||
}
|
||||
this.$refs.auditForm.$refs.auditForm.validate(valid => {
|
||||
if (valid) {
|
||||
const _form = `funid=sys_dept&parentId=&levelCol=sys_dept.dept_level&keyid=${this.id}&pagetype=editgrid&eventcode=save_eg&sys_dept__dept_code=${this.saveFrom.sys_dept__dept_code}&sys_dept__dept_name=${this.saveFrom.sys_dept__dept_name}&sys_dept__memo=${this.saveFrom.sys_dept__memo}&sys_dept__is_novalid=${this.saveFrom.sys_dept__is_novalid}&sys_dept__dept_id=${this.id}&sys_dept__dept_level=${this.saveFrom.sys_dept__dept_level}&user_id=administrator&dataType=json`
|
||||
api.auditSave(_form).then(data => {
|
||||
if (data.success) {
|
||||
this.whereSql = false
|
||||
this.whereValue = ''
|
||||
this.getList()
|
||||
this.$message.success('保存成功!')
|
||||
this.dialogEditVisible = false
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
cellDblclick(row) {
|
||||
console.log(row, 'row')
|
||||
this.id = row.sys_dept__dept_id
|
||||
this.parent_id = this.id.substring(0, this.id.length - 4)
|
||||
this.auditForm = row
|
||||
this.saveFrom = []
|
||||
this.dialogEditVisible = true
|
||||
},
|
||||
sizeChange(size) {
|
||||
this.pager.pageSize = size
|
||||
this.getList()
|
||||
},
|
||||
pageChange(page) {
|
||||
this.pager.pageNo = page
|
||||
this.getList()
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.ids = val.map(d => d.sys_dept__dept_id)
|
||||
this.levels = val.map(d => d.sys_dept__dept_level)
|
||||
},
|
||||
closeDialog() {
|
||||
this.dialogFormVisible = false
|
||||
this.$refs['form'].resetFields()
|
||||
this.form.dept_name = ''
|
||||
this.form.dept_code = ''
|
||||
},
|
||||
handleNodeClick(data) {
|
||||
this.pager.pageNo = 0
|
||||
this.pager.pageSize = 10
|
||||
this.pager.total = 0
|
||||
this.whereValue = encodeURI(`${data.sys_dept__dept_id}\%`)
|
||||
this.whereSql = true
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.el-card {
|
||||
margin-top: 10px;
|
||||
}
|
||||
</style>
|
56
src/views/sys_user/api/index.js
Normal file
56
src/views/sys_user/api/index.js
Normal file
@ -0,0 +1,56 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export default {
|
||||
getUser(pageSize, pageNo, isWhereSql, whereValue) {
|
||||
let whereSql = ''
|
||||
let whereType = ''
|
||||
if (isWhereSql) {
|
||||
whereSql = `sys_dept.dept_id like ?`
|
||||
whereType = 'string'
|
||||
}
|
||||
return request({
|
||||
url: `/commonAction.do?eventcode=query_data&funid=queryevent&pagetype=editgrid&query_funid=sys_user&user_id=administrator`,
|
||||
method: 'post',
|
||||
data: `start=${pageNo}&limit=${pageSize}&where_sql=${whereSql}&where_value=${whereValue}&where_type=${whereType}&is_query=1&query_type=0`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
getDeptTree() {
|
||||
return request({
|
||||
url: `/commonAction.do?eventcode=query_data&funid=queryevent&pagetype=editgrid&query_funid=sys_dept&user_id=administrator`,
|
||||
method: 'post',
|
||||
data: `start=0&limit=10000&where_sql=&where_value=&where_type=&is_query=1&query_type=0`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
Crerte(data) {
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `${data}`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
auditSave(data) {
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `${data}`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
Delete(ids) {
|
||||
let keys = ''
|
||||
ids.forEach(d => {
|
||||
keys += 'keyid=' + d + '&'
|
||||
})
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `funid=sys_user&${keys}pagetype=editgrid&eventcode=delete_eg&user_id=administrator&dataType=json`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
getSelect(control_code) {
|
||||
return request({
|
||||
url: `/commonAction.do?eventcode=query_data&funid=queryevent&pagetype=editgrid&query_funid=sys_control&user_id=administrator`,
|
||||
method: 'post',
|
||||
data: `start=0&limit=50&where_sql=(funall_control.control_code = ? )&where_value=${control_code}&where_type=string&is_query=1&query_type=0`
|
||||
}).then(response => response.data)
|
||||
}
|
||||
}
|
211
src/views/sys_user/components/auditUser.vue
Normal file
211
src/views/sys_user/components/auditUser.vue
Normal file
@ -0,0 +1,211 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card>
|
||||
<el-form ref="form" :model="form" label-width="80px" :rules="rules">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="姓名" prop="sys_user__user_name">
|
||||
<el-input v-model="form.sys_user__user_name" clearable @change="change" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="工号" prop="sys_user__user_code">
|
||||
<el-input v-model="form.sys_user__user_code" clearable @change="change" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="部门名称" prop="sys_dept__dept_name">
|
||||
<el-input v-model="form.sys_dept__dept_name" placeholder="请选择部门" class="input-with-select" clearable>
|
||||
<el-button slot="append" icon="el-icon-search" @click="selDeptVisible = !selDeptVisible" />
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="部门负责人?">
|
||||
<el-select v-model="form.sys_user__is_leader" placeholder="请选择" clearable @change="change">
|
||||
<el-option
|
||||
v-for="item in yesno"
|
||||
:key="item.funall_control__value_data"
|
||||
:label="item.funall_control__display_data"
|
||||
:value="item.funall_control__value_data"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="职务">
|
||||
<el-input v-model="form.sys_user__duty" clearable @change="change" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="固定电话">
|
||||
<el-input v-model="form.sys_user__phone_code" clearable @change="change" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="手机号码">
|
||||
<el-input v-model="form.sys_user__mob_code" clearable @change="change" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="性别">
|
||||
<el-select v-model="form.sys_user__sex" placeholder="请选择" clearable @change="change">
|
||||
<el-option
|
||||
v-for="item in usersex"
|
||||
:key="item.funall_control__value_data"
|
||||
:label="item.funall_control__display_data"
|
||||
:value="item.funall_control__value_data"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="邮箱">
|
||||
<el-input v-model="form.sys_user__email" clearable @change="change" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="是否注销">
|
||||
<el-select v-model="form.sys_user__is_novalid" placeholder="请选择" clearable @change="change">
|
||||
<el-option
|
||||
v-for="item in yesno"
|
||||
:key="item.funall_control__value_data"
|
||||
:label="item.funall_control__display_data"
|
||||
:value="item.funall_control__value_data"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="16">
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="form.sys_user__memo" @change="change" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-dialog
|
||||
v-if="selDeptVisible"
|
||||
class="selDept"
|
||||
title="选择部门"
|
||||
:visible.sync="selDeptVisible"
|
||||
width="60%"
|
||||
:modal="false"
|
||||
>
|
||||
<SelDept ref="seLDept" @updateDept="updateDept" @updateDepts="updateDepts" />
|
||||
<span>
|
||||
<el-button @click="selDeptVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="selDeptVisible = false">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import api from '../api'
|
||||
import SelDept from '@/components/selDept'
|
||||
export default {
|
||||
components: {
|
||||
SelDept
|
||||
},
|
||||
props: {
|
||||
id: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
data: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
auditForm: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
novalid: [
|
||||
{
|
||||
value: '0',
|
||||
label: '否'
|
||||
}, {
|
||||
value: '1',
|
||||
label: '是'
|
||||
}
|
||||
],
|
||||
rules: {
|
||||
sys_user__user_code: [
|
||||
{ required: true, message: '请输入工号', trigger: 'blur' }
|
||||
],
|
||||
sys_user__user_name: [
|
||||
{ required: true, message: '请输入用户名称', trigger: 'blur' }
|
||||
],
|
||||
sys_dept__dept_name: [
|
||||
{ required: true, message: '请选择部门名称', trigger: 'blur' }
|
||||
|
||||
]
|
||||
},
|
||||
formLabelWidth: '120px',
|
||||
form: {},
|
||||
yesno: [],
|
||||
usersex: [],
|
||||
selDeptVisible: false
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
await this.getYesNo()
|
||||
await this.getSex()
|
||||
await this.init()
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.form = JSON.parse(JSON.stringify(this.auditForm))
|
||||
},
|
||||
change() {
|
||||
console.log(this.form, 'this.form')
|
||||
this.$emit('change', this.form)
|
||||
},
|
||||
getYesNo() {
|
||||
api.getSelect('yesno').then(data => {
|
||||
if (data.success) {
|
||||
this.yesno = data.data.root
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
getSex() {
|
||||
api.getSelect('usersex').then(data => {
|
||||
if (data.success) {
|
||||
this.usersex = data.data.root
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
updateDept(data) {
|
||||
this.form.sys_dept__dept_name = data.sys_dept__dept_name
|
||||
this.form.sys_user__dept_id = data.sys_dept__dept_id
|
||||
this.selDeptVisible = false
|
||||
this.change()
|
||||
},
|
||||
updateDepts(data) {
|
||||
this.form.sys_dept__dept_name = data.map(d => { return d.sys_dept__dept_name }).join(';')
|
||||
this.form.sys_user__dept_id = data.map(d => { return d.sys_dept__dept_id }).join(';')
|
||||
this.change()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.selDept{
|
||||
margin-top: -10vh;
|
||||
}
|
||||
</style>
|
451
src/views/sys_user/index.vue
Normal file
451
src/views/sys_user/index.vue
Normal file
@ -0,0 +1,451 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<buttons funid="sys_dept" @editCreate="editCreate" @editDelete="editDelete" @editSave="editSave" @upload="upload" />
|
||||
<el-row>
|
||||
<el-col :span="3">
|
||||
<el-card>
|
||||
<div class="tree_title">安全组织架构</div>
|
||||
<el-tree :data="treeData" default-expand-all :props="defaultProps" @node-click="handleNodeClick" />
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="20" style="margin-left:20px">
|
||||
<el-card>
|
||||
<el-table
|
||||
ref="deptTable"
|
||||
v-loading="loading"
|
||||
:data="data"
|
||||
style="width: 100%"
|
||||
stripe
|
||||
@selection-change="handleSelectionChange"
|
||||
@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 slot-scope="scope">
|
||||
<div v-if="d.label==='部门负责人?'">
|
||||
{{
|
||||
scope.row.sys_user__is_leader == 0 ? '否' : '是'
|
||||
}}
|
||||
</div>
|
||||
<div v-else-if="d.label==='性别'">
|
||||
{{
|
||||
scope.row.sys_user__sex == 0 ? '女' : '男'
|
||||
}}
|
||||
</div>
|
||||
<div v-else-if="d.label==='是否注销'">
|
||||
{{
|
||||
scope.row.sys_user__is_novalid == 0 ? '否' : '是'
|
||||
}}
|
||||
</div>
|
||||
<div v-else-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)" />
|
||||
</div>
|
||||
<div v-else>{{ scope.row[d.prop] }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</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>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-dialog v-if="dialogFormVisible" title="新增部门" :visible.sync="dialogFormVisible" @close="closeDialog">
|
||||
<el-form ref="form" :model="form" :rules="rules">
|
||||
<el-form-item label="所属部门" :label-width="formLabelWidth">
|
||||
<el-select v-model="dept_id" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in data"
|
||||
:key="item.sys_user__dept_id"
|
||||
:label="item.sys_user__dept_name"
|
||||
:value="item.sys_user__dept_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门编码" :label-width="formLabelWidth" prop="dept_code">
|
||||
<el-input v-model="form.dept_code" />
|
||||
</el-form-item>
|
||||
<el-form-item label="部门名称" :label-width="formLabelWidth" prop="dept_name">
|
||||
<el-input v-model="form.dept_name" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" :label-width="formLabelWidth" prop="memo">
|
||||
<el-input v-model="form.memo" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="create">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<el-dialog v-if="dialogEditVisible" title="部门" :visible.sync="dialogEditVisible" width="70%" @close="closeDialog">
|
||||
<AdutiUser :id="user_id" ref="auditForm" :audit-form="auditForm" :data="deptTree" @change="auditFormChange" />
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogEditVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="save">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import api from './api'
|
||||
import buttons from '@/components/Buttons'
|
||||
import AdutiUser from './components/auditUser'
|
||||
export default {
|
||||
name: 'User',
|
||||
components: {
|
||||
buttons,
|
||||
AdutiUser
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
data: [],
|
||||
deptTree: [],
|
||||
ids: [],
|
||||
levels: [],
|
||||
pager: {
|
||||
pageNo: 0,
|
||||
pageSize: 10,
|
||||
total: 0
|
||||
},
|
||||
tableHeader: [
|
||||
{
|
||||
prop: 'selection',
|
||||
type: 'selection',
|
||||
fixed: 'left'
|
||||
}, {
|
||||
prop: 'sys_user__user_name',
|
||||
label: '姓名'
|
||||
}, {
|
||||
prop: 'sys_user__user_code',
|
||||
label: '工号'
|
||||
}, {
|
||||
prop: 'sys_dept__dept_name',
|
||||
label: '部门名称'
|
||||
}, {
|
||||
prop: 'sys_user__is_leader',
|
||||
label: '部门负责人?'
|
||||
},
|
||||
{
|
||||
prop: 'sys_user__duty',
|
||||
label: '职务'
|
||||
},
|
||||
{
|
||||
prop: 'sys_user__phone_code',
|
||||
label: '固定电话'
|
||||
},
|
||||
{
|
||||
prop: 'sys_user__mob_code',
|
||||
label: '手机号码'
|
||||
},
|
||||
{
|
||||
prop: 'sys_user__sex',
|
||||
label: '性别'
|
||||
},
|
||||
{
|
||||
prop: 'sys_user__email',
|
||||
label: '邮箱'
|
||||
},
|
||||
{
|
||||
prop: 'sys_user__is_novalid',
|
||||
label: '是否注销'
|
||||
},
|
||||
{
|
||||
prop: 'sys_user__memo',
|
||||
label: '备注'
|
||||
},
|
||||
{
|
||||
prop: 'opration',
|
||||
label: '操作',
|
||||
width: '70px',
|
||||
fixed: 'right',
|
||||
minWidth: '70px',
|
||||
show: true
|
||||
}],
|
||||
value: '',
|
||||
dept_id: '',
|
||||
level: '',
|
||||
user_id: '',
|
||||
parent_id: '',
|
||||
form: {
|
||||
dept_name: '',
|
||||
dept_code: '',
|
||||
memo: ''
|
||||
},
|
||||
rules: {
|
||||
dept_code: [
|
||||
{ required: true, message: '请输入部门编码', trigger: 'blur' }
|
||||
],
|
||||
dept_name: [
|
||||
{ required: true, message: '请输入部门名称', trigger: 'blur' }
|
||||
|
||||
]
|
||||
},
|
||||
dialogFormVisible: false,
|
||||
dialogEditVisible: false,
|
||||
formLabelWidth: '120px',
|
||||
auditForm: {},
|
||||
saveFrom: {},
|
||||
treeData: [],
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'sys_dept__dept_name'
|
||||
},
|
||||
treeList: [],
|
||||
whereSql: false,
|
||||
whereValue: ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
this.transitionTree()
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
this.loading = true
|
||||
let pageNo = this.pager.pageNo * this.pager.pageSize - this.pager.pageSize
|
||||
if (pageNo < 0) {
|
||||
pageNo = 0
|
||||
}
|
||||
api.getUser(
|
||||
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)
|
||||
}
|
||||
})
|
||||
},
|
||||
async transitionTree() {
|
||||
await api.getDeptTree().then(data => {
|
||||
if (data.success) {
|
||||
this.deptTree = data.data.root
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
this.treeData = []
|
||||
let data = []
|
||||
data = this.deptTree.sort((a, b) => {
|
||||
return a.sys_dept__dept_id - b.sys_dept__dept_id
|
||||
})
|
||||
const oneTreeList = data.filter(d => {
|
||||
return d.sys_dept__dept_level === '1'
|
||||
})
|
||||
for (let i = 0; i < oneTreeList.length; i++) {
|
||||
const treeList = data.filter(d => {
|
||||
return d.sys_dept__dept_id.substring(0, 4).indexOf(oneTreeList[i].sys_dept__dept_id) > -1
|
||||
})
|
||||
treeList.forEach(d => {
|
||||
d.children = []
|
||||
if (d.sys_dept__dept_level === '1') {
|
||||
this.treeData.push(d)
|
||||
} else if (d.sys_dept__dept_level === '2') {
|
||||
this.treeData[i].children.push(d)
|
||||
} else if (d.sys_dept__dept_level === '3') {
|
||||
this.treeData[i].children.forEach((threeVal, three) => {
|
||||
if (d.sys_dept__dept_id.substring(0, 8).indexOf(threeVal.sys_dept__dept_id) > -1) {
|
||||
this.treeData[i].children[three].children.push(d)
|
||||
}
|
||||
})
|
||||
} else if (d.sys_dept__dept_level === '4') {
|
||||
this.treeData[i].children.forEach((threeVal, three) => {
|
||||
threeVal.children.forEach((fourVal, four) => {
|
||||
if (d.sys_dept__dept_id.substring(0, 12).indexOf(fourVal.sys_dept__dept_id) > -1) {
|
||||
this.treeData[i].children[three].children[four].children.push(d)
|
||||
}
|
||||
})
|
||||
})
|
||||
} else if (d.sys_dept__dept_level === '5') {
|
||||
this.treeData[i].children.forEach((threeVal, three) => {
|
||||
threeVal.children.forEach((fourVal, four) => {
|
||||
fourVal.children.forEach((fiveVal, five) => {
|
||||
if (d.sys_dept__dept_id.substring(0, 16).indexOf(fiveVal.sys_dept__dept_id) > -1) {
|
||||
this.treeData[i].children[three].children[four].children[five].children.push(d)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
} else if (d.sys_dept__dept_level === '6') {
|
||||
this.treeData[i].children.forEach((threeVal, three) => {
|
||||
threeVal.children.forEach((fourVal, four) => {
|
||||
fourVal.children.forEach((fiveVal, five) => {
|
||||
fiveVal.children.forEach((sixVal, six) => {
|
||||
if (d.sys_dept__dept_id.substring(0, 20).indexOf(sixVal.sys_dept__dept_id) > -1) {
|
||||
this.treeData[i].children[three].children[four].children[five].children[six].children.push(d)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
console.log(this.treeData, 'this.treeData')
|
||||
}
|
||||
},
|
||||
editCreate() {
|
||||
this.id = ''
|
||||
this.auditForm = {}
|
||||
this.dialogEditVisible = true
|
||||
},
|
||||
create() {
|
||||
this.$refs.auditForm.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
const data = `funid=sys_dept&parentId=${this.dept_id}&levelCol=sys_dept.dept_level&keyid=&pagetype=editgrid&eventcode=save_eg&sys_user__dept_code=${this.form.dept_code}&sys_user__dept_name=${this.form.dept_name}&sys_user__memo=${this.form.memo}&sys_user__is_novalid=0&sys_user__dept_id=&sys_user__dept_level=${Number(this.level) + 1}&user_id=administrator&dataType= json`
|
||||
api.Crerte(data).then(data => {
|
||||
if (data.success) {
|
||||
this.getList()
|
||||
this.transitionTree()
|
||||
this.dialogFormVisible = false
|
||||
this.$refs.auditForm.$refs.form.resetFields()
|
||||
this.form.dept_name = ''
|
||||
this.form.dept_code = ''
|
||||
this.$message.success('新增成功!')
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
Delete(row) {
|
||||
this.ids = []
|
||||
this.ids.push(row.sys_user__user_id)
|
||||
this.editDelete()
|
||||
},
|
||||
editDelete() {
|
||||
if (this.ids && this.ids.length > 0) {
|
||||
this.$confirm('确认删除员工?').then(() => {
|
||||
api.Delete(this.ids).then(data => {
|
||||
if (data.success) {
|
||||
this.getList()
|
||||
this.$message.success('删除成功!')
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
}).catch(() => {})
|
||||
} else {
|
||||
this.$message.warning('请选择数据进行删除')
|
||||
}
|
||||
},
|
||||
editSave() {
|
||||
console.log('editSave')
|
||||
},
|
||||
upload() {
|
||||
console.log('upload')
|
||||
},
|
||||
edit(row) {
|
||||
this.id = row.sys_user__user_id
|
||||
this.auditForm = row
|
||||
this.dialogEditVisible = true
|
||||
},
|
||||
auditFormChange(form) {
|
||||
this.saveFrom = form
|
||||
},
|
||||
save() {
|
||||
console.log(this.$refs.auditForm, 'this.$refs.auditForm.')
|
||||
if (Object.keys(this.saveFrom).length === 0) {
|
||||
this.saveFrom = this.auditForm
|
||||
}
|
||||
this.$refs.auditForm.$refs.form.validate(valid => {
|
||||
if (valid) {
|
||||
const _form = `funid=sys_user&parentId=&levelCol=sys_dept.dept_level&keyid=${this.id}&pagetype=editgrid&eventcode=save_eg&sys_user__user_name=${this.saveFrom.sys_user__user_name}&sys_user__user_code=${this.saveFrom.sys_user__user_code}&sys_dept__dept_name=${this.saveFrom.sys_dept__dept_name}&sys_user__is_leader=${this.saveFrom.sys_user__is_leader}&sys_user__duty=${this.saveFrom.sys_user__duty}&sys_user__phone_code=${this.saveFrom.sys_user__phone_code}&sys_user__mob_code=${this.saveFrom.sys_user__mob_code}&sys_user__sex=${this.saveFrom.sys_user__sex}&sys_user__email=${this.saveFrom.sys_user__email}&sys_user__is_novalid=${this.saveFrom.sys_user__is_novalid}&sys_user__memo=${this.saveFrom.sys_user__memo}&sys_user__user_id=${this.id}&sys_user__dept_id=${this.saveFrom.sys_user__dept_id}&user_id=administrator&dataType=json`
|
||||
api.auditSave(_form).then(data => {
|
||||
if (data.success) {
|
||||
this.whereSql = false
|
||||
this.whereValue = ''
|
||||
this.getList()
|
||||
this.$message.success('保存成功!')
|
||||
this.dialogEditVisible = false
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
cellDblclick(row) {
|
||||
console.log(row, 'row')
|
||||
this.id = row.sys_user__user_id
|
||||
this.auditForm = row
|
||||
this.saveFrom = []
|
||||
this.dialogEditVisible = true
|
||||
},
|
||||
sizeChange(size) {
|
||||
this.pager.pageSize = size
|
||||
this.getList()
|
||||
},
|
||||
pageChange(page) {
|
||||
this.pager.pageNo = page
|
||||
this.getList()
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.ids = val.map(d => d.sys_user__user_id)
|
||||
},
|
||||
closeDialog() {
|
||||
this.dialogFormVisible = false
|
||||
this.$refs.auditForm.$refs.form.resetFields()
|
||||
this.form = ''
|
||||
},
|
||||
handleNodeClick(data) {
|
||||
this.pager.pageNo = 0
|
||||
this.pager.pageSize = 10
|
||||
this.pager.total = 0
|
||||
this.whereValue = encodeURI(`${data.sys_dept__dept_id}\%`)
|
||||
this.whereSql = true
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.el-card {
|
||||
margin-top: 10px;
|
||||
}
|
||||
::v-deep .el-card__body {
|
||||
padding: 0px;
|
||||
}
|
||||
.tree_title{
|
||||
width: 100%;
|
||||
height: 30px;
|
||||
margin-bottom: 10px;
|
||||
padding: 2px;
|
||||
line-height: 30px;
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
background-color: #42b983;
|
||||
text-align: center;
|
||||
}
|
||||
.el-tree{
|
||||
height: 500px;
|
||||
overflow-x:auto;
|
||||
overflow-y:auto;
|
||||
}
|
||||
</style>
|
Loading…
x
Reference in New Issue
Block a user