加分组原始门店

This commit is contained in:
dengbw
2022-12-09 13:45:13 +08:00
parent 28ab079413
commit 67f2740a0b
6 changed files with 98 additions and 13 deletions
+12
View File
@@ -152,3 +152,15 @@ export async function checkExistence(field, value, id) {
}
return Promise.reject(new Error(res.data.message));
}
/**
* 同步原始门店用户
* @param groupsId 分组id
*/
export async function synchronousGroupsUser(groupsId) {
const res = await request.get('/sylive/groupsUser/synchronous/' + groupsId);
if (res.data.code === 0) {
return res.data.message;
}
return Promise.reject(new Error(res.data.message));
}
+12
View File
@@ -77,3 +77,15 @@ export async function removeOrganization(id) {
}
return Promise.reject(new Error(res.data.message));
}
/**
* 机构详情
* @param id 机构id
*/
export async function infoOrganization(id) {
const res = await request.get('/sylive/organization/info/' + id);
if (res.data.code === 0) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
@@ -50,6 +50,26 @@
<el-radio :label="1"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
v-if="form.userFrom == 0 && form.ifBiz == 1"
label="原始门店:"
>
<ele-tree-select
:data="organizationList"
label-key="organizationName"
value-key="organizationId"
v-model="form.originalBizId"
placeholder="请选择门店"
size="small"
:filterable="false"
:multiple="false"
:clearable="true"
:disabled="false"
:expand-on-click-node="true"
:check-strictly="false"
@change="onChange"
/>
</el-form-item>
<el-form-item
label="统计类型:"
v-if="!form.parentId"
@@ -84,6 +104,7 @@
<script>
import GroSelect from './gro-select.vue';
import { addGroups, updateGroups } from '@/api/sylive/groups';
import { infoOrganization } from '@/api/sylive/organization';
export default {
components: { GroSelect },
@@ -99,7 +120,9 @@
// 分组数据
groupsList: Array,
// 统计类型数据
statisticsTypeList: Array
statisticsTypeList: Array,
// 门店数据
organizationList: Array
},
data() {
const defaultForm = {
@@ -109,7 +132,8 @@
userFrom: 0,
ifBiz: 0,
statisticsType: null,
sortNumber: null
sortNumber: null,
originalBizId: null
};
return {
defaultForm,
@@ -145,6 +169,16 @@
}
},
methods: {
onChange(value) {
let organizationId = Number(value);
if (organizationId) {
infoOrganization(organizationId)
.then((re) => {
this.form.groupsName = re.organizationName;
})
.catch(() => {});
}
},
/* 保存编辑 */
save() {
this.$refs.form.validate((valid) => {
@@ -14,6 +14,17 @@
<template v-slot:toolbar>
<gro-user-search @search="reload">
<el-button
v-if="data.userFrom == 0 && data.ifBiz == 1"
size="small"
type="primary"
icon="el-icon-plus"
class="ele-btn-icon"
@click="synchronous()"
>
同步原始门店
</el-button>
<el-button
v-else
size="small"
type="primary"
icon="el-icon-plus"
@@ -57,9 +68,9 @@
<!-- 编辑弹窗 -->
<gro-user-add
:visible.sync="showAdd"
:user-from="userFrom"
:user-from="data.userFrom"
:groups-id="groupsId"
:activity-id="activityId"
:activity-id="data.activityId"
:organization-list="organizationList"
:team-list="teamList"
@done="reload"
@@ -73,18 +84,16 @@
import {
pageGroupsUser,
removeGroupsUser,
synchronousGroupsUser,
updateGroupsUserStatus
} from '@/api/sylive/groups-user';
export default {
components: { GroUserSearch, GroUserAdd },
props: {
data: Object,
// 分组id
groupsId: Number,
// 用户来源
userFrom: Number,
// 活动id
activityId: Number,
// 全部分组
groupsList: Array,
// 全部团队
@@ -173,7 +182,25 @@
page,
limit,
groupsId: this.groupsId,
activityId: this.activityId
activityId: this.data.activityId
});
},
/* 同步原始门店 */
synchronous() {
if (!this.data.originalBizId) {
this.$message.error('分组未选择原始门店');
return;
}
const loading = this.$loading({ lock: true });
synchronousGroupsUser(this.groupsId)
.then((msg) => {
loading.close();
this.$message.success(msg);
this.reload();
})
.catch((e) => {
loading.close();
this.$message.error(e.message);
});
},
/* 刷新表格 */
@@ -7,7 +7,7 @@
@submit.native.prevent
>
<el-row :gutter="10">
<el-col v-bind="styleResponsive ? { md: 8 } : { span: 8 }">
<el-col v-bind="styleResponsive ? { md: 6 } : { span: 6 }">
<el-form-item>
<el-input
clearable
@@ -17,7 +17,7 @@
/>
</el-form-item>
</el-col>
<el-col v-bind="styleResponsive ? { md: 8 } : { span: 8 }">
<el-col v-bind="styleResponsive ? { md: 6 } : { span: 6 }">
<el-form-item>
<el-input
clearable
+2 -2
View File
@@ -57,9 +57,8 @@
<template v-slot:content>
<gro-user-list
v-if="current"
:user-from="current.userFrom"
:data="current"
:groups-id="current.groupsId"
:activity-id="activityId"
:organization-list="organizationList"
:team-list="teamList"
/>
@@ -74,6 +73,7 @@
:parent-id="parentId"
:groups-list="data"
:statistics-type-list="statisticsTypeList"
:organization-list="organizationList"
@done="query"
/>
</div>