|
@@ -66,6 +66,12 @@
|
|
|
<el-form-item>
|
|
|
<el-button type="primary" @click="search">搜索</el-button>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item style="float:right" >
|
|
|
+ <el-button @click="dialogVisible1=true" plain icon="el-icon-upload" type="primary">导入</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item style="float:right" >
|
|
|
+ <el-button @click="download" plain icon="el-icon-download" type="primary">导出</el-button>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item style="float: right">
|
|
|
<el-button @click="add" type="primary">添加期刊</el-button>
|
|
|
</el-form-item>
|
|
@@ -164,6 +170,26 @@
|
|
|
<el-button size="small" type="primary" @click="save">确 定</el-button>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
+ <el-dialog
|
|
|
+ class="fu-dialog"
|
|
|
+ title="导入期刊" width="400px"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :visible.sync="dialogVisible1"
|
|
|
+ >
|
|
|
+ <el-upload
|
|
|
+ class="upload-demo"
|
|
|
+ action="/api/admin/uploadfile"
|
|
|
+ :show-file-list="false"
|
|
|
+ :on-success="handleAvatarSuccess1">
|
|
|
+ <el-button size="small" type="primary">点击上传</el-button>
|
|
|
+ <div slot="tip" class="el-upload__tip">只能上传.xls/.xlsx文件,且不超过500M</div>
|
|
|
+ </el-upload>
|
|
|
+ <div>{{file}}</div>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button size="small" type="normal" @click="dialogVisible1=false">取消</el-button>
|
|
|
+ <el-button size="small" type="primary" @click="upload">确 定</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</section>
|
|
|
</template>
|
|
@@ -183,11 +209,64 @@ export default {
|
|
|
input: "",
|
|
|
dialogVisible: false,
|
|
|
dialogTitle: "",
|
|
|
+ dialogVisible1:false,
|
|
|
form1: {},
|
|
|
+ file:''
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
+ save() {
|
|
|
+ this.$refs["form1"].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ let parm = this.form1;
|
|
|
+ let id = this.form1.id;
|
|
|
+ this.$api.updateJournal(parm).then((res) => {
|
|
|
+ if (res.data.code == 0) {
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "保存成功!",
|
|
|
+ });
|
|
|
+ this.getData();
|
|
|
+ } else {
|
|
|
+ // this.$message.error("保存失败!");
|
|
|
+ }
|
|
|
+ this.dialogVisible = false;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ upload(){
|
|
|
+ this.$api.upJournalData({file:this.file}).then(res=>{
|
|
|
+ this.dialogVisible1=true;
|
|
|
+ this.getData();
|
|
|
+ this.$message({
|
|
|
+ message: "上传成功",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ })
|
|
|
+ },
|
|
|
+ download(){
|
|
|
+ this.$api.getJournalData().then(res=>{
|
|
|
+ var elink = document.createElement("a");
|
|
|
+ let blob = new Blob([res.data], {
|
|
|
+ type: "application/vnd.ms-excel,charset=UTF-8",
|
|
|
+ });
|
|
|
+ let objUrl = URL.createObjectURL(blob);
|
|
|
+ let file_name = decodeURIComponent(
|
|
|
+ res.headers["content-disposition"].split("=")[1]
|
|
|
+ );
|
|
|
+ console.log(file_name);
|
|
|
+ elink.download = file_name;
|
|
|
+ elink.style.display = "none";
|
|
|
+ elink.href = objUrl;
|
|
|
+ document.body.appendChild(elink);
|
|
|
+ elink.click();
|
|
|
+ document.body.removeChild(elink);
|
|
|
+ })
|
|
|
+ },
|
|
|
showQrcode(row){
|
|
|
+ this.form1.journal_id = row.journal_id;
|
|
|
+ this.form1.id = row.id;
|
|
|
this.form1.qrcode = row.qrcode;
|
|
|
this.dialogVisible = true;
|
|
|
},
|
|
@@ -199,7 +278,10 @@ export default {
|
|
|
},
|
|
|
//封面
|
|
|
handleAvatarSuccess(res, file) {
|
|
|
- this.$set(this.form1,'img',file.response.data)
|
|
|
+ this.$set(this.form1,'qrcode',file.response.data)
|
|
|
+ },
|
|
|
+ handleAvatarSuccess1(res, file) {
|
|
|
+ this.file=file.response.data;
|
|
|
},
|
|
|
gopage(size) {
|
|
|
if (size) {
|