合并代码

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 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"> <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 v-if="item.buttontip" size="mini" style="margin-bottom:10px" @click="item.buttonClick">{{ item.buttontip }}
</el-button> </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"> <el-table-column v-for="data in item.tableList" :key="data.prop" :prop="data.prop" :label="data.label">
<template slot-scope="scope"> <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]"> <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:', startingPoint: 'Starting point:',
endingPoint: 'Ending point:', endingPoint: 'Ending point:',
frontSectionMode:'Extend Mode', frontSectionMode:'Extend Mode',
lockFirst:'Lock First',
continueProtect: 'Continue protect', continueProtect: 'Continue protect',
continueProtectList: 'Continue protect list' continueProtectList: 'Continue protect list'
}; };

View File

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

View File

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

View File

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

View File

@ -9,11 +9,12 @@ export function getUID(type, list) {
let name = ''; let name = '';
if (type == 'T') { if (type == 'T') {
name = list.length ? Number(list[list.length - 1].code.replace('T', '')) + 1 : list.length + 1; 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 { } else {
name = Math.floor((Math.random() * 100000) + 1); 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() { function checkUid() {
let count = 0; let count = 0;
for (let index = 0; index < list.length; index++) { 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 socket from './modules/socket';
import scriptRecord from './modules/scriptRecord'; import scriptRecord from './modules/scriptRecord';
import ibp from './modules/ibp'; import ibp from './modules/ibp';
import order from './modules/order';
import getters from './getters'; import getters from './getters';
@ -34,7 +35,8 @@ const store = new Vuex.Store({
runPlan, runPlan,
socket, socket,
scriptRecord, scriptRecord,
ibp ibp,
order
}, },
getters 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 { listPublishMap, getMapListByProjectCode } from '@/api/jmap/map';
import { ProjectCode } from '@/scripts/ConstDic'; import { ProjectCode } from '@/scripts/ConstDic';
export async function getMapListByProject() { export async function getMapListByProject(drawWay) {
const project = getSessionStorage('project'); const project = getSessionStorage('project');
let mapList = []; let mapList = [];
if (project.endsWith('xty')) { if (project.endsWith('xty')) {
mapList = await getMapListByProjectCode(ProjectCode[project]); mapList = await getMapListByProjectCode(ProjectCode[project]);
} else { } else {
mapList = await listPublishMap(); mapList = await listPublishMap({'drawWay':drawWay});
} }
return mapList; return mapList;
} }

View File

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

View File

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

View File

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

View File

@ -14,18 +14,12 @@
</div> </div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane class="view-control" :label="$t('map.newConstruction')" name="second"> <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-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-form-item :label="$t('map.createModel')">
<el-radio-group v-model="createModel.type"> <el-radio-group v-model="createModel.type">
<el-radio <el-radio v-for="item in typeOptions" :key="item.value" :label="item.value" border size="mini">{{ item.label }}</el-radio>
v-for="item in typeOptions"
:key="item.value"
:label="item.value"
border
size="mini"
>{{ item.label }}</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<div v-if="createModel.type == '01'" class="coordinate"> <div v-if="createModel.type == '01'" class="coordinate">
@ -46,12 +40,7 @@
</el-form-item> </el-form-item>
<el-form-item v-if="createModel.type == '03'" :label="$t('map.leftAssociatedSection')" prop="leftSectionCode"> <el-form-item v-if="createModel.type == '03'" :label="$t('map.leftAssociatedSection')" prop="leftSectionCode">
<el-select v-model="createModel.leftSectionCode" filterable> <el-select v-model="createModel.leftSectionCode" filterable>
<el-option <el-option v-for="item in PhysicalSectionList" :key="item.code" :label="item.name" :value="item.code" />
v-for="item in PhysicalSectionList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select> </el-select>
<el-button <el-button
:type="field == 'getSectionStart' ? 'danger' : 'primary'" :type="field == 'getSectionStart' ? 'danger' : 'primary'"
@ -62,14 +51,9 @@
<el-form-item v-if="createModel.type == '03'" label="距离长度:" prop="length"> <el-form-item v-if="createModel.type == '03'" label="距离长度:" prop="length">
<el-input-number v-model="createModel.length" /> <el-input-number v-model="createModel.length" />
</el-form-item> </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-select v-model="createModel.leftSectionCode" filterable>
<el-option <el-option v-for="item in PhysicalSectionList" :key="item.code" :label="item.name" :value="item.code" />
v-for="item in PhysicalSectionList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select> </el-select>
<el-button <el-button
:type="field == 'getSectionStart' ? 'danger' : 'primary'" :type="field == 'getSectionStart' ? 'danger' : 'primary'"
@ -92,6 +76,32 @@
@click="hover('getSectionEnd')" @click="hover('getSectionEnd')"
>{{ $t('map.activate') }}</el-button> >{{ $t('map.activate') }}</el-button>
</el-form-item> </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-form>
</el-scrollbar> </el-scrollbar>
</div> </div>
@ -311,7 +321,8 @@ export default {
startPoint: { x: 0, y: 0 }, startPoint: { x: 0, y: 0 },
length: 0, length: 0,
leftSectionCode: '', leftSectionCode: '',
rightSectionCode: '' rightSectionCode: '',
modelList: []
}, },
createRules: { createRules: {
'startPoint.x': [ 'startPoint.x': [
@ -324,16 +335,19 @@ export default {
{ required: true, message: '请填写距离值', trigger: 'blur' } { required: true, message: '请填写距离值', trigger: 'blur' }
] ]
}, },
typeOptions: [{ typeOptions: [
{
value: '01', value: '01',
label: this.$t('map.coordinateMode') label: this.$t('map.coordinateMode')
}, }, {
{
value: '03', value: '03',
label: this.$t('map.frontSectionMode') label: this.$t('map.frontSectionMode')
}, { }, {
value: '02', value: '02',
label: this.$t('map.sectionAssociationMode') label: this.$t('map.sectionAssociationMode')
}, {
value: '04',
label: '批量创建'
} }
], ],
oldLeftSectionCode: '', oldLeftSectionCode: '',
@ -417,7 +431,8 @@ export default {
{ prop: 'segmentationPosition.x', firstLevel: 'segmentationPosition', secondLevel: 'x', label: 'x:', type: 'number', labelWidth: '20px', disabled: true }, { 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: '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: { map: {
@ -516,6 +531,13 @@ export default {
} }
return list; return list;
}, },
switchSectionList() {
let list = [];
if (this.sectionList && this.sectionList.length) {
list = this.sectionList.filter(elem => { return elem.type === '03'; });
}
return list;
},
ReverseSectionList() { ReverseSectionList() {
let list = []; let list = [];
if (this.sectionList && this.sectionList.length) { if (this.sectionList && this.sectionList.length) {
@ -719,14 +741,21 @@ export default {
this.editModel.points.splice(index, 1); this.editModel.points.splice(index, 1);
this.logicSectionNums.splice(index, 1); this.logicSectionNums.splice(index, 1);
}, },
// addModelList() {
create() { const param = {
const uid = getUID('T', this.sectionList); sectionName: 'T',
const uname = 'T' + (Number(this.sectionList.length) + 1); length: ''
const model = { };
this.createModel.modelList.push(param);
},
handleDelete(index, row) { //
this.createModel.modelList.splice(index, 1);
},
createModelParam(uid, name) {
return {
_type: 'Section', _type: 'Section',
code: uid, code: uid,
name: uname, name: name,
type: '01', type: '01',
axleShow: false, axleShow: false,
isStandTrack: false, isStandTrack: false,
@ -742,8 +771,8 @@ export default {
isSegmentation: false, isSegmentation: false,
segmentationPosition: { x: 0, y: 0 }, segmentationPosition: { x: 0, y: 0 },
relSwitchCode: '', relSwitchCode: '',
rightSectionCode:'', rightSectionCode: '',
leftSectionCode:'', leftSectionCode: '',
kmRangeRight: '', kmRangeRight: '',
kmRangeLeft: '', kmRangeLeft: '',
region: '', region: '',
@ -764,8 +793,53 @@ export default {
trainWindowCode: '', trainWindowCode: '',
destinationCodePoint: { x: 0, y: 0 }, destinationCodePoint: { x: 0, y: 0 },
isCurve: false, isCurve: false,
relevanceSectionList: [] relevanceSectionList: [],
points: []
}; };
},
//
create() {
if (this.createModel.type == '04') {
const models = [];
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') { if (this.createModel.type == '01') {
model.points = [ model.points = [
{ x: this.createModel.startPoint.x, y: this.createModel.startPoint.y }, { x: this.createModel.startPoint.x, y: this.createModel.startPoint.y },
@ -824,7 +898,7 @@ export default {
this.$emit('updateMapModel', models); this.$emit('updateMapModel', models);
} }
} }
}
}, },
// //
edit() { edit() {
@ -1161,9 +1235,6 @@ export default {
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss"; @import "src/styles/mixin.scss";
.el-radio{
margin-right:0px;
}
.coordinate { .coordinate {
overflow: hidden; overflow: hidden;
@ -1215,5 +1286,14 @@ export default {
padding: 18px 0; 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> </style>

View File

@ -479,14 +479,14 @@ export default {
const models = []; const models = [];
const switchList = [...this.switchList, ...list]; const switchList = [...this.switchList, ...list];
if (list && list.length && sectionLists && sectionLists.length) { if (list && list.length && sectionLists && sectionLists.length) {
const sectionList = []; const sectionList = []; const addSectionList = []; const switchSectionList = [];
const addSectionList = [];
list.forEach(elem => { list.forEach(elem => {
const sectionb = this.findSectionData(sectionLists, elem.sectionBCode); const sectionb = this.findSectionData(sectionLists, elem.sectionBCode);
const sectiona = this.findSectionData(sectionLists, elem.sectionACode); const sectiona = this.findSectionData(sectionLists, elem.sectionACode);
const sectionc = this.findSectionData(sectionLists, elem.sectionCCode); const sectionc = this.findSectionData(sectionLists, elem.sectionCCode);
const parentSectionModel = this.$store.getters['map/getDeviceByCode'](sectiona.parentCode); const parentSectionModel = this.$store.getters['map/getDeviceByCode'](sectiona.parentCode);
if (!parentSectionModel) { // if (!parentSectionModel) { //
if (switchSectionList.indexOf(elem.code) == -1) {
let uid; let uid;
if (!elem['uid']) { if (!elem['uid']) {
uid = getUID('T', [...this.sectionList, ...addSectionList]); uid = getUID('T', [...this.sectionList, ...addSectionList]);
@ -496,7 +496,7 @@ export default {
sectiona.parentCode = elem['uid']; sectiona.parentCode = elem['uid'];
sectionb.parentCode = elem['uid']; sectionb.parentCode = elem['uid'];
sectionc.parentCode = elem['uid']; sectionc.parentCode = elem['uid'];
elem['relevanceSectionList'] = elem['relevanceSectionList'] || [elem.sectionACode, elem.sectionBCode, elem.sectionCCode]; elem['relevanceSectionList'] = [elem.sectionACode, elem.sectionBCode, elem.sectionCCode];
sectionList.push(elem); sectionList.push(elem);
switchList.forEach(ele => { switchList.forEach(ele => {
const sectiona1 = this.findSectionData(sectionLists, ele.sectionACode); const sectiona1 = this.findSectionData(sectionLists, ele.sectionACode);
@ -508,24 +508,26 @@ export default {
sectiona1.parentCode = uid; sectiona1.parentCode = uid;
sectionb1.parentCode = uid; sectionb1.parentCode = uid;
sectionc1.parentCode = uid; sectionc1.parentCode = uid;
switchSectionList.push(ele.code);
sectionList.forEach((item, index) => { sectionList.forEach((item, index) => {
if (item.code == elem.code) { if (item.code == ele.code) {
sectionList.splice(index, 1); 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) { // 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]; // elem['relevanceSectionList'] = [elem.sectionACode, elem.sectionBCode, elem.sectionCCode, ele.sectionACode, ele.sectionBCode, ele.sectionCCode];
sectiona1.parentCode = uid; // sectiona1.parentCode = uid;
sectionb1.parentCode = uid; // sectionb1.parentCode = uid;
sectionc1.parentCode = uid; // sectionc1.parentCode = uid;
sectionList.forEach((item, index) => { // sectionList.forEach((item, index) => {
if (item.code == elem.code) { // if (item.code == elem.code) {
sectionList.splice(index, 1); // sectionList.splice(index, 1);
} // }
// });
// }
}); });
} }
});
} else { } else {
parentSectionModel.relevanceSectionList.push(elem.sectionACode); parentSectionModel.relevanceSectionList.push(elem.sectionACode);
parentSectionModel.relevanceSectionList.push(elem.sectionBCode); parentSectionModel.relevanceSectionList.push(elem.sectionBCode);

View File

@ -122,19 +122,38 @@ export default {
name: this.$t('global.append'), name: this.$t('global.append'),
handleClick: this.handlePut, handleClick: this.handlePut,
type: '', 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'), name: this.$t('global.delete'),
handleClick: this.handlePop, handleClick: this.handlePop,
type: 'warning', 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> <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-dialog v-dialogDrag :title="this.$t('orderAuthor.orderDetails')" :visible.sync="show" width="1000px" :before-do-close="doClose" :close-on-click-modal="false">
<el-scrollbar wrap-class="scrollbar-wrapper" style="height: 400px"> <el-table
<data-form ref="dataform" :form="form" :form-model="formModel" class="data-box" /> ref="table2"
</el-scrollbar> highlight-current-row
<div slot="footer" class="dialog-footer"> stripe
<el-button type="primary" @click="doClose">{{ $t('global.close') }}</el-button> border
</div> :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> </el-dialog>
</template> </template>
<script> <script>
import { getGoodsListByOrderId } from '@/api/management/goods';
export default { export default {
name: 'RouteDetail', name: 'RouteDetail',
data() { data() {
return { return {
show: false, show: false,
formModel: { orderId:'',
organizationName: '', orderList:[]
userName: '',
goodsName: '',
amount: '',
forever: '',
startTime: '',
monthAmount: '',
totalPrice: '',
payWays: '',
createTime: '',
orderType: '',
contractNo: '',
bizType: '',
payStatusZh: '',
sellerName: ''
}
}; };
}, },
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: { methods: {
doShow(data) { doShow(data) {
this.orderId = data.id;
this.reloadTable();
this.show = true; 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() { doClose() {
this.show = false; 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:'数量必须为整数', errorIntTip:'数量必须为整数',
formModel: { formModel: {
organizationId: '', organizationId: '',
goodsId: '',
goodsName: '',
orderType: '02', orderType: '02',
contractNo: '', contractNo: '',
forever: false, forever: false,
totalPrice: 0, totalPrice: 0,
price: 0,
amount: 0,
monthAmount: 0, monthAmount: 0,
bizType: '01', bizType: '01',
payWays: '01', payWays: '01',
@ -161,9 +157,10 @@ export default {
buttontip: this.$t('orderAuthor.selectGoods'), buttontip: this.$t('orderAuthor.selectGoods'),
buttonClick: this.buttonClick, buttonClick: this.buttonClick,
type:'table', type:'table',
style:'width:80%',
tableList:[ tableList:[
{prop:'goodsName', label:'商品名称' }, {prop:'goodsName', label:this.$t('orderAuthor.commodityName') },
{prop:'goodsAmount', label:'商品数量', isEdit:true, min:0, {prop:'goodsAmount', label:this.$t('orderAuthor.goodsAmount'), isEdit:true, min:0,
rules:{ rules:{
goodsAmount:[ goodsAmount:[
{ {
@ -177,11 +174,11 @@ export default {
] ]
} }
}, },
{prop:'goodsPrice', label:'商品单价'} {prop:'goodsPrice', label:this.$t('orderAuthor.itemPricing')}
], ],
operate:'操作', operate:this.$t('orderAuthor.operate'),
operateButton:[ 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') }, // { 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() { mounted() {
this.initLoadPage(); this.initLoadPage();
}, },
beforeDestroy() {
this.$store.dispatch('order/setOrderList', []);
},
methods: { methods: {
buttonClick() { buttonClick() {
this.$refs.addGoods.doShow(); this.$refs.addGoods.doShow();
@ -318,12 +318,15 @@ export default {
'goodsPrice':row.price 'goodsPrice':row.price
}; };
this.formModel.detailCreateVOList.push(data); this.formModel.detailCreateVOList.push(data);
this.$store.dispatch('order/setOrderList', this.formModel.detailCreateVOList);
}, },
removeGoods(data) { removeGoods(data) {
this.formModel.detailCreateVOList = this.formModel.detailCreateVOList.filter(({ goodsId }) => goodsId !== data.goodsId); this.formModel.detailCreateVOList = this.formModel.detailCreateVOList.filter(({ goodsId }) => goodsId !== data.goodsId);
this.$store.dispatch('order/setOrderList', this.formModel.detailCreateVOList);
}, },
deleteGoods(index, row) { deleteGoods(index, row) {
this.formModel.detailCreateVOList = this.formModel.detailCreateVOList.filter(({ goodsId }) => goodsId !== row.id); this.formModel.detailCreateVOList = this.formModel.detailCreateVOList.filter(({ goodsId }) => goodsId !== row.id);
this.$store.dispatch('order/setOrderList', this.formModel.detailCreateVOList);
}, },
initLoadPage() { initLoadPage() {
// //
@ -519,6 +522,7 @@ export default {
this.loading = true; this.loading = true;
createOrder(this.buildModel()).then(response => { createOrder(this.buildModel()).then(response => {
this.turnback(); this.turnback();
this.$store.dispatch('order/setOrderList', []);
this.loading = false; this.loading = false;
this.$message.success(this.$t('tip.creatingSuccessful')); this.$message.success(this.$t('tip.creatingSuccessful'));
}).catch(() => { }).catch(() => {
@ -542,6 +546,7 @@ export default {
}); });
}, },
turnback() { turnback() {
this.$store.dispatch('order/setOrderList', []);
this.$router.go(-1); this.$router.go(-1);
} }
} }

View File

@ -74,10 +74,6 @@ export default {
title: this.$t('orderAuthor.userMobile'), title: this.$t('orderAuthor.userMobile'),
prop: 'userMobile' prop: 'userMobile'
}, },
{
title: this.$t('orderAuthor.commodityName'),
prop: 'goodsName'
},
// { // {
// title: this.$t('orderAuthor.permissionType'), // title: this.$t('orderAuthor.permissionType'),
// prop: 'permissionType', // prop: 'permissionType',
@ -85,10 +81,10 @@ export default {
// columnValue: (row) => { return this.$convertField(row.permissionType, this.PermissionTypeList, ['value', 'label']); }, // columnValue: (row) => { return this.$convertField(row.permissionType, this.PermissionTypeList, ['value', 'label']); },
// tagType: (row) => { return ''; } // tagType: (row) => { return ''; }
// }, // },
{ // {
title: this.$t('orderAuthor.permissionNumber'), // title: this.$t('orderAuthor.permissionNumber'),
prop: 'amount' // prop: 'amount'
}, // },
{ {
title: this.$t('orderAuthor.permanenceOrNot'), title: this.$t('orderAuthor.permanenceOrNot'),
prop: 'forever', prop: 'forever',
@ -106,7 +102,12 @@ export default {
}, },
{ {
title: this.$t('orderAuthor.purchaseMonths'), 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'), // title: this.$t('orderAuthor.totalPrice'),
@ -246,10 +247,6 @@ export default {
this.$router.push({ path: `${UrlConfig.orderauthor.orderDraft}/add/0` }); this.$router.push({ path: `${UrlConfig.orderauthor.orderDraft}/add/0` });
}, },
handleDetail(index, data) { 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); this.$refs.detail.doShow(data);
}, },
handleCanDistribute(index, data) { handleCanDistribute(index, data) {