postdischarge-ui/src/views/manage/info/index.vue

533 lines
18 KiB
Vue
Raw Normal View History

2024-04-15 15:51:50 +08:00
<template>
<div class="app-container">
2024-05-08 17:59:20 +08:00
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
2024-04-15 15:51:50 +08:00
<el-form-item label="资讯标题" prop="infoTitle">
2024-05-08 17:59:20 +08:00
<el-input v-model="queryParams.infoTitle" placeholder="请输入资讯标题" maxlength="100" clearable
@keyup.enter.native="handleQuery" />
2024-04-15 15:51:50 +08:00
</el-form-item>
<el-form-item label="资讯分类" prop="infoCategoryId">
2024-05-08 17:59:20 +08:00
<el-button type="" v-if="infoCategoryName == '请选择资讯分类'" @click="clickitem()" style="
2024-04-15 15:51:50 +08:00
width: 250px;
text-align: left;
height: 36px;
color: #c0c4cc;
overflow: hidden;
2024-05-08 17:59:20 +08:00
">{{ infoCategoryName }}</el-button>
<el-button @click="clickitem()" type="" v-else style="
2024-04-15 15:51:50 +08:00
width: 250px;
text-align: left;
height: 36px;
padding-left: -10px;
overflow: hidden;
2024-05-08 17:59:20 +08:00
">{{ infoCategoryName }}</el-button>
2024-04-15 15:51:50 +08:00
</el-form-item>
<!-- </el-form-item> -->
<el-form-item label="资讯编码" prop="infoCode">
2024-05-08 17:59:20 +08:00
<el-input v-model="queryParams.infoCode" placeholder="请输入资讯编码" clearable @keyup.enter.native="handleQuery" />
2024-04-15 15:51:50 +08:00
</el-form-item>
2024-04-16 15:09:53 +08:00
2024-04-15 15:51:50 +08:00
<el-form-item>
2024-05-08 17:59:20 +08:00
<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>
2024-04-15 15:51:50 +08:00
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
2024-05-08 17:59:20 +08:00
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['manage:info:add']">新增</el-button>
2024-04-15 15:51:50 +08:00
</el-col>
<el-col :span="1.5">
2024-05-08 17:59:20 +08:00
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
v-hasPermi="['manage:info:edit']">修改</el-button>
2024-04-15 15:51:50 +08:00
</el-col>
<el-col :span="1.5">
2024-05-08 17:59:20 +08:00
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
v-hasPermi="['manage:info:remove']">删除</el-button>
2024-04-15 15:51:50 +08:00
</el-col>
<!-- <el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['manage:info:export']"
>导出</el-button>
</el-col> -->
2024-05-08 17:59:20 +08:00
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
2024-04-15 15:51:50 +08:00
</el-row>
2024-05-08 17:59:20 +08:00
<el-table v-loading="loading" :data="infoList" @selection-change="handleSelectionChange">
2024-04-15 15:51:50 +08:00
<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="infoTitle" />
<el-table-column label="资讯编码" align="center" prop="infoCode" />
2024-04-16 15:09:53 +08:00
<el-table-column label="资讯分类" align="center" prop="infoCategoryName" />
2024-04-15 15:51:50 +08:00
<el-table-column label="资讯排序" align="center" prop="infoSort" />
2024-04-16 15:09:53 +08:00
2024-05-08 17:59:20 +08:00
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
2024-04-15 15:51:50 +08:00
<template slot-scope="scope">
2024-05-08 17:59:20 +08:00
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['manage:info:edit']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['manage:info:remove']">删除</el-button>
2024-04-15 15:51:50 +08:00
</template>
</el-table-column>
</el-table>
2024-05-08 17:59:20 +08:00
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
@pagination="getList" />
2024-04-15 15:51:50 +08:00
<!-- 添加或修改资讯信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="900px" append-to-body>
2024-05-08 17:59:20 +08:00
<el-form ref="form" :model="form" :rules="rules" label-width="140px" :inline="true">
2024-04-15 15:51:50 +08:00
<el-form-item label="资讯标题" prop="infoTitle">
2024-05-08 17:59:20 +08:00
<el-input v-model="form.infoTitle" maxlength="100" placeholder="请输入资讯标题" />
2024-04-15 15:51:50 +08:00
</el-form-item>
2024-04-16 15:09:53 +08:00
<el-form-item label="资讯分类" prop="infoCategoryId">
2024-05-08 17:59:20 +08:00
<el-button type="" v-if="form.infoCategoryName == '请选择资讯分类'" @click="clickinnerVisible()" style="
2024-04-15 15:51:50 +08:00
width: 250px;
text-align: left;
height: 36px;
color: #c0c4cc;
overflow: hidden;
2024-05-08 17:59:20 +08:00
">{{ form.infoCategoryName }}</el-button>
<el-button @click="clickinnerVisible()" type="" v-else style="
2024-04-15 15:51:50 +08:00
width: 250px;
text-align: left;
height: 36px;
padding-left: -10px;
overflow: hidden;
2024-05-08 17:59:20 +08:00
">{{ form.infoCategoryName }}</el-button>
2024-04-15 15:51:50 +08:00
</el-form-item>
2024-04-16 15:09:53 +08:00
<el-form-item label="资讯图标" prop="infoLargePictureUrl">
2024-05-08 17:59:20 +08:00
<stationAcatar style="width: 208px" @imgUrl="imgUrl" :img="form.infoLargePictureUrl"
:type="'infoMainThumbnailUrl'" />
2024-04-15 15:51:50 +08:00
<!-- <el-input v-model="form.leadThumbnailUrl" placeholder="请输入资讯主缩略图地址" /> -->
</el-form-item>
<el-form-item label="显示顺序" prop="infoSort">
2024-05-08 17:59:20 +08:00
<el-input v-model="form.infoSort" placeholder="请输入显示顺序" style="width: 250px" type="number"
oninput="value=value.replace(/[^\d]/g,'')" maxLength="5" />
2024-04-15 15:51:50 +08:00
</el-form-item>
2024-04-16 15:09:53 +08:00
<el-form-item label="资讯图文内容" prop="infoContent">
2024-05-08 17:59:20 +08:00
<editor @imgs="imgs" maxlength="300" :min-height="102" placeholder="请输入资讯图文内容"
style="width: 80%; margin-left: 18%; margin-top: -5%" v-model="form.infoContent" />
2024-04-15 15:51:50 +08:00
</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>
<!-- 选择资讯 -->
2024-05-08 17:59:20 +08:00
<el-dialog title="选择资讯" :visible.sync="innerVisible" width="1000px" append-to-body
:before-close="innerVisiblecancel">
<el-form ref="queryForm" :model="informationqueryParams" label-width="80px" :inline="true">
<el-form-item label="资讯分类编码" prop="infoCategoryCode" label-width="120">
<el-input v-model="informationqueryParams.infoCategoryCode" placeholder="请输入资讯分类编码" clearable />
2024-04-15 15:51:50 +08:00
</el-form-item>
2024-05-08 17:59:20 +08:00
<el-form-item label="资讯分类名称" label-width="120">
<el-input v-model="informationqueryParams.infoCategoryName" placeholder="请输入资讯分类名称" clearable />
2024-04-15 15:51:50 +08:00
</el-form-item>
<el-form-item>
2024-05-08 17:59:20 +08:00
<el-button type="primary" icon="el-icon-search" size="mini" @click="informationInfoinfo">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="addresetQuerylist">重置</el-button>
2024-04-15 15:51:50 +08:00
</el-form-item>
</el-form>
2024-05-08 17:59:20 +08:00
<el-table :data="infolist" @cell-dblclick="nurseclick" v-loading="loading">
2024-04-15 15:51:50 +08:00
<el-table-column label="请选择" width="100" align="center">
<template slot-scope="scope">
2024-05-08 17:59:20 +08:00
<el-button type="primary" style="width: 15px; height: 15px" v-if="form.infoCategoryId == scope.row.id"
circle @click="nurseclick(scope.row)"></el-button>
<el-button v-else style="width: 15px; height: 15px" circle @click="nurseclick(scope.row)"></el-button>
2024-04-15 15:51:50 +08:00
</template>
</el-table-column>
2024-05-08 17:59:20 +08:00
<el-table-column property="infoCategoryCode" label="资讯分类编码" align="center">
2024-04-15 15:51:50 +08:00
</el-table-column>
2024-05-08 17:59:20 +08:00
<el-table-column property="infoCategoryName" label="资讯名称" align="center" :show-overflow-tooltip="true">
2024-04-15 15:51:50 +08:00
</el-table-column>
<!-- <el-table-column
property="hospitalAddress"
label="医院地址"
align="center"
>
</el-table-column> -->
<!-- <el-table-column
property="hospitalIntroduce"
label="医院介绍"
align="center"
:show-overflow-tooltip="true"
>
</el-table-column> -->
<!-- <el-table-column
property="phone"
label="联系电话"
align="center"
:show-overflow-tooltip="true"
>
</el-table-column> -->
</el-table>
2024-05-08 17:59:20 +08:00
<pagination v-show="total2 > 0" :total="total2" :page.sync="informationqueryParams.pageNum"
:limit.sync="informationqueryParams.pageSize" @pagination="informationInfoinfo" />
2024-04-15 15:51:50 +08:00
</el-dialog>
<!-- 搜索选择资讯 -->
2024-05-08 17:59:20 +08:00
<el-dialog title="选择资讯" :visible.sync="innerVisiblezx" width="1000px" append-to-body
:before-close="innerVisiblecancelzx">
<el-form ref="queryForm" :model="informationqueryParams" label-width="80px" :inline="true">
<el-form-item label="资讯分类编码" prop="infoCategoryCode" label-width="120">
<el-input v-model="informationqueryParams.infoCategoryCode" placeholder="请输入资讯分类编码" clearable />
2024-04-15 15:51:50 +08:00
</el-form-item>
2024-05-08 17:59:20 +08:00
<el-form-item label="资讯分类名称" label-width="120">
<el-input v-model="informationqueryParams.infoCategoryName" placeholder="请输入资讯分类名称" clearable />
2024-04-15 15:51:50 +08:00
</el-form-item>
<el-form-item>
2024-05-08 17:59:20 +08:00
<el-button type="primary" icon="el-icon-search" size="mini" @click="informationInfoinfo">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="addresetQuerylist">重置</el-button>
2024-04-15 15:51:50 +08:00
</el-form-item>
</el-form>
2024-05-08 17:59:20 +08:00
<el-table :data="infolist" @cell-dblclick="nurseclickzx" v-loading="loading">
2024-04-15 15:51:50 +08:00
<el-table-column label="请选择" width="100" align="center">
<template slot-scope="scope">
2024-05-08 17:59:20 +08:00
<el-button type="primary" style="width: 15px; height: 15px"
v-if="queryParams.infoCategoryId == scope.row.id" circle @click="nurseclickzx(scope.row)"></el-button>
<el-button v-else style="width: 15px; height: 15px" circle @click="nurseclickzx(scope.row)"></el-button>
2024-04-15 15:51:50 +08:00
</template>
</el-table-column>
2024-05-08 17:59:20 +08:00
<el-table-column property="infoCategoryCode" label="资讯分类编码" align="center">
2024-04-15 15:51:50 +08:00
</el-table-column>
2024-05-08 17:59:20 +08:00
<el-table-column property="infoCategoryName" label="资讯名称" align="center" :show-overflow-tooltip="true">
2024-04-15 15:51:50 +08:00
</el-table-column>
</el-table>
2024-05-08 17:59:20 +08:00
<pagination v-show="total2 > 0" :total="total2" :page.sync="informationqueryParams.pageNum"
:limit.sync="informationqueryParams.pageSize" @pagination="informationInfoinfo" />
2024-04-15 15:51:50 +08:00
</el-dialog>
</div>
</template>
<script>
import { listInfo, getInfo, delInfo, addInfo, updateInfo } from "@/api/manage/info";
import { listCategory } from "@/api/manage/category";
import stationAcatar from "../../system/stationAvatar/index.vue";
export default {
name: "Info",
components: { stationAcatar },
data() {
return {
2024-05-08 17:59:20 +08:00
2024-04-15 15:51:50 +08:00
innerVisible: false,
innerVisiblezx: false,
2024-05-08 17:59:20 +08:00
imgs: '',
infoCategoryName: '请选择资讯分类',
2024-04-15 15:51:50 +08:00
informationqueryParams: {
pageNum: 1,
pageSize: 10,
infoCategoryCode: "",
infoCategoryName: "",
2024-04-16 15:09:53 +08:00
infoCategoryId: "",
2024-04-15 15:51:50 +08:00
},
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
total2: 0,
infolist: [],
// 资讯信息表格数据
infoList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
2024-05-08 17:59:20 +08:00
infoCategoryName: "",
2024-04-15 15:51:50 +08:00
infoCategoryId: null,
infoTitle: null,
infoCode: null,
infoContent: null,
infoClickCount: null,
infoJumpLink: null,
infoSource: null,
2024-04-16 15:09:53 +08:00
2024-04-15 15:51:50 +08:00
infoLargePictureUrl: null,
infoSort: null,
infoCreator: null,
infoCreateTime: null,
infoReviser: null,
infoModifyTime: null
},
// 表单参数
form: {
},
// 表单校验
rules: {
// infoTitle: [
// { required: true, message: "角色名称不能为空", trigger: "blur" }
// ],
2024-04-16 15:09:53 +08:00
infoCategoryId: [
2024-04-15 15:51:50 +08:00
{
required: true,
message: "请选择资讯分类",
trigger: "blur",
},
],
infoTitle: [
{
required: true,
message: "请选择资讯标题",
trigger: "blur",
},
],
2024-04-16 15:09:53 +08:00
infoLargePictureUrl: [
2024-04-15 15:51:50 +08:00
{
required: true,
trigger: "blur",
message: "请选择缩略图",
},
],
infoSort: [
{
required: true,
trigger: "blur",
message: "请输入显示顺序",
},
],
2024-04-16 15:09:53 +08:00
infoContent: [
2024-04-15 15:51:50 +08:00
{
required: true,
message: "请输入资讯图文内容",
trigger: "blur",
},
],
}
};
},
created() {
this.getList();
},
methods: {
2024-05-08 17:59:20 +08:00
// 新增按钮
clickinnerVisible() {
2024-04-15 15:51:50 +08:00
this.informationInfoinfo();
this.innerVisible = true;
},
imgUrl(imgUrl) {
2024-05-08 17:59:20 +08:00
console.log(imgUrl, 'imgUrl')
2024-04-16 15:09:53 +08:00
this.form.infoLargePictureUrl = imgUrl;
2024-04-15 15:51:50 +08:00
},
// imgs(item) {
// this.imgsurl.pictureUrlList.push(item);
// },
2024-05-08 17:59:20 +08:00
2024-04-15 15:51:50 +08:00
innerVisiblecancel() {
this.innerVisible = false;
},
innerVisiblecancelzx() {
this.innerVisiblezx = false;
},
//重置
addresetQuery() {
this.queryParams = {
pageNum: 1,
pageSize: 10,
infoCategoryCode: "",
informationTitle: "",
infoCategoryName: "",
2024-04-16 15:09:53 +08:00
2024-05-08 17:59:20 +08:00
2024-04-15 15:51:50 +08:00
};
this.getList();
},
addresetQuerylist() {
this.informationqueryParams = {
pageNum: 1,
pageSize: 10,
infoCategoryCode: "",
infoCategoryName: "",
};
this.informationInfoinfo();
},
informationInfoinfo() {
listCategory(this.informationqueryParams).then((response) => {
this.infolist = response.rows;
this.total2 = response.total;
this.loading = false;
});
},
clickitem() {
this.informationInfoinfo();
this.innerVisiblezx = true;
},
nurseclick(row) {
2024-04-16 15:09:53 +08:00
this.form.infoCategoryId = row.id;
2024-04-15 15:51:50 +08:00
this.form.infoCategoryName = row.infoCategoryName;
this.innerVisible = false;
},
nurseclickzx(row) {
2024-04-16 15:09:53 +08:00
this.queryParams.infoCategoryId = row.id;
2024-04-15 15:51:50 +08:00
this.queryParams.infoCategoryName = row.infoCategoryName;
2024-04-16 15:09:53 +08:00
this.infoCategoryName = this.queryParams.infoCategoryName;
2024-04-15 15:51:50 +08:00
this.innerVisiblezx = false;
},
/** 查询资讯信息列表 */
getList() {
this.loading = true;
listInfo(this.queryParams).then(response => {
this.infoList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
infoCategoryId: null,
infoTitle: null,
infoCode: null,
infoContent: null,
infoClickCount: null,
infoJumpLink: null,
2024-04-16 15:09:53 +08:00
2024-04-15 15:51:50 +08:00
infoLargePictureUrl: null,
infoSort: null,
infoCreator: null,
infoCreateTime: null,
infoReviser: null,
infoModifyTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
2024-04-16 15:09:53 +08:00
2024-05-08 17:59:20 +08:00
this.queryParams.pageNum = 1
2024-04-15 15:51:50 +08:00
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
2024-05-08 17:59:20 +08:00
this.queryParams = {
2024-04-16 15:09:53 +08:00
pageNum: 1,
pageSize: 10,
2024-05-08 17:59:20 +08:00
infoCategoryName: null,
infoCategoryId: null,
2024-04-16 15:09:53 +08:00
infoCategoryId: null,
infoTitle: null,
infoCode: null,
infoContent: null,
infoClickCount: null,
infoJumpLink: null,
infoSource: null,
infoLargePictureUrl: null,
infoSort: null,
infoCreator: null,
infoCreateTime: null,
infoReviser: null,
infoModifyTime: null
}
2024-05-08 17:59:20 +08:00
this.infoCategoryName = "请选择资讯分类"
2024-04-16 15:09:53 +08:00
this.getList();
// this.handleQuery();
2024-04-15 15:51:50 +08:00
},
// 多选框选中数据
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 = "添加资讯信息";
2024-05-08 17:59:20 +08:00
this.form.infoCategoryName = "请选择资讯分类";
2024-04-15 15:51:50 +08:00
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getInfo(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改资讯信息";
});
},
/** 提交按钮 */
submitForm() {
2024-05-08 17:59:20 +08:00
if (this.form.infoSort) {
this.form.infoSort = Number(this.form.infoSort)
}
2024-04-15 15:51:50 +08:00
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateInfo(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addInfo(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除资讯信息编号为"' + ids + '"的数据项?').then(function () {
return delInfo(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => { });
},
/** 导出按钮操作 */
handleExport() {
this.download('manage/info/export', {
...this.queryParams
}, `info_${new Date().getTime()}.xlsx`)
}
}
};
</script>