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
4105503024
commit
33762ffb8e
BIN
src/assets/images/1.png
Normal file
BIN
src/assets/images/1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
BIN
src/assets/images/2.png
Normal file
BIN
src/assets/images/2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
BIN
src/assets/images/3.png
Normal file
BIN
src/assets/images/3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
@ -10,14 +10,14 @@
|
||||
>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-link>
|
||||
<el-link @click="jumpReform">
|
||||
<i class="el-icon-help" />
|
||||
待整改
|
||||
<span>({{ 11 }})</span>
|
||||
</el-link>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-link>
|
||||
<el-link @click="jumpReview">
|
||||
<i class="el-icon-s-help" />
|
||||
待验收
|
||||
<span>({{ 22 }})</span>
|
||||
@ -83,6 +83,12 @@ export default {
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
jumpReform() {
|
||||
this.$router.push({ path: '/hidden_danger/hidden_reform', query: { isBacklog: true }})
|
||||
},
|
||||
jumpReview() {
|
||||
this.$router.push({ path: '/hidden_danger/hidden_review', query: { isBacklog: true }})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -1,364 +1,367 @@
|
||||
<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',
|
||||
props: {
|
||||
selective: {
|
||||
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: '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: '',
|
||||
Dpets: ''
|
||||
}
|
||||
},
|
||||
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(row) {
|
||||
if (this.selective) {
|
||||
this.$emit('updateDepts', row)
|
||||
} else {
|
||||
this.Dpets = row
|
||||
}
|
||||
},
|
||||
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>
|
||||
<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',
|
||||
props: {
|
||||
selective: {
|
||||
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: '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: '',
|
||||
Dpets: ''
|
||||
}
|
||||
},
|
||||
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(row) {
|
||||
if (this.selective) {
|
||||
this.$emit('updateDepts', row)
|
||||
} else {
|
||||
this.Dpets = row
|
||||
}
|
||||
},
|
||||
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;
|
||||
::v-deep.el-table__row{
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
.app-container{
|
||||
padding: 0px;
|
||||
}
|
||||
.el-tree{
|
||||
height: 500px;
|
||||
overflow-x:auto;
|
||||
overflow-y:auto;
|
||||
}
|
||||
</style>
|
||||
|
40
src/components/show_images/api/index.js
Normal file
40
src/components/show_images/api/index.js
Normal file
@ -0,0 +1,40 @@
|
||||
import request from '@/utils/request'
|
||||
import store from '@/store/modules/user'
|
||||
|
||||
var roles = store.state.roles.replace(/;/g, '')
|
||||
|
||||
export default {
|
||||
getDate(pageSize, pageNo, data_id, table_name) {
|
||||
return request({
|
||||
url: `/commonAction.do?eventcode=query_data&funid=queryevent&pagetype=editgrid&query_funid=sys_attach&user_id=${roles}`,
|
||||
method: 'post',
|
||||
data: `start=${pageNo}&limit=${pageSize}&where_sql=sys_attach.data_id = ? and sys_attach.table_name = ?&where_type=string;string&where_value=${data_id};${table_name}`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
Delete(ids) {
|
||||
let keys = ''
|
||||
ids.forEach(d => {
|
||||
keys += 'keyid=' + d + '&'
|
||||
})
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `funid=sys_attach&${keys}pagetype=editgrid&eventcode=delete&user_id=${roles}&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=${roles}`,
|
||||
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)
|
||||
},
|
||||
downLoad(keys) {
|
||||
const timestamp = new Date().getTime()
|
||||
return request({
|
||||
url: `fileAction.do?funid=sys_attach&keyid=${keys}&pagetype=editgrid&eventcode=down&user_id=${roles}&dataType=byte&_dc=${timestamp}`,
|
||||
method: 'get'
|
||||
// data: `funid=sys_attach&keyid=${keys}&pagetype=editgrid&eventcode=down&user_id=${roles}&dataType=byte&_dc=${timestamp}`
|
||||
})
|
||||
}
|
||||
}
|
262
src/components/show_images/index.vue
Normal file
262
src/components/show_images/index.vue
Normal file
@ -0,0 +1,262 @@
|
||||
<template>
|
||||
<el-card>
|
||||
<div v-for="(item , i) in imgList" :key="i" class="img">
|
||||
<el-image :preview-src-list="imgPathList" :src="baseUrl +'?funid=sys_attach&pagetype=editgrid&eventcode=down&nousercheck=1&dataType=byte&keyid='+ item.sys_attach__attach_id +'&is_highimage=1'" />
|
||||
</div>
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import api from './api'
|
||||
import store from '@/store/modules/user'
|
||||
|
||||
var roles = store.state.roles.replace(/;/g, '')
|
||||
export default {
|
||||
name: 'SafeIdsp',
|
||||
components: {
|
||||
// buttons
|
||||
},
|
||||
props: {
|
||||
dataId: {
|
||||
type: String,
|
||||
default: null
|
||||
},
|
||||
tableName: {
|
||||
type: String,
|
||||
default: null
|
||||
},
|
||||
funId: {
|
||||
type: String,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
data: [],
|
||||
deptTree: [],
|
||||
ids: [],
|
||||
levels: [],
|
||||
pager: {
|
||||
pageNo: 0,
|
||||
pageSize: 100,
|
||||
total: 0
|
||||
},
|
||||
value: '',
|
||||
dept_id: '',
|
||||
level: '',
|
||||
id: '',
|
||||
parent_id: '',
|
||||
form: {
|
||||
dept_name: '',
|
||||
dept_code: '',
|
||||
memo: ''
|
||||
},
|
||||
dialogFormVisible: false,
|
||||
dialogEditVisible: false,
|
||||
formLabelWidth: '120px',
|
||||
auditForm: {},
|
||||
saveFrom: {},
|
||||
treeData: [],
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'sys_dept__dept_name'
|
||||
},
|
||||
treeList: [],
|
||||
whereSql: false,
|
||||
whereValue: '',
|
||||
formData: {},
|
||||
attach_path: null,
|
||||
baseUrl: window.location.origin + '/bwhse/fileAction.do',
|
||||
href: '',
|
||||
imgList: [],
|
||||
imgPathList: []
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
this.initFormData()
|
||||
},
|
||||
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.dataId,
|
||||
this.tableName
|
||||
).then(data => {
|
||||
if (data.success) {
|
||||
this.data = data.data.root
|
||||
|
||||
this.imgList = this.data.filter(d => {
|
||||
return d.sys_attach__content_type === 'image/png'
|
||||
})
|
||||
this.imgPathList = this.imgList.map(d => {
|
||||
return `${this.baseUrl}?funid=sys_attach&pagetype=editgrid&eventcode=down&nousercheck=1&dataType=byte&keyid=${d.sys_attach__attach_id}&is_highimage=1`
|
||||
})
|
||||
console.log(this.imgList, 'this.imgList')
|
||||
this.pager.total = data.data.total
|
||||
setTimeout(() => {
|
||||
this.loading = false
|
||||
}, 200)
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
initFormData() {
|
||||
this.formData.attach_path = ''
|
||||
this.formData.funid = 'sys_attach'
|
||||
this.formData.eventcode = 'create'
|
||||
this.formData.nousercheck = '1'
|
||||
this.formData.table_name = this.tableName
|
||||
this.formData.datafunid = this.funId
|
||||
this.formData.user_id = 'administrator'
|
||||
this.formData.dataid = this.dataId[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.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_attach__attach_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.attach_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
|
||||
},
|
||||
cellDblclick(row) {
|
||||
},
|
||||
sizeChange(size) {
|
||||
this.pager.pageSize = size
|
||||
this.getList()
|
||||
},
|
||||
pageChange(page) {
|
||||
this.pager.pageNo = page
|
||||
this.getList()
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
console.log(val)
|
||||
this.ids = val.map(d => d.sys_attach__attach_id)
|
||||
},
|
||||
async downLoadAttach(row) {
|
||||
const timestamp = new Date().getTime()
|
||||
this.href = `${this.baseUrl}?funid=sys_attach&keyid=${row.sys_attach__attach_id}&pagetype=editgrid&eventcode=down&user_id=${roles}&dataType=byte&_dc=${timestamp}`
|
||||
// await api.downLoad(row.sys_attach__attach_id)
|
||||
},
|
||||
handleRemove(file, fileList) {
|
||||
console.log(file, fileList)
|
||||
},
|
||||
handlePreview(file) {
|
||||
console.log(file)
|
||||
},
|
||||
handleExceed(files, fileList) {
|
||||
this.$message.warning(`当前限制选择 9 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`)
|
||||
},
|
||||
beforeRemove(file, fileList) {
|
||||
return this.$confirm(`确定移除 ${file.name}?`)
|
||||
},
|
||||
onChange(file) {
|
||||
this.formData.attach_path = file.raw
|
||||
},
|
||||
onSuccess() {
|
||||
this.$message.success('上传成功!')
|
||||
this.getList()
|
||||
this.$refs.upload.clearFiles()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.el-card {
|
||||
margin-top: 10px;
|
||||
}
|
||||
.el-table__row {
|
||||
a {
|
||||
color: blue;
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
.buttons{
|
||||
display: flex;
|
||||
}
|
||||
.el-button--primary {
|
||||
height: 26.8px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.pagination{
|
||||
overflow: auto;
|
||||
}
|
||||
.img{
|
||||
display: inline-block;
|
||||
width: 188px;
|
||||
height: 108px;
|
||||
text-align: center;
|
||||
line-height: 58px;
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
background: #fff;
|
||||
position: relative;
|
||||
box-shadow: 2px 2px 5px;
|
||||
margin-right: 4px;
|
||||
box-sizing: border-box;
|
||||
padding: 10px;
|
||||
margin: 20px;
|
||||
.el-image{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
@ -1,15 +1,19 @@
|
||||
const getters = {
|
||||
sidebar: state => state.app.sidebar,
|
||||
size: state => state.app.size,
|
||||
device: state => state.app.device,
|
||||
visitedViews: state => state.tagsView.visitedViews,
|
||||
cachedViews: state => state.tagsView.cachedViews,
|
||||
token: state => state.user.token,
|
||||
avatar: state => state.user.avatar,
|
||||
name: state => state.user.name,
|
||||
introduction: state => state.user.introduction,
|
||||
roles: state => state.user.roles,
|
||||
permission_routes: state => state.permission.routes,
|
||||
errorLogs: state => state.errorLog.logs
|
||||
}
|
||||
export default getters
|
||||
const getters = {
|
||||
sidebar: state => state.app.sidebar,
|
||||
size: state => state.app.size,
|
||||
device: state => state.app.device,
|
||||
visitedViews: state => state.tagsView.visitedViews,
|
||||
cachedViews: state => state.tagsView.cachedViews,
|
||||
token: state => state.user.token,
|
||||
userName: state => state.user.userName,
|
||||
userId: state => state.user.userId,
|
||||
deptName: state => state.user.deptName,
|
||||
deptId: state => state.user.deptId,
|
||||
avatar: state => state.user.avatar,
|
||||
name: state => state.user.name,
|
||||
introduction: state => state.user.introduction,
|
||||
roles: state => state.user.roles,
|
||||
permission_routes: state => state.permission.routes,
|
||||
errorLogs: state => state.errorLog.logs
|
||||
}
|
||||
export default getters
|
||||
|
@ -8,7 +8,11 @@ const state = {
|
||||
name: '',
|
||||
avatar: '',
|
||||
introduction: '',
|
||||
roles: []
|
||||
roles: [],
|
||||
userName: '',
|
||||
userId: '',
|
||||
deptName: '',
|
||||
deptId: ''
|
||||
}
|
||||
|
||||
const mutations = {
|
||||
@ -26,6 +30,18 @@ const mutations = {
|
||||
},
|
||||
SET_ROLES: (state, roles) => {
|
||||
state.roles = roles
|
||||
},
|
||||
USER_NAME: (state, userName) => {
|
||||
state.userName = userName
|
||||
},
|
||||
USER_ID: (state, userId) => {
|
||||
state.userId = userId
|
||||
},
|
||||
DEPT_NAME: (state, deptName) => {
|
||||
state.deptName = deptName
|
||||
},
|
||||
DEPT_ID: (state, deptId) => {
|
||||
state.deptId = deptId
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,8 +55,16 @@ const actions = {
|
||||
commit('SET_ROLES', res.data.data.role_id)
|
||||
// const { data } = res.data
|
||||
commit('SET_TOKEN', 'bwhse')
|
||||
commit('USER_NAME', res.data.data.user_name)
|
||||
commit('USER_ID', res.data.data.user_id)
|
||||
commit('DEPT_NAME', res.data.data.dept_name)
|
||||
commit('DEPT_ID', res.data.data.dept_id)
|
||||
setToken('bwhse')
|
||||
sessionStorage.setItem('ROLES', res.data.data.role_id)
|
||||
sessionStorage.setItem('USER_NAME', res.data.data.user_name)
|
||||
sessionStorage.setItem('USER_ID', res.data.data.user_id)
|
||||
sessionStorage.setItem('DEPT_NAME', res.data.data.dept_name)
|
||||
sessionStorage.setItem('DEPT_ID', res.data.data.dept_id)
|
||||
resolve()
|
||||
} else {
|
||||
Vue.prototype.$message.error(res.data.message)
|
||||
@ -85,6 +109,10 @@ const actions = {
|
||||
// logout(state.token).then(() => {
|
||||
commit('SET_TOKEN', '')
|
||||
commit('SET_ROLES', [])
|
||||
commit('USER_NAME', '')
|
||||
commit('USER_ID', '')
|
||||
commit('DEPT_NAME', '')
|
||||
commit('DEPT_ID', '')
|
||||
sessionStorage.clear
|
||||
removeToken()
|
||||
resetRouter()
|
||||
@ -104,6 +132,10 @@ const actions = {
|
||||
getRoles({ commit }, roles) {
|
||||
return new Promise(resolve => {
|
||||
commit('SET_ROLES', roles)
|
||||
commit('USER_NAME', sessionStorage.getItem('USER_NAME'))
|
||||
commit('USER_ID', sessionStorage.getItem('USER_ID'))
|
||||
commit('DEPT_NAME', sessionStorage.getItem('DEPT_NAME'))
|
||||
commit('DEPT_ID', sessionStorage.getItem('DEPT_ID'))
|
||||
resolve()
|
||||
})
|
||||
},
|
||||
|
@ -158,3 +158,38 @@
|
||||
// .el-input--medium .el-input__icon {
|
||||
// line-height: 26.8px;
|
||||
// }
|
||||
|
||||
.el-tree .el-tree-node__expand-icon.expanded {
|
||||
-webkit-transform: rotate(0deg);
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
//有子节点 且未展开
|
||||
.el-tree .el-icon-caret-right:before {
|
||||
background: url("../assets/images/1.png") no-repeat;
|
||||
content: "";
|
||||
display: block;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
font-size: 16px;
|
||||
background-size: 16px;
|
||||
}
|
||||
//有子节点 且已展开
|
||||
.el-tree .el-tree-node__expand-icon.expanded.el-icon-caret-right:before {
|
||||
background: url("../assets/images/2.png") no-repeat 0 3px;
|
||||
content: "";
|
||||
display: block;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
font-size: 16px;
|
||||
background-size: 16px;
|
||||
}
|
||||
//没有子节点
|
||||
.el-tree .el-tree-node__expand-icon.is-leaf::before {
|
||||
background: url("../assets/images/3.png") no-repeat;
|
||||
content: "";
|
||||
display: block;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
font-size: 16px;
|
||||
background-size: 16px;
|
||||
}
|
||||
|
@ -1,400 +1,400 @@
|
||||
/**
|
||||
* Created by PanJiaChen on 16/11/18.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Parse the time to string
|
||||
* @param {(Object|string|number)} time
|
||||
* @param {string} cFormat
|
||||
* @returns {string | null}
|
||||
*/
|
||||
export function parseTime(time, cFormat) {
|
||||
if (arguments.length === 0 || !time) {
|
||||
return null
|
||||
}
|
||||
const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
|
||||
let date
|
||||
if (typeof time === 'object') {
|
||||
date = time
|
||||
} else {
|
||||
if ((typeof time === 'string')) {
|
||||
if ((/^[0-9]+$/.test(time))) {
|
||||
// support "1548221490638"
|
||||
time = parseInt(time)
|
||||
} else {
|
||||
// support safari
|
||||
// https://stackoverflow.com/questions/4310953/invalid-date-in-safari
|
||||
time = time.replace(new RegExp(/-/gm), '/')
|
||||
}
|
||||
}
|
||||
|
||||
if ((typeof time === 'number') && (time.toString().length === 10)) {
|
||||
time = time * 1000
|
||||
}
|
||||
date = new Date(time)
|
||||
}
|
||||
const formatObj = {
|
||||
y: date.getFullYear(),
|
||||
m: date.getMonth() + 1,
|
||||
d: date.getDate(),
|
||||
h: date.getHours(),
|
||||
i: date.getMinutes(),
|
||||
s: date.getSeconds(),
|
||||
a: date.getDay()
|
||||
}
|
||||
const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
|
||||
const value = formatObj[key]
|
||||
// Note: getDay() returns 0 on Sunday
|
||||
if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value ] }
|
||||
return value.toString().padStart(2, '0')
|
||||
})
|
||||
return time_str
|
||||
}
|
||||
|
||||
export function parseDay(time, cFormat) {
|
||||
if (arguments.length === 0 || !time) {
|
||||
return null
|
||||
}
|
||||
const format = cFormat || '{y}-{m}-{d}'
|
||||
let date
|
||||
if (typeof time === 'object') {
|
||||
date = time
|
||||
} else {
|
||||
if ((typeof time === 'string')) {
|
||||
if ((/^[0-9]+$/.test(time))) {
|
||||
// support "1548221490638"
|
||||
time = parseInt(time)
|
||||
} else {
|
||||
// support safari
|
||||
// https://stackoverflow.com/questions/4310953/invalid-date-in-safari
|
||||
time = time.replace(new RegExp(/-/gm), '/')
|
||||
}
|
||||
}
|
||||
|
||||
if ((typeof time === 'number') && (time.toString().length === 10)) {
|
||||
time = time * 1000
|
||||
}
|
||||
date = new Date(time)
|
||||
}
|
||||
const formatObj = {
|
||||
y: date.getFullYear(),
|
||||
m: date.getMonth() + 2,
|
||||
d: date.getDate(),
|
||||
h: date.getHours(),
|
||||
i: date.getMinutes(),
|
||||
s: date.getSeconds(),
|
||||
a: date.getDay()
|
||||
}
|
||||
const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
|
||||
const value = formatObj[key]
|
||||
// Note: getDay() returns 0 on Sunday
|
||||
if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value ] }
|
||||
return value.toString().padStart(2, '0')
|
||||
})
|
||||
return time_str
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} time
|
||||
* @param {string} option
|
||||
* @returns {string}
|
||||
*/
|
||||
export function formatTime(time, option) {
|
||||
if (('' + time).length === 10) {
|
||||
time = parseInt(time) * 1000
|
||||
} else {
|
||||
time = +time
|
||||
}
|
||||
const d = new Date(time)
|
||||
const now = Date.now()
|
||||
|
||||
const diff = (now - d) / 1000
|
||||
|
||||
if (diff < 30) {
|
||||
return '刚刚'
|
||||
} else if (diff < 3600) {
|
||||
// less 1 hour
|
||||
return Math.ceil(diff / 60) + '分钟前'
|
||||
} else if (diff < 3600 * 24) {
|
||||
return Math.ceil(diff / 3600) + '小时前'
|
||||
} else if (diff < 3600 * 24 * 2) {
|
||||
return '1天前'
|
||||
}
|
||||
if (option) {
|
||||
return parseTime(time, option)
|
||||
} else {
|
||||
return (
|
||||
d.getMonth() +
|
||||
1 +
|
||||
'月' +
|
||||
d.getDate() +
|
||||
'日' +
|
||||
d.getHours() +
|
||||
'时' +
|
||||
d.getMinutes() +
|
||||
'分'
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} url
|
||||
* @returns {Object}
|
||||
*/
|
||||
export function getQueryObject(url) {
|
||||
url = url == null ? window.location.href : url
|
||||
const search = url.substring(url.lastIndexOf('?') + 1)
|
||||
const obj = {}
|
||||
const reg = /([^?&=]+)=([^?&=]*)/g
|
||||
search.replace(reg, (rs, $1, $2) => {
|
||||
const name = decodeURIComponent($1)
|
||||
let val = decodeURIComponent($2)
|
||||
val = String(val)
|
||||
obj[name] = val
|
||||
return rs
|
||||
})
|
||||
return obj
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} input value
|
||||
* @returns {number} output value
|
||||
*/
|
||||
export function byteLength(str) {
|
||||
// returns the byte length of an utf8 string
|
||||
let s = str.length
|
||||
for (var i = str.length - 1; i >= 0; i--) {
|
||||
const code = str.charCodeAt(i)
|
||||
if (code > 0x7f && code <= 0x7ff) s++
|
||||
else if (code > 0x7ff && code <= 0xffff) s += 2
|
||||
if (code >= 0xDC00 && code <= 0xDFFF) i--
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array} actual
|
||||
* @returns {Array}
|
||||
*/
|
||||
export function cleanArray(actual) {
|
||||
const newArray = []
|
||||
for (let i = 0; i < actual.length; i++) {
|
||||
if (actual[i]) {
|
||||
newArray.push(actual[i])
|
||||
}
|
||||
}
|
||||
return newArray
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Object} json
|
||||
* @returns {Array}
|
||||
*/
|
||||
export function param(json) {
|
||||
if (!json) return ''
|
||||
return cleanArray(
|
||||
Object.keys(json).map(key => {
|
||||
if (json[key] === undefined) return ''
|
||||
return encodeURIComponent(key) + '=' + encodeURIComponent(json[key])
|
||||
})
|
||||
).join('&')
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} url
|
||||
* @returns {Object}
|
||||
*/
|
||||
export function param2Obj(url) {
|
||||
const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ')
|
||||
if (!search) {
|
||||
return {}
|
||||
}
|
||||
const obj = {}
|
||||
const searchArr = search.split('&')
|
||||
searchArr.forEach(v => {
|
||||
const index = v.indexOf('=')
|
||||
if (index !== -1) {
|
||||
const name = v.substring(0, index)
|
||||
const val = v.substring(index + 1, v.length)
|
||||
obj[name] = val
|
||||
}
|
||||
})
|
||||
return obj
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} val
|
||||
* @returns {string}
|
||||
*/
|
||||
export function html2Text(val) {
|
||||
const div = document.createElement('div')
|
||||
div.innerHTML = val
|
||||
return div.textContent || div.innerText
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges two objects, giving the last one precedence
|
||||
* @param {Object} target
|
||||
* @param {(Object|Array)} source
|
||||
* @returns {Object}
|
||||
*/
|
||||
export function objectMerge(target, source) {
|
||||
if (typeof target !== 'object') {
|
||||
target = {}
|
||||
}
|
||||
if (Array.isArray(source)) {
|
||||
return source.slice()
|
||||
}
|
||||
Object.keys(source).forEach(property => {
|
||||
const sourceProperty = source[property]
|
||||
if (typeof sourceProperty === 'object') {
|
||||
target[property] = objectMerge(target[property], sourceProperty)
|
||||
} else {
|
||||
target[property] = sourceProperty
|
||||
}
|
||||
})
|
||||
return target
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {HTMLElement} element
|
||||
* @param {string} className
|
||||
*/
|
||||
export function toggleClass(element, className) {
|
||||
if (!element || !className) {
|
||||
return
|
||||
}
|
||||
let classString = element.className
|
||||
const nameIndex = classString.indexOf(className)
|
||||
if (nameIndex === -1) {
|
||||
classString += '' + className
|
||||
} else {
|
||||
classString =
|
||||
classString.substr(0, nameIndex) +
|
||||
classString.substr(nameIndex + className.length)
|
||||
}
|
||||
element.className = classString
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} type
|
||||
* @returns {Date}
|
||||
*/
|
||||
export function getTime(type) {
|
||||
if (type === 'start') {
|
||||
return new Date().getTime() - 3600 * 1000 * 24 * 90
|
||||
} else {
|
||||
return new Date(new Date().toDateString())
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Function} func
|
||||
* @param {number} wait
|
||||
* @param {boolean} immediate
|
||||
* @return {*}
|
||||
*/
|
||||
export function debounce(func, wait, immediate) {
|
||||
let timeout, args, context, timestamp, result
|
||||
|
||||
const later = function() {
|
||||
// 据上一次触发时间间隔
|
||||
const last = +new Date() - timestamp
|
||||
|
||||
// 上次被包装函数被调用时间间隔 last 小于设定时间间隔 wait
|
||||
if (last < wait && last > 0) {
|
||||
timeout = setTimeout(later, wait - last)
|
||||
} else {
|
||||
timeout = null
|
||||
// 如果设定为immediate===true,因为开始边界已经调用过了此处无需调用
|
||||
if (!immediate) {
|
||||
result = func.apply(context, args)
|
||||
if (!timeout) context = args = null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return function(...args) {
|
||||
context = this
|
||||
timestamp = +new Date()
|
||||
const callNow = immediate && !timeout
|
||||
// 如果延时不存在,重新设定延时
|
||||
if (!timeout) timeout = setTimeout(later, wait)
|
||||
if (callNow) {
|
||||
result = func.apply(context, args)
|
||||
context = args = null
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is just a simple version of deep copy
|
||||
* Has a lot of edge cases bug
|
||||
* If you want to use a perfect deep copy, use lodash's _.cloneDeep
|
||||
* @param {Object} source
|
||||
* @returns {Object}
|
||||
*/
|
||||
export function deepClone(source) {
|
||||
if (!source && typeof source !== 'object') {
|
||||
throw new Error('error arguments', 'deepClone')
|
||||
}
|
||||
const targetObj = source.constructor === Array ? [] : {}
|
||||
Object.keys(source).forEach(keys => {
|
||||
if (source[keys] && typeof source[keys] === 'object') {
|
||||
targetObj[keys] = deepClone(source[keys])
|
||||
} else {
|
||||
targetObj[keys] = source[keys]
|
||||
}
|
||||
})
|
||||
return targetObj
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array} arr
|
||||
* @returns {Array}
|
||||
*/
|
||||
export function uniqueArr(arr) {
|
||||
return Array.from(new Set(arr))
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
export function createUniqueString() {
|
||||
const timestamp = +new Date() + ''
|
||||
const randomNum = parseInt((1 + Math.random()) * 65536) + ''
|
||||
return (+(randomNum + timestamp)).toString(32)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an element has a class
|
||||
* @param {HTMLElement} elm
|
||||
* @param {string} cls
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function hasClass(ele, cls) {
|
||||
return !!ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)'))
|
||||
}
|
||||
|
||||
/**
|
||||
* Add class to element
|
||||
* @param {HTMLElement} elm
|
||||
* @param {string} cls
|
||||
*/
|
||||
export function addClass(ele, cls) {
|
||||
if (!hasClass(ele, cls)) ele.className += ' ' + cls
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove class from element
|
||||
* @param {HTMLElement} elm
|
||||
* @param {string} cls
|
||||
*/
|
||||
export function removeClass(ele, cls) {
|
||||
if (hasClass(ele, cls)) {
|
||||
const reg = new RegExp('(\\s|^)' + cls + '(\\s|$)')
|
||||
ele.className = ele.className.replace(reg, ' ')
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Created by PanJiaChen on 16/11/18.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Parse the time to string
|
||||
* @param {(Object|string|number)} time
|
||||
* @param {string} cFormat
|
||||
* @returns {string | null}
|
||||
*/
|
||||
export function parseTime(time, cFormat) {
|
||||
if (arguments.length === 0 || !time) {
|
||||
return null
|
||||
}
|
||||
const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
|
||||
let date
|
||||
if (typeof time === 'object') {
|
||||
date = time
|
||||
} else {
|
||||
if ((typeof time === 'string')) {
|
||||
if ((/^[0-9]+$/.test(time))) {
|
||||
// support "1548221490638"
|
||||
time = parseInt(time)
|
||||
} else {
|
||||
// support safari
|
||||
// https://stackoverflow.com/questions/4310953/invalid-date-in-safari
|
||||
time = time.replace(new RegExp(/-/gm), '/')
|
||||
}
|
||||
}
|
||||
|
||||
if ((typeof time === 'number') && (time.toString().length === 10)) {
|
||||
time = time * 1000
|
||||
}
|
||||
date = new Date(time)
|
||||
}
|
||||
const formatObj = {
|
||||
y: date.getFullYear(),
|
||||
m: date.getMonth() + 1,
|
||||
d: date.getDate(),
|
||||
h: date.getHours(),
|
||||
i: date.getMinutes(),
|
||||
s: date.getSeconds(),
|
||||
a: date.getDay()
|
||||
}
|
||||
const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
|
||||
const value = formatObj[key]
|
||||
// Note: getDay() returns 0 on Sunday
|
||||
if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value ] }
|
||||
return value.toString().padStart(2, '0')
|
||||
})
|
||||
return time_str
|
||||
}
|
||||
|
||||
export function parseDay(time, cFormat) {
|
||||
if (arguments.length === 0 || !time) {
|
||||
return null
|
||||
}
|
||||
const format = cFormat || '{y}-{m}-{d}'
|
||||
let date
|
||||
if (typeof time === 'object') {
|
||||
date = time
|
||||
} else {
|
||||
if ((typeof time === 'string')) {
|
||||
if ((/^[0-9]+$/.test(time))) {
|
||||
// support "1548221490638"
|
||||
time = parseInt(time)
|
||||
} else {
|
||||
// support safari
|
||||
// https://stackoverflow.com/questions/4310953/invalid-date-in-safari
|
||||
time = time.replace(new RegExp(/-/gm), '/')
|
||||
}
|
||||
}
|
||||
|
||||
if ((typeof time === 'number') && (time.toString().length === 10)) {
|
||||
time = time * 1000
|
||||
}
|
||||
date = new Date(time)
|
||||
}
|
||||
const formatObj = {
|
||||
y: date.getFullYear(),
|
||||
m: date.getMonth() + 1,
|
||||
d: date.getDate(),
|
||||
h: date.getHours(),
|
||||
i: date.getMinutes(),
|
||||
s: date.getSeconds(),
|
||||
a: date.getDay()
|
||||
}
|
||||
const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
|
||||
const value = formatObj[key]
|
||||
// Note: getDay() returns 0 on Sunday
|
||||
if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value ] }
|
||||
return value.toString().padStart(2, '0')
|
||||
})
|
||||
return time_str
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} time
|
||||
* @param {string} option
|
||||
* @returns {string}
|
||||
*/
|
||||
export function formatTime(time, option) {
|
||||
if (('' + time).length === 10) {
|
||||
time = parseInt(time) * 1000
|
||||
} else {
|
||||
time = +time
|
||||
}
|
||||
const d = new Date(time)
|
||||
const now = Date.now()
|
||||
|
||||
const diff = (now - d) / 1000
|
||||
|
||||
if (diff < 30) {
|
||||
return '刚刚'
|
||||
} else if (diff < 3600) {
|
||||
// less 1 hour
|
||||
return Math.ceil(diff / 60) + '分钟前'
|
||||
} else if (diff < 3600 * 24) {
|
||||
return Math.ceil(diff / 3600) + '小时前'
|
||||
} else if (diff < 3600 * 24 * 2) {
|
||||
return '1天前'
|
||||
}
|
||||
if (option) {
|
||||
return parseTime(time, option)
|
||||
} else {
|
||||
return (
|
||||
d.getMonth() +
|
||||
1 +
|
||||
'月' +
|
||||
d.getDate() +
|
||||
'日' +
|
||||
d.getHours() +
|
||||
'时' +
|
||||
d.getMinutes() +
|
||||
'分'
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} url
|
||||
* @returns {Object}
|
||||
*/
|
||||
export function getQueryObject(url) {
|
||||
url = url == null ? window.location.href : url
|
||||
const search = url.substring(url.lastIndexOf('?') + 1)
|
||||
const obj = {}
|
||||
const reg = /([^?&=]+)=([^?&=]*)/g
|
||||
search.replace(reg, (rs, $1, $2) => {
|
||||
const name = decodeURIComponent($1)
|
||||
let val = decodeURIComponent($2)
|
||||
val = String(val)
|
||||
obj[name] = val
|
||||
return rs
|
||||
})
|
||||
return obj
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} input value
|
||||
* @returns {number} output value
|
||||
*/
|
||||
export function byteLength(str) {
|
||||
// returns the byte length of an utf8 string
|
||||
let s = str.length
|
||||
for (var i = str.length - 1; i >= 0; i--) {
|
||||
const code = str.charCodeAt(i)
|
||||
if (code > 0x7f && code <= 0x7ff) s++
|
||||
else if (code > 0x7ff && code <= 0xffff) s += 2
|
||||
if (code >= 0xDC00 && code <= 0xDFFF) i--
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array} actual
|
||||
* @returns {Array}
|
||||
*/
|
||||
export function cleanArray(actual) {
|
||||
const newArray = []
|
||||
for (let i = 0; i < actual.length; i++) {
|
||||
if (actual[i]) {
|
||||
newArray.push(actual[i])
|
||||
}
|
||||
}
|
||||
return newArray
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Object} json
|
||||
* @returns {Array}
|
||||
*/
|
||||
export function param(json) {
|
||||
if (!json) return ''
|
||||
return cleanArray(
|
||||
Object.keys(json).map(key => {
|
||||
if (json[key] === undefined) return ''
|
||||
return encodeURIComponent(key) + '=' + encodeURIComponent(json[key])
|
||||
})
|
||||
).join('&')
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} url
|
||||
* @returns {Object}
|
||||
*/
|
||||
export function param2Obj(url) {
|
||||
const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ')
|
||||
if (!search) {
|
||||
return {}
|
||||
}
|
||||
const obj = {}
|
||||
const searchArr = search.split('&')
|
||||
searchArr.forEach(v => {
|
||||
const index = v.indexOf('=')
|
||||
if (index !== -1) {
|
||||
const name = v.substring(0, index)
|
||||
const val = v.substring(index + 1, v.length)
|
||||
obj[name] = val
|
||||
}
|
||||
})
|
||||
return obj
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} val
|
||||
* @returns {string}
|
||||
*/
|
||||
export function html2Text(val) {
|
||||
const div = document.createElement('div')
|
||||
div.innerHTML = val
|
||||
return div.textContent || div.innerText
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges two objects, giving the last one precedence
|
||||
* @param {Object} target
|
||||
* @param {(Object|Array)} source
|
||||
* @returns {Object}
|
||||
*/
|
||||
export function objectMerge(target, source) {
|
||||
if (typeof target !== 'object') {
|
||||
target = {}
|
||||
}
|
||||
if (Array.isArray(source)) {
|
||||
return source.slice()
|
||||
}
|
||||
Object.keys(source).forEach(property => {
|
||||
const sourceProperty = source[property]
|
||||
if (typeof sourceProperty === 'object') {
|
||||
target[property] = objectMerge(target[property], sourceProperty)
|
||||
} else {
|
||||
target[property] = sourceProperty
|
||||
}
|
||||
})
|
||||
return target
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {HTMLElement} element
|
||||
* @param {string} className
|
||||
*/
|
||||
export function toggleClass(element, className) {
|
||||
if (!element || !className) {
|
||||
return
|
||||
}
|
||||
let classString = element.className
|
||||
const nameIndex = classString.indexOf(className)
|
||||
if (nameIndex === -1) {
|
||||
classString += '' + className
|
||||
} else {
|
||||
classString =
|
||||
classString.substr(0, nameIndex) +
|
||||
classString.substr(nameIndex + className.length)
|
||||
}
|
||||
element.className = classString
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} type
|
||||
* @returns {Date}
|
||||
*/
|
||||
export function getTime(type) {
|
||||
if (type === 'start') {
|
||||
return new Date().getTime() - 3600 * 1000 * 24 * 90
|
||||
} else {
|
||||
return new Date(new Date().toDateString())
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Function} func
|
||||
* @param {number} wait
|
||||
* @param {boolean} immediate
|
||||
* @return {*}
|
||||
*/
|
||||
export function debounce(func, wait, immediate) {
|
||||
let timeout, args, context, timestamp, result
|
||||
|
||||
const later = function() {
|
||||
// 据上一次触发时间间隔
|
||||
const last = +new Date() - timestamp
|
||||
|
||||
// 上次被包装函数被调用时间间隔 last 小于设定时间间隔 wait
|
||||
if (last < wait && last > 0) {
|
||||
timeout = setTimeout(later, wait - last)
|
||||
} else {
|
||||
timeout = null
|
||||
// 如果设定为immediate===true,因为开始边界已经调用过了此处无需调用
|
||||
if (!immediate) {
|
||||
result = func.apply(context, args)
|
||||
if (!timeout) context = args = null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return function(...args) {
|
||||
context = this
|
||||
timestamp = +new Date()
|
||||
const callNow = immediate && !timeout
|
||||
// 如果延时不存在,重新设定延时
|
||||
if (!timeout) timeout = setTimeout(later, wait)
|
||||
if (callNow) {
|
||||
result = func.apply(context, args)
|
||||
context = args = null
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is just a simple version of deep copy
|
||||
* Has a lot of edge cases bug
|
||||
* If you want to use a perfect deep copy, use lodash's _.cloneDeep
|
||||
* @param {Object} source
|
||||
* @returns {Object}
|
||||
*/
|
||||
export function deepClone(source) {
|
||||
if (!source && typeof source !== 'object') {
|
||||
throw new Error('error arguments', 'deepClone')
|
||||
}
|
||||
const targetObj = source.constructor === Array ? [] : {}
|
||||
Object.keys(source).forEach(keys => {
|
||||
if (source[keys] && typeof source[keys] === 'object') {
|
||||
targetObj[keys] = deepClone(source[keys])
|
||||
} else {
|
||||
targetObj[keys] = source[keys]
|
||||
}
|
||||
})
|
||||
return targetObj
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array} arr
|
||||
* @returns {Array}
|
||||
*/
|
||||
export function uniqueArr(arr) {
|
||||
return Array.from(new Set(arr))
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
export function createUniqueString() {
|
||||
const timestamp = +new Date() + ''
|
||||
const randomNum = parseInt((1 + Math.random()) * 65536) + ''
|
||||
return (+(randomNum + timestamp)).toString(32)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an element has a class
|
||||
* @param {HTMLElement} elm
|
||||
* @param {string} cls
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function hasClass(ele, cls) {
|
||||
return !!ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)'))
|
||||
}
|
||||
|
||||
/**
|
||||
* Add class to element
|
||||
* @param {HTMLElement} elm
|
||||
* @param {string} cls
|
||||
*/
|
||||
export function addClass(ele, cls) {
|
||||
if (!hasClass(ele, cls)) ele.className += ' ' + cls
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove class from element
|
||||
* @param {HTMLElement} elm
|
||||
* @param {string} cls
|
||||
*/
|
||||
export function removeClass(ele, cls) {
|
||||
if (hasClass(ele, cls)) {
|
||||
const reg = new RegExp('(\\s|^)' + cls + '(\\s|$)')
|
||||
ele.className = ele.className.replace(reg, ' ')
|
||||
}
|
||||
}
|
||||
|
@ -1,119 +1,119 @@
|
||||
<template>
|
||||
<div class="dashboard-editor-container">
|
||||
|
||||
<panel-group @handleSetLineChartData="handleSetLineChartData" />
|
||||
|
||||
<el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
|
||||
<line-chart :chart-data="lineChartData" />
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="32">
|
||||
<el-col :xs="24" :sm="24" :lg="8">
|
||||
<div class="chart-wrapper">
|
||||
<raddar-chart />
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="24" :lg="8">
|
||||
<div class="chart-wrapper">
|
||||
<pie-chart />
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="24" :lg="8">
|
||||
<div class="chart-wrapper">
|
||||
<bar-chart />
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<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 /> -->
|
||||
</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 />
|
||||
</el-col>
|
||||
<el-col :xs="{span: 24}" :sm="{span: 12}" :md="{span: 12}" :lg="{span: 6}" :xl="{span: 6}" style="margin-bottom:30px;">
|
||||
<box-card />
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import PanelGroup from './components/PanelGroup'
|
||||
import LineChart from './components/LineChart'
|
||||
import RaddarChart from './components/RaddarChart'
|
||||
import PieChart from './components/PieChart'
|
||||
import BarChart from './components/BarChart'
|
||||
import TodoList from './components/TodoList'
|
||||
import BoxCard from './components/BoxCard'
|
||||
|
||||
const lineChartData = {
|
||||
newVisitis: {
|
||||
expectedData: [100, 120, 161, 134, 105, 160, 165],
|
||||
actualData: [120, 82, 91, 154, 162, 140, 145]
|
||||
},
|
||||
messages: {
|
||||
expectedData: [200, 192, 120, 144, 160, 130, 140],
|
||||
actualData: [180, 160, 151, 106, 145, 150, 130]
|
||||
},
|
||||
purchases: {
|
||||
expectedData: [80, 100, 121, 104, 105, 90, 100],
|
||||
actualData: [120, 90, 100, 138, 142, 130, 130]
|
||||
},
|
||||
shoppings: {
|
||||
expectedData: [130, 140, 141, 142, 145, 150, 160],
|
||||
actualData: [120, 82, 91, 154, 162, 140, 130]
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'DashboardAdmin',
|
||||
components: {
|
||||
PanelGroup,
|
||||
LineChart,
|
||||
RaddarChart,
|
||||
PieChart,
|
||||
BarChart,
|
||||
TodoList,
|
||||
BoxCard
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
lineChartData: lineChartData.newVisitis
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleSetLineChartData(type) {
|
||||
this.lineChartData = lineChartData[type]
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.dashboard-editor-container {
|
||||
padding: 32px;
|
||||
background-color: rgb(240, 242, 245);
|
||||
position: relative;
|
||||
|
||||
.github-corner {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
border: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.chart-wrapper {
|
||||
background: #fff;
|
||||
padding: 16px 16px 0;
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width:1024px) {
|
||||
.chart-wrapper {
|
||||
padding: 8px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div class="dashboard-editor-container">
|
||||
|
||||
<panel-group @handleSetLineChartData="handleSetLineChartData" />
|
||||
|
||||
<el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
|
||||
<line-chart :chart-data="lineChartData" />
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="32">
|
||||
<el-col :xs="24" :sm="24" :lg="8">
|
||||
<div class="chart-wrapper">
|
||||
<raddar-chart />
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="24" :lg="8">
|
||||
<div class="chart-wrapper">
|
||||
<pie-chart />
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="24" :lg="8">
|
||||
<div class="chart-wrapper">
|
||||
<bar-chart />
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<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 /> -->
|
||||
</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 />
|
||||
</el-col>
|
||||
<el-col :xs="{span: 24}" :sm="{span: 12}" :md="{span: 12}" :lg="{span: 6}" :xl="{span: 6}" style="margin-bottom:30px;">
|
||||
<box-card />
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import PanelGroup from './components/PanelGroup'
|
||||
import LineChart from './components/LineChart'
|
||||
import RaddarChart from './components/RaddarChart'
|
||||
import PieChart from './components/PieChart'
|
||||
import BarChart from './components/BarChart'
|
||||
import TodoList from './components/TodoList'
|
||||
import BoxCard from './components/BoxCard'
|
||||
|
||||
const lineChartData = {
|
||||
newVisitis: {
|
||||
expectedData: [100, 120, 161, 134, 105, 160, 165],
|
||||
actualData: [120, 82, 91, 154, 162, 140, 145]
|
||||
},
|
||||
messages: {
|
||||
expectedData: [200, 192, 120, 144, 160, 130, 140],
|
||||
actualData: [180, 160, 151, 106, 145, 150, 130]
|
||||
},
|
||||
purchases: {
|
||||
expectedData: [80, 100, 121, 104, 105, 90, 100],
|
||||
actualData: [120, 90, 100, 138, 142, 130, 130]
|
||||
},
|
||||
shoppings: {
|
||||
expectedData: [130, 140, 141, 142, 145, 150, 160],
|
||||
actualData: [120, 82, 91, 154, 162, 140, 130]
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'DashboardAdmin',
|
||||
components: {
|
||||
PanelGroup,
|
||||
LineChart,
|
||||
RaddarChart,
|
||||
PieChart,
|
||||
BarChart,
|
||||
TodoList,
|
||||
BoxCard
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
lineChartData: lineChartData.newVisitis
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleSetLineChartData(type) {
|
||||
this.lineChartData = lineChartData[type]
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.dashboard-editor-container {
|
||||
padding: 32px;
|
||||
background-color: rgb(240, 242, 245);
|
||||
position: relative;
|
||||
|
||||
.github-corner {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
border: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.chart-wrapper {
|
||||
background: #fff;
|
||||
padding: 16px 16px 0;
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width:1024px) {
|
||||
.chart-wrapper {
|
||||
padding: 8px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@ -54,19 +54,19 @@
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="检查地点">
|
||||
<el-input v-model="form.hidden_danger__check_location" />
|
||||
<el-input v-model="form.hidden_danger__check_location" maxlength="250" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="检查内容">
|
||||
<el-input v-model="form.hidden_danger__check_content" type="textarea" />
|
||||
<el-input v-model="form.hidden_danger__check_content" type="textarea" maxlength="500" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="隐患描述" prop="hidden_danger__check_problem">
|
||||
<el-input v-model="form.hidden_danger__check_problem" type="textarea" />
|
||||
<el-input v-model="form.hidden_danger__check_problem" type="textarea" maxlength="500" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -148,7 +148,7 @@
|
||||
>
|
||||
<SelDept ref="ReformDept" @updateDept="getReformDept" />
|
||||
<span>
|
||||
<el-button @click="reformDeptVisible = false">取 消</el-button>
|
||||
<!-- <el-button @click="reformDeptVisible = false">取 消</el-button> -->
|
||||
<el-button type="primary" @click="selReformDept">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
@ -161,6 +161,7 @@ import publicApi from '@/api/public'
|
||||
import buttons from '@/components/formBtn'
|
||||
import SelUser from '@/components/selUser'
|
||||
import SelDept from '@/components/selDept'
|
||||
import { parseDay } from '@/utils/index'
|
||||
export default {
|
||||
name: 'HiddenCheckCreateForm',
|
||||
components: {
|
||||
@ -177,9 +178,9 @@ export default {
|
||||
form: {
|
||||
hidden_danger__hidden_code: '',
|
||||
hidden_danger__hidden_state: '1',
|
||||
hidden_danger__check_man: '',
|
||||
hidden_danger__check_dept: '',
|
||||
hidden_danger__check_date: '',
|
||||
hidden_danger__check_man: this.$store.state.user.userName,
|
||||
hidden_danger__check_dept: this.$store.state.user.deptName,
|
||||
hidden_danger__check_date: parseDay(new Date()),
|
||||
hidden_danger__check_location: '',
|
||||
hidden_danger__check_content: '',
|
||||
hidden_danger__check_problem: '',
|
||||
@ -195,8 +196,8 @@ export default {
|
||||
hidden_danger__insp_det_id: '',
|
||||
hidden_danger__hidden_danger_id: '',
|
||||
hidden_danger__dept_id: '',
|
||||
hidden_danger__check_man_id: '',
|
||||
hidden_danger__check_dept_id: ''
|
||||
hidden_danger__check_man_id: this.$store.state.user.userId,
|
||||
hidden_danger__check_dept_id: this.$store.state.user.deptId
|
||||
},
|
||||
rules: {
|
||||
hidden_danger__check_man: [
|
||||
@ -230,6 +231,8 @@ export default {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
console.log(this.$store)
|
||||
console.log(this.form)
|
||||
this.getHiddenState()
|
||||
},
|
||||
methods: {
|
||||
|
@ -54,19 +54,19 @@
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="检查地点">
|
||||
<el-input v-model="form.hidden_danger__check_location" />
|
||||
<el-input v-model="form.hidden_danger__check_location" maxlength="250" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="检查内容">
|
||||
<el-input v-model="form.hidden_danger__check_content" type="textarea" />
|
||||
<el-input v-model="form.hidden_danger__check_content" type="textarea" maxlength="500" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="隐患描述" prop="hidden_danger__check_problem">
|
||||
<el-input v-model="form.hidden_danger__check_problem" type="textarea" />
|
||||
<el-input v-model="form.hidden_danger__check_problem" type="textarea" maxlength="500" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -100,6 +100,16 @@
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-row>
|
||||
<el-col class="img" :span="12">
|
||||
<span class="img-title">隐患排查图片</span>
|
||||
<ShowImages :data-id="id" table-name="hidden_danger" fun-id="hidden_check" />
|
||||
</el-col>
|
||||
<el-col class="img" :span="12">
|
||||
<span class="img-title">隐患整改图片</span>
|
||||
<ShowImages :data-id="id" table-name="hidden_danger" fun-id="hidden_check" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-dialog
|
||||
v-if="checkManVisible"
|
||||
title="选择人员"
|
||||
@ -161,12 +171,14 @@ import publicApi from '@/api/public'
|
||||
import buttons from '@/components/formBtn'
|
||||
import SelUser from '@/components/selUser'
|
||||
import SelDept from '@/components/selDept'
|
||||
import ShowImages from '@/components/show_images'
|
||||
export default {
|
||||
name: 'HiddenCheckAuditForm',
|
||||
components: {
|
||||
buttons,
|
||||
SelUser,
|
||||
SelDept
|
||||
SelDept,
|
||||
ShowImages
|
||||
},
|
||||
// props: {
|
||||
// id: { type: String, default: () => '' }
|
||||
@ -356,9 +368,6 @@ export default {
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.el-col{
|
||||
margin-left: 2%;
|
||||
}
|
||||
.buttons {
|
||||
display: flex;
|
||||
.el-button--primary {
|
||||
@ -366,4 +375,11 @@ export default {
|
||||
height: 26.8px;
|
||||
}
|
||||
}
|
||||
.img{
|
||||
margin-top: 10px;
|
||||
text-align: center;
|
||||
span{
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@ -6,6 +6,9 @@
|
||||
<el-button type="primary" @click="back">返回列表</el-button>
|
||||
</div>
|
||||
<el-form ref="form" :model="form" label-width="80px" :rules="rules">
|
||||
<div class="classify">
|
||||
<div class="classify-title">| <span>隐患排查</span></div>
|
||||
</div>
|
||||
<el-row>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="隐患编号">
|
||||
@ -100,6 +103,11 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div class="classify">
|
||||
<div class="classify-title">
|
||||
| <span>隐患整改</span>
|
||||
</div>
|
||||
</div>
|
||||
<el-row>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="整改时间" prop="hidden_danger__reform_date">
|
||||
@ -120,7 +128,7 @@
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="整改情况">
|
||||
<el-input v-model="form.hidden_danger__reform_desc" placeholder="请输入整改情况" class="input-with-select" type="textarea" clearable />
|
||||
<el-input v-model="form.hidden_danger__reform_desc" placeholder="请输入整改情况" class="input-with-select" type="textarea" clearable maxlength="500" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -382,4 +390,14 @@ export default {
|
||||
height: 26.8px;
|
||||
}
|
||||
}
|
||||
.classify{
|
||||
width: 100%;
|
||||
// display: inline-block;
|
||||
padding: 10px 0;
|
||||
font-weight: bold;
|
||||
color: #1890ff;
|
||||
span{
|
||||
color: #000;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@ -94,6 +94,7 @@ export default {
|
||||
data: [],
|
||||
deptTree: [],
|
||||
ids: [],
|
||||
isBacklog: this.$route.query.isBacklog || false,
|
||||
levels: [],
|
||||
pager: {
|
||||
pageNo: 0,
|
||||
@ -198,6 +199,9 @@ export default {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.isBacklog) {
|
||||
this.whereSql = ''
|
||||
}
|
||||
this.getList()
|
||||
},
|
||||
mounted() {
|
||||
|
@ -6,6 +6,9 @@
|
||||
<el-button type="primary" @click="back">返回列表</el-button>
|
||||
</div>
|
||||
<el-form ref="form" :model="form" label-width="80px" :rules="rules">
|
||||
<div class="classify">
|
||||
<div class="classify-title">| <span>隐患排查</span></div>
|
||||
</div>
|
||||
<el-row>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="隐患编号">
|
||||
@ -100,6 +103,9 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div class="classify">
|
||||
<div class="classify-title">| <span>隐患整改</span></div>
|
||||
</div>
|
||||
<el-row>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="整改时间" prop="hidden_danger__reform_date">
|
||||
@ -125,6 +131,9 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div class="classify">
|
||||
<div class="classify-title">| <span>隐患验收</span></div>
|
||||
</div>
|
||||
<el-row>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="验收时间" prop="hidden_danger__review_date">
|
||||
@ -147,7 +156,7 @@
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="验收情况">
|
||||
<el-input v-model="form.hidden_danger__review_desc" placeholder="请输入整改情况" class="input-with-select" type="textarea" clearable />
|
||||
<el-input v-model="form.hidden_danger__review_desc" placeholder="请输入整改情况" class="input-with-select" type="textarea" clearable maxlength="500" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -436,4 +445,16 @@ export default {
|
||||
height: 26.8px;
|
||||
}
|
||||
}
|
||||
.classify{
|
||||
width: 100%;
|
||||
// display: inline-block;
|
||||
padding: 10px 0;
|
||||
font-weight: bold;
|
||||
color: #1890ff;
|
||||
span{
|
||||
height: 100%;
|
||||
line-height: 18.4px;
|
||||
color: #000;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@ -90,6 +90,7 @@ export default {
|
||||
data: [],
|
||||
deptTree: [],
|
||||
ids: [],
|
||||
isBacklog: this.$route.query.isBacklog || false,
|
||||
levels: [],
|
||||
pager: {
|
||||
pageNo: 0,
|
||||
@ -174,6 +175,9 @@ export default {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.isBacklog) {
|
||||
this.whereSql = ''
|
||||
}
|
||||
this.getList()
|
||||
},
|
||||
mounted() {
|
||||
@ -188,8 +192,7 @@ export default {
|
||||
api.getDate(
|
||||
this.pager.pageSize,
|
||||
pageNo,
|
||||
this.whereSql,
|
||||
this.whereValue
|
||||
this.whereSql
|
||||
).then(data => {
|
||||
if (data.success) {
|
||||
this.data = data.data.root
|
||||
|
@ -26,7 +26,7 @@
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="巡检名称">
|
||||
<el-input v-model="form.safe_insp__insp_name" />
|
||||
<el-input v-model="form.safe_insp__insp_name" maxlength="250" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -52,7 +52,7 @@
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="form.safe_insp__insp_memo" />
|
||||
<el-input v-model="form.safe_insp__insp_memo" maxlength="500" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
@ -9,7 +9,7 @@
|
||||
<el-row>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="巡检单编号">
|
||||
<el-input v-model="form.safe_insp__insp_code" />
|
||||
<el-input v-model="form.safe_insp__insp_code" maxlength="250" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
@ -27,7 +27,7 @@
|
||||
<el-col :span="7">
|
||||
<el-form-item ref="safe_insp__insp_name" label="巡检名称" prop="safe_insp__insp_name">
|
||||
<el-input v-model="form.safe_insp__insp_name" placeholder="请选择巡检名称" class="input-with-select" clearable>
|
||||
<el-button slot="append" icon="el-icon-search" @click="inspNameVisible = !inspNameVisible" />
|
||||
<el-button slot="append" icon="el-icon-search" maxlength="250" @click="inspNameVisible = !inspNameVisible" />
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -54,7 +54,7 @@
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="form.safe_insp__insp_memo" />
|
||||
<el-input v-model="form.safe_insp__insp_memo" maxlength="500" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
@ -54,7 +54,7 @@
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="form.safe_insp__insp_memo" />
|
||||
<el-input v-model="form.safe_insp__insp_memo" maxlength="500" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -199,6 +199,7 @@ export default {
|
||||
console.log(this.id)
|
||||
this.getList()
|
||||
this.getTypeSel()
|
||||
this.getInsptimes()
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
@ -215,7 +216,7 @@ export default {
|
||||
})
|
||||
},
|
||||
async getTypeSel() {
|
||||
await publicApi.getTypeSel('insptimes').then(data => {
|
||||
await publicApi.getTypeSel('inspstate').then(data => {
|
||||
if (data.success) {
|
||||
this.options = data.data.root
|
||||
} else {
|
||||
@ -227,6 +228,7 @@ export default {
|
||||
await publicApi.getTypeSel('insptimes').then(data => {
|
||||
if (data.success) {
|
||||
this.insptimes = data.data.root
|
||||
console.log(this.insptimes, 'this.insptimes')
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
|
@ -56,6 +56,15 @@
|
||||
|
||||
<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="det_desc">
|
||||
<el-input v-model="form.insp_det__det_name" type="text" disabled="false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="巡检标准" :label-width="formLabelWidth" prop="det_desc">
|
||||
<el-input v-model="form.insp_det__det_std" type="text" disabled="false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="巡检方法" :label-width="formLabelWidth" prop="det_desc">
|
||||
<el-input v-model="form.insp_det__det_way" type="text" disabled="false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="巡检结果" :label-width="formLabelWidth" prop="insp_det__det_result">
|
||||
<el-select v-model="form.insp_det__det_result" placeholder="请选择">
|
||||
<el-option
|
||||
@ -67,7 +76,7 @@
|
||||
</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-input v-model="form.insp_det__det_desc" type="textarea" maxlength="500" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
|
@ -1,92 +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>
|
||||
<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" maxlength="40" @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" maxlength="100" @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>
|
||||
|
@ -40,7 +40,7 @@
|
||||
</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)" />
|
||||
<!-- <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>
|
||||
@ -416,4 +416,9 @@ export default {
|
||||
.el-card {
|
||||
margin-top: 10px;
|
||||
}
|
||||
.el-tree{
|
||||
height: 500px;
|
||||
overflow-x:auto;
|
||||
overflow-y:auto;
|
||||
}
|
||||
</style>
|
||||
|
@ -1,211 +1,219 @@
|
||||
<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" selective="single" @updateDept="updateDept" @updateDepts="updateDepts" />
|
||||
<span>
|
||||
<el-button @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()
|
||||
this.selDeptVisible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.selDept{
|
||||
margin-top: -10vh;
|
||||
}
|
||||
</style>
|
||||
<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 ref="sys_dept__dept_name" 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" maxlength="100" @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" selective="single" @updateDept="updateDept" @updateDepts="updateDepts" />
|
||||
<span>
|
||||
<el-button @click="reformDeptVisible = 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
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'form.sys_dept__dept_name': {
|
||||
handler(val, oldVal) {
|
||||
this.$refs['sys_dept__dept_name'].clearValidate()
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
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()
|
||||
this.selDeptVisible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.selDept{
|
||||
margin-top: -10vh;
|
||||
}
|
||||
</style>
|
||||
|
@ -51,7 +51,7 @@
|
||||
</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)" />
|
||||
<!-- <el-button v-if="scope.row.status !== 'NULLIFY'" icon="el-icon-delete" style="color:#F56C6C" type="text" title="删除" @click="Delete(scope.row)" /> -->
|
||||
</div>
|
||||
<div v-else>{{ scope.row[d.prop] }}</div>
|
||||
</template>
|
||||
|
Loading…
x
Reference in New Issue
Block a user