linwenling
2023-08-08 49bf04d7865d999463a024b82a6cd7608bb89507
ruoyi-ui/src/views/honor/index.vue
@@ -50,27 +50,11 @@
                  -->
      </el-form-item>
      <el-form-item label="名称" prop="name">
<!--        <el-input-->
<!--          v-model="queryParams.name"-->
<!--          placeholder="请输入名称"-->
<!--          clearable-->
<!--          style="width: 240px"-->
<!--          @keyup.enter.native="handleQuery">-->
<!--          <i slot="prefix" class="el-input__icon el-icon-search"></i>-->
<!--        </el-input>-->
        <el-select
          v-model="queryParams.name"
          placeholder="所有类别"
          clearable
          style="width: 240px"
          @keyup.enter.native="handleQuery"
        >
          <el-option
            v-for="dic in typeOptions"
            :key="dic.value"
            :label="dic.label"
            :value="dic.value"
          />
        <el-select v-model="queryParams.name" placeholder="所有名称" clearable
                   style="width: 240px" @keyup.enter.native="handleQuery">
          <el-option v-for="item in typeOptions"
                     :key="item.value" :label="item.label" :value="item.value"/>
        </el-select>
      </el-form-item>
      <el-form-item label="类别" prop="type" >
@@ -203,19 +187,20 @@
      </el-table-column>
      <el-table-column label="名称" prop="name" sortable :show-overflow-tooltip="true" width="120" align="center" >
<!--        <template slot-scope="scope">{{scope.row.name? scope.row.name: '————'}}</template>-->
        <template slot-scope="scope">
<!--        <template slot-scope="scope">-->
<!--          <template v-if="formDat.name===1">{{ getSrc(scope.row.name) }}</template>-->
          <template v-if="scope.row.name == 1">出生证</template>
          <template v-else-if="scope.row.name == 2">学生证</template>
          <template v-else-if="scope.row.name == 3">毕业证</template>
          <template v-else-if="scope.row.name == 4">结婚证</template>
          <template v-else-if="scope.row.name == 5">户口簿</template>
          <template v-else-if="scope.row.name == 6">独生子女证</template>
          <template v-else-if="scope.row.name == 7">高级职称</template>
          <template v-else-if="scope.row.name == 8">护照</template>
          <template v-else-if="scope.row.name == 9">通行证</template>
          <template v-else>{{ scope.row.name }}</template>
        </template>
<!--          <template v-if="scope.row.name == 1">出生证</template>-->
<!--          <template v-else-if="scope.row.name == 2">学生证</template>-->
<!--          <template v-else-if="scope.row.name == 3">毕业证</template>-->
<!--          <template v-else-if="scope.row.name == 4">结婚证</template>-->
<!--          <template v-else-if="scope.row.name == 5">户口簿</template>-->
<!--          <template v-else-if="scope.row.name == 6">独生子女证</template>-->
<!--          <template v-else-if="scope.row.name == 7">高级职称</template>-->
<!--          <template v-else-if="scope.row.name == 8">护照</template>-->
<!--          <template v-else-if="scope.row.name == 9">通行证</template>-->
<!--          <template v-else>{{ scope.row.name }}</template>-->
<!--        </template>-->
        <template slot-scope="scope">{{scope.row.name? scope.row.name: '————'}}</template>
      </el-table-column>
      <el-table-column label="证号/专业" prop="idNo" sortable width="170" align="center" >
        <template slot-scope="scope">{{scope.row.idNo? scope.row.idNo: '————'}}</template>
@@ -306,7 +291,7 @@
<!--          <el-date-picker v-model='formDat.happenTime' type='date' placeholder='选择日期'></el-date-picker>-->
<!--        </el-form-item>-->
        <el-form-item label="类别" prop="type">
          <el-select v-model="formDat.type" placeholder="请选择名称" clearable :style="{width: '100%'}"  >
          <el-select v-model="formDat.type" placeholder="请选择类别" clearable :style="{width: '100%'}"  >
            <el-option v-for="(item, index) in typeOption" :key="index" :label="item.label" :value="item.value"
            ></el-option>
          </el-select>
