功能变化: 上传文件框架性优化

pull/60/head
李强 2022-05-25 15:25:59 +08:00
parent 2ade2e3bfc
commit 231437fae1
3 changed files with 20 additions and 8 deletions

View File

@ -59,7 +59,7 @@ export default {
// //
headers: { Authorization: 'JWT ' + util.cookies.get('token') }, headers: { Authorization: 'JWT ' + util.cookies.get('token') },
// //
url: process.env.VUE_APP_API + '/api/system/file/' url: util.baseURL() + '/api/system/file/'
} }
} }
}, },

View File

@ -18,8 +18,7 @@ import XEUtils from 'xe-utils'
import store from '@/store/index' import store from '@/store/index'
import { urlPrefix as deptPrefix } from '@/views/system/dept/api' import { urlPrefix as deptPrefix } from '@/views/system/dept/api'
import types from '@/config/d2p-extends/types' import types from '@/config/d2p-extends/types'
import { checkPlugins } from '@/views/plugins' import { checkPlugins, plugins } from '@/views/plugins'
const uploadUrl = util.baseURL() + 'api/system/file/'
/** /**
// vxe0 // vxe0
@ -32,7 +31,8 @@ const uploadUrl = util.baseURL() + 'api/system/file/'
// 按如下重命名引入可与官方版共存index.vue中标签用<d2-crud-x />使用加强版 // 按如下重命名引入可与官方版共存index.vue中标签用<d2-crud-x />使用加强版
// 不传name则d2CrudX的标签仍为<d2-crud>,不可与官方版共存 // 不传name则d2CrudX的标签仍为<d2-crud>,不可与官方版共存
Vue.use(d2CrudX, { name: 'd2-crud-x' }) Vue.use(d2CrudX, { name: 'd2-crud-x' })
// 注册dvadmin插件
Vue.use(plugins)
// // 官方版此处为演示与官方版共存而引入全新项目中可以用d2-crud-x完全替代官方版 // // 官方版此处为演示与官方版共存而引入全新项目中可以用d2-crud-x完全替代官方版
// Vue.use(d2Crud) // Vue.use(d2Crud)
/** /**
@ -167,7 +167,7 @@ Vue.use(D2pUploader, {
domain: 'http://d2p.file.veryreader.com' domain: 'http://d2p.file.veryreader.com'
}, },
form: { form: {
action: uploadUrl, action: util.baseURL() + 'api/system/file/',
name: 'file', name: 'file',
data: {}, // 上传附加参数 data: {}, // 上传附加参数
headers () { headers () {
@ -180,7 +180,7 @@ Vue.use(D2pUploader, {
if (ret.data === null || ret.data === '') { if (ret.data === null || ret.data === '') {
throw new Error('上传失败') throw new Error('上传失败')
} }
return { url: util.baseURL() + ret.data.url, key: option.data.key } return { url: util.baseURL() + ret.data.url, key: option.data.key, id: ret.data.id }
}, },
withCredentials: false // 是否带cookie withCredentials: false // 是否带cookie
} }
@ -368,6 +368,20 @@ Vue.prototype.commonEndColumns = function (param = {}) {
title: '创建时间', title: '创建时间',
key: 'create_datetime', key: 'create_datetime',
width: 160, width: 160,
search: {
disabled: !showData.create_datetime.showForm,
width: 240,
component: { // 查询框组件配置默认根据form配置生成
name: 'el-date-picker',
props: {
type: 'daterange',
'range-separator': '',
'start-placeholder': '开始',
'end-placeholder': '结束',
valueFormat: 'yyyy-MM-dd'
}
}
},
show: showData.create_datetime.showTable, show: showData.create_datetime.showTable,
type: 'datetime', type: 'datetime',
sortable: true, sortable: true,

View File

@ -16,7 +16,6 @@ import pluginError from '@/plugin/error'
import pluginLog from '@/plugin/log' import pluginLog from '@/plugin/log'
import pluginOpen from '@/plugin/open' import pluginOpen from '@/plugin/open'
import tableSelector from '@/components/table-selector/index' import tableSelector from '@/components/table-selector/index'
import { plugins } from '@/views/plugins/index.js'
export default { export default {
async install (Vue, options) { async install (Vue, options) {
// 设置为 false 以阻止 vue 在启动时生成生产提示 // 设置为 false 以阻止 vue 在启动时生成生产提示
@ -40,6 +39,5 @@ export default {
Vue.use(pluginLog) Vue.use(pluginLog)
Vue.use(pluginOpen) Vue.use(pluginOpen)
Vue.use(tableSelector) Vue.use(tableSelector)
Vue.use(plugins)
} }
} }