| | |
| | | <el-button type="primary" @click="customAdd" :loading="loading">确 定</el-button> |
| | | </span></template> |
| | | </el-dialog> |
| | | <el-dialog title="印章管理" v-model="fileVisible" width="60vw"> |
| | | <div class="btns"> |
| | | <el-button size="default" type="primary" @click="openUpload">更新印章</el-button> |
| | | </div> |
| | | <lims-table :tableData="fileComponentData" :column="fileComponentDataColumn" @pagination="fileComponentPagination" |
| | | height="500px" :page="fileComponentPage" :tableLoading="fileComponentTableLoading"></lims-table> |
| | | </el-dialog> |
| | | <el-dialog title="更新印章" v-model="upFileVisible" width="400px"> |
| | | <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" :show-all-levels="false" :props="props" |
| | | placeholder="请选择" size="small" style="width:100%" collapse-tags clearable></el-cascader> |
| | | </el-form-item> |
| | | <el-form-item label="印章图片" prop="address"> |
| | | <el-upload class="avatar-uploader" :action="action" :headers="uploadHeader" |
| | | 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" class="avatar"> |
| | | <lims-icon v-else class="avatar-uploader-icon" name="el-icon-plus"></lims-icon> |
| | | </el-upload> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer><span class="dialog-footer"> |
| | | <el-button @click="upFileVisible = false">取 消</el-button> |
| | | <el-button type="primary" @click="confirmConnect" :loading="loading">确 定</el-button> |
| | | </span></template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | import limsTable from "@/components/Table/lims-table.vue"; |
| | | import { |
| | | addParameter, |
| | | addSeal, |
| | | delParameter, |
| | | selectItemParameter, |
| | | selectSeal, |
| | | upParameter |
| | | } from "@/api/structural/laboratoryScope"; |
| | | import { getCertificationDetail } from "@/api/structural/laboratory"; |
| | | export default { |
| | | components: { |
| | | limsTable |
| | | |
| | | }, |
| | | computed: { |
| | | action() { |
| | | return this.javaApi + '/deviceScope/uploadFile' |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | |
| | | this.delete(row); |
| | | }, |
| | | }, |
| | | { |
| | | name: '印章管理', |
| | | type: 'text', |
| | | clickFun: (row) => { |
| | | this.fileManagement(row); |
| | | }, |
| | | }, |
| | | ] |
| | | } |
| | | ], |
| | |
| | | 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, |
| | | loading: false, |
| | | dataForm: { |
| | | type: '', |
| | | address: '', |
| | | }, |
| | | dataFormRules: { |
| | | type: [{ required: true, message: '请选择印章类型', trigger: 'change' }], |
| | | address: [{ required: false, message: '请上传图片', trigger: 'change' }], |
| | | }, |
| | | props: { multiple: false, emitPath: false, }, |
| | | options: [ |
| | | { |
| | | value: '行业资质', |
| | | label: '行业资质', |
| | | children: [] |
| | | }, |
| | | { |
| | | value: '委托报告', |
| | | label: '委托报告', |
| | | children: null |
| | | }, |
| | | { |
| | | value: '进厂报告', |
| | | label: '进厂报告', |
| | | children: null |
| | | }, |
| | | ], |
| | | } |
| | | }, |
| | | mounted() { |
| | |
| | | }) |
| | | }).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() |
| | | }, |
| | | // 查询印章类型 |
| | | 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() { |
| | | 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; |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | 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> |
| | |
| | | justify-content: space-between; |
| | | } |
| | | |
| | | .btns { |
| | | text-align: right; |
| | | margin-bottom: 10px; |
| | | } |
| | | |
| | | :deep(.el-dialog__body) { |
| | | padding-top: 8px !important; |
| | | } |
| | | |
| | | .avatar-uploader :deep(.el-upload) { |
| | | border: 1px dashed #666666; |
| | | border-radius: 6px; |
| | | cursor: pointer; |
| | | position: relative; |
| | | overflow: hidden; |
| | | } |
| | | |
| | | .avatar-uploader :deep(.el-upload:hover) { |
| | | border-color: var(--el-color-primary); |
| | | } |
| | | |
| | | .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> |