From d5d7f913589aac09957d1922c20da9d0e0681543 Mon Sep 17 00:00:00 2001
From: wangting <675591594@qq.com>
Date: 星期四, 11 四月 2024 11:24:33 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
Source/ProjectWeb/src/components/PLT-basic-component/Upload-files.vue | 155 ++++++++++++++++++++++++++++++++++++++
Source/ProjectWeb/src/components/Divider/index.vue | 26 ++++++
Source/ProjectWeb/src/main.js | 8 +
Source/ProjectWeb/src/components/PLT-basic-component/richText.vue | 0
Source/ProjectWeb/src/views/custom-ui/test.vue | 3
5 files changed, 190 insertions(+), 2 deletions(-)
diff --git a/Source/ProjectWeb/src/components/Divider/index.vue b/Source/ProjectWeb/src/components/Divider/index.vue
new file mode 100644
index 0000000..0f2cacc
--- /dev/null
+++ b/Source/ProjectWeb/src/components/Divider/index.vue
@@ -0,0 +1,26 @@
+<!-- 鍑芥暟寮忕粍浠跺皝瑁呭垎鍓茬嚎 -->
+<template functional>
+
+ <div class="divider" :style="{backgroundColor: props.bgkColor, color: props.color}">
+ <span :style="{left: props.left}">{{ props.text }}</span>{{ $props }}
+ </div>
+</template>
+<style lang="scss" scoped>
+.divider {
+ margin: 10px 0;
+ position: relative;
+ width: 100%;
+ height: 1px;
+ background-color: rgb(196, 196, 196);
+ color: rgb(164, 164, 164);
+ span {
+ padding: 0 10px;
+ position: absolute;
+ top: 50%;
+ left: 10%;
+ transform: translateY(-50%);
+ z-index: 999;
+ background-color: #fff;
+ }
+}
+</style>
diff --git a/Source/ProjectWeb/src/components/PLT-basic-component/Upload-files.vue b/Source/ProjectWeb/src/components/PLT-basic-component/Upload-files.vue
new file mode 100644
index 0000000..9e19065
--- /dev/null
+++ b/Source/ProjectWeb/src/components/PLT-basic-component/Upload-files.vue
@@ -0,0 +1,155 @@
+<template>
+ <el-dialog
+ title="涓婁紶鏂囦欢"
+ :visible.sync="dialogVisible"
+ append-to-body
+ >
+ <Divider text="瀵煎叆鎻愮ず" left="30px"></Divider>
+ <ul>
+ <li>
+ 1.绾㈣壊瀛椾綋琛ㄧず蹇呰緭椤�
+ </li>
+ <li>
+ 2.姣忔浠呰兘鏈�澶氬鍏�10000鏉℃暟鎹�
+ </li>
+ </ul>
+ <Divider text="excel鏂囦欢锛岄�夋嫨鏂囦欢鍚庝細鑷姩涓婁紶" left="30px"></Divider>
+ <el-upload
+ accept=".xlsx, .xls"
+ action="/api/ubcs-code/codeClassify/importClassify"
+ :on-success="onSuccess"
+ :on-error="onError"
+ :headers="uploadHeaders"
+ :show-file-list="false"
+ :before-upload="beforeUpload"
+ :on-change="uploadChange"
+ class="upload-demo">
+ <el-button size="small" type="primary" style="margin: 15px 35px">娴忚鏂囦欢</el-button>
+ </el-upload>
+ <template #footer>
+ <el-button
+ type="primary"
+ size="small"
+ @click="downloadTemplateFun"
+ :loading="downloadLoading"
+ >涓嬭浇瀵煎叆妯℃澘</el-button
+ >
+ <el-button size="small" @click="dialogVisible = false">鍏抽棴</el-button>
+ </template>
+ </el-dialog>
+</template>
+
+<script>
+// import {downloadErrorFile,downloadBatchImportApplyTemplate} from '@/api/template/templateAttr'
+import {getToken} from "@/util/auth";
+import func from "@/util/func";
+export default {
+ name: "Upload-files",
+ props: {
+ visible: {
+ type: Boolean,
+ default: false,
+ },
+ codeClassifyOid: {
+ type: String,
+ default: "",
+ },
+ },
+ data(){
+ return{
+ flga:true,
+ pageLoading: null,
+ downloadLoading: false,
+ }
+ },
+ watch:{
+ visible:{
+ handler(newval,oldval){
+ // console.log('newval',newval)
+ }
+ }
+ },
+ computed:{
+ uploadHeaders() {
+ return {
+ "Blade-Auth": "bearer " + getToken(),
+ };
+ },
+ dialogVisible: {
+ get() {
+ return this.visible;
+ },
+ set(val) {
+ this.$emit("update:visible", val);
+ },
+ },
+ },
+ methods:{
+ //鏂囦欢涓婁紶鍓�
+ async beforeUpload(file) {
+ const fileType = file.name.split(".").pop();
+ if (fileType !== "xlsx" && fileType !== "xls") {
+ // 涓婁紶鏍煎紡涓嶇鍚堣姹傦紝鎻愮ず閿欒淇℃伅骞跺彇娑堜笂浼�
+ this.$message.error("鍙厑璁镐笂浼爔lsx銆亁ls鏍煎紡鐨勬枃浠�");
+ return Promise.reject(false);
+ }
+ this.pageLoading = this.$loading({
+ lock: true,
+ text: "鏂囦欢涓婁紶涓�",
+ spinner: "el-icon-loading",
+ background: "rgba(0, 0, 0, 0.7)",
+ });
+ return true;
+ },
+ // 鏂囦欢涓婁紶鎴愬姛
+ onSuccess(resbonse){
+ if (Object.keys(resbonse.data).length === 0) {
+ this.$message.success( "涓婁紶鎴愬姛锛�");
+ this.dialogVisible = false;
+ return;
+ }
+ if (resbonse.data.fileOid) {
+ const fileName = resbonse.data.filePath.split("/").pop();
+ this.$message.error("璇蜂笅杞介敊璇俊鎭枃浠惰繘琛屾煡鐪嬶紒");
+ downloadErrorFile({ uuid: resbonse.data.fileOid }).then((res) => {
+ func.downloadFileByBlobHandler(res);
+ });
+ }
+ },
+ //鐐瑰嚮涓嬭浇妯℃澘
+ downloadTemplateFun(){
+ this.downloadLoading = true;
+ downloadBatchImportApplyTemplate({codeClassifyOid: this.codeClassifyOid}).then(res=>{
+ this.$utilFunc.downloadFileByBlob(res.data, "妯℃澘鏂囦欢.xls");
+ this.downloadLoading = false;
+ }).catch((res)=>{
+ this.$message.warning(res)
+ this.downloadLoading = false;
+ })
+ },
+ //鏂囦欢涓婁紶澶辫触
+ onError(res){
+ this.pageLoading.close();
+ },
+ //鏂囦欢鐘舵�佹敼鍙�
+ uploadChange(file){
+ if (file.status === "success" || file.status === "error") {
+ this.pageLoading.close();
+ }
+ }
+ }
+}
+</script>
+
+<style scoped lang="scss">
+ul {
+ color: rgb(188, 188, 188);
+ margin: 20px 0 20px 0;
+ padding: 0 0 0 30px;
+ list-style: none;
+ li {
+ margin-bottom: 5px;
+ font-size: 13px;
+ }
+}
+</style>
diff --git a/Source/ProjectWeb/src/components/form-component/richText.vue b/Source/ProjectWeb/src/components/PLT-basic-component/richText.vue
similarity index 100%
rename from Source/ProjectWeb/src/components/form-component/richText.vue
rename to Source/ProjectWeb/src/components/PLT-basic-component/richText.vue
diff --git a/Source/ProjectWeb/src/main.js b/Source/ProjectWeb/src/main.js
index 8c1ddde..d13aa2e 100644
--- a/Source/ProjectWeb/src/main.js
+++ b/Source/ProjectWeb/src/main.js
@@ -23,6 +23,7 @@
import avueUeditor from 'avue-plugin-ueditor';
import website from '@/config/website';
import crudCommon from '@/mixins/crud';
+import Divider from '@/components/Divider/index'
// 涓氬姟缁勪欢
import tenantPackage from './views/system/tenantpackage';
//鍩虹缁戝畾琛ㄥ崟鎸夐挳
@@ -32,8 +33,9 @@
//鍥哄畾琛ㄥ崟缁勪欢
import dynamicForm from '@/components/dynamic-components/dynamic-form'
//瀵屾枃鏈粍浠�
-import richText from '@/components/form-component/richText'
-
+import richText from '@/components/PLT-basic-component/richText'
+// 涓婁紶鏂囦欢缁勪欢
+import UploadFiles from '@/components/PLT-basic-component/Upload-files'
// 娉ㄥ唽鍏ㄥ眬瀹瑰櫒
Vue.component('basicContainer', basicContainer);
Vue.component('basicBlock', basicBlock);
@@ -45,6 +47,8 @@
Vue.component('dynamicTableForm', dynamicTableForm);
Vue.component('dynamicForm', dynamicForm);
Vue.component('richText', richText);
+Vue.component('UploadFiles', UploadFiles);
+Vue.component('Divider', Divider);
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
diff --git a/Source/ProjectWeb/src/views/custom-ui/test.vue b/Source/ProjectWeb/src/views/custom-ui/test.vue
index b405076..927ace7 100644
--- a/Source/ProjectWeb/src/views/custom-ui/test.vue
+++ b/Source/ProjectWeb/src/views/custom-ui/test.vue
@@ -1,5 +1,6 @@
<template>
<div id='quillEditorQiniu'>
+ <el-button @click="visible = true">涓婁紶鏂囦欢</el-button>
<!-- 鍩轰簬elementUi鐨勪笂浼犵粍浠� el-upload begin-->
<el-upload
:accept="'image'"
@@ -14,6 +15,7 @@
<!-- 鍩轰簬elementUi鐨勪笂浼犵粍浠� el-upload end-->
<quill-editor ref="customQuillEditor" v-model="content" :options="editorOption" class="editor">
</quill-editor>
+ <UploadFiles :visible.sync="visible"></UploadFiles>
</div>
</template>
@@ -38,6 +40,7 @@
export default {
data() {
return {
+ visible:false,
headers: {
Authorization: "Bearer " + getToken(),
},
--
Gitblit v1.9.3