| | |
| | | import request from '@/utils/request' |
| | | |
| | | // 获取场所枚举值 |
| | | // 获取实验室名称 |
| | | export function obtainItemParameterList() { |
| | | return request({ |
| | | url: '/laboratoryScope/obtainItemParameterList', |
| | | method: 'get' |
| | | }) |
| | | } |
| | | // 查询实验室管理列表 |
| | | export function selectItemParameter(query) { |
| | | return request({ |
| | | url: '/laboratoryScope/selectItemParameter', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | |
| | | <script> |
| | | export default { |
| | | name: "index" |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | |
| | | <div class="capacity-scope"> |
| | | <div class="search"> |
| | | <div> |
| | | <el-form :model="queryParams" ref="queryForm" size="small" :inline="true"> |
| | | <el-form-item label="实验室名称" prop="laboratoryName"> |
| | | <el-input size="small" placeholder="请输入" clearable v-model="queryParams.laboratoryName" |
| | | @keyup.enter.native="refreshTable"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="实验室编码" prop="laboratoryNumber"> |
| | | <el-input size="small" placeholder="请输入" clearable v-model="queryParams.laboratoryNumber" |
| | | @keyup.enter.native="refreshTable"></el-input> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="el-icon-search" size="mini" @click="refreshTable">查 询</el-button> |
| | | <el-button icon="el-icon-refresh" size="mini" @click="refresh">重 置</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <div> |
| | | <el-button size="small" type="primary" @click="openAdd" icon="el-icon-plus">新增</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" />--> |
| | | <lims-table :tableData="tableData" :column="column" |
| | | @pagination="pagination" |
| | | :page="page" :tableLoading="tableLoading"></lims-table> |
| | | </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> |
| | | |
| | | <style scoped lang="scss"> |
| | | <script> |
| | | import limsTable from "@/components/Table/lims-table.vue"; |
| | | import {selectItemParameter} from "@/api/structural/laboratoryScope"; |
| | | |
| | | export default { |
| | | components: { |
| | | limsTable |
| | | |
| | | }, |
| | | computed: { |
| | | headers() { |
| | | return { |
| | | 'token': sessionStorage.getItem('token') |
| | | } |
| | | }, |
| | | action() { |
| | | return this.javaApi |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | queryParams: { |
| | | laboratoryName: '', |
| | | laboratoryNumber: '', |
| | | }, |
| | | tableData: [], |
| | | tableLoading: false, |
| | | column: [ |
| | | {label: '实验室名称', prop: 'laboratoryName'}, |
| | | {label: '场所编码', prop: 'laboratoryNumber'}, |
| | | {label: '实验室代号', prop: 'laboratoryCode'}, |
| | | {label: '负责人', prop: 'head'}, |
| | | {label: '负责人电话', prop: 'phoneNumber'}, |
| | | {label: '地址', prop: 'address'}, |
| | | {label: '创建人', prop: 'createUserName'}, |
| | | {label: '创建时间', prop: 'createTime'}, |
| | | { |
| | | dataType: 'action', |
| | | fixed: 'right', |
| | | label: '操作', |
| | | width: '140px', |
| | | operation: [ |
| | | { |
| | | name: '编辑', |
| | | type: 'text', |
| | | clickFun: (row) => { |
| | | this.editForm(row); |
| | | }, |
| | | }, |
| | | { |
| | | name: '删除', |
| | | type: 'text', |
| | | clickFun: (row) => { |
| | | this.delete(row); |
| | | }, |
| | | }, |
| | | { |
| | | name: '印章管理', |
| | | type: 'text', |
| | | clickFun: (row) => { |
| | | this.fileManagement(row); |
| | | }, |
| | | }, |
| | | ] |
| | | } |
| | | ], |
| | | page: { |
| | | total:0, |
| | | size:10, |
| | | current:1 |
| | | }, |
| | | 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'], |
| | | needSort: ['laboratoryName', 'createTime'], |
| | | }, |
| | | 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: {}, |
| | | fileVisible:false, |
| | | upFileVisible:false, |
| | | loading:false, |
| | | dataForm:{ |
| | | type:'', |
| | | address:'', |
| | | }, |
| | | props: { multiple: false,emitPath:false,}, |
| | | options:[ |
| | | { |
| | | value:'实验室资质', |
| | | label:'实验室资质', |
| | | children:[] |
| | | }, |
| | | { |
| | | value:'委托报告', |
| | | label:'委托报告', |
| | | children:null |
| | | }, |
| | | { |
| | | value:'进厂报告', |
| | | label:'进厂报告', |
| | | children:null |
| | | }, |
| | | ], |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.entityCopy = this.HaveJson(this.componentData.entity) |
| | | this.getCertificationDetail() |
| | | }, |
| | | methods: { |
| | | refreshTable() { |
| | | this.tableLoading = true |
| | | selectItemParameter({...this.page, ...this.itemParameterForm}).then(res => { |
| | | this.tableLoading = false |
| | | if (res.code === 200) { |
| | | this.tableData = res.data.records |
| | | this.page.total = res.data.total |
| | | } |
| | | }).catch(err => { |
| | | this.tableLoading = false |
| | | }) |
| | | }, |
| | | 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.selectField.type.select = arr; |
| | | }) |
| | | }, |
| | | refresh() { |
| | | this.componentData.entity = this.HaveJson(this.entityCopy) |
| | | this.refreshTable() |
| | | }, |
| | | pagination (page) { |
| | | this.page.size = page.pageNum.limit |
| | | this.refreshTable() |
| | | }, |
| | | 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('page') |
| | | }) |
| | | }, |
| | | 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('page') |
| | | 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() |
| | | }, |
| | | } |
| | | } |
| | | </script> |
| | | <style scoped> |
| | | .search { |
| | | height: 46px; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | } |
| | | </style> |