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
60bcb97066
commit
194d718c19
@ -170,7 +170,8 @@ export default {
|
||||
},
|
||||
treeList: [],
|
||||
whereSql: false,
|
||||
whereValue: ''
|
||||
whereValue: '',
|
||||
Users: ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@ -364,7 +365,7 @@ export default {
|
||||
this.getList()
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.$emit('updateUsers', val)
|
||||
this.Users = val
|
||||
},
|
||||
closeDialog() {
|
||||
this.dialogFormVisible = false
|
||||
|
@ -99,7 +99,14 @@ export const constantRoutes = [
|
||||
meta: { title: '安全点巡检', icon: 'list', noCache: true }
|
||||
},
|
||||
{
|
||||
path: 'edit_form/:id',
|
||||
path: 'edit_form/create',
|
||||
component: () => import('@/views/safe_insp/components/create/index'),
|
||||
name: 'EditForm',
|
||||
hidden: true,
|
||||
meta: { title: '安全点巡检新增', icon: 'list', noCache: true }
|
||||
},
|
||||
{
|
||||
path: 'edit_form/audit/:id',
|
||||
component: () => import('@/views/safe_insp/components/edit_form/index'),
|
||||
name: 'EditForm',
|
||||
hidden: true,
|
||||
|
56
src/views/insp_name/api/index.js
Normal file
56
src/views/insp_name/api/index.js
Normal file
@ -0,0 +1,56 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export default {
|
||||
getDate(pageSize, pageNo, isWhereSql, whereValue) {
|
||||
let whereSql = ''
|
||||
let whereType = ''
|
||||
if (isWhereSql) {
|
||||
whereSql = `dept_id like ?`
|
||||
whereType = 'string'
|
||||
}
|
||||
return request({
|
||||
url: `commonAction.do?eventcode=query_data&funid=queryevent&pagetype=grid&query_funid=insp_name&user_id=administrator`,
|
||||
method: 'post',
|
||||
data: `start=${pageNo}&limit=${pageSize}&where_sql=${whereSql}&where_value=${whereValue}&where_type=${whereType}&is_query=1&query_type=0`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
Crerte(data) {
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `${data}`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
auditSave(data) {
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `${data}`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
Delete(ids) {
|
||||
let keys = ''
|
||||
ids.forEach(d => {
|
||||
keys += 'keyid=' + d + '&'
|
||||
})
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `funid=insp_name&${keys}pagetype=editgrid&eventcode=delete_eg&user_id=administrator&dataType=json`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
getFormDate(id) {
|
||||
return request({
|
||||
url: `/commonAction.do?eventcode=query_data&funid=queryevent&pagetype=grid&query_funid=insp_name&user_id=administrator`,
|
||||
method: 'post',
|
||||
data: `start=0&limit=10&where_sql=safe_insp.safe_insp_id = ?&where_value=${id}&where_type=string&is_query=1&query_type=0`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
Save(data) {
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `funid=safe_insp&keyid=${data.safe_insp__safe_insp_id}&safe_insp__insp_code=${data.safe_insp__insp_code}&safe_insp__insp_name=${data.safe_insp__insp_name}&safe_insp__insp_man=${data.safe_insp__insp_man}&safe_insp__insp_times=${data.safe_insp__insp_times}&safe_insp__insp_name_id=${data.safe_insp__insp_name_id}&safe_insp__org_id=${data.safe_insp__org_id}&safe_insp__insp_state=${data.safe_insp__insp_state}&safe_insp__insp_date=${data.safe_insp__insp_date}&safe_insp__insp_memo=${data.safe_insp__insp_memo}&safe_insp__safe_insp_id=${data.safe_insp__safe_insp_id}&safe_insp__dept_id=${data.safe_insp__dept_id}&safe_insp__insp_man_id=${data.safe_insp__insp_man_id}&safe_insp__insp_ed=&safe_insp__insp_ing=${data.safe_insp__insp_ing}&safe_insp__insp_non=&pagetype=form&eventcode=save&dirtyfields=safe_insp.insp_man;safe_insp.insp_times;safe_insp.insp_date;safe_insp.insp_memo;safe_insp.insp_man_id;safe_insp.insp_name;safe_insp.insp_name_id;&fkValue=&user_id=administrator&dataType=json`
|
||||
}).then(response => response.data)
|
||||
}
|
||||
}
|
196
src/views/insp_name/components/edit_form/index.vue
Normal file
196
src/views/insp_name/components/edit_form/index.vue
Normal file
@ -0,0 +1,196 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card>
|
||||
<buttons funid="safe_insp" style="margin-bottom:20px" @save="save" />
|
||||
<el-form ref="form" :model="form" label-width="80px">
|
||||
<el-row>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="巡检单编号">
|
||||
<el-input v-model="form.safe_insp__insp_code" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="巡检状态">
|
||||
<el-select v-model="form.safe_insp__insp_state" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
:key="item.funall_control__value_data"
|
||||
:label="item.funall_control__display_data"
|
||||
:value="item.funall_control__value_data"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="巡检名称">
|
||||
<el-input v-model="form.safe_insp__insp_name" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="巡检日期">
|
||||
<el-date-picker
|
||||
v-model="form.safe_insp__insp_date"
|
||||
type="date"
|
||||
placeholder="选择日期"
|
||||
style="width: 100%;"
|
||||
format="yyyy-MM-dd"
|
||||
value-format="yyyy-MM-dd"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="巡检人员">
|
||||
<el-input v-model="form.safe_insp__insp_man" placeholder="请输入内容" class="input-with-select" clearable>
|
||||
<el-button slot="append" icon="el-icon-search" @click="selUserVisible = !selUserVisible" />
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="form.safe_insp__insp_memo" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="巡检频率">
|
||||
<el-input v-model="form.safe_insp__insp_times" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="已巡检数量">
|
||||
<el-input v-model="form.safe_insp__insp_ed" disabled="disabled" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="待巡检数量">
|
||||
<el-input v-model="form.safe_insp__insp_ing" disabled="disabled" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="不符合数量">
|
||||
<el-input v-model="form.safe_insp__insp_non" disabled="disabled" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<InspDet :id="id" />
|
||||
<el-dialog
|
||||
v-if="selUserVisible"
|
||||
title="选择人员"
|
||||
:visible.sync="selUserVisible"
|
||||
width="60%"
|
||||
>
|
||||
<SelUser @updateUsers="updateUsers" @updateUser="updateUser" />
|
||||
<span>
|
||||
<el-button @click="selUserVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="selUserVisible = false">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import api from '../../api'
|
||||
import publicApi from '@/api/public'
|
||||
import buttons from '@/components/formBtn'
|
||||
import InspDet from '../insp_det'
|
||||
import SelUser from '@/components/selUser'
|
||||
export default {
|
||||
name: 'EditForm',
|
||||
components: {
|
||||
buttons,
|
||||
SelUser,
|
||||
InspDet
|
||||
},
|
||||
// props: {
|
||||
// id: { type: String, default: () => '' }
|
||||
// },
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
form: {},
|
||||
id: this.$route.params.id,
|
||||
disabled: false,
|
||||
options: [],
|
||||
selUserVisible: false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
console.log(this.id)
|
||||
this.getList()
|
||||
this.getTypeSel()
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
this.loading = true
|
||||
api.getFormDate(this.id).then(data => {
|
||||
if (data.success) {
|
||||
this.form = data.data.root[0]
|
||||
setTimeout(() => {
|
||||
this.loading = false
|
||||
}, 200)
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
async getTypeSel() {
|
||||
await publicApi.getTypeSel('insptimes').then(data => {
|
||||
if (data.success) {
|
||||
this.options = data.data.root
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
onSubmit() {},
|
||||
updateUser(data) {
|
||||
this.form.safe_insp__insp_man = data.sys_user__user_name
|
||||
this.form.safe_insp__insp_man_id = data.sys_user__user_id
|
||||
this.selUserVisible = false
|
||||
},
|
||||
updateUsers(data) {
|
||||
this.form.safe_insp__insp_man = data.map(d => { return d.sys_user__user_name }).join(';')
|
||||
this.form.safe_insp__insp_man_id = data.map(d => { return d.sys_user__user_id }).join(';')
|
||||
},
|
||||
save() {
|
||||
api.Save(this.form).then(data => {
|
||||
if (data.success) {
|
||||
this.$message.success('保存成功!')
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
back() {
|
||||
// this.$router.back(-1)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
::v-deep .el-dialog__body {
|
||||
padding: 10px 20px !important;
|
||||
}
|
||||
::v-deep .el-form-item__label {
|
||||
text-align: right;
|
||||
/* vertical-align: middle; */
|
||||
float: left;
|
||||
font-size: 14px;
|
||||
color: #606266;
|
||||
line-height: 40px;
|
||||
padding: 0 6px 0 0;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.el-col{
|
||||
margin-left: 2%;
|
||||
}
|
||||
</style>
|
35
src/views/insp_name/components/insp_item/api/index.js
Normal file
35
src/views/insp_name/components/insp_item/api/index.js
Normal file
@ -0,0 +1,35 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export default {
|
||||
getDate(id, pageSize, pageNo, isWhereSql, whereValue) {
|
||||
let whereSql = ''
|
||||
let whereType = ''
|
||||
if (isWhereSql) {
|
||||
whereSql = `dept_id like ?`
|
||||
whereType = 'string'
|
||||
}
|
||||
return request({
|
||||
url: `/commonAction.do?eventcode=query_data&funid=queryevent&pagetype=subeditgrid&query_funid=insp_item&user_id=administrator`,
|
||||
method: 'post',
|
||||
data: `start=${pageNo}&limit=${pageSize}&where_sql=(insp_item.insp_name_id = ?)${whereSql}&where_value=${id}${whereValue}&where_type=string${whereType}&is_query=1&query_type=0`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
Crerte(data) {
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `${data}`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
Delete(ids) {
|
||||
let keys = ''
|
||||
ids.forEach(d => {
|
||||
keys += 'keyid=' + d + '&'
|
||||
})
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `funid=insp_item&${keys}pagetype=editgrid&eventcode=delete_eg&user_id=administrator&dataType=json`
|
||||
}).then(response => response.data)
|
||||
}
|
||||
}
|
273
src/views/insp_name/components/insp_item/index.vue
Normal file
273
src/views/insp_name/components/insp_item/index.vue
Normal file
@ -0,0 +1,273 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-card>
|
||||
<buttons funid="insp_item" style="margin-bottom:10px" @editCreate="editCreate" @editDelete="editDelete" />
|
||||
<el-table
|
||||
ref="deptTable"
|
||||
v-loading="loading"
|
||||
:data="data"
|
||||
style="width: 100%"
|
||||
@selection-change="handleSelectionChange"
|
||||
@cell-dblclick="cellDblclick"
|
||||
>
|
||||
<template v-for="(d,i) in tableHeader">
|
||||
<el-table-column v-if="d.type && d.type === 'selection'" :key="i" :type="d.type" :fixed="d.fixed" />
|
||||
<el-table-column
|
||||
v-else
|
||||
:key="i"
|
||||
:prop="d.prop"
|
||||
:label="d.label"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<div v-if="d.label === '操作'">
|
||||
<el-button icon="el-icon-view" type="text" title="编辑" @click="edit(scope.row)" />
|
||||
<el-button v-if="scope.row.status !== 'NULLIFY'" icon="el-icon-delete" style="color:#F56C6C" type="text" title="删除" @click="Delete(scope.row)" />
|
||||
</div>
|
||||
<div v-else>{{ scope.row[d.prop] }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
:current-page="pager.pageNo"
|
||||
:page-sizes="[10, 30, 50, 100, 500]"
|
||||
:page-size="pager.pageSize"
|
||||
:total="pager.total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@size-change="sizeChange"
|
||||
@current-change="pageChange"
|
||||
/>
|
||||
</el-card>
|
||||
|
||||
<el-dialog v-if="dialogFormVisible" :title="title" :visible.sync="dialogFormVisible" @close="closeDialog">
|
||||
<el-form ref="form" :model="form" :rules="rules">
|
||||
<el-form-item label="巡检项目" :label-width="formLabelWidth" prop="insp_item__item_name">
|
||||
<el-input v-model="form.insp_item__item_name" type="textarea" />
|
||||
</el-form-item>
|
||||
<el-form-item label="巡检标准" :label-width="formLabelWidth" prop="insp_item__item_std">
|
||||
<el-input v-model="form.insp_item__item_std" type="textarea" />
|
||||
</el-form-item>
|
||||
<el-form-item label="巡检方法" :label-width="formLabelWidth" prop="insp_item__item_way">
|
||||
<el-input v-model="form.insp_item__item_way" type="textarea" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="create">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import api from './api'
|
||||
import publicApi from '@/api/public'
|
||||
import buttons from '@/components/Buttons'
|
||||
export default {
|
||||
name: 'SafeIdsp',
|
||||
components: {
|
||||
buttons
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
id: '',
|
||||
loading: false,
|
||||
data: [],
|
||||
deptTree: [],
|
||||
ids: [],
|
||||
pager: {
|
||||
pageNo: 0,
|
||||
pageSize: 10,
|
||||
total: 0
|
||||
},
|
||||
tableHeader: [
|
||||
{
|
||||
prop: 'selection',
|
||||
type: 'selection',
|
||||
fixed: 'left'
|
||||
}, {
|
||||
prop: 'insp_item__item_name',
|
||||
label: '巡检项目'
|
||||
}, {
|
||||
prop: 'insp_item__item_std',
|
||||
label: '巡检标准'
|
||||
},
|
||||
{
|
||||
prop: 'insp_item__item_way',
|
||||
label: '巡检方法'
|
||||
}, {
|
||||
prop: 'opration',
|
||||
label: '操作',
|
||||
width: '70px',
|
||||
fixed: 'right',
|
||||
minWidth: '70px',
|
||||
show: true
|
||||
}],
|
||||
dept_id: '',
|
||||
level: '',
|
||||
parent_id: '',
|
||||
initFrom: {
|
||||
insp_item__insp_item_id: '',
|
||||
insp_item__item_name: '',
|
||||
insp_item__item_std: '',
|
||||
insp_item__item_way: ''
|
||||
},
|
||||
form: {},
|
||||
rules: {
|
||||
insp_item__item_name: [
|
||||
{ required: true, message: '请输入巡检项目', trigger: 'blur' }
|
||||
],
|
||||
insp_item__item_std: [
|
||||
{ required: true, message: '请输入巡检标准', trigger: 'blur' }
|
||||
],
|
||||
insp_item__item_way: [
|
||||
{ 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: '',
|
||||
title: ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.value) {
|
||||
this.id = this.value
|
||||
this.getList(this.id)
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
getList(id) {
|
||||
this.id = id
|
||||
this.loading = true
|
||||
let pageNo = this.pager.pageNo * this.pager.pageSize - this.pager.pageSize
|
||||
if (pageNo < 0) {
|
||||
pageNo = 0
|
||||
}
|
||||
api.getDate(
|
||||
this.id,
|
||||
this.pager.pageSize,
|
||||
pageNo,
|
||||
this.whereSql,
|
||||
this.whereValue
|
||||
).then(data => {
|
||||
if (data.success) {
|
||||
this.data = data.data.root
|
||||
this.pager.total = data.data.total
|
||||
setTimeout(() => {
|
||||
this.loading = false
|
||||
}, 200)
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
editCreate() {
|
||||
this.title = '新增'
|
||||
this.form = JSON.parse(JSON.stringify(this.initFrom))
|
||||
this.dialogFormVisible = true
|
||||
},
|
||||
create() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
const data = `funid=insp_item&fkValue=${this.id}&pfunid=insp_name&keyid=${this.form.insp_item__insp_item_id}&pagetype=editgrid&eventcode=save_eg&insp_item__item_name=${this.form.insp_item__item_name}&insp_item__item_std=${this.form.insp_item__item_std}&insp_item__item_way=${this.form.insp_item__item_way}&insp_item__insp_item_id=${this.form.insp_item__insp_item_id}&insp_item__insp_name_id=${this.id}&user_id=administrator&dataType=json`
|
||||
api.Crerte(data).then(data => {
|
||||
if (data.success) {
|
||||
this.getList(this.id)
|
||||
this.dialogFormVisible = false
|
||||
this.$refs['form'].resetFields()
|
||||
this.$message.success('保存成功!')
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
edit(row) {
|
||||
this.title = '编辑'
|
||||
this.dialogFormVisible = true
|
||||
this.form = JSON.parse(JSON.stringify(row))
|
||||
},
|
||||
Delete(row) {
|
||||
this.ids = []
|
||||
this.ids.push(row.insp_item__insp_item_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.id)
|
||||
this.$message.success('删除成功!')
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
}).catch(() => {})
|
||||
} else {
|
||||
this.$message.warning('请选择数据进行删除')
|
||||
}
|
||||
},
|
||||
auditFormChange(form) {
|
||||
this.saveFrom = form
|
||||
},
|
||||
cellDblclick(row) {
|
||||
this.title = '编辑'
|
||||
this.form = JSON.parse(JSON.stringify(row))
|
||||
this.dialogFormVisible = true
|
||||
},
|
||||
sizeChange(size) {
|
||||
this.pager.pageSize = size
|
||||
this.getList(this.id)
|
||||
},
|
||||
pageChange(page) {
|
||||
this.pager.pageNo = page
|
||||
this.getList(this.id)
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.ids = val.map(d => d.insp_item__insp_item_id)
|
||||
},
|
||||
closeDialog() {
|
||||
this.dialogFormVisible = false
|
||||
this.$refs['form'].resetFields()
|
||||
this.form.dept_name = ''
|
||||
this.form.dept_code = ''
|
||||
},
|
||||
handleNodeClick(data) {
|
||||
console.log(data)
|
||||
this.whereValue = encodeURI(`${data.sys_dept__dept_id}\%`)
|
||||
this.whereSql = true
|
||||
this.getList(this.id)
|
||||
},
|
||||
async getTypeSel() {
|
||||
await publicApi.getTypeSel('inspresult').then(data => {
|
||||
if (data.success) {
|
||||
this.inspresult = data.data.root
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.el-card {
|
||||
margin-top: 10px;
|
||||
}
|
||||
</style>
|
@ -1,13 +1,261 @@
|
||||
<template>
|
||||
<div>123</div>
|
||||
<div>
|
||||
<buttons funid="insp_name" style="margin:10px 10px" @editCreate="editCreate" @editDelete="editDelete" @editSave="editSave" @upload="upload" />
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-card>
|
||||
<el-table
|
||||
ref="deptTable"
|
||||
v-loading="loading"
|
||||
:data="data"
|
||||
style="width: 100%"
|
||||
@row-click="rowClick"
|
||||
@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 === '操作'">
|
||||
<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-col :span="16">
|
||||
<InspItem ref="inspItem" v-model="id" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<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="dept_code">
|
||||
<el-input v-model="form.insp_name__insp_name" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="create">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<el-dialog v-if="dialogFormVisible" :title="title" :visible.sync="dialogFormVisible" @close="closeDialog">
|
||||
<el-form ref="form" :model="form" :rules="rules">
|
||||
<el-form-item label="巡检表名称" :label-width="formLabelWidth" prop="dept_code">
|
||||
<el-input v-model="form.insp_name__insp_name" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="create">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import api from './api'
|
||||
import buttons from '@/components/Buttons'
|
||||
import InspItem from './components/insp_item'
|
||||
export default {
|
||||
|
||||
name: 'SafeIdsp',
|
||||
components: {
|
||||
buttons,
|
||||
InspItem
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
data: [],
|
||||
deptTree: [],
|
||||
ids: [],
|
||||
levels: [],
|
||||
pager: {
|
||||
pageNo: 0,
|
||||
pageSize: 10,
|
||||
total: 0
|
||||
},
|
||||
tableHeader: [
|
||||
{
|
||||
prop: 'selection',
|
||||
type: 'selection',
|
||||
fixed: 'left'
|
||||
}, {
|
||||
prop: 'insp_name__insp_name',
|
||||
label: '巡检表名称'
|
||||
}, {
|
||||
prop: 'opration',
|
||||
label: '操作',
|
||||
width: '70px',
|
||||
fixed: 'right',
|
||||
minWidth: '70px',
|
||||
show: true
|
||||
}],
|
||||
value: '',
|
||||
id: '',
|
||||
form: { },
|
||||
initForm: {
|
||||
insp_name__insp_name: '',
|
||||
insp_name__insp_name_id: ''
|
||||
},
|
||||
rules: {
|
||||
insp_name__insp_name: [
|
||||
{ required: true, message: '请输入部门编码', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
dialogFormVisible: false,
|
||||
dialogEditVisible: false,
|
||||
formLabelWidth: '120px',
|
||||
auditForm: {},
|
||||
saveFrom: {},
|
||||
treeList: [],
|
||||
whereSql: false,
|
||||
whereValue: '',
|
||||
title: ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
this.loading = true
|
||||
let pageNo = this.pager.pageNo * this.pager.pageSize - this.pager.pageSize
|
||||
if (pageNo < 0) {
|
||||
pageNo = 0
|
||||
}
|
||||
api.getDate(
|
||||
this.pager.pageSize,
|
||||
pageNo,
|
||||
this.whereSql,
|
||||
this.whereValue
|
||||
).then(data => {
|
||||
if (data.success) {
|
||||
this.data = data.data.root
|
||||
this.pager.total = data.data.total
|
||||
setTimeout(() => {
|
||||
this.loading = false
|
||||
}, 200)
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
editCreate() {
|
||||
this.title = '新增'
|
||||
this.dialogFormVisible = true
|
||||
this.form = JSON.parse(JSON.stringify(this.initForm))
|
||||
},
|
||||
create() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
const data = `funid=insp_name&keyid=${this.form.insp_name__insp_name_id}&pagetype=editgrid&eventcode=save_eg&insp_name__insp_name=${this.form.insp_name__insp_name}&insp_name__insp_name_id=${this.form.insp_name__insp_name_id}&insp_name__org_id=&insp_name__dept_id=&user_id=administrator&dataType=json`
|
||||
api.Crerte(data).then(data => {
|
||||
if (data.success) {
|
||||
this.getList()
|
||||
this.dialogFormVisible = false
|
||||
this.$refs['form'].resetFields()
|
||||
this.$message.success('保存成功!')
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
edit(row) {
|
||||
this.title = '编辑'
|
||||
this.dialogFormVisible = true
|
||||
this.form = JSON.parse(JSON.stringify(row))
|
||||
},
|
||||
Delete(row) {
|
||||
this.ids = []
|
||||
this.ids.push(row.insp_name__insp_name_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')
|
||||
},
|
||||
auditFormChange(form) {
|
||||
this.form = form
|
||||
},
|
||||
cellDblclick(row) {
|
||||
this.title = '编辑'
|
||||
this.dialogFormVisible = true
|
||||
this.form = JSON.parse(JSON.stringify(row))
|
||||
},
|
||||
sizeChange(size) {
|
||||
this.pager.pageSize = size
|
||||
this.getList()
|
||||
},
|
||||
pageChange(page) {
|
||||
this.pager.pageNo = page
|
||||
this.getList()
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.ids = val.map(d => d.insp_name__insp_name_id)
|
||||
},
|
||||
rowClick(row) {
|
||||
this.id = row.insp_name__insp_name_id
|
||||
this.$refs.inspItem.getList(this.id)
|
||||
},
|
||||
closeDialog() {
|
||||
this.dialogFormVisible = false
|
||||
this.$refs['form'].resetFields()
|
||||
this.form.dept_name = ''
|
||||
this.form.dept_code = ''
|
||||
},
|
||||
handleNodeClick(data) {
|
||||
console.log(data)
|
||||
this.whereValue = encodeURI(`${data.sys_dept__dept_id}\%`)
|
||||
this.whereSql = true
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.el-card {
|
||||
margin-top: 10px;
|
||||
}
|
||||
</style>
|
||||
|
@ -25,7 +25,14 @@ export default {
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `${data}`
|
||||
data: `funid=safe_insp&keyid=${data.safe_insp__safe_insp_id}&safe_insp__insp_code=${data.safe_insp__insp_code}&safe_insp__insp_name=${data.safe_insp__insp_name}&safe_insp__insp_man=${data.safe_insp__insp_man}&safe_insp__insp_times=${data.safe_insp__insp_times}&safe_insp__insp_name_id=${data.safe_insp__insp_name_id}&safe_insp__org_id=${data.safe_insp__org_id}&safe_insp__insp_state=${data.safe_insp__insp_state}&safe_insp__insp_date=${data.safe_insp__insp_date}&safe_insp__insp_memo=${data.safe_insp__insp_memo}&safe_insp__safe_insp_id=${data.safe_insp__safe_insp_id}&safe_insp__dept_id=${data.safe_insp__dept_id}&safe_insp__insp_man_id=${data.safe_insp__insp_man_id}&safe_insp__insp_ed=&safe_insp__insp_ing=${data.safe_insp__insp_ing}&safe_insp__insp_non=&pagetype=form&eventcode=create&dirtyfields=safe_insp.insp_man;safe_insp.insp_times;safe_insp.insp_date;safe_insp.insp_memo;safe_insp.insp_man_id;safe_insp.insp_name;safe_insp.insp_name_id;&fkValue=&user_id=administrator&dataType=json`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
Save(data) {
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `funid=safe_insp&keyid=${data.safe_insp__safe_insp_id}&safe_insp__insp_code=${data.safe_insp__insp_code}&safe_insp__insp_name=${data.safe_insp__insp_name}&safe_insp__insp_man=${data.safe_insp__insp_man}&safe_insp__insp_times=${data.safe_insp__insp_times}&safe_insp__insp_name_id=${data.safe_insp__insp_name_id}&safe_insp__org_id=${data.safe_insp__org_id}&safe_insp__insp_state=${data.safe_insp__insp_state}&safe_insp__insp_date=${data.safe_insp__insp_date}&safe_insp__insp_memo=${data.safe_insp__insp_memo}&safe_insp__safe_insp_id=${data.safe_insp__safe_insp_id}&safe_insp__dept_id=${data.safe_insp__dept_id}&safe_insp__insp_man_id=${data.safe_insp__insp_man_id}&safe_insp__insp_ed=&safe_insp__insp_ing=${data.safe_insp__insp_ing}&safe_insp__insp_non=&pagetype=form&eventcode=save&dirtyfields=safe_insp.insp_man;safe_insp.insp_times;safe_insp.insp_date;safe_insp.insp_memo;safe_insp.insp_man_id;safe_insp.insp_name;safe_insp.insp_name_id;&fkValue=&user_id=administrator&dataType=json`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
auditSave(data) {
|
||||
@ -52,12 +59,5 @@ export default {
|
||||
method: 'post',
|
||||
data: `start=0&limit=10&where_sql=safe_insp.safe_insp_id = ?&where_value=${id}&where_type=string&is_query=1&query_type=0`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
Save(data) {
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `funid=safe_insp&keyid=${data.safe_insp__safe_insp_id}&safe_insp__insp_code=${data.safe_insp__insp_code}&safe_insp__insp_name=${data.safe_insp__insp_name}&safe_insp__insp_man=${data.safe_insp__insp_man}&safe_insp__insp_times=${data.safe_insp__insp_times}&safe_insp__insp_name_id=${data.safe_insp__insp_name_id}&safe_insp__org_id=${data.safe_insp__org_id}&safe_insp__insp_state=${data.safe_insp__insp_state}&safe_insp__insp_date=${data.safe_insp__insp_date}&safe_insp__insp_memo=${data.safe_insp__insp_memo}&safe_insp__safe_insp_id=${data.safe_insp__safe_insp_id}&safe_insp__dept_id=${data.safe_insp__dept_id}&safe_insp__insp_man_id=${data.safe_insp__insp_man_id}&safe_insp__insp_ed=&safe_insp__insp_ing=${data.safe_insp__insp_ing}&safe_insp__insp_non=&pagetype=form&eventcode=save&dirtyfields=safe_insp.insp_man;safe_insp.insp_times;safe_insp.insp_date;safe_insp.insp_memo;safe_insp.insp_man_id;safe_insp.insp_name;safe_insp.insp_name_id;&fkValue=&user_id=administrator&dataType=json`
|
||||
}).then(response => response.data)
|
||||
}
|
||||
}
|
||||
|
240
src/views/safe_insp/components/create/index.vue
Normal file
240
src/views/safe_insp/components/create/index.vue
Normal file
@ -0,0 +1,240 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card>
|
||||
<buttons funid="safe_insp" style="margin-bottom:20px" @save="save" />
|
||||
<el-form ref="form" :model="form" label-width="80px">
|
||||
<el-row>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="巡检单编号">
|
||||
<el-input v-model="form.safe_insp__insp_code" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="巡检状态">
|
||||
<el-select v-model="form.safe_insp__insp_state" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
:key="item.funall_control__value_data"
|
||||
:label="item.funall_control__display_data"
|
||||
:value="item.funall_control__value_data"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="巡检名称">
|
||||
<el-input v-model="form.safe_insp__insp_name" placeholder="请选择巡检名称" class="input-with-select" clearable>
|
||||
<el-button slot="append" icon="el-icon-search" @click="inspNameVisible = !inspNameVisible" />
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="巡检日期">
|
||||
<el-date-picker
|
||||
v-model="form.safe_insp__insp_date"
|
||||
type="date"
|
||||
placeholder="选择日期"
|
||||
style="width: 100%;"
|
||||
format="yyyy-MM-dd"
|
||||
value-format="yyyy-MM-dd"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="巡检人员">
|
||||
<el-input v-model="form.safe_insp__insp_man" placeholder="请选择巡检人员" class="input-with-select" clearable>
|
||||
<el-button slot="append" icon="el-icon-search" @click="selUserVisible = !selUserVisible" />
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="form.safe_insp__insp_memo" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="巡检频率">
|
||||
<el-input v-model="form.safe_insp__insp_times" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="已巡检数量">
|
||||
<el-input v-model="form.safe_insp__insp_ed" disabled="disabled" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="待巡检数量">
|
||||
<el-input v-model="form.safe_insp__insp_ing" disabled="disabled" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="不符合数量">
|
||||
<el-input v-model="form.safe_insp__insp_non" disabled="disabled" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<InspDet v-if="id" :id="id" />
|
||||
<el-dialog
|
||||
v-if="selUserVisible"
|
||||
title="选择人员"
|
||||
:visible.sync="selUserVisible"
|
||||
width="60%"
|
||||
>
|
||||
<SelUser ref="selUser" @updateUser="updateUser" />
|
||||
<span>
|
||||
<el-button @click="selUserVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="selUser">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<el-dialog
|
||||
v-if="inspNameVisible"
|
||||
title="选择巡检名称"
|
||||
:visible.sync="inspNameVisible"
|
||||
width="60%"
|
||||
>
|
||||
<InspName @updateInspName="updateInspName" />
|
||||
<span>
|
||||
<el-button @click="inspNameVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="inspNameVisible = false">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import api from '../../api'
|
||||
import publicApi from '@/api/public'
|
||||
import buttons from '@/components/formBtn'
|
||||
import InspDet from '../insp_det'
|
||||
import SelUser from '@/components/selUser'
|
||||
import InspName from '../inspName'
|
||||
export default {
|
||||
name: 'AuditForm',
|
||||
components: {
|
||||
buttons,
|
||||
SelUser,
|
||||
InspDet,
|
||||
InspName
|
||||
},
|
||||
// props: {
|
||||
// id: { type: String, default: () => '' }
|
||||
// },
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
form: {
|
||||
safe_insp__insp_code: '',
|
||||
safe_insp__insp_name: '',
|
||||
safe_insp__insp_state: '',
|
||||
safe_insp__insp_date: '',
|
||||
safe_insp__insp_man: '',
|
||||
safe_insp__insp_times: '',
|
||||
safe_insp__insp_memo: '',
|
||||
safe_insp__insp_ed: '',
|
||||
safe_insp__insp_ing: '',
|
||||
safe_insp__insp_non: '',
|
||||
safe_insp__insp_name_id: '',
|
||||
safe_insp__org_id: '',
|
||||
safe_insp__safe_insp_id: '',
|
||||
safe_insp__dept_id: '',
|
||||
safe_insp__insp_man_id: ''
|
||||
},
|
||||
inspName: [],
|
||||
disabled: false,
|
||||
options: [],
|
||||
selUserVisible: false,
|
||||
inspNameVisible: false,
|
||||
id: ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getTypeSel()
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
this.loading = true
|
||||
api.getFormDate().then(data => {
|
||||
if (data.success) {
|
||||
this.form = data.data.root[0]
|
||||
setTimeout(() => {
|
||||
this.loading = false
|
||||
}, 200)
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
async getTypeSel() {
|
||||
await publicApi.getTypeSel('insptimes').then(data => {
|
||||
if (data.success) {
|
||||
this.options = data.data.root
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
onSubmit() {},
|
||||
updateUser(data) {
|
||||
this.form.safe_insp__insp_man = data.sys_user__user_name
|
||||
this.form.safe_insp__insp_man_id = data.sys_user__user_id
|
||||
this.selUserVisible = false
|
||||
},
|
||||
selUser() {
|
||||
this.updateUsers(this.$refs.selUser.Users)
|
||||
this.selUserVisible = false
|
||||
},
|
||||
updateUsers(data) {
|
||||
this.form.safe_insp__insp_man = data.map(d => { return d.sys_user__user_name }).join(';')
|
||||
this.form.safe_insp__insp_man_id = data.map(d => { return d.sys_user__user_id }).join(';')
|
||||
this.selUserVisible = false
|
||||
},
|
||||
updateInspName(data) {
|
||||
this.form.safe_insp__insp_name = data.insp_name__insp_name
|
||||
this.form.safe_insp__insp_name_id = data.insp_name__insp_name_id
|
||||
this.inspNameVisible = false
|
||||
},
|
||||
save() {
|
||||
api.Crerte(this.form).then(data => {
|
||||
if (data.success) {
|
||||
this.$message.success('保存成功!')
|
||||
const param = `/insp/edit_form/audit/${data.data.keyid}`
|
||||
this.$router.push(param)
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
back() {
|
||||
// this.$router.back(-1)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
::v-deep .el-dialog__body {
|
||||
padding: 10px 20px !important;
|
||||
}
|
||||
::v-deep .el-form-item__label {
|
||||
text-align: right;
|
||||
/* vertical-align: middle; */
|
||||
float: left;
|
||||
font-size: 14px;
|
||||
color: #606266;
|
||||
line-height: 40px;
|
||||
padding: 0 6px 0 0;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.el-col{
|
||||
margin-left: 2%;
|
||||
}
|
||||
</style>
|
56
src/views/safe_insp/components/inspName/api/index.js
Normal file
56
src/views/safe_insp/components/inspName/api/index.js
Normal file
@ -0,0 +1,56 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export default {
|
||||
getDate(pageSize, pageNo, isWhereSql, whereValue) {
|
||||
let whereSql = ''
|
||||
let whereType = ''
|
||||
if (isWhereSql) {
|
||||
whereSql = `dept_id like ?`
|
||||
whereType = 'string'
|
||||
}
|
||||
return request({
|
||||
url: `commonAction.do?eventcode=query_data&funid=queryevent&pagetype=grid&query_funid=insp_name&user_id=administrator`,
|
||||
method: 'post',
|
||||
data: `start=${pageNo}&limit=${pageSize}&where_sql=${whereSql}&where_value=${whereValue}&where_type=${whereType}&is_query=1&query_type=0`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
Crerte(data) {
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `${data}`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
auditSave(data) {
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `${data}`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
Delete(ids) {
|
||||
let keys = ''
|
||||
ids.forEach(d => {
|
||||
keys += 'keyid=' + d + '&'
|
||||
})
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `funid=insp_name&${keys}pagetype=editgrid&eventcode=delete_eg&user_id=administrator&dataType=json`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
getFormDate(id) {
|
||||
return request({
|
||||
url: `/commonAction.do?eventcode=query_data&funid=queryevent&pagetype=grid&query_funid=insp_name&user_id=administrator`,
|
||||
method: 'post',
|
||||
data: `start=0&limit=10&where_sql=safe_insp.safe_insp_id = ?&where_value=${id}&where_type=string&is_query=1&query_type=0`
|
||||
}).then(response => response.data)
|
||||
},
|
||||
Save(data) {
|
||||
return request({
|
||||
url: `/commonAction.do`,
|
||||
method: 'post',
|
||||
data: `funid=safe_insp&keyid=${data.safe_insp__safe_insp_id}&safe_insp__insp_code=${data.safe_insp__insp_code}&safe_insp__insp_name=${data.safe_insp__insp_name}&safe_insp__insp_man=${data.safe_insp__insp_man}&safe_insp__insp_times=${data.safe_insp__insp_times}&safe_insp__insp_name_id=${data.safe_insp__insp_name_id}&safe_insp__org_id=${data.safe_insp__org_id}&safe_insp__insp_state=${data.safe_insp__insp_state}&safe_insp__insp_date=${data.safe_insp__insp_date}&safe_insp__insp_memo=${data.safe_insp__insp_memo}&safe_insp__safe_insp_id=${data.safe_insp__safe_insp_id}&safe_insp__dept_id=${data.safe_insp__dept_id}&safe_insp__insp_man_id=${data.safe_insp__insp_man_id}&safe_insp__insp_ed=&safe_insp__insp_ing=${data.safe_insp__insp_ing}&safe_insp__insp_non=&pagetype=form&eventcode=save&dirtyfields=safe_insp.insp_man;safe_insp.insp_times;safe_insp.insp_date;safe_insp.insp_memo;safe_insp.insp_man_id;safe_insp.insp_name;safe_insp.insp_name_id;&fkValue=&user_id=administrator&dataType=json`
|
||||
}).then(response => response.data)
|
||||
}
|
||||
}
|
131
src/views/safe_insp/components/inspName/index.vue
Normal file
131
src/views/safe_insp/components/inspName/index.vue
Normal file
@ -0,0 +1,131 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card>
|
||||
<el-table
|
||||
ref="deptTable"
|
||||
v-loading="loading"
|
||||
:data="data"
|
||||
style="width: 100%"
|
||||
@cell-dblclick="cellDblclick"
|
||||
>
|
||||
<template v-for="(d,i) in tableHeader">
|
||||
<el-table-column v-if="d.type && d.type === 'selection'" :key="i" :type="d.type" :fixed="d.fixed" />
|
||||
<el-table-column
|
||||
v-else
|
||||
:key="i"
|
||||
:prop="d.prop"
|
||||
:label="d.label"
|
||||
/>
|
||||
</template>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
:current-page="pager.pageNo"
|
||||
:page-sizes="[10, 30, 50, 100, 500]"
|
||||
:page-size="pager.pageSize"
|
||||
:total="pager.total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@size-change="sizeChange"
|
||||
@current-change="pageChange"
|
||||
/>
|
||||
</el-card>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import api from './api'
|
||||
export default {
|
||||
name: 'SafeIdsp',
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
data: [],
|
||||
ids: [],
|
||||
pager: {
|
||||
pageNo: 0,
|
||||
pageSize: 10,
|
||||
total: 0
|
||||
},
|
||||
tableHeader: [
|
||||
{
|
||||
prop: 'insp_name__insp_name',
|
||||
label: '巡检表名称'
|
||||
}],
|
||||
id: '',
|
||||
dialogFormVisible: false,
|
||||
dialogEditVisible: false,
|
||||
formLabelWidth: '120px',
|
||||
whereSql: false,
|
||||
whereValue: ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
this.loading = true
|
||||
let pageNo = this.pager.pageNo * this.pager.pageSize - this.pager.pageSize
|
||||
if (pageNo < 0) {
|
||||
pageNo = 0
|
||||
}
|
||||
api.getDate(
|
||||
this.pager.pageSize,
|
||||
pageNo,
|
||||
this.whereSql,
|
||||
this.whereValue
|
||||
).then(data => {
|
||||
if (data.success) {
|
||||
this.data = data.data.root
|
||||
this.pager.total = data.data.total
|
||||
setTimeout(() => {
|
||||
this.loading = false
|
||||
}, 200)
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
editCreate() {
|
||||
this.title = '新增'
|
||||
this.dialogFormVisible = true
|
||||
this.form = JSON.parse(JSON.stringify(this.initForm))
|
||||
},
|
||||
create() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
const data = `funid=insp_name&keyid=${this.form.insp_name__insp_name_id}&pagetype=editgrid&eventcode=save_eg&insp_name__insp_name=${this.form.insp_name__insp_name}&insp_name__insp_name_id=${this.form.insp_name__insp_name_id}&insp_name__org_id=&insp_name__dept_id=&user_id=administrator&dataType=json`
|
||||
api.Crerte(data).then(data => {
|
||||
if (data.success) {
|
||||
this.getList()
|
||||
this.dialogFormVisible = false
|
||||
this.$refs['form'].resetFields()
|
||||
this.$message.success('保存成功!')
|
||||
} else {
|
||||
this.$message.error(data.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
cellDblclick(row) {
|
||||
this.$emit('updateInspName', row)
|
||||
},
|
||||
sizeChange(size) {
|
||||
this.pager.pageSize = size
|
||||
this.getList()
|
||||
},
|
||||
pageChange(page) {
|
||||
this.pager.pageNo = page
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.el-card {
|
||||
margin-top: 10px;
|
||||
}
|
||||
</style>
|
@ -205,7 +205,7 @@ export default {
|
||||
},
|
||||
editCreate() {
|
||||
this.title = '新增'
|
||||
this.form = this.initFrom
|
||||
this.form = JSON.parse(JSON.stringify(this.initFrom))
|
||||
this.dialogFormVisible = true
|
||||
},
|
||||
edit(row) {
|
||||
@ -257,7 +257,7 @@ export default {
|
||||
},
|
||||
cellDblclick(row) {
|
||||
this.title = '编辑'
|
||||
this.form = row
|
||||
this.form = JSON.parse(JSON.stringify(row))
|
||||
this.dialogFormVisible = true
|
||||
},
|
||||
sizeChange(size) {
|
||||
|
@ -277,15 +277,8 @@ export default {
|
||||
}
|
||||
},
|
||||
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]
|
||||
}
|
||||
const param = `/insp/edit_form/create`
|
||||
this.$router.push(param)
|
||||
},
|
||||
create() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
@ -368,7 +361,7 @@ export default {
|
||||
})
|
||||
},
|
||||
cellDblclick(row) {
|
||||
const param = `/insp/edit_form/${row.safe_insp__safe_insp_id}`
|
||||
const param = `/insp/edit_form/audit/${row.safe_insp__safe_insp_id}`
|
||||
this.$router.push(param)
|
||||
},
|
||||
sizeChange(size) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user