备份用

This commit is contained in:
shawnzhang 2020-06-02 17:39:08 +08:00
parent 2cf966cef9
commit 74ba7fbd2d
12 changed files with 328 additions and 27 deletions

View file

@ -382,4 +382,30 @@ console.log(c);
for (i in a){
a[i] = Object.assign(a[i],b[i])
}
```
#### json中key值相同时把其他值相加合并
```
function trans (arr) {
let obj = {}
let result = []
arr.forEach(({name, value}) => {
let cur = obj[name]
if (cur) {
let index = cur.index
result[index].value += value
} else {
let index = result.length
obj[name] = {
name,
index
}
result.push({name, value})
}
})
return result
}
var arr = [{name: "上海", value: 1},{name: "上海", value: 2},{name: "北京", value: 3},{name: "杭州", value: 2}]
trans(arr)
```

View file

@ -4419,6 +4419,8 @@ export default {
bmpx: 'Coding order',
xhpx: 'Sort by number',
isSecondApply: 'isSecondApply',
ecfqzzdywly: 'The second installment is only for non-sourced'
ecfqzzdywly: 'The second installment is only for non-sourced',
hzje: 'Aggregate amount'
}
}

View file

@ -4419,6 +4419,7 @@ export default {
bmpx: '编码排序',
xhpx: '序号排序',
isSecondApply: '是否二次分期',
ecfqzzdywly: '二次分期只针对于无来源'
ecfqzzdywly: '二次分期只针对于无来源',
hzje: '汇总金额'
}
}

View file

@ -366,6 +366,7 @@ export default {
offset: 100
})
}
this.$refs.newApprovalTable.clear()
this.saveloding = false
this.clearNewParms()
this.getlist()

View file

@ -1,5 +1,5 @@
<template>
<el-dialog :visible.sync="repositoryVisible" :repositorycontrol="repositorycontrol" :close-on-press-escape="false" top="10px" title="选择仓库" append-to-body @close="$emit('update:repositorycontrol', false)">
<el-dialog :visible.sync="repositoryVisible" :repositorycontrol="repositorycontrol" :close-on-press-escape="false" top="10px" title="选择单据" append-to-body @close="$emit('update:repositorycontrol', false)">
<div class="filter-container">
<!-- 搜索条件栏目 -->
<el-input v-model="getemplist.process_name" :placeholder="$t('BasicSettings.process_name')" size="small" class="filter-item" clearable @keyup.enter.native="handleFilter"/>

View file

@ -151,6 +151,11 @@
<span>{{ scope.row.expensesAccount }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('update4.hzje')" :resizable="false" align="center" min-width="150">
<template slot-scope="scope">
<span>{{ scope.row.resultmoney }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('income.currency')" :resizable="false" align="center" min-width="150">
<template slot-scope="scope">
<span>{{ scope.row.currency | currencyFilter }}</span>
@ -639,6 +644,19 @@ export default {
searchexpenses(this.getemplist).then(res => {
if (res.data.ret === 200) {
this.list = res.data.data.content.list
const listdata = res.data.data.content.list.map(item => {
return item.expensesDetailVos
})
const dataarr = [].concat.apply([], listdata)
const obj = this.trans(dataarr)
for (const i in this.list) {
for (const j in obj) {
if (this.list[i].id === obj[j].primaryTableId) {
this.list[i].resultmoney = obj[j].money
}
}
}
this.total = res.data.data.content.totalCount
}
setTimeout(() => {
@ -652,6 +670,25 @@ export default {
}
})
},
trans(arr) {
const obj = {}
const result = []
arr.forEach(({ primaryTableId, money }) => {
const cur = obj[primaryTableId]
if (cur) {
const index = cur.index
result[index].money += money
} else {
const index = result.length
obj[primaryTableId] = {
primaryTableId,
index
}
result.push({ primaryTableId, money })
}
})
return result
},
//
restFilter() {
this.handlePersonId = ''
@ -671,6 +708,18 @@ export default {
searchexpenses(this.getemplist).then(res => {
if (res.data.ret === 200) {
this.list = res.data.data.content.list
const listdata = res.data.data.content.list.map(item => {
return item.expensesDetailVos
})
const dataarr = [].concat.apply([], listdata)
const obj = this.trans(dataarr)
for (const i in this.list) {
for (const j in obj) {
if (this.list[i].id === obj[j].primaryTableId) {
this.list[i].resultmoney = obj[j].money
}
}
}
this.total = res.data.data.content.totalCount
// this.restFilter()
} else {

View file

@ -727,7 +727,9 @@ export default {
return true
} else if (row.InvestigationResult === 2 && row.isSecondApply === 1) {
return false
} else {
} else if (!row.InvestigationResult && row.isSecondApply === 1) {
return false
} else if (!row.InvestigationResult && row.isSecondApply === 2) {
return true
}
}

View file

@ -1209,15 +1209,15 @@ export default {
}).forEach(function(elem) {
const re = elem.productCode.slice(0, 2)
if (re === '01') {
if (elem.carCode === null || elem.carCode === undefined || elem.carCode === '' || elem.motorCode === null || elem.motorCode === undefined || elem.motorCode === '' || elem.batteryCode === null || elem.batteryCode === undefined || elem.batteryCode === '' || elem.chargeCode === null || elem.chargeCode === undefined || elem.chargeCode === '' || elem.controlCode === null || elem.controlCode === undefined || elem.controlCode === '') {
if (elem.carCode === null || elem.carCode === undefined || elem.carCode === '' || elem.motorCode === null || elem.motorCode === undefined || elem.motorCode === '') {
m = 2
}
}
if (re === '05') {
if (elem.batteryCode === null || elem.batteryCode === undefined || elem.batteryCode === '') {
m = 3
}
}
// if (re === '05') {
// if (elem.batteryCode === null || elem.batteryCode === undefined || elem.batteryCode === '') {
// m = 3
// }
// }
})
if (m === 3) {

View file

@ -95,6 +95,7 @@
<el-input-number
:precision="6"
v-model="scope.row.newIncludeTaxPrice"
@input="calcnewprice(scope.row, scope)"
@keyup.enter.native = "getincludeTaxPrice(scope.row, scope)"/>
</template>
</el-editable-column>
@ -356,7 +357,7 @@ export default {
console.log(row)
}
}
row.newSalePrice = row.calcitem / 100 * row.newPrice
row.newSalePrice = row.calcitem / 100 * row.newIncludeTaxPrice
},
//
getprice(row) {
@ -543,9 +544,9 @@ export default {
val.supplierDetailVos[i].oldPrice = val.supplierDetailVos[i].price
val.supplierDetailVos[i].oldIncludeTaxPrice = val.supplierDetailVos[i].includeTaxPrice
val.supplierDetailVos[i].oldTaxRate = val.supplierDetailVos[i].taxRate
val.supplierDetailVos[i].newPrice = 0
val.supplierDetailVos[i].newIncludeTaxPrice = 0
val.supplierDetailVos[i].newTaxRate = 0
val.supplierDetailVos[i].newPrice = val.supplierDetailVos[i].price
val.supplierDetailVos[i].newIncludeTaxPrice = val.supplierDetailVos[i].includeTaxPrice
val.supplierDetailVos[i].newTaxRate = val.supplierDetailVos[i].taxRate
this.$refs.editable.insert(val.supplierDetailVos[i])
}
this.supplierId = val.supplierName

View file

@ -24,7 +24,18 @@
<!-- 表格导出操作 -->
<el-button v-permission="['104-114-6']" v-waves :loading="downloadLoading" size="small" class="filter-item2" style="width: 86px" @click="handleExport"> <svg-icon icon-class="daochu"/>{{ $t('public.export') }}</el-button>
<!-- 打印操作 -->
<el-button v-permission="['104-114-7']" v-waves size="small" class="filter-item2" style="width: 86px" @click="handleImport"> <svg-icon icon-class="daochu"/>{{ $t('updates.drsj') }}</el-button>
<!-- <el-button v-permission="['104-114-7']" v-waves size="small" class="filter-item2" icon="el-icon-printer" style="width: 86px" @click="handlePrint">{{ $t('public.print') }}</el-button> -->
<el-dialog
:visible.sync="dialogVisible"
title="导入数据"
class="normal"
width="600px">
<upload-excel-component :on-success="handleSuccess" :before-upload="beforeUpload"/>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
</span>
</el-dialog>
<!-- 新建操作 -->
<el-button v-permission="['1-22-255-1']" v-waves size="small" class="filter-item2" icon="el-icon-plus" type="success" style="width: 86px" @click="handleAdd">{{ $t('public.add') }}</el-button>
</el-card>
@ -108,7 +119,7 @@
</template>
<script>
import { SupplierAdjustlist, deleteSupplierAdjust, updateSupplierAdjust2 } from '@/api/SupplierAdjust'
import { SupplierAdjustlist, deleteSupplierAdjust, updateSupplierAdjust2, addSupplierAdjust } from '@/api/SupplierAdjust'
import { getdeptlist } from '@/api/BasicSettings'
import { checkReceiptOrder } from '@/api/public'
import { searchStockCategory } from '@/api/StockCategory'
@ -121,12 +132,13 @@ import MyEmp from './components/MyEmp'
import DetailList from './components/DetailList'
import MyDialog from './components/MyDialog'
import MySupplier from './components/MySupplier'
import UploadExcelComponent from '@/components/UploadExcel/index.vue'
var _that
export default {
name: 'SupplierAdjustList',
directives: { waves, permission, permission2 },
components: { MyDialog, DetailList, MyEmp, Pagination, MySupplier },
components: { MyDialog, DetailList, MyEmp, Pagination, MySupplier, UploadExcelComponent },
filters: {
judgeStatFilter(status) {
const statusMap = {
@ -164,6 +176,7 @@ export default {
},
data() {
return {
dialogVisible: false,
tableHeight: 200,
step1: '',
step2: '',
@ -202,7 +215,7 @@ export default {
//
stockControl: false,
//
moreaction: '',
moreaction: [],
//
downloadLoading: false,
//
@ -226,7 +239,10 @@ export default {
//
editVisible: false,
//
date: []
date: [],
tableData: [],
tableHeader: [],
uploadHead: []
}
},
activated() {
@ -245,6 +261,119 @@ export default {
_that = this
},
methods: {
beforeUpload(file) {
const isLt1M = file.size / 1024 / 1024 < 1
if (isLt1M) {
return true
}
this.$message({
message: 'Please do not upload files larger than 1m in size.',
type: 'warning'
})
return false
},
handleSuccess({ results, header }) {
this.tableData = results
this.tableHeader = ['主题', '申请人', '申请人id', '部门', '部门id', '供应商', '供应商id', '申请日期', '物品编号', '物品名称', '规格', '颜色', '单位', '采购单原价', '采购单现价', '原含税价', '新含税价', '原税率', '新税率', '比例', '原销售价', '新销售价']
this.uploadHead = results.map(function(item) {
return {
title: item.主题,
applyPersonName: item.申请人,
applyPersonId: item.申请人id,
deptName: item.部门,
deptId: item.部门id,
supplierName: item.供应商,
supplierId: item.供应商id,
applyDate: item.申请日期,
productCode: item.物品编号,
productName: item.物品名称,
productType: item.规格,
color: item.颜色,
unit: item.单位,
oldPrice: item.采购单原价,
newPrice: item.采购单现价,
oldIncludeTaxPrice: item.原含税价,
newIncludeTaxPrice: item.新含税价,
oldTaxRate: item.原税率,
newTaxRate: item.新税率,
calcitem: item.比例,
oldSalePrice: item.原销售价,
newSalePrice: item.新销售价
}
})
console.log('this.uploadHead', this.uploadHead)
const detaildata = this.uploadHead.map(item => {
return {
mainid: item.supplierId,
productCode: item.productCode,
productName: item.productName,
productType: item.productType,
color: item.color,
unit: item.unit,
oldPrice: item.oldPrice,
newPrice: item.newPrice,
oldIncludeTaxPrice: item.oldIncludeTaxPrice,
newIncludeTaxPrice: item.newIncludeTaxPrice,
oldTaxRate: item.oldTaxRate,
newTaxRate: item.newTaxRate,
calcitem: item.calcitem,
oldSalePrice: item.oldSalePrice,
newSalePrice: item.newSalePrice
}
})
const maindata = this.uploadHead.map(item => {
return {
mainid: item.supplierId,
title: item.title,
applyPersonId: item.applyPersonId,
deptId: item.deptId,
supplierId: item.supplierId,
applyDate: item.applyDate
}
})
var jmap = {}
var result = []
this.uploadHead.forEach(function(al) {
var key = al.supplierId + '_' + al.supplierName
if (typeof jmap[key] === 'undefined') {
jmap[key] = []
}
jmap[key].push(al)
})
var keys = Object.keys(jmap)
for (var i = 0; i < keys.length; i++) {
var rs = keys[i].split('_')
result.push({ supplierId: rs[0], title: jmap[keys[i]][0].title, applyPersonId: jmap[keys[i]][0].applyPersonId, deptId: jmap[keys[i]][0].deptId, value: jmap[keys[i]] })
}
console.log('result', result)
for (const i in result) {
const parms = {
mainid: result[i].supplierId,
title: result[i].title,
applyPersonId: result[i].applyPersonId,
deptId: result[i].deptId,
supplierId: result[i].supplierId,
applyDate: result[i].applyDate
}
const parms2 = result[i].value
const sendparms = JSON.stringify(parms)
const sendparms2 = JSON.stringify(parms2)
addSupplierAdjust(sendparms, sendparms2, this.getemplist).then(res => {
console.log('res', res)
})
}
},
handleImport() {
this.dialogVisible = true
},
clickRow(val) {
if (val.judgeStat === 0) {
this.$refs.table.toggleRowSelection(val)
@ -434,7 +563,7 @@ export default {
//
selectInit(row, index) {
if (row.judgeStat !== 0) {
return false
return true
} else {
return true
}
@ -607,7 +736,10 @@ export default {
//
//
handleCommand(command) {
const ids = this.moreaction.map(item => item.id).join()
const needdeletedata = this.moreaction.filter(item => {
return item.judgeStat === 0
})
const ids = needdeletedata.map(item => item.id).join()
if (command === 'delete') {
this.$confirm(this.$t('prompt.scts'), this.$t('prompt.ts'), {
confirmButtonText: this.$t('prompt.qd'),
@ -674,15 +806,43 @@ export default {
},
//
handleExport() {
if (this.moreaction.length === 0) {
this.$notify.error({
title: 'wrong',
message: '请选择要导出数据',
offset: 100
})
return false
}
this.downloadLoading = true
const maindata = this.moreaction
const detaildata = this.moreaction.map(item => {
return item.supplierAdjustDetailVos
})
const needdetaildata = [].concat.apply([], detaildata)
for (const i in maindata) {
for (const j in needdetaildata) {
if (maindata[i].id === needdetaildata[j].adjustId) {
needdetaildata[j].title = maindata[i].title
needdetaildata[j].applyPersonName = maindata[i].applyPersonName
needdetaildata[j].deptName = maindata[i].deptName
needdetaildata[j].supplierName = maindata[i].supplierName
needdetaildata[j].applyDate = maindata[i].applyDate
needdetaildata[j].applyPersonId = maindata[i].applyPersonId
needdetaildata[j].deptId = maindata[i].deptId
needdetaildata[j].supplierId = maindata[i].supplierId
}
}
}
import('@/vendor/Export2Excel').then(excel => {
const tHeader = ['供应商编号', '供应商名称', '供应商简称', '供应商类别', '所在区域', '采购员', '供应商优质级别', '建档人', '建档日期']
const filterVal = ['id', 'SupplierAdjustName', 'SupplierAdjustShortName', 'typeName', 'regionName', 'buyerName', 'levelName', 'createName', 'createTime']
const data = this.formatJson(filterVal, this.list)
const tHeader = ['主题', '申请人', '申请人id', '部门', '部门id', '供应商', '供应商id', '申请日期', '物品编号', '物品名称', '规格', '颜色', '单位', '采购单原价', '采购单现价', '原含税价', '新含税价', '原税率', '新税率', '比例', '原销售价', '新销售价']
const filterVal = ['title', 'applyPersonName', 'applyPersonId', 'deptName', 'deptId', 'supplierName', 'supplierId', 'applyDate', 'productCode', 'productName', 'productType', 'color', 'unit', 'oldPrice', 'newPrice', 'oldIncludeTaxPrice', 'newIncludeTaxPrice', 'oldTaxRate', 'newTaxRate', 'calcitem', 'oldSalePrice', 'newSalePrice']
const data = this.formatJson(filterVal, needdetaildata)
excel.export_json_to_excel({
header: tHeader,
data,
filename: '经销商资料表'
filename: '供应商调价单资料表'
})
this.downloadLoading = false
})
@ -730,6 +890,23 @@ export default {
</script>
<style rel="stylesheet/css" scoped>
.normal >>> .el-dialog__header {
padding: 20px 20px 10px;
background: #fff;
position: static;
top: auto;
z-index: auto;
width: auto;
border-bottom: none;
}
.normal >>> .el-dialog {
-webkit-transform: none;
transform: none;
left: 0;
position: relative;
margin: 0 auto;
height: auto;
}
.app-container >>> .el-table .cell {
-webkit-box-sizing: border-box;
box-sizing: border-box;

View file

@ -49,7 +49,7 @@
</div>
</el-card>
<!--子件信息-->
<el-card class="box-card" style="margin-top: 5px;margin-bottom: 20px" shadow="never">
<el-card class="box-card" style="margin-top: 5px;margin-bottom: 160px" shadow="never">
<h2 ref="fuzhu" class="form-name" style="font-size: 16px;color: #606266;margin-top: -5px;">采购订货单明细</h2>
<div class="buttons" style="margin-top: 35px;margin-bottom: 10px;">
<el-button @click="handleAddproduct">{{ $t('Hmodule.tjsp') }}</el-button>
@ -85,11 +85,12 @@
</el-editable-column>
<!-- <el-editable-column :edit-render="{name: 'ElInputNumber', attrs: {min: 0, precision: 6}, type: 'visible'}" :label="$t('updates.cgdxj')" prop="newPrice" align="center" min-width="150px"/> -->
<el-editable-column :label="$t('updates.oldIncludeTaxPrice')" prop="oldIncludeTaxPrice" align="center" min-width="150px"/>
<el-editable-column :label="$t('updates.newIncludeTaxPrice')" prop="newIncludeTaxPrice" align="center" min-width="170px">
<el-editable-column :edit-render="{name: 'ElInputNumber', attrs: {min: 0, precision: 6}, type: 'visible'}" :label="$t('updates.newIncludeTaxPrice')" prop="newIncludeTaxPrice" align="center" min-width="170px">
<template slot="edit" slot-scope="scope">
<el-input-number
:precision="6"
v-model="scope.row.newIncludeTaxPrice"
@input="calcnewprice(scope.row, scope)"
@keyup.enter.native = "getincludeTaxPrice(scope.row, scope)"/>
</template>
</el-editable-column>
@ -370,7 +371,7 @@ export default {
console.log(row)
}
}
row.newSalePrice = row.calcitem / 100 * row.newPrice
row.newSalePrice = row.calcitem / 100 * row.newIncludeTaxPrice
},
//
change() {
@ -870,6 +871,11 @@ export default {
val.supplierDetailVos[i].typeId = val.supplierDetailVos[i].type
val.supplierDetailVos[i].type = val.supplierDetailVos[i].productTypeName
val.supplierDetailVos[i].oldPrice = val.supplierDetailVos[i].price
val.supplierDetailVos[i].oldIncludeTaxPrice = val.supplierDetailVos[i].includeTaxPrice
val.supplierDetailVos[i].oldTaxRate = val.supplierDetailVos[i].taxRate
val.supplierDetailVos[i].newPrice = val.supplierDetailVos[i].price
val.supplierDetailVos[i].newIncludeTaxPrice = val.supplierDetailVos[i].includeTaxPrice
val.supplierDetailVos[i].newTaxRate = val.supplierDetailVos[i].taxRate
this.$refs.editable.insert(val.supplierDetailVos[i])
}
this.supplierId = val.supplierName

View file

@ -98,6 +98,11 @@
<span>{{ scope.row.transferTicket }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('update4.hzje')" :resizable="false" align="center" min-width="150">
<template slot-scope="scope">
<span>{{ scope.row.resultmoney }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('Transfer.transferMoney')" :resizable="false" align="center" min-width="150">
<template slot-scope="scope">
<span>{{ scope.row.transferMoney }}</span>
@ -421,6 +426,18 @@ export default {
// const detaildata = res.data.data.content.list.map(item => {
// return item.approvalUseVos
// })
const listdata = res.data.data.content.list.map(item => {
return item.transferDetailVos
})
const dataarr = [].concat.apply([], listdata)
const obj = this.trans(dataarr)
for (const i in this.list) {
for (const j in obj) {
if (this.list[i].id === obj[j].transferId) {
this.list[i].resultmoney = obj[j].money
}
}
}
this.total = res.data.data.content.totalCount
}
setTimeout(() => {
@ -434,6 +451,25 @@ export default {
}
})
},
trans(arr) {
const obj = {}
const result = []
arr.forEach(({ transferId, money }) => {
const cur = obj[transferId]
if (cur) {
const index = cur.index
result[index].money += money
} else {
const index = result.length
obj[transferId] = {
transferId,
index
}
result.push({ transferId, money })
}
})
return result
},
//
restFilter() {
this.handlePersonId = ''