This commit is contained in:
xiao-fajia 2024-08-07 10:08:48 +08:00
commit 29bf3c4f56
11 changed files with 904 additions and 33 deletions

View File

@ -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({

View File

@ -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({

View 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>

View File

@ -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">

View File

@ -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() {

View 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,
// 12
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>

View 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,
// 12
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>

View File

@ -171,17 +171,17 @@
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['base:car-main:delete']">删除</el-button>
<el-dropdown @command="(command) => handleCommand(command, scope.$index, scope.row)"
v-hasPermi="['base:car-main:update']">
<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>
<el-dropdown-item command="markSign" size="mini" type="text" icon="el-icon-truck"
v-hasPermi="['base:customer-main:markSign']">打标签</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-dropdown @command="(command) => handleCommand(command, scope.$index, scope.row)"
v-hasPermi="['base:car-main:update']">
<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:car-main:bindCustomer']">绑定客户</el-dropdown-item>
<el-dropdown-item command="markSign" size="mini" type="text" icon="el-icon-truck"
v-hasPermi="['base:car-main:markSign']">打标签</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
@ -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 {
@ -246,25 +249,27 @@ export default {
this.getList();
},
methods: {
/**更多操作*/
handleCommand(command, index, row) {
/**更多操作*/
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();

View 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,
// 12
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>

View File

@ -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 {

View 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,
// 12
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>