|
@@ -0,0 +1,396 @@
|
|
|
+<!--安全信息类目-->
|
|
|
+<template>
|
|
|
+ <div class="app-container approval_handle">
|
|
|
+ <div class="tab-title">
|
|
|
+ <div class="tab-title-l">
|
|
|
+ <template>
|
|
|
+ <el-tabs v-model="activeName" @tab-click="handleTabClick">
|
|
|
+ <el-tab-pane :label="item.classifyName" :name="item.id+''" v-for="item in tabsList"></el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ plain
|
|
|
+ icon="el-icon-plus"
|
|
|
+ size="mini"
|
|
|
+ @click="handleClick('','','add')"
|
|
|
+ >新增</el-button>
|
|
|
+ </div>
|
|
|
+ <div class="approval_handle-page" v-if="pageType == 1">
|
|
|
+ <el-table border v-loading="loading" :data="tableData">
|
|
|
+ <el-table-column label="序号" width="100" align="left" type="index"/>
|
|
|
+ <el-table-column label="信息名称" align="left" prop="infoName"/>
|
|
|
+ <el-table-column label="公共信息" align="left">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-switch
|
|
|
+ @click.native="categoryShow(scope.row)"
|
|
|
+ class="category-switch captcha-img"
|
|
|
+ :active-value="2"
|
|
|
+ :inactive-value="1"
|
|
|
+ active-color="#FF9900"
|
|
|
+ inactive-color="#999"
|
|
|
+ v-model="scope.row.isCollective"
|
|
|
+ active-text="是"
|
|
|
+ inactive-text="否"
|
|
|
+ disabled
|
|
|
+ ></el-switch>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="添加人" align="left" prop="createBy"/>
|
|
|
+ <el-table-column label="添加时间" align="left" prop="createTime"/>
|
|
|
+ <el-table-column label="操作" align="left" class-name="small-padding fixed-width" width="120">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div class="button-box">
|
|
|
+ <p class="table-min-button"
|
|
|
+ @click="handleClick('',scope.row,'edit')"
|
|
|
+ >编辑</p>
|
|
|
+ <p class="table-min-button"
|
|
|
+ @click="handleClick('',scope.row,'delete')"
|
|
|
+ >删除</p>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <pagination :page-sizes="[20, 30, 40, 50]"
|
|
|
+ :total="total"
|
|
|
+ layout="total, prev, pager, next, sizes, jumper"
|
|
|
+ :page.sync="queryParams.pageNum"
|
|
|
+ :limit.sync="queryParams.pageSize"
|
|
|
+ @pagination="getList"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <safety-Info-Config v-if="pageType == 2"></safety-Info-Config>
|
|
|
+ <!-- 添加或修改安全分级对话框 -->
|
|
|
+ <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
+ <el-form-item label="信息名称" prop="infoName">
|
|
|
+ <el-input v-model="form.infoName" maxlength="10" placeholder="请输入名称" style="width:320px;"/>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="信息类目" prop="infoClassifyId" class="form-item">
|
|
|
+ <el-select placeholder="请选择类目" v-model="form.infoClassifyId" style="width:320px;" @change="categoryClick()">
|
|
|
+ <el-option
|
|
|
+ v-for="dict in categoryList"
|
|
|
+ :key="dict.id"
|
|
|
+ :label="dict.classifyName"
|
|
|
+ :value="dict.id"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="信息类型">
|
|
|
+ <el-input v-model="form.infoTypeName" placeholder="" disabled style="width:320px;"/>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="信息内容" prop="infoContent" v-if="form.infoType==1">
|
|
|
+ <el-input type="textarea" v-model="form.infoContent" placeholder="请输入内容" style="width:320px;"/>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="信息内容" prop="infoContent" v-if="form.infoType==2">
|
|
|
+ <el-upload
|
|
|
+ class="certificate-avatar-uploader"
|
|
|
+ :action="uploadImgUrl"
|
|
|
+ :show-file-list="false"
|
|
|
+ :on-success="handleAvatarSuccess"
|
|
|
+ :headers="headers"
|
|
|
+ :before-upload="beforeAvatarUpload">
|
|
|
+ <div style="display: flex;">
|
|
|
+ <img v-if="form.infoContent" :src="form.infoContent" style="width: 80px;height: 80px;margin-right: 10px">
|
|
|
+ <i v-if="!form.infoContent" class="el-icon-plus avatar-uploader-icon"></i>
|
|
|
+ </div>
|
|
|
+ </el-upload>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
+ <el-button @click="cancel">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { getToken } from "@/utils/auth";
|
|
|
+import {
|
|
|
+ infoCategoryList,
|
|
|
+ infoConfigAdd, infoConfigList, infoConfigPut,infoConfigDelete
|
|
|
+} from '@/api/laboratory/safetyInfo'
|
|
|
+import safetyInfoConfig from "./safetyInfoConfig.vue"
|
|
|
+import { listHazard } from '@/api/permissionRequired'
|
|
|
+export default {
|
|
|
+ name: "Approval",
|
|
|
+ components: {
|
|
|
+ safetyInfoConfig
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ uploadImgUrl: this.uploadUrl(), // 上传的图片服务器地址
|
|
|
+ activeName: '',
|
|
|
+ // 弹出层标题
|
|
|
+ title: "",
|
|
|
+ // 是否显示弹出层
|
|
|
+ open: false,
|
|
|
+ //页面状态
|
|
|
+ pageType:1,
|
|
|
+ loading:false,
|
|
|
+ headers: {
|
|
|
+ Authorization: "Bearer " + getToken()
|
|
|
+ },
|
|
|
+ // 查询参数
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize:20,
|
|
|
+ infoClassifyId:'',
|
|
|
+ },
|
|
|
+ total:0,
|
|
|
+ tableData:[{}],
|
|
|
+ dateRange:[],
|
|
|
+ pageData2:{},
|
|
|
+ tabsList:[],
|
|
|
+ categoryList:[],
|
|
|
+ // 表单参数
|
|
|
+ form: {
|
|
|
+ infoName:'',
|
|
|
+ infoClassifyId:'',
|
|
|
+ infoType:'',
|
|
|
+ infoTypeName:'',
|
|
|
+ infoContent:'',
|
|
|
+ isCollective:'',
|
|
|
+
|
|
|
+ },
|
|
|
+ // 表单校验
|
|
|
+ rules: {
|
|
|
+ infoName: [
|
|
|
+ { required: true, message: "请输入名称", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ infoClassifyId: [
|
|
|
+ { required: true, message: "请选择类目", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ infoContent: [
|
|
|
+ { required: true, message: "请添加信息内容", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ handleTabClick(tab){
|
|
|
+ console.log(tab.name)
|
|
|
+ this.queryParams.infoClassifyId=tab.name;
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ handleClick(index,row,doType){
|
|
|
+ let self=this;
|
|
|
+ if(doType=='add'){//添加
|
|
|
+ delete this.form.id
|
|
|
+ this.form.infoName='';
|
|
|
+ this.form.infoClassifyId='';
|
|
|
+ this.form.infoType='';
|
|
|
+ this.form.infoTypeName='';
|
|
|
+ this.form.infoContent='';
|
|
|
+ this.open = true;
|
|
|
+ }else if(doType=='edit'){//编辑
|
|
|
+ this.form.id=row.id
|
|
|
+ this.form.infoName=row.infoName
|
|
|
+ this.form.infoClassifyId=row.infoClassifyId
|
|
|
+ this.form.infoContent=row.infoContent
|
|
|
+ this.form.infoType=row.infoType
|
|
|
+ this.form.infoTypeName=row.infoType==1?'文字':'图片';
|
|
|
+ this.open = true;
|
|
|
+
|
|
|
+ }else if(doType=='deploy'){//信息牌配置
|
|
|
+ self.pageType=2;
|
|
|
+ }else if(doType=='delete'){//删除
|
|
|
+ this.$confirm('确认要删除吗?', "警告", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }).then(() => {
|
|
|
+ // 确定
|
|
|
+ infoConfigDelete(row.id).then(response => {
|
|
|
+ self.msgSuccess(response.msg);
|
|
|
+ self.getList();
|
|
|
+ });
|
|
|
+ }).catch(function() {});
|
|
|
+ }else if(doType=='back'){//返回
|
|
|
+ self.pageType=1;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ categoryShow(row){
|
|
|
+ let obj={
|
|
|
+ id:row.id,
|
|
|
+ isCollective:row.isCollective==1?2:1,
|
|
|
+ }
|
|
|
+ infoConfigPut(obj).then( response => {
|
|
|
+ this.msgSuccess("修改成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ categoryClick(){
|
|
|
+ let _this=this;
|
|
|
+ this.form.infoContent='';
|
|
|
+ this.categoryList.forEach(function(item) {
|
|
|
+ if(item.id==_this.form.infoClassifyId){
|
|
|
+ console.log(item)
|
|
|
+ _this.form.infoTypeName=item.classifyType==1?'文字':'图片';
|
|
|
+ _this.form.infoType=item.classifyType;
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
+ /** 搜索按钮操作 */
|
|
|
+ handleQuery() {
|
|
|
+ this.queryParams.pageNum = 1;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ /** 重置按钮操作 */
|
|
|
+ resetQuery() {
|
|
|
+ this.handleQuery();
|
|
|
+ },
|
|
|
+ /** 取消按钮 */
|
|
|
+ cancel() {
|
|
|
+ this.open = false;
|
|
|
+ },
|
|
|
+ /** 提交按钮 */
|
|
|
+ submitForm() {
|
|
|
+ this.$refs["form"].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ if (this.form.id != null) {
|
|
|
+ infoConfigPut(this.form).then( response => {
|
|
|
+ this.msgSuccess("修改成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ infoConfigAdd(this.form).then( response => {
|
|
|
+ this.msgSuccess("新增成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //上传
|
|
|
+ handleAvatarSuccess(res, file) {
|
|
|
+ console.log(res.data.url);
|
|
|
+ this.form.infoContent = res.data.url;
|
|
|
+ this.$forceUpdate()
|
|
|
+ },
|
|
|
+ beforeAvatarUpload(file) {
|
|
|
+ let type = false;
|
|
|
+ if (file.type == 'image/png' || file.type == 'image/jpeg' || file.type == 'image/gif') {
|
|
|
+ type = true;
|
|
|
+ }else{
|
|
|
+ this.$message.error('只能上传png/jpeg/gif格式图片');
|
|
|
+ type = false;
|
|
|
+ }
|
|
|
+ return type;
|
|
|
+ },
|
|
|
+ //获取危险源列表
|
|
|
+ getCategory(){
|
|
|
+ listHazard({}).then(response=>{
|
|
|
+ this.$set(this,'categoryList',response.data);
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //查询信息类目列表
|
|
|
+ getCategoryList(){
|
|
|
+ let _this=this;
|
|
|
+ let obj={
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize:100,
|
|
|
+ }
|
|
|
+ infoCategoryList(obj).then( response => {
|
|
|
+ let res=response.rows;
|
|
|
+ if(response.code==200){
|
|
|
+ if(res){
|
|
|
+ _this.tabsList=res;
|
|
|
+ _this.categoryList=res;
|
|
|
+ _this.activeName=response.rows[0].id+''
|
|
|
+ _this.queryParams.infoClassifyId=response.rows[0].id;
|
|
|
+ this.getList()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getList(){
|
|
|
+ let _this=this;
|
|
|
+ infoConfigList(_this.queryParams).then( response => {
|
|
|
+ let res=response.rows;
|
|
|
+ _this.tableData=res;
|
|
|
+ _this.total=response.total;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.getCategoryList()
|
|
|
+
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped lang="scss">
|
|
|
+ .approval_handle {
|
|
|
+ display: flex!important;
|
|
|
+ flex-direction: column;
|
|
|
+ flex-direction: column;
|
|
|
+ box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
|
|
|
+ border-radius:10px;
|
|
|
+ padding-top: 20px !important;
|
|
|
+ .approval_handle-page{
|
|
|
+ padding:20px 20px 20px!important;
|
|
|
+ flex:1;
|
|
|
+ display: flex!important;
|
|
|
+ flex-direction: column;
|
|
|
+ .button-box{
|
|
|
+ width:200px;
|
|
|
+ display: flex;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+</style>
|
|
|
+<style lang="scss">
|
|
|
+
|
|
|
+.tab-title{
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ padding-bottom: 20px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ border-bottom: 1px solid #E0E0E0;
|
|
|
+ padding: 0 20px;
|
|
|
+ .tab-title-l{
|
|
|
+ flex: 1;
|
|
|
+ .el-tabs__nav-wrap::after{
|
|
|
+ background-color: #fff !important;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+.category-switch .el-switch__label {
|
|
|
+ position: absolute;
|
|
|
+ display: none;
|
|
|
+ color: #fff !important;
|
|
|
+}
|
|
|
+.category-switch .el-switch__label--right span {
|
|
|
+ margin-left: 10px;
|
|
|
+}
|
|
|
+
|
|
|
+.category-switch .el-switch__label--left {
|
|
|
+ z-index: 1;
|
|
|
+}
|
|
|
+
|
|
|
+.category-switch .el-switch__label--left span {
|
|
|
+ margin-left: 24px;
|
|
|
+}
|
|
|
+
|
|
|
+.category-switch .el-switch__label.is-active {
|
|
|
+ display: block;
|
|
|
+}
|
|
|
+
|
|
|
+.category-switch.el-switch .el-switch__core,
|
|
|
+.el-switch .el-switch__label {
|
|
|
+ width: 60px !important;
|
|
|
+ margin: 0;
|
|
|
+}
|
|
|
+</style>
|