|
|
|
|
@ -1,8 +1,445 @@
|
|
|
|
|
<template>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
<template>
|
|
|
|
|
<div class="container">
|
|
|
|
|
<!-- 查询配置 -->
|
|
|
|
|
<div style="padding: 0px 20px">
|
|
|
|
|
<div ref="lxHeader">
|
|
|
|
|
<LxHeader icon="md-apps" text="危险源信息" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
|
|
|
|
|
<div slot="content"></div>
|
|
|
|
|
<slot>
|
|
|
|
|
<div>
|
|
|
|
|
<Input style="width: 200px; margin-right: 10px" v-model="searchFields.KeyWord" placeholder="关键字搜索" />
|
|
|
|
|
<Button type="primary" @click="load" style="margin-left: 10px">查询</Button>
|
|
|
|
|
<Button type="primary" @click="edit()" style="margin-left: 10px">新增</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</slot>
|
|
|
|
|
</LxHeader>
|
|
|
|
|
</div>
|
|
|
|
|
<div ref="lxTable">
|
|
|
|
|
<el-table :data="tableData" :height="tableHeight" style="width: 100%">
|
|
|
|
|
<el-table-column type="index" width="50" align="center"> </el-table-column>
|
|
|
|
|
<el-table-column :prop="column.field" :align="column.align" v-for="(column,index) in columns"
|
|
|
|
|
:label="column.title" :width="column.width">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<div v-if="column.type=='opt'">
|
|
|
|
|
<Button ghost size="small" @click="edit(scope.row)" type="primary"
|
|
|
|
|
style="margin-left: 10px;">编辑</Button>
|
|
|
|
|
<Button ghost size="small" @click="del(scope.row)" type="error" style="margin-left: 10px;">删除</Button>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-else>{{scope.row[column.field]}}</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
<div class="pagination">
|
|
|
|
|
<el-pagination @current-change="handleCurrentChange" :current-page="paginations.page"
|
|
|
|
|
:page-size="paginations.page_size" background layout="prev, pager, next" :total="paginations.total">
|
|
|
|
|
</el-pagination>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<el-dialog title="基础信息" :visible.sync="dialogFormVisible" fullscreen width="90%">
|
|
|
|
|
<div class="dialogConcent" :style="{height:clientHeight+'px'}">
|
|
|
|
|
<el-scrollbar style="flex: 1">
|
|
|
|
|
<el-form :model="form" :rules="rules" ref="form" label-position="right" :label-width="formLabelWidth">
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item label="单位" prop="unit">
|
|
|
|
|
<el-select v-model="form.unit" placeholder="请选择单位">
|
|
|
|
|
<el-option v-for="item in deptOptions" :key="item.id" :label="item.name" :value="item.name">
|
|
|
|
|
</el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item label="危险源等级等级" prop="level">
|
|
|
|
|
<el-input oninput="value=value.replace(/[^\d]/g,'')" v-model="form.level" placeholder="请填写危险源等级"
|
|
|
|
|
autocomplete="off"></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="8" :offset="6">
|
|
|
|
|
<el-form-item label="辨识方法" prop="distinguish">
|
|
|
|
|
<el-input v-model="form.distinguish" placeholder="请填写辨识方法" autocomplete="off"></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-form-item label="危险源地点" prop="address">
|
|
|
|
|
<el-input v-model="form.address" placeholder="请填写危险源地点" autocomplete="off"></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="危险源名称" prop="name">
|
|
|
|
|
<el-input v-model="form.name" placeholder="请填写危险源名称" autocomplete="off"></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="危险因素" prop="element">
|
|
|
|
|
<el-input v-model="form.element" placeholder="请填写危险因素" autocomplete="off"></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="安全评估" prop="evaluate">
|
|
|
|
|
<el-input v-model="form.evaluate" placeholder="请填写安全评估" autocomplete="off"></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="备注" prop="remark">
|
|
|
|
|
<el-input v-model="form.remark" placeholder="请填写备注" autocomplete="off"></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="附件" prop="file_list">
|
|
|
|
|
<el-upload class="upload-demo" :on-success="handlesuccess" :data="uploadOther"
|
|
|
|
|
action="/api/admin/upload-file" :on-remove="handleRemove" :before-remove="beforeRemove"
|
|
|
|
|
:on-exceed="handleExceed" :file-list="fileList">
|
|
|
|
|
<el-button size="small" type="primary">点击上传</el-button>
|
|
|
|
|
</el-upload>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<!-- <el-form-item label="科室" prop="department_list">
|
|
|
|
|
<el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange">全选
|
|
|
|
|
</el-checkbox>
|
|
|
|
|
<div style="margin: 15px 0;"></div>
|
|
|
|
|
<el-checkbox-group v-model="form.department_list" @change="handleCheckedDeptChange">
|
|
|
|
|
<el-checkbox v-for="dept in deptOptions" :label="dept.id" :key="dept.id">{{dept.name}}</el-checkbox>
|
|
|
|
|
</el-checkbox-group>
|
|
|
|
|
</el-form-item> -->
|
|
|
|
|
</el-form>
|
|
|
|
|
</el-scrollbar>
|
|
|
|
|
</div>
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
|
|
<el-button @click="resetForm('form')">取 消</el-button>
|
|
|
|
|
<el-button type="primary" v-preventReClick @click="submitForm('form')">确 定</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import {
|
|
|
|
|
getToken
|
|
|
|
|
} from '@/utils/auth'
|
|
|
|
|
import LxHeader from "@/components/LxHeader/index.vue";
|
|
|
|
|
import Tinymce from '@/components/Tinymce'
|
|
|
|
|
import {
|
|
|
|
|
save,
|
|
|
|
|
store,
|
|
|
|
|
del,
|
|
|
|
|
get,
|
|
|
|
|
listtask
|
|
|
|
|
|
|
|
|
|
} from "../../api/risk/hazardindex.js";
|
|
|
|
|
|
|
|
|
|
import {
|
|
|
|
|
listdept
|
|
|
|
|
} from "../../api/system/department.js"
|
|
|
|
|
export default {
|
|
|
|
|
components: {
|
|
|
|
|
LxHeader,
|
|
|
|
|
Tinymce
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
checkAll: false,
|
|
|
|
|
isIndeterminate: true,
|
|
|
|
|
paginations: {
|
|
|
|
|
page: 1,
|
|
|
|
|
page_size: 15,
|
|
|
|
|
total: 0
|
|
|
|
|
},
|
|
|
|
|
tableHeight: 0,
|
|
|
|
|
dialogFormVisible: false,
|
|
|
|
|
formLabelWidth: "120px",
|
|
|
|
|
clientHeight: 0,
|
|
|
|
|
form: {
|
|
|
|
|
unit: "",
|
|
|
|
|
level: "",
|
|
|
|
|
distinguish: "",
|
|
|
|
|
address: "",
|
|
|
|
|
element: "",
|
|
|
|
|
name: "",
|
|
|
|
|
evaluate: "",
|
|
|
|
|
remark: "",
|
|
|
|
|
file_list: "",
|
|
|
|
|
},
|
|
|
|
|
fileList: [],
|
|
|
|
|
tableData: [],
|
|
|
|
|
rules: {
|
|
|
|
|
unit: [{
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请输入单位',
|
|
|
|
|
trigger: 'blur'
|
|
|
|
|
}],
|
|
|
|
|
level: [{
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请输入等级',
|
|
|
|
|
trigger: 'blur'
|
|
|
|
|
}],
|
|
|
|
|
distinguish: [{
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请输入辨识方法',
|
|
|
|
|
trigger: 'blur'
|
|
|
|
|
}],
|
|
|
|
|
address: [{
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请输入危险源地点',
|
|
|
|
|
trigger: 'blur'
|
|
|
|
|
}],
|
|
|
|
|
element: [{
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请输入因素',
|
|
|
|
|
trigger: 'blur'
|
|
|
|
|
}],
|
|
|
|
|
name: [{
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请输入危险源名称',
|
|
|
|
|
trigger: 'blur'
|
|
|
|
|
}],
|
|
|
|
|
evaluate: [{
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请输入安全评估',
|
|
|
|
|
trigger: 'blur'
|
|
|
|
|
}],
|
|
|
|
|
remark: [{
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请输入备注',
|
|
|
|
|
trigger: 'blur'
|
|
|
|
|
}],
|
|
|
|
|
|
|
|
|
|
department_list: [{
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请选择科室',
|
|
|
|
|
trigger: 'blur'
|
|
|
|
|
}],
|
|
|
|
|
daterange: [{
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请选择日期区间',
|
|
|
|
|
trigger: 'blur'
|
|
|
|
|
}]
|
|
|
|
|
},
|
|
|
|
|
indexUrl: "/api/admin/task/index",
|
|
|
|
|
tableHeight: 900,
|
|
|
|
|
searchFields: {
|
|
|
|
|
KeyWord: ""
|
|
|
|
|
},
|
|
|
|
|
columns: [{
|
|
|
|
|
field: "name",
|
|
|
|
|
title: "名称",
|
|
|
|
|
type: "string"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: "address",
|
|
|
|
|
title: "地点",
|
|
|
|
|
type: "string",
|
|
|
|
|
width: 180
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: "unit",
|
|
|
|
|
title: "科室",
|
|
|
|
|
type: "string",
|
|
|
|
|
width: 180
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: "level",
|
|
|
|
|
title: "等级",
|
|
|
|
|
type: "string",
|
|
|
|
|
width: 180,
|
|
|
|
|
align: "center"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: "created_at",
|
|
|
|
|
title: "创建信息",
|
|
|
|
|
type: "string",
|
|
|
|
|
width: 180,
|
|
|
|
|
align: "center"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
field: "操作",
|
|
|
|
|
title: "操作",
|
|
|
|
|
width: 220,
|
|
|
|
|
type: "opt",
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
uploadOther: {
|
|
|
|
|
token: ""
|
|
|
|
|
},
|
|
|
|
|
deptOptions: []
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.uploadOther.token = getToken();
|
|
|
|
|
this.loadDeptOptions();
|
|
|
|
|
this.initLoad();
|
|
|
|
|
this.load();
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
loadDeptOptions() {
|
|
|
|
|
listdept().
|
|
|
|
|
then((res) => {
|
|
|
|
|
this.deptOptions = res;
|
|
|
|
|
}).catch(error => {
|
|
|
|
|
console.log(error)
|
|
|
|
|
reject(error)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
handleCheckAllChange(val) {
|
|
|
|
|
console.log(val)
|
|
|
|
|
let options = [];
|
|
|
|
|
for (var m of this.deptOptions) {
|
|
|
|
|
options.push(m.id);
|
|
|
|
|
}
|
|
|
|
|
this.form.department_list = val ? options : [];
|
|
|
|
|
this.isIndeterminate = false;
|
|
|
|
|
},
|
|
|
|
|
handleCheckedDeptChange(value) {
|
|
|
|
|
let checkedCount = value.length;
|
|
|
|
|
this.checkAll = checkedCount === this.deptOptions.length;
|
|
|
|
|
this.isIndeterminate = checkedCount > 0 && checkedCount < this.deptOptions.length;
|
|
|
|
|
},
|
|
|
|
|
initLoad() {
|
|
|
|
|
var that = this;
|
|
|
|
|
var clientHeight = document.documentElement.clientHeight
|
|
|
|
|
var lxHeader_height = 96.5; //查询 头部
|
|
|
|
|
var paginationHeight = 37; //分页的高度
|
|
|
|
|
var topHeight = 50; //页面 头部
|
|
|
|
|
let tableHeight = clientHeight - lxHeader_height - topHeight - paginationHeight - 20;
|
|
|
|
|
that.tableHeight = tableHeight;
|
|
|
|
|
},
|
|
|
|
|
handleCurrentChange(page) {
|
|
|
|
|
this.paginations.page = page;
|
|
|
|
|
this.load();
|
|
|
|
|
},
|
|
|
|
|
load() {
|
|
|
|
|
listtask({
|
|
|
|
|
page: this.paginations.page,
|
|
|
|
|
page_size: this.paginations.page_size,
|
|
|
|
|
}).then(response => {
|
|
|
|
|
this.tableData = response.data;
|
|
|
|
|
this.paginations.total = response.total;
|
|
|
|
|
}).catch(error => {
|
|
|
|
|
console.log(error)
|
|
|
|
|
reject(error)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
del(obj) {
|
|
|
|
|
var that = this;
|
|
|
|
|
if (obj) {
|
|
|
|
|
this.$Modal.confirm({
|
|
|
|
|
title: '确认要删除数据?',
|
|
|
|
|
onOk: () => {
|
|
|
|
|
del(obj.id).then(response => {
|
|
|
|
|
this.$Message.success('操作成功');
|
|
|
|
|
that.load();
|
|
|
|
|
}).catch(error => {
|
|
|
|
|
console.log(error)
|
|
|
|
|
reject(error)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
onCancel: () => {
|
|
|
|
|
//this.$Message.info('Clicked cancel');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
show(obj) {
|
|
|
|
|
this.clientHeight = document.documentElement.clientHeight - 84 - 110;
|
|
|
|
|
this.dialogViewVisible = true;
|
|
|
|
|
this.info(obj);
|
|
|
|
|
},
|
|
|
|
|
info(obj) {
|
|
|
|
|
var that = this;
|
|
|
|
|
|
|
|
|
|
get(obj.id).then(res => {
|
|
|
|
|
let result = Object.assign(that.form, res);
|
|
|
|
|
that.form = result;
|
|
|
|
|
let _files = [];
|
|
|
|
|
for (var mod of result.risk_from_files) {
|
|
|
|
|
let m = Object.assign({}, mod["files"]);
|
|
|
|
|
m.name = mod["files"].original_name;
|
|
|
|
|
_files.push(m);
|
|
|
|
|
}
|
|
|
|
|
that.fileList = _files;
|
|
|
|
|
}).catch(error => {
|
|
|
|
|
//reject(error)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
edit(obj) {
|
|
|
|
|
this.form = this.$options.data().form;
|
|
|
|
|
this.clientHeight = document.documentElement.clientHeight - 84 - 110;
|
|
|
|
|
if (obj) {
|
|
|
|
|
var that = this;
|
|
|
|
|
that.info(obj);
|
|
|
|
|
} else {}
|
|
|
|
|
this.dialogFormVisible = true;
|
|
|
|
|
},
|
|
|
|
|
submitForm(formName) {
|
|
|
|
|
var that = this;
|
|
|
|
|
|
|
|
|
|
this.$refs[formName].validate((valid) => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
if (that.form.id) {
|
|
|
|
|
that.form.id = that.form.id;
|
|
|
|
|
save(that.form).then(response => {
|
|
|
|
|
//console.log(response)
|
|
|
|
|
this.$Message.success('操作成功');
|
|
|
|
|
that.load();
|
|
|
|
|
that.dialogFormVisible = false;
|
|
|
|
|
|
|
|
|
|
}).catch(error => {
|
|
|
|
|
//reject(error)
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
store(that.form).then(response => {
|
|
|
|
|
//console.log(response)
|
|
|
|
|
this.$Message.success('操作成功');
|
|
|
|
|
that.load();
|
|
|
|
|
that.dialogFormVisible = false;
|
|
|
|
|
}).catch(error => {
|
|
|
|
|
//reject(error)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
that.fileList = [];
|
|
|
|
|
} else {
|
|
|
|
|
this.$Message.error('数据校验失败');
|
|
|
|
|
console.log('error submit!!');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
handleRemove(file, fileList) {
|
|
|
|
|
let listUrl = [];
|
|
|
|
|
for (var m of fileList) {
|
|
|
|
|
if (m.response)
|
|
|
|
|
listUrl.push({"upload_id":m.response.id});
|
|
|
|
|
else
|
|
|
|
|
listUrl.push({"upload_id":m.id});
|
|
|
|
|
}
|
|
|
|
|
this.form.file_list = listUrl;
|
|
|
|
|
},
|
|
|
|
|
handleExceed(files, fileList) {},
|
|
|
|
|
beforeRemove(file, fileList) {
|
|
|
|
|
return this.$confirm(`确定移除 ${ file.name }?`);
|
|
|
|
|
},
|
|
|
|
|
handlesuccess(response, file, fileList) {
|
|
|
|
|
let listUrl = [];
|
|
|
|
|
for (var m of fileList) {
|
|
|
|
|
if (m.response)
|
|
|
|
|
listUrl.push({"upload_id":m.response.id});
|
|
|
|
|
else
|
|
|
|
|
listUrl.push({"upload_id":m.id});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
this.form.file_list = listUrl;
|
|
|
|
|
},
|
|
|
|
|
resetForm(formName) {
|
|
|
|
|
var that = this;
|
|
|
|
|
that.fileList = [];
|
|
|
|
|
this.$refs[formName].resetFields();
|
|
|
|
|
that.dialogFormVisible = false;
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
.dialogConcent {
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|