|
|
|
@ -0,0 +1,293 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div class="img-text-list-content-style">
|
|
|
|
|
<template v-if="pageType === 0">
|
|
|
|
|
<div class="search-and-add-style">
|
|
|
|
|
<div>
|
|
|
|
|
<span style="margin:0 0.5rem">图片分类</span>
|
|
|
|
|
<a-select :value="categoryId" @change="categoryChange">
|
|
|
|
|
<a-select-option v-for="item in categoryList" :key="item.category_id" :value="item.category_id">
|
|
|
|
|
{{ item.category_name }}
|
|
|
|
|
</a-select-option>
|
|
|
|
|
</a-select>
|
|
|
|
|
</div>
|
|
|
|
|
<a-button type="primary" @click="toAdd" class="add-button-style">新增</a-button>
|
|
|
|
|
</div>
|
|
|
|
|
<a-table :columns="tableColumn" :data-source="dataList" :loading="loading" :pagination="false" class="imgListTable">
|
|
|
|
|
<div slot="photo" slot-scope="text, record" class="idPhotoContent">
|
|
|
|
|
<Upload :type="2" :multiple="false" :option="{}" :canDownload="false"
|
|
|
|
|
:fileData="record.fileList"
|
|
|
|
|
:canUpload="false"
|
|
|
|
|
ref="fileUpload"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<span slot="action" slot-scope="text, record">
|
|
|
|
|
<a @click="toDelete(record)">删除</a>
|
|
|
|
|
</span>
|
|
|
|
|
</a-table>
|
|
|
|
|
<a-pagination v-if="totalPage > 1" v-model="pageNumber" :pageSize="pageSize" :total="totalNum"
|
|
|
|
|
@change="onPageChange"/>
|
|
|
|
|
</template>
|
|
|
|
|
<a-modal title="提示"
|
|
|
|
|
:visible="visible"
|
|
|
|
|
centered
|
|
|
|
|
cancelText="取消"
|
|
|
|
|
okText="确定"
|
|
|
|
|
@ok="handleOk"
|
|
|
|
|
@cancel="handleCancel">
|
|
|
|
|
是否确定删除此条信息?
|
|
|
|
|
</a-modal>
|
|
|
|
|
<template v-if="pageType === 1">
|
|
|
|
|
<PictureInfo :categoryId="categoryId" :pictureId="pictureId" @cancel="cancel"/>
|
|
|
|
|
</template>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
|
|
|
|
import InterConfig from '../interConfig';
|
|
|
|
|
import {Table, Button, Select, Modal, Divider, Cascader, Icon, Input,Pagination} from 'ant-design-vue';
|
|
|
|
|
import PictureInfo from './pictureInfo';
|
|
|
|
|
import Upload from '../../../../../../components/common/uploader/Upload.vue';
|
|
|
|
|
const tableColumn = [
|
|
|
|
|
{
|
|
|
|
|
dataIndex: 'index',
|
|
|
|
|
key: 'index',
|
|
|
|
|
title: '序号',
|
|
|
|
|
width: "80px",
|
|
|
|
|
align: "center"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
dataIndex: 'picture_name',
|
|
|
|
|
key: 'pictureName',
|
|
|
|
|
title: '图片名称',
|
|
|
|
|
align: "center"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
dataIndex: 'picture_format',
|
|
|
|
|
key: 'pictureFormat',
|
|
|
|
|
title: '图片格式',
|
|
|
|
|
align: "center"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
dataIndex: 'photo',
|
|
|
|
|
key: 'photo',
|
|
|
|
|
title: '图片',
|
|
|
|
|
align: "center",
|
|
|
|
|
scopedSlots: {customRender: 'photo'},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
dataIndex: 'create_time',
|
|
|
|
|
key: 'createTime',
|
|
|
|
|
title: '创建时间',
|
|
|
|
|
align: "center"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '操作',
|
|
|
|
|
key: 'action',
|
|
|
|
|
align: "center",
|
|
|
|
|
scopedSlots: {customRender: 'action'},
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
export default{
|
|
|
|
|
props: ["menuId"],
|
|
|
|
|
data(){
|
|
|
|
|
return {
|
|
|
|
|
pageType: 0,//0 列表页面 1 新增页面
|
|
|
|
|
categoryId: "",
|
|
|
|
|
categoryList: [],
|
|
|
|
|
tableColumn: tableColumn,
|
|
|
|
|
dataList: [],
|
|
|
|
|
loading: false,
|
|
|
|
|
visible: false,
|
|
|
|
|
pageNumber: 1,
|
|
|
|
|
pageSize: 3,
|
|
|
|
|
totalPage: 0,
|
|
|
|
|
totalNum: 0,
|
|
|
|
|
pictureId:"",
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
created(){
|
|
|
|
|
this.getPictureCategories();
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
getPictureCategories: function () {
|
|
|
|
|
let param = {
|
|
|
|
|
bureau_id: this.BaseConfig.person_info_my.bureau_id,
|
|
|
|
|
}
|
|
|
|
|
this.InterfaceConfig.callInterface([{
|
|
|
|
|
url: InterConfig.getPictureCategories.url,
|
|
|
|
|
params: param,
|
|
|
|
|
method: InterConfig.getPictureCategories.method,
|
|
|
|
|
isTestLogin: InterConfig.getPictureCategories.isTestLogin,
|
|
|
|
|
}], (result) => {
|
|
|
|
|
let resData = result[0].data;
|
|
|
|
|
if (resData.code === 2000) {
|
|
|
|
|
let categoryList = resData.data;
|
|
|
|
|
if(categoryList && categoryList.length > 0){
|
|
|
|
|
this.categoryList.push(...categoryList);
|
|
|
|
|
this.categoryId = categoryList[0].category_id;
|
|
|
|
|
this.getPictureList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
search:function () {
|
|
|
|
|
this.getPictureList();
|
|
|
|
|
},
|
|
|
|
|
getPictureList: function () {
|
|
|
|
|
let param = {
|
|
|
|
|
bureau_id: this.BaseConfig.person_info_my.bureau_id,
|
|
|
|
|
category_id: this.categoryId,
|
|
|
|
|
page_number: this.pageNumber,
|
|
|
|
|
page_size: this.pageSize,
|
|
|
|
|
}
|
|
|
|
|
this.InterfaceConfig.callInterface([{
|
|
|
|
|
url: InterConfig.getPictureList.url,
|
|
|
|
|
params: param,
|
|
|
|
|
method: InterConfig.getPictureList.method,
|
|
|
|
|
isTestLogin: InterConfig.getPictureList.isTestLogin,
|
|
|
|
|
}], (result) => {
|
|
|
|
|
let resData = result[0].data;
|
|
|
|
|
if (resData.code === 2000) {
|
|
|
|
|
let dataList = resData.data.list;
|
|
|
|
|
if (dataList && dataList.length > 0) {
|
|
|
|
|
for (let i = 0, len = dataList.length; i < len; i++) {
|
|
|
|
|
dataList[i]['index'] = i + 1;
|
|
|
|
|
let fileList = [];
|
|
|
|
|
let fileJson = dataList[i]['attachment_json'];
|
|
|
|
|
if (fileJson && fileJson !== "") {
|
|
|
|
|
fileList.push(fileJson);
|
|
|
|
|
}
|
|
|
|
|
dataList[i]['fileList'] = fileList;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.dataList = dataList;
|
|
|
|
|
this.totalNum = resData.data.total_row;
|
|
|
|
|
this.totalPage = resData.data.total_page;
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
onPageChange: function (page) {
|
|
|
|
|
this.pageNumber = page;
|
|
|
|
|
this.getPictureList();
|
|
|
|
|
},
|
|
|
|
|
categoryChange: function (value) {
|
|
|
|
|
this.categoryId = value;
|
|
|
|
|
this.getPictureList();
|
|
|
|
|
},
|
|
|
|
|
toAdd: function () {
|
|
|
|
|
this.pictureId = "";
|
|
|
|
|
this.pageType = 1;
|
|
|
|
|
},
|
|
|
|
|
toEdit: function (record) {
|
|
|
|
|
this.pageType = 1;
|
|
|
|
|
this.pictureId = record.picture_id + "";
|
|
|
|
|
},
|
|
|
|
|
toDelete: function (record) {
|
|
|
|
|
this.pictureId = record.picture_id + "";
|
|
|
|
|
this.visible = true;
|
|
|
|
|
},
|
|
|
|
|
cancel: function () {
|
|
|
|
|
this.pageType = 0;
|
|
|
|
|
this.getPictureList();
|
|
|
|
|
},
|
|
|
|
|
//确定删除
|
|
|
|
|
handleOk: function () {
|
|
|
|
|
let param = {
|
|
|
|
|
picture_ids: this.pictureId,
|
|
|
|
|
bureau_id: this.BaseConfig.person_info_my.bureau_id,
|
|
|
|
|
}
|
|
|
|
|
this.InterfaceConfig.callInterface([{
|
|
|
|
|
url: InterConfig.pictureDelete.url,
|
|
|
|
|
params: param,
|
|
|
|
|
method: InterConfig.pictureDelete.method,
|
|
|
|
|
isTestLogin: InterConfig.pictureDelete.isTestLogin,
|
|
|
|
|
}], (result) => {
|
|
|
|
|
let resData = result[0].data;
|
|
|
|
|
if (resData.code === 2000) {
|
|
|
|
|
Modal.success({
|
|
|
|
|
title: "操作成功",
|
|
|
|
|
content: "",
|
|
|
|
|
centered: true
|
|
|
|
|
});
|
|
|
|
|
this.handleCancel();
|
|
|
|
|
this.getPictureList();
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
//取消
|
|
|
|
|
handleCancel: function () {
|
|
|
|
|
this.pictureId = "";
|
|
|
|
|
this.visible = false;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
components: {
|
|
|
|
|
ATable: Table,
|
|
|
|
|
AButton: Button,
|
|
|
|
|
ASelect: Select,
|
|
|
|
|
ASelectOption: Select.Option,
|
|
|
|
|
AModal: Modal,
|
|
|
|
|
ADivider: Divider,
|
|
|
|
|
ACascader: Cascader,
|
|
|
|
|
AIcon: Icon,
|
|
|
|
|
AInput: Input,
|
|
|
|
|
APagination:Pagination,
|
|
|
|
|
PictureInfo,
|
|
|
|
|
Upload
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scopep lang="scss">
|
|
|
|
|
.img-text-list-content-style {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: auto;
|
|
|
|
|
padding: 0.5rem;
|
|
|
|
|
.search-and-add-style {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 3.5rem;
|
|
|
|
|
background-color: white;
|
|
|
|
|
margin-bottom: 0.5rem;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
align-items: center;
|
|
|
|
|
padding: 0 0.5rem;
|
|
|
|
|
.ant-select {
|
|
|
|
|
width: 150px;
|
|
|
|
|
}
|
|
|
|
|
.ant-input {
|
|
|
|
|
width: 150px;
|
|
|
|
|
}
|
|
|
|
|
.add-button-style {
|
|
|
|
|
float: right;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.imgListTable {
|
|
|
|
|
.ant-spin-nested-loading{
|
|
|
|
|
.ant-spin-container{
|
|
|
|
|
.ant-table{
|
|
|
|
|
.ant-table-content{
|
|
|
|
|
.ant-table-body{
|
|
|
|
|
.ant-table-tbody{
|
|
|
|
|
.ant-table-row{
|
|
|
|
|
td{
|
|
|
|
|
.idPhotoContent{
|
|
|
|
|
.upload-container-style{
|
|
|
|
|
display: flex !important;
|
|
|
|
|
justify-content: center !important;
|
|
|
|
|
align-items: center !important;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.ant-pagination {
|
|
|
|
|
margin-top: 0.5rem;
|
|
|
|
|
text-align: right;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|