licp
2024-04-22 0b1c5e6680c2986b54866b8dded31c4d9c497fdc
src/components/view/a5-laboratory-management.vue
@@ -34,6 +34,35 @@
      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>
@@ -67,6 +96,52 @@
            :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.laboratoryScope.selectItemParameter"
            :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.insProductIds"
          :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"
            :limit="1"
            >
            <img v-if="dataForm.pic1" :src="dataForm.pic1" >
            <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>
@@ -75,6 +150,16 @@
   export default {
      components: {
         ValueTable
      },
    computed: {
         headers() {
            return {
               'token': sessionStorage.getItem('token')
            }
         },
         action() {
            return this.javaApi + this.$api.deviceScope.uploadFile
         }
      },
      data() {
         return {
@@ -102,26 +187,92 @@
                  font: '删除',
                  type: 'text',
                  method: 'doDiy'
               }, {
                  id: '',
                  font: '印章管理',
                  type: 'text',
                  method: 'fileManagement'
               }],
               tagField: {},
               selectField: {},
               requiredAdd: ['laboratoryName', 'laboratoryNumber', 'head', 'phoneNumber'],
               requiredUp: ['laboratoryName', 'laboratoryNumber', 'head', 'phoneNumber']
            },
        fileComponentData: {
               entity: {
                  orderBy: {
                     field: 'id',
                     order: 'asc'
                  }
               },
          isPage:false,
          init:false,
               isIndex: true,
               showSelect: false,
               select: false,
               do: [],
               tagField: {},
               selectField: {},
               requiredAdd: [],
               requiredUp: []
            },
            entityCopy: {},
            upIndex: 0,
            addDia: true,
            addPower: true
            addPower: true,
        fileVisible:true,
        upFileVisible:false,
        loading:false,
        dataForm:{},
        props: { multiple: false,emitPath:false,},
        options:[
          {
            value:0,
            label:'实验室资质',
            children:[]
          },
          {
            value:1,
            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.id;
            m.label = m.name;
            return m
          })
          this.options[0].children = arr;
        })
      },
         refresh() {
            this.componentData.entity = this.HaveJson(this.entityCopy)
            this.upIndex++
@@ -129,6 +280,43 @@
         openAdd() {
            this.$refs.ValueTable.openAddDia(this.$api.laboratoryScope.addParameter);
         },
      openUpload(){
        this.dataForm = {};
        this.upFileVisible = true;
      },
      fileManagement(row){
        this.$refs['ValueTable0'].selectList()
        this.fileVisible = true;
      },
      confirmConnect(){
        if(!this.dataForm.pic1){
          this.$message.error('未上传企业印章');
          return
        }
        if(!this.dataForm.pic2){
          this.$message.error('未上传CNAS印章');
          return
        }
        this.loading = true;
      },
      handleSuccess(response,){
        if (response.code == 200) {
          this.dataForm.pic1 = response.data
            }
      },
      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'))