Commit 1ebc52aa by 张立顺

v4.6.1 功能开发完成

1 parent 067dc75f
...@@ -42,7 +42,23 @@ export function getIncomeFlowList(data) { ...@@ -42,7 +42,23 @@ export function getIncomeFlowList(data) {
data.method = `${path2}workbench.statistics.income.listCountByMonth` data.method = `${path2}workbench.statistics.income.listCountByMonth`
return request(data) return request(data)
} }
export function getIncomeProductList(data) { export function getIncomeProductList(data) {
data.method = `${path2}workbench.statistics.goods.grossProfitRadio` data.method = `${path2}workbench.statistics.goods.grossProfitRadio`
return request(data) return request(data)
} }
export function getExportDailyReport(data) {
data.method = `${path2}workbench.exportDailyReport`
return request(data)
}
export function getMerchantOutputValueTarget(data) {
data.method = `${path2}workbench.listMerchantOutputValueTarget`
return request(data)
}
export function setMerchantOutputValueTarget(data) {
data.method = `${path2}workbench.inputMerchantOutputValueTarget`
return request(data)
}
...@@ -242,6 +242,23 @@ export const Util = { ...@@ -242,6 +242,23 @@ export const Util = {
return copy return copy
} }
throw new Error("Unable to clone obj! Its type isn't supported.") throw new Error("Unable to clone obj! Its type isn't supported.")
},
/**
* url下载文件
*
*/
downLoadFile: function(url) {
// console.log(row)
// return
const Temp = document.createElement('a')
// Temp.href = process.env.VUE_APP_BASE_URL + '/article/export.do?articleId=' + row.id
Temp.href = url
console.log(url)
// console.log(Temp.href)
document.body.append(Temp)
Temp.click()
document.body.removeChild(Temp)
} }
} }
...@@ -250,3 +267,4 @@ export const showToast = Util.Info ...@@ -250,3 +267,4 @@ export const showToast = Util.Info
export const showLoading = Util.loading export const showLoading = Util.loading
export const hideLoading = Util.closeLoading export const hideLoading = Util.closeLoading
export const deepClone = Util.deepClone export const deepClone = Util.deepClone
export const downLoadFile = Util.downLoadFile
...@@ -37,7 +37,7 @@ util.open = function(url, target) { ...@@ -37,7 +37,7 @@ util.open = function(url, target) {
* console.log(bar===foo) false * console.log(bar===foo) false
* @param {*} obj * @param {*} obj
*/ */
util.deepClone = (obj) => { util.deepClone = obj => {
// Handle the 3 simple types, and null or undefined or function // Handle the 3 simple types, and null or undefined or function
if (obj == null || typeof obj !== 'object') return obj if (obj == null || typeof obj !== 'object') return obj
// Handle Date // Handle Date
...@@ -47,8 +47,8 @@ util.deepClone = (obj) => { ...@@ -47,8 +47,8 @@ util.deepClone = (obj) => {
return copy return copy
} }
// Handle Array or Object // Handle Array or Object
if (obj instanceof Array | obj instanceof Object) { if ((obj instanceof Array) | (obj instanceof Object)) {
const copy = (obj instanceof Array) ? [] : {} const copy = obj instanceof Array ? [] : {}
for (var attr in obj) { for (var attr in obj) {
if (obj.hasOwnProperty(attr)) { if (obj.hasOwnProperty(attr)) {
copy[attr] = util.deepClone(obj[attr]) copy[attr] = util.deepClone(obj[attr])
......
<template> <template>
<d2-dialog :title="'单店目标产值'" <d2-dialog :title="'单店目标产值'"
:isVisible="outputVisible" :isVisible="outputVisible"
:width="'1080px'" :width="'880px'"
@closeDialog="handleImport" @closeDialog="handleImport"
@confirmDialog="handleConfirmImport"> @confirmDialog="handleConfirmImport">
<slot> <slot>
<div class="searchWrap"> <div class="searchWrap">
<el-col :span="13"> <el-col :span="13">
<el-date-picker v-model="search.outputMonth" <el-date-picker v-model="search.targetDate"
:clearable="false"
type="month" type="month"
format="yyyy 年 MM 月" format="yyyy 年 MM 月"
value-format="yyyy-MM-dd" value-format="yyyy-MM"
:picker-options="pickerOptions" :picker-options="pickerOptions"
placeholder="选择月"> placeholder="选择月">
</el-date-picker> </el-date-picker>
</el-col> </el-col>
<el-col :span="9"> <el-col :span="9">
<el-input v-model="search.inputVal" <el-input v-model="search.keyword"
clearable
placeholder="输入门店名称搜索"></el-input> placeholder="输入门店名称搜索"></el-input>
</el-col> </el-col>
<el-col :span="2" <el-col :span="2"
class="btnContainer"> class="btnContainer">
<el-button type="primary" <el-button type="primary"
@click="getList"
class="searchBtn">搜索</el-button> class="searchBtn">搜索</el-button>
</el-col> </el-col>
<!-- <div class="searchInput"> <!-- <div class="searchInput">
...@@ -38,26 +41,30 @@ ...@@ -38,26 +41,30 @@
style="width: 100%"> style="width: 100%">
<el-table-column label="序号" <el-table-column label="序号"
type="index" type="index"
width="180"> width="50">
</el-table-column> </el-table-column>
<el-table-column prop="date" <el-table-column prop="yqMerchantName"
label="园区店列表" label="园区店列表"
width="180"> width="300">
</el-table-column> </el-table-column>
<el-table-column prop="name" <el-table-column prop="merchantName"
label="门店列表"> label="门店列表"
width="300">
</el-table-column> </el-table-column>
<el-table-column prop="name" <!-- <el-table-column prop="outputValue"
width="260" label="门店列表">
</el-table-column> -->
<!-- width="260" -->
<el-table-column prop="outputValue"
label="产值目标"> label="产值目标">
<template slot-scope="scope"> <template slot-scope="scope">
<!-- <div>slot-scope="scope"</div> --> <!-- <div>slot-scope="scope"</div> &&item.isEdit-->
<span v-if="!scope.row['name']&&item.isEdit">{{scope.row['name']}}</span> <span v-if="!scope.row['isEdit']">{{scope.row['outputValue']}}</span>
<!-- @input="input($event,item)" --> <!-- @input="input($event,item)" -->
<el-input v-else <el-input v-else
style="width: 140px" style="width: 140px"
@input="handleInput($event,scope)" @input="handleInput($event,scope)"
v-model="scope.row['name']" v-model="scope.row['outputValue']"
placeholder=""></el-input> placeholder=""></el-input>
<!-- <div></div> --> <!-- <div></div> -->
</template> </template>
...@@ -72,6 +79,7 @@ ...@@ -72,6 +79,7 @@
<script> <script>
import { limitPrice } from '@/common/constants' import { limitPrice } from '@/common/constants'
import moment from 'moment' import moment from 'moment'
import { getMerchantOutputValueTarget, setMerchantOutputValueTarget } from '@api/index'
export default { export default {
props: { props: {
isShow: { isShow: {
...@@ -92,61 +100,65 @@ export default { ...@@ -92,61 +100,65 @@ export default {
return time.getTime() > maxMonth.valueOf() || time.getTime() < minMonth.valueOf() return time.getTime() > maxMonth.valueOf() || time.getTime() < minMonth.valueOf()
} }
}, },
nowMonth: moment().subtract('months').startOf('month').format('yyyy-MM-DD'), nowMonth: moment().subtract('months').startOf('month').format('yyyy-MM'),
nextMonth: moment().subtract(-1, 'months').startOf('month').format('yyyy-MM-DD'), nextMonth: moment().subtract(-1, 'months').startOf('month').format('yyyy-MM'),
search: { search: {
inputVal: '', keyword: '',
outputMonth: '' targetDate: ''
}, },
tableData: [{ // tableLabel: [],
date: '2016-05-02', tableData: [
name: '王小虎', {
address: '上海市普陀区金沙江路 1518 弄' date: '2016-05-02',
}, { name: '王小虎',
date: '2016-05-04', address: '上海市普陀区金沙江路 1518 弄'
name: '王小虎', }
address: '上海市普陀区金沙江路 1517 弄' // , {
}, { // date: '2016-05-04',
date: '2016-05-04', // name: '王小虎',
name: '王小虎', // address: '上海市普陀区金沙江路 1517 弄'
address: '上海市普陀区金沙江路 1517 弄' // }, {
}, { // date: '2016-05-04',
date: '2016-05-04', // name: '王小虎',
name: '王小虎', // address: '上海市普陀区金沙江路 1517 弄'
address: '上海市普陀区金沙江路 1517 弄' // }, {
}, { // date: '2016-05-04',
date: '2016-05-04', // name: '王小虎',
name: '王小虎', // address: '上海市普陀区金沙江路 1517 弄'
address: '上海市普陀区金沙江路 1517 弄' // }, {
}, { // date: '2016-05-04',
date: '2016-05-04', // name: '王小虎',
name: '王小虎', // address: '上海市普陀区金沙江路 1517 弄'
address: '上海市普陀区金沙江路 1517 弄' // }, {
}, { // date: '2016-05-04',
date: '2016-05-01', // name: '王小虎',
name: '王小虎', // address: '上海市普陀区金沙江路 1517 弄'
address: '上海市普陀区金沙江路 1519 弄' // }, {
}, { // date: '2016-05-01',
date: '2016-05-01', // name: '王小虎',
name: '王小虎', // address: '上海市普陀区金沙江路 1519 弄'
address: '上海市普陀区金沙江路 1519 弄' // }, {
}, { // date: '2016-05-01',
date: '2016-05-01', // name: '王小虎',
name: '王小虎', // address: '上海市普陀区金沙江路 1519 弄'
address: '上海市普陀区金沙江路 1519 弄' // }, {
}, { // date: '2016-05-01',
date: '2016-05-01', // name: '王小虎',
name: '王小虎', // address: '上海市普陀区金沙江路 1519 弄'
address: '上海市普陀区金沙江路 1519 弄' // }, {
}, { // date: '2016-05-01',
date: '2016-05-01', // name: '王小虎',
name: '王小虎', // address: '上海市普陀区金沙江路 1519 弄'
address: '上海市普陀区金沙江路 1519 弄' // }, {
}, { // date: '2016-05-01',
date: '2016-05-03', // name: '王小虎',
name: '王小虎', // address: '上海市普陀区金沙江路 1519 弄'
address: '上海市普陀区金沙江路 1516 弄' // }, {
}] // date: '2016-05-03',
// name: '王小虎',
// address: '上海市普陀区金沙江路 1516 弄'
// }
]
// outputVisible: true // outputVisible: true
} }
}, },
...@@ -162,19 +174,39 @@ export default { ...@@ -162,19 +174,39 @@ export default {
}, },
mounted() { mounted() {
console.log(this.nowMonth) console.log(this.nowMonth)
this.search.outputMonth = this.nowMonth this.search.targetDate = this.nowMonth
this.getList()
// console.log(moment().subtract(-1, 'months').endOf('month').format('YYYY-MM-DD')) // console.log(moment().subtract(-1, 'months').endOf('month').format('YYYY-MM-DD'))
// console.log(moment().subtract(5, 'months').startOf('month').format('YYYY-MM-DD')) // console.log(moment().subtract(5, 'months').startOf('month').format('YYYY-MM-DD'))
}, },
methods: { methods: {
getlist() { getList() {
getMerchantOutputValueTarget(this.search).then((result) => {
const monthCheck = [this.nowMonth, this.nextMonth].includes(this.search.targetDate)
console.log(monthCheck)
// 处理值能否编辑的问题
const listFilter = result
// 要单月或者下月并且值为0才可以编辑
this.tableData = listFilter.map((item) => {
item.dataMonth = this.search.targetDate
item.isEdit = monthCheck && !item.outputValue
return item
})
// console.log(result)
this.tableData = result
// console.log(this.tableData)
}).catch((err) => {
console.log(err)
})
}, },
handleInput(newValue, item) { handleInput(newValue, item) {
// console.log(newValue, item) // console.log(newValue, item)
// let limitNum = limitPrice // let limitNum = limitPrice
this.tableData[item.$index]['name'] = limitPrice(newValue, item.row.name, 6) // console.log(limitPrice(newValue, item.row.outputValue, 6))
newValue = newValue.replace(/[^\d.]/g, '') // 清除“数字”和“.”以外的字符
console.log(newValue)
this.tableData[item.$index]['outputValue'] = limitPrice(newValue, item.row.outputValue, 6, 0, 1)
// console.log(this.tableData[item.$index]['name']) // console.log(this.tableData[item.$index]['name'])
}, },
// 设置表头的颜色 // 设置表头的颜色
...@@ -182,7 +214,19 @@ export default { ...@@ -182,7 +214,19 @@ export default {
console.log(rowIndex) // 表头行标号为0 console.log(rowIndex) // 表头行标号为0
return 'background:#F4F6FC' return 'background:#F4F6FC'
}, },
handleConfirmImport() { async handleConfirmImport() {
const filterList = this.tableData.filter((item) => {
return item.isEdit && item.outputValue
})
if (filterList.length) {
// console.log('请求修改')
// const result =
await setMerchantOutputValueTarget({ list: filterList })
// console.log(result)
}
// else {
// console.log('没有能修改的')
// }
this.handleImport() this.handleImport()
}, },
handleImport() { handleImport() {
......
...@@ -7,10 +7,12 @@ ...@@ -7,10 +7,12 @@
<div class="selectContainer"> <div class="selectContainer">
<div>选择日期</div> <div>选择日期</div>
<div class="daySelect"> <div class="daySelect">
<!-- -->
<el-date-picker v-model="dateValue" <el-date-picker v-model="dateValue"
type="date" type="date"
:picker-options="pickerOptions" :picker-options="pickerOptions"
format="yyyy 年 MM 月 dd 日" format="yyyy 年 MM 月 dd 日"
value-format="yyyy-MM-dd"
placeholder="选择日期"> placeholder="选择日期">
</el-date-picker> </el-date-picker>
<!-- <el-select v-model="model" <!-- <el-select v-model="model"
...@@ -22,7 +24,10 @@ ...@@ -22,7 +24,10 @@
</el-option> </el-option>
</el-select> --> </el-select> -->
</div> </div>
<!-- -->
<el-button type="primary" <el-button type="primary"
@click="exportDailyReport"
:loading="exportDailyReportBtn"
class="exportBtn">导出日报</el-button> class="exportBtn">导出日报</el-button>
</div> </div>
<div class="inputTargetBtn" <div class="inputTargetBtn"
...@@ -38,6 +43,8 @@ ...@@ -38,6 +43,8 @@
<script> <script>
import outputValueDialog from './outputValueDialog' import outputValueDialog from './outputValueDialog'
import moment from 'moment' import moment from 'moment'
import { getExportDailyReport } from '@api/index'
import { downLoadFile } from '@/common/util'
export default { export default {
name: 'reportDownloadsCom', name: 'reportDownloadsCom',
components: { components: {
...@@ -54,8 +61,28 @@ export default { ...@@ -54,8 +61,28 @@ export default {
1 * 24 * 60 * 60 * 1000 1 * 24 * 60 * 60 * 1000
} }
}, },
dateValue: '', dateValue: moment().subtract(1, 'day').format('yyyy-MM-DD'),
outputVisible: false outputVisible: false,
exportDailyReportBtn: false
}
},
methods: {
exportDailyReport() {
if (!this.dateValue) return this.$message.warning('请选择日期')
this.exportDailyReportBtn = true
console.log(downLoadFile)
// return
getExportDailyReport({ endDateStr: this.dateValue }).then((result) => {
console.log(result)
// if (result.code == 0) {
console.log(downLoadFile)
// downLoadFile(result)
// }
}).catch((err) => {
console.log(err)
}).finally((result) => {
this.exportDailyReportBtn = false
})
} }
} }
} }
......
...@@ -890,15 +890,4 @@ export default { ...@@ -890,15 +890,4 @@ export default {
max-width: 100%; max-width: 100%;
} }
} }
.a {
.b {
text-align: center;
}
}
// .c{
.b {
text-align: left;
}
// }\\
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!