护理员app 上传

This commit is contained in:
shidongli 2022-11-16 14:56:49 +08:00
parent a55f139254
commit f8ec8383f9
2 changed files with 452 additions and 0 deletions

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询护理员App文件管理列表
export function listAppFileInfo(query) {
return request({
url: '/system/appFileInfo/list',
method: 'get',
params: query
})
}
// 查询护理员App文件管理详细
export function getAppFileInfo(id) {
return request({
url: '/system/appFileInfo/' + id,
method: 'get'
})
}
// 新增护理员App文件管理
export function addAppFileInfo(data) {
return request({
url: '/system/appFileInfo',
method: 'post',
data: data
})
}
// 修改护理员App文件管理
export function updateAppFileInfo(data) {
return request({
url: '/system/appFileInfo',
method: 'put',
data: data
})
}
// 删除护理员App文件管理
export function delAppFileInfo(id) {
return request({
url: '/system/appFileInfo/' + id,
method: 'delete'
})
}

View File

@ -0,0 +1,408 @@
<template>
<div class="app-container">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="文件名称" prop="fileName">
<el-input
v-model="queryParams.fileName"
placeholder="请输入文件名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="版本号" prop="fileVersion">
<el-input
v-model="queryParams.fileVersion"
placeholder="请输入版本号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<!-- <el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:appFileInfo:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:appFileInfo:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:appFileInfo:remove']"
>删除</el-button>
</el-col> -->
<!-- <el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:appFileInfo:export']"
>导出</el-button>
</el-col> -->
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-upload2"
size="mini"
@click="handledata"
v-hasPermi="['system:appFileInfo:importData']"
>上传</el-button
>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table
v-loading="loading"
:data="appFileInfoList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="主键id" align="center" prop="id" /> -->
<el-table-column label="文件名称" align="center" prop="fileName" />
<el-table-column label="文件地址" align="center" prop="fileUrl" />
<el-table-column label="版本号" align="center" prop="fileVersion" />
<el-table-column label="创建人" align="center" prop="createBy" />
<el-table-column label="创建时间" align="center" prop="createTime" />
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:appFileInfo:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:appFileInfo:remove']"
>删除</el-button>
</template>
</el-table-column> -->
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改护理员App文件管理对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="文件名称" prop="fileName">
<el-input v-model="form.fileName" placeholder="请输入文件名称" />
</el-form-item>
<el-form-item label="文件地址" prop="fileUrl">
<el-input
v-model="form.fileUrl"
type="textarea"
placeholder="请输入内容"
/>
</el-form-item>
<el-form-item label="版本号" prop="fileVersion">
<el-input v-model="form.fileVersion" placeholder="请输入版本号" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- // -->
<el-dialog
:title="upload.title"
:visible.sync="upload.open"
width="400px"
append-to-body
>
<el-form>
<el-form-item label="版本号" prop="versions" label-width="60px">
<el-input placeholder="请输入版本号" v-model="versions" />
</el-form-item>
</el-form>
<el-upload
ref="upload"
:limit="1"
accept=".apk"
:headers="upload.headers"
:action="upload.url"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
:data="{
version: versions,
}"
drag
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip">
<span>仅允许上传.apk格式文件</span>
<!-- <el-link
type="primary"
:underline="false"
style="font-size: 12px; vertical-align: baseline"
@click="importTemplate"
>下载模板</el-link
> -->
</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm"> </el-button>
<el-button @click="upload.open = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listAppFileInfo, getAppFileInfo, delAppFileInfo, addAppFileInfo, updateAppFileInfo } from "@/api/system/appFileInfo";
import { getToken } from "@/utils/auth";
export default {
name: "AppFileInfo",
data() {
return {
versions: '',//banbenhao
//
upload: {
//
open: false,
//
title: "",
//
isUploading: false,
//
headers: { Authorization: "Bearer " + getToken() },
//
url:
process.env.VUE_APP_BASE_API +
"/system/appFileInfo/uploadAppFileUrl",
},
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
// App
appFileInfoList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
fileName: null,
fileUrl: null,
fileVersion: null,
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询护理员App文件管理列表 */
getList() {
this.loading = true;
listAppFileInfo(this.queryParams).then(response => {
this.appFileInfoList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
fileName: null,
fileUrl: null,
fileVersion: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加护理员App文件管理";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getAppFileInfo(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改护理员App文件管理";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateAppFileInfo(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addAppFileInfo(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 导入按钮操作 */
handledata() {
this.versions=""
this.upload.title = "护理员App文件导入";
this.upload.open = true;
},
/** 下载模板操作 */
// importTemplate() {
// this.download(
// "/system/station/downloadTemplate?fileType=nurseStation",
// {},
// `App.xlsx`
// );
// },
//
submitFileForm() {
this.$refs.upload.submit();
},
//
handleFileSuccess(response, file, fileList) {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$alert(
"<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
response.msg +
"</div>",
"导入结果",
{ dangerouslyUseHTMLString: true }
);
this.getList();
},
//
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除护理员App文件管理编号为"' + ids + '"的数据项?').then(function () {
return delAppFileInfo(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => { });
},
/** 导出按钮操作 */
handleExport() {
this.download('system/appFileInfo/export', {
...this.queryParams
}, `appFileInfo_${new Date().getTime()}.xlsx`)
}
}
};
</script>