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', permission: 'Permission',
orderSelectionItem: 'Order selection item', orderSelectionItem: 'Order selection item',
orderDetails: 'Order details', orderDetails: 'Order details',
universalPackage: '万能权限',
createPackage: '创建权限',
package: '权限包',
basePackage: '基础权限',
statusType: 'Status type', statusType: 'Status type',
private: 'Private', private: 'Private',
public: 'Public', public: 'Public',
pleaseEnterContent: 'Please enter content', pleaseEnterContent: 'Please enter content',
selectGoods: 'Select Goods', selectGoods: 'Select Goods',
month: ' month', month: ' month',
yuan: ' yuan' yuan: ' yuan',
back: '返回',
next: '下一步'
}; };

View File

@ -275,5 +275,6 @@ export default {
inputMaxDuration: 'Please input max duration', inputMaxDuration: 'Please input max duration',
accessNumber: 'Please input the number of permissions', accessNumber: 'Please input the number of permissions',
courseNameEmpty: 'Course name cannot be empty', 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', selectAPieceOfData: 'Please select a piece of data',
selectSpeedLimitValueTip: 'Please select the speed limit value, click the "release" button, and issue the command!', selectSpeedLimitValueTip: 'Please select the speed limit value, click the "release" button, and issue the command!',
addTrainIdTip: 'Add train identification number: successful', 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: '创建权限', createPackage: '创建权限',
package: '权限包', package: '权限包',
basePackage: '基础权限', basePackage: '基础权限',
universalPackage: '万能权限',
pleaseEnterContent: '请输入内容', pleaseEnterContent: '请输入内容',
selectGoods: '选择商品', selectGoods: '选择商品',
month: '月', month: '月',
yuan: '元' yuan: '元',
back: '返回',
next: '下一步'
}; };

View File

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

View File

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

View File

@ -27,7 +27,7 @@ export default {
importData(Sheet, JsonData) { importData(Sheet, JsonData) {
var dataList = convertSheetToList(Sheet, false); var dataList = convertSheetToList(Sheet, false);
var needList = Object.keys(this.ExcelConfig.columns); var needList = Object.keys(this.ExcelConfig.columns);
debugger;
if (dataList && dataList.length) { if (dataList && dataList.length) {
for (var rowIndex = this.ExcelConfig.beginRow; rowIndex < dataList.length; rowIndex += 1) { 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) { 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') { if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud'; // BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.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.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.41:9000'; // 王兴杰 BASE_API = 'http://192.168.3.41:9000'; // 王兴杰
} else { } else {
BASE_API = process.env.VUE_APP_BASE_API; BASE_API = process.env.VUE_APP_BASE_API;
} }

View File

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

View File

@ -1,7 +1,16 @@
<template> <template>
<el-dialog :title="this.$t('orderAuthor.packingDetails')" :visible.sync="dialogShow" width="800px" :before-close="close"> <el-dialog :title="this.$t('orderAuthor.packingDetails')" :visible.sync="dialogShow" width="800px" :before-close="close">
<div> <div style="height: 300px">
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" /> <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> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="dialogShow = false">{{ $t('map.cancel') }}</el-button> <el-button @click="dialogShow = false">{{ $t('map.cancel') }}</el-button>
@ -10,7 +19,6 @@
</template> </template>
<script> <script>
import { getPermissonDetail } from '@/api/management/author';
export default { export default {
name: 'Author', name: 'Author',
@ -21,44 +29,22 @@ export default {
dialogShow: false, dialogShow: false,
id: '', id: '',
PermissionTypeList: [], PermissionTypeList: [],
pagerConfig: { permissionList: []
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: [
]
}
}; };
}, },
mounted() { mounted() {
this.loadInitData(); this.loadInitData();
}, },
methods: { methods: {
computedName(list, code) {
let name = '';
list.forEach(elem => {
if (elem.value == code) {
name = elem.label;
}
});
return name;
},
loadInitData() { loadInitData() {
this.$Dictionary.permissionType().then(list => { this.$Dictionary.permissionType().then(list => {
this.$convertList(list, this.PermissionTypeList, elem => { this.$convertList(list, this.PermissionTypeList, elem => {
@ -66,25 +52,14 @@ export default {
}); });
}); });
}, },
doShow(id) { doShow(list) {
this.id = id; this.permissionList = list;
this.dialogShow = true; this.dialogShow = true;
this.reloadTable();
}, },
close() { close() {
this.id = ''; this.id = '';
this.dialogShow = false; this.dialogShow = false;
}, },
queryFunction() {
if (this.id) {
return getPermissonDetail(this.id);
}
},
reloadTable() {
if (this.queryList && this.queryList.reload) {
this.queryList.reload();
}
},
turnback() { turnback() {
this.$router.go(-1); this.$router.go(-1);
} }

View File

@ -144,16 +144,14 @@ export default {
labelWidth: this.$i18n.locale == 'en' ? '200px': '145px', labelWidth: this.$i18n.locale == 'en' ? '200px': '145px',
items: [ items: [
{ prop: 'organizationId', label: this.$t('orderAuthor.organizationOrEnterprise'), type: 'select', options: this.OrganizationList, allowCreate: true, onChange: this.onChange }, { 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: '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: '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: '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: '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: '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: '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: '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: '元' }, { 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: '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: '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 }, { prop: 'payStatus', label: this.$t('orderAuthor.paymentStatus'), type: 'select', show: this.isShowPayStatus, options: this.PayStatusTypeList },
@ -334,7 +332,7 @@ export default {
}); });
}, },
showPermission(index, row) { showPermission(index, row) {
this.$refs.permissionList.doShow(row.permissionId); this.$refs.permissionList.doShow(row.list);
}, },
// //
setOrderName(data, permission) { setOrderName(data, permission) {
@ -413,7 +411,7 @@ export default {
}; };
this.$emit('orderNext', this.urlInfo); this.$emit('orderNext', this.urlInfo);
}).catch(error => { }).catch(error => {
console.log(error); this.$messageBox(`${error.message}`);
}); });
}); });
}, },

View File

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

View File

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

View File

@ -11,7 +11,7 @@
<status-bar ref="statusBar" @dispatchDialog="dispatchDialog" @showTrain="showTrain" /> <status-bar ref="statusBar" @dispatchDialog="dispatchDialog" @showTrain="showTrain" />
<open-run-plan ref="openRunPlan" :skin-code="skinCode" @dispatchDialog="dispatchDialog" /> <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" /> <parameter ref="parameter" />
<off-line ref="offLine" @handleConfirm="handleConfirm" @dispatchDialog="dispatchDialog" /> <off-line ref="offLine" @handleConfirm="handleConfirm" @dispatchDialog="dispatchDialog" />
<add-planning-train ref="addPlanningTrain" @dispatchDialog="dispatchDialog" /> <add-planning-train ref="addPlanningTrain" @dispatchDialog="dispatchDialog" />

View File

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

View File

@ -40,6 +40,20 @@
</el-form> </el-form>
</el-row> </el-row>
</el-tab-pane> </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> </el-tabs>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
@ -50,18 +64,28 @@
</template> </template>
<script> <script>
import { createEmptyPlan, queryRunPlanList, postCreatePlan } from '@/api/runplan'; import { createEmptyPlan, queryRunPlanList, postCreatePlan, importRunPlan } from '@/api/runplan';
import { UrlConfig } from '@/router/index'; import { UrlConfig } from '@/router/index';
import XLSX from 'xlsx';
export default { export default {
name: 'CreateEmptyPlan', name: 'CreateEmptyPlan',
components: { components: {
}, },
props: {
planConvert: {
type: Object,
default: function() {
return { };
}
}
},
data() { data() {
return { return {
activeTab: 'first', activeTab: 'first',
dialogShow: false, dialogShow: false,
loading: false, loading: false,
loadingDig: null,
publishMapList: [], publishMapList: [],
newModel: { newModel: {
name: '', name: '',
@ -136,7 +160,6 @@ export default {
}; };
this.$emit('dispatchOperate', params); this.$emit('dispatchOperate', params);
// this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'add'} });
this.$message.success('创建空运行图成功!'); this.$message.success('创建空运行图成功!');
this.jump(resp.data, this.newModel.name); this.jump(resp.data, this.newModel.name);
this.doClose(); this.doClose();
@ -151,7 +174,6 @@ export default {
if (valid) { if (valid) {
this.loading = true; this.loading = true;
postCreatePlan(this.pullModel).then(resp => { postCreatePlan(this.pullModel).then(resp => {
// this.$emit('dispatchDialog', { name: 'openRunPlan', params: {type: 'add'} });
this.$message.success('创建运行图成功!'); this.$message.success('创建运行图成功!');
this.jump(resp.data, this.pullModel.name); this.jump(resp.data, this.pullModel.name);
this.doClose(); 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) { jump(planId, planName) {
const query = { skinCode: this.$route.query.skinCode, mapId: this.$route.query.mapId, planId: planId, planName: 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 }); this.$router.push({ path: `${UrlConfig.plan.tool}`, query: query });
@ -182,4 +272,24 @@ export default {
width: 120px; 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> </style>

View File

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

View File

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

View File

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