Commit 0fad7280 by zhangquan

联调

1 parent 79f56e26
import { http } from '@/main' import { http, http_common } from '@/main'
const defaultPath = 'scrm.api.live.' const defaultPath = 'scrm.api.live.'
...@@ -44,7 +44,7 @@ const getZoneList = params => { ...@@ -44,7 +44,7 @@ const getZoneList = params => {
} }
const pictureUpload = params => { const pictureUpload = params => {
params.method = 'glsx.accounts.biz.common.pictureUpload' params.method = 'glsx.accounts.biz.common.pictureUpload'
return http({ return http_common({
url: '/router?method=glsx.accounts.biz.common.pictureUpload', url: '/router?method=glsx.accounts.biz.common.pictureUpload',
method: 'POST', method: 'POST',
data: params, data: params,
......
import { http } from '@/main'
const defaultPath = 'scrm.api.equity.order.config.'
const url = 'rop-scrm-equity/router'
const getListApi = params => {
params.method = `${defaultPath}page`
return http({
url,
method: 'POST',
data: params
})
}
const importDateApi = params => {
params.method = `${defaultPath}import`
return http({
url,
method: 'POST',
data: params
})
}
const getDetailApi = params => {
params.method = `${defaultPath}detail`
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true
})
}
const exportDataApi = params => {
params.method = `${defaultPath}fail.export`
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true
})
}
export default {
getListApi,
importDateApi,
getDetailApi,
exportDataApi
}
...@@ -19,3 +19,4 @@ start() ...@@ -19,3 +19,4 @@ start()
export { bootstrap, mount, unmount } from '@/setup' export { bootstrap, mount, unmount } from '@/setup'
export const http = params => Vue.prototype.$http(params) export const http = params => Vue.prototype.$http(params)
export const http_brand = params => Vue.prototype.$http_brand(params) export const http_brand = params => Vue.prototype.$http_brand(params)
export const http_common = params => Vue.prototype.$http_common(params)
import Vue from 'vue' import Vue from 'vue'
import { message, messageBox } from '@/plugins/element.js' import { message, messageBox } from '@/plugins/element.js'
import { fetchConfig } from '@/config' import { fetchConfig } from '@/config'
import { GLButton, GLTable , GLCombiForm, GLTableButton,GLDialog} from 'glsx-components' //权限按钮 (根据权限动态创建) import { GLButton, GLTable, GLCombiForm, GLTableButton, GLDialog } from 'glsx-components' //权限按钮 (根据权限动态创建)
import { getRoutes } from '@/router' import { getRoutes } from '@/router'
import render from './render' import render from './render'
import 'glsx-components/dist/glsx-components.css' import 'glsx-components/dist/glsx-components.css'
...@@ -9,9 +9,12 @@ import 'glsx-components/dist/glsx-components.css' ...@@ -9,9 +9,12 @@ import 'glsx-components/dist/glsx-components.css'
let routes = [] let routes = []
let router = null let router = null
let instance = null let instance = null
Vue.use(GLTable).use(GLCombiForm).use(GLTableButton).use(GLDialog) Vue.use(GLTable)
.use(GLCombiForm)
.use(GLTableButton)
.use(GLDialog)
export async function bootstrap({ history, common, messenger, globalState, routerBase }) { export async function bootstrap({ history, common, messenger, globalState, routerBase }) {
let { response, request, request_brand, sign, secret } = await fetchConfig(common) let { response, request, request_common, request_brand, sign, sign_common, secret } = await fetchConfig(common)
// request.baseURL = 'https://scrm.dev.glsx.com.cn' // request.baseURL = 'https://scrm.dev.glsx.com.cn'
// request_brand.baseURL = 'https://scrm.dev.glsx.com.cn' // request_brand.baseURL = 'https://scrm.dev.glsx.com.cn'
// globalState.session.token = 'scrm-base-6358b874-c112-4753-ac00-ec0cce769751-rop' // globalState.session.token = 'scrm-base-6358b874-c112-4753-ac00-ec0cce769751-rop'
...@@ -26,6 +29,7 @@ export async function bootstrap({ history, common, messenger, globalState, route ...@@ -26,6 +29,7 @@ export async function bootstrap({ history, common, messenger, globalState, route
// // Vue.prototype.$defaultStartDate = '2021-07-01' // // Vue.prototype.$defaultStartDate = '2021-07-01'
Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: message.error, headers: { token: globalState.session.token } }) Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: message.error, headers: { token: globalState.session.token } })
Vue.prototype.$http_brand = new common.Http({ response, request: request_brand, sign, secret, alert: message.error, headers: { token: globalState.session.token } }) Vue.prototype.$http_brand = new common.Http({ response, request: request_brand, sign, secret, alert: message.error, headers: { token: globalState.session.token } })
Vue.prototype.$http_common = new common.Http({ response, signWay: 'md5', request: request_common, sign: sign_common, secret, headers: { TGT: globalState.session.token } })
// Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: message.error, headers: { token: 'scrm-base-811305a2-49a3-4e8a-b6dc-fb925c65c95c-rop' } }) // Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: message.error, headers: { token: 'scrm-base-811305a2-49a3-4e8a-b6dc-fb925c65c95c-rop' } })
// Vue.prototype.$http_brand = new common.Http({ response, request: request_brand, sign, secret, alert: message.error, headers: { token: 'scrm-base-811305a2-49a3-4e8a-b6dc-fb925c65c95c-rop' } }) // Vue.prototype.$http_brand = new common.Http({ response, request: request_brand, sign, secret, alert: message.error, headers: { token: 'scrm-base-811305a2-49a3-4e8a-b6dc-fb925c65c95c-rop' } })
// Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: message.error, headers: { token: '781f08c5-c443-46fd-80e1-f98d94673a73' } }) // Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: message.error, headers: { token: '781f08c5-c443-46fd-80e1-f98d94673a73' } })
......
export const taskStutas = {
0: {
label: '待执行',
color: '#C6C6C6'
},
1: {
label: '部分成功',
color: '#FDB757'
},
2: {
label: '全部成功',
color: '#2CCA74'
}
}
export const shlftStutas = {
0: {
label: '待执行',
color: '#C6C6C6'
},
1: {
label: '部分上架',
color: '#FDB757'
},
2: {
label: '全部上架',
color: '#2CCA74'
}
}
<template>
<div class="container">
<div class="global-title">任务详情</div>
<div class="main">
<GLTable :pageSizes="pageSizes" ref="tableRef" :pageConf="pageConf" :searchForm="searchForm" :tableParams="tableParams" :beforeSearchFn="beforeSearchFn" :getListApi="getListApi"></GLTable>
</div>
</div>
</template>
<script>
import util from '@/util/util'
export default {
name: 'index',
data() {
return {
size: 'small',
getListApi: this.$apis.task.getDetailApi,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
pageSizes: [10, 20, 30, 40, 50],
searchForm: {},
tableParams: {
listName: 'list',
tableOption: null,
tableColumns: [
{
label: '门店名称',
prop: 'merchantName'
},
{
label: '门店ID',
prop: 'merchantId'
},
{
label: '产品编号',
prop: 'skuCode'
},
{
label: '产品名称',
prop: 'skuName'
},
{
label: '数量',
prop: 'orderCount'
},
{
label: '单价(元)',
prop: 'unitPrice'
},
{
label: '商品状态',
prop: 'createdDate'
},
{
label: '商品状态描述',
prop: 'failReason'
},
{
label: '任务状态',
prop: 'updatedBy'
},
{
label: '任务状态描述',
prop: 'taskFailReason'
}
]
}
}
},
methods: {
beforeSearchFn() {
return new Promise(resolve => {
this.searchForm = { id: this.$route.params.id }
resolve()
})
}
}
}
</script>
<style lang="scss" scoped>
.container {
background-color: #fff;
.main {
padding: 20px;
}
}
</style>
<template>
<div class="container">
<GLCombiForm ref="searchRef" :rowNumber="2" :formObj="searchForm" :formData="searchFormData" @handleOk="handleOk" @handleRest="handleRest"></GLCombiForm>
<div class="operate_wrap">
<span class="table_title">导入列表</span>
<div class="operate_btn">
<el-button :size="size" type="primary" @click="createTask()">新建任务</el-button>
</div>
</div>
<GLTable :pageSizes="pageSizes" ref="tableRef" :pageConf="pageConf" :searchForm="searchForm" :tableParams="tableParams" :beforeSearchFn="beforeSearchFn" :getListApi="getListApi">
<div class="table-btns" slot="table-btns" slot-scope="scope">
<GLTableButton :buttonList="buttonList" :buttonItem="scope" :buttonNum="3"></GLTableButton>
</div>
</GLTable>
<GLDialog :title="uploadFormObj.id ? '导入' : '新建任务'" mode="mid" :visible.sync="isVisible" :show-close="showClose" :before-close="handleClose" @onOk="onOk" @onCancel="handleClose" :close-on-click-modal="false">
<div class="dialog_wrap">
<glsx-combi-form :isInline="false" ref="uploadRef" defaultWidth="320px" :formObj.sync="uploadFormObj" :formData="uploadFormData" :formRules="uploadRules">
<div slot="dateSlot">
<el-date-picker v-model="uploadFormObj.taskMonth" type="month" placeholder="选择月"></el-date-picker>
</div>
<div slot="uploadSlot">
<el-button icon="el-icon-plus" :size="size" @click="upload">
上传文件
<input type="file" style="opacity: 0;width: 0;height: 0;" ref="file" accept=".xlsx" @change="uploadFile" />
</el-button>
<div class="file-wrap">
<div class="file-box" @click="toOpenPDF(uploadFormObj.fileUrl)">
<div class="info" v-if="uploadFormObj.fileName">
<span class="name">{{ uploadFormObj.fileName }}</span>
</div>
<div
class="process"
:style="{
width: uploadFormObj.fileUrl ? '320px' : (compress * 320) / 100 + 'px'
}"
></div>
</div>
<img v-if="uploadFormObj.fileUrl" class="del-btn" :src="require('@/assets/del.png')" alt="" @click="delFile()" />
</div>
</div>
</glsx-combi-form>
</div>
</GLDialog>
</div>
</template>
<script>
import util from '@/util/util'
import exampleImg from '@/assets/example.png'
import glsxCombiForm from '@/components/glsx-combi-form'
import dayjs from 'dayjs'
export default {
name: 'index',
components: {
glsxCombiForm
},
data() {
return {
size: 'small',
exampleImg,
isVisible: false,
uploadRules: {
taskMonth: [{ required: true, message: '请选择任务时间', trigger: 'change' }],
taskCount: [{ required: true, message: '请输入任务数', trigger: 'change' }],
fileUrl: [{ required: true, message: '请上传文件', trigger: 'change' }]
},
uploadFormObj: {
id: '',
fileUrl: '',
fileName: '',
taskCount: '',
taskMonth: ''
},
uploadFormData: [
{
label: '任务时间:',
name: 'taskMonth',
addHtml: 'dateSlot',
isHide: false
},
{
label: '任务数:',
name: 'taskCount',
type: 'input',
maxlength: 8,
isHide: false
},
{
label: '任务明细:',
name: 'fileUrl',
addHtml: 'uploadSlot',
isHide: false
}
],
buttonList: [
{
type: 'el-button',
name: row => {
return '详情'
},
attrs: {
type: 'text'
},
listeners: {
click: row => this.goDetailPage(row.scope)
}
},
{
type: 'el-button',
name: row => {
return '导入'
},
condition: row => {
return [1].includes(row.scope.shelfStatus)
},
attrs: {
type: 'text'
},
listeners: {
click: row => this.createTask(row.scope)
}
},
{
type: 'el-button',
name: row => {
return '下载错误数据'
},
condition: row => {
return [1].includes(row.scope.shelfStatus)
},
attrs: {
type: 'text'
},
listeners: {
click: row => this.downloadExcel(row.scope)
}
}
],
getListApi: this.$apis.task.getListApi,
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
pageSizes: [5, 10, 20, 30, 40],
tableParams: {
listName: 'list',
tableOption: null,
tableColumns: [
{
label: '任务时间',
prop: 'taskMonth'
},
{
label: '任务数',
prop: 'taskCount'
},
{
label: '上架成功数',
prop: 'shelfSuccessCount'
},
{
label: '上架失败数',
prop: 'shelfFailCount'
},
{
label: '商品上架状态',
prop: 'shelfStatus'
},
{
label: '任务状态',
prop: 'taskStatus'
},
{
label: '创建时间',
prop: 'createdDate',
formatter: cell => {
return util.dateFormat(cell.createdDate, 'YYYY-MM-DD HH:mm:ss')
}
},
{
label: '更新时间',
prop: 'updatedDate',
formatter: cell => {
return util.dateFormat(cell.updatedDate, 'YYYY-MM-DD HH:mm:ss')
}
},
{
label: '操作人',
prop: 'updatedBy'
},
{
label: '操作',
addHtml: 'table-btns'
}
]
},
searchForm: {
taskMonth: '',
shelfStatus: '',
taskStatus: '',
createDate: '',
upadteDate: ''
},
searchFormData: [
{
label: '任务时间',
name: 'taskMonth',
type: 'select',
optionList: [],
optionId: 'packageCode',
optionLabel: 'packageName'
},
{
label: '商品上架状态',
name: 'shelfStatus',
type: 'select',
optionList: [
{
id: '',
label: '全部'
},
{
id: 0,
label: '待执行'
},
{
id: 1,
label: '部分上架'
},
{
id: 2,
label: '全部上架'
}
],
optionId: 'id',
optionLabel: 'label'
},
{
label: '任务状态',
name: 'taskStatus',
type: 'select',
optionList: [
{
id: '',
label: '全部'
},
{
id: 0,
label: '待执行'
},
{
id: 1,
label: '部分成功'
},
{
id: 2,
label: '全部成功'
}
],
optionId: 'id',
optionLabel: 'label'
},
{
label: '创建时间',
name: 'createDate',
type: 'datePicker',
isClear: true
},
{
label: '更新时间',
name: 'upadteDate',
type: 'datePicker',
isClear: true
}
]
}
},
methods: {
upload() {
this.$refs.file.click()
},
//查询表格
handleOk() {
this.$refs.tableRef.refreshTable()
},
goDetailPage(row) {
this.$router.push(`/taskList/detail/${row.id}`)
},
downloadExcel(row) {
this.$apis.task.exportDataApi({ taskId: row.id }).then(res => {
// window.open(res)
let tempaa = util.getExplorer()
if (tempaa == 'QQ') {
window.open(res)
} else {
let iframe = document.createElement('iframe')
iframe.style.display = 'none'
iframe.src = res
document.body.appendChild(iframe)
}
})
},
// 重置表格
handleRest() {
this.searchForm = {
taskMonth: '',
shelfStatus: '',
taskStatus: '',
createDate: '',
upadteDate: ''
}
this.handleOk()
},
getParams() {
let params = { ...this.searchForm }
if (params.createDate) {
params.createBeginDate = new Date(this.searchForm.createDate[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
params.createEndDate = new Date(this.searchForm.createDate[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
}
if (params.upadteDate) {
params.updateBeginDate = new Date(this.searchForm.upadteDate[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
params.updateEndDate = new Date(this.searchForm.upadteDate[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
}
delete params.createDate
delete params.upadteDate
return params
},
beforeSearchFn() {
return new Promise(resolve => {
this.searchForm = this.getParams()
resolve()
})
},
// 上传excel
uploadFile(e) {
const file = e.srcElement.files[0]
let AllImgExt = '.xlsx' //文件格式判断
let extName = file.name.substring(file.name.lastIndexOf('.')).toLowerCase()
if (AllImgExt !== extName) {
this.$message.error('文件格式不正确')
this.$refs.file.value = ''
return false
}
this.uploadFormObj.fileName = file.name
const reader = new FileReader()
reader.readAsDataURL(file)
reader.onload = event => {
const imgFile = event.target.result
const arrBase64 = imgFile.split(',')
const fileName = file.name.split('.')
//fileUrl: 文件名 + @ + base64拼接
const fileUrl = fileName.pop() + '@' + arrBase64[1]
this.$apis.common
.pictureUpload({ file: fileUrl })
.then(res => {
if (res.data) {
this.uploadFormObj.fileUrl = res.data
}
})
.finally(end => {
this.$refs.file.value = ''
})
}
},
createTask(row) {
if (row) {
this.uploadFormObj.id = row.id
}
this.uploadFormData.forEach(item => {
item.isHide = item.name != 'fileUrl' && row?.id
if (item.name == 'fileUrl') {
item.label = row?.id ? '导入明细' : '任务明细'
}
})
this.isVisible = true
this.$refs?.uploadRef?.$refs.formRef && this.$refs.uploadRef.$refs.formRef.clearValidate()
},
delFile() {
this.uploadFormObj.fileUrl = ''
this.uploadFormObj.fileName = ''
},
onOk() {
this.$refs?.uploadRef?.$refs.formRef.validate(valid => {
if (valid) {
let baseInfo = window.sessionStorage.getItem('SCRM_BASE_SESSION') || '{}'
const { accountName } = JSON.parse(baseInfo) || {}
let { fileUrl, taskCount, taskMonth, id } = this.uploadFormObj
taskMonth = dayjs(taskMonth).format('YYYY-MM')
let params = { fileUrl, taskCount, taskMonth, createdBy: accountName }
if (id) {
delete params.taskCount
delete params.taskMonth
}
this.$apis.task.importDateApi(params).then(res => {
if (res) {
this.handleClose()
this.$message.success('操作成功')
this.handleOk()
}
})
}
})
},
handleClose() {
this.isVisible = false
this.uploadFormObj = {
id: '',
fileUrl: '',
fileName: '',
taskCount: '',
taskMonth: ''
}
}
}
}
</script>
<style lang="scss" scoped>
.container {
background-color: #fff;
padding: 20px;
.dialog_wrap {
/deep/ .el-form-item__label {
width: 154px;
}
.file-wrap {
margin: 8px 0 0 154px;
display: flex;
align-items: center;
.file-box {
width: 320px;
height: 26px;
border-radius: 4px;
position: relative;
cursor: pointer;
.info {
height: inherit;
display: flex;
align-items: center;
margin-left: 8px;
position: relative;
z-index: 1;
.logo {
margin-right: 8px;
}
.name {
color: #1d1d1d;
font-size: 14px;
display: inline-block;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
}
.process {
position: absolute;
height: 26px;
left: 0;
top: 0;
background: #f4f6f7;
}
}
.del-btn {
width: 16px;
height: 16px;
cursor: pointer;
margin-left: 10px;
}
}
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!