增加pdf 上传
This commit is contained in:
parent
9bd90ce182
commit
54295fe452
32
src/api/pdf.js
Normal file
32
src/api/pdf.js
Normal file
@ -0,0 +1,32 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
/** 创建分组 */
|
||||
export function postUploadFile(data) {
|
||||
return request({
|
||||
url: `/api/file`,
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
}
|
||||
// 查询
|
||||
export function getUploadFile() {
|
||||
return request({
|
||||
url: `/api/file`,
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
// 修改
|
||||
export function putUploadFile(data) {
|
||||
return request({
|
||||
url: `/api/file`,
|
||||
method: 'put',
|
||||
data
|
||||
});
|
||||
}
|
||||
// 删除
|
||||
export function deleteUploadFile(data) {
|
||||
return request({
|
||||
url: `/api/file`,
|
||||
method: 'delete'
|
||||
});
|
||||
}
|
@ -3,10 +3,10 @@ import request from '@/utils/request';
|
||||
export const productIdentify = '00001&appSecret=joylink00001';
|
||||
|
||||
export const pictureUrl = `/api/upload/PICTURE?appId=${productIdentify}`;
|
||||
// export const modelUrl = `/api/upload/model?appId=${productIdentify}`;
|
||||
// export const modelUrl = `/api/file?appId=${productIdentify}`;
|
||||
|
||||
// export const attachmentUrl = `/api/upload/attachment?appId=${productIdentify}`;
|
||||
// export const meansUrl = `/api/upload/means?appId=${productIdentify}`;
|
||||
export const meansUrl = `/api/upload/MEANS?appId=${productIdentify}`;
|
||||
// export const regulationUrl = `/api/upload/regulation?appId=${productIdentify}`;
|
||||
|
||||
export function getUrl(relatedUrl) {
|
||||
|
@ -353,13 +353,45 @@
|
||||
</el-form-item>
|
||||
</template>
|
||||
|
||||
<template v-else-if="checkFieldType(item, 'uploadPicture')">
|
||||
<el-form-item v-show="item.show" :key="item.prop" :prop="item.prop" :label="item.label" :required="item.required">
|
||||
<el-upload
|
||||
class="upload-demo"
|
||||
:action="item.action"
|
||||
:on-success="item.onSuccess"
|
||||
:http-request="item.uploadFile"
|
||||
:on-change="item.onChange"
|
||||
:limit="1"
|
||||
:file-list="item.fileList"
|
||||
>
|
||||
<el-button size="small" type="primary">点击上传</el-button>
|
||||
<!-- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div> -->
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item prop="imageUrl" /> -->
|
||||
<!-- <picture-card
|
||||
ref="upload"
|
||||
v-model="fileList"
|
||||
:action="action"
|
||||
scope="file"
|
||||
@disabled="onDisabled"
|
||||
>
|
||||
<div slot class="tips">请上传文件</div>
|
||||
</picture-card> -->
|
||||
</template>
|
||||
|
||||
</template>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// import PictureCard from '@/components/UploadFiles/picture-card';
|
||||
|
||||
export default {
|
||||
name: 'DataForm',
|
||||
components: {
|
||||
// PictureCard
|
||||
},
|
||||
props: {
|
||||
form: {
|
||||
type: Object,
|
||||
|
136
src/components/UploadFiles/picture-card.vue
Normal file
136
src/components/UploadFiles/picture-card.vue
Normal file
@ -0,0 +1,136 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-upload
|
||||
ref="upload"
|
||||
list-type="picture-card"
|
||||
:action="action"
|
||||
:file-list="fileList"
|
||||
:multiple="multiple"
|
||||
:auto-upload="auto"
|
||||
:limit="limit"
|
||||
:http-request="uploadFile"
|
||||
:on-change="onChange"
|
||||
:on-remove="onRemove"
|
||||
:on-exceed="onExceed"
|
||||
:on-preview="pictureCardPreview"
|
||||
>
|
||||
<i class="el-icon-plus" />
|
||||
<slot name="trigger" />
|
||||
</el-upload>
|
||||
<slot />
|
||||
<el-dialog :visible.sync="dialogVisible" :modal="false">
|
||||
<img width="100%" :src="dialogImageUrl" alt="">
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
props: {
|
||||
auto: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
multiple: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
action: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
value: {
|
||||
type: Array,
|
||||
required: true
|
||||
},
|
||||
limit: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
scope: {
|
||||
type: String,
|
||||
default: 'files'
|
||||
},
|
||||
extra: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
fileList: [],
|
||||
formData: '',
|
||||
dialogVisible: false,
|
||||
dialogImageUrl: ''
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
value(val) {
|
||||
this.fileList = val;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onChange(file, fileList) {
|
||||
this.fileList = fileList;
|
||||
this.$emit('value', [...this.fileList]);
|
||||
this.$emit('disabled', fileList.every(el => el.status == 'success'));
|
||||
},
|
||||
onRemove(file, fileList) {
|
||||
this.fileList = fileList;
|
||||
this.$emit('value', [...this.fileList]);
|
||||
this.$emit('disabled', fileList.every(el => el.status == 'success'));
|
||||
},
|
||||
clearFiles() {
|
||||
this.$refs.upload.clearFiles();
|
||||
this.fileList = [];
|
||||
this.$emit('value', [...this.fileList]);
|
||||
this.$emit('disabled', true);
|
||||
},
|
||||
onExceed(files, fileLis) {
|
||||
this.$message.info(`超出文件上传限制,限制${this.limit}个。`);
|
||||
},
|
||||
pictureCardPreview(file) {
|
||||
this.dialogImageUrl = file.url;
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
uploadFile(file) {
|
||||
this.formData.append(this.scope, file.file);
|
||||
},
|
||||
submit(upload) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (this.fileList.length) {
|
||||
var isUpload = this.fileList.every(file => file.status == 'ready');
|
||||
var isLt100M = this.fileList.every(file => file.size / 1024 / 1024 < 100);
|
||||
|
||||
if (!isUpload) {
|
||||
reject({message: '没有需要上传的文件'});
|
||||
} else if (!isLt100M) {
|
||||
reject({message: '请检查,上传文件大小不能超过100MB!'});
|
||||
} else {
|
||||
this.formData = new FormData();
|
||||
this.$refs.upload.submit();
|
||||
Object.keys(this.extra).forEach(key => { this.formData.append(key, this.extra[key]); });
|
||||
|
||||
upload(this.action, this.formData)
|
||||
.then(resp => { resolve(resp); })
|
||||
.catch(error => { reject(error); });
|
||||
}
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/deep/ {
|
||||
.el-upload-list--picture-card .el-upload-list__item {
|
||||
margin: 0 6px 0 0 !important;
|
||||
}
|
||||
}
|
||||
</style>
|
@ -7,6 +7,7 @@ export default {
|
||||
newDesignEditor: '编辑器',
|
||||
newDesignEditorList: '图文列表',
|
||||
newDesignDraftEditorList: '文章草稿',
|
||||
uploadPdf: 'PDF上传',
|
||||
|
||||
mapManage: '地图管理',
|
||||
skinManage: '皮肤管理',
|
||||
|
@ -177,6 +177,8 @@ const Ueditor = () => import('@/views/editor/index');
|
||||
const UeditorList = () => import('@/views/editor/list');
|
||||
const UeditorDraftList = () => import('@/views/editor/listDraft');
|
||||
|
||||
const UploadPdfList = () => import('@/views/uploadPdf/list');
|
||||
|
||||
// import { GenerateRouteProjectList } from '@/scripts/ProjectConfig';
|
||||
// import { getSessionStorage } from '@/utils/auth';
|
||||
|
||||
@ -1176,6 +1178,23 @@ export const asyncRouter = [
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/uploading',
|
||||
component: Layout,
|
||||
meta: {
|
||||
i18n: 'router.uploadPdf',
|
||||
roles: [admin, user]
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'list',
|
||||
component: UploadPdfList,
|
||||
meta: {
|
||||
i18n: 'router.uploadPdf'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{ // 新个人地图
|
||||
path: '/design',
|
||||
component: Layout,
|
||||
|
@ -3,10 +3,10 @@ export function getBaseUrl() {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
// BASE_API = 'https://joylink.club/jlcloud';
|
||||
// BASE_API = 'https://test.joylink.club/jlcloud';
|
||||
BASE_API = 'http://192.168.3.119:9000'; // 袁琪
|
||||
// BASE_API = 'http://192.168.3.119:9000'; // 袁琪
|
||||
// BASE_API = 'http://192.168.3.83:9000'; // 旭强 有线
|
||||
// BASE_API = 'http://192.168.8.114:9000'; // 旭强 无线
|
||||
// BASE_API = 'http://192.168.3.120:9000'; // 张赛
|
||||
BASE_API = 'http://192.168.3.120:9000'; // 张赛
|
||||
// BASE_API = 'http://192.168.8.140:9000'; // 杜康
|
||||
// BASE_API = 'http://b29z135112.zicp.vip';
|
||||
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康
|
||||
|
260
src/views/uploadPdf/edit.vue
Normal file
260
src/views/uploadPdf/edit.vue
Normal file
@ -0,0 +1,260 @@
|
||||
<template>
|
||||
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center class="uploadDialog">
|
||||
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
|
||||
<el-button @click="handleClose">{{ $t('global.cancel') }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { postUploadFile, putUploadFile } from '@/api/pdf';
|
||||
import { getPublishMapList, getPublishMapDetailById, getPublishMapVersionById } from '@/api/jmap/map';
|
||||
import { dbReadData, dbAddData, dbUpdateData } from '@/utils/indexedDb';
|
||||
// uploadFile
|
||||
import { meansUrl } from '@/api/upload';
|
||||
|
||||
export default {
|
||||
name: 'TrainingDetailEdit',
|
||||
props: {
|
||||
type: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
formModel: {
|
||||
// cityCode: '',
|
||||
mapId: '',
|
||||
deviceTypes: '',
|
||||
deviceIds: [],
|
||||
upload: '',
|
||||
filePath: '',
|
||||
fileType: 'DRAWING'
|
||||
},
|
||||
rowData: null,
|
||||
graphDataNew: null,
|
||||
mapList: [],
|
||||
|
||||
fileList: [],
|
||||
formData: '',
|
||||
id: '',
|
||||
|
||||
deviceTypeList: [
|
||||
{ label: '区段', value: 'sectionList', code: 'SECTION' },
|
||||
{ label: '道岔', value: 'switchList', code: 'SWITCH' },
|
||||
{ label: '信号机', value: 'signalList', code: 'SIGNAL' },
|
||||
{ label: '车站', value: 'stationList', code: 'STATION' },
|
||||
{ label: '站台', value: 'stationStandList', code: 'STAND' },
|
||||
{ label: '屏蔽门', value: 'psdList', code: 'PSD' },
|
||||
{ label: '列车', value: 'trainList', code: 'TRAIN' }
|
||||
],
|
||||
deviceCodesList: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
action() {
|
||||
return `${process.env.VUE_APP_UPLOAD_API}${meansUrl}`;
|
||||
},
|
||||
form() {
|
||||
const form = {
|
||||
labelWidth: '120px',
|
||||
items: [
|
||||
{ prop: 'mapId', label: '选择线路:', type:'select', options: this.mapList, optionValue:'id', optionLabel:'name', change: true, onChange: this.handleMap },
|
||||
{ prop: 'deviceTypes', label: '选择设备类型:', type:'select', options: this.deviceTypeList, optionValue:'value', optionLabel:'label', change: true, onChange: this.handleDevice },
|
||||
{ prop: 'deviceIds', label: '选择设备:', type:'select', multiple: true, options: this.deviceCodesList, optionValue:'code', optionLabel:'name' },
|
||||
{ prop: 'upload', label: '上传:', type:'uploadPicture', show: this.type == 'ADD', action: this.action, fileList: this.fileList, onChange: this.onChange, onSuccess: this.onSuccess }
|
||||
]
|
||||
};
|
||||
return form;
|
||||
},
|
||||
rules() {
|
||||
const crules = {
|
||||
mapId: [
|
||||
{ required: true, message: '请选择线路', trigger: 'change' }
|
||||
],
|
||||
deviceTypes: [
|
||||
{ required: true, message: '请选择设备类型', trigger: 'change' }
|
||||
],
|
||||
deviceIds: [
|
||||
{ required: true, message: '请选择设备', trigger: 'change' }
|
||||
]
|
||||
};
|
||||
return crules;
|
||||
},
|
||||
title() {
|
||||
if (this.type === 'ADD') {
|
||||
return '上传PDF';
|
||||
} else {
|
||||
return '更新文章';
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async show(data) {
|
||||
this.dialogVisible = true;
|
||||
this.loadInitData();
|
||||
if (this.type != 'ADD') {
|
||||
const obj = this.deviceTypeList.find(el => el.code == data.deviceTypes[0]);
|
||||
this.id = data.id;
|
||||
this.rowData = data;
|
||||
this.rowData.deviceTypes = obj ? obj.value : '';
|
||||
this.formModel = {
|
||||
mapId: data.mapId,
|
||||
deviceTypes: obj ? obj.value : '',
|
||||
deviceIds: data.deviceIds,
|
||||
upload: '',
|
||||
filePath: data.filePath
|
||||
};
|
||||
await this.handleMap(data.mapId);
|
||||
obj && await this.handleDevice(obj.value);
|
||||
} else {
|
||||
this.formModel = {
|
||||
mapId: '',
|
||||
deviceTypes: '',
|
||||
deviceIds: [],
|
||||
upload: '',
|
||||
filePath: ''
|
||||
};
|
||||
}
|
||||
},
|
||||
loadInitData() {
|
||||
this.mapList = [];
|
||||
const params = {
|
||||
pageSize: 9999,
|
||||
pageNum: 1
|
||||
};
|
||||
getPublishMapList(params).then(res => {
|
||||
this.mapList = res.data.list.filter(el => !el.project );
|
||||
});
|
||||
},
|
||||
async handleMap(mapId) {
|
||||
if (mapId) {
|
||||
if (mapId != this.rowData.mapId) {
|
||||
this.formModel.deviceIds = [];
|
||||
this.formModel.deviceTypes = '';
|
||||
}
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const resp = await getPublishMapVersionById(mapId);
|
||||
const version = resp.data;
|
||||
dbReadData('mapData', mapId, version, async (mapData, version) =>{
|
||||
if (mapData && mapData.version == version) {
|
||||
this.graphDataNew = mapData.graphDataNew;
|
||||
resolve();
|
||||
} else if (mapData) {
|
||||
const res = await getPublishMapDetailById(mapId);
|
||||
this.graphDataNew = res.data.graphDataNew;
|
||||
dbUpdateData('mapData', res.data);
|
||||
resolve();
|
||||
} else {
|
||||
const res = await getPublishMapDetailById(mapId);
|
||||
this.graphDataNew = res.data.graphDataNew;
|
||||
dbAddData('mapData', res.data);
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this.formModel.deviceIds = [];
|
||||
this.formModel.mapId = '';
|
||||
this.formModel.deviceTypes = '';
|
||||
}
|
||||
},
|
||||
handleDevice(type) {
|
||||
if (type) {
|
||||
if (type != this.rowData.deviceTypes) {
|
||||
this.formModel.deviceIds = [];
|
||||
}
|
||||
this.deviceCodesList = this.graphDataNew[type].map(el => {
|
||||
return {
|
||||
code: el.code,
|
||||
name: `${el.name}(${el.code})`
|
||||
};
|
||||
});
|
||||
} else {
|
||||
this.formModel.deviceIds = [];
|
||||
}
|
||||
},
|
||||
// uploadFile(file) {
|
||||
// this.formData.append('file', file.file);
|
||||
// },
|
||||
onSuccess(res, file) {
|
||||
this.formModel.filePath = res.data;
|
||||
},
|
||||
doSave() {
|
||||
const self = this;
|
||||
this.$refs.dataform.validateForm(() => {
|
||||
if (self.type == 'ADD') {
|
||||
self.create();
|
||||
} else {
|
||||
self.update();
|
||||
}
|
||||
});
|
||||
},
|
||||
create() {
|
||||
const self = this;
|
||||
const obj = this.deviceTypeList.find(el => el.value == this.formModel.deviceTypes);
|
||||
if (obj) {
|
||||
this.formModel.deviceTypes = [obj.code];
|
||||
}
|
||||
const data = {
|
||||
fileType: 'DRAWING',
|
||||
mapId: this.formModel.mapId,
|
||||
deviceTypes: this.formModel.deviceTypes,
|
||||
deviceIds: this.formModel.deviceIds,
|
||||
filePath: this.formModel.filePath
|
||||
};
|
||||
postUploadFile(data).then((res) => {
|
||||
self.$message.success('上传PDF成功!');
|
||||
self.handleClose();
|
||||
self.$emit('reloadTable');
|
||||
}).catch(error => {
|
||||
console.log(error);
|
||||
self.$message.error(`创建文章失败:${error.message}`);
|
||||
});
|
||||
},
|
||||
update() {
|
||||
const self = this;
|
||||
const obj = this.deviceTypeList.find(el => el.value == this.formModel.deviceTypes);
|
||||
if (obj) {
|
||||
this.formModel.deviceTypes = [obj.code];
|
||||
}
|
||||
const data = {
|
||||
id: this.id,
|
||||
fileType: 'DRAWING',
|
||||
mapId: this.formModel.mapId,
|
||||
deviceTypes: this.formModel.deviceTypes,
|
||||
deviceIds: this.formModel.deviceIds,
|
||||
filePath: this.formModel.filePath
|
||||
};
|
||||
putUploadFile(data).then(() => {
|
||||
self.$message.success('更新文章成功!');
|
||||
self.handleClose();
|
||||
self.$emit('reloadTable');
|
||||
}).catch(error => {
|
||||
self.$message.error(`更新文章失败:${error.message}`);
|
||||
});
|
||||
},
|
||||
handleClose() {
|
||||
this.formModel = {
|
||||
title: ''
|
||||
};
|
||||
this.$refs.dataform.resetForm();
|
||||
this.dialogVisible = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.uploadDialog{
|
||||
/deep/ {
|
||||
.el-select--medium{
|
||||
width: 300px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
136
src/views/uploadPdf/list.vue
Normal file
136
src/views/uploadPdf/list.vue
Normal file
@ -0,0 +1,136 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- <QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" /> -->
|
||||
<el-card>
|
||||
<el-form
|
||||
ref="queryForm"
|
||||
:model="formModel"
|
||||
size="small"
|
||||
style="padding: 6px 20px 6px 20px;overflow: hidden;"
|
||||
>
|
||||
<el-form-item label="标题" style="margin-bottom: 0;float: left; width: 300px;">
|
||||
<el-input v-model="formModel.title" style="width: 240px;" />
|
||||
</el-form-item>
|
||||
<el-button style="margin-right: 10px; float: right;" type="primary" size="small" @click="createTitle">创建</el-button>
|
||||
<el-button style="margin-right: 10px; float: right;" type="primary" size="small" @click="query">查询</el-button>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-table :data="tableData" border style="width: 100%">
|
||||
<el-table-column label="线路">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ getMapName(scope.row.mapId) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="类型">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.deviceTypes[0] }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="设备">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-for="(item, index) in scope.row.deviceIds" :key="index">{{ item }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="路径" prop="filePath" />
|
||||
<el-table-column label="时间" prop="createTime" />
|
||||
<el-table-column label="操作" width="450">
|
||||
<template slot-scope="scope">
|
||||
<!-- <el-button size="mini" @click="handleEdit(scope.$index, scope.row)">编辑</el-button> -->
|
||||
<el-button size="mini" @click="handleUpdate(scope.$index, scope.row)">更新</el-button>
|
||||
<!-- <el-button size="mini" @click="handlePublish(scope.$index, scope.row)">发布</el-button> -->
|
||||
<el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<Edit ref="edits" type="ADD" @reloadTable="reloadTable" />
|
||||
<Edit ref="edit" type="EDIT" @reloadTable="reloadTable" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getUploadFile, deleteUploadFile } from '@/api/pdf';
|
||||
import { getPublishMapList } from '@/api/jmap/map';
|
||||
import Edit from './edit';
|
||||
|
||||
export default {
|
||||
name: 'CacheControl',
|
||||
components: {
|
||||
Edit
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableData: [],
|
||||
formModel: {
|
||||
title: ''
|
||||
},
|
||||
mapList: []
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.query();
|
||||
const params = {
|
||||
pageSize: 9999,
|
||||
pageNum: 1
|
||||
};
|
||||
getPublishMapList(params).then(res => {
|
||||
this.mapList = res.data.list.filter(el => !el.project );
|
||||
});
|
||||
|
||||
},
|
||||
methods: {
|
||||
query() {
|
||||
this.reloadTable();
|
||||
},
|
||||
getMapName(val) {
|
||||
if (this && this.mapList.length) {
|
||||
const data = this.mapList.find(el => el.id == val);
|
||||
return data.name;
|
||||
}
|
||||
return val;
|
||||
},
|
||||
createTitle() {
|
||||
this.$refs.edits.show();
|
||||
},
|
||||
// // 编辑
|
||||
// handleEdit(row, data) {
|
||||
// this.$router.push({path : '/editor', query: {docId: data.id, draft: 1}});
|
||||
// },
|
||||
// 更新标题
|
||||
handleUpdate(row, data) {
|
||||
this.$refs.edit.show(data);
|
||||
},
|
||||
// // 草稿发布
|
||||
// handlePublish(row, data) {
|
||||
// console.log(data);
|
||||
// putDocDraftByIdPublish(data.id).then(res => {
|
||||
// this.$message.success('创建文章成功!');
|
||||
// this.reloadTable();
|
||||
// }).catch(error => {
|
||||
// this.$message.error(`发布失败: ${error.data}`);
|
||||
// });
|
||||
// },
|
||||
handleDelete(row, data) {
|
||||
this.$confirm('是否确认删除?', this.$t('tip.hint'), {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
deleteUploadFile(data.id).then(res => {
|
||||
this.$message.success('删除文章成功!');
|
||||
this.reloadTable();
|
||||
}).catch(error => {
|
||||
this.$message.error(`删除失败: ${error.data}`);
|
||||
});
|
||||
}).catch(() => {});
|
||||
},
|
||||
reloadTable() {
|
||||
this.tableData = [];
|
||||
getUploadFile().then(res => {
|
||||
this.tableData = res.data;
|
||||
}).catch(error => {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user