lanan-system-vue/src/views/rescue/customerIndex.vue

418 lines
13 KiB
Vue
Raw Normal View History

2024-08-16 13:46:48 +08:00
<template>
<el-row>
<el-col :span="4">
<div class="left-box">
<div class="title-h">公司机构</div>
<div class="xzbox">
2024-08-20 18:57:23 +08:00
<span>当前选择{{ xtitle }}</span>
2024-08-16 13:46:48 +08:00
</div>
<el-input
placeholder="请输入机构名称查询"
2024-08-20 18:57:23 +08:00
v-model="filterText"
>
2024-08-16 13:46:48 +08:00
</el-input>
<el-tree :data="Thetree"
:props="defaultProps"
node-key="id"
2024-08-19 19:13:26 +08:00
ref="tree"
2024-08-16 13:46:48 +08:00
:default-expanded-keys="[200, 201]"
:default-checked-keys="[206]"
2024-08-20 18:57:23 +08:00
@node-click="handleNodeClick"
:filter-node-method="filterNode"
></el-tree>
2024-08-16 13:46:48 +08:00
</div>
</el-col>
2024-08-20 18:57:23 +08:00
<el-col :span="20">
<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="customerName">
<el-input
v-model="queryParams.customerName"
placeholder="请输入客户名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="手机号" prop="customerPhone">
<el-input
v-model="queryParams.customerPhone"
placeholder="请输入手机号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
2024-08-16 13:46:48 +08:00
2024-08-20 18:57:23 +08:00
<el-form-item label="开始日期" prop="signStartDate">
<el-date-picker clearable
v-model="queryParams.signStartDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择签约开始日期"
>
</el-date-picker>
</el-form-item>
<el-form-item label="结束日期" prop="signEndDate">
<el-date-picker clearable
v-model="queryParams.signEndDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择签约结束日期"
>
</el-date-picker>
</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>
2024-08-16 13:46:48 +08:00
2024-08-20 18:57:23 +08:00
<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>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
2024-08-16 13:46:48 +08:00
2024-08-20 18:57:23 +08:00
<el-table v-loading="loading" :data="rescueCustomerList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<!-- <el-table-column label="主键" align="center" prop="id" />-->
<el-table-column label="客户名称" align="center" prop="customerName"/>
<el-table-column label="客户手机号" align="center" prop="customerPhone"/>
<el-table-column label="客户公司" align="center" prop="deptName"/>
<el-table-column label="签约开始日期" align="center" prop="signStartDate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.signStartDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="签约结束日期" align="center" prop="signEndDate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.signEndDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="默认救援类型" align="center" prop="defaultRescueType">-->
<!-- <template slot-scope="scope">-->
<!-- <dict-tag :options="dict.type.dljy_type" :value="scope.row.defaultRescueType"/>-->
<!-- </template>-->
<!-- </el-table-column>-->
<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)"
>修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
2024-08-16 13:46:48 +08:00
2024-08-20 18:57:23 +08:00
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
2024-08-16 13:46:48 +08:00
2024-08-20 18:57:23 +08:00
<!-- 添加或修改救援的客户信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
2024-08-16 13:46:48 +08:00
2024-08-20 18:57:23 +08:00
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="客户公司" prop="customerDeptId">
2024-08-16 13:46:48 +08:00
2024-08-20 18:57:23 +08:00
<span style="font-weight: bold; font-size: 16px">{{ form.deptName || xtitle }}</span>
</el-form-item>
<el-form-item label="客户名称" prop="customerName">
<el-input v-model="form.customerName" placeholder="请输入客户名称"/>
</el-form-item>
<el-form-item label="客户手机号" prop="customerPhone">
<el-input v-model="form.customerPhone" placeholder="请输入客户手机号"/>
</el-form-item>
<el-form-item label="单号前缀" prop="orderPrefix">
<el-input v-model="form.orderPrefix" placeholder="请输入单号前缀"/>
</el-form-item>
<el-form-item label="签约开始日期" prop="signStartDate">
<el-date-picker clearable
v-model="form.signStartDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择签约开始日期"
>
</el-date-picker>
</el-form-item>
<el-form-item label="签约结束日期" prop="signEndDate">
<el-date-picker clearable
v-model="form.signEndDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择签约结束日期"
>
</el-date-picker>
</el-form-item>
2024-08-16 13:46:48 +08:00
2024-08-20 18:57:23 +08:00
<!-- <el-form-item label="默认救援类型" prop="defaultRescueType">-->
<!-- <el-select v-model="form.defaultRescueType" placeholder="请选择默认救援类型">-->
<!-- <el-option-->
<!-- v-for="dict in dict.type.dljy_type"-->
<!-- :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>
2024-08-16 13:46:48 +08:00
</div>
</el-col>
</el-row>
</template>
<script>
2024-08-20 18:57:23 +08:00
import {
listRescueCustomer,
getRescueCustomer,
delRescueCustomer,
addRescueCustomer,
updateRescueCustomer,
getdeptTree
} from './api/rescueCustomer'
2024-08-16 13:46:48 +08:00
export default {
2024-08-20 18:57:23 +08:00
name: 'RescueCustomer',
2024-08-16 13:46:48 +08:00
dicts: ['dljy_type'],
data() {
return {
2024-08-20 18:57:23 +08:00
filterText: '',
2024-08-16 13:46:48 +08:00
defaultProps: {
children: 'children',
2024-08-19 19:13:26 +08:00
label: 'name'
2024-08-16 13:46:48 +08:00
},
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 救援的客户信息表格数据
rescueCustomerList: [],
// 弹出层标题
2024-08-20 18:57:23 +08:00
title: '',
xtitle: '',
xid: '',
2024-08-16 13:46:48 +08:00
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNo: 1,
pageSize: 10,
customerName: null,
customerPhone: null,
customerDeptId: null,
signStartDate: null,
signEndDate: null,
2024-08-20 18:57:23 +08:00
defaultRescueType: null
2024-08-16 13:46:48 +08:00
},
2024-08-20 18:57:23 +08:00
Thetree: [],
2024-08-16 13:46:48 +08:00
// 表单参数
form: {},
// 表单校验
rules: {
customerName: [
2024-08-20 18:57:23 +08:00
{ required: true, message: '不能为空', trigger: 'blur' }
2024-08-16 13:46:48 +08:00
],
customerPhone: [
2024-08-20 18:57:23 +08:00
{ required: true, message: '不能为空', trigger: 'blur' }
2024-08-16 13:46:48 +08:00
],
orderPrefix: [
2024-08-20 18:57:23 +08:00
{ required: true, message: '不能为空', trigger: 'blur' }
]
}
}
2024-08-16 13:46:48 +08:00
},
created() {
2024-08-20 18:57:23 +08:00
this.getList()
2024-08-16 13:46:48 +08:00
},
watch: {
filterText(val) {
2024-08-20 18:57:23 +08:00
this.$refs.tree.filter(val)
2024-08-16 13:46:48 +08:00
}
},
methods: {
2024-08-20 18:57:23 +08:00
filterNode(value, data) {
if (!value) return true
return data.name.indexOf(value) !== -1
2024-08-16 13:46:48 +08:00
},
handleNodeClick(data) {
2024-08-20 18:57:23 +08:00
this.xid = data.id
2024-08-19 19:13:26 +08:00
this.xtitle = data.name
2024-08-16 13:46:48 +08:00
},
/** 查询救援的客户信息列表 */
getList() {
2024-08-20 18:57:23 +08:00
this.loading = true
2024-08-16 13:46:48 +08:00
listRescueCustomer(this.queryParams).then(response => {
2024-08-20 18:57:23 +08:00
this.rescueCustomerList = response.data.records
this.total = response.data.total
this.loading = false
})
getdeptTree().then(res => {
2024-08-19 19:13:26 +08:00
this.Thetree = this.handleTree(res.data, 'id')
2024-08-16 13:46:48 +08:00
})
},
// 取消按钮
cancel() {
2024-08-20 18:57:23 +08:00
this.open = false
this.reset()
2024-08-16 13:46:48 +08:00
},
// 表单重置
reset() {
this.form = {
id: null,
customerName: null,
customerPhone: null,
customerDeptId: null,
signStartDate: null,
signEndDate: null,
orderPrefix: null,
defaultRescueType: null,
deptId: null,
createTime: null,
createBy: null,
updateTime: null,
updateBy: null
2024-08-20 18:57:23 +08:00
}
this.resetForm('form')
2024-08-16 13:46:48 +08:00
},
/** 搜索按钮操作 */
handleQuery() {
2024-08-20 18:57:23 +08:00
this.queryParams.pageNo = 1
this.getList()
2024-08-16 13:46:48 +08:00
},
/** 重置按钮操作 */
resetQuery() {
2024-08-20 18:57:23 +08:00
this.resetForm('queryForm')
this.handleQuery()
2024-08-16 13:46:48 +08:00
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
2024-08-20 18:57:23 +08:00
this.single = selection.length !== 1
2024-08-16 13:46:48 +08:00
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
2024-08-20 18:57:23 +08:00
if (this.xtitle == '') {
this.$modal.msgSuccess('请先选择部门')
2024-08-16 13:46:48 +08:00
return
}
2024-08-20 18:57:23 +08:00
this.reset()
this.open = true
this.title = '添加客户信息'
2024-08-16 13:46:48 +08:00
this.form.customerDeptId = this.xid
},
/** 修改按钮操作 */
handleUpdate(row) {
2024-08-20 18:57:23 +08:00
this.reset()
2024-08-16 13:46:48 +08:00
const id = row.id || this.ids
getRescueCustomer(id).then(response => {
2024-08-20 18:57:23 +08:00
this.form = response.data
this.open = true
this.title = '修改救援的客户信息'
})
2024-08-16 13:46:48 +08:00
},
/** 提交按钮 */
submitForm() {
2024-08-20 18:57:23 +08:00
this.$refs['form'].validate(valid => {
2024-08-16 13:46:48 +08:00
if (valid) {
if (this.form.id != null) {
updateRescueCustomer(this.form).then(response => {
2024-08-20 18:57:23 +08:00
this.$modal.msgSuccess('修改成功')
this.open = false
this.getList()
})
2024-08-16 13:46:48 +08:00
} else {
addRescueCustomer(this.form).then(response => {
2024-08-20 18:57:23 +08:00
this.$modal.msgSuccess('新增成功')
this.open = false
this.getList()
})
2024-08-16 13:46:48 +08:00
}
}
2024-08-20 18:57:23 +08:00
})
2024-08-16 13:46:48 +08:00
},
/** 删除按钮操作 */
handleDelete(row) {
2024-08-20 18:57:23 +08:00
const ids = row.id || this.ids
2024-08-16 13:46:48 +08:00
this.$modal.confirm('是否确认删除救援的客户信息编号为"' + ids + '"的数据项?').then(function() {
2024-08-20 18:57:23 +08:00
return delRescueCustomer(ids)
2024-08-16 13:46:48 +08:00
}).then(() => {
2024-08-20 18:57:23 +08:00
this.getList()
this.$modal.msgSuccess('删除成功')
}).catch(() => {
})
2024-08-16 13:46:48 +08:00
},
/** 导出按钮操作 */
handleExport() {
this.download('rescueCustomer/rescueCustomer/export', {
...this.queryParams
}, `rescueCustomer_${new Date().getTime()}.xlsx`)
}
}
2024-08-20 18:57:23 +08:00
}
2024-08-16 13:46:48 +08:00
</script>
<style>
2024-08-20 18:57:23 +08:00
.left-box {
box-sizing: border-box;
padding: 15px;
}
2024-08-16 13:46:48 +08:00
2024-08-20 18:57:23 +08:00
.title-h {
font-size: 18px;
font-weight: 600;
margin-bottom: 20px;
}
.xzbox {
width: 100%;
margin: 5px auto;
border-radius: 8px;
height: 40px;
box-sizing: border-box;
padding: 0px 10px;
display: flex;
align-items: center;
color: #409EFF;
/*background: #99a9bf;*/
}
2024-08-16 13:46:48 +08:00
</style>