|
|
@@ -3,40 +3,60 @@
|
|
|
<el-button type="primary" @click="show = true">文件上传</el-button>
|
|
|
<el-dialog
|
|
|
v-model="show"
|
|
|
- width="900"
|
|
|
+ width="1200"
|
|
|
:show-close="false"
|
|
|
:close-on-click-modal="false"
|
|
|
+ @close="onClose"
|
|
|
>
|
|
|
<template #header>
|
|
|
<div class="full-width flex flex-center flex-justify-between">
|
|
|
<h4>选择文件</h4>
|
|
|
<div class="flex flex-center flex-justify-end">
|
|
|
- <span class="mr-20" style="width: 120px">项目阶段</span>
|
|
|
- <el-select
|
|
|
- v-model="stageId"
|
|
|
- remote
|
|
|
- filterable
|
|
|
- clearable
|
|
|
- placeholder="筛选项目阶段"
|
|
|
- style="width: 100%"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in stageList"
|
|
|
- :key="item.id"
|
|
|
- :label="item.name"
|
|
|
- :value="item.id"
|
|
|
+ <div class="flex flex-center" v-show="activeName === '2'">
|
|
|
+ <span class="mr-10">项目阶段:</span>
|
|
|
+ <el-select
|
|
|
+ v-model="stageId"
|
|
|
+ remote
|
|
|
+ filterable
|
|
|
+ clearable
|
|
|
+ placeholder="筛选项目阶段"
|
|
|
+ style="width: 200px"
|
|
|
+ @change="stageChange"
|
|
|
>
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- <upload-file class="ml-10" btn-text="本地上传" />
|
|
|
+ <el-option
|
|
|
+ v-for="item in stageList"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ <upload-file
|
|
|
+ class="ml-10"
|
|
|
+ btn-text="本地上传"
|
|
|
+ :max="9"
|
|
|
+ v-if="!topFolder"
|
|
|
+ :project-id="projectId"
|
|
|
+ :stage-id="stageId"
|
|
|
+ :parent-id="parentId"
|
|
|
+ @on-success="uploadSuccess"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <el-button
|
|
|
+ type="info"
|
|
|
+ class="ml-10"
|
|
|
+ circle
|
|
|
+ icon="Close"
|
|
|
+ @click="show = false"
|
|
|
+ >
|
|
|
+ </el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
- <div>
|
|
|
- <div class="flex">
|
|
|
+ <div class="flex flex-justify-start flex-align-start flex-col">
|
|
|
+ <div class="full-width flex">
|
|
|
<el-tabs
|
|
|
v-model="activeName"
|
|
|
- class="demo-tabs"
|
|
|
tab-position="left"
|
|
|
@tab-change="tabClick"
|
|
|
>
|
|
|
@@ -46,13 +66,29 @@
|
|
|
<el-tab-pane label="合同" name="4"></el-tab-pane>
|
|
|
</el-tabs>
|
|
|
<div class="area">
|
|
|
+ <div
|
|
|
+ v-if="activeName === '2'"
|
|
|
+ class="full-width flex flex-center flex-justify-start ml-20"
|
|
|
+ ></div>
|
|
|
<div class="files">
|
|
|
- <xtable :data="list" :option="option" />
|
|
|
+ <xtable
|
|
|
+ :data="list"
|
|
|
+ :option="option"
|
|
|
+ :loading="loading"
|
|
|
+ :total="page.total"
|
|
|
+ :max="max"
|
|
|
+ @selected="selected"
|
|
|
+ @row-click="rowClick"
|
|
|
+ @current-change="currentChange"
|
|
|
+ />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="full-width flex flex-center flex-justify-between mt-20">
|
|
|
- <span class="bold">已选择 8/9 项</span>
|
|
|
+ <div
|
|
|
+ class="full-width flex flex-center flex-justify-between"
|
|
|
+ style="margin-top: 80px"
|
|
|
+ >
|
|
|
+ <span class="bold">已选择 {{ selectedList.length }}/9 项</span>
|
|
|
<div>
|
|
|
<el-button type="primary" plain @click="show = false"
|
|
|
>取 消</el-button
|
|
|
@@ -77,6 +113,10 @@ export default {
|
|
|
projectId: {
|
|
|
type: String,
|
|
|
default: ''
|
|
|
+ },
|
|
|
+ max: {
|
|
|
+ type: Number,
|
|
|
+ default: 9
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
@@ -88,17 +128,38 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
immediate: true
|
|
|
+ },
|
|
|
+ stageId: {
|
|
|
+ handler(val) {
|
|
|
+ if (this.activeName === '2') {
|
|
|
+ this.tabClick()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ immediate: false
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
stageId: '',
|
|
|
+ parentId: '',
|
|
|
stageList: [],
|
|
|
+ topFolder: true,
|
|
|
show: false,
|
|
|
activeName: '1',
|
|
|
list: [],
|
|
|
+ selectedList: [],
|
|
|
+ isLatest: 0,
|
|
|
+ dictKey: '',
|
|
|
+ loading: false,
|
|
|
+ currentRow: null,
|
|
|
+ page: {
|
|
|
+ current: 1,
|
|
|
+ size: 10,
|
|
|
+ total: 0
|
|
|
+ },
|
|
|
option: {
|
|
|
showMenu: false,
|
|
|
+ showCheckBox: true,
|
|
|
column: [
|
|
|
{
|
|
|
label: '名称',
|
|
|
@@ -106,20 +167,38 @@ export default {
|
|
|
display: false
|
|
|
},
|
|
|
{
|
|
|
- label: '上传人2',
|
|
|
+ label: '上传人',
|
|
|
prop: 'createUserName'
|
|
|
},
|
|
|
{
|
|
|
label: '上传时间',
|
|
|
- prop: 'createUserName'
|
|
|
+ prop: 'createTime'
|
|
|
}
|
|
|
]
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- tabClick(res) {
|
|
|
- console.log(this.activeName)
|
|
|
+ tabClick() {
|
|
|
+ this.list.length = 0
|
|
|
+ if (this.activeName === '1') {
|
|
|
+ this.isLatest = 0
|
|
|
+ this.dictKey = ''
|
|
|
+ this.fetchData()
|
|
|
+ } else if (this.activeName === '2') {
|
|
|
+ this.isLatest = 0
|
|
|
+ this.dictKey = ''
|
|
|
+ this.getFolderList()
|
|
|
+ } else if (this.activeName === '3') {
|
|
|
+ this.isLatest = ''
|
|
|
+ this.dictKey = 1
|
|
|
+ this.fetchData()
|
|
|
+ } else {
|
|
|
+ this.isLatest = this.activeName
|
|
|
+ this.isLatest = ''
|
|
|
+ this.dictKey = 2
|
|
|
+ this.fetchData()
|
|
|
+ }
|
|
|
},
|
|
|
getStage() {
|
|
|
this.$api.project
|
|
|
@@ -127,21 +206,111 @@ export default {
|
|
|
.then(res => {
|
|
|
if (res.code === 200) {
|
|
|
this.stageList = res.data
|
|
|
- this.stageId = this.stageList[0].id
|
|
|
+ const tmp = this.stageList.find(ele => ele.isLastSelect === 1)
|
|
|
+ if (tmp) {
|
|
|
+ this.stageId = tmp.id
|
|
|
+ } else {
|
|
|
+ this.stageId = this.stageList[0].id
|
|
|
+ }
|
|
|
+ console.log(this.stageId)
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ /**
|
|
|
+ * 获取全部文件
|
|
|
+ */
|
|
|
+ getFolderList() {
|
|
|
+ this.loading = true
|
|
|
+ const row = {
|
|
|
+ stageId: this.stageId,
|
|
|
+ dictKey: 1,
|
|
|
+ current: this.page.current,
|
|
|
+ size: this.page.size
|
|
|
+ }
|
|
|
+ this.$api.resource.folderList(row).then(res => {
|
|
|
+ this.loading = false
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.list = res.data.records
|
|
|
+ this.page.total = res.data.total
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 获取文件夹下面的文件及文件夹
|
|
|
+ * @param row
|
|
|
+ */
|
|
|
+ getFileList(row) {
|
|
|
+ console.log(row)
|
|
|
+ this.topFolder = false
|
|
|
+ const item = {
|
|
|
+ id: row.id,
|
|
|
+ current: this.page.current,
|
|
|
+ size: this.page.size
|
|
|
+ }
|
|
|
+ this.loading = true
|
|
|
+ this.$api.resource.fileList(item).then(res => {
|
|
|
+ this.loading = false
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.list = res.data.records
|
|
|
+ this.page.total = res.data.total
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 获取文件
|
|
|
+ */
|
|
|
fetchData() {
|
|
|
const data = {
|
|
|
projectId: this.projectId,
|
|
|
- stageId: this.stageId,
|
|
|
- isLatest: 0
|
|
|
+ isLatest: this.isLatest,
|
|
|
+ dictKey: this.dictKey,
|
|
|
+ current: this.page.current,
|
|
|
+ size: this.page.size
|
|
|
}
|
|
|
+ this.loading = true
|
|
|
this.$api.resource.filePicker(data).then(res => {
|
|
|
+ this.loading = false
|
|
|
if (res.code === 200) {
|
|
|
this.list = res.data.records
|
|
|
+ this.page.total = res.data.total
|
|
|
}
|
|
|
})
|
|
|
+ },
|
|
|
+ selected(list) {
|
|
|
+ this.selectedList = list
|
|
|
+ },
|
|
|
+ rowClick(res) {
|
|
|
+ this.currentRow = res
|
|
|
+ const tmp = this.list.find(ele => ele.id === res.id)
|
|
|
+ this.parentId = tmp.id
|
|
|
+ if (tmp && tmp.type !== 2) {
|
|
|
+ tmp.checked = !tmp.checked
|
|
|
+ } else {
|
|
|
+ this.list.length = 0
|
|
|
+ this.getFileList(this.currentRow)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ currentChange(current) {
|
|
|
+ this.page.current = current
|
|
|
+ this.tabClick()
|
|
|
+ },
|
|
|
+ uploadSuccess(res) {
|
|
|
+ this.getFileList(this.currentRow)
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 阶段发生改变
|
|
|
+ */
|
|
|
+ stageChange() {
|
|
|
+ this.topFolder = true
|
|
|
+ },
|
|
|
+ onClose() {
|
|
|
+ this.page.current = 1
|
|
|
+ this.selectedList.length = 0
|
|
|
+ this.list.length = 0
|
|
|
+ this.activeName = '1'
|
|
|
+ this.parentId = ''
|
|
|
}
|
|
|
}
|
|
|
}
|