@@ -316,6 +301,8 @@
            <el-option v-for="(item, index) in typeOptions" :key="index" :label="item.label" :value="item.value"
            ></el-option>
          </el-select>
          <el-input v-model="newOption" v-if="showInput" placeholder="若未在上述选项中找到对应名称,请在此输入新的名称" @change="addNewOption"></el-input>
        </el-form-item>
        <el-form-item label="证件号/专业" prop="idNo">
          <el-input v-model="formDat.idNo" placeholder="请输入证件号/专业" clearable :style="{width: '100%'}" >
@@ -423,7 +410,7 @@
//导入接口函数
import {listHonor,enload, addHonor,updateHonor, delHonor,uploadPic,getCategory} from "@/api/honor/index";
import {listHonor,listType,enload, addHonor,updateHonor, delHonor,uploadPic,getCategory} from "@/api/honor/index";
import { Notification, MessageBox, Message, Loading } from 'element-ui'
export default {
@@ -448,6 +435,7 @@
      total: 0,
      // 荣誉表格数据
      honorList: [],
      typeList:[],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
@@ -461,12 +449,10 @@
      // 日期范围
      dateRange: [],
      // 数据范围选项
      fot:[".jpg",".jif"],
      fileList:[
      ],
      fileListOther:[
      ],
      fot:['.bmp','.jpg','.jpeg','.png','.tif','.gif','.pcx','.tga','.exif','.fpx',
        '.svg','.psd','.cdr','.pcd','.dxf','.ufo','.eps','.ai','.aw','.WMF','.webp','.apng'],
      fileList:[],
      fileListOther:[],
      dsb:true,
      btn:false,
      fit:['fill'],
@@ -519,7 +505,7 @@
          trigger: 'blur'
        }],
        name: [{
          required: true,
          // required: true,
          message: '请输入名称',
          trigger: 'blur'
        }],
@@ -556,16 +542,18 @@
      },
      selected:'',
      typeOptions: [],
      newOption: undefined,
      showInput: true,
      typeOption:[
        {value:'1',label:'荣誉'},
        {value:'0',label:'证件'},
        {value:'1',label:'荣誉'},
        {value:'2',label:'资质'},]
    };
  },
  created() {
    this.getList();
    this.getCateInfor()
    this.getTypeOptions();
    // for (let i = 0; i < this.contactList.length; i++) {
    //   this.formDat[i] = this.contactList[i];
    // }
@@ -585,6 +573,14 @@
        return "statistics-warning-row";
      }
    },
    //名称
    addNewOption() {
      const newOption = this.newOption.trim();
      if (newOption && !this.typeOptions.includes(newOption)) {
        this.typeOptions.push(newOption);
        this.$set(this.formDat, 'type', newOption); // 更新formDat.type的值为新的选项
      }
    },
    /** 查询记录列表 */
    getList() {
      this.loading = true;
@@ -601,6 +597,32 @@
          this.loading = false;
        }
      );
      listType(this.queryParams).then(response => {
          this.typeList = response.data;
          this.total = response.data.total;
          // console.log( this.typeList )
          // 在回调函数中调用 getTypeOptions()
          this.getTypeOptions();
          this.loading = false;
        }
      );
    },
    getTypeOptions() {
      const filteredOptions = this.typeList.filter(item => typeof item === 'string' && item !== '');
      const uniqueOptions = {};
      this.typeOptions = filteredOptions.reduce((options, option) => {
        if (!uniqueOptions[option]) {
          uniqueOptions[option] = true;
          options.push({
            label: option,
            value: option
          });
        }
        return options;
      }, []);
    },
    /** 查询类别信息 */
    getCateInfor()
@@ -763,6 +785,7 @@
    /** 提交按钮(数据权限) */
    submitDataScope: function() {
      let ul = this.fileList.map(function (elem){
        return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API,"")
      }).join(",")