|
@@ -7,43 +7,91 @@
|
|
|
<div class="info-top">
|
|
|
<div class="info-left">
|
|
|
<span>按文物类别查看:</span>
|
|
|
- <el-select style="width:100px;" v-model="typeId" placeholder="请选择">
|
|
|
+ <el-select
|
|
|
+ style="width: 100px"
|
|
|
+ v-model="typeId"
|
|
|
+ placeholder="请选择"
|
|
|
+ >
|
|
|
<el-option label="全部" value=""></el-option>
|
|
|
- <el-option v-for="(item,i) in plist" :key="i" :label="item.name" :value="item.id"></el-option>
|
|
|
+ <el-option
|
|
|
+ v-for="(item, i) in plist"
|
|
|
+ :key="i"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ ></el-option>
|
|
|
</el-select>
|
|
|
- <span style="margin-left:20px;">按文物年代查看:</span>
|
|
|
- <el-select style="width:180px; text-align:center;" v-model="timeId" placeholder="请选择">
|
|
|
+ <span style="margin-left: 20px">按文物年代查看:</span>
|
|
|
+ <el-select
|
|
|
+ style="width: 180px; text-align: center"
|
|
|
+ v-model="timeId"
|
|
|
+ placeholder="请选择"
|
|
|
+ >
|
|
|
<el-option label="全部" value=""></el-option>
|
|
|
- <el-option v-for="(item,i) in tlist" :key="i" :label="item.name" :value="item.id"></el-option>
|
|
|
+ <el-option
|
|
|
+ v-for="(item, i) in tlist"
|
|
|
+ :key="i"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ ></el-option>
|
|
|
</el-select>
|
|
|
- <el-input style="width:220px;margin:0 20px;" v-model="inputKey" placeholder="请输入文物名称搜索"></el-input>
|
|
|
+ <el-input
|
|
|
+ style="width: 220px; margin: 0 20px"
|
|
|
+ v-model="inputKey"
|
|
|
+ placeholder="请输入文物名称搜索"
|
|
|
+ ></el-input>
|
|
|
<el-button type="primary" @click="getInformation">查找</el-button>
|
|
|
- <el-button @click="inputKey=''">重置</el-button>
|
|
|
- <el-select style="margin-left:20px;" @change="piliang" :value="'批量导入 '" placeholder="请选择" v-if="0">
|
|
|
- <el-option
|
|
|
- label="模板下载"
|
|
|
- value="模板下载">
|
|
|
- </el-option>
|
|
|
- <el-option
|
|
|
- label="批量导入"
|
|
|
- value="批量导入">
|
|
|
- </el-option>
|
|
|
+ <el-button @click="reset">重置</el-button>
|
|
|
+ <el-select
|
|
|
+ style="margin-left: 20px"
|
|
|
+ @change="piliang"
|
|
|
+ :value="'批量导入 '"
|
|
|
+ placeholder="请选择"
|
|
|
+ v-if="0"
|
|
|
+ >
|
|
|
+ <el-option label="模板下载" value="模板下载"> </el-option>
|
|
|
+ <el-option label="批量导入" value="批量导入"> </el-option>
|
|
|
</el-select>
|
|
|
- <input @change="uploadChange" class="upload-btn" ref="upload" type="file">
|
|
|
+ <input
|
|
|
+ @change="uploadChange"
|
|
|
+ class="upload-btn"
|
|
|
+ ref="upload"
|
|
|
+ type="file"
|
|
|
+ />
|
|
|
</div>
|
|
|
<div class="info-right">
|
|
|
- <el-button type="primary" @click="$router.push({name:'edit-cultural-relic',params:{type:0}})">新增文物</el-button>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="
|
|
|
+ $router.push({
|
|
|
+ name: 'edit-cultural-relic',
|
|
|
+ params: { type: 0 },
|
|
|
+ })
|
|
|
+ "
|
|
|
+ >新增文物</el-button
|
|
|
+ >
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="collection-con">
|
|
|
<ul>
|
|
|
- <li class="theme-color" @click="gotoShow(item)" v-for="(item,i) in tableData" :key="i">
|
|
|
+ <li
|
|
|
+ class="theme-color"
|
|
|
+ @click="gotoShow(item)"
|
|
|
+ v-for="(item, i) in tableData"
|
|
|
+ :key="i"
|
|
|
+ >
|
|
|
<div class="li-img">
|
|
|
- <el-image :fit="'cover'" style="width:100%;height:100%;" :src="item.pic"></el-image>
|
|
|
+ <el-image
|
|
|
+ :fit="'cover'"
|
|
|
+ style="width: 100%; height: 100%"
|
|
|
+ :src="item.pic"
|
|
|
+ ></el-image>
|
|
|
<!-- <div class="liulan"><span>浏览量: {{Math.round(Math.random()*100000)}}</span> 点赞数: {{Math.round(Math.random()*1000)}}</div> -->
|
|
|
</div>
|
|
|
- <div>{{item.timeName}} {{item.typeName}} <span @click.stop="del(item)" class="del">删除</span></div>
|
|
|
- <p>{{item.name}}</p>
|
|
|
+ <div>
|
|
|
+ {{ item.timeName }} {{ item.typeName }}
|
|
|
+ <span @click.stop="del(item)" class="del">删除</span>
|
|
|
+ </div>
|
|
|
+ <p>{{ item.name }}</p>
|
|
|
</li>
|
|
|
</ul>
|
|
|
</div>
|
|
@@ -101,10 +149,10 @@ export default {
|
|
|
},
|
|
|
size () {
|
|
|
this.refresh()
|
|
|
- },
|
|
|
- inputKey () {
|
|
|
- this.refresh()
|
|
|
}
|
|
|
+ // inputKey () {
|
|
|
+ // this.refresh()
|
|
|
+ // }
|
|
|
},
|
|
|
mounted () {
|
|
|
this.getPositionList()
|
|
@@ -112,6 +160,13 @@ export default {
|
|
|
this.refresh()
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 点击重置
|
|
|
+ reset () {
|
|
|
+ this.inputKey = this.typeId = this.timeId = ''
|
|
|
+ this.currentPage = 1
|
|
|
+ this.size = 20
|
|
|
+ this.refresh()
|
|
|
+ },
|
|
|
del (item) {
|
|
|
let data = {
|
|
|
id: item.id
|
|
@@ -120,29 +175,31 @@ export default {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning'
|
|
|
- }).then(() => {
|
|
|
- this.$http.post('/collection/deleteCollection', data).then(res => {
|
|
|
- if (res.code === 0) {
|
|
|
- this.$notify.success({
|
|
|
- title: '提示',
|
|
|
- message: '删除成功',
|
|
|
- duration: 2000
|
|
|
- })
|
|
|
- this.refresh()
|
|
|
- } else {
|
|
|
- this.$notify.error({
|
|
|
- title: '错误',
|
|
|
- message: res.msg,
|
|
|
- duration: 2000
|
|
|
- })
|
|
|
- }
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.$http.post('/collection/deleteCollection', data).then((res) => {
|
|
|
+ if (res.code === 0) {
|
|
|
+ this.$notify.success({
|
|
|
+ title: '提示',
|
|
|
+ message: '删除成功',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ this.refresh()
|
|
|
+ } else {
|
|
|
+ this.$notify.error({
|
|
|
+ title: '错误',
|
|
|
+ message: res.msg,
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
- }).catch(() => {
|
|
|
- this.$message({
|
|
|
- type: 'info',
|
|
|
- message: '已取消删除'
|
|
|
+ .catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消删除'
|
|
|
+ })
|
|
|
})
|
|
|
- })
|
|
|
},
|
|
|
async uploadChange (e) {
|
|
|
let file = e.target.files[0]
|
|
@@ -151,18 +208,19 @@ export default {
|
|
|
const res = await this.$http.post(
|
|
|
'/collection/importCollection',
|
|
|
formData,
|
|
|
- {'Content-Type': 'multipart/form-data'})
|
|
|
+ { 'Content-Type': 'multipart/form-data' }
|
|
|
+ )
|
|
|
if (res.code === 0) {
|
|
|
this.$alert(`上传成功`, '提示', {
|
|
|
confirmButtonText: '确定',
|
|
|
- callback: action => {
|
|
|
+ callback: (action) => {
|
|
|
this.refresh()
|
|
|
}
|
|
|
})
|
|
|
} else {
|
|
|
this.$alert(`上传失败,${res.msg}`, '提示', {
|
|
|
confirmButtonText: '确定',
|
|
|
- callback: action => {
|
|
|
+ callback: (action) => {
|
|
|
this.refresh()
|
|
|
}
|
|
|
})
|
|
@@ -195,7 +253,10 @@ export default {
|
|
|
this.tlist = result.data
|
|
|
},
|
|
|
gotoShow (item) {
|
|
|
- this.$router.push({ name: 'show-cultural-relic', params: { id: item.id } })
|
|
|
+ this.$router.push({
|
|
|
+ name: 'show-cultural-relic',
|
|
|
+ params: { id: item.id }
|
|
|
+ })
|
|
|
},
|
|
|
goto (item) {
|
|
|
window.localStorage.setItem('editCollection', JSON.stringify(item))
|