<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="proId">
|
<el-input v-model="queryParams.proId" placeholder="请输入项目编码" clearable @keyup.enter.native="handleQuery" />
|
</el-form-item>
|
<el-form-item label="项目名称" prop="proName">
|
<el-input v-model="queryParams.proName" 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="['hosp:contrast: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="['hosp:contrast: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="['hosp:contrast: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="['hosp:contrast:export']">导出
|
</el-button>
|
</el-col> -->
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
</el-row>
|
|
<el-table v-loading="loading" :data="contrastList" @selection-change="handleSelectionChange" border>
|
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column label="序号" align="center" prop="id" />
|
<el-table-column label="项目编码" align="center" prop="proId" />
|
<el-table-column label="项目名称" align="center" prop="proName" />
|
<el-table-column label="是否对比" align="center" prop="isContrast">
|
<template slot-scope="scope">
|
<el-switch v-model="scope.row.isContrast" active-value="1" inactive-value="0"
|
@change="handleStatusChange(scope.row)"></el-switch>
|
</template>
|
</el-table-column>
|
<!-- 0是1否 -->
|
<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="['hosp:contrast:edit']">修改
|
</el-button> -->
|
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
v-hasPermi="['hosp:contrast:remove']">删除
|
</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
|
|
<div class="pag">
|
<div class="pag1">
|
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
|
:limit.sync="queryParams.pageSize" @pagination="getList" />
|
</div>
|
</div>
|
|
<!-- 添加或修改体检项目对比对话框 -->
|
<el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body >
|
<el-table v-loading="loading" :data="dataList" @selection-change="handleSelectionChange1" border height="400">
|
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column label="项目编码" align="center" prop="proId" />
|
<el-table-column label="项目名称" align="center" prop="proName" />
|
<!-- <el-table-column label="是否对比" align="center" prop="isContrast">
|
<template slot-scope="scope">
|
<el-switch v-model="scope.row.isContrast" active-value="0" inactive-value="1"
|
@change="handleStatusChange(scope.row)"></el-switch>
|
</template>
|
</el-table-column> -->
|
</el-table>
|
|
|
<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>
|
|
<script>
|
import {
|
listContrast,
|
getContrast,
|
delContrast,
|
addContrast,
|
updateContrast,
|
getTjProContrast
|
} from "@/api/hosp/contrast";
|
|
export default {
|
name: "Contrast",
|
data() {
|
return {
|
// 遮罩层
|
loading: true,
|
// 选中数组
|
ids: [],
|
// 非单个禁用
|
single: true,
|
// 非多个禁用
|
multiple: true,
|
// 显示搜索条件
|
showSearch: true,
|
// 总条数
|
total: 0,
|
// 体检项目对比表格数据
|
contrastList: [],
|
dataList:[],
|
selectionList:[],
|
// 弹出层标题
|
title: "",
|
// 是否显示弹出层
|
open: false,
|
// 查询参数
|
queryParams: {
|
pageNum: 1,
|
pageSize: 10,
|
proId: null,
|
proName: null,
|
},
|
// 表单参数
|
form: {},
|
// 表单校验
|
rules: {
|
}
|
};
|
},
|
created() {
|
this.getList();
|
},
|
methods: {
|
/** 查询体检项目对比列表 */
|
getList() {
|
this.loading = true;
|
listContrast(this.queryParams).then(response => {
|
this.contrastList = response.rows;
|
this.total = response.total;
|
this.loading = false;
|
});
|
},
|
// 取消按钮
|
cancel() {
|
this.open = false;
|
this.reset();
|
},
|
// 表单重置
|
reset() {
|
this.form = {
|
id: null,
|
proId: null,
|
proName: null,
|
createBy: null,
|
createTime: null,
|
updateBy: null,
|
updateTime: null,
|
deleted: 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
|
},
|
|
// 多选框选中数据
|
handleSelectionChange1(selection) {
|
this.selectionList = selection
|
},
|
|
/** 新增按钮操作 */
|
handleAdd() {
|
this.reset();
|
getTjProContrast().then(res =>{
|
this.dataList = res.data
|
})
|
this.open = true;
|
this.title = "添加体检项目对比";
|
},
|
/** 修改按钮操作 */
|
handleUpdate(row) {
|
this.reset();
|
const id = row.id || this.ids
|
getContrast(id).then(response => {
|
this.form = response.data;
|
this.open = true;
|
this.title = "修改体检项目对比";
|
});
|
},
|
|
// 是否启用
|
handleStatusChange(row) {
|
let data = {
|
id: row.id,
|
proId: row.proId,
|
isContrast: row.isContrast,
|
}
|
let text = row.isContrast === "1" ? "启用" : "停用";
|
this.$confirm("确认要" + text + row.proName + "套餐吗?")
|
.then(function () {
|
return updateContrast(data).then((res) => {
|
if (res.code == 200) {
|
this.getList()
|
this.msgSuccess(text + "成功")
|
|
}
|
|
});
|
})
|
.catch(function () {
|
row.isContrast = row.isContrast === "0" ? "0" : "1";
|
});
|
},
|
/** 提交按钮 */
|
submitForm() {
|
let data = []
|
data = this.selectionList
|
addContrast(data).then(res =>{
|
this.$modal.msgSuccess("新增成功");
|
this.open = false;
|
})
|
},
|
/** 删除按钮操作 */
|
handleDelete(row) {
|
const id = row.id || this.ids;
|
this.$modal
|
.confirm('是否确认删除项目信息编号为"' + id + '"的数据项?')
|
.then(function () {
|
return delContrast(id);
|
})
|
.then(() => {
|
this.getList();
|
this.$modal.msgSuccess("删除成功");
|
})
|
.catch(() => { });
|
|
|
},
|
|
/** 导出按钮操作 */
|
handleExport() {
|
|
},
|
}
|
}
|
|
</script>
|
|
|
<style scoped>
|
.pag {
|
width: 100%;
|
display: flex;
|
justify-content: center;
|
}
|
|
.pag1 {
|
width: 30%;
|
}
|
</style>
|