<template>
|
<div class="app-container">
|
<el-tabs v-model="tabSelect" type="border-card" @tab-click="tabClickEvent">
|
<el-tab-pane label="所内科研用房情况" name="first">
|
<div v-if="tabSelect==='first'">
|
<div>
|
<el-form :inline="true" :model="queryHouseForm">
|
<el-row>
|
<el-form-item>
|
<el-button
|
class="filter-item"
|
style="margin-left: 10px;"
|
type="primary"
|
icon="el-icon-refresh"
|
@click="refreshHouseHandle"
|
>刷新</el-button>
|
</el-form-item>
|
<el-form-item>
|
<el-button
|
v-if="getBtnPermission('add')"
|
class="filter-item"
|
style="margin-left: 10px;"
|
type="primary"
|
icon="el-icon-plus"
|
@click="showCreateHouseHandle"
|
>新增</el-button>
|
</el-form-item>
|
<el-form-item>
|
<el-button
|
v-if="getBtnPermission('import')"
|
class="filter-item"
|
style="margin-left: 10px;"
|
type="primary"
|
icon="el-icon-upload2"
|
@click="showImportEditHandle"
|
>导入修改</el-button>
|
</el-form-item>
|
<el-form-item>
|
<el-button
|
v-if="getBtnPermission('import')"
|
class="filter-item"
|
style="margin-left: 10px;"
|
type="primary"
|
icon="el-icon-upload2"
|
@click="showImportPicHandle"
|
>导入图片</el-button>
|
</el-form-item>
|
<el-form-item>
|
<el-button
|
v-if="getBtnPermission('bashDelete')"
|
class="filter-item"
|
style="margin-left: 10px;"
|
type="primary"
|
icon="el-icon-minus"
|
@click="bashDeleteHandle"
|
>批量删除</el-button>
|
</el-form-item>
|
<el-form-item>
|
<el-button
|
v-if="getBtnPermission('import')"
|
class="filter-item"
|
style="margin-left: 10px;"
|
type="primary"
|
icon="el-icon-upload2"
|
@click="showImportHandle"
|
>导入</el-button>
|
</el-form-item>
|
<el-form-item>
|
<el-button
|
v-if="getBtnPermission('export')"
|
class="filter-item"
|
style="margin-left: 10px;"
|
type="primary"
|
icon="el-icon-download"
|
@click="exportAllHandle"
|
>导出</el-button>
|
</el-form-item>
|
<el-form-item label="场所条码">
|
<el-input
|
v-model="queryHouseForm.number"
|
class="filter-item"
|
placeholder=""
|
style="width: 150px;"
|
@keyup.enter.native="queryHouseHandle"
|
/>
|
</el-form-item>
|
<el-form-item label="场所名称">
|
<el-input
|
v-model="queryHouseForm.name"
|
class="filter-item"
|
placeholder=""
|
style="width: 150px;"
|
@keyup.enter.native="queryHouseHandle"
|
/>
|
</el-form-item>
|
</el-row>
|
<el-row>
|
<el-form-item label="场所类型">
|
<el-select v-model="queryHouseForm.houseType" placeholder="请选择类型" filterable clearable>
|
<el-option
|
v-for="(item,index) in dictionaryItemHouseList"
|
:label="item.text"
|
:value="item.text"
|
:key="index"
|
/>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="具体地点">
|
<el-input
|
v-model="queryHouseForm.location"
|
class="filter-item"
|
placeholder=""
|
style="width: 150px;"
|
@keyup.enter.native="queryHouseHandle"
|
/>
|
</el-form-item>
|
<el-form-item label="安全员">
|
<el-input
|
v-model="queryHouseForm.safer"
|
class="filter-item"
|
placeholder=""
|
style="width: 150px;"
|
@keyup.enter.native="queryHouseHandle"
|
/>
|
</el-form-item>
|
<el-form-item label="研究所名称">
|
<el-input
|
v-model="queryHouseForm.instituteName"
|
class="filter-item"
|
placeholder=""
|
style="width: 250px;"
|
@keyup.enter.native="queryHouseHandle"
|
/>
|
</el-form-item>
|
<el-form-item>
|
<el-button
|
class="filter-item"
|
type="primary"
|
icon="el-icon-search"
|
@click="queryHouseHandle"
|
/>
|
</el-form-item>
|
</el-row>
|
</el-form>
|
</div>
|
|
<div class="table_content">
|
<el-table
|
v-loading="listLoading"
|
ref="multipleTable"
|
:key="tableKey"
|
:data="labData"
|
border
|
fit
|
highlight-current-row
|
style="width: 100%;"
|
:header-cell-style="{background:'#F1F4F7',color:'#606266'}"
|
:row-style="{background:'rgba(255,255,255,0.94)',color:'#606266'}"
|
:stripe="true"
|
>
|
<el-table-column type="selection" align="center" width="60" fixed="left"/>
|
<el-table-column label="场所条码" prop="number" align="center" width="150" fixed="left">
|
<template slot-scope="scope">
|
<span>{{ scope.row.number }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="场所类型" prop="houseType" align="center" width="100" fixed="left">
|
<template slot-scope="scope">
|
<span>{{ scope.row.houseType }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="场所名称" prop="name" align="center" width="150" fixed="left">
|
<template slot-scope="scope">
|
<span>{{ scope.row.name }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="具体地点" prop="location" align="center" width="130" fixed="left">
|
<template slot-scope="scope">
|
<span>{{ scope.row.location }}</span>
|
</template>
|
</el-table-column>
|
|
<el-table-column label="气瓶存储上限" prop="upperLimit" align="center">
|
<template slot-scope="scope">
|
<span>{{ scope.row.upperLimit }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="气瓶是否有保护措施" prop="isSafeguard" align="center">
|
<template slot-scope="scope">
|
<span>{{ scope.row.isSafeguard|parseValue }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="灭火器设计数量" prop="designCount" align="center">
|
<template slot-scope="scope">
|
<span>{{ scope.row.designCount }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="灭火器实际数量" prop="actualCount" align="center">
|
<template slot-scope="scope">
|
<span>{{ scope.row.actualCount }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="是否有视频监控" prop="isMonitor" align="center">
|
<template slot-scope="scope">
|
<span>{{ scope.row.isMonitor|parseValue }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="是否为巡检对象" prop="isCheck" align="center">
|
<template slot-scope="scope">
|
<span>{{ scope.row.isCheck|parseValue }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="是否为重点实验室" prop="riskGrade" align="center">
|
<template slot-scope="scope">
|
<span>{{ scope.row.riskGrade|parseIntValue }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="负责部门" prop="department" align="center" width="130">
|
<template slot-scope="scope">
|
<span>{{ scope.row.department }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="负责人" prop="manager" align="center">
|
<template slot-scope="scope">
|
<span>{{ scope.row.manager }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="负责人电话" prop="managerPhone" align="center" width="120">
|
<template slot-scope="scope">
|
<span>{{ scope.row.managerPhone }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="安全员" prop="safer" align="center">
|
<template slot-scope="scope">
|
<span>{{ scope.row.safer }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="安全员电话" prop="saferPhone" align="center" width="120">
|
<template slot-scope="scope">
|
<span>{{ scope.row.saferPhone }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="烟感器数量" prop="smokeDetectorNum" align="center">
|
<template slot-scope="scope">
|
<span>{{ scope.row.smokeDetectorNum }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="喷淋器数量" prop="sprayThrowerNum" align="center">
|
<template slot-scope="scope">
|
<span>{{ scope.row.sprayThrowerNum }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="所属研究所" prop="institute" align="center" width="250">
|
<template slot-scope="scope">
|
<span>{{ scope.row.institute?scope.row.institute.name:'' }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column
|
:show-overflow-tooltip="true"
|
label="场所简介"
|
prop="introduction"
|
align="center"
|
>
|
<template slot-scope="scope">
|
<span>{{ scope.row.introduction }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="场所图片" prop="path" align="center">
|
<template slot-scope="scope">
|
<img
|
v-if="scope.row.path"
|
:src="baseUrl+scope.row.path"
|
style="width: 80px;height: 80px"
|
>
|
</template>
|
</el-table-column>
|
<el-table-column
|
:show-overflow-tooltip="true"
|
label="备注"
|
prop="description"
|
align="center"
|
>
|
<template slot-scope="scope">
|
<span>{{ scope.row.description }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column
|
:show-overflow-tooltip="true"
|
label="视频监控地址"
|
prop="videoAddress"
|
align="center"
|
>
|
<template slot-scope="scope">
|
<span>{{ scope.row.videoAddress }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="更新时间" prop="lastModifiedDate" align="center" width="120">
|
<template slot-scope="scope">
|
<span>{{ scope.row.lastModifiedDate | parseTime('{y}-{m}-{d}') }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="操作"
|
align="center"
|
width="120"
|
class-name="small-padding fixed-width"
|
fixed="right"
|
>
|
<template slot-scope="scope">
|
<el-button
|
v-if="getBtnPermission('edit')"
|
type="text"
|
@click="showEditHouseHandle(scope.row)"
|
>编辑</el-button>
|
<el-button
|
v-if="getBtnPermission('delete')"
|
type="text"
|
style="color:red;"
|
@click="deleteHouseHandle(scope.row)"
|
>删除</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
<br >
|
<el-pagination
|
v-show="recordTotal>0"
|
:current-page="currentPage"
|
:page-sizes="[5, 10, 20, 30, 50, 100, 200, 500]"
|
:page-size="pageSize"
|
:total="recordTotal"
|
layout="total, sizes, prev, pager, next, jumper"
|
background
|
style="float:right;"
|
@size-change="handleSizeChange"
|
@current-change="handleCurrentChange"
|
/>
|
</div>
|
<el-dialog
|
:title="dialogStatus==='create'?'新增':'编辑'"
|
:visible.sync="dialogFormVisible"
|
:modal-append-to-body="false"
|
:close-on-click-modal="false"
|
width="700px"
|
>
|
<el-form
|
ref="houseDataForm"
|
:rules="houseDataFormRules"
|
:model="houseDataForm"
|
label-position="right"
|
label-width="140px"
|
style="margin-left:50px;width:500px;"
|
element-loading-text="保存中..."
|
>
|
<el-form-item label="所名称:" prop="instituteId">
|
<el-select
|
v-model.trim="houseDataForm.instituteId"
|
placeholder="请选择研究所"
|
style="width:100%;"
|
@change="handleInstituteChange"
|
>
|
<el-option
|
v-for="(item,index) in instituteList"
|
:label="item.name"
|
:value="item.id"
|
:key="index"
|
/>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="场所条码:" prop="number">
|
<el-input v-model.trim="houseDataForm.number" />
|
</el-form-item>
|
<el-form-item label="具体地点:" prop="location">
|
<el-input
|
v-model.trim="houseDataForm.location"
|
placeholder="地点格式标注楼号-层号-房间号,例如:2-2-301"
|
/>
|
</el-form-item>
|
<el-form-item label="场所名称:" prop="name">
|
<el-input v-model.trim="houseDataForm.name" />
|
</el-form-item>
|
<el-form-item label="场所类型:" prop="houseType">
|
<el-select
|
v-model.trim="houseDataForm.houseType"
|
placeholder="请选择类型"
|
style="width:100%;"
|
>
|
<el-option
|
v-for="(item,index) in dictionaryItemHouseList"
|
:label="item.text"
|
:value="item.text"
|
:key="index"
|
/>
|
</el-select>
|
</el-form-item>
|
|
<el-form-item label="气瓶存储上限:" prop="upperLimit">
|
<el-input v-model.trim="houseDataForm.upperLimit" />
|
</el-form-item>
|
<el-form-item label="气瓶是否有保护措施:" prop="isSafeguard">
|
<el-radio-group v-model="houseDataForm.isSafeguard">
|
<el-radio :label="true">是</el-radio>
|
<el-radio :label="false">否</el-radio>
|
</el-radio-group>
|
</el-form-item>
|
<el-form-item label="灭火器设计数量:" prop="designCount">
|
<el-input v-model.trim="houseDataForm.designCount" />
|
</el-form-item>
|
<el-form-item label="灭火器实际数量:" prop="actualCount">
|
<el-input v-model.trim="houseDataForm.actualCount" />
|
</el-form-item>
|
<el-form-item label="是否有视频监控:" prop="isMonitor">
|
<el-radio-group v-model="houseDataForm.isMonitor">
|
<el-radio :label="true">是</el-radio>
|
<el-radio :label="false">否</el-radio>
|
</el-radio-group>
|
</el-form-item>
|
<el-form-item label="是否为巡检对象:" prop="isCheck">
|
<el-radio-group v-model="houseDataForm.isCheck">
|
<el-radio :label="true">是</el-radio>
|
<el-radio :label="false">否</el-radio>
|
</el-radio-group>
|
</el-form-item>
|
<el-form-item label="是否为重点实验室:" prop="riskGrade">
|
<el-radio-group v-model="houseDataForm.riskGrade">
|
<el-radio :label="1">是</el-radio>
|
<el-radio :label="0">否</el-radio>
|
</el-radio-group>
|
</el-form-item>
|
<el-form-item label="负责部门:" prop="department">
|
<!-- <el-input v-model.trim="houseDataForm.department" /> -->
|
<el-select
|
v-model.trim="houseDataForm.department"
|
placeholder="请选择类型"
|
style="width:100%;"
|
filterable
|
>
|
<el-option
|
v-for="(item,index) in departmentData"
|
:label="item.name"
|
:value="item.name"
|
:key="index"
|
/>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="负责人:" prop="manger">
|
<el-input v-model="houseDataForm.manager" />
|
</el-form-item>
|
<el-form-item label="安全员:" prop="safer">
|
<el-input v-model="houseDataForm.safer" placeholder="多个安全员请用空格分隔" />
|
</el-form-item>
|
<el-form-item label="负责人电话:" prop="mangerPhone">
|
<el-input v-model.trim="houseDataForm.managerPhone" />
|
</el-form-item>
|
<el-form-item label="安全员电话:" prop="saferPhone">
|
<el-input v-model.trim="houseDataForm.saferPhone" placeholder="多个安全员请用空格分隔" />
|
</el-form-item>
|
<el-form-item label="烟感器数量:" prop="smokeDetectorNum">
|
<el-input v-model.trim="houseDataForm.smokeDetectorNum" />
|
</el-form-item>
|
<el-form-item label="喷淋器数量:" prop="sprayThrowerNum">
|
<el-input v-model.trim="houseDataForm.sprayThrowerNum" />
|
</el-form-item>
|
<el-form-item label="场所简介:" prop="introduction">
|
<el-input
|
:autosize="{ minRows: 1, maxRows: 3}"
|
v-model.trim="houseDataForm.introduction"
|
type="textarea"
|
/>
|
</el-form-item>
|
<el-form-item label="视频监控地址:" prop="videoAddress">
|
<el-input v-model="houseDataForm.videoAddress"/>
|
</el-form-item>
|
<el-form-item v-if="dialogStatus !=='create'" label="场所图片:" prop="path">
|
<el-upload
|
ref="upload"
|
:action="UploadUrl()"
|
:on-preview="handlePreview"
|
:on-remove="handleRemove"
|
:before-upload="beforeUpload"
|
:data="uploadParams1"
|
:file-list="fileList"
|
class="upload-demo"
|
:limit="1"
|
>
|
<el-button size="small" type="primary">点击上传</el-button>
|
</el-upload>
|
</el-form-item>
|
</el-form>
|
<div slot="footer" class="dialog-footer">
|
<el-button @click="dialogFormVisible = false">取消</el-button>
|
<el-button
|
type="primary"
|
@click="dialogStatus==='create'?createHouseHandle():updateHouseHandle()"
|
>确认</el-button>
|
</div>
|
</el-dialog>
|
|
</div>
|
</el-tab-pane>
|
<el-tab-pane label="科研用房的新改扩建" name="second">
|
<div v-if="tabSelect==='second'">
|
<div class="filter-container">
|
<el-button
|
class="filter-item"
|
type="primary"
|
style="margin-left: 10px;"
|
icon="el-icon-refresh"
|
@click="refreshExtendHandle"
|
>刷新</el-button>
|
<el-button
|
v-if="getBtnPermission('add')"
|
class="filter-item"
|
type="primary"
|
style="margin-left: 10px;"
|
icon="el-icon-plus"
|
@click="showCreateExtendHandle"
|
>新增</el-button>
|
<el-input
|
v-model="queryExtendForm.name"
|
class="filter-item"
|
placeholder="输入所名称"
|
style="width: 400px;"
|
@keyup.enter.native="queryExtendHandle"
|
/>
|
<el-button
|
class="filter-item"
|
type="primary"
|
icon="el-icon-search"
|
@click="queryExtendHandle"
|
/>
|
</div>
|
<div class="table_content">
|
<el-table
|
v-loading="listLoading"
|
:key="tableKey"
|
:data="labData"
|
border
|
fit
|
highlight-current-row
|
style="width: 100%;"
|
>
|
<!-- <el-table-column type="selection" width="55">
|
</el-table-column>-->
|
<el-table-column type="index" label="序号" align="center" width="80" />
|
<el-table-column label="是否开展安全环境三同时工作" prop="isSync" align="center">
|
<template slot-scope="scope">
|
<span>{{ scope.row.isSync|parseValue }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="动物实验室是否开展安评和环评工作" prop="isAnimal" align="center">
|
<template slot-scope="scope">
|
<span>{{ scope.row.isAnimal }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="辐射实验室是否开展安评和环评工作" prop="isRadiate" align="center">
|
<template slot-scope="scope">
|
<span>{{ scope.row.isRadiate }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="电镀实验室是否开展安评和环评工作" prop="isElect" align="center">
|
<template slot-scope="scope">
|
<span>{{ scope.row.isElect }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="对新改扩建实施单位是否签订安全责任书" prop="isSign" align="center">
|
<template slot-scope="scope">
|
<span>{{ scope.row.isSign|parseValue }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="所属研究所" prop="institute" align="center">
|
<template slot-scope="scope">
|
<span>{{ scope.row.institute?scope.row.institute.name:'' }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="创建时间" prop="createdDate" align="center">
|
<template slot-scope="scope">
|
<span>{{ scope.row.createdDate | parseTime('{y}-{m}-{d}') }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="操作"
|
align="center"
|
width="240"
|
class-name="small-padding fixed-width"
|
>
|
<template slot-scope="scope">
|
<el-button
|
v-if="getBtnPermission('edit')"
|
type="primary"
|
size="mini"
|
@click="showEditExtendHandle(scope.row)"
|
>编辑</el-button>
|
<el-button
|
v-if="getBtnPermission('delete')"
|
type="danger"
|
size="mini"
|
@click="deleteExtendHandle(scope.row)"
|
>删除</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
<br >
|
<el-pagination
|
v-show="recordTotal>0"
|
:current-page="currentPage"
|
:page-sizes="[10, 20, 30, 50]"
|
:page-size="pageSize"
|
:total="recordTotal"
|
layout="total, sizes, prev, pager, next, jumper"
|
background
|
style="float:right;"
|
@size-change="handleSizeChange"
|
@current-change="handleCurrentChange"
|
/>
|
</div>
|
<el-dialog
|
:title="dialogStatus==='create'?'新增':'编辑'"
|
:visible.sync="dialogFormVisible"
|
:modal-append-to-body="false"
|
:close-on-click-modal="false"
|
width="700px"
|
>
|
<el-form
|
ref="extendDataForm"
|
:rules="extendDataFormRules"
|
:model="extendDataForm"
|
label-position="right"
|
label-width="260px"
|
style="margin-left:20px;width:600px;"
|
element-loading-text="保存中..."
|
>
|
<el-form-item label="所名称:" prop="instituteId">
|
<el-select
|
v-model.trim="extendDataForm.instituteId"
|
placeholder="请选择研究所"
|
style="width:100%;"
|
>
|
<el-option
|
v-for="(item,index) in instituteList"
|
:label="item.name"
|
:value="item.id"
|
:key="index"
|
/>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="是否开展安全环境三同时工作:" prop="isSync">
|
<el-radio-group v-model="extendDataForm.isSync">
|
<el-radio :label="true">是</el-radio>
|
<el-radio :label="false">否</el-radio>
|
</el-radio-group>
|
</el-form-item>
|
<el-form-item label="动物实验室是否开展安评和环评工作:" prop="isAnimal">
|
<el-radio-group v-model="extendDataForm.isAnimal">
|
<el-radio label="是">是</el-radio>
|
<el-radio label="否">否</el-radio>
|
<el-radio label="无">无</el-radio>
|
</el-radio-group>
|
</el-form-item>
|
<el-form-item label="辐射实验室是否开展安评和环评工作:" prop="isRadiate">
|
<el-radio-group v-model="extendDataForm.isRadiate">
|
<el-radio label="是">是</el-radio>
|
<el-radio label="否">否</el-radio>
|
<el-radio label="无">无</el-radio>
|
</el-radio-group>
|
</el-form-item>
|
<el-form-item label="电镀实验室是否开展安评和环评工作:" prop="isElect">
|
<el-radio-group v-model="extendDataForm.isElect">
|
<el-radio label="是">是</el-radio>
|
<el-radio label="否">否</el-radio>
|
<el-radio label="无">无</el-radio>
|
</el-radio-group>
|
</el-form-item>
|
<el-form-item label="对新改扩建实施单位是否签订安全责任书:" prop="isSign">
|
<el-radio-group v-model="extendDataForm.isSign">
|
<el-radio :label="true">是</el-radio>
|
<el-radio :label="false">否</el-radio>
|
</el-radio-group>
|
</el-form-item>
|
</el-form>
|
<div slot="footer" class="dialog-footer">
|
<el-button @click="dialogFormVisible = false">取消</el-button>
|
<el-button
|
type="primary"
|
@click="dialogStatus==='create'?createExtendHandle():updateExtendHandle()"
|
>确认</el-button>
|
</div>
|
</el-dialog>
|
</div>
|
</el-tab-pane>
|
</el-tabs>
|
<el-dialog
|
:visible.sync="importDialogFormVisible"
|
:modal-append-to-body="false"
|
:close-on-click-modal="false"
|
title="科研用房导入"
|
width="700px"
|
>
|
<el-form
|
ref="importForm"
|
label-position="right"
|
label-width="120px"
|
style="margin-left:50px;width:500px;"
|
element-loading-text="导入中..."
|
>
|
<el-form-item label="导入文件:">
|
<input ref="importLabInput" type="file" accept=".xls, .xlsx" >
|
</el-form-item>
|
<el-form-item label="excel参考模板:">
|
<el-button type="text" @click="viewHandle">下载模板</el-button>
|
</el-form-item>
|
</el-form>
|
<div slot="footer" class="dialog-footer">
|
<el-button @click="importDialogFormVisible = false">取消</el-button>
|
<el-button :disabled="importDisabled" type="primary" @click="importHandle()">导入</el-button>
|
</div>
|
</el-dialog>
|
<el-dialog
|
:visible.sync="importEditDialogFormVisible"
|
:modal-append-to-body="false"
|
:close-on-click-modal="false"
|
title="科研用房导入修改"
|
width="700px"
|
>
|
<el-form
|
ref="importForm"
|
label-position="right"
|
label-width="120px"
|
style="margin-left:50px;width:500px;"
|
element-loading-text="导入中..."
|
>
|
<el-form-item label="导入文件:">
|
<input ref="importLabInput" type="file" accept=".xls, .xlsx" >
|
</el-form-item>
|
<el-form-item label="excel参考模板:">
|
<el-button type="text" @click="viewHandle">下载模板</el-button>
|
</el-form-item>
|
</el-form>
|
<div slot="footer" class="dialog-footer">
|
<el-button @click="importEditDialogFormVisible = false">取消</el-button>
|
<el-button :disabled="importEditDisabled" type="primary" @click="importEditHandle()">导入</el-button>
|
</div>
|
</el-dialog>
|
<el-dialog
|
:visible.sync="importPicDialogFormVisible"
|
:modal-append-to-body="false"
|
:close-on-click-modal="false"
|
title="科研用房导入图片"
|
width="700px"
|
>
|
<el-form
|
ref="importForm"
|
label-position="right"
|
label-width="120px"
|
style="margin-left:50px;width:500px;"
|
element-loading-text="导入中..."
|
>
|
<el-form-item label="导入图片:">
|
<el-upload
|
ref="upload"
|
:action="MUploadUrl()"
|
:before-upload="mbeforeUpload"
|
:data="uploadParams3"
|
:file-list="picList"
|
class="upload-demo"
|
multiple
|
:on-error="showImportPicError"
|
:on-success="showImportPicSuc"
|
><el-button type="primary" icon="el-icon-upload2">导入图片</el-button>
|
</el-upload>
|
</el-form-item>
|
<el-form-item label="所名称:" prop="minstituteId">
|
<el-select
|
v-model.trim="minstituteId"
|
placeholder="请选择研究所"
|
style="width:100%;"
|
>
|
<el-option
|
v-for="(item,index) in instituteList"
|
:label="item.name"
|
:value="item.id"
|
:key="index"
|
/>
|
</el-select>
|
</el-form-item>
|
</el-form>
|
<div slot="footer" class="dialog-footer">
|
<el-button @click="importPicDialogFormVisible = false">关闭</el-button>
|
</div>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import { mapGetters } from 'vuex'
|
import { parseTime, computePageCount } from '@/utils'
|
import { parseError } from '@/utils/messageDialog'
|
import Cookies from 'js-cookie'
|
import { Message, MessageBox } from 'element-ui'
|
import { checkBtnPermission } from '@/utils/permission'
|
export default {
|
name: 'LabManage',
|
filters: {
|
parseValue(value) {
|
if (value == true) {
|
return '是'
|
} else {
|
return '否'
|
}
|
},
|
parseIntValue(value) {
|
if (value == '1') {
|
return '是'
|
} else {
|
return '否'
|
}
|
}
|
},
|
computed: {
|
...mapGetters(['userType', 'instituteId'])
|
},
|
data() {
|
return {
|
baseUrl: process.env.IMG_API + '/media/building/',
|
pageSize: 10,
|
recordTotal: 0,
|
currentPage: 1,
|
pageTotal: 0,
|
tableKey: 0,
|
labData: null,
|
listLoading: true,
|
houseDataForm: {
|
id: '',
|
instituteId: '',
|
number: '',
|
location: '',
|
name: '',
|
houseType: '',
|
upperLimit: '',
|
isSafeguard: false,
|
designCount: '',
|
actualCount: '',
|
isMonitor: false,
|
isCheck: false,
|
riskGrade:0,
|
department: '',
|
manager: '',
|
safer: '',
|
description: '',
|
path: '',
|
introduction: '',
|
managerPhone: '',
|
saferPhone: '',
|
sprayThrowerNum: '',
|
smokeDetectorNum: '',
|
videoAddress:''
|
},
|
queryHouseForm: {
|
name: '',
|
number:'',
|
houseType:'',
|
location:'',
|
safer:'',
|
instituteName:''
|
},
|
extendDataForm: {
|
id: '',
|
instituteId: '',
|
isSync: false,
|
isAnimal: '无',
|
isRadiate: '无',
|
isElect: '无',
|
isSign: false,
|
description: ''
|
},
|
queryExtendForm: {
|
name: ''
|
},
|
dialogFormVisible: false,
|
dialogStatus: '',
|
houseDataFormRules: {
|
instituteId: [
|
{ required: true, message: '研究所不能为空', trigger: 'blur' }
|
],
|
name: [
|
{ required: true, message: '场所名称不能为空', trigger: 'blur' }
|
],
|
houseType: [
|
{ required: true, message: '房间类别不能为空', trigger: 'blur' }
|
],
|
number: [
|
{ required: true, message: '房间编号不能为空', trigger: 'blur' }
|
],
|
location: [
|
{ required: true, message: '具体地点不能为空', trigger: 'blur' }
|
]
|
},
|
extendDataFormRules: {
|
instituteId: [
|
{ required: true, message: '研究所不能为空', trigger: 'blur' }
|
]
|
},
|
instituteList: [],
|
departmentData: [],
|
dictionaryItemHouseList: [],
|
tabSelect: 'first',
|
tabSelectBak: '',
|
importDialogFormVisible: false,
|
importDisabled: false,
|
importEditDisabled:false,
|
importEditDialogFormVisible: false,
|
importPicDisabled:false,
|
importPicDialogFormVisible:false,
|
searchKey: '',
|
searchContent: '',
|
uploadParams1: { flag: 1 },
|
uploadParams2: {},
|
fileList: [],
|
picList: [],
|
uploadParams3: {},
|
minstituteId:''
|
}
|
},
|
created() {
|
this.getLabList()
|
this.getDictionaryItemHouseList()
|
this.getInstituteList()
|
this.getDepartmentList()
|
},
|
methods: {
|
MUploadUrl: function() {
|
const url = process.env.BASE_API
|
return url + '/v1/api/mhouse_images'
|
// return "http://127.0.0.1:8008/v1/api/units_images";
|
// return "http://sinanoaq.com:8008/v1/api/units_images";
|
},
|
mbeforeUpload(file) {
|
this.uploadParams3.instituteid = this.instituteId
|
this.uploadParams3.minstituteid = this.minstituteId
|
this.uploadParams3.flag = 1
|
},
|
showImportPicError : function(err, file, picList){
|
parseError({ error: err})
|
},
|
showImportPicSuc : function(response, file, picList){
|
if (response.code != 200){
|
parseError({ error: response.message, vm: this })
|
}
|
},
|
UploadUrl: function() {
|
const url = process.env.BASE_API
|
return url + '/v1/api/house_images'
|
// return "http://127.0.0.1:8008/v1/api/units_images";
|
// return "http://sinanoaq.com:8008/v1/api/units_images";
|
},
|
beforeUpload(file) {
|
this.uploadParams1.id = this.houseDataForm.id
|
this.uploadParams2.id = this.houseDataForm.id
|
this.uploadParams1.flag = 1
|
},
|
handleRemove(file, fileList) {
|
console.log(file, fileList)
|
},
|
handlePreview(file) {
|
console.log(file)
|
},
|
getDepartmentList(instituteId) {
|
if (!instituteId) {
|
return
|
}
|
const _this = this
|
const params = {}
|
params['returns'] = 'queryAll'
|
params['instituteId'] = instituteId
|
departmentList(params)
|
.then((response) => {
|
const res = response.data
|
if (res.code == 200) {
|
_this.departmentData = res.result
|
} else {
|
parseError({ error: res.message, vm: _this })
|
}
|
_this.listLoading = false
|
})
|
.catch((error) => {
|
_this.listLoading = false
|
parseError({ error: error, vm: _this })
|
})
|
},
|
getLabList() {
|
const _this = this
|
const params = {}
|
params['pageIndex'] = _this.currentPage
|
params['pageSize'] = _this.pageSize
|
const userName = Cookies.get('userName')
|
const name = Cookies.get('name')
|
params['operator'] = name + '(' + userName + ')'
|
params['instituteId'] = _this.instituteId
|
|
if (_this.queryHouseForm.number ){
|
params['number'] = _this.queryHouseForm.number
|
}
|
if (_this.queryHouseForm.name){
|
params['name'] = _this.queryHouseForm.name
|
}
|
if (_this.queryHouseForm.houseType){
|
params['houseType'] = _this.queryHouseForm.houseType
|
}
|
if (_this.queryHouseForm.location){
|
params['location'] = _this.queryHouseForm.location
|
}
|
if (_this.queryHouseForm.safer){
|
params['safer'] = _this.queryHouseForm.safer
|
}
|
if (_this.queryHouseForm.instituteName){
|
params['instituteName'] = _this.queryHouseForm.instituteName
|
}
|
|
_this.listLoading = true
|
labList(params)
|
.then((response) => {
|
const res = response.data
|
if (res.code == 200) {
|
_this.recordTotal = res.totalCount
|
_this.pageSize = res.pageSize
|
_this.pageTotal = computePageCount(res.totalCount, res.pageSize)
|
_this.currentPage = res.pageIndex
|
_this.labData = res.result
|
} else {
|
parseError({ error: res.message, vm: _this })
|
}
|
_this.listLoading = false
|
})
|
.catch((error) => {
|
_this.listLoading = false
|
parseError({ error: error, vm: _this })
|
})
|
},
|
getLabExtendList() {
|
const _this = this
|
const params = {}
|
params['pageIndex'] = _this.currentPage
|
params['pageSize'] = _this.pageSize
|
const userName = Cookies.get('userName')
|
const name = Cookies.get('name')
|
params['operator'] = name + '(' + userName + ')'
|
params['instituteId'] = _this.instituteId
|
for (const i in _this.queryExtendForm) {
|
if (
|
_this.queryExtendForm[i] != undefined &&
|
_this.queryExtendForm[i].toString() != ''
|
) {
|
params[i] = _this.queryExtendForm[i]
|
}
|
}
|
_this.listLoading = true
|
labExtendList(params)
|
.then((response) => {
|
const res = response.data
|
if (res.code == 200) {
|
_this.recordTotal = res.totalCount
|
_this.pageSize = res.pageSize
|
_this.pageTotal = computePageCount(res.totalCount, res.pageSize)
|
_this.currentPage = res.pageIndex
|
_this.labData = res.result
|
} else {
|
parseError({ error: res.message, vm: _this })
|
}
|
_this.listLoading = false
|
})
|
.catch((error) => {
|
_this.listLoading = false
|
parseError({ error: error, vm: _this })
|
})
|
},
|
getInstituteList() {
|
const _this = this
|
if (_this.instituteList && _this.instituteList.length > 0) {
|
return
|
}
|
const params = {}
|
if (_this.userType != 1) {
|
if (!_this.instituteId) {
|
parseError({ error: '获取用户所属研究所信息失败', vm: _this })
|
}
|
params['instituteId'] = _this.instituteId
|
}
|
params['returns'] = 'queryAll'
|
instituteList(params)
|
.then((response) => {
|
const res = response.data
|
if (res.code == 200) {
|
_this.instituteList = res.result
|
} else {
|
parseError({ error: res.message, vm: _this })
|
}
|
})
|
.catch((error) => {
|
parseError({ error: error, vm: _this })
|
})
|
},
|
getDictionaryItemHouseList() {
|
const _this = this
|
if (
|
_this.dictionaryItemHouseList &&
|
_this.dictionaryItemHouseList.length > 0
|
) {
|
return
|
}
|
const params = {}
|
params['returns'] = 'queryAll'
|
const userName = Cookies.get('userName')
|
const name = Cookies.get('name')
|
params['operator'] = name + '(' + userName + ')'
|
params['dictionaryType'] = '场所类型'
|
dictionaryItemList(params)
|
.then((response) => {
|
const res = response.data
|
if (res.code == 200) {
|
_this.dictionaryItemHouseList = res.result
|
} else {
|
parseError({ error: res.message, vm: _this })
|
}
|
})
|
.catch((error) => {
|
parseError({ error: error, vm: _this })
|
})
|
},
|
createHouseHandle: function() {
|
const _this = this
|
this.$refs['houseDataForm'].validate((valid) => {
|
if (valid) {
|
const userName = Cookies.get('userName')
|
const name = Cookies.get('name')
|
_this.houseDataForm['operator'] = name + '(' + userName + ')'
|
_this.houseDataForm['safer'] = _this.houseDataForm.safer.trim()
|
_this.houseDataForm['manager'] = _this.houseDataForm.manager.trim()
|
createLab(_this.houseDataForm)
|
.then((response) => {
|
const res = response.data
|
if (res.code == 200) {
|
_this.dialogFormVisible = false
|
_this.$message({
|
message: '创建成功',
|
type: 'success'
|
})
|
_this.getLabList()
|
} else {
|
parseError({ error: res.message, vm: _this })
|
}
|
})
|
.catch((error) => {
|
parseError({ error: error, vm: _this })
|
})
|
}
|
})
|
},
|
createExtendHandle: function() {
|
const _this = this
|
this.$refs['extendDataForm'].validate((valid) => {
|
if (valid) {
|
const userName = Cookies.get('userName')
|
const name = Cookies.get('name')
|
_this.extendDataForm['operator'] = name + '(' + userName + ')'
|
createLabExtend(_this.extendDataForm)
|
.then((response) => {
|
const res = response.data
|
if (res.code == 200) {
|
_this.dialogFormVisible = false
|
_this.$message({
|
message: '创建成功',
|
type: 'success'
|
})
|
_this.getLabExtendList()
|
} else {
|
parseError({ error: res.message, vm: _this })
|
}
|
})
|
.catch((error) => {
|
parseError({ error: error, vm: _this })
|
})
|
}
|
})
|
},
|
bashDeleteHandle() {
|
const selections = this.$refs.multipleTable.selection
|
if (selections.length == 0) {
|
parseError({ error: '请选中需要删除的信息', vm: this })
|
return
|
}
|
MessageBox.confirm('确定删除选中的信息', '确定删除', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
})
|
.then(() => {
|
this.bashDeleteHouseAction(selections)
|
})
|
.catch((error) => {
|
console.log(error, '已取消删除')
|
})
|
},
|
bashDeleteHouseAction: function(rows) {
|
const _this = this
|
const params = {}
|
const ids = []
|
for (const row of rows) {
|
ids.push(row.id)
|
}
|
params['ids'] = ids
|
const userName = Cookies.get('userName')
|
const name = Cookies.get('name')
|
params['operator'] = name + '(' + userName + ')'
|
bashDeleteLab(params)
|
.then((response) => {
|
const res = response.data
|
if (res.code == 200) {
|
_this.$message({
|
message: '删除成功',
|
type: 'success'
|
})
|
_this.getLabList()
|
} else {
|
parseError({ error: res.message, vm: _this })
|
}
|
})
|
.catch((error) => {
|
parseError({ error: error, vm: _this })
|
})
|
},
|
deleteHouseHandle: function(row) {
|
const _this = this
|
MessageBox.confirm('确定删除' + row.name + '信息', '确定删除', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
})
|
.then(() => {
|
_this.deleteHouseAction(row)
|
})
|
.catch((error) => {
|
console.log(error, '已取消删除')
|
})
|
},
|
deleteHouseAction: function(row) {
|
const _this = this
|
const params = {}
|
params['id'] = row.id
|
const userName = Cookies.get('userName')
|
const name = Cookies.get('name')
|
params['operator'] = name + '(' + userName + ')'
|
deleteLab(params)
|
.then((response) => {
|
const res = response.data
|
if (res.code == 200) {
|
_this.$message({
|
message: '删除成功',
|
type: 'success'
|
})
|
_this.getLabList()
|
} else {
|
parseError({ error: res.message, vm: _this })
|
}
|
})
|
.catch((error) => {
|
parseError({ error: error, vm: _this })
|
})
|
},
|
deleteExtendHandle: function(row) {
|
const _this = this
|
MessageBox.confirm('确定删除信息', '确定删除', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
})
|
.then(() => {
|
_this.deleteExtendAction(row)
|
})
|
.catch(() => {
|
console.log('已取消删除')
|
})
|
},
|
deleteExtendAction: function(row) {
|
const _this = this
|
const params = {}
|
params['id'] = row.id
|
const userName = Cookies.get('userName')
|
const name = Cookies.get('name')
|
params['operator'] = name + '(' + userName + ')'
|
deleteLabExtend(params)
|
.then((response) => {
|
const res = response.data
|
if (res.code == 200) {
|
_this.$message({
|
message: '删除成功',
|
type: 'success'
|
})
|
_this.getLabExtendList()
|
} else {
|
parseError({ error: res.message, vm: _this })
|
}
|
})
|
.catch((error) => {
|
parseError({ error: error, vm: _this })
|
})
|
},
|
refreshHouseHandle: function() {
|
this.getLabList()
|
},
|
refreshExtendHandle: function() {
|
this.getLabExtendList()
|
},
|
queryHouseHandle: function() {
|
// if (this.queryForm.name == '') {
|
// parseError({ error: '请输入查询条件', vm: this })
|
// return
|
// }
|
this.currentPage = 1
|
this.getLabList()
|
},
|
queryExtendHandle: function() {
|
// if (this.queryExtendForm.name == '') {
|
// parseError({ error: '请输入查询条件', vm: this })
|
// return
|
// }
|
this.currentPage = 1
|
this.getLabExtendList()
|
},
|
resetHouseDataForm() {
|
this.houseDataForm = {
|
id: '',
|
instituteId: '',
|
number: '',
|
location: '',
|
name: '',
|
houseType: '',
|
upperLimit: '',
|
isSafeguard: false,
|
designCount: '',
|
actualCount: '',
|
isMonitor: false,
|
isCheck: false,
|
riskGrade:0,
|
department: '',
|
manager: '',
|
safer: '',
|
description: '',
|
path: '',
|
introduction: '',
|
managerPhone: '',
|
saferPhone: '',
|
sprayThrowerNum: '',
|
smokeDetectorNum: '',
|
videoAddress:''
|
}
|
},
|
resetExtendDataForm() {
|
this.extendDataForm = {
|
id: '',
|
instituteId: '',
|
isSync: false,
|
isAnimal: '无',
|
isRadiate: '无',
|
isElect: '无',
|
isSign: false,
|
description: '',
|
}
|
},
|
showCreateHouseHandle() {
|
this.resetHouseDataForm()
|
this.dialogStatus = 'create'
|
this.dialogFormVisible = true
|
this.getDepartmentList(this.houseDataForm.instituteId)
|
this.$nextTick(() => {
|
this.$refs['houseDataForm'].clearValidate()
|
})
|
},
|
showCreateExtendHandle() {
|
this.resetExtendDataForm()
|
this.dialogStatus = 'create'
|
this.dialogFormVisible = true
|
this.$nextTick(() => {
|
this.$refs['extendDataForm'].clearValidate()
|
})
|
},
|
updateHouseHandle() {
|
this.$refs['houseDataForm'].validate((valid) => {
|
const _this = this
|
if (valid) {
|
const userName = Cookies.get('userName')
|
const name = Cookies.get('name')
|
_this.houseDataForm['operator'] = name + '(' + userName + ')'
|
_this.houseDataForm['safer'] = _this.houseDataForm.safer.trim()
|
_this.houseDataForm['manager'] = _this.houseDataForm.manager.trim()
|
updateLab(_this.houseDataForm)
|
.then((response) => {
|
const res = response.data
|
if (res.code == 200) {
|
_this.$refs.upload.clearFiles()
|
_this.dialogFormVisible = false
|
_this.$message({
|
message: '更新成功',
|
type: 'success'
|
})
|
_this.getLabList()
|
} else {
|
parseError({ error: res.message, vm: _this })
|
}
|
})
|
.catch((error) => {
|
parseError({ error: error, vm: _this })
|
})
|
}
|
})
|
},
|
updateExtendHandle() {
|
this.$refs['extendDataForm'].validate((valid) => {
|
const _this = this
|
if (valid) {
|
const userName = Cookies.get('userName')
|
const name = Cookies.get('name')
|
_this.extendDataForm['operator'] = name + '(' + userName + ')'
|
updateLabExtend(_this.extendDataForm)
|
.then((response) => {
|
const res = response.data
|
if (res.code == 200) {
|
_this.dialogFormVisible = false
|
_this.$message({
|
message: '更新成功',
|
type: 'success'
|
})
|
_this.getLabExtendList()
|
} else {
|
parseError({ error: res.message, vm: _this })
|
}
|
})
|
.catch((error) => {
|
parseError({ error: error, vm: _this })
|
})
|
}
|
})
|
},
|
showEditHouseHandle: function(row) {
|
this.resetHouseDataForm()
|
this.dialogStatus = 'editor'
|
this.houseDataForm.id = row.id
|
this.houseDataForm.number = row.number
|
this.houseDataForm.location = row.location
|
this.houseDataForm.name = row.name
|
this.houseDataForm.houseType = row.houseType
|
this.houseDataForm.upperLimit = row.upperLimit
|
this.houseDataForm.isSafeguard = row.isSafeguard
|
this.houseDataForm.designCount = row.designCount
|
this.houseDataForm.actualCount = row.actualCount
|
this.houseDataForm.isMonitor = row.isMonitor
|
this.houseDataForm.isCheck = row.isCheck
|
this.houseDataForm.riskGrade = row.riskGrade ? row.riskGrade : 0
|
this.houseDataForm.department = row.department
|
this.houseDataForm.manager = row.manager
|
this.houseDataForm.safer = row.safer
|
this.houseDataForm.instituteId = row.institute ? row.institute.id : ''
|
this.getDepartmentList(this.houseDataForm.instituteId)
|
this.houseDataForm.description = row.description
|
this.houseDataForm.introduction = row.introduction
|
this.houseDataForm.managerPhone = row.managerPhone
|
this.houseDataForm.sprayThrowerNum = row.sprayThrowerNum
|
this.houseDataForm.smokeDetectorNum = row.smokeDetectorNum
|
this.houseDataForm.saferPhone = row.saferPhone
|
this.houseDataForm.videoAddress = row.videoAddress
|
this.dialogFormVisible = true
|
this.$nextTick(() => {
|
this.$refs['houseDataForm'].clearValidate()
|
})
|
},
|
showEditExtendHandle: function(row) {
|
this.resetExtendDataForm()
|
this.dialogStatus = 'editor'
|
this.extendDataForm.id = row.id
|
this.extendDataForm.isSync = row.isSync
|
this.extendDataForm.isAnimal = row.isAnimal
|
this.extendDataForm.isRadiate = row.isRadiate
|
this.extendDataForm.isElect = row.isElect
|
this.extendDataForm.isSign = row.isSign
|
this.extendDataForm.instituteId = row.institute ? row.institute.id : ''
|
this.extendDataForm.description = row.description
|
this.dialogFormVisible = true
|
this.$nextTick(() => {
|
this.$refs['extendDataForm'].clearValidate()
|
})
|
},
|
handleSizeChange: function(val) {
|
this.pageSize = val
|
this.currentPage = 1
|
if (this.tabSelect == 'first') {
|
this.getLabList()
|
} else {
|
this.getLabExtendList()
|
}
|
},
|
handleCurrentChange: function(val) {
|
this.currentPage = val
|
if (this.tabSelect == 'first') {
|
this.getLabList()
|
} else {
|
this.getLabExtendList()
|
}
|
},
|
tabClickEvent(tab) {
|
if (this.tabSelectBak == tab.name) {
|
return
|
} else {
|
this.tabSelectBak = tab.name
|
}
|
if (tab.name == 'first') {
|
this.getLabList()
|
} else {
|
this.getLabExtendList()
|
}
|
},
|
showImportHandle() {
|
this.importDisabled = false
|
this.importDialogFormVisible = true
|
},
|
importHandle() {
|
const _this = this
|
const formData = new FormData()
|
const userName = Cookies.get('userName')
|
const name = Cookies.get('name')
|
formData.append('operator', name + '(' + userName + ')')
|
const files = this.$refs['importLabInput'].files
|
if (files && files.length > 0) {
|
formData.append('file', files[0])
|
}
|
formData.append('action', 'import')
|
importLab(formData)
|
.then((response) => {
|
const res = response.data
|
if (res.code == 200) {
|
_this.importDialogFormVisible = false
|
_this.$message({
|
message: '导入成功',
|
type: 'success'
|
})
|
_this.getLabList()
|
} else {
|
parseError({ error: res.message, vm: _this })
|
}
|
})
|
.catch((error) => {
|
parseError({ error: error, vm: _this })
|
})
|
},
|
viewHandle() {
|
const _this = this
|
const params = { name: 'lab-example.xlsx' }
|
getExcelExample(params)
|
.then((response) => {
|
const res = response.data
|
if (res.code == 200) {
|
window.open(res.result, '_blank')
|
} else {
|
parseError({ error: res.message, vm: _this })
|
}
|
})
|
.catch((error) => {
|
parseError({ error: error, vm: _this })
|
})
|
},
|
|
showImportEditHandle() {
|
this.importEditDisabled = false
|
this.importEditDialogFormVisible = true
|
},
|
importEditHandle() {
|
const _this = this
|
const formData = new FormData()
|
const userName = Cookies.get('userName')
|
const name = Cookies.get('name')
|
formData.append('operator', name + '(' + userName + ')')
|
const files = this.$refs['importLabInput'].files
|
if (files && files.length > 0) {
|
formData.append('file', files[0])
|
}
|
formData.append('action', 'importedit')
|
importEditLab(formData)
|
.then((response) => {
|
const res = response.data
|
if (res.code == 200) {
|
_this.importEditDialogFormVisible = false
|
_this.$message({
|
message: '导入成功',
|
type: 'success'
|
})
|
_this.getLabList()
|
} else {
|
parseError({ error: res.message, vm: _this })
|
}
|
})
|
.catch((error) => {
|
parseError({ error: error, vm: _this })
|
})
|
},
|
showImportPicHandle(){
|
this.importPicDisabled = false
|
this.importPicDialogFormVisible = true
|
this.picList = []
|
},
|
exportAllHandle() {
|
const _this = this
|
const params = {}
|
params['returns'] = 'queryAll'
|
params['instituteId'] = _this.instituteId
|
if (_this.queryHouseForm.number ){
|
params['number'] = _this.queryHouseForm.number
|
}
|
if (_this.queryHouseForm.name){
|
params['name'] = _this.queryHouseForm.name
|
}
|
if (_this.queryHouseForm.houseType){
|
params['houseType'] = _this.queryHouseForm.houseType
|
}
|
if (_this.queryHouseForm.location){
|
params['location'] = _this.queryHouseForm.location
|
}
|
if (_this.queryHouseForm.safer){
|
params['safer'] = _this.queryHouseForm.safer
|
}
|
if (_this.queryHouseForm.instituteName){
|
params['instituteName'] = _this.queryHouseForm.instituteName
|
}
|
|
labList(params)
|
.then((response) => {
|
const res = response.data
|
if (res.code == 200) {
|
const allData = res.result
|
if (allData.length == 0) {
|
parseError({ error: '科研用房没有录入数据', vm: _this })
|
return
|
}
|
import('@/vendor/Export2Excel').then((excel) => {
|
const tHeader = [
|
'场所条码',
|
'场所类型',
|
'场所名称',
|
'具体地点',
|
'气瓶存储上限',
|
'气瓶是否有保护措施',
|
'灭火器设计数量',
|
'灭火器实际数量',
|
'是否有视频监控',
|
'是否为巡检对象',
|
'负责部门',
|
'负责人',
|
'安全员',
|
'所属研究所',
|
'负责人电话',
|
'安全员电话',
|
'烟感器数量',
|
'喷淋器数量',
|
'场所介绍',
|
'备注'
|
]
|
const filterVal = [
|
'number',
|
'houseType',
|
'name',
|
'location',
|
'upperLimit',
|
'isSafeguard',
|
'designCount',
|
'actualCount',
|
'isMonitor',
|
'isCheck',
|
'department',
|
'manager',
|
'safer',
|
'institute',
|
'managerPhone',
|
'saferPhone',
|
'smokeDetectorNum',
|
'sprayThrowerNum',
|
'introduction',
|
'description'
|
]
|
const data = _this.formatJson(filterVal, allData)
|
excel.export_json_to_excel({
|
header: tHeader,
|
data,
|
filename: 'lab-list'
|
})
|
})
|
} else {
|
parseError({ error: res.message, vm: _this })
|
}
|
})
|
.catch((error) => {
|
parseError({ error: error, vm: _this })
|
})
|
},
|
formatJson(filterVal, jsonData) {
|
return jsonData.map((v) =>
|
filterVal.map((j) => {
|
if (j === 'createdDate') {
|
return parseTime(v[j], '{y}-{m}-{d}')
|
} else if (j === 'isSafeguard') {
|
return v[j] ? '是' : '否'
|
} else if (j === 'isMonitor') {
|
return v[j] ? '是' : '否'
|
} else if (j === 'isCheck') {
|
return v[j] ? '是' : '否'
|
} else if (j === 'institute') {
|
return v[j].name
|
} else {
|
return v[j]
|
}
|
})
|
)
|
},
|
getBtnPermission(btnType) {
|
return checkBtnPermission(this.userType, btnType)
|
},
|
handleInstituteChange(value) {
|
if (value) {
|
// this.houseDataForm.instituteId = "";
|
this.getDepartmentList(value)
|
}
|
}
|
}
|
}
|
|
</script>
|