Browse Source

上报类型添加单位,附件,备注

newDev
lzp 1 week ago
parent
commit
1e74bec548
  1. 716
      acupuncture-后台/src/views/report/type.vue

716
acupuncture-后台/src/views/report/type.vue

@ -1,266 +1,500 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" <el-form
label-width="80px"> :model="queryParams"
<el-form-item label="类型名称" prop="typeName"> ref="queryForm"
<el-input v-model="queryParams.param.typeName" placeholder="请输入" clearable size="small"
@keyup.enter.native="handleQuery" /> :inline="true"
</el-form-item> v-show="showSearch"
<el-form-item> label-width="80px"
<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 label="类型名称" prop="typeName">
</el-form-item> <el-input
</el-form> v-model="queryParams.param.typeName"
<el-row :gutter="10" class="mb8"> placeholder="请输入"
<el-col :span="1.5"> clearable
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button> @keyup.enter.native="handleQuery"
</el-col> />
<el-col :span="1.5"> </el-form-item>
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" <el-form-item>
@click="handleDelete">删除</el-button> <el-button
</el-col> type="primary"
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> icon="el-icon-search"
</el-row> 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"
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
>删除</el-button
>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="listData" @selection-change="handleSelectionChange" max-height="600"> <el-table
<el-table-column type="selection" width="55" align="center" /> v-loading="loading"
<el-table-column fixed label="类型名称" align="center" prop="typeName" min-width="100" /> :data="listData"
<el-table-column label="备注" align="center" prop="remark" min-width="100" /> @selection-change="handleSelectionChange"
<el-table-column label="创建人/创建时间" align="center" min-width="140"> max-height="600"
<template slot-scope="scope"> >
<div>{{scope.row.createBy}}</div> <el-table-column type="selection" width="55" align="center" />
<span> <el-table-column
{{ parseTime(scope.row.createTime, "{y}-{m}-{d} {h}:{i}") }} fixed
</span> label="类型名称"
</template> align="center"
</el-table-column> prop="typeName"
<el-table-column fixed="right" label="操作" align="center" class-name="small-padding fixed-width" width="200"> min-width="100"
<template slot-scope="scope"> show-overflow-tooltip
<el-button size="mini" type="text" icon="el-icon-edit" />
@click="handleUpdate(scope.row)">修改</el-button> <el-table-column
<el-button size="mini" type="text" icon="el-icon-delete" label="单位"
@click="handleDelete(scope.row)">删除</el-button> align="center"
</template> prop="tenantIdList"
</el-table-column> min-width="250"
</el-table> show-overflow-tooltip
>
<template slot-scope="scope">
<!-- 通过id列表找到tenantsData中匹配的数据并替换为中文数据后面添加逗号 -->
<template v-for="(item, index) in scope.row.tenantIdList">
<template v-if="tenantsData.some((tenant) => tenant.id === item)">
{{ tenantsData.find((tenant) => tenant.id === item).name
}}{{ index < scope.row.tenantIdList.length - 1 ? "," : "" }}
</template>
</template>
</template>
</el-table-column>
<el-table-column
label="附件"
align="center"
prop="typeName"
min-width="150"
show-overflow-tooltip
>
<template slot-scope="scope">
<el-button type="text" size="mini" @click="handleDownload(scope.row)">
<span v-if="scope.row.file">
<i class="el-icon-download"></i>
<span>{{
scope.row.file.substring(scope.row.file.lastIndexOf("/") + 1)
}}</span>
</span>
</el-button>
</template>
</el-table-column>
<el-table-column
label="备注"
align="center"
prop="remark"
min-width="150"
show-overflow-tooltip
/>
<el-table-column label="创建人/创建时间" align="center" min-width="140">
<template slot-scope="scope">
<div>{{ scope.row.createBy }}</div>
<span>
{{ parseTime(scope.row.createTime, "{y}-{m}-{d} {h}:{i}") }}
</span>
</template>
</el-table-column>
<el-table-column
fixed="right"
label="操作"
align="center"
class-name="small-padding fixed-width"
width="200"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" <pagination
:limit.sync="queryParams.pageSize" @pagination="getList" /> v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改公告对话框 --> <!-- 添加或修改公告对话框 -->
<el-dialog class="popup" :title="title" :visible.sync="open" width="780px" append-to-body> <el-dialog
<el-form ref="form" :model="form" :rules="rules" label-width="90px" class="formStep"> class="popup"
<el-form-item label="类型名称" prop="typeName"> :title="title"
<el-input v-model="form.typeName" placeholder="请输入" /> :visible.sync="open"
</el-form-item> width="780px"
</el-form> append-to-body
<div slot="footer" class="dialog-footer"> >
<el-button type="primary" @click="submitForm"> </el-button> <el-form
<el-button @click="cancel"> </el-button> ref="form"
</div> :model="form"
</el-dialog> :rules="rules"
</div> label-width="90px"
class="formStep"
>
<el-form-item label="类型名称" prop="typeName">
<el-input v-model="form.typeName" placeholder="请输入" />
</el-form-item>
<el-form-item label="单位" prop="tenantIdList">
<el-select v-model="form.tenantIdList" multiple placeholder="请选择">
<el-option
v-for="item in tenantsData"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="附件" prop="file">
<el-upload
:limit="1"
class="avatar-uploader wj-uploader"
:headers="headers"
:action="uploadFileUrl"
accept=".xlsx,.xls,.pdf,.doc,.docx"
:before-upload="handleBeforePdfUpload1"
:on-success="handleUploadPdfAdd1"
:on-remove="handleRemove"
:file-list="fileList"
:show-file-list="true"
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">
将文件拖到此处
<em>点击上传</em>
</div>
</el-upload>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input
type="textarea"
v-model="form.remark"
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>
</div>
</template> </template>
<script> <script>
import { import { getToken } from "@/utils/auth";
reportList, import { tenantsList } from "@/api/member";
reportAdd, import { reportList, reportAdd, reportUpd, reportDel } from "@/api/report";
reportUpd, export default {
reportDel name: "Notice",
} from "@/api/report"; data() {
export default { return {
name: "Notice", uploadFileUrl: process.env.VUE_APP_API_QZURL + "/common/upload", //
data() { headers: {
return { Authorization: "Bearer " + getToken(),
dataSourceList: [], },
queryParams: { dataSourceList: [],
param: { queryParams: {
name: "", param: {
} name: "",
}, },
listData: [], },
title: '', listData: [],
open: false, title: "",
total: 0, open: false,
form: {}, total: 0,
loading: false, form: {},
showSearch: true, loading: false,
multiple: false, showSearch: true,
// multiple: false,
rules: { //
typeName: [{ rules: {
required: true, typeName: [
message: "上报类型不能为空", {
trigger: "blur", required: true,
}], message: "上报类型不能为空",
}, trigger: "blur",
}; },
}, ],
created() { tenantIdList: [
this.getList(); {
}, required: true,
methods: { message: "单位不能为空",
/** 查询公告列表 */ trigger: "change",
getList() { },
this.loading = true; ],
reportList(this.queryParams).then((res) => { file: [
this.listData = res.data.list; {
this.total = res.data.total; required: true,
this.loading = false; message: "附件不能为空",
}); trigger: "change",
}, },
// ],
cancel() { },
this.open = false; tenantsData: [],
this.reset(); fileList: [],
}, };
// },
reset() { created() {
this.form = { this.getList();
"typeName": "", this.getTenantsList();
}; },
this.resetForm("form"); methods: {
}, handleRemove(file, fileList) {
/** 搜索按钮操作 */ this.form.file = "";
handleQuery() { this.fileList = [];
this.queryParams.pageNum = 1; },
this.getList(); // - pdg
}, handleUploadPdfAdd1(res) {
/** 重置按钮操作 */ if (res.code == 200) {
resetQuery() { this.$message.success(res.msg || "导入成功");
this.queryParams.param = { this.form.file = res.fileName;
typeName: "", setTimeout(() => {
}; this.$refs["form"].validateField("file", (errorMessage) => {});
this.handleQuery(); });
}, } else {
// this.$message.error(res.msg || "导入失败");
handleSelectionChange(selection) { this.fileList = [];
this.ids = selection.map((item) => item.id); }
this.single = selection.length != 1; },
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "新增上报类型";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.open = true;
this.title = "修改诊疗档案";
this.form = JSON.parse(JSON.stringify(row))
},
/** 诊疗档案 */
submitForm: function() {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.id != undefined) {
reportUpd(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
reportAdd(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */ // -
handleDelete(row) { handleBeforePdfUpload1(file) {
const idList = row.id ? [row.id] : this.ids; const fileSuffix = file.name.substring(file.name.lastIndexOf(".") + 1);
this.$modal const whiteList = ["xlsx", "xls", "pdf", "doc", "docx"];
.confirm("是否确认删除当前选择的数据?") if (whiteList.indexOf(fileSuffix) === -1) {
.then(function() { this.$message.error("上传文件只能是xlsx/xls/pdf/doc/docx 格式!");
return reportDel({ return false;
idList: idList, }
}); },
}) /** 查询公告列表 */
.then(() => { getTenantsList() {
this.getList(); tenantsList({
this.$modal.msgSuccess("删除成功"); pageNum: -1,
}) param: {},
.catch(() => {}); }).then((res) => {
}, this.tenantsData = res.data.list;
}, });
}; },
/** 查询公告列表 */
getList() {
this.loading = true;
reportList(this.queryParams).then((res) => {
this.listData = res.data.list;
this.total = res.data.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.fileList = [];
this.form = {
typeName: "",
tenantIdList: [],
remark: "",
file: "",
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams.param = {
typeName: "",
};
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 = "新增上报类型";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.open = true;
this.title = "修改上报类型";
this.form = JSON.parse(JSON.stringify(row));
if (row.file) {
this.fileList = [
{
//
name: row.file.substring(row.file.lastIndexOf("/") + 1),
url: row.file,
},
];
} else {
this.fileList = [];
}
},
/** 诊疗档案 */
submitForm: function () {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.id != undefined) {
reportUpd(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
reportAdd(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const idList = row.id ? [row.id] : this.ids;
this.$modal
.confirm("是否确认删除当前选择的数据?")
.then(function () {
return reportDel({
idList: idList,
});
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
},
};
</script> </script>
<style scoped src="@/assets/styles/common.css"></style> <style scoped src="@/assets/styles/common.css"></style>
<style scoped> <style scoped>
.div-title1 { >>> .el-upload-list__item:first-child {
font-size: 22px; margin-top: 0 !important;
font-weight: bold; }
margin-bottom: 10px; .div-title1 {
} font-size: 22px;
font-weight: bold;
margin-bottom: 10px;
}
.div-title2 { .div-title2 {
font-size: 20px; font-size: 20px;
font-weight: bold; font-weight: bold;
margin-bottom: 10px; margin-bottom: 10px;
} }
.div-title3 { .div-title3 {
font-size: 18px; font-size: 18px;
font-weight: bold; font-weight: bold;
margin-bottom: 10px; margin-bottom: 10px;
} }
.span-but { .span-but {
display: inline-block; display: inline-block;
border-radius: 4px; border-radius: 4px;
border: 1px solid #dcdfe6; border: 1px solid #dcdfe6;
line-height: 32px; line-height: 32px;
padding: 0 15px; padding: 0 15px;
margin: 5px; margin: 5px;
} }
.span-but-active { .span-but-active {
border: 1px solid #1890ff; border: 1px solid #1890ff;
} }
.human-body { .human-body {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
} }
.human-body>>>.el-form-item { .human-body >>> .el-form-item {
width: 49%; width: 49%;
margin-right: 2%; margin-right: 2%;
} }
.human-body>>>.el-form-item:nth-of-type(2n) { .human-body >>> .el-form-item:nth-of-type(2n) {
margin-right: 0; margin-right: 0;
} }
.formStep1>>>.el-form-item__label {} .formStep1 >>> .el-form-item__label {
}
.form-item-zd { .form-item-zd {
width: 100%; width: 100%;
text-align: left; text-align: left;
} }
.form-item-age { .form-item-age {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.form-item-age span { .form-item-age span {
margin: 0 10px; margin: 0 10px;
} }
.form-item-age>>>.el-input { .form-item-age >>> .el-input {
width: 100px; width: 100px;
} }
>>>.el-drawer.rtl { >>> .el-drawer.rtl {
width: 50% !important; width: 50% !important;
} }
</style> </style>

Loading…
Cancel
Save