供应商管理
This commit is contained in:
parent
c99987e0bf
commit
18ab821d5f
|
@ -814,6 +814,83 @@ export const getPages = (): Promise<any> => {
|
|||
updateBy: null,
|
||||
updateTime: null,
|
||||
},
|
||||
{
|
||||
btnList: [],
|
||||
children: [
|
||||
{
|
||||
btnList: [],
|
||||
children: [],
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
deleteFlag: null,
|
||||
icon: "EosIconsRoleBinding",
|
||||
isFull: {
|
||||
extData: {
|
||||
boolVal: false,
|
||||
},
|
||||
label: "否",
|
||||
value: 1,
|
||||
},
|
||||
isKeepAlive: {
|
||||
extData: {
|
||||
boolVal: false,
|
||||
},
|
||||
label: "否",
|
||||
value: 1,
|
||||
},
|
||||
link: "",
|
||||
name: "供应商管理",
|
||||
orderIndex: null,
|
||||
parentId: "1904795567075102721",
|
||||
path: "/suppliers/supplierManagement",
|
||||
redirect: "",
|
||||
remark: "",
|
||||
snowFlakeId: "1904812573660811423",
|
||||
status: null,
|
||||
type: {
|
||||
extData: null,
|
||||
label: "菜单",
|
||||
value: "menu",
|
||||
},
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
},
|
||||
],
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
deleteFlag: null,
|
||||
icon: "LineMdCogFilledLoop",
|
||||
isFull: {
|
||||
extData: {
|
||||
boolVal: false,
|
||||
},
|
||||
label: "否",
|
||||
value: 1,
|
||||
},
|
||||
isKeepAlive: {
|
||||
extData: {
|
||||
boolVal: false,
|
||||
},
|
||||
label: "否",
|
||||
value: 1,
|
||||
},
|
||||
link: "",
|
||||
name: "供应商管理",
|
||||
orderIndex: null,
|
||||
parentId: "0",
|
||||
path: "/suppliers",
|
||||
redirect: "/suppliers",
|
||||
remark: "",
|
||||
snowFlakeId: "1904795567075101420",
|
||||
status: null,
|
||||
type: {
|
||||
extData: null,
|
||||
label: "目录",
|
||||
value: "dir",
|
||||
},
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
},
|
||||
{
|
||||
btnList: [],
|
||||
createBy: null,
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
export interface SuppliersValue{
|
||||
activate?: number
|
||||
company?:string
|
||||
cpId?:string
|
||||
cred?:string
|
||||
id?:string | number
|
||||
license?: string
|
||||
manager?: string
|
||||
name? : string
|
||||
phone?:string
|
||||
address?:string
|
||||
settlementType?:TypeList[]
|
||||
invoiceType?:TypeList
|
||||
deliveryMethod?:TypeList
|
||||
supplyType?:TypeList
|
||||
}
|
||||
|
||||
interface TypeList {
|
||||
value:number
|
||||
label:string
|
||||
}
|
||||
|
||||
const suppliersValueList:SuppliersValue[] = [
|
||||
{
|
||||
activate: 1,
|
||||
company:"江南市场",
|
||||
cpId:"1888888888888",
|
||||
cred:"https://file.wy2020.com/admin/weiyi/img/purchase/supplier/license/1821723155631304705.jpg",
|
||||
id:"1915009841416429569",
|
||||
license: "https://file.wy2020.com/admin/weiyi/img/purchase/supplier/license/1821723155631304705.jpg",
|
||||
manager: "test3",
|
||||
name : "张三",
|
||||
phone:"13416661555",
|
||||
address:'湖南长沙',
|
||||
settlementType:undefined,
|
||||
invoiceType:undefined,
|
||||
deliveryMethod:undefined,
|
||||
supplyType:undefined
|
||||
},
|
||||
{
|
||||
activate: 0,
|
||||
company:"农贸市场",
|
||||
cpId:"1888888888888",
|
||||
cred:"https://file.wy2020.com/admin/weiyi/img/purchase/supplier/license/1821723155631304705.jpg",
|
||||
id:"1915009841416429569",
|
||||
license: "https://file.wy2020.com/admin/weiyi/img/purchase/supplier/license/1821723155631304705.jpg",
|
||||
manager: "test1",
|
||||
name : "李三",
|
||||
address:'湖南长沙',
|
||||
phone:"13416661555",
|
||||
},
|
||||
{
|
||||
activate: 1,
|
||||
company:"海鲜市场",
|
||||
cpId:"255H2D32DF3152431",
|
||||
cred:"https://file.wy2020.com/admin/weiyi/img/purchase/supplier/license/1821723155631304705.jpg",
|
||||
id:"1915009841416429569",
|
||||
license: "https://file.wy2020.com/admin/weiyi/img/purchase/supplier/license/1821723155631304705.jpg",
|
||||
manager: "test2",
|
||||
name : "刘三",
|
||||
address:'湖南长沙',
|
||||
phone:"13416661555",
|
||||
},
|
||||
{
|
||||
activate: 0,
|
||||
company:"果农市场",
|
||||
cpId:"154563FGG1153156",
|
||||
cred:"https://file.wy2020.com/admin/weiyi/img/purchase/supplier/license/1821723155631304705.jpg",
|
||||
id:"1915009841416429569",
|
||||
license: "https://file.wy2020.com/admin/weiyi/img/purchase/supplier/license/1821723155631304705.jpg",
|
||||
manager: "刘某",
|
||||
name : "关三",
|
||||
address:'湖南长沙',
|
||||
phone:"13416661555",
|
||||
}
|
||||
]
|
||||
|
||||
export default suppliersValueList
|
|
@ -0,0 +1,449 @@
|
|||
<template>
|
||||
<div>
|
||||
<TablePro
|
||||
ref="tableRef"
|
||||
:request-api="reqApi"
|
||||
:search-form-options="searchFormOptions"
|
||||
:columns="columns"
|
||||
:isPageTable="true"
|
||||
:single-line="false"
|
||||
>
|
||||
<template #headerExtra>
|
||||
<n-button strong secondary type="info" @click="addSupplier">添加供应商</n-button>
|
||||
</template>
|
||||
</TablePro>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="tsx">
|
||||
import {
|
||||
TablePro,
|
||||
type TableProProps,
|
||||
FormPro,
|
||||
type FormItemOptions,
|
||||
type TableProInst,
|
||||
Icon,
|
||||
} from "@/components";
|
||||
import {reactive,ref} from 'vue'
|
||||
import { type FormInst, NPerformantEllipsis, NPopconfirm, NTag, useModal } from "naive-ui";
|
||||
import suppliersValueList, { type SuppliersValue } from "@/views/suppliers/supplierManagement/index.ts";
|
||||
const tableRef = useTemplateRef<TableProInst>("tableRef");
|
||||
const modal = useModal();
|
||||
const forms = ref<FormInst | null>(null);
|
||||
const reqApi: TableType["requestApi"] = (params) => {
|
||||
return new Promise((resolve) => {
|
||||
resolve({
|
||||
code: 200,
|
||||
data: {
|
||||
current: "1",
|
||||
// @ts-ignore
|
||||
pages: "2",
|
||||
records: suppliersValueList,
|
||||
size: "10",
|
||||
total: "12",
|
||||
},
|
||||
message: "操作成功!",
|
||||
});
|
||||
});
|
||||
};
|
||||
type TableType = TableProProps<any, any>;
|
||||
const searchFormOptions = reactive<TableType["searchFormOptions"]>({
|
||||
name: {
|
||||
type: "input",
|
||||
label: "供应商名称",
|
||||
},
|
||||
});
|
||||
|
||||
const columns = ref<TableType["columns"]>([
|
||||
|
||||
{
|
||||
key: "company",
|
||||
title: "供应商全称",
|
||||
},
|
||||
{
|
||||
key: "cpId",
|
||||
title: "统一社会信用代码",
|
||||
},
|
||||
{
|
||||
key: "name",
|
||||
title: "负责人",
|
||||
},
|
||||
{
|
||||
key: "phone",
|
||||
title: "联系电话",
|
||||
},
|
||||
{
|
||||
key: "manager",
|
||||
title: "管理员",
|
||||
},
|
||||
{
|
||||
key: "license",
|
||||
title: "营业执照",
|
||||
render: (value: any) => {
|
||||
return (
|
||||
<n-image
|
||||
width="30"
|
||||
src={value.license}
|
||||
/>
|
||||
);
|
||||
}
|
||||
},
|
||||
{
|
||||
key:'cred',
|
||||
title:'资证',
|
||||
render: (value: any) => {
|
||||
return (
|
||||
<n-image
|
||||
width="30"
|
||||
src={value.cred}
|
||||
/>
|
||||
);
|
||||
}
|
||||
},
|
||||
{
|
||||
key:'activate',
|
||||
title:'状态',
|
||||
render: (value: any) => {
|
||||
return (
|
||||
<n-tag type={value.activate == 1?'success':'error'}>
|
||||
{value.activate===1?'已激活':'未激活'}
|
||||
</n-tag>
|
||||
);
|
||||
}
|
||||
},
|
||||
{
|
||||
key: "",
|
||||
title: "操作",
|
||||
render: (value) => {
|
||||
return (
|
||||
<div style={{ display: "flex" }}>
|
||||
<n-button
|
||||
loading={loading.value}
|
||||
strong
|
||||
secondary
|
||||
style={{ marginLeft: "10px" }}
|
||||
type="success"
|
||||
onClick={()=>{
|
||||
title.value = `供应商信息`;
|
||||
userValue.value.company = value.company
|
||||
userValue.value.phone = value.phone
|
||||
userValue.value.address = value.address
|
||||
userValue.value.name = value.name
|
||||
userValue.value.cpId = value.cpId
|
||||
modalRef.value = modal.create({
|
||||
title: title.value,
|
||||
preset: "card",
|
||||
style: {
|
||||
width: "800px"
|
||||
},
|
||||
content: () => (
|
||||
<div style="height:600px">
|
||||
<FormPro labelPlacement={"top"} ref={forms} v-model:value={userValue.value}
|
||||
form-item-options={formOptionsUser} gridProps={{ cols: 2, xGap: 16, itemResponsive: true }}>
|
||||
</FormPro>
|
||||
<FormPro ref={forms} v-model:value={userValue.value}
|
||||
form-item-options={formOptions1User} gridProps={{ cols: 1, xGap: 8, itemResponsive: true }}>
|
||||
</FormPro>
|
||||
</div>
|
||||
),
|
||||
footer: () => (
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
justifyContent: "flex-end"
|
||||
}}
|
||||
>
|
||||
<n-button
|
||||
loading={loading.value}
|
||||
style={{ marginRight: "10px" }}
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
addUserOrUpdate();
|
||||
}}
|
||||
>
|
||||
确认
|
||||
</n-button>
|
||||
<n-button
|
||||
onClick={() => {
|
||||
modalRef.value.destroy();
|
||||
resetModelValue();
|
||||
}}
|
||||
>
|
||||
取消
|
||||
</n-button>
|
||||
</div>
|
||||
),
|
||||
onAfterLeave: () => {
|
||||
resetModelValue();
|
||||
}
|
||||
});
|
||||
|
||||
}}
|
||||
>
|
||||
编辑
|
||||
</n-button>
|
||||
<n-button
|
||||
loading={loading.value}
|
||||
strong
|
||||
secondary
|
||||
style={{ marginLeft: "10px" }}
|
||||
type={value.activate===1?'error':'success'}
|
||||
>
|
||||
{value.activate===1?'禁用':'启用'}
|
||||
</n-button>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
const suppliersList = {
|
||||
activate: 0,
|
||||
company:"",
|
||||
cpId:"",
|
||||
cred:"",
|
||||
id:"",
|
||||
license: "",
|
||||
manager: "",
|
||||
name : "",
|
||||
phone:"",
|
||||
settlementType:'0',
|
||||
invoiceType:'0',
|
||||
deliveryMethod:'0',
|
||||
supplyType:'0',
|
||||
}
|
||||
|
||||
const userValue = ref<SuppliersValue>({
|
||||
...suppliersList as any
|
||||
});
|
||||
|
||||
const resetModelValue = () => {
|
||||
userValue.value = { ...suppliersList as any };
|
||||
title.value = '添加供应商'
|
||||
};
|
||||
|
||||
const addUserOrUpdate = () => {
|
||||
forms.value?.validate().then((res) => {
|
||||
// loading.value = true
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
const formOptionsUser = reactive<FormItemOptions<SuppliersValue>>({
|
||||
company : {
|
||||
type:'input',
|
||||
label:'公司名',
|
||||
required:true
|
||||
},
|
||||
address:{
|
||||
type:'input',
|
||||
label:'地址',
|
||||
required:true
|
||||
},
|
||||
name:{
|
||||
type:'input',
|
||||
label:'联系人',
|
||||
required:true
|
||||
},
|
||||
phone:{
|
||||
type:'input',
|
||||
label:'联系电话',
|
||||
required:true
|
||||
},
|
||||
manager:{
|
||||
type:'input',
|
||||
label:'管理员'
|
||||
},
|
||||
cpId:{
|
||||
type:'input',
|
||||
label:'统一社会信用代码',
|
||||
required:true
|
||||
},
|
||||
license:{
|
||||
type:'custom',
|
||||
label:'营业执照',
|
||||
required:true
|
||||
},
|
||||
cred:{
|
||||
type:'custom',
|
||||
label:'资质'
|
||||
}
|
||||
})
|
||||
const formOptions1User = reactive<FormItemOptions<SuppliersValue>>({
|
||||
settlementType: {
|
||||
type: 'radioGroup',
|
||||
label: '结算类型',
|
||||
required:true,
|
||||
options: [
|
||||
{
|
||||
value: '0',
|
||||
label: '无(报价时选择)'
|
||||
},
|
||||
{
|
||||
value: '1',
|
||||
label: '月结90天'
|
||||
},
|
||||
{
|
||||
value: '2',
|
||||
label: '月结60天'
|
||||
},
|
||||
{
|
||||
value: '3',
|
||||
label: '月结30天'
|
||||
},
|
||||
{
|
||||
value: '4',
|
||||
label: '现结'
|
||||
},
|
||||
{
|
||||
value: '5',
|
||||
label: '批结'
|
||||
}
|
||||
],
|
||||
},
|
||||
invoiceType:{
|
||||
type:'radioGroup',
|
||||
label:'发票类型',
|
||||
required:true,
|
||||
options:[
|
||||
{
|
||||
value:'0',
|
||||
label:'无(报价时选择)'
|
||||
},
|
||||
{
|
||||
value:'1',
|
||||
label:'专票13%'
|
||||
},
|
||||
{
|
||||
value:'2',
|
||||
label:'专票9%'
|
||||
},
|
||||
{
|
||||
value:'3',
|
||||
label:'专票6%'
|
||||
},
|
||||
{
|
||||
value:'4',
|
||||
label:'普票'
|
||||
},
|
||||
{
|
||||
value:'5',
|
||||
label:'不开票'
|
||||
}
|
||||
]
|
||||
},
|
||||
deliveryMethod:{
|
||||
type:'radioGroup',
|
||||
label:'配送方式',
|
||||
required:true,
|
||||
options:[
|
||||
{
|
||||
value:'0',
|
||||
label:'无(报价时选择)'
|
||||
},
|
||||
{
|
||||
value:'1',
|
||||
label:'是'
|
||||
},
|
||||
{
|
||||
value:'2',
|
||||
label:'否'
|
||||
}
|
||||
]
|
||||
},
|
||||
supplyType:{
|
||||
type:'checkboxGroup',
|
||||
label:'供应类型',
|
||||
required:true,
|
||||
options:[
|
||||
{
|
||||
value:'0',
|
||||
label:'蔬菜豆制类'
|
||||
},
|
||||
{
|
||||
value:'1',
|
||||
label:'肉类'
|
||||
},
|
||||
{
|
||||
value:'2',
|
||||
label:'禽类'
|
||||
},
|
||||
{
|
||||
value:'3',
|
||||
label:'烧腊类'
|
||||
},
|
||||
{
|
||||
value:'4',
|
||||
label:'水产冻货'
|
||||
},{
|
||||
value:'5',
|
||||
label:'豆品蛋类'
|
||||
},{
|
||||
value:'6',
|
||||
label:'米油杂粮'
|
||||
},{
|
||||
value:'7',
|
||||
label:'调料干货'
|
||||
},{
|
||||
value:'8',
|
||||
label:'厨房用品'
|
||||
},{
|
||||
value:'9',
|
||||
label:'饮品'
|
||||
}
|
||||
]
|
||||
}
|
||||
})
|
||||
const loading = ref<boolean>(false);
|
||||
const modalRef = ref();
|
||||
const title = ref("添加供应商");
|
||||
const addSupplier = ()=>{
|
||||
modalRef.value = modal.create({
|
||||
title: title.value,
|
||||
preset: "card",
|
||||
style: {
|
||||
width: "800px"
|
||||
},
|
||||
content: () => (
|
||||
<div style="height:600px">
|
||||
<FormPro labelPlacement={"top"} ref={forms} v-model:value={userValue.value}
|
||||
form-item-options={formOptionsUser} gridProps={{ cols: 2, xGap: 16, itemResponsive: true }}>
|
||||
</FormPro>
|
||||
<FormPro ref={forms} v-model:value={userValue.value}
|
||||
form-item-options={formOptions1User} gridProps={{ cols: 1, xGap: 8, itemResponsive: true }}>
|
||||
</FormPro>
|
||||
</div>
|
||||
),
|
||||
footer: () => (
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
justifyContent: "flex-end"
|
||||
}}
|
||||
>
|
||||
<n-button
|
||||
loading={loading.value}
|
||||
style={{ marginRight: "10px" }}
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
addUserOrUpdate();
|
||||
}}
|
||||
>
|
||||
确认
|
||||
</n-button>
|
||||
<n-button
|
||||
onClick={() => {
|
||||
modalRef.value.destroy();
|
||||
resetModelValue();
|
||||
}}
|
||||
>
|
||||
取消
|
||||
</n-button>
|
||||
</div>
|
||||
),
|
||||
onAfterLeave: () => {
|
||||
resetModelValue();
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="scss"></style>
|
Loading…
Reference in New Issue