合并代码

This commit is contained in:
fan 2019-12-10 10:20:32 +08:00
commit 2c6f19b270
19 changed files with 368 additions and 238 deletions

View File

@ -148,3 +148,10 @@ export function postCreatePackage(data) {
data: data
});
}
// 获取订单对应的商品列表
export function getGoodsListByOrderId(id) {
return request({
url: `/api/order/${id}`,
method: 'get'
});
}

View File

@ -236,7 +236,7 @@
<div :key="item.prop" style="margin-left:150px;margin-bottom:20px">
<el-button v-if="item.buttontip" size="mini" style="margin-bottom:10px" @click="item.buttonClick">{{ item.buttontip }}
</el-button>
<el-table :data="formModel[item.prop]" border style="width:80%" class="table_item">
<el-table :data="formModel[item.prop]" border :style="item.style" class="table_item">
<el-table-column v-for="data in item.tableList" :key="data.prop" :prop="data.prop" :label="data.label">
<template slot-scope="scope">
<el-form-item v-if="data.isEdit" :prop="item.prop+'.' + scope.$index + '.'+data.prop" :required="false" :rules="data.rules[data.prop]">

View File

@ -560,6 +560,7 @@ export default {
startingPoint: 'Starting point:',
endingPoint: 'Ending point:',
frontSectionMode:'Extend Mode',
lockFirst:'Lock First',
continueProtect: 'Continue protect',
continueProtectList: 'Continue protect list'
};

View File

@ -114,5 +114,7 @@ export default {
back: 'back',
next: 'next',
transferAttribution: 'Transfer attribution',
distributionAttribution: 'Distribution attribution'
distributionAttribution: 'Distribution attribution',
goodsAmount:'Goods Amount',
operate:'operate'
};

View File

@ -554,6 +554,7 @@ export default {
startingPoint: '起点:',
endingPoint: '终点:',
frontSectionMode:'延伸方式',
lockFirst:'是否先锁闭',
continueProtect: '延续保护',
continueProtectList: '延续保护列表'
};

View File

@ -113,5 +113,7 @@ export default {
back: '返回',
next: '下一步',
transferAttribution: '转赠归属',
distributionAttribution: '分发归属'
distributionAttribution: '分发归属',
goodsAmount:'商品个数',
operate:'操作'
};

View File

@ -9,11 +9,12 @@ export function getUID(type, list) {
let name = '';
if (type == 'T') {
name = list.length ? Number(list[list.length - 1].code.replace('T', '')) + 1 : list.length + 1;
} else if (type == 'W') {
name = list.length ? Number(list[list.length - 1].code.replace('W', '')) + 1 : list.length + 1;
} else {
name = Math.floor((Math.random() * 100000) + 1);
}
// else if (type == 'W') {
// name = list.length ? Number(list[list.length - 1].code.replace('W', '')) + 1 : list.length + 1;
// }
function checkUid() {
let count = 0;
for (let index = 0; index < list.length; index++) {

View File

@ -14,6 +14,7 @@ import runPlan from './modules/runplan';
import socket from './modules/socket';
import scriptRecord from './modules/scriptRecord';
import ibp from './modules/ibp';
import order from './modules/order';
import getters from './getters';
@ -34,7 +35,8 @@ const store = new Vuex.Store({
runPlan,
socket,
scriptRecord,
ibp
ibp,
order
},
getters
});

View File

@ -0,0 +1,28 @@
/**
* 实训状态数据
*/
const order = {
namespaced: true,
state: {
orderList: [] // 选中的商品列表,
},
getters: {
orderList: (state)=>{
return state.orderList;
}
},
mutations: {
setOrderList: (state, orderList) => {
state.orderList = orderList;
}
},
actions: {
/**
* 设置选中的商品列表
*/
setOrderList: ({ commit }, orderList) => {
commit('setOrderList', orderList);
}
}
};
export default order;

View File

@ -2,13 +2,13 @@ import { getSessionStorage } from '@/utils/auth';
import { listPublishMap, getMapListByProjectCode } from '@/api/jmap/map';
import { ProjectCode } from '@/scripts/ConstDic';
export async function getMapListByProject() {
export async function getMapListByProject(drawWay) {
const project = getSessionStorage('project');
let mapList = [];
if (project.endsWith('xty')) {
mapList = await getMapListByProjectCode(ProjectCode[project]);
} else {
mapList = await listPublishMap();
mapList = await listPublishMap({'drawWay':drawWay});
}
return mapList;
}

View File

@ -134,7 +134,8 @@ export default {
this.lineCodeList = response.data;
});
getMapListByProject().then(response => {
const drawWay = 0;
getMapListByProject(drawWay).then(response => {
this.publishMapList = response.data;
}).catch(() => {
this.$messageBox(this.$t('map.failedLoadListPublishedMaps'));

View File

@ -134,7 +134,9 @@ export default {
this.lineCodeList = response.data;
});
getMapListByProject().then(response => {
//
const drawWay = 1;
getMapListByProject(drawWay).then(response => {
this.publishMapList = response.data;
}).catch(() => {
this.$messageBox(this.$t('map.failedLoadListPublishedMaps'));

View File

@ -22,6 +22,13 @@
<el-radio :label="false">{{ $t('map.deny') }}</el-radio>
</el-radio-group>
</el-form-item>
<!-- 是否先锁闭 -->
<el-form-item :label="$t('map.lockFirst') + ':'" prop="lockFirst">
<el-radio-group v-model="addModel.lockFirst">
<el-radio :label="true">{{ $t('map.are') }}</el-radio>
<el-radio :label="false">{{ $t('map.deny') }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item :label="$t('map.delayUnlockingTime') + ':'" prop="delayReleaseTime">
<el-input-number v-model="addModel.delayReleaseTime" :min="0" />
<span>s</span>
@ -315,6 +322,7 @@ export default {
stationCode: '', //
arc: false, // /
flt: false, // /
lockFirst:false, //
delayReleaseTime: '', //
turnBack: false, //
startSignalCode: '', //

View File

@ -14,18 +14,12 @@
</div>
</el-tab-pane>
<el-tab-pane class="view-control" :label="$t('map.newConstruction')" name="second">
<div style="height: calc(100% - 46px)">
<div style="height: calc(100% - 46px);">
<el-scrollbar>
<el-form ref="oprt" :model="createModel" label-width="130px" size="mini" :rules="createRules">
<el-form ref="oprt" :model="createModel" label-width="130px" size="mini" :rules="createRules" style="position: relative;">
<el-form-item :label="$t('map.createModel')">
<el-radio-group v-model="createModel.type">
<el-radio
v-for="item in typeOptions"
:key="item.value"
:label="item.value"
border
size="mini"
>{{ item.label }}</el-radio>
<el-radio v-for="item in typeOptions" :key="item.value" :label="item.value" border size="mini">{{ item.label }}</el-radio>
</el-radio-group>
</el-form-item>
<div v-if="createModel.type == '01'" class="coordinate">
@ -46,12 +40,7 @@
</el-form-item>
<el-form-item v-if="createModel.type == '03'" :label="$t('map.leftAssociatedSection')" prop="leftSectionCode">
<el-select v-model="createModel.leftSectionCode" filterable>
<el-option
v-for="item in PhysicalSectionList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
<el-option v-for="item in PhysicalSectionList" :key="item.code" :label="item.name" :value="item.code" />
</el-select>
<el-button
:type="field == 'getSectionStart' ? 'danger' : 'primary'"
@ -62,14 +51,9 @@
<el-form-item v-if="createModel.type == '03'" label="距离长度:" prop="length">
<el-input-number v-model="createModel.length" />
</el-form-item>
<el-form-item v-if="createModel.type == '02'" :label="$t('map.leftAssociatedSection')" prop="leftSectionCode">
<el-form-item v-if="createModel.type == '02' || createModel.type == '04'" label="起始区段:" prop="leftSectionCode">
<el-select v-model="createModel.leftSectionCode" filterable>
<el-option
v-for="item in PhysicalSectionList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
<el-option v-for="item in PhysicalSectionList" :key="item.code" :label="item.name" :value="item.code" />
</el-select>
<el-button
:type="field == 'getSectionStart' ? 'danger' : 'primary'"
@ -92,6 +76,32 @@
@click="hover('getSectionEnd')"
>{{ $t('map.activate') }}</el-button>
</el-form-item>
<el-button
v-if="createModel.type == '04'"
icon="el-icon-plus"
circle
size="small"
style="position: absolute; right: 50px; top: 85px; z-index: 10;"
class="point-button"
@click="addModelList"
/>
<el-table v-if="createModel.type == '04'" :data="createModel.modelList" style="width: 80%; margin: 0 auto;">
<el-table-column label="区段名称" width="160">
<template slot-scope="scope">
<el-input v-model="scope.row.sectionName" size="mini" />
</template>
</el-table-column>
<el-table-column label="显示长度">
<template slot-scope="scope">
<el-input-number v-model="scope.row.length" size="mini" />
</template>
</el-table-column>
<el-table-column label="操作" width="80">
<template slot-scope="scope">
<el-button size="mini" type="text" @click="handleDelete(scope.$index, scope.row)">{{ $t('map.deleteObj') }}</el-button>
</template>
</el-table-column>
</el-table>
</el-form>
</el-scrollbar>
</div>
@ -311,7 +321,8 @@ export default {
startPoint: { x: 0, y: 0 },
length: 0,
leftSectionCode: '',
rightSectionCode: ''
rightSectionCode: '',
modelList: []
},
createRules: {
'startPoint.x': [
@ -324,17 +335,20 @@ export default {
{ required: true, message: '请填写距离值', trigger: 'blur' }
]
},
typeOptions: [{
value: '01',
label: this.$t('map.coordinateMode')
},
{
value: '03',
label: this.$t('map.frontSectionMode')
}, {
value: '02',
label: this.$t('map.sectionAssociationMode')
}
typeOptions: [
{
value: '01',
label: this.$t('map.coordinateMode')
}, {
value: '03',
label: this.$t('map.frontSectionMode')
}, {
value: '02',
label: this.$t('map.sectionAssociationMode')
}, {
value: '04',
label: '批量创建'
}
],
oldLeftSectionCode: '',
oldRightSectionCode: ''
@ -417,7 +431,8 @@ export default {
{ prop: 'segmentationPosition.x', firstLevel: 'segmentationPosition', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px', disabled: true },
{ prop: 'segmentationPosition.y', firstLevel: 'segmentationPosition', secondLevel: 'y', label: 'y:', type: 'number', labelWidth: '20px', disabled: true }
] },
{ prop: 'isCurve', label: this.$t('map.isCurve'), type: 'checkbox', isHidden: !this.isSwitchSectionType }
{ prop: 'isCurve', label: this.$t('map.isCurve'), type: 'checkbox', isHidden: !this.isSwitchSectionType },
{ prop: 'relevanceSectionList', label: '关联道岔区段:', type: 'multiSelect', optionLabel: 'name&&code', optionValue: 'code', options: this.switchSectionList, isHidden: this.isSwitchSectionType }
]
},
map: {
@ -516,6 +531,13 @@ export default {
}
return list;
},
switchSectionList() {
let list = [];
if (this.sectionList && this.sectionList.length) {
list = this.sectionList.filter(elem => { return elem.type === '03'; });
}
return list;
},
ReverseSectionList() {
let list = [];
if (this.sectionList && this.sectionList.length) {
@ -719,14 +741,21 @@ export default {
this.editModel.points.splice(index, 1);
this.logicSectionNums.splice(index, 1);
},
//
create() {
const uid = getUID('T', this.sectionList);
const uname = 'T' + (Number(this.sectionList.length) + 1);
const model = {
addModelList() {
const param = {
sectionName: 'T',
length: ''
};
this.createModel.modelList.push(param);
},
handleDelete(index, row) { //
this.createModel.modelList.splice(index, 1);
},
createModelParam(uid, name) {
return {
_type: 'Section',
code: uid,
name: uname,
name: name,
type: '01',
axleShow: false,
isStandTrack: false,
@ -742,8 +771,8 @@ export default {
isSegmentation: false,
segmentationPosition: { x: 0, y: 0 },
relSwitchCode: '',
rightSectionCode:'',
leftSectionCode:'',
rightSectionCode: '',
leftSectionCode: '',
kmRangeRight: '',
kmRangeLeft: '',
region: '',
@ -764,67 +793,112 @@ export default {
trainWindowCode: '',
destinationCodePoint: { x: 0, y: 0 },
isCurve: false,
relevanceSectionList: []
relevanceSectionList: [],
points: []
};
if (this.createModel.type == '01') {
model.points = [
{ x: this.createModel.startPoint.x, y: this.createModel.startPoint.y },
{ x: this.createModel.startPoint.x + this.createModel.length, y: this.createModel.startPoint.y }
];
this.$emit('updateMapModel', model);
} else if (this.createModel.type == '02') {
if (!(this.createModel.leftSectionCode && this.createModel.rightSectionCode)) {
return false;
}
const startModel = this.$store.getters['map/getDeviceByCode'](this.createModel.leftSectionCode);
const endModel = this.$store.getters['map/getDeviceByCode'](this.createModel.rightSectionCode);
const start_x = startModel.points[startModel.points.length - 1].x;
const end_x = endModel.points[0].x;
const start_y = startModel.points[startModel.points.length - 1].y;
const end_y = endModel.points[0].y;
if (this.createModel.leftSectionCode == this.createModel.rightSectionCode) {
this.$messageBox('左关联区段不能和右关联区段相同');
return;
}
if (start_x == end_x && start_y == end_y) {
this.$messageBox('左关联区段终点不能和右关联区段起点相同');
return;
}
model.points = [
{ x: start_x, y: start_y },
{ x: end_x, y: end_y }
];
},
//
create() {
if (this.createModel.type == '04') {
const models = [];
const leftSection = this.getSectionByCode(this.createModel.leftSectionCode);
const rightSection = this.getSectionByCode(this.createModel.rightSectionCode);
model.leftSectionCode = this.createModel.leftSectionCode;
leftSection.rightSectionCode = model.code;
rightSection.leftSectionCode = model.code;
model.rightSectionCode = this.createModel.rightSectionCode;
models.push(model);
models.push(leftSection);
models.push(rightSection);
this.$emit('updateMapModel', models);
} else if (this.createModel.type == '03') {
if (this.createModel.leftSectionCode) {
let flag = true;
let leftPointX = 0; let rightPointX = 0;
const startModel = this.getSectionByCode(this.createModel.leftSectionCode);
this.createModel.modelList.forEach((item, index) => {
if (item.length && item.sectionName) {
let param = {};
const uid = getUID('T', [...this.sectionList, ...models]);
rightPointX += item.length;
if (index != 0) {
leftPointX += this.createModel.modelList[index - 1].length;
}
param = this.createModelParam(uid, item.sectionName);
param.points = [
{ x: startModel.points[startModel.points.length - 1].x + leftPointX, y: startModel.points[startModel.points.length - 1].y },
{ x: startModel.points[startModel.points.length - 1].x + rightPointX, y: startModel.points[startModel.points.length - 1].y }
];
if (index == 0) {
param.leftSectionCode = this.createModel.leftSectionCode;
startModel.rightSectionCode = param.code;
} else {
param.leftSectionCode = models[index - 1].code;
models[index - 1].rightSectionCode = param.code;
}
models.push(param);
} else {
flag = false;
this.$message('表格内容必须填写,请检查后再重新创建!');
}
});
if (flag) {
models.push(startModel);
this.$emit('updateMapModel', models);
this.createModel.modelList = [];
}
} else {
const uid = getUID('T', this.sectionList);
const uname = 'T' + (Number(this.sectionList.length) + 1);
const model = this.createModelParam(uid, uname);
if (this.createModel.type == '01') {
model.points = [
{ x: this.createModel.startPoint.x, y: this.createModel.startPoint.y },
{ x: this.createModel.startPoint.x + this.createModel.length, y: this.createModel.startPoint.y }
];
this.$emit('updateMapModel', model);
} else if (this.createModel.type == '02') {
if (!(this.createModel.leftSectionCode && this.createModel.rightSectionCode)) {
return false;
}
const startModel = this.$store.getters['map/getDeviceByCode'](this.createModel.leftSectionCode);
const endModel = this.$store.getters['map/getDeviceByCode'](this.createModel.rightSectionCode);
const start_x = startModel.points[startModel.points.length - 1].x;
const end_x = endModel.points[0].x;
const start_y = startModel.points[startModel.points.length - 1].y;
const end_y = endModel.points[0].y;
if (this.createModel.leftSectionCode == this.createModel.rightSectionCode) {
this.$messageBox('左关联区段不能和右关联区段相同');
return;
}
if (start_x == end_x && start_y == end_y) {
this.$messageBox('左关联区段终点不能和右关联区段起点相同');
return;
}
model.points = [
{ x: start_x, y: start_y },
{ x: start_x + this.createModel.length, y: start_y }
{ x: end_x, y: end_y }
];
const models = [];
model.leftSectionCode = this.createModel.leftSectionCode;
const leftSection = this.getSectionByCode(this.createModel.leftSectionCode);
const rightSection = this.getSectionByCode(this.createModel.rightSectionCode);
model.leftSectionCode = this.createModel.leftSectionCode;
leftSection.rightSectionCode = model.code;
rightSection.leftSectionCode = model.code;
model.rightSectionCode = this.createModel.rightSectionCode;
models.push(model);
models.push(leftSection);
models.push(rightSection);
this.$emit('updateMapModel', models);
} else if (this.createModel.type == '03') {
if (this.createModel.leftSectionCode) {
const startModel = this.$store.getters['map/getDeviceByCode'](this.createModel.leftSectionCode);
const start_x = startModel.points[startModel.points.length - 1].x;
const start_y = startModel.points[startModel.points.length - 1].y;
model.points = [
{ x: start_x, y: start_y },
{ x: start_x + this.createModel.length, y: start_y }
];
const models = [];
model.leftSectionCode = this.createModel.leftSectionCode;
const leftSection = this.getSectionByCode(this.createModel.leftSectionCode);
leftSection.rightSectionCode = model.code;
models.push(model);
models.push(leftSection);
this.$emit('updateMapModel', models);
}
}
}
},
//
edit() {
@ -1161,9 +1235,6 @@ export default {
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.el-radio{
margin-right:0px;
}
.coordinate {
overflow: hidden;
@ -1215,5 +1286,14 @@ export default {
padding: 18px 0;
}
}
/deep/ {
.el-radio.is-bordered+.el-radio.is-bordered{
margin-left: 0;
}
.el-radio.is-bordered {
margin-right: 10px;
margin-bottom: 5px;
}
}
</style>

View File

@ -479,53 +479,55 @@ export default {
const models = [];
const switchList = [...this.switchList, ...list];
if (list && list.length && sectionLists && sectionLists.length) {
const sectionList = [];
const addSectionList = [];
const sectionList = []; const addSectionList = []; const switchSectionList = [];
list.forEach(elem => {
const sectionb = this.findSectionData(sectionLists, elem.sectionBCode);
const sectiona = this.findSectionData(sectionLists, elem.sectionACode);
const sectionc = this.findSectionData(sectionLists, elem.sectionCCode);
const parentSectionModel = this.$store.getters['map/getDeviceByCode'](sectiona.parentCode);
if (!parentSectionModel) { //
let uid;
if (!elem['uid']) {
uid = getUID('T', [...this.sectionList, ...addSectionList]);
elem['uid'] = uid;
if (switchSectionList.indexOf(elem.code) == -1) {
let uid;
if (!elem['uid']) {
uid = getUID('T', [...this.sectionList, ...addSectionList]);
elem['uid'] = uid;
}
addSectionList.push({ code: elem.uid });
sectiona.parentCode = elem['uid'];
sectionb.parentCode = elem['uid'];
sectionc.parentCode = elem['uid'];
elem['relevanceSectionList'] = [elem.sectionACode, elem.sectionBCode, elem.sectionCCode];
sectionList.push(elem);
switchList.forEach(ele => {
const sectiona1 = this.findSectionData(sectionLists, ele.sectionACode);
const sectionc1 = this.findSectionData(sectionLists, ele.sectionCCode);
const sectionb1 = this.findSectionData(sectionLists, ele.sectionBCode);
if (sectionb1.points[sectionb1.points.length - 1].x == sectionb.points[0].x && sectionb1.points[sectionb1.points.length - 1].y == sectionb.points[0].y) {
ele['uid'] = uid;
elem['relevanceSectionList'] = [elem.sectionACode, elem.sectionBCode, elem.sectionCCode, ele.sectionACode, ele.sectionBCode, ele.sectionCCode];
sectiona1.parentCode = uid;
sectionb1.parentCode = uid;
sectionc1.parentCode = uid;
switchSectionList.push(ele.code);
sectionList.forEach((item, index) => {
if (item.code == ele.code) {
sectionList.splice(index, 1);
}
});
}
// if (sectiona1.points[sectiona1.points.length - 1].x == sectiona.points[0].x && sectiona1.points[sectiona1.points.length - 1].y == sectiona.points[0].y) {
// elem['relevanceSectionList'] = [elem.sectionACode, elem.sectionBCode, elem.sectionCCode, ele.sectionACode, ele.sectionBCode, ele.sectionCCode];
// sectiona1.parentCode = uid;
// sectionb1.parentCode = uid;
// sectionc1.parentCode = uid;
// sectionList.forEach((item, index) => {
// if (item.code == elem.code) {
// sectionList.splice(index, 1);
// }
// });
// }
});
}
addSectionList.push({ code: elem.uid });
sectiona.parentCode = elem['uid'];
sectionb.parentCode = elem['uid'];
sectionc.parentCode = elem['uid'];
elem['relevanceSectionList'] = elem['relevanceSectionList'] || [elem.sectionACode, elem.sectionBCode, elem.sectionCCode];
sectionList.push(elem);
switchList.forEach(ele => {
const sectiona1 = this.findSectionData(sectionLists, ele.sectionACode);
const sectionc1 = this.findSectionData(sectionLists, ele.sectionCCode);
const sectionb1 = this.findSectionData(sectionLists, ele.sectionBCode);
if (sectionb1.points[sectionb1.points.length - 1].x == sectionb.points[0].x && sectionb1.points[sectionb1.points.length - 1].y == sectionb.points[0].y) {
ele['uid'] = uid;
elem['relevanceSectionList'] = [elem.sectionACode, elem.sectionBCode, elem.sectionCCode, ele.sectionACode, ele.sectionBCode, ele.sectionCCode];
sectiona1.parentCode = uid;
sectionb1.parentCode = uid;
sectionc1.parentCode = uid;
sectionList.forEach((item, index) => {
if (item.code == elem.code) {
sectionList.splice(index, 1);
}
});
}
if (sectiona1.points[sectiona1.points.length - 1].x == sectiona.points[0].x && sectiona1.points[sectiona1.points.length - 1].y == sectiona.points[0].y) {
elem['relevanceSectionList'] = [elem.sectionACode, elem.sectionBCode, elem.sectionCCode, ele.sectionACode, ele.sectionBCode, ele.sectionCCode];
sectiona1.parentCode = uid;
sectionb1.parentCode = uid;
sectionc1.parentCode = uid;
sectionList.forEach((item, index) => {
if (item.code == elem.code) {
sectionList.splice(index, 1);
}
});
}
});
} else {
parentSectionModel.relevanceSectionList.push(elem.sectionACode);
parentSectionModel.relevanceSectionList.push(elem.sectionBCode);

View File

@ -122,19 +122,38 @@ export default {
name: this.$t('global.append'),
handleClick: this.handlePut,
type: '',
showControl: (row) => { return !row.isPut; }
showControl: (row) => {
const orderList = this.$store.state.order.orderList;
if (orderList.length > 0) {
const order = orderList.find(item=>{ return item.goodsId == row.id; });
if (order) {
return false;
} else {
return true;
}
} else {
return !row.isPut;
}
}
},
{
name: this.$t('global.delete'),
handleClick: this.handlePop,
type: 'warning',
showControl: (row) => { return row.isPut; }
showControl: (row) => {
const orderList = this.$store.state.order.orderList;
if (orderList.length > 0) {
const order = orderList.find(item=>{ return item.goodsId == row.id; });
if (order) {
return true;
} else {
return false;
}
} else {
return row.isPut;
}
}
}
// {
// name: this.$t('orderAuthor.select'),
// type: 'primary',
// handleClick: this.handleAdd
// }
]
}
],

View File

@ -1,89 +1,61 @@
<template>
<el-dialog v-dialogDrag :title="this.$t('orderAuthor.orderDetails')" :visible.sync="show" width="500px" :before-do-close="doClose" :close-on-click-modal="false">
<el-scrollbar wrap-class="scrollbar-wrapper" style="height: 400px">
<data-form ref="dataform" :form="form" :form-model="formModel" class="data-box" />
</el-scrollbar>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="doClose">{{ $t('global.close') }}</el-button>
</div>
<el-dialog v-dialogDrag :title="this.$t('orderAuthor.orderDetails')" :visible.sync="show" width="1000px" :before-do-close="doClose" :close-on-click-modal="false">
<el-table
ref="table2"
highlight-current-row
stripe
border
:data="orderList"
size="medium"
>
<el-table-column :key="goodsName" :label="this.$t('orderAuthor.commodityName')" prop="goodsName" />
<el-table-column :key="forever" :label="this.$t('orderAuthor.permanenceOrNot')" prop="forever">
<template slot-scope="scope">
{{ $ConstSelect.translate(scope.row.forever, 'Whether') }}
</template>
</el-table-column>
<el-table-column :key="goodsName" :label="this.$t('orderAuthor.goodsAmount')" prop="goodsAmount" />
<el-table-column :key="goodsName" :label="this.$t('orderAuthor.itemPricing')" prop="price" />
<el-table-column :key="goodsName" :label="this.$t('orderAuthor.startDate')" prop="startTime" />
<el-table-column :key="goodsName" :label="this.$t('orderAuthor.purchaseMonths')" prop="monthAmount">
<template slot-scope="scope">
{{ scope.row.forever?'/':scope.row.monthAmount }}
</template>
</el-table-column>
</el-table>
</el-dialog>
</template>
<script>
import { getGoodsListByOrderId } from '@/api/management/goods';
export default {
name: 'RouteDetail',
data() {
return {
show: false,
formModel: {
organizationName: '',
userName: '',
goodsName: '',
amount: '',
forever: '',
startTime: '',
monthAmount: '',
totalPrice: '',
payWays: '',
createTime: '',
orderType: '',
contractNo: '',
bizType: '',
payStatusZh: '',
sellerName: ''
}
orderId:'',
orderList:[]
};
},
computed: {
form() {
const form = {
labelWidth: '120px',
items: [
{ prop: 'organizationName', label: `${this.$t('orderAuthor.organizationOrEnterprise')}:`, type: 'text', disabled: true },
{ prop: 'userName', label: `${this.$t('orderAuthor.userName')}:`, type: 'text', disabled: true },
{ prop: 'goodsName', label: `${this.$t('orderAuthor.commodityName')}:`, type: 'text', disabled: true },
{ prop: 'amount', label: `${this.$t('orderAuthor.permissionNumber')}:`, type: 'text', disabled: true },
{ prop: 'forever', label: `${this.$t('orderAuthor.permanenceOrNot')}:`, type: 'radio', disabled: true, required: false, options: this.$ConstSelect.Whether },
{ prop: 'startTime', label: `${this.$t('orderAuthor.startDate')}:`, type: 'text', disabled: true },
{ prop: 'monthAmount', label: `${this.$t('orderAuthor.purchaseMonths')}:`, type: 'text', disabled: true },
{ prop: 'totalPrice', label: `${this.$t('orderAuthor.totalPrice')}:`, type: 'text', disabled: true },
{ prop: 'payWays', label: `${this.$t('orderAuthor.paymentMethod')}:`, type: 'text', disabled: true },
{ prop: 'createTime', label: `${this.$t('orderAuthor.creationDate')}:`, type: 'text', disabled: true },
{ prop: 'orderType', label: `${this.$t('orderAuthor.orderType')}:`, type: 'text', disabled: true },
{ prop: 'contractNo', label: `${this.$t('orderAuthor.contractNumber')}:`, type: 'text', disabled: true },
{ prop: 'bizType', label: `${this.$t('orderAuthor.businessType')}:`, type: 'text', disabled: true },
{ prop: 'payStatusZh', label: `${this.$t('orderAuthor.paymentStatus')}:`, type: 'text', disabled: true },
{ prop: 'sellerName', label: `${this.$t('orderAuthor.salesman')}:`, type: 'text', disabled: true }
]
};
return form;
}
},
methods: {
doShow(data) {
this.orderId = data.id;
this.reloadTable();
this.show = true;
this.formModel = {
organizationName: data.organizationName,
userName: data.userName,
goodsName: data.goodsName,
amount: data.amount,
forever: data.forever,
startTime: data.startTime,
monthAmount: data.monthAmount,
totalPrice: data.totalPrice,
payWays: data.payWays,
createTime: data.createTime,
orderType: data.orderType,
contractNo: data.contractNo,
bizType: data.bizType,
payStatusZh: data.payStatusZh,
sellerName: data.sellerName
};
},
doClose() {
this.show = false;
},
reloadTable() {
if (this.orderId) {
this.initData();
}
},
initData() {
getGoodsListByOrderId(this.orderId).then(res=>{
this.orderList = res.data;
});
}
}
};

View File

@ -57,14 +57,10 @@ export default {
errorIntTip:'数量必须为整数',
formModel: {
organizationId: '',
goodsId: '',
goodsName: '',
orderType: '02',
contractNo: '',
forever: false,
totalPrice: 0,
price: 0,
amount: 0,
monthAmount: 0,
bizType: '01',
payWays: '01',
@ -161,9 +157,10 @@ export default {
buttontip: this.$t('orderAuthor.selectGoods'),
buttonClick: this.buttonClick,
type:'table',
style:'width:80%',
tableList:[
{prop:'goodsName', label:'商品名称' },
{prop:'goodsAmount', label:'商品数量', isEdit:true, min:0,
{prop:'goodsName', label:this.$t('orderAuthor.commodityName') },
{prop:'goodsAmount', label:this.$t('orderAuthor.goodsAmount'), isEdit:true, min:0,
rules:{
goodsAmount:[
{
@ -177,11 +174,11 @@ export default {
]
}
},
{prop:'goodsPrice', label:'商品单价'}
{prop:'goodsPrice', label:this.$t('orderAuthor.itemPricing')}
],
operate:'操作',
operate:this.$t('orderAuthor.operate'),
operateButton:[
{name:'删除', clickFunc:this.removeGoods}
{name:this.$t('global.delete'), clickFunc:this.removeGoods}
]
},
// { prop: 'price', label: this.$t('orderAuthor.itemPricing'), type: 'number', required: false, disabled: true, min: 0, message: this.$t('orderAuthor.yuan') },
@ -295,6 +292,9 @@ export default {
mounted() {
this.initLoadPage();
},
beforeDestroy() {
this.$store.dispatch('order/setOrderList', []);
},
methods: {
buttonClick() {
this.$refs.addGoods.doShow();
@ -318,12 +318,15 @@ export default {
'goodsPrice':row.price
};
this.formModel.detailCreateVOList.push(data);
this.$store.dispatch('order/setOrderList', this.formModel.detailCreateVOList);
},
removeGoods(data) {
this.formModel.detailCreateVOList = this.formModel.detailCreateVOList.filter(({ goodsId }) => goodsId !== data.goodsId);
this.$store.dispatch('order/setOrderList', this.formModel.detailCreateVOList);
},
deleteGoods(index, row) {
this.formModel.detailCreateVOList = this.formModel.detailCreateVOList.filter(({ goodsId }) => goodsId !== row.id);
this.$store.dispatch('order/setOrderList', this.formModel.detailCreateVOList);
},
initLoadPage() {
//
@ -519,6 +522,7 @@ export default {
this.loading = true;
createOrder(this.buildModel()).then(response => {
this.turnback();
this.$store.dispatch('order/setOrderList', []);
this.loading = false;
this.$message.success(this.$t('tip.creatingSuccessful'));
}).catch(() => {
@ -542,6 +546,7 @@ export default {
});
},
turnback() {
this.$store.dispatch('order/setOrderList', []);
this.$router.go(-1);
}
}

View File

@ -74,10 +74,6 @@ export default {
title: this.$t('orderAuthor.userMobile'),
prop: 'userMobile'
},
{
title: this.$t('orderAuthor.commodityName'),
prop: 'goodsName'
},
// {
// title: this.$t('orderAuthor.permissionType'),
// prop: 'permissionType',
@ -85,10 +81,10 @@ export default {
// columnValue: (row) => { return this.$convertField(row.permissionType, this.PermissionTypeList, ['value', 'label']); },
// tagType: (row) => { return ''; }
// },
{
title: this.$t('orderAuthor.permissionNumber'),
prop: 'amount'
},
// {
// title: this.$t('orderAuthor.permissionNumber'),
// prop: 'amount'
// },
{
title: this.$t('orderAuthor.permanenceOrNot'),
prop: 'forever',
@ -106,7 +102,12 @@ export default {
},
{
title: this.$t('orderAuthor.purchaseMonths'),
prop: 'monthAmount'
prop: 'monthAmount',
type: 'tag',
columnValue: (row) => {
return row.forever ? '/' : row.monthAmount;
},
tagType: (row) => { return ''; }
},
// {
// title: this.$t('orderAuthor.totalPrice'),
@ -246,10 +247,6 @@ export default {
this.$router.push({ path: `${UrlConfig.orderauthor.orderDraft}/add/0` });
},
handleDetail(index, data) {
data.payWays = this.$convertField(data.payWays, this.PayTypeList, ['value', 'label']);
data.orderType = this.$convertField(data.orderType, this.OrderTypeList, ['value', 'label']);
data.bizType = this.$convertField(data.bizType, this.BizTypeList, ['value', 'label']);
data.payStatusZh = this.$convertField(data.payStatus, this.PayStatusList, ['value', 'label']);
this.$refs.detail.doShow(data);
},
handleCanDistribute(index, data) {