<style scoped>
|
.title {
|
height: 60px;
|
line-height: 60px;
|
}
|
|
.search {
|
background-color: #fff;
|
height: 80px;
|
display: flex;
|
align-items: center;
|
}
|
|
.search_thing {
|
width: 350px;
|
display: flex;
|
align-items: center;
|
}
|
|
.search_label {
|
width: 110px;
|
font-size: 14px;
|
text-align: right;
|
}
|
|
.search_input {
|
width: calc(100% - 110px);
|
}
|
|
.table {
|
margin-top: 10px;
|
background-color: #fff;
|
width: calc(100% - 40px);
|
height: calc(100% - 60px - 80px - 10px - 40px);
|
padding: 20px;
|
}
|
.el-upload {
|
border: 1px dashed #d9d9d9;
|
border-radius: 6px;
|
cursor: pointer;
|
position: relative;
|
overflow: hidden;
|
}
|
.el-upload:hover {
|
border-color: #409EFF;
|
}
|
.avatar-uploader-icon {
|
border: 1px dashed #d9d9d9;
|
font-size: 28px;
|
color: #8c939d;
|
width: 120px;
|
height: 120px;
|
line-height: 120px;
|
text-align: center;
|
}
|
.avatar {
|
width: 120px;
|
height: 120px;
|
display: block;
|
}
|
.btns{
|
position: absolute;
|
right: 80px;
|
top: 13px;
|
}
|
</style>
|
|
<template>
|
<div class="role_manage">
|
<div>
|
<el-row class="title">
|
<el-col :span="12" style="padding-left: 20px;">场所或设施:</el-col>
|
<el-col :span="12" style="text-align: right;">
|
<el-button size="medium" type="primary" @click="openAdd" v-if="addPower">新增</el-button>
|
</el-col>
|
</el-row>
|
</div>
|
<div class="search">
|
<div class="search_thing">
|
<div class="search_label">实验室名称:</div>
|
<div class="search_input"><el-input size="small" placeholder="请输入" clearable
|
v-model="componentData.entity.laboratoryName" @keyup.enter.native="refreshTable()"></el-input></div>
|
</div>
|
<div class="search_thing">
|
<div class="search_label">实验室编码:</div>
|
<div class="search_input"><el-input size="small" placeholder="请输入" clearable
|
v-model="componentData.entity.laboratoryNumber" @keyup.enter.native="refreshTable()"></el-input></div>
|
</div>
|
<div class="search_thing" style="padding-left: 30px;">
|
<el-button size="small" @click="refresh()">重 置</el-button>
|
<el-button size="small" type="primary" @click="refreshTable()">查 询</el-button>
|
</div>
|
</div>
|
<div class="table">
|
<ValueTable ref="ValueTable" :url="$api.laboratoryScope.selectItemParameter"
|
:upUrl="$api.laboratoryScope.upParameter" :delUrl="$api.laboratoryScope.delParameter"
|
:componentData="componentData" :key="upIndex" />
|
</div>
|
<el-dialog title="印章管理" :visible.sync="fileVisible" width="60vw">
|
<div class="btns">
|
<el-button size="medium" type="primary" @click="openUpload">更新印章</el-button>
|
</div>
|
<ValueTable ref="ValueTable0" :url="$api.sealScope.selectSeal"
|
:componentData="fileComponentData" :key="upIndex" style="height: 400px;" />
|
</el-dialog>
|
<el-dialog title="更新印章" :visible.sync="upFileVisible" width="400px">
|
<div class="search_thing" style="margin-bottom: 16px;">
|
<div class="search_label" style="width:90px">印章类型:</div>
|
<div class="search_input">
|
<el-cascader
|
v-model="dataForm.type"
|
:options="options"
|
:show-all-levels="false"
|
:props="props"
|
placeholder="请选择" size="small"
|
style="width:100%"
|
collapse-tags
|
clearable></el-cascader>
|
</div>
|
</div>
|
<div class="search_thing">
|
<div class="search_label" style="width:90px">印章图片:</div>
|
<div class="search_input">
|
<el-upload
|
:action="action"
|
:headers="headers"
|
accept='image/jpg,image/jpeg,image/png'
|
:show-file-list="false"
|
:on-success="handleSuccess"
|
:on-change="beforeUpload"
|
ref="upload"
|
:on-error="onError"
|
>
|
<img v-if="dataForm.address" :src="javaApi+'/img/'+dataForm.address" style="width: 110px;height: 110px;" >
|
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
</el-upload>
|
</div>
|
</div>
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="upFileVisible = false">取 消</el-button>
|
<el-button type="primary" @click="confirmConnect" :loading="loading">确 定</el-button>
|
</span>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import ValueTable from '../tool/value-table.vue'
|
export default {
|
components: {
|
ValueTable
|
},
|
computed: {
|
headers() {
|
return {
|
'token': sessionStorage.getItem('token')
|
}
|
},
|
action() {
|
return this.javaApi + this.$api.deviceScope.uploadFile
|
}
|
},
|
data() {
|
return {
|
componentData: {
|
entity: {
|
laboratoryName: null,
|
laboratoryNumber: null,
|
head: null,
|
orderBy: {
|
field: 'id',
|
order: 'asc'
|
}
|
},
|
isIndex: true,
|
showSelect: false,
|
select: false,
|
do: [{
|
id: 'update',
|
font: '编辑',
|
type: 'text',
|
method: 'doDiy',
|
field: ['createUserName']
|
}, {
|
id: 'delete',
|
font: '删除',
|
type: 'text',
|
method: 'doDiy'
|
}, {
|
id: '',
|
font: '印章管理',
|
type: 'text',
|
method: 'fileManagement'
|
}],
|
tagField: {
|
type:{
|
select:[]
|
}
|
},
|
selectField: {},
|
requiredAdd: ['laboratoryName', 'laboratoryNumber', 'head', 'phoneNumber'],
|
requiredUp: ['laboratoryName', 'laboratoryNumber', 'head', 'phoneNumber']
|
},
|
fileComponentData: {
|
entity: {
|
labId:null,
|
orderBy: {
|
field: 'id',
|
order: 'asc'
|
}
|
},
|
isPage:false,
|
init:false,
|
isIndex: true,
|
showSelect: false,
|
select: false,
|
do: [],
|
tagField: {},
|
selectField: {
|
type:{
|
select:[]
|
}
|
},
|
requiredAdd: [],
|
requiredUp: [],
|
addUpload:['address'],
|
},
|
entityCopy: {},
|
upIndex: 0,
|
addDia: true,
|
addPower: true,
|
fileVisible:false,
|
upFileVisible:false,
|
loading:false,
|
dataForm:{
|
type:'',
|
address:'',
|
},
|
props: { multiple: false,emitPath:false,},
|
options:[
|
{
|
value:'实验室资质',
|
label:'实验室资质',
|
children:[]
|
},
|
{
|
value:'报告类型',
|
label:'报告类型',
|
children:null
|
},
|
],
|
}
|
},
|
mounted() {
|
this.entityCopy = this.HaveJson(this.componentData.entity)
|
this.getPower()
|
this.getCertificationDetail()
|
},
|
methods: {
|
refreshTable() {
|
this.$refs['ValueTable'].selectList()
|
},
|
getCertificationDetail(){
|
this.$axios.post(this.$api.certification.getCertificationDetail, {
|
page: {
|
current: -1,
|
size: -1,
|
},
|
entity: {
|
name: null,
|
}
|
}, {
|
headers: {
|
'Content-Type': 'application/json'
|
}
|
}).then(res => {
|
if (res.code === 201) {
|
return
|
}
|
let arr = res.data.body.records.map(m=>{
|
m.value = m.name;
|
m.label = m.name;
|
return m
|
})
|
this.options[0].children = arr;
|
this.fileComponentData.tagField.type.select = arr;
|
this.fileComponentData.selectField.type.select = arr;
|
})
|
},
|
refresh() {
|
this.componentData.entity = this.HaveJson(this.entityCopy)
|
this.upIndex++
|
},
|
openAdd() {
|
this.$refs.ValueTable.openAddDia(this.$api.laboratoryScope.addParameter);
|
},
|
openUpload(){
|
this.dataForm.type = '';
|
this.dataForm.address = '';
|
this.upFileVisible = true;
|
},
|
fileManagement(row){
|
this.fileVisible = true;
|
this.fileComponentData.entity.labId = row.id;
|
this.$nextTick(function () {
|
this.$refs['ValueTable0'].selectList()
|
})
|
},
|
confirmConnect(){
|
if(!this.dataForm.type){
|
this.$message.error('未上选择印章类型');
|
return
|
}
|
if(!this.dataForm.address){
|
this.$message.error('未上传印章');
|
return
|
}
|
this.loading = true;
|
this.$axios.post(this.$api.sealScope.addSeal, {
|
labId:this.fileComponentData.entity.labId,
|
...this.dataForm
|
}, {
|
headers: {
|
'Content-Type': 'application/json'
|
}
|
}).then(res => {
|
this.loading = false;
|
if (res.code === 201) {
|
return
|
}
|
this.$refs['ValueTable0'].selectList()
|
this.upFileVisible = false;
|
})
|
},
|
handleSuccess(response,){
|
if (response.code == 200) {
|
this.dataForm.address = response.data.url
|
}
|
},
|
beforeUpload(file,type) {
|
if (file.size > 1024 * 1024 * 10) {
|
this.$message.error('上传文件不超过10M');
|
this.$refs.upload.clearFiles()
|
return false;
|
} else {
|
return true;
|
}
|
},
|
onError(err, file, fileList,type) {
|
this.$message.error('上传失败')
|
this.$refs.upload.clearFiles()
|
},
|
// 权限分配
|
getPower(radio) {
|
let power = JSON.parse(sessionStorage.getItem('power'))
|
let up = false
|
let del = false
|
let add = false
|
let file = false
|
for (var i = 0; i < power.length; i++) {
|
if (power[i].menuMethod == 'upParameter') {
|
up = true
|
}
|
if (power[i].menuMethod == 'delParameter') {
|
del = true
|
}
|
if (power[i].menuMethod == 'addParameter') {
|
add = true
|
}
|
if (power[i].menuMethod == 'addSeal') {
|
file = true
|
}
|
}
|
if (!file) {
|
this.componentData.do.splice(2, 1)
|
}
|
if (!del) {
|
this.componentData.do.splice(1, 1)
|
}
|
if (!up) {
|
this.componentData.do.splice(0, 1)
|
}
|
this.addPower = add
|
}
|
}
|
}
|
</script>
|