desc: 调整权限国际化,调整琏计划导入运行图逻辑

This commit is contained in:
zyy 2019-09-19 17:22:48 +08:00
parent 4f716b502c
commit 48ea44a980
19 changed files with 273 additions and 158 deletions

View File

@ -100,11 +100,17 @@ export default {
permission: 'Permission',
orderSelectionItem: 'Order selection item',
orderDetails: 'Order details',
universalPackage: '万能权限',
createPackage: '创建权限',
package: '权限包',
basePackage: '基础权限',
statusType: 'Status type',
private: 'Private',
public: 'Public',
pleaseEnterContent: 'Please enter content',
selectGoods: 'Select Goods',
month: ' month',
yuan: ' yuan'
yuan: ' yuan',
back: '返回',
next: '下一步'
};

View File

@ -275,5 +275,6 @@ export default {
inputMaxDuration: 'Please input max duration',
accessNumber: 'Please input the number of permissions',
courseNameEmpty: 'Course name cannot be empty',
purchaseMonth: 'Please input the number of months to buy'
purchaseMonth: 'Please input the number of months to buy',
pleaseEnterGoodPrice: '请输入商品价格'
};

View File

@ -170,5 +170,8 @@ export default {
selectAPieceOfData: 'Please select a piece of data',
selectSpeedLimitValueTip: 'Please select the speed limit value, click the "release" button, and issue the command!',
addTrainIdTip: 'Add train identification number: successful',
editTrainIdTip: 'Modify train identification number: successful'
editTrainIdTip: 'Modify train identification number: successful',
enterPrice: '请输入价格',
publishMap: '获取发布地图',
addPackage: '请添加权限'
};

View File

@ -105,8 +105,11 @@ export default {
createPackage: '创建权限',
package: '权限包',
basePackage: '基础权限',
universalPackage: '万能权限',
pleaseEnterContent: '请输入内容',
selectGoods: '选择商品',
month: '月',
yuan: '元'
yuan: '元',
back: '返回',
next: '下一步'
};

View File

@ -277,5 +277,6 @@ export default {
enterTheServiceNumber: '请输入表号',
enterTheTripNumber: '请输入车次号',
enterTheTargetCode: '请输入目的地号',
selectStation: '请选择车站'
selectStation: '请选择车站',
pleaseEnterGoodPrice: '请输入商品价格'
};

View File

@ -170,5 +170,8 @@ export default {
selectAPieceOfData: '请选择一条数据',
selectSpeedLimitValueTip: '请选择限速值后,点击“下达”按钮,下达命令!',
addTrainIdTip: '添加列车识别号:成功',
editTrainIdTip: '修改列车识别号:成功'
editTrainIdTip: '修改列车识别号:成功',
enterPrice: '请输入价格',
publishMap: '获取发布地图',
addPackage: '请添加权限'
};

View File

@ -27,7 +27,7 @@ export default {
importData(Sheet, JsonData) {
var dataList = convertSheetToList(Sheet, false);
var needList = Object.keys(this.ExcelConfig.columns);
debugger;
if (dataList && dataList.length) {
for (var rowIndex = this.ExcelConfig.beginRow; rowIndex < dataList.length; rowIndex += 1) {
for (var colIndex = this.ExcelConfig.beginCol; colIndex < dataList[this.ExcelConfig.beginCol].length; colIndex += this.ExcelConfig.fieldNum + 1) {

View File

@ -4,9 +4,9 @@ export function getBaseUrl() {
if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud';
BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 王兴杰
BASE_API = 'http://192.168.3.41:9000'; // 王兴杰
} else {
BASE_API = process.env.VUE_APP_BASE_API;
}

View File

@ -70,7 +70,8 @@ export default {
permissionId: good.permissionId,
name: good.name,
remarks: good.remarks,
price: good.price
price: good.price,
list: good.list
}];
this.$refs.orderForm.setOrderName(good, permission);
this.display = 1;

View File

@ -1,7 +1,16 @@
<template>
<el-dialog :title="this.$t('orderAuthor.packingDetails')" :visible.sync="dialogShow" width="800px" :before-close="close">
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<div style="height: 300px">
<el-scrollbar wrap-class="scrollbar-wrapper" style="">
<el-table :data="permissionList" border style="width: 100%">
<el-table-column prop="name" :label="this.$t('orderAuthor.permissionName')" />
<el-table-column prop="type" :label="this.$t('orderAuthor.permissionType')">
<template slot-scope="scope">
{{ computedName(PermissionTypeList, scope.row.type) }}
</template>
</el-table-column>
</el-table>
</el-scrollbar>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogShow = false">{{ $t('map.cancel') }}</el-button>
@ -10,7 +19,6 @@
</template>
<script>
import { getPermissonDetail } from '@/api/management/author';
export default {
name: 'Author',
@ -21,44 +29,22 @@ export default {
dialogShow: false,
id: '',
PermissionTypeList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '140px',
reset: true,
show: false,
queryObject: {
}
},
queryList: {
query: this.queryFunction,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: this.$t('orderAuthor.permissionName'),
prop: 'name'
},
{
title: this.$t('orderAuthor.permissionType'),
prop: 'type',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.type, this.PermissionTypeList, ['value', 'label']); },
tagType: (row) => { return ''; }
}
],
actions: [
]
}
permissionList: []
};
},
mounted() {
this.loadInitData();
},
methods: {
computedName(list, code) {
let name = '';
list.forEach(elem => {
if (elem.value == code) {
name = elem.label;
}
});
return name;
},
loadInitData() {
this.$Dictionary.permissionType().then(list => {
this.$convertList(list, this.PermissionTypeList, elem => {
@ -66,25 +52,14 @@ export default {
});
});
},
doShow(id) {
this.id = id;
doShow(list) {
this.permissionList = list;
this.dialogShow = true;
this.reloadTable();
},
close() {
this.id = '';
this.dialogShow = false;
},
queryFunction() {
if (this.id) {
return getPermissonDetail(this.id);
}
},
reloadTable() {
if (this.queryList && this.queryList.reload) {
this.queryList.reload();
}
},
turnback() {
this.$router.go(-1);
}

View File

@ -144,16 +144,14 @@ export default {
labelWidth: this.$i18n.locale == 'en' ? '200px': '145px',
items: [
{ prop: 'organizationId', label: this.$t('orderAuthor.organizationOrEnterprise'), type: 'select', options: this.OrganizationList, allowCreate: true, onChange: this.onChange },
// { prop: 'goodsName', label: this.$t('orderAuthor.commodityName'), type: 'text', disabled: true },
// { prop: 'price', label: this.$t('orderAuthor.itemPricing'), type: 'number', disabled: true, min: 0, message: '' },
{ prop: 'orderType', label: this.$t('orderAuthor.orderType'), type: 'select', options: this.OrderTypeList },
{ prop: 'sellerId', label: this.$t('orderAuthor.salesman'), type: 'select', show: this.isShowSeller, options: this.SellerList },
{ prop: 'contractNo', label: this.$t('orderAuthor.contractNumber'), type: 'text', show: this.isShowContractNo },
{ prop: 'amount', label: this.$t('orderAuthor.choosePermissionNumber'), type: 'number', show: true, min: 0 },
{ prop: 'forever', label: this.$t('orderAuthor.permanenceOrNot'), type: 'radio', options: this.$ConstSelect.Whether, disabled: this.foreverIsDisabled },
{ prop: 'startTime', label: this.$t('orderAuthor.startDate'), type: 'date', show: this.isShowStartDate, viewFormat: 'yyyy-MM-dd', valueFormat: 'yyyy-MM-dd', picker: this.DatePicker },
{ prop: 'monthAmount', label: this.$t('orderAuthor.choosePurchaseTime'), type: 'number', show: this.isShowMonths, min: 0, message: '月' },
{ prop: 'totalPrice', label: this.$t('orderAuthor.totalPrice'), type: 'number', show: this.isShowPrice, min: 0, message: '元' },
{ prop: 'monthAmount', label: this.$t('orderAuthor.choosePurchaseTime'), type: 'number', show: this.isShowMonths, min: 0, message: this.$t('orderAuthor.month') },
{ prop: 'totalPrice', label: this.$t('orderAuthor.totalPrice'), type: 'number', show: this.isShowPrice, min: 0, message: this.$t('orderAuthor.yuan') },
{ prop: 'bizType', label: this.$t('orderAuthor.businessType'), type: 'select', disabled: true, options: this.BizTypeList },
{ prop: 'payWays', label: this.$t('orderAuthor.paymentMethod'), type: 'select', show: this.isShowPayType, options: this.PayTypeList },
{ prop: 'payStatus', label: this.$t('orderAuthor.paymentStatus'), type: 'select', show: this.isShowPayStatus, options: this.PayStatusTypeList },
@ -334,7 +332,7 @@ export default {
});
},
showPermission(index, row) {
this.$refs.permissionList.doShow(row.permissionId);
this.$refs.permissionList.doShow(row.list);
},
//
setOrderName(data, permission) {
@ -413,7 +411,7 @@ export default {
};
this.$emit('orderNext', this.urlInfo);
}).catch(error => {
console.log(error);
this.$messageBox(`${error.message}`);
});
});
},

View File

@ -21,11 +21,11 @@
{{ computedName(PermissionTypeList, scope.row.type) }}
</template>
</el-table-column>
<el-table-column v-if="addModel.type == '01'" prop="price" label="价格">
<el-table-column v-if="addModel.type == '01'" prop="price" :label="$t('orderAuthor.price')">
<template slot-scope="scope">
<div v-if="scope.row.price">{{ scope.row.price }}</div>
<div v-if="!scope.row.price">
<el-input v-model="scope.row.payPrice" placeholder="请输入价格" />
<el-input v-model="scope.row.payPrice" :placeholder="$t('tip.enterPrice')" />
</div>
</template>
</el-table-column>
@ -37,13 +37,13 @@
</el-table>
</div>
<el-form ref="formData" label-width="130px" :model="addModel" size="mini" :rules="rules" class="rule_box">
<el-form-item label="权限类型:">
<el-form-item :label="$t('orderAuthor.permissionType') + ':'">
<el-radio-group v-model="addModel.type">
<el-radio v-for="item in permissionType" :key="item.value" :label="item.value" @change="changeRadio">{{ item.label }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-show="addModel.type == '02'" :label="$t('orderAuthor.permissionGoodName') + ':'" prop="name">
<el-input v-model="addModel.name" size="small" />
<el-input v-model="addModel.name" size="small" :disabled="isGoods" />
</el-form-item>
<el-form-item v-show="addModel.type == '02'" :label="$t('orderAuthor.describtion') + ':'">
<el-input
@ -52,19 +52,20 @@
:rows="2"
maxlength="60"
show-word-limit
:disabled="isGoods"
/>
</el-form-item>
<el-form-item v-show="addModel.type == '02' && !isGoods" :label="$t('orderAuthor.price') + ':'" prop="price">
<el-input-number v-model="addModel.price" :min="0.01" />
<el-form-item v-show="addModel.type == '02'" :label="$t('orderAuthor.price') + ':'" prop="price">
<el-input-number v-model="addModel.price" :min="0.01" :disabled="isGoods" />
<span style="padding-left: 20px; font-size: 12px; color: #a9a9a9;">{{ $t('global.yuan') }}</span>
</el-form-item>
<el-form-item v-show="addModel.type == '02' && !isGoods" :label="$t('orderAuthor.whetherTrial')" prop="forever">
<el-radio-group v-model="addModel.forever">
<el-form-item v-show="addModel.type == '02'" :label="$t('orderAuthor.whetherTrial')" prop="forever">
<el-radio-group v-model="addModel.forever" :disabled="isGoods">
<el-radio v-for="option in $ConstSelect.Whether" :key="option.value" :label="option.value">{{ option.label }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item v-if="addModel.type == '02' && addModel.forever && !isGoods" :label="$t('orderAuthor.unitOfTime')" prop="tryUseTimeUnit">
<el-select v-model="addModel.tryUseTimeUnit" filterable>
<el-form-item v-if="addModel.type == '02' && addModel.forever" :label="$t('orderAuthor.unitOfTime')" prop="tryUseTimeUnit">
<el-select v-model="addModel.tryUseTimeUnit" filterable :disabled="isGoods">
<el-option
v-for="option in TimeStyleList"
:key="option.value"
@ -73,8 +74,8 @@
/>
</el-select>
</el-form-item>
<el-form-item v-if="addModel.type == '02' && addModel.forever && !isGoods" :label="$t('orderAuthor.price') + ':'" prop="tryUseTime">
<el-input-number v-model="addModel.tryUseTime" :min="0.01" />
<el-form-item v-if="addModel.type == '02' && addModel.forever" :label="$t('orderAuthor.price') + ':'" prop="tryUseTime">
<el-input-number v-model="addModel.tryUseTime" :min="0.01" :disabled="isGoods" />
<span style="padding-left: 20px; font-size: 12px; color: #a9a9a9;">{{ TimeStyleDict[addModel.tryUseTimeUnit] }}</span>
</el-form-item>
</el-form>
@ -90,7 +91,7 @@
<div class="draft">
<el-button-group>
<el-button type="primary" @click="turnback">{{ $t('global.back') }}</el-button>
<el-button type="primary" @click="permissionNext">下一步</el-button>
<el-button type="primary" @click="permissionNext">{{ $t('orderAuthor.next') }}</el-button>
</el-button-group>
</div>
</div>
@ -114,10 +115,10 @@ export default {
EffectiveTypeList: [],
PermissionTypeList: [],
permissionType: [
{value: '01', label: '基础权限'},
{value: '02', label: '万能权限'}
{value: '01', label: this.$t('orderAuthor.basePackage')},
{value: '02', label: this.$t('orderAuthor.universalPackage')}
],
isGoods: true,
isGoods: false,
mapList: [],
goodsList: [], //
goodsListNew: [],
@ -136,7 +137,7 @@ export default {
{ required: true, message: this.$t('rules.enterPermissionName'), trigger: 'blur' }
],
price: [
{ required: true, message: '请输入商品价格', trigger: 'blur' }
{ required: true, message: this.$t('rules.pleaseEnterGoodPrice'), trigger: 'blur' }
]
}
};
@ -153,11 +154,12 @@ export default {
return item.id;
});
postFindPermission(arr).then(res => {
this.isGoods = true;
if (!res.data) {
this.isGoods = false;
} else {
if (res.data && res.data.goodsId) {
this.isGoods = true;
this.addModel.name = res.data.name;
this.addModel.price = res.data.prdPrice;
this.addModel.remarks = res.data.remarks;
}
});
}
@ -184,11 +186,12 @@ export default {
return item.id;
});
postFindPermission(arr).then(res => {
this.isGoods = true;
if (!res.data) {
this.isGoods = false;
} else {
if (res.data && res.data.goodsId) {
this.isGoods = true;
this.addModel.name = res.data.name;
this.addModel.price = res.data.prdPrice;
this.addModel.remarks = res.data.remarks;
}
});
}
@ -223,7 +226,7 @@ export default {
this.mapList.push({ value: elem.id, label: elem.name });
});
} catch (error) {
console.error(error, '获取发布地图');
console.error(error, this.$t('tip.publishMap'));
}
},
computedName(list, code) {
@ -319,45 +322,40 @@ export default {
if (valid) { // 使
postFindPermission(arr).then(res => {
this.addModel['relPermissions'] = arr;
if (res.data) {
if (this.isGoods) {
this.addModel.name = res.data.name;
this.addModel.remarks = res.data.remarks;
this.$confirm('选择的权限已存在对应商品,是否创建订单', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.addModel['id'] = res.data.id;
const good = {
id: res.data.goodsId,
permissionId: res.data.id,
name: res.data.prdName,
price: res.data.prdPrice,
remarks: res.data.remarks
remarks: res.data.remarks,
list: this.ruleList
};
this.$emit('permissionNextOrder', this.addModel, good);
});
} else {
this.addModel['id'] = '';
//
const good = {
name: this.addModel.name,
permissionId: this.addModel.id,
permissionId: '',
tryUse: this.addModel.forever,
tryUseTime: this.addModel.tryUseTime,
tryUseTimeUnit: this.addModel.tryUseTimeUnit,
price: this.addModel.price,
remarks: this.addModel.remarks
remarks: this.addModel.remarks,
list: this.ruleList
};
this.$emit('permissionNextOrder', this.addModel, good);
}
// this.$emit('permissionNextOrder', this.addModel, good);
}).catch((error) => { console.log(error); });
}
});
}
} else {
this.$messageBox('请添加权限');
this.$messageBox(this.$t('tip.addPackage'));
}
},
turnback() {

View File

@ -7,7 +7,7 @@
</div>
<div class="draft">
<el-button-group>
<el-button @click="turnback">返回</el-button>
<el-button @click="turnback">{{ $t('orderAuthor.back') }}</el-button>
</el-button-group>
</div>
</div>

View File

@ -11,7 +11,7 @@
<status-bar ref="statusBar" @dispatchDialog="dispatchDialog" @showTrain="showTrain" />
<open-run-plan ref="openRunPlan" :skin-code="skinCode" @dispatchDialog="dispatchDialog" />
<create-empty-plan ref="createEmptyPlan" @dispatchOperate="dispatchOperate" @dispatchDialog="dispatchDialog" />
<create-empty-plan ref="createEmptyPlan" :plan-convert="PlanConvert" @dispatchOperate="dispatchOperate" @dispatchDialog="dispatchDialog" />
<parameter ref="parameter" />
<off-line ref="offLine" @handleConfirm="handleConfirm" @dispatchDialog="dispatchDialog" />
<add-planning-train ref="addPlanningTrain" @dispatchDialog="dispatchDialog" />

View File

@ -159,19 +159,19 @@ export default {
title: '新建运行图',
click: this.handleCreateEmptyPlan
},
{
title: '修改运行图名称',
click: this.handleEditPlan
},
// {
// title: '',
// click: this.handleEditPlan
// },
{
title: '修改站间运行时间',
click: this.handleModifyingStationIntervalTime
// disabledCallback: () => { return !this.$route.query.planId },
},
{
title: '删除运行图',
click: this.handledeleteRunPlan
}
// {
// title: '',
// click: this.handledeleteRunPlan
// }
]
},
{
@ -399,13 +399,13 @@ export default {
handleOpenRunPlan() {
this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'add'} });
},
handledeleteRunPlan() {
this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'delete'} });
},
// handledeleteRunPlan() {
// this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'delete'} });
// },
//
handleEditPlan() {
this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'edit'} });
},
// handleEditPlan() {
// this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'edit'} });
// },
loadingScreen() {
this.loading = this.$loading({
lock: true,

View File

@ -40,6 +40,20 @@
</el-form>
</el-row>
</el-tab-pane>
<el-tab-pane label="导入运行图" name="three">
<el-row>
<el-button type="text" class="uploadDemo">
<input
ref="files"
type="file"
class="file_box"
accept=".json, application/json, .csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
@change="importf"
>
<i class="el-icon-plus" />
</el-button>
</el-row>
</el-tab-pane>
</el-tabs>
</div>
<span slot="footer" class="dialog-footer">
@ -50,18 +64,28 @@
</template>
<script>
import { createEmptyPlan, queryRunPlanList, postCreatePlan } from '@/api/runplan';
import { createEmptyPlan, queryRunPlanList, postCreatePlan, importRunPlan } from '@/api/runplan';
import { UrlConfig } from '@/router/index';
import XLSX from 'xlsx';
export default {
name: 'CreateEmptyPlan',
components: {
},
props: {
planConvert: {
type: Object,
default: function() {
return { };
}
}
},
data() {
return {
activeTab: 'first',
dialogShow: false,
loading: false,
loadingDig: null,
publishMapList: [],
newModel: {
name: '',
@ -136,7 +160,6 @@ export default {
};
this.$emit('dispatchOperate', params);
// this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'add'} });
this.$message.success('创建空运行图成功!');
this.jump(resp.data, this.newModel.name);
this.doClose();
@ -151,7 +174,6 @@ export default {
if (valid) {
this.loading = true;
postCreatePlan(this.pullModel).then(resp => {
// this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'add'} });
this.$message.success('创建运行图成功!');
this.jump(resp.data, this.pullModel.name);
this.doClose();
@ -163,6 +185,74 @@ export default {
});
}
},
importf(item) {
const obj = this.$refs.files;
if (obj.files) {
const file = obj.files[0];
this.handleImportRunPlan(file);
obj.value = '';
}
},
loadingScreen() {
this.loadingDig = this.$loading({
lock: true,
text: '正在导入中...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
},
//
handleImportRunPlan(file) {
if (file) {
this.loadingScreen();
setTimeout(() => {
const that = this;
const reader = new FileReader();
if (reader) {
reader.onload = function (e) {
let wb;
const data = e.target.result;
if (that.rABS) {
wb = XLSX.read(btoa(that.fixdata(data)), { //
type: 'base64'
});
} else {
wb = XLSX.read(data, {
type: 'binary'
});
}
if (wb) {
try {
let jsonData = [];
for (const index in wb.Sheets) {
jsonData = that.planConvert.importData(wb.Sheets[index], jsonData);
}
importRunPlan({ skinCode: that.$route.query.skinCode || '02', runPlanList: jsonData }).then(response => {
that.loadingDig.close();
that.$message.success(`导入运行图成功`);
// this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'add'} });
}).catch(error => {
that.loadingDig.close();
that.$message.warning(`导入运行图失败: ${error.message}`);
});
} catch (error) {
that.loadingDig.close();
that.$message.warning(`解析运行图失败: ${error.message}`);
}
}
};
if (that.rABS) {
reader.readAsArrayBuffer(file);
} else {
reader.readAsBinaryString(file);
}
}
}, 200);
}
this.doClose();
},
jump(planId, planName) {
const query = { skinCode: this.$route.query.skinCode, mapId: this.$route.query.mapId, planId: planId, planName: planName };
this.$router.push({ path: `${UrlConfig.plan.tool}`, query: query });
@ -182,4 +272,24 @@ export default {
width: 120px;
}
}
.uploadDemo{
width: 100%;
height: 130px;
border: 1px dashed #409EFF;
position: relative;
.file_box{
position: absolute;
opacity: 0;
left: 0;
top: 0;
width: 100%;
height: 100%;
cursor: pointer;
}
.el-icon-plus{
font-size: 40px;
}
}
</style>

View File

@ -4,7 +4,7 @@
class="planEdit__tool create-empty-plan"
:title="title"
:visible.sync="dialogShow"
width="30%"
width="400px"
:before-close="doClose"
:z-index="3000"
:modal="false"
@ -20,8 +20,8 @@
</el-row>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" :loading="loading" @click="handleEdit">修改</el-button>
<el-button @click="doClose">{{ $t('map.cancel') }}</el-button>
<el-button type="primary" :loading="loading" @click="handleEdit">修改</el-button>
</span>
</el-dialog>
</template>

View File

@ -296,9 +296,11 @@ export default {
if (index < list.length - 1) {
const stopStationObj = this.stopStationMap[[list[index].sectionCode, list[index + 1].sectionCode].toString()];
if (stopStationObj) {
console.log(stopStationObj, 1111);
if (stopStationObj.runPlanLevelVO) {
runTime = parseInt(stopStationObj.runPlanLevelVO[runLevel]);
} else {
console.log(stopStationObj, 2222);
this.$messageBox(`请先设置开始区段 ${stopStationObj.startSectionCode} 终到区段 ${stopStationObj.endSectionCode} 的站间运行时间`);
}
}

View File

@ -5,13 +5,24 @@
class="planEdit__tool open-runplan"
:title="title"
:visible.sync="show"
width="640px"
width="800px"
:before-close="doClose"
:z-index="2000"
:modal="true"
:close-on-click-modal="false"
>
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{height: height+'px'}">
<el-table :data="runPlanList" height="350" border style="width: 100%">
<el-table-column prop="name" label="运行图名称" />
<el-table-column prop="createTime" label="创建日期" width="180" />
<el-table-column label="操作">
<template slot-scope="scope">
<el-button size="mini" class="button_box" @click="handleConfirm(scope.row)">加载</el-button>
<el-button size="mini" class="button_box" @click="handleEdit(scope.row)">修改名称</el-button>
<el-button size="mini" class="button_box" type="danger" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- <el-scrollbar wrap-class="scrollbar-wrapper" :style="{height: height+'px'}">
<el-tree
ref="tree"
class="filter-tree"
@ -22,13 +33,13 @@
:style="{height: height-20+'px'}"
@node-click="handleNodeClick"
/>
</el-scrollbar>
<el-row type="flex" justify="center" class="button-group">
</el-scrollbar> -->
<!-- <el-row type="flex" justify="center" class="button-group">
<el-button v-if="type == 'add'" type="primary" @click="handleConfirm">选择运行图</el-button>
<el-button v-if="type == 'delete'" type="primary" @click="handleDelete">删除</el-button>
<el-button v-if="type == 'edit'" type="primary" @click="handleEdit">修改</el-button>
<el-button @click="dialogShow = false"> </el-button>
</el-row>
</el-row> -->
</el-dialog>
<edit-plan-name ref="editPlan" @renewal="getRunPlanList" />
</div>
@ -55,15 +66,15 @@ export default {
dialogShow: false,
loading: false,
height: 260,
planId: '',
planName: '',
// planId: '',
// planName: '',
type: 'add',
// defaultShowKeys: [],
runPlanList: [],
runPlanDict: {},
defaultProps: {
label: 'name'
}
runPlanDict: {}
// defaultProps: {
// label: 'name'
// }
};
},
computed: {
@ -82,10 +93,10 @@ export default {
});
},
methods: {
handleNodeClick(data) {
this.planId = data.id;
this.planName = data.name;
},
// handleNodeClick(data) {
// this.planId = data.id;
// this.planName = data.name;
// },
loadRunPlanData({ refresh, planId, skinCode, planName }) {
if (refresh) {
this.$store.dispatch('runPlan/refresh');
@ -100,7 +111,6 @@ export default {
this.runPlanList.forEach(elem => {
this.runPlanDict[elem.id] = elem.name;
});
// this.defaultShowKeys = [this.planId];
this.dialogShow = true;
}).catch(() => {
this.$messageBox('获取运行图列表失败');
@ -112,28 +122,28 @@ export default {
},
doClose() {
this.dialogShow = false;
this.planId = '';
this.planName = '';
// this.planId = '';
// this.planName = '';
},
//
handleConfirm() {
handleConfirm(row) {
this.loadRunPlanData({
planId: this.planId,
planId: row.id,
skinCode: this.$route.query.skinCode,
planName: this.planName
planName: row.name
});
this.doClose();
},
//
handleDelete() {
handleDelete(row) {
this.$confirm('您确认是否删除此运行图?', this.$t('tip.hint'), {
confirmButtonText: this.$t('tip.confirm'),
cancelButtonText: this.$t('tip.cancel'),
type: 'warning'
}).then(() => {
deleteRunPlan(this.planId).then(Response => {
deleteRunPlan(row.id).then(Response => {
this.$message.success(`删除成功!`);
if (this.planId === this.$route.query.planId) {
if (row.id === this.$route.query.planId) {
const query = { skinCode: this.$route.query.skinCode, mapId: this.$route.query.mapId };
this.$router.push({ path: `${UrlConfig.plan.tool}`, query: query });
}
@ -144,9 +154,9 @@ export default {
}).catch(() => { });
},
//
handleEdit() {
if (this.planId && this.planName) {
this.$refs.editPlan.doShow({id: this.planId, name: this.planName});
handleEdit(row) {
if (row.id && row.name) {
this.$refs.editPlan.doShow({id: row.id, name: row.name});
} else {
this.$message.info('请选择运行图');
}
@ -167,4 +177,8 @@ export default {
// background: #ECE9D8 !important;
}
}
.button_box{
float: left;
margin: 0 2px!important;
}
</style>