init
This commit is contained in:
parent
e350dbe696
commit
b8eebd1d17
|
|
@ -1,97 +0,0 @@
|
|||
import service from '@/utils/request'
|
||||
|
||||
// @Tags CompanyPrice
|
||||
// @Summary 创建公司报价
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.CompanyPrice true "创建公司报价"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
|
||||
// @Router /companyPrice/createCompanyPrice [post]
|
||||
export const createCompanyPrice = (data) => {
|
||||
return service({
|
||||
url: '/companyPrice/createCompanyPrice',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags CompanyPrice
|
||||
// @Summary 删除公司报价
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.CompanyPrice true "删除公司报价"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
// @Router /companyPrice/deleteCompanyPrice [delete]
|
||||
export const deleteCompanyPrice = (params) => {
|
||||
return service({
|
||||
url: '/companyPrice/deleteCompanyPrice',
|
||||
method: 'delete',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags CompanyPrice
|
||||
// @Summary 批量删除公司报价
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.IdsReq true "批量删除公司报价"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
// @Router /companyPrice/deleteCompanyPrice [delete]
|
||||
export const deleteCompanyPriceByIds = (params) => {
|
||||
return service({
|
||||
url: '/companyPrice/deleteCompanyPriceByIds',
|
||||
method: 'delete',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags CompanyPrice
|
||||
// @Summary 更新公司报价
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.CompanyPrice true "更新公司报价"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
|
||||
// @Router /companyPrice/updateCompanyPrice [put]
|
||||
export const updateCompanyPrice = (data) => {
|
||||
return service({
|
||||
url: '/companyPrice/updateCompanyPrice',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags CompanyPrice
|
||||
// @Summary 用id查询公司报价
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data query model.CompanyPrice true "用id查询公司报价"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
|
||||
// @Router /companyPrice/findCompanyPrice [get]
|
||||
export const findCompanyPrice = (params) => {
|
||||
return service({
|
||||
url: '/companyPrice/findCompanyPrice',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags CompanyPrice
|
||||
// @Summary 分页获取公司报价列表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data query request.PageInfo true "分页获取公司报价列表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /companyPrice/getCompanyPriceList [get]
|
||||
export const getCompanyPriceList = (params) => {
|
||||
return service({
|
||||
url: '/companyPrice/getCompanyPriceList',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
|
@ -1,113 +0,0 @@
|
|||
import service from '@/utils/request'
|
||||
|
||||
// @Tags Crawl100ppi
|
||||
// @Summary 创建生意社爬虫数据
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.Crawl100ppi true "创建生意社爬虫数据"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
|
||||
// @Router /crawl100ppi/createCrawl100ppi [post]
|
||||
export const createCrawl100ppi = (data) => {
|
||||
return service({
|
||||
url: '/crawl100ppi/createCrawl100ppi',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags Crawl100ppi
|
||||
// @Summary 删除生意社爬虫数据
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.Crawl100ppi true "删除生意社爬虫数据"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
// @Router /crawl100ppi/deleteCrawl100ppi [delete]
|
||||
export const deleteCrawl100ppi = (params) => {
|
||||
return service({
|
||||
url: '/crawl100ppi/deleteCrawl100ppi',
|
||||
method: 'delete',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags Crawl100ppi
|
||||
// @Summary 批量删除生意社爬虫数据
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.IdsReq true "批量删除生意社爬虫数据"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
// @Router /crawl100ppi/deleteCrawl100ppi [delete]
|
||||
export const deleteCrawl100ppiByIds = (params) => {
|
||||
return service({
|
||||
url: '/crawl100ppi/deleteCrawl100ppiByIds',
|
||||
method: 'delete',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags Crawl100ppi
|
||||
// @Summary 更新生意社爬虫数据
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.Crawl100ppi true "更新生意社爬虫数据"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
|
||||
// @Router /crawl100ppi/updateCrawl100ppi [put]
|
||||
export const updateCrawl100ppi = (data) => {
|
||||
return service({
|
||||
url: '/crawl100ppi/updateCrawl100ppi',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags Crawl100ppi
|
||||
// @Summary 用id查询生意社爬虫数据
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data query model.Crawl100ppi true "用id查询生意社爬虫数据"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
|
||||
// @Router /crawl100ppi/findCrawl100ppi [get]
|
||||
export const findCrawl100ppi = (params) => {
|
||||
return service({
|
||||
url: '/crawl100ppi/findCrawl100ppi',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags Crawl100ppi
|
||||
// @Summary 分页获取生意社爬虫数据列表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data query request.PageInfo true "分页获取生意社爬虫数据列表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /crawl100ppi/getCrawl100ppiList [get]
|
||||
export const getCrawl100ppiList = (params) => {
|
||||
return service({
|
||||
url: '/crawl100ppi/getCrawl100ppiList',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags Crawl100ppi
|
||||
// @Summary 批量重新同步爬虫数据
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.IdsReq true "批量重新同步爬虫数据"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"同步成功"}"
|
||||
// @Router /crawl100ppi/syncCrawl100ppi [put]
|
||||
export const syncCrawl100ppi = (params) => {
|
||||
return service({
|
||||
url: '/crawl100ppi/syncCrawl100ppi',
|
||||
method: 'put',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
import service from '@/utils/request'
|
||||
|
||||
// @Tags CrawlFieldReplace
|
||||
// @Summary 创建crawlFieldReplace表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.CrawlFieldReplace true "创建crawlFieldReplace表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
|
||||
// @Router /crawlFieldReplace/createCrawlFieldReplace [post]
|
||||
export const createCrawlFieldReplace = (data) => {
|
||||
return service({
|
||||
url: '/crawlFieldReplace/createCrawlFieldReplace',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags CrawlFieldReplace
|
||||
// @Summary 删除crawlFieldReplace表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.CrawlFieldReplace true "删除crawlFieldReplace表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
// @Router /crawlFieldReplace/deleteCrawlFieldReplace [delete]
|
||||
export const deleteCrawlFieldReplace = (params) => {
|
||||
return service({
|
||||
url: '/crawlFieldReplace/deleteCrawlFieldReplace',
|
||||
method: 'delete',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags CrawlFieldReplace
|
||||
// @Summary 批量删除crawlFieldReplace表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.IdsReq true "批量删除crawlFieldReplace表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
// @Router /crawlFieldReplace/deleteCrawlFieldReplace [delete]
|
||||
export const deleteCrawlFieldReplaceByIds = (params) => {
|
||||
return service({
|
||||
url: '/crawlFieldReplace/deleteCrawlFieldReplaceByIds',
|
||||
method: 'delete',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags CrawlFieldReplace
|
||||
// @Summary 更新crawlFieldReplace表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.CrawlFieldReplace true "更新crawlFieldReplace表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
|
||||
// @Router /crawlFieldReplace/updateCrawlFieldReplace [put]
|
||||
export const updateCrawlFieldReplace = (data) => {
|
||||
return service({
|
||||
url: '/crawlFieldReplace/updateCrawlFieldReplace',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags CrawlFieldReplace
|
||||
// @Summary 用id查询crawlFieldReplace表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data query model.CrawlFieldReplace true "用id查询crawlFieldReplace表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
|
||||
// @Router /crawlFieldReplace/findCrawlFieldReplace [get]
|
||||
export const findCrawlFieldReplace = (params) => {
|
||||
return service({
|
||||
url: '/crawlFieldReplace/findCrawlFieldReplace',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags CrawlFieldReplace
|
||||
// @Summary 分页获取crawlFieldReplace表列表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data query request.PageInfo true "分页获取crawlFieldReplace表列表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /crawlFieldReplace/getCrawlFieldReplaceList [get]
|
||||
export const getCrawlFieldReplaceList = (params) => {
|
||||
return service({
|
||||
url: '/crawlFieldReplace/getCrawlFieldReplaceList',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
import service from '@/utils/request'
|
||||
|
||||
// @Tags Product
|
||||
// @Summary 创建产品表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.Product true "创建产品表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
|
||||
// @Router /product/createProduct [post]
|
||||
export const createProduct = (data) => {
|
||||
return service({
|
||||
url: '/product/createProduct',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags Product
|
||||
// @Summary 删除产品表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.Product true "删除产品表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
// @Router /product/deleteProduct [delete]
|
||||
export const deleteProduct = (params) => {
|
||||
return service({
|
||||
url: '/product/deleteProduct',
|
||||
method: 'delete',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags Product
|
||||
// @Summary 批量删除产品表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.IdsReq true "批量删除产品表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
// @Router /product/deleteProduct [delete]
|
||||
export const deleteProductByIds = (params) => {
|
||||
return service({
|
||||
url: '/product/deleteProductByIds',
|
||||
method: 'delete',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags Product
|
||||
// @Summary 更新产品表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.Product true "更新产品表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
|
||||
// @Router /product/updateProduct [put]
|
||||
export const updateProduct = (data) => {
|
||||
return service({
|
||||
url: '/product/updateProduct',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags Product
|
||||
// @Summary 用id查询产品表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data query model.Product true "用id查询产品表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
|
||||
// @Router /product/findProduct [get]
|
||||
export const findProduct = (params) => {
|
||||
return service({
|
||||
url: '/product/findProduct',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags Product
|
||||
// @Summary 分页获取产品表列表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data query request.PageInfo true "分页获取产品表列表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /product/getProductList [get]
|
||||
export const getProductList = (params) => {
|
||||
return service({
|
||||
url: '/product/getProductList',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
import service from '@/utils/request'
|
||||
|
||||
// @Tags ProductCategory
|
||||
// @Summary 创建农资行情分类表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.ProductCategory true "创建农资行情分类表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
|
||||
// @Router /productCategory/createProductCategory [post]
|
||||
export const createProductCategory = (data) => {
|
||||
return service({
|
||||
url: '/productCategory/createProductCategory',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags ProductCategory
|
||||
// @Summary 删除农资行情分类表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.ProductCategory true "删除农资行情分类表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
// @Router /productCategory/deleteProductCategory [delete]
|
||||
export const deleteProductCategory = (params) => {
|
||||
return service({
|
||||
url: '/productCategory/deleteProductCategory',
|
||||
method: 'delete',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags ProductCategory
|
||||
// @Summary 批量删除农资行情分类表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.IdsReq true "批量删除农资行情分类表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
// @Router /productCategory/deleteProductCategory [delete]
|
||||
export const deleteProductCategoryByIds = (params) => {
|
||||
return service({
|
||||
url: '/productCategory/deleteProductCategoryByIds',
|
||||
method: 'delete',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags ProductCategory
|
||||
// @Summary 更新农资行情分类表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.ProductCategory true "更新农资行情分类表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
|
||||
// @Router /productCategory/updateProductCategory [put]
|
||||
export const updateProductCategory = (data) => {
|
||||
return service({
|
||||
url: '/productCategory/updateProductCategory',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags ProductCategory
|
||||
// @Summary 用id查询农资行情分类表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data query model.ProductCategory true "用id查询农资行情分类表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
|
||||
// @Router /productCategory/findProductCategory [get]
|
||||
export const findProductCategory = (params) => {
|
||||
return service({
|
||||
url: '/productCategory/findProductCategory',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags ProductCategory
|
||||
// @Summary 分页获取农资行情分类表列表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data query request.PageInfo true "分页获取农资行情分类表列表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /productCategory/getProductCategoryList [get]
|
||||
export const getProductCategoryList = (params) => {
|
||||
return service({
|
||||
url: '/productCategory/getProductCategoryList',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
import service from '@/utils/request'
|
||||
|
||||
// @Tags ProductPrice
|
||||
// @Summary 创建产品价格
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.ProductPrice true "创建产品价格"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
|
||||
// @Router /productPrice/createProductPrice [post]
|
||||
export const createProductPrice = (data) => {
|
||||
return service({
|
||||
url: '/productPrice/createProductPrice',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags ProductPrice
|
||||
// @Summary 删除产品价格
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.ProductPrice true "删除产品价格"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
// @Router /productPrice/deleteProductPrice [delete]
|
||||
export const deleteProductPrice = (params) => {
|
||||
return service({
|
||||
url: '/productPrice/deleteProductPrice',
|
||||
method: 'delete',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags ProductPrice
|
||||
// @Summary 批量删除产品价格
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.IdsReq true "批量删除产品价格"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
// @Router /productPrice/deleteProductPrice [delete]
|
||||
export const deleteProductPriceByIds = (params) => {
|
||||
return service({
|
||||
url: '/productPrice/deleteProductPriceByIds',
|
||||
method: 'delete',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags ProductPrice
|
||||
// @Summary 更新产品价格
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.ProductPrice true "更新产品价格"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
|
||||
// @Router /productPrice/updateProductPrice [put]
|
||||
export const updateProductPrice = (data) => {
|
||||
return service({
|
||||
url: '/productPrice/updateProductPrice',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags ProductPrice
|
||||
// @Summary 用id查询产品价格
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data query model.ProductPrice true "用id查询产品价格"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
|
||||
// @Router /productPrice/findProductPrice [get]
|
||||
export const findProductPrice = (params) => {
|
||||
return service({
|
||||
url: '/productPrice/findProductPrice',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags ProductPrice
|
||||
// @Summary 分页获取产品价格列表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data query request.PageInfo true "分页获取产品价格列表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /productPrice/getProductPriceList [get]
|
||||
export const getProductPriceList = (params) => {
|
||||
return service({
|
||||
url: '/productPrice/getProductPriceList',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
import service from '@/utils/request'
|
||||
|
||||
// @Tags SourcePrice
|
||||
// @Summary 创建nzhq_source_price表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.SourcePrice true "创建nzhq_source_price表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
|
||||
// @Router /sourcePrice/createSourcePrice [post]
|
||||
export const createSourcePrice = (data) => {
|
||||
return service({
|
||||
url: '/sourcePrice/createSourcePrice',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags SourcePrice
|
||||
// @Summary 删除nzhq_source_price表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.SourcePrice true "删除nzhq_source_price表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
// @Router /sourcePrice/deleteSourcePrice [delete]
|
||||
export const deleteSourcePrice = (params) => {
|
||||
return service({
|
||||
url: '/sourcePrice/deleteSourcePrice',
|
||||
method: 'delete',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags SourcePrice
|
||||
// @Summary 批量删除nzhq_source_price表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.IdsReq true "批量删除nzhq_source_price表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
// @Router /sourcePrice/deleteSourcePrice [delete]
|
||||
export const deleteSourcePriceByIds = (params) => {
|
||||
return service({
|
||||
url: '/sourcePrice/deleteSourcePriceByIds',
|
||||
method: 'delete',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags SourcePrice
|
||||
// @Summary 更新nzhq_source_price表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.SourcePrice true "更新nzhq_source_price表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
|
||||
// @Router /sourcePrice/updateSourcePrice [put]
|
||||
export const updateSourcePrice = (data) => {
|
||||
return service({
|
||||
url: '/sourcePrice/updateSourcePrice',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags SourcePrice
|
||||
// @Summary 用id查询nzhq_source_price表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data query model.SourcePrice true "用id查询nzhq_source_price表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
|
||||
// @Router /sourcePrice/findSourcePrice [get]
|
||||
export const findSourcePrice = (params) => {
|
||||
return service({
|
||||
url: '/sourcePrice/findSourcePrice',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags SourcePrice
|
||||
// @Summary 分页获取nzhq_source_price表列表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data query request.PageInfo true "分页获取nzhq_source_price表列表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /sourcePrice/getSourcePriceList [get]
|
||||
export const getSourcePriceList = (params) => {
|
||||
return service({
|
||||
url: '/sourcePrice/getSourcePriceList',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
import service from '@/utils/request'
|
||||
|
||||
// @Tags SystemArea
|
||||
// @Summary 创建地区
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.SystemArea true "创建地区"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
|
||||
// @Router /systemArea/createSystemArea [post]
|
||||
export const createSystemArea = (data) => {
|
||||
return service({
|
||||
url: '/systemArea/createSystemArea',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags SystemArea
|
||||
// @Summary 删除地区
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.SystemArea true "删除地区"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
// @Router /systemArea/deleteSystemArea [delete]
|
||||
export const deleteSystemArea = (params) => {
|
||||
return service({
|
||||
url: '/systemArea/deleteSystemArea',
|
||||
method: 'delete',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags SystemArea
|
||||
// @Summary 批量删除地区
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.IdsReq true "批量删除地区"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
// @Router /systemArea/deleteSystemArea [delete]
|
||||
export const deleteSystemAreaByIds = (params) => {
|
||||
return service({
|
||||
url: '/systemArea/deleteSystemAreaByIds',
|
||||
method: 'delete',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags SystemArea
|
||||
// @Summary 更新地区
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.SystemArea true "更新地区"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
|
||||
// @Router /systemArea/updateSystemArea [put]
|
||||
export const updateSystemArea = (data) => {
|
||||
return service({
|
||||
url: '/systemArea/updateSystemArea',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags SystemArea
|
||||
// @Summary 用id查询地区
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data query model.SystemArea true "用id查询地区"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
|
||||
// @Router /systemArea/findSystemArea [get]
|
||||
export const findSystemArea = (params) => {
|
||||
return service({
|
||||
url: '/systemArea/findSystemArea',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags SystemArea
|
||||
// @Summary 分页获取地区列表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data query request.PageInfo true "分页获取地区列表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /systemArea/getSystemAreaList [get]
|
||||
export const getSystemAreaList = (params) => {
|
||||
return service({
|
||||
url: '/systemArea/getSystemAreaList',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
|
@ -1,458 +0,0 @@
|
|||
<template>
|
||||
<div>
|
||||
<div class="gva-search-box">
|
||||
<el-form ref="elSearchFormRef" :inline="true" :model="searchInfo" class="demo-form-inline" :rules="searchRule"
|
||||
@keyup.enter="onSubmit">
|
||||
<el-form-item label="创建日期" prop="createdAt">
|
||||
<template #label>
|
||||
<span>
|
||||
创建日期
|
||||
<el-tooltip content="搜索范围是开始日期(包含)至结束日期(不包含)">
|
||||
<el-icon>
|
||||
<QuestionFilled />
|
||||
</el-icon>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
</template>
|
||||
<el-date-picker v-model="searchInfo.startCreatedAt" type="datetime" placeholder="开始日期"
|
||||
:disabled-date="time=> searchInfo.endCreatedAt ? time.getTime() > searchInfo.endCreatedAt.getTime() : false"></el-date-picker>
|
||||
—
|
||||
<el-date-picker v-model="searchInfo.endCreatedAt" type="datetime" placeholder="结束日期"
|
||||
:disabled-date="time=> searchInfo.startCreatedAt ? time.getTime() < searchInfo.startCreatedAt.getTime() : false"></el-date-picker>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="search" @click="onSubmit">查询</el-button>
|
||||
<el-button icon="refresh" @click="onReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="gva-table-box">
|
||||
<div class="gva-btn-list">
|
||||
<el-button type="primary" icon="plus" @click="openDialog">新增</el-button>
|
||||
<el-button icon="delete" style="margin-left: 10px;" :disabled="!multipleSelection.length"
|
||||
@click="onDelete">删除</el-button>
|
||||
</div>
|
||||
<el-table ref="multipleTable" style="width: 100%" tooltip-effect="dark" :data="tableData" row-key="ID"
|
||||
@selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column align="left" label="ID" prop="ID" width="80" />
|
||||
<el-table-column align="left" label="产品" prop="productId" width="120">
|
||||
<template #default="scope">{{ formatProduct(scope.row.productId) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="产品价格Id" prop="productPriceId" width="100" />
|
||||
<el-table-column align="left" label="数据源Id" prop="sourceId" width="100" />
|
||||
<el-table-column align="left" label="公司" prop="companyName" width="240" />
|
||||
<el-table-column align="left" label="品牌" prop="producer" width="120" />
|
||||
<el-table-column align="left" label="价格" prop="price" width="80" />
|
||||
<el-table-column align="left" label="单位" prop="priceUnit" width="60" />
|
||||
<el-table-column align="left" label="发布日期" width="100">
|
||||
<template #default="scope">{{ formatOnlyDate(scope.row.publishDate) }}</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="left" label="创建时间" width="180">
|
||||
<template #default="scope">{{ formatDate(scope.row.createdAt) }}</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="left" label="操作" fixed="right" min-width="240">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" link class="table-button" @click="getDetails(scope.row)">
|
||||
<el-icon style="margin-right: 5px">
|
||||
<InfoFilled />
|
||||
</el-icon>
|
||||
查看详情
|
||||
</el-button>
|
||||
<el-button type="primary" link icon="edit" class="table-button"
|
||||
@click="updateCompanyPriceFunc(scope.row)">变更</el-button>
|
||||
<el-button type="primary" link icon="delete" @click="deleteRow(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="gva-pagination">
|
||||
<el-pagination layout="total, sizes, prev, pager, next, jumper" :current-page="page" :page-size="pageSize"
|
||||
:page-sizes="[10, 30, 50, 100]" :total="total" @current-change="handleCurrentChange"
|
||||
@size-change="handleSizeChange" />
|
||||
</div>
|
||||
</div>
|
||||
<el-drawer size="800" v-model="dialogFormVisible" :show-close="false" :before-close="closeDialog">
|
||||
<template #header>
|
||||
<div class="flex justify-between items-center">
|
||||
<span class="text-lg">{{ type==='create'?'添加':'修改' }}</span>
|
||||
<div>
|
||||
<el-button type="primary" @click="enterDialog">确 定</el-button>
|
||||
<el-button @click="closeDialog">取 消</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-form :model="formData" label-position="top" ref="elFormRef" :rules="rule" label-width="80px">
|
||||
<el-form-item label="产品Id:" prop="productId">
|
||||
<el-input v-model.number="formData.productId" :clearable="true" placeholder="请输入产品Id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="产品价格Id:" prop="productPriceId">
|
||||
<el-input v-model.number="formData.productPriceId" :clearable="true" placeholder="请输入产品价格Id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="数据源Id:" prop="sourceId">
|
||||
<el-input v-model.number="formData.sourceId" :clearable="true" placeholder="请输入数据源Id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="公司:" prop="companyName">
|
||||
<el-input v-model="formData.companyName" :clearable="true" placeholder="请输入公司" />
|
||||
</el-form-item>
|
||||
<el-form-item label="品牌:" prop="producer">
|
||||
<el-input v-model="formData.producer" :clearable="true" placeholder="请输入品牌" />
|
||||
</el-form-item>
|
||||
<el-form-item label="价格:" prop="price">
|
||||
<el-input-number v-model="formData.price" style="width:100%" :precision="2" :clearable="true" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单位:" prop="priceUnit">
|
||||
<el-input v-model="formData.priceUnit" :clearable="true" placeholder="请输入单位" />
|
||||
</el-form-item>
|
||||
<el-form-item label="发布日期:" prop="publishDate">
|
||||
<el-date-picker v-model="formData.publishDate" type="date" style="width:100%" placeholder="选择日期" :clearable="true" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-drawer>
|
||||
|
||||
<el-drawer size="800" v-model="detailShow" :before-close="closeDetailShow" destroy-on-close>
|
||||
<template #header>
|
||||
<div class="flex justify-between items-center">
|
||||
<span class="text-lg">查看详情</span>
|
||||
</div>
|
||||
</template>
|
||||
<el-descriptions :column="1" border>
|
||||
<el-descriptions-item label="ID">
|
||||
{{ formData.ID }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="产品">
|
||||
{{ formatProduct(formData.productId) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="产品价格Id">
|
||||
{{ formData.productPriceId }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="数据源Id">
|
||||
{{ formData.sourceId }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="公司">
|
||||
{{ formData.companyName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="品牌">
|
||||
{{ formData.producer }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="价格">
|
||||
{{ formData.price }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="单位">
|
||||
{{ formData.priceUnit }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="发布日期">
|
||||
{{ formatOnlyDate(formData.publishDate) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="创建时间">
|
||||
{{ formatDate(formData.createdAt) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="更新时间">
|
||||
{{ formatDate(formData.updatedAt) }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getProductList } from '@/api/product'
|
||||
import {
|
||||
createCompanyPrice,
|
||||
deleteCompanyPrice,
|
||||
deleteCompanyPriceByIds,
|
||||
updateCompanyPrice,
|
||||
findCompanyPrice,
|
||||
getCompanyPriceList
|
||||
} from '@/api/companyPrice'
|
||||
|
||||
// 全量引入格式化工具 请按需保留
|
||||
import { formatDate, formatOnlyDate } from '@/utils/format'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { ref, reactive } from 'vue'
|
||||
|
||||
defineOptions({
|
||||
name: 'CompanyPrice'
|
||||
})
|
||||
|
||||
// 自动化生成的字典(可能为空)以及字段
|
||||
const formData = ref({
|
||||
productId: 0,
|
||||
productPriceId: 0,
|
||||
sourceId: 0,
|
||||
companyName: '',
|
||||
producer: '',
|
||||
price: 0,
|
||||
priceUnit: '',
|
||||
publishDate: new Date(),
|
||||
})
|
||||
|
||||
// 验证规则
|
||||
const rule = reactive({
|
||||
})
|
||||
|
||||
const searchRule = reactive({
|
||||
createdAt: [
|
||||
{ validator: (rule, value, callback) => {
|
||||
if (searchInfo.value.startCreatedAt && !searchInfo.value.endCreatedAt) {
|
||||
callback(new Error('请填写结束日期'))
|
||||
} else if (!searchInfo.value.startCreatedAt && searchInfo.value.endCreatedAt) {
|
||||
callback(new Error('请填写开始日期'))
|
||||
} else if (searchInfo.value.startCreatedAt && searchInfo.value.endCreatedAt && (searchInfo.value.startCreatedAt.getTime() === searchInfo.value.endCreatedAt.getTime() || searchInfo.value.startCreatedAt.getTime() > searchInfo.value.endCreatedAt.getTime())) {
|
||||
callback(new Error('开始日期应当早于结束日期'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}, trigger: 'change' }
|
||||
],
|
||||
})
|
||||
|
||||
const elFormRef = ref()
|
||||
const elSearchFormRef = ref()
|
||||
|
||||
// =========== 表格控制部分 ===========
|
||||
const page = ref(1)
|
||||
const total = ref(0)
|
||||
const pageSize = ref(10)
|
||||
const tableData = ref([])
|
||||
const searchInfo = ref({})
|
||||
const productList = ref([])
|
||||
|
||||
const formatProduct = (id) => {
|
||||
for (let i = 0; i < productList.value.length; i++) {
|
||||
if (productList.value[i].ID === id) {
|
||||
return productList.value[i].name
|
||||
}
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
// 重置
|
||||
const onReset = () => {
|
||||
searchInfo.value = {}
|
||||
getTableData()
|
||||
}
|
||||
|
||||
// 搜索
|
||||
const onSubmit = () => {
|
||||
elSearchFormRef.value?.validate(async(valid) => {
|
||||
if (!valid) return
|
||||
page.value = 1
|
||||
pageSize.value = 10
|
||||
getTableData()
|
||||
})
|
||||
}
|
||||
|
||||
// 分页
|
||||
const handleSizeChange = (val) => {
|
||||
pageSize.value = val
|
||||
getTableData()
|
||||
}
|
||||
|
||||
// 修改页面容量
|
||||
const handleCurrentChange = (val) => {
|
||||
page.value = val
|
||||
getTableData()
|
||||
}
|
||||
|
||||
const getProductData = async() => {
|
||||
const resp = await getProductList({ page: 1, pageSize: 100 })
|
||||
if (resp.code === 0 && resp.data.list) {
|
||||
productList.value = resp.data.list
|
||||
}
|
||||
}
|
||||
|
||||
getProductData()
|
||||
|
||||
// 查询
|
||||
const getTableData = async() => {
|
||||
const table = await getCompanyPriceList({ page: page.value, pageSize: pageSize.value, ...searchInfo.value })
|
||||
if (table.code === 0) {
|
||||
tableData.value = table.data.list
|
||||
total.value = table.data.total
|
||||
page.value = table.data.page
|
||||
pageSize.value = table.data.pageSize
|
||||
}
|
||||
}
|
||||
|
||||
getTableData()
|
||||
|
||||
// ============== 表格控制部分结束 ===============
|
||||
|
||||
// 获取需要的字典 可能为空 按需保留
|
||||
const setOptions = async() => {
|
||||
}
|
||||
|
||||
// 获取需要的字典 可能为空 按需保留
|
||||
setOptions()
|
||||
|
||||
// 多选数据
|
||||
const multipleSelection = ref([])
|
||||
// 多选
|
||||
const handleSelectionChange = (val) => {
|
||||
multipleSelection.value = val
|
||||
}
|
||||
|
||||
// 删除行
|
||||
const deleteRow = (row) => {
|
||||
ElMessageBox.confirm('确定要删除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
deleteCompanyPriceFunc(row)
|
||||
})
|
||||
}
|
||||
|
||||
// 多选删除
|
||||
const onDelete = async() => {
|
||||
ElMessageBox.confirm('确定要删除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(async() => {
|
||||
const IDs = []
|
||||
if (multipleSelection.value.length === 0) {
|
||||
ElMessage({
|
||||
type: 'warning',
|
||||
message: '请选择要删除的数据'
|
||||
})
|
||||
return
|
||||
}
|
||||
multipleSelection.value &&
|
||||
multipleSelection.value.map(item => {
|
||||
IDs.push(item.ID)
|
||||
})
|
||||
const res = await deleteCompanyPriceByIds({ IDs })
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '删除成功'
|
||||
})
|
||||
if (tableData.value.length === IDs.length && page.value > 1) {
|
||||
page.value--
|
||||
}
|
||||
getTableData()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 行为控制标记(弹窗内部需要增还是改)
|
||||
const type = ref('')
|
||||
|
||||
// 更新行
|
||||
const updateCompanyPriceFunc = async(row) => {
|
||||
const res = await findCompanyPrice({ ID: row.ID })
|
||||
type.value = 'update'
|
||||
if (res.code === 0) {
|
||||
formData.value = res.data.recompanyPrice
|
||||
dialogFormVisible.value = true
|
||||
}
|
||||
}
|
||||
|
||||
// 删除行
|
||||
const deleteCompanyPriceFunc = async(row) => {
|
||||
const res = await deleteCompanyPrice({ ID: row.ID })
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '删除成功'
|
||||
})
|
||||
if (tableData.value.length === 1 && page.value > 1) {
|
||||
page.value--
|
||||
}
|
||||
getTableData()
|
||||
}
|
||||
}
|
||||
|
||||
// 弹窗控制标记
|
||||
const dialogFormVisible = ref(false)
|
||||
|
||||
// 查看详情控制标记
|
||||
const detailShow = ref(false)
|
||||
|
||||
// 打开详情弹窗
|
||||
const openDetailShow = () => {
|
||||
detailShow.value = true
|
||||
}
|
||||
|
||||
// 打开详情
|
||||
const getDetails = async(row) => {
|
||||
// 打开弹窗
|
||||
const res = await findCompanyPrice({ ID: row.ID })
|
||||
if (res.code === 0) {
|
||||
formData.value = res.data.recompanyPrice
|
||||
openDetailShow()
|
||||
}
|
||||
}
|
||||
|
||||
// 关闭详情弹窗
|
||||
const closeDetailShow = () => {
|
||||
detailShow.value = false
|
||||
formData.value = {
|
||||
productId: 0,
|
||||
productPriceId: 0,
|
||||
sourceId: 0,
|
||||
companyName: '',
|
||||
producer: '',
|
||||
price: 0,
|
||||
priceUnit: '',
|
||||
publishDate: new Date(),
|
||||
}
|
||||
}
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = () => {
|
||||
type.value = 'create'
|
||||
dialogFormVisible.value = true
|
||||
}
|
||||
|
||||
// 关闭弹窗
|
||||
const closeDialog = () => {
|
||||
dialogFormVisible.value = false
|
||||
formData.value = {
|
||||
productId: 0,
|
||||
productPriceId: 0,
|
||||
sourceId: 0,
|
||||
companyName: '',
|
||||
producer: '',
|
||||
price: 0,
|
||||
priceUnit: '',
|
||||
publishDate: new Date(),
|
||||
}
|
||||
}
|
||||
// 弹窗确定
|
||||
const enterDialog = async() => {
|
||||
elFormRef.value?.validate(async(valid) => {
|
||||
if (!valid) return
|
||||
let res
|
||||
switch (type.value) {
|
||||
case 'create':
|
||||
res = await createCompanyPrice(formData.value)
|
||||
break
|
||||
case 'update':
|
||||
res = await updateCompanyPrice(formData.value)
|
||||
break
|
||||
default:
|
||||
res = await createCompanyPrice(formData.value)
|
||||
break
|
||||
}
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '创建/更改成功'
|
||||
})
|
||||
closeDialog()
|
||||
getTableData()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
|
@ -1,123 +0,0 @@
|
|||
<template>
|
||||
<div>
|
||||
<div class="gva-form-box">
|
||||
<el-form :model="formData" ref="elFormRef" label-position="right" :rules="rule" label-width="80px">
|
||||
<el-form-item label="产品Id:" prop="productId">
|
||||
<el-input v-model.number="formData.productId" :clearable="true" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item label="产品价格Id:" prop="productPriceId">
|
||||
<el-input v-model.number="formData.productPriceId" :clearable="true" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item label="数据源Id:" prop="sourceId">
|
||||
<el-input v-model.number="formData.sourceId" :clearable="true" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item label="公司:" prop="companyName">
|
||||
<el-input v-model="formData.companyName" :clearable="true" placeholder="请输入公司" />
|
||||
</el-form-item>
|
||||
<el-form-item label="品牌:" prop="producer">
|
||||
<el-input v-model="formData.producer" :clearable="true" placeholder="请输入品牌" />
|
||||
</el-form-item>
|
||||
<el-form-item label="价格:" prop="price">
|
||||
<el-input-number v-model="formData.price" :precision="2" :clearable="true"></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item label="单位:" prop="priceUnit">
|
||||
<el-input v-model="formData.priceUnit" :clearable="true" placeholder="请输入单位" />
|
||||
</el-form-item>
|
||||
<el-form-item label="发布日期:" prop="publishDate">
|
||||
<el-date-picker v-model="formData.publishDate" type="date" placeholder="选择日期" :clearable="true"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="save">保存</el-button>
|
||||
<el-button type="primary" @click="back">返回</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
createCompanyPrice,
|
||||
updateCompanyPrice,
|
||||
findCompanyPrice
|
||||
} from '@/api/companyPrice'
|
||||
|
||||
defineOptions({
|
||||
name: 'CompanyPriceForm'
|
||||
})
|
||||
|
||||
// 自动获取字典
|
||||
import { getDictFunc } from '@/utils/format'
|
||||
import { useRoute, useRouter } from "vue-router"
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { ref, reactive } from 'vue'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const type = ref('')
|
||||
const formData = ref({
|
||||
productId: 0,
|
||||
productPriceId: 0,
|
||||
sourceId: 0,
|
||||
companyName: '',
|
||||
producer: '',
|
||||
price: 0,
|
||||
priceUnit: '',
|
||||
publishDate: new Date(),
|
||||
})
|
||||
// 验证规则
|
||||
const rule = reactive({
|
||||
})
|
||||
|
||||
const elFormRef = ref()
|
||||
|
||||
// 初始化方法
|
||||
const init = async() => {
|
||||
// 建议通过url传参获取目标数据ID 调用 find方法进行查询数据操作 从而决定本页面是create还是update 以下为id作为url参数示例
|
||||
if (route.query.id) {
|
||||
const res = await findCompanyPrice({ ID: route.query.id })
|
||||
if (res.code === 0) {
|
||||
formData.value = res.data.recompanyPrice
|
||||
type.value = 'update'
|
||||
}
|
||||
} else {
|
||||
type.value = 'create'
|
||||
}
|
||||
}
|
||||
|
||||
init()
|
||||
// 保存按钮
|
||||
const save = async() => {
|
||||
elFormRef.value?.validate(async(valid) => {
|
||||
if (!valid) return
|
||||
let res
|
||||
switch (type.value) {
|
||||
case 'create':
|
||||
res = await createCompanyPrice(formData.value)
|
||||
break
|
||||
case 'update':
|
||||
res = await updateCompanyPrice(formData.value)
|
||||
break
|
||||
default:
|
||||
res = await createCompanyPrice(formData.value)
|
||||
break
|
||||
}
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '创建/更改成功'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 返回按钮
|
||||
const back = () => {
|
||||
router.go(-1)
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
|
|
@ -1,581 +0,0 @@
|
|||
<template>
|
||||
<div>
|
||||
<div class="gva-search-box">
|
||||
<el-form ref="elSearchFormRef" :inline="true" :model="searchInfo" class="demo-form-inline" :rules="searchRule"
|
||||
@keyup.enter="onSubmit">
|
||||
<el-form-item label="状态:" prop="status">
|
||||
<el-select v-model="searchInfo.status" placeholder="请选择" :clearable="true">
|
||||
<el-option v-for="item in statusOptions" :key="item.key" :label="item.label" :value="item.key" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建日期" prop="createdAt">
|
||||
<template #label>
|
||||
<span>
|
||||
创建日期
|
||||
<el-tooltip content="搜索范围是开始日期(包含)至结束日期(不包含)">
|
||||
<el-icon>
|
||||
<QuestionFilled />
|
||||
</el-icon>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
</template>
|
||||
<el-date-picker v-model="searchInfo.startCreatedAt" type="datetime" placeholder="开始日期"
|
||||
:disabled-date="time=> searchInfo.endCreatedAt ? time.getTime() > searchInfo.endCreatedAt.getTime() : false"></el-date-picker>
|
||||
—
|
||||
<el-date-picker v-model="searchInfo.endCreatedAt" type="datetime" placeholder="结束日期"
|
||||
:disabled-date="time=> searchInfo.startCreatedAt ? time.getTime() < searchInfo.startCreatedAt.getTime() : false"></el-date-picker>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="search" @click="onSubmit">查询</el-button>
|
||||
<el-button icon="refresh" @click="onReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="gva-table-box">
|
||||
<div class="gva-btn-list">
|
||||
<el-button type="primary" icon="plus" @click="openDialog">新增</el-button>
|
||||
<el-button icon="delete" style="margin-left: 10px;" :disabled="!multipleSelection.length"
|
||||
@click="onDelete">删除</el-button>
|
||||
<el-button icon="check" style="margin-left: 10px;" :disabled="!multipleSelection.length"
|
||||
@click="onSyncClick">重新同步</el-button>
|
||||
</div>
|
||||
<el-table ref="multipleTable" style="width: 100%" tooltip-effect="dark" :data="tableData" row-key="ID"
|
||||
@selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column align="left" label="ID" prop="ID" width="80" />
|
||||
<el-table-column align="left" label="产品Code" prop="code" width="100" />
|
||||
<el-table-column align="left" label="产品名称" prop="name" width="120" />
|
||||
<el-table-column align="left" label="规格" prop="norm" width="300" />
|
||||
<el-table-column align="left" label="品牌" prop="producer" width="120" />
|
||||
<el-table-column align="left" label="价格类型" prop="priceType" width="120" />
|
||||
<el-table-column align="left" label="单位" prop="priceUnit" width="80" />
|
||||
<el-table-column align="left" label="价格" prop="price" width="80" />
|
||||
<el-table-column align="left" label="地区" prop="areaDetail" width="120" />
|
||||
<el-table-column align="left" label="公司" prop="dealer" width="240" />
|
||||
<el-table-column align="left" label="发布日期" prop="publishDate" width="100" />
|
||||
<el-table-column align="left" label="数据唯一值" prop="uniqueCode" width="300" />
|
||||
<el-table-column align="left" label="抓取时间" prop="crawlTime" width="180" />
|
||||
<el-table-column align="left" label="状态" prop="status" width="80">
|
||||
<template #default="scope">{{ formatCrawlStatus(scope.row.status) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="同步失败原因" prop="syncError" width="240" />
|
||||
|
||||
<el-table-column align="left" label="创建时间" width="180">
|
||||
<template #default="scope">{{ formatDate(scope.row.createdAt) }}</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="left" label="操作" fixed="right" min-width="320">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" link class="table-button" @click="getDetails(scope.row)">
|
||||
<el-icon style="margin-right: 5px">
|
||||
<InfoFilled />
|
||||
</el-icon>
|
||||
查看
|
||||
</el-button>
|
||||
<el-button type="primary" link icon="edit" class="table-button"
|
||||
@click="updateCrawl100ppiFunc(scope.row)">变更</el-button>
|
||||
<el-button type="primary" link icon="check" @click="syncRow(scope.row)">重新同步</el-button>
|
||||
<el-button type="primary" link icon="delete" @click="deleteRow(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="gva-pagination">
|
||||
<el-pagination layout="total, sizes, prev, pager, next, jumper" :current-page="page" :page-size="pageSize"
|
||||
:page-sizes="[10, 30, 50, 100]" :total="total" @current-change="handleCurrentChange"
|
||||
@size-change="handleSizeChange" />
|
||||
</div>
|
||||
</div>
|
||||
<el-drawer size="800" v-model="dialogFormVisible" :show-close="false" :before-close="closeDialog">
|
||||
<template #header>
|
||||
<div class="flex justify-between items-center">
|
||||
<span class="text-lg">{{ type==='create'?'添加':'修改' }}</span>
|
||||
<div>
|
||||
<el-button type="primary" @click="enterDialog">确 定</el-button>
|
||||
<el-button @click="closeDialog">取 消</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-form :model="formData" label-position="top" ref="elFormRef" :rules="rule" label-width="80px">
|
||||
<el-form-item label="产品Code:" prop="code">
|
||||
<el-input v-model="formData.code" :clearable="true" placeholder="请输入产品Code" />
|
||||
</el-form-item>
|
||||
<el-form-item label="产品名称:" prop="name">
|
||||
<el-input v-model="formData.name" :clearable="true" placeholder="请输入产品名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="规格:" prop="norm">
|
||||
<el-input v-model="formData.norm" :clearable="true" placeholder="请输入规格" />
|
||||
</el-form-item>
|
||||
<el-form-item label="品牌:" prop="producer">
|
||||
<el-input v-model="formData.producer" :clearable="true" placeholder="请输入品牌" />
|
||||
</el-form-item>
|
||||
<el-form-item label="价格类型:" prop="priceType">
|
||||
<el-input v-model="formData.priceType" :clearable="true" placeholder="请输入价格类型" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单位:" prop="priceUnit">
|
||||
<el-input v-model="formData.priceUnit" :clearable="true" placeholder="请输入单位" />
|
||||
</el-form-item>
|
||||
<el-form-item label="价格:" prop="price">
|
||||
<el-input v-model="formData.price" :clearable="true" placeholder="请输入价格" />
|
||||
</el-form-item>
|
||||
<el-form-item label="地区:" prop="areaDetail">
|
||||
<el-input v-model="formData.areaDetail" :clearable="true" placeholder="请输入地区" />
|
||||
</el-form-item>
|
||||
<el-form-item label="公司:" prop="dealer">
|
||||
<el-input v-model="formData.dealer" :clearable="true" placeholder="请输入公司" />
|
||||
</el-form-item>
|
||||
<el-form-item label="发布日期:" prop="publishDate">
|
||||
<el-input v-model="formData.publishDate" :clearable="true" placeholder="请输入发布日期" />
|
||||
</el-form-item>
|
||||
<el-form-item label="数据唯一值:" prop="uniqueCode">
|
||||
<el-input v-model="formData.uniqueCode" :clearable="true" placeholder="请输入数据唯一值" />
|
||||
</el-form-item>
|
||||
<el-form-item label="抓取时间:" prop="crawlTime">
|
||||
<el-input v-model="formData.crawlTime" :clearable="true" placeholder="请输入抓取时间" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态:" prop="status">
|
||||
<el-input v-model.number="formData.status" :clearable="true" placeholder="请输入状态" />
|
||||
</el-form-item>
|
||||
<el-form-item label="同步失败原因:" prop="syncError">
|
||||
<el-input v-model="formData.syncError" :clearable="true" placeholder="请输入同步失败原因" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-drawer>
|
||||
|
||||
<el-drawer size="800" v-model="detailShow" :before-close="closeDetailShow" destroy-on-close>
|
||||
<template #header>
|
||||
<div class="flex justify-between items-center">
|
||||
<span class="text-lg">查看详情</span>
|
||||
</div>
|
||||
</template>
|
||||
<el-descriptions :column="1" border>
|
||||
<el-descriptions-item label="ID">
|
||||
{{ formData.ID }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="产品Code">
|
||||
{{ formData.code }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="产品名称">
|
||||
{{ formData.name }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="规格">
|
||||
{{ formData.norm }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="品牌">
|
||||
{{ formData.producer }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="价格类型">
|
||||
{{ formData.priceType }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="单位">
|
||||
{{ formData.priceUnit }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="价格">
|
||||
{{ formData.price }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="地区">
|
||||
{{ formData.areaDetail }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="公司">
|
||||
{{ formData.dealer }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="发布日期">
|
||||
{{ formData.publishDate }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="数据唯一值">
|
||||
{{ formData.uniqueCode }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="抓取时间">
|
||||
{{ formData.crawlTime }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="状态">
|
||||
{{ formatCrawlStatus(formData.status) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="同步失败原因">
|
||||
{{ formData.syncError }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="创建时间">
|
||||
{{ formatDate(formData.createdAt) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="更新时间">
|
||||
{{ formatDate(formData.updatedAt) }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
createCrawl100ppi,
|
||||
deleteCrawl100ppi,
|
||||
syncCrawl100ppi,
|
||||
deleteCrawl100ppiByIds,
|
||||
updateCrawl100ppi,
|
||||
findCrawl100ppi,
|
||||
getCrawl100ppiList
|
||||
} from '@/api/crawl100ppi'
|
||||
|
||||
// 全量引入格式化工具 请按需保留
|
||||
import { getDictFunc, formatDate, filterDict, ReturnArrImg, onDownloadFile } from '@/utils/format'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { ref, reactive } from 'vue'
|
||||
|
||||
defineOptions({
|
||||
name: 'Crawl100ppi'
|
||||
})
|
||||
|
||||
const statusOptions = [
|
||||
{ key: 1, label: '未同步' },
|
||||
{ key: 2, label: '同步成功' },
|
||||
{ key: 3, label: '同步失败' },
|
||||
]
|
||||
|
||||
const formatCrawlStatus = (status) => {
|
||||
let item
|
||||
statusOptions.forEach((option, index) => {
|
||||
if (option.key === status) {
|
||||
item = option
|
||||
return
|
||||
}
|
||||
})
|
||||
if (item) {
|
||||
return item.label
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
// 自动化生成的字典(可能为空)以及字段
|
||||
const formData = ref({
|
||||
code: '',
|
||||
name: '',
|
||||
norm: '',
|
||||
producer: '',
|
||||
priceType: '',
|
||||
priceUnit: '',
|
||||
price: '',
|
||||
areaDetail: '',
|
||||
dealer: '',
|
||||
publishDate: '',
|
||||
uniqueCode: '',
|
||||
crawlTime: '',
|
||||
status: 0,
|
||||
syncError: '',
|
||||
})
|
||||
|
||||
// 验证规则
|
||||
const rule = reactive({
|
||||
})
|
||||
|
||||
const searchRule = reactive({
|
||||
createdAt: [
|
||||
{ validator: (rule, value, callback) => {
|
||||
if (searchInfo.value.startCreatedAt && !searchInfo.value.endCreatedAt) {
|
||||
callback(new Error('请填写结束日期'))
|
||||
} else if (!searchInfo.value.startCreatedAt && searchInfo.value.endCreatedAt) {
|
||||
callback(new Error('请填写开始日期'))
|
||||
} else if (searchInfo.value.startCreatedAt && searchInfo.value.endCreatedAt && (searchInfo.value.startCreatedAt.getTime() === searchInfo.value.endCreatedAt.getTime() || searchInfo.value.startCreatedAt.getTime() > searchInfo.value.endCreatedAt.getTime())) {
|
||||
callback(new Error('开始日期应当早于结束日期'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}, trigger: 'change' }
|
||||
],
|
||||
})
|
||||
|
||||
const elFormRef = ref()
|
||||
const elSearchFormRef = ref()
|
||||
|
||||
// =========== 表格控制部分 ===========
|
||||
const page = ref(1)
|
||||
const total = ref(0)
|
||||
const pageSize = ref(10)
|
||||
const tableData = ref([])
|
||||
const searchInfo = ref({})
|
||||
|
||||
// 重置
|
||||
const onReset = () => {
|
||||
searchInfo.value = {}
|
||||
getTableData()
|
||||
}
|
||||
|
||||
// 搜索
|
||||
const onSubmit = () => {
|
||||
elSearchFormRef.value?.validate(async(valid) => {
|
||||
if (!valid) return
|
||||
page.value = 1
|
||||
pageSize.value = 10
|
||||
getTableData()
|
||||
})
|
||||
}
|
||||
|
||||
// 分页
|
||||
const handleSizeChange = (val) => {
|
||||
pageSize.value = val
|
||||
getTableData()
|
||||
}
|
||||
|
||||
// 修改页面容量
|
||||
const handleCurrentChange = (val) => {
|
||||
page.value = val
|
||||
getTableData()
|
||||
}
|
||||
|
||||
// 查询
|
||||
const getTableData = async() => {
|
||||
const table = await getCrawl100ppiList({ page: page.value, pageSize: pageSize.value, ...searchInfo.value })
|
||||
if (table.code === 0) {
|
||||
tableData.value = table.data.list
|
||||
total.value = table.data.total
|
||||
page.value = table.data.page
|
||||
pageSize.value = table.data.pageSize
|
||||
}
|
||||
}
|
||||
|
||||
getTableData()
|
||||
|
||||
// ============== 表格控制部分结束 ===============
|
||||
|
||||
// 获取需要的字典 可能为空 按需保留
|
||||
const setOptions = async() => {
|
||||
}
|
||||
|
||||
// 获取需要的字典 可能为空 按需保留
|
||||
setOptions()
|
||||
|
||||
// 多选数据
|
||||
const multipleSelection = ref([])
|
||||
// 多选
|
||||
const handleSelectionChange = (val) => {
|
||||
multipleSelection.value = val
|
||||
}
|
||||
|
||||
// 删除行
|
||||
const deleteRow = (row) => {
|
||||
ElMessageBox.confirm('确定要删除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
deleteCrawl100ppiFunc(row)
|
||||
})
|
||||
}
|
||||
|
||||
// 多选删除
|
||||
const onDelete = async() => {
|
||||
ElMessageBox.confirm('确定要删除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(async() => {
|
||||
const IDs = []
|
||||
if (multipleSelection.value.length === 0) {
|
||||
ElMessage({
|
||||
type: 'warning',
|
||||
message: '请选择要删除的数据'
|
||||
})
|
||||
return
|
||||
}
|
||||
multipleSelection.value &&
|
||||
multipleSelection.value.map(item => {
|
||||
IDs.push(item.ID)
|
||||
})
|
||||
const res = await deleteCrawl100ppiByIds({ IDs })
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '删除成功'
|
||||
})
|
||||
if (tableData.value.length === IDs.length && page.value > 1) {
|
||||
page.value--
|
||||
}
|
||||
getTableData()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 同步行
|
||||
const syncRow = (row) => {
|
||||
ElMessageBox.confirm('确定要同步吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
syncCrawl100ppiFunc(row)
|
||||
})
|
||||
}
|
||||
|
||||
// 多选同步
|
||||
const onSyncClick = async() => {
|
||||
ElMessageBox.confirm('确定要删除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(async() => {
|
||||
const IDs = []
|
||||
if (multipleSelection.value.length === 0) {
|
||||
ElMessage({
|
||||
type: 'warning',
|
||||
message: '请选择要同步的数据'
|
||||
})
|
||||
return
|
||||
}
|
||||
multipleSelection.value &&
|
||||
multipleSelection.value.map(item => {
|
||||
IDs.push(item.ID)
|
||||
})
|
||||
const res = await syncCrawl100ppi({ IDs })
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '同步操作成功'
|
||||
})
|
||||
if (tableData.value.length === IDs.length && page.value > 1) {
|
||||
page.value--
|
||||
}
|
||||
getTableData()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 行为控制标记(弹窗内部需要增还是改)
|
||||
const type = ref('')
|
||||
|
||||
// 更新行
|
||||
const updateCrawl100ppiFunc = async(row) => {
|
||||
const res = await findCrawl100ppi({ ID: row.ID })
|
||||
type.value = 'update'
|
||||
if (res.code === 0) {
|
||||
formData.value = res.data.recrawl100ppi
|
||||
dialogFormVisible.value = true
|
||||
}
|
||||
}
|
||||
|
||||
// 删除行
|
||||
const deleteCrawl100ppiFunc = async(row) => {
|
||||
const res = await deleteCrawl100ppi({ ID: row.ID })
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '删除成功'
|
||||
})
|
||||
if (tableData.value.length === 1 && page.value > 1) {
|
||||
page.value--
|
||||
}
|
||||
getTableData()
|
||||
}
|
||||
}
|
||||
|
||||
// 同步行
|
||||
const syncCrawl100ppiFunc = async(row) => {
|
||||
const res = await syncCrawl100ppi({ IDs: [row.ID] })
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '同步操作成功'
|
||||
})
|
||||
getTableData()
|
||||
}
|
||||
}
|
||||
|
||||
// 弹窗控制标记
|
||||
const dialogFormVisible = ref(false)
|
||||
|
||||
// 查看详情控制标记
|
||||
const detailShow = ref(false)
|
||||
|
||||
// 打开详情弹窗
|
||||
const openDetailShow = () => {
|
||||
detailShow.value = true
|
||||
}
|
||||
|
||||
// 打开详情
|
||||
const getDetails = async(row) => {
|
||||
// 打开弹窗
|
||||
const res = await findCrawl100ppi({ ID: row.ID })
|
||||
if (res.code === 0) {
|
||||
formData.value = res.data.recrawl100ppi
|
||||
openDetailShow()
|
||||
}
|
||||
}
|
||||
|
||||
// 关闭详情弹窗
|
||||
const closeDetailShow = () => {
|
||||
detailShow.value = false
|
||||
formData.value = {
|
||||
code: '',
|
||||
name: '',
|
||||
norm: '',
|
||||
producer: '',
|
||||
priceType: '',
|
||||
priceUnit: '',
|
||||
price: '',
|
||||
areaDetail: '',
|
||||
dealer: '',
|
||||
publishDate: '',
|
||||
uniqueCode: '',
|
||||
crawlTime: '',
|
||||
status: 0,
|
||||
syncError: '',
|
||||
}
|
||||
}
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = () => {
|
||||
type.value = 'create'
|
||||
dialogFormVisible.value = true
|
||||
}
|
||||
|
||||
// 关闭弹窗
|
||||
const closeDialog = () => {
|
||||
dialogFormVisible.value = false
|
||||
formData.value = {
|
||||
code: '',
|
||||
name: '',
|
||||
norm: '',
|
||||
producer: '',
|
||||
priceType: '',
|
||||
priceUnit: '',
|
||||
price: '',
|
||||
areaDetail: '',
|
||||
dealer: '',
|
||||
publishDate: '',
|
||||
uniqueCode: '',
|
||||
crawlTime: '',
|
||||
status: 0,
|
||||
syncError: '',
|
||||
}
|
||||
}
|
||||
// 弹窗确定
|
||||
const enterDialog = async() => {
|
||||
elFormRef.value?.validate(async(valid) => {
|
||||
if (!valid) return
|
||||
let res
|
||||
switch (type.value) {
|
||||
case 'create':
|
||||
res = await createCrawl100ppi(formData.value)
|
||||
break
|
||||
case 'update':
|
||||
res = await updateCrawl100ppi(formData.value)
|
||||
break
|
||||
default:
|
||||
res = await createCrawl100ppi(formData.value)
|
||||
break
|
||||
}
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '创建/更改成功'
|
||||
})
|
||||
closeDialog()
|
||||
getTableData()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
|
@ -1,147 +0,0 @@
|
|||
<template>
|
||||
<div>
|
||||
<div class="gva-form-box">
|
||||
<el-form :model="formData" ref="elFormRef" label-position="right" :rules="rule" label-width="80px">
|
||||
<el-form-item label="产品Code:" prop="code">
|
||||
<el-input v-model="formData.code" :clearable="true" placeholder="请输入产品Code" />
|
||||
</el-form-item>
|
||||
<el-form-item label="产品名称:" prop="name">
|
||||
<el-input v-model="formData.name" :clearable="true" placeholder="请输入产品名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="规格:" prop="norm">
|
||||
<el-input v-model="formData.norm" :clearable="true" placeholder="请输入规格" />
|
||||
</el-form-item>
|
||||
<el-form-item label="品牌:" prop="producer">
|
||||
<el-input v-model="formData.producer" :clearable="true" placeholder="请输入品牌" />
|
||||
</el-form-item>
|
||||
<el-form-item label="价格类型:" prop="priceType">
|
||||
<el-input v-model="formData.priceType" :clearable="true" placeholder="请输入价格类型" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单位:" prop="priceUnit">
|
||||
<el-input v-model="formData.priceUnit" :clearable="true" placeholder="请输入单位" />
|
||||
</el-form-item>
|
||||
<el-form-item label="价格:" prop="price">
|
||||
<el-input v-model="formData.price" :clearable="true" placeholder="请输入价格" />
|
||||
</el-form-item>
|
||||
<el-form-item label="地区:" prop="areaDetail">
|
||||
<el-input v-model="formData.areaDetail" :clearable="true" placeholder="请输入地区" />
|
||||
</el-form-item>
|
||||
<el-form-item label="公司:" prop="dealer">
|
||||
<el-input v-model="formData.dealer" :clearable="true" placeholder="请输入公司" />
|
||||
</el-form-item>
|
||||
<el-form-item label="发布日期:" prop="publishDate">
|
||||
<el-input v-model="formData.publishDate" :clearable="true" placeholder="请输入发布日期" />
|
||||
</el-form-item>
|
||||
<el-form-item label="数据唯一值:" prop="uniqueCode">
|
||||
<el-input v-model="formData.uniqueCode" :clearable="true" placeholder="请输入数据唯一值" />
|
||||
</el-form-item>
|
||||
<el-form-item label="抓取时间:" prop="crawlTime">
|
||||
<el-input v-model="formData.crawlTime" :clearable="true" placeholder="请输入抓取时间" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态:" prop="status">
|
||||
<el-input v-model.number="formData.status" :clearable="true" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item label="同步失败原因:" prop="syncError">
|
||||
<el-input v-model="formData.syncError" :clearable="true" placeholder="请输入同步失败原因" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="save">保存</el-button>
|
||||
<el-button type="primary" @click="back">返回</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
createCrawl100ppi,
|
||||
updateCrawl100ppi,
|
||||
findCrawl100ppi
|
||||
} from '@/api/crawl100ppi'
|
||||
|
||||
defineOptions({
|
||||
name: 'Crawl100ppiForm'
|
||||
})
|
||||
|
||||
// 自动获取字典
|
||||
import { getDictFunc } from '@/utils/format'
|
||||
import { useRoute, useRouter } from "vue-router"
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { ref, reactive } from 'vue'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const type = ref('')
|
||||
const formData = ref({
|
||||
code: '',
|
||||
name: '',
|
||||
norm: '',
|
||||
producer: '',
|
||||
priceType: '',
|
||||
priceUnit: '',
|
||||
price: '',
|
||||
areaDetail: '',
|
||||
dealer: '',
|
||||
publishDate: '',
|
||||
uniqueCode: '',
|
||||
crawlTime: '',
|
||||
status: 0,
|
||||
syncError: '',
|
||||
})
|
||||
// 验证规则
|
||||
const rule = reactive({
|
||||
})
|
||||
|
||||
const elFormRef = ref()
|
||||
|
||||
// 初始化方法
|
||||
const init = async() => {
|
||||
// 建议通过url传参获取目标数据ID 调用 find方法进行查询数据操作 从而决定本页面是create还是update 以下为id作为url参数示例
|
||||
if (route.query.id) {
|
||||
const res = await findCrawl100ppi({ ID: route.query.id })
|
||||
if (res.code === 0) {
|
||||
formData.value = res.data.recrawl100ppi
|
||||
type.value = 'update'
|
||||
}
|
||||
} else {
|
||||
type.value = 'create'
|
||||
}
|
||||
}
|
||||
|
||||
init()
|
||||
// 保存按钮
|
||||
const save = async() => {
|
||||
elFormRef.value?.validate(async(valid) => {
|
||||
if (!valid) return
|
||||
let res
|
||||
switch (type.value) {
|
||||
case 'create':
|
||||
res = await createCrawl100ppi(formData.value)
|
||||
break
|
||||
case 'update':
|
||||
res = await updateCrawl100ppi(formData.value)
|
||||
break
|
||||
default:
|
||||
res = await createCrawl100ppi(formData.value)
|
||||
break
|
||||
}
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '创建/更改成功'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 返回按钮
|
||||
const back = () => {
|
||||
router.go(-1)
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
|
|
@ -1,409 +0,0 @@
|
|||
<template>
|
||||
<div>
|
||||
<div class="gva-search-box">
|
||||
<el-form ref="elSearchFormRef" :inline="true" :model="searchInfo" class="demo-form-inline" @keyup.enter="onSubmit">
|
||||
<el-form-item label="字段名" prop="fieldName">
|
||||
<template #label>
|
||||
<span>字段名</span>
|
||||
</template>
|
||||
<el-input v-model="searchInfo.fieldName" type="input" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否同步:" prop="isSync">
|
||||
<el-select v-model="searchInfo.isSync" placeholder="请选择" :clearable="true">
|
||||
<el-option v-for="item in ['yes', 'no']" :key="item" :label="item" :value="item" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="search" @click="onSubmit">查询</el-button>
|
||||
<el-button icon="refresh" @click="onReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="gva-table-box">
|
||||
<div class="gva-btn-list">
|
||||
<el-button type="primary" icon="plus" @click="openDialog">新增</el-button>
|
||||
<el-button icon="delete" style="margin-left: 10px;" :disabled="!multipleSelection.length" @click="onDelete">删除</el-button>
|
||||
</div>
|
||||
<el-table
|
||||
ref="multipleTable"
|
||||
style="width: 100%"
|
||||
tooltip-effect="dark"
|
||||
:data="tableData"
|
||||
row-key="id"
|
||||
@selection-change="handleSelectionChange"
|
||||
@sort-change="sortChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column sortable align="left" label="ID" prop="id" width="80" />
|
||||
<el-table-column align="left" label="字段名" prop="fieldName" width="120" />
|
||||
<el-table-column align="left" label="原始值" prop="fieldSource" width="300" />
|
||||
<el-table-column align="left" label="替换后的值" prop="fieldReplace" width="200" />
|
||||
<el-table-column align="left" label="是否同步" prop="isSync" width="120" />
|
||||
<el-table-column align="left" label="操作" fixed="right" min-width="240">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" link class="table-button" @click="getDetails(scope.row)">
|
||||
<el-icon style="margin-right: 5px"><InfoFilled /></el-icon>
|
||||
查看详情
|
||||
</el-button>
|
||||
<el-button type="primary" link icon="edit" class="table-button" @click="updateCrawlFieldReplaceFunc(scope.row)">变更</el-button>
|
||||
<el-button type="primary" link icon="delete" @click="deleteRow(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="gva-pagination">
|
||||
<el-pagination
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:current-page="page"
|
||||
:page-size="pageSize"
|
||||
:page-sizes="[10, 30, 50, 100]"
|
||||
:total="total"
|
||||
@current-change="handleCurrentChange"
|
||||
@size-change="handleSizeChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<el-drawer size="800" v-model="dialogFormVisible" :show-close="false" :before-close="closeDialog">
|
||||
<template #header>
|
||||
<div class="flex justify-between items-center">
|
||||
<span class="text-lg">{{ type==='create'?'添加':'修改' }}</span>
|
||||
<div>
|
||||
<el-button type="primary" @click="enterDialog">确 定</el-button>
|
||||
<el-button @click="closeDialog">取 消</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-form :model="formData" label-position="top" ref="elFormRef" :rules="rule" label-width="80px">
|
||||
<el-form-item label="字段名:" prop="fieldName">
|
||||
<el-input v-model="formData.fieldName" :clearable="true" placeholder="请输入字段名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="原始值:" prop="fieldSource">
|
||||
<el-input v-model="formData.fieldSource" :clearable="true" placeholder="请输入原始值" />
|
||||
</el-form-item>
|
||||
<el-form-item label="替换后的值:" prop="fieldReplace">
|
||||
<el-input v-model="formData.fieldReplace" :clearable="true" placeholder="请输入替换后的值" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否同步:" prop="isSync">
|
||||
<el-select v-model="formData.isSync" placeholder="请选择是否同步" style="width:100%" :clearable="true" >
|
||||
<el-option v-for="item in ['yes', 'no']" :key="item" :label="item" :value="item" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-drawer>
|
||||
|
||||
<el-drawer size="800" v-model="detailShow" :before-close="closeDetailShow" destroy-on-close>
|
||||
<template #header>
|
||||
<div class="flex justify-between items-center">
|
||||
<span class="text-lg">查看详情</span>
|
||||
</div>
|
||||
</template>
|
||||
<el-descriptions :column="1" border>
|
||||
<el-descriptions-item label="ID">
|
||||
{{ formData.id }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="字段名">
|
||||
{{ formData.fieldName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="原始值">
|
||||
{{ formData.fieldSource }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="替换后的值">
|
||||
{{ formData.fieldReplace }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="是否同步">
|
||||
{{ formData.isSync }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
createCrawlFieldReplace,
|
||||
deleteCrawlFieldReplace,
|
||||
deleteCrawlFieldReplaceByIds,
|
||||
updateCrawlFieldReplace,
|
||||
findCrawlFieldReplace,
|
||||
getCrawlFieldReplaceList
|
||||
} from '@/api/crawlFieldReplace'
|
||||
|
||||
// 全量引入格式化工具 请按需保留
|
||||
// import { getDictFunc, formatDate, formatBoolean, filterDict, ReturnArrImg, onDownloadFile } from '@/utils/format'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { ref, reactive } from 'vue'
|
||||
|
||||
defineOptions({
|
||||
name: 'CrawlFieldReplace'
|
||||
})
|
||||
|
||||
// 自动化生成的字典(可能为空)以及字段
|
||||
const formData = ref({
|
||||
id: 0,
|
||||
fieldName: '',
|
||||
fieldReplace: '',
|
||||
fieldSource: '',
|
||||
isSync: '',
|
||||
})
|
||||
|
||||
// 验证规则
|
||||
const rule = reactive({
|
||||
fieldName: [{
|
||||
required: true,
|
||||
message: '',
|
||||
trigger: ['input', 'blur'],
|
||||
},
|
||||
{
|
||||
whitespace: true,
|
||||
message: '不能只输入空格',
|
||||
trigger: ['input', 'blur'],
|
||||
}
|
||||
],
|
||||
id: [{
|
||||
required: true,
|
||||
message: '',
|
||||
trigger: ['input', 'blur'],
|
||||
},
|
||||
],
|
||||
isSync: [{
|
||||
required: true,
|
||||
message: '',
|
||||
trigger: ['input', 'blur'],
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
const elFormRef = ref()
|
||||
const elSearchFormRef = ref()
|
||||
|
||||
// =========== 表格控制部分 ===========
|
||||
const page = ref(1)
|
||||
const total = ref(0)
|
||||
const pageSize = ref(10)
|
||||
const tableData = ref([])
|
||||
const searchInfo = ref({})
|
||||
// 排序
|
||||
const sortChange = ({ prop, order }) => {
|
||||
const sortMap = {
|
||||
id: 'id',
|
||||
}
|
||||
|
||||
let sort = sortMap[prop]
|
||||
if (!sort) {
|
||||
sort = prop.replace(/[A-Z]/g, match => `_${match.toLowerCase()}`)
|
||||
}
|
||||
|
||||
searchInfo.value.sort = sort
|
||||
searchInfo.value.order = order
|
||||
getTableData()
|
||||
}
|
||||
|
||||
// 重置
|
||||
const onReset = () => {
|
||||
searchInfo.value = {}
|
||||
getTableData()
|
||||
}
|
||||
|
||||
// 搜索
|
||||
const onSubmit = () => {
|
||||
elSearchFormRef.value?.validate(async(valid) => {
|
||||
if (!valid) return
|
||||
page.value = 1
|
||||
pageSize.value = 10
|
||||
getTableData()
|
||||
})
|
||||
}
|
||||
|
||||
// 分页
|
||||
const handleSizeChange = (val) => {
|
||||
pageSize.value = val
|
||||
getTableData()
|
||||
}
|
||||
|
||||
// 修改页面容量
|
||||
const handleCurrentChange = (val) => {
|
||||
page.value = val
|
||||
getTableData()
|
||||
}
|
||||
|
||||
// 查询
|
||||
const getTableData = async() => {
|
||||
const table = await getCrawlFieldReplaceList({ page: page.value, pageSize: pageSize.value, ...searchInfo.value })
|
||||
if (table.code === 0) {
|
||||
tableData.value = table.data.list
|
||||
total.value = table.data.total
|
||||
page.value = table.data.page
|
||||
pageSize.value = table.data.pageSize
|
||||
}
|
||||
}
|
||||
|
||||
getTableData()
|
||||
|
||||
// ============== 表格控制部分结束 ===============
|
||||
|
||||
// 获取需要的字典 可能为空 按需保留
|
||||
const setOptions = async() => {
|
||||
}
|
||||
|
||||
// 获取需要的字典 可能为空 按需保留
|
||||
setOptions()
|
||||
|
||||
// 多选数据
|
||||
const multipleSelection = ref([])
|
||||
// 多选
|
||||
const handleSelectionChange = (val) => {
|
||||
multipleSelection.value = val
|
||||
}
|
||||
|
||||
// 删除行
|
||||
const deleteRow = (row) => {
|
||||
ElMessageBox.confirm('确定要删除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
deleteCrawlFieldReplaceFunc(row)
|
||||
})
|
||||
}
|
||||
|
||||
// 多选删除
|
||||
const onDelete = async() => {
|
||||
ElMessageBox.confirm('确定要删除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(async() => {
|
||||
const ids = []
|
||||
if (multipleSelection.value.length === 0) {
|
||||
ElMessage({
|
||||
type: 'warning',
|
||||
message: '请选择要删除的数据'
|
||||
})
|
||||
return
|
||||
}
|
||||
multipleSelection.value &&
|
||||
multipleSelection.value.map(item => {
|
||||
ids.push(item.id)
|
||||
})
|
||||
const res = await deleteCrawlFieldReplaceByIds({ ids })
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '删除成功'
|
||||
})
|
||||
if (tableData.value.length === ids.length && page.value > 1) {
|
||||
page.value--
|
||||
}
|
||||
getTableData()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 行为控制标记(弹窗内部需要增还是改)
|
||||
const type = ref('')
|
||||
|
||||
// 更新行
|
||||
const updateCrawlFieldReplaceFunc = async(row) => {
|
||||
const res = await findCrawlFieldReplace({ id: row.id })
|
||||
type.value = 'update'
|
||||
if (res.code === 0) {
|
||||
formData.value = res.data.recrawlFieldReplace
|
||||
dialogFormVisible.value = true
|
||||
}
|
||||
}
|
||||
|
||||
// 删除行
|
||||
const deleteCrawlFieldReplaceFunc = async(row) => {
|
||||
const res = await deleteCrawlFieldReplace({ id: row.id })
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '删除成功'
|
||||
})
|
||||
if (tableData.value.length === 1 && page.value > 1) {
|
||||
page.value--
|
||||
}
|
||||
getTableData()
|
||||
}
|
||||
}
|
||||
|
||||
// 弹窗控制标记
|
||||
const dialogFormVisible = ref(false)
|
||||
|
||||
// 查看详情控制标记
|
||||
const detailShow = ref(false)
|
||||
|
||||
// 打开详情弹窗
|
||||
const openDetailShow = () => {
|
||||
detailShow.value = true
|
||||
}
|
||||
|
||||
// 打开详情
|
||||
const getDetails = async(row) => {
|
||||
// 打开弹窗
|
||||
const res = await findCrawlFieldReplace({ id: row.id })
|
||||
if (res.code === 0) {
|
||||
formData.value = res.data.recrawlFieldReplace
|
||||
openDetailShow()
|
||||
}
|
||||
}
|
||||
|
||||
// 关闭详情弹窗
|
||||
const closeDetailShow = () => {
|
||||
detailShow.value = false
|
||||
formData.value = {
|
||||
fieldName: '',
|
||||
fieldReplace: '',
|
||||
fieldSource: '',
|
||||
id: 0,
|
||||
}
|
||||
}
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = () => {
|
||||
type.value = 'create'
|
||||
dialogFormVisible.value = true
|
||||
}
|
||||
|
||||
// 关闭弹窗
|
||||
const closeDialog = () => {
|
||||
dialogFormVisible.value = false
|
||||
formData.value = {
|
||||
fieldName: '',
|
||||
fieldReplace: '',
|
||||
fieldSource: '',
|
||||
id: 0,
|
||||
}
|
||||
}
|
||||
// 弹窗确定
|
||||
const enterDialog = async() => {
|
||||
elFormRef.value?.validate(async(valid) => {
|
||||
if (!valid) return
|
||||
let res
|
||||
switch (type.value) {
|
||||
case 'create':
|
||||
res = await createCrawlFieldReplace(formData.value)
|
||||
break
|
||||
case 'update':
|
||||
res = await updateCrawlFieldReplace(formData.value)
|
||||
break
|
||||
default:
|
||||
res = await createCrawlFieldReplace(formData.value)
|
||||
break
|
||||
}
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '创建/更改成功'
|
||||
})
|
||||
closeDialog()
|
||||
getTableData()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
|
@ -1,128 +0,0 @@
|
|||
<template>
|
||||
<div>
|
||||
<div class="gva-form-box">
|
||||
<el-form :model="formData" ref="elFormRef" label-position="right" :rules="rule" label-width="80px">
|
||||
<el-form-item label="字段名:" prop="fieldName">
|
||||
<el-input v-model="formData.fieldName" :clearable="true" placeholder="请输入字段名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="替换后的值:" prop="fieldReplace">
|
||||
<el-input v-model="formData.fieldReplace" :clearable="true" placeholder="请输入替换后的值" />
|
||||
</el-form-item>
|
||||
<el-form-item label="原始值:" prop="fieldSource">
|
||||
<el-input v-model="formData.fieldSource" :clearable="true" placeholder="请输入原始值" />
|
||||
</el-form-item>
|
||||
<el-form-item label="ID:" prop="id">
|
||||
<el-input v-model.number="formData.id" :clearable="true" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否同步:" prop="isSync">
|
||||
<el-select v-model="formData.isSync" placeholder="请选择" style="width:100%" :clearable="true">
|
||||
<el-option v-for="item in [100]" :key="item" :label="item" :value="item" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="save">保存</el-button>
|
||||
<el-button type="primary" @click="back">返回</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
createCrawlFieldReplace,
|
||||
updateCrawlFieldReplace,
|
||||
findCrawlFieldReplace
|
||||
} from '@/api/crawlFieldReplace'
|
||||
|
||||
defineOptions({
|
||||
name: 'CrawlFieldReplaceForm'
|
||||
})
|
||||
|
||||
// 自动获取字典
|
||||
import { getDictFunc } from '@/utils/format'
|
||||
import { useRoute, useRouter } from "vue-router"
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { ref, reactive } from 'vue'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const type = ref('')
|
||||
const formData = ref({
|
||||
fieldName: '',
|
||||
fieldReplace: '',
|
||||
fieldSource: '',
|
||||
id: 0,
|
||||
})
|
||||
// 验证规则
|
||||
const rule = reactive({
|
||||
fieldName : [{
|
||||
required: true,
|
||||
message: '',
|
||||
trigger: ['input','blur'],
|
||||
}],
|
||||
id : [{
|
||||
required: true,
|
||||
message: '',
|
||||
trigger: ['input','blur'],
|
||||
}],
|
||||
isSync : [{
|
||||
required: true,
|
||||
message: '',
|
||||
trigger: ['input','blur'],
|
||||
}],
|
||||
})
|
||||
|
||||
const elFormRef = ref()
|
||||
|
||||
// 初始化方法
|
||||
const init = async () => {
|
||||
// 建议通过url传参获取目标数据ID 调用 find方法进行查询数据操作 从而决定本页面是create还是update 以下为id作为url参数示例
|
||||
if (route.query.id) {
|
||||
const res = await findCrawlFieldReplace({ ID: route.query.id })
|
||||
if (res.code === 0) {
|
||||
formData.value = res.data.recrawlFieldReplace
|
||||
type.value = 'update'
|
||||
}
|
||||
} else {
|
||||
type.value = 'create'
|
||||
}
|
||||
}
|
||||
|
||||
init()
|
||||
// 保存按钮
|
||||
const save = async() => {
|
||||
elFormRef.value?.validate( async (valid) => {
|
||||
if (!valid) return
|
||||
let res
|
||||
switch (type.value) {
|
||||
case 'create':
|
||||
res = await createCrawlFieldReplace(formData.value)
|
||||
break
|
||||
case 'update':
|
||||
res = await updateCrawlFieldReplace(formData.value)
|
||||
break
|
||||
default:
|
||||
res = await createCrawlFieldReplace(formData.value)
|
||||
break
|
||||
}
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '创建/更改成功'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 返回按钮
|
||||
const back = () => {
|
||||
router.go(-1)
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
@/api/crawlFieldReplace
|
||||
|
|
@ -1,437 +0,0 @@
|
|||
<template>
|
||||
<div>
|
||||
<div class="gva-search-box">
|
||||
<el-form ref="elSearchFormRef" :inline="true" :model="searchInfo" class="demo-form-inline" :rules="searchRule"
|
||||
@keyup.enter="onSubmit">
|
||||
<el-form-item label="创建日期" prop="createdAt">
|
||||
<template #label>
|
||||
<span>
|
||||
创建日期
|
||||
<el-tooltip content="搜索范围是开始日期(包含)至结束日期(不包含)">
|
||||
<el-icon>
|
||||
<QuestionFilled />
|
||||
</el-icon>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
</template>
|
||||
<el-date-picker v-model="searchInfo.startCreatedAt" type="datetime" placeholder="开始日期"
|
||||
:disabled-date="time=> searchInfo.endCreatedAt ? time.getTime() > searchInfo.endCreatedAt.getTime() : false"></el-date-picker>
|
||||
—
|
||||
<el-date-picker v-model="searchInfo.endCreatedAt" type="datetime" placeholder="结束日期"
|
||||
:disabled-date="time=> searchInfo.startCreatedAt ? time.getTime() < searchInfo.startCreatedAt.getTime() : false"></el-date-picker>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="search" @click="onSubmit">查询</el-button>
|
||||
<el-button icon="refresh" @click="onReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="gva-table-box">
|
||||
<div class="gva-btn-list">
|
||||
<el-button type="primary" icon="plus" @click="openDialog">新增</el-button>
|
||||
<el-button icon="delete" style="margin-left: 10px;" :disabled="!multipleSelection.length"
|
||||
@click="onDelete">删除</el-button>
|
||||
</div>
|
||||
<el-table ref="multipleTable" style="width: 100%" tooltip-effect="dark" :data="tableData" row-key="ID"
|
||||
@selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column align="left" label="ID" prop="ID" width="120" />
|
||||
<el-table-column align="left" label="编码" prop="code" width="120" />
|
||||
<el-table-column align="left" label="名称" prop="name" width="120" />
|
||||
<el-table-column align="left" label="分类" prop="categoryId" width="120">
|
||||
<template #default="scope">{{ formatCategory(scope.row.categoryId) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="排序" prop="sortWeight" width="120" />
|
||||
<el-table-column align="left" label="状态" prop="status" width="120">
|
||||
<template #default="scope">{{ formatBoolean(scope.row.status) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="创建时间" width="180">
|
||||
<template #default="scope">{{ formatDate(scope.row.createdAt) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="操作" fixed="right" min-width="240">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" link class="table-button" @click="getDetails(scope.row)">
|
||||
<el-icon style="margin-right: 5px">
|
||||
<InfoFilled />
|
||||
</el-icon>
|
||||
查看详情
|
||||
</el-button>
|
||||
<el-button type="primary" link icon="edit" class="table-button"
|
||||
@click="updateProductFunc(scope.row)">变更</el-button>
|
||||
<el-button type="primary" link icon="delete" @click="deleteRow(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="gva-pagination">
|
||||
<el-pagination layout="total, sizes, prev, pager, next, jumper" :current-page="page" :page-size="pageSize"
|
||||
:page-sizes="[10, 30, 50, 100]" :total="total" @current-change="handleCurrentChange"
|
||||
@size-change="handleSizeChange" />
|
||||
</div>
|
||||
</div>
|
||||
<el-drawer size="800" v-model="dialogFormVisible" :show-close="false" :before-close="closeDialog">
|
||||
<template #header>
|
||||
<div class="flex justify-between items-center">
|
||||
<span class="text-lg">{{type==='create'?'添加':'修改'}}</span>
|
||||
<div>
|
||||
<el-button type="primary" @click="enterDialog">确 定</el-button>
|
||||
<el-button @click="closeDialog">取 消</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-form :model="formData" label-position="top" ref="elFormRef" :rules="rule" label-width="80px">
|
||||
<el-form-item label="编码:" prop="code">
|
||||
<el-input v-model="formData.code" :clearable="true" placeholder="请输入编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="名称:" prop="name">
|
||||
<el-input v-model="formData.name" :clearable="true" placeholder="请输入名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="分类:">
|
||||
<el-select v-model="formData.categoryId">
|
||||
<el-option v-for="(item, index) in formData.categoryOptions" :key="index" :label="item.name"
|
||||
:value="item.ID">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序:" prop="sortWeight">
|
||||
<el-input v-model.number="formData.sortWeight" :clearable="true" placeholder="请输入排序" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态:" prop="status">
|
||||
<el-switch v-model="formData.status" active-color="#13ce66" inactive-color="#ff4949" active-text="开启"
|
||||
inactive-text="关闭" clearable></el-switch>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-drawer>
|
||||
|
||||
<el-drawer size="800" v-model="detailShow" :before-close="closeDetailShow" destroy-on-close>
|
||||
<template #header>
|
||||
<div class="flex justify-between items-center">
|
||||
<span class="text-lg">查看详情</span>
|
||||
</div>
|
||||
</template>
|
||||
<el-descriptions :column="1" border>
|
||||
<el-descriptions-item label="ID">
|
||||
{{ formData.ID }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="编码">
|
||||
{{ formData.code }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="名称">
|
||||
{{ formData.name }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="分类">
|
||||
{{ formatCategory(formData.categoryId) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="排序">
|
||||
{{ formData.sortWeight }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="状态">
|
||||
{{ formatBoolean(formData.status) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="创建时间">
|
||||
{{ formatDate(formData.createdAt) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="更新时间">
|
||||
{{ formatDate(formData.updatedAt) }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
createProduct,
|
||||
deleteProduct,
|
||||
deleteProductByIds,
|
||||
updateProduct,
|
||||
findProduct,
|
||||
getProductList
|
||||
} from '@/api/product'
|
||||
import { getProductCategoryList } from '@/api/productCategory'
|
||||
|
||||
// 全量引入格式化工具 请按需保留
|
||||
import { getDictFunc, formatDate, formatBoolean, filterDict, ReturnArrImg, onDownloadFile } from '@/utils/format'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { ref, reactive } from 'vue'
|
||||
|
||||
defineOptions({
|
||||
name: 'Product'
|
||||
})
|
||||
|
||||
// 自动化生成的字典(可能为空)以及字段
|
||||
const formData = ref({
|
||||
code: '',
|
||||
name: '',
|
||||
categoryId: 0,
|
||||
sortWeight: 0,
|
||||
status: false,
|
||||
categoryOptions: []
|
||||
})
|
||||
|
||||
// 验证规则
|
||||
const rule = reactive({
|
||||
})
|
||||
|
||||
const searchRule = reactive({
|
||||
createdAt: [
|
||||
{ validator: (rule, value, callback) => {
|
||||
if (searchInfo.value.startCreatedAt && !searchInfo.value.endCreatedAt) {
|
||||
callback(new Error('请填写结束日期'))
|
||||
} else if (!searchInfo.value.startCreatedAt && searchInfo.value.endCreatedAt) {
|
||||
callback(new Error('请填写开始日期'))
|
||||
} else if (searchInfo.value.startCreatedAt && searchInfo.value.endCreatedAt && (searchInfo.value.startCreatedAt.getTime() === searchInfo.value.endCreatedAt.getTime() || searchInfo.value.startCreatedAt.getTime() > searchInfo.value.endCreatedAt.getTime())) {
|
||||
callback(new Error('开始日期应当早于结束日期'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}, trigger: 'change' }
|
||||
],
|
||||
})
|
||||
|
||||
const elFormRef = ref()
|
||||
const elSearchFormRef = ref()
|
||||
|
||||
// =========== 表格控制部分 ===========
|
||||
const page = ref(1)
|
||||
const total = ref(0)
|
||||
const pageSize = ref(10)
|
||||
const tableData = ref([])
|
||||
const searchInfo = ref({})
|
||||
const cateoryList = ref([])
|
||||
|
||||
const formatCategory = (id) => {
|
||||
for (let i = 0; i < cateoryList.value.length; i++) {
|
||||
if (cateoryList.value[i].ID === id) {
|
||||
return cateoryList.value[i].name
|
||||
}
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
// 重置
|
||||
const onReset = () => {
|
||||
searchInfo.value = {}
|
||||
getTableData()
|
||||
}
|
||||
|
||||
// 搜索
|
||||
const onSubmit = () => {
|
||||
elSearchFormRef.value?.validate(async(valid) => {
|
||||
if (!valid) return
|
||||
page.value = 1
|
||||
pageSize.value = 10
|
||||
if (searchInfo.value.status === '') {
|
||||
searchInfo.value.status = null
|
||||
}
|
||||
getTableData()
|
||||
})
|
||||
}
|
||||
|
||||
// 分页
|
||||
const handleSizeChange = (val) => {
|
||||
pageSize.value = val
|
||||
getTableData()
|
||||
}
|
||||
|
||||
// 修改页面容量
|
||||
const handleCurrentChange = (val) => {
|
||||
page.value = val
|
||||
getTableData()
|
||||
}
|
||||
|
||||
const getCategoryData = async() => {
|
||||
const resp = await getProductCategoryList({ page: 1, pageSize: 100 })
|
||||
if (resp.code === 0 && resp.data.list) {
|
||||
cateoryList.value = resp.data.list
|
||||
}
|
||||
}
|
||||
|
||||
getCategoryData()
|
||||
|
||||
// 查询
|
||||
const getTableData = async() => {
|
||||
const table = await getProductList({ page: page.value, pageSize: pageSize.value, ...searchInfo.value })
|
||||
if (table.code === 0) {
|
||||
tableData.value = table.data.list
|
||||
total.value = table.data.total
|
||||
page.value = table.data.page
|
||||
pageSize.value = table.data.pageSize
|
||||
}
|
||||
}
|
||||
|
||||
getTableData()
|
||||
|
||||
// ============== 表格控制部分结束 ===============
|
||||
|
||||
// 获取需要的字典 可能为空 按需保留
|
||||
const setOptions = async() => {
|
||||
}
|
||||
|
||||
// 获取需要的字典 可能为空 按需保留
|
||||
setOptions()
|
||||
|
||||
// 多选数据
|
||||
const multipleSelection = ref([])
|
||||
// 多选
|
||||
const handleSelectionChange = (val) => {
|
||||
multipleSelection.value = val
|
||||
}
|
||||
|
||||
// 删除行
|
||||
const deleteRow = (row) => {
|
||||
ElMessageBox.confirm('确定要删除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
deleteProductFunc(row)
|
||||
})
|
||||
}
|
||||
|
||||
// 多选删除
|
||||
const onDelete = async() => {
|
||||
ElMessageBox.confirm('确定要删除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(async() => {
|
||||
const IDs = []
|
||||
if (multipleSelection.value.length === 0) {
|
||||
ElMessage({
|
||||
type: 'warning',
|
||||
message: '请选择要删除的数据'
|
||||
})
|
||||
return
|
||||
}
|
||||
multipleSelection.value &&
|
||||
multipleSelection.value.map(item => {
|
||||
IDs.push(item.ID)
|
||||
})
|
||||
const res = await deleteProductByIds({ IDs })
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '删除成功'
|
||||
})
|
||||
if (tableData.value.length === IDs.length && page.value > 1) {
|
||||
page.value--
|
||||
}
|
||||
getTableData()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 行为控制标记(弹窗内部需要增还是改)
|
||||
const type = ref('')
|
||||
|
||||
// 更新行
|
||||
const updateProductFunc = async(row) => {
|
||||
const res = await findProduct({ ID: row.ID })
|
||||
type.value = 'update'
|
||||
if (res.code === 0) {
|
||||
formData.value = res.data.reproduct
|
||||
formData.value.categoryOptions = cateoryList.value
|
||||
console.log(formData)
|
||||
dialogFormVisible.value = true
|
||||
}
|
||||
}
|
||||
|
||||
// 删除行
|
||||
const deleteProductFunc = async (row) => {
|
||||
const res = await deleteProduct({ ID: row.ID })
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '删除成功'
|
||||
})
|
||||
if (tableData.value.length === 1 && page.value > 1) {
|
||||
page.value--
|
||||
}
|
||||
getTableData()
|
||||
}
|
||||
}
|
||||
|
||||
// 弹窗控制标记
|
||||
const dialogFormVisible = ref(false)
|
||||
|
||||
// 查看详情控制标记
|
||||
const detailShow = ref(false)
|
||||
|
||||
// 打开详情弹窗
|
||||
const openDetailShow = () => {
|
||||
detailShow.value = true
|
||||
}
|
||||
|
||||
// 打开详情
|
||||
const getDetails = async (row) => {
|
||||
// 打开弹窗
|
||||
const res = await findProduct({ ID: row.ID })
|
||||
if (res.code === 0) {
|
||||
formData.value = res.data.reproduct
|
||||
openDetailShow()
|
||||
}
|
||||
}
|
||||
|
||||
// 关闭详情弹窗
|
||||
const closeDetailShow = () => {
|
||||
detailShow.value = false
|
||||
formData.value = {
|
||||
code: '',
|
||||
name: '',
|
||||
categoryId: 0,
|
||||
sortWeight: 0,
|
||||
status: false,
|
||||
}
|
||||
}
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = () => {
|
||||
type.value = 'create'
|
||||
dialogFormVisible.value = true
|
||||
}
|
||||
|
||||
// 关闭弹窗
|
||||
const closeDialog = () => {
|
||||
dialogFormVisible.value = false
|
||||
formData.value = {
|
||||
code: '',
|
||||
name: '',
|
||||
categoryId: 0,
|
||||
sortWeight: 0,
|
||||
status: false,
|
||||
}
|
||||
}
|
||||
// 弹窗确定
|
||||
const enterDialog = async() => {
|
||||
elFormRef.value?.validate(async(valid) => {
|
||||
if (!valid) return
|
||||
let res
|
||||
switch (type.value) {
|
||||
case 'create':
|
||||
res = await createProduct(formData.value)
|
||||
break
|
||||
case 'update':
|
||||
res = await updateProduct(formData.value)
|
||||
break
|
||||
default:
|
||||
res = await createProduct(formData.value)
|
||||
break
|
||||
}
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '创建/更改成功'
|
||||
})
|
||||
closeDialog()
|
||||
getTableData()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
|
@ -1,111 +0,0 @@
|
|||
<template>
|
||||
<div>
|
||||
<div class="gva-form-box">
|
||||
<el-form :model="formData" ref="elFormRef" label-position="right" :rules="rule" label-width="80px">
|
||||
<el-form-item label="编码:" prop="code">
|
||||
<el-input v-model="formData.code" :clearable="true" placeholder="请输入编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="名称:" prop="name">
|
||||
<el-input v-model="formData.name" :clearable="true" placeholder="请输入名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="分类:" prop="categoryId">
|
||||
<el-input v-model.number="formData.categoryId" :clearable="true" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item label="排序:" prop="sortWeight">
|
||||
<el-input v-model.number="formData.sortWeight" :clearable="true" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态:" prop="status">
|
||||
<el-switch v-model="formData.status" active-color="#13ce66" inactive-color="#ff4949" active-text="开启" inactive-text="关闭" clearable ></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="save">保存</el-button>
|
||||
<el-button type="primary" @click="back">返回</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
createProduct,
|
||||
updateProduct,
|
||||
findProduct
|
||||
} from '@/api/product'
|
||||
|
||||
defineOptions({
|
||||
name: 'ProductForm'
|
||||
})
|
||||
|
||||
// 自动获取字典
|
||||
import { getDictFunc } from '@/utils/format'
|
||||
import { useRoute, useRouter } from "vue-router"
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { ref, reactive } from 'vue'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const type = ref('')
|
||||
const formData = ref({
|
||||
code: '',
|
||||
name: '',
|
||||
categoryId: 0,
|
||||
sortWeight: 0,
|
||||
status: false,
|
||||
})
|
||||
// 验证规则
|
||||
const rule = reactive({
|
||||
})
|
||||
|
||||
const elFormRef = ref()
|
||||
|
||||
// 初始化方法
|
||||
const init = async () => {
|
||||
// 建议通过url传参获取目标数据ID 调用 find方法进行查询数据操作 从而决定本页面是create还是update 以下为id作为url参数示例
|
||||
if (route.query.id) {
|
||||
const res = await findProduct({ ID: route.query.id })
|
||||
if (res.code === 0) {
|
||||
formData.value = res.data.reproduct
|
||||
type.value = 'update'
|
||||
}
|
||||
} else {
|
||||
type.value = 'create'
|
||||
}
|
||||
}
|
||||
|
||||
init()
|
||||
// 保存按钮
|
||||
const save = async() => {
|
||||
elFormRef.value?.validate( async (valid) => {
|
||||
if (!valid) return
|
||||
let res
|
||||
switch (type.value) {
|
||||
case 'create':
|
||||
res = await createProduct(formData.value)
|
||||
break
|
||||
case 'update':
|
||||
res = await updateProduct(formData.value)
|
||||
break
|
||||
default:
|
||||
res = await createProduct(formData.value)
|
||||
break
|
||||
}
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '创建/更改成功'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 返回按钮
|
||||
const back = () => {
|
||||
router.go(-1)
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
|
|
@ -1,341 +0,0 @@
|
|||
<template>
|
||||
<div>
|
||||
<div class="gva-table-box">
|
||||
<div class="gva-btn-list">
|
||||
<el-button type="primary" icon="plus" @click="openDialog">新增</el-button>
|
||||
<el-button icon="delete" style="margin-left: 10px;" :disabled="!multipleSelection.length"
|
||||
@click="onDelete">删除</el-button>
|
||||
</div>
|
||||
<el-table ref="multipleTable" style="width: 100%" tooltip-effect="dark" :data="tableData" row-key="ID"
|
||||
@selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column align="left" label="ID" prop="ID" width="120" />
|
||||
<el-table-column align="left" label="父级ID" prop="parentId" width="120" />
|
||||
<el-table-column align="left" label="分类名称" prop="name" width="120" />
|
||||
<el-table-column align="left" label="操作" fixed="right" min-width="240">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" link class="table-button" @click="getDetails(scope.row)">
|
||||
<el-icon style="margin-right: 5px">
|
||||
<InfoFilled />
|
||||
</el-icon>
|
||||
查看详情
|
||||
</el-button>
|
||||
<el-button type="primary" link icon="edit" class="table-button"
|
||||
@click="updateProductCategoryFunc(scope.row)">变更</el-button>
|
||||
<el-button type="primary" link icon="delete" @click="deleteRow(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="gva-pagination">
|
||||
<el-pagination layout="total, sizes, prev, pager, next, jumper" :current-page="page" :page-size="pageSize"
|
||||
:page-sizes="[10, 30, 50, 100]" :total="total" @current-change="handleCurrentChange"
|
||||
@size-change="handleSizeChange" />
|
||||
</div>
|
||||
</div>
|
||||
<el-drawer size="800" v-model="dialogFormVisible" :show-close="false" :before-close="closeDialog">
|
||||
<template #header>
|
||||
<div class="flex justify-between items-center">
|
||||
<span class="text-lg">{{type==='create'?'添加':'修改'}}</span>
|
||||
<div>
|
||||
<el-button type="primary" @click="enterDialog">确 定</el-button>
|
||||
<el-button @click="closeDialog">取 消</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-form :model="formData" label-position="top" ref="elFormRef" :rules="rule" label-width="80px">
|
||||
<el-form-item label="父级ID:" prop="parentId">
|
||||
<el-input v-model.number="formData.parentId" :clearable="true" placeholder="请输入父级ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="分类名称:" prop="name">
|
||||
<el-input v-model="formData.name" :clearable="true" placeholder="请输入分类名称" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-drawer>
|
||||
|
||||
<el-drawer size="800" v-model="detailShow" :before-close="closeDetailShow" destroy-on-close>
|
||||
<template #header>
|
||||
<div class="flex justify-between items-center">
|
||||
<span class="text-lg">查看详情</span>
|
||||
</div>
|
||||
</template>
|
||||
<el-descriptions :column="1" border>
|
||||
<el-descriptions-item label="ID">
|
||||
{{ formData.ID }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="父级ID">
|
||||
{{ formData.parentId }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="分类名称">
|
||||
{{ formData.name }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="创建时间">
|
||||
{{ formatDate(formData.createdAt) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="更新时间">
|
||||
{{ formatDate(formData.updatedAt) }}
|
||||
</el-descriptions-item></el-descriptions>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
createProductCategory,
|
||||
deleteProductCategory,
|
||||
deleteProductCategoryByIds,
|
||||
updateProductCategory,
|
||||
findProductCategory,
|
||||
getProductCategoryList
|
||||
} from '@/api/productCategory'
|
||||
|
||||
// 全量引入格式化工具 请按需保留
|
||||
import { getDictFunc, formatDate, formatBoolean, filterDict, ReturnArrImg, onDownloadFile } from '@/utils/format'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { ref, reactive } from 'vue'
|
||||
|
||||
defineOptions({
|
||||
name: 'ProductCategory'
|
||||
})
|
||||
|
||||
// 自动化生成的字典(可能为空)以及字段
|
||||
const formData = ref({
|
||||
name: '',
|
||||
parentId: 0,
|
||||
})
|
||||
|
||||
// 验证规则
|
||||
const rule = reactive({
|
||||
})
|
||||
|
||||
const searchRule = reactive({
|
||||
createdAt: [
|
||||
{ validator: (rule, value, callback) => {
|
||||
if (searchInfo.value.startCreatedAt && !searchInfo.value.endCreatedAt) {
|
||||
callback(new Error('请填写结束日期'))
|
||||
} else if (!searchInfo.value.startCreatedAt && searchInfo.value.endCreatedAt) {
|
||||
callback(new Error('请填写开始日期'))
|
||||
} else if (searchInfo.value.startCreatedAt && searchInfo.value.endCreatedAt && (searchInfo.value.startCreatedAt.getTime() === searchInfo.value.endCreatedAt.getTime() || searchInfo.value.startCreatedAt.getTime() > searchInfo.value.endCreatedAt.getTime())) {
|
||||
callback(new Error('开始日期应当早于结束日期'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}, trigger: 'change' }
|
||||
],
|
||||
})
|
||||
|
||||
const elFormRef = ref()
|
||||
const elSearchFormRef = ref()
|
||||
|
||||
// =========== 表格控制部分 ===========
|
||||
const page = ref(1)
|
||||
const total = ref(0)
|
||||
const pageSize = ref(10)
|
||||
const tableData = ref([])
|
||||
const searchInfo = ref({})
|
||||
|
||||
// 重置
|
||||
const onReset = () => {
|
||||
searchInfo.value = {}
|
||||
getTableData()
|
||||
}
|
||||
|
||||
// 搜索
|
||||
const onSubmit = () => {
|
||||
elSearchFormRef.value?.validate(async(valid) => {
|
||||
if (!valid) return
|
||||
page.value = 1
|
||||
pageSize.value = 10
|
||||
getTableData()
|
||||
})
|
||||
}
|
||||
|
||||
// 分页
|
||||
const handleSizeChange = (val) => {
|
||||
pageSize.value = val
|
||||
getTableData()
|
||||
}
|
||||
|
||||
// 修改页面容量
|
||||
const handleCurrentChange = (val) => {
|
||||
page.value = val
|
||||
getTableData()
|
||||
}
|
||||
|
||||
// 查询
|
||||
const getTableData = async() => {
|
||||
const table = await getProductCategoryList({ page: page.value, pageSize: pageSize.value, ...searchInfo.value })
|
||||
if (table.code === 0) {
|
||||
tableData.value = table.data.list
|
||||
total.value = table.data.total
|
||||
page.value = table.data.page
|
||||
pageSize.value = table.data.pageSize
|
||||
}
|
||||
}
|
||||
|
||||
getTableData()
|
||||
|
||||
// ============== 表格控制部分结束 ===============
|
||||
|
||||
// 获取需要的字典 可能为空 按需保留
|
||||
const setOptions = async() => {
|
||||
}
|
||||
|
||||
// 获取需要的字典 可能为空 按需保留
|
||||
setOptions()
|
||||
|
||||
// 多选数据
|
||||
const multipleSelection = ref([])
|
||||
// 多选
|
||||
const handleSelectionChange = (val) => {
|
||||
multipleSelection.value = val
|
||||
}
|
||||
|
||||
// 删除行
|
||||
const deleteRow = (row) => {
|
||||
ElMessageBox.confirm('确定要删除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
deleteProductCategoryFunc(row)
|
||||
})
|
||||
}
|
||||
|
||||
// 多选删除
|
||||
const onDelete = async() => {
|
||||
ElMessageBox.confirm('确定要删除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(async() => {
|
||||
const IDs = []
|
||||
if (multipleSelection.value.length === 0) {
|
||||
ElMessage({
|
||||
type: 'warning',
|
||||
message: '请选择要删除的数据'
|
||||
})
|
||||
return
|
||||
}
|
||||
multipleSelection.value &&
|
||||
multipleSelection.value.map(item => {
|
||||
IDs.push(item.ID)
|
||||
})
|
||||
const res = await deleteProductCategoryByIds({ IDs })
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '删除成功'
|
||||
})
|
||||
if (tableData.value.length === IDs.length && page.value > 1) {
|
||||
page.value--
|
||||
}
|
||||
getTableData()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 行为控制标记(弹窗内部需要增还是改)
|
||||
const type = ref('')
|
||||
|
||||
// 更新行
|
||||
const updateProductCategoryFunc = async(row) => {
|
||||
const res = await findProductCategory({ ID: row.ID })
|
||||
type.value = 'update'
|
||||
if (res.code === 0) {
|
||||
formData.value = res.data.reproductCategory
|
||||
dialogFormVisible.value = true
|
||||
}
|
||||
}
|
||||
|
||||
// 删除行
|
||||
const deleteProductCategoryFunc = async(row) => {
|
||||
const res = await deleteProductCategory({ ID: row.ID })
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '删除成功'
|
||||
})
|
||||
if (tableData.value.length === 1 && page.value > 1) {
|
||||
page.value--
|
||||
}
|
||||
getTableData()
|
||||
}
|
||||
}
|
||||
|
||||
// 弹窗控制标记
|
||||
const dialogFormVisible = ref(false)
|
||||
|
||||
// 查看详情控制标记
|
||||
const detailShow = ref(false)
|
||||
|
||||
// 打开详情弹窗
|
||||
const openDetailShow = () => {
|
||||
detailShow.value = true
|
||||
}
|
||||
|
||||
// 打开详情
|
||||
const getDetails = async(row) => {
|
||||
// 打开弹窗
|
||||
const res = await findProductCategory({ ID: row.ID })
|
||||
if (res.code === 0) {
|
||||
formData.value = res.data.reproductCategory
|
||||
openDetailShow()
|
||||
}
|
||||
}
|
||||
|
||||
// 关闭详情弹窗
|
||||
const closeDetailShow = () => {
|
||||
detailShow.value = false
|
||||
formData.value = {
|
||||
name: '',
|
||||
parentId: 0,
|
||||
}
|
||||
}
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = () => {
|
||||
type.value = 'create'
|
||||
dialogFormVisible.value = true
|
||||
}
|
||||
|
||||
// 关闭弹窗
|
||||
const closeDialog = () => {
|
||||
dialogFormVisible.value = false
|
||||
formData.value = {
|
||||
name: '',
|
||||
parentId: 0,
|
||||
}
|
||||
}
|
||||
// 弹窗确定
|
||||
const enterDialog = async() => {
|
||||
elFormRef.value?.validate(async(valid) => {
|
||||
if (!valid) return
|
||||
let res
|
||||
switch (type.value) {
|
||||
case 'create':
|
||||
res = await createProductCategory(formData.value)
|
||||
break
|
||||
case 'update':
|
||||
res = await updateProductCategory(formData.value)
|
||||
break
|
||||
default:
|
||||
res = await createProductCategory(formData.value)
|
||||
break
|
||||
}
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '创建/更改成功'
|
||||
})
|
||||
closeDialog()
|
||||
getTableData()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
|
@ -1,99 +0,0 @@
|
|||
<template>
|
||||
<div>
|
||||
<div class="gva-form-box">
|
||||
<el-form :model="formData" ref="elFormRef" label-position="right" :rules="rule" label-width="80px">
|
||||
<el-form-item label="父级Id:" prop="parentId">
|
||||
<el-input v-model.number="formData.parentId" :clearable="true" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item label="分类名称:" prop="name">
|
||||
<el-input v-model="formData.name" :clearable="true" placeholder="请输入name字段" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="save">保存</el-button>
|
||||
<el-button type="primary" @click="back">返回</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
createProductCategory,
|
||||
updateProductCategory,
|
||||
findProductCategory
|
||||
} from '@/api/productCategory'
|
||||
|
||||
defineOptions({
|
||||
name: 'ProductCategoryForm'
|
||||
})
|
||||
|
||||
// 自动获取字典
|
||||
import { getDictFunc } from '@/utils/format'
|
||||
import { useRoute, useRouter } from "vue-router"
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { ref, reactive } from 'vue'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const type = ref('')
|
||||
const formData = ref({
|
||||
name: '',
|
||||
parentId: 0,
|
||||
})
|
||||
// 验证规则
|
||||
const rule = reactive({
|
||||
})
|
||||
|
||||
const elFormRef = ref()
|
||||
|
||||
// 初始化方法
|
||||
const init = async () => {
|
||||
// 建议通过url传参获取目标数据ID 调用 find方法进行查询数据操作 从而决定本页面是create还是update 以下为id作为url参数示例
|
||||
if (route.query.id) {
|
||||
const res = await findProductCategory({ ID: route.query.id })
|
||||
if (res.code === 0) {
|
||||
formData.value = res.data.reproductCategory
|
||||
type.value = 'update'
|
||||
}
|
||||
} else {
|
||||
type.value = 'create'
|
||||
}
|
||||
}
|
||||
|
||||
init()
|
||||
// 保存按钮
|
||||
const save = async() => {
|
||||
elFormRef.value?.validate(async(valid) => {
|
||||
if (!valid) return
|
||||
let res
|
||||
switch (type.value) {
|
||||
case 'create':
|
||||
res = await createProductCategory(formData.value)
|
||||
break
|
||||
case 'update':
|
||||
res = await updateProductCategory(formData.value)
|
||||
break
|
||||
default:
|
||||
res = await createProductCategory(formData.value)
|
||||
break
|
||||
}
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '创建/更改成功'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 返回按钮
|
||||
const back = () => {
|
||||
router.go(-1)
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
|
|
@ -1,497 +0,0 @@
|
|||
<template>
|
||||
<div>
|
||||
<div class="gva-search-box">
|
||||
<el-form ref="elSearchFormRef" :inline="true" :model="searchInfo" class="demo-form-inline" :rules="searchRule"
|
||||
@keyup.enter="onSubmit">
|
||||
<el-form-item label="创建日期" prop="createdAt">
|
||||
<template #label>
|
||||
<span>
|
||||
创建日期
|
||||
<el-tooltip content="搜索范围是开始日期(包含)至结束日期(不包含)">
|
||||
<el-icon>
|
||||
<QuestionFilled />
|
||||
</el-icon>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
</template>
|
||||
<el-date-picker v-model="searchInfo.startCreatedAt" type="datetime" placeholder="开始日期"
|
||||
:disabled-date="time=> searchInfo.endCreatedAt ? time.getTime() > searchInfo.endCreatedAt.getTime() : false"></el-date-picker>
|
||||
—
|
||||
<el-date-picker v-model="searchInfo.endCreatedAt" type="datetime" placeholder="结束日期"
|
||||
:disabled-date="time=> searchInfo.startCreatedAt ? time.getTime() < searchInfo.startCreatedAt.getTime() : false"></el-date-picker>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="search" @click="onSubmit">查询</el-button>
|
||||
<el-button icon="refresh" @click="onReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="gva-table-box">
|
||||
<div class="gva-btn-list">
|
||||
<el-button type="primary" icon="plus" @click="openDialog">新增</el-button>
|
||||
<el-button icon="delete" style="margin-left: 10px;" :disabled="!multipleSelection.length"
|
||||
@click="onDelete">删除</el-button>
|
||||
</div>
|
||||
<el-table ref="multipleTable" style="width: 100%" tooltip-effect="dark" :data="tableData" row-key="ID"
|
||||
@selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column align="left" label="ID" prop="ID" width="80" />
|
||||
<el-table-column align="left" label="产品" prop="productId" width="120">
|
||||
<template #default="scope">{{ formatProduct(scope.row.productId) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="发布日期" width="100">
|
||||
<template #default="scope">{{ formatOnlyDate(scope.row.publishDate) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="规格" prop="norm" width="120" />
|
||||
<el-table-column align="left" label="地区" prop="areaFullname" width="120" />
|
||||
<el-table-column align="left" label="价格类型" prop="priceType" width="80" />
|
||||
<el-table-column align="left" label="单位" prop="priceUnit" width="60" />
|
||||
<el-table-column align="left" label="最低价格" prop="priceMin" width="120" />
|
||||
<el-table-column align="left" label="最高价格" prop="priceMax" width="120" />
|
||||
<el-table-column align="left" label="状态" prop="status" width="80">
|
||||
<template #default="scope">{{ formatBoolean(scope.row.status) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="备注" prop="remark" width="120" />
|
||||
|
||||
<el-table-column align="left" label="创建时间" width="180">
|
||||
<template #default="scope">{{ formatDate(scope.row.createdAt) }}</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="left" label="操作" fixed="right" min-width="240">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" link class="table-button" @click="getDetails(scope.row)">
|
||||
<el-icon style="margin-right: 5px">
|
||||
<InfoFilled />
|
||||
</el-icon>
|
||||
查看详情
|
||||
</el-button>
|
||||
<el-button type="primary" link icon="edit" class="table-button"
|
||||
@click="updateProductPriceFunc(scope.row)">变更</el-button>
|
||||
<el-button type="primary" link icon="delete" @click="deleteRow(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="gva-pagination">
|
||||
<el-pagination layout="total, sizes, prev, pager, next, jumper" :current-page="page" :page-size="pageSize"
|
||||
:page-sizes="[10, 30, 50, 100]" :total="total" @current-change="handleCurrentChange"
|
||||
@size-change="handleSizeChange" />
|
||||
</div>
|
||||
</div>
|
||||
<el-drawer size="800" v-model="dialogFormVisible" :show-close="false" :before-close="closeDialog">
|
||||
<template #header>
|
||||
<div class="flex justify-between items-center">
|
||||
<span class="text-lg">{{type==='create'?'添加':'修改'}}</span>
|
||||
<div>
|
||||
<el-button type="primary" @click="enterDialog">确 定</el-button>
|
||||
<el-button @click="closeDialog">取 消</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-form :model="formData" label-position="top" ref="elFormRef" :rules="rule" label-width="80px">
|
||||
<el-form-item label="产品Id:" prop="productId">
|
||||
<el-input v-model.number="formData.productId" :clearable="true" placeholder="请输入产品Id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="发布日期:" prop="publishDate">
|
||||
<el-date-picker v-model="formData.publishDate" type="date" style="width:100%" placeholder="选择日期"
|
||||
:clearable="true" />
|
||||
</el-form-item>
|
||||
<el-form-item label="规格:" prop="norm">
|
||||
<el-input v-model="formData.norm" :clearable="true" placeholder="请输入规格" />
|
||||
</el-form-item>
|
||||
<el-form-item label="地区Id:" prop="areaId">
|
||||
<el-input v-model.number="formData.areaId" :clearable="true" placeholder="请输入地区Id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="地区:" prop="areaFullname">
|
||||
<el-input v-model="formData.areaFullname" :clearable="true" placeholder="请输入地区" />
|
||||
</el-form-item>
|
||||
<el-form-item label="价格类型:" prop="priceType">
|
||||
<el-input v-model="formData.priceType" :clearable="true" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单位:" prop="priceUnit">
|
||||
<el-input v-model="formData.priceUnit" :clearable="true" placeholder="请输入单位" />
|
||||
</el-form-item>
|
||||
<el-form-item label="最低价格:" prop="priceMin">
|
||||
<el-input-number v-model="formData.priceMin" style="width:100%" :precision="2" :clearable="true" />
|
||||
</el-form-item>
|
||||
<el-form-item label="最高价格:" prop="priceMax">
|
||||
<el-input-number v-model="formData.priceMax" style="width:100%" :precision="2" :clearable="true" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态:" prop="status">
|
||||
<el-switch v-model="formData.status" active-color="#13ce66" inactive-color="#ff4949" active-text="是"
|
||||
inactive-text="否" clearable></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注:" prop="remark">
|
||||
<el-input v-model="formData.remark" :clearable="true" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-drawer>
|
||||
|
||||
<el-drawer size="800" v-model="detailShow" :before-close="closeDetailShow" destroy-on-close>
|
||||
<template #header>
|
||||
<div class="flex justify-between items-center">
|
||||
<span class="text-lg">查看详情</span>
|
||||
</div>
|
||||
</template>
|
||||
<el-descriptions :column="1" border>
|
||||
<el-descriptions-item label="ID">
|
||||
{{ formData.ID }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="产品">
|
||||
{{ formatProduct(formData.productId) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="发布日期">
|
||||
{{ formatOnlyDate(formData.publishDate) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="规格">
|
||||
{{ formData.norm }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="地区Id">
|
||||
{{ formData.areaId }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="地区">
|
||||
{{ formData.areaFullname }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="价格类型">
|
||||
{{ formData.priceType }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="单位">
|
||||
{{ formData.priceUnit }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="最低价格">
|
||||
{{ formData.priceMin }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="最高价格">
|
||||
{{ formData.priceMax }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="状态">
|
||||
{{ formatBoolean(formData.status) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="备注">
|
||||
{{ formData.remark }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="创建时间">
|
||||
{{ formatDate(formData.createdAt) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="更新时间">
|
||||
{{ formatDate(formData.updatedAt) }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getProductList } from '@/api/product'
|
||||
import {
|
||||
createProductPrice,
|
||||
deleteProductPrice,
|
||||
deleteProductPriceByIds,
|
||||
updateProductPrice,
|
||||
findProductPrice,
|
||||
getProductPriceList
|
||||
} from '@/api/productPrice'
|
||||
|
||||
// 全量引入格式化工具 请按需保留
|
||||
import { formatDate, formatOnlyDate, formatBoolean } from '@/utils/format'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { ref, reactive } from 'vue'
|
||||
|
||||
defineOptions({
|
||||
name: 'ProductPrice'
|
||||
})
|
||||
|
||||
// 自动化生成的字典(可能为空)以及字段
|
||||
const formData = ref({
|
||||
productId: 0,
|
||||
publishDate: new Date(),
|
||||
norm: '',
|
||||
areaId: 0,
|
||||
areaFullname: '',
|
||||
priceType: false,
|
||||
priceUnit: '',
|
||||
priceMin: 0,
|
||||
priceMax: 0,
|
||||
status: false,
|
||||
remark: '',
|
||||
})
|
||||
|
||||
// 验证规则
|
||||
const rule = reactive({
|
||||
})
|
||||
|
||||
const searchRule = reactive({
|
||||
createdAt: [
|
||||
{ validator: (rule, value, callback) => {
|
||||
if (searchInfo.value.startCreatedAt && !searchInfo.value.endCreatedAt) {
|
||||
callback(new Error('请填写结束日期'))
|
||||
} else if (!searchInfo.value.startCreatedAt && searchInfo.value.endCreatedAt) {
|
||||
callback(new Error('请填写开始日期'))
|
||||
} else if (searchInfo.value.startCreatedAt && searchInfo.value.endCreatedAt && (searchInfo.value.startCreatedAt.getTime() === searchInfo.value.endCreatedAt.getTime() || searchInfo.value.startCreatedAt.getTime() > searchInfo.value.endCreatedAt.getTime())) {
|
||||
callback(new Error('开始日期应当早于结束日期'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}, trigger: 'change' }
|
||||
],
|
||||
})
|
||||
|
||||
const elFormRef = ref()
|
||||
const elSearchFormRef = ref()
|
||||
|
||||
// =========== 表格控制部分 ===========
|
||||
const page = ref(1)
|
||||
const total = ref(0)
|
||||
const pageSize = ref(10)
|
||||
const tableData = ref([])
|
||||
const searchInfo = ref({})
|
||||
const productList = ref([])
|
||||
|
||||
const formatProduct = (id) => {
|
||||
for (let i = 0; i < productList.value.length; i++) {
|
||||
if (productList.value[i].ID === id) {
|
||||
return productList.value[i].name
|
||||
}
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
// 重置
|
||||
const onReset = () => {
|
||||
searchInfo.value = {}
|
||||
getTableData()
|
||||
}
|
||||
|
||||
// 搜索
|
||||
const onSubmit = () => {
|
||||
elSearchFormRef.value?.validate(async(valid) => {
|
||||
if (!valid) return
|
||||
page.value = 1
|
||||
pageSize.value = 10
|
||||
if (searchInfo.value.priceType === '') {
|
||||
searchInfo.value.priceType = null
|
||||
}
|
||||
if (searchInfo.value.status === '') {
|
||||
searchInfo.value.status = null
|
||||
}
|
||||
getTableData()
|
||||
})
|
||||
}
|
||||
|
||||
// 分页
|
||||
const handleSizeChange = (val) => {
|
||||
pageSize.value = val
|
||||
getTableData()
|
||||
}
|
||||
|
||||
// 修改页面容量
|
||||
const handleCurrentChange = (val) => {
|
||||
page.value = val
|
||||
getTableData()
|
||||
}
|
||||
|
||||
const getProductData = async() => {
|
||||
const resp = await getProductList({ page: 1, pageSize: 100 })
|
||||
if (resp.code === 0 && resp.data.list) {
|
||||
productList.value = resp.data.list
|
||||
}
|
||||
}
|
||||
|
||||
getProductData()
|
||||
|
||||
// 查询
|
||||
const getTableData = async() => {
|
||||
const table = await getProductPriceList({ page: page.value, pageSize: pageSize.value, ...searchInfo.value })
|
||||
if (table.code === 0) {
|
||||
tableData.value = table.data.list
|
||||
total.value = table.data.total
|
||||
page.value = table.data.page
|
||||
pageSize.value = table.data.pageSize
|
||||
}
|
||||
}
|
||||
|
||||
getTableData()
|
||||
|
||||
// ============== 表格控制部分结束 ===============
|
||||
|
||||
// 获取需要的字典 可能为空 按需保留
|
||||
const setOptions = async() => {
|
||||
}
|
||||
|
||||
// 获取需要的字典 可能为空 按需保留
|
||||
setOptions()
|
||||
|
||||
// 多选数据
|
||||
const multipleSelection = ref([])
|
||||
// 多选
|
||||
const handleSelectionChange = (val) => {
|
||||
multipleSelection.value = val
|
||||
}
|
||||
|
||||
// 删除行
|
||||
const deleteRow = (row) => {
|
||||
ElMessageBox.confirm('确定要删除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
deleteProductPriceFunc(row)
|
||||
})
|
||||
}
|
||||
|
||||
// 多选删除
|
||||
const onDelete = async() => {
|
||||
ElMessageBox.confirm('确定要删除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(async() => {
|
||||
const IDs = []
|
||||
if (multipleSelection.value.length === 0) {
|
||||
ElMessage({
|
||||
type: 'warning',
|
||||
message: '请选择要删除的数据'
|
||||
})
|
||||
return
|
||||
}
|
||||
multipleSelection.value &&
|
||||
multipleSelection.value.map(item => {
|
||||
IDs.push(item.ID)
|
||||
})
|
||||
const res = await deleteProductPriceByIds({ IDs })
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '删除成功'
|
||||
})
|
||||
if (tableData.value.length === IDs.length && page.value > 1) {
|
||||
page.value--
|
||||
}
|
||||
getTableData()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 行为控制标记(弹窗内部需要增还是改)
|
||||
const type = ref('')
|
||||
|
||||
// 更新行
|
||||
const updateProductPriceFunc = async(row) => {
|
||||
const res = await findProductPrice({ ID: row.ID })
|
||||
type.value = 'update'
|
||||
if (res.code === 0) {
|
||||
formData.value = res.data.reproductPrice
|
||||
dialogFormVisible.value = true
|
||||
}
|
||||
}
|
||||
|
||||
// 删除行
|
||||
const deleteProductPriceFunc = async(row) => {
|
||||
const res = await deleteProductPrice({ ID: row.ID })
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '删除成功'
|
||||
})
|
||||
if (tableData.value.length === 1 && page.value > 1) {
|
||||
page.value--
|
||||
}
|
||||
getTableData()
|
||||
}
|
||||
}
|
||||
|
||||
// 弹窗控制标记
|
||||
const dialogFormVisible = ref(false)
|
||||
|
||||
// 查看详情控制标记
|
||||
const detailShow = ref(false)
|
||||
|
||||
// 打开详情弹窗
|
||||
const openDetailShow = () => {
|
||||
detailShow.value = true
|
||||
}
|
||||
|
||||
// 打开详情
|
||||
const getDetails = async(row) => {
|
||||
// 打开弹窗
|
||||
const res = await findProductPrice({ ID: row.ID })
|
||||
if (res.code === 0) {
|
||||
formData.value = res.data.reproductPrice
|
||||
openDetailShow()
|
||||
}
|
||||
}
|
||||
|
||||
// 关闭详情弹窗
|
||||
const closeDetailShow = () => {
|
||||
detailShow.value = false
|
||||
formData.value = {
|
||||
productId: 0,
|
||||
publishDate: new Date(),
|
||||
norm: '',
|
||||
areaId: 0,
|
||||
areaFullname: '',
|
||||
priceType: false,
|
||||
priceUnit: '',
|
||||
priceMin: 0,
|
||||
priceMax: 0,
|
||||
status: false,
|
||||
remark: '',
|
||||
}
|
||||
}
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = () => {
|
||||
type.value = 'create'
|
||||
dialogFormVisible.value = true
|
||||
}
|
||||
|
||||
// 关闭弹窗
|
||||
const closeDialog = () => {
|
||||
dialogFormVisible.value = false
|
||||
formData.value = {
|
||||
productId: 0,
|
||||
publishDate: new Date(),
|
||||
norm: '',
|
||||
areaId: 0,
|
||||
areaFullname: '',
|
||||
priceType: false,
|
||||
priceUnit: '',
|
||||
priceMin: 0,
|
||||
priceMax: 0,
|
||||
status: false,
|
||||
remark: '',
|
||||
}
|
||||
}
|
||||
// 弹窗确定
|
||||
const enterDialog = async() => {
|
||||
elFormRef.value?.validate(async(valid) => {
|
||||
if (!valid) return
|
||||
let res
|
||||
switch (type.value) {
|
||||
case 'create':
|
||||
res = await createProductPrice(formData.value)
|
||||
break
|
||||
case 'update':
|
||||
res = await updateProductPrice(formData.value)
|
||||
break
|
||||
default:
|
||||
res = await createProductPrice(formData.value)
|
||||
break
|
||||
}
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '创建/更改成功'
|
||||
})
|
||||
closeDialog()
|
||||
getTableData()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
|
@ -1,135 +0,0 @@
|
|||
<template>
|
||||
<div>
|
||||
<div class="gva-form-box">
|
||||
<el-form :model="formData" ref="elFormRef" label-position="right" :rules="rule" label-width="80px">
|
||||
<el-form-item label="产品Id:" prop="productId">
|
||||
<el-input v-model.number="formData.productId" :clearable="true" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item label="发布日期:" prop="publishDate">
|
||||
<el-date-picker v-model="formData.publishDate" type="date" placeholder="选择日期" :clearable="true"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="规格:" prop="norm">
|
||||
<el-input v-model="formData.norm" :clearable="true" placeholder="请输入规格" />
|
||||
</el-form-item>
|
||||
<el-form-item label="地区Id:" prop="areaId">
|
||||
<el-input v-model.number="formData.areaId" :clearable="true" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item label="地区:" prop="areaFullname">
|
||||
<el-input v-model="formData.areaFullname" :clearable="true" placeholder="请输入地区" />
|
||||
</el-form-item>
|
||||
<el-form-item label="价格类型:" prop="priceType">
|
||||
<el-switch v-model="formData.priceType" active-color="#13ce66" inactive-color="#ff4949" active-text="是" inactive-text="否" clearable ></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="单位:" prop="priceUnit">
|
||||
<el-input v-model="formData.priceUnit" :clearable="true" placeholder="请输入单位" />
|
||||
</el-form-item>
|
||||
<el-form-item label="最低价格:" prop="priceMin">
|
||||
<el-input-number v-model="formData.priceMin" :precision="2" :clearable="true"></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item label="最高价格:" prop="priceMax">
|
||||
<el-input-number v-model="formData.priceMax" :precision="2" :clearable="true"></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态:" prop="status">
|
||||
<el-switch v-model="formData.status" active-color="#13ce66" inactive-color="#ff4949" active-text="是" inactive-text="否" clearable ></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注:" prop="remark">
|
||||
<el-input v-model="formData.remark" :clearable="true" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="save">保存</el-button>
|
||||
<el-button type="primary" @click="back">返回</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
createProductPrice,
|
||||
updateProductPrice,
|
||||
findProductPrice
|
||||
} from '@/api/productPrice'
|
||||
|
||||
defineOptions({
|
||||
name: 'ProductPriceForm'
|
||||
})
|
||||
|
||||
// 自动获取字典
|
||||
import { getDictFunc } from '@/utils/format'
|
||||
import { useRoute, useRouter } from "vue-router"
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { ref, reactive } from 'vue'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const type = ref('')
|
||||
const formData = ref({
|
||||
productId: 0,
|
||||
publishDate: new Date(),
|
||||
norm: '',
|
||||
areaId: 0,
|
||||
areaFullname: '',
|
||||
priceType: false,
|
||||
priceUnit: '',
|
||||
priceMin: 0,
|
||||
priceMax: 0,
|
||||
status: false,
|
||||
remark: '',
|
||||
})
|
||||
// 验证规则
|
||||
const rule = reactive({
|
||||
})
|
||||
|
||||
const elFormRef = ref()
|
||||
|
||||
// 初始化方法
|
||||
const init = async () => {
|
||||
// 建议通过url传参获取目标数据ID 调用 find方法进行查询数据操作 从而决定本页面是create还是update 以下为id作为url参数示例
|
||||
if (route.query.id) {
|
||||
const res = await findProductPrice({ ID: route.query.id })
|
||||
if (res.code === 0) {
|
||||
formData.value = res.data.reproductPrice
|
||||
type.value = 'update'
|
||||
}
|
||||
} else {
|
||||
type.value = 'create'
|
||||
}
|
||||
}
|
||||
|
||||
init()
|
||||
// 保存按钮
|
||||
const save = async() => {
|
||||
elFormRef.value?.validate( async (valid) => {
|
||||
if (!valid) return
|
||||
let res
|
||||
switch (type.value) {
|
||||
case 'create':
|
||||
res = await createProductPrice(formData.value)
|
||||
break
|
||||
case 'update':
|
||||
res = await updateProductPrice(formData.value)
|
||||
break
|
||||
default:
|
||||
res = await createProductPrice(formData.value)
|
||||
break
|
||||
}
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '创建/更改成功'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 返回按钮
|
||||
const back = () => {
|
||||
router.go(-1)
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
|
|
@ -1,641 +0,0 @@
|
|||
<template>
|
||||
<div>
|
||||
<div class="gva-search-box">
|
||||
<el-form ref="elSearchFormRef" :inline="true" :model="searchInfo" class="demo-form-inline" :rules="searchRule"
|
||||
@keyup.enter="onSubmit">
|
||||
<el-form-item label="创建日期" prop="createdAt">
|
||||
<template #label>
|
||||
<span>
|
||||
创建日期
|
||||
<el-tooltip content="搜索范围是开始日期(包含)至结束日期(不包含)">
|
||||
<el-icon>
|
||||
<QuestionFilled />
|
||||
</el-icon>
|
||||
</el-tooltip>
|
||||
</span>
|
||||
</template>
|
||||
<el-date-picker v-model="searchInfo.startCreatedAt" type="datetime" placeholder="开始日期"
|
||||
:disabled-date="time=> searchInfo.endCreatedAt ? time.getTime() > searchInfo.endCreatedAt.getTime() : false"></el-date-picker>
|
||||
—
|
||||
<el-date-picker v-model="searchInfo.endCreatedAt" type="datetime" placeholder="结束日期"
|
||||
:disabled-date="time=> searchInfo.startCreatedAt ? time.getTime() < searchInfo.startCreatedAt.getTime() : false"></el-date-picker>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="search" @click="onSubmit">查询</el-button>
|
||||
<el-button icon="refresh" @click="onReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="gva-table-box">
|
||||
<div class="gva-btn-list">
|
||||
<el-button type="primary" icon="plus" @click="openDialog">新增</el-button>
|
||||
<el-button icon="delete" style="margin-left: 10px;" :disabled="!multipleSelection.length"
|
||||
@click="onDelete">删除</el-button>
|
||||
</div>
|
||||
<el-table ref="multipleTable" style="width: 100%" tooltip-effect="dark" :data="tableData" row-key="ID"
|
||||
@selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column align="left" label="ID" prop="ID" width="60" />
|
||||
<el-table-column align="left" label="产品" prop="productId" width="80">
|
||||
<template #default="scope">{{ formatProduct(scope.row.productId) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="产品价格Id" prop="productPriceId" width="120" />
|
||||
<el-table-column align="left" label="公司价格Id" prop="companyPriceId" width="120" />
|
||||
<el-table-column align="left" label="规格" prop="norm" width="120" />
|
||||
<el-table-column align="left" label="地区Id" prop="areaId" width="80" />
|
||||
<el-table-column align="left" label="地区" prop="areaFullname" width="120" />
|
||||
<el-table-column align="left" label="品牌" prop="producter" width="120" />
|
||||
<el-table-column align="left" label="价格类型" prop="priceType" width="80">
|
||||
<template #default="scope">{{ formatPriceType(scope.row.priceType) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="价格" prop="price" width="120" />
|
||||
<el-table-column align="left" label="单位" prop="priceUnit" width="60" />
|
||||
<el-table-column align="left" label="公司" prop="companyName" width="220" />
|
||||
<el-table-column align="left" label="发布日期" width="120">
|
||||
<template #default="scope">{{ formatOnlyDate(scope.row.publishDate) }}</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="left" label="创建时间" width="180">
|
||||
<template #default="scope">{{ formatDate(scope.row.createdAt) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="更新时间" width="180">
|
||||
<template #default="scope">{{ formatDate(scope.row.updatedAt) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="爬虫表.Id" prop="crawTableId" width="220">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" link @click="getCrawlData(scope.row)">
|
||||
{{ scope.row.crawTable }}.{{ scope.row.crawTableId }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="left" label="操作" fixed="right" min-width="240">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" link class="table-button" @click="getDetails(scope.row)">
|
||||
<el-icon style="margin-right: 5px">
|
||||
<InfoFilled />
|
||||
</el-icon>
|
||||
查看详情
|
||||
</el-button>
|
||||
<el-button type="primary" link icon="edit" class="table-button"
|
||||
@click="updateSourcePriceFunc(scope.row)">变更</el-button>
|
||||
<el-button type="primary" link icon="delete" @click="deleteRow(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="gva-pagination">
|
||||
<el-pagination layout="total, sizes, prev, pager, next, jumper" :current-page="page" :page-size="pageSize"
|
||||
:page-sizes="[10, 30, 50, 100]" :total="total" @current-change="handleCurrentChange"
|
||||
@size-change="handleSizeChange" />
|
||||
</div>
|
||||
</div>
|
||||
<el-drawer size="800" v-model="dialogFormVisible" :show-close="false" :before-close="closeDialog">
|
||||
<template #header>
|
||||
<div class="flex justify-between items-center">
|
||||
<span class="text-lg">{{type==='create'?'添加':'修改'}}</span>
|
||||
<div>
|
||||
<el-button type="primary" @click="enterDialog">确 定</el-button>
|
||||
<el-button @click="closeDialog">取 消</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-form :model="formData" label-position="top" ref="elFormRef" :rules="rule" label-width="80px">
|
||||
<el-form-item label="爬虫表:" prop="crawTable">
|
||||
<el-input v-model="formData.crawTable" :clearable="true" placeholder="请输入爬虫表" />
|
||||
</el-form-item>
|
||||
<el-form-item label="爬虫表Id:" prop="crawTableId">
|
||||
<el-input v-model.number="formData.crawTableId" :clearable="true" placeholder="请输入爬虫表Id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="产品Id:" prop="productId">
|
||||
<el-input v-model.number="formData.productId" :clearable="true" placeholder="请输入产品Id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="产品价格Id:" prop="productPriceId">
|
||||
<el-input v-model.number="formData.productPriceId" :clearable="true" placeholder="请输入产品价格Id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="公司价格Id:" prop="companyPriceId">
|
||||
<el-input v-model.number="formData.companyPriceId" :clearable="true" placeholder="请输入公司价格Id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="规格:" prop="norm">
|
||||
<el-input v-model="formData.norm" :clearable="true" placeholder="请输入规格" />
|
||||
</el-form-item>
|
||||
<el-form-item label="地区Id:" prop="areaId">
|
||||
<el-input v-model.number="formData.areaId" :clearable="true" placeholder="请输入地区Id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="地区:" prop="areaFullname">
|
||||
<el-input v-model="formData.areaFullname" :clearable="true" placeholder="请输入地区" />
|
||||
</el-form-item>
|
||||
<el-form-item label="品牌:" prop="producter">
|
||||
<el-input v-model="formData.producter" :clearable="true" placeholder="请输入品牌" />
|
||||
</el-form-item>
|
||||
<el-form-item label="价格类型:" prop="priceType">
|
||||
<el-switch v-model="formData.priceType" active-color="#13ce66" inactive-color="#ff4949" active-text="是"
|
||||
inactive-text="否" clearable></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="价格:" prop="price">
|
||||
<el-input-number v-model="formData.price" style="width:100%" :precision="2" :clearable="true" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单位:" prop="priceUnit">
|
||||
<el-input v-model="formData.priceUnit" :clearable="true" placeholder="请输入单位" />
|
||||
</el-form-item>
|
||||
<el-form-item label="公司:" prop="companyName">
|
||||
<el-input v-model="formData.companyName" :clearable="true" placeholder="请输入公司" />
|
||||
</el-form-item>
|
||||
<el-form-item label="发布日期:" prop="publishDate">
|
||||
<el-date-picker v-model="formData.publishDate" type="date" style="width:100%" placeholder="选择日期"
|
||||
:clearable="true" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-drawer>
|
||||
|
||||
<el-drawer size="800" v-model="detailShow" :before-close="closeDetailShow" destroy-on-close>
|
||||
<template #header>
|
||||
<div class="flex justify-between items-center">
|
||||
<span class="text-lg">查看详情</span>
|
||||
</div>
|
||||
</template>
|
||||
<el-descriptions :column="1" border>
|
||||
<el-descriptions-item label="ID">
|
||||
{{ formData.ID }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="爬虫表">
|
||||
{{ formData.crawTable }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="爬虫表Id">
|
||||
{{ formData.crawTableId }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="产品Id">
|
||||
{{ formatProduct(formData.productId) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="产品价格Id">
|
||||
{{ formData.productPriceId }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="公司价格Id">
|
||||
{{ formData.companyPriceId }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="规格">
|
||||
{{ formData.norm }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="地区Id">
|
||||
{{ formData.areaId }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="地区">
|
||||
{{ formData.areaFullname }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="品牌">
|
||||
{{ formData.producter }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="价格类型">
|
||||
{{ formatPriceType(formData.priceType) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="价格">
|
||||
{{ formData.price }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="单位">
|
||||
{{ formData.priceUnit }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="公司">
|
||||
{{ formData.companyName }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="发布日期">
|
||||
{{ formatOnlyDate(formData.publishDate) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="创建时间">
|
||||
{{ formatDate(formData.createdAt) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="更新时间">
|
||||
{{ formatDate(formData.updatedAt) }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-drawer>
|
||||
|
||||
<el-drawer size="800" v-model="crawl100ppiDetail" :before-close="closeCrawl100ppiShow" destroy-on-close>
|
||||
<template #header>
|
||||
<div class="flex justify-between items-center">
|
||||
<span class="text-lg">查看爬虫数据详情</span>
|
||||
</div>
|
||||
</template>
|
||||
<el-descriptions :column="1" border>
|
||||
<el-descriptions-item label="ID">
|
||||
{{ formData.ID }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="产品Code">
|
||||
{{ formData.code }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="产品名称">
|
||||
{{ formData.name }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="规格">
|
||||
{{ formData.norm }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="品牌">
|
||||
{{ formData.producer }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="价格类型">
|
||||
{{ formData.priceType }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="单位">
|
||||
{{ formData.priceUnit }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="价格">
|
||||
{{ formData.price }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="地区">
|
||||
{{ formData.areaDetail }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="公司">
|
||||
{{ formData.dealer }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="发布日期">
|
||||
{{ formData.publishDate }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="数据唯一值">
|
||||
{{ formData.uniqueCode }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="抓取时间">
|
||||
{{ formData.crawlTime }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="状态">
|
||||
{{ formData.status }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="同步失败原因">
|
||||
{{ formData.syncError }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="创建时间">
|
||||
{{ formatDate(formData.createdAt) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="更新时间">
|
||||
{{ formatDate(formData.updatedAt) }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { findCrawl100ppi } from '@/api/crawl100ppi'
|
||||
import { getProductList } from '@/api/product'
|
||||
import {
|
||||
createSourcePrice,
|
||||
deleteSourcePrice,
|
||||
deleteSourcePriceByIds,
|
||||
updateSourcePrice,
|
||||
findSourcePrice,
|
||||
getSourcePriceList
|
||||
} from '@/api/sourcePrice'
|
||||
|
||||
// 全量引入格式化工具 请按需保留
|
||||
import { formatDate, formatOnlyDate, formatPriceType } from '@/utils/format'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { ref, reactive } from 'vue'
|
||||
|
||||
defineOptions({
|
||||
name: 'SourcePrice'
|
||||
})
|
||||
|
||||
// 自动化生成的字典(可能为空)以及字段
|
||||
const formData = ref({
|
||||
crawTable: '',
|
||||
crawTableId: 0,
|
||||
productId: 0,
|
||||
productPriceId: 0,
|
||||
companyPriceId: 0,
|
||||
norm: '',
|
||||
areaId: 0,
|
||||
areaFullname: '',
|
||||
producter: '',
|
||||
priceType: false,
|
||||
price: 0,
|
||||
priceUnit: '',
|
||||
companyName: '',
|
||||
publishDate: new Date(),
|
||||
})
|
||||
|
||||
// 验证规则
|
||||
const rule = reactive({
|
||||
})
|
||||
|
||||
const searchRule = reactive({
|
||||
createdAt: [
|
||||
{ validator: (rule, value, callback) => {
|
||||
if (searchInfo.value.startCreatedAt && !searchInfo.value.endCreatedAt) {
|
||||
callback(new Error('请填写结束日期'))
|
||||
} else if (!searchInfo.value.startCreatedAt && searchInfo.value.endCreatedAt) {
|
||||
callback(new Error('请填写开始日期'))
|
||||
} else if (searchInfo.value.startCreatedAt && searchInfo.value.endCreatedAt && (searchInfo.value.startCreatedAt.getTime() === searchInfo.value.endCreatedAt.getTime() || searchInfo.value.startCreatedAt.getTime() > searchInfo.value.endCreatedAt.getTime())) {
|
||||
callback(new Error('开始日期应当早于结束日期'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}, trigger: 'change' }
|
||||
],
|
||||
})
|
||||
|
||||
const elFormRef = ref()
|
||||
const elSearchFormRef = ref()
|
||||
|
||||
// =========== 表格控制部分 ===========
|
||||
const page = ref(1)
|
||||
const total = ref(0)
|
||||
const pageSize = ref(10)
|
||||
const tableData = ref([])
|
||||
const searchInfo = ref({})
|
||||
const productList = ref([])
|
||||
|
||||
const formatProduct = (id) => {
|
||||
for (let i = 0; i < productList.value.length; i++) {
|
||||
if (productList.value[i].ID === id) {
|
||||
return productList.value[i].name
|
||||
}
|
||||
}
|
||||
return id
|
||||
}
|
||||
|
||||
const formmatStatus = (stauts) => {
|
||||
switch (status) {
|
||||
case '1': return '待同步'
|
||||
case '2': return '已同步'
|
||||
case '3': return '同步失败'
|
||||
}
|
||||
}
|
||||
|
||||
// 重置
|
||||
const onReset = () => {
|
||||
searchInfo.value = {}
|
||||
getTableData()
|
||||
}
|
||||
|
||||
// 搜索
|
||||
const onSubmit = () => {
|
||||
elSearchFormRef.value?.validate(async(valid) => {
|
||||
if (!valid) return
|
||||
page.value = 1
|
||||
pageSize.value = 10
|
||||
if (searchInfo.value.priceType === '') {
|
||||
searchInfo.value.priceType = null
|
||||
}
|
||||
getTableData()
|
||||
})
|
||||
}
|
||||
|
||||
// 分页
|
||||
const handleSizeChange = (val) => {
|
||||
pageSize.value = val
|
||||
getTableData()
|
||||
}
|
||||
|
||||
// 修改页面容量
|
||||
const handleCurrentChange = (val) => {
|
||||
page.value = val
|
||||
getTableData()
|
||||
}
|
||||
|
||||
const getProductData = async() => {
|
||||
const resp = await getProductList({ page: 1, pageSize: 100 })
|
||||
if (resp.code === 0 && resp.data.list) {
|
||||
productList.value = resp.data.list
|
||||
}
|
||||
}
|
||||
|
||||
getProductData()
|
||||
|
||||
// 查询
|
||||
const getTableData = async() => {
|
||||
const table = await getSourcePriceList({ page: page.value, pageSize: pageSize.value, ...searchInfo.value })
|
||||
if (table.code === 0) {
|
||||
tableData.value = table.data.list
|
||||
total.value = table.data.total
|
||||
page.value = table.data.page
|
||||
pageSize.value = table.data.pageSize
|
||||
}
|
||||
}
|
||||
|
||||
getTableData()
|
||||
|
||||
// ============== 表格控制部分结束 ===============
|
||||
|
||||
// 获取需要的字典 可能为空 按需保留
|
||||
const setOptions = async() => {
|
||||
}
|
||||
|
||||
// 获取需要的字典 可能为空 按需保留
|
||||
setOptions()
|
||||
|
||||
// 多选数据
|
||||
const multipleSelection = ref([])
|
||||
// 多选
|
||||
const handleSelectionChange = (val) => {
|
||||
multipleSelection.value = val
|
||||
}
|
||||
|
||||
// 删除行
|
||||
const deleteRow = (row) => {
|
||||
ElMessageBox.confirm('确定要删除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
deleteSourcePriceFunc(row)
|
||||
})
|
||||
}
|
||||
|
||||
// 多选删除
|
||||
const onDelete = async() => {
|
||||
ElMessageBox.confirm('确定要删除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(async() => {
|
||||
const IDs = []
|
||||
if (multipleSelection.value.length === 0) {
|
||||
ElMessage({
|
||||
type: 'warning',
|
||||
message: '请选择要删除的数据'
|
||||
})
|
||||
return
|
||||
}
|
||||
multipleSelection.value &&
|
||||
multipleSelection.value.map(item => {
|
||||
IDs.push(item.ID)
|
||||
})
|
||||
const res = await deleteSourcePriceByIds({ IDs })
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '删除成功'
|
||||
})
|
||||
if (tableData.value.length === IDs.length && page.value > 1) {
|
||||
page.value--
|
||||
}
|
||||
getTableData()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 行为控制标记(弹窗内部需要增还是改)
|
||||
const type = ref('')
|
||||
|
||||
// 更新行
|
||||
const updateSourcePriceFunc = async(row) => {
|
||||
const res = await findSourcePrice({ ID: row.ID })
|
||||
type.value = 'update'
|
||||
if (res.code === 0) {
|
||||
formData.value = res.data.resourcePrice
|
||||
dialogFormVisible.value = true
|
||||
}
|
||||
}
|
||||
|
||||
// 删除行
|
||||
const deleteSourcePriceFunc = async(row) => {
|
||||
const res = await deleteSourcePrice({ ID: row.ID })
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '删除成功'
|
||||
})
|
||||
if (tableData.value.length === 1 && page.value > 1) {
|
||||
page.value--
|
||||
}
|
||||
getTableData()
|
||||
}
|
||||
}
|
||||
|
||||
// 弹窗控制标记
|
||||
const dialogFormVisible = ref(false)
|
||||
|
||||
// 查看详情控制标记
|
||||
const detailShow = ref(false)
|
||||
|
||||
const crawl100ppiDetail = ref(false)
|
||||
|
||||
// 打开详情弹窗
|
||||
const openDetailShow = () => {
|
||||
detailShow.value = true
|
||||
}
|
||||
|
||||
// 打开详情
|
||||
const getDetails = async(row) => {
|
||||
// 打开弹窗
|
||||
const res = await findSourcePrice({ ID: row.ID })
|
||||
if (res.code === 0) {
|
||||
formData.value = res.data.resourcePrice
|
||||
openDetailShow()
|
||||
}
|
||||
}
|
||||
|
||||
// 关闭详情弹窗
|
||||
const closeDetailShow = () => {
|
||||
detailShow.value = false
|
||||
formData.value = {
|
||||
crawTable: '',
|
||||
crawTableId: 0,
|
||||
productId: 0,
|
||||
productPriceId: 0,
|
||||
companyPriceId: 0,
|
||||
norm: '',
|
||||
areaId: 0,
|
||||
areaFullname: '',
|
||||
producter: '',
|
||||
priceType: false,
|
||||
price: 0,
|
||||
priceUnit: '',
|
||||
companyName: '',
|
||||
publishDate: new Date(),
|
||||
}
|
||||
}
|
||||
|
||||
const openCrawl100ppiShow = () => {
|
||||
crawl100ppiDetail.value = true
|
||||
}
|
||||
|
||||
// 关闭详情弹窗
|
||||
const closeCrawl100ppiShow = () => {
|
||||
crawl100ppiDetail.value = false
|
||||
formData.value = {
|
||||
code: '',
|
||||
name: '',
|
||||
norm: '',
|
||||
producer: '',
|
||||
priceType: '',
|
||||
priceUnit: '',
|
||||
price: '',
|
||||
areaDetail: '',
|
||||
dealer: '',
|
||||
publishDate: '',
|
||||
uniqueCode: '',
|
||||
crawlTime: '',
|
||||
status: 0,
|
||||
syncError: '',
|
||||
}
|
||||
}
|
||||
// 打开爬虫详情
|
||||
const getCrawlData = async(row) => {
|
||||
// 打开弹窗
|
||||
if (row.crawTable === 'nzhq_crawl_100ppi') {
|
||||
const res = await findCrawl100ppi({ ID: row.crawTableId })
|
||||
if (res.code === 0) {
|
||||
formData.value = res.data.recrawl100ppi
|
||||
openCrawl100ppiShow()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = () => {
|
||||
type.value = 'create'
|
||||
dialogFormVisible.value = true
|
||||
}
|
||||
|
||||
// 关闭弹窗
|
||||
const closeDialog = () => {
|
||||
dialogFormVisible.value = false
|
||||
formData.value = {
|
||||
crawTable: '',
|
||||
crawTableId: 0,
|
||||
productId: 0,
|
||||
productPriceId: 0,
|
||||
companyPriceId: 0,
|
||||
norm: '',
|
||||
areaId: 0,
|
||||
areaFullname: '',
|
||||
producter: '',
|
||||
priceType: false,
|
||||
price: 0,
|
||||
priceUnit: '',
|
||||
companyName: '',
|
||||
publishDate: new Date(),
|
||||
}
|
||||
}
|
||||
// 弹窗确定
|
||||
const enterDialog = async() => {
|
||||
elFormRef.value?.validate(async(valid) => {
|
||||
if (!valid) return
|
||||
let res
|
||||
switch (type.value) {
|
||||
case 'create':
|
||||
res = await createSourcePrice(formData.value)
|
||||
break
|
||||
case 'update':
|
||||
res = await updateSourcePrice(formData.value)
|
||||
break
|
||||
default:
|
||||
res = await createSourcePrice(formData.value)
|
||||
break
|
||||
}
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '创建/更改成功'
|
||||
})
|
||||
closeDialog()
|
||||
getTableData()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
|
@ -1,149 +0,0 @@
|
|||
<template>
|
||||
<div>
|
||||
<div class="gva-form-box">
|
||||
<el-form :model="formData" ref="elFormRef" label-position="right" :rules="rule" label-width="80px">
|
||||
<el-form-item label="爬虫表:" prop="crawTable">
|
||||
<el-input v-model="formData.crawTable" :clearable="true" placeholder="请输入爬虫表" />
|
||||
</el-form-item>
|
||||
<el-form-item label="爬虫表Id:" prop="crawTableId">
|
||||
<el-input v-model.number="formData.crawTableId" :clearable="true" placeholder="请输入爬虫表Id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="产品Id:" prop="productId">
|
||||
<el-input v-model.number="formData.productId" :clearable="true" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item label="产品价格Id:" prop="productPriceId">
|
||||
<el-input v-model.number="formData.productPriceId" :clearable="true" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item label="公司价格Id:" prop="companyPriceId">
|
||||
<el-input v-model.number="formData.companyPriceId" :clearable="true" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item label="规格:" prop="norm">
|
||||
<el-input v-model="formData.norm" :clearable="true" placeholder="请输入规格" />
|
||||
</el-form-item>
|
||||
<el-form-item label="地区Id:" prop="areaId">
|
||||
<el-input v-model.number="formData.areaId" :clearable="true" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item label="地区:" prop="areaFullname">
|
||||
<el-input v-model="formData.areaFullname" :clearable="true" placeholder="请输入地区" />
|
||||
</el-form-item>
|
||||
<el-form-item label="品牌:" prop="producter">
|
||||
<el-input v-model="formData.producter" :clearable="true" placeholder="请输入品牌" />
|
||||
</el-form-item>
|
||||
<el-form-item label="价格类型:" prop="priceType">
|
||||
<el-switch v-model="formData.priceType" active-color="#13ce66" inactive-color="#ff4949" active-text="是"
|
||||
inactive-text="否" clearable></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="价格:" prop="price">
|
||||
<el-input-number v-model="formData.price" :precision="2" :clearable="true"></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item label="单位:" prop="priceUnit">
|
||||
<el-input v-model="formData.priceUnit" :clearable="true" placeholder="请输入单位" />
|
||||
</el-form-item>
|
||||
<el-form-item label="公司:" prop="companyName">
|
||||
<el-input v-model="formData.companyName" :clearable="true" placeholder="请输入公司" />
|
||||
</el-form-item>
|
||||
<el-form-item label="发布日期:" prop="publishDate">
|
||||
<el-date-picker v-model="formData.publishDate" type="date" placeholder="选择日期"
|
||||
:clearable="true"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="save">保存</el-button>
|
||||
<el-button type="primary" @click="back">返回</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
createSourcePrice,
|
||||
updateSourcePrice,
|
||||
findSourcePrice
|
||||
} from '@/api/sourcePrice'
|
||||
|
||||
defineOptions({
|
||||
name: 'SourcePriceForm'
|
||||
})
|
||||
|
||||
// 自动获取字典
|
||||
import { getDictFunc } from '@/utils/format'
|
||||
import { useRoute, useRouter } from "vue-router"
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { ref, reactive } from 'vue'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const type = ref('')
|
||||
const formData = ref({
|
||||
crawTable: '',
|
||||
crawTableId: 0,
|
||||
productId: 0,
|
||||
productPriceId: 0,
|
||||
companyPriceId: 0,
|
||||
norm: '',
|
||||
areaId: 0,
|
||||
areaFullname: '',
|
||||
producter: '',
|
||||
priceType: false,
|
||||
price: 0,
|
||||
priceUnit: '',
|
||||
companyName: '',
|
||||
publishDate: new Date(),
|
||||
})
|
||||
// 验证规则
|
||||
const rule = reactive({
|
||||
})
|
||||
|
||||
const elFormRef = ref()
|
||||
|
||||
// 初始化方法
|
||||
const init = async () => {
|
||||
// 建议通过url传参获取目标数据ID 调用 find方法进行查询数据操作 从而决定本页面是create还是update 以下为id作为url参数示例
|
||||
if (route.query.id) {
|
||||
const res = await findSourcePrice({ ID: route.query.id })
|
||||
if (res.code === 0) {
|
||||
formData.value = res.data.resourcePrice
|
||||
type.value = 'update'
|
||||
}
|
||||
} else {
|
||||
type.value = 'create'
|
||||
}
|
||||
}
|
||||
|
||||
init()
|
||||
// 保存按钮
|
||||
const save = async() => {
|
||||
elFormRef.value?.validate( async (valid) => {
|
||||
if (!valid) return
|
||||
let res
|
||||
switch (type.value) {
|
||||
case 'create':
|
||||
res = await createSourcePrice(formData.value)
|
||||
break
|
||||
case 'update':
|
||||
res = await updateSourcePrice(formData.value)
|
||||
break
|
||||
default:
|
||||
res = await createSourcePrice(formData.value)
|
||||
break
|
||||
}
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '创建/更改成功'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 返回按钮
|
||||
const back = () => {
|
||||
router.go(-1)
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
|
|
@ -1,387 +0,0 @@
|
|||
<template>
|
||||
<div>
|
||||
<div class="gva-search-box">
|
||||
<el-form ref="elSearchFormRef" :inline="true" :model="searchInfo" class="demo-form-inline"
|
||||
@keyup.enter="onSubmit">
|
||||
<el-form-item label="ID" prop="id">
|
||||
<template #label>
|
||||
<span>ID</span>
|
||||
</template>
|
||||
<el-input v-model="searchInfo.id" type="input" />
|
||||
</el-form-item>
|
||||
<el-form-item label="上级Id" prop="pid">
|
||||
<template #label>
|
||||
<span>上级Id</span>
|
||||
</template>
|
||||
<el-input v-model="searchInfo.pid" type="input" />
|
||||
</el-form-item>
|
||||
<el-form-item label="地区级别" prop="level">
|
||||
<template #label>
|
||||
<span>地区级别</span>
|
||||
</template>
|
||||
<el-input v-model="searchInfo.level" type="input" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="search" @click="onSubmit">查询</el-button>
|
||||
<el-button icon="refresh" @click="onReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="gva-table-box">
|
||||
<div class="gva-btn-list">
|
||||
<el-button type="primary" icon="plus" @click="openDialog">新增</el-button>
|
||||
<el-button icon="delete" style="margin-left: 10px;" :disabled="!multipleSelection.length"
|
||||
@click="onDelete">删除</el-button>
|
||||
</div>
|
||||
<el-table ref="multipleTable" style="width: 100%" tooltip-effect="dark" :data="tableData" row-key="ID"
|
||||
@selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" />
|
||||
|
||||
<el-table-column align="left" label="ID" prop="ID" width="120" />
|
||||
<el-table-column align="left" label="上级Id" prop="pid" width="120" />
|
||||
<el-table-column align="left" label="地区名称" prop="name" width="300" />
|
||||
<el-table-column align="left" label="是否显示" prop="visible" width="120">
|
||||
<template #default="scope">{{ formatBoolean(scope.row.visible) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="left" label="排序值" prop="weight" width="120" />
|
||||
<el-table-column align="left" label="地区级别" prop="level" width="120" />
|
||||
<el-table-column align="left" label="操作" fixed="right" min-width="240">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" link class="table-button" @click="getDetails(scope.row)">
|
||||
<el-icon style="margin-right: 5px">
|
||||
<InfoFilled />
|
||||
</el-icon>
|
||||
查看详情
|
||||
</el-button>
|
||||
<el-button type="primary" link icon="edit" class="table-button"
|
||||
@click="updateSystemAreaFunc(scope.row)">变更</el-button>
|
||||
<el-button type="primary" link icon="delete" @click="deleteRow(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="gva-pagination">
|
||||
<el-pagination layout="total, sizes, prev, pager, next, jumper" :current-page="page" :page-size="pageSize"
|
||||
:page-sizes="[10, 30, 50, 100]" :total="total" @current-change="handleCurrentChange"
|
||||
@size-change="handleSizeChange" />
|
||||
</div>
|
||||
</div>
|
||||
<el-drawer v-model="dialogFormVisible" size="800" :show-close="false" :before-close="closeDialog">
|
||||
<template #header>
|
||||
<div class="flex justify-between items-center">
|
||||
<span class="text-lg">{{ type==='create'?'添加':'修改' }}</span>
|
||||
<div>
|
||||
<el-button type="primary" @click="enterDialog">确 定</el-button>
|
||||
<el-button @click="closeDialog">取 消</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-form ref="elFormRef" :model="formData" label-position="top" :rules="rule" label-width="80px">
|
||||
<el-form-item label="上级Id:" prop="pid">
|
||||
<el-input v-model.number="formData.pid" :clearable="true" placeholder="请输入上级Id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="地区名称:" prop="name">
|
||||
<el-input v-model="formData.name" :clearable="true" placeholder="请输入地区名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否显示:" prop="visible">
|
||||
<el-switch v-model="formData.visible" active-color="#13ce66" inactive-color="#ff4949" active-text="是"
|
||||
inactive-text="否" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="排序值:" prop="weight">
|
||||
<el-input v-model.number="formData.weight" :clearable="true" placeholder="请输入排序值" />
|
||||
</el-form-item>
|
||||
<el-form-item label="地区级别:" prop="level">
|
||||
<el-input v-model.number="formData.level" :clearable="true" placeholder="请输入地区级别" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-drawer>
|
||||
|
||||
<el-drawer v-model="detailShow" size="800" :before-close="closeDetailShow" destroy-on-close>
|
||||
<template #header>
|
||||
<div class="flex justify-between items-center">
|
||||
<span class="text-lg">查看详情</span>
|
||||
</div>
|
||||
</template>
|
||||
<el-descriptions :column="1" border>
|
||||
<el-descriptions-item label="ID">
|
||||
{{ formData.ID }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="上级Id">
|
||||
{{ formData.pid }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="地区名称">
|
||||
{{ formData.name }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="是否显示">
|
||||
{{ formatBoolean(formData.visible) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="排序值">
|
||||
{{ formData.weight }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="地区级别">
|
||||
{{ formData.level }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
createSystemArea,
|
||||
deleteSystemArea,
|
||||
deleteSystemAreaByIds,
|
||||
updateSystemArea,
|
||||
findSystemArea,
|
||||
getSystemAreaList
|
||||
} from '@/api/systemArea'
|
||||
|
||||
// 全量引入格式化工具 请按需保留
|
||||
import { formatBoolean } from '@/utils/format'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { ref, reactive } from 'vue'
|
||||
|
||||
defineOptions({
|
||||
name: 'SystemArea'
|
||||
})
|
||||
|
||||
// 自动化生成的字典(可能为空)以及字段
|
||||
const formData = ref({
|
||||
id: 0,
|
||||
pid: 0,
|
||||
name: '',
|
||||
visible: false,
|
||||
weight: 0,
|
||||
level: 0,
|
||||
})
|
||||
|
||||
// 验证规则
|
||||
const rule = reactive({})
|
||||
|
||||
const elFormRef = ref()
|
||||
const elSearchFormRef = ref()
|
||||
|
||||
// =========== 表格控制部分 ===========
|
||||
const page = ref(1)
|
||||
const total = ref(0)
|
||||
const pageSize = ref(10)
|
||||
const tableData = ref([])
|
||||
const searchInfo = ref({})
|
||||
|
||||
// 重置
|
||||
const onReset = () => {
|
||||
searchInfo.value = {}
|
||||
getTableData()
|
||||
}
|
||||
|
||||
// 搜索
|
||||
const onSubmit = () => {
|
||||
elSearchFormRef.value?.validate(async(valid) => {
|
||||
if (!valid) return
|
||||
page.value = 1
|
||||
pageSize.value = 10
|
||||
if (searchInfo.value.visible === '') {
|
||||
searchInfo.value.visible = null
|
||||
}
|
||||
if (searchInfo.value.pid === '') {
|
||||
searchInfo.value.pid = null
|
||||
}
|
||||
getTableData()
|
||||
})
|
||||
}
|
||||
|
||||
// 分页
|
||||
const handleSizeChange = (val) => {
|
||||
pageSize.value = val
|
||||
getTableData()
|
||||
}
|
||||
|
||||
// 修改页面容量
|
||||
const handleCurrentChange = (val) => {
|
||||
page.value = val
|
||||
getTableData()
|
||||
}
|
||||
|
||||
// 查询
|
||||
const getTableData = async() => {
|
||||
const table = await getSystemAreaList({ page: page.value, pageSize: pageSize.value, ...searchInfo.value })
|
||||
if (table.code === 0) {
|
||||
tableData.value = table.data.list
|
||||
total.value = table.data.total
|
||||
page.value = table.data.page
|
||||
pageSize.value = table.data.pageSize
|
||||
}
|
||||
}
|
||||
|
||||
getTableData()
|
||||
|
||||
// ============== 表格控制部分结束 ===============
|
||||
|
||||
// 获取需要的字典 可能为空 按需保留
|
||||
const setOptions = async() => {
|
||||
}
|
||||
|
||||
// 获取需要的字典 可能为空 按需保留
|
||||
setOptions()
|
||||
|
||||
// 多选数据
|
||||
const multipleSelection = ref([])
|
||||
// 多选
|
||||
const handleSelectionChange = (val) => {
|
||||
multipleSelection.value = val
|
||||
}
|
||||
|
||||
// 删除行
|
||||
const deleteRow = (row) => {
|
||||
ElMessageBox.confirm('确定要删除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
deleteSystemAreaFunc(row)
|
||||
})
|
||||
}
|
||||
|
||||
// 多选删除
|
||||
const onDelete = async() => {
|
||||
ElMessageBox.confirm('确定要删除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(async() => {
|
||||
const IDs = []
|
||||
if (multipleSelection.value.length === 0) {
|
||||
ElMessage({
|
||||
type: 'warning',
|
||||
message: '请选择要删除的数据'
|
||||
})
|
||||
return
|
||||
}
|
||||
multipleSelection.value &&
|
||||
multipleSelection.value.map(item => {
|
||||
IDs.push(item.ID)
|
||||
})
|
||||
const res = await deleteSystemAreaByIds({ IDs })
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '删除成功'
|
||||
})
|
||||
if (tableData.value.length === IDs.length && page.value > 1) {
|
||||
page.value--
|
||||
}
|
||||
getTableData()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 行为控制标记(弹窗内部需要增还是改)
|
||||
const type = ref('')
|
||||
|
||||
// 更新行
|
||||
const updateSystemAreaFunc = async(row) => {
|
||||
const res = await findSystemArea({ ID: row.ID })
|
||||
type.value = 'update'
|
||||
if (res.code === 0) {
|
||||
formData.value = res.data.resystemArea
|
||||
dialogFormVisible.value = true
|
||||
}
|
||||
}
|
||||
|
||||
// 删除行
|
||||
const deleteSystemAreaFunc = async(row) => {
|
||||
const res = await deleteSystemArea({ ID: row.ID })
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '删除成功'
|
||||
})
|
||||
if (tableData.value.length === 1 && page.value > 1) {
|
||||
page.value--
|
||||
}
|
||||
getTableData()
|
||||
}
|
||||
}
|
||||
|
||||
// 弹窗控制标记
|
||||
const dialogFormVisible = ref(false)
|
||||
|
||||
// 查看详情控制标记
|
||||
const detailShow = ref(false)
|
||||
|
||||
// 打开详情弹窗
|
||||
const openDetailShow = () => {
|
||||
detailShow.value = true
|
||||
}
|
||||
|
||||
// 打开详情
|
||||
const getDetails = async(row) => {
|
||||
// 打开弹窗
|
||||
const res = await findSystemArea({ ID: row.ID })
|
||||
if (res.code === 0) {
|
||||
formData.value = res.data.resystemArea
|
||||
openDetailShow()
|
||||
}
|
||||
}
|
||||
|
||||
// 关闭详情弹窗
|
||||
const closeDetailShow = () => {
|
||||
detailShow.value = false
|
||||
formData.value = {
|
||||
pid: 0,
|
||||
name: '',
|
||||
visible: false,
|
||||
weight: 0,
|
||||
level: 0,
|
||||
}
|
||||
}
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = () => {
|
||||
type.value = 'create'
|
||||
dialogFormVisible.value = true
|
||||
}
|
||||
|
||||
// 关闭弹窗
|
||||
const closeDialog = () => {
|
||||
dialogFormVisible.value = false
|
||||
formData.value = {
|
||||
pid: 0,
|
||||
name: '',
|
||||
visible: false,
|
||||
weight: 0,
|
||||
level: 0,
|
||||
}
|
||||
}
|
||||
// 弹窗确定
|
||||
const enterDialog = async() => {
|
||||
elFormRef.value?.validate(async(valid) => {
|
||||
if (!valid) return
|
||||
let res
|
||||
switch (type.value) {
|
||||
case 'create':
|
||||
res = await createSystemArea(formData.value)
|
||||
break
|
||||
case 'update':
|
||||
res = await updateSystemArea(formData.value)
|
||||
break
|
||||
default:
|
||||
res = await createSystemArea(formData.value)
|
||||
break
|
||||
}
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '创建/更改成功'
|
||||
})
|
||||
closeDialog()
|
||||
getTableData()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
|
@ -1,111 +0,0 @@
|
|||
<template>
|
||||
<div>
|
||||
<div class="gva-form-box">
|
||||
<el-form :model="formData" ref="elFormRef" label-position="right" :rules="rule" label-width="80px">
|
||||
<el-form-item label="上级Id:" prop="pid">
|
||||
<el-input v-model.number="formData.pid" :clearable="true" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item label="地区名称:" prop="name">
|
||||
<el-input v-model="formData.name" :clearable="true" placeholder="请输入地区名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否显示:" prop="visible">
|
||||
<el-switch v-model="formData.visible" active-color="#13ce66" inactive-color="#ff4949" active-text="是" inactive-text="否" clearable ></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序值:" prop="weight">
|
||||
<el-input v-model.number="formData.weight" :clearable="true" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item label="地区级别:" prop="level">
|
||||
<el-input v-model.number="formData.level" :clearable="true" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="save">保存</el-button>
|
||||
<el-button type="primary" @click="back">返回</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
createSystemArea,
|
||||
updateSystemArea,
|
||||
findSystemArea
|
||||
} from '@/api/systemArea'
|
||||
|
||||
defineOptions({
|
||||
name: 'SystemAreaForm'
|
||||
})
|
||||
|
||||
// 自动获取字典
|
||||
import { getDictFunc } from '@/utils/format'
|
||||
import { useRoute, useRouter } from "vue-router"
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { ref, reactive } from 'vue'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const type = ref('')
|
||||
const formData = ref({
|
||||
pid: 0,
|
||||
name: '',
|
||||
visible: false,
|
||||
weight: 0,
|
||||
level: 0,
|
||||
})
|
||||
// 验证规则
|
||||
const rule = reactive({
|
||||
})
|
||||
|
||||
const elFormRef = ref()
|
||||
|
||||
// 初始化方法
|
||||
const init = async () => {
|
||||
// 建议通过url传参获取目标数据ID 调用 find方法进行查询数据操作 从而决定本页面是create还是update 以下为id作为url参数示例
|
||||
if (route.query.id) {
|
||||
const res = await findSystemArea({ ID: route.query.id })
|
||||
if (res.code === 0) {
|
||||
formData.value = res.data.resystemArea
|
||||
type.value = 'update'
|
||||
}
|
||||
} else {
|
||||
type.value = 'create'
|
||||
}
|
||||
}
|
||||
|
||||
init()
|
||||
// 保存按钮
|
||||
const save = async() => {
|
||||
elFormRef.value?.validate( async (valid) => {
|
||||
if (!valid) return
|
||||
let res
|
||||
switch (type.value) {
|
||||
case 'create':
|
||||
res = await createSystemArea(formData.value)
|
||||
break
|
||||
case 'update':
|
||||
res = await updateSystemArea(formData.value)
|
||||
break
|
||||
default:
|
||||
res = await createSystemArea(formData.value)
|
||||
break
|
||||
}
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
message: '创建/更改成功'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 返回按钮
|
||||
const back = () => {
|
||||
router.go(-1)
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
Loading…
Reference in New Issue