| | |
| | | </el-form> |
| | | </div> |
| | | <div> |
| | | <el-button size="small" type="primary" @click="openAdd" icon="el-icon-plus">新增</el-button> |
| | | <el-button size="small" type="primary" @click="openAdd('add')" icon="el-icon-plus">新增</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table"> |
| | | <lims-table :tableData="tableData" :column="column" |
| | | :height="'calc(100vh - 250px)'" |
| | | @pagination="pagination" |
| | | :page="page" :tableLoading="tableLoading"></lims-table> |
| | | </div> |
| | | <!-- 新增实验室--> |
| | | <el-dialog :title="formTitle" :visible.sync="addDia" width="450px"> |
| | | <el-form ref="laboratoryForm" :model="laboratoryForm" :rules="userRules" |
| | | label-position="right" label-width="100px"> |
| | | <el-form-item label="实验室名称" prop="laboratoryName"> |
| | | <el-input v-model="laboratoryForm.laboratoryName" size="small" clearable></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="场所编码" prop="laboratoryNumber"> |
| | | <el-input v-model="laboratoryForm.laboratoryNumber" size="small" clearable></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="实验室代号" prop="laboratoryCode"> |
| | | <el-input v-model="laboratoryForm.laboratoryCode" size="small" clearable></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="负责人" prop="head"> |
| | | <el-input v-model="laboratoryForm.head" size="small" clearable></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="负责人电话" prop="phoneNumber"> |
| | | <el-input v-model="laboratoryForm.phoneNumber" size="small" clearable></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="地址" prop="address"> |
| | | <el-input v-model="laboratoryForm.address" size="small" clearable></el-input> |
| | | </el-form-item> |
| | | </el-form> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="reset">取 消</el-button> |
| | | <el-button type="primary" @click="customAdd" :loading="loading">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | <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;" />--> |
| | | <lims-table :tableData="fileComponentData" :column="fileComponentDataColumn" |
| | | @pagination="fileComponentPagination" height="500px" |
| | | :page="fileComponentPage" :tableLoading="fileComponentTableLoading"></lims-table> |
| | | </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-form ref="dataForm" :model="dataForm" :rules="dataFormRules" |
| | | label-position="right" label-width="80px"> |
| | | <el-form-item label="印章类型" prop="type"> |
| | | <el-cascader |
| | | v-model="dataForm.type" |
| | | :options="options" |
| | |
| | | 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-form-item> |
| | | <el-form-item label="印章图片" prop="address"> |
| | | <el-upload |
| | | class="avatar-uploader" |
| | | :action="action" |
| | | :headers="headers" |
| | | accept='image/jpg,image/jpeg,image/png' |
| | |
| | | :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;" > |
| | | :on-error="onError"> |
| | | <img v-if="dataForm.address" :src="javaApi+'/img/'+dataForm.address" class="avatar" > |
| | | <i v-else class="el-icon-plus avatar-uploader-icon"></i> |
| | | </el-upload> |
| | | </div> |
| | | </div> |
| | | </el-form-item> |
| | | </el-form> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="upFileVisible = false">取 消</el-button> |
| | | <el-button type="primary" @click="confirmConnect" :loading="loading">确 定</el-button> |
| | |
| | | |
| | | <script> |
| | | import limsTable from "@/components/Table/lims-table.vue"; |
| | | import {selectItemParameter} from "@/api/structural/laboratoryScope"; |
| | | import { |
| | | addParameter, |
| | | addSeal, |
| | | delParameter, |
| | | selectItemParameter, |
| | | selectSeal, |
| | | upParameter |
| | | } from "@/api/structural/laboratoryScope"; |
| | | import {getCertificationDetail} from "@/api/structural/laboratory"; |
| | | |
| | | export default { |
| | | components: { |
| | |
| | | name: '编辑', |
| | | type: 'text', |
| | | clickFun: (row) => { |
| | | this.editForm(row); |
| | | this.openAdd('edit', row); |
| | | }, |
| | | }, |
| | | { |
| | |
| | | size:10, |
| | | current:1 |
| | | }, |
| | | 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'], |
| | | addDia: false, |
| | | formTitle: '', |
| | | laboratoryForm: { |
| | | |
| | | }, |
| | | operationType: '', |
| | | userRules: { |
| | | laboratoryName: [{ required: true, message: '请输入实验室名称', trigger: 'blur' }], |
| | | laboratoryNumber: [{ required: true, message: '请输入场所编码', trigger: 'blur' }], |
| | | head: [{ required: true, message: '请输入负责人', trigger: 'blur' }], |
| | | phoneNumber: [{ required: true, message: '请输入负责人电话', trigger: 'blur' }], |
| | | }, |
| | | currentRow: {}, |
| | | fileComponentTableLoading: false, |
| | | fileComponentData: [], |
| | | fileComponentDataColumn: [ |
| | | {label: '实验室名称', prop: 'laboratoryName'}, |
| | | {label: '印章图片', prop: 'address', dataType: 'image'}, |
| | | {label: '印章类型', prop: 'type'}, |
| | | ], |
| | | fileComponentPage: { |
| | | total:0, |
| | | size:10, |
| | | current:1, |
| | | layout: 'total, prev, pager, next' |
| | | }, |
| | | fileVisible:false, |
| | | upFileVisible:false, |
| | |
| | | dataForm:{ |
| | | type:'', |
| | | address:'', |
| | | }, |
| | | dataFormRules: { |
| | | type: [{ required: true, message: '请选择印章类型', trigger: 'change' }], |
| | | address: [{ required: false, message: '请上传图片', trigger: 'change' }], |
| | | }, |
| | | props: { multiple: false,emitPath:false,}, |
| | | options:[ |
| | |
| | | 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.resetForm('queryForm') |
| | | this.refreshTable() |
| | | }, |
| | | // 分页切换 |
| | | pagination (page) { |
| | | this.page.size = page.pageNum.limit |
| | | this.page.size = page.limit |
| | | this.refreshTable() |
| | | }, |
| | | openAdd() { |
| | | this.$refs.ValueTable.openAddDia(this.$api.laboratoryScope.addParameter); |
| | | openAdd(type, row) { |
| | | this.formTitle = type === 'add' ? '新增实验室' : '编辑实验室' |
| | | this.operationType = type |
| | | if (type === 'edit') { |
| | | this.laboratoryForm = this.HaveJson(row) |
| | | } |
| | | this.addDia = true |
| | | }, |
| | | // 提交新增、编辑实验室表单 |
| | | customAdd() { |
| | | this.$refs['laboratoryForm'].validate((valid) => { |
| | | if (valid) { |
| | | this.loading = true |
| | | if (this.operationType === 'add') { |
| | | addParameter(this.laboratoryForm).then(res => { |
| | | this.loading = false |
| | | if (res.code !== 200) return |
| | | this.$message.success('新增成功') |
| | | this.refreshTable() |
| | | this.reset() |
| | | }).catch(err => { |
| | | this.loading = false |
| | | }) |
| | | } else { |
| | | upParameter(this.laboratoryForm).then(res => { |
| | | this.loading = false |
| | | if (res.code !== 200) return |
| | | this.$message.success('修改成功') |
| | | this.refreshTable() |
| | | this.reset() |
| | | }).catch(err => { |
| | | this.loading = false |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | reset () { |
| | | this.resetForm('laboratoryForm') |
| | | this.addDia = false |
| | | }, |
| | | // 删除实验室 |
| | | delete (row) { |
| | | this.$confirm('是否删除当前数据?', "警告", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }).then(() => { |
| | | delParameter({id: row.id}).then(res => { |
| | | this.$message.success('删除成功') |
| | | this.refreshTable() |
| | | }).catch(e => { |
| | | this.$message.error('删除失败') |
| | | }) |
| | | }).catch(() => {}) |
| | | }, |
| | | // 打开印章管理弹框 |
| | | fileManagement(row){ |
| | | this.fileVisible = true; |
| | | this.fileComponentTableLoading = true |
| | | this.currentRow = row |
| | | this.getFileComponentList() |
| | | }, |
| | | getFileComponentList () { |
| | | selectSeal({id: this.currentRow.id, ...this.fileComponentPage}).then(res => { |
| | | this.fileComponentTableLoading = false |
| | | if (res.code === 200) { |
| | | this.fileComponentData = res.data.records |
| | | this.fileComponentPage.total = res.data.total |
| | | } |
| | | }).catch(err => { |
| | | this.fileComponentTableLoading = false |
| | | }) |
| | | }, |
| | | fileComponentPagination (page) { |
| | | this.fileComponentPage.size = page.limit |
| | | this.getFileComponentList() |
| | | }, |
| | | // 打开更新印章弹框 |
| | | openUpload(){ |
| | | this.dataForm.type = ''; |
| | | this.dataForm.address = ''; |
| | | this.upFileVisible = true; |
| | | this.getCertificationOperation() |
| | | }, |
| | | fileManagement(row){ |
| | | this.fileVisible = true; |
| | | this.fileComponentData.entity.labId = row.id; |
| | | this.$nextTick(function () { |
| | | this.$refs['ValueTable0'].selectList('page') |
| | | // 查询印章类型 |
| | | getCertificationOperation(){ |
| | | const params = { |
| | | current: -1, |
| | | size: -1, |
| | | } |
| | | getCertificationDetail(params).then(res => { |
| | | this.options[0].children = res.data.records.map(m => { |
| | | m.value = m.name; |
| | | m.label = m.name; |
| | | return m |
| | | }); |
| | | }) |
| | | }, |
| | | // 提交更新印章 |
| | | 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' |
| | | this.$refs['dataForm'].validate((valid) => { |
| | | if (valid) { |
| | | this.loading = true; |
| | | addSeal({labId:this.currentRow.id, ...this.dataForm}).then(res => { |
| | | this.loading = false; |
| | | this.getFileComponentList() |
| | | this.upFileVisible = false; |
| | | }) |
| | | } |
| | | }).then(res => { |
| | | this.loading = false; |
| | | if (res.code === 201) { |
| | | return |
| | | } |
| | | this.$refs['ValueTable0'].selectList('page') |
| | | this.upFileVisible = false; |
| | | }) |
| | | }, |
| | | handleSuccess(response,){ |
| | | if (response.code == 200) { |
| | | if (response.code === 200) { |
| | | this.dataForm.address = response.data.url |
| | | } |
| | | }, |
| | |
| | | display: flex; |
| | | justify-content: space-between; |
| | | } |
| | | .btns{ |
| | | text-align: right; |
| | | margin-bottom: 10px; |
| | | } |
| | | ::v-deep .el-dialog__body { |
| | | padding-top: 8px !important; |
| | | } |
| | | .avatar-uploader ::v-deep .el-upload { |
| | | border: 1px dashed #666666; |
| | | border-radius: 6px; |
| | | cursor: pointer; |
| | | position: relative; |
| | | overflow: hidden; |
| | | } |
| | | .avatar-uploader ::v-deep .el-upload:hover { |
| | | border-color: #409EFF; |
| | | } |
| | | .avatar-uploader-icon { |
| | | font-size: 20px; |
| | | color: #8c939d; |
| | | width: 90px; |
| | | height: 90px; |
| | | line-height: 90px; |
| | | text-align: center; |
| | | } |
| | | .avatar { |
| | | width: 90px; |
| | | height: 90px; |
| | | display: block; |
| | | } |
| | | </style> |