Commit 1ebc52aa by 张立顺

v4.6.1 功能开发完成

1 parent 067dc75f
......@@ -42,7 +42,23 @@ export function getIncomeFlowList(data) {
data.method = `${path2}workbench.statistics.income.listCountByMonth`
return request(data)
}
export function getIncomeProductList(data) {
data.method = `${path2}workbench.statistics.goods.grossProfitRadio`
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 = {
return copy
}
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
export const showLoading = Util.loading
export const hideLoading = Util.closeLoading
export const deepClone = Util.deepClone
export const downLoadFile = Util.downLoadFile
......@@ -37,7 +37,7 @@ util.open = function(url, target) {
* console.log(bar===foo) false
* @param {*} obj
*/
util.deepClone = (obj) => {
util.deepClone = obj => {
// Handle the 3 simple types, and null or undefined or function
if (obj == null || typeof obj !== 'object') return obj
// Handle Date
......@@ -47,8 +47,8 @@ util.deepClone = (obj) => {
return copy
}
// Handle Array or Object
if (obj instanceof Array | obj instanceof Object) {
const copy = (obj instanceof Array) ? [] : {}
if ((obj instanceof Array) | (obj instanceof Object)) {
const copy = obj instanceof Array ? [] : {}
for (var attr in obj) {
if (obj.hasOwnProperty(attr)) {
copy[attr] = util.deepClone(obj[attr])
......
<template>
<d2-dialog :title="'单店目标产值'"
:isVisible="outputVisible"
:width="'1080px'"
:width="'880px'"
@closeDialog="handleImport"
@confirmDialog="handleConfirmImport">
<slot>
<div class="searchWrap">
<el-col :span="13">
<el-date-picker v-model="search.outputMonth"
<el-date-picker v-model="search.targetDate"
:clearable="false"
type="month"
format="yyyy 年 MM 月"
value-format="yyyy-MM-dd"
value-format="yyyy-MM"
:picker-options="pickerOptions"
placeholder="选择月">
</el-date-picker>
</el-col>
<el-col :span="9">
<el-input v-model="search.inputVal"
<el-input v-model="search.keyword"
clearable
placeholder="输入门店名称搜索"></el-input>
</el-col>
<el-col :span="2"
class="btnContainer">
<el-button type="primary"
@click="getList"
class="searchBtn">搜索</el-button>
</el-col>
<!-- <div class="searchInput">
......@@ -38,26 +41,30 @@
style="width: 100%">
<el-table-column label="序号"
type="index"
width="180">
width="50">
</el-table-column>
<el-table-column prop="date"
<el-table-column prop="yqMerchantName"
label="园区店列表"
width="180">
width="300">
</el-table-column>
<el-table-column prop="name"
label="门店列表">
<el-table-column prop="merchantName"
label="门店列表"
width="300">
</el-table-column>
<el-table-column prop="name"
width="260"
<!-- <el-table-column prop="outputValue"
label="门店列表">
</el-table-column> -->
<!-- width="260" -->
<el-table-column prop="outputValue"
label="产值目标">
<template slot-scope="scope">
<!-- <div>slot-scope="scope"</div> -->
<span v-if="!scope.row['name']&&item.isEdit">{{scope.row['name']}}</span>
<!-- <div>slot-scope="scope"</div> &&item.isEdit-->
<span v-if="!scope.row['isEdit']">{{scope.row['outputValue']}}</span>
<!-- @input="input($event,item)" -->
<el-input v-else
style="width: 140px"
@input="handleInput($event,scope)"
v-model="scope.row['name']"
v-model="scope.row['outputValue']"
placeholder=""></el-input>
<!-- <div></div> -->
</template>
......@@ -72,6 +79,7 @@
<script>
import { limitPrice } from '@/common/constants'
import moment from 'moment'
import { getMerchantOutputValueTarget, setMerchantOutputValueTarget } from '@api/index'
export default {
props: {
isShow: {
......@@ -92,61 +100,65 @@ export default {
return time.getTime() > maxMonth.valueOf() || time.getTime() < minMonth.valueOf()
}
},
nowMonth: moment().subtract('months').startOf('month').format('yyyy-MM-DD'),
nextMonth: moment().subtract(-1, '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'),
search: {
inputVal: '',
outputMonth: ''
keyword: '',
targetDate: ''
},
tableData: [{
date: '2016-05-02',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄'
}, {
date: '2016-05-04',
name: '王小虎',
address: '上海市普陀区金沙江路 1517 弄'
}, {
date: '2016-05-04',
name: '王小虎',
address: '上海市普陀区金沙江路 1517 弄'
}, {
date: '2016-05-04',
name: '王小虎',
address: '上海市普陀区金沙江路 1517 弄'
}, {
date: '2016-05-04',
name: '王小虎',
address: '上海市普陀区金沙江路 1517 弄'
}, {
date: '2016-05-04',
name: '王小虎',
address: '上海市普陀区金沙江路 1517 弄'
}, {
date: '2016-05-01',
name: '王小虎',
address: '上海市普陀区金沙江路 1519 弄'
}, {
date: '2016-05-01',
name: '王小虎',
address: '上海市普陀区金沙江路 1519 弄'
}, {
date: '2016-05-01',
name: '王小虎',
address: '上海市普陀区金沙江路 1519 弄'
}, {
date: '2016-05-01',
name: '王小虎',
address: '上海市普陀区金沙江路 1519 弄'
}, {
date: '2016-05-01',
name: '王小虎',
address: '上海市普陀区金沙江路 1519 弄'
}, {
date: '2016-05-03',
name: '王小虎',
address: '上海市普陀区金沙江路 1516 弄'
}]
// tableLabel: [],
tableData: [
{
date: '2016-05-02',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄'
}
// , {
// date: '2016-05-04',
// name: '王小虎',
// address: '上海市普陀区金沙江路 1517 弄'
// }, {
// date: '2016-05-04',
// name: '王小虎',
// address: '上海市普陀区金沙江路 1517 弄'
// }, {
// date: '2016-05-04',
// name: '王小虎',
// address: '上海市普陀区金沙江路 1517 弄'
// }, {
// date: '2016-05-04',
// name: '王小虎',
// address: '上海市普陀区金沙江路 1517 弄'
// }, {
// date: '2016-05-04',
// name: '王小虎',
// address: '上海市普陀区金沙江路 1517 弄'
// }, {
// date: '2016-05-01',
// name: '王小虎',
// address: '上海市普陀区金沙江路 1519 弄'
// }, {
// date: '2016-05-01',
// name: '王小虎',
// address: '上海市普陀区金沙江路 1519 弄'
// }, {
// date: '2016-05-01',
// name: '王小虎',
// address: '上海市普陀区金沙江路 1519 弄'
// }, {
// date: '2016-05-01',
// name: '王小虎',
// address: '上海市普陀区金沙江路 1519 弄'
// }, {
// date: '2016-05-01',
// name: '王小虎',
// address: '上海市普陀区金沙江路 1519 弄'
// }, {
// date: '2016-05-03',
// name: '王小虎',
// address: '上海市普陀区金沙江路 1516 弄'
// }
]
// outputVisible: true
}
},
......@@ -162,19 +174,39 @@ export default {
},
mounted() {
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(5, 'months').startOf('month').format('YYYY-MM-DD'))
},
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) {
// console.log(newValue, item)
// 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'])
},
// 设置表头的颜色
......@@ -182,7 +214,19 @@ export default {
console.log(rowIndex) // 表头行标号为0
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()
},
handleImport() {
......
......@@ -7,10 +7,12 @@
<div class="selectContainer">
<div>选择日期</div>
<div class="daySelect">
<!-- -->
<el-date-picker v-model="dateValue"
type="date"
:picker-options="pickerOptions"
format="yyyy 年 MM 月 dd 日"
value-format="yyyy-MM-dd"
placeholder="选择日期">
</el-date-picker>
<!-- <el-select v-model="model"
......@@ -22,7 +24,10 @@
</el-option>
</el-select> -->
</div>
<!-- -->
<el-button type="primary"
@click="exportDailyReport"
:loading="exportDailyReportBtn"
class="exportBtn">导出日报</el-button>
</div>
<div class="inputTargetBtn"
......@@ -38,6 +43,8 @@
<script>
import outputValueDialog from './outputValueDialog'
import moment from 'moment'
import { getExportDailyReport } from '@api/index'
import { downLoadFile } from '@/common/util'
export default {
name: 'reportDownloadsCom',
components: {
......@@ -54,8 +61,28 @@ export default {
1 * 24 * 60 * 60 * 1000
}
},
dateValue: '',
outputVisible: false
dateValue: moment().subtract(1, 'day').format('yyyy-MM-DD'),
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 {
max-width: 100%;
}
}
.a {
.b {
text-align: center;
}
}
// .c{
.b {
text-align: left;
}
// }\\
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!