Commit c28837eb authored by cxr's avatar cxr

feat(cxr): 新增区域现货服务功能模块(区域管理/供货商信息管理)

parent 2c4f22ab
import { tmallabHttp } from '/@/utils/http/axios';
import { ErrorMessageMode } from '/#/axios';
enum Api {
dictRegionList = '/system/dictRegion/getList',
addScArea = '/system/scArea/add',
addScAreaPlatform = '/system/scAreaPlatform/add',
getScAreaList = '/system/scArea/getList',
removeScAreaPlatform = '/system/scAreaPlatform/remove',
getPlatList = '/system/scAreaPlatform/getPlatList',
getPlatListAll = '/system/plat/list',
}
/**
* @description: 区域字典-获取省市
*/
export function dictRegionListApi(data: any, mode: ErrorMessageMode = 'message') {
return tmallabHttp.post<any>(
{
url: Api.dictRegionList,
data,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 添加区域
*/
export function addScAreaApi(
data: any,
mode: ErrorMessageMode = 'message',
) {
return tmallabHttp.post<any>(
{
url: Api.addScArea,
data,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 管理客户平台-提交
*/
export function addScAreaPlatformApi(data: any, mode: ErrorMessageMode = 'message') {
return tmallabHttp.post<any>(
{
url: Api.addScAreaPlatform,
data
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 区域管理-列表获取
*/
export function getScAreaListApi(data: any, mode: ErrorMessageMode = 'message') {
return tmallabHttp.post<any>(
{
url: Api.getScAreaList,
data,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 管理客户平台-删除平台
*/
export function removeScAreaPlatformApi(data: any, mode: ErrorMessageMode = 'message') {
return tmallabHttp.post<any>(
{
url: Api.removeScAreaPlatform,
data
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 管理客户平台-获取平台列表
*/
export function getPlatListApi(data: any, mode: ErrorMessageMode = 'message') {
return tmallabHttp.post<any>(
{
url: Api.getPlatList,
data
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 管理客户平台-获取所有平台列表
*/
export function getPlatListAllApi(data: any, mode: ErrorMessageMode = 'message') {
return tmallabHttp.post<any>(
{
url: Api.getPlatListAll,
data
},
{
errorMessageMode: mode,
},
);
}
import { tmallabHttp } from '/@/utils/http/axios';
import { ErrorMessageMode } from '/#/axios';
enum Api {
listContract = '/system/vipContract/listContract',
list = '/system/plat/list',
createAccount = '/system/plat/createAccount',
batchClosePlats = '/system/supplier/batchClosePlats',
stopPlatAccount = '/system/supplier/stopPlatAccount',
batchOpenPlats = '/system/supplier/batchOpenPlats',
getGhsBondedPlatform = '/system/supplier/getGhsBondedPlatform',
listInfoAdmin = '/system/supplier/listInfoAdmin',
listContactInfo = '/system/supplier/listContactInfo',
listBingState = '/system/supplier/listBingState',
updateGhsInfoByGhsCode = '/system/supplier/updateGhsInfoByGhsCode',
updatePwd = '/system/supplier/updatePwd',
updateExPlatform = '/system/supplier/updateExPlatform',
listLogAccountManagement = '/system/supplier/listLogAccountManagement',
updateLimitNum = '/system/supplier/updateLimitNum',
getLimitLog = '/system/supplier/getLimitLog',
operateisSc = '/system/supplier/operateisSc',
}
/**
* @description:
*/
export function listContractApi(data: any, mode: ErrorMessageMode = 'message') {
return tmallabHttp.post<any>(
{
url: Api.listContract,
data,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description:
*/
export function listApi(
data: any,
mode: ErrorMessageMode = 'message',
) {
return tmallabHttp.post<any>(
{
url: Api.list,
data,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description:
*/
export function createAccountApi(data: any, mode: ErrorMessageMode = 'message') {
return tmallabHttp.post<any>(
{
url: Api.createAccount,
data
},
{
errorMessageMode: mode,
},
);
}
/**
* @description:
*/
export function batchClosePlatsApi(data: any, mode: ErrorMessageMode = 'message') {
return tmallabHttp.post<any>(
{
url: Api.batchClosePlats,
data,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description:
*/
export function stopPlatAccountApi(data: any, mode: ErrorMessageMode = 'message') {
return tmallabHttp.post<any>(
{
url: Api.stopPlatAccount,
data
},
{
errorMessageMode: mode,
},
);
}
/**
* @description:
*/
export function batchOpenPlatsApi(data: any, mode: ErrorMessageMode = 'message') {
return tmallabHttp.post<any>(
{
url: Api.batchOpenPlats,
data
},
{
errorMessageMode: mode,
},
);
}
/**
* @description:
*/
export function getGhsBondedPlatformApi(data: any, mode: ErrorMessageMode = 'message') {
return tmallabHttp.post<any>(
{
url: Api.getGhsBondedPlatform,
data
},
{
errorMessageMode: mode,
},
);
}
/**
* @description:
*/
export function listInfoAdminApi(data: any, mode: ErrorMessageMode = 'message') {
return tmallabHttp.post<any>(
{
url: Api.listInfoAdmin,
data
},
{
errorMessageMode: mode,
},
);
}
/**
* @description:
*/
export function listContactInfoApi(data: any, mode: ErrorMessageMode = 'message') {
return tmallabHttp.post<any>(
{
url: Api.listContactInfo,
data
},
{
errorMessageMode: mode,
},
);
}
/**
* @description:
*/
export function listBingStateApi(data: any, mode: ErrorMessageMode = 'message') {
return tmallabHttp.post<any>(
{
url: Api.listBingState,
data
},
{
errorMessageMode: mode,
},
);
}
/**
* @description:
*/
export function updateGhsInfoByGhsCodeApi(data: any, mode: ErrorMessageMode = 'message') {
return tmallabHttp.post<any>(
{
url: Api.updateGhsInfoByGhsCode,
data
},
{
errorMessageMode: mode,
},
);
}
/**
* @description:
*/
export function updatePwdApi(data: any, mode: ErrorMessageMode = 'message') {
return tmallabHttp.post<any>(
{
url: Api.updatePwd,
data
},
{
errorMessageMode: mode,
},
);
}
/**
* @description:
*/
export function updateExPlatformApi(data: any, mode: ErrorMessageMode = 'message') {
return tmallabHttp.post<any>(
{
url: Api.updateExPlatform,
data
},
{
errorMessageMode: mode,
},
);
}
/**
* @description:
*/
export function listLogAccountManagementApi(data: any, mode: ErrorMessageMode = 'message') {
return tmallabHttp.post<any>(
{
url: Api.listLogAccountManagement,
data
},
{
errorMessageMode: mode,
},
);
}
/**
* @description:
*/
export function updateLimitNumApi(data: any, mode: ErrorMessageMode = 'message') {
return tmallabHttp.post<any>(
{
url: Api.updateLimitNum,
data
},
{
errorMessageMode: mode,
},
);
}
/**
* @description:
*/
export function getLimitLogApi(data: any, mode: ErrorMessageMode = 'message') {
return tmallabHttp.post<any>(
{
url: Api.getLimitLog,
data
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 开通区域现货
*/
export function operateisScApi(data: any, mode: ErrorMessageMode = 'message') {
return tmallabHttp.post<any>(
{
url: Api.operateisSc,
data
},
{
errorMessageMode: mode,
},
);
}
...@@ -15,9 +15,9 @@ import { setupGlobDirectives } from '/@/directives'; ...@@ -15,9 +15,9 @@ import { setupGlobDirectives } from '/@/directives';
import { setupI18n } from '/@/locales/setupI18n'; import { setupI18n } from '/@/locales/setupI18n';
import { registerGlobComp } from '/@/components/registerGlobComp'; import { registerGlobComp } from '/@/components/registerGlobComp';
if (import.meta.env.DEV) { //全局组件注册
import('ant-design-vue/dist/antd.less'); import Antd from 'ant-design-vue';
} import 'ant-design-vue/dist/antd.less';
async function bootstrap() { async function bootstrap() {
const app = createApp(App); const app = createApp(App);
...@@ -37,6 +37,8 @@ async function bootstrap() { ...@@ -37,6 +37,8 @@ async function bootstrap() {
setupErrorHandle(app); setupErrorHandle(app);
app.use(Antd);
app.mount('#app'); app.mount('#app');
} }
......
import type { AppRouteModule } from '/@/router/types';
import { LAYOUT } from '/@/router/constant';
const complaints: AppRouteModule = {
path: '/RegionalSpotManage',
name: 'RegionalSpotManage',
component: LAYOUT,
redirect: '/RegionalSpotManage/index',
meta: {
hideChildrenInMenu: true,
orderNo: 200,
icon: 'ion:grid-outline',
title: '区域管理',
roles: ['super']
},
children: [
{
path: 'index',
name: '区域管理',
component: () => import('/@/views/super/regionalSpotManage/index.vue'),
meta: {
title: '区域管理',
},
}
],
};
export default complaints;
import type { AppRouteModule } from '/@/router/types';
import { LAYOUT } from '/@/router/constant';
const complaints: AppRouteModule = {
path: '/supplierInfoManage',
name: 'supplierInfoManage',
component: LAYOUT,
redirect: '/supplierInfoManage/index',
meta: {
hideChildrenInMenu: true,
orderNo: 200,
icon: 'ion:grid-outline',
title: '供货商信息管理',
roles: ['super']
},
children: [
{
path: 'index',
name: '供货商信息管理',
component: () => import('/@/views/super/supplierInfoManage/供货商信息管理.vue'),
meta: {
title: '供货商信息管理',
},
}
],
};
export default complaints;
<template>
<div class="complaints-page">
<a-card class="search-form">
<a-button type="primary" style="margin: 0 5px" @click="addBtn">新增区域</a-button>
<a-table
:columns="columns"
:dataSource="tableData"
:scroll="{ x: 'max-content' }"
:loading="tableLoading"
rowKey="id"
:pagination="false"
>
<template #platList="{ record }">
<p v-for="item in record.platList" :key="item.platCode">{{ item.platName }}</p>
</template>
<template #action="{ record }">
<a-button type="link" @click="manageBtn(record)">管理客户平台</a-button>
</template>
</a-table>
<a-pagination
style="text-align: right; margin-top: 10px"
v-model:current="page"
simple
:total="total"
>
<template #itemRender="{ type, originalElement }">
<a-button size="small" v-if="type === 'prev'">上一页</a-button>
<a-button size="small" v-else-if="type === 'next'">下一页</a-button>
<component :is="originalElement" v-else />
</template>
</a-pagination>
</a-card>
<a-modal
v-model:visible="visible"
okText="提交"
title="新增区域"
:confirmLoading="confirmLoading"
@ok="handleOk"
@cancel="cancelHandle"
>
<div>
<a-form layout="inline" :model="form">
<a-form-item label="">
<a-select
v-model:value="form.province"
show-search
placeholder="请选择省"
style="width: 200px"
@change="onProvinceChange"
:filter-option="filterOption"
>
<a-select-option v-for="item in provinceOptions" :key="item.name" :value="item.code"
>{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="">
<a-select
:disabled="cityDisadble"
v-model:value="form.cityName"
show-search
placeholder="请选择市"
style="width: 200px"
:filter-option="filterOption"
>
<a-select-option v-for="item in cityOptions" :key="item.name" :value="item.code">{{
item.name
}}</a-select-option>
</a-select>
</a-form-item>
</a-form>
</div>
</a-modal>
<a-modal
v-model:visible="manageVisible"
title="管理客户平台"
okText="提交"
:confirmLoading="manageConfirmLoading"
@ok="manegeHandleOk"
@cancel="manegecancelHandle"
>
<div v-loading="modalLoading">
<p style="margin: 10px; font-weight: bold"
>{{ currentItem.province }}{{ currentItem.cityName }}</p
>
<!-- 人工管理 -->
<div class="box">
<div class="title">人工管理</div>
<div class="innerbox">
<div style="border: 1px solid #ddd" v-for="item in peopleData" :key="item.id">
<p>{{ item.platName }}</p>
<a-button
class="icon"
type="link"
@click="removePeoplePlat(item)"
:icon="h(DeleteOutlined)"
/>
<!-- <Icon class="icon" icon="delete"></Icon> -->
</div>
<div style="border: 1px solid #ddd" v-for="(item, index) in addPlatList" :key="index">
<a-select
class="addPlatSelect"
v-model:value="item.platCode"
show-search
style="width: 100%"
placeholder="请选择平台"
:filter-option="filterOptionPlat"
>
<a-select-option v-for="i in platOptions" :key="i.platName" :value="i.platCode">{{
i.platName
}}</a-select-option>
</a-select>
<a-button
class="icon"
type="link"
@click="removePlatBtn(index)"
:icon="h(DeleteOutlined)"
/>
</div>
<div style="text-align: center">
<a-button @click="addPlatBtn" :icon="h(PlusOutlined)">添加行</a-button>
</div>
</div>
</div>
<!-- 系统管理 -->
<div class="box">
<div class="title">系统管理</div>
<div class="innerbox" v-if="rootData.length">
<div style="border: 1px solid #ddd" v-for="item in rootData" :key="item.id">{{
item.platName
}}</div>
</div>
<div class="innerbox" v-else>
<div style="text-align: center; border: 1px solid #ddd">暂无数据</div>
</div>
</div>
</div>
</a-modal>
</div>
</template>
<script lang="ts" setup>
import { PlusOutlined, DeleteOutlined } from '@ant-design/icons-vue';
import { Modal } from 'ant-design-vue';
import { ref, h, onMounted } from 'vue';
// import { useRouter } from 'vue-router';
import {
getScAreaListApi,
dictRegionListApi,
addScAreaApi,
getPlatListApi,
removeScAreaPlatformApi,
addScAreaPlatformApi,
getPlatListAllApi,
} from '/@/api/regionalSpotManage';
import moment from 'moment';
import { message } from 'ant-design-vue';
// const router = useRouter();
const tableData = ref<any[]>([]);
const tableLoading = ref<any>(false);
const visible = ref<any>(false); //
const page = ref<any>(1); //
const pageSize = ref<any>(10); //
const total = ref<any>(1); //
const confirmLoading = ref<any>(false); //
const cityDisadble = ref<any>(true); //
const form = ref<any>({
province: '',
cityName: '',
});
//管理客户平台
const manageVisible = ref<any>(false); //
const manageConfirmLoading = ref<any>(false); //
const currentItem = ref<any>({}); //
const peopleData = ref<any>([]); // 系统管理
const rootData = ref<any>([]); //
// 查询表单数据
const provinceOptions = ref<any[]>([]);
//平台管理数据
const platOptions = ref<any[]>([]);
const addPlatList = ref<any>([]); // 新添加的平台
const modalLoading = ref<any>(false); // 新添加的平台
//省市
const cityOptions = ref<any[]>([]); //省市
const columns = [
{ title: '', dataIndex: 'province', key: 'province' },
{ title: '', dataIndex: 'cityName', key: 'cityName' },
{
title: '客户平台',
dataIndex: 'platList',
key: 'platList',
slots: { customRender: 'platList' },
width: 180,
},
{
title: '创建时间',
dataIndex: 'createTime',
key: 'createTime',
customRender: ({ text }) => {
return moment(text).format('YYYY-MM-DD HH:mm:ss');
},
},
{ title: '创建人', dataIndex: 'creator', key: 'creator' },
{
title: '操作',
fixed: 'right',
key: 'action',
width: '150px',
slots: { customRender: 'action' },
},
];
onMounted(() => {
getTableDate();
getDictRegionList(1);
getPlatListAll();
});
//获取区域现货列表
const getTableDate = () => {
tableLoading.value = true;
getScAreaListApi({
currentPage: page.value,
pageSize: pageSize.value,
}).then((res) => {
if (res.success) {
tableData.value = res.data;
total.value = res.data[0].total;
} else {
message.error(res.message);
}
tableLoading.value = false;
});
};
//获取省
const getDictRegionList = (level: any) => {
dictRegionListApi({ provinceId: form.value.province, level }).then((res) => {
if (res.success) {
provinceOptions.value = res.data;
} else {
message.error(res.message);
}
});
};
//获取所有平台
const getPlatListAll = () => {
getPlatListAllApi({}).then((res) => {
if (res.success) {
platOptions.value = res.data;
} else {
platOptions.value = [];
message.error(res.message);
}
});
};
//添加区域按钮
const addBtn = () => {
visible.value = true;
};
//省改变事件
const onProvinceChange = () => {
dictRegionListApi({ provinceId: form.value.province, level: 2 }).then((res) => {
if (res.success) {
cityOptions.value = res.data;
} else {
message.error(res.message);
}
});
form.value.cityName = '';
cityDisadble.value = false;
};
//添加区域确认事件
const handleOk = () => {
if (form.value.province == '' || form.value.cityName == '') {
return message.warning('请选择省市');
}
let param = {
provinceId: form.value.province,
provinceName: provinceOptions.value.filter((item) => item.code == form.value.province)[0]
.name,
cityId: form.value.cityName,
cityName: cityOptions.value.filter((item) => item.code == form.value.cityName)[0].name,
};
confirmLoading.value = true;
addScAreaApi(param).then((res) => {
if (res.success) {
message.success(res.message);
} else {
message.error(res.message);
}
confirmLoading.value = false;
cancelHandle();
getTableDate();
});
};
//添加区域取消事件
const cancelHandle = () => {
form.value.province = '';
form.value.cityName = '';
cityDisadble.value = true;
confirmLoading.value = false;
visible.value = false;
};
//管理客户平台按钮
const manageBtn = (row) => {
currentItem.value = row;
manageVisible.value = true;
modalLoading.value = true;
getPlatListApi({ provinceId: row.provinceId, cityId: row.cityId }).then((res) => {
if (res.success) {
peopleData.value = res.data.filter((item) => item.type == 1);
rootData.value = res.data.filter((item) => item.type == 0);
} else {
message.error(res.message);
}
modalLoading.value = false;
});
};
//确认管理客户平台
const manegeHandleOk = () => {
if (addPlatList.value.length === 0) {
manageVisible.value = false;
return;
}
if (addPlatList.value.find((item) => item.platCode == '')) {
return message.warning('请先选择要添加的平台!');
}
let param = {
provinceId: currentItem.value.provinceId,
province: currentItem.value.province,
cityId: currentItem.value.cityId,
city: currentItem.value.cityName,
platCode: addPlatList.value.map((item) => item.platCode).join(','),
};
manageConfirmLoading.value = true;
addScAreaPlatformApi(param).then((res) => {
if (res.success) {
message.success(res.message);
} else {
message.error(res.message);
}
manageConfirmLoading.value = false;
manegecancelHandle();
getTableDate();
});
};
//管理客户平台取消按钮
const manegecancelHandle = () => {
manageVisible.value = false;
addPlatList.value = [];
peopleData.value = [];
rootData.value = [];
};
//添加平台按钮
const addPlatBtn = () => {
if (addPlatList.value.find((item) => item.platCode == '')) {
return message.warning('请先选择当前行的平台');
}
addPlatList.value.push({
platCode: '',
});
};
//删除平台按钮
const removePlatBtn = (index) => {
addPlatList.value.splice(index, 1);
};
//删除平台回调
const removePeoplePlat = (item) => {
Modal.confirm({
title: '确认',
content: `确认删除平台 ${item.platName} 吗?`,
okText: '确认删除',
cancelText: '取消',
onOk: () => {
removeScAreaPlatformApi({ sysid: item.id }).then((res) => {
if (res.success) {
message.success(res.message);
getPlatListApi({
provinceId: currentItem.value.provinceId,
cityId: currentItem.value.cityId,
}).then((res) => {
if (res.success) {
peopleData.value = res.data.filter((item) => item.type == 1);
rootData.value = res.data.filter((item) => item.type == 0);
} else {
peopleData.value = [];
rootData.value = [];
message.error(res.message);
}
});
} else {
message.error(res.message);
}
});
},
});
};
//过滤搜索
const filterOption = (input: string, option: any) => {
return option.key.toLowerCase().indexOf(input.toLowerCase()) >= 0;
};
const filterOptionPlat = (input: string, option: any) => {
return option.key.toLowerCase().indexOf(input.toLowerCase()) >= 0;
};
</script>
<style lang="less" scoped>
.complaints-page {
//margin: 20px;
.search-form {
.search-header {
background: #f7f8fc;
padding: 5px 10px;
display: flex;
margin-bottom: 10px;
.title {
font-size: 18px;
//font-weight: 600;
font-family: 黑体;
flex: 1;
}
}
}
}
.box {
padding: 10px 50px 10px 10px;
.title {
height: 50px;
line-height: 50px;
font-weight: 700;
text-align: center;
background: #fafafa;
border: 1px solid #ddd;
}
.innerbox {
div {
position: relative;
height: 40px;
line-height: 40px;
border-radius: 8px;
.icon {
position: absolute;
right: -38px;
top: 0;
}
}
}
}
.addPlatSelect :deep(.ant-select-selector) {
border: none;
}
.addPlatSelect :deep(.ant-select-arrow) {
top: 35%;
}
</style>
<template>
<div>
<a-form style="margin-bottom: 10px" layout="inline">
<a-form-item label="供应商名称:">
<a-input v-model:value="searchText" placeholder="请输入供应商名称" />
</a-form-item>
<a-form-item label="是否会员:">
<a-select
v-model:value="isVip"
allowClear
style="width: 150px"
placeholder="请选择是否为会员"
>
<a-select-option value="1">会员</a-select-option>
<a-select-option value="0">非会员</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="区域现货:">
<a-select
v-model:value="isScOpen"
allowClear
style="width: 150px"
placeholder="请选择是否为区域现货"
>
<a-select-option value="1">已开通</a-select-option>
<a-select-option value="0">未开通</a-select-option>
</a-select>
</a-form-item>
<a-form-item>
<a-button type="primary" @click="onSearch">搜索</a-button>
</a-form-item>
</a-form>
<a-table
:columns="columns"
:dataSource="list"
:loading="listloading"
:pagination="pagination"
:rowKey="(record) => record.sysid"
:scroll="{ x: 1350 }"
bordered
>
<template #isScOpen="{ record }">
{{ record.isScOpen ? '已开通' : '未开通' }}
</template>
<template #isVip="{ record }">
{{ record.isVip ? '会员' : '非会员' }}
</template>
<template #hasBankInfo="{ record }">
<p>{{ record.belongBank }}</p>
<p>{{ record.payeeAccount }}</p>
<p>{{ record.payee }}</p>
<p>{{ record.payeeBank }}</p>
</template>
<template #action="{ record }">
<a-dropdown>
<template #overlay>
<a-menu>
<a-menu-item key="1">
<UserOutlined />
<a @click="getContactInfo(record)">查看联系人</a>
</a-menu-item>
<a-menu-item key="2">
<UserOutlined />
<a @click="showBindingDialog(record)">平台绑定</a>
</a-menu-item>
<a-menu-item key="3">
<UserOutlined />
<a @click="expansion(record)">数据扩容</a>
</a-menu-item>
<a-menu-item key="4">
<a @click="showregionalSpotVisible(record)">区域现货授权</a>
</a-menu-item>
</a-menu>
</template>
<a-button type="primary">
更多
<!-- <DownOutlined /> -->
<a-icon type="down" />
</a-button>
</a-dropdown>
</template>
<template #action1="{ record }">
<a @click="showOpenGHSDialog(record)">开通</a>
</template>
</a-table>
<a-modal title="联系人信息" v-model:visible="visible" :footer="null">
<a-table
:columns="infoColumns"
:dataSource="infoList"
:pagination="false"
:loading="listloading1"
:rowKey="(record) => record.sysid"
bordered
>
<template #action="{ record }">
<a @click="showResetPwd(record)">修改密码</a>
</template>
</a-table>
</a-modal>
<a-modal
title="开通供货商平台权限"
v-model:visible="openGHSDialogVisible"
@cancel="openGHSDialogVisible = false"
width="700px"
>
<div style="margin-bottom: 10px; display: flex; justify-content: space-between">
<div>
<a-button
:loading="batchOpening"
type="primary"
@click="batchOpen"
style="margin-right: 10px"
>批量开通平台</a-button
>
<a-button
:loading="batchOpening"
type="primary"
@click="batchClose"
style="margin-right: 10px"
>批量关闭平台</a-button
>
<a-button type="primary" @click="showBanDialog('禁用', true)" style="margin-right: 10px"
>批量禁用平台</a-button
>
<a-button type="primary" @click="showBanDialog('解禁', true)">批量解禁平台</a-button>
</div>
<a-button type="primary" @click="showRecord">操作记录</a-button>
</div>
<a-table
:columns="openGHSColumns"
:dataSource="openGHSDialogData"
:pagination="false"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:loading="openGHSDialogloading"
:rowKey="(record) => record.sysid"
bordered
>
<template #status="{ text }">
{{ text === 1 ? '开通' : '关闭' }}
</template>
<template #action="{ record }">
<a-button v-if="record.isOpen === 1" type="link" @click="closePlat(record)"
>关闭</a-button
>
<a-button v-else type="link" @click="openPlat(record)">开通</a-button>
<a-button
v-if="record.isDisable === 1"
type="link"
@click="showBanDialog('解禁', false, record)"
>解禁</a-button
>
<a-button v-else type="link" @click="showBanDialog('禁用', false, record)">禁用</a-button>
</template>
</a-table>
<template #footer>
<a-button @click="openGHSDialogVisible = false">取消</a-button>
</template>
</a-modal>
<a-modal
title="修改供货商信息"
v-model:visible="ghsInfoDialogVisible"
:destroyOnClose="true"
@ok="handleOk"
@cancel="handleCancel"
>
<template #footer>
<a-button :loading="confirmLoading" @click="handleCancel">取消</a-button>
<a-button :loading="confirmLoading" type="primary" @click="handleOk">确认</a-button>
</template>
<a-form :form="editForm" @submit="handleSubmit">
<div hidden>
<a-form-item>
<a-input
hidden
v-decorator="[
'supplierCode',
{ rules: [{ required: false, message: '请输入供货商名称!' }] },
]"
/>
</a-form-item>
</div>
<a-form-item label="供货商名称" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }">
<a-input
v-decorator="[
'supplierName',
{ rules: [{ required: false, message: '请输入供货商名称!' }] },
]"
/>
</a-form-item>
<a-form-item label="供货商简称" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }">
<a-input
v-decorator="[
'supplierShortName',
{ rules: [{ required: false, message: '请输入供货商简称!' }] },
]"
/>
</a-form-item>
</a-form>
</a-modal>
<a-modal
width="50%"
title="平台绑定"
v-model:visible="bindingDialog"
:destroyOnClose="true"
@ok="bindingDialog = false"
@cancel="bindingDialog = false"
>
<div>
<a-table
:columns="columns2"
:dataSource="bindingList"
:loading="bindingloading"
:rowKey="(record) => record.platCode"
bordered
>
<template #action="{ record }">
<a-button type="link" :disabled="record.platSupplierCode" @click="createAccount(record)"
>创建帐号</a-button
>
</template>
</a-table>
</div>
</a-modal>
<a-modal
title="修改密码"
v-model:visible="resetPwdVisible"
:destroyOnClose="true"
@ok="handlePwdOk"
@cancel="handlePwdCancel"
>
<template #footer>
<a-button :loading="confirmLoading" @click="handlePwdCancel">取消</a-button>
<a-button :loading="confirmLoading" type="primary" @click="handlePwdOk">确定</a-button>
</template>
<a-form
:model="pwdForm"
ref="pwdFormRef"
:label-col="{ span: 6 }"
:wrapper-col="{ span: 18 }"
@submit="handlePwdSubmit"
>
<div>
<a-form-item
label="帐号"
prop="username"
:rules="[{ required: false }]"
:label-col="{ span: 5 }"
:wrapper-col="{ span: 12 }"
>
<a-input disabled v-model:value="pwdForm.username" />
</a-form-item>
</div>
<a-form-item
label="密码"
prop="password"
:rules="[{ required: true, message: '请输入密码', trigger: 'blur' }]"
:label-col="{ span: 5 }"
:wrapper-col="{ span: 12 }"
>
<a-input type="password" v-model:value="pwdForm.password" />
</a-form-item>
</a-form>
</a-modal>
<a-modal
width="30%"
title="选择平台"
v-model:visible="changePlatDialog"
:destroyOnClose="true"
:afterClose="changePlatDialogClose"
:confirmLoading="selestedLoading"
@ok="submitChangePlat"
@cancel="changePlatDialog = false"
>
<a-select
mode="multiple"
:default-value="selestedPlist"
style="width: 80%; margin-left: 20px"
placeholder="请选择平台"
@change="handleChange"
>
<a-select-option v-for="item in platList" :key="item.sysid" :value="item.platCode">
{{ item.platName }}
</a-select-option>
</a-select>
</a-modal>
<a-modal title="填写备注" v-model:visible="banNoteDialogVisible" @cancel="closeBanNoteDialog">
<div style="padding: 10px">
<p style="margin-bottom: 10px"
>{{ banType }}以下平台:{{
isBatch ? selectedRows.map((item) => item.platName).join(',') : curPlat.platName
}}</p
>
<a-textarea v-model:value="banNote" placeholder="填写备注" />
</div>
<template #footer>
<a-button :loading="operatingBan" @click="closeBanNoteDialog">取消</a-button>
<a-button :loading="operatingBan" type="primary" @click="confirmBan(banType)"
>确定</a-button
>
</template>
</a-modal>
<!-- 操作记录 -->
<a-modal
:title="'操作记录(' + curGHS.ghsName + ')'"
v-model:visible="recordDialogVisible"
width="650px"
@cancel="recordDialogVisible = false"
@ok="recordDialogVisible = false"
>
<a-table
:columns="recordColumns"
:dataSource="recordList"
:pagination="false"
:loading="recordListLoading"
bordered
>
<template #record="{ record }">
<span v-if="record.isOpen === 1">开通</span>
<span v-if="record.isOpen === 0">关闭</span>
<span v-if="record.isDisable === 1">禁用</span>
<span v-if="record.isDisable === 0">解禁</span>
</template>
<template #note="{ text }">
{{ text ? text : '---' }}
</template>
</a-table>
</a-modal>
<a-modal
:title="contractGHSName + ' - 合同'"
v-model:visible="contractModalVisible"
width="1000px"
@ok="closeContractModal"
@cancel="closeContractModal"
>
<!-- <a-table
:columns="contractColumns"
:dataSource="contractList"
:rowKey="(record) => record.sysid"
:loading="contractLoading"
bordered
>
<span slot="chargePeriod" slot-scope="row">
{{ row.startTime }}
<br />
~
<br />
{{ row.endTime }}
</span>
<span slot="percentage" slot-scope="row">
{{ Number(row.percentage) * 100 }}%
</span>
<span slot="isRetain" slot-scope="row">
{{ row.isRetain ? '是' : '否 ' }}
</span>
<span slot="exPlatform" slot-scope="text">
{{ text ? text : '---' }}
</span>
<span slot="note" slot-scope="text">
{{ text ? text : '---' }}
</span>
</a-table> -->
</a-modal>
<a-modal
title="供应商商品数量限额调整"
v-model:visible="expansionVisible"
@cancel="closeExpansion"
@ok="confirmExpansion"
>
<a-form style="padding: 10px">
<a-form-item label="当前限额"
>{{ currentItem.limitNum }}
<a-button type="primary" style="margin-left: 100px" @click="viewOperate"
>操作记录</a-button
>
</a-form-item>
<a-form-item label="调整后限额">
<a-input-number
v-model:value="limitNum"
:min="1"
:max="99999999"
placeholder="请输入8位以内正整数"
style="width: 200px"
/>
</a-form-item>
<a-form-item label="调整依据">
<a-textarea
v-model:value="note"
style="word-break: keep-all; white-space: normal; word-wrap: break-word"
placeholder="请输入调整原因,例如 扩容合同编码和合同名称、厦大国资处同意函"
/>
</a-form-item>
</a-form>
</a-modal>
<a-modal
title="操作记录"
v-model:visible="operateDialogVisible"
@cancel="closeOperate"
@ok="closeOperate"
:width="800"
>
<a-table
:data-source="operateList"
:columns="operateColumns"
:pagination="operatePagination"
:loading="operateListLoading"
bordered
/>
</a-modal>
<a-modal title="区域现货授权管理" v-model:visible="regionalSpotVisible" width="30%">
<div style="padding: 10px">
<p style="font-weight: bold">{{ currentItem.ghsName }}</p>
<a-form>
<a-form-item label="区域现货授权" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }">
<a-radio-group name="radioGroup" v-model:value="regionalSpotIsOpen">
<a-radio value="1">已开通</a-radio>
<a-radio value="0">未开通</a-radio>
</a-radio-group>
</a-form-item>
</a-form>
<p style="background-color: #fbe0bb; padding: 5px"
>由已开通更新为末开通状态时,<span style="color: red"
>请将清空供应商区域现货管理的所有数据,</span
>请谨慎操作!</p
>
</div>
<template #footer>
<a-button :loading="operatingBan" @click="cancelRegionalSpot">取消</a-button>
<a-button :loading="operatingBan" type="primary" @click="confirmRegionalSpot()"
>提交</a-button
>
</template>
</a-modal>
</div>
</template>
<script setup>
import { Modal } from 'ant-design-vue';
import { ref, onMounted, nextTick } from 'vue';
import { message } from 'ant-design-vue';
import {
// listContractApi,
listApi,
createAccountApi,
batchClosePlatsApi,
stopPlatAccountApi,
batchOpenPlatsApi,
getGhsBondedPlatformApi,
listInfoAdminApi,
listContactInfoApi,
listBingStateApi,
// updateGhsInfoByGhsCodeApi,
updatePwdApi,
updateExPlatformApi,
listLogAccountManagementApi,
updateLimitNumApi,
getLimitLogApi,
operateisScApi,
} from '/@/api/supplierInfoManage';
const columns2 = [
{ title: '平台名称', dataIndex: 'platName', key: 'platName' },
{ title: '供货商平台编号', dataIndex: 'platSupplierCode', key: 'platSupplierCode' },
{ title: '绑定状态', dataIndex: 'isBonded', key: 'isBonded' },
{ title: '初始密码', dataIndex: 'initPwd', key: 'initPwd' },
{ title: '操作', key: 'operation1', slots: { customRender: 'action' } },
];
const columns = [
{ title: '供货商名称', dataIndex: 'ghsName', key: 'ghsName', align: 'center', width: 110 },
{
title: '供货商简称',
dataIndex: 'ghsShortName',
key: 'ghsShortName',
align: 'center',
width: 90,
},
{ title: '供货商编号', dataIndex: 'ghsCode', key: 'ghsCode', align: 'center', width: 80 },
{ title: '登录名', dataIndex: 'loginName', key: 'loginName', align: 'center', width: 80 },
{ title: '创建时间', dataIndex: 'createdTime', key: 'createdTime', align: 'center', width: 80 },
{ title: '商品数量限额', dataIndex: 'limitNum', key: 'limitNum', align: 'center', width: 80 },
{
title: '区域现货',
slots: { customRender: 'isScOpen' },
key: 'isScOpen',
align: 'center',
width: 80,
},
{ title: '是否会员', slots: { customRender: 'isVip' }, align: 'center', width: 80 },
{ title: '已开通', dataIndex: 'platOpened', key: 'platOpened', align: 'center', width: 110 },
{ title: '已绑定', dataIndex: 'platBonded', key: 'platBonded', align: 'center', width: 110 },
{
title: '银行信息',
slots: { customRender: 'hasBankInfo' },
key: 'hasBankInfo',
align: 'center',
width: 120,
},
// { title: '专属平台', dataIndex: 'exclusivePlatform', key: 'exclusivePlatform', align: 'center', width: 110 },
{
title: '开通',
key: 'operation',
slots: { customRender: 'action1' },
align: 'center',
width: 75,
},
{
title: '操作',
key: 'operation1',
width: 150,
slots: { customRender: 'action' },
align: 'center',
},
];
const openGHSColumns = [
{ title: '平台名称', dataIndex: 'platName' },
{ title: '状态', dataIndex: 'isOpen', slots: { customRender: 'status' }, align: 'center' },
{ title: '操作', slots: { customRender: 'action' }, align: 'center' },
];
const infoColumns = [
{ title: '姓名', dataIndex: 'name', key: 'name' },
{ title: '手机号', dataIndex: 'cellPhone', key: 'cellPhone' },
{ title: '邮箱', dataIndex: 'email', key: 'email' },
{ title: '操作', key: 'operation1', slots: { customRender: 'action' } },
];
const bindingList = ref([]);
const bindingloading = ref(false);
const list = ref([]);
const infoList = ref([]);
const pagination = ref({
// 分页配置器
pageSize: 10, // 一页的数据限制
current: 1, // 当前页
total: 0, // 总数
hideOnSinglePage: false, // 只有一页时是否隐藏分页器
showQuickJumper: true, // 是否可以快速跳转至某页
showSizeChanger: false, // 是否可以改变 pageSize
onChange: (current) => {
// 切换分页时的回调,
// 当在页面定义change事件时,切记要把此处的事件清除,因为这两个事件重叠了,可能到时候会导致一些莫名的bug
pagination.value.current = current;
getList();
},
});
const searchText = ref('');
const isVip = ref('');
const isScOpen = ref('');
const selectedRowKeys = ref([]);
const selectedRows = ref([]);
const listloading = ref(false);
const listloading1 = ref(true);
const visible = ref(false);
const currentItem = ref({});
const bindingDialog = ref(false);
const curGHS = ref('');
const openGHSDialogVisible = ref(false);
const openGHSDialogData = ref([]);
const openGHSDialogloading = ref(false);
const ghsInfoDialogVisible = ref(false);
const editForm = ref({});
const confirmLoading = ref(false);
const pwdForm = ref({
username: '',
password: '',
});
const pwdFormRef = ref();
const resetPwdVisible = ref(false);
const platList = ref({});
const selectedId = ref(0);
const changePlatDialog = ref(false);
const selestedPlist = ref([]);
const selestedLoading = ref(false);
const supplierCode = ref('');
const batchOpening = ref(false);
// =========禁用供货商============
const banNoteDialogVisible = ref(false);
const banNote = ref('');
const banType = ref('');
const operatingBan = ref(false);
const isBatch = ref(false);
const curPlat = ref({
platName: '',
platCode: '',
});
// =======操作记录==========
const recordDialogVisible = ref(false);
const recordListLoading = ref(false);
const recordList = ref([]);
const recordColumns = ref([
{ title: '平台名称', dataIndex: 'platName', width: 100 },
{ title: '操作', slots: { customRender: 'record' }, width: 100 },
{ title: '备注', dataIndex: 'note', slots: { customRender: 'note' }, width: 100 },
{ title: '操作人', dataIndex: 'name', width: 100 },
{ title: '操作时间', dataIndex: 'createTime', width: 100 },
]);
// 查看合同弹窗
const contractGHSName = ref('');
const contractModalVisible = ref(false);
// const contractLoading = ref(false);
const contractList = ref([]);
// const contractColumns = ref([
// {
// title: '周期',
// scopedSlots: { customRender: 'chargePeriod' },
// key: 'chargePeriod',
// align: 'center',
// width: '150px',
// },
// {
// title: '收取流水百分比',
// scopedSlots: { customRender: 'percentage' },
// key: 'percentage',
// align: 'center',
// width: '100px',
// },
// { title: '预付款(元)', dataIndex: 'money', key: 'money', align: 'center', width: '100px' },
// {
// title: '是否沿用',
// scopedSlots: { customRender: 'isRetain' },
// key: 'isRetain',
// align: 'center',
// width: '100px',
// },
// {
// title: '会员费',
// dataIndex: 'membershipFee',
// key: 'membershipFee',
// align: 'center',
// width: '100px',
// },
// {
// title: '专属平台',
// dataIndex: 'exPlatform',
// key: 'exPlatform',
// align: 'center',
// width: '100px',
// scopedSlots: { customRender: 'exPlatform' },
// },
// {
// title: '备注',
// dataIndex: 'note',
// key: 'note',
// align: 'center',
// width: '100px',
// scopedSlots: { customRender: 'note' },
// },
// {
// title: '操作时间',
// dataIndex: 'createTime',
// key: 'createTime',
// align: 'center',
// width: '100px',
// },
// ]);
const expansionVisible = ref(false);
const limitNum = ref(undefined);
const note = ref('');
const operateDialogVisible = ref(false);
const operateList = ref([]);
const operateColumns = ref([
{ title: '操作人', dataIndex: 'operator', key: 'operator', align: 'center', width: '100px' },
{
title: '操作',
dataIndex: 'operatorNote',
key: 'operatorNote',
align: 'center',
width: '100px',
},
{
title: '操作类型',
dataIndex: 'operatorType',
key: 'operatorType',
align: 'center',
width: '100px',
},
{ title: '操作备注', dataIndex: 'note', key: 'note', align: 'center', width: '100px' },
{
title: '操作时间',
dataIndex: 'operatorTime',
key: 'operatorTime',
align: 'center',
width: '100px',
},
]);
const operatePagination = ref({
// 分页配置器
pageSize: 10, // 一页的数据限制
current: 1, // 当前页
total: 0, // 总数
hideOnSinglePage: false, // 只有一页时是否隐藏分页器
showQuickJumper: true, // 是否可以快速跳转至某页
showSizeChanger: false, // 是否可以改变 pageSize
onChange: (current) => {
// 切换分页时的回调,
// 当在页面定义change事件时,切记要把此处的事件清除,因为这两个事件重叠了,可能到时候会导致一些莫名的bug
operatePagination.value.current = current;
getOperateList();
},
});
const operateListLoading = ref(false);
//区域现货
const regionalSpotVisible = ref(false);
const regionalSpotIsOpen = ref('');
onMounted(() => {
getList();
getPlatList();
});
const closeContractModal = () => {
contractModalVisible.value = false;
contractGHSName.value = '';
contractList.value = [];
};
// const showContract = (ghsCode, ghsName) => {
// contractModalVisible.value = true;
// contractGHSName.value = ghsName;
// const param = {
// supplierCode: ghsCode,
// };
// contractLoading.value = true;
// listContractApi(param).then((res) => {
// if (res.success) {
// contractList.value = res.data;
// } else {
// contractList.value = [];
// }
// contractLoading.value = false;
// });
// };
const getPlatList = () => {
listApi().then((res) => {
if (res.success) {
platList.value = res.data;
} else {
message.error(res.message);
}
});
};
const createAccount = (item) => {
const param = { ghsCode: currentItem.value.ghsCode, plat: item.platCode };
createAccountApi(param).then((res) => {
if (res.success) {
message.success(res.message);
showBindingDialog(currentItem.value);
} else {
message.error(res.message);
}
});
};
const batchClose = () => {
if (!selectedRows.value.length) {
message.warning('请先选择平台');
return;
}
const param = {
sysids: selectedRowKeys.value.join(','),
};
Modal.confirm({
title: '确认',
content: `确认关闭以下平台:${selectedRows.value.map((item) => item.platName).join('')}`,
okText: '确认关闭',
cancelText: '取消',
onOk: () => {
batchOpening.value = true;
batchClosePlatsApi(param)
.then((res) => {
if (res.success) {
message.success('关闭成功');
selectedRows.value = [];
selectedRowKeys.value = [];
getList();
showOpenGHSDialog(curGHS.value);
} else {
message.error(res.message);
}
batchOpening.value = false;
})
.catch(() => {
batchOpening.value = false;
});
},
});
};
const closePlat = (item) => {
const param = {
sysids: item.sysid.toString(),
};
Modal.confirm({
title: '确认',
content: `确认关闭平台${item.platName}吗?`,
okText: '确认关闭',
cancelText: '取消',
onOk: () => {
batchClosePlatsApi(param).then((res) => {
if (res.success) {
message.success('关闭成功');
showOpenGHSDialog(curGHS.value);
} else {
message.error(res.message);
}
});
},
});
};
const batchOpen = () => {
if (!selectedRows.value.length) {
message.warning('请先选择平台');
return;
}
const param = {
sysids: selectedRowKeys.value.join(','),
};
Modal.confirm({
title: '确认',
content: `确认开通以下平台:${selectedRows.value.map((item) => item.platName).join('')}`,
okText: '确认开通',
cancelText: '取消',
onOk: () => {
batchOpening.value = true;
batchOpenPlatsApi(param)
.then((res) => {
if (res.success) {
message.success('开通成功');
selectedRows.value = [];
selectedRowKeys.value = [];
getList();
showOpenGHSDialog(curGHS.value);
} else {
message.error(res.message);
}
batchOpening.value = false;
})
.catch(() => {
batchOpening.value = false;
});
},
});
};
// 批量禁用/解禁平台
const showBanDialog = (banType1, isBatch1, item) => {
if (!selectedRows.value.length && isBatch1) {
message.warning('请先选择平台');
return;
}
banType.value = banType1;
banNoteDialogVisible.value = true;
isBatch.value = isBatch1;
if (!isBatch1) {
curPlat.value = JSON.parse(JSON.stringify(item));
}
};
const closeBanNoteDialog = () => {
banNoteDialogVisible.value = false;
banType.value = '';
banNote.value = '';
isBatch.value = false;
curPlat.value.platName = '';
curPlat.value.platCode = '';
};
const confirmBan = (banType) => {
const param = {
supplierCode: curGHS.value.ghsCode,
note: banNote.value,
type: banType === '禁用' ? '1' : '0',
platCode: isBatch.value
? selectedRows.value.map((item) => item.platCode).join(',')
: curPlat.value.platCode,
};
operatingBan.value = true;
stopPlatAccountApi(param)
.then((res) => {
if (res.success) {
message.success(res.message);
selectedRows.value = [];
selectedRowKeys.value = [];
closeBanNoteDialog();
showOpenGHSDialog(curGHS.value);
} else {
message.error(res.message);
}
operatingBan.value = false;
})
.catch(() => {
operatingBan.value = false;
});
};
const openPlat = (item) => {
const param = {
sysids: item.sysid.toString(),
};
Modal.confirm({
title: '确认',
content: `确认开通平台${item.platName}吗?`,
okText: '确认开通',
cancelText: '取消',
onOk: () => {
batchOpenPlatsApi(param).then((res) => {
if (res.success) {
message.success('开通成功');
getList();
showOpenGHSDialog(curGHS.value);
} else {
message.error(res.message);
}
});
},
});
};
const onSelectChange = (keys, rows) => {
selectedRows.value = rows;
selectedRowKeys.value = keys;
};
const showOpenGHSDialog = (text) => {
curGHS.value = text;
openGHSDialogVisible.value = true;
openGHSDialogloading.value = true;
const param = { supplierCode: text.ghsCode };
getGhsBondedPlatformApi(param).then((res) => {
if (res.success) {
openGHSDialogData.value = res.data;
} else {
openGHSDialogData.value = [];
}
openGHSDialogloading.value = false;
});
};
const onSearch = () => {
pagination.value.current = 1;
getList();
};
const getList = () => {
const param = {
currentPage: pagination.value.current,
pageSize: pagination.value.pageSize,
searchText: searchText.value,
isVip: isVip.value,
isScOpen: isScOpen.value,
};
listloading.value = true;
listInfoAdminApi(param).then((res) => {
if (res.success) {
list.value = res.data;
pagination.value.total = res.data[0].total;
} else {
list.value = [];
pagination.value.total = 0;
}
listloading.value = false;
});
};
const getContactInfo = (text) => {
visible.value = true;
const param = {
supplierCode: text.ghsCode,
};
listContactInfoApi(param).then((res) => {
if (res.success) {
infoList.value = res.data;
} else {
infoList.value = [];
}
listloading1.value = false;
});
};
const showBindingDialog = (item) => {
bindingDialog.value = true;
bindingloading.value = true;
currentItem.value = item;
const param = { supplierCode: item.ghsCode };
listBingStateApi(param).then((res) => {
if (res.success) {
bindingList.value = res.data;
} else {
bindingList.value = [];
}
bindingloading.value = false;
});
};
// const editGhsinfo = (item) => {
// ghsInfoDialogVisible.value = true;
// nextTick(() => {
// editForm.value.supplierName = item.ghsName;
// editForm.value.supplierShortName = item.ghsShortName;
// editForm.value.supplierCode = item.ghsCode;
// });
// };
const handleOk = (e) => {
confirmLoading.value = true;
handleSubmit(e);
};
const handlePwdOk = (e) => {
confirmLoading.value = true;
handlePwdSubmit(e);
};
const handleCancel = () => {
ghsInfoDialogVisible.value = false;
};
const handlePwdCancel = () => {
resetPwdVisible.value = false;
confirmLoading.value = false;
};
// const handleSubmit = (e) => {
// e.preventDefault();
// editForm.validateFields((err, values) => {
// if (err) {
// return;
// }
// updateGhsInfoByGhsCodeApi(values).then((res) => {
// if (res.success) {
// message.success(res.message);
// } else {
// message.error(res.message);
// }
// ghsInfoDialogVisible.value = false;
// getList();
// confirmLoading.value = false;
// });
// });
// };
const showResetPwd = (item) => {
console.log(item);
resetPwdVisible.value = true;
nextTick(() => {
pwdForm.value.username = item.username;
pwdForm.value.password = '';
console.log(pwdForm.value);
});
};
// modalFormRef.value.validateFields().then
const handlePwdSubmit = (e) => {
e.preventDefault();
console.log(pwdFormRef.value);
// return
pwdFormRef.value
.validateFields()
.then((values) => {
updatePwdApi(values).then((res) => {
if (res.success) {
message.success(res.message);
resetPwdVisible.value = false;
} else {
message.warning(res.message);
}
confirmLoading.value = false;
});
})
.catch(() => {
confirmLoading.value = false;
return;
});
};
// 选择平台
// const selectPlat = (item) => {
// selectedId.value = item.sysid;
// changePlatDialog.value = true;
// supplierCode.value = item.ghsCode;
// };
const changePlatDialogClose = () => {
selestedPlist.value = [];
selestedLoading.value = false;
};
// 选择平台后确认提交
const submitChangePlat = () => {
if (selestedPlist.value.length < 1) {
return message.warning('请选择平台');
}
const param = {
ghsCode: supplierCode.value,
exPlatform: selestedPlist.value.join(','),
};
selestedLoading.value = true;
updateExPlatformApi(param).then((res) => {
if (res.success) {
message.success(res.message);
selestedLoading.value = false;
changePlatDialog.value = false;
// 更新修改,但不刷新页面
const selectedItemID = list.value.findIndex((item) => item.sysid === selectedId.value);
const obj = selestedPlist.value.map((item) => {
return platList.value.find((e) => e.platCode === item).platName;
});
list.value.selectedItemID = {
...this.list[selectedItemID],
exclusivePlatform: obj.join(','),
};
// this.$set(this.list, selectedItemID, { ...this.list[selectedItemID], exclusivePlatform: obj.join(',') })
} else {
message.error(res.message);
selestedLoading.value = false;
}
});
};
const handleChange = (val) => {
selestedPlist.value = val;
};
const showRecord = () => {
recordDialogVisible.value = true;
const param = { supplierCode: curGHS.value.ghsCode };
recordListLoading.value = true;
listLogAccountManagementApi(param)
.then((res) => {
if (res.success) {
recordList.value = res.data;
} else {
recordList.value = [];
}
recordListLoading.value = false;
})
.catch(() => {
recordListLoading.value = false;
});
};
const expansion = (item) => {
currentItem.value = item;
expansionVisible.value = true;
};
const closeExpansion = () => {
expansionVisible.value = false;
currentItem.value = {};
note.value = '';
limitNum.value = undefined;
};
const confirmExpansion = () => {
if (!limitNum.value) {
return message.warning('请输入调整后限制');
}
const param = {
ghsCode: currentItem.value.ghsCode,
limitNum: limitNum.value,
note: note.value,
};
updateLimitNumApi(param).then((res) => {
if (res.success) {
message.success('操作成功');
closeExpansion();
getList();
} else {
message.error(res.message);
}
});
};
const viewOperate = () => {
operateDialogVisible.value = true;
operateList.value = [];
getOperateList();
};
const getOperateList = () => {
const param = {
ghsCode: currentItem.value.ghsCode,
pageIndex: operatePagination.value.current,
pageSize: operatePagination.value.pageSize,
};
operateListLoading.value = true;
getLimitLogApi(param).then((res) => {
if (res.success) {
operateList.value = res.data;
operatePagination.value.total = res.data[0].total;
} else {
operateList.value = [];
operatePagination.value.total = 0;
}
operateListLoading.value = false;
});
};
const closeOperate = () => {
operateDialogVisible.value = false;
};
const showregionalSpotVisible = (item) => {
currentItem.value = item;
regionalSpotVisible.value = true;
};
const cancelRegionalSpot = () => {
regionalSpotVisible.value = false;
regionalSpotIsOpen.value = '';
};
const confirmRegionalSpot = () => {
if (!regionalSpotIsOpen.value) {
return message.warning('请选择是否开通区域管理');
}
const param = {
supplierCode: currentItem.value.ghsCode,
type: regionalSpotIsOpen.value,
};
operateisScApi(param).then((res) => {
if (res.success) {
message.success(res.message);
} else {
message.error(res.message);
}
cancelRegionalSpot();
getList();
});
};
</script>
<style lang="scss" scoped></style>
<style>
/* .error {
background: red;
} */
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment