41 changed files with 8118 additions and 14 deletions
@ -0,0 +1,84 @@ |
|||||||
|
import axiosApi from './AxiosApi.js' |
||||||
|
|
||||||
|
const apiList = { |
||||||
|
page: { |
||||||
|
method: 'POST', |
||||||
|
url: `/MemberTask/page` |
||||||
|
}, |
||||||
|
update: { |
||||||
|
method: 'PUT', |
||||||
|
url: `/MemberTask` |
||||||
|
}, |
||||||
|
save: { |
||||||
|
method: 'POST', |
||||||
|
url: `/MemberTask` |
||||||
|
}, |
||||||
|
delete: { |
||||||
|
method: 'DELETE', |
||||||
|
url: `/MemberTask` |
||||||
|
}, |
||||||
|
preview: { |
||||||
|
method: 'POST', |
||||||
|
url: `/MemberTask/preview` |
||||||
|
}, |
||||||
|
export: { |
||||||
|
method: 'POST', |
||||||
|
url: `/MemberTask/export` |
||||||
|
}, |
||||||
|
import: { |
||||||
|
method: 'POST', |
||||||
|
url: `/MemberTask/import` |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
export default { |
||||||
|
page(data) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.page, |
||||||
|
data |
||||||
|
}) |
||||||
|
}, |
||||||
|
query(parentId) { |
||||||
|
return axiosApi({ |
||||||
|
method: 'GET', |
||||||
|
url: `/MemberTask/${parentId}` |
||||||
|
}) |
||||||
|
}, |
||||||
|
save(data) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.save, |
||||||
|
data |
||||||
|
}) |
||||||
|
}, |
||||||
|
update(data) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.update, |
||||||
|
data |
||||||
|
}) |
||||||
|
}, |
||||||
|
delete(data) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.delete, |
||||||
|
data |
||||||
|
}) |
||||||
|
}, |
||||||
|
preview(data) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.preview, |
||||||
|
data |
||||||
|
}) |
||||||
|
}, |
||||||
|
export(data) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.export, |
||||||
|
responseType: "blob", |
||||||
|
data |
||||||
|
}) |
||||||
|
}, |
||||||
|
import(data) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.import, |
||||||
|
data |
||||||
|
}) |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,96 @@ |
|||||||
|
import axiosApi from './AxiosApi.js' |
||||||
|
|
||||||
|
const apiList = { |
||||||
|
page: { |
||||||
|
method: 'POST', |
||||||
|
url: `/store/information/page`, |
||||||
|
}, |
||||||
|
query: { |
||||||
|
method: 'POST', |
||||||
|
url: `/store/information/query`, |
||||||
|
}, |
||||||
|
update: { |
||||||
|
method: 'PUT', |
||||||
|
url: `/store/information` |
||||||
|
}, |
||||||
|
save: { |
||||||
|
method: 'POST', |
||||||
|
url: `/store/information` |
||||||
|
}, |
||||||
|
delete: { |
||||||
|
method: 'DELETE', |
||||||
|
url: `/store/information` |
||||||
|
}, |
||||||
|
export: { |
||||||
|
method: 'POST', |
||||||
|
url: `/store/information/export` |
||||||
|
}, |
||||||
|
preview: { |
||||||
|
method: 'POST', |
||||||
|
url: `/store/information/preview` |
||||||
|
}, |
||||||
|
import: { |
||||||
|
method: 'POST', |
||||||
|
url: `/store/information/import` |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
export default { |
||||||
|
page (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.page, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
query (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.query, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
save (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.save, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
update (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.update, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
delete (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.delete, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
export (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.export, |
||||||
|
responseType: "blob", |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
preview (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.preview, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
import (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.import, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,84 @@ |
|||||||
|
import axiosApi from './AxiosApi.js' |
||||||
|
|
||||||
|
const apiList = { |
||||||
|
page: { |
||||||
|
method: 'POST', |
||||||
|
url: `/memberRank/page` |
||||||
|
}, |
||||||
|
update: { |
||||||
|
method: 'PUT', |
||||||
|
url: `/memberRank` |
||||||
|
}, |
||||||
|
save: { |
||||||
|
method: 'POST', |
||||||
|
url: `/memberRank` |
||||||
|
}, |
||||||
|
delete: { |
||||||
|
method: 'DELETE', |
||||||
|
url: `/memberRank` |
||||||
|
}, |
||||||
|
preview: { |
||||||
|
method: 'POST', |
||||||
|
url: `/memberRank/preview` |
||||||
|
}, |
||||||
|
export: { |
||||||
|
method: 'POST', |
||||||
|
url: `/memberRank/export` |
||||||
|
}, |
||||||
|
import: { |
||||||
|
method: 'POST', |
||||||
|
url: `/memberRank/import` |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
export default { |
||||||
|
page(data) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.page, |
||||||
|
data |
||||||
|
}) |
||||||
|
}, |
||||||
|
query(parentId) { |
||||||
|
return axiosApi({ |
||||||
|
method: 'GET', |
||||||
|
url: `/memberRank/${parentId}` |
||||||
|
}) |
||||||
|
}, |
||||||
|
save(data) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.save, |
||||||
|
data |
||||||
|
}) |
||||||
|
}, |
||||||
|
update(data) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.update, |
||||||
|
data |
||||||
|
}) |
||||||
|
}, |
||||||
|
delete(data) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.delete, |
||||||
|
data |
||||||
|
}) |
||||||
|
}, |
||||||
|
preview(data) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.preview, |
||||||
|
data |
||||||
|
}) |
||||||
|
}, |
||||||
|
export(data) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.export, |
||||||
|
responseType: "blob", |
||||||
|
data |
||||||
|
}) |
||||||
|
}, |
||||||
|
import(data) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.import, |
||||||
|
data |
||||||
|
}) |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,76 @@ |
|||||||
|
import axiosApi from './AxiosApi.js' |
||||||
|
|
||||||
|
const apiList = { |
||||||
|
getLogistics: `/logistics/detail/page`, |
||||||
|
// addLogistics: `/logistics`,
|
||||||
|
// checkLogistics: `/logistics/detail/`,
|
||||||
|
// updateLogistics: `/logistics`,
|
||||||
|
// deleteLogistics: `/logistics`,
|
||||||
|
// getProductList: `/product/page`,
|
||||||
|
// findDefaultStore: `/store/findDefaultStore`,
|
||||||
|
// updateStore: `/store`
|
||||||
|
} |
||||||
|
|
||||||
|
export default { |
||||||
|
// updateStore(data) {
|
||||||
|
// return axiosApi({
|
||||||
|
// method: 'PUT',
|
||||||
|
// url: apiList.updateStore,
|
||||||
|
// data
|
||||||
|
// })
|
||||||
|
// },
|
||||||
|
// findDefaultStore() {
|
||||||
|
// return axiosApi({
|
||||||
|
// method: 'GET',
|
||||||
|
// url: apiList.findDefaultStore
|
||||||
|
// })
|
||||||
|
// },
|
||||||
|
getLogistics(data) { |
||||||
|
return axiosApi({ |
||||||
|
method: 'POST', |
||||||
|
url: apiList.getLogistics, |
||||||
|
data |
||||||
|
}) |
||||||
|
}, |
||||||
|
// addLogistics(data) {
|
||||||
|
// return axiosApi({
|
||||||
|
// method: 'POST',
|
||||||
|
// url: apiList.addLogistics,
|
||||||
|
// data
|
||||||
|
// })
|
||||||
|
// },
|
||||||
|
// checkLogistics(id) {
|
||||||
|
// return axiosApi({
|
||||||
|
// method: 'GET',
|
||||||
|
// url: apiList.checkLogistics + id
|
||||||
|
// })
|
||||||
|
// },
|
||||||
|
// updateLogistics(data) {
|
||||||
|
// return axiosApi({
|
||||||
|
// method: 'PUT',
|
||||||
|
// url: apiList.updateLogistics,
|
||||||
|
// data
|
||||||
|
// })
|
||||||
|
// },
|
||||||
|
// deleteLogistics(data) {
|
||||||
|
// return axiosApi({
|
||||||
|
// method: 'DELETE',
|
||||||
|
// url: apiList.deleteLogistics,
|
||||||
|
// data
|
||||||
|
// })
|
||||||
|
// },
|
||||||
|
// eidtGroup(data) {
|
||||||
|
// return axiosApi({
|
||||||
|
// method: 'PUT',
|
||||||
|
// url: apiList.productGroup,
|
||||||
|
// data
|
||||||
|
// })
|
||||||
|
// },
|
||||||
|
// deleteGroup(data) {
|
||||||
|
// return axiosApi({
|
||||||
|
// method: 'POST',
|
||||||
|
// url: apiList.deleteGroup,
|
||||||
|
// data
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
} |
@ -0,0 +1,114 @@ |
|||||||
|
import axioApi from './AxiosApi' |
||||||
|
|
||||||
|
|
||||||
|
const apiList = { |
||||||
|
ceresConfigs: '/config/getdata', |
||||||
|
printerList:'/config/printerList',
|
||||||
|
// updatePrinter:'/config/updatePrinter',
|
||||||
|
// addPrinter:'/config/addPrinter',
|
||||||
|
// delPrinter:'/config/delPrinter',
|
||||||
|
setdata:'/config/setdata', |
||||||
|
// getDeductions:'/config/getDeductionList',
|
||||||
|
// addDeduction:'/config/addDeduction',
|
||||||
|
// updateDeduction:'/config/updateDeduction',
|
||||||
|
// delDeduction:'/config/stopDeduction',
|
||||||
|
// startDeduction:'/config/startDeduction',
|
||||||
|
// getSonDeductionList:'/config/getSonDeductionList',
|
||||||
|
addConfig: '/config/addConfig', |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
export default { |
||||||
|
// getSonDeductionList(data){
|
||||||
|
// return axioApi({
|
||||||
|
// method: 'POST',
|
||||||
|
// url: apiList.getSonDeductionList,
|
||||||
|
// data
|
||||||
|
// })
|
||||||
|
// },
|
||||||
|
// delDeduction(data){
|
||||||
|
// return axioApi({
|
||||||
|
// method: 'POST',
|
||||||
|
// url: apiList.delDeduction,
|
||||||
|
// data
|
||||||
|
// })
|
||||||
|
// },
|
||||||
|
// startDeduction(data){
|
||||||
|
// return axioApi({
|
||||||
|
// method: 'POST',
|
||||||
|
// url: apiList.startDeduction,
|
||||||
|
// data
|
||||||
|
// })
|
||||||
|
// },
|
||||||
|
// updateDeduction(data){
|
||||||
|
// return axioApi({
|
||||||
|
// method: 'POST',
|
||||||
|
// url: apiList.updateDeduction,
|
||||||
|
// data
|
||||||
|
// })
|
||||||
|
// },
|
||||||
|
// addDeduction(data){
|
||||||
|
// return axioApi({
|
||||||
|
// method: 'POST',
|
||||||
|
// url: apiList.addDeduction,
|
||||||
|
// data
|
||||||
|
// })
|
||||||
|
// },
|
||||||
|
// getDeductions(data){
|
||||||
|
// return axioApi({
|
||||||
|
// method: 'POST',
|
||||||
|
// url: apiList.getDeductions,
|
||||||
|
// data
|
||||||
|
// })
|
||||||
|
// },
|
||||||
|
ceresConfigs(data){ |
||||||
|
return axioApi({ |
||||||
|
method: 'POST', |
||||||
|
url: apiList.ceresConfigs, |
||||||
|
data |
||||||
|
}) |
||||||
|
}, |
||||||
|
printerList(data){ |
||||||
|
return axioApi({ |
||||||
|
method: 'POST', |
||||||
|
url: apiList.printerList, |
||||||
|
data |
||||||
|
}) |
||||||
|
}, |
||||||
|
// updatePrinter(data){
|
||||||
|
// return axioApi({
|
||||||
|
// method: 'POST',
|
||||||
|
// url: apiList.updatePrinter,
|
||||||
|
// data
|
||||||
|
// })
|
||||||
|
// },
|
||||||
|
// addPrinter(data){
|
||||||
|
// return axioApi({
|
||||||
|
// method: 'POST',
|
||||||
|
// url: apiList.addPrinter,
|
||||||
|
// data
|
||||||
|
// })
|
||||||
|
// },
|
||||||
|
// delPrinter(data){
|
||||||
|
// return axioApi({
|
||||||
|
// method: 'POST',
|
||||||
|
// url: apiList.delPrinter,
|
||||||
|
// data
|
||||||
|
// })
|
||||||
|
// },
|
||||||
|
setdata(data){ |
||||||
|
return axioApi({ |
||||||
|
method: 'POST', |
||||||
|
url: apiList.setdata, |
||||||
|
data |
||||||
|
}) |
||||||
|
}, |
||||||
|
addConfig(data) { |
||||||
|
return axioApi({ |
||||||
|
method: 'POST', |
||||||
|
url: apiList.addConfig, |
||||||
|
data |
||||||
|
}) |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,96 @@ |
|||||||
|
import axiosApi from '../AxiosApi.js' |
||||||
|
|
||||||
|
const apiList = { |
||||||
|
page: { |
||||||
|
method: 'POST', |
||||||
|
url: `/creditGoods/page`, |
||||||
|
}, |
||||||
|
query: { |
||||||
|
method: 'POST', |
||||||
|
url: `/creditGoods/query`, |
||||||
|
}, |
||||||
|
update: { |
||||||
|
method: 'PUT', |
||||||
|
url: `/creditGoods` |
||||||
|
}, |
||||||
|
save: { |
||||||
|
method: 'POST', |
||||||
|
url: `/creditGoods` |
||||||
|
}, |
||||||
|
delete: { |
||||||
|
method: 'DELETE', |
||||||
|
url: `/creditGoods` |
||||||
|
}, |
||||||
|
export: { |
||||||
|
method: 'POST', |
||||||
|
url: `/creditGoods/export` |
||||||
|
}, |
||||||
|
preview: { |
||||||
|
method: 'POST', |
||||||
|
url: `/creditGoods/preview` |
||||||
|
}, |
||||||
|
import: { |
||||||
|
method: 'POST', |
||||||
|
url: `/creditGoods/import` |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
export default { |
||||||
|
page (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.page, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
query (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.query, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
save (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.save, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
update (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.update, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
delete (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.delete, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
export (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.export, |
||||||
|
responseType: "blob", |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
preview (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.preview, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
import (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.import, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,96 @@ |
|||||||
|
import axiosApi from '../AxiosApi.js' |
||||||
|
|
||||||
|
const apiList = { |
||||||
|
page: { |
||||||
|
method: 'POST', |
||||||
|
url: `/creditGoodsCategory/page`, |
||||||
|
}, |
||||||
|
query: { |
||||||
|
method: 'POST', |
||||||
|
url: `/creditGoodsCategory/query`, |
||||||
|
}, |
||||||
|
update: { |
||||||
|
method: 'PUT', |
||||||
|
url: `/creditGoodsCategory` |
||||||
|
}, |
||||||
|
save: { |
||||||
|
method: 'POST', |
||||||
|
url: `/creditGoodsCategory` |
||||||
|
}, |
||||||
|
delete: { |
||||||
|
method: 'DELETE', |
||||||
|
url: `/creditGoodsCategory` |
||||||
|
}, |
||||||
|
export: { |
||||||
|
method: 'POST', |
||||||
|
url: `/creditGoodsCategory/export` |
||||||
|
}, |
||||||
|
preview: { |
||||||
|
method: 'POST', |
||||||
|
url: `/creditGoodsCategory/preview` |
||||||
|
}, |
||||||
|
import: { |
||||||
|
method: 'POST', |
||||||
|
url: `/creditGoodsCategory/import` |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
export default { |
||||||
|
page (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.page, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
query (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.query, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
save (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.save, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
update (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.update, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
delete (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.delete, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
export (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.export, |
||||||
|
responseType: "blob", |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
preview (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.preview, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
import (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.import, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,96 @@ |
|||||||
|
import axiosApi from '../AxiosApi.js' |
||||||
|
|
||||||
|
const apiList = { |
||||||
|
page: { |
||||||
|
method: 'POST', |
||||||
|
url: `/store/creditGoodsImg/page`, |
||||||
|
}, |
||||||
|
query: { |
||||||
|
method: 'POST', |
||||||
|
url: `/store/creditGoodsImg/query`, |
||||||
|
}, |
||||||
|
update: { |
||||||
|
method: 'PUT', |
||||||
|
url: `/store/creditGoodsImg` |
||||||
|
}, |
||||||
|
save: { |
||||||
|
method: 'POST', |
||||||
|
url: `/store/creditGoodsImg` |
||||||
|
}, |
||||||
|
delete: { |
||||||
|
method: 'DELETE', |
||||||
|
url: `/store/creditGoodsImg` |
||||||
|
}, |
||||||
|
export: { |
||||||
|
method: 'POST', |
||||||
|
url: `/store/creditGoodsImg/export` |
||||||
|
}, |
||||||
|
preview: { |
||||||
|
method: 'POST', |
||||||
|
url: `/store/creditGoodsImg/preview` |
||||||
|
}, |
||||||
|
import: { |
||||||
|
method: 'POST', |
||||||
|
url: `/store/creditGoodsImg/import` |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
export default { |
||||||
|
page (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.page, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
query (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.query, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
save (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.save, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
update (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.update, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
delete (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.delete, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
export (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.export, |
||||||
|
responseType: "blob", |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
preview (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.preview, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
import (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.import, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,96 @@ |
|||||||
|
import axiosApi from '../AxiosApi.js' |
||||||
|
|
||||||
|
const apiList = { |
||||||
|
page: { |
||||||
|
method: 'POST', |
||||||
|
url: `/creditOrder/page`, |
||||||
|
}, |
||||||
|
query: { |
||||||
|
method: 'POST', |
||||||
|
url: `/creditOrder/query`, |
||||||
|
}, |
||||||
|
update: { |
||||||
|
method: 'PUT', |
||||||
|
url: `/creditOrder` |
||||||
|
}, |
||||||
|
save: { |
||||||
|
method: 'POST', |
||||||
|
url: `/creditOrder` |
||||||
|
}, |
||||||
|
delete: { |
||||||
|
method: 'DELETE', |
||||||
|
url: `/creditOrder` |
||||||
|
}, |
||||||
|
export: { |
||||||
|
method: 'POST', |
||||||
|
url: `/creditOrder/export` |
||||||
|
}, |
||||||
|
preview: { |
||||||
|
method: 'POST', |
||||||
|
url: `/creditOrder/preview` |
||||||
|
}, |
||||||
|
import: { |
||||||
|
method: 'POST', |
||||||
|
url: `/creditOrder/import` |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
export default { |
||||||
|
page (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.page, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
query (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.query, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
save (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.save, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
update (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.update, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
delete (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.delete, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
export (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.export, |
||||||
|
responseType: "blob", |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
preview (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.preview, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
import (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.import, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,96 @@ |
|||||||
|
import axiosApi from '../AxiosApi.js' |
||||||
|
|
||||||
|
const apiList = { |
||||||
|
page: { |
||||||
|
method: 'POST', |
||||||
|
url: `/store/creditOrderDelivery/page`, |
||||||
|
}, |
||||||
|
query: { |
||||||
|
method: 'POST', |
||||||
|
url: `/store/creditOrderDelivery/query`, |
||||||
|
}, |
||||||
|
update: { |
||||||
|
method: 'PUT', |
||||||
|
url: `/store/creditOrderDelivery` |
||||||
|
}, |
||||||
|
save: { |
||||||
|
method: 'POST', |
||||||
|
url: `/store/creditOrderDelivery` |
||||||
|
}, |
||||||
|
delete: { |
||||||
|
method: 'DELETE', |
||||||
|
url: `/store/creditOrderDelivery` |
||||||
|
}, |
||||||
|
export: { |
||||||
|
method: 'POST', |
||||||
|
url: `/store/creditOrderDelivery/export` |
||||||
|
}, |
||||||
|
preview: { |
||||||
|
method: 'POST', |
||||||
|
url: `/store/creditOrderDelivery/preview` |
||||||
|
}, |
||||||
|
import: { |
||||||
|
method: 'POST', |
||||||
|
url: `/store/creditOrderDelivery/import` |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
export default { |
||||||
|
page (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.page, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
query (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.query, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
save (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.save, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
update (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.update, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
delete (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.delete, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
export (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.export, |
||||||
|
responseType: "blob", |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
preview (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.preview, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
import (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.import, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,96 @@ |
|||||||
|
import axiosApi from '../AxiosApi.js' |
||||||
|
|
||||||
|
const apiList = { |
||||||
|
page: { |
||||||
|
method: 'POST', |
||||||
|
url: `/store/creditOrderDetail/page`, |
||||||
|
}, |
||||||
|
query: { |
||||||
|
method: 'POST', |
||||||
|
url: `/store/creditOrderDetail/query`, |
||||||
|
}, |
||||||
|
update: { |
||||||
|
method: 'PUT', |
||||||
|
url: `/store/creditOrderDetail` |
||||||
|
}, |
||||||
|
save: { |
||||||
|
method: 'POST', |
||||||
|
url: `/store/creditOrderDetail` |
||||||
|
}, |
||||||
|
delete: { |
||||||
|
method: 'DELETE', |
||||||
|
url: `/store/creditOrderDetail` |
||||||
|
}, |
||||||
|
export: { |
||||||
|
method: 'POST', |
||||||
|
url: `/store/creditOrderDetail/export` |
||||||
|
}, |
||||||
|
preview: { |
||||||
|
method: 'POST', |
||||||
|
url: `/store/creditOrderDetail/preview` |
||||||
|
}, |
||||||
|
import: { |
||||||
|
method: 'POST', |
||||||
|
url: `/store/creditOrderDetail/import` |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
export default { |
||||||
|
page (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.page, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
query (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.query, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
save (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.save, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
update (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.update, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
delete (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.delete, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
export (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.export, |
||||||
|
responseType: "blob", |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
preview (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.preview, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
}, |
||||||
|
import (data, custom = {}) { |
||||||
|
return axiosApi({ |
||||||
|
...apiList.import, |
||||||
|
data, |
||||||
|
custom |
||||||
|
}) |
||||||
|
} |
||||||
|
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,233 @@ |
|||||||
|
<template> |
||||||
|
<el-dialog :close-on-click-modal="false" :close-on-press-escape="true" :title="title" :type="type" |
||||||
|
:visible.sync="isVisible" :width="width" top="50px" v-el-drag-dialog> |
||||||
|
<el-form :model="creditGoods" :rules="rules" label-position="right" label-width="100px" ref="form"> |
||||||
|
<el-form-item :label="$t('table.creditGoods.categoryId')" prop="categoryId"> |
||||||
|
<el-input type="" v-model="creditGoods.categoryId" placeholder="分类ID"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditGoods.name')" prop="name"> |
||||||
|
<el-input type="" v-model="creditGoods.name" placeholder="商品名"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditGoods.mainImgPath')" prop="imgPath"> |
||||||
|
<el-input type="" v-model="creditGoods.mainImgPath" placeholder="图片路径"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditGoods.viceImgPaths')" prop="imgPath"> |
||||||
|
<el-input type="" v-model="creditGoods.viceImgPaths" placeholder="图片路径"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditGoods.description')" prop="description"> |
||||||
|
<el-input type="" v-model="creditGoods.description" placeholder="描述"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditGoods.worth')" prop="worth"> |
||||||
|
<el-input type="" v-model="creditGoods.worth" placeholder="价值(人民币)"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditGoods.price')" prop="price"> |
||||||
|
<el-input type="" v-model="creditGoods.price" placeholder="价格(积分)"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditGoods.stock')" prop="stock"> |
||||||
|
<el-input type="" v-model="creditGoods.stock" placeholder="库存"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditGoods.sales')" prop="sales"> |
||||||
|
<el-input type="" v-model="creditGoods.sales" placeholder="销量"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditGoods.isHot')" prop="isHot"> |
||||||
|
<el-radio-group v-model="creditGoods.isHot" size="medium"> |
||||||
|
<el-radio-button :label="true">{{ $t("common.yes") }}</el-radio-button> |
||||||
|
<el-radio-button :label="false">{{ $t("common.no") }}</el-radio-button> |
||||||
|
</el-radio-group> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditGoods.couponId')" prop="couponId"> |
||||||
|
<el-input type="" v-model="creditGoods.couponId" placeholder="优惠券ID(如果该值大于0,则购买之后赠送相应的优惠券)"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditGoods.canPick')" prop="canPick"> |
||||||
|
<el-radio-group v-model="creditGoods.canPick" size="medium"> |
||||||
|
<el-radio-button :label="true">{{ $t("common.yes") }}</el-radio-button> |
||||||
|
<el-radio-button :label="false">{{ $t("common.no") }}</el-radio-button> |
||||||
|
</el-radio-group> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditGoods.canDelivery')" prop="canDelivery"> |
||||||
|
<el-radio-group v-model="creditGoods.canDelivery" size="medium"> |
||||||
|
<el-radio-button :label="true">{{ $t("common.yes") }}</el-radio-button> |
||||||
|
<el-radio-button :label="false">{{ $t("common.no") }}</el-radio-button> |
||||||
|
</el-radio-group> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditGoods.sortOrder')" prop="sortOrder"> |
||||||
|
<el-input type="" v-model="creditGoods.sortOrder" placeholder="显示顺序"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditGoods.state')" prop="state"> |
||||||
|
<el-input type="" v-model="creditGoods.state" placeholder="状态:1-上架,0-下架"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditGoods.isDelete')" prop="isDelete"> |
||||||
|
<el-input type="" v-model="creditGoods.isDelete" placeholder="逻辑删除:1-删除 0-未删除"/> |
||||||
|
</el-form-item> |
||||||
|
</el-form> |
||||||
|
<div class="dialog-footer" slot="footer"> |
||||||
|
<el-button @click="isVisible = false" plain type="warning"> |
||||||
|
{{ $t("common.cancel") }} |
||||||
|
</el-button> |
||||||
|
<el-button @click="submitForm" :disabled="confirmDisabled" plain type="primary"> |
||||||
|
{{ $t("common.confirm") }} |
||||||
|
</el-button> |
||||||
|
</div> |
||||||
|
</el-dialog> |
||||||
|
</template> |
||||||
|
<script> |
||||||
|
import elDragDialog from '@/directive/el-drag-dialog' |
||||||
|
import creditGoodsApi from "@/api/creditGoods/CreditGoods.js"; |
||||||
|
|
||||||
|
export default { |
||||||
|
name: "CreditGoodsEdit", |
||||||
|
directives: { elDragDialog }, |
||||||
|
components: { }, |
||||||
|
props: { |
||||||
|
dialogVisible: { |
||||||
|
type: Boolean, |
||||||
|
default: false |
||||||
|
}, |
||||||
|
type: { |
||||||
|
type: String, |
||||||
|
default: "add" |
||||||
|
} |
||||||
|
}, |
||||||
|
data() { |
||||||
|
return { |
||||||
|
confirmDisabled: false, |
||||||
|
creditGoods: this.initCreditGoods(), |
||||||
|
screenWidth: 0, |
||||||
|
width: this.initWidth(), |
||||||
|
rules: { |
||||||
|
|
||||||
|
}, |
||||||
|
// 枚举 |
||||||
|
enums: { |
||||||
|
}, |
||||||
|
// 字典 |
||||||
|
dicts: { |
||||||
|
} |
||||||
|
}; |
||||||
|
}, |
||||||
|
computed: { |
||||||
|
isVisible: { |
||||||
|
get() { |
||||||
|
return this.dialogVisible; |
||||||
|
}, |
||||||
|
set() { |
||||||
|
this.close(); |
||||||
|
this.reset(); |
||||||
|
} |
||||||
|
}, |
||||||
|
title() { |
||||||
|
return this.$t("common." + this.type); |
||||||
|
} |
||||||
|
}, |
||||||
|
watch: {}, |
||||||
|
mounted() { |
||||||
|
window.onresize = () => { |
||||||
|
return (() => { |
||||||
|
this.width = this.initWidth(); |
||||||
|
})(); |
||||||
|
}; |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
initCreditGoods() { |
||||||
|
return { |
||||||
|
id: "", |
||||||
|
categoryId: null, |
||||||
|
name: '', |
||||||
|
mainImgPath: '', |
||||||
|
viceImgPaths: [], |
||||||
|
description: '', |
||||||
|
worth: null, |
||||||
|
price: null, |
||||||
|
stock: null, |
||||||
|
sales: null, |
||||||
|
isHot: true, |
||||||
|
couponId: null, // 如果该值大于0,则购买之后赠送相应的优惠券 |
||||||
|
canPick: true, |
||||||
|
canDelivery: true, |
||||||
|
sortOrder: null, |
||||||
|
state: null, // 1-上架,0-下架 |
||||||
|
isDelete: null, // 1-删除 0-未删除 |
||||||
|
}; |
||||||
|
}, |
||||||
|
initWidth() { |
||||||
|
this.screenWidth = document.body.clientWidth; |
||||||
|
if (this.screenWidth < 991) { |
||||||
|
return "90%"; |
||||||
|
} else if (this.screenWidth < 1400) { |
||||||
|
return "45%"; |
||||||
|
} else { |
||||||
|
return "800px"; |
||||||
|
} |
||||||
|
}, |
||||||
|
setCreditGoods(val = {}) { |
||||||
|
const vm = this; |
||||||
|
|
||||||
|
vm.dicts = val['dicts']; |
||||||
|
vm.enums = val['enums']; |
||||||
|
if (val['row']) { |
||||||
|
vm.creditGoods = { ...val['row'] }; |
||||||
|
|
||||||
|
} |
||||||
|
}, |
||||||
|
close() { |
||||||
|
this.$emit("close"); |
||||||
|
}, |
||||||
|
reset() { |
||||||
|
// 先清除校验,再清除表单,不然有奇怪的bug |
||||||
|
this.$refs.form.clearValidate(); |
||||||
|
this.$refs.form.resetFields(); |
||||||
|
this.confirmDisabled = false; |
||||||
|
this.creditGoods = this.initCreditGoods(); |
||||||
|
}, |
||||||
|
submitForm() { |
||||||
|
const vm = this; |
||||||
|
this.$refs.form.validate(valid => { |
||||||
|
if (valid) { |
||||||
|
vm.editSubmit(); |
||||||
|
} else { |
||||||
|
return false; |
||||||
|
} |
||||||
|
}); |
||||||
|
}, |
||||||
|
editSubmit() { |
||||||
|
const vm = this; |
||||||
|
if (vm.type === "edit") { |
||||||
|
vm.update(); |
||||||
|
} else { |
||||||
|
vm.save(); |
||||||
|
} |
||||||
|
}, |
||||||
|
save() { |
||||||
|
const vm = this; |
||||||
|
vm.confirmDisabled = true; |
||||||
|
creditGoodsApi.save(this.creditGoods).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
vm.isVisible = false; |
||||||
|
vm.$message({ |
||||||
|
message: vm.$t("tips.createSuccess"), |
||||||
|
type: "success" |
||||||
|
}); |
||||||
|
vm.$emit("success"); |
||||||
|
} |
||||||
|
}).finally(()=> vm.confirmDisabled = false); |
||||||
|
}, |
||||||
|
update() { |
||||||
|
const vm = this; |
||||||
|
vm.confirmDisabled = true; |
||||||
|
creditGoodsApi.update(this.creditGoods).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
vm.isVisible = false; |
||||||
|
vm.$message({ |
||||||
|
message: this.$t("tips.updateSuccess"), |
||||||
|
type: "success" |
||||||
|
}); |
||||||
|
vm.$emit("success"); |
||||||
|
} |
||||||
|
}).finally(()=> vm.confirmDisabled = false); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
</script> |
||||||
|
<style lang="scss" scoped></style> |
@ -0,0 +1,418 @@ |
|||||||
|
<template> |
||||||
|
<div class="app-container"> |
||||||
|
<div class="filter-container"> |
||||||
|
<el-input |
||||||
|
:placeholder="$t('table.creditGoods.name')" |
||||||
|
class="filter-item search-item" |
||||||
|
v-model="queryParams.model.name" |
||||||
|
/> |
||||||
|
<el-input |
||||||
|
:placeholder="$t('table.creditGoods.description')" |
||||||
|
class="filter-item search-item" |
||||||
|
v-model="queryParams.model.description" |
||||||
|
/> |
||||||
|
|
||||||
|
<el-date-picker :range-separator="null" class="filter-item search-item date-range-item" |
||||||
|
end-placeholder="结束日期" format="yyyy-MM-dd HH:mm:ss" start-placeholder="开始日期" |
||||||
|
type="daterange" v-model="queryParams.timeRange" value-format="yyyy-MM-dd HH:mm:ss" |
||||||
|
/> |
||||||
|
<el-button @click="search" class="filter-item" plain type="primary"> |
||||||
|
{{ $t("table.search") }} |
||||||
|
</el-button> |
||||||
|
<el-button @click="reset" class="filter-item" plain type="warning"> |
||||||
|
{{ $t("table.reset") }} |
||||||
|
</el-button> |
||||||
|
<el-button @click="add" class="filter-item" plain type="danger" v-has-permission="['creditGoods:add']"> |
||||||
|
{{ $t("table.add") }} |
||||||
|
</el-button> |
||||||
|
<el-dropdown class="filter-item" trigger="click" v-has-any-permission="['creditGoods:delete', 'creditGoods:export', |
||||||
|
'creditGoods:import']"> |
||||||
|
<el-button> |
||||||
|
{{ $t("table.more") }}<i class="el-icon-arrow-down el-icon--right" /> |
||||||
|
</el-button> |
||||||
|
<el-dropdown-menu slot="dropdown"> |
||||||
|
<el-dropdown-item @click.native="batchDelete" v-has-permission="['creditGoods:delete']"> |
||||||
|
{{ $t("table.delete") }} |
||||||
|
</el-dropdown-item> |
||||||
|
<el-dropdown-item @click.native="exportExcel" v-has-permission="['creditGoods:export']"> |
||||||
|
{{ $t("table.export") }} |
||||||
|
</el-dropdown-item> |
||||||
|
<el-dropdown-item @click.native="exportExcelPreview" v-has-permission="['creditGoods:export']"> |
||||||
|
{{ $t("table.exportPreview") }} |
||||||
|
</el-dropdown-item> |
||||||
|
<el-dropdown-item @click.native="importExcel" v-has-permission="['creditGoods:import']"> |
||||||
|
{{ $t("table.import") }} |
||||||
|
</el-dropdown-item> |
||||||
|
</el-dropdown-menu> |
||||||
|
</el-dropdown> |
||||||
|
</div> |
||||||
|
|
||||||
|
<el-table :data="tableData.records" :key="tableKey" @cell-click="cellClick" |
||||||
|
@filter-change="filterChange" @selection-change="onSelectChange" @sort-change="sortChange" |
||||||
|
border fit row-key="id" ref="table" style="width: 100%;" v-loading="loading"> |
||||||
|
<el-table-column align="center" type="selection" width="40px" :reserve-selection="true"/> |
||||||
|
<el-table-column :label="$t('table.creditGoods.categoryId')" :show-overflow-tooltip="true" align="center" prop="categoryId" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.categoryId }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditGoods.name')" :show-overflow-tooltip="true" align="center" prop="name" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.name }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditGoods.description')" :show-overflow-tooltip="true" align="center" prop="description" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.description }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditGoods.worth')" :show-overflow-tooltip="true" align="center" prop="worth" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.worth }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditGoods.price')" :show-overflow-tooltip="true" align="center" prop="price" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.price }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditGoods.stock')" :show-overflow-tooltip="true" align="center" prop="stock" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.stock }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditGoods.sales')" :show-overflow-tooltip="true" align="center" prop="sales" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.sales }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditGoods.isHot')" :show-overflow-tooltip="true" align="center" prop="isHot" |
||||||
|
:filter-multiple="false" column-key="isHot" |
||||||
|
:filters="[{ text: $t('common.yes'), value: 'true' }, { text: $t('common.no'), value: 'false' }]" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<el-tag :type="scope.row.isHot ? 'success' : 'danger'" slot> |
||||||
|
{{ scope.row.isHot ? $t("common.yes") : $t("common.no") }} |
||||||
|
</el-tag> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditGoods.couponId')" :show-overflow-tooltip="true" align="center" prop="couponId" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.couponId }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditGoods.canPick')" :show-overflow-tooltip="true" align="center" prop="canPick" |
||||||
|
:filter-multiple="false" column-key="canPick" |
||||||
|
:filters="[{ text: $t('common.yes'), value: 'true' }, { text: $t('common.no'), value: 'false' }]" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<el-tag :type="scope.row.canPick ? 'success' : 'danger'" slot> |
||||||
|
{{ scope.row.canPick ? $t("common.yes") : $t("common.no") }} |
||||||
|
</el-tag> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditGoods.canDelivery')" :show-overflow-tooltip="true" align="center" prop="canDelivery" |
||||||
|
:filter-multiple="false" column-key="canDelivery" |
||||||
|
:filters="[{ text: $t('common.yes'), value: 'true' }, { text: $t('common.no'), value: 'false' }]" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<el-tag :type="scope.row.canDelivery ? 'success' : 'danger'" slot> |
||||||
|
{{ scope.row.canDelivery ? $t("common.yes") : $t("common.no") }} |
||||||
|
</el-tag> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditGoods.sortOrder')" :show-overflow-tooltip="true" align="center" prop="sortOrder" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.sortOrder }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditGoods.state')" :show-overflow-tooltip="true" align="center" prop="state" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.state }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditGoods.isDelete')" :show-overflow-tooltip="true" align="center" prop="isDelete" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.isDelete }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column |
||||||
|
:label="$t('table.createTime')" |
||||||
|
align="center" |
||||||
|
prop="createTime" |
||||||
|
sortable="custom" |
||||||
|
width="170px"> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.createTime }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column |
||||||
|
:label="$t('table.operation')" align="center" column-key="operation" class-name="small-padding fixed-width" width="100px"> |
||||||
|
<template slot-scope="{ row }"> |
||||||
|
<i @click="copy(row)" class="el-icon-copy-document table-operation" :title="$t('common.delete')" |
||||||
|
style="color: #2db7f5;" v-hasPermission="['creditGoods:add']"/> |
||||||
|
<i @click="edit(row)" class="el-icon-edit table-operation" :title="$t('common.delete')" |
||||||
|
style="color: #2db7f5;" v-hasPermission="['creditGoods:update']"/> |
||||||
|
<i @click="singleDelete(row)" class="el-icon-delete table-operation" :title="$t('common.delete')" |
||||||
|
style="color: #f50;" v-hasPermission="['creditGoods:delete']"/> |
||||||
|
<el-link class="no-perm" v-has-no-permission="['creditGoods:update', 'creditGoods:copy', 'creditGoods:delete']"> |
||||||
|
{{ $t("tips.noPermission") }} |
||||||
|
</el-link> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
</el-table> |
||||||
|
<pagination :limit.sync="queryParams.size" :page.sync="queryParams.current" |
||||||
|
:total="Number(tableData.total)" @pagination="fetch" v-show="tableData.total > 0"/> |
||||||
|
<creditGoods-edit :dialog-visible="dialog.isVisible" :type="dialog.type" |
||||||
|
@close="editClose" @success="editSuccess" ref="edit"/> |
||||||
|
<creditGoods-import ref="import" :dialog-visible="fileImport.isVisible" :type="fileImport.type" |
||||||
|
:action="fileImport.action" accept=".xls,.xlsx" @close="importClose" @success="importSuccess" /> |
||||||
|
<el-dialog :close-on-click-modal="false" :close-on-press-escape="true" |
||||||
|
title="预览" width="80%" top="50px" :visible.sync="preview.isVisible" v-el-drag-dialog> |
||||||
|
<el-scrollbar> |
||||||
|
<div v-html="preview.context"></div> |
||||||
|
</el-scrollbar> |
||||||
|
</el-dialog> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
import Pagination from "@/components/Pagination"; |
||||||
|
import elDragDialog from '@/directive/el-drag-dialog' |
||||||
|
import CreditGoodsEdit from "./Edit"; |
||||||
|
import creditGoodsApi from "@/api/creditGoods/CreditGoods.js"; |
||||||
|
import CreditGoodsImport from "@/components/ceres/Import" |
||||||
|
import {convertEnum} from '@/utils/utils' |
||||||
|
import {downloadFile, loadEnums, initDicts, initQueryParams} from '@/utils/commons' |
||||||
|
|
||||||
|
export default { |
||||||
|
name: "CreditGoodsManage", |
||||||
|
directives: { elDragDialog }, |
||||||
|
components: { Pagination, CreditGoodsEdit, CreditGoodsImport}, |
||||||
|
filters: { |
||||||
|
|
||||||
|
}, |
||||||
|
data() { |
||||||
|
return { |
||||||
|
// 编辑 |
||||||
|
dialog: { |
||||||
|
isVisible: false, |
||||||
|
type: "add" |
||||||
|
}, |
||||||
|
// 预览 |
||||||
|
preview: { |
||||||
|
isVisible: false, |
||||||
|
context: '' |
||||||
|
}, |
||||||
|
// 导入 |
||||||
|
fileImport: { |
||||||
|
isVisible: false, |
||||||
|
type: "import", |
||||||
|
action: `${process.env.VUE_APP_BASE_API}/creditGoods/import` |
||||||
|
// action: `${process.env.VUE_APP_BASE_API}/store/creditGoods/import` |
||||||
|
}, |
||||||
|
tableKey: 0, |
||||||
|
queryParams: initQueryParams(), |
||||||
|
selection: [], |
||||||
|
loading: false, |
||||||
|
tableData: { |
||||||
|
total: 0 |
||||||
|
}, |
||||||
|
// 枚举 |
||||||
|
enums: { |
||||||
|
}, |
||||||
|
// 字典 |
||||||
|
dicts: { |
||||||
|
} |
||||||
|
}; |
||||||
|
}, |
||||||
|
computed: { |
||||||
|
}, |
||||||
|
watch: { |
||||||
|
}, |
||||||
|
mounted() { |
||||||
|
this.fetch(); |
||||||
|
|
||||||
|
// 初始化字典和枚举 |
||||||
|
const enumList = []; |
||||||
|
const dictList = []; |
||||||
|
loadEnums(enumList, this.enums, 'store'); |
||||||
|
initDicts(dictList, this.dicts); |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
editClose() { |
||||||
|
this.dialog.isVisible = false; |
||||||
|
}, |
||||||
|
editSuccess() { |
||||||
|
this.search(); |
||||||
|
}, |
||||||
|
onSelectChange(selection) { |
||||||
|
this.selection = selection; |
||||||
|
}, |
||||||
|
search() { |
||||||
|
this.fetch({ |
||||||
|
...this.queryParams |
||||||
|
}); |
||||||
|
}, |
||||||
|
reset() { |
||||||
|
this.queryParams = initQueryParams(); |
||||||
|
this.$refs.table.clearSort(); |
||||||
|
this.$refs.table.clearFilter(); |
||||||
|
this.search(); |
||||||
|
}, |
||||||
|
exportExcelPreview() { |
||||||
|
if (this.queryParams.timeRange) { |
||||||
|
this.queryParams.map.createTime_st = this.queryParams.timeRange[0]; |
||||||
|
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1]; |
||||||
|
} |
||||||
|
this.queryParams.map.fileName = '导出数据'; |
||||||
|
creditGoodsApi.preview(this.queryParams).then(response => { |
||||||
|
const res = response.data; |
||||||
|
this.preview.isVisible = true; |
||||||
|
this.preview.context = res.data; |
||||||
|
}); |
||||||
|
}, |
||||||
|
exportExcel() { |
||||||
|
if (this.queryParams.timeRange) { |
||||||
|
this.queryParams.map.createTime_st = this.queryParams.timeRange[0]; |
||||||
|
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1]; |
||||||
|
} |
||||||
|
this.queryParams.map.fileName = '导出数据'; |
||||||
|
creditGoodsApi.export(this.queryParams).then(response => { |
||||||
|
downloadFile(response); |
||||||
|
}); |
||||||
|
}, |
||||||
|
importExcel() { |
||||||
|
this.fileImport.type = "upload"; |
||||||
|
this.fileImport.isVisible = true; |
||||||
|
this.$refs.import.setModel(false); |
||||||
|
}, |
||||||
|
importSuccess() { |
||||||
|
this.search(); |
||||||
|
}, |
||||||
|
importClose() { |
||||||
|
this.fileImport.isVisible = false; |
||||||
|
}, |
||||||
|
singleDelete(row) { |
||||||
|
this.$refs.table.clearSelection() |
||||||
|
this.$refs.table.toggleRowSelection(row, true); |
||||||
|
this.batchDelete(); |
||||||
|
}, |
||||||
|
batchDelete() { |
||||||
|
if (!this.selection.length) { |
||||||
|
this.$message({ |
||||||
|
message: this.$t("tips.noDataSelected"), |
||||||
|
type: "warning" |
||||||
|
}); |
||||||
|
return; |
||||||
|
} |
||||||
|
this.$confirm(this.$t("tips.confirmDelete"), this.$t("common.tips"), { |
||||||
|
confirmButtonText: this.$t("common.confirm"), |
||||||
|
cancelButtonText: this.$t("common.cancel"), |
||||||
|
type: "warning" |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
const ids = this.selection.map(u => u.id); |
||||||
|
this.delete(ids); |
||||||
|
}) |
||||||
|
.catch(() => { |
||||||
|
this.clearSelections(); |
||||||
|
}); |
||||||
|
}, |
||||||
|
clearSelections() { |
||||||
|
this.$refs.table.clearSelection(); |
||||||
|
}, |
||||||
|
delete(ids) { |
||||||
|
creditGoodsApi.delete({ ids: ids }).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
this.$message({ |
||||||
|
message: this.$t("tips.deleteSuccess"), |
||||||
|
type: "success" |
||||||
|
}); |
||||||
|
this.search(); |
||||||
|
} |
||||||
|
}); |
||||||
|
}, |
||||||
|
add() { |
||||||
|
this.dialog.type = "add"; |
||||||
|
this.dialog.isVisible = true; |
||||||
|
this.$refs.edit.setCreditGoods({ enums: this.enums, dicts: this.dicts}); |
||||||
|
}, |
||||||
|
copy(row) { |
||||||
|
this.$refs.edit.setCreditGoods({row, enums: this.enums, dicts: this.dicts}); |
||||||
|
this.dialog.type = "copy"; |
||||||
|
this.dialog.isVisible = true; |
||||||
|
}, |
||||||
|
edit(row) { |
||||||
|
this.$refs.edit.setCreditGoods({row, enums: this.enums, dicts: this.dicts}); |
||||||
|
this.dialog.type = "edit"; |
||||||
|
this.dialog.isVisible = true; |
||||||
|
}, |
||||||
|
fetch(params = {}) { |
||||||
|
this.loading = true; |
||||||
|
if (this.queryParams.timeRange) { |
||||||
|
this.queryParams.map.createTime_st = this.queryParams.timeRange[0]; |
||||||
|
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1]; |
||||||
|
} |
||||||
|
|
||||||
|
this.queryParams.current = params.current ? params.current : this.queryParams.current; |
||||||
|
this.queryParams.size = params.size ? params.size : this.queryParams.size; |
||||||
|
|
||||||
|
creditGoodsApi.page(this.queryParams).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
this.tableData = res.data; |
||||||
|
} |
||||||
|
}).finally(() => this.loading = false); |
||||||
|
}, |
||||||
|
sortChange(val) { |
||||||
|
this.queryParams.sort = val.prop; |
||||||
|
this.queryParams.order = val.order; |
||||||
|
if (this.queryParams.sort) { |
||||||
|
this.search(); |
||||||
|
} |
||||||
|
}, |
||||||
|
filterChange (filters) { |
||||||
|
for (const key in filters) { |
||||||
|
if(key.includes('.')) { |
||||||
|
const val = { }; |
||||||
|
val[key.split('.')[1]] = filters[key][0]; |
||||||
|
this.queryParams.model[key.split('.')[0]] = val; |
||||||
|
} else { |
||||||
|
this.queryParams.model[key] = filters[key][0] |
||||||
|
} |
||||||
|
} |
||||||
|
this.search() |
||||||
|
}, |
||||||
|
cellClick (row, column) { |
||||||
|
if (column['columnKey'] === "operation") { |
||||||
|
return; |
||||||
|
} |
||||||
|
let flag = false; |
||||||
|
this.selection.forEach((item)=>{ |
||||||
|
if(item.id === row.id) { |
||||||
|
flag = true; |
||||||
|
this.$refs.table.toggleRowSelection(row); |
||||||
|
} |
||||||
|
}) |
||||||
|
|
||||||
|
if(!flag){ |
||||||
|
this.$refs.table.toggleRowSelection(row, true); |
||||||
|
} |
||||||
|
}, |
||||||
|
} |
||||||
|
}; |
||||||
|
</script> |
||||||
|
<style lang="scss" scoped></style> |
@ -0,0 +1,181 @@ |
|||||||
|
<template> |
||||||
|
<el-dialog :close-on-click-modal="false" :close-on-press-escape="true" :title="title" :type="type" |
||||||
|
:visible.sync="isVisible" :width="width" top="50px" v-el-drag-dialog> |
||||||
|
<el-form :model="creditGoodsCategory" :rules="rules" label-position="right" label-width="100px" ref="form"> |
||||||
|
<el-form-item :label="$t('table.creditGoodsCategory.parentId')" prop="parentId"> |
||||||
|
<el-input type="" v-model="creditGoodsCategory.parentId" placeholder="父分类ID"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditGoodsCategory.name')" prop="name"> |
||||||
|
<el-input type="" v-model="creditGoodsCategory.name" placeholder="分类名"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditGoodsCategory.miniShow')" prop="miniShow"> |
||||||
|
<el-input type="" v-model="creditGoodsCategory.miniShow" placeholder="小程序是否显示:1-显示,0-不显示"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditGoodsCategory.sortOrder')" prop="sortOrder"> |
||||||
|
<el-input type="" v-model="creditGoodsCategory.sortOrder" placeholder="显示顺序"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditGoodsCategory.isDelete')" prop="isDelete"> |
||||||
|
<el-input type="" v-model="creditGoodsCategory.isDelete" placeholder="逻辑删除:1-删除 0-未删除"/> |
||||||
|
</el-form-item> |
||||||
|
</el-form> |
||||||
|
<div class="dialog-footer" slot="footer"> |
||||||
|
<el-button @click="isVisible = false" plain type="warning"> |
||||||
|
{{ $t("common.cancel") }} |
||||||
|
</el-button> |
||||||
|
<el-button @click="submitForm" :disabled="confirmDisabled" plain type="primary"> |
||||||
|
{{ $t("common.confirm") }} |
||||||
|
</el-button> |
||||||
|
</div> |
||||||
|
</el-dialog> |
||||||
|
</template> |
||||||
|
<script> |
||||||
|
import elDragDialog from '@/directive/el-drag-dialog' |
||||||
|
import creditGoodsCategoryApi from "@/api/creditGoods/CreditGoodsCategory.js"; |
||||||
|
|
||||||
|
export default { |
||||||
|
name: "CreditGoodsCategoryEdit", |
||||||
|
directives: { elDragDialog }, |
||||||
|
components: { }, |
||||||
|
props: { |
||||||
|
dialogVisible: { |
||||||
|
type: Boolean, |
||||||
|
default: false |
||||||
|
}, |
||||||
|
type: { |
||||||
|
type: String, |
||||||
|
default: "add" |
||||||
|
} |
||||||
|
}, |
||||||
|
data() { |
||||||
|
return { |
||||||
|
confirmDisabled: false, |
||||||
|
creditGoodsCategory: this.initCreditGoodsCategory(), |
||||||
|
screenWidth: 0, |
||||||
|
width: this.initWidth(), |
||||||
|
rules: { |
||||||
|
|
||||||
|
}, |
||||||
|
// 枚举 |
||||||
|
enums: { |
||||||
|
}, |
||||||
|
// 字典 |
||||||
|
dicts: { |
||||||
|
} |
||||||
|
}; |
||||||
|
}, |
||||||
|
computed: { |
||||||
|
isVisible: { |
||||||
|
get() { |
||||||
|
return this.dialogVisible; |
||||||
|
}, |
||||||
|
set() { |
||||||
|
this.close(); |
||||||
|
this.reset(); |
||||||
|
} |
||||||
|
}, |
||||||
|
title() { |
||||||
|
return this.$t("common." + this.type); |
||||||
|
} |
||||||
|
}, |
||||||
|
watch: {}, |
||||||
|
mounted() { |
||||||
|
window.onresize = () => { |
||||||
|
return (() => { |
||||||
|
this.width = this.initWidth(); |
||||||
|
})(); |
||||||
|
}; |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
initCreditGoodsCategory() { |
||||||
|
return { |
||||||
|
// id: "", |
||||||
|
parentId: null, |
||||||
|
name: '', |
||||||
|
miniShow: null, |
||||||
|
sortOrder: null, |
||||||
|
isDelete: null, |
||||||
|
}; |
||||||
|
}, |
||||||
|
initWidth() { |
||||||
|
this.screenWidth = document.body.clientWidth; |
||||||
|
if (this.screenWidth < 991) { |
||||||
|
return "90%"; |
||||||
|
} else if (this.screenWidth < 1400) { |
||||||
|
return "45%"; |
||||||
|
} else { |
||||||
|
return "800px"; |
||||||
|
} |
||||||
|
}, |
||||||
|
setCreditGoodsCategory(val = {}) { |
||||||
|
const vm = this; |
||||||
|
|
||||||
|
vm.dicts = val['dicts']; |
||||||
|
vm.enums = val['enums']; |
||||||
|
if (val['row']) { |
||||||
|
vm.creditGoodsCategory = { ...val['row'] }; |
||||||
|
|
||||||
|
} |
||||||
|
}, |
||||||
|
close() { |
||||||
|
this.$emit("close"); |
||||||
|
}, |
||||||
|
reset() { |
||||||
|
// 先清除校验,再清除表单,不然有奇怪的bug |
||||||
|
this.$refs.form.clearValidate(); |
||||||
|
this.$refs.form.resetFields(); |
||||||
|
this.confirmDisabled = false; |
||||||
|
this.creditGoodsCategory = this.initCreditGoodsCategory(); |
||||||
|
}, |
||||||
|
submitForm() { |
||||||
|
const vm = this; |
||||||
|
this.$refs.form.validate(valid => { |
||||||
|
if (valid) { |
||||||
|
vm.editSubmit(); |
||||||
|
} else { |
||||||
|
return false; |
||||||
|
} |
||||||
|
}); |
||||||
|
}, |
||||||
|
editSubmit() { |
||||||
|
const vm = this; |
||||||
|
if (vm.type === "edit") { |
||||||
|
vm.update(); |
||||||
|
} else { |
||||||
|
vm.save(); |
||||||
|
} |
||||||
|
}, |
||||||
|
save() { |
||||||
|
const vm = this; |
||||||
|
vm.confirmDisabled = true; |
||||||
|
this.creditGoodsCategory.id = 1; |
||||||
|
creditGoodsCategoryApi.save(this.creditGoodsCategory).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
vm.isVisible = false; |
||||||
|
vm.$message({ |
||||||
|
message: vm.$t("tips.createSuccess"), |
||||||
|
type: "success" |
||||||
|
}); |
||||||
|
vm.$emit("success"); |
||||||
|
} |
||||||
|
}).finally(()=> vm.confirmDisabled = false); |
||||||
|
}, |
||||||
|
update() { |
||||||
|
const vm = this; |
||||||
|
vm.confirmDisabled = true; |
||||||
|
creditGoodsCategoryApi.update(this.creditGoodsCategory).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
vm.isVisible = false; |
||||||
|
vm.$message({ |
||||||
|
message: this.$t("tips.updateSuccess"), |
||||||
|
type: "success" |
||||||
|
}); |
||||||
|
vm.$emit("success"); |
||||||
|
} |
||||||
|
}).finally(()=> vm.confirmDisabled = false); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
</script> |
||||||
|
<style lang="scss" scoped></style> |
@ -0,0 +1,347 @@ |
|||||||
|
<template> |
||||||
|
<div class="app-container"> |
||||||
|
<div class="filter-container"> |
||||||
|
<el-input |
||||||
|
:placeholder="$t('table.creditGoodsCategory.name')" |
||||||
|
class="filter-item search-item" |
||||||
|
v-model="queryParams.model.name" |
||||||
|
/> |
||||||
|
|
||||||
|
<el-date-picker :range-separator="null" class="filter-item search-item date-range-item" |
||||||
|
end-placeholder="结束日期" format="yyyy-MM-dd HH:mm:ss" start-placeholder="开始日期" |
||||||
|
type="daterange" v-model="queryParams.timeRange" value-format="yyyy-MM-dd HH:mm:ss" |
||||||
|
/> |
||||||
|
<el-button @click="search" class="filter-item" plain type="primary"> |
||||||
|
{{ $t("table.search") }} |
||||||
|
</el-button> |
||||||
|
<el-button @click="reset" class="filter-item" plain type="warning"> |
||||||
|
{{ $t("table.reset") }} |
||||||
|
</el-button> |
||||||
|
<el-button @click="add" class="filter-item" plain type="danger" v-has-permission="['creditGoodsCategory:add']"> |
||||||
|
{{ $t("table.add") }} |
||||||
|
</el-button> |
||||||
|
<el-dropdown class="filter-item" trigger="click" v-has-any-permission="['creditGoodsCategory:delete', 'creditGoodsCategory:export', |
||||||
|
'creditGoodsCategory:import']"> |
||||||
|
<el-button> |
||||||
|
{{ $t("table.more") }}<i class="el-icon-arrow-down el-icon--right" /> |
||||||
|
</el-button> |
||||||
|
<el-dropdown-menu slot="dropdown"> |
||||||
|
<el-dropdown-item @click.native="batchDelete" v-has-permission="['creditGoodsCategory:delete']"> |
||||||
|
{{ $t("table.delete") }} |
||||||
|
</el-dropdown-item> |
||||||
|
<el-dropdown-item @click.native="exportExcel" v-has-permission="['creditGoodsCategory:export']"> |
||||||
|
{{ $t("table.export") }} |
||||||
|
</el-dropdown-item> |
||||||
|
<el-dropdown-item @click.native="exportExcelPreview" v-has-permission="['creditGoodsCategory:export']"> |
||||||
|
{{ $t("table.exportPreview") }} |
||||||
|
</el-dropdown-item> |
||||||
|
<el-dropdown-item @click.native="importExcel" v-has-permission="['creditGoodsCategory:import']"> |
||||||
|
{{ $t("table.import") }} |
||||||
|
</el-dropdown-item> |
||||||
|
</el-dropdown-menu> |
||||||
|
</el-dropdown> |
||||||
|
</div> |
||||||
|
|
||||||
|
<el-table :data="tableData.records" :key="tableKey" @cell-click="cellClick" |
||||||
|
@filter-change="filterChange" @selection-change="onSelectChange" @sort-change="sortChange" |
||||||
|
border fit row-key="id" ref="table" style="width: 100%;" v-loading="loading"> |
||||||
|
<el-table-column align="center" type="selection" width="40px" :reserve-selection="true"/> |
||||||
|
<el-table-column :label="$t('table.creditGoodsCategory.parentId')" :show-overflow-tooltip="true" align="center" prop="parentId" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.parentId }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditGoodsCategory.name')" :show-overflow-tooltip="true" align="center" prop="name" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.name }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditGoodsCategory.miniShow')" :show-overflow-tooltip="true" align="center" prop="miniShow" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.miniShow }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditGoodsCategory.sortOrder')" :show-overflow-tooltip="true" align="center" prop="sortOrder" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.sortOrder }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditGoodsCategory.isDelete')" :show-overflow-tooltip="true" align="center" prop="isDelete" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.isDelete }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column |
||||||
|
:label="$t('table.createTime')" |
||||||
|
align="center" |
||||||
|
prop="createTime" |
||||||
|
sortable="custom" |
||||||
|
width="170px"> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.createTime }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column |
||||||
|
:label="$t('table.operation')" align="center" column-key="operation" class-name="small-padding fixed-width" width="100px"> |
||||||
|
<template slot-scope="{ row }"> |
||||||
|
<i @click="copy(row)" class="el-icon-copy-document table-operation" :title="$t('common.delete')" |
||||||
|
style="color: #2db7f5;" v-hasPermission="['creditGoodsCategory:add']"/> |
||||||
|
<i @click="edit(row)" class="el-icon-edit table-operation" :title="$t('common.delete')" |
||||||
|
style="color: #2db7f5;" v-hasPermission="['creditGoodsCategory:update']"/> |
||||||
|
<i @click="singleDelete(row)" class="el-icon-delete table-operation" :title="$t('common.delete')" |
||||||
|
style="color: #f50;" v-hasPermission="['creditGoodsCategory:delete']"/> |
||||||
|
<el-link class="no-perm" v-has-no-permission="['creditGoodsCategory:update', 'creditGoodsCategory:copy', 'creditGoodsCategory:delete']"> |
||||||
|
{{ $t("tips.noPermission") }} |
||||||
|
</el-link> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
</el-table> |
||||||
|
<pagination :limit.sync="queryParams.size" :page.sync="queryParams.current" |
||||||
|
:total="Number(tableData.total)" @pagination="fetch" v-show="tableData.total > 0"/> |
||||||
|
<creditGoodsCategory-edit :dialog-visible="dialog.isVisible" :type="dialog.type" |
||||||
|
@close="editClose" @success="editSuccess" ref="edit"/> |
||||||
|
<creditGoodsCategory-import ref="import" :dialog-visible="fileImport.isVisible" :type="fileImport.type" |
||||||
|
:action="fileImport.action" accept=".xls,.xlsx" @close="importClose" @success="importSuccess" /> |
||||||
|
<el-dialog :close-on-click-modal="false" :close-on-press-escape="true" |
||||||
|
title="预览" width="80%" top="50px" :visible.sync="preview.isVisible" v-el-drag-dialog> |
||||||
|
<el-scrollbar> |
||||||
|
<div v-html="preview.context"></div> |
||||||
|
</el-scrollbar> |
||||||
|
</el-dialog> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
import Pagination from "@/components/Pagination"; |
||||||
|
import elDragDialog from '@/directive/el-drag-dialog' |
||||||
|
import CreditGoodsCategoryEdit from "./Edit"; |
||||||
|
import creditGoodsCategoryApi from "@/api/creditGoods/CreditGoodsCategory.js"; |
||||||
|
import CreditGoodsCategoryImport from "@/components/ceres/Import" |
||||||
|
import {convertEnum} from '@/utils/utils' |
||||||
|
import {downloadFile, loadEnums, initDicts, initQueryParams} from '@/utils/commons' |
||||||
|
|
||||||
|
export default { |
||||||
|
name: "CreditGoodsCategoryManage", |
||||||
|
directives: { elDragDialog }, |
||||||
|
components: { Pagination, CreditGoodsCategoryEdit, CreditGoodsCategoryImport}, |
||||||
|
filters: { |
||||||
|
|
||||||
|
}, |
||||||
|
data() { |
||||||
|
return { |
||||||
|
// 编辑 |
||||||
|
dialog: { |
||||||
|
isVisible: false, |
||||||
|
type: "add" |
||||||
|
}, |
||||||
|
// 预览 |
||||||
|
preview: { |
||||||
|
isVisible: false, |
||||||
|
context: '' |
||||||
|
}, |
||||||
|
// 导入 |
||||||
|
fileImport: { |
||||||
|
isVisible: false, |
||||||
|
type: "import", |
||||||
|
action: `${process.env.VUE_APP_BASE_API}/creditGoodsCategory/import` |
||||||
|
// action: `${process.env.VUE_APP_BASE_API}/store/creditGoodsCategory/import` |
||||||
|
}, |
||||||
|
tableKey: 0, |
||||||
|
queryParams: initQueryParams(), |
||||||
|
selection: [], |
||||||
|
loading: false, |
||||||
|
tableData: { |
||||||
|
total: 0 |
||||||
|
}, |
||||||
|
// 枚举 |
||||||
|
enums: { |
||||||
|
}, |
||||||
|
// 字典 |
||||||
|
dicts: { |
||||||
|
} |
||||||
|
}; |
||||||
|
}, |
||||||
|
computed: { |
||||||
|
}, |
||||||
|
watch: { |
||||||
|
}, |
||||||
|
mounted() { |
||||||
|
this.fetch(); |
||||||
|
|
||||||
|
// 初始化字典和枚举 |
||||||
|
const enumList = []; |
||||||
|
const dictList = []; |
||||||
|
loadEnums(enumList, this.enums, 'store'); |
||||||
|
initDicts(dictList, this.dicts); |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
editClose() { |
||||||
|
this.dialog.isVisible = false; |
||||||
|
}, |
||||||
|
editSuccess() { |
||||||
|
this.search(); |
||||||
|
}, |
||||||
|
onSelectChange(selection) { |
||||||
|
this.selection = selection; |
||||||
|
}, |
||||||
|
search() { |
||||||
|
this.fetch({ |
||||||
|
...this.queryParams |
||||||
|
}); |
||||||
|
}, |
||||||
|
reset() { |
||||||
|
this.queryParams = initQueryParams(); |
||||||
|
this.$refs.table.clearSort(); |
||||||
|
this.$refs.table.clearFilter(); |
||||||
|
this.search(); |
||||||
|
}, |
||||||
|
exportExcelPreview() { |
||||||
|
if (this.queryParams.timeRange) { |
||||||
|
this.queryParams.map.createTime_st = this.queryParams.timeRange[0]; |
||||||
|
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1]; |
||||||
|
} |
||||||
|
this.queryParams.map.fileName = '导出数据'; |
||||||
|
creditGoodsCategoryApi.preview(this.queryParams).then(response => { |
||||||
|
const res = response.data; |
||||||
|
this.preview.isVisible = true; |
||||||
|
this.preview.context = res.data; |
||||||
|
}); |
||||||
|
}, |
||||||
|
exportExcel() { |
||||||
|
if (this.queryParams.timeRange) { |
||||||
|
this.queryParams.map.createTime_st = this.queryParams.timeRange[0]; |
||||||
|
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1]; |
||||||
|
} |
||||||
|
this.queryParams.map.fileName = '导出数据'; |
||||||
|
creditGoodsCategoryApi.export(this.queryParams).then(response => { |
||||||
|
downloadFile(response); |
||||||
|
}); |
||||||
|
}, |
||||||
|
importExcel() { |
||||||
|
this.fileImport.type = "upload"; |
||||||
|
this.fileImport.isVisible = true; |
||||||
|
this.$refs.import.setModel(false); |
||||||
|
}, |
||||||
|
importSuccess() { |
||||||
|
this.search(); |
||||||
|
}, |
||||||
|
importClose() { |
||||||
|
this.fileImport.isVisible = false; |
||||||
|
}, |
||||||
|
singleDelete(row) { |
||||||
|
this.$refs.table.clearSelection() |
||||||
|
this.$refs.table.toggleRowSelection(row, true); |
||||||
|
this.batchDelete(); |
||||||
|
}, |
||||||
|
batchDelete() { |
||||||
|
if (!this.selection.length) { |
||||||
|
this.$message({ |
||||||
|
message: this.$t("tips.noDataSelected"), |
||||||
|
type: "warning" |
||||||
|
}); |
||||||
|
return; |
||||||
|
} |
||||||
|
this.$confirm(this.$t("tips.confirmDelete"), this.$t("common.tips"), { |
||||||
|
confirmButtonText: this.$t("common.confirm"), |
||||||
|
cancelButtonText: this.$t("common.cancel"), |
||||||
|
type: "warning" |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
const ids = this.selection.map(u => u.id); |
||||||
|
this.delete(ids); |
||||||
|
}) |
||||||
|
.catch(() => { |
||||||
|
this.clearSelections(); |
||||||
|
}); |
||||||
|
}, |
||||||
|
clearSelections() { |
||||||
|
this.$refs.table.clearSelection(); |
||||||
|
}, |
||||||
|
delete(ids) { |
||||||
|
creditGoodsCategoryApi.delete({ ids: ids }).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
this.$message({ |
||||||
|
message: this.$t("tips.deleteSuccess"), |
||||||
|
type: "success" |
||||||
|
}); |
||||||
|
this.search(); |
||||||
|
} |
||||||
|
}); |
||||||
|
}, |
||||||
|
add() { |
||||||
|
this.dialog.type = "add"; |
||||||
|
this.dialog.isVisible = true; |
||||||
|
this.$refs.edit.setCreditGoodsCategory({ enums: this.enums, dicts: this.dicts}); |
||||||
|
}, |
||||||
|
copy(row) { |
||||||
|
this.$refs.edit.setCreditGoodsCategory({row, enums: this.enums, dicts: this.dicts}); |
||||||
|
this.dialog.type = "copy"; |
||||||
|
this.dialog.isVisible = true; |
||||||
|
}, |
||||||
|
edit(row) { |
||||||
|
this.$refs.edit.setCreditGoodsCategory({row, enums: this.enums, dicts: this.dicts}); |
||||||
|
this.dialog.type = "edit"; |
||||||
|
this.dialog.isVisible = true; |
||||||
|
}, |
||||||
|
fetch(params = {}) { |
||||||
|
this.loading = true; |
||||||
|
if (this.queryParams.timeRange) { |
||||||
|
this.queryParams.map.createTime_st = this.queryParams.timeRange[0]; |
||||||
|
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1]; |
||||||
|
} |
||||||
|
|
||||||
|
this.queryParams.current = params.current ? params.current : this.queryParams.current; |
||||||
|
this.queryParams.size = params.size ? params.size : this.queryParams.size; |
||||||
|
|
||||||
|
creditGoodsCategoryApi.page(this.queryParams).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
this.tableData = res.data; |
||||||
|
} |
||||||
|
}).finally(() => this.loading = false); |
||||||
|
}, |
||||||
|
sortChange(val) { |
||||||
|
this.queryParams.sort = val.prop; |
||||||
|
this.queryParams.order = val.order; |
||||||
|
if (this.queryParams.sort) { |
||||||
|
this.search(); |
||||||
|
} |
||||||
|
}, |
||||||
|
filterChange (filters) { |
||||||
|
for (const key in filters) { |
||||||
|
if(key.includes('.')) { |
||||||
|
const val = { }; |
||||||
|
val[key.split('.')[1]] = filters[key][0]; |
||||||
|
this.queryParams.model[key.split('.')[0]] = val; |
||||||
|
} else { |
||||||
|
this.queryParams.model[key] = filters[key][0] |
||||||
|
} |
||||||
|
} |
||||||
|
this.search() |
||||||
|
}, |
||||||
|
cellClick (row, column) { |
||||||
|
if (column['columnKey'] === "operation") { |
||||||
|
return; |
||||||
|
} |
||||||
|
let flag = false; |
||||||
|
this.selection.forEach((item)=>{ |
||||||
|
if(item.id === row.id) { |
||||||
|
flag = true; |
||||||
|
this.$refs.table.toggleRowSelection(row); |
||||||
|
} |
||||||
|
}) |
||||||
|
|
||||||
|
if(!flag){ |
||||||
|
this.$refs.table.toggleRowSelection(row, true); |
||||||
|
} |
||||||
|
}, |
||||||
|
} |
||||||
|
}; |
||||||
|
</script> |
||||||
|
<style lang="scss" scoped></style> |
@ -0,0 +1,187 @@ |
|||||||
|
<template> |
||||||
|
<el-dialog :close-on-click-modal="false" :close-on-press-escape="true" :title="title" :type="type" |
||||||
|
:visible.sync="isVisible" :width="width" top="50px" v-el-drag-dialog> |
||||||
|
<el-form :model="creditGoodsImg" :rules="rules" label-position="right" label-width="100px" ref="form"> |
||||||
|
<el-form-item :label="$t('table.creditGoodsImg.goodsId')" prop="goodsId"> |
||||||
|
<el-input type="" v-model="creditGoodsImg.goodsId" placeholder="商品ID"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditGoodsImg.imgPath')" prop="imgPath"> |
||||||
|
<el-input type="" v-model="creditGoodsImg.imgPath" placeholder="图片路径"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditGoodsImg.sortOrder')" prop="sortOrder"> |
||||||
|
<el-input type="" v-model="creditGoodsImg.sortOrder" placeholder="显示顺序"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditGoodsImg.typed')" prop="typed"> |
||||||
|
<el-input type="" v-model="creditGoodsImg.typed" placeholder="类型:1-主图,2-副图"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditGoodsImg.enabled')" prop="enabled"> |
||||||
|
<el-radio-group v-model="creditGoodsImg.enabled" size="medium"> |
||||||
|
<el-radio-button :label="true">{{ $t("common.yes") }}</el-radio-button> |
||||||
|
<el-radio-button :label="false">{{ $t("common.no") }}</el-radio-button> |
||||||
|
</el-radio-group> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditGoodsImg.isDelete')" prop="isDelete"> |
||||||
|
<el-input type="" v-model="creditGoodsImg.isDelete" placeholder="逻辑删除:1-删除 0-未删除"/> |
||||||
|
</el-form-item> |
||||||
|
</el-form> |
||||||
|
<div class="dialog-footer" slot="footer"> |
||||||
|
<el-button @click="isVisible = false" plain type="warning"> |
||||||
|
{{ $t("common.cancel") }} |
||||||
|
</el-button> |
||||||
|
<el-button @click="submitForm" :disabled="confirmDisabled" plain type="primary"> |
||||||
|
{{ $t("common.confirm") }} |
||||||
|
</el-button> |
||||||
|
</div> |
||||||
|
</el-dialog> |
||||||
|
</template> |
||||||
|
<script> |
||||||
|
import elDragDialog from '@/directive/el-drag-dialog' |
||||||
|
import creditGoodsImgApi from "@/api/creditGoods/CreditGoodsImg.js"; |
||||||
|
|
||||||
|
export default { |
||||||
|
name: "CreditGoodsImgEdit", |
||||||
|
directives: { elDragDialog }, |
||||||
|
components: { }, |
||||||
|
props: { |
||||||
|
dialogVisible: { |
||||||
|
type: Boolean, |
||||||
|
default: false |
||||||
|
}, |
||||||
|
type: { |
||||||
|
type: String, |
||||||
|
default: "add" |
||||||
|
} |
||||||
|
}, |
||||||
|
data() { |
||||||
|
return { |
||||||
|
confirmDisabled: false, |
||||||
|
creditGoodsImg: this.initCreditGoodsImg(), |
||||||
|
screenWidth: 0, |
||||||
|
width: this.initWidth(), |
||||||
|
rules: { |
||||||
|
|
||||||
|
}, |
||||||
|
// 枚举 |
||||||
|
enums: { |
||||||
|
}, |
||||||
|
// 字典 |
||||||
|
dicts: { |
||||||
|
} |
||||||
|
}; |
||||||
|
}, |
||||||
|
computed: { |
||||||
|
isVisible: { |
||||||
|
get() { |
||||||
|
return this.dialogVisible; |
||||||
|
}, |
||||||
|
set() { |
||||||
|
this.close(); |
||||||
|
this.reset(); |
||||||
|
} |
||||||
|
}, |
||||||
|
title() { |
||||||
|
return this.$t("common." + this.type); |
||||||
|
} |
||||||
|
}, |
||||||
|
watch: {}, |
||||||
|
mounted() { |
||||||
|
window.onresize = () => { |
||||||
|
return (() => { |
||||||
|
this.width = this.initWidth(); |
||||||
|
})(); |
||||||
|
}; |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
initCreditGoodsImg() { |
||||||
|
return { |
||||||
|
id: "", |
||||||
|
goodsId: null, |
||||||
|
imgPath: '', |
||||||
|
sortOrder: null, |
||||||
|
typed: null, |
||||||
|
enabled: true, |
||||||
|
isDelete: null, |
||||||
|
}; |
||||||
|
}, |
||||||
|
initWidth() { |
||||||
|
this.screenWidth = document.body.clientWidth; |
||||||
|
if (this.screenWidth < 991) { |
||||||
|
return "90%"; |
||||||
|
} else if (this.screenWidth < 1400) { |
||||||
|
return "45%"; |
||||||
|
} else { |
||||||
|
return "800px"; |
||||||
|
} |
||||||
|
}, |
||||||
|
setCreditGoodsImg(val = {}) { |
||||||
|
const vm = this; |
||||||
|
|
||||||
|
vm.dicts = val['dicts']; |
||||||
|
vm.enums = val['enums']; |
||||||
|
if (val['row']) { |
||||||
|
vm.creditGoodsImg = { ...val['row'] }; |
||||||
|
|
||||||
|
} |
||||||
|
}, |
||||||
|
close() { |
||||||
|
this.$emit("close"); |
||||||
|
}, |
||||||
|
reset() { |
||||||
|
// 先清除校验,再清除表单,不然有奇怪的bug |
||||||
|
this.$refs.form.clearValidate(); |
||||||
|
this.$refs.form.resetFields(); |
||||||
|
this.confirmDisabled = false; |
||||||
|
this.creditGoodsImg = this.initCreditGoodsImg(); |
||||||
|
}, |
||||||
|
submitForm() { |
||||||
|
const vm = this; |
||||||
|
this.$refs.form.validate(valid => { |
||||||
|
if (valid) { |
||||||
|
vm.editSubmit(); |
||||||
|
} else { |
||||||
|
return false; |
||||||
|
} |
||||||
|
}); |
||||||
|
}, |
||||||
|
editSubmit() { |
||||||
|
const vm = this; |
||||||
|
if (vm.type === "edit") { |
||||||
|
vm.update(); |
||||||
|
} else { |
||||||
|
vm.save(); |
||||||
|
} |
||||||
|
}, |
||||||
|
save() { |
||||||
|
const vm = this; |
||||||
|
vm.confirmDisabled = true; |
||||||
|
creditGoodsImgApi.save(this.creditGoodsImg).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
vm.isVisible = false; |
||||||
|
vm.$message({ |
||||||
|
message: vm.$t("tips.createSuccess"), |
||||||
|
type: "success" |
||||||
|
}); |
||||||
|
vm.$emit("success"); |
||||||
|
} |
||||||
|
}).finally(()=> vm.confirmDisabled = false); |
||||||
|
}, |
||||||
|
update() { |
||||||
|
const vm = this; |
||||||
|
vm.confirmDisabled = true; |
||||||
|
creditGoodsImgApi.update(this.creditGoodsImg).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
vm.isVisible = false; |
||||||
|
vm.$message({ |
||||||
|
message: this.$t("tips.updateSuccess"), |
||||||
|
type: "success" |
||||||
|
}); |
||||||
|
vm.$emit("success"); |
||||||
|
} |
||||||
|
}).finally(()=> vm.confirmDisabled = false); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
</script> |
||||||
|
<style lang="scss" scoped></style> |
@ -0,0 +1,356 @@ |
|||||||
|
<template> |
||||||
|
<div class="app-container"> |
||||||
|
<div class="filter-container"> |
||||||
|
<el-input |
||||||
|
:placeholder="$t('table.creditGoodsImg.imgPath')" |
||||||
|
class="filter-item search-item" |
||||||
|
v-model="queryParams.model.imgPath" |
||||||
|
/> |
||||||
|
|
||||||
|
<el-date-picker :range-separator="null" class="filter-item search-item date-range-item" |
||||||
|
end-placeholder="结束日期" format="yyyy-MM-dd HH:mm:ss" start-placeholder="开始日期" |
||||||
|
type="daterange" v-model="queryParams.timeRange" value-format="yyyy-MM-dd HH:mm:ss" |
||||||
|
/> |
||||||
|
<el-button @click="search" class="filter-item" plain type="primary"> |
||||||
|
{{ $t("table.search") }} |
||||||
|
</el-button> |
||||||
|
<el-button @click="reset" class="filter-item" plain type="warning"> |
||||||
|
{{ $t("table.reset") }} |
||||||
|
</el-button> |
||||||
|
<el-button @click="add" class="filter-item" plain type="danger" v-has-permission="['creditGoodsImg:add']"> |
||||||
|
{{ $t("table.add") }} |
||||||
|
</el-button> |
||||||
|
<el-dropdown class="filter-item" trigger="click" v-has-any-permission="['creditGoodsImg:delete', 'creditGoodsImg:export', |
||||||
|
'creditGoodsImg:import']"> |
||||||
|
<el-button> |
||||||
|
{{ $t("table.more") }}<i class="el-icon-arrow-down el-icon--right" /> |
||||||
|
</el-button> |
||||||
|
<el-dropdown-menu slot="dropdown"> |
||||||
|
<el-dropdown-item @click.native="batchDelete" v-has-permission="['creditGoodsImg:delete']"> |
||||||
|
{{ $t("table.delete") }} |
||||||
|
</el-dropdown-item> |
||||||
|
<el-dropdown-item @click.native="exportExcel" v-has-permission="['creditGoodsImg:export']"> |
||||||
|
{{ $t("table.export") }} |
||||||
|
</el-dropdown-item> |
||||||
|
<el-dropdown-item @click.native="exportExcelPreview" v-has-permission="['creditGoodsImg:export']"> |
||||||
|
{{ $t("table.exportPreview") }} |
||||||
|
</el-dropdown-item> |
||||||
|
<el-dropdown-item @click.native="importExcel" v-has-permission="['creditGoodsImg:import']"> |
||||||
|
{{ $t("table.import") }} |
||||||
|
</el-dropdown-item> |
||||||
|
</el-dropdown-menu> |
||||||
|
</el-dropdown> |
||||||
|
</div> |
||||||
|
|
||||||
|
<el-table :data="tableData.records" :key="tableKey" @cell-click="cellClick" |
||||||
|
@filter-change="filterChange" @selection-change="onSelectChange" @sort-change="sortChange" |
||||||
|
border fit row-key="id" ref="table" style="width: 100%;" v-loading="loading"> |
||||||
|
<el-table-column align="center" type="selection" width="40px" :reserve-selection="true"/> |
||||||
|
<el-table-column :label="$t('table.creditGoodsImg.goodsId')" :show-overflow-tooltip="true" align="center" prop="goodsId" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.goodsId }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditGoodsImg.imgPath')" :show-overflow-tooltip="true" align="center" prop="imgPath" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.imgPath }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditGoodsImg.sortOrder')" :show-overflow-tooltip="true" align="center" prop="sortOrder" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.sortOrder }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditGoodsImg.typed')" :show-overflow-tooltip="true" align="center" prop="typed" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.typed }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditGoodsImg.enabled')" :show-overflow-tooltip="true" align="center" prop="enabled" |
||||||
|
:filter-multiple="false" column-key="enabled" |
||||||
|
:filters="[{ text: $t('common.yes'), value: 'true' }, { text: $t('common.no'), value: 'false' }]" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<el-tag :type="scope.row.enabled ? 'success' : 'danger'" slot> |
||||||
|
{{ scope.row.enabled ? $t("common.yes") : $t("common.no") }} |
||||||
|
</el-tag> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditGoodsImg.isDelete')" :show-overflow-tooltip="true" align="center" prop="isDelete" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.isDelete }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column |
||||||
|
:label="$t('table.createTime')" |
||||||
|
align="center" |
||||||
|
prop="createTime" |
||||||
|
sortable="custom" |
||||||
|
width="170px"> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.createTime }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column |
||||||
|
:label="$t('table.operation')" align="center" column-key="operation" class-name="small-padding fixed-width" width="100px"> |
||||||
|
<template slot-scope="{ row }"> |
||||||
|
<i @click="copy(row)" class="el-icon-copy-document table-operation" :title="$t('common.delete')" |
||||||
|
style="color: #2db7f5;" v-hasPermission="['creditGoodsImg:add']"/> |
||||||
|
<i @click="edit(row)" class="el-icon-edit table-operation" :title="$t('common.delete')" |
||||||
|
style="color: #2db7f5;" v-hasPermission="['creditGoodsImg:update']"/> |
||||||
|
<i @click="singleDelete(row)" class="el-icon-delete table-operation" :title="$t('common.delete')" |
||||||
|
style="color: #f50;" v-hasPermission="['creditGoodsImg:delete']"/> |
||||||
|
<el-link class="no-perm" v-has-no-permission="['creditGoodsImg:update', 'creditGoodsImg:copy', 'creditGoodsImg:delete']"> |
||||||
|
{{ $t("tips.noPermission") }} |
||||||
|
</el-link> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
</el-table> |
||||||
|
<pagination :limit.sync="queryParams.size" :page.sync="queryParams.current" |
||||||
|
:total="Number(tableData.total)" @pagination="fetch" v-show="tableData.total > 0"/> |
||||||
|
<creditGoodsImg-edit :dialog-visible="dialog.isVisible" :type="dialog.type" |
||||||
|
@close="editClose" @success="editSuccess" ref="edit"/> |
||||||
|
<creditGoodsImg-import ref="import" :dialog-visible="fileImport.isVisible" :type="fileImport.type" |
||||||
|
:action="fileImport.action" accept=".xls,.xlsx" @close="importClose" @success="importSuccess" /> |
||||||
|
<el-dialog :close-on-click-modal="false" :close-on-press-escape="true" |
||||||
|
title="预览" width="80%" top="50px" :visible.sync="preview.isVisible" v-el-drag-dialog> |
||||||
|
<el-scrollbar> |
||||||
|
<div v-html="preview.context"></div> |
||||||
|
</el-scrollbar> |
||||||
|
</el-dialog> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
import Pagination from "@/components/Pagination"; |
||||||
|
import elDragDialog from '@/directive/el-drag-dialog' |
||||||
|
import CreditGoodsImgEdit from "./Edit"; |
||||||
|
import creditGoodsImgApi from "@/api/creditGoods/CreditGoodsImg.js"; |
||||||
|
import CreditGoodsImgImport from "@/components/ceres/Import" |
||||||
|
import {convertEnum} from '@/utils/utils' |
||||||
|
import {downloadFile, loadEnums, initDicts, initQueryParams} from '@/utils/commons' |
||||||
|
|
||||||
|
export default { |
||||||
|
name: "CreditGoodsImgManage", |
||||||
|
directives: { elDragDialog }, |
||||||
|
components: { Pagination, CreditGoodsImgEdit, CreditGoodsImgImport}, |
||||||
|
filters: { |
||||||
|
|
||||||
|
}, |
||||||
|
data() { |
||||||
|
return { |
||||||
|
// 编辑 |
||||||
|
dialog: { |
||||||
|
isVisible: false, |
||||||
|
type: "add" |
||||||
|
}, |
||||||
|
// 预览 |
||||||
|
preview: { |
||||||
|
isVisible: false, |
||||||
|
context: '' |
||||||
|
}, |
||||||
|
// 导入 |
||||||
|
fileImport: { |
||||||
|
isVisible: false, |
||||||
|
type: "import", |
||||||
|
action: `${process.env.VUE_APP_BASE_API}/store/creditGoodsImg/import` |
||||||
|
}, |
||||||
|
tableKey: 0, |
||||||
|
queryParams: initQueryParams(), |
||||||
|
selection: [], |
||||||
|
loading: false, |
||||||
|
tableData: { |
||||||
|
total: 0 |
||||||
|
}, |
||||||
|
// 枚举 |
||||||
|
enums: { |
||||||
|
}, |
||||||
|
// 字典 |
||||||
|
dicts: { |
||||||
|
} |
||||||
|
}; |
||||||
|
}, |
||||||
|
computed: { |
||||||
|
}, |
||||||
|
watch: { |
||||||
|
}, |
||||||
|
mounted() { |
||||||
|
this.fetch(); |
||||||
|
|
||||||
|
// 初始化字典和枚举 |
||||||
|
const enumList = []; |
||||||
|
const dictList = []; |
||||||
|
loadEnums(enumList, this.enums, 'store'); |
||||||
|
initDicts(dictList, this.dicts); |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
editClose() { |
||||||
|
this.dialog.isVisible = false; |
||||||
|
}, |
||||||
|
editSuccess() { |
||||||
|
this.search(); |
||||||
|
}, |
||||||
|
onSelectChange(selection) { |
||||||
|
this.selection = selection; |
||||||
|
}, |
||||||
|
search() { |
||||||
|
this.fetch({ |
||||||
|
...this.queryParams |
||||||
|
}); |
||||||
|
}, |
||||||
|
reset() { |
||||||
|
this.queryParams = initQueryParams(); |
||||||
|
this.$refs.table.clearSort(); |
||||||
|
this.$refs.table.clearFilter(); |
||||||
|
this.search(); |
||||||
|
}, |
||||||
|
exportExcelPreview() { |
||||||
|
if (this.queryParams.timeRange) { |
||||||
|
this.queryParams.map.createTime_st = this.queryParams.timeRange[0]; |
||||||
|
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1]; |
||||||
|
} |
||||||
|
this.queryParams.map.fileName = '导出数据'; |
||||||
|
creditGoodsImgApi.preview(this.queryParams).then(response => { |
||||||
|
const res = response.data; |
||||||
|
this.preview.isVisible = true; |
||||||
|
this.preview.context = res.data; |
||||||
|
}); |
||||||
|
}, |
||||||
|
exportExcel() { |
||||||
|
if (this.queryParams.timeRange) { |
||||||
|
this.queryParams.map.createTime_st = this.queryParams.timeRange[0]; |
||||||
|
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1]; |
||||||
|
} |
||||||
|
this.queryParams.map.fileName = '导出数据'; |
||||||
|
creditGoodsImgApi.export(this.queryParams).then(response => { |
||||||
|
downloadFile(response); |
||||||
|
}); |
||||||
|
}, |
||||||
|
importExcel() { |
||||||
|
this.fileImport.type = "upload"; |
||||||
|
this.fileImport.isVisible = true; |
||||||
|
this.$refs.import.setModel(false); |
||||||
|
}, |
||||||
|
importSuccess() { |
||||||
|
this.search(); |
||||||
|
}, |
||||||
|
importClose() { |
||||||
|
this.fileImport.isVisible = false; |
||||||
|
}, |
||||||
|
singleDelete(row) { |
||||||
|
this.$refs.table.clearSelection() |
||||||
|
this.$refs.table.toggleRowSelection(row, true); |
||||||
|
this.batchDelete(); |
||||||
|
}, |
||||||
|
batchDelete() { |
||||||
|
if (!this.selection.length) { |
||||||
|
this.$message({ |
||||||
|
message: this.$t("tips.noDataSelected"), |
||||||
|
type: "warning" |
||||||
|
}); |
||||||
|
return; |
||||||
|
} |
||||||
|
this.$confirm(this.$t("tips.confirmDelete"), this.$t("common.tips"), { |
||||||
|
confirmButtonText: this.$t("common.confirm"), |
||||||
|
cancelButtonText: this.$t("common.cancel"), |
||||||
|
type: "warning" |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
const ids = this.selection.map(u => u.id); |
||||||
|
this.delete(ids); |
||||||
|
}) |
||||||
|
.catch(() => { |
||||||
|
this.clearSelections(); |
||||||
|
}); |
||||||
|
}, |
||||||
|
clearSelections() { |
||||||
|
this.$refs.table.clearSelection(); |
||||||
|
}, |
||||||
|
delete(ids) { |
||||||
|
creditGoodsImgApi.delete({ ids: ids }).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
this.$message({ |
||||||
|
message: this.$t("tips.deleteSuccess"), |
||||||
|
type: "success" |
||||||
|
}); |
||||||
|
this.search(); |
||||||
|
} |
||||||
|
}); |
||||||
|
}, |
||||||
|
add() { |
||||||
|
this.dialog.type = "add"; |
||||||
|
this.dialog.isVisible = true; |
||||||
|
this.$refs.edit.setCreditGoodsImg({ enums: this.enums, dicts: this.dicts}); |
||||||
|
}, |
||||||
|
copy(row) { |
||||||
|
this.$refs.edit.setCreditGoodsImg({row, enums: this.enums, dicts: this.dicts}); |
||||||
|
this.dialog.type = "copy"; |
||||||
|
this.dialog.isVisible = true; |
||||||
|
}, |
||||||
|
edit(row) { |
||||||
|
this.$refs.edit.setCreditGoodsImg({row, enums: this.enums, dicts: this.dicts}); |
||||||
|
this.dialog.type = "edit"; |
||||||
|
this.dialog.isVisible = true; |
||||||
|
}, |
||||||
|
fetch(params = {}) { |
||||||
|
this.loading = true; |
||||||
|
if (this.queryParams.timeRange) { |
||||||
|
this.queryParams.map.createTime_st = this.queryParams.timeRange[0]; |
||||||
|
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1]; |
||||||
|
} |
||||||
|
|
||||||
|
this.queryParams.current = params.current ? params.current : this.queryParams.current; |
||||||
|
this.queryParams.size = params.size ? params.size : this.queryParams.size; |
||||||
|
|
||||||
|
creditGoodsImgApi.page(this.queryParams).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
this.tableData = res.data; |
||||||
|
} |
||||||
|
}).finally(() => this.loading = false); |
||||||
|
}, |
||||||
|
sortChange(val) { |
||||||
|
this.queryParams.sort = val.prop; |
||||||
|
this.queryParams.order = val.order; |
||||||
|
if (this.queryParams.sort) { |
||||||
|
this.search(); |
||||||
|
} |
||||||
|
}, |
||||||
|
filterChange (filters) { |
||||||
|
for (const key in filters) { |
||||||
|
if(key.includes('.')) { |
||||||
|
const val = { }; |
||||||
|
val[key.split('.')[1]] = filters[key][0]; |
||||||
|
this.queryParams.model[key.split('.')[0]] = val; |
||||||
|
} else { |
||||||
|
this.queryParams.model[key] = filters[key][0] |
||||||
|
} |
||||||
|
} |
||||||
|
this.search() |
||||||
|
}, |
||||||
|
cellClick (row, column) { |
||||||
|
if (column['columnKey'] === "operation") { |
||||||
|
return; |
||||||
|
} |
||||||
|
let flag = false; |
||||||
|
this.selection.forEach((item)=>{ |
||||||
|
if(item.id === row.id) { |
||||||
|
flag = true; |
||||||
|
this.$refs.table.toggleRowSelection(row); |
||||||
|
} |
||||||
|
}) |
||||||
|
|
||||||
|
if(!flag){ |
||||||
|
this.$refs.table.toggleRowSelection(row, true); |
||||||
|
} |
||||||
|
}, |
||||||
|
} |
||||||
|
}; |
||||||
|
</script> |
||||||
|
<style lang="scss" scoped></style> |
@ -0,0 +1,184 @@ |
|||||||
|
<template> |
||||||
|
<el-dialog :close-on-click-modal="false" :close-on-press-escape="true" :title="title" :type="type" |
||||||
|
:visible.sync="isVisible" :width="width" top="50px" v-el-drag-dialog> |
||||||
|
<el-form :model="creditOrder" :rules="rules" label-position="right" label-width="100px" ref="form"> |
||||||
|
<el-form-item :label="$t('table.creditOrder.mid')" prop="mid"> |
||||||
|
<el-input type="" v-model="creditOrder.mid" placeholder="会员ID"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditOrder.orderCode')" prop="orderCode"> |
||||||
|
<el-input type="" v-model="creditOrder.orderCode" placeholder="订单编号"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditOrder.amount')" prop="amount"> |
||||||
|
<el-input type="" v-model="creditOrder.amount" placeholder="金额"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditOrder.state')" prop="state"> |
||||||
|
<el-input type="" v-model="creditOrder.state" placeholder="状态:1-未完成,2-已完成,9-已取消"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditOrder.useTyped')" prop="useTyped"> |
||||||
|
<el-input type="" v-model="creditOrder.useTyped" placeholder="使用类型:1-配送,2-自提,3-虚拟"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditOrder.isDelete')" prop="isDelete"> |
||||||
|
<el-input type="" v-model="creditOrder.isDelete" placeholder="逻辑删除:1-删除 0-未删除"/> |
||||||
|
</el-form-item> |
||||||
|
</el-form> |
||||||
|
<div class="dialog-footer" slot="footer"> |
||||||
|
<el-button @click="isVisible = false" plain type="warning"> |
||||||
|
{{ $t("common.cancel") }} |
||||||
|
</el-button> |
||||||
|
<el-button @click="submitForm" :disabled="confirmDisabled" plain type="primary"> |
||||||
|
{{ $t("common.confirm") }} |
||||||
|
</el-button> |
||||||
|
</div> |
||||||
|
</el-dialog> |
||||||
|
</template> |
||||||
|
<script> |
||||||
|
import elDragDialog from '@/directive/el-drag-dialog' |
||||||
|
import creditOrderApi from "@/api/creditGoods/CreditOrder.js"; |
||||||
|
|
||||||
|
export default { |
||||||
|
name: "CreditOrderEdit", |
||||||
|
directives: { elDragDialog }, |
||||||
|
components: { }, |
||||||
|
props: { |
||||||
|
dialogVisible: { |
||||||
|
type: Boolean, |
||||||
|
default: false |
||||||
|
}, |
||||||
|
type: { |
||||||
|
type: String, |
||||||
|
default: "add" |
||||||
|
} |
||||||
|
}, |
||||||
|
data() { |
||||||
|
return { |
||||||
|
confirmDisabled: false, |
||||||
|
creditOrder: this.initCreditOrder(), |
||||||
|
screenWidth: 0, |
||||||
|
width: this.initWidth(), |
||||||
|
rules: { |
||||||
|
|
||||||
|
}, |
||||||
|
// 枚举 |
||||||
|
enums: { |
||||||
|
}, |
||||||
|
// 字典 |
||||||
|
dicts: { |
||||||
|
} |
||||||
|
}; |
||||||
|
}, |
||||||
|
computed: { |
||||||
|
isVisible: { |
||||||
|
get() { |
||||||
|
return this.dialogVisible; |
||||||
|
}, |
||||||
|
set() { |
||||||
|
this.close(); |
||||||
|
this.reset(); |
||||||
|
} |
||||||
|
}, |
||||||
|
title() { |
||||||
|
return this.$t("common." + this.type); |
||||||
|
} |
||||||
|
}, |
||||||
|
watch: {}, |
||||||
|
mounted() { |
||||||
|
window.onresize = () => { |
||||||
|
return (() => { |
||||||
|
this.width = this.initWidth(); |
||||||
|
})(); |
||||||
|
}; |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
initCreditOrder() { |
||||||
|
return { |
||||||
|
id: "", |
||||||
|
mid: null, |
||||||
|
orderCode: '', |
||||||
|
amount: null, |
||||||
|
state: null, |
||||||
|
useTyped: null, |
||||||
|
isDelete: null, |
||||||
|
}; |
||||||
|
}, |
||||||
|
initWidth() { |
||||||
|
this.screenWidth = document.body.clientWidth; |
||||||
|
if (this.screenWidth < 991) { |
||||||
|
return "90%"; |
||||||
|
} else if (this.screenWidth < 1400) { |
||||||
|
return "45%"; |
||||||
|
} else { |
||||||
|
return "800px"; |
||||||
|
} |
||||||
|
}, |
||||||
|
setCreditOrder(val = {}) { |
||||||
|
const vm = this; |
||||||
|
|
||||||
|
vm.dicts = val['dicts']; |
||||||
|
vm.enums = val['enums']; |
||||||
|
if (val['row']) { |
||||||
|
vm.creditOrder = { ...val['row'] }; |
||||||
|
|
||||||
|
} |
||||||
|
}, |
||||||
|
close() { |
||||||
|
this.$emit("close"); |
||||||
|
}, |
||||||
|
reset() { |
||||||
|
// 先清除校验,再清除表单,不然有奇怪的bug |
||||||
|
this.$refs.form.clearValidate(); |
||||||
|
this.$refs.form.resetFields(); |
||||||
|
this.confirmDisabled = false; |
||||||
|
this.creditOrder = this.initCreditOrder(); |
||||||
|
}, |
||||||
|
submitForm() { |
||||||
|
const vm = this; |
||||||
|
this.$refs.form.validate(valid => { |
||||||
|
if (valid) { |
||||||
|
vm.editSubmit(); |
||||||
|
} else { |
||||||
|
return false; |
||||||
|
} |
||||||
|
}); |
||||||
|
}, |
||||||
|
editSubmit() { |
||||||
|
const vm = this; |
||||||
|
if (vm.type === "edit") { |
||||||
|
vm.update(); |
||||||
|
} else { |
||||||
|
vm.save(); |
||||||
|
} |
||||||
|
}, |
||||||
|
save() { |
||||||
|
const vm = this; |
||||||
|
vm.confirmDisabled = true; |
||||||
|
creditOrderApi.save(this.creditOrder).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
vm.isVisible = false; |
||||||
|
vm.$message({ |
||||||
|
message: vm.$t("tips.createSuccess"), |
||||||
|
type: "success" |
||||||
|
}); |
||||||
|
vm.$emit("success"); |
||||||
|
} |
||||||
|
}).finally(()=> vm.confirmDisabled = false); |
||||||
|
}, |
||||||
|
update() { |
||||||
|
const vm = this; |
||||||
|
vm.confirmDisabled = true; |
||||||
|
creditOrderApi.update(this.creditOrder).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
vm.isVisible = false; |
||||||
|
vm.$message({ |
||||||
|
message: this.$t("tips.updateSuccess"), |
||||||
|
type: "success" |
||||||
|
}); |
||||||
|
vm.$emit("success"); |
||||||
|
} |
||||||
|
}).finally(()=> vm.confirmDisabled = false); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
</script> |
||||||
|
<style lang="scss" scoped></style> |
@ -0,0 +1,352 @@ |
|||||||
|
<template> |
||||||
|
<div class="app-container"> |
||||||
|
<div class="filter-container"> |
||||||
|
<el-input |
||||||
|
:placeholder="$t('table.creditOrder.orderCode')" |
||||||
|
class="filter-item search-item" |
||||||
|
v-model="queryParams.model.orderCode" |
||||||
|
/> |
||||||
|
|
||||||
|
<el-date-picker :range-separator="null" class="filter-item search-item date-range-item" |
||||||
|
end-placeholder="结束日期" format="yyyy-MM-dd HH:mm:ss" start-placeholder="开始日期" |
||||||
|
type="daterange" v-model="queryParams.timeRange" value-format="yyyy-MM-dd HH:mm:ss" |
||||||
|
/> |
||||||
|
<el-button @click="search" class="filter-item" plain type="primary"> |
||||||
|
{{ $t("table.search") }} |
||||||
|
</el-button> |
||||||
|
<el-button @click="reset" class="filter-item" plain type="warning"> |
||||||
|
{{ $t("table.reset") }} |
||||||
|
</el-button> |
||||||
|
<el-button @click="add" class="filter-item" plain type="danger" v-has-permission="['creditOrder:add']"> |
||||||
|
{{ $t("table.add") }} |
||||||
|
</el-button> |
||||||
|
<el-dropdown class="filter-item" trigger="click" v-has-any-permission="['creditOrder:delete', 'creditOrder:export', |
||||||
|
'creditOrder:import']"> |
||||||
|
<el-button> |
||||||
|
{{ $t("table.more") }}<i class="el-icon-arrow-down el-icon--right" /> |
||||||
|
</el-button> |
||||||
|
<el-dropdown-menu slot="dropdown"> |
||||||
|
<el-dropdown-item @click.native="batchDelete" v-has-permission="['creditOrder:delete']"> |
||||||
|
{{ $t("table.delete") }} |
||||||
|
</el-dropdown-item> |
||||||
|
<el-dropdown-item @click.native="exportExcel" v-has-permission="['creditOrder:export']"> |
||||||
|
{{ $t("table.export") }} |
||||||
|
</el-dropdown-item> |
||||||
|
<el-dropdown-item @click.native="exportExcelPreview" v-has-permission="['creditOrder:export']"> |
||||||
|
{{ $t("table.exportPreview") }} |
||||||
|
</el-dropdown-item> |
||||||
|
<el-dropdown-item @click.native="importExcel" v-has-permission="['creditOrder:import']"> |
||||||
|
{{ $t("table.import") }} |
||||||
|
</el-dropdown-item> |
||||||
|
</el-dropdown-menu> |
||||||
|
</el-dropdown> |
||||||
|
</div> |
||||||
|
|
||||||
|
<el-table :data="tableData.records" :key="tableKey" @cell-click="cellClick" |
||||||
|
@filter-change="filterChange" @selection-change="onSelectChange" @sort-change="sortChange" |
||||||
|
border fit row-key="id" ref="table" style="width: 100%;" v-loading="loading"> |
||||||
|
<el-table-column align="center" type="selection" width="40px" :reserve-selection="true"/> |
||||||
|
<el-table-column :label="$t('table.creditOrder.mid')" :show-overflow-tooltip="true" align="center" prop="mid" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.mid }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditOrder.orderCode')" :show-overflow-tooltip="true" align="center" prop="orderCode" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.orderCode }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditOrder.amount')" :show-overflow-tooltip="true" align="center" prop="amount" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.amount }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditOrder.state')" :show-overflow-tooltip="true" align="center" prop="state" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.state }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditOrder.useTyped')" :show-overflow-tooltip="true" align="center" prop="useTyped" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.useTyped }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditOrder.isDelete')" :show-overflow-tooltip="true" align="center" prop="isDelete" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.isDelete }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column |
||||||
|
:label="$t('table.createTime')" |
||||||
|
align="center" |
||||||
|
prop="createTime" |
||||||
|
sortable="custom" |
||||||
|
width="170px"> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.createTime }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column |
||||||
|
:label="$t('table.operation')" align="center" column-key="operation" class-name="small-padding fixed-width" width="100px"> |
||||||
|
<template slot-scope="{ row }"> |
||||||
|
<i @click="copy(row)" class="el-icon-copy-document table-operation" :title="$t('common.delete')" |
||||||
|
style="color: #2db7f5;" v-hasPermission="['creditOrder:add']"/> |
||||||
|
<i @click="edit(row)" class="el-icon-edit table-operation" :title="$t('common.delete')" |
||||||
|
style="color: #2db7f5;" v-hasPermission="['creditOrder:update']"/> |
||||||
|
<i @click="singleDelete(row)" class="el-icon-delete table-operation" :title="$t('common.delete')" |
||||||
|
style="color: #f50;" v-hasPermission="['creditOrder:delete']"/> |
||||||
|
<el-link class="no-perm" v-has-no-permission="['creditOrder:update', 'creditOrder:copy', 'creditOrder:delete']"> |
||||||
|
{{ $t("tips.noPermission") }} |
||||||
|
</el-link> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
</el-table> |
||||||
|
<pagination :limit.sync="queryParams.size" :page.sync="queryParams.current" |
||||||
|
:total="Number(tableData.total)" @pagination="fetch" v-show="tableData.total > 0"/> |
||||||
|
<creditOrder-edit :dialog-visible="dialog.isVisible" :type="dialog.type" |
||||||
|
@close="editClose" @success="editSuccess" ref="edit"/> |
||||||
|
<creditOrder-import ref="import" :dialog-visible="fileImport.isVisible" :type="fileImport.type" |
||||||
|
:action="fileImport.action" accept=".xls,.xlsx" @close="importClose" @success="importSuccess" /> |
||||||
|
<el-dialog :close-on-click-modal="false" :close-on-press-escape="true" |
||||||
|
title="预览" width="80%" top="50px" :visible.sync="preview.isVisible" v-el-drag-dialog> |
||||||
|
<el-scrollbar> |
||||||
|
<div v-html="preview.context"></div> |
||||||
|
</el-scrollbar> |
||||||
|
</el-dialog> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
import Pagination from "@/components/Pagination"; |
||||||
|
import elDragDialog from '@/directive/el-drag-dialog' |
||||||
|
import CreditOrderEdit from "./Edit"; |
||||||
|
import creditOrderApi from "@/api/creditGoods/CreditOrder.js"; |
||||||
|
import CreditOrderImport from "@/components/ceres/Import" |
||||||
|
import {convertEnum} from '@/utils/utils' |
||||||
|
import {downloadFile, loadEnums, initDicts, initQueryParams} from '@/utils/commons' |
||||||
|
|
||||||
|
export default { |
||||||
|
name: "CreditOrderManage", |
||||||
|
directives: { elDragDialog }, |
||||||
|
components: { Pagination, CreditOrderEdit, CreditOrderImport}, |
||||||
|
filters: { |
||||||
|
|
||||||
|
}, |
||||||
|
data() { |
||||||
|
return { |
||||||
|
// 编辑 |
||||||
|
dialog: { |
||||||
|
isVisible: false, |
||||||
|
type: "add" |
||||||
|
}, |
||||||
|
// 预览 |
||||||
|
preview: { |
||||||
|
isVisible: false, |
||||||
|
context: '' |
||||||
|
}, |
||||||
|
// 导入 |
||||||
|
fileImport: { |
||||||
|
isVisible: false, |
||||||
|
type: "import", |
||||||
|
action: `${process.env.VUE_APP_BASE_API}/store/creditOrder/import` |
||||||
|
}, |
||||||
|
tableKey: 0, |
||||||
|
queryParams: initQueryParams(), |
||||||
|
selection: [], |
||||||
|
loading: false, |
||||||
|
tableData: { |
||||||
|
total: 0 |
||||||
|
}, |
||||||
|
// 枚举 |
||||||
|
enums: { |
||||||
|
}, |
||||||
|
// 字典 |
||||||
|
dicts: { |
||||||
|
} |
||||||
|
}; |
||||||
|
}, |
||||||
|
computed: { |
||||||
|
}, |
||||||
|
watch: { |
||||||
|
}, |
||||||
|
mounted() { |
||||||
|
this.fetch(); |
||||||
|
|
||||||
|
// 初始化字典和枚举 |
||||||
|
const enumList = []; |
||||||
|
const dictList = []; |
||||||
|
loadEnums(enumList, this.enums, 'store'); |
||||||
|
initDicts(dictList, this.dicts); |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
editClose() { |
||||||
|
this.dialog.isVisible = false; |
||||||
|
}, |
||||||
|
editSuccess() { |
||||||
|
this.search(); |
||||||
|
}, |
||||||
|
onSelectChange(selection) { |
||||||
|
this.selection = selection; |
||||||
|
}, |
||||||
|
search() { |
||||||
|
this.fetch({ |
||||||
|
...this.queryParams |
||||||
|
}); |
||||||
|
}, |
||||||
|
reset() { |
||||||
|
this.queryParams = initQueryParams(); |
||||||
|
this.$refs.table.clearSort(); |
||||||
|
this.$refs.table.clearFilter(); |
||||||
|
this.search(); |
||||||
|
}, |
||||||
|
exportExcelPreview() { |
||||||
|
if (this.queryParams.timeRange) { |
||||||
|
this.queryParams.map.createTime_st = this.queryParams.timeRange[0]; |
||||||
|
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1]; |
||||||
|
} |
||||||
|
this.queryParams.map.fileName = '导出数据'; |
||||||
|
creditOrderApi.preview(this.queryParams).then(response => { |
||||||
|
const res = response.data; |
||||||
|
this.preview.isVisible = true; |
||||||
|
this.preview.context = res.data; |
||||||
|
}); |
||||||
|
}, |
||||||
|
exportExcel() { |
||||||
|
if (this.queryParams.timeRange) { |
||||||
|
this.queryParams.map.createTime_st = this.queryParams.timeRange[0]; |
||||||
|
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1]; |
||||||
|
} |
||||||
|
this.queryParams.map.fileName = '导出数据'; |
||||||
|
creditOrderApi.export(this.queryParams).then(response => { |
||||||
|
downloadFile(response); |
||||||
|
}); |
||||||
|
}, |
||||||
|
importExcel() { |
||||||
|
this.fileImport.type = "upload"; |
||||||
|
this.fileImport.isVisible = true; |
||||||
|
this.$refs.import.setModel(false); |
||||||
|
}, |
||||||
|
importSuccess() { |
||||||
|
this.search(); |
||||||
|
}, |
||||||
|
importClose() { |
||||||
|
this.fileImport.isVisible = false; |
||||||
|
}, |
||||||
|
singleDelete(row) { |
||||||
|
this.$refs.table.clearSelection() |
||||||
|
this.$refs.table.toggleRowSelection(row, true); |
||||||
|
this.batchDelete(); |
||||||
|
}, |
||||||
|
batchDelete() { |
||||||
|
if (!this.selection.length) { |
||||||
|
this.$message({ |
||||||
|
message: this.$t("tips.noDataSelected"), |
||||||
|
type: "warning" |
||||||
|
}); |
||||||
|
return; |
||||||
|
} |
||||||
|
this.$confirm(this.$t("tips.confirmDelete"), this.$t("common.tips"), { |
||||||
|
confirmButtonText: this.$t("common.confirm"), |
||||||
|
cancelButtonText: this.$t("common.cancel"), |
||||||
|
type: "warning" |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
const ids = this.selection.map(u => u.id); |
||||||
|
this.delete(ids); |
||||||
|
}) |
||||||
|
.catch(() => { |
||||||
|
this.clearSelections(); |
||||||
|
}); |
||||||
|
}, |
||||||
|
clearSelections() { |
||||||
|
this.$refs.table.clearSelection(); |
||||||
|
}, |
||||||
|
delete(ids) { |
||||||
|
creditOrderApi.delete({ ids: ids }).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
this.$message({ |
||||||
|
message: this.$t("tips.deleteSuccess"), |
||||||
|
type: "success" |
||||||
|
}); |
||||||
|
this.search(); |
||||||
|
} |
||||||
|
}); |
||||||
|
}, |
||||||
|
add() { |
||||||
|
this.dialog.type = "add"; |
||||||
|
this.dialog.isVisible = true; |
||||||
|
this.$refs.edit.setCreditOrder({ enums: this.enums, dicts: this.dicts}); |
||||||
|
}, |
||||||
|
copy(row) { |
||||||
|
this.$refs.edit.setCreditOrder({row, enums: this.enums, dicts: this.dicts}); |
||||||
|
this.dialog.type = "copy"; |
||||||
|
this.dialog.isVisible = true; |
||||||
|
}, |
||||||
|
edit(row) { |
||||||
|
this.$refs.edit.setCreditOrder({row, enums: this.enums, dicts: this.dicts}); |
||||||
|
this.dialog.type = "edit"; |
||||||
|
this.dialog.isVisible = true; |
||||||
|
}, |
||||||
|
fetch(params = {}) { |
||||||
|
this.loading = true; |
||||||
|
if (this.queryParams.timeRange) { |
||||||
|
this.queryParams.map.createTime_st = this.queryParams.timeRange[0]; |
||||||
|
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1]; |
||||||
|
} |
||||||
|
|
||||||
|
this.queryParams.current = params.current ? params.current : this.queryParams.current; |
||||||
|
this.queryParams.size = params.size ? params.size : this.queryParams.size; |
||||||
|
|
||||||
|
creditOrderApi.page(this.queryParams).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
this.tableData = res.data; |
||||||
|
} |
||||||
|
}).finally(() => this.loading = false); |
||||||
|
}, |
||||||
|
sortChange(val) { |
||||||
|
this.queryParams.sort = val.prop; |
||||||
|
this.queryParams.order = val.order; |
||||||
|
if (this.queryParams.sort) { |
||||||
|
this.search(); |
||||||
|
} |
||||||
|
}, |
||||||
|
filterChange (filters) { |
||||||
|
for (const key in filters) { |
||||||
|
if(key.includes('.')) { |
||||||
|
const val = { }; |
||||||
|
val[key.split('.')[1]] = filters[key][0]; |
||||||
|
this.queryParams.model[key.split('.')[0]] = val; |
||||||
|
} else { |
||||||
|
this.queryParams.model[key] = filters[key][0] |
||||||
|
} |
||||||
|
} |
||||||
|
this.search() |
||||||
|
}, |
||||||
|
cellClick (row, column) { |
||||||
|
if (column['columnKey'] === "operation") { |
||||||
|
return; |
||||||
|
} |
||||||
|
let flag = false; |
||||||
|
this.selection.forEach((item)=>{ |
||||||
|
if(item.id === row.id) { |
||||||
|
flag = true; |
||||||
|
this.$refs.table.toggleRowSelection(row); |
||||||
|
} |
||||||
|
}) |
||||||
|
|
||||||
|
if(!flag){ |
||||||
|
this.$refs.table.toggleRowSelection(row, true); |
||||||
|
} |
||||||
|
}, |
||||||
|
} |
||||||
|
}; |
||||||
|
</script> |
||||||
|
<style lang="scss" scoped></style> |
@ -0,0 +1,208 @@ |
|||||||
|
<template> |
||||||
|
<el-dialog :close-on-click-modal="false" :close-on-press-escape="true" :title="title" :type="type" |
||||||
|
:visible.sync="isVisible" :width="width" top="50px" v-el-drag-dialog> |
||||||
|
<el-form :model="creditOrderDelivery" :rules="rules" label-position="right" label-width="100px" ref="form"> |
||||||
|
<el-form-item :label="$t('table.creditOrderDelivery.orderId')" prop="orderId"> |
||||||
|
<el-input type="" v-model="creditOrderDelivery.orderId" placeholder="订单ID"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditOrderDelivery.state')" prop="state"> |
||||||
|
<el-input type="" v-model="creditOrderDelivery.state" placeholder="状态:1-待发货,2-待收货,3-已完成"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditOrderDelivery.username')" prop="username"> |
||||||
|
<el-input type="" v-model="creditOrderDelivery.username" placeholder="收货人姓名"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditOrderDelivery.phone')" prop="phone"> |
||||||
|
<el-input type="" v-model="creditOrderDelivery.phone" placeholder="收货手机号"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditOrderDelivery.province')" prop="province"> |
||||||
|
<el-input type="" v-model="creditOrderDelivery.province" placeholder="收货地址省份"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditOrderDelivery.city')" prop="city"> |
||||||
|
<el-input type="" v-model="creditOrderDelivery.city" placeholder="收货地址城市"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditOrderDelivery.area')" prop="area"> |
||||||
|
<el-input type="" v-model="creditOrderDelivery.area" placeholder="收货地址区域"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditOrderDelivery.cityInfo')" prop="cityInfo"> |
||||||
|
<el-input type="" v-model="creditOrderDelivery.cityInfo" placeholder="城市信息"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditOrderDelivery.address')" prop="address"> |
||||||
|
<el-input type="" v-model="creditOrderDelivery.address" placeholder="收货详细地址"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditOrderDelivery.longitude')" prop="longitude"> |
||||||
|
<el-input type="" v-model="creditOrderDelivery.longitude" placeholder="经度"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditOrderDelivery.latitude')" prop="latitude"> |
||||||
|
<el-input type="" v-model="creditOrderDelivery.latitude" placeholder="纬度"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditOrderDelivery.isDelete')" prop="isDelete"> |
||||||
|
<el-input type="" v-model="creditOrderDelivery.isDelete" placeholder="逻辑删除:1-删除 0-未删除"/> |
||||||
|
</el-form-item> |
||||||
|
</el-form> |
||||||
|
<div class="dialog-footer" slot="footer"> |
||||||
|
<el-button @click="isVisible = false" plain type="warning"> |
||||||
|
{{ $t("common.cancel") }} |
||||||
|
</el-button> |
||||||
|
<el-button @click="submitForm" :disabled="confirmDisabled" plain type="primary"> |
||||||
|
{{ $t("common.confirm") }} |
||||||
|
</el-button> |
||||||
|
</div> |
||||||
|
</el-dialog> |
||||||
|
</template> |
||||||
|
<script> |
||||||
|
import elDragDialog from '@/directive/el-drag-dialog' |
||||||
|
import creditOrderDeliveryApi from "@/api/creditGoods/CreditOrderDelivery.js"; |
||||||
|
|
||||||
|
export default { |
||||||
|
name: "CreditOrderDeliveryEdit", |
||||||
|
directives: { elDragDialog }, |
||||||
|
components: { }, |
||||||
|
props: { |
||||||
|
dialogVisible: { |
||||||
|
type: Boolean, |
||||||
|
default: false |
||||||
|
}, |
||||||
|
type: { |
||||||
|
type: String, |
||||||
|
default: "add" |
||||||
|
} |
||||||
|
}, |
||||||
|
data() { |
||||||
|
return { |
||||||
|
confirmDisabled: false, |
||||||
|
creditOrderDelivery: this.initCreditOrderDelivery(), |
||||||
|
screenWidth: 0, |
||||||
|
width: this.initWidth(), |
||||||
|
rules: { |
||||||
|
|
||||||
|
}, |
||||||
|
// 枚举 |
||||||
|
enums: { |
||||||
|
}, |
||||||
|
// 字典 |
||||||
|
dicts: { |
||||||
|
} |
||||||
|
}; |
||||||
|
}, |
||||||
|
computed: { |
||||||
|
isVisible: { |
||||||
|
get() { |
||||||
|
return this.dialogVisible; |
||||||
|
}, |
||||||
|
set() { |
||||||
|
this.close(); |
||||||
|
this.reset(); |
||||||
|
} |
||||||
|
}, |
||||||
|
title() { |
||||||
|
return this.$t("common." + this.type); |
||||||
|
} |
||||||
|
}, |
||||||
|
watch: {}, |
||||||
|
mounted() { |
||||||
|
window.onresize = () => { |
||||||
|
return (() => { |
||||||
|
this.width = this.initWidth(); |
||||||
|
})(); |
||||||
|
}; |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
initCreditOrderDelivery() { |
||||||
|
return { |
||||||
|
id: "", |
||||||
|
orderId: null, |
||||||
|
state: null, |
||||||
|
username: '', |
||||||
|
phone: '', |
||||||
|
province: '', |
||||||
|
city: '', |
||||||
|
area: '', |
||||||
|
cityInfo: '', |
||||||
|
address: '', |
||||||
|
longitude: null, |
||||||
|
latitude: null, |
||||||
|
isDelete: null, |
||||||
|
}; |
||||||
|
}, |
||||||
|
initWidth() { |
||||||
|
this.screenWidth = document.body.clientWidth; |
||||||
|
if (this.screenWidth < 991) { |
||||||
|
return "90%"; |
||||||
|
} else if (this.screenWidth < 1400) { |
||||||
|
return "45%"; |
||||||
|
} else { |
||||||
|
return "800px"; |
||||||
|
} |
||||||
|
}, |
||||||
|
setCreditOrderDelivery(val = {}) { |
||||||
|
const vm = this; |
||||||
|
|
||||||
|
vm.dicts = val['dicts']; |
||||||
|
vm.enums = val['enums']; |
||||||
|
if (val['row']) { |
||||||
|
vm.creditOrderDelivery = { ...val['row'] }; |
||||||
|
|
||||||
|
} |
||||||
|
}, |
||||||
|
close() { |
||||||
|
this.$emit("close"); |
||||||
|
}, |
||||||
|
reset() { |
||||||
|
// 先清除校验,再清除表单,不然有奇怪的bug |
||||||
|
this.$refs.form.clearValidate(); |
||||||
|
this.$refs.form.resetFields(); |
||||||
|
this.confirmDisabled = false; |
||||||
|
this.creditOrderDelivery = this.initCreditOrderDelivery(); |
||||||
|
}, |
||||||
|
submitForm() { |
||||||
|
const vm = this; |
||||||
|
this.$refs.form.validate(valid => { |
||||||
|
if (valid) { |
||||||
|
vm.editSubmit(); |
||||||
|
} else { |
||||||
|
return false; |
||||||
|
} |
||||||
|
}); |
||||||
|
}, |
||||||
|
editSubmit() { |
||||||
|
const vm = this; |
||||||
|
if (vm.type === "edit") { |
||||||
|
vm.update(); |
||||||
|
} else { |
||||||
|
vm.save(); |
||||||
|
} |
||||||
|
}, |
||||||
|
save() { |
||||||
|
const vm = this; |
||||||
|
vm.confirmDisabled = true; |
||||||
|
creditOrderDeliveryApi.save(this.creditOrderDelivery).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
vm.isVisible = false; |
||||||
|
vm.$message({ |
||||||
|
message: vm.$t("tips.createSuccess"), |
||||||
|
type: "success" |
||||||
|
}); |
||||||
|
vm.$emit("success"); |
||||||
|
} |
||||||
|
}).finally(()=> vm.confirmDisabled = false); |
||||||
|
}, |
||||||
|
update() { |
||||||
|
const vm = this; |
||||||
|
vm.confirmDisabled = true; |
||||||
|
creditOrderDeliveryApi.update(this.creditOrderDelivery).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
vm.isVisible = false; |
||||||
|
vm.$message({ |
||||||
|
message: this.$t("tips.updateSuccess"), |
||||||
|
type: "success" |
||||||
|
}); |
||||||
|
vm.$emit("success"); |
||||||
|
} |
||||||
|
}).finally(()=> vm.confirmDisabled = false); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
</script> |
||||||
|
<style lang="scss" scoped></style> |
@ -0,0 +1,398 @@ |
|||||||
|
<template> |
||||||
|
<div class="app-container"> |
||||||
|
<div class="filter-container"> |
||||||
|
<el-input |
||||||
|
:placeholder="$t('table.creditOrderDelivery.username')" |
||||||
|
class="filter-item search-item" |
||||||
|
v-model="queryParams.model.username" |
||||||
|
/> |
||||||
|
<el-input |
||||||
|
:placeholder="$t('table.creditOrderDelivery.phone')" |
||||||
|
class="filter-item search-item" |
||||||
|
v-model="queryParams.model.phone" |
||||||
|
/> |
||||||
|
<el-input |
||||||
|
:placeholder="$t('table.creditOrderDelivery.address')" |
||||||
|
class="filter-item search-item" |
||||||
|
v-model="queryParams.model.address" |
||||||
|
/> |
||||||
|
|
||||||
|
<el-date-picker :range-separator="null" class="filter-item search-item date-range-item" |
||||||
|
end-placeholder="结束日期" format="yyyy-MM-dd HH:mm:ss" start-placeholder="开始日期" |
||||||
|
type="daterange" v-model="queryParams.timeRange" value-format="yyyy-MM-dd HH:mm:ss" |
||||||
|
/> |
||||||
|
<el-button @click="search" class="filter-item" plain type="primary"> |
||||||
|
{{ $t("table.search") }} |
||||||
|
</el-button> |
||||||
|
<el-button @click="reset" class="filter-item" plain type="warning"> |
||||||
|
{{ $t("table.reset") }} |
||||||
|
</el-button> |
||||||
|
<el-button @click="add" class="filter-item" plain type="danger" v-has-permission="['creditOrderDelivery:add']"> |
||||||
|
{{ $t("table.add") }} |
||||||
|
</el-button> |
||||||
|
<el-dropdown class="filter-item" trigger="click" v-has-any-permission="['creditOrderDelivery:delete', 'creditOrderDelivery:export', |
||||||
|
'creditOrderDelivery:import']"> |
||||||
|
<el-button> |
||||||
|
{{ $t("table.more") }}<i class="el-icon-arrow-down el-icon--right" /> |
||||||
|
</el-button> |
||||||
|
<el-dropdown-menu slot="dropdown"> |
||||||
|
<el-dropdown-item @click.native="batchDelete" v-has-permission="['creditOrderDelivery:delete']"> |
||||||
|
{{ $t("table.delete") }} |
||||||
|
</el-dropdown-item> |
||||||
|
<el-dropdown-item @click.native="exportExcel" v-has-permission="['creditOrderDelivery:export']"> |
||||||
|
{{ $t("table.export") }} |
||||||
|
</el-dropdown-item> |
||||||
|
<el-dropdown-item @click.native="exportExcelPreview" v-has-permission="['creditOrderDelivery:export']"> |
||||||
|
{{ $t("table.exportPreview") }} |
||||||
|
</el-dropdown-item> |
||||||
|
<el-dropdown-item @click.native="importExcel" v-has-permission="['creditOrderDelivery:import']"> |
||||||
|
{{ $t("table.import") }} |
||||||
|
</el-dropdown-item> |
||||||
|
</el-dropdown-menu> |
||||||
|
</el-dropdown> |
||||||
|
</div> |
||||||
|
|
||||||
|
<el-table :data="tableData.records" :key="tableKey" @cell-click="cellClick" |
||||||
|
@filter-change="filterChange" @selection-change="onSelectChange" @sort-change="sortChange" |
||||||
|
border fit row-key="id" ref="table" style="width: 100%;" v-loading="loading"> |
||||||
|
<el-table-column align="center" type="selection" width="40px" :reserve-selection="true"/> |
||||||
|
<el-table-column :label="$t('table.creditOrderDelivery.orderId')" :show-overflow-tooltip="true" align="center" prop="orderId" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.orderId }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditOrderDelivery.state')" :show-overflow-tooltip="true" align="center" prop="state" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.state }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditOrderDelivery.username')" :show-overflow-tooltip="true" align="center" prop="username" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.username }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditOrderDelivery.phone')" :show-overflow-tooltip="true" align="center" prop="phone" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.phone }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditOrderDelivery.province')" :show-overflow-tooltip="true" align="center" prop="province" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.province }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditOrderDelivery.city')" :show-overflow-tooltip="true" align="center" prop="city" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.city }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditOrderDelivery.area')" :show-overflow-tooltip="true" align="center" prop="area" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.area }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditOrderDelivery.cityInfo')" :show-overflow-tooltip="true" align="center" prop="cityInfo" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.cityInfo }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditOrderDelivery.address')" :show-overflow-tooltip="true" align="center" prop="address" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.address }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditOrderDelivery.longitude')" :show-overflow-tooltip="true" align="center" prop="longitude" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.longitude }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditOrderDelivery.latitude')" :show-overflow-tooltip="true" align="center" prop="latitude" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.latitude }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditOrderDelivery.isDelete')" :show-overflow-tooltip="true" align="center" prop="isDelete" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.isDelete }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column |
||||||
|
:label="$t('table.createTime')" |
||||||
|
align="center" |
||||||
|
prop="createTime" |
||||||
|
sortable="custom" |
||||||
|
width="170px"> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.createTime }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column |
||||||
|
:label="$t('table.operation')" align="center" column-key="operation" class-name="small-padding fixed-width" width="100px"> |
||||||
|
<template slot-scope="{ row }"> |
||||||
|
<i @click="copy(row)" class="el-icon-copy-document table-operation" :title="$t('common.delete')" |
||||||
|
style="color: #2db7f5;" v-hasPermission="['creditOrderDelivery:add']"/> |
||||||
|
<i @click="edit(row)" class="el-icon-edit table-operation" :title="$t('common.delete')" |
||||||
|
style="color: #2db7f5;" v-hasPermission="['creditOrderDelivery:update']"/> |
||||||
|
<i @click="singleDelete(row)" class="el-icon-delete table-operation" :title="$t('common.delete')" |
||||||
|
style="color: #f50;" v-hasPermission="['creditOrderDelivery:delete']"/> |
||||||
|
<el-link class="no-perm" v-has-no-permission="['creditOrderDelivery:update', 'creditOrderDelivery:copy', 'creditOrderDelivery:delete']"> |
||||||
|
{{ $t("tips.noPermission") }} |
||||||
|
</el-link> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
</el-table> |
||||||
|
<pagination :limit.sync="queryParams.size" :page.sync="queryParams.current" |
||||||
|
:total="Number(tableData.total)" @pagination="fetch" v-show="tableData.total > 0"/> |
||||||
|
<creditOrderDelivery-edit :dialog-visible="dialog.isVisible" :type="dialog.type" |
||||||
|
@close="editClose" @success="editSuccess" ref="edit"/> |
||||||
|
<creditOrderDelivery-import ref="import" :dialog-visible="fileImport.isVisible" :type="fileImport.type" |
||||||
|
:action="fileImport.action" accept=".xls,.xlsx" @close="importClose" @success="importSuccess" /> |
||||||
|
<el-dialog :close-on-click-modal="false" :close-on-press-escape="true" |
||||||
|
title="预览" width="80%" top="50px" :visible.sync="preview.isVisible" v-el-drag-dialog> |
||||||
|
<el-scrollbar> |
||||||
|
<div v-html="preview.context"></div> |
||||||
|
</el-scrollbar> |
||||||
|
</el-dialog> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
import Pagination from "@/components/Pagination"; |
||||||
|
import elDragDialog from '@/directive/el-drag-dialog' |
||||||
|
import CreditOrderDeliveryEdit from "./Edit"; |
||||||
|
import creditOrderDeliveryApi from "@/api/creditGoods/CreditOrderDelivery.js"; |
||||||
|
import CreditOrderDeliveryImport from "@/components/ceres/Import" |
||||||
|
import {convertEnum} from '@/utils/utils' |
||||||
|
import {downloadFile, loadEnums, initDicts, initQueryParams} from '@/utils/commons' |
||||||
|
|
||||||
|
export default { |
||||||
|
name: "CreditOrderDeliveryManage", |
||||||
|
directives: { elDragDialog }, |
||||||
|
components: { Pagination, CreditOrderDeliveryEdit, CreditOrderDeliveryImport}, |
||||||
|
filters: { |
||||||
|
|
||||||
|
}, |
||||||
|
data() { |
||||||
|
return { |
||||||
|
// 编辑 |
||||||
|
dialog: { |
||||||
|
isVisible: false, |
||||||
|
type: "add" |
||||||
|
}, |
||||||
|
// 预览 |
||||||
|
preview: { |
||||||
|
isVisible: false, |
||||||
|
context: '' |
||||||
|
}, |
||||||
|
// 导入 |
||||||
|
fileImport: { |
||||||
|
isVisible: false, |
||||||
|
type: "import", |
||||||
|
action: `${process.env.VUE_APP_BASE_API}/store/creditOrderDelivery/import` |
||||||
|
}, |
||||||
|
tableKey: 0, |
||||||
|
queryParams: initQueryParams(), |
||||||
|
selection: [], |
||||||
|
loading: false, |
||||||
|
tableData: { |
||||||
|
total: 0 |
||||||
|
}, |
||||||
|
// 枚举 |
||||||
|
enums: { |
||||||
|
}, |
||||||
|
// 字典 |
||||||
|
dicts: { |
||||||
|
} |
||||||
|
}; |
||||||
|
}, |
||||||
|
computed: { |
||||||
|
}, |
||||||
|
watch: { |
||||||
|
}, |
||||||
|
mounted() { |
||||||
|
this.fetch(); |
||||||
|
|
||||||
|
// 初始化字典和枚举 |
||||||
|
const enumList = []; |
||||||
|
const dictList = []; |
||||||
|
loadEnums(enumList, this.enums, 'store'); |
||||||
|
initDicts(dictList, this.dicts); |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
editClose() { |
||||||
|
this.dialog.isVisible = false; |
||||||
|
}, |
||||||
|
editSuccess() { |
||||||
|
this.search(); |
||||||
|
}, |
||||||
|
onSelectChange(selection) { |
||||||
|
this.selection = selection; |
||||||
|
}, |
||||||
|
search() { |
||||||
|
this.fetch({ |
||||||
|
...this.queryParams |
||||||
|
}); |
||||||
|
}, |
||||||
|
reset() { |
||||||
|
this.queryParams = initQueryParams(); |
||||||
|
this.$refs.table.clearSort(); |
||||||
|
this.$refs.table.clearFilter(); |
||||||
|
this.search(); |
||||||
|
}, |
||||||
|
exportExcelPreview() { |
||||||
|
if (this.queryParams.timeRange) { |
||||||
|
this.queryParams.map.createTime_st = this.queryParams.timeRange[0]; |
||||||
|
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1]; |
||||||
|
} |
||||||
|
this.queryParams.map.fileName = '导出数据'; |
||||||
|
creditOrderDeliveryApi.preview(this.queryParams).then(response => { |
||||||
|
const res = response.data; |
||||||
|
this.preview.isVisible = true; |
||||||
|
this.preview.context = res.data; |
||||||
|
}); |
||||||
|
}, |
||||||
|
exportExcel() { |
||||||
|
if (this.queryParams.timeRange) { |
||||||
|
this.queryParams.map.createTime_st = this.queryParams.timeRange[0]; |
||||||
|
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1]; |
||||||
|
} |
||||||
|
this.queryParams.map.fileName = '导出数据'; |
||||||
|
creditOrderDeliveryApi.export(this.queryParams).then(response => { |
||||||
|
downloadFile(response); |
||||||
|
}); |
||||||
|
}, |
||||||
|
importExcel() { |
||||||
|
this.fileImport.type = "upload"; |
||||||
|
this.fileImport.isVisible = true; |
||||||
|
this.$refs.import.setModel(false); |
||||||
|
}, |
||||||
|
importSuccess() { |
||||||
|
this.search(); |
||||||
|
}, |
||||||
|
importClose() { |
||||||
|
this.fileImport.isVisible = false; |
||||||
|
}, |
||||||
|
singleDelete(row) { |
||||||
|
this.$refs.table.clearSelection() |
||||||
|
this.$refs.table.toggleRowSelection(row, true); |
||||||
|
this.batchDelete(); |
||||||
|
}, |
||||||
|
batchDelete() { |
||||||
|
if (!this.selection.length) { |
||||||
|
this.$message({ |
||||||
|
message: this.$t("tips.noDataSelected"), |
||||||
|
type: "warning" |
||||||
|
}); |
||||||
|
return; |
||||||
|
} |
||||||
|
this.$confirm(this.$t("tips.confirmDelete"), this.$t("common.tips"), { |
||||||
|
confirmButtonText: this.$t("common.confirm"), |
||||||
|
cancelButtonText: this.$t("common.cancel"), |
||||||
|
type: "warning" |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
const ids = this.selection.map(u => u.id); |
||||||
|
this.delete(ids); |
||||||
|
}) |
||||||
|
.catch(() => { |
||||||
|
this.clearSelections(); |
||||||
|
}); |
||||||
|
}, |
||||||
|
clearSelections() { |
||||||
|
this.$refs.table.clearSelection(); |
||||||
|
}, |
||||||
|
delete(ids) { |
||||||
|
creditOrderDeliveryApi.delete({ ids: ids }).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
this.$message({ |
||||||
|
message: this.$t("tips.deleteSuccess"), |
||||||
|
type: "success" |
||||||
|
}); |
||||||
|
this.search(); |
||||||
|
} |
||||||
|
}); |
||||||
|
}, |
||||||
|
add() { |
||||||
|
this.dialog.type = "add"; |
||||||
|
this.dialog.isVisible = true; |
||||||
|
this.$refs.edit.setCreditOrderDelivery({ enums: this.enums, dicts: this.dicts}); |
||||||
|
}, |
||||||
|
copy(row) { |
||||||
|
this.$refs.edit.setCreditOrderDelivery({row, enums: this.enums, dicts: this.dicts}); |
||||||
|
this.dialog.type = "copy"; |
||||||
|
this.dialog.isVisible = true; |
||||||
|
}, |
||||||
|
edit(row) { |
||||||
|
this.$refs.edit.setCreditOrderDelivery({row, enums: this.enums, dicts: this.dicts}); |
||||||
|
this.dialog.type = "edit"; |
||||||
|
this.dialog.isVisible = true; |
||||||
|
}, |
||||||
|
fetch(params = {}) { |
||||||
|
this.loading = true; |
||||||
|
if (this.queryParams.timeRange) { |
||||||
|
this.queryParams.map.createTime_st = this.queryParams.timeRange[0]; |
||||||
|
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1]; |
||||||
|
} |
||||||
|
|
||||||
|
this.queryParams.current = params.current ? params.current : this.queryParams.current; |
||||||
|
this.queryParams.size = params.size ? params.size : this.queryParams.size; |
||||||
|
|
||||||
|
creditOrderDeliveryApi.page(this.queryParams).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
this.tableData = res.data; |
||||||
|
} |
||||||
|
}).finally(() => this.loading = false); |
||||||
|
}, |
||||||
|
sortChange(val) { |
||||||
|
this.queryParams.sort = val.prop; |
||||||
|
this.queryParams.order = val.order; |
||||||
|
if (this.queryParams.sort) { |
||||||
|
this.search(); |
||||||
|
} |
||||||
|
}, |
||||||
|
filterChange (filters) { |
||||||
|
for (const key in filters) { |
||||||
|
if(key.includes('.')) { |
||||||
|
const val = { }; |
||||||
|
val[key.split('.')[1]] = filters[key][0]; |
||||||
|
this.queryParams.model[key.split('.')[0]] = val; |
||||||
|
} else { |
||||||
|
this.queryParams.model[key] = filters[key][0] |
||||||
|
} |
||||||
|
} |
||||||
|
this.search() |
||||||
|
}, |
||||||
|
cellClick (row, column) { |
||||||
|
if (column['columnKey'] === "operation") { |
||||||
|
return; |
||||||
|
} |
||||||
|
let flag = false; |
||||||
|
this.selection.forEach((item)=>{ |
||||||
|
if(item.id === row.id) { |
||||||
|
flag = true; |
||||||
|
this.$refs.table.toggleRowSelection(row); |
||||||
|
} |
||||||
|
}) |
||||||
|
|
||||||
|
if(!flag){ |
||||||
|
this.$refs.table.toggleRowSelection(row, true); |
||||||
|
} |
||||||
|
}, |
||||||
|
} |
||||||
|
}; |
||||||
|
</script> |
||||||
|
<style lang="scss" scoped></style> |
@ -0,0 +1,222 @@ |
|||||||
|
<template> |
||||||
|
<el-dialog :close-on-click-modal="false" :close-on-press-escape="true" :title="title" :type="type" |
||||||
|
:visible.sync="isVisible" :width="width" top="50px" v-el-drag-dialog> |
||||||
|
<el-form :model="creditOrderDetail" :rules="rules" label-position="right" label-width="100px" ref="form"> |
||||||
|
<el-form-item :label="$t('table.creditOrderDetail.orderId')" prop="orderId"> |
||||||
|
<el-input type="" v-model="creditOrderDetail.orderId" placeholder="订单ID"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditOrderDetail.goodsId')" prop="goodsId"> |
||||||
|
<el-input type="" v-model="creditOrderDetail.goodsId" placeholder="商品ID"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditOrderDetail.categoryId')" prop="categoryId"> |
||||||
|
<el-input type="" v-model="creditOrderDetail.categoryId" placeholder="商品分类ID"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditOrderDetail.name')" prop="name"> |
||||||
|
<el-input type="" v-model="creditOrderDetail.name" placeholder="商品名"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditOrderDetail.description')" prop="description"> |
||||||
|
<el-input type="" v-model="creditOrderDetail.description" placeholder="商品描述"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditOrderDetail.worth')" prop="worth"> |
||||||
|
<el-input type="" v-model="creditOrderDetail.worth" placeholder="商品价值(人民币)"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditOrderDetail.price')" prop="price"> |
||||||
|
<el-input type="" v-model="creditOrderDetail.price" placeholder="商品价格(积分)"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditOrderDetail.couponId')" prop="couponId"> |
||||||
|
<el-input type="" v-model="creditOrderDetail.couponId" placeholder="优惠券ID(如果该值大于0,则购买之后赠送相应的优惠券)"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditOrderDetail.canPick')" prop="canPick"> |
||||||
|
<el-radio-group v-model="creditOrderDetail.canPick" size="medium"> |
||||||
|
<el-radio-button :label="true">{{ $t("common.yes") }}</el-radio-button> |
||||||
|
<el-radio-button :label="false">{{ $t("common.no") }}</el-radio-button> |
||||||
|
</el-radio-group> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditOrderDetail.canDelivery')" prop="canDelivery"> |
||||||
|
<el-radio-group v-model="creditOrderDetail.canDelivery" size="medium"> |
||||||
|
<el-radio-button :label="true">{{ $t("common.yes") }}</el-radio-button> |
||||||
|
<el-radio-button :label="false">{{ $t("common.no") }}</el-radio-button> |
||||||
|
</el-radio-group> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditOrderDetail.goodsMainImg')" prop="goodsMainImg"> |
||||||
|
<el-input type="" v-model="creditOrderDetail.goodsMainImg" placeholder="商品主图路径"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditOrderDetail.goodsViceImg')" prop="goodsViceImg"> |
||||||
|
<el-input type="" v-model="creditOrderDetail.goodsViceImg" placeholder="商品副图的路径集合"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditOrderDetail.goodsNumber')" prop="goodsNumber"> |
||||||
|
<el-input type="" v-model="creditOrderDetail.goodsNumber" placeholder="商品数量"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.creditOrderDetail.isDelete')" prop="isDelete"> |
||||||
|
<el-input type="" v-model="creditOrderDetail.isDelete" placeholder="逻辑删除:1-删除 0-未删除"/> |
||||||
|
</el-form-item> |
||||||
|
</el-form> |
||||||
|
<div class="dialog-footer" slot="footer"> |
||||||
|
<el-button @click="isVisible = false" plain type="warning"> |
||||||
|
{{ $t("common.cancel") }} |
||||||
|
</el-button> |
||||||
|
<el-button @click="submitForm" :disabled="confirmDisabled" plain type="primary"> |
||||||
|
{{ $t("common.confirm") }} |
||||||
|
</el-button> |
||||||
|
</div> |
||||||
|
</el-dialog> |
||||||
|
</template> |
||||||
|
<script> |
||||||
|
import elDragDialog from '@/directive/el-drag-dialog' |
||||||
|
import creditOrderDetailApi from "@/api/creditGoods/CreditOrderDetail.js"; |
||||||
|
|
||||||
|
export default { |
||||||
|
name: "CreditOrderDetailEdit", |
||||||
|
directives: { elDragDialog }, |
||||||
|
components: { }, |
||||||
|
props: { |
||||||
|
dialogVisible: { |
||||||
|
type: Boolean, |
||||||
|
default: false |
||||||
|
}, |
||||||
|
type: { |
||||||
|
type: String, |
||||||
|
default: "add" |
||||||
|
} |
||||||
|
}, |
||||||
|
data() { |
||||||
|
return { |
||||||
|
confirmDisabled: false, |
||||||
|
creditOrderDetail: this.initCreditOrderDetail(), |
||||||
|
screenWidth: 0, |
||||||
|
width: this.initWidth(), |
||||||
|
rules: { |
||||||
|
|
||||||
|
}, |
||||||
|
// 枚举 |
||||||
|
enums: { |
||||||
|
}, |
||||||
|
// 字典 |
||||||
|
dicts: { |
||||||
|
} |
||||||
|
}; |
||||||
|
}, |
||||||
|
computed: { |
||||||
|
isVisible: { |
||||||
|
get() { |
||||||
|
return this.dialogVisible; |
||||||
|
}, |
||||||
|
set() { |
||||||
|
this.close(); |
||||||
|
this.reset(); |
||||||
|
} |
||||||
|
}, |
||||||
|
title() { |
||||||
|
return this.$t("common." + this.type); |
||||||
|
} |
||||||
|
}, |
||||||
|
watch: {}, |
||||||
|
mounted() { |
||||||
|
window.onresize = () => { |
||||||
|
return (() => { |
||||||
|
this.width = this.initWidth(); |
||||||
|
})(); |
||||||
|
}; |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
initCreditOrderDetail() { |
||||||
|
return { |
||||||
|
id: "", |
||||||
|
orderId: null, |
||||||
|
goodsId: null, |
||||||
|
categoryId: null, |
||||||
|
name: '', |
||||||
|
description: '', |
||||||
|
worth: null, |
||||||
|
price: null, |
||||||
|
couponId: null, |
||||||
|
canPick: true, |
||||||
|
canDelivery: true, |
||||||
|
goodsMainImg: '', |
||||||
|
goodsViceImg: '', |
||||||
|
goodsNumber: null, |
||||||
|
isDelete: null, |
||||||
|
}; |
||||||
|
}, |
||||||
|
initWidth() { |
||||||
|
this.screenWidth = document.body.clientWidth; |
||||||
|
if (this.screenWidth < 991) { |
||||||
|
return "90%"; |
||||||
|
} else if (this.screenWidth < 1400) { |
||||||
|
return "45%"; |
||||||
|
} else { |
||||||
|
return "800px"; |
||||||
|
} |
||||||
|
}, |
||||||
|
setCreditOrderDetail(val = {}) { |
||||||
|
const vm = this; |
||||||
|
|
||||||
|
vm.dicts = val['dicts']; |
||||||
|
vm.enums = val['enums']; |
||||||
|
if (val['row']) { |
||||||
|
vm.creditOrderDetail = { ...val['row'] }; |
||||||
|
|
||||||
|
} |
||||||
|
}, |
||||||
|
close() { |
||||||
|
this.$emit("close"); |
||||||
|
}, |
||||||
|
reset() { |
||||||
|
// 先清除校验,再清除表单,不然有奇怪的bug |
||||||
|
this.$refs.form.clearValidate(); |
||||||
|
this.$refs.form.resetFields(); |
||||||
|
this.confirmDisabled = false; |
||||||
|
this.creditOrderDetail = this.initCreditOrderDetail(); |
||||||
|
}, |
||||||
|
submitForm() { |
||||||
|
const vm = this; |
||||||
|
this.$refs.form.validate(valid => { |
||||||
|
if (valid) { |
||||||
|
vm.editSubmit(); |
||||||
|
} else { |
||||||
|
return false; |
||||||
|
} |
||||||
|
}); |
||||||
|
}, |
||||||
|
editSubmit() { |
||||||
|
const vm = this; |
||||||
|
if (vm.type === "edit") { |
||||||
|
vm.update(); |
||||||
|
} else { |
||||||
|
vm.save(); |
||||||
|
} |
||||||
|
}, |
||||||
|
save() { |
||||||
|
const vm = this; |
||||||
|
vm.confirmDisabled = true; |
||||||
|
creditOrderDetailApi.save(this.creditOrderDetail).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
vm.isVisible = false; |
||||||
|
vm.$message({ |
||||||
|
message: vm.$t("tips.createSuccess"), |
||||||
|
type: "success" |
||||||
|
}); |
||||||
|
vm.$emit("success"); |
||||||
|
} |
||||||
|
}).finally(()=> vm.confirmDisabled = false); |
||||||
|
}, |
||||||
|
update() { |
||||||
|
const vm = this; |
||||||
|
vm.confirmDisabled = true; |
||||||
|
creditOrderDetailApi.update(this.creditOrderDetail).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
vm.isVisible = false; |
||||||
|
vm.$message({ |
||||||
|
message: this.$t("tips.updateSuccess"), |
||||||
|
type: "success" |
||||||
|
}); |
||||||
|
vm.$emit("success"); |
||||||
|
} |
||||||
|
}).finally(()=> vm.confirmDisabled = false); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
</script> |
||||||
|
<style lang="scss" scoped></style> |
@ -0,0 +1,423 @@ |
|||||||
|
<template> |
||||||
|
<div class="app-container"> |
||||||
|
<div class="filter-container"> |
||||||
|
<el-input |
||||||
|
:placeholder="$t('table.creditOrderDetail.name')" |
||||||
|
class="filter-item search-item" |
||||||
|
v-model="queryParams.model.name" |
||||||
|
/> |
||||||
|
<el-input |
||||||
|
:placeholder="$t('table.creditOrderDetail.description')" |
||||||
|
class="filter-item search-item" |
||||||
|
v-model="queryParams.model.description" |
||||||
|
/> |
||||||
|
<el-input |
||||||
|
:placeholder="$t('table.creditOrderDetail.goodsMainImg')" |
||||||
|
class="filter-item search-item" |
||||||
|
v-model="queryParams.model.goodsMainImg" |
||||||
|
/> |
||||||
|
<el-input |
||||||
|
:placeholder="$t('table.creditOrderDetail.goodsViceImg')" |
||||||
|
class="filter-item search-item" |
||||||
|
v-model="queryParams.model.goodsViceImg" |
||||||
|
/> |
||||||
|
|
||||||
|
<el-date-picker :range-separator="null" class="filter-item search-item date-range-item" |
||||||
|
end-placeholder="结束日期" format="yyyy-MM-dd HH:mm:ss" start-placeholder="开始日期" |
||||||
|
type="daterange" v-model="queryParams.timeRange" value-format="yyyy-MM-dd HH:mm:ss" |
||||||
|
/> |
||||||
|
<el-button @click="search" class="filter-item" plain type="primary"> |
||||||
|
{{ $t("table.search") }} |
||||||
|
</el-button> |
||||||
|
<el-button @click="reset" class="filter-item" plain type="warning"> |
||||||
|
{{ $t("table.reset") }} |
||||||
|
</el-button> |
||||||
|
<el-button @click="add" class="filter-item" plain type="danger" v-has-permission="['creditOrderDetail:add']"> |
||||||
|
{{ $t("table.add") }} |
||||||
|
</el-button> |
||||||
|
<el-dropdown class="filter-item" trigger="click" v-has-any-permission="['creditOrderDetail:delete', 'creditOrderDetail:export', |
||||||
|
'creditOrderDetail:import']"> |
||||||
|
<el-button> |
||||||
|
{{ $t("table.more") }}<i class="el-icon-arrow-down el-icon--right" /> |
||||||
|
</el-button> |
||||||
|
<el-dropdown-menu slot="dropdown"> |
||||||
|
<el-dropdown-item @click.native="batchDelete" v-has-permission="['creditOrderDetail:delete']"> |
||||||
|
{{ $t("table.delete") }} |
||||||
|
</el-dropdown-item> |
||||||
|
<el-dropdown-item @click.native="exportExcel" v-has-permission="['creditOrderDetail:export']"> |
||||||
|
{{ $t("table.export") }} |
||||||
|
</el-dropdown-item> |
||||||
|
<el-dropdown-item @click.native="exportExcelPreview" v-has-permission="['creditOrderDetail:export']"> |
||||||
|
{{ $t("table.exportPreview") }} |
||||||
|
</el-dropdown-item> |
||||||
|
<el-dropdown-item @click.native="importExcel" v-has-permission="['creditOrderDetail:import']"> |
||||||
|
{{ $t("table.import") }} |
||||||
|
</el-dropdown-item> |
||||||
|
</el-dropdown-menu> |
||||||
|
</el-dropdown> |
||||||
|
</div> |
||||||
|
|
||||||
|
<el-table :data="tableData.records" :key="tableKey" @cell-click="cellClick" |
||||||
|
@filter-change="filterChange" @selection-change="onSelectChange" @sort-change="sortChange" |
||||||
|
border fit row-key="id" ref="table" style="width: 100%;" v-loading="loading"> |
||||||
|
<el-table-column align="center" type="selection" width="40px" :reserve-selection="true"/> |
||||||
|
<el-table-column :label="$t('table.creditOrderDetail.orderId')" :show-overflow-tooltip="true" align="center" prop="orderId" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.orderId }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditOrderDetail.goodsId')" :show-overflow-tooltip="true" align="center" prop="goodsId" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.goodsId }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditOrderDetail.categoryId')" :show-overflow-tooltip="true" align="center" prop="categoryId" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.categoryId }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditOrderDetail.name')" :show-overflow-tooltip="true" align="center" prop="name" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.name }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditOrderDetail.description')" :show-overflow-tooltip="true" align="center" prop="description" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.description }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditOrderDetail.worth')" :show-overflow-tooltip="true" align="center" prop="worth" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.worth }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditOrderDetail.price')" :show-overflow-tooltip="true" align="center" prop="price" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.price }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditOrderDetail.couponId')" :show-overflow-tooltip="true" align="center" prop="couponId" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.couponId }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditOrderDetail.canPick')" :show-overflow-tooltip="true" align="center" prop="canPick" |
||||||
|
:filter-multiple="false" column-key="canPick" |
||||||
|
:filters="[{ text: $t('common.yes'), value: 'true' }, { text: $t('common.no'), value: 'false' }]" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<el-tag :type="scope.row.canPick ? 'success' : 'danger'" slot> |
||||||
|
{{ scope.row.canPick ? $t("common.yes") : $t("common.no") }} |
||||||
|
</el-tag> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditOrderDetail.canDelivery')" :show-overflow-tooltip="true" align="center" prop="canDelivery" |
||||||
|
:filter-multiple="false" column-key="canDelivery" |
||||||
|
:filters="[{ text: $t('common.yes'), value: 'true' }, { text: $t('common.no'), value: 'false' }]" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<el-tag :type="scope.row.canDelivery ? 'success' : 'danger'" slot> |
||||||
|
{{ scope.row.canDelivery ? $t("common.yes") : $t("common.no") }} |
||||||
|
</el-tag> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditOrderDetail.goodsMainImg')" :show-overflow-tooltip="true" align="center" prop="goodsMainImg" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.goodsMainImg }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditOrderDetail.goodsViceImg')" :show-overflow-tooltip="true" align="center" prop="goodsViceImg" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.goodsViceImg }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditOrderDetail.goodsNumber')" :show-overflow-tooltip="true" align="center" prop="goodsNumber" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.goodsNumber }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.creditOrderDetail.isDelete')" :show-overflow-tooltip="true" align="center" prop="isDelete" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.isDelete }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column |
||||||
|
:label="$t('table.createTime')" |
||||||
|
align="center" |
||||||
|
prop="createTime" |
||||||
|
sortable="custom" |
||||||
|
width="170px"> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.createTime }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column |
||||||
|
:label="$t('table.operation')" align="center" column-key="operation" class-name="small-padding fixed-width" width="100px"> |
||||||
|
<template slot-scope="{ row }"> |
||||||
|
<i @click="copy(row)" class="el-icon-copy-document table-operation" :title="$t('common.delete')" |
||||||
|
style="color: #2db7f5;" v-hasPermission="['creditOrderDetail:add']"/> |
||||||
|
<i @click="edit(row)" class="el-icon-edit table-operation" :title="$t('common.delete')" |
||||||
|
style="color: #2db7f5;" v-hasPermission="['creditOrderDetail:update']"/> |
||||||
|
<i @click="singleDelete(row)" class="el-icon-delete table-operation" :title="$t('common.delete')" |
||||||
|
style="color: #f50;" v-hasPermission="['creditOrderDetail:delete']"/> |
||||||
|
<el-link class="no-perm" v-has-no-permission="['creditOrderDetail:update', 'creditOrderDetail:copy', 'creditOrderDetail:delete']"> |
||||||
|
{{ $t("tips.noPermission") }} |
||||||
|
</el-link> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
</el-table> |
||||||
|
<pagination :limit.sync="queryParams.size" :page.sync="queryParams.current" |
||||||
|
:total="Number(tableData.total)" @pagination="fetch" v-show="tableData.total > 0"/> |
||||||
|
<creditOrderDetail-edit :dialog-visible="dialog.isVisible" :type="dialog.type" |
||||||
|
@close="editClose" @success="editSuccess" ref="edit"/> |
||||||
|
<creditOrderDetail-import ref="import" :dialog-visible="fileImport.isVisible" :type="fileImport.type" |
||||||
|
:action="fileImport.action" accept=".xls,.xlsx" @close="importClose" @success="importSuccess" /> |
||||||
|
<el-dialog :close-on-click-modal="false" :close-on-press-escape="true" |
||||||
|
title="预览" width="80%" top="50px" :visible.sync="preview.isVisible" v-el-drag-dialog> |
||||||
|
<el-scrollbar> |
||||||
|
<div v-html="preview.context"></div> |
||||||
|
</el-scrollbar> |
||||||
|
</el-dialog> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
import Pagination from "@/components/Pagination"; |
||||||
|
import elDragDialog from '@/directive/el-drag-dialog' |
||||||
|
import CreditOrderDetailEdit from "./Edit"; |
||||||
|
import creditOrderDetailApi from "@/api/creditGoods/CreditOrderDetail.js"; |
||||||
|
import CreditOrderDetailImport from "@/components/ceres/Import" |
||||||
|
import {convertEnum} from '@/utils/utils' |
||||||
|
import {downloadFile, loadEnums, initDicts, initQueryParams} from '@/utils/commons' |
||||||
|
|
||||||
|
export default { |
||||||
|
name: "CreditOrderDetailManage", |
||||||
|
directives: { elDragDialog }, |
||||||
|
components: { Pagination, CreditOrderDetailEdit, CreditOrderDetailImport}, |
||||||
|
filters: { |
||||||
|
|
||||||
|
}, |
||||||
|
data() { |
||||||
|
return { |
||||||
|
// 编辑 |
||||||
|
dialog: { |
||||||
|
isVisible: false, |
||||||
|
type: "add" |
||||||
|
}, |
||||||
|
// 预览 |
||||||
|
preview: { |
||||||
|
isVisible: false, |
||||||
|
context: '' |
||||||
|
}, |
||||||
|
// 导入 |
||||||
|
fileImport: { |
||||||
|
isVisible: false, |
||||||
|
type: "import", |
||||||
|
action: `${process.env.VUE_APP_BASE_API}/store/creditOrderDetail/import` |
||||||
|
}, |
||||||
|
tableKey: 0, |
||||||
|
queryParams: initQueryParams(), |
||||||
|
selection: [], |
||||||
|
loading: false, |
||||||
|
tableData: { |
||||||
|
total: 0 |
||||||
|
}, |
||||||
|
// 枚举 |
||||||
|
enums: { |
||||||
|
}, |
||||||
|
// 字典 |
||||||
|
dicts: { |
||||||
|
} |
||||||
|
}; |
||||||
|
}, |
||||||
|
computed: { |
||||||
|
}, |
||||||
|
watch: { |
||||||
|
}, |
||||||
|
mounted() { |
||||||
|
this.fetch(); |
||||||
|
|
||||||
|
// 初始化字典和枚举 |
||||||
|
const enumList = []; |
||||||
|
const dictList = []; |
||||||
|
loadEnums(enumList, this.enums, 'store'); |
||||||
|
initDicts(dictList, this.dicts); |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
editClose() { |
||||||
|
this.dialog.isVisible = false; |
||||||
|
}, |
||||||
|
editSuccess() { |
||||||
|
this.search(); |
||||||
|
}, |
||||||
|
onSelectChange(selection) { |
||||||
|
this.selection = selection; |
||||||
|
}, |
||||||
|
search() { |
||||||
|
this.fetch({ |
||||||
|
...this.queryParams |
||||||
|
}); |
||||||
|
}, |
||||||
|
reset() { |
||||||
|
this.queryParams = initQueryParams(); |
||||||
|
this.$refs.table.clearSort(); |
||||||
|
this.$refs.table.clearFilter(); |
||||||
|
this.search(); |
||||||
|
}, |
||||||
|
exportExcelPreview() { |
||||||
|
if (this.queryParams.timeRange) { |
||||||
|
this.queryParams.map.createTime_st = this.queryParams.timeRange[0]; |
||||||
|
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1]; |
||||||
|
} |
||||||
|
this.queryParams.map.fileName = '导出数据'; |
||||||
|
creditOrderDetailApi.preview(this.queryParams).then(response => { |
||||||
|
const res = response.data; |
||||||
|
this.preview.isVisible = true; |
||||||
|
this.preview.context = res.data; |
||||||
|
}); |
||||||
|
}, |
||||||
|
exportExcel() { |
||||||
|
if (this.queryParams.timeRange) { |
||||||
|
this.queryParams.map.createTime_st = this.queryParams.timeRange[0]; |
||||||
|
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1]; |
||||||
|
} |
||||||
|
this.queryParams.map.fileName = '导出数据'; |
||||||
|
creditOrderDetailApi.export(this.queryParams).then(response => { |
||||||
|
downloadFile(response); |
||||||
|
}); |
||||||
|
}, |
||||||
|
importExcel() { |
||||||
|
this.fileImport.type = "upload"; |
||||||
|
this.fileImport.isVisible = true; |
||||||
|
this.$refs.import.setModel(false); |
||||||
|
}, |
||||||
|
importSuccess() { |
||||||
|
this.search(); |
||||||
|
}, |
||||||
|
importClose() { |
||||||
|
this.fileImport.isVisible = false; |
||||||
|
}, |
||||||
|
singleDelete(row) { |
||||||
|
this.$refs.table.clearSelection() |
||||||
|
this.$refs.table.toggleRowSelection(row, true); |
||||||
|
this.batchDelete(); |
||||||
|
}, |
||||||
|
batchDelete() { |
||||||
|
if (!this.selection.length) { |
||||||
|
this.$message({ |
||||||
|
message: this.$t("tips.noDataSelected"), |
||||||
|
type: "warning" |
||||||
|
}); |
||||||
|
return; |
||||||
|
} |
||||||
|
this.$confirm(this.$t("tips.confirmDelete"), this.$t("common.tips"), { |
||||||
|
confirmButtonText: this.$t("common.confirm"), |
||||||
|
cancelButtonText: this.$t("common.cancel"), |
||||||
|
type: "warning" |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
const ids = this.selection.map(u => u.id); |
||||||
|
this.delete(ids); |
||||||
|
}) |
||||||
|
.catch(() => { |
||||||
|
this.clearSelections(); |
||||||
|
}); |
||||||
|
}, |
||||||
|
clearSelections() { |
||||||
|
this.$refs.table.clearSelection(); |
||||||
|
}, |
||||||
|
delete(ids) { |
||||||
|
creditOrderDetailApi.delete({ ids: ids }).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
this.$message({ |
||||||
|
message: this.$t("tips.deleteSuccess"), |
||||||
|
type: "success" |
||||||
|
}); |
||||||
|
this.search(); |
||||||
|
} |
||||||
|
}); |
||||||
|
}, |
||||||
|
add() { |
||||||
|
this.dialog.type = "add"; |
||||||
|
this.dialog.isVisible = true; |
||||||
|
this.$refs.edit.setCreditOrderDetail({ enums: this.enums, dicts: this.dicts}); |
||||||
|
}, |
||||||
|
copy(row) { |
||||||
|
this.$refs.edit.setCreditOrderDetail({row, enums: this.enums, dicts: this.dicts}); |
||||||
|
this.dialog.type = "copy"; |
||||||
|
this.dialog.isVisible = true; |
||||||
|
}, |
||||||
|
edit(row) { |
||||||
|
this.$refs.edit.setCreditOrderDetail({row, enums: this.enums, dicts: this.dicts}); |
||||||
|
this.dialog.type = "edit"; |
||||||
|
this.dialog.isVisible = true; |
||||||
|
}, |
||||||
|
fetch(params = {}) { |
||||||
|
this.loading = true; |
||||||
|
if (this.queryParams.timeRange) { |
||||||
|
this.queryParams.map.createTime_st = this.queryParams.timeRange[0]; |
||||||
|
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1]; |
||||||
|
} |
||||||
|
|
||||||
|
this.queryParams.current = params.current ? params.current : this.queryParams.current; |
||||||
|
this.queryParams.size = params.size ? params.size : this.queryParams.size; |
||||||
|
|
||||||
|
creditOrderDetailApi.page(this.queryParams).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
this.tableData = res.data; |
||||||
|
} |
||||||
|
}).finally(() => this.loading = false); |
||||||
|
}, |
||||||
|
sortChange(val) { |
||||||
|
this.queryParams.sort = val.prop; |
||||||
|
this.queryParams.order = val.order; |
||||||
|
if (this.queryParams.sort) { |
||||||
|
this.search(); |
||||||
|
} |
||||||
|
}, |
||||||
|
filterChange (filters) { |
||||||
|
for (const key in filters) { |
||||||
|
if(key.includes('.')) { |
||||||
|
const val = { }; |
||||||
|
val[key.split('.')[1]] = filters[key][0]; |
||||||
|
this.queryParams.model[key.split('.')[0]] = val; |
||||||
|
} else { |
||||||
|
this.queryParams.model[key] = filters[key][0] |
||||||
|
} |
||||||
|
} |
||||||
|
this.search() |
||||||
|
}, |
||||||
|
cellClick (row, column) { |
||||||
|
if (column['columnKey'] === "operation") { |
||||||
|
return; |
||||||
|
} |
||||||
|
let flag = false; |
||||||
|
this.selection.forEach((item)=>{ |
||||||
|
if(item.id === row.id) { |
||||||
|
flag = true; |
||||||
|
this.$refs.table.toggleRowSelection(row); |
||||||
|
} |
||||||
|
}) |
||||||
|
|
||||||
|
if(!flag){ |
||||||
|
this.$refs.table.toggleRowSelection(row, true); |
||||||
|
} |
||||||
|
}, |
||||||
|
} |
||||||
|
}; |
||||||
|
</script> |
||||||
|
<style lang="scss" scoped></style> |
@ -0,0 +1,210 @@ |
|||||||
|
<template> |
||||||
|
<el-dialog :close-on-click-modal="false" :close-on-press-escape="true" :title="title" :type="type" |
||||||
|
:visible.sync="isVisible" :width="width" top="50px" v-el-drag-dialog> |
||||||
|
<el-form :model="information" :rules="rules" label-position="right" label-width="100px" ref="form"> |
||||||
|
<el-form-item :label="$t('table.information.storeId')" prop="storeId"> |
||||||
|
<el-input type="" v-model="information.storeId" placeholder="店铺ID"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.information.mainTitle')" prop="mainTitle"> |
||||||
|
<el-input type="" v-model="information.mainTitle" placeholder="主标题"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.information.viceTitle')" prop="viceTitle"> |
||||||
|
<el-input type="" v-model="information.viceTitle" placeholder="副标题"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.information.content')" prop="content"> |
||||||
|
<el-input type="" v-model="information.content" placeholder="内容"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.information.coverImg')" prop="coverImg"> |
||||||
|
<el-input type="" v-model="information.coverImg" placeholder="封面图"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.information.startTime')" prop="startTime"> |
||||||
|
<el-date-picker |
||||||
|
v-model="information.startTime" |
||||||
|
placeholder="开始时间" |
||||||
|
:start-placeholder="$t('table.information.startTime')" |
||||||
|
value-format="yyyy-MM-dd HH:mm:ss" |
||||||
|
format="yyyy-MM-dd HH:mm:ss" |
||||||
|
class="filter-item date-range-item" |
||||||
|
type="datetime"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.information.endTime')" prop="endTime"> |
||||||
|
<el-date-picker |
||||||
|
v-model="information.endTime" |
||||||
|
placeholder="结束时间" |
||||||
|
:start-placeholder="$t('table.information.endTime')" |
||||||
|
value-format="yyyy-MM-dd HH:mm:ss" |
||||||
|
format="yyyy-MM-dd HH:mm:ss" |
||||||
|
class="filter-item date-range-item" |
||||||
|
type="datetime"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.information.state')" prop="state"> |
||||||
|
<el-input type="" v-model="information.state" placeholder="状态:1-上架,0-下架"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.information.isDelete')" prop="isDelete"> |
||||||
|
<el-input type="" v-model="information.isDelete" placeholder="逻辑删除:1-删除 0-未删除"/> |
||||||
|
</el-form-item> |
||||||
|
</el-form> |
||||||
|
<div class="dialog-footer" slot="footer"> |
||||||
|
<el-button @click="isVisible = false" plain type="warning"> |
||||||
|
{{ $t("common.cancel") }} |
||||||
|
</el-button> |
||||||
|
<el-button @click="submitForm" :disabled="confirmDisabled" plain type="primary"> |
||||||
|
{{ $t("common.confirm") }} |
||||||
|
</el-button> |
||||||
|
</div> |
||||||
|
</el-dialog> |
||||||
|
</template> |
||||||
|
<script> |
||||||
|
import elDragDialog from '@/directive/el-drag-dialog' |
||||||
|
import informationApi from "@/api/InformationApi.js"; |
||||||
|
|
||||||
|
export default { |
||||||
|
name: "InformationEdit", |
||||||
|
directives: { elDragDialog }, |
||||||
|
components: { }, |
||||||
|
props: { |
||||||
|
dialogVisible: { |
||||||
|
type: Boolean, |
||||||
|
default: false |
||||||
|
}, |
||||||
|
type: { |
||||||
|
type: String, |
||||||
|
default: "add" |
||||||
|
} |
||||||
|
}, |
||||||
|
data() { |
||||||
|
return { |
||||||
|
confirmDisabled: false, |
||||||
|
information: this.initInformation(), |
||||||
|
screenWidth: 0, |
||||||
|
width: this.initWidth(), |
||||||
|
rules: { |
||||||
|
|
||||||
|
}, |
||||||
|
// 枚举 |
||||||
|
enums: { |
||||||
|
}, |
||||||
|
// 字典 |
||||||
|
dicts: { |
||||||
|
} |
||||||
|
}; |
||||||
|
}, |
||||||
|
computed: { |
||||||
|
isVisible: { |
||||||
|
get() { |
||||||
|
return this.dialogVisible; |
||||||
|
}, |
||||||
|
set() { |
||||||
|
this.close(); |
||||||
|
this.reset(); |
||||||
|
} |
||||||
|
}, |
||||||
|
title() { |
||||||
|
return this.$t("common." + this.type); |
||||||
|
} |
||||||
|
}, |
||||||
|
watch: {}, |
||||||
|
mounted() { |
||||||
|
window.onresize = () => { |
||||||
|
return (() => { |
||||||
|
this.width = this.initWidth(); |
||||||
|
})(); |
||||||
|
}; |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
initInformation() { |
||||||
|
return { |
||||||
|
id: "", |
||||||
|
storeId: null, |
||||||
|
mainTitle: '', |
||||||
|
viceTitle: '', |
||||||
|
content: '', |
||||||
|
coverImg: '', |
||||||
|
startTime: null, |
||||||
|
endTime: null, |
||||||
|
state: null, |
||||||
|
isDelete: null, |
||||||
|
}; |
||||||
|
}, |
||||||
|
initWidth() { |
||||||
|
this.screenWidth = document.body.clientWidth; |
||||||
|
if (this.screenWidth < 991) { |
||||||
|
return "90%"; |
||||||
|
} else if (this.screenWidth < 1400) { |
||||||
|
return "45%"; |
||||||
|
} else { |
||||||
|
return "800px"; |
||||||
|
} |
||||||
|
}, |
||||||
|
setInformation(val = {}) { |
||||||
|
const vm = this; |
||||||
|
|
||||||
|
vm.dicts = val['dicts']; |
||||||
|
vm.enums = val['enums']; |
||||||
|
if (val['row']) { |
||||||
|
vm.information = { ...val['row'] }; |
||||||
|
|
||||||
|
} |
||||||
|
}, |
||||||
|
close() { |
||||||
|
this.$emit("close"); |
||||||
|
}, |
||||||
|
reset() { |
||||||
|
// 先清除校验,再清除表单,不然有奇怪的bug |
||||||
|
this.$refs.form.clearValidate(); |
||||||
|
this.$refs.form.resetFields(); |
||||||
|
this.confirmDisabled = false; |
||||||
|
this.information = this.initInformation(); |
||||||
|
}, |
||||||
|
submitForm() { |
||||||
|
const vm = this; |
||||||
|
this.$refs.form.validate(valid => { |
||||||
|
if (valid) { |
||||||
|
vm.editSubmit(); |
||||||
|
} else { |
||||||
|
return false; |
||||||
|
} |
||||||
|
}); |
||||||
|
}, |
||||||
|
editSubmit() { |
||||||
|
const vm = this; |
||||||
|
if (vm.type === "edit") { |
||||||
|
vm.update(); |
||||||
|
} else { |
||||||
|
vm.save(); |
||||||
|
} |
||||||
|
}, |
||||||
|
save() { |
||||||
|
const vm = this; |
||||||
|
vm.confirmDisabled = true; |
||||||
|
informationApi.save(this.information).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
vm.isVisible = false; |
||||||
|
vm.$message({ |
||||||
|
message: vm.$t("tips.createSuccess"), |
||||||
|
type: "success" |
||||||
|
}); |
||||||
|
vm.$emit("success"); |
||||||
|
} |
||||||
|
}).finally(()=> vm.confirmDisabled = false); |
||||||
|
}, |
||||||
|
update() { |
||||||
|
const vm = this; |
||||||
|
vm.confirmDisabled = true; |
||||||
|
informationApi.update(this.information).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
vm.isVisible = false; |
||||||
|
vm.$message({ |
||||||
|
message: this.$t("tips.updateSuccess"), |
||||||
|
type: "success" |
||||||
|
}); |
||||||
|
vm.$emit("success"); |
||||||
|
} |
||||||
|
}).finally(()=> vm.confirmDisabled = false); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
</script> |
||||||
|
<style lang="scss" scoped></style> |
@ -0,0 +1,370 @@ |
|||||||
|
<template> |
||||||
|
<div class="app-container"> |
||||||
|
<div class="filter-container"> |
||||||
|
<el-input |
||||||
|
:placeholder="$t('table.information.mainTitle')" |
||||||
|
class="filter-item search-item" |
||||||
|
v-model="queryParams.model.mainTitle" |
||||||
|
/> |
||||||
|
|
||||||
|
<el-date-picker :range-separator="null" class="filter-item search-item date-range-item" |
||||||
|
end-placeholder="结束日期" format="yyyy-MM-dd HH:mm:ss" start-placeholder="开始日期" |
||||||
|
type="daterange" v-model="queryParams.timeRange" value-format="yyyy-MM-dd HH:mm:ss" |
||||||
|
/> |
||||||
|
<el-button @click="search" class="filter-item" plain type="primary"> |
||||||
|
{{ $t("table.search") }} |
||||||
|
</el-button> |
||||||
|
<el-button @click="reset" class="filter-item" plain type="warning"> |
||||||
|
{{ $t("table.reset") }} |
||||||
|
</el-button> |
||||||
|
<el-button @click="add" class="filter-item" plain type="danger" v-has-permission="['information:add']"> |
||||||
|
{{ $t("table.add") }} |
||||||
|
</el-button> |
||||||
|
<el-dropdown class="filter-item" trigger="click" v-has-any-permission="['information:delete', 'information:export', |
||||||
|
'information:import']"> |
||||||
|
<el-button> |
||||||
|
{{ $t("table.more") }}<i class="el-icon-arrow-down el-icon--right" /> |
||||||
|
</el-button> |
||||||
|
<el-dropdown-menu slot="dropdown"> |
||||||
|
<el-dropdown-item @click.native="batchDelete" v-has-permission="['information:delete']"> |
||||||
|
{{ $t("table.delete") }} |
||||||
|
</el-dropdown-item> |
||||||
|
<el-dropdown-item @click.native="exportExcel" v-has-permission="['information:export']"> |
||||||
|
{{ $t("table.export") }} |
||||||
|
</el-dropdown-item> |
||||||
|
<el-dropdown-item @click.native="exportExcelPreview" v-has-permission="['information:export']"> |
||||||
|
{{ $t("table.exportPreview") }} |
||||||
|
</el-dropdown-item> |
||||||
|
<el-dropdown-item @click.native="importExcel" v-has-permission="['information:import']"> |
||||||
|
{{ $t("table.import") }} |
||||||
|
</el-dropdown-item> |
||||||
|
</el-dropdown-menu> |
||||||
|
</el-dropdown> |
||||||
|
</div> |
||||||
|
|
||||||
|
<el-table :data="tableData.records" :key="tableKey" @cell-click="cellClick" |
||||||
|
@filter-change="filterChange" @selection-change="onSelectChange" @sort-change="sortChange" |
||||||
|
border fit row-key="id" ref="table" style="width: 100%;" v-loading="loading"> |
||||||
|
<el-table-column align="center" type="selection" width="40px" :reserve-selection="true"/> |
||||||
|
<el-table-column :label="$t('table.information.storeId')" :show-overflow-tooltip="true" align="center" prop="storeId" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.storeId }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.information.mainTitle')" :show-overflow-tooltip="true" align="center" prop="mainTitle" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.mainTitle }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.information.viceTitle')" :show-overflow-tooltip="true" align="center" prop="viceTitle" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.viceTitle }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.information.content')" :show-overflow-tooltip="true" align="center" prop="content" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.content }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.information.coverImg')" :show-overflow-tooltip="true" align="center" prop="coverImg" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.coverImg }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.information.startTime')" :show-overflow-tooltip="true" align="center" prop="startTime" |
||||||
|
width="170"> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.startTime }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.information.endTime')" :show-overflow-tooltip="true" align="center" prop="endTime" |
||||||
|
width="170"> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.endTime }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.information.state')" :show-overflow-tooltip="true" align="center" prop="state" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.state }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.information.isDelete')" :show-overflow-tooltip="true" align="center" prop="isDelete" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.isDelete }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column |
||||||
|
:label="$t('table.createTime')" |
||||||
|
align="center" |
||||||
|
prop="createTime" |
||||||
|
sortable="custom" |
||||||
|
width="170px"> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.createTime }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column |
||||||
|
:label="$t('table.operation')" align="center" column-key="operation" class-name="small-padding fixed-width" width="100px"> |
||||||
|
<template slot-scope="{ row }"> |
||||||
|
<i @click="copy(row)" class="el-icon-copy-document table-operation" :title="$t('common.delete')" |
||||||
|
style="color: #2db7f5;" v-hasPermission="['information:add']"/> |
||||||
|
<i @click="edit(row)" class="el-icon-edit table-operation" :title="$t('common.delete')" |
||||||
|
style="color: #2db7f5;" v-hasPermission="['information:update']"/> |
||||||
|
<i @click="singleDelete(row)" class="el-icon-delete table-operation" :title="$t('common.delete')" |
||||||
|
style="color: #f50;" v-hasPermission="['information:delete']"/> |
||||||
|
<el-link class="no-perm" v-has-no-permission="['information:update', 'information:copy', 'information:delete']"> |
||||||
|
{{ $t("tips.noPermission") }} |
||||||
|
</el-link> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
</el-table> |
||||||
|
<pagination :limit.sync="queryParams.size" :page.sync="queryParams.current" |
||||||
|
:total="Number(tableData.total)" @pagination="fetch" v-show="tableData.total > 0"/> |
||||||
|
<information-edit :dialog-visible="dialog.isVisible" :type="dialog.type" |
||||||
|
@close="editClose" @success="editSuccess" ref="edit"/> |
||||||
|
<information-import ref="import" :dialog-visible="fileImport.isVisible" :type="fileImport.type" |
||||||
|
:action="fileImport.action" accept=".xls,.xlsx" @close="importClose" @success="importSuccess" /> |
||||||
|
<el-dialog :close-on-click-modal="false" :close-on-press-escape="true" |
||||||
|
title="预览" width="80%" top="50px" :visible.sync="preview.isVisible" v-el-drag-dialog> |
||||||
|
<el-scrollbar> |
||||||
|
<div v-html="preview.context"></div> |
||||||
|
</el-scrollbar> |
||||||
|
</el-dialog> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
import Pagination from "@/components/Pagination"; |
||||||
|
import elDragDialog from '@/directive/el-drag-dialog' |
||||||
|
import InformationEdit from "./Edit"; |
||||||
|
import informationApi from "@/api/InformationApi.js"; |
||||||
|
import InformationImport from "@/components/ceres/Import" |
||||||
|
import {convertEnum} from '@/utils/utils' |
||||||
|
import {downloadFile, loadEnums, initDicts, initQueryParams} from '@/utils/commons' |
||||||
|
|
||||||
|
export default { |
||||||
|
name: "InformationManage", |
||||||
|
directives: { elDragDialog }, |
||||||
|
components: { Pagination, InformationEdit, InformationImport}, |
||||||
|
filters: { |
||||||
|
|
||||||
|
}, |
||||||
|
data() { |
||||||
|
return { |
||||||
|
// 编辑 |
||||||
|
dialog: { |
||||||
|
isVisible: false, |
||||||
|
type: "add" |
||||||
|
}, |
||||||
|
// 预览 |
||||||
|
preview: { |
||||||
|
isVisible: false, |
||||||
|
context: '' |
||||||
|
}, |
||||||
|
// 导入 |
||||||
|
fileImport: { |
||||||
|
isVisible: false, |
||||||
|
type: "import", |
||||||
|
action: `${process.env.VUE_APP_BASE_API}/store/information/import` |
||||||
|
}, |
||||||
|
tableKey: 0, |
||||||
|
queryParams: initQueryParams(), |
||||||
|
selection: [], |
||||||
|
loading: false, |
||||||
|
tableData: { |
||||||
|
total: 0 |
||||||
|
}, |
||||||
|
// 枚举 |
||||||
|
enums: { |
||||||
|
}, |
||||||
|
// 字典 |
||||||
|
dicts: { |
||||||
|
} |
||||||
|
}; |
||||||
|
}, |
||||||
|
computed: { |
||||||
|
}, |
||||||
|
watch: { |
||||||
|
}, |
||||||
|
mounted() { |
||||||
|
this.fetch(); |
||||||
|
|
||||||
|
// 初始化字典和枚举 |
||||||
|
const enumList = []; |
||||||
|
const dictList = []; |
||||||
|
loadEnums(enumList, this.enums, 'store'); |
||||||
|
initDicts(dictList, this.dicts); |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
editClose() { |
||||||
|
this.dialog.isVisible = false; |
||||||
|
}, |
||||||
|
editSuccess() { |
||||||
|
this.search(); |
||||||
|
}, |
||||||
|
onSelectChange(selection) { |
||||||
|
this.selection = selection; |
||||||
|
}, |
||||||
|
search() { |
||||||
|
this.fetch({ |
||||||
|
...this.queryParams |
||||||
|
}); |
||||||
|
}, |
||||||
|
reset() { |
||||||
|
this.queryParams = initQueryParams(); |
||||||
|
this.$refs.table.clearSort(); |
||||||
|
this.$refs.table.clearFilter(); |
||||||
|
this.search(); |
||||||
|
}, |
||||||
|
exportExcelPreview() { |
||||||
|
if (this.queryParams.timeRange) { |
||||||
|
this.queryParams.map.createTime_st = this.queryParams.timeRange[0]; |
||||||
|
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1]; |
||||||
|
} |
||||||
|
this.queryParams.map.fileName = '导出数据'; |
||||||
|
informationApi.preview(this.queryParams).then(response => { |
||||||
|
const res = response.data; |
||||||
|
this.preview.isVisible = true; |
||||||
|
this.preview.context = res.data; |
||||||
|
}); |
||||||
|
}, |
||||||
|
exportExcel() { |
||||||
|
if (this.queryParams.timeRange) { |
||||||
|
this.queryParams.map.createTime_st = this.queryParams.timeRange[0]; |
||||||
|
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1]; |
||||||
|
} |
||||||
|
this.queryParams.map.fileName = '导出数据'; |
||||||
|
informationApi.export(this.queryParams).then(response => { |
||||||
|
downloadFile(response); |
||||||
|
}); |
||||||
|
}, |
||||||
|
importExcel() { |
||||||
|
this.fileImport.type = "upload"; |
||||||
|
this.fileImport.isVisible = true; |
||||||
|
this.$refs.import.setModel(false); |
||||||
|
}, |
||||||
|
importSuccess() { |
||||||
|
this.search(); |
||||||
|
}, |
||||||
|
importClose() { |
||||||
|
this.fileImport.isVisible = false; |
||||||
|
}, |
||||||
|
singleDelete(row) { |
||||||
|
this.$refs.table.clearSelection() |
||||||
|
this.$refs.table.toggleRowSelection(row, true); |
||||||
|
this.batchDelete(); |
||||||
|
}, |
||||||
|
batchDelete() { |
||||||
|
if (!this.selection.length) { |
||||||
|
this.$message({ |
||||||
|
message: this.$t("tips.noDataSelected"), |
||||||
|
type: "warning" |
||||||
|
}); |
||||||
|
return; |
||||||
|
} |
||||||
|
this.$confirm(this.$t("tips.confirmDelete"), this.$t("common.tips"), { |
||||||
|
confirmButtonText: this.$t("common.confirm"), |
||||||
|
cancelButtonText: this.$t("common.cancel"), |
||||||
|
type: "warning" |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
const ids = this.selection.map(u => u.id); |
||||||
|
this.delete(ids); |
||||||
|
}) |
||||||
|
.catch(() => { |
||||||
|
this.clearSelections(); |
||||||
|
}); |
||||||
|
}, |
||||||
|
clearSelections() { |
||||||
|
this.$refs.table.clearSelection(); |
||||||
|
}, |
||||||
|
delete(ids) { |
||||||
|
informationApi.delete({ ids: ids }).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
this.$message({ |
||||||
|
message: this.$t("tips.deleteSuccess"), |
||||||
|
type: "success" |
||||||
|
}); |
||||||
|
this.search(); |
||||||
|
} |
||||||
|
}); |
||||||
|
}, |
||||||
|
add() { |
||||||
|
this.dialog.type = "add"; |
||||||
|
this.dialog.isVisible = true; |
||||||
|
this.$refs.edit.setInformation({ enums: this.enums, dicts: this.dicts}); |
||||||
|
}, |
||||||
|
copy(row) { |
||||||
|
this.$refs.edit.setInformation({row, enums: this.enums, dicts: this.dicts}); |
||||||
|
this.dialog.type = "copy"; |
||||||
|
this.dialog.isVisible = true; |
||||||
|
}, |
||||||
|
edit(row) { |
||||||
|
this.$refs.edit.setInformation({row, enums: this.enums, dicts: this.dicts}); |
||||||
|
this.dialog.type = "edit"; |
||||||
|
this.dialog.isVisible = true; |
||||||
|
}, |
||||||
|
fetch(params = {}) { |
||||||
|
this.loading = true; |
||||||
|
if (this.queryParams.timeRange) { |
||||||
|
this.queryParams.map.createTime_st = this.queryParams.timeRange[0]; |
||||||
|
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1]; |
||||||
|
} |
||||||
|
|
||||||
|
this.queryParams.current = params.current ? params.current : this.queryParams.current; |
||||||
|
this.queryParams.size = params.size ? params.size : this.queryParams.size; |
||||||
|
|
||||||
|
informationApi.page(this.queryParams).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
this.tableData = res.data; |
||||||
|
} |
||||||
|
}).finally(() => this.loading = false); |
||||||
|
}, |
||||||
|
sortChange(val) { |
||||||
|
this.queryParams.sort = val.prop; |
||||||
|
this.queryParams.order = val.order; |
||||||
|
if (this.queryParams.sort) { |
||||||
|
this.search(); |
||||||
|
} |
||||||
|
}, |
||||||
|
filterChange (filters) { |
||||||
|
for (const key in filters) { |
||||||
|
if(key.includes('.')) { |
||||||
|
const val = { }; |
||||||
|
val[key.split('.')[1]] = filters[key][0]; |
||||||
|
this.queryParams.model[key.split('.')[0]] = val; |
||||||
|
} else { |
||||||
|
this.queryParams.model[key] = filters[key][0] |
||||||
|
} |
||||||
|
} |
||||||
|
this.search() |
||||||
|
}, |
||||||
|
cellClick (row, column) { |
||||||
|
if (column['columnKey'] === "operation") { |
||||||
|
return; |
||||||
|
} |
||||||
|
let flag = false; |
||||||
|
this.selection.forEach((item)=>{ |
||||||
|
if(item.id === row.id) { |
||||||
|
flag = true; |
||||||
|
this.$refs.table.toggleRowSelection(row); |
||||||
|
} |
||||||
|
}) |
||||||
|
|
||||||
|
if(!flag){ |
||||||
|
this.$refs.table.toggleRowSelection(row, true); |
||||||
|
} |
||||||
|
}, |
||||||
|
} |
||||||
|
}; |
||||||
|
</script> |
||||||
|
<style lang="scss" scoped></style> |
@ -0,0 +1,229 @@ |
|||||||
|
<template> |
||||||
|
<el-dialog :close-on-click-modal="false" :close-on-press-escape="true" :title="title" :type="type" |
||||||
|
:visible.sync="isVisible" :width="width" top="50px" v-el-drag-dialog> |
||||||
|
<el-form :model="ceresMemberTask" :rules="rules" label-position="right" label-width="100px" ref="form"> |
||||||
|
<el-form-item :label="$t('table.ceresMemberTask.name')" prop="name"> |
||||||
|
<el-input type="" v-model="ceresMemberTask.name" placeholder="任务名称"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.ceresMemberTask.type')" prop="type"> |
||||||
|
<!-- <el-input type="" v-model="ceresMemberTask.type" placeholder="任务类型"/> --> |
||||||
|
<el-select v-model="ceresMemberTask.type" placeholder="请选择"> |
||||||
|
<el-option |
||||||
|
v-for="item in typeOptions" |
||||||
|
:key="item.value" |
||||||
|
:label="item.label" |
||||||
|
:value="item.value"> |
||||||
|
</el-option> |
||||||
|
</el-select> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.ceresMemberTask.limitDay')" prop="limitDay"> |
||||||
|
<el-input type="" v-model="ceresMemberTask.limitDay" placeholder="每日次数限制"/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.ceresMemberTask.rewardType')" prop="rewardType"> |
||||||
|
<!-- <el-input type="" v-model="ceresMemberTask.rewardType" placeholder="奖励类型1积分 "/> --> |
||||||
|
<el-select v-model="ceresMemberTask.rewardType" placeholder="请选择"> |
||||||
|
<el-option |
||||||
|
v-for="item in rewardType" |
||||||
|
:key="item.value" |
||||||
|
:label="item.label" |
||||||
|
:value="item.value"> |
||||||
|
</el-option> |
||||||
|
</el-select> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.ceresMemberTask.rewardValue')" prop="rewardValue"> |
||||||
|
<el-input type="" v-model="ceresMemberTask.rewardValue" placeholder="奖励数值"/> |
||||||
|
</el-form-item> |
||||||
|
<!-- <el-form-item :label="$t('table.ceresMemberTask.aspects')" prop="aspects"> |
||||||
|
<el-input type="" v-model="ceresMemberTask.aspects" placeholder="切面方法 用,隔开"/> |
||||||
|
</el-form-item> --> |
||||||
|
<el-form-item :label="$t('table.ceresMemberTask.status')" prop="status"> |
||||||
|
<el-radio-group v-model="ceresMemberTask.status" size="medium"> |
||||||
|
<el-radio-button :label="true">{{ $t("common.status.valid") }}</el-radio-button> |
||||||
|
<el-radio-button :label="false">{{ $t("common.status.invalid") }}</el-radio-button> |
||||||
|
</el-radio-group> |
||||||
|
</el-form-item> |
||||||
|
</el-form> |
||||||
|
<div class="dialog-footer" slot="footer"> |
||||||
|
<el-button @click="isVisible = false" plain type="warning"> |
||||||
|
{{ $t("common.cancel") }} |
||||||
|
</el-button> |
||||||
|
<el-button @click="submitForm" :disabled="confirmDisabled" plain type="primary"> |
||||||
|
{{ $t("common.confirm") }} |
||||||
|
</el-button> |
||||||
|
</div> |
||||||
|
</el-dialog> |
||||||
|
</template> |
||||||
|
<script> |
||||||
|
import elDragDialog from '@/directive/el-drag-dialog' |
||||||
|
import ceresMemberTaskApi from "@/api/CeresMemberTask.js"; |
||||||
|
import { initMsgsEnums } from '@/utils/commons' |
||||||
|
export default { |
||||||
|
name: "CeresMemberTaskEdit", |
||||||
|
directives: { elDragDialog }, |
||||||
|
components: { }, |
||||||
|
props: { |
||||||
|
dialogVisible: { |
||||||
|
type: Boolean, |
||||||
|
default: false |
||||||
|
}, |
||||||
|
type: { |
||||||
|
type: String, |
||||||
|
default: "add" |
||||||
|
} |
||||||
|
}, |
||||||
|
data() { |
||||||
|
return { |
||||||
|
typeOptions: [ |
||||||
|
|
||||||
|
], |
||||||
|
rewardType: [ |
||||||
|
{ |
||||||
|
value: 1, |
||||||
|
label: 1 |
||||||
|
} |
||||||
|
], |
||||||
|
confirmDisabled: false, |
||||||
|
// ceresMemberTask: this.initCeresMemberTask(), |
||||||
|
ceresMemberTask: {...this.initCeresMemberTask(),rewardType: 1}, |
||||||
|
screenWidth: 0, |
||||||
|
width: this.initWidth(), |
||||||
|
rules: { |
||||||
|
|
||||||
|
}, |
||||||
|
// 枚举 |
||||||
|
enums: { |
||||||
|
}, |
||||||
|
// 字典 |
||||||
|
dicts: { |
||||||
|
} |
||||||
|
}; |
||||||
|
}, |
||||||
|
computed: { |
||||||
|
isVisible: { |
||||||
|
get() { |
||||||
|
return this.dialogVisible; |
||||||
|
}, |
||||||
|
set() { |
||||||
|
this.close(); |
||||||
|
this.reset(); |
||||||
|
} |
||||||
|
}, |
||||||
|
title() { |
||||||
|
return this.$t("common." + this.type); |
||||||
|
} |
||||||
|
}, |
||||||
|
watch: {}, |
||||||
|
mounted() { |
||||||
|
window.onresize = () => { |
||||||
|
return (() => { |
||||||
|
this.width = this.initWidth(); |
||||||
|
})(); |
||||||
|
}; |
||||||
|
initMsgsEnums(['MemberTaskTypeEnums'], this.enums); |
||||||
|
setTimeout(() => { |
||||||
|
let obj = this.enums.MemberTaskTypeEnums; |
||||||
|
for(let key in obj) { |
||||||
|
let val = { |
||||||
|
value: key, |
||||||
|
label: obj[key] |
||||||
|
} |
||||||
|
this.typeOptions.push(val) |
||||||
|
} |
||||||
|
}, 100) |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
initCeresMemberTask() { |
||||||
|
return { |
||||||
|
id: "", |
||||||
|
name: '', |
||||||
|
type: '', |
||||||
|
limitDay: null, |
||||||
|
rewardType: null, |
||||||
|
rewardValue: null, |
||||||
|
aspects: '', |
||||||
|
status: true, |
||||||
|
}; |
||||||
|
}, |
||||||
|
initWidth() { |
||||||
|
this.screenWidth = document.body.clientWidth; |
||||||
|
if (this.screenWidth < 991) { |
||||||
|
return "90%"; |
||||||
|
} else if (this.screenWidth < 1400) { |
||||||
|
return "45%"; |
||||||
|
} else { |
||||||
|
return "800px"; |
||||||
|
} |
||||||
|
}, |
||||||
|
setCeresMemberTask(val = {}) { |
||||||
|
const vm = this; |
||||||
|
|
||||||
|
vm.dicts = val['dicts']; |
||||||
|
vm.enums = val['enums']; |
||||||
|
if (val['row']) { |
||||||
|
vm.ceresMemberTask = { ...val['row'] }; |
||||||
|
|
||||||
|
} |
||||||
|
}, |
||||||
|
close() { |
||||||
|
this.$emit("close"); |
||||||
|
}, |
||||||
|
reset() { |
||||||
|
// 先清除校验,再清除表单,不然有奇怪的bug |
||||||
|
this.$refs.form.clearValidate(); |
||||||
|
this.$refs.form.resetFields(); |
||||||
|
this.confirmDisabled = false; |
||||||
|
this.ceresMemberTask = this.initCeresMemberTask(); |
||||||
|
}, |
||||||
|
submitForm() { |
||||||
|
const vm = this; |
||||||
|
this.$refs.form.validate(valid => { |
||||||
|
if (valid) { |
||||||
|
vm.editSubmit(); |
||||||
|
} else { |
||||||
|
return false; |
||||||
|
} |
||||||
|
}); |
||||||
|
}, |
||||||
|
editSubmit() { |
||||||
|
const vm = this; |
||||||
|
if (vm.type === "edit") { |
||||||
|
vm.update(); |
||||||
|
} else { |
||||||
|
vm.save(); |
||||||
|
} |
||||||
|
}, |
||||||
|
save() { |
||||||
|
const vm = this; |
||||||
|
vm.confirmDisabled = true; |
||||||
|
|
||||||
|
ceresMemberTaskApi.save(this.ceresMemberTask).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
vm.isVisible = false; |
||||||
|
vm.$message({ |
||||||
|
message: vm.$t("tips.createSuccess"), |
||||||
|
type: "success" |
||||||
|
}); |
||||||
|
vm.$emit("success"); |
||||||
|
} |
||||||
|
}).finally(()=> vm.confirmDisabled = false); |
||||||
|
}, |
||||||
|
update() { |
||||||
|
const vm = this; |
||||||
|
vm.confirmDisabled = true; |
||||||
|
ceresMemberTaskApi.update(this.ceresMemberTask).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
vm.isVisible = false; |
||||||
|
vm.$message({ |
||||||
|
message: this.$t("tips.updateSuccess"), |
||||||
|
type: "success" |
||||||
|
}); |
||||||
|
vm.$emit("success"); |
||||||
|
} |
||||||
|
}).finally(()=> vm.confirmDisabled = false); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
</script> |
||||||
|
<style lang="scss" scoped></style> |
@ -0,0 +1,360 @@ |
|||||||
|
<template> |
||||||
|
<div class="app-container"> |
||||||
|
<div class="filter-container"> |
||||||
|
|
||||||
|
<el-date-picker :range-separator="null" class="filter-item search-item date-range-item" |
||||||
|
end-placeholder="结束日期" format="yyyy-MM-dd HH:mm:ss" start-placeholder="开始日期" |
||||||
|
type="daterange" v-model="queryParams.timeRange" value-format="yyyy-MM-dd HH:mm:ss" |
||||||
|
/> |
||||||
|
<el-button @click="search" class="filter-item" plain type="primary"> |
||||||
|
{{ $t("table.search") }} |
||||||
|
</el-button> |
||||||
|
<el-button @click="reset" class="filter-item" plain type="warning"> |
||||||
|
{{ $t("table.reset") }} |
||||||
|
</el-button> |
||||||
|
<el-button @click="add" class="filter-item" plain type="danger" v-has-permission="['ceresMemberTask:add']"> |
||||||
|
{{ $t("table.add") }} |
||||||
|
</el-button> |
||||||
|
<el-dropdown class="filter-item" trigger="click" v-has-any-permission="['ceresMemberTask:delete', 'ceresMemberTask:export', |
||||||
|
'ceresMemberTask:import']"> |
||||||
|
<el-button> |
||||||
|
{{ $t("table.more") }}<i class="el-icon-arrow-down el-icon--right" /> |
||||||
|
</el-button> |
||||||
|
<el-dropdown-menu slot="dropdown"> |
||||||
|
<el-dropdown-item @click.native="batchDelete" v-has-permission="['ceresMemberTask:delete']"> |
||||||
|
{{ $t("table.delete") }} |
||||||
|
</el-dropdown-item> |
||||||
|
<el-dropdown-item @click.native="exportExcel" v-has-permission="['ceresMemberTask:export']"> |
||||||
|
{{ $t("table.export") }} |
||||||
|
</el-dropdown-item> |
||||||
|
<el-dropdown-item @click.native="exportExcelPreview" v-has-permission="['ceresMemberTask:export']"> |
||||||
|
{{ $t("table.exportPreview") }} |
||||||
|
</el-dropdown-item> |
||||||
|
<el-dropdown-item @click.native="importExcel" v-has-permission="['ceresMemberTask:import']"> |
||||||
|
{{ $t("table.import") }} |
||||||
|
</el-dropdown-item> |
||||||
|
</el-dropdown-menu> |
||||||
|
</el-dropdown> |
||||||
|
</div> |
||||||
|
|
||||||
|
<el-table :data="tableData.records" :key="tableKey" @cell-click="cellClick" |
||||||
|
@filter-change="filterChange" @selection-change="onSelectChange" @sort-change="sortChange" |
||||||
|
border fit row-key="id" ref="table" style="width: 100%;" v-loading="loading"> |
||||||
|
<el-table-column align="center" type="selection" width="40px" :reserve-selection="true"/> |
||||||
|
<el-table-column :label="$t('table.ceresMemberTask.name')" :show-overflow-tooltip="true" align="center" prop="name" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.name }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.ceresMemberTask.type')" :show-overflow-tooltip="true" align="center" prop="type" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.type }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.ceresMemberTask.limitDay')" :show-overflow-tooltip="true" align="center" prop="limitDay" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.limitDay }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.ceresMemberTask.rewardType')" :show-overflow-tooltip="true" align="center" prop="rewardType" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.rewardType }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.ceresMemberTask.rewardValue')" :show-overflow-tooltip="true" align="center" prop="rewardValue" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.rewardValue }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<!-- <el-table-column :label="$t('table.ceresMemberTask.aspects')" :show-overflow-tooltip="true" align="center" prop="aspects" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.aspects }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> --> |
||||||
|
<el-table-column :label="$t('table.ceresMemberTask.status')" :show-overflow-tooltip="true" align="center" prop="status" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.status }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column |
||||||
|
:label="$t('table.createTime')" |
||||||
|
align="center" |
||||||
|
prop="createTime" |
||||||
|
sortable="custom" |
||||||
|
width="170px"> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.createTime }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column |
||||||
|
:label="$t('table.operation')" align="center" column-key="operation" class-name="small-padding fixed-width" width="100px"> |
||||||
|
<template slot-scope="{ row }"> |
||||||
|
<i @click="copy(row)" class="el-icon-copy-document table-operation" :title="$t('common.delete')" |
||||||
|
style="color: #2db7f5;" v-hasPermission="['ceresMemberTask:add']"/> |
||||||
|
<i @click="edit(row)" class="el-icon-edit table-operation" :title="$t('common.delete')" |
||||||
|
style="color: #2db7f5;" v-hasPermission="['ceresMemberTask:update']"/> |
||||||
|
<i @click="singleDelete(row)" class="el-icon-delete table-operation" :title="$t('common.delete')" |
||||||
|
style="color: #f50;" v-hasPermission="['ceresMemberTask:delete']"/> |
||||||
|
<el-link class="no-perm" v-has-no-permission="['ceresMemberTask:update', 'ceresMemberTask:copy', 'ceresMemberTask:delete']"> |
||||||
|
{{ $t("tips.noPermission") }} |
||||||
|
</el-link> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
</el-table> |
||||||
|
<pagination :limit.sync="queryParams.size" :page.sync="queryParams.current" |
||||||
|
:total="Number(tableData.total)" @pagination="fetch" v-show="tableData.total > 0"/> |
||||||
|
<ceresMemberTask-edit :dialog-visible="dialog.isVisible" :type="dialog.type" |
||||||
|
@close="editClose" @success="editSuccess" ref="edit"/> |
||||||
|
<ceresMemberTask-import ref="import" :dialog-visible="fileImport.isVisible" :type="fileImport.type" |
||||||
|
:action="fileImport.action" accept=".xls,.xlsx" @close="importClose" @success="importSuccess" /> |
||||||
|
<el-dialog :close-on-click-modal="false" :close-on-press-escape="true" |
||||||
|
title="预览" width="80%" top="50px" :visible.sync="preview.isVisible" v-el-drag-dialog> |
||||||
|
<el-scrollbar> |
||||||
|
<div v-html="preview.context"></div> |
||||||
|
</el-scrollbar> |
||||||
|
</el-dialog> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
import Pagination from "@/components/Pagination"; |
||||||
|
import elDragDialog from '@/directive/el-drag-dialog' |
||||||
|
import CeresMemberTaskEdit from "./Edit"; |
||||||
|
import ceresMemberTaskApi from "@/api/CeresMemberTask.js"; |
||||||
|
import CeresMemberTaskImport from "@/components/ceres/Import" |
||||||
|
import {convertEnum} from '@/utils/utils' |
||||||
|
import {downloadFile, loadEnums, initDicts, initQueryParams, initMsgsEnums} from '@/utils/commons' |
||||||
|
|
||||||
|
export default { |
||||||
|
name: "CeresMemberTaskManage", |
||||||
|
directives: { elDragDialog }, |
||||||
|
components: { Pagination, CeresMemberTaskEdit, CeresMemberTaskImport}, |
||||||
|
filters: { |
||||||
|
|
||||||
|
}, |
||||||
|
data() { |
||||||
|
return { |
||||||
|
// 编辑 |
||||||
|
dialog: { |
||||||
|
isVisible: false, |
||||||
|
type: "add" |
||||||
|
}, |
||||||
|
// 预览 |
||||||
|
preview: { |
||||||
|
isVisible: false, |
||||||
|
context: '' |
||||||
|
}, |
||||||
|
// 导入 |
||||||
|
fileImport: { |
||||||
|
isVisible: false, |
||||||
|
type: "import", |
||||||
|
action: `${process.env.VUE_APP_BASE_API}/member/ceresMemberTask/import` |
||||||
|
}, |
||||||
|
tableKey: 0, |
||||||
|
queryParams: initQueryParams(), |
||||||
|
selection: [], |
||||||
|
loading: false, |
||||||
|
tableData: { |
||||||
|
total: 0 |
||||||
|
}, |
||||||
|
// 枚举 |
||||||
|
enums: { |
||||||
|
}, |
||||||
|
// 字典 |
||||||
|
dicts: { |
||||||
|
}, |
||||||
|
type: {} |
||||||
|
}; |
||||||
|
}, |
||||||
|
computed: { |
||||||
|
}, |
||||||
|
watch: { |
||||||
|
}, |
||||||
|
mounted() { |
||||||
|
this.fetch(); |
||||||
|
|
||||||
|
// 初始化字典和枚举 |
||||||
|
const enumList = []; |
||||||
|
const dictList = []; |
||||||
|
loadEnums(enumList, this.enums, 'member'); |
||||||
|
initDicts(dictList, this.dicts); |
||||||
|
initMsgsEnums(['MemberTaskTypeEnums'], this.type); |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
editClose() { |
||||||
|
this.dialog.isVisible = false; |
||||||
|
}, |
||||||
|
editSuccess() { |
||||||
|
this.search(); |
||||||
|
}, |
||||||
|
onSelectChange(selection) { |
||||||
|
this.selection = selection; |
||||||
|
}, |
||||||
|
search() { |
||||||
|
this.fetch({ |
||||||
|
...this.queryParams |
||||||
|
}); |
||||||
|
}, |
||||||
|
reset() { |
||||||
|
this.queryParams = initQueryParams(); |
||||||
|
this.$refs.table.clearSort(); |
||||||
|
this.$refs.table.clearFilter(); |
||||||
|
this.search(); |
||||||
|
}, |
||||||
|
exportExcelPreview() { |
||||||
|
if (this.queryParams.timeRange) { |
||||||
|
this.queryParams.map.createTime_st = this.queryParams.timeRange[0]; |
||||||
|
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1]; |
||||||
|
} |
||||||
|
this.queryParams.map.fileName = '导出数据'; |
||||||
|
ceresMemberTaskApi.preview(this.queryParams).then(response => { |
||||||
|
const res = response.data; |
||||||
|
this.preview.isVisible = true; |
||||||
|
this.preview.context = res.data; |
||||||
|
}); |
||||||
|
}, |
||||||
|
exportExcel() { |
||||||
|
if (this.queryParams.timeRange) { |
||||||
|
this.queryParams.map.createTime_st = this.queryParams.timeRange[0]; |
||||||
|
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1]; |
||||||
|
} |
||||||
|
this.queryParams.map.fileName = '导出数据'; |
||||||
|
ceresMemberTaskApi.export(this.queryParams).then(response => { |
||||||
|
downloadFile(response); |
||||||
|
}); |
||||||
|
}, |
||||||
|
importExcel() { |
||||||
|
this.fileImport.type = "upload"; |
||||||
|
this.fileImport.isVisible = true; |
||||||
|
this.$refs.import.setModel(false); |
||||||
|
}, |
||||||
|
importSuccess() { |
||||||
|
this.search(); |
||||||
|
}, |
||||||
|
importClose() { |
||||||
|
this.fileImport.isVisible = false; |
||||||
|
}, |
||||||
|
singleDelete(row) { |
||||||
|
this.$refs.table.clearSelection() |
||||||
|
this.$refs.table.toggleRowSelection(row, true); |
||||||
|
this.batchDelete(); |
||||||
|
}, |
||||||
|
batchDelete() { |
||||||
|
if (!this.selection.length) { |
||||||
|
this.$message({ |
||||||
|
message: this.$t("tips.noDataSelected"), |
||||||
|
type: "warning" |
||||||
|
}); |
||||||
|
return; |
||||||
|
} |
||||||
|
this.$confirm(this.$t("tips.confirmDelete"), this.$t("common.tips"), { |
||||||
|
confirmButtonText: this.$t("common.confirm"), |
||||||
|
cancelButtonText: this.$t("common.cancel"), |
||||||
|
type: "warning" |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
const ids = this.selection.map(u => u.id); |
||||||
|
this.delete(ids); |
||||||
|
}) |
||||||
|
.catch(() => { |
||||||
|
this.clearSelections(); |
||||||
|
}); |
||||||
|
}, |
||||||
|
clearSelections() { |
||||||
|
this.$refs.table.clearSelection(); |
||||||
|
}, |
||||||
|
delete(ids) { |
||||||
|
ceresMemberTaskApi.delete({ ids: ids }).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
this.$message({ |
||||||
|
message: this.$t("tips.deleteSuccess"), |
||||||
|
type: "success" |
||||||
|
}); |
||||||
|
this.search(); |
||||||
|
} |
||||||
|
}); |
||||||
|
}, |
||||||
|
add() { |
||||||
|
this.dialog.type = "add"; |
||||||
|
this.dialog.isVisible = true; |
||||||
|
this.$refs.edit.setCeresMemberTask({ enums: this.enums, dicts: this.dicts}); |
||||||
|
}, |
||||||
|
copy(row) { |
||||||
|
this.$refs.edit.setCeresMemberTask({row, enums: this.enums, dicts: this.dicts}); |
||||||
|
this.dialog.type = "copy"; |
||||||
|
this.dialog.isVisible = true; |
||||||
|
}, |
||||||
|
edit(row) { |
||||||
|
this.$refs.edit.setCeresMemberTask({row, enums: this.enums, dicts: this.dicts}); |
||||||
|
this.dialog.type = "edit"; |
||||||
|
this.dialog.isVisible = true; |
||||||
|
}, |
||||||
|
fetch(params = {}) { |
||||||
|
this.loading = true; |
||||||
|
if (this.queryParams.timeRange) { |
||||||
|
this.queryParams.map.createTime_st = this.queryParams.timeRange[0]; |
||||||
|
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1]; |
||||||
|
} |
||||||
|
|
||||||
|
this.queryParams.current = params.current ? params.current : this.queryParams.current; |
||||||
|
this.queryParams.size = params.size ? params.size : this.queryParams.size; |
||||||
|
|
||||||
|
ceresMemberTaskApi.page(this.queryParams).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
this.tableData = res.data; |
||||||
|
setTimeout(() => { |
||||||
|
this.tableData.records.forEach(val => { |
||||||
|
val.type = this.type.MemberTaskTypeEnums[val.type] |
||||||
|
}) |
||||||
|
}, 10) |
||||||
|
} |
||||||
|
}).finally(() => this.loading = false); |
||||||
|
}, |
||||||
|
sortChange(val) { |
||||||
|
this.queryParams.sort = val.prop; |
||||||
|
this.queryParams.order = val.order; |
||||||
|
if (this.queryParams.sort) { |
||||||
|
this.search(); |
||||||
|
} |
||||||
|
}, |
||||||
|
filterChange (filters) { |
||||||
|
for (const key in filters) { |
||||||
|
if(key.includes('.')) { |
||||||
|
const val = { }; |
||||||
|
val[key.split('.')[1]] = filters[key][0]; |
||||||
|
this.queryParams.model[key.split('.')[0]] = val; |
||||||
|
} else { |
||||||
|
this.queryParams.model[key] = filters[key][0] |
||||||
|
} |
||||||
|
} |
||||||
|
this.search() |
||||||
|
}, |
||||||
|
cellClick (row, column) { |
||||||
|
if (column['columnKey'] === "operation") { |
||||||
|
return; |
||||||
|
} |
||||||
|
let flag = false; |
||||||
|
this.selection.forEach((item)=>{ |
||||||
|
if(item.id === row.id) { |
||||||
|
flag = true; |
||||||
|
this.$refs.table.toggleRowSelection(row); |
||||||
|
} |
||||||
|
}) |
||||||
|
|
||||||
|
if(!flag){ |
||||||
|
this.$refs.table.toggleRowSelection(row, true); |
||||||
|
} |
||||||
|
}, |
||||||
|
} |
||||||
|
}; |
||||||
|
</script> |
||||||
|
<style lang="scss" scoped></style> |
@ -0,0 +1,235 @@ |
|||||||
|
<template> |
||||||
|
<el-dialog :close-on-click-modal="false" :close-on-press-escape="true" :title="title" :type="type" |
||||||
|
:visible.sync="isVisible" :width="width" top="50px" v-el-drag-dialog> |
||||||
|
<el-form :model="memberRank" :rules="rules" label-position="right" label-width="100px" ref="form"> |
||||||
|
<el-form-item :label="$t('table.memberRank.rankName')" prop="rankName"> |
||||||
|
<el-input type="" v-model="memberRank.rankName" placeholder=""/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.memberRank.rankOrigin')" prop="rankOrigin"> |
||||||
|
<el-input type="" v-model="memberRank.rankOrigin" placeholder=""/> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.memberRank.rankContent')" prop="rankContent"> |
||||||
|
<!-- <el-input type="" v-model="memberRank.rankContent" placeholder=""/> --> |
||||||
|
<Tinymce ref="content" v-model="memberRank.rankContent" :height="200" /> |
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.memberRank.rankImg')" prop="rankImg"> |
||||||
|
<!-- <el-input type="" v-model="memberRank.rankImg" placeholder=""/> --> |
||||||
|
<imgUpload |
||||||
|
ref="imgFileRef" |
||||||
|
:accept="accept" |
||||||
|
:accept-size="2 * 1024 * 1024" |
||||||
|
:auto-upload="true" |
||||||
|
:data="memberRank.rankImg" |
||||||
|
:file-list="imgFileList" |
||||||
|
:show-file-list="false" |
||||||
|
list-type="picture-card" |
||||||
|
@setId="setIdAndSubmit" |
||||||
|
> |
||||||
|
<i class="el-icon-plus"></i> |
||||||
|
</imgUpload> |
||||||
|
|
||||||
|
</el-form-item> |
||||||
|
<el-form-item :label="$t('table.memberRank.status')" prop="status"> |
||||||
|
<el-radio-group v-model="memberRank.status" size="medium"> |
||||||
|
<el-radio-button :label="true">{{ $t("common.status.valid") }}</el-radio-button> |
||||||
|
<el-radio-button :label="false">{{ $t("common.status.invalid") }}</el-radio-button> |
||||||
|
</el-radio-group> |
||||||
|
</el-form-item> |
||||||
|
</el-form> |
||||||
|
<div class="dialog-footer" slot="footer"> |
||||||
|
<el-button @click="isVisible = false" plain type="warning"> |
||||||
|
{{ $t("common.cancel") }} |
||||||
|
</el-button> |
||||||
|
<el-button @click="submitForm" :disabled="confirmDisabled" plain type="primary"> |
||||||
|
{{ $t("common.confirm") }} |
||||||
|
</el-button> |
||||||
|
</div> |
||||||
|
</el-dialog> |
||||||
|
</template> |
||||||
|
<script> |
||||||
|
import elDragDialog from '@/directive/el-drag-dialog' |
||||||
|
import memberRankApi from "@/api/MemberRank.js"; |
||||||
|
import Tinymce from '@/components/Tinymce' |
||||||
|
import imgUpload from "@/components/ceres/imgUpload" |
||||||
|
export default { |
||||||
|
name: "MemberRankEdit", |
||||||
|
directives: { elDragDialog }, |
||||||
|
components: { Tinymce, imgUpload }, |
||||||
|
props: { |
||||||
|
dialogVisible: { |
||||||
|
type: Boolean, |
||||||
|
default: false |
||||||
|
}, |
||||||
|
type: { |
||||||
|
type: String, |
||||||
|
default: "add" |
||||||
|
} |
||||||
|
}, |
||||||
|
data() { |
||||||
|
return { |
||||||
|
confirmDisabled: false, |
||||||
|
memberRank: this.initMemberRank(), |
||||||
|
screenWidth: 0, |
||||||
|
width: this.initWidth(), |
||||||
|
rules: { |
||||||
|
|
||||||
|
}, |
||||||
|
// 枚举 |
||||||
|
enums: { |
||||||
|
}, |
||||||
|
// 字典 |
||||||
|
dicts: { |
||||||
|
}, |
||||||
|
options: { |
||||||
|
placeholder: '请输入内容', |
||||||
|
modules: { |
||||||
|
toolbar: [ |
||||||
|
[{ size: ['small', false, 'large'] }], |
||||||
|
['bold', 'italic'], |
||||||
|
[{ header: 1 }, { header: 2 }], |
||||||
|
[{ list: 'ordered' }, { list: 'bullet' }], |
||||||
|
['link'], |
||||||
|
[{ color: [] }, { background: [] }], |
||||||
|
[{ align: [] }] |
||||||
|
], |
||||||
|
history: { |
||||||
|
delay: 1000, |
||||||
|
maxStack: 50, |
||||||
|
userOnly: false |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
accept: "image/jpeg, image/gif, image/png", |
||||||
|
imgFileList: [], |
||||||
|
// 上传成功数 |
||||||
|
successNum: 0, |
||||||
|
}; |
||||||
|
}, |
||||||
|
computed: { |
||||||
|
isVisible: { |
||||||
|
get() { |
||||||
|
return this.dialogVisible; |
||||||
|
}, |
||||||
|
set() { |
||||||
|
this.close(); |
||||||
|
this.reset(); |
||||||
|
} |
||||||
|
}, |
||||||
|
title() { |
||||||
|
return this.$t("common." + this.type); |
||||||
|
} |
||||||
|
}, |
||||||
|
watch: {}, |
||||||
|
mounted() { |
||||||
|
window.onresize = () => { |
||||||
|
return (() => { |
||||||
|
this.width = this.initWidth(); |
||||||
|
})(); |
||||||
|
}; |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
setIdAndSubmit(bizId, url) { |
||||||
|
const vm = this |
||||||
|
vm.successNum += 1 |
||||||
|
// vm.imgFileData.bizId = bizId |
||||||
|
vm.memberRank.rankImg = url |
||||||
|
// vm.user.id = bizId |
||||||
|
|
||||||
|
// if (vm.successNum === vm.imgFileTotal) { |
||||||
|
// vm.$store.state.hasLoading = false |
||||||
|
// } |
||||||
|
}, |
||||||
|
initMemberRank() { |
||||||
|
return { |
||||||
|
id: "", |
||||||
|
rankName: '', |
||||||
|
rankOrigin: null, |
||||||
|
rankContent: '', |
||||||
|
rankImg: '', |
||||||
|
status: true, |
||||||
|
}; |
||||||
|
}, |
||||||
|
initWidth() { |
||||||
|
this.screenWidth = document.body.clientWidth; |
||||||
|
if (this.screenWidth < 991) { |
||||||
|
return "90%"; |
||||||
|
} else if (this.screenWidth < 1400) { |
||||||
|
return "45%"; |
||||||
|
} else { |
||||||
|
return "800px"; |
||||||
|
} |
||||||
|
}, |
||||||
|
setMemberRank(val = {}) { |
||||||
|
const vm = this; |
||||||
|
|
||||||
|
vm.dicts = val['dicts']; |
||||||
|
vm.enums = val['enums']; |
||||||
|
if (val['row']) { |
||||||
|
vm.memberRank = { ...val['row'] }; |
||||||
|
|
||||||
|
} |
||||||
|
}, |
||||||
|
close() { |
||||||
|
this.$emit("close"); |
||||||
|
}, |
||||||
|
reset() { |
||||||
|
// 先清除校验,再清除表单,不然有奇怪的bug |
||||||
|
this.$refs.form.clearValidate(); |
||||||
|
this.$refs.form.resetFields(); |
||||||
|
this.confirmDisabled = false; |
||||||
|
this.memberRank = this.initMemberRank(); |
||||||
|
}, |
||||||
|
submitForm() { |
||||||
|
const vm = this; |
||||||
|
this.$refs.form.validate(valid => { |
||||||
|
if (valid) { |
||||||
|
vm.editSubmit(); |
||||||
|
} else { |
||||||
|
return false; |
||||||
|
} |
||||||
|
}); |
||||||
|
}, |
||||||
|
editSubmit() { |
||||||
|
const vm = this; |
||||||
|
if (vm.type === "edit") { |
||||||
|
vm.update(); |
||||||
|
} else { |
||||||
|
vm.save(); |
||||||
|
} |
||||||
|
}, |
||||||
|
save() { |
||||||
|
const vm = this; |
||||||
|
vm.confirmDisabled = true; |
||||||
|
// console.log(this.memberRank); |
||||||
|
// return; |
||||||
|
memberRankApi.save(this.memberRank).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
vm.isVisible = false; |
||||||
|
vm.$message({ |
||||||
|
message: vm.$t("tips.createSuccess"), |
||||||
|
type: "success" |
||||||
|
}); |
||||||
|
vm.$emit("success"); |
||||||
|
} |
||||||
|
}).finally(()=> vm.confirmDisabled = false); |
||||||
|
}, |
||||||
|
update() { |
||||||
|
const vm = this; |
||||||
|
vm.confirmDisabled = true; |
||||||
|
memberRankApi.update(this.memberRank).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
vm.isVisible = false; |
||||||
|
vm.$message({ |
||||||
|
message: this.$t("tips.updateSuccess"), |
||||||
|
type: "success" |
||||||
|
}); |
||||||
|
vm.$emit("success"); |
||||||
|
} |
||||||
|
}).finally(()=> vm.confirmDisabled = false); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
</script> |
||||||
|
<style lang="scss" scoped></style> |
@ -0,0 +1,347 @@ |
|||||||
|
<template> |
||||||
|
<div class="app-container"> |
||||||
|
<div class="filter-container"> |
||||||
|
|
||||||
|
<el-date-picker :range-separator="null" class="filter-item search-item date-range-item" |
||||||
|
end-placeholder="结束日期" format="yyyy-MM-dd HH:mm:ss" start-placeholder="开始日期" |
||||||
|
type="daterange" v-model="queryParams.timeRange" value-format="yyyy-MM-dd HH:mm:ss" |
||||||
|
/> |
||||||
|
<el-button @click="search" class="filter-item" plain type="primary"> |
||||||
|
{{ $t("table.search") }} |
||||||
|
</el-button> |
||||||
|
<el-button @click="reset" class="filter-item" plain type="warning"> |
||||||
|
{{ $t("table.reset") }} |
||||||
|
</el-button> |
||||||
|
<el-button @click="add" class="filter-item" plain type="danger" v-has-permission="['memberRank:add']"> |
||||||
|
{{ $t("table.add") }} |
||||||
|
</el-button> |
||||||
|
<el-dropdown class="filter-item" trigger="click" v-has-any-permission="['memberRank:delete', 'memberRank:export', |
||||||
|
'memberRank:import']"> |
||||||
|
<el-button> |
||||||
|
{{ $t("table.more") }}<i class="el-icon-arrow-down el-icon--right" /> |
||||||
|
</el-button> |
||||||
|
<el-dropdown-menu slot="dropdown"> |
||||||
|
<el-dropdown-item @click.native="batchDelete" v-has-permission="['memberRank:delete']"> |
||||||
|
{{ $t("table.delete") }} |
||||||
|
</el-dropdown-item> |
||||||
|
<el-dropdown-item @click.native="exportExcel" v-has-permission="['memberRank:export']"> |
||||||
|
{{ $t("table.export") }} |
||||||
|
</el-dropdown-item> |
||||||
|
<el-dropdown-item @click.native="exportExcelPreview" v-has-permission="['memberRank:export']"> |
||||||
|
{{ $t("table.exportPreview") }} |
||||||
|
</el-dropdown-item> |
||||||
|
<el-dropdown-item @click.native="importExcel" v-has-permission="['memberRank:import']"> |
||||||
|
{{ $t("table.import") }} |
||||||
|
</el-dropdown-item> |
||||||
|
</el-dropdown-menu> |
||||||
|
</el-dropdown> |
||||||
|
</div> |
||||||
|
|
||||||
|
<el-table :data="tableData.records" :key="tableKey" @cell-click="cellClick" |
||||||
|
@filter-change="filterChange" @selection-change="onSelectChange" @sort-change="sortChange" |
||||||
|
border fit row-key="id" ref="table" style="width: 100%;" v-loading="loading"> |
||||||
|
<el-table-column align="center" type="selection" width="40px" :reserve-selection="true"/> |
||||||
|
<el-table-column :label="$t('table.memberRank.rankName')" :show-overflow-tooltip="true" align="center" prop="rankName" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.rankName }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.memberRank.rankOrigin')" :show-overflow-tooltip="true" align="center" prop="rankOrigin" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.rankOrigin }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<!-- <el-table-column :label="$t('table.memberRank.rankContent')" :show-overflow-tooltip="true" align="center" prop="rankContent" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.rankContent }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> --> |
||||||
|
<el-table-column :label="$t('table.memberRank.rankImg')" :show-overflow-tooltip="true" align="center" prop="rankImg" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<!-- <span>{{ scope.row.rankImg }}</span> --> |
||||||
|
<el-image |
||||||
|
style="width: 50px; height: 50px" |
||||||
|
:src="scope.row.rankImg" |
||||||
|
fit="contain"> |
||||||
|
</el-image> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column :label="$t('table.memberRank.status')" :show-overflow-tooltip="true" align="center" prop="status" |
||||||
|
width=""> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.status }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column |
||||||
|
:label="$t('table.createTime')" |
||||||
|
align="center" |
||||||
|
prop="createTime" |
||||||
|
sortable="custom" |
||||||
|
width="170px"> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.createTime }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column |
||||||
|
:label="$t('table.operation')" align="center" column-key="operation" class-name="small-padding fixed-width" width="100px"> |
||||||
|
<template slot-scope="{ row }"> |
||||||
|
<i @click="copy(row)" class="el-icon-copy-document table-operation" :title="$t('common.delete')" |
||||||
|
style="color: #2db7f5;" v-hasPermission="['memberRank:add']"/> |
||||||
|
<i @click="edit(row)" class="el-icon-edit table-operation" :title="$t('common.delete')" |
||||||
|
style="color: #2db7f5;" v-hasPermission="['memberRank:update']"/> |
||||||
|
<i @click="singleDelete(row)" class="el-icon-delete table-operation" :title="$t('common.delete')" |
||||||
|
style="color: #f50;" v-hasPermission="['memberRank:delete']"/> |
||||||
|
<el-link class="no-perm" v-has-no-permission="['memberRank:update', 'memberRank:copy', 'memberRank:delete']"> |
||||||
|
{{ $t("tips.noPermission") }} |
||||||
|
</el-link> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
</el-table> |
||||||
|
<pagination :limit.sync="queryParams.size" :page.sync="queryParams.current" |
||||||
|
:total="Number(tableData.total)" @pagination="fetch" v-show="tableData.total > 0"/> |
||||||
|
<memberRank-edit :dialog-visible="dialog.isVisible" :type="dialog.type" |
||||||
|
@close="editClose" @success="editSuccess" ref="edit"/> |
||||||
|
<memberRank-import ref="import" :dialog-visible="fileImport.isVisible" :type="fileImport.type" |
||||||
|
:action="fileImport.action" accept=".xls,.xlsx" @close="importClose" @success="importSuccess" /> |
||||||
|
<el-dialog :close-on-click-modal="false" :close-on-press-escape="true" |
||||||
|
title="预览" width="80%" top="50px" :visible.sync="preview.isVisible" v-el-drag-dialog> |
||||||
|
<el-scrollbar> |
||||||
|
<div v-html="preview.context"></div> |
||||||
|
</el-scrollbar> |
||||||
|
</el-dialog> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
import Pagination from "@/components/Pagination"; |
||||||
|
import elDragDialog from '@/directive/el-drag-dialog' |
||||||
|
import MemberRankEdit from "./edit"; |
||||||
|
import memberRankApi from "@/api/MemberRank.js"; |
||||||
|
import MemberRankImport from "@/components/ceres/Import" |
||||||
|
import {convertEnum} from '@/utils/utils' |
||||||
|
import {downloadFile, loadEnums, initDicts, initQueryParams} from '@/utils/commons' |
||||||
|
|
||||||
|
export default { |
||||||
|
name: "MemberRankManage", |
||||||
|
directives: { elDragDialog }, |
||||||
|
components: { Pagination, MemberRankEdit, MemberRankImport}, |
||||||
|
filters: { |
||||||
|
|
||||||
|
}, |
||||||
|
data() { |
||||||
|
return { |
||||||
|
// 编辑 |
||||||
|
dialog: { |
||||||
|
isVisible: false, |
||||||
|
type: "add" |
||||||
|
}, |
||||||
|
// 预览 |
||||||
|
preview: { |
||||||
|
isVisible: false, |
||||||
|
context: '' |
||||||
|
}, |
||||||
|
// 导入 |
||||||
|
fileImport: { |
||||||
|
isVisible: false, |
||||||
|
type: "import", |
||||||
|
action: `${process.env.VUE_APP_BASE_API}/memberRank/import` |
||||||
|
// action: `${process.env.VUE_APP_BASE_API}/member/memberRank/import` |
||||||
|
}, |
||||||
|
tableKey: 0, |
||||||
|
queryParams: initQueryParams(), |
||||||
|
selection: [], |
||||||
|
loading: false, |
||||||
|
tableData: { |
||||||
|
total: 0 |
||||||
|
}, |
||||||
|
// 枚举 |
||||||
|
enums: { |
||||||
|
}, |
||||||
|
// 字典 |
||||||
|
dicts: { |
||||||
|
} |
||||||
|
}; |
||||||
|
}, |
||||||
|
computed: { |
||||||
|
}, |
||||||
|
watch: { |
||||||
|
}, |
||||||
|
mounted() { |
||||||
|
this.fetch(); |
||||||
|
|
||||||
|
// 初始化字典和枚举 |
||||||
|
const enumList = []; |
||||||
|
const dictList = []; |
||||||
|
loadEnums(enumList, this.enums, 'member'); |
||||||
|
initDicts(dictList, this.dicts); |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
editClose() { |
||||||
|
this.dialog.isVisible = false; |
||||||
|
}, |
||||||
|
editSuccess() { |
||||||
|
this.search(); |
||||||
|
}, |
||||||
|
onSelectChange(selection) { |
||||||
|
this.selection = selection; |
||||||
|
}, |
||||||
|
search() { |
||||||
|
this.fetch({ |
||||||
|
...this.queryParams |
||||||
|
}); |
||||||
|
}, |
||||||
|
reset() { |
||||||
|
this.queryParams = initQueryParams(); |
||||||
|
this.$refs.table.clearSort(); |
||||||
|
this.$refs.table.clearFilter(); |
||||||
|
this.search(); |
||||||
|
}, |
||||||
|
exportExcelPreview() { |
||||||
|
if (this.queryParams.timeRange) { |
||||||
|
this.queryParams.map.createTime_st = this.queryParams.timeRange[0]; |
||||||
|
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1]; |
||||||
|
} |
||||||
|
this.queryParams.map.fileName = '导出数据'; |
||||||
|
memberRankApi.preview(this.queryParams).then(response => { |
||||||
|
const res = response.data; |
||||||
|
this.preview.isVisible = true; |
||||||
|
this.preview.context = res.data; |
||||||
|
}); |
||||||
|
}, |
||||||
|
exportExcel() { |
||||||
|
if (this.queryParams.timeRange) { |
||||||
|
this.queryParams.map.createTime_st = this.queryParams.timeRange[0]; |
||||||
|
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1]; |
||||||
|
} |
||||||
|
this.queryParams.map.fileName = '导出数据'; |
||||||
|
memberRankApi.export(this.queryParams).then(response => { |
||||||
|
downloadFile(response); |
||||||
|
}); |
||||||
|
}, |
||||||
|
importExcel() { |
||||||
|
this.fileImport.type = "upload"; |
||||||
|
this.fileImport.isVisible = true; |
||||||
|
this.$refs.import.setModel(false); |
||||||
|
}, |
||||||
|
importSuccess() { |
||||||
|
this.search(); |
||||||
|
}, |
||||||
|
importClose() { |
||||||
|
this.fileImport.isVisible = false; |
||||||
|
}, |
||||||
|
singleDelete(row) { |
||||||
|
this.$refs.table.clearSelection() |
||||||
|
this.$refs.table.toggleRowSelection(row, true); |
||||||
|
this.batchDelete(); |
||||||
|
}, |
||||||
|
batchDelete() { |
||||||
|
if (!this.selection.length) { |
||||||
|
this.$message({ |
||||||
|
message: this.$t("tips.noDataSelected"), |
||||||
|
type: "warning" |
||||||
|
}); |
||||||
|
return; |
||||||
|
} |
||||||
|
this.$confirm(this.$t("tips.confirmDelete"), this.$t("common.tips"), { |
||||||
|
confirmButtonText: this.$t("common.confirm"), |
||||||
|
cancelButtonText: this.$t("common.cancel"), |
||||||
|
type: "warning" |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
const ids = this.selection.map(u => u.id); |
||||||
|
this.delete(ids); |
||||||
|
}) |
||||||
|
.catch(() => { |
||||||
|
this.clearSelections(); |
||||||
|
}); |
||||||
|
}, |
||||||
|
clearSelections() { |
||||||
|
this.$refs.table.clearSelection(); |
||||||
|
}, |
||||||
|
delete(ids) { |
||||||
|
memberRankApi.delete({ ids: ids }).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
this.$message({ |
||||||
|
message: this.$t("tips.deleteSuccess"), |
||||||
|
type: "success" |
||||||
|
}); |
||||||
|
this.search(); |
||||||
|
} |
||||||
|
}); |
||||||
|
}, |
||||||
|
add() { |
||||||
|
this.dialog.type = "add"; |
||||||
|
this.dialog.isVisible = true; |
||||||
|
this.$refs.edit.setMemberRank({ enums: this.enums, dicts: this.dicts}); |
||||||
|
}, |
||||||
|
copy(row) { |
||||||
|
this.$refs.edit.setMemberRank({row, enums: this.enums, dicts: this.dicts}); |
||||||
|
this.dialog.type = "copy"; |
||||||
|
this.dialog.isVisible = true; |
||||||
|
}, |
||||||
|
edit(row) { |
||||||
|
this.$refs.edit.setMemberRank({row, enums: this.enums, dicts: this.dicts}); |
||||||
|
this.dialog.type = "edit"; |
||||||
|
this.dialog.isVisible = true; |
||||||
|
}, |
||||||
|
fetch(params = {}) { |
||||||
|
this.loading = true; |
||||||
|
if (this.queryParams.timeRange) { |
||||||
|
this.queryParams.map.createTime_st = this.queryParams.timeRange[0]; |
||||||
|
this.queryParams.map.createTime_ed = this.queryParams.timeRange[1]; |
||||||
|
} |
||||||
|
|
||||||
|
this.queryParams.current = params.current ? params.current : this.queryParams.current; |
||||||
|
this.queryParams.size = params.size ? params.size : this.queryParams.size; |
||||||
|
|
||||||
|
memberRankApi.page(this.queryParams).then(response => { |
||||||
|
const res = response.data; |
||||||
|
if (res.isSuccess) { |
||||||
|
this.tableData = res.data; |
||||||
|
} |
||||||
|
}).finally(() => this.loading = false); |
||||||
|
}, |
||||||
|
sortChange(val) { |
||||||
|
this.queryParams.sort = val.prop; |
||||||
|
this.queryParams.order = val.order; |
||||||
|
if (this.queryParams.sort) { |
||||||
|
this.search(); |
||||||
|
} |
||||||
|
}, |
||||||
|
filterChange (filters) { |
||||||
|
for (const key in filters) { |
||||||
|
if(key.includes('.')) { |
||||||
|
const val = { }; |
||||||
|
val[key.split('.')[1]] = filters[key][0]; |
||||||
|
this.queryParams.model[key.split('.')[0]] = val; |
||||||
|
} else { |
||||||
|
this.queryParams.model[key] = filters[key][0] |
||||||
|
} |
||||||
|
} |
||||||
|
this.search() |
||||||
|
}, |
||||||
|
cellClick (row, column) { |
||||||
|
if (column['columnKey'] === "operation") { |
||||||
|
return; |
||||||
|
} |
||||||
|
let flag = false; |
||||||
|
this.selection.forEach((item)=>{ |
||||||
|
if(item.id === row.id) { |
||||||
|
flag = true; |
||||||
|
this.$refs.table.toggleRowSelection(row); |
||||||
|
} |
||||||
|
}) |
||||||
|
|
||||||
|
if(!flag){ |
||||||
|
this.$refs.table.toggleRowSelection(row, true); |
||||||
|
} |
||||||
|
}, |
||||||
|
} |
||||||
|
}; |
||||||
|
</script> |
||||||
|
<style lang="scss" scoped></style> |
Loading…
Reference in new issue