535 lines
20 KiB
Vue
535 lines
20 KiB
Vue
<template>
|
|
<XdPageContainer class="app-container">
|
|
<SearchForm slot="pageHeader" :model="queryParams" ref="queryForm" size="small" :maxShow="30" label-width="80px" v-show="showSearch" @search="handleQuery" @reset="resetQuery">
|
|
<el-form-item label="运输批次" prop="batchNo">
|
|
<EmisTmsSiteBatchPicker v-model="queryParams.batchNo" ></EmisTmsSiteBatchPicker>
|
|
</el-form-item>
|
|
<el-form-item :label="$t('供应商')" prop="feeType">
|
|
<EmisSupplierPicker :placeholder="$t('请选择')" v-model="queryParams.supplierCode" ></EmisSupplierPicker>
|
|
</el-form-item>
|
|
<el-form-item label="账期" prop="billMonth">
|
|
<el-date-picker v-model="queryParams.billMonth" type="month" placeholder="账单月份" value-format="yyyy-MM" style="width:110px"></el-date-picker>
|
|
</el-form-item>
|
|
<el-form-item label="成本时间" prop="dateTimeRange">
|
|
<elDateAdvPicker placeholder="成本时间" v-model="dateTimeRange" style="width:300px" ></elDateAdvPicker>
|
|
</el-form-item>
|
|
<el-form-item label="运输方式" prop="transType">
|
|
<el-select clearable v-model="queryParams.transType" placeholder="请选择">
|
|
<el-option
|
|
v-for="dict in dict.type.emis_biz_shipping_method"
|
|
:key="dict.value"
|
|
:label="dict.label"
|
|
:value="dict.value"
|
|
></el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="运输号" prop="transSignNo">
|
|
<el-input
|
|
v-model="queryParams.transSignNo"
|
|
:placeholder="$t('运输号')"
|
|
clearable
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="发件地" prop="sendPlace">
|
|
<el-input v-model="queryParams.sendPlace" clearable placeholder="" />
|
|
</el-form-item>
|
|
<el-form-item label="目的地" prop="destPlace">
|
|
<el-input v-model="queryParams.destPlace" clearable placeholder="" />
|
|
</el-form-item>
|
|
<el-form-item :label="$t('费用类型')" prop="feeType">
|
|
<el-select clearable filterable v-model="queryParams.feeType" placeholder="请选择" >
|
|
<el-option
|
|
v-for="dict in dict.type.emis_cost_fee_type"
|
|
:key="dict.value"
|
|
:label="dict.label"
|
|
:value="dict.value"
|
|
></el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item :label="$t('分摊类型')" prop="splitType">
|
|
<el-select clearable v-model="queryParams.splitType" placeholder="请选择" >
|
|
<el-option
|
|
v-for="dict in dict.type.emis_cost_split_type"
|
|
:key="dict.value"
|
|
:label="dict.label"
|
|
:value="dict.value"
|
|
></el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
|
|
</SearchForm>
|
|
|
|
<XdTable
|
|
|
|
ref="refTable"
|
|
|
|
slot="pageContent"
|
|
slot-scope="slotProps"
|
|
:height="(slotProps.contentHeight)+'px'"
|
|
|
|
storageName="emisTmsCostFeeList_main3"
|
|
|
|
v-loading="loading"
|
|
border stripe
|
|
size="small"
|
|
:data="emisTmsCostFeeList"
|
|
:showSearch.sync="showSearch"
|
|
:queryParams="queryParams"
|
|
:total="total"
|
|
@queryTable="getList"
|
|
@selection-change="handleSelectionChange"
|
|
@sort-change="handleSortChange"
|
|
show-summary
|
|
:summary-method="getSummaries"
|
|
>
|
|
|
|
<div slot="toolbar">
|
|
<el-row :gutter="10" class="mb8">
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
type="primary"
|
|
plain
|
|
icon="el-icon-plus"
|
|
size="mini"
|
|
@click="handleAdd"
|
|
v-hasPermi="['emis:emisTmsCostFee:add']"
|
|
>成本录入</el-button>
|
|
</el-col>
|
|
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
type="success"
|
|
plain
|
|
icon="el-icon-edit"
|
|
size="mini"
|
|
:disabled="single"
|
|
@click="handleUpdate"
|
|
v-hasPermi="['emis:emisTmsCostFee:edit']"
|
|
>修改</el-button>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
type="danger"
|
|
plain
|
|
icon="el-icon-delete"
|
|
size="mini"
|
|
:disabled="multiple"
|
|
@click="handleDelete"
|
|
v-hasPermi="['emis:emisTmsCostFee:remove']"
|
|
>删除</el-button>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
type="primary"
|
|
plain
|
|
size="mini"
|
|
:disabled="multiple"
|
|
@click="handleReCalcProfit"
|
|
v-hasPermi="['emis:emisTmsCostProfit:edit']"
|
|
>利润重算</el-button>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
type="warning"
|
|
plain
|
|
icon="el-icon-download"
|
|
size="mini"
|
|
@click="handleExport"
|
|
v-hasPermi="['emis:emisTmsCostFee:export']"
|
|
>导出</el-button>
|
|
</el-col>
|
|
</el-row>
|
|
</div>
|
|
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
<!-- <el-table-column label="序号" align="center" prop="index" min-width="60">
|
|
<template slot-scope="scope">
|
|
<span v-text="getIndex(scope.$index)"> </span>
|
|
</template>
|
|
</el-table-column> -->
|
|
<!-- <el-table-column :label="$t('成本序号')" align="center" prop="costNo" min-width="100" /> -->
|
|
<el-table-column :label="$t('批次号')" align="center" prop="batchNo" min-width="120" />
|
|
<el-table-column :label="$t('批次名称')" align="center" prop="costName" min-width="150" :show-overflow-tooltip="true"/>
|
|
<el-table-column :label="$t('供应商')" align="center" prop="supplierName" min-width="180" :show-overflow-tooltip="true"/>
|
|
<!-- <el-table-column :label="$t('成本类型')" align="center" prop="feeType" min-width="100" >
|
|
<template slot-scope="scope">
|
|
<dict-tag :options="dict.type.emis_cost_fee_type" :value="scope.row.feeType"/>
|
|
</template>
|
|
</el-table-column> -->
|
|
<el-table-column :label="$t('分摊类型')" align="center" prop="splitType" min-width="100" >
|
|
<template slot-scope="scope">
|
|
<dict-tag :options="dict.type.emis_cost_split_type" :value="scope.row.splitType"/>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column :label="$t('账期')" align="center" prop="billMonth" min-width="100" />
|
|
<el-table-column :label="$t('成本时间')" align="center" prop="tradeDate" min-width="170" />
|
|
<el-table-column :label="$t('总费用')" align="center" prop="costFee" min-width="100" />
|
|
<el-table-column :label="$t('总票数')" align="center" prop="sendPieceSum" min-width="100" />
|
|
<!-- <el-table-column :label="$t('总件数')" align="center" prop="pieceNumber" min-width="100" /> -->
|
|
<!-- <el-table-column :label="$t('运单总重')" align="center" prop="totalWeight" min-width="100" /> -->
|
|
<el-table-column :label="$t('承运重量')" align="center" prop="realTotalWeight" min-width="100" />
|
|
<el-table-column :label="$t('总体积')" align="center" prop="totalVolume" min-width="100" />
|
|
<el-table-column :label="$t('运输方式')" align="center" prop="transType" min-width="100" >
|
|
<template slot-scope="scope">
|
|
<dict-tag :options="dict.type.emis_biz_shipping_method" :value="scope.row.transType"/>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column :label="$t('运输单号')" align="center" prop="transSignNo" min-width="100" />
|
|
<!-- <el-table-column :label="$t('供应商代码')" align="center" prop="supplierCode" min-width="100" /> -->
|
|
<el-table-column :label="$t('发件地')" align="center" prop="sendPlace" min-width="100" />
|
|
<el-table-column :label="$t('目的地')" align="center" prop="destPlace" min-width="100" />
|
|
<el-table-column :label="$t('包裹数')" align="center" prop="realPieceNumber" min-width="100" />
|
|
<el-table-column :label="$t('是否计算')" align="center" prop="blHasCalc" min-width="100" >
|
|
<template slot-scope="scope">
|
|
<el-tag v-if="scope.row.blHasCalc=='1'" type="success">已计算</el-tag>
|
|
<el-tag v-if="scope.row.blHasCalc=='0'" type="danger">未计算</el-tag>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column :label="$t('计算时间')" align="center" prop="calcDate" min-width="170"/>
|
|
<!-- <el-table-column :label="$t('成本费')" align="center" prop="costFee" min-width="100" /> -->
|
|
<!-- <el-table-column :label="$t('总票数')" align="center" prop="sendPieceSum" min-width="100" /> -->
|
|
<!-- <el-table-column :label="$t('总件数')" align="center" prop="pieceNumber" min-width="100" /> -->
|
|
<!-- <el-table-column :label="$t('总重量')" align="center" prop="totalWeight" min-width="100" /> -->
|
|
<!-- <el-table-column :label="$t('总体积')" align="center" prop="totalVolume" min-width="100" /> -->
|
|
<!-- <el-table-column :label="$t('财务确认状态')" align="center" prop="blConfirmCenter" min-width="120" >
|
|
<template slot-scope="scope">
|
|
<span v-if="scope.row.blConfirmCenter=='0'" >未确认</span>
|
|
<el-tag v-if="scope.row.blConfirmCenter=='1'" type="success">已确认</el-tag>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column :label="$t('财务确认人')" align="center" prop="confirmCenterManName" min-width="100" />
|
|
<el-table-column :label="$t('财务确认时间')" align="center" prop="confirmCenterDate" min-width="170" />
|
|
<el-table-column :label="$t('财务备注')" align="center" prop="confirmCenterNote" min-width="100" /> -->
|
|
<el-table-column :label="$t('备注')" align="center" prop="remark" min-width="100" :show-overflow-tooltip="true"/>
|
|
<el-table-column label="创建人" align="center" prop="createByName" width="80" :show-overflow-tooltip="true"/>
|
|
<el-table-column label="创建网点" align="center" prop="createSiteName" width="80" :show-overflow-tooltip="true"/>
|
|
<el-table-column label="创建时间" align="center" prop="createTime" width="170"/>
|
|
<el-table-column label="修改人" align="center" prop="updateByName" width="80" :show-overflow-tooltip="true"/>
|
|
<el-table-column label="修改网点" align="center" prop="updateSiteName" width="80" :show-overflow-tooltip="true"/>
|
|
<el-table-column label="修改时间" align="center" prop="updateTime" width="170"/>
|
|
|
|
</XdTable>
|
|
|
|
<el-dialog :title="titleForm" :visible.sync="openForm" width="90%" :close-on-click-modal="false" :destroy-on-close="true" v-dialogDrag append-to-body>
|
|
<EmisTmsCostFeeForm :id="currentId" @on-changed="handleFormChanged" @on-cancel="cancelForm"></EmisTmsCostFeeForm>
|
|
</el-dialog>
|
|
|
|
</XdPageContainer>
|
|
</template>
|
|
|
|
<script>
|
|
import { listEmisTmsCostFee, getEmisTmsCostFee,reCalcSplitCostFee, delEmisTmsCostFee, addEmisTmsCostFee, updateEmisTmsCostFee } from "@/api/emis/emisTmsCostFee";
|
|
import EmisTmsCostFeeForm from '@/views/emis/emisTmsCostFee/emisTmsCostFeeForm';
|
|
import elDateAdvPicker from '@/components/DatePickerAdv/elDateAdvPicker';
|
|
import EmisSupplierPicker from '@/views/emis/EmisBaseTools/EmisSupplierPicker';
|
|
import EmisTmsSiteBatchPicker from '@/views/emis/EmisBaseTools/EmisTmsSiteBatchPicker';
|
|
|
|
export default {
|
|
name: "emisTmsCostFee",
|
|
components: { EmisTmsCostFeeForm ,elDateAdvPicker,EmisSupplierPicker,EmisTmsSiteBatchPicker},
|
|
dicts: ['emis_cost_fee_type','emis_supplier_name','emis_cost_split_type','emis_biz_shipping_method','emis_payment_type'],
|
|
data() {
|
|
return {
|
|
// 遮罩层
|
|
loading: true,
|
|
// 选中数组
|
|
ids: [],
|
|
// 非单个禁用
|
|
single: true,
|
|
// 非多个禁用
|
|
multiple: true,
|
|
// 显示搜索条件
|
|
showSearch: true,
|
|
// 创建时间搜索
|
|
dateTimeRange:[],
|
|
// 总条数
|
|
total: 0,
|
|
// TMS运输成本账单表格数据
|
|
emisTmsCostFeeList: [],
|
|
selectList:[],
|
|
|
|
currentId:null,
|
|
openForm: false,
|
|
titleForm: "",
|
|
|
|
// 弹出展示层
|
|
id:null,
|
|
titleView:"",
|
|
openView: false,
|
|
// 更新站点时间范围
|
|
daterangeConfirmCenterDate: [],
|
|
// 更新站点时间范围
|
|
daterangeConfirmSiteDate: [],
|
|
// 更新站点时间范围
|
|
daterangeCreateTime: [],
|
|
// 更新站点时间范围
|
|
daterangeUpdateTime: [],
|
|
// 查询参数
|
|
queryParams: {
|
|
pageNum: 1,
|
|
pageSize: 20,
|
|
costName: null,
|
|
feeType: null,
|
|
splitType: null,
|
|
},
|
|
};
|
|
},
|
|
created() {
|
|
this.getList();
|
|
},
|
|
methods: {
|
|
/** 查询TMS运输成本账单列表 */
|
|
getList() {
|
|
this.loading = true;
|
|
listEmisTmsCostFee( this.addDateRange(this.queryParams, this.dateTimeRange,'tradeDate')).then(response => {
|
|
this.emisTmsCostFeeList = response.rows;
|
|
this.total = response.total;
|
|
this.loading = false;
|
|
});
|
|
},
|
|
async handleReCalcProfit(){
|
|
if(this.selectList&&this.selectList.length>0){
|
|
for(let i=0;i<this.selectList.length;i++){
|
|
let item=this.selectList[i];
|
|
let res=await reCalcSplitCostFee(item.costNo);
|
|
}
|
|
this.$modal.msgSuccess("重算成功");
|
|
}else{
|
|
this.$modal.msgError("请先选择成本");
|
|
}
|
|
|
|
},
|
|
|
|
/** 搜索按钮操作 */
|
|
handleQuery() {
|
|
this.queryParams.pageNum = 1;
|
|
this.getList();
|
|
},
|
|
/** 重置按钮操作 */
|
|
resetQuery() {
|
|
this.resetForm("queryForm");
|
|
this.handleQuery();
|
|
},
|
|
// 多选框选中数据
|
|
handleSelectionChange(selection) {
|
|
this.ids = selection.map(item => item.id)
|
|
this.single = selection.length!==1
|
|
this.multiple = !selection.length
|
|
|
|
this.selectList=selection;
|
|
},
|
|
// 排序 查询字段是表格中字段名字 动态取值排序顺序
|
|
handleSortChange(column) {
|
|
this.queryParams.orderByColumn = column.prop;
|
|
this.queryParams.isAsc = column.order;
|
|
this.getList();
|
|
},
|
|
/** 新增按钮操作 */
|
|
handleAdd(row) {
|
|
this.currentId=null;
|
|
this.openForm= true;
|
|
this.titleForm = "成本费用录入";
|
|
},
|
|
handleShowMoreInput(){
|
|
this.moreInputVisible = !this.moreInputVisible;
|
|
},
|
|
/** 修改按钮操作 */
|
|
handleUpdate(row) {
|
|
this.currentId=row.id || this.ids;
|
|
this.openForm = true;
|
|
this.titleForm = "修改成本";
|
|
},
|
|
handleView(row) {
|
|
this.id=row.id;
|
|
this.titleView="查看";
|
|
this.openView=true;
|
|
// this.router.push({ path: '/emis/emisTmsCostFee/viewDetail', query: { id: row.id }})
|
|
},
|
|
handleFormChanged(){
|
|
this.openForm = false;
|
|
this.getList();
|
|
},
|
|
cancelForm(){
|
|
this.openForm = false;
|
|
},
|
|
/** 删除按钮操作 */
|
|
handleDelete(row) {
|
|
const ids = row.id || this.ids;
|
|
this.$modal.confirm('是否确认删除').then(function() {
|
|
return delEmisTmsCostFee(ids);
|
|
}).then(() => {
|
|
this.getList();
|
|
this.$modal.msgSuccess("删除成功");
|
|
}).catch(() => {});
|
|
},
|
|
//指定列求和
|
|
getSummaries(param) {
|
|
const { columns, data } = param;
|
|
const sums = [];
|
|
columns.forEach((column, index) => {
|
|
if (index === 0) {
|
|
sums[index] = '合计';
|
|
return;
|
|
}
|
|
if (
|
|
column.property === 'costFee'
|
|
) {
|
|
const values = data.map(item => Number(item.costFee));
|
|
sums[index] = values.reduce((prev, curr) => {
|
|
const value = Number(curr);
|
|
if (!isNaN(value)) {
|
|
return prev + curr;
|
|
} else {
|
|
return prev;
|
|
}
|
|
}, 0);
|
|
sums[index] = sums[index].toFixed(2); //保留0位小数
|
|
}
|
|
|
|
else if (
|
|
column.property === 'sendPieceSum'
|
|
|
|
) {
|
|
const values = data.map(item => Number(item.sendPieceSum));
|
|
|
|
sums[index] = values.reduce((prev, curr) => {
|
|
const value = Number(curr);
|
|
if (!isNaN(value)) {
|
|
return prev + curr;
|
|
} else {
|
|
return prev;
|
|
}
|
|
}, 0);
|
|
sums[index] = sums[index].toFixed(0); //保留0位小数
|
|
}
|
|
else if (
|
|
column.property === 'realTotalWeight'
|
|
|
|
) {
|
|
const values = data.map(item => Number(item.realTotalWeight));
|
|
|
|
sums[index] = values.reduce((prev, curr) => {
|
|
const value = Number(curr);
|
|
if (!isNaN(value)) {
|
|
return prev + curr;
|
|
} else {
|
|
return prev;
|
|
}
|
|
}, 0);
|
|
sums[index] = sums[index].toFixed(2); //保留2位小数
|
|
}
|
|
|
|
else if (
|
|
column.property === 'totalVolume'
|
|
) {
|
|
const values = data.map(item => Number(item.totalVolume));
|
|
sums[index] = values.reduce((prev, curr) => {
|
|
const value = Number(curr);
|
|
if (!isNaN(value)) {
|
|
return prev + curr;
|
|
} else {
|
|
return prev;
|
|
}
|
|
}, 0);
|
|
sums[index] = sums[index].toFixed(2); //保留2位小数
|
|
}
|
|
else if (
|
|
column.property === 'realPieceNumber'
|
|
) {
|
|
const values = data.map(item => Number(item.realPieceNumber));
|
|
sums[index] = values.reduce((prev, curr) => {
|
|
const value = Number(curr);
|
|
if (!isNaN(value)) {
|
|
return prev + curr;
|
|
} else {
|
|
return prev;
|
|
}
|
|
}, 0);
|
|
sums[index] = sums[index].toFixed(0); //保留2位小数
|
|
}
|
|
});
|
|
|
|
|
|
console.log(sums);
|
|
return sums
|
|
},
|
|
/** 导出按钮操作 */
|
|
handleExport() {
|
|
const loadingInstance = this.$loading({
|
|
text: '正在导出...'
|
|
})
|
|
|
|
if(this.selectList&&this.selectList.length>0){
|
|
this.exportData(this.selectList,loadingInstance);
|
|
}
|
|
else{
|
|
|
|
let qExportParam={...this.queryParams};
|
|
qExportParam=this.addDateRange(qExportParam, this.dateTimeRange,'tradeDate')
|
|
qExportParam.pageNum=1;
|
|
qExportParam.pageSize=20000;
|
|
|
|
listEmisTmsCostFee(qExportParam).then(response => {
|
|
if (response.code === 200) {
|
|
this.exportData(response.rows,loadingInstance);
|
|
}
|
|
});
|
|
}
|
|
},
|
|
exportData(selData,loadingInstance){
|
|
const curList =selData
|
|
import('@/vendor/Export2Excel').then(excel => {
|
|
const exportParam=this.$refs.refTable.getExportParam();
|
|
const tHeader = exportParam.header;
|
|
const filterVal = exportParam.filter;
|
|
const data = this.formatJson(filterVal, curList, selData)
|
|
excel.export_json_to_excel({
|
|
header: tHeader,
|
|
data,
|
|
filename: '成本费用列表',
|
|
autoWidth: true
|
|
})
|
|
loadingInstance.close()
|
|
})
|
|
},
|
|
formatJson(filterVal, jsonData, resData) {
|
|
let index = 0
|
|
return jsonData.map(v => filterVal.map(j => {
|
|
|
|
if (j === 'index') {
|
|
return ++index
|
|
}
|
|
else if (j === 'splitType') {
|
|
return this.selectDictLabel(this.dict.type.emis_cost_split_type,v[j]);
|
|
}
|
|
else if (j === 'transType') {
|
|
return this.selectDictLabel(this.dict.type.emis_biz_shipping_method,v[j]);
|
|
}
|
|
|
|
return v[j]
|
|
}))
|
|
},
|
|
/** 列索引函数 */
|
|
getIndex($index) {
|
|
return (this.queryParams.pageNum - 1) * this.queryParams.pageSize + $index + 1
|
|
},
|
|
/** 时间搜索响应函数 */
|
|
dateTimeChange(value){
|
|
this.dateTimeRange=value;
|
|
},
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style scoped>
|
|
.el-divider{
|
|
margin-top: 0px;
|
|
background: 0 0;
|
|
border-top: 1px solid #E6EBF5;
|
|
}
|
|
.el-divider__text {
|
|
color: #0955ee;
|
|
cursor: pointer;
|
|
}
|
|
</style>
|