| New file |
| | |
| | | import request,{download,requestType} from "@/utils/request"; |
| | | import {BaseEntityInterface} from "@/utils/globalInterface"; |
| | | export interface CustomerManagementI extends BaseEntityInterface{ |
| | | id ?: number , customerFullName ?: string , customerShortName ?: string , customerType ?: string , contactPerson ?: string , address ?: string , contactPhone ?: string , customerCode ?: string , status ?: number , remark ?: string , createBy ?: string , updateBy ?: string , createTime ?: string , updateTime ?: string , deleted ?: number } |
| | | |
| | | |
| | | /** |
| | | * 查询客户管理列表 |
| | | */ |
| | | export const listCustomerManagement:requestType = (query) => { |
| | | return request({ |
| | | url: '/cwgl/customerManagement/list', |
| | | method:'get', |
| | | params:query |
| | | }) |
| | | } |
| | | /** |
| | | * 查询客户管理详细 |
| | | */ |
| | | export const getCustomerManagement:requestType = (id) => { |
| | | return request({ |
| | | url: '/cwgl/customerManagement/' + id, |
| | | method:'get' |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * 新增客户管理 |
| | | */ |
| | | export const addCustomerManagement:requestType = (data) => { |
| | | return request({ |
| | | url: '/cwgl/customerManagement', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * 修改客户管理 |
| | | */ |
| | | export const updateCustomerManagement:requestType = (data) => { |
| | | return request({ |
| | | url: '/cwgl/customerManagement', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * 删除客户管理 |
| | | */ |
| | | export const delCustomerManagement:requestType = (id) => { |
| | | return request({ |
| | | url: '/cwgl/customerManagement/' + id, |
| | | method: 'delete' |
| | | }) |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导出客户管理 |
| | | */ |
| | | export const exportCustomerManagement:requestType = (query) => { |
| | | return new Promise<any>(()=>{ |
| | | download('/cwgl/customerManagement/export',query); |
| | | }) |
| | | } |
| New file |
| | |
| | | <template> |
| | | <basicContainer > |
| | | <avue-crud |
| | | :option="option" |
| | | :table-loading="pageF.loading" |
| | | :data="tableData" |
| | | :page="page" |
| | | :permission="permissionList" |
| | | :before-open="beforeOpen" |
| | | v-model="form" |
| | | ref="crudRef" |
| | | @row-update="rowUpdate" |
| | | @row-save="rowSave" |
| | | @refresh-change="refreshChange" |
| | | @row-del="rowDel" |
| | | @search-change="searchChange" |
| | | @search-reset="searchReset" |
| | | @selection-change="selectionChange" |
| | | @current-change="currentChange" |
| | | @size-change="sizeChange" |
| | | @on-load="onLoad" |
| | | > |
| | | <template #menu-left> |
| | | <el-button |
| | | type="success" |
| | | icon="Edit" |
| | | :disabled="pageF.single" |
| | | v-hasPermi="['cwgl:customerManagement:edit']" |
| | | @click="handleUpdate">修改 |
| | | </el-button> |
| | | <el-button |
| | | type="danger" |
| | | icon="Delete" |
| | | :disabled="pageF.multiple" |
| | | @click="handleDelete" |
| | | v-hasPermi="['cwgl:customerManagement:remove']" |
| | | >删除 |
| | | </el-button> |
| | | <el-button |
| | | type="warning" |
| | | plain |
| | | icon="Download" |
| | | @click="handleExport" |
| | | v-hasPermi="['cwgl:customerManagement:export']" |
| | | >导出 |
| | | </el-button> |
| | | </template> |
| | | </avue-crud> |
| | | </basicContainer> |
| | | </template> |
| | | |
| | | <script setup name="customerManagement" lang="ts"> |
| | | import {CustomerManagementI,addCustomerManagement, delCustomerManagement, exportCustomerManagement, getCustomerManagement, listCustomerManagement, updateCustomerManagement} from "@/api/cwgl/customerManagement"; |
| | | import useCurrentInstance from "@/utils/useCurrentInstance"; |
| | | import {computed,reactive, ref, toRefs} from "vue"; |
| | | import {PagesInterface, PageQueryInterface} from "@/utils/globalInterface"; |
| | | import {usePagePlus} from "@/hooks/usePagePlus"; |
| | | import {hasPermission} from "@/utils/permissionUtils"; |
| | | |
| | | const { proxy } = useCurrentInstance(); |
| | | const crudRef = ref(); |
| | | |
| | | const permissionList = computed(()=>{ |
| | | return { |
| | | addBtn: hasPermission(["cwgl:customerManagement:add"]), |
| | | delBtn: hasPermission(["cwgl:customerManagement:remove"]), |
| | | editBtn: hasPermission(["cwgl:customerManagement:edit"]), |
| | | viewBtn: hasPermission(["cwgl:customerManagement:query"]), |
| | | } |
| | | }) |
| | | |
| | | const data = reactive({ |
| | | form:<CustomerManagementI>{}, |
| | | queryParams:<CustomerManagementI&PageQueryInterface>{}, |
| | | page: <PagesInterface>{ |
| | | pageSize: 10, |
| | | total: 0, |
| | | currentPage: 1, |
| | | }, |
| | | selectionList:[], |
| | | }) |
| | | const {queryParams,form,page,selectionList} = toRefs(data); |
| | | const option = ref({ |
| | | pageKey: 'CustomerManagement', |
| | | rowKey: 'id', |
| | | column: { |
| | | id: { |
| | | label: 'ID', |
| | | }, |
| | | customerFullName: { |
| | | label: '客户全称', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: "客户全称不能为空", trigger: "blur" } |
| | | ], }, |
| | | customerShortName: { |
| | | label: '客户简称', |
| | | }, |
| | | customerType: { |
| | | label: '客户类型', |
| | | }, |
| | | contactPerson: { |
| | | label: '联系人姓名', |
| | | }, |
| | | address: { |
| | | label: '地址', |
| | | type: 'textarea', minRows: 3, maxRows: 5, |
| | | }, |
| | | contactPhone: { |
| | | label: '联系人电话', |
| | | }, |
| | | customerCode: { |
| | | label: '客户编码', |
| | | }, |
| | | status: { |
| | | label: '状态', |
| | | }, |
| | | remark: { |
| | | label: '备注', |
| | | type: 'textarea', minRows: 3, maxRows: 5, |
| | | }, |
| | | createBy: { |
| | | label: '创建人', |
| | | }, |
| | | updateBy: { |
| | | label: '更新人', |
| | | }, |
| | | createTime: { |
| | | label: '创建时间', |
| | | }, |
| | | updateTime: { |
| | | label: '更新时间', |
| | | }, |
| | | deleted: { |
| | | label: '删除标记(0:正常;1:删除)', |
| | | }, |
| | | } |
| | | }) |
| | | |
| | | const { tableData,pageF,rowSave,rowUpdate,rowDel,beforeOpen,searchChange, |
| | | searchReset,selectionChange,onLoad,currentChange,sizeChange,handleDelete,handleExport,handleUpdate,refreshChange} = usePagePlus({ |
| | | form:form, |
| | | option:option, |
| | | queryParams:queryParams, |
| | | idKey:'id', |
| | | page:page.value, |
| | | getListApi:listCustomerManagement, |
| | | getDetailApi:getCustomerManagement, |
| | | exportApi:exportCustomerManagement, |
| | | deleteApi:delCustomerManagement, |
| | | addApi:addCustomerManagement, |
| | | updateApi:updateCustomerManagement, |
| | | handleUpdateFunc:()=>{ |
| | | crudRef.value.rowEdit(selectionList.value[0]); |
| | | }, |
| | | handleSelectionChangeFunc:(selection:any)=>{ |
| | | selectionList.value = selection; |
| | | } |
| | | }) |
| | | |
| | | |
| | | </script> |