123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329 |
- <!--危险源管理-->
- <template>
- <div class="app-container hazard">
- <div class="hazard-min" v-if="pageType==1">
- <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="90px" class="form-box">
- <el-form-item label="危险源名称" prop="name" style="margin-left:20px;">
- <el-input
- v-model="queryParams.name"
- placeholder="请输入危险源名称"
- clearable
- size="small"
- />
- </el-form-item>
- <el-form-item style="float: right;">
- <el-col :span="1.5">
- <p class="add-button-one-90"
- @click="addLaboratoryButton"
- v-hasPermi="['laboratory:hazard:add']"
- ><i class="el-icon-plus"></i>添加</p>
- </el-col>
- </el-form-item>
- <el-form-item>
- <p class="inquire-button-one" @click="handleQuery">查询</p>
- <p class="reset-button-one" @click="resetQuery">重置</p>
- </el-form-item>
- </el-form>
- <!--<div class="for-max-box">-->
- <!--<div class="for-big-box" v-for="(item,index) in hazardList" :key="index">-->
- <!--<!–<p class="class-name-p color_ff" :class="item.type==1?'lv1Back':(item.type==2?'lv2Back':(item.type==3?'lv3Back':(item.type==4?'lv4Back':'')))">危险化学品</p>–>-->
- <!--<p class="name-box color_66">{{item.name}}</p>-->
- <!--<div class="progress-box">-->
- <!--<p class="color_99">实验室危险源占比 {{item.labScale}}%</p>-->
- <!--<el-progress :text-inside="true" :stroke-width="20" color="#F7CB6B" :percentage="item.labScale" style="margin-right:74px;"></el-progress>-->
- <!--</div>-->
- <!--<div class="progress-box">-->
- <!--<p class="color_99">发生事故占比 {{item.faultScale}}%</p>-->
- <!--<el-progress :text-inside="true" :stroke-width="20" color="#FF4C76" :percentage="item.faultScale" style="margin-right:74px;"></el-progress>-->
- <!--</div>-->
- <!--<div class="progress-box">-->
- <!--<p class="color_99">关联风险占比 {{item.planScale}}%</p>-->
- <!--<el-progress :text-inside="true" :stroke-width="20" color="#52a1fe" :percentage="item.planScale" style="margin-right:74px;"></el-progress>-->
- <!--</div>-->
- <!--<div class="button-null-left"></div>-->
- <!--<div class="button-box">-->
- <!--<p class="table-button-warning-90" style="margin-right:20px;" @click="addLaboratoryButton(item)"><i class="el-icon-edit-outline"></i>编辑</p>-->
- <!--<p class="table-button-grey-90" @click="handleDelete(item)"><i class="el-icon-delete"></i>删除</p>-->
- <!--</div>-->
- <!--</div>-->
- <!--<img v-if="!hazardList[0]" src="@/assets/ZDimages/null-data-1.png" style="display: block;width:200px;margin:100px auto;">-->
- <!--</div>-->
- <el-table v-loading="loading" border :data="hazardList" @selection-change="handleSelectionChange">
- <!--<el-table-column type="selection" width="55" align="center" />-->
- <!-- <el-table-column label="消息类型" align="left" prop="messType" /> -->
- <el-table-column label="名称" align="left" prop="name" />
- <el-table-column label="编号" align="left" prop="code" />
- <el-table-column label="实验室危险源占比" align="left" prop="labScale">
- <template slot-scope="scope">
- <div class="progress-box">
- <el-progress :text-inside="true" :stroke-width="20" color="#52a1fe" :percentage="scope.row.labScale" style="margin-right:74px;"></el-progress>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="查看次数" align="left" prop="scanCount" width="100" />
- <el-table-column label="二维码" align="left" width="100">
- <template slot-scope="scope">
- <div @click="dialogQrCodeOn(scope.row.qrCodeUrl)">
- <vue-qr style="height:23px;width:23px;cursor:pointer;" :text="scope.row.qrCodeUrl" :size="200"></vue-qr>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="操作" align="left" class-name="small-padding fixed-width" width="160" v-if="tableButtonType">
- <template slot-scope="scope">
- <div class="button-box">
- <p class="table-min-button"
- @click="addLaboratoryButton(scope.row)"
- v-hasPermiAnd="['laboratory:hazard:query','laboratory:hazard:edit']"
- >编辑</p>
- <p class="table-min-button"
- @click="handleDelete(scope.row)"
- v-hasPermi="['laboratory:hazard:remove']"
- >删除</p>
- </div>
- </template>
- </el-table-column>
- </el-table>
- <pagination :page-sizes="[20, 30, 40, 50]"
- v-show="total>0"
- :total="total"
- layout="total, prev, pager, next, sizes, jumper"
- :page.sync="queryParams.pageNum"
- :limit.sync="queryParams.pageSize"
- @pagination="getList"
- />
- </div>
- <add-laboratory v-if="pageType==2" :hazardId="hazardId"></add-laboratory>
- <!-- 二维码展示 -->
- <el-dialog title="二维码" class="qr-codeUrl-dialog" :visible.sync="dialogQrCodeType" width="300px" append-to-body>
- <vue-qr style="display: block;height:200px;width:200px;cursor:pointer;margin:0 auto;" :text="dialogQrCodeUrl" :size="200"></vue-qr>
- </el-dialog>
- </div>
- </template>
- <script>
- import { listHazard, getHazard, delHazard, addHazard, updateHazard } from "@/api/laboratory/hazard";
- import addLaboratory from "./addLaboratory.vue";
- import { done } from 'element-ui'
- import vueQr from 'vue-qr'
- export default {
- components: {
- addLaboratory,
- vueQr
- },
- name: "Hazard",
- data() {
- return {
- tableButtonType:this.hasPermiDom(['laboratory:hazard:query','laboratory:hazard:edit','laboratory:hazard:remove']),
- // 遮罩层
- loading: true,
- // 选中数组
- ids: [],
- // 子表选中数据
- checkedLabHazardSubjectRelation: [],
- // 非单个禁用
- single: true,
- // 非多个禁用
- multiple: true,
- // 显示搜索条件
- showSearch: true,
- // 总条数
- total: 0,
- // 危险源表格数据
- hazardList: [],
- // 危险源和实验室关联表格数据
- labHazardSubjectRelationList: [],
- // 弹出层标题
- title: "",
- // 是否显示弹出层
- open: false,
- // 查询参数
- queryParams: {
- pageNum: 1,
- pageSize:20,
- chName: null,
- enName: null,
- casNo: null,
- dangerCode: null,
- flammability: null,
- ignitionPoint: null,
- combustionProducts: null,
- stability: null,
- taboo: null,
- skinContactAid: null,
- eyeContactAid: null,
- inhalationAid: null,
- ingestionAid: null,
- engineeringProtection: null,
- personalProtection: null,
- storage: null,
- leakageTreatment: null,
- deptId: null,
- deptName: null,
- userId: null,
- },
- // 表单参数
- form: {},
- // 表单校验
- rules: {
- },
- //新增危险源
- pageType:1,
- hazardId: null,
- //二维码展示数据
- dialogQrCodeType:false,
- dialogQrCodeUrl:"",
- };
- },
- created() {
- this.getList();
- },
- methods: {
- dialogQrCodeOn(url){
- this.dialogQrCodeUrl = url;
- this.dialogQrCodeType = true;
- },
- //新建危险源
- addLaboratoryButton(row){
- console.log(row.hazardId)
- this.hazardId = row.hazardId
- this.pageType = 2;
- },
- offLaboratoryButton(){
- this.pageType = 1;
- },
- /** 查询危险源列表 */
- getList() {
- this.loading = true;
- listHazard(this.queryParams).then(response => {
- this.hazardList = response.rows;
- this.total = response.total;
- this.loading = false;
- });
- },
- // 取消按钮
- cancel() {
- this.open = false;
- this.reset();
- },
- clickPageTypeOne(){
- this.pageType = 1;
- this.getList();
- },
- // 表单重置
- reset() {
- this.form = {
- id: null,
- chName: null,
- enName: null,
- casNo: null,
- dangerCode: null,
- flammability: null,
- ignitionPoint: null,
- combustionProducts: null,
- stability: null,
- taboo: null,
- skinContactAid: null,
- eyeContactAid: null,
- inhalationAid: null,
- ingestionAid: null,
- engineeringProtection: null,
- personalProtection: null,
- storage: null,
- leakageTreatment: null,
- deptId: null,
- deptName: null,
- createTime: null,
- userId: null,
- createBy: null,
- updateTime: null,
- updateBy: null,
- remark: null
- };
- this.labHazardSubjectRelationList = [];
- this.resetForm("form");
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.queryParams.pageNum = 1;
- this.getList();
- },
- /** 重置按钮操作 */
- resetQuery() {
- // this.resetForm("queryForm");
- this.$set(this,'queryParams',{
- pageNum: 1,
- pageSize:20,
- name:"",
- });
- this.handleQuery();
- },
- // 多选框选中数据
- handleSelectionChange(selection) {
- this.ids = selection.map(item => item.hazardId)
- this.single = selection.length!==1
- this.multiple = !selection.length
- },
- /** 新增按钮操作 */
- handleAdd() {
- this.reset();
- this.open = true;
- this.title = "添加危险源";
- },
- /** 删除按钮操作 */
- handleDelete(row) {
- const ids = row.hazardId || this.ids;
- this.$confirm('是否确认删除危险源?', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(function() {
- return delHazard(ids);
- }).then(() => {
- this.getList();
- this.msgSuccess("删除成功");
- }).catch(() => {});
- },
- /** 导出按钮操作 */
- handleExport() {
- this.download('laboratory/hazard/export', {
- ...this.queryParams
- }, `laboratory_hazard.xlsx`)
- },
- }
- };
- </script>
- <style scoped lang="scss">
- .hazard {
- display: flex!important;
- flex-direction: column;
- box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
- /*padding:11px 20px 20px!important;*/
- .hazard-min{
- flex:1;
- overflow: hidden;
- display: flex!important;
- flex-direction: column;
- padding:11px 20px 20px!important;
- }
- .form-box{
- margin-top:12px;
- //display: flex;
- .null-p{
- flex:1;
- }
- }
- .button-box{
- display: flex;
- height:30px;
- width:190px;
- /*margin-top:40px;*/
- /*margin-right:40px;*/
- margin:0 auto;
- }
- }
- </style>
|