This commit is contained in:
磷叶 2025-01-23 18:04:46 +08:00
parent 44bd6f336c
commit 274ab38926
7 changed files with 512 additions and 75 deletions

View File

@ -9,6 +9,18 @@ export function listCustomer(query) {
})
}
// 根据ID列表查询客户
export function listCustomerByIds(ids) {
return request({
url: '/bst/customer/listByIds',
headers: {
repeatSubmit: true
},
method: 'post',
data: ids
})
}
// 查询客户详细
export function getCustomer(id) {
return request({

View File

@ -0,0 +1,156 @@
<template>
<check-dialog
:show.sync="dialogVisible"
:title="title"
:columns="columns"
:selected-ids="selectedIds"
:list-api="listApi"
:load-api="loadApi"
:query="queryParams"
@confirm="handleConfirm"
ref="checkDialog"
>
<template #search-form>
<el-form-item label="客户编号" prop="code">
<el-input
v-model="queryParams.code"
placeholder="请输入客户编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="客户名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入客户名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable @change="handleQuery">
<el-option
v-for="dict in dict.type.customer_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="手机号" prop="mobile">
<el-input
v-model="queryParams.mobile"
placeholder="请输入手机号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="微信号" prop="wechat">
<el-input
v-model="queryParams.wechat"
placeholder="请输入微信号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="跟进人" prop="followId">
<user-select v-model="queryParams.followId" @change="handleQuery"/>
</el-form-item>
</template>
<template #status="{row}">
<dict-tag :options="dict.type.customer_status" :value="row.status" />
</template>
</check-dialog>
</template>
<script>
import { listCustomer, listCustomerByIds } from "@/api/bst/customer";
import CheckDialog from "@/components/CheckDialog/index.vue";
import UserSelect from "@/components/Business/User/UserSelect.vue";
export default {
name: "CustomerDialog",
components: {
CheckDialog,
UserSelect
},
dicts: ['customer_status'],
props: {
//
title: {
type: String,
default: "选择客户"
},
//
show: {
type: Boolean,
default: false
},
// ID
selectedIds: {
type: [String, Array],
default: null,
},
// API
listApi: {
type: Function,
default: listCustomer
},
// API
loadApi: {
type: Function,
default: listCustomerByIds
}
},
data() {
return {
//
queryParams: {
pageNum: 1,
pageSize: 10,
code: null,
name: null,
status: null,
intentLevel: null,
mobile: null,
wechat: null,
followId: null
},
//
columns: [
{key: 'id', visible: false, label: 'ID', minWidth: null, sortable: true, overflow: false, align: 'center', width: "80"},
{key: 'code', visible: true, label: '编号', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'name', visible: true, label: '名称', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'status', visible: true, label: '状态', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'mobile', visible: true, label: '手机号', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'wechat', visible: true, label: '微信号', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'followName', visible: true, label: '跟进人', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'remark', visible: true, label: '备注', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'createTime', visible: true, label: '创建时间', minWidth: null, sortable: true, overflow: false, align: 'center', width: "100"},
],
}
},
computed: {
dialogVisible: {
get() {
return this.show;
},
set(val) {
this.$emit("update:show", val);
}
}
},
methods: {
//
handleConfirm(selection) {
this.$emit('confirm', selection);
},
//
handleQuery() {
this.$refs.checkDialog.handleQuery();
}
}
}
</script>

View File

@ -0,0 +1,57 @@
<template>
<div>
<el-input
:value="text"
@focus="showDialog = true"
placeholder="点击选择客户"
/>
<customer-dialog
:show.sync="showDialog"
@confirm="handleConfirm"
:selectedIds="value"
:multiple="multiple"
/>
</div>
</template>
<script>
import CustomerDialog from '@/components/Business/Customer/CustomerDialog.vue';
export default {
components: { CustomerDialog },
props: {
//
value: {
type: [String, Array],
default: null
},
//
text: {
type: String,
default: null,
},
//
multiple: {
type: Boolean,
default: false
}
},
data() {
return {
showDialog: false,
}
},
methods: {
handleConfirm(selection) {
if (this.multiple) {
this.$emit('input', selection.map(item => item.id));
this.$emit('update:text', selection.map(item => item.name).join(','));
} else {
this.$emit('input', selection?.id);
this.$emit('update:text', selection?.name);
}
this.$emit('confirm', selection);
}
}
}
</script>

View File

@ -0,0 +1,247 @@
<template>
<el-dialog
:visible.sync="dialogVisible"
:title="title"
width="1080px"
append-to-body
@open="init"
@close="handleClose"
>
<!-- 搜索区域 -->
<el-form :model="query" ref="queryForm" :inline="true" label-width="68px" size="small">
<slot name="search-form"></slot>
<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-table
v-loading="loading"
:data="list"
@selection-change="handleSelectionChange"
@row-click="handleRowClick"
@row-dblclick="handleRowDbClick"
:highlight-current-row="!multiple"
height="400"
ref="table"
>
<el-table-column type="selection" width="55" align="center" v-if="multiple" />
<template v-for="(column, index) in columns">
<el-table-column
:key="index"
:prop="column.key"
:label="column.label"
:align="column.align || 'center'"
:width="column.width"
:min-width="column.minWidth"
:show-overflow-tooltip="column.overflow"
>
<template slot-scope="scope">
<slot :name="column.key" :row="scope.row">
{{ scope.row[column.key] | dv }}
</slot>
</template>
</el-table-column>
</template>
</el-table>
<!-- 分页 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="query.pageNum"
:limit.sync="query.pageSize"
@pagination="getList"
/>
<!-- 底部按钮 -->
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleConfirm"> </el-button>
<el-button @click="handleClose"> </el-button>
</div>
</el-dialog>
</template>
<script>
export default {
name: "CheckDialog",
props: {
//
title: {
type: String,
default: "选择数据"
},
//
show: {
type: Boolean,
default: false
},
// ID
selectedIds: {
type: [String, Array],
default: null
},
//
columns: {
type: Array,
required: true
},
// API
listApi: {
type: Function,
required: true
},
// API
loadApi: {
type: Function,
required: true
},
// ID
prop: {
type: String,
default: "id"
},
//
multiple: {
type: Boolean,
default: false,
},
//
query: {
type: Object,
default: () => {
return {
pageNum: 1,
pageSize: 20
}
}
}
},
data() {
return {
//
loading: false,
// ID
selection: [],
//
total: 0,
//
list: [],
}
},
computed: {
dialogVisible: {
get() {
return this.show;
},
set(val) {
this.$emit("update:show", val);
}
}
},
methods: {
//
async init() {
this.query.pageNum = 1;
this.query.pageSize = 20;
if (this.multiple) {
this.selection = [...this.selectedIds];
} else {
this.selection = [this.selectedIds];
}
this.getList();
},
//
getList() {
this.loading = true;
this.listApi(this.query).then(res => {
this.list = res.rows;
this.total = res.total;
this.loading = false;
this.$nextTick(() => {
//
this.list.forEach(row => {
const index = this.selection.findIndex(item => item === row[this.prop]);
if (index !== -1) {
this.$refs.table.toggleRowSelection(this.list[index], true);
}
});
});
});
},
//
handleQuery() {
this.query.pageNum = 1;
this.getList();
},
//
resetQuery() {
this.$refs["queryForm"].resetFields();
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.selection = selection.map(item => item[this.prop]);
},
//
handleConfirm() {
if (this.loadApi) {
this.loading = true;
this.loadApi(this.selection).then((res) => {
this.confirm(res.data);
this.handleClose();
}).finally(() => {
this.loading = false;
});
} else {
this.confirm(res.data);
this.handleClose();
}
},
confirm(data) {
if (this.multiple) {
this.$emit("confirm", data);
} else {
if (data.length > 0) {
this.$emit("confirm", data[0]);
} else {
this.$emit("confirm", null);
}
}
},
//
handleClose() {
this.dialogVisible = false;
},
//
handleRowClick(row) {
if (this.multiple) {
if (this.selection.includes(row[this.prop])) {
this.$refs.table.toggleRowSelection(row, false);
} else {
this.$refs.table.toggleRowSelection(row, true);
}
} else {
this.selection = [row[this.prop]];
}
},
//
handleRowDbClick(row) {
if (!this.multiple) {
this.selection = [row[this.prop]];
this.handleConfirm();
}
}
}
}
</script>
<style lang="scss" scoped>
.el-dialog {
.el-table {
margin: 10px 0;
}
}
</style>

View File

@ -14,7 +14,7 @@
<image-upload v-model="form.picture" />
</form-col>
<form-col :span="span" label="客户" prop="customerId">
<el-input v-model="form.customerId" placeholder="请输入客户名称"/>
<customer-input v-model="form.customerId" :text.sync="form.customerName" />
</form-col>
<form-col :span="span" label="跟进方式" prop="type">
<el-select v-model="form.type" placeholder="请选择跟进方式" style="width: 100%;">
@ -48,6 +48,7 @@
<el-button type="primary" @click="submitForm" :loading="submitLoading"> </el-button>
<el-button @click="handleClose"> </el-button>
</div>
</el-dialog>
</template>
@ -55,11 +56,11 @@
import { getCustomerFollow, addCustomerFollow, updateCustomerFollow } from "@/api/bst/customerFollow";
import FormCol from "@/components/FormCol/index.vue";
import UserSelect from '@/components/Business/User/UserSelect.vue';
import CustomerInput from '@/components/Business/Customer/CustomerInput.vue';
import { mapGetters } from 'vuex';
export default {
name: "CustomerFollowEditDialog",
components: { FormCol, UserSelect },
components: { FormCol, UserSelect, CustomerInput },
dicts: ['customer_follow_type'],
props: {
show: {
@ -81,16 +82,16 @@ export default {
//
rules: {
customerId: [
{ required: true, message: "客户不能为空", trigger: "blur" }
{ required: true, message: "客户不能为空", trigger: "change" }
],
type: [
{ required: true, message: "跟进方式不能为空", trigger: "change" }
],
content: [
{ required: true, message: "跟进内容不能为空", trigger: "blur" }
{ required: true, message: "跟进内容不能为空", trigger: "change" }
],
userId: [
{ required: true, message: "跟进人不能为空", trigger: "blur" }
{ required: true, message: "跟进人不能为空", trigger: "change" }
]
}
};
@ -128,7 +129,8 @@ export default {
content: null,
picture: null,
userId: this.userId,
nextFollowTime: null
nextFollowTime: null,
customerName: null,
};
this.resetForm("form");
},

View File

@ -56,22 +56,13 @@
:default-expand-all="isExpandAll"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
>
<el-table-column prop="deptName" label="车间工序名称"/>
<el-table-column prop="deptName" label="部门名称"/>
<el-table-column prop="orderNum" label="排序" width="100" align="center"/>
<el-table-column prop="status" label="状态" width="100" align="center">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="负责人" align="center" >
<template slot-scope="d">
<template v-if="!isEmpty(d.row.leaderList)">
<el-tag type="primary" size="mini" v-for="item of d.row.leaderList">
{{item.nickName | dv}}
</el-tag>
</template>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
@ -108,11 +99,11 @@
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<!-- <form-col :span="span" label="上级部门" prop="parentId" v-if="form.parentId !== 0">
<form-col :span="span" label="上级部门" prop="parentId" v-if="form.parentId !== 0">
<treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级部门" />
</form-col> -->
</form-col>
<form-col :span="span" label="名称" prop="deptName">
<el-input v-model="form.deptName" placeholder="请输入车间名称" />
<el-input v-model="form.deptName" placeholder="请输入部门名称" />
</form-col>
<form-col :span="span" label="状态">
<el-radio-group v-model="form.status">
@ -126,9 +117,6 @@
<form-col :span="span" label="显示排序" prop="orderNum">
<el-input-number v-model="form.orderNum" controls-position="right" :min="0" style="width: 100%" placeholder="请输入显示排序" />
</form-col>
<form-col :span="span" label="负责人" prop="leaderId">
<user-input v-model="form.leaderIds" multiple/>
</form-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
@ -267,7 +255,7 @@ export default {
this.form.parentId = row.deptId;
}
this.open = true;
this.title = "添加车间";
this.title = "添加部门";
listDept().then(response => {
this.deptOptions = this.handleTree(response.data, "deptId");
});
@ -286,7 +274,7 @@ export default {
getDept(row.deptId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改车间";
this.title = "修改部门";
listDeptExcludeChild(row.deptId).then(response => {
this.deptOptions = this.handleTree(response.data, "deptId");
if (this.deptOptions.length == 0) {

View File

@ -2,7 +2,7 @@
<div class="app-container">
<el-row :gutter="20">
<!--部门数据-->
<!-- <el-col :span="4" :xs="24">
<el-col :span="4" :xs="24">
<div class="head-container">
<el-input
v-model="deptName"
@ -26,9 +26,9 @@
@node-click="handleNodeClick"
/>
</div>
</el-col> -->
</el-col>
<!--用户数据-->
<el-col :span="24" >
<el-col :span="20" :xs="24">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="姓名" prop="nickName">
<el-input
@ -154,12 +154,6 @@
<template v-else-if="column.key === 'employStatus'">
<dict-tag :value="d.row.employStatus" :options="dict.type.user_employ_status"/>
</template>
<template v-else-if="['birthday'].includes(column.key)">
{{calcBirthDay(d.row[column.key], new Date()) | dv}}
</template>
<template v-else-if="['employDate'].includes(column.key)">
{{calcFullYear(d.row[column.key], new Date()) | dv}}
</template>
<template v-else-if="column.key === 'roles'">
<template v-for="(role, index) in d.row.roles">
<el-tag :key="index" v-if="!isEmpty(role.roleName)">{{role.roleName}}</el-tag>
@ -216,15 +210,12 @@
</el-row>
<!-- 添加或修改用户配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
<el-dialog :title="title" :visible.sync="open" width="700px" append-to-body :close-on-click-modal="false">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<!-- <form-col :span="24" label="归属部门" prop="deptId">
<form-col :span="24" label="归属部门" prop="deptId">
<treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />
</form-col> -->
<!-- <form-col :span="12" label="工号" prop="userNo">-->
<!-- <el-input v-model="form.userNo" placeholder="请输入工号" maxlength="30" />-->
<!-- </form-col>-->
</form-col>
<form-col :span="12" label="姓名" prop="nickName">
<el-input v-model="form.nickName" placeholder="请输入姓名" maxlength="30" />
</form-col>
@ -254,39 +245,24 @@
>{{dict.label}}</el-radio>
</el-radio-group>
</form-col>
<!-- <form-col :span="12" label="在职情况" prop="employStatus">-->
<!-- <el-radio-group v-model="form.employStatus">-->
<!-- <el-radio-->
<!-- v-for="dict in dict.type.user_employ_status"-->
<!-- :key="dict.value"-->
<!-- :label="dict.value"-->
<!-- >{{dict.label}}</el-radio>-->
<!-- </el-radio-group>-->
<!-- </form-col>-->
<!-- <form-col :span="12" label="手机号码" prop="phonenumber">-->
<!-- <el-input v-model="form.phonenumber" placeholder="请输入手机号码" maxlength="11" />-->
<!-- </form-col>-->
<!-- <form-col :span="12" label="邮箱" prop="email">-->
<!-- <el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" />-->
<!-- </form-col>-->
<!-- <form-col :span="12" label="出生日期" prop="birthday">-->
<!-- <el-date-picker style="width: 100%" clearable v-model="form.birthday" type="date" value-format="yyyy-MM-dd" placeholder="选择日期"/>-->
<!-- </form-col>-->
<!-- <form-col :span="12" label="入职日期" prop="birthday">-->
<!-- <el-date-picker style="width: 100%" clearable v-model="form.employDate" type="date" value-format="yyyy-MM-dd" placeholder="选择日期"/>-->
<!-- </form-col>-->
<!-- <form-col :span="12" label="用户性别">-->
<!-- <el-radio-group v-model="form.sex">-->
<!-- <el-radio-->
<!-- v-for="dict in dict.type.sys_user_sex"-->
<!-- :key="dict.value"-->
<!-- :label="dict.value"-->
<!-- >{{dict.label}}</el-radio>-->
<!-- </el-radio-group>-->
<!-- </form-col>-->
<form-col :span="24" label="备注">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
</form-col>
<form-col :span="12" label="手机号码" prop="phonenumber">
<el-input v-model="form.phonenumber" placeholder="请输入手机号码" maxlength="11" />
</form-col>
<form-col :span="12" label="邮箱" prop="email">
<el-input v-model="form.email" placeholder="请输入邮箱" maxlength="50" />
</form-col>
<form-col :span="12" label="入职日期" prop="birthday">
<el-date-picker style="width: 100%" clearable v-model="form.employDate" type="date" value-format="yyyy-MM-dd" placeholder="选择日期"/>
</form-col>
<form-col :span="12" label="用户性别">
<el-radio-group v-model="form.sex">
<el-radio
v-for="dict in dict.type.sys_user_sex"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</form-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
@ -404,9 +380,9 @@ export default {
{key: 'userId', visible: false, label: 'ID', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'nickName', visible: true, label: '姓名', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'userName', visible: true, label: '登录账号', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'deptName', visible: true, label: '归属部门', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'roles', visible: true, label: '角色', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'status', visible: true, label: '账号状态', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'remark', visible: true, label: '备注', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'loginIp', visible: true, label: '最后登录IP', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'loginDate', visible: true, label: '最后登录时间', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'createTime', visible: true, label: '创建时间', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
@ -421,7 +397,6 @@ export default {
{ min: 2, max: 20, message: '登录账号长度必须介于 2 和 20 之间', trigger: 'blur' }
],
phonenumber: [
{ required: true, message: "手机号码不能为空", trigger: "blur" },
{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码", trigger: "blur"}
],
deptId: [