Commit 5f193a74 authored by 白舜's avatar 白舜 🎱

格式化规范化

parent 1d348cce
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
"build": "vite build", "build": "vite build",
"preview": "vite preview", "preview": "vite preview",
"lint": "eslint --ext .js,vue --ignore-pattern '!.*ignore' .", "lint": "eslint --ext .js,vue --ignore-pattern '!.*ignore' .",
"lint:fix": "eslint --fix && prettier --config .prettierrc --write ." "lint:fix": "prettier --config .prettierrc --write . && yarn lint --fix"
}, },
"dependencies": { "dependencies": {
"@element-plus/icons-vue": "^2.0.10", "@element-plus/icons-vue": "^2.0.10",
......
...@@ -79,6 +79,8 @@ const info = reactive({ ...@@ -79,6 +79,8 @@ const info = reactive({
], ],
}); });
const aFileList = ref([]);
const { options: btnsOption, currentValue: btnsCurrentValue } = toRefs(btns); const { options: btnsOption, currentValue: btnsCurrentValue } = toRefs(btns);
const { title: cardTitle, icon: cardIcon } = toRefs(card); const { title: cardTitle, icon: cardIcon } = toRefs(card);
</script> </script>
...@@ -220,10 +222,14 @@ const { title: cardTitle, icon: cardIcon } = toRefs(card); ...@@ -220,10 +222,14 @@ const { title: cardTitle, icon: cardIcon } = toRefs(card);
<cw title="bg-upload-image" /> <cw title="bg-upload-image" />
<cw title="bg-upload"> <cw title="bg-upload">
<bg-upload <bg-upload
:data="{ v-model="aFileList"
directory: 'file', :el-attrs="{
uniqueCode: false, multiple: false,
}" /> drag: true,
}"
:auto="false"
:custom-tips="true"
:file-types="['zip', 'tgz', 'tar', 'gz']" />
</cw> </cw>
<cw title="bg-user-upload-image" /> <cw title="bg-user-upload-image" />
</div> </div>
......
...@@ -18,17 +18,13 @@ ...@@ -18,17 +18,13 @@
v-if="!item.urls" v-if="!item.urls"
:title="item.info" :title="item.info"
:style="item.url ? { color: '#515fe7', cursor: 'pointer' } : ''" :style="item.url ? { color: '#515fe7', cursor: 'pointer' } : ''"
@click="down_file(item.url)" @click="down_file(item.url)">{{ item.info }}</span>
>{{ item.info }}</span
>
<span v-else :title="item.info"> <span v-else :title="item.info">
<span <span
v-for="(it, idx) in item.urls" v-for="(it, idx) in item.urls"
:key="'urls' + idx" :key="'urls' + idx"
style="color: #515fe7; cursor: pointer" style="color: #515fe7; cursor: pointer"
@click="down_file(it)" @click="down_file(it)">{{ helper.downloadFileFormatNew(it) }}</span>
>{{ helper.downloadFileFormatNew(it) }}</span
>
</span> </span>
</template> </template>
</div> </div>
...@@ -43,6 +39,7 @@ ...@@ -43,6 +39,7 @@
<script setup> <script setup>
import { reactive, ref, onBeforeMount, toRefs, watch } from "vue"; import { reactive, ref, onBeforeMount, toRefs, watch } from "vue";
import helper from "./utils/index.js"; import helper from "./utils/index.js";
const props = defineProps({ const props = defineProps({
data: { data: {
type: Array, type: Array,
...@@ -50,9 +47,9 @@ const props = defineProps({ ...@@ -50,9 +47,9 @@ const props = defineProps({
}, },
layout: { layout: {
type: Object, type: Object,
default: () => { default: () => ({
4; line_num: 4,
}, }),
}, },
}); });
......
...@@ -36,9 +36,7 @@ ...@@ -36,9 +36,7 @@
v-if="item.callback" v-if="item.callback"
class="can_click_text" class="can_click_text"
style="text-decoration: underline" style="text-decoration: underline"
@click.stop="item.callback && item.callback()" @click.stop="item.callback && item.callback()">{{ item.value }}</span>
>{{ item.value }}</span
>
<span v-else>{{ item.value }}</span> <span v-else>{{ item.value }}</span>
</span> </span>
<a <a
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
<script setup> <script setup>
import { reactive, ref, onBeforeMount, toRefs, computed, nextTick } from "vue"; import { reactive, ref, onBeforeMount, toRefs, computed, nextTick } from "vue";
import html2canvas from "html2canvas"; import html2canvas from "html2canvas";
const emit = defineEmits(["update:btn"]);
const props = defineProps({ const props = defineProps({
title: { title: {
type: String, type: String,
...@@ -57,7 +57,6 @@ const props = defineProps({ ...@@ -57,7 +57,6 @@ const props = defineProps({
}, },
}); });
const emit = defineEmits(["update:btn"]);
const style = computed(() => { const style = computed(() => {
return { return {
width: `calc(${props.width} - 20px)`, width: `calc(${props.width} - 20px)`,
......
...@@ -43,7 +43,9 @@ ...@@ -43,7 +43,9 @@
<el-button type="primary" @click="$emit('search-action')"> <el-button type="primary" @click="$emit('search-action')">
查询 查询
</el-button> </el-button>
<el-button @click="$emit('search-reset')"> 重置 </el-button> <el-button type="default" @click="$emit('search-reset')">
重置
</el-button>
</div> </div>
</div> </div>
</div> </div>
...@@ -71,6 +73,7 @@ ...@@ -71,6 +73,7 @@
</template> </template>
<script setup> <script setup>
const emit = defineEmits(["update:visible", "search-action", "search-reset"]);
const props = defineProps({ const props = defineProps({
visible: { visible: {
type: Boolean, type: Boolean,
...@@ -85,6 +88,4 @@ const props = defineProps({ ...@@ -85,6 +88,4 @@ const props = defineProps({
default: false, default: false,
}, },
}); });
const emit = defineEmits(["update:visible", "search-action", "search-reset"]);
</script> </script>
...@@ -81,7 +81,7 @@ const props = defineProps({ ...@@ -81,7 +81,7 @@ const props = defineProps({
}, },
highlightParentRule: { highlightParentRule: {
type: Function, type: Function,
default: () => null, default: () => {},
}, },
}); });
......
...@@ -27,7 +27,7 @@ const props = defineProps({ ...@@ -27,7 +27,7 @@ const props = defineProps({
}, // 导航列表 [ { name: "xxx", path: "xxx" } ] }, // 导航列表 [ { name: "xxx", path: "xxx" } ]
highlightParentRule: { highlightParentRule: {
type: Function, type: Function,
default: () => null, default: () => {},
}, },
}); });
</script> </script>
...@@ -18,8 +18,10 @@ ...@@ -18,8 +18,10 @@
<script setup> <script setup>
import "@wangeditor/editor/dist/css/style.css"; // 引入 css import "@wangeditor/editor/dist/css/style.css"; // 引入 css
import { onBeforeUnmount, ref, shallowRef, onMounted } from "vue"; import { onBeforeUnmount, ref, shallowRef, onMounted } from "vue";
import { Editor, Toolbar } from "@wangeditor/editor-for-vue"; import { Editor, Toolbar } from "@wangeditor/editor-for-vue";
import { useFormItem } from "element-plus"; import { useFormItem } from "element-plus";
const props = defineProps({ const props = defineProps({
...@@ -36,14 +38,8 @@ const props = defineProps({ ...@@ -36,14 +38,8 @@ const props = defineProps({
default: "default", default: "default",
}, },
}); });
const emit = defineEmits([
"update:modelValue", const emit = defineEmits(["update:modelValue", "change", "blur"]);
"update:visible",
"search-action",
"search-reset",
"change",
"blur",
]);
const valueHtml = ref(""); const valueHtml = ref("");
// change次数 // change次数
......
...@@ -20,9 +20,7 @@ ...@@ -20,9 +20,7 @@
v-for="(item, index) in state.lastChildren" v-for="(item, index) in state.lastChildren"
:key="'as' + index" :key="'as' + index"
:class="item.disabled ? 'disabled' : ''" :class="item.disabled ? 'disabled' : ''"
@click="action(item.onClick, item.disabled)" @click="action(item.onClick, item.disabled)">{{ item.name }}</span>
>{{ item.name }}</span
>
</div> </div>
</teleport> </teleport>
</span> </span>
......
...@@ -72,8 +72,8 @@ const attrs = useAttrs(); ...@@ -72,8 +72,8 @@ const attrs = useAttrs();
const props = defineProps({ const props = defineProps({
headers: { headers: {
type: Array, type: Array,
default: () => [],
require: true, require: true,
default: () => [],
}, },
data: { data: {
type: Array, type: Array,
...@@ -93,7 +93,7 @@ const props = defineProps({ ...@@ -93,7 +93,7 @@ const props = defineProps({
}, },
selectable: { selectable: {
type: Function, type: Function,
default: () => null, default: () => {},
}, },
defaultExpandAll: { defaultExpandAll: {
type: Boolean, type: Boolean,
......
...@@ -111,8 +111,8 @@ const props = defineProps({ ...@@ -111,8 +111,8 @@ const props = defineProps({
}, },
headers: { headers: {
type: Array, type: Array,
default: () => [],
require: true, require: true,
default: () => [],
}, },
rows: { rows: {
type: Array, type: Array,
......
...@@ -96,7 +96,7 @@ const props = defineProps({ ...@@ -96,7 +96,7 @@ const props = defineProps({
}, // 接受类型 }, // 接受类型
fileSize: { fileSize: {
type: Number, type: Number,
default: 2048, default: 1024,
}, // 文件大小 }, // 文件大小
fileSizeUnit: { fileSizeUnit: {
type: String, type: String,
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
class="bg-upload" class="bg-upload"
:class="{ 'is-disabled': actionDisabled, 'is-easy': isEasy }"> :class="{ 'is-disabled': actionDisabled, 'is-easy': isEasy }">
<el-upload <el-upload
ref="uploadRef"
:action="actionUrl" :action="actionUrl"
:data="actionData" :data="actionData"
:name="actionName" :name="actionName"
...@@ -27,7 +26,7 @@ ...@@ -27,7 +26,7 @@
支持上传{{ fileTypes.join("") }},最大{{ fileMaxSize }}M 支持上传{{ fileTypes.join("") }},最大{{ fileMaxSize }}M
</div> --> </div> -->
<template v-if="isEasy"> <template v-if="isEasy">
<el-button type="primary" size="mini"> <el-button type="primary" size="small">
<bg-icon <bg-icon
v-if="triggerIcon" v-if="triggerIcon"
:icon="`#${triggerIcon}`" :icon="`#${triggerIcon}`"
...@@ -68,7 +67,6 @@ import { ...@@ -68,7 +67,6 @@ import {
toRefs, toRefs,
} from "vue"; } from "vue";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
const props = defineProps({ const props = defineProps({
modelValue: { modelValue: {
type: Array, type: Array,
...@@ -144,8 +142,6 @@ const props = defineProps({ ...@@ -144,8 +142,6 @@ const props = defineProps({
const emit = defineEmits(["update:modelValue", "change", "delete"]); const emit = defineEmits(["update:modelValue", "change", "delete"]);
const uploadRef = ref(null);
const state = reactive({ const state = reactive({
fileList: [], fileList: [],
initFileList: [], initFileList: [],
...@@ -176,7 +172,11 @@ watch( ...@@ -176,7 +172,11 @@ watch(
.join(","); .join(",");
if (newStr !== oldStr) { if (newStr !== oldStr) {
state.fileList = [...props.modelValue]; let newFileList = [];
props.modelValue.forEach((file) => {
newFileList.push({ name: file.name, url2: file.url });
});
state.fileList = newFileList;
} }
} }
); );
...@@ -226,7 +226,7 @@ const updateFileList = (fileList) => { ...@@ -226,7 +226,7 @@ const updateFileList = (fileList) => {
if (props.saveType == "url") { if (props.saveType == "url") {
return { return {
name: v.name, name: v.name,
url: (v.response && v.response.data) || v.url || v.raw, url: (v.response && v.response.data) || v.url2 || v.raw,
}; };
} else { } else {
return { return {
...@@ -243,7 +243,6 @@ const updateFileList = (fileList) => { ...@@ -243,7 +243,6 @@ const updateFileList = (fileList) => {
}; };
const onChangeFile = (file, fileList) => { const onChangeFile = (file, fileList) => {
console.log(file, fileList);
if (!handleBeforeUpload(file.raw)) { if (!handleBeforeUpload(file.raw)) {
state.fileList = state.fileList.filter(({ uid }) => file.uid !== uid); state.fileList = state.fileList.filter(({ uid }) => file.uid !== uid);
return; return;
......
...@@ -81,7 +81,7 @@ export default { ...@@ -81,7 +81,7 @@ export default {
}); });
return vnode; return vnode;
} catch (error) { } catch (error) {
console.error(error); log.error(error);
} }
}, },
}; };
var downloadFileFormatNew = function (fileUrl) { var downloadFileFormatNew = function(fileUrl) {
/* /*
input: /apaas/common/docs/image/images/1234_qq234ewr123.png input: /apaas/common/docs/image/images/1234_qq234ewr123.png
output: 1234.png output: 1234.png
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment