Merge branch 'master' of http://git.xdadan.loc/tanex/emis-frontend
This commit is contained in:
commit
6e3c482c89
BIN
public/static/tpl/imp_vip_trans_quote.xlsx
Normal file
BIN
public/static/tpl/imp_vip_trans_quote.xlsx
Normal file
Binary file not shown.
@ -536,7 +536,7 @@ export default {
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
//ids去掉空元素
|
||||
if( row.quoteId || this.ids.filter(Boolean).length>1){
|
||||
if( row.quoteId || this.ids.filter(Boolean).length>0){
|
||||
this.resetRefreshId="vipquote-"+this.getUUID();
|
||||
this.currentId = row.quoteId || this.ids;
|
||||
this.openForm = true;
|
||||
@ -765,7 +765,7 @@ export default {
|
||||
orderItem.feeType = orderItem.feeTypeName;
|
||||
orderItem.billType = orderItem.billTypeName;
|
||||
orderItem.priceType =orderItem.priceTypeName;
|
||||
let res = await draftQuotePrice(orderItem)
|
||||
let res = await draftQuotePrice({...orderItem,quoteType:1}) // 1-干线费
|
||||
|
||||
let rstData = res.data;
|
||||
if (rstData.result == 'success') {
|
||||
|
||||
@ -155,6 +155,18 @@
|
||||
v-hasPermi="['emis:emisQuotePrice:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button plain class="filter-item" size="mini" type="primary" icon="el-icon-upload2" @click="handleBatchImport">选择文件</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
size="mini"
|
||||
:disabled="batchAdd"
|
||||
@click="handleBatchAdd"
|
||||
>批量新增</el-button>
|
||||
</el-col>
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
@ -234,7 +246,21 @@
|
||||
<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"/>
|
||||
|
||||
<el-table-column label="计算规则" align="center" prop="exprJson" width="470"/>
|
||||
<el-table-column :label="$t('状态')" align="center" prop="uploadStatus" min-width="80" :show-overflow-tooltip="true" >
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.uploadStatus==1" type="success">新增成功</el-tag>
|
||||
<el-tag v-if="scope.row.uploadStatus==0" type="info">待新增</el-tag>
|
||||
<el-tag v-if="scope.row.uploadStatus==-1" type="danger">新增异常</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('异常信息')" align="center" prop="errorInfo" min-width="300" :show-overflow-tooltip="true" >
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.uploadStatus==-1" style="color:red">{{ scope.row.errorInfo }}</span>
|
||||
<span v-if="scope.row.uploadStatus==1">新增成功</span>
|
||||
<span v-if="scope.row.uploadStatus==0">待新增</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
@ -264,14 +290,48 @@
|
||||
<el-dialog :title="titleBatchForm" :visible.sync="openBatchUpdateForm" width="50%" :destroy-on-close="true" :close-on-click-modal="false" v-dialogDrag append-to-body>
|
||||
<BatchQuotePriceUpdateForm :ids="ids" @on-changed="handleBatchFormChanged" @on-cancel="cancelBatchForm"></BatchQuotePriceUpdateForm>
|
||||
</el-dialog>
|
||||
<el-dialog title="上传文件" :visible.sync="openUploadForm" width="50%" v-dialogDrag :destroy-on-close="true" :close-on-click-modal="false" append-to-body>
|
||||
<el-row :gutter="0">
|
||||
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="80px">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="选择文件" prop="uploadFile" >
|
||||
<el-upload
|
||||
action=""
|
||||
name="file"
|
||||
accept="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
||||
:show-file-list="true"
|
||||
:limit="1"
|
||||
:file-list="fileList"
|
||||
:tooltip="fileName"
|
||||
:on-change="fileChange"
|
||||
:before-upload="beforeUpload">
|
||||
<el-button slot="trigger" plain class="filter-item" size="mini" type="primary" >选择文件</el-button>
|
||||
<el-link type="primary" style="line-height: 28px;font-size:13px;color:blue" href="/static/tpl/imp_vip_trans_quote.xlsx">下载导入Excel模板</el-link>
|
||||
<div v-if="uploadExcelDataInfo !=''" style="color: black;font-size: 12px;font-weight: 800;">{{ fileName }} {{ uploadExcelDataInfo }}</div>
|
||||
</el-upload>
|
||||
<el-alert
|
||||
title="注意"
|
||||
type="info"
|
||||
description="仅允许导入“xls”或“xlsx”格式文件!"
|
||||
close-text="知道了">
|
||||
</el-alert>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-form>
|
||||
</el-row>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="batchImpDataForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</XdPageContainer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
|
||||
import { listEmisQuotePrice, getEmisQuotePrice, delEmisQuotePrice, addEmisQuotePrice, updateEmisQuotePrice } from "@/api/emis/emisQuotePrice";
|
||||
import { listEmisQuotePrice, getEmisQuotePrice, delEmisQuotePrice, addEmisQuotePrice, updateEmisQuotePrice, draftQuotePrice } from "@/api/emis/emisQuotePrice";
|
||||
import elDateSimplePicker from '@/components/DatePickerAdv/elDateSimplePicker';
|
||||
import vipTransQuotePriceForm from '@/views/emis/emisQuotePrice/vipTransQuotePriceForm';
|
||||
|
||||
@ -288,8 +348,7 @@ import TransProductPicker from '@/views/emis/EmisBaseTools/TransProductPicker.vu
|
||||
import EmisMonthpayAccountPicker from '@/views/emis/EmisBaseTools/EmisMonthpayAccountPicker.vue';
|
||||
|
||||
import BatchQuotePriceUpdateForm from '@/views/emis/emisQuotePrice/batchQuotePriceUpdateForm.vue';
|
||||
|
||||
|
||||
import XLSX from 'xlsx'
|
||||
export default {
|
||||
name: "VipTransQuotePriceList",
|
||||
components: { elDateSimplePicker,EmisMonthpayAccountPicker,vipTransQuotePriceForm,CountryPicker,
|
||||
@ -325,11 +384,15 @@ export default {
|
||||
formulaType:1,
|
||||
|
||||
chargeType:null,
|
||||
|
||||
openBatchUpdateForm:false,
|
||||
titleBatchForm: "",
|
||||
form:{},
|
||||
rules:{},
|
||||
openForm: false,
|
||||
titleForm: "",
|
||||
isCopy: false,
|
||||
|
||||
fileName:"",
|
||||
fileList:[],
|
||||
openBatchUpdateForm:false,
|
||||
titleBatchForm: "",
|
||||
|
||||
@ -338,6 +401,16 @@ export default {
|
||||
// 弹出展示层
|
||||
titleView:"",
|
||||
openView: false,
|
||||
//批量录入弹出
|
||||
openUploadForm:false,
|
||||
uploadMsg:"",
|
||||
uploadExcelDataInfo:"",
|
||||
//导入模板列表表格数据
|
||||
tmpDataList: [],
|
||||
selectionList:[],
|
||||
selectionIndexList: [],
|
||||
// 非批量新增禁用
|
||||
batchAdd:true,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
@ -400,7 +473,9 @@ export default {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
|
||||
getUUID() {
|
||||
return Math.random().toString(36).substring(3, 10);
|
||||
},
|
||||
/** 查询费用报价列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
@ -415,6 +490,7 @@ export default {
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.batchAdd=true;
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
@ -425,6 +501,7 @@ export default {
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.selectionList = selection;
|
||||
this.ids = selection.map(item => item.quoteId)
|
||||
let [lastObj]=selection.slice(-1);
|
||||
this.currentQuote=lastObj;
|
||||
@ -452,10 +529,12 @@ export default {
|
||||
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
if( row.quoteId || this.ids.filter(Boolean).length>0){
|
||||
this.currentId = row.quoteId || this.ids;
|
||||
this.openForm = true;
|
||||
this.isCopy = false;
|
||||
this.titleForm = "修改干线运输费";
|
||||
}
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleBatchUpdate(row) {
|
||||
@ -549,6 +628,150 @@ export default {
|
||||
dateTimeChange(value){
|
||||
this.dateTimeRange=value;
|
||||
},
|
||||
batchImpDataForm() {
|
||||
this.batchAdd = false;
|
||||
// 判断是否有数据
|
||||
if (this.tmpDataList.length == 0) {
|
||||
this.$modal.msgError('表格中没有数据');
|
||||
return;
|
||||
}
|
||||
//数据转换
|
||||
let newList = this.tmpDataList.map(item => {
|
||||
item.feeType = this.dict.type.emis_fee_type.find(v => v.label == item.feeTypeName).value;
|
||||
item.priceType = this.dict.type.emis_price_type.find(v => v.label == item.priceTypeName).value;
|
||||
if (item.billTypeName === '重量计费') {
|
||||
item.billType = '1'
|
||||
} else if (item.billType === '体积计费') {
|
||||
item.billType = '2'
|
||||
} else if (item.billType === '一口价') {
|
||||
item.billType = '3'
|
||||
}
|
||||
item.startDate = this.excelDateToJSDate(item.startDate);
|
||||
item.endDate = this.excelDateToJSDate(item.endDate);
|
||||
return item;
|
||||
})
|
||||
this.total = newList.length;
|
||||
this.emisQuotePriceList = this.emisQuotePriceList.concat(newList);
|
||||
this.tmpDataList = [];
|
||||
this.openUploadForm = false;
|
||||
},
|
||||
handleBatchAdd() {
|
||||
if (this.ids && this.ids.length > 0) {
|
||||
this.$confirm("确认新增吗?", "提示", {
|
||||
cancelButtonText: "取消",
|
||||
confirmButtonText: "确认",
|
||||
type: "warning",
|
||||
distinguishCancelAndClose: true,
|
||||
closeOnClickModal: false
|
||||
}).then(async () => {
|
||||
if (this.selectionList && this.selectionList.length > 0) {
|
||||
for (let i = 0; i < this.selectionList.length; i++) {
|
||||
let orderItem = this.selectionList[i];
|
||||
//数据转换
|
||||
|
||||
orderItem.feeType = orderItem.feeTypeName;
|
||||
orderItem.billType = orderItem.billTypeName;
|
||||
orderItem.priceType = orderItem.priceTypeName;
|
||||
let res = await draftQuotePrice({ ...orderItem, quoteType: 3 }) // 3-大客户运输费
|
||||
|
||||
let rstData = res.data;
|
||||
if (rstData.result == 'success') {
|
||||
orderItem.uploadStatus = 1;
|
||||
orderItem.errorInfo = "新增成功";
|
||||
}
|
||||
else {
|
||||
orderItem.uploadStatus = -1;
|
||||
orderItem.errorInfo = rstData.msg;
|
||||
}
|
||||
|
||||
}
|
||||
this.$modal.msgSuccess("上传成功");
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
handleBatchImport() {
|
||||
this.resetRefreshId = "importForm-" + this.getUUID();
|
||||
this.openUploadForm = true;
|
||||
this.fileList = [];
|
||||
this.uploadExcelDataInfo = "";
|
||||
this.fileName = "";
|
||||
},
|
||||
fileChange(file, fileList) {
|
||||
this.fileList = fileList;
|
||||
},
|
||||
beforeUpload(file) {
|
||||
this.fileName = file.name;
|
||||
this.form.batchName = file.name;
|
||||
this.readerData(file)
|
||||
return false
|
||||
},
|
||||
cancel(){
|
||||
this.openUploadForm = false;
|
||||
},
|
||||
excelDateToJSDate(excelDate) {
|
||||
// Excel把1900年1月1日存储为数字1
|
||||
const date = new Date(1900, 0, excelDate - 1);
|
||||
// 时间格式化为 YYYY-MM-DD HH:mm:ss
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
const hours = String(date.getHours()).padStart(2, '0');
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||
const seconds = String(date.getSeconds()).padStart(2, '0');
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||
},
|
||||
readerData(rawFile) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const reader = new FileReader()
|
||||
reader.onload = e => {
|
||||
const data = e.target.result
|
||||
const workbook = XLSX.read(data, { type: 'array' })
|
||||
const firstSheetName = workbook.SheetNames[0] // firstSheetName
|
||||
const worksheet = workbook.Sheets[firstSheetName]
|
||||
const results = XLSX.utils.sheet_to_json(worksheet)
|
||||
this.batchImportData(results);
|
||||
resolve()
|
||||
}
|
||||
reader.readAsArrayBuffer(rawFile)
|
||||
})
|
||||
},
|
||||
async batchImportData(results) {
|
||||
const _index = 1
|
||||
let loadingInstance = this.$loading({
|
||||
text: '正在解析 ' + _index + ' 数据...'
|
||||
})
|
||||
this.emisQuotePriceList = [];
|
||||
// 组装提交的数据
|
||||
for (let index = 0; index < results.length; index++) {
|
||||
const element = results[index]
|
||||
let orderData = {
|
||||
quoteName: element['报价名称'],
|
||||
useSiteName: element['使用网点'], //需要后面转成code
|
||||
custName:element['客户名称'],
|
||||
transLine: element['线路'], //转code
|
||||
prodName: element['产品类型'], //转code
|
||||
leastPrice: element['最低价格'],
|
||||
priceTypeName: element['价格取值'],
|
||||
startDate: element['开始日期'],
|
||||
endDate: element['结束日期'],
|
||||
billTypeName: element['计费类型'],
|
||||
statusName: element['启用状态'],
|
||||
feeTypeName: element['费用类型'],
|
||||
currency: element['费用币种'],
|
||||
sendAreaName: element['寄件区域'],
|
||||
dispAreaName: element['派件区域'],
|
||||
exprJson: element['计算规则'],
|
||||
uploadStatus: 0,
|
||||
errorInfo: '',
|
||||
status: 1
|
||||
}
|
||||
this.tmpDataList.push(orderData);
|
||||
}
|
||||
this.uploadExcelDataInfo = "总共 " + this.tmpDataList.length + " 条数据。";
|
||||
loadingInstance.close()
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@ -107,6 +107,16 @@ export default {
|
||||
this.drawTreeGraph();
|
||||
|
||||
|
||||
},
|
||||
beforeRouteEnter(to, from, next) {
|
||||
// 组件创建前 保存当前背景颜色
|
||||
document.documentElement.style.overflow = 'hidden';
|
||||
next();
|
||||
},
|
||||
beforeRouteLeave(to, from, next) {
|
||||
// 组件销毁前 恢复样式
|
||||
document.documentElement.style.overflow = '';
|
||||
next();
|
||||
},
|
||||
methods: {
|
||||
/** 搜索按钮操作 */
|
||||
@ -127,7 +137,6 @@ export default {
|
||||
this.queryParams.productName = item.prodName;
|
||||
},
|
||||
drawTreeGraph() {
|
||||
//
|
||||
this.contextMenu = new G6.Menu({
|
||||
getContent(evt) {
|
||||
|
||||
@ -213,6 +222,11 @@ export default {
|
||||
},
|
||||
},
|
||||
},
|
||||
nodeStateStyles: {
|
||||
closest: {
|
||||
fill: '#f00',
|
||||
},
|
||||
},
|
||||
modes: {
|
||||
default: [
|
||||
{
|
||||
@ -231,7 +245,11 @@ export default {
|
||||
},
|
||||
"drag-canvas",
|
||||
"fixed-zoom-canvas",
|
||||
"drag-node"
|
||||
"drag-node",
|
||||
// {
|
||||
// type: 'drag-node',
|
||||
// enableDelegate: true,
|
||||
// }
|
||||
],
|
||||
},
|
||||
layout: {
|
||||
@ -332,20 +350,13 @@ export default {
|
||||
|
||||
const animateCfg = { duration: 200, easing: "easeCubic" };
|
||||
this.graph.on("node:click", (evt) => {
|
||||
// this.graph.fitView();
|
||||
const { item } = evt;
|
||||
const node = item?.get("model");
|
||||
//点击更多 显示锁起来的下一层节点
|
||||
if (node.id.includes("expand")) {
|
||||
const parentNode = this.graph.getNeighbors(item, "source")[0].get("model");
|
||||
console.log(parentNode, parentNode.childrenBak);
|
||||
this.graph.updateChildren(parentNode.childrenBak, parentNode.id);
|
||||
}
|
||||
// if (node.id.includes("expand")) {
|
||||
// const parentNode = this.graph.getNeighbors(item, "source")[0].get("model");
|
||||
// console.log(parentNode, parentNode.childrenBak);
|
||||
// this.graph.updateChildren(parentNode.childrenBak, parentNode.id);
|
||||
// }
|
||||
setTimeout(() => {
|
||||
if (!node.id.includes("expand")) {
|
||||
this.graph.focusItem(item, true, animateCfg);
|
||||
@ -362,7 +373,72 @@ export default {
|
||||
this.graph.clearItemStates(node);
|
||||
});
|
||||
});
|
||||
let minDisNode;
|
||||
this.graph.on('node:dragstart', (e) => {
|
||||
console.log('dragstart')
|
||||
minDisNode = undefined;
|
||||
});
|
||||
this.graph.on('node:drag', (e) => {
|
||||
console.log('node:drag')
|
||||
minDisNode = undefined;
|
||||
const item = e.item;
|
||||
const model = item.getModel();
|
||||
const nodes = this.graph.getNodes();
|
||||
let minDis = Infinity;
|
||||
nodes.forEach((inode) => {
|
||||
this.graph.setItemState(inode, 'closest', false);
|
||||
const node = inode.getModel();
|
||||
if (node.id === model.id) return;
|
||||
const dis = (node.x - e.x) * (node.x - e.x) + (node.y - e.y) * (node.y - e.y);
|
||||
if (dis < minDis) {
|
||||
minDis = dis;
|
||||
minDisNode = inode;
|
||||
}
|
||||
});
|
||||
// console.log('minDisNode1', minDisNode);
|
||||
// if (minDis < 2000)
|
||||
this.graph.setItemState(minDisNode, 'closest', true);
|
||||
// else minDisNode = undefined;
|
||||
// console.log('minDisNode2',minDisNode)
|
||||
});
|
||||
this.graph.on('node:dragend', (e) => {
|
||||
// console.log('dragend')
|
||||
const descriptionDiv = document.createElement('div');
|
||||
descriptionDiv.innerHTML =
|
||||
'Move a subtree to a new parent by dragging the root node of the subtree.';
|
||||
container.appendChild(descriptionDiv);
|
||||
// console.log('minDisNode', minDisNode)
|
||||
if (!minDisNode) {
|
||||
descriptionDiv.innerHTML = 'Failed. No node close to the dragged node.';
|
||||
return;
|
||||
}
|
||||
const item = e.item;
|
||||
const id = item.getID();
|
||||
const data = this.graph.findDataById(id);
|
||||
// if the minDisNode is a descent of the dragged node, return
|
||||
let isDescent = false;
|
||||
const minDisNodeId = minDisNode.getID();
|
||||
// console.log('dragend', minDisNodeId, isDescent, data, id);
|
||||
console.log('目的节点==》',this.graph.findDataById(minDisNodeId)) //目的节点
|
||||
console.log('拖动节点==》', this.graph.findDataById(id)) //拖动节点
|
||||
G6.Util.traverseTree(data, (d) => {
|
||||
if (d.id === minDisNodeId) isDescent = true;
|
||||
});
|
||||
if (isDescent) {
|
||||
descriptionDiv.innerHTML = 'Failed. The target node is a descendant of the dragged node.';
|
||||
return;
|
||||
}
|
||||
this.graph.removeChild(id);
|
||||
|
||||
setTimeout(() => {
|
||||
const newParentData = this.graph.findDataById(minDisNodeId);
|
||||
let newChildren = newParentData.children;
|
||||
if (newChildren) newChildren.push(data);
|
||||
else newChildren = [data];
|
||||
this.graph.updateChildren(newChildren, minDisNodeId);
|
||||
descriptionDiv.innerHTML = 'Success.';
|
||||
}, 600);
|
||||
});
|
||||
// this.graph.data(this.treeData);
|
||||
// this.graph.render();
|
||||
this.graph.zoom(0.9);
|
||||
@ -413,10 +489,14 @@ export default {
|
||||
return e.item._cfg.model.label;
|
||||
},
|
||||
getContent(e) {
|
||||
let outDiv = document.createElement("p");
|
||||
// outDiv.innerHTML = ` ${e.item.getModel().id} `;
|
||||
outDiv.innerHTML = ` ${e.item._cfg.model.supplierName || ''} `;
|
||||
return outDiv;
|
||||
if (e.item._cfg.model.startSiteName) {
|
||||
return `<div class="tooltip">
|
||||
<div>${e.item._cfg.model.startSiteName}->${e.item._cfg.model.nextSiteName}</div>
|
||||
<div>${e.item._cfg.model.supplierName || ''}</div>
|
||||
</div>`
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
},
|
||||
itemTypes: ["node"],
|
||||
});
|
||||
@ -515,7 +595,7 @@ export default {
|
||||
#container>>>.g6-component-tooltip {
|
||||
background: #333;
|
||||
color: #fff;
|
||||
padding: 0 8px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
canvas {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user