Merge branch 'master' of http://122.51.230.86:3000/dianliang/lanan-system-vue
This commit is contained in:
commit
29bf3c4f56
@ -34,6 +34,14 @@ export function getCarMain(id) {
|
||||
})
|
||||
}
|
||||
|
||||
export function bindCustomerCar(data) {
|
||||
return request({
|
||||
url: '/base/carMain/bindCustomerCar',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 获得车辆信息分页
|
||||
export function getCarMainPage(params) {
|
||||
return request({
|
||||
|
@ -17,6 +17,14 @@ export function bindCustomerCar(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export function setLabelList(data) {
|
||||
return request({
|
||||
url: '/base/custom/setLabel',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 更新客户管理
|
||||
export function updateCustomerMain(data) {
|
||||
return request({
|
||||
|
104
src/layout/components/CarBrandSelector/index.vue
Normal file
104
src/layout/components/CarBrandSelector/index.vue
Normal file
@ -0,0 +1,104 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-cascader
|
||||
:options="options"
|
||||
:props="cascaderProps"
|
||||
v-model="selectedOptions"
|
||||
@visible-change="handleVisibleChange"
|
||||
:filter-method="handleFilter"
|
||||
placeholder="请选择"
|
||||
filterable
|
||||
:show-all-levels="false"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
placeholder: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
options: [], // 存储级联选项数据
|
||||
selectedOptions: [], // 存储已选择的选项
|
||||
loading: false, // 标志是否在加载数据
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
cascaderProps() {
|
||||
return {
|
||||
lazy: true, // 启用懒加载
|
||||
lazyLoad: this.loadData, // 懒加载方法
|
||||
value: 'value',
|
||||
label: 'label',
|
||||
children: 'children',
|
||||
emitPath: false,
|
||||
multiple: false // 多选模式
|
||||
};
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// 当可见状态变化时触发
|
||||
handleVisibleChange(visible) {
|
||||
if (visible && this.options.length === 0) {
|
||||
this.loadData(null, [], (options) => {
|
||||
this.options = options;
|
||||
});
|
||||
}
|
||||
},
|
||||
// 懒加载数据方法
|
||||
loadData(node, resolve) {
|
||||
if (node) {
|
||||
// 模拟异步加载子节点数据
|
||||
setTimeout(() => {
|
||||
const children = [
|
||||
{ value: 'child1', label: '子节点 1' },
|
||||
{ value: 'child2', label: '子节点 2' },
|
||||
];
|
||||
resolve(children);
|
||||
}, 100);
|
||||
} else {
|
||||
// 模拟异步加载根节点数据
|
||||
setTimeout(() => {
|
||||
const root = [
|
||||
{ value: 'root1', label: '根节点 1' },
|
||||
{ value: 'root2', label: '根节点 2' },
|
||||
];
|
||||
resolve(root);
|
||||
}, 100);
|
||||
}
|
||||
},
|
||||
// 处理过滤方法
|
||||
handleFilter(inputValue, path) {
|
||||
console.log('Filtering:', inputValue);
|
||||
// 模拟请求
|
||||
setTimeout(() => {
|
||||
const filteredOptions = [
|
||||
{
|
||||
value: 'filtered1',
|
||||
label: `Filtered ${inputValue} 1`,
|
||||
children: [
|
||||
{ value: 'filtered1-1', label: `Filtered ${inputValue} 1-1` },
|
||||
{ value: 'filtered1-2', label: `Filtered ${inputValue} 1-2` },
|
||||
],
|
||||
},
|
||||
{
|
||||
value: 'filtered2',
|
||||
label: `Filtered ${inputValue} 2`,
|
||||
children: [
|
||||
{ value: 'filtered2-1', label: `Filtered ${inputValue} 2-1` },
|
||||
{ value: 'filtered2-2', label: `Filtered ${inputValue} 2-2` },
|
||||
],
|
||||
},
|
||||
];
|
||||
this.options = filteredOptions;
|
||||
}, 1000); // 模拟延迟
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
@ -57,7 +57,11 @@
|
||||
}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="车标图片" align="center" prop="logoImg" />
|
||||
<el-table-column label="车标图片" align="center" prop="logoImg" >
|
||||
<template v-slot="scope">
|
||||
<el-image style="width: 7rem; height: 7rem" :preview-src-list="[scope.row.logoImg]" :src="scope.row.logoImg" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="品牌名称" align="center" prop="brandName">
|
||||
<template v-slot="scope">
|
||||
<router-link class="link-type" @click="routeToData" :to="'car-model' + '?brandId=' + scope.row.id">
|
||||
|
@ -71,6 +71,7 @@
|
||||
<el-button type="primary" @click="submitForm" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</div>
|
||||
<CarBrandSelector/>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
@ -78,11 +79,13 @@
|
||||
<script>
|
||||
import * as CarMainApi from '@/api/base/carmain';
|
||||
import ImageUpload from '@/components/ImageUpload';
|
||||
import {getDictDatas, DICT_TYPE} from '@/utils/dict'
|
||||
import {getDictDatas, DICT_TYPE} from '@/utils/dict';
|
||||
import CarBrandSelector from '@/layout/components/CarBrandSelector';
|
||||
export default {
|
||||
name: "CarMainForm",
|
||||
components: {
|
||||
ImageUpload,
|
||||
CarBrandSelector,
|
||||
|
||||
},
|
||||
data() {
|
||||
|
267
src/views/base/carmain/components/ChooseCustomerDraw.vue
Normal file
267
src/views/base/carmain/components/ChooseCustomerDraw.vue
Normal file
@ -0,0 +1,267 @@
|
||||
<template>
|
||||
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<el-drawer title="选择车辆" size="60%" :visible.sync="drawVisible" @close="cancelForm">
|
||||
<div style="padding: 0 10px;margin-bottom: 70px">
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
|
||||
<el-form-item label="客户名称" prop="cusName" label-width="80">
|
||||
<el-input v-model="queryParams.cusName" placeholder="请输入客户名称" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="联系方式" prop="phoneNumber" label-width="90">
|
||||
<el-input v-model="queryParams.phoneNumber" placeholder="请输入联系方式" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="身份证号" prop="idCard" label-width="90">
|
||||
<el-input v-model="queryParams.idCard" placeholder="请输入身份证号" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="发动机号" prop="engineNumber" label-width="90">
|
||||
<el-input v-model="queryParams.engineNumber" placeholder="请输入发动机号" clearable
|
||||
@keyup.enter.native="handleQuery"/>
|
||||
</el-form-item> -->
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 操作工具栏 -->
|
||||
<el-row>
|
||||
<el-col :span="3">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="openForm(undefined)"
|
||||
v-hasPermi="['base:car-main:create']">新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="3" v-for="cusItem in multipleSelection" :key="cusItem.id" class="el-col-item">
|
||||
<el-tag :key="cusItem.id" type="danger" @close="tagClose(cusItem)" closable>
|
||||
{{ cusItem.cusName }}
|
||||
</el-tag>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table ref="multipleTable" height="460" v-loading="formLoading" :data="list" :stripe="true" @select="selectRow"
|
||||
@select-all="handleSelectAll" :show-overflow-tooltip="true">
|
||||
<el-table-column type="selection" width="55">
|
||||
</el-table-column>
|
||||
<el-table-column label="姓名" align="center" prop="cusName" />
|
||||
<el-table-column width="80" label="性别" align="center" prop="sex">
|
||||
<template v-slot="scope">
|
||||
<dict-tag :type="DICT_TYPE.DICT_SYS_USER_SEX" :value="scope.row.sex" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="150" label="联系方式" align="center" prop="phoneNumber" />
|
||||
<el-table-column width="150" label="生日" align="center" prop="birthday">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.birthday, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="150" label="最近办理业务" align="center" prop="nearDoContent">
|
||||
<template v-slot="scope">
|
||||
<dict-tag :type="DICT_TYPE.DICT_CUS_BUSI_TYPE" :value="scope.row.nearDoContent" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList" />
|
||||
</div>
|
||||
<div
|
||||
style="position: absolute;bottom: 0;width: 100%;right: 0;padding: 5px 20px 0;z-index: 999;background: white;text-align: right">
|
||||
<div class="demo-drawer__footer">
|
||||
<el-button @click="cancelForm">取 消</el-button>
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<CustomerMainForm ref="formRef" @success="getList"/>
|
||||
|
||||
</el-drawer>
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as CustomerMainApi from '@/api/base/customer';
|
||||
import * as CarMainApi from '@/api/base/carmain';
|
||||
import CustomerMainForm from '@/views/base/customer/CustomerMainForm.vue';
|
||||
export default {
|
||||
name: "ChooseCarDraw",
|
||||
components: { CustomerMainForm },
|
||||
data() {
|
||||
return {
|
||||
// 弹出层标题
|
||||
// 是否显示弹出层
|
||||
drawVisible: false,
|
||||
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
formLoading: false,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
//回参
|
||||
formData: {},
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 车辆信息列表
|
||||
list: [],
|
||||
multipleSelection: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
licenseNumber: null,
|
||||
carModel: null,
|
||||
carBrand: null,
|
||||
engineNumber: null,
|
||||
},
|
||||
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
|
||||
/** 打开弹窗 */
|
||||
async open(multipleSelection) {
|
||||
this.drawVisible = true;
|
||||
this.formLoading = true;
|
||||
this.reset();
|
||||
try {
|
||||
const res = await CustomerMainApi.getCustomerMainPage(this.queryParams);;
|
||||
this.list = res.data.records;
|
||||
this.total = res.data.total;
|
||||
this.multipleSelection = JSON.parse(JSON.stringify(multipleSelection))
|
||||
this.defaultChecked(multipleSelection)
|
||||
} finally {
|
||||
this.formLoading = false;
|
||||
}
|
||||
},
|
||||
/**标签删除事件*/
|
||||
tagClose(row) {
|
||||
const that = this;
|
||||
let id1 = this.multipleSelection.findIndex(item => {
|
||||
if (item.id == row.id) {
|
||||
this.$nextTick(() => {
|
||||
that.$refs.multipleTable.toggleRowSelection(
|
||||
this.list.find( // 这是弹框表格的数据
|
||||
cusItem => item.id === cusItem.id
|
||||
), false);
|
||||
});
|
||||
return true
|
||||
}
|
||||
})
|
||||
this.multipleSelection.splice(id1, 1)
|
||||
},
|
||||
|
||||
/**选中*/
|
||||
selectRow(val, row) {
|
||||
//当前点击是否勾选
|
||||
let selectBool = val.length && val.indexOf(row) !== -1
|
||||
if (!selectBool) {
|
||||
//取消勾选
|
||||
this.multipleSelection.forEach((item, i) => {
|
||||
if (item.id == row.id) {
|
||||
this.multipleSelection.splice(i, 1)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
//选中
|
||||
this.multipleSelection.push(row)
|
||||
}
|
||||
},
|
||||
|
||||
/**全选*/
|
||||
handleSelectAll(val) {
|
||||
if (val.length == this.list.length) { //全选
|
||||
this.multipleSelection = this.multipleSelection.concat(val)
|
||||
//去重
|
||||
let obj = {}
|
||||
let result = []
|
||||
this.multipleSelection.forEach(item => {
|
||||
if (!obj[item.id]) {
|
||||
result.push(item)
|
||||
obj[item.id] = true
|
||||
}
|
||||
})
|
||||
this.multipleSelection = result
|
||||
} else { //取消全选
|
||||
this.list.forEach(item => {
|
||||
this.multipleSelection.forEach((multItem, i) => {
|
||||
if (item.id == multItem.id) {
|
||||
this.multipleSelection.splice(i, 1)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
/**设置默认选中*/
|
||||
defaultChecked(multipleSelection) {
|
||||
const that = this;
|
||||
this.$nextTick(() => {
|
||||
that.list.forEach((v, i) => {
|
||||
multipleSelection.map(item => {
|
||||
if (item.id === v.id) {
|
||||
that.$refs.multipleTable.toggleRowSelection(v, true);
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
cancelForm() {
|
||||
this.drawVisible = false
|
||||
},
|
||||
|
||||
/** 添加/修改操作 */
|
||||
openForm(id) {
|
||||
this.$refs["formRef"].open(id);
|
||||
},
|
||||
|
||||
/** 查询列表 */
|
||||
async getList() {
|
||||
try {
|
||||
this.formLoading = true
|
||||
const res = await CustomerMainApi.getCustomerMainPage(this.queryParams);
|
||||
this.list = res.data.records;
|
||||
this.total = res.data.total;
|
||||
this.defaultChecked(this.multipleSelection)
|
||||
} finally {
|
||||
this.formLoading = false
|
||||
}
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/**重置参数*/
|
||||
reset() {
|
||||
this.queryParams = {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
licenseNumber: null,
|
||||
carModel: null,
|
||||
carBrand: null,
|
||||
engineNumber: null,
|
||||
}
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.drawVisible = false
|
||||
this.$emit('success', this.multipleSelection)
|
||||
},
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.el-col-item{
|
||||
width: auto;
|
||||
}
|
||||
</style>
|
189
src/views/base/carmain/components/CustomerCarForm.vue
Normal file
189
src/views/base/carmain/components/CustomerCarForm.vue
Normal file
@ -0,0 +1,189 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="60%" v-dialogDrag append-to-body>
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>车辆基本信息</span>
|
||||
</div>
|
||||
<el-descriptions class="margin-top" :column="3" border>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
车牌号
|
||||
</template>
|
||||
{{formData.licenseNumber}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
车辆品牌
|
||||
</template>
|
||||
<!-- <dict-tag :type="DICT_TYPE.DICT_SYS_USER_SEX" :value="formData.sex" /> -->
|
||||
{{formData.carBrand}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
车辆型号
|
||||
</template>
|
||||
<!-- <dict-tag :type="DICT_TYPE.DICT_SYS_USER_SEX" :value="formData.sex" /> -->
|
||||
{{formData.carModel }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
车架号
|
||||
</template>
|
||||
{{formData.vin}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
发动机号码
|
||||
</template>
|
||||
{{formData.engineNumber}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
车辆注册日期
|
||||
</template>
|
||||
{{ parseTime(formData.carRegisterDate,'{y}-{m}-{d}') }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
车辆性质
|
||||
</template>
|
||||
<dict-tag :type="DICT_TYPE.DICT_CAR_NATURE" :value="formData.carNature" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
车辆类别
|
||||
</template>
|
||||
<dict-tag :type="DICT_TYPE.DICT_CAR_CATEGORY" :value="formData.carCategory" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
最近办理业务
|
||||
</template>
|
||||
<dict-tag :type="DICT_TYPE.DICT_CUS_BUSI_TYPE" :value="formData.recentlyHandledBusiness" />
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>客户信息</span>
|
||||
<el-button @click="openChooseCustomer" style="float: right; padding: 3px 0" type="text">选择客户</el-button>
|
||||
</div>
|
||||
<el-row>
|
||||
<el-empty v-if="formData.cusList.length == 0" description="暂无客户信息" :image-size="100"></el-empty>
|
||||
<el-col v-for="item in formData.cusList" :span="8" :key="item.id">
|
||||
<el-card shadow="hover">
|
||||
<el-descriptions>
|
||||
<template slot="title">
|
||||
{{item.cusName}}({{ getDictDataLabel(DICT_TYPE.DICT_SYS_USER_SEX,item.sex) }})
|
||||
<el-button @click="deleteCar(item)" style="text-align: right" size="mini" type="danger" icon="el-icon-delete" circle></el-button>
|
||||
</template>
|
||||
<el-descriptions-item label="车主"> <el-checkbox true-label="1" false-label="0" v-model="item.isOwner" /></el-descriptions-item>
|
||||
<el-descriptions-item label="联系电话">{{item.phoneNumber}}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
</el-card>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-card>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<ChooseCustomerDraw @success="chooseCar" ref="CustomerDraw"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as CarMainApi from '@/api/base/carmain';
|
||||
import ChooseCustomerDraw from '@/views/base/carmain/components/ChooseCustomerDraw.vue';
|
||||
import { getDictDatas, DICT_TYPE, getDictData } from '@/utils/dict';
|
||||
|
||||
export default {
|
||||
name: "CustomerMainForm",
|
||||
components: {
|
||||
ChooseCustomerDraw
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 弹出层标题
|
||||
dialogTitle: "",
|
||||
// 是否显示弹出层
|
||||
dialogVisible: false,
|
||||
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
formLoading: false,
|
||||
//回参
|
||||
formData:{
|
||||
cusList:[],
|
||||
},
|
||||
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
|
||||
getDictDataLabel(type,data){
|
||||
let resultObj = getDictData(type, data);
|
||||
|
||||
return resultObj.label;
|
||||
},
|
||||
/** 打开弹窗 */
|
||||
async open(id) {
|
||||
this.dialogVisible = true;
|
||||
this.formLoading = true;
|
||||
this.reset()
|
||||
try{
|
||||
const res = await CarMainApi.getCarMain(id);
|
||||
this.formData = res.data
|
||||
this.dialogTitle = "绑定客户";
|
||||
}finally {
|
||||
this.formLoading = false;
|
||||
}
|
||||
},
|
||||
/**删除卡片*/
|
||||
deleteCar(row){
|
||||
this.formData.cusList.forEach((item,index) => {
|
||||
if (item.id == row.id){
|
||||
this.formData.cusList.splice(index,1)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**重置*/
|
||||
reset(){
|
||||
this.formData={
|
||||
cusList:[],
|
||||
}
|
||||
},
|
||||
|
||||
openChooseCustomer(){
|
||||
this.$refs["CustomerDraw"].open(this.formData.cusList);
|
||||
},
|
||||
|
||||
/**
|
||||
* 选择客户
|
||||
*/
|
||||
chooseCar(chooseCuses){
|
||||
this.formData.cusList = chooseCuses
|
||||
},
|
||||
|
||||
/** 提交按钮 */
|
||||
async submitForm() {
|
||||
this.formLoading = true
|
||||
try{
|
||||
const data = this.formData;
|
||||
await CarMainApi.bindCustomerCar(data);
|
||||
this.$modal.msgSuccess("绑定成功");
|
||||
this.dialogVisible = false;
|
||||
this.$emit('success');
|
||||
}finally {
|
||||
this.formLoading = false
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
@ -176,9 +176,9 @@
|
||||
<el-button size="mini" type="text" icon="el-icon-d-arrow-right">更多</el-button>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item command="bindCustomer" size="mini" type="text" icon="el-icon-truck"
|
||||
v-hasPermi="['base:customer-main:bindCustomer']">绑定客户</el-dropdown-item>
|
||||
v-hasPermi="['base:car-main:bindCustomer']">绑定客户</el-dropdown-item>
|
||||
<el-dropdown-item command="markSign" size="mini" type="text" icon="el-icon-truck"
|
||||
v-hasPermi="['base:customer-main:markSign']">打标签</el-dropdown-item>
|
||||
v-hasPermi="['base:car-main:markSign']">打标签</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
|
||||
</el-dropdown>
|
||||
@ -191,10 +191,12 @@
|
||||
@pagination="getList" />
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<CarMainForm ref="formRef" @success="getList" />
|
||||
<CustomerCarForm ref="bindCustomerFormRef" @success="getList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CustomerCarForm from '@/views/base/carmain/components/CustomerCarForm.vue';
|
||||
import * as CarMainApi from '@/api/base/carmain';
|
||||
import CarMainForm from './CarMainForm.vue';
|
||||
import { getDictDatas, DICT_TYPE, getDictData } from '@/utils/dict';
|
||||
@ -202,6 +204,7 @@ export default {
|
||||
name: "CarMain",
|
||||
components: {
|
||||
CarMainForm,
|
||||
CustomerCarForm,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -249,22 +252,24 @@ export default {
|
||||
/**更多操作*/
|
||||
handleCommand(command, index, row) {
|
||||
switch (command) {
|
||||
case 'markSign':
|
||||
this.openForm(row.id);
|
||||
break;
|
||||
case 'bindCustomer':
|
||||
//绑定车辆信息
|
||||
this.openForm(row.id);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
//打标签
|
||||
case 'markSign': this.openForm(row.id); break;
|
||||
|
||||
//绑定客户信息
|
||||
case 'bindCustomer': this.openFormBindCustomer(row.id); break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
},
|
||||
openFormBindCustomer(id) {
|
||||
this.$refs["bindCustomerFormRef"].open(id);
|
||||
},
|
||||
/** 查询列表 */
|
||||
async getList() {
|
||||
debugger;
|
||||
|
||||
try {
|
||||
debugger;
|
||||
|
||||
this.loading = true;
|
||||
const res = await CarMainApi.getCarMainPage(this.queryParams);
|
||||
this.list = res.data.records;
|
||||
@ -275,7 +280,7 @@ export default {
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
debugger;
|
||||
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
@ -291,8 +296,6 @@ export default {
|
||||
/** 删除按钮操作 */
|
||||
async handleDelete(row) {
|
||||
const id = row.id;
|
||||
debugger;
|
||||
|
||||
|
||||
let optionValue = 0;
|
||||
await this.$confirm('是否确认删除该条车辆信息?', '提示', {
|
||||
@ -300,7 +303,7 @@ debugger;
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
debugger;
|
||||
|
||||
optionValue = 1;
|
||||
}).catch(() => {
|
||||
// this.$message({
|
||||
@ -318,7 +321,7 @@ debugger;
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
debugger;
|
||||
|
||||
|
||||
CarMainApi.deleteCarMain(id).then(() => {
|
||||
this.getList();
|
||||
@ -331,7 +334,7 @@ debugger;
|
||||
})
|
||||
|
||||
} else {
|
||||
debugger;
|
||||
|
||||
|
||||
CarMainApi.deleteCarMain(id).then(() => {
|
||||
this.getList();
|
||||
|
178
src/views/base/customer/CustomerLabelForm.vue
Normal file
178
src/views/base/customer/CustomerLabelForm.vue
Normal file
@ -0,0 +1,178 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="60%" v-dialogDrag append-to-body>
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>客户基本信息</span>
|
||||
</div>
|
||||
<el-descriptions class="margin-top" :column="3" border>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
客户名称
|
||||
</template>
|
||||
{{ formData.cusName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
性别
|
||||
</template>
|
||||
<dict-tag :type="DICT_TYPE.DICT_SYS_USER_SEX" :value="formData.sex"/>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
联系方式
|
||||
</template>
|
||||
{{ formData.phoneNumber }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
生日
|
||||
</template>
|
||||
{{ parseTime(formData.birthday, '{y}-{m}-{d}') }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
客户来源
|
||||
</template>
|
||||
<dict-tag :type="DICT_TYPE.DICT_CUS_DATA_FROM" :value="formData.dataFrom"/>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
最近办理业务
|
||||
</template>
|
||||
<dict-tag :type="DICT_TYPE.DICT_CUS_BUSI_TYPE" :value="formData.nearDoContent"/>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
联系地址
|
||||
</template>
|
||||
{{ formData.address }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-card>
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>客户标签</span>
|
||||
<el-button @click="openBusiLabel" style="float: right; padding: 3px 0" type="text">打标签</el-button>
|
||||
</div>
|
||||
<el-row>
|
||||
<el-empty v-if="formData.labelList.length == 0" description="暂无标签信息" :image-size="100"></el-empty>
|
||||
<template v-for="item in formData.labelList">
|
||||
<el-popover
|
||||
placement="top-start"
|
||||
width="200"
|
||||
trigger="hover"
|
||||
:content="item.labelContent">
|
||||
<el-tag
|
||||
style="margin-left: 5px"
|
||||
:key="item.id"
|
||||
closable
|
||||
@close="tagClose(item)"
|
||||
slot="reference"
|
||||
:type="item.labelType">
|
||||
{{ item.labelName }}
|
||||
</el-tag>
|
||||
</el-popover>
|
||||
</template>
|
||||
</el-row>
|
||||
</el-card>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<BusiLabelForm ref="busiLabelForm" @ok="setLabel"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as CustomerMainApi from '@/api/base/customer';
|
||||
import BusiLabelForm from '@/views/base/label/BusiLabelForm.vue';
|
||||
export default {
|
||||
name: "CustomerLabelForm",
|
||||
components: {BusiLabelForm},
|
||||
data() {
|
||||
return {
|
||||
// 弹出层标题
|
||||
dialogTitle: "",
|
||||
// 是否显示弹出层
|
||||
dialogVisible: false,
|
||||
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
formLoading: false,
|
||||
//回参
|
||||
formData: {
|
||||
labelList: [],
|
||||
},
|
||||
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
/** 删除标签 */
|
||||
tagClose(row){
|
||||
let id1 = this.formData.labelList.findIndex(item => {
|
||||
if (item.id == row.id) {
|
||||
return true
|
||||
}
|
||||
})
|
||||
this.formData.labelList.splice(id1, 1)
|
||||
},
|
||||
|
||||
/** 打开弹窗 */
|
||||
async open(row) {
|
||||
this.dialogVisible = true;
|
||||
this.formLoading = true;
|
||||
this.reset()
|
||||
try {
|
||||
const res = await CustomerMainApi.getCustomerMain(row.id);
|
||||
this.formData = res.data
|
||||
this.dialogTitle = "打标签";
|
||||
} finally {
|
||||
this.formLoading = false;
|
||||
}
|
||||
},
|
||||
|
||||
/**删除标签信息*/
|
||||
deleteLabel(row) {
|
||||
this.formData.labelList.forEach((item, index) => {
|
||||
if (item.id == row.id) {
|
||||
this.formData.labelList.splice(index, 1)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**重置*/
|
||||
reset() {
|
||||
this.formData = {
|
||||
labelList: [],
|
||||
}
|
||||
},
|
||||
|
||||
/**设置标签内容*/
|
||||
setLabel(row){
|
||||
this.formData.labelList.push(JSON.parse(JSON.stringify(row)))
|
||||
},
|
||||
|
||||
/**新增业务标签*/
|
||||
openBusiLabel(){
|
||||
this.$refs["busiLabelForm"].open(this.formData);
|
||||
},
|
||||
|
||||
|
||||
/** 提交按钮 */
|
||||
async submitForm() {
|
||||
this.formLoading = true
|
||||
try {
|
||||
const data = this.formData;
|
||||
await CustomerMainApi.setLabelList(data);
|
||||
this.$modal.msgSuccess("设置标签成功");
|
||||
this.dialogVisible = false;
|
||||
this.$emit('success');
|
||||
} finally {
|
||||
this.formLoading = false
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
@ -92,6 +92,7 @@
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item command="bindCar" size="mini" type="text" icon="el-icon-truck"
|
||||
v-hasPermi="['base:customer-main:car']">绑定车辆</el-dropdown-item>
|
||||
<el-dropdown-item command="bindLabel" size="mini" type="text" icon="el-icon-s-management">打标签</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
|
||||
@ -104,6 +105,7 @@
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<CustomerMainForm ref="formRef" @success="getList"/>
|
||||
<CustomerCarForm ref="carFormRef" @success="getList"/>
|
||||
<CustomerLabelForm ref="labelFormRef" @success="getList"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -111,10 +113,11 @@
|
||||
import * as CustomerMainApi from '@/api/base/customer';
|
||||
import CustomerMainForm from '@/views/base/customer/CustomerMainForm.vue';
|
||||
import CustomerCarForm from '@/views/base/customer/CustomerCarForm.vue';
|
||||
import CustomerLabelForm from '@/views/base/customer/CustomerLabelForm.vue';
|
||||
export default {
|
||||
name: "PrivateCustomer",
|
||||
components: {
|
||||
CustomerMainForm,CustomerCarForm
|
||||
CustomerMainForm,CustomerCarForm,CustomerLabelForm
|
||||
},
|
||||
props:{
|
||||
typeCode: {
|
||||
@ -176,10 +179,17 @@ export default {
|
||||
//绑定车辆信息
|
||||
this.bindCar(row);
|
||||
break;
|
||||
case 'bindLabel':
|
||||
this.bindLabel(row);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
/**打标签*/
|
||||
bindLabel(row){
|
||||
this.$refs["labelFormRef"].open(row);
|
||||
},
|
||||
/** 查询列表 */
|
||||
async getList() {
|
||||
try {
|
||||
|
97
src/views/base/label/BusiLabelForm.vue
Normal file
97
src/views/base/label/BusiLabelForm.vue
Normal file
@ -0,0 +1,97 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="45%" v-dialogDrag append-to-body>
|
||||
<el-form ref="formRef" :model="labelData" :rules="formRules" v-loading="formLoading" label-width="100px">
|
||||
<el-form-item label="标签名称" prop="labelName">
|
||||
<el-input v-model="labelData.labelName" placeholder="请输入标签名称"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="标签样式" prop="labelType">
|
||||
<el-select v-model="labelData.labelType" placeholder="请选择标签样式">
|
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.DICT_BASE_LABEL_TYPE)"
|
||||
:key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||
</el-select>
|
||||
实例:<el-tag :type="labelData.labelType">{{ labelData.labelName }}</el-tag>
|
||||
</el-form-item>
|
||||
<el-form-item label="标签描述" prop="labelContent">
|
||||
<el-input type="textarea" v-model="labelData.labelContent" placeholder="请输入标签描述"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: "BusiLabelForm",
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
// 弹出层标题
|
||||
dialogTitle: "",
|
||||
// 是否显示弹出层
|
||||
dialogVisible: false,
|
||||
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
formLoading: false,
|
||||
// 表单参数
|
||||
labelData: {
|
||||
id: undefined,
|
||||
labelName: undefined,
|
||||
labelContent: undefined,
|
||||
labelType: undefined
|
||||
},
|
||||
// 表单校验
|
||||
formRules: {
|
||||
labelName: [
|
||||
{required: true, message: '请输入标签名称', trigger: 'blur'},
|
||||
],
|
||||
labelType: [
|
||||
{required: true, message: '请选择标签样式', trigger: 'blur'},
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
/** 打开弹窗 */
|
||||
async open(row) {
|
||||
this.dialogVisible = true;
|
||||
this.reset();
|
||||
this.dialogTitle = row.cusName
|
||||
this.labelData.mainId = row.id
|
||||
// 修改时,设置数据
|
||||
// if (row) {
|
||||
// this.formLoading = true;
|
||||
// try {
|
||||
// this.labelData = row;
|
||||
// } finally {
|
||||
// this.formLoading = false;
|
||||
// }
|
||||
// }
|
||||
},
|
||||
/** 提交按钮 */
|
||||
async submitForm() {
|
||||
await this.$refs["formRef"].validate();
|
||||
//生成随机数
|
||||
this.labelData.id = Math.random()*10
|
||||
const data = this.labelData
|
||||
this.$emit('ok',data)
|
||||
this.dialogVisible = false
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.labelData = {
|
||||
id: undefined,
|
||||
labelType: undefined,
|
||||
labelName: undefined,
|
||||
labelContent: undefined,
|
||||
};
|
||||
this.resetForm("formRef");
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user