gaosp
2024-03-03 07f190ec30b8af7dcfc1323f9c40652b85e186c9
src/container/ledger/Manage-add-update.vue
@@ -150,12 +150,12 @@
          </el-col> -->
               <el-col :xs="24" :sm="6" :md="6" :lg="6" :xl="6">
                  <el-form-item label="电气复杂系数" prop="elecCompFactor">
                     <el-input v-model="dataForm.elecCompFactor" placeholder="电气复杂系数" clearable></el-input>
                     <el-input v-model="dataForm.elecCompFactor" placeholder="电气复杂系数" :change="checkAmount('elecCompFactor')" clearable></el-input>
                  </el-form-item>
               </el-col>
               <el-col :xs="24" :sm="6" :md="6" :lg="6" :xl="6">
                  <el-form-item label="机械复杂系数" prop="mechCompFactor">
                     <el-input v-model="dataForm.mechCompFactor" placeholder="机械复杂系数" clearable></el-input>
                     <el-input v-model="dataForm.mechCompFactor" placeholder="机械复杂系数" :change="checkAmount('mechCompFactor')" clearable></el-input>
                  </el-form-item>
               </el-col>
@@ -227,6 +227,7 @@
               <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
                  <el-form-item label="上传设备图片" prop="pic">
                     <el-upload class="avatar-uploader" action="/mdc/account/uploadPic" :show-file-list="false"
                        accept=".jpg, .png"
                        :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload">
                        <img v-if="dataForm.pic" :src="dataForm.pic" class="avatar">
                        <i v-else class="el-icon-plus avatar-uploader-icon"></i>
@@ -366,10 +367,19 @@
      beforeAvatarUpload(file) {
         const types  = ['image/jpeg','image/jpg','image/png']
         const isJPG = file.type;
         console.log(isJPG)
         if (!types.includes(isJPG)) {
         this.$message.error('上传头像图片只能是 JPG、PNG 格式!');
         this.$message.error('上传文件必须为图片');
         }
         return types.includes(isJPG);
         // const typeArry = ['.jpg', '.png',  '.JPG', '.PNG'];
         // const type = file.name.substring(file.name.lastIndexOf('.'));
         // const isImage = typeArry.indexOf(type) > -1;
         // if (!isImage) {
         //   this.$message.error('上传文件必须为图片');
         // }
         // return isImage;
      },
      handleAvatarSuccess(res) {
         if (res.result === 'SUCCESS') {