提交 c7ae00b9 authored 作者: 袁伟伟's avatar 袁伟伟

feat

上级 71c4a018
...@@ -142,6 +142,7 @@ export interface Goods { ...@@ -142,6 +142,7 @@ export interface Goods {
goodsCategoryList: Array<{ id: number }> | number[]; goodsCategoryList: Array<{ id: number }> | number[];
name: string; name: string;
pic?: string;
} }
export type GoodsPageResult = PageResult<Goods>; export type GoodsPageResult = PageResult<Goods>;
......
...@@ -6,57 +6,44 @@ ...@@ -6,57 +6,44 @@
import { defHttp } from '/@/utils/http/axios'; import { defHttp } from '/@/utils/http/axios';
import { ApiResponse } from '../model/baseModel'; import { ApiResponse } from '../model/baseModel';
import { import { Goods, GoodsParams, GoodsPageResult, GoodsPageResponse, GoodsResponse } from '../model/goods';
Goods,
GoodsParams,
GoodsPageResult,
GoodsPageResponse,
GoodsResponse,
} from '../model/goods';
const baseApi = '/v1/product/goods'; const baseApi = '/v1/product/goods';
/** /**
* 新增 * 新增
*/ */
export const add = (entity: Goods) => export const add = (entity: Goods) => defHttp.post<Goods>({ url: `${baseApi}/add`, data: entity });
defHttp.post<Goods>({ url: `${baseApi}/`, data: entity });
/** /**
* 更新 * 更新
*/ */
export const update = (entity: Goods) => export const update = (entity: Goods) => defHttp.post<Goods>({ url: `${baseApi}/updateGoods`, data: entity });
defHttp.put<Goods>({ url: `${baseApi}/`, data: entity });
/** /**
* 删除 * 删除
*/ */
export const remove = (id: any) => export const remove = (id: any) => defHttp.delete<Number>({ url: `${baseApi}/${id}` });
defHttp.delete<Number>({ url: `${baseApi}/${id}` });
/** /**
* 分页查询 * 分页查询
*/ */
export const search = (params?: GoodsParams) => export const search = (params?: GoodsParams) => defHttp.get<GoodsPageResult>({ url: `${baseApi}/search`, params });
defHttp.get<GoodsPageResult>({ url: `${baseApi}/search`, params });
/** /**
* 列表查询 * 列表查询
*/ */
export const all = (params?: GoodsParams) => export const all = (params?: GoodsParams) => defHttp.get<GoodsPageResult>({ url: `${baseApi}/all`, params });
defHttp.get<GoodsPageResult>({ url: `${baseApi}/all`, params });
/** /**
* 通过主键查询 * 通过主键查询
*/ */
export const getById = (id: any) => export const getById = (id: any) => defHttp.get<Goods>({ url: `${baseApi}/${id}` });
defHttp.get<Goods>({ url: `${baseApi}/${id}` });
/** /**
* 单个查询 * 单个查询
*/ */
export const getOne = (params?: GoodsParams) => export const getOne = (params?: GoodsParams) => defHttp.get<Goods>({ url: `${baseApi}/one`, params });
defHttp.get<Goods>({ url: `${baseApi}/one`, params });
/** /**
* 批量删除 * 批量删除
...@@ -79,7 +66,9 @@ export const batchUpdate = (entityList: Array<Goods>) => ...@@ -79,7 +66,9 @@ export const batchUpdate = (entityList: Array<Goods>) =>
/** /**
* 查询数量 * 查询数量
*/ */
export const count = (params?: GoodsParams) => export const count = (params?: GoodsParams) => defHttp.get<Number>({ url: `${baseApi}/count`, params });
defHttp.get<Number>({ url: `${baseApi}/count`, params });
/**
* 产品线查询
*/
export const line = () => defHttp.get<Number>({ url: `/v1/system/third/get/product/line` });
...@@ -6,57 +6,44 @@ ...@@ -6,57 +6,44 @@
import { defHttp } from '/@/utils/http/axios'; import { defHttp } from '/@/utils/http/axios';
import { ApiResponse } from '../model/baseModel'; import { ApiResponse } from '../model/baseModel';
import { import { User, UserParams, UserPageResult, UserPageResponse, UserResponse } from '../model/user';
User,
UserParams,
UserPageResult,
UserPageResponse,
UserResponse,
} from '../model/user';
const baseApi = '/v1/system/user'; const baseApi = '/v1/system/user';
/** /**
* 新增 * 新增
*/ */
export const add = (entity: User) => export const add = (entity: User) => defHttp.post<User>({ url: `${baseApi}/`, data: entity });
defHttp.post<User>({ url: `${baseApi}/`, data: entity });
/** /**
* 更新 * 更新
*/ */
export const update = (entity: User) => export const update = (entity: User) => defHttp.put<User>({ url: `${baseApi}/`, data: entity });
defHttp.put<User>({ url: `${baseApi}/`, data: entity });
/** /**
* 删除 * 删除
*/ */
export const remove = (id: any) => export const remove = (id: any) => defHttp.delete<Number>({ url: `${baseApi}/${id}` });
defHttp.delete<Number>({ url: `${baseApi}/${id}` });
/** /**
* 分页查询 * 分页查询
*/ */
export const search = (params?: UserParams) => export const search = (params?: UserParams) => defHttp.get<UserPageResult>({ url: `${baseApi}/search`, params });
defHttp.get<UserPageResult>({ url: `${baseApi}/search`, params });
/** /**
* 列表查询 * 列表查询
*/ */
export const all = (params?: UserParams) => export const all = (params?: UserParams) => defHttp.get<UserPageResult>({ url: `${baseApi}/all`, params });
defHttp.get<UserPageResult>({ url: `${baseApi}/all`, params });
/** /**
* 通过主键查询 * 通过主键查询
*/ */
export const getById = (id: any) => export const getById = (id: any) => defHttp.get<User>({ url: `${baseApi}/${id}` });
defHttp.get<User>({ url: `${baseApi}/${id}` });
/** /**
* 单个查询 * 单个查询
*/ */
export const getOne = (params?: UserParams) => export const getOne = (params?: UserParams) => defHttp.get<User>({ url: `${baseApi}/one`, params });
defHttp.get<User>({ url: `${baseApi}/one`, params });
/** /**
* 批量删除 * 批量删除
...@@ -79,8 +66,7 @@ export const batchUpdate = (entityList: Array<User>) => ...@@ -79,8 +66,7 @@ export const batchUpdate = (entityList: Array<User>) =>
/** /**
* 查询数量 * 查询数量
*/ */
export const count = (params?: UserParams) => export const count = (params?: UserParams) => defHttp.get<Number>({ url: `${baseApi}/count`, params });
defHttp.get<Number>({ url: `${baseApi}/count`, params });
/** /**
* 用户登录 * 用户登录
...@@ -94,8 +80,7 @@ export const login = (loginInfo: { username: string; password: string }) => ...@@ -94,8 +80,7 @@ export const login = (loginInfo: { username: string; password: string }) =>
/** /**
* 用户登出 * 用户登出
*/ */
export const logout = () => export const logout = () => defHttp.post<any>({ url: `${baseApi}/logout` }, { errorMessageMode: 'none' });
defHttp.post<any>({ url: `${baseApi}/logout` }, { errorMessageMode: 'none' });
/** /**
* 用户注册 * 用户注册
...@@ -106,8 +91,7 @@ export const register = (user: User) => ...@@ -106,8 +91,7 @@ export const register = (user: User) =>
/** /**
* 当前用户信息 * 当前用户信息
*/ */
export const info = () => export const info = () => defHttp.get<User>({ url: `${baseApi}/info` }, { errorMessageMode: 'none' });
defHttp.get<User>({ url: `${baseApi}/info` }, { errorMessageMode: 'none' });
/** /**
* 修改密码 * 修改密码
...@@ -115,4 +99,7 @@ export const info = () => ...@@ -115,4 +99,7 @@ export const info = () =>
export const changePassword = (passwordInfo: any) => export const changePassword = (passwordInfo: any) =>
defHttp.post<User>({ url: `${baseApi}/change-password`, data: passwordInfo }); defHttp.post<User>({ url: `${baseApi}/change-password`, data: passwordInfo });
/**
* 审核
*/
export const verify = (data: any) => defHttp.post<User>({ url: `${baseApi}/batch/verify`, data });
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
} }
.ant-modal-body { .ant-modal-body {
padding: 0; // padding: 0;
> .scrollbar > .scrollbar__bar.is-horizontal { > .scrollbar > .scrollbar__bar.is-horizontal {
display: none; display: none;
......
...@@ -41,8 +41,3 @@ ...@@ -41,8 +41,3 @@
-ms-user-select: none; -ms-user-select: none;
user-select: none; user-select: none;
} }
p {
padding: 0;
margin: 0;
}
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
</a-select> </a-select>
</a-form-item> </a-form-item>
<a-form-item label="分类名称" name="name"> <a-form-item label="分类名称" name="name">
<a-input v-model:value="formData.name" /> <a-input v-model:value="formData.name" :disabled="formData.parentId === 0" />
</a-form-item> </a-form-item>
<a-form-item label="排序" name="sort"> <a-form-item label="排序" name="sort">
<a-input-number v-model:value="formData.sort" :min="0" /> <a-input-number v-model:value="formData.sort" :min="0" />
...@@ -56,11 +56,13 @@ ...@@ -56,11 +56,13 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { defineExpose, ref, reactive, defineEmits, watch, defineProps } from 'vue'; import { defineExpose, ref, reactive, defineEmits, watch, defineProps, onMounted } from 'vue';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import * as GoodsCategoryApi from '/@/api/product/goodsCategoryApi'; import * as GoodsCategoryApi from '/@/api/product/goodsCategoryApi';
import * as GoodsApi from '/@/api/product/goodsApi';
import { DataItem } from '/@/views/product/goods-category/type'; import { DataItem } from '/@/views/product/goods-category/type';
import { GoodsCategory } from '/@/api/model/goodsCategory'; import { GoodsCategory } from '/@/api/model/goodsCategory';
import { fieldNames, rulesRef } from './schema'; import { fieldNames, rulesRef } from './schema';
import lodash from 'lodash'; import lodash from 'lodash';
...@@ -80,7 +82,7 @@ ...@@ -80,7 +82,7 @@
// 树结构选项 // 树结构选项
const classifyTree = ref<DataItem[]>([]); const classifyTree = ref<DataItem[]>([]);
const thirdProductOption = ref([{ name: '产品线1', id: 1 }]); const thirdProductOption = ref<any>([]);
// 获取树结构 // 获取树结构
const getTreeData = () => { const getTreeData = () => {
...@@ -109,6 +111,12 @@ ...@@ -109,6 +111,12 @@
formData.lineName = option.key; formData.lineName = option.key;
}; };
const handleGetLineList = () => {
GoodsApi.line().then((res) => {
thirdProductOption.value = res;
});
};
const handleOk = () => { const handleOk = () => {
formRef.value.validate().then(() => { formRef.value.validate().then(() => {
const data = lodash.cloneDeep(formData); const data = lodash.cloneDeep(formData);
...@@ -159,6 +167,10 @@ ...@@ -159,6 +167,10 @@
}, },
); );
onMounted(() => {
handleGetLineList();
});
defineExpose({ visible }); defineExpose({ visible });
</script> </script>
......
<template>
<div class="">
<a-upload
v-model:file-list="fileList"
list-type="picture-card"
class="avatar-uploader"
:action="apiUrl"
:before-upload="beforeUpload"
:headers="headers"
name="file"
@change="handleChange"
@preview="handlePreview"
>
<div v-if="fileList.length < 8">
<plus-outlined />
<div style="margin-top: 8px">上传</div>
</div>
</a-upload>
<a-modal :visible="previewVisible" title="预览" :footer="null" @cancel="handleCancel">
<img alt="example" style="width: 100%" :src="previewImage" />
</a-modal>
</div>
</template>
<script lang="ts" setup>
import { ref, defineExpose, defineProps, watch } from 'vue';
import { useGlobSetting } from '/@/hooks/setting';
import { getToken } from '/@/utils/auth';
import { message, UploadChangeParam, UploadProps } from 'ant-design-vue';
const props = defineProps(['editFileList']);
const fileList = ref([]);
const picLoading = ref<boolean>(false);
const globSetting = useGlobSetting();
const apiUrl = globSetting.uploadUrl;
const token = getToken();
const headers = {
Authorization: token,
};
const handleChange = (info: UploadChangeParam) => {
if (info.file.status === 'uploading') {
picLoading.value = true;
return;
}
if (info.file.status === 'done') {
picLoading.value = false;
}
if (info.file.status === 'error') {
picLoading.value = false;
message.error('上传失败');
}
};
const beforeUpload = (file: UploadProps['fileList'][number]) => {
const isJpgOrPng =
file.type === 'image/jpeg' ||
file.type === 'image/png' ||
file.type === 'image/jpg' ||
file.type === 'image/gif' ||
file.type === 'image/webp';
if (!isJpgOrPng) {
message.error('请上传图片格式');
}
// const isLt2M = file.size / 1024 / 1024 < 2;
// if (!isLt2M) {
// message.error('Image must smaller than 2MB!');
// }
return isJpgOrPng;
};
const previewVisible = ref(false);
const previewImage = ref('');
const handleCancel = () => {
previewVisible.value = false;
};
const handlePreview = async (file: UploadProps['fileList'][number]) => {
previewImage.value = file.url;
previewVisible.value = true;
};
watch(
() => props.editFileList,
(n) => {
if (n) {
console.log(n);
fileList.value = n;
}
},
{
immediate: true,
deep: true,
},
);
defineExpose({ fileList });
</script>
<style lang="less" scoped></style>
...@@ -8,13 +8,13 @@ ...@@ -8,13 +8,13 @@
<a-table :dataSource="dataSource" :columns="productColumns" :pagination="false"> <a-table :dataSource="dataSource" :columns="productColumns" :pagination="false">
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'"> <template v-if="column.key === 'action'">
<a-button type="link">编辑</a-button> <a-button type="link" @click="handleEdit(record)">编辑</a-button>
<a-button type="link">删除</a-button> <a-button type="link" @click="handleDelete(record)">删除</a-button>
</template> </template>
</template> </template>
</a-table> </a-table>
</div> </div>
<a-modal v-model:visible="visible" title="新增" @ok="handleSubmit"> <a-modal v-model:visible="visible" title="新增" @ok="handleSubmit" @cancel="handleCancel">
<a-form <a-form
:model="formData" :model="formData"
:label-col="{ span: 6 }" :label-col="{ span: 6 }"
...@@ -23,11 +23,11 @@ ...@@ -23,11 +23,11 @@
ref="formRef" ref="formRef"
:rules="productRulesRef" :rules="productRulesRef"
> >
<a-form-item label="产品编号" name="code"> <a-form-item label="产品编号" name="thirdProductId">
<a-input v-model:value="formData.code" /> <a-input v-model:value="formData.thirdProductId" />
</a-form-item> </a-form-item>
<a-form-item label="数量" name="number"> <a-form-item label="数量" name="quantity">
<a-input v-model:value="formData.number" /> <a-input v-model:value="formData.quantity" />
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-modal> </a-modal>
...@@ -35,15 +35,17 @@ ...@@ -35,15 +35,17 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from 'vue'; import { message } from 'ant-design-vue';
import { ref, reactive, defineExpose, defineProps, watch } from 'vue';
import { productColumns, productRulesRef } from '../schema'; import { productColumns, productRulesRef } from '../schema';
const props = defineProps(['editProductList']);
const visible = ref(false); const visible = ref(false);
const dataSource = ref(); const dataSource = ref<any>([]);
const formRef = ref(); const formRef = ref();
const formData = ref({ const formData = reactive({
code: '', thirdProductId: '',
number: '', quantity: '',
}); });
const handleAdd = () => { const handleAdd = () => {
...@@ -52,9 +54,57 @@ ...@@ -52,9 +54,57 @@
const handleSubmit = () => { const handleSubmit = () => {
formRef.value.validate().then(() => { formRef.value.validate().then(() => {
visible.value = false; const index = dataSource.value.findIndex((item) => {
return item.thirdProductId === formData.thirdProductId;
});
if (index != -1) {
dataSource.value[index].quantity = formData.quantity;
} else {
dataSource.value.push({
thirdProductId: formData.thirdProductId,
quantity: formData.quantity,
});
}
message.success('操作成功');
handleCancel();
}); });
}; };
const handleEdit = (info) => {
formData.thirdProductId = info.thirdProductId;
formData.quantity = info.quantity;
visible.value = true;
};
const handleDelete = (info) => {
const index = dataSource.value.findIndex((item) => {
return item.thirdProductId === info.thirdProductId;
});
dataSource.value.splice(index, 1);
message.success('删除成功');
};
const handleCancel = () => {
formRef.value.resetFields();
visible.value = false;
};
watch(
() => props.editProductList,
(n) => {
if (n) {
dataSource.value = n;
}
},
{
immediate: true,
},
);
defineExpose({ dataSource });
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
......
...@@ -4,8 +4,10 @@ ...@@ -4,8 +4,10 @@
<a-tabs v-model:activeKey="activeKey" centered> <a-tabs v-model:activeKey="activeKey" centered>
<a-tab-pane key="1" tab="基本信息"><BasicInfo ref="basicInfoRef" @handleSubmit="handleSubmit" /> </a-tab-pane> <a-tab-pane key="1" tab="基本信息"><BasicInfo ref="basicInfoRef" @handleSubmit="handleSubmit" /> </a-tab-pane>
<a-tab-pane key="2" tab="商品描述" force-render>Content of Tab Pane 2</a-tab-pane> <a-tab-pane key="2" tab="商品描述" force-render>Content of Tab Pane 2</a-tab-pane>
<a-tab-pane key="3" tab="商品图片">Content of Tab Pane 3</a-tab-pane> <a-tab-pane key="3" tab="商品图片"
<a-tab-pane key="4" tab="产品规格"><Product /></a-tab-pane> ><Picture ref="pictureRef" :editFileList="editFileList"></Picture
></a-tab-pane>
<a-tab-pane key="4" tab="产品规格"><Product ref="productRef" :editProductList="editProductList" /></a-tab-pane>
</a-tabs> </a-tabs>
<div class="btnWrap"> <div class="btnWrap">
<a-button type="primary" @click="handleAdd">提交</a-button> <a-button type="primary" @click="handleAdd">提交</a-button>
...@@ -21,6 +23,7 @@ ...@@ -21,6 +23,7 @@
import BasicInfo from './components/basicInfo.vue'; import BasicInfo from './components/basicInfo.vue';
import * as GoodsApi from '/@/api/product/goodsApi'; import * as GoodsApi from '/@/api/product/goodsApi';
import Product from './components/product.vue'; import Product from './components/product.vue';
import Picture from './components/picture.vue';
import { useGo } from '/@/hooks/web/usePage'; import { useGo } from '/@/hooks/web/usePage';
import lodash from 'lodash'; import lodash from 'lodash';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
...@@ -28,9 +31,14 @@ ...@@ -28,9 +31,14 @@
const route = useRoute(); const route = useRoute();
const go = useGo(); const go = useGo();
const basicInfoRef = ref(); const basicInfoRef = ref();
const pictureRef = ref();
const productRef = ref();
const activeKey = ref('1'); const activeKey = ref('1');
const id = route.query.id; const id = route.query.id;
let editInfo;
let basicInfo; let basicInfo;
const editFileList = ref<any>([]);
const editProductList = ref<any>([]);
const getInfo = () => { const getInfo = () => {
GoodsApi.getById(id).then((res) => { GoodsApi.getById(id).then((res) => {
...@@ -42,6 +50,27 @@ ...@@ -42,6 +50,27 @@
for (const key in basicInfo) { for (const key in basicInfo) {
basicInfo[key] = res[key]; basicInfo[key] = res[key];
} }
if (res.pic) {
const picList = res.pic.split(',');
picList.forEach((url, index) => {
editFileList.value.push({
thumbUrl: url,
url: url,
type: 'image/jpeg',
uid: index,
response: {
result: url,
},
});
});
}
if (res.productList) {
editProductList.value = res.productList;
}
editInfo = res;
}); });
}; };
...@@ -62,6 +91,29 @@ ...@@ -62,6 +91,29 @@
} else { } else {
api = GoodsApi.add; api = GoodsApi.add;
} }
if (pictureRef.value) {
const fileList = pictureRef.value.fileList;
let pic = '';
fileList.forEach((item, index) => {
if (index === 0) {
pic = item.response.result;
} else {
pic += `,${item.response.result}`;
}
});
data.pic = pic;
} else if (editInfo && editInfo.pic) {
data.pic = editInfo.pic;
}
if (productRef.value) {
data.productList = productRef.value.dataSource;
} else if (editInfo && editInfo.productList) {
data.productList = editInfo.productList;
}
api(data).then(() => { api(data).then(() => {
message.success('操作成功'); message.success('操作成功');
handleBack(); handleBack();
......
...@@ -83,8 +83,8 @@ export const productColumns = [ ...@@ -83,8 +83,8 @@ export const productColumns = [
}, },
{ {
title: '产品编号', title: '产品编号',
dataIndex: 'index', dataIndex: 'thirdProductId',
key: 'index0', key: 'thirdProductId',
}, },
{ {
title: '产品名称', title: '产品名称',
...@@ -113,8 +113,8 @@ export const productColumns = [ ...@@ -113,8 +113,8 @@ export const productColumns = [
}, },
{ {
title: '数量', title: '数量',
dataIndex: 'index', dataIndex: 'quantity',
key: 'index4', key: 'quantity',
}, },
{ {
title: '未税价格', title: '未税价格',
...@@ -138,13 +138,13 @@ export const productColumns = [ ...@@ -138,13 +138,13 @@ export const productColumns = [
]; ];
export const productRulesRef = { export const productRulesRef = {
code: [ thirdProductId: [
{ {
required: true, required: true,
message: '请选择产品编号', message: '请选择产品编号',
}, },
], ],
number: [ quantity: [
{ {
required: true, required: true,
message: '请输入数量', message: '请输入数量',
......
export const navList = [
{
id: 1,
title: '产品线',
},
{
id: 2,
title: '正天关节脊柱',
},
{
id: 3,
title: '正天创伤',
},
{
id: 4,
title: 'LINK产品线',
},
{
id: 5,
title: '正天关节',
},
];
...@@ -5,6 +5,10 @@ ...@@ -5,6 +5,10 @@
<a-button v-auth="'AUTH_SYSTEM_ROLE:ADD'" type="primary" @click="handleCreate"> 新增</a-button> <a-button v-auth="'AUTH_SYSTEM_ROLE:ADD'" type="primary" @click="handleCreate"> 新增</a-button>
</template> </template>
<template #bodyCell="{ column, record }"> <template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'distributorId'">
<span v-if="record.distributorId === 0"> 华润角色</span>
<span v-else> 经销商角色</span>
</template>
<template v-if="column.dataIndex === 'action'"> <template v-if="column.dataIndex === 'action'">
<TableAction <TableAction
:actions="[ :actions="[
......
...@@ -6,10 +6,10 @@ export const columns: BasicColumn[] = [ ...@@ -6,10 +6,10 @@ export const columns: BasicColumn[] = [
title: '角色名称', title: '角色名称',
dataIndex: 'name', dataIndex: 'name',
}, },
// { {
// title: '操作人', title: '角色类型',
// dataIndex: 'editorName', dataIndex: 'distributorId',
// }, },
// { // {
// title: '创建时间', // title: '创建时间',
// dataIndex: 'createTime', // dataIndex: 'createTime',
...@@ -29,13 +29,32 @@ export const searchFormSchema: FormSchema[] = [ ...@@ -29,13 +29,32 @@ export const searchFormSchema: FormSchema[] = [
}, },
]; ];
export const formSchema: FormSchema[] = [ export const formSchema = [
{ {
field: 'name', field: 'name',
label: '角色名称', label: '角色名称',
required: true, required: true,
component: 'Input', component: 'Input',
}, },
{
field: 'distributorId',
label: '角色类型',
required: true,
componentProps: {
placeholder: '角色类型',
options: [
{
label: '华润角色',
value: 0,
},
{
label: '经销商角色',
value: -1,
},
],
},
component: 'Select',
},
{ {
label: '备注', label: '备注',
field: 'remark', field: 'remark',
......
...@@ -40,10 +40,7 @@ ...@@ -40,10 +40,7 @@
try { try {
const values = await validate(); const values = await validate();
setDrawerProps({ confirmLoading: true }); setDrawerProps({ confirmLoading: true });
const { const { distributorId, ...rest } = values;
distributorId,
...rest
} = values;
const action = !unref(isUpdate) ? UserApi.add : UserApi.update; const action = !unref(isUpdate) ? UserApi.add : UserApi.update;
const data = !unref(isUpdate) const data = !unref(isUpdate)
? { ? {
...@@ -51,14 +48,16 @@ ...@@ -51,14 +48,16 @@
distributorId: distributorId.value, distributorId: distributorId.value,
distributorName: distributorId.label, distributorName: distributorId.label,
} }
: Object.assign({}, : Object.assign(
{ {},
...rest, {
id: unref(entityId), ...rest,
distributorId: distributorId.value, id: unref(entityId),
distributorName: distributorId.label, distributorId: distributorId.value,
}, distributorName: distributorId.label,
); },
);
data.roleList = [{ id: data.roleList.value }];
await action(data); await action(data);
closeDrawer(); closeDrawer();
emit('success'); emit('success');
......
...@@ -20,6 +20,18 @@ ...@@ -20,6 +20,18 @@
onClick: handleEdit.bind(null, record), onClick: handleEdit.bind(null, record),
ifShow: hasPermission('AUTH_SYSTEM_USER:EDIT'), ifShow: hasPermission('AUTH_SYSTEM_USER:EDIT'),
}, },
{
tooltip: '审核',
icon: 'ant-design:highlight-outlined',
popConfirm: {
title: '是否通过审核',
okText: '通过',
cancelText: '拒绝',
confirm: handleCheck.bind(null, record, 'PASSED'),
cancel: handleCheck.bind(null, record, 'FORBIDDEN'),
},
ifShow: hasPermission('AUTH_SYSTEM_USER:VERIFY') && record.status === 'PENDING_REVIEW',
},
{ {
tooltip: '删除', tooltip: '删除',
icon: 'ant-design:delete-outlined', icon: 'ant-design:delete-outlined',
...@@ -50,6 +62,7 @@ ...@@ -50,6 +62,7 @@
import componentSetting from '/@/settings/componentSetting'; import componentSetting from '/@/settings/componentSetting';
import UserDrawer from './drawer.vue'; import UserDrawer from './drawer.vue';
import { columns, searchFormSchema } from './schema'; import { columns, searchFormSchema } from './schema';
import { message } from 'ant-design-vue';
const { hasPermission } = usePermission(); const { hasPermission } = usePermission();
const go = useGo(); const go = useGo();
...@@ -77,7 +90,7 @@ ...@@ -77,7 +90,7 @@
canResize: false, canResize: false,
rowKey: (record: any) => record.id, rowKey: (record: any) => record.id,
actionColumn: { actionColumn: {
width: 80, width: 120,
title: '操作', title: '操作',
dataIndex: 'action', dataIndex: 'action',
fixed: 'right', fixed: 'right',
...@@ -127,6 +140,13 @@ ...@@ -127,6 +140,13 @@
}); });
}; };
const handleCheck = (record: any, status: string) => {
UserApi.verify({ idList: [record.id], status: status }).then(() => {
message.success('审核成功');
reload();
});
};
const handleBatchDelete = () => { const handleBatchDelete = () => {
UserApi.batchRemove(checkedKeys.value).then((_) => { UserApi.batchRemove(checkedKeys.value).then((_) => {
reload(); reload();
......
...@@ -127,7 +127,7 @@ export const schema = { ...@@ -127,7 +127,7 @@ export const schema = {
api: RoleApi.all, api: RoleApi.all,
params: {}, params: {},
resultField: 'records', resultField: 'records',
labelField: 'id', labelField: 'remark',
valueField: 'id', valueField: 'id',
allowClear: false, allowClear: false,
placeholder: '角色', placeholder: '角色',
...@@ -259,17 +259,7 @@ export const schema = { ...@@ -259,17 +259,7 @@ export const schema = {
], ],
}; };
const queryFields = [ const queryFields = ['distributorId', 'username', 'realName', 'mobile', 'status', 'deleteStatus', 'createTime'];
'distributorId',
'username',
'realName',
'mobile',
'status',
'deleteStatus',
'editorName',
'createTime',
];
const editFields = ['distributorId', 'username', 'password', 'realName', 'mobile', 'roleList', 'deleteStatus']; const editFields = ['distributorId', 'username', 'password', 'realName', 'mobile', 'roleList', 'deleteStatus'];
const tableFields = [ const tableFields = [
'distributorId', 'distributorId',
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论