|
|
|
@ -15,11 +15,11 @@
|
|
|
|
|
>
|
|
|
|
|
<template #search>
|
|
|
|
|
<el-form inline>
|
|
|
|
|
<el-form-item label="所属系统" prop="systemId">
|
|
|
|
|
<el-form-item label="所属店铺" prop="storeId">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="state.condition.systemId"
|
|
|
|
|
v-model="state.condition.storeId"
|
|
|
|
|
:config="{ label: 'name', value: 'id' }"
|
|
|
|
|
:opts="opts.system"
|
|
|
|
|
:opts="opts.store"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="客服ID" prop="waiterId">
|
|
|
|
@ -32,23 +32,29 @@
|
|
|
|
|
</template>
|
|
|
|
|
</table-list>
|
|
|
|
|
<el-dialog v-model="formState.formVisible" :title="formState.form.id ? '编辑' : '添加' + '店铺'">
|
|
|
|
|
<el-form ref="refsForm" label-width="100px" :model="formState.form" :rules="formState.rules">
|
|
|
|
|
<el-form-item label="所属系统" prop="systemId">
|
|
|
|
|
<el-form
|
|
|
|
|
ref="refsForm"
|
|
|
|
|
v-loading="formState.submitting"
|
|
|
|
|
label-width="100px"
|
|
|
|
|
:model="formState.form"
|
|
|
|
|
:rules="formState.rules"
|
|
|
|
|
>
|
|
|
|
|
<el-form-item label="所属店铺" prop="storeId">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="formState.form.sysId"
|
|
|
|
|
v-model="formState.form.storeId"
|
|
|
|
|
:config="{ label: 'name', value: 'id' }"
|
|
|
|
|
:disabled="formState.form.id"
|
|
|
|
|
:opts="opts.system"
|
|
|
|
|
:opts="opts.store"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="客服类型" prop="type">
|
|
|
|
|
<el-radio-group v-model="formState.form.type" :opts="opts.type" />
|
|
|
|
|
<el-input v-model="formState.form.type" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="客服头像" prop="waiterAvatar">
|
|
|
|
|
<el-upload-image v-model="formState.form.waiterAvatar" config-id="im/" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="客服ID" prop="waiterId">
|
|
|
|
|
<el-input v-model="formState.form.waiterId" />
|
|
|
|
|
<el-input v-model="formState.form.waiterId" :disabled="!!formState.form.id" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="客服昵称" prop="waiterNickname">
|
|
|
|
|
<el-input v-model="formState.form.waiterNickname" />
|
|
|
|
@ -78,35 +84,50 @@
|
|
|
|
|
}
|
|
|
|
|
const state = reactive({
|
|
|
|
|
condition: {
|
|
|
|
|
systemId: null,
|
|
|
|
|
storeId: null,
|
|
|
|
|
waiterId: null,
|
|
|
|
|
waiterNickname: null,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
const handleReset = () => {
|
|
|
|
|
state.condition = {
|
|
|
|
|
systemId: null,
|
|
|
|
|
storeId: null,
|
|
|
|
|
waiterId: null,
|
|
|
|
|
waiterNickname: null,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
const handleSearch = async () => {
|
|
|
|
|
if (state.condition.storeId) {
|
|
|
|
|
loading.value = true;
|
|
|
|
|
await store.dispatch('chatWaiter/search');
|
|
|
|
|
loading.value = false;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
watch(
|
|
|
|
|
() => unref(opts).store,
|
|
|
|
|
(value) => {
|
|
|
|
|
if (!state.condition.storeId) {
|
|
|
|
|
state.condition.storeId = value[0]?.id;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
watch(
|
|
|
|
|
() => state.condition,
|
|
|
|
|
(value) => {
|
|
|
|
|
store.commit('chatWaiter/setCondition', _.cloneDeep(value));
|
|
|
|
|
handleSearch();
|
|
|
|
|
},
|
|
|
|
|
{ immediate: true, deep: true }
|
|
|
|
|
);
|
|
|
|
|
watch(
|
|
|
|
|
() => state.condition.storeId,
|
|
|
|
|
() => {
|
|
|
|
|
handleSearch();
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
onActivated(() => {
|
|
|
|
|
let sysId = route.query.sysId;
|
|
|
|
|
if (sysId) {
|
|
|
|
|
state.condition.sysId = +sysId;
|
|
|
|
|
let storeId = route.query.storeId;
|
|
|
|
|
if (storeId) {
|
|
|
|
|
state.condition.storeId = +storeId;
|
|
|
|
|
} else {
|
|
|
|
|
handleSearch();
|
|
|
|
|
}
|
|
|
|
@ -119,14 +140,14 @@
|
|
|
|
|
submitting: false,
|
|
|
|
|
form: {
|
|
|
|
|
id: null,
|
|
|
|
|
systemId: null,
|
|
|
|
|
type: 0,
|
|
|
|
|
storeId: null,
|
|
|
|
|
type: null,
|
|
|
|
|
waiterAvatar: null,
|
|
|
|
|
waiterId: null,
|
|
|
|
|
waiterNickname: null,
|
|
|
|
|
},
|
|
|
|
|
rules: {
|
|
|
|
|
systemId: [{ required: true, message: '所属系统不能为空' }],
|
|
|
|
|
storeId: [{ required: true, message: '所属店铺不能为空' }],
|
|
|
|
|
type: [{ required: true, message: '客服类型不能为空' }],
|
|
|
|
|
waiterAvatar: [{ required: true, message: '客服头像不能为空' }],
|
|
|
|
|
waiterId: [{ required: true, message: '客服ID不能为空' }],
|
|
|
|
@ -139,13 +160,16 @@
|
|
|
|
|
formState.form,
|
|
|
|
|
row || {
|
|
|
|
|
id: null,
|
|
|
|
|
systemId: null,
|
|
|
|
|
type: 0,
|
|
|
|
|
storeId: null,
|
|
|
|
|
type: null,
|
|
|
|
|
waiterAvatar: null,
|
|
|
|
|
waiterId: null,
|
|
|
|
|
waiterNickname: null,
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
if (!formState.form.storeId) {
|
|
|
|
|
formState.form.storeId = state.condition.storeId;
|
|
|
|
|
}
|
|
|
|
|
formState.formVisible = true;
|
|
|
|
|
};
|
|
|
|
|
// 保存
|
|
|
|
@ -162,19 +186,19 @@
|
|
|
|
|
formState.submitting = false;
|
|
|
|
|
};
|
|
|
|
|
const handleRemove = async (rows) => {
|
|
|
|
|
store.dispatch(
|
|
|
|
|
'chatWaiter/remove',
|
|
|
|
|
rows.map((item) => item.id)
|
|
|
|
|
);
|
|
|
|
|
store.dispatch('chatWaiter/remove', {
|
|
|
|
|
storeId: state.condition.storeId,
|
|
|
|
|
waiterIds: rows.map((item) => item.waiterId),
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
const config = reactive({
|
|
|
|
|
// 表格列配置
|
|
|
|
|
columns: [
|
|
|
|
|
{
|
|
|
|
|
label: '所属系统',
|
|
|
|
|
label: '所属店铺',
|
|
|
|
|
width: 160,
|
|
|
|
|
slots: {
|
|
|
|
|
default: ({ row }) => proxy.$dict(unref(opts).system, row.sysId, { label: 'name', value: 'id' }),
|
|
|
|
|
default: ({ row }) => proxy.$dict(unref(opts).store, row.storeId, { label: 'name', value: 'id' }),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|