<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="cusName">
|
<el-input v-model="queryParams.cusName" placeholder="请输入姓名" clearable style="width:120px" @keyup.enter.native="handleQuery"/>
|
</el-form-item>
|
<el-form-item label="联系电话" prop="cusPhone">
|
<el-input v-model="queryParams.cusPhone" placeholder="请输入联系电话" style="width:140px" clearable @keyup.enter.native="handleQuery"/>
|
</el-form-item>
|
<el-form-item label="身份证号" prop="cusIdcard">
|
<el-input
|
v-model="queryParams.cusIdcard"
|
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"
|
icon="el-icon-plus"
|
size="mini"
|
@click="handleAdd"
|
v-hasPermi="['hosp:customer:add']"
|
>批量恢复</el-button
|
>
|
</el-col>
|
</el-row>
|
|
<el-table
|
border
|
v-loading="loading"
|
:data="customerList"
|
@selection-change="handleSelectionChange"
|
|
>
|
<el-table-column type="selection" width="40px" align="center" fixed="left" />
|
<el-table-column
|
label="序号"
|
align="center"
|
prop="newID"
|
fixed="left"
|
:show-overflow-tooltip="true"
|
width="50px"
|
/>
|
<el-table-column
|
label="姓名"
|
align="center"
|
prop="cusName"
|
width="90px"
|
fixed="left"
|
:show-overflow-tooltip="true"
|
/>
|
<el-table-column
|
label="性别"
|
align="center"
|
prop="cusSex"
|
:show-overflow-tooltip="true"
|
width="60px"
|
>
|
<template slot-scope="scope">
|
<dict-tag
|
:options="dict.type.sys_user_sex"
|
:value="scope.row.cusSex"
|
/>
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="出生日期"
|
align="center"
|
prop="cusBrithday"
|
width="100px"
|
:show-overflow-tooltip="true"
|
>
|
<template slot-scope="scope">
|
<span>{{ parseTime(scope.row.cusBrithday, "{y}-{m}-{d}") }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="身份证号"
|
align="center"
|
prop="cusIdcard"
|
width="170px"
|
:show-overflow-tooltip="true"
|
/>
|
<el-table-column
|
label="联系电话"
|
align="center"
|
prop="cusPhone"
|
width="110px"
|
:show-overflow-tooltip="true"
|
/>
|
<el-table-column
|
label="现住址"
|
align="center"
|
prop="cusAddr"
|
width="180px"
|
:show-overflow-tooltip="true"
|
/>
|
|
<el-table-column
|
label="邮政编码"
|
align="center"
|
prop="cusPostcode"
|
width="80px"
|
:show-overflow-tooltip="true"
|
/>
|
<el-table-column
|
label="邮箱"
|
align="center"
|
prop="cusEmail"
|
width="170px"
|
:show-overflow-tooltip="true"
|
/>
|
<el-table-column
|
label="民族"
|
align="center"
|
prop="cusNational"
|
width="80px"
|
:show-overflow-tooltip="true"
|
>
|
<template slot-scope="scope">
|
<dict-tag
|
:options="dict.type.dict_user_national"
|
:value="scope.row.cusNational"
|
/>
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="婚姻状况"
|
align="center"
|
prop="cusMarryStatus"
|
:show-overflow-tooltip="true"
|
width="80px"
|
>
|
<template slot-scope="scope">
|
<dict-tag
|
:options="dict.type.dict_user_marry"
|
:value="scope.row.cusMarryStatus"
|
/>
|
</template>
|
</el-table-column>
|
|
<el-table-column
|
label="介绍人"
|
align="center"
|
prop="cusIntroduce"
|
width="90px"
|
:show-overflow-tooltip="true"
|
/>
|
<el-table-column
|
label="次数"
|
align="center"
|
prop="cusNumber"
|
width="55px"
|
:show-overflow-tooltip="true"
|
/>
|
<el-table-column
|
label="VIP"
|
align="center"
|
prop="cusIsvip"
|
width="55px"
|
:show-overflow-tooltip="true"
|
>
|
<template slot-scope="scope">
|
<dict-tag
|
:options="dict.type.sys_yes_no"
|
:value="scope.row.cusIsvip"
|
/>
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="索引卡号"
|
align="center"
|
prop="indexCard"
|
:show-overflow-tooltip="true"
|
/>
|
<el-table-column
|
fixed="right"
|
label="操作"
|
align="center"
|
width="70px"
|
class-name="small-padding fixed-width"
|
>
|
<template slot-scope="scope">
|
<el-button
|
size="mini"
|
type="text"
|
icon="el-icon-refresh-left"
|
@click="handleUpdate(scope.row)"
|
v-hasPermi="['hosp:customer:edit']"
|
title="恢复"
|
></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-form
|
ref="form"
|
:model="form"
|
:rules="rules"
|
label-width="100px"
|
:inline="true"
|
>
|
<el-form-item label="姓名" prop="cusName">
|
<el-input
|
v-model="form.cusName"
|
placeholder="请输入姓名"
|
style="width: 200px"
|
/>
|
</el-form-item>
|
<el-form-item label="性别" prop="cusSex">
|
<el-select
|
v-model="form.cusSex"
|
placeholder="请选择性别"
|
style="width: 200px"
|
>
|
<el-option
|
v-for="dict in dict.type.sys_user_sex"
|
:key="dict.value"
|
:label="dict.label"
|
:value="parseInt(dict.value)"
|
></el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="身份证号" prop="cusIdcard">
|
<el-input
|
v-model="form.cusIdcard"
|
placeholder="请输入身份证号"
|
style="width: 200px"
|
/>
|
</el-form-item>
|
<el-form-item label="出生日期" prop="cusBrithday">
|
<el-date-picker
|
clearable
|
v-model="form.cusBrithday"
|
type="date"
|
value-format="yyyy-MM-dd"
|
placeholder="请选择出生日期"
|
style="width: 200px"
|
>
|
</el-date-picker>
|
</el-form-item>
|
<el-form-item label="现住址" prop="cusAddr">
|
<el-input
|
v-model="form.cusAddr"
|
placeholder="请输入现居住地址"
|
style="width: 200px"
|
/>
|
</el-form-item>
|
<el-form-item label="联系电话" prop="cusPhone">
|
<el-input
|
v-model="form.cusPhone"
|
placeholder="请输入联系电话"
|
style="width: 200px"
|
/>
|
</el-form-item>
|
<!-- <el-form-item label="账号密码" prop="cusPassword">
|
<el-input v-model="form.cusPassword" placeholder="请输入账号密码" style="width: 220px" />
|
</el-form-item> -->
|
<!-- <el-form-item label="邮政编码" prop="cusPostcode">
|
<el-input v-model="form.cusPostcode" placeholder="请输入邮政编码" />
|
</el-form-item> -->
|
<el-form-item label="邮箱" prop="cusEmail">
|
<el-input
|
v-model="form.cusEmail"
|
placeholder="请输入邮箱"
|
style="width: 200px"
|
/>
|
</el-form-item>
|
<!-- <el-form-item label="索引卡号" prop="indexCard">
|
<el-input v-model="form.indexCard" placeholder="请输入索引卡号" style="width: 220px" />
|
</el-form-item> -->
|
<el-form-item label="民族" prop="cusNational">
|
<el-select
|
v-model="form.cusNational"
|
placeholder="请选择民族"
|
style="width: 200px"
|
filterable
|
>
|
<el-option
|
v-for="dict in dict.type.dict_user_national"
|
:key="dict.value"
|
:label="dict.label"
|
:value="dict.value"
|
></el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="婚姻状况" prop="cusMarryStatus">
|
<el-select
|
v-model="form.cusMarryStatus"
|
placeholder="请选择婚姻状况"
|
style="width: 200px"
|
>
|
<el-option
|
v-for="dict in dict.type.dict_user_marry"
|
:key="dict.value"
|
:label="dict.label"
|
:value="dict.value"
|
></el-option>
|
</el-select>
|
</el-form-item>
|
|
<el-form-item label="介绍人" prop="cusIntroduce">
|
<el-input
|
v-model="form.cusIntroduce"
|
placeholder="请输入介绍人"
|
style="width: 200px"
|
/>
|
</el-form-item>
|
<el-form-item label="是否VIP" prop="cusIsvip">
|
<el-select
|
v-model="form.cusIsvip"
|
placeholder="请选择是否VIP"
|
style="width: 200px"
|
>
|
<el-option
|
v-for="dict in dict.type.sys_yes_no"
|
:key="dict.value"
|
:label="dict.label"
|
:value="dict.value"
|
></el-option>
|
</el-select>
|
</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>
|
|
<script>
|
import {
|
listCustomer,
|
getCustomer,
|
delCustomer,
|
addCustomer,
|
updateCustomer,
|
} from "@/api/hosp/customer";
|
|
export default {
|
name: "Customer",
|
dicts: [
|
"dict_user_national",
|
"dict_user_marry",
|
"sys_yes_no",
|
"sys_user_sex",
|
],
|
data() {
|
return {
|
// 遮罩层
|
loading: true,
|
// 选中数组
|
ids: [],
|
// 非单个禁用
|
single: true,
|
// 非多个禁用
|
multiple: true,
|
// 显示搜索条件
|
showSearch: true,
|
// 总条数
|
total: 0,
|
// 信息表格数据
|
customerList: [],
|
// 弹出层标题
|
title: "",
|
// 是否显示弹出层
|
open: false,
|
// 查询参数
|
queryParams: {
|
pageNum: 1,
|
pageSize: 10,
|
cusName: null,
|
cusSex: null,
|
cusBrithday: null,
|
cusAddr: null,
|
cusPhone: null,
|
cusPostcode: null,
|
cusEmail: null,
|
indexCard: null,
|
cusNational: null,
|
cusMarryStatus: null,
|
cusIdcard: null,
|
cusIntroduce: null,
|
cusNumber: null,
|
cusIsvip: null,
|
},
|
// 表单参数
|
form: {},
|
// 表单校验
|
rules: {
|
cusName: [{ required: true, message: "姓名不能为空", trigger: "blur" }],
|
cusSex: [
|
{ required: true, message: "性别不能为空", trigger: "change" },
|
],
|
cusBrithday: [
|
{ required: true, message: "出生日期不能为空", trigger: "blur" },
|
],
|
cusAddr: [
|
{ required: true, message: "现居住地址不能为空", trigger: "blur" },
|
],
|
cusPhone: [
|
{ required: true, message: "联系电话不能为空", trigger: "blur" },
|
],
|
cusPassword: [
|
{ required: true, message: "账号密码不能为空", trigger: "blur" },
|
],
|
// cusNational: [
|
// { required: true, message: "民族不能为空", trigger: "change" }
|
// ],
|
cusIdcard: [
|
{ required: true, message: "身份证号不能为空", trigger: "blur" },
|
],
|
deleted: [
|
{ required: true, message: "删除标志不能为空", trigger: "blur" },
|
],
|
},
|
};
|
},
|
created() {
|
this.getList();
|
},
|
methods: {
|
/** 查询信息列表 */
|
getList() {
|
this.loading = true;
|
listCustomer(this.queryParams).then((response) => {
|
this.customerList = response.rows;
|
response.rows.forEach((item, index) => {
|
item.newID =
|
(this.queryParams.pageNum - 1) * this.queryParams.pageSize +
|
index +
|
1;
|
});
|
this.total = response.total;
|
this.loading = false;
|
});
|
},
|
// 取消按钮
|
cancel() {
|
this.open = false;
|
this.reset();
|
},
|
// 表单重置
|
reset() {
|
this.form = {
|
cusId: null,
|
cusName: null,
|
cusSex: null,
|
cusBrithday: null,
|
cusAddr: null,
|
cusPhone: null,
|
cusPassword: null,
|
cusPostcode: null,
|
cusEmail: null,
|
indexCard: null,
|
cusNational: null,
|
cusMarryStatus: null,
|
cusIdcard: null,
|
cusIntroduce: null,
|
cusNumber: null,
|
cusIsvip: 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.cusId);
|
this.single = selection.length !== 1;
|
this.multiple = !selection.length;
|
},
|
/** 新增按钮操作 */
|
handleAdd() {
|
this.reset();
|
this.open = true;
|
this.title = "客户信息维护";
|
},
|
/** 修改按钮操作 */
|
handleUpdate(row) {
|
this.reset();
|
const cusId = row.cusId || this.ids;
|
getCustomer(cusId).then((response) => {
|
this.form = response.data;
|
this.open = true;
|
this.title = "客户信息维护";
|
});
|
},
|
/** 提交按钮 */
|
submitForm() {
|
this.$refs["form"].validate((valid) => {
|
if (valid) {
|
if (this.form.cusId != null) {
|
updateCustomer(this.form).then((response) => {
|
this.$modal.msgSuccess("修改成功");
|
this.open = false;
|
this.getList();
|
});
|
} else {
|
addCustomer(this.form).then((response) => {
|
this.$modal.msgSuccess("新增成功");
|
this.open = false;
|
this.getList();
|
});
|
}
|
}
|
});
|
},
|
/** 删除按钮操作 */
|
handleDelete(row) {
|
const cusIds = row.cusId || this.ids;
|
this.$modal
|
.confirm('是否确认删除信息编号为"' + cusIds + '"的数据项?')
|
.then(function () {
|
return delCustomer(cusIds);
|
})
|
.then(() => {
|
this.getList();
|
this.$modal.msgSuccess("删除成功");
|
})
|
.catch(() => {});
|
},
|
/** 导出按钮操作 */
|
handleExport() {
|
this.download(
|
"hosp/order/export",
|
{
|
...this.queryParams,
|
},
|
`customer_${new Date().getTime()}.xlsx`
|
);
|
},
|
},
|
};
|
</script>
|
<style scoped>
|
.pag {
|
width: 100%;
|
display: flex;
|
justify-content: center;
|
}
|
.pag1 {
|
width: 30%;
|
}
|
|
.dialog-footer {
|
display: flex;
|
justify-content: center;
|
}
|
</style>
|
|