From 4bb904fc27caf0576ed7dbf46d5909a7b1f778c0 Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Mon, 14 Jul 2025 09:52:28 +0800
Subject: [PATCH] Merge branch 'test' of http://139.196.74.78:10010/r/drone/drone-web-manage into test
---
src/views/resource/attach.vue | 219 ++++++++++++++++++++++--------------------------------
1 files changed, 91 insertions(+), 128 deletions(-)
diff --git a/src/views/resource/attach.vue b/src/views/resource/attach.vue
index 3b1ed06..29bebe0 100644
--- a/src/views/resource/attach.vue
+++ b/src/views/resource/attach.vue
@@ -1,49 +1,18 @@
<template>
<basic-container>
- <avue-crud
- :option="option"
- :table-loading="loading"
- :data="data"
- v-model:page="page"
- :permission="permissionList"
- :before-open="beforeOpen"
- v-model="form"
- ref="crud"
- @row-del="rowDel"
- @search-change="searchChange"
- @search-reset="searchReset"
- @selection-change="selectionChange"
- @current-change="currentChange"
- @size-change="sizeChange"
- @refresh-change="refreshChange"
- @on-load="onLoad"
- >
+ <avue-crud :option="option" :table-loading="loading" :data="data" v-model:page="page" :permission="permissionList"
+ :before-open="beforeOpen" v-model="form" ref="crud" @row-del="rowDel" @search-change="searchChange"
+ @search-reset="searchReset" @selection-change="selectionChange" @current-change="currentChange"
+ @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
<template #menu-left>
- <el-button
- type="primary"
- plain
- v-if="permission.attach_upload"
- icon="el-icon-upload"
- @click="handleUpload"
- >上 传
+ <el-button type="primary" plain v-if="permission.attach_upload" icon="el-icon-upload" @click="handleUpload">上 传
</el-button>
- <el-button
- type="danger"
- icon="el-icon-delete"
- plain
- v-if="permission.attach_delete"
- @click="handleDelete"
- >删 除
+ <el-button type="danger" icon="el-icon-delete" plain v-if="permission.attach_delete" @click="handleDelete">删 除
</el-button>
</template>
<template #menu="scope">
- <el-button
- type="primary"
- text
- icon="el-icon-download"
- v-if="permission.attach_download"
- @click="handleDownload(scope.row)"
- >下载
+ <el-button type="primary" text icon="el-icon-download" v-if="permission.attach_download"
+ @click="handleDownload(scope.row)">下载
</el-button>
</template>
<template #attachSize="{ row }">
@@ -58,12 +27,12 @@
</template>
<script>
-import { getList, getDetail, removeAttachAndData } from '@/api/resource/attach';
-import { mapGetters } from 'vuex';
-import func from '@/utils/func';
+import { getList, getDetail, removeAttachAndData } from '@/api/resource/attach'
+import { mapGetters } from 'vuex'
+import func from '@/utils/func'
export default {
- data() {
+ data () {
return {
form: {},
query: {},
@@ -85,6 +54,9 @@
// grid: true,
selection: true,
dialogClickModal: false,
+
+ height: 'auto',
+ calcHeight: 20,
column: [
{
label: '附件地址',
@@ -112,7 +84,7 @@
label: '附件名称',
prop: 'name',
search: true,
- searchSpan:4,
+ searchSpan: 4,
rules: [
{
required: true,
@@ -125,7 +97,7 @@
label: '附件原名',
prop: 'originalName',
search: true,
- searchSpan:4,
+ searchSpan: 4,
rules: [
{
required: true,
@@ -138,8 +110,8 @@
label: '附件拓展名',
prop: 'extension',
search: true,
- searchSpan:4,
- searchLabelWidth:95,
+ searchSpan: 4,
+ searchLabelWidth: 95,
rules: [
{
required: true,
@@ -168,14 +140,14 @@
label: '创建日期',
prop: 'daterange',
type: 'daterange',
- search:true,
+ search: true,
searchRange: true,
- searchSpan:6,
+ searchSpan: 6,
format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
- viewDisplay:false,
+ viewDisplay: false,
hide: true,
rules: [
{
@@ -207,63 +179,63 @@
},
],
},
- };
+ }
},
computed: {
- func() {
- return func;
+ func () {
+ return func
},
...mapGetters(['permission']),
- permissionList() {
+ permissionList () {
return {
addBtn: false,
editBtn: false,
viewBtn: false,
delBtn: this.validData(this.permission.attach_delete, false),
- };
+ }
},
- ids() {
- let ids = [];
+ ids () {
+ let ids = []
this.selectionList.forEach(ele => {
- ids.push(ele.id);
- });
- return ids.join(',');
+ ids.push(ele.id)
+ })
+ return ids.join(',')
},
},
methods: {
- handleUpload() {
- this.attachBox = true;
+ handleUpload () {
+ this.attachBox = true
},
- uploadAfter(res, done, loading, column) {
- window.console.log(column);
- this.attachBox = false;
- this.refreshChange();
- done();
+ uploadAfter (res, done, loading, column) {
+ window.console.log(column)
+ this.attachBox = false
+ this.refreshChange()
+ done()
},
- handleDownload(row) {
- window.open(`${row.link}`);
+ handleDownload (row) {
+ window.open(`${row.link}`)
},
- rowDel(row) {
+ rowDel (row) {
this.$confirm('确定将选择数据及对应的文件删除?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
- return removeAttachAndData(row.id);
+ return removeAttachAndData(row.id)
})
.then(() => {
- this.onLoad(this.page);
+ this.onLoad(this.page)
this.$message({
type: 'success',
message: '操作成功!',
- });
- });
+ })
+ })
},
- handleDelete() {
+ handleDelete () {
if (this.selectionList.length === 0) {
- this.$message.warning('请选择至少一条数据');
- return;
+ this.$message.warning('请选择至少一条数据')
+ return
}
this.$confirm('确定将选择数据及对应的文件删除?', {
confirmButtonText: '确定',
@@ -271,85 +243,76 @@
type: 'warning',
})
.then(() => {
- return removeAttachAndData(this.ids);
+ return removeAttachAndData(this.ids)
})
.then(() => {
- this.onLoad(this.page);
+ this.onLoad(this.page)
this.$message({
type: 'success',
message: '操作成功!',
- });
- this.$refs.crud.toggleSelection();
- });
+ })
+ this.$refs.crud.toggleSelection()
+ })
},
- beforeOpen(done, type) {
+ beforeOpen (done, type) {
if (['edit', 'view'].includes(type)) {
getDetail(this.form.id).then(res => {
- this.form = res.data.data;
- });
+ this.form = res.data.data
+ })
}
- done();
+ done()
},
- searchReset() {
- this.query = {};
- this.onLoad(this.page);
+ searchReset () {
+ this.query = {}
+ this.onLoad(this.page)
},
- searchChange(params, done) {
- this.query = params;
- this.page.currentPage = 1;
- this.onLoad(this.page, params);
- done();
+ searchChange (params, done) {
+ this.query = params
+ this.page.currentPage = 1
+ this.onLoad(this.page, params)
+ done()
},
- selectionChange(list) {
- this.selectionList = list;
+ selectionChange (list) {
+ this.selectionList = list
},
- selectionClear() {
- this.selectionList = [];
- this.$refs.crud.toggleSelection();
+ selectionClear () {
+ this.selectionList = []
+ this.$refs.crud.toggleSelection()
},
- currentChange(currentPage) {
- this.page.currentPage = currentPage;
+ currentChange (currentPage) {
+ this.page.currentPage = currentPage
},
- sizeChange(pageSize) {
- this.page.pageSize = pageSize;
+ sizeChange (pageSize) {
+ this.page.pageSize = pageSize
},
- refreshChange() {
- this.onLoad(this.page, this.query);
+ refreshChange () {
+ this.onLoad(this.page, this.query)
},
- onLoad(page, params = {}) {
- const { daterange } = this.query;
+ onLoad (page, params = {}) {
+ const { daterange } = this.query
let values = {
...params,
...this.query,
- };
+ }
if (daterange) {
values = {
...values,
startTime: daterange[0],
endTime: daterange[1],
- };
- values.daterange = null;
+ }
+ values.daterange = null
}
- this.loading = true;
+ this.loading = true
getList(page.currentPage, page.pageSize, values).then(res => {
- const data = res.data.data;
- this.page.total = data.total;
- this.data = data.records;
- this.loading = false;
- this.selectionClear();
- });
+ const data = res.data.data
+ this.page.total = data.total
+ this.data = data.records
+ this.loading = false
+ this.selectionClear()
+ })
},
},
-};
+}
</script>
-<style scoped lang="scss">
- :deep(){
- .avue-crud__body{
- .el-form{
- height: 745px;
- overflow: auto;
- }
- }
- }
-</style>
+<style scoped lang="scss"></style>
--
Gitblit v1.9.3