From 811fb2fd8fc81107903637cfbe03de9da9d50ede Mon Sep 17 00:00:00 2001
From: gaoshp <291585735@qq.com>
Date: 星期三, 11 九月 2024 19:29:16 +0800
Subject: [PATCH] update
---
src/views/dnc/document/index.vue | 54 ++++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 44 insertions(+), 10 deletions(-)
diff --git a/src/views/dnc/document/index.vue b/src/views/dnc/document/index.vue
index cff8b87..e94c58c 100644
--- a/src/views/dnc/document/index.vue
+++ b/src/views/dnc/document/index.vue
@@ -1,7 +1,7 @@
<!--
* @Date: 2024-05-16 22:40:01
* @LastEditors: Sneed
- * @LastEditTime: 2024-06-16 15:35:03
+ * @LastEditTime: 2024-06-22 18:08:04
* @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/dnc/document/index.vue
-->
<template>
@@ -11,8 +11,8 @@
<el-aside width="200px">
<el-container>
<el-main>
- <el-tree expand-on-click-node default-expand-all ref="tree" node-key="id" :data="treeData"
- :props="{
+ <el-tree :expand-on-click-node="false" default-expand-all ref="tree" node-key="id"
+ :data="treeData" :props="{
label: 'name',
}" @node-click="nodeClick" highlight-current :current-node-key="selectNode.id">
<template #default="{ node, data }">
@@ -42,8 +42,12 @@
</el-dropdown-menu>
</template>
</el-dropdown>
- <el-upload style="margin-left: 8px;" :show-file-list="false" class="upload"
+ <!-- <el-upload style="margin-left: 8px;" :show-file-list="false" class="upload"
action="/api/blade-resource/oss/endpoint/put-file">
+ <el-button type="primary">涓婁紶鏂囦欢</el-button>
+ </el-upload> -->
+ <el-upload style="margin-left: 8px;" :show-file-list="false" class="upload"
+ :http-request="request">
<el-button type="primary">涓婁紶鏂囦欢</el-button>
</el-upload>
<!-- <el-button type="primary" style="margin-left: 8px;">涓婁紶鏂囦欢</el-button> -->
@@ -107,7 +111,7 @@
<template #default="scope">
<el-button-group>
<el-button text type="primary" size="small"
- @click="table_edit(scope.row, scope.$index)">缂栬緫</el-button>
+ @click="table_edit(scope.row, scope.$index)">閲嶅懡鍚�</el-button>
<el-popconfirm width="220" title="纭畾灏嗛�夋嫨鐨勬暟鎹垹闄�" @confirm="del([scope.row], '0')">
<template #reference>
<el-button text type="primary" size="small">鍒犻櫎</el-button>
@@ -123,7 +127,7 @@
</el-container>
</el-container>
</el-card>
- <el-dialog v-model="visible" title="鏂板缓鏂囦欢澶�" width="500">
+ <el-dialog v-model="visible" :title="form.id ? '閲嶅懡鍚�' : '鏂板缓鏂囦欢澶�'" width="500">
<el-form :model="form" :rules="rules" ref="dialogForm" label-width="120px" label-position="center">
<el-form-item v-if="form.fileType == 1 || !form.id" label="鏂囦欢澶瑰悕绉�" prop="name">
<el-input v-model="form.name" />
@@ -156,7 +160,7 @@
</div>
</template>
</el-dialog>
- <scDialog v-model="visible">
+ <scDialog v-model="visible1">
<scForm ref="form" :config="config" :rules="rules1" v-model="form1" @submit="submit1">
</scForm>
</scDialog>
@@ -204,7 +208,7 @@
},
treeData: [],
selectNode: {},
- visible: false,
+ visible1: false,
form: {},
rules: {
name: [{
@@ -246,10 +250,40 @@
this.init()
},
methods: {
+ request(options) {
+ const formData = new FormData()
+ formData.append('file', options.file)
+ console.log(options)
+ this.$HTTP.post(`/api/blade-resource/oss/endpoint/put-file`, formData).then(resFile => {
+ if (resFile.success) {
+ this.$HTTP.post(`/api/blade-dnc/file/batch-save`, [{
+ name: options.file.name,
+ targetId: this.selectNode.id,
+ ossFile: {
+ attachId: resFile.data.attachId,
+ domain: resFile.data.domain,
+ link: resFile.data.link,
+ name: resFile.data.name,
+ originalName: resFile.data.originalName
+ }
+ }]).then(res => {
+ if (res.success) {
+ this.visible = false
+ this.search()
+ } else {
+ this.$message.error(res.msg)
+ }
+ })
+ } else {
+ this.$message.error(res.msg)
+ }
+
+ })
+ },
addFile() {
this.form1 = {}
this.$refs?.form?.resetFields()
- this.visible = true
+ this.visible1 = true
},
submit1() {
// 鍒涘缓鏂囨湰鍐呭
@@ -275,7 +309,7 @@
}
}]).then(res => {
if (res.success) {
- this.visible = false
+ this.visible1 = false
this.search()
} else {
this.$message.error(res.msg)
--
Gitblit v1.9.3