|
@@ -94,42 +94,18 @@
|
|
|
:limit = 1
|
|
|
:on-change="handleChange"
|
|
|
:file-list="fileList"
|
|
|
+ :auto-upload="false"
|
|
|
accept=".jpg,.jpeg,.JPG,.JPEG,.PNG,.png,.GIF,.gif"
|
|
|
>
|
|
|
<el-button size="small" type="primary">点击上传</el-button>
|
|
|
</el-upload>
|
|
|
- </el-form-item>
|
|
|
- <!-- <el-checkbox-group v-model="form.logo" v-show="false"></el-checkbox-group> -->
|
|
|
- <!-- <el-upload
|
|
|
- action="#"
|
|
|
- accept="image/png,image/jpg,image/jpeg"
|
|
|
- :http-request="uploadFile"
|
|
|
- :limit = limit
|
|
|
- list-type="picture-card"
|
|
|
- :file-list="fileList"
|
|
|
- style="color:#D9D9D9"
|
|
|
- on-sucsee="handSuccess"
|
|
|
- :auto-upload="true">
|
|
|
- <i slot="default" class="el-icon-plus"></i>
|
|
|
- <div slot="file" slot-scope="{file}">
|
|
|
- <img class="el-upload-list__item-thumbnail imgupload" :src="file.url" alt="" >
|
|
|
- <span class="el-upload-list__item-actions">
|
|
|
- <span v-if="!disabled" class="el-upload-list__item-delete" @click="handleRemove(file)">
|
|
|
- <i class="el-icon-delete"></i>
|
|
|
- </span>
|
|
|
- </span>
|
|
|
- </div>
|
|
|
- </el-upload> -->
|
|
|
- <!-- <el-dialog :visible.sync="dialogVisible" >
|
|
|
- <img width="100%" :src="dialogImageUrl" alt="">
|
|
|
- </el-dialog> -->
|
|
|
+ </el-form-item>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button type="primary" @click="submitForm" v-if="!loading">确 定</el-button>
|
|
|
<el-button :loading="loading" type="primary" @click="submitForm" v-else>提交中...</el-button>
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
</div>
|
|
|
-
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -214,15 +190,7 @@ export default {
|
|
|
onInput(){
|
|
|
this.$forceUpdate();
|
|
|
},
|
|
|
- handleRemove(file) {
|
|
|
- this.form.logo = undefined
|
|
|
- // this.$nextTick(() => {
|
|
|
- // this.$refs['form'].clearValidate(['logo']);
|
|
|
- // })
|
|
|
- this.limit = 100
|
|
|
- document.getElementsByClassName("el-upload-list el-upload-list--picture-card")[0].firstChild.remove()
|
|
|
- document.getElementsByClassName("el-upload--picture-card")[0].style.display="block"
|
|
|
- },
|
|
|
+
|
|
|
/** 查询参数列表 */
|
|
|
getList() {
|
|
|
this.loading = true;
|
|
@@ -302,9 +270,6 @@ export default {
|
|
|
this.reset();
|
|
|
this.open = true;
|
|
|
this.title = "添加参数";
|
|
|
- setTimeout(()=>{
|
|
|
- document.getElementsByClassName("el-upload--picture-card")[0].style.display="block"
|
|
|
- },200)
|
|
|
},
|
|
|
// 多选框选中数据
|
|
|
handleSelectionChange(selection) {
|
|
@@ -318,69 +283,18 @@ export default {
|
|
|
Object.assign(this.form, row.id ? this.adminList.find(val=>val.id === row.id) : this.adminList.find(val=>val.id === this.ids[0]))
|
|
|
this.open = true;
|
|
|
this.title = "修改参数";
|
|
|
- // setTimeout(() =>{
|
|
|
- // if(this.fileList.length>0){
|
|
|
- // }else{
|
|
|
- // this.fileList.push([])
|
|
|
- // this.fileList[0].url = row.logo
|
|
|
- // }
|
|
|
- // document.getElementsByClassName("el-upload--picture-card")[0].style.display="none"
|
|
|
- // },100)
|
|
|
- // this.limit = 1
|
|
|
- // });
|
|
|
},
|
|
|
- // 图片上传尺寸大小检验
|
|
|
- beforeUpload (file) {
|
|
|
- const is1M = file.size / 1024 < 70; // 限制小于70kb
|
|
|
- const isSize = new Promise(function (resolve, reject) {
|
|
|
- let width = 1024; // 限制图片尺寸为1024X240
|
|
|
- let height = 640;
|
|
|
- let _URL = window.URL || window.webkitURL;
|
|
|
- let img = new Image();
|
|
|
- img.onload = function () {
|
|
|
- let valid = img.width === width && img.height === height;
|
|
|
- valid ? resolve() : reject();
|
|
|
- }
|
|
|
|
|
|
- img.src = _URL.createObjectURL(file);
|
|
|
- }).then(() => {
|
|
|
- return file;
|
|
|
- }, () => {
|
|
|
- this.$message.error('图片尺寸限制为1024 x 240,大小不可超过70kB')
|
|
|
- return Promise.reject();
|
|
|
- });
|
|
|
- // if (!is1M) {
|
|
|
- // this.$message.error('图片尺寸限制为1024 x 240,大小不可超过70kB')
|
|
|
- // }
|
|
|
- // return isSize&is1M
|
|
|
- },
|
|
|
- // 图片 转base64
|
|
|
- getBase64(file) {
|
|
|
- return new Promise(function (resolve, reject) {
|
|
|
- let reader = new FileReader();
|
|
|
- let imgResult = "";
|
|
|
- reader.readAsDataURL(file);
|
|
|
- reader.onload = function () {
|
|
|
- imgResult = reader.result;
|
|
|
- };
|
|
|
- reader.onerror = function (error) {
|
|
|
- reject(error);
|
|
|
- };
|
|
|
- reader.onloadend = function () {
|
|
|
- resolve(imgResult);
|
|
|
- };
|
|
|
- });
|
|
|
- },
|
|
|
uploadFile(param){
|
|
|
this.limit = 1
|
|
|
- document.getElementsByClassName("el-upload--picture-card")[0].style.display="none"
|
|
|
fileId().then(res=>{
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs['form'].clearValidate(['logo']);
|
|
|
- })
|
|
|
+ // this.$nextTick(() => {
|
|
|
+ // this.$refs['form'].clearValidate(['logo']);
|
|
|
+ // })
|
|
|
this.form.batchNo = res.msg
|
|
|
this.form.logo = res.msg
|
|
|
this.formData = new FormData()// FormData 对象
|
|
|
+
|
|
|
this.formData.append('files', param.file)// 文件对象
|
|
|
})
|
|
|
},
|