|
@@ -6,9 +6,10 @@
|
|
|
v-show="(!isQiniu || (isQiniu && token))"
|
|
v-show="(!isQiniu || (isQiniu && token))"
|
|
|
v-if="!printRead"
|
|
v-if="!printRead"
|
|
|
>
|
|
>
|
|
|
- <el-button v-if="ui == 'element'" type="primary" :disabled="disabled || fileList.length == limit"
|
|
|
|
|
|
|
+ <!-- <el-button v-if="ui == 'element'" type="primary" :disabled="disabled || fileList.length == limit"
|
|
|
@click="handleAdd">{{ $t('fm.actions.upload') }}
|
|
@click="handleAdd">{{ $t('fm.actions.upload') }}
|
|
|
- </el-button>
|
|
|
|
|
|
|
+ </el-button> -->
|
|
|
|
|
+ <fileMain v-if="ui == 'element'" :type="disabled || fileList.length == limit ? 'view' : 'add'" v-model="fileList" @updateVal="getFiles"></fileMain>
|
|
|
<a-button :size="size" v-if="ui == 'antd'" icon="upload" :disabled="disabled || fileList.length == limit"
|
|
<a-button :size="size" v-if="ui == 'antd'" icon="upload" :disabled="disabled || fileList.length == limit"
|
|
|
@click="handleAdd">{{ $t('fm.actions.upload') }}
|
|
@click="handleAdd">{{ $t('fm.actions.upload') }}
|
|
|
</a-button>
|
|
</a-button>
|
|
@@ -22,7 +23,7 @@
|
|
|
{{ tip }}
|
|
{{ tip }}
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
- <ul class="upload-list">
|
|
|
|
|
|
|
+ <ul class="upload-list" v-if="ui == 'antd'">
|
|
|
<li class="list_item"
|
|
<li class="list_item"
|
|
|
:class="{uploading: item.status=='uploading', 'is-success': item.status=='success', 'is-disabled': disabled}"
|
|
:class="{uploading: item.status=='uploading', 'is-success': item.status=='success', 'is-disabled': disabled}"
|
|
|
v-for="(item) in fileList" :key="item.key"
|
|
v-for="(item) in fileList" :key="item.key"
|
|
@@ -57,12 +58,14 @@ import {executeExpression} from '../../util/expression'
|
|
|
|
|
|
|
|
import {getFile, removeFile} from "/src/api/system/file";
|
|
import {getFile, removeFile} from "/src/api/system/file";
|
|
|
import {getToken} from "../../util/token";
|
|
import {getToken} from "../../util/token";
|
|
|
|
|
+import fileMain from '@/components/addDoc/index.vue';
|
|
|
|
|
|
|
|
require('viewerjs/dist/viewer.css')
|
|
require('viewerjs/dist/viewer.css')
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
components: {
|
|
components: {
|
|
|
- Draggable
|
|
|
|
|
|
|
+ Draggable,
|
|
|
|
|
+ fileMain
|
|
|
},
|
|
},
|
|
|
props: {
|
|
props: {
|
|
|
value: {
|
|
value: {
|
|
@@ -145,7 +148,14 @@ export default {
|
|
|
},
|
|
},
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
- fileList: this.value.map(item => {
|
|
|
|
|
|
|
+ // orderFiles: [],
|
|
|
|
|
+ // fileList: this.value.map(item => {
|
|
|
|
|
+ // return {
|
|
|
|
|
+ // ...item,
|
|
|
|
|
+ // key: item.key ? item.key : (new Date().getTime()) + '_' + Math.ceil(Math.random() * 99999),
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }),
|
|
|
|
|
+ fileList: this.ui == 'element' ? this.value : this.value.map(item => {
|
|
|
return {
|
|
return {
|
|
|
...item,
|
|
...item,
|
|
|
key: item.key ? item.key : (new Date().getTime()) + '_' + Math.ceil(Math.random() * 99999),
|
|
key: item.key ? item.key : (new Date().getTime()) + '_' + Math.ceil(Math.random() * 99999),
|
|
@@ -167,6 +177,10 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ getFiles(files) {
|
|
|
|
|
+ this.fileList = files
|
|
|
|
|
+ this.$emit('input', this.fileList)
|
|
|
|
|
+ },
|
|
|
handleChange() {
|
|
handleChange() {
|
|
|
console.log(this.$refs.uploadInput.files)
|
|
console.log(this.$refs.uploadInput.files)
|
|
|
const files = this.$refs.uploadInput.files
|
|
const files = this.$refs.uploadInput.files
|
|
@@ -417,7 +431,13 @@ export default {
|
|
|
},
|
|
},
|
|
|
watch: {
|
|
watch: {
|
|
|
value(val) {
|
|
value(val) {
|
|
|
- this.fileList = this.value.map(item => {
|
|
|
|
|
|
|
+ // this.fileList = this.value.map(item => {
|
|
|
|
|
+ // return {
|
|
|
|
|
+ // ...item,
|
|
|
|
|
+ // key: item.key ? item.key : (new Date().getTime()) + '_' + Math.ceil(Math.random() * 99999),
|
|
|
|
|
+ // }
|
|
|
|
|
+ // })
|
|
|
|
|
+ this.fileList = this.ui == 'element' ? this.value : this.value.map(item => {
|
|
|
return {
|
|
return {
|
|
|
...item,
|
|
...item,
|
|
|
key: item.key ? item.key : (new Date().getTime()) + '_' + Math.ceil(Math.random() * 99999),
|
|
key: item.key ? item.key : (new Date().getTime()) + '_' + Math.ceil(Math.random() * 99999),
|