From 59b49fe634cc4d7c3faf2fdc4f4ed40d8e3c3c12 Mon Sep 17 00:00:00 2001
From: wangchengming <15110151257@163.com>
Date: Mon, 18 Aug 2025 18:48:08 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E4=BE=9B=E5=BA=94=E5=95=86?=
=?UTF-8?q?=E5=9F=BA=E7=A1=80=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/supplier.js | 53 +++++
src/views/supplier/index.vue | 168 +++++++------
src/views/supplier/supplierDetail.vue | 111 +++++----
src/views/supplier/supplierForm.vue | 324 +++++++++++++++-----------
vite.config.js | 2 +-
5 files changed, 398 insertions(+), 260 deletions(-)
create mode 100644 src/api/supplier.js
diff --git a/src/api/supplier.js b/src/api/supplier.js
new file mode 100644
index 0000000..980217d
--- /dev/null
+++ b/src/api/supplier.js
@@ -0,0 +1,53 @@
+import request from '@/utils/request'
+
+// 获取供应商分页列表
+export function busSupplierPage(query) {
+ return request({
+ url: '/admin/busSupplier/getBusSupplierPage',
+ method: 'post',
+ data: query
+ })
+}
+
+// 获取供应商列表
+export function listBusSupplier(query) {
+ return request({
+ url: '/admin/busSupplier/listBusSupplier',
+ method: 'post',
+ data: query
+ })
+}
+
+// 新增供应商
+export function addBusSupplier(data) {
+ return request({
+ url: '/admin/busSupplier/addBusSupplier',
+ method: 'post',
+ data: data
+ })
+}
+
+// 修改供应商
+export function updateBusSupplier(data) {
+ return request({
+ url: '/admin/busSupplier/updateBusSupplier',
+ method: 'post',
+ data: data
+ })
+}
+
+// 获取供应商详情
+export function getBusSupplier(supplierId) {
+ return request({
+ url: '/admin/busSupplier/getBusSupplier/' + supplierId,
+ method: 'post'
+ })
+}
+
+// 删除供应商
+export function deleteBusSupplier(supplierId) {
+ return request({
+ url: '/admin/busSupplier/deleteBusSupplier/' + supplierId,
+ method: 'post'
+ })
+}
\ No newline at end of file
diff --git a/src/views/supplier/index.vue b/src/views/supplier/index.vue
index 60b8d0f..c260b70 100644
--- a/src/views/supplier/index.vue
+++ b/src/views/supplier/index.vue
@@ -4,51 +4,51 @@
-
+
-
-
+
-
+
-
-
-
-
@@ -67,7 +67,7 @@
-
+
@@ -102,19 +102,18 @@
-
+
-
+
-
+
-
@@ -136,26 +135,42 @@
{{ scope.$index + 1 }}
-
+
- {{ scope.row.supplierName
- }}
+ {{
+ scope.row.supplierName
+ }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -224,6 +239,7 @@ import optionIconHover from '@/assets/images/optionIconHover.png'
import { useBackgroundStore } from '@/store/modules/background'
import otherbg from '@/assets/images/otherbg.png'
import { sysRegionListByPid } from "@/api/system/administrativeRegion"
+import { busSupplierPage, deleteBusSupplier } from "@/api/supplier"
import supplierForm from "./supplierForm.vue";
import supplierDetail from "./supplierDetail.vue";
@@ -259,25 +275,25 @@ const upload = reactive({
url: import.meta.env.VITE_APP_BASE_API + "/system/user/importData"
})
-const supplierList = ref([
- { supplierName: 'xxxx供应商', currentImageSrc: defaultImageSrc.value }
-])
+const supplierList = ref([])
const loading = ref(true)
const total = ref(0)
const data = reactive({
- form: {},
queryParams: {
- pageNum: 1,
+ pageIndex: 1,
pageSize: 10,
- },
- rules: {
- postName: [{ required: true, message: "岗位名称不能为空", trigger: "blur" }],
- postCode: [{ required: true, message: "岗位编码不能为空", trigger: "blur" }],
- postSort: [{ required: true, message: "岗位顺序不能为空", trigger: "blur" }],
+ keyword: undefined,
+ invoiceType: undefined,
+ meitiGuishu: undefined,
+ renyuanSize: undefined,
+ zhuyingMeitiType: undefined,
+ isCooperation: undefined,
+ meitiZhiliang: undefined,
+ supplierLevel: undefined,
}
})
-const { queryParams, form, rules } = toRefs(data)
+const { queryParams } = toRefs(data)
// 折叠展开
const unfoldFlag = ref(false)
@@ -308,34 +324,46 @@ const getCountyList = (value) => {
})
}
-/** 查询岗位列表 */
-const getList = () => {
+/** 查询供应商分页列表 */
+const getSupplierPageList = () => {
loading.value = false
- // listPost(proxy.addDateRange(queryParams.value, dateRange.value)).then(response => {
- // postList.value = response.rows
- // total.value = response.total
- // loading.value = false
- // })
+ busSupplierPage(queryParams.value).then(res => {
+ res.data.list.forEach(element => {
+ element.currentImageSrc = defaultImageSrc.value
+ });
+ supplierList.value = res.data.list
+ total.value = res.data.total
+ loading.value = false
+ })
}
/** 搜索按钮操作 */
const handleQuery = () => {
- queryParams.value.pageNum = 1
- getList()
+ queryParams.value.pageIndex = 1
+ getSupplierPageList()
}
/** 重置按钮操作 */
const resetQuery = () => {
- proxy.resetForm("queryRef")
+ queryParams.value = {
+ pageIndex: 1,
+ pageSize: 10,
+ keyword: undefined,
+ invoiceType: undefined,
+ meitiGuishu: undefined,
+ renyuanSize: undefined,
+ zhuyingMeitiType: undefined,
+ isCooperation: undefined,
+ meitiZhiliang: undefined,
+ supplierLevel: undefined,
+ }
handleQuery()
}
/** 删除按钮操作 */
const handleDelete = (row) => {
- const postIds = row.postId
- const supplierName = row.supplierName
- proxy.$modal.confirm('是否确认删除名称为"' + supplierName + '"的供应商数据?').then(function () {
- return delPost(postIds)
+ proxy.$modal.confirm('是否确认删除名称为"' + row.supplierName + '"的供应商数据?').then(function () {
+ return deleteBusSupplier(row.supplierId)
}).then(() => {
- getList()
+ getSupplierPageList()
proxy.$modal.msgSuccess("删除成功")
}).catch(() => { })
}
@@ -368,33 +396,35 @@ const handleExport = () => {
const handleOpenAddForm = () => {
showForm.value = true
nextTick(() => {
- supplierFormRef.value.formTitle = '新建供应商'
+ supplierFormRef.value.initForm('新建供应商', { supplierId: null })
})
}
// 修改
-const handleUpdate = () => {
+const handleUpdate = (row) => {
showForm.value = true
nextTick(() => {
- supplierFormRef.value.formTitle = '编辑供应商'
+ supplierFormRef.value.initForm('编辑供应商', row)
})
}
// 详情
-const handleOpenDetail = () => {
+const handleOpenDetail = (_supplierId) => {
showDetail.value = true
nextTick(() => {
- // supplierFormRef.value.formTitle = '编辑供应商'
+ supplierDetailRef.value.getSupplierInfo(_supplierId)
})
}
const handleShowList = () => {
- console.log('触发')
showForm.value = false
+ getSupplierPageList()
+}
+const handleCloseDetail = () => {
showDetail.value = false
}
// 初始化
onMounted(() => {
bgStore.setBgImage(otherbg)
getProvinceList()
- getList()
+ getSupplierPageList()
});