209 lines
7.8 KiB
Vue
209 lines
7.8 KiB
Vue
// 添加专业与人数
|
|
<template>
|
|
<div class="content">
|
|
<el-dialog
|
|
:title="title"
|
|
:close-on-click-modal="false"
|
|
append-to-body
|
|
width="60%"
|
|
:visible.sync="visible">
|
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
|
|
<el-form-item label="素材名称" prop="materialName">
|
|
<el-input
|
|
v-model="queryParams.materialName"
|
|
placeholder="请输入素材名称"
|
|
clearable
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
<el-row :gutter="10" class="mb8">
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
type="primary"
|
|
plain
|
|
icon="el-icon-plus"
|
|
size="mini"
|
|
@click="handleAdd"
|
|
>添加图片</el-button>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
type="danger"
|
|
plain
|
|
icon="el-icon-delete"
|
|
size="mini"
|
|
:disabled="multiple"
|
|
@click="handleDelete"
|
|
>删除</el-button>
|
|
</el-col>
|
|
</el-row>
|
|
<el-table v-loading="loading" :data="dataList" @selection-change="handleSelectionChange">
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
<el-table-column label="素材名称" align="center" prop="materialName" />
|
|
<el-table-column label="缩略图" align="center" prop="savePath">
|
|
<template slot-scope="scope">
|
|
<image-preview :src="scope.row.savePath" :width="50" :height="50"/>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="上传日期" align="center" prop="uploadTime" width="180">
|
|
<template slot-scope="scope">
|
|
<span>{{ parseTime(scope.row.uploadTime, '{y}-{m}-{d}') }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
<template slot-scope="scope">
|
|
<el-button
|
|
size="mini"
|
|
type="text"
|
|
icon="el-icon-edit"
|
|
@click="handleUpdate(scope.row)"
|
|
>修改</el-button>
|
|
<el-button
|
|
size="mini"
|
|
type="text"
|
|
icon="el-icon-delete"
|
|
@click="handleDelete(scope.row)"
|
|
>删除</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<pagination
|
|
v-show="total>0"
|
|
:total="total"
|
|
:page.sync="queryParams.pageNum"
|
|
:limit.sync="queryParams.pageSize"
|
|
@pagination="getList"
|
|
/>
|
|
<!-- <span slot="footer" class="dialog-footer">
|
|
<el-button @click="closeDialog">取消</el-button>
|
|
<el-button type="primary" @click="submit()">确定</el-button>
|
|
</span> -->
|
|
</el-dialog>
|
|
<materialDialog ref="materialDialog" @selectData="selectData" :single="false"></materialDialog>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import {getAlbumImgList,AddAlbumImgList,delAlbumImgList} from "@/api/system/album";
|
|
import materialDialog from '@/views/system/article/materialDialog'
|
|
export default {
|
|
name: "equipment",
|
|
dicts:['tender_speciality'],
|
|
components:{
|
|
materialDialog
|
|
},
|
|
data() {
|
|
return {
|
|
loading: false,
|
|
dataList:[],
|
|
albumImgList:[],
|
|
total:0,
|
|
visible: false,
|
|
title:'相册素材',
|
|
queryParams:{
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
},
|
|
selectRow:{},
|
|
// 选中数组
|
|
ids: [],
|
|
// 非单个禁用
|
|
single: true,
|
|
// 非多个禁用
|
|
multiple: true,
|
|
}
|
|
},
|
|
methods: {
|
|
selectData(data){
|
|
console.log(data)
|
|
console.log(typeof data)
|
|
AddAlbumImgList({albumId:this.queryParams.albumId,materialIds: data.join(',')}).then(res=>{
|
|
this.$modal.msgSuccess("添加成功");
|
|
this.getList()
|
|
})
|
|
},
|
|
getRowData(row, column, event) {
|
|
this.selectRow = row
|
|
},
|
|
init(id) {
|
|
this.visible = true
|
|
this.$set(this.queryParams,'albumId',id)
|
|
this.getList()
|
|
},
|
|
getList(){
|
|
this.loading = true
|
|
getAlbumImgList(this.queryParams).then(response => {
|
|
this.dataList = response.rows;
|
|
this.total = response.total;
|
|
this.loading = false
|
|
});
|
|
},
|
|
// 多选框选中数据
|
|
handleSelectionChange(selection) {
|
|
this.ids = selection.map(item => item.id);
|
|
this.single = selection.length != 1;
|
|
this.multiple = !selection.length;
|
|
},
|
|
handleAdd(){
|
|
this.$refs.materialDialog.init()
|
|
|
|
},
|
|
/** 删除按钮操作 */
|
|
handleDelete(row) {
|
|
const materialId = row.id || this.ids;
|
|
this.$modal.confirm('是否确认删除编号为"' + materialId + '"的数据项?').then(function() {
|
|
return delAlbumImgList(materialId);
|
|
}).then(() => {
|
|
this.getList();
|
|
this.$modal.msgSuccess("删除成功");
|
|
}).catch(() => {});
|
|
},
|
|
handleSearch() {
|
|
this.pageNum = 1;
|
|
this.getList();
|
|
},
|
|
handleQuery(){
|
|
this.queryParams.pageNum = 1;
|
|
this.getList();
|
|
},
|
|
resetQuery() {
|
|
this.queryParams = {
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
}
|
|
this.getList();
|
|
},
|
|
pageChange(value) {
|
|
this.queryParams.pageNum = value;
|
|
this.getList();
|
|
},
|
|
pageSizeChange(value) {
|
|
this.queryParams.pageSize = value;
|
|
this.getList();
|
|
},
|
|
// handleSelectionChange(val){
|
|
// this.multipleSelection = []
|
|
// for(let i=0;i<val.length;i++){
|
|
// this.multipleSelection.push(val[i].id)
|
|
// }
|
|
// },
|
|
closeDialog() {
|
|
this.visible = false
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
|
|
</style>
|