刘翔宇-旅管家 3 years ago
parent 19b3df2f7e
commit 1db595ef45

@ -35,10 +35,10 @@ export function request(api, params, callback) {
export function get_isbn(params, callback) { export function get_isbn(params, callback) {
const api = "/ISBN" const api = "/query"
requestGet(api, { requestGet(api, {
params: { params: {
key: "376b36e8dc0771b23dc85ac4e7749c5f", key: "417d45266d502c8f67235e96f1e891e2",
...params ...params
} }
}, callback) }, callback)

@ -92,7 +92,7 @@
} }
} > <img src = { } > <img src = {
row.small_cover?.url row.small_cover?.url
} > </img></div> ) } style='width:120px;height:120px'> </img></div> )
} }
}, { }, {

@ -53,7 +53,7 @@
<div class="xy-table-item-content"> <div class="xy-table-item-content">
<div v-if="detail.small_cover" style="position: relative;"> <div v-if="detail.small_cover" style="position: relative;">
<img :src="detail.small_cover" class="avatar"> <img :src="detail.small_cover" class="avatar" style="width:120px;height:120px">
<Button shape="circle" icon="md-close" type="error" size="small" class="img__delete" <Button shape="circle" icon="md-close" type="error" size="small" class="img__delete"
@click="detail.small_cover = '',detail.small_cover=''"></Button> @click="detail.small_cover = '',detail.small_cover=''"></Button>
</div> </div>
@ -76,7 +76,7 @@
<div class="xy-table-item-content"> <div class="xy-table-item-content">
<div v-if="detail.big_cover" style="position: relative;"> <div v-if="detail.big_cover" style="position: relative;">
<img :src="detail.big_cover" class="avatar"> <img :src="detail.big_cover" class="avatar" style="width:280px;height:280px">
<Button shape="circle" icon="md-close" type="error" size="small" class="img__delete" <Button shape="circle" icon="md-close" type="error" size="small" class="img__delete"
@click="detail.big_cover = '',detail.big_cover_id=''"></Button> @click="detail.big_cover = '',detail.big_cover_id=''"></Button>
</div> </div>
@ -178,7 +178,6 @@
get_isbn get_isbn
} from "@/api/bookStore/interface"; } from "@/api/bookStore/interface";
import { import {
uploadFile, uploadFile,
uploadFileByUrl uploadFileByUrl
@ -251,11 +250,16 @@
} else { } else {
this.id = '' this.id = ''
this.type = '' this.type = ''
this.$refs['addActivity'].reset(); this.$refs['addActivity'].reset();
this.detail.small_cover = ""; this.detail.small_cover = "";
this.detail.big_cover = ""; this.detail.big_cover = "";
} }
let that = this;
this.$nextTick(function() {
console.log(that.$refs.inputisbn)
that.$refs.inputisbn.focus();
})
} }
}, },
methods: { methods: {
@ -281,28 +285,28 @@
return false; return false;
} }
get_isbn({ get_isbn({
sub: e isbn: e
}, function(res) { }, function(res) {
console.log(res) console.log(res)
if (res.error_code != 0) { if (res.error_code != 0) {
that.$Message.error("存在错误" + res.error_code); that.$Message.error("存在错误" + res.error_code);
} else { } else {
let book = res.result; let book = res.result.data;
that.detail.name = book.title; that.detail.name = book.title;
that.detail.sub_title = book.subtitle; that.detail.sub_title = book.subtitle;
that.detail.author = book.author; that.detail.author = book.author;
that.detail.bind_way = book.binding; that.detail.bind_way = book.paper;
that.detail.publish_date = book.pubdate; that.detail.publish_date = book.pubDate;
that.detail.publish_house = book.publisher; that.detail.publish_house = book.publisher;
that.detail.font_total = book.pages; that.detail.font_total = book.wordNum;
that.detail.content = book.summary; that.detail.content = book.gist;
if (book.images_medium && book.images_medium != '') { if (book.smallImg && book.smallImg != '') {
that.downloadByBlob(book.images_medium, "small_cover", "small_cover_id"); that.downloadByBlob(book.smallImg, "small_cover", "small_cover_id");
} }
if (book.images_large && book.images_large != '') { if (book.img && book.img != '') {
that.downloadByBlob(book.images_medium, "big_cover", "big_cover_id"); that.downloadByBlob(book.img, "big_cover", "big_cover_id");
} }
} }
@ -376,7 +380,7 @@
editor() { editor() {
if (this.detail.id == "") { if (this.detail.id == "") {
let _arr = []; let _arr = [];
console.log(this.detail.stockNum) console.log(this.detail.stockNum)
for (var i = 0; i < this.detail.stockNum; i++) { for (var i = 0; i < this.detail.stockNum; i++) {
_arr.push({ _arr.push({
@ -384,7 +388,7 @@
remark: "", remark: "",
status: 0, status: 0,
}) })
} }
console.log(this.detail.id) console.log(this.detail.id)
this.detail.details = _arr; this.detail.details = _arr;
} }
@ -409,7 +413,11 @@
}) })
}, },
mounted() { mounted() {
let that = this;
that.$nextTick(function() {
console.log(that.$refs.inputisbn)
that.$refs.inputisbn.focus();
})
} }
} }
</script> </script>

@ -3,12 +3,23 @@
<!-- 编辑--> <!-- 编辑-->
<xy-dialog :is-show.sync="isShow" title="图书入库" type="form" :form="detail" :rules="rules" @submit="editor" <xy-dialog :is-show.sync="isShow" title="图书入库" type="form" :form="detail" :rules="rules" @submit="editor"
ref="addActivity"> ref="addActivity">
<template v-slot:booknum>
<div class="xy-table-item">
<div class="xy-table-item-label">入库数量
</div>
<div class="xy-table-item-content">
<el-input-number v-model="detail.booknum" :min="1" :max="99"></el-input-number>
</div>
</div>
</template>
<template v-slot:enter_date> <template v-slot:enter_date>
<div class="xy-table-item"> <div class="xy-table-item">
<div class="xy-table-item-label">入库日期 <div class="xy-table-item-label">入库日期
</div> </div>
<div class="xy-table-item-content"> <div class="xy-table-item-content">
<el-input clearable placeholder="请填写入库日期" v-model="detail.enter_date" style="width: 150px;" /> <el-date-picker style="width: 150px;" clearable v-model="detail.enter_date" type="date"
value-format="yyyy-MM-dd" placeholder="选择日期时间">
</el-date-picker>
</div> </div>
</div> </div>
</template> </template>
@ -42,15 +53,17 @@
return { return {
isShow: false, isShow: false,
id: "", id: "",
bookid:"", bookid: "",
type: "add", type: "add",
detail: { detail: {
book_id: "", book_id: "",
id: "", id: "",
no: "", no: "",
enter_date: "", enter_date: "",
remark: "" remark: "",
status: 0,
booknum: 1
}, },
rules: { rules: {
enter_date: [{ enter_date: [{
@ -83,11 +96,17 @@
Object.assign(this.detail, res); Object.assign(this.detail, res);
}, },
editor() { editor() {
saveDetail(this.detail).then(res => {
for (var i = 1; i <= this.detail.booknum;i++) {
saveDetail(this.detail).then(res => {
})
}
this.isShow = false this.isShow = false
this.$Message.success("操作成功"); this.$Message.success("操作成功");
this.$emit('refresh') this.$emit('refresh')
})
}, },
}, },
@ -96,6 +115,7 @@
}, },
created() { created() {
let that = this; let that = this;
that.detail.enter_date = this.$moment().format("YYYY-MM-DD")
}, },
mounted() { mounted() {

@ -45,12 +45,12 @@ module.exports = {
}, },
//before: require('./mock/mock-server.js'), //before: require('./mock/mock-server.js'),
proxy: { proxy: {
'^/ISBN': { '^/query': {
target: "http://feedback.api.juhe.cn/ISBN", target: "http://apis.juhe.cn/isbn/query",
secure: true, secure: true,
changeOrigin: true, //配置跨域 changeOrigin: true, //配置跨域
pathRewrite: { pathRewrite: {
"^/ISBN": "", "^/query": "",
} }
}, },
[process.env.VUE_APP_BASE_API]: { [process.env.VUE_APP_BASE_API]: {

Loading…
Cancel
Save