This commit is contained in:
zyy 2020-11-18 13:15:40 +08:00
commit d8c25dde1e
31 changed files with 812 additions and 393 deletions

View File

@ -11,7 +11,6 @@ pipeline {
nodejs 'nodejs-10' nodejs 'nodejs-10'
} }
steps { steps {
sh 'npm update'
sh 'npm install' sh 'npm install'
sh 'npm run build' sh 'npm run build'
} }

View File

@ -11,7 +11,6 @@ pipeline {
nodejs 'nodejs-10' nodejs 'nodejs-10'
} }
steps { steps {
sh 'npm update'
sh 'npm install' sh 'npm install'
sh 'npm run test' sh 'npm run test'
} }

View File

@ -29,6 +29,7 @@
"path-to-regexp": "2.4.0", "path-to-regexp": "2.4.0",
"qrcode.vue": "^1.6.2", "qrcode.vue": "^1.6.2",
"qs": "^6.9.3", "qs": "^6.9.3",
"quill-image-extend-module": "^1.1.2",
"recordrtc": "^5.5.9", "recordrtc": "^5.5.9",
"script-loader": "^0.7.2", "script-loader": "^0.7.2",
"sessionstorage": "^0.1.0", "sessionstorage": "^0.1.0",

84
src/api/learn.js Normal file
View File

@ -0,0 +1,84 @@
import request from '@/utils/request';
// 根据postId帖子ID分页查询留言列表
export function queryMessagePagingByPostId(postId, params) {
return request({
url: `/api/learn/${postId}/message/pagedQuery/postId`,
method: 'get',
params: params
});
}
// 根据项目分页查询留言列表
export function queryMessagePagingByProjectCode(projectCode, params) {
return request({
url: `/api/learn/${projectCode}/message/pagedQuery/project`,
method: 'get',
params: params
});
}
// 回复帖子
export function answerPost(data) {
return request({
url: `/api/learn/message/create`,
method: 'post',
data: data
});
}
// 评论留言
export function commentLevelMessage(messageId, data) {
return request({
url: `/api/learn/${messageId}/comment`,
method: 'post',
data: data
});
}
// 评论 留言的评论
export function commentComents(messageId, commentId, data) {
return request({
url: `/api/learn/${messageId}/${commentId}/comment`,
method: 'post',
data: data
});
}
// 管理员删除留言
export function deleteMessageByAdmin(messageId) {
return request({
url: `/api/learn/${messageId}/deleteMessage/admin`,
method: 'delete'
});
}
// 用户自己删除留言
export function deleteMessageBySelf(messageId) {
return request({
url: `/api/learn/${messageId}/deleteMessage/user`,
method: 'delete'
});
}
// 查询留言的评论列表
export function queryMessageCommentList(messageId) {
return request({
url: `/api/learn/${messageId}/list`,
method: 'get'
});
}
// 删除评论回复管理员
export function deleteCommentByAdmin(commentId) {
return request({
url: `/api/learn/${commentId}/deleteComment/admin`,
method: 'delete'
});
}
// 删除评论回复用户
export function deleteCommentBySelf(commentId) {
return request({
url: `/api/learn/${commentId}/deleteComment/user`,
method: 'delete'
});
}
// 根据项目获取项目关联的帖子
export function getPostByProjectCode(projectCode) {
return request({
url: `/api/learn/${projectCode}/post`,
method: 'get'
});
}

BIN
src/assets/bg_board.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

BIN
src/assets/delete.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
src/assets/like.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
src/assets/reply.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
src/assets/unlike.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -4,7 +4,8 @@
ref="editor" ref="editor"
v-model="content" v-model="content"
:options="options" :options="options"
:style="{height: height+'px', 'margin-bottom': '80px'}" style="background-color: #fff"
:style="{height: height+'px', 'margin-bottom': marginBottom+'px'}"
@change="onChange" @change="onChange"
@blur="onBlur" @blur="onBlur"
@focus="onFocus" @focus="onFocus"
@ -13,9 +14,10 @@
</template> </template>
<script> <script>
import { quillEditor } from 'vue-quill-editor'; import { quillEditor, Quill } from 'vue-quill-editor';
import 'quill/dist/quill.snow.css'; import 'quill/dist/quill.snow.css';
import { ImageExtend, QuillWatch} from 'quill-image-extend-module';
Quill.register('modules/ImageExtend', ImageExtend);
export default { export default {
components: { components: {
quillEditor quillEditor
@ -32,12 +34,69 @@ export default {
placeholder: { placeholder: {
type: String, type: String,
default: '' default: ''
},
marginBottom: {
type: Number,
default: 80
},
unloadImg: {
type: Boolean,
default: false
},
noHandleP: {
type: Boolean,
defalut: false
} }
}, },
data() { data() {
return { return {
content: '', content: ''
options: { };
},
computed: {
editor() {
return this.$refs.editor.quill;
},
options() {
const that = this;
return this.unloadImg ? {
modules: {
ImageExtend: {
loading: true,
name: 'file',
size: 3,
action: `https://test.joylink.club/jlfile/api/upload/PICTURE?appId=00001&appSecret=joylink00001`,
response: (res) => {
return `https://test.joylink.club/oss/joylink${res.data}`;
},
error: () => { that.$message.error('图片上传失败,请检查网络状态'); },
sizeError: () => { that.$message.error('图片上传失败图片大小限制3MB'); } //
},
toolbar: {
container: [
['bold', 'italic', 'underline', 'strike'],
[],
[],
[{'list': 'ordered'}, {'list': 'bullet'}],
[{'script': 'sub'}, {'script': 'super'}],
[{'indent': '-1'}, {'indent': '+1'}],
[{'direction': 'rtl'}],
[{'size': ['small', 'large', 'huge']}],
[{'color': [], 'background': []}],
[{'font': []}],
[{'align': []}],
['clean'],
['image']
],
handlers: {
'image': function () {
QuillWatch.emit(this.quill.id);
}
}
}
},
placeholder: '请输入'
} : {
modules: { modules: {
toolbar: [ toolbar: [
['bold', 'italic', 'underline', 'strike'], ['bold', 'italic', 'underline', 'strike'],
@ -54,12 +113,7 @@ export default {
['clean'] ['clean']
] ]
} }
} };
};
},
computed: {
editor() {
return this.$refs.editor.quill;
}, },
titleConfig () { titleConfig () {
return { return {
@ -91,11 +145,13 @@ export default {
watch: { watch: {
'value': function(val) { 'value': function(val) {
this.$nextTick(() => { this.$nextTick(() => {
if (val != this.$escapeHTML(this.content)) { if (val != this.$escapeHTML(this.content) && !this.noHandleP) {
this.editor.enable(false); this.editor.enable(false);
this.content = val; this.content = val;
this.editor.enable(true); this.editor.enable(true);
this.editor.blur(); this.editor.blur();
} else if (this.noHandleP) {
this.content = val;
} }
}); });
} }
@ -105,11 +161,18 @@ export default {
}, },
methods: { methods: {
onChange(e) { onChange(e) {
this.$emit('input', this.$escapeHTML(this.content)); if (!this.noHandleP) {
this.$emit('input', this.$escapeHTML(this.content));
} else {
this.$emit('input', this.content);
}
}, },
onBlur(e) { onBlur(e) {
}, },
onFocus(e) { onFocus(e) {
},
getFocus() {
this.$refs.editor.quill.focus();
} }
} }
}; };

View File

@ -56,6 +56,7 @@ export default {
threeDimensionalStation: 'Three-Dimensional Station', threeDimensionalStation: 'Three-Dimensional Station',
passengerflow: 'CCTV View', passengerflow: 'CCTV View',
trafficplantext:'Passer Planing', trafficplantext:'Passer Planing',
traffictraintext:'Trunk View',
maintainer: 'Maintainer View', maintainer: 'Maintainer View',
deviceView: 'DeviceView', deviceView: 'DeviceView',
taskOperateSuccess: 'Task Operate success', taskOperateSuccess: 'Task Operate success',

View File

@ -55,7 +55,8 @@ export default {
threeDimensionalView: '数字沙盘', threeDimensionalView: '数字沙盘',
threeDimensionalStation: '三维车站', threeDimensionalStation: '三维车站',
passengerflow: 'cctv视图', passengerflow: 'cctv视图',
trafficplantext:'客流规划', trafficplantext:'车站视角',
traffictraintext:'车厢视角',
maintainer: '设备故障视图', maintainer: '设备故障视图',
deviceView: '设备视图', deviceView: '设备视图',
taskOperateSuccess: '任务操作成功', taskOperateSuccess: '任务操作成功',

View File

@ -38,8 +38,8 @@ export function PasserRender(mapmode) {
freeViewRender.initRender(renderer,dom,scene,camerass); freeViewRender.initRender(renderer,dom,scene,camerass);
// //
scope.state = "4views"; scope.state = "freeview";
scope.nowrender = fourViewRender; scope.nowrender = freeViewRender;
} }
this.changeRenderMode = function(mode){ this.changeRenderMode = function(mode){

View File

@ -31,13 +31,14 @@ export function TrainConnect(trafficTrain,deviceaction,toptrain,routegroup,passe
const data = JSON.parse(Response.body); const data = JSON.parse(Response.body);
if(data.type != "TrainRun_3D"){ if(data.type == "TrainRun_3D"){
console.log(data); trafficTrain.runList = data.body;
// console.log(data);
} }
if(data.type == "BeAbout2Arrive_3D"){ if(data.type == "BeAbout2Arrive_3D"){
if(toptrain.nowcode == data.body.groupNumber){ if(toptrain.nowcode == data.body.groupNumber){
console.log(data); // console.log(data);
} }
} }
@ -68,8 +69,12 @@ export function TrainConnect(trafficTrain,deviceaction,toptrain,routegroup,passe
num:data.body[i].num, num:data.body[i].num,
doorCode:1, doorCode:1,
open:0, open:0,
text:"",
}; };
trafficTrain.trainList.push(train);
train.text = data.body[i].code+"(现有乘客"+data.body[i].num+"人)";
trafficTrain.trainList[train.code] = train;
} }
} }

View File

@ -83,6 +83,7 @@ export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap) {
this.humanInSpeed = 0; this.humanInSpeed = 0;
this.humanOutSpeed = 0; this.humanOutSpeed = 0;
this.runList = [];
//定义相机 //定义相机
camerass = new THREE.PerspectiveCamera(70, dom.offsetWidth / dom.offsetHeight, 0.01, 1000); camerass = new THREE.PerspectiveCamera(70, dom.offsetWidth / dom.offsetHeight, 0.01, 1000);
camerass.position.set(0, 80, 40); camerass.position.set(0, 80, 40);
@ -293,6 +294,10 @@ export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap) {
return scope.trainList; return scope.trainList;
} }
this.getRunList = function(){
return scope.runList;
}
let nowLeaveDoor = null; let nowLeaveDoor = null;
this.updatePasserMove = function(doorData){ this.updatePasserMove = function(doorData){
nowLeaveDoor = doorData.doorCode; nowLeaveDoor = doorData.doorCode;
@ -330,9 +335,9 @@ export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap) {
passerTrain.toptrain.nowcode = newCode; passerTrain.toptrain.nowcode = newCode;
scope.nowTrainCode = newCode; scope.nowTrainCode = newCode;
// console.log(scope.trainList); // console.log(scope.trainList);
for(let i=0;i<scope.trainList.length;i++){ for(let k in scope.trainList){
if(scope.trainList[i].code == newCode){ if(scope.trainList[k].code == newCode){
let trainDataList = getnum(scope.trainList[i].num,6); let trainDataList = getnum(scope.trainList[k].num,6);
scope.nowTrunk.code = newCode; scope.nowTrunk.code = newCode;
scope.nowTrunk.numList = trainDataList; scope.nowTrunk.numList = trainDataList;
@ -351,8 +356,8 @@ export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap) {
passerTrain.toptrain.action.down[an].play(); passerTrain.toptrain.action.down[an].play();
} }
if(scope.trainList[i].open != "0"){ if(scope.trainList[k].open != "0"){
if(scope.trainList[i].doorCode == "1"){ if(scope.trainList[k].doorCode == "1"){
for(let an=passerTrain.toptrain.action.top.length-1;an>=0;an--){ for(let an=passerTrain.toptrain.action.top.length-1;an>=0;an--){
passerTrain.toptrain.action.top[an].reset(); passerTrain.toptrain.action.top[an].reset();
passerTrain.toptrain.action.top[an].time = passerTrain.toptrain.action.top[an]._clip.duration; passerTrain.toptrain.action.top[an].time = passerTrain.toptrain.action.top[an]._clip.duration;
@ -370,7 +375,8 @@ export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap) {
} }
updateTrainNum(trainDataList); updateTrainNum(trainDataList);
i = scope.trainList.length; break;
// i = scope.trainList.length;
} }
} }

View File

@ -447,3 +447,7 @@ export const ProjectList = [
{value: 'bjd', label: '北交大'}, {value: 'bjd', label: '北交大'},
{value: 'urtss', label: '陪标项目'} {value: 'urtss', label: '陪标项目'}
]; ];
export const ProjectPostIdMap = {
drts: 1,
bjd: 2
};

View File

@ -5,7 +5,7 @@ export function getBaseUrl() {
BASE_API = 'https://test.joylink.club/jlcloud'; BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.8.107:9000'; // 袁琪 // BASE_API = 'http://192.168.8.107:9000'; // 袁琪
// BASE_API = 'http://192.168.8.129:9000'; // 旭强 // BASE_API = 'http://192.168.8.129:9000'; // 旭强
// BASE_API = 'http://192.168.8.109:9000'; // 张赛 // BASE_API = 'http://192.168.8.119:9000'; // 张赛
// BASE_API = 'http://192.168.8.110:9000'; // 杜康 // BASE_API = 'http://192.168.8.110:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip'; // BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康 // BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康

View File

@ -16,11 +16,11 @@
<Station-Data> <Station-Data>
</Station-Data> </Station-Data>
<div class="menutop"> <!-- <div class="menutop">
<el-button-group> <el-button-group>
<el-button type="primary" @click="switchauto">列车车厢视角</el-button> <el-button type="primary" @click="switchauto">列车车厢视角</el-button>
</el-button-group> </el-button-group>
</div> </div> -->
<div class="menudown"> <div class="menudown">
<el-button-group> <el-button-group>
@ -108,19 +108,6 @@ export default {
} }
}, },
switchauto() {
const routeData = this.$router.resolve({
path:'/jlmap3d/traffictrain',
query:{
mapid:this.$route.query.mapid,
group:this.group,
project: this.project,
noPreLogout: true,
lineCode:this.lineCode
}
});
window.open(routeData.href, '_blank', 'noopener noreferrer');
},
updatestationlist(list) { updatestationlist(list) {
// console.log(list); // console.log(list);
this.value = list[0].name; this.value = list[0].name;

View File

@ -7,7 +7,7 @@
<el-option <el-option
v-for="item in trainlist" v-for="item in trainlist"
:key="item.code" :key="item.code"
:label="item.code" :label="item.text"
:value="item.code" :value="item.code"
/> />
@ -24,7 +24,8 @@
<el-row class="tac"> <el-row class="tac">
<el-col :span="12"> <el-col :span="12">
<el-menu <el-menu
default-active="2" default-active="0"
:default-openeds="openeds"
class="el-menu-vertical-demo datatab" class="el-menu-vertical-demo datatab"
@ -116,6 +117,7 @@ export default {
isActive:0, isActive:0,
localStatic:JL3D_LOCAL_STATIC, localStatic:JL3D_LOCAL_STATIC,
openeds:['2','3','4','5','6','7'],
trunkAssetList:[ trunkAssetList:[
'/trafficplan/trunkhead.png', '/trafficplan/trunkhead.png',
'/trafficplan/trunkbody.png', '/trafficplan/trunkbody.png',
@ -154,13 +156,13 @@ export default {
if (this.loadingProjectList.includes(this.$route.query.project)) { if (this.loadingProjectList.includes(this.$route.query.project)) {
this.$store.dispatch('app/transitionAnimations'); this.$store.dispatch('app/transitionAnimations');
} }
document.querySelector("link[rel*='icon']").href = loginInfo[this.$route.query.project].linkIcon || ProjectIcon[this.$route.query.project]; // document.querySelector("link[rel*='icon']").href = loginInfo[this.$route.query.project].linkIcon || ProjectIcon[this.$route.query.project];
}, },
mounted() { mounted() {
this.init(); this.init();
this.takelist = this.getnum(this.allPassers,6); this.takelist = this.getnum(this.allPassers,6);
console.log(this.takelist); // console.log(this.takelist);
if (this.$route.query.type == 'CCTV') { if (this.$route.query.type == 'CCTV') {
this.isCctv = false; this.isCctv = false;
} }
@ -177,7 +179,7 @@ export default {
this.jl3d = new Jl3dTrafficTrain(dom, this.$route.query.mapid, this.$route.query.group, 'normal'); this.jl3d = new Jl3dTrafficTrain(dom, this.$route.query.mapid, this.$route.query.group, 'normal');
}, },
assetSelect(index){ assetSelect(index){
console.log(index); // console.log(index);
this.isActive=index; this.isActive=index;
this.jl3d.switchcamera(index+''); this.jl3d.switchcamera(index+'');
}, },
@ -197,10 +199,22 @@ export default {
// this.jl3d.updateNowTrainCode(codeData); // this.jl3d.updateNowTrainCode(codeData);
// }, // },
updateTrainList(){ updateTrainList(){
this.trainlist = this.jl3d.getTrainList(); this.trainlist = [];
let newTrainList = this.jl3d.getTrainList();
let newRunList = this.jl3d.getRunList();
for(let i=0;i<newRunList.length;i++){
this.trainlist.push(newTrainList[newRunList[i].code]);
}
// console.log(this.trainlist); // console.log(this.trainlist);
// if(){
//
// }
// // console.log(this.trainlist);
}, },
updateTrainCode(selVal) { updateTrainCode(selVal) {
// console.log(selVal);
// this.jl3d.changeTrain(selVal); // this.jl3d.changeTrain(selVal);
this.isActive=0; this.isActive=0;
this.jl3d.updateNowTrainCode(selVal); this.jl3d.updateNowTrainCode(selVal);

View File

@ -0,0 +1,370 @@
<template>
<el-dialog
id="elDialog"
title="留言板"
:visible.sync="dialogVisible"
fullscreen
:show-close="false"
center
:before-close="handleClose"
>
<el-card class="box-card" style="width: 80%;margin-left: 10%;padding: 20px;margin-bottom: 20px;background-color: rgba(255,255,255,0)">
<div v-if="postCommentList.length">
<template v-for="(item,i) in postCommentList">
<div :key="i" style="border: 1px solid #C0C0C0;border-radius: 5px;margin-bottom: 20px;box-shadow: 2px 2px 3px #808080;padding: 10px 20px;background-color: #fff">
<div style="margin-bottom: 10px;display: flex;align-items: center;">
<img :src="avatarUrl(item)" class="head_portrait">
<div style="display: inline-block;margin-right: 20px;margin-left:10px;font-size: 18px;color: #000;">{{ item.creatorNickName }}</div>
<div style="display: inline-block;">{{ item.createTime }}</div>
</div>
<div style="margin-left: 60px;" v-html="$escapeHTML(`${item.content}`)" />
<div style="width: 100%;display:flex;align-items: center;justify-content: flex-end;">
<!--<img :src="lickIcon" style="width: 20px;height: auto;margin-right: 30px;">-->
<!--<img :src="unlikeIcon" style="width: 20px;height: auto;margin-right: 30px;">-->
<img :src="replyIcon" style="width: 16px;height: auto;margin-right: 30px;cursor: pointer;" @click="replyLeaveMessage(item.id, i)">
<img v-if="userId == item.creatorId || superAdmin" :src="deleteIcon" style="width: 16px;height: auto;cursor:pointer;" @click="deleteMessage(item.id)">
</div>
<div v-if="item.comments && item.comments.total > 0" style="background: #F5F5F5;margin-top: 10px; width: calc(100% - 120px);margin-left: 60px; border-radius: 5px;padding: 1px 10px 10px;">
<div v-if="moreMessageId == item.id">
<template v-for="(elem,j) in allCommentList">
<div :key="j" style="font-size: 14px;margin-top: 10px;">
<span style="margin-right: 5px;">{{ computedCommentName(elem) }}</span>
<span style="margin-right: 15px;">{{ elem.content }}</span>
<span style="margin-right: 10px;">{{ elem.commentTime }}</span>
<span style="color:#409EFF;cursor: pointer;margin-right: 10px;" @click="replyLeaveMessage(item.id, i,elem.id, elem.userNickname)">回复</span>
<span v-if="userId == elem.userId || superAdmin" style="color:#409EFF;cursor: pointer;" type="text" @click="deleteComment(item.id, i, elem.id)">删除</span>
</div>
</template>
</div>
<div v-else>
<template v-for="(elem,j) in item.comments.list">
<div :key="j" style="font-size: 14px;margin-top: 18px;">
<span style="margin-right: 5px;">{{ computedCommentName(elem) }}</span>
<span style="margin-right: 15px;">{{ elem.content }}</span>
<span style="margin-right: 10px;">{{ elem.commentTime }}</span>
<span style="color:#409EFF;cursor: pointer;margin-right: 10px;" @click="replyLeaveMessage(item.id, i,elem.id, elem.userNickname)">回复</span>
<span v-if="userId == elem.userId || superAdmin" style="color:#409EFF;cursor: pointer;" type="text" @click="deleteComment(item.id, i, elem.id)">删除</span>
</div>
</template>
</div>
<div v-if="item.comments.total > 3 && moreMessageId != item.id" style="margin-top: 10px;">
<span class="view_more" @click="viewMoreComment(item)">{{ `${item.comments.total}条回复,点击查看更多>>` }}</span>
</div>
</div>
<div v-if="replyMessageId == item.id" style="width: 80%;margin-left: 10%;text-align: center;">
<el-input :id="'answerInput' + item.id" v-model="commentContent" type="textarea" placeholder="请输入内容" maxlength="300" style="margin-top: 10px;" :autosize="{ minRows: 2, maxRows: 4}" show-word-limit @input="changeCommentContent" />
<div style="margin-top: 10px;">
<el-button type="danger" size="small" @click="commentMessage">回复</el-button>
<el-button size="small" @click="cancelComment">取消</el-button>
</div>
</div>
</div>
</template>
</div>
<div v-else style="text-align: center;width: 100%;height: 50px;line-height: 50px;font-size: 18px;color: #ccc;">
<span>暂无留言</span>
</div>
<div style="width: 100%;text-align: center;">
<el-pagination
:current-page.sync="pageNum"
:page-size="pageSize"
layout="total, prev, pager, next,jumper"
:total="total"
@current-change="handleCurrentChange"
/>
</div>
</el-card>
<quill-editor ref="quillEditor" v-model="content" style="width: 80%;margin-left: 10%;" placeholder="请输入内容" :margin-bottom="20" :unload-img="true" :no-handle-p="true" />
<span id="boardBottom" class="dialog-footer">
<el-button @click="handleClear">清空</el-button>
<el-button type="danger" @click="commitComment">留言</el-button>
<!--<el-button type="danger" @click="dialogVisible = false">返回</el-button>-->
</span>
<el-button size="mini" type="danger" style="position: fixed; right: 100px;top: 80px;width: 90px;" @click="goSlide">我要留言</el-button>
<el-button size="mini" style="position: fixed; right: 100px;top: 120px;width: 90px;" @click="dialogVisible = false">退出留言板</el-button>
<div v-show="imgShow" style="position: fixed;width: 100%;height: 100%;left: 0;top: 0;background: rgba(0,0,0,0.5);cursor: zoom-out;" @click="handelCloseImg">
<img id="targetImg" src="" style="position: fixed;top: 50%;left: 50%;transform: translate(-50%,-50%);min-width: 500px;max-height: 80%;height: auto;">
</div>
</el-dialog>
</template>
<script>
import { answerPost, queryMessagePagingByProjectCode, deleteMessageByAdmin, deleteMessageBySelf, commentLevelMessage, commentComents, queryMessageCommentList, deleteCommentByAdmin, deleteCommentBySelf, getPostByProjectCode } from '@/api/learn';
import lick_icon from '@/assets/like.png';
import unlike_icon from '@/assets/unlike.png';
import reply_icon from '@/assets/reply.png';
import delete_icon from '@/assets/delete.png';
import { superAdmin } from '@/router/index_APP_TARGET';
import { getSessionStorage } from '@/utils/auth';
import { ProjectCode } from '@/scripts/ProjectConfig';
export default {
name: 'MessageBoard',
data() {
return {
dialogVisible: false,
content: '',
postCommentList: [],
pageSize: 10,
pageNum: 0,
total: 0,
imgShow: false,
lickIcon: lick_icon,
unlikeIcon: unlike_icon,
replyIcon: reply_icon,
deleteIcon: delete_icon,
replyMessageId: '',
commentContent: '',
replyCommentId: '',
replyMessageIndex: '',
allCommentList: [],
moreMessageId: '',
replyUserName: '',
commentContentNoName: '',
postId: ''
};
},
computed: {
userId() {
return this.$store.state.user.id;
},
superAdmin() {
return this.$store.state.user.roles.includes(superAdmin);
},
projectCode() {
const project = getSessionStorage('project');
return ProjectCode[project];
}
},
created() {
const that = this;
window.handleZoomImg = function () {
that.imgShow = true;
document.getElementById('targetImg').src = event.target.currentSrc;
};
},
mounted() {
if (this.projectCode === 'DRTS' || this.projectCode === 'BJD') {
getPostByProjectCode(this.projectCode).then(resp => {
this.postId = resp.data.id;
});
}
},
methods: {
handleClose() {
this.dialogVisible = false;
},
doShow() {
this.handleCurrentChange();
this.dialogVisible = true;
},
commitComment() {
const images = this.content.match(/<img/g);
if (images && images.length > 3) {
this.$message.error('留言内容使用图片应小于三张!');
return;
}
if (this.content.length > 1000) {
this.$message.error('留言内容超出最大长度!');
return;
}
if (!this.content) {
this.$message.error('留言内容不能为空!');
return;
}
answerPost({postId: this.postId, content: this.content}).then(resp => {
this.pageNum = 1;
this.handleCurrentChange();
this.content = '';
}).catch(error => {
this.$message.error('留言失败 ');
console.log(error);
});
},
handleCurrentChange() {
queryMessagePagingByProjectCode(this.projectCode, {pageSize: this.pageSize, pageNum: this.pageNum}).then(resp => {
this.postCommentList = [];
(resp.data.list || []).forEach(item => {
const value = item.content.replace(/<img/g, '<img style="width: 100px;height: auto;cursor: zoom-in;" onclick="handleZoomImg()"');
item.content = value;
this.postCommentList.push(item);
});
this.total = resp.data.total;
});
},
goSlide() {
const bottom = document.getElementById('boardBottom');
const element = document.getElementById('elDialog').childNodes[0];
element.scrollTop = bottom.offsetTop;
this.$refs.quillEditor.getFocus();
},
avatarUrl(val) {
if (val && val.creatorAvatarPath) {
return 'https://joylink.club/oss/joylink' + val.creatorAvatarPath;
} else {
return 'https://joylink.club/oss/wxmicro_assistant/userhead/defaultuser.png';
}
},
handleClear() {
this.content = '';
},
handelCloseImg() {
this.imgShow = false;
document.getElementById('targetImg').src = '';
},
replyLeaveMessage(messageId, messageIndex, commentId, userNickname) {
this.cancelComment();
this.replyMessageId = messageId;
this.replyCommentId = commentId;
this.replyMessageIndex = messageIndex;
if (commentId) {
this.replyUserName = '@' + userNickname + ' ';
this.commentContent = this.replyUserName + this.commentContentNoName;
}
this.$nextTick(()=>{
document.getElementById('answerInput' + messageId).focus();
});
},
cancelComment() {
this.replyMessageId = '';
this.commentContent = '';
this.replyCommentId = '';
this.replyMessageIndex = '';
this.replyUserName = '';
this.commentContentNoName = '';
},
commentMessage() {
if (this.replyCommentId) {
commentComents(this.replyMessageId, this.replyCommentId, {content:this.commentContentNoName}).then(resp => {
this.getCommentList(this.replyMessageId, this.replyMessageIndex);
this.cancelComment();
}).catch(error => {
this.$message.error('评论留言失败!');
console.error(error);
});
} else {
commentLevelMessage(this.replyMessageId, {content:this.commentContentNoName}).then(resp => {
this.getCommentList(this.replyMessageId, this.replyMessageIndex);
this.cancelComment();
}).catch(error => {
this.$message.error('评论留言失败!');
console.error(error);
});
}
},
getCommentList(messageId, messageIndex) {
queryMessageCommentList(messageId).then(resp => {
if (this.moreMessageId == messageId) {
this.allCommentList = resp.data;
}
if (resp.data.length > 3) {
this.postCommentList[messageIndex].comments.list = resp.data.slice(0, 3);
this.postCommentList[messageIndex].comments.total = resp.data.length;
} else {
this.postCommentList[messageIndex].comments.list = resp.data;
this.postCommentList[messageIndex].comments.total = resp.data.length;
}
}).catch(error => {
this.$message.error('更新回复失败!');
console.error(error);
});
},
computedCommentName(elem) {
if (elem.replyUserNickName) {
return `${elem.userNickname} 回复@ ${elem.replyUserNickName}`;
} else {
return elem.userNickname + '';
}
},
deleteMessage(messageId) {
if (this.superAdmin) {
deleteMessageByAdmin(messageId).then(resp => {
// this.$message.success('');
this.handleCurrentChange();
}).catch(error => {
this.$message.error('删除留言失败!');
console.error(error);
});
} else {
deleteMessageBySelf(messageId).then(resp => {
// this.$message.success('');
this.handleCurrentChange();
}).catch(error => {
this.$message.error('删除留言失败!');
console.error(error);
});
}
},
deleteComment(messageId, messageIndex, commentId) {
if (this.superAdmin) {
deleteCommentByAdmin(commentId).then(resp => {
this.getCommentList(messageId, messageIndex);
}).catch(error => {
this.$message.error('删除回复失败!');
console.error(error);
});
} else {
deleteCommentBySelf(commentId).then(resp => {
this.getCommentList(messageId, messageIndex);
}).catch(error => {
this.$message.error('删除回复失败!');
console.error(error);
});
}
},
viewMoreComment(data) {
queryMessageCommentList(data.id).then(resp => {
this.allCommentList = resp.data;
this.moreMessageId = data.id;
}).catch(error => {
console.error(error);
});
},
changeCommentContent(val) {
if (this.replyUserName && val.startsWith(this.replyUserName)) {
this.commentContentNoName = val.slice(this.replyUserName.length);
} else if (this.replyUserName) {
this.commentContent = this.replyUserName + this.commentContentNoName;
} else {
this.commentContentNoName = this.commentContent;
}
}
}
};
</script>
<style scoped>
.dialog-footer{
margin: 0 auto;
display: flex;
justify-content: center;
}
.head_portrait{
width: 50px;
height: 50px;
border-radius: 25px;
}
.view_more {
cursor: pointer;
}
.view_more:hover {
cursor: pointer;
color: #409EFF;
}
.img-box{
width: 100px;
height: auto;
}
/deep/ .el-dialog.is-fullscreen{
background-image:url('../../../../assets/bg_board.jpg');
}
/deep/.ql-container{
height: 80%;
}
/deep/.el-dialog__title{
font-size: 30px;
color: #F00;
font-family: 'fangsong';
font-weight: bolder;
}
</style>

View File

@ -4,6 +4,10 @@
<div class="btn_hover" @click="menuClick">菜单</div> <div class="btn_hover" @click="menuClick">菜单</div>
<el-button-group ref="button_group_box" class="button_group_box" :style="`margin-left:-${btnWidth}px`"> <el-button-group ref="button_group_box" class="button_group_box" :style="`margin-left:-${btnWidth}px`">
<!-- 地图错误判断 --> <!-- 地图错误判断 -->
<template v-if="project === 'bjd'">
<el-button v-if="running" size="small" @click="viewRunPlan">{{ $t('joinTraining.runGraphPreview') }}</el-button>
<el-button v-if="!running" size="small" type="warning" @click="loadRunPlan">{{ $t('joinTraining.runGraphLoading') }}</el-button><!-- 运行图加载 -->
</template>
<!-- 设备视图 --> <!-- 设备视图 -->
<el-button v-if="jl3dmodelShow && !isContest && project !== 'bjd'" size="small" @click="jumpjlmap3dmodel">{{ jl3dmodel }}</el-button> <el-button v-if="jl3dmodelShow && !isContest && project !== 'bjd'" size="small" @click="jumpjlmap3dmodel">{{ jl3dmodel }}</el-button>
<!-- 三维视图/数字沙盘 --> <!-- 三维视图/数字沙盘 -->
@ -12,6 +16,8 @@
<el-button v-if="cctvShow && !isContest && project !== 'bjd'" size="small" @click="jumpjl3dpassflow">{{ jl3dpassflow }}</el-button> <el-button v-if="cctvShow && !isContest && project !== 'bjd'" size="small" @click="jumpjl3dpassflow">{{ jl3dpassflow }}</el-button>
<!-- 客流规划视图 --> <!-- 客流规划视图 -->
<el-button v-if="trafficplanShow && !isContest" size="small" @click="jumpjl3dtrafficplan">{{ jl3dtrafficplan }}</el-button> <el-button v-if="trafficplanShow && !isContest" size="small" @click="jumpjl3dtrafficplan">{{ jl3dtrafficplan }}</el-button>
<el-button v-if="trafficplanShow && !isContest" size="small" @click="jumpjl3dtraffictrain">{{ $t('display.demon.traffictraintext') }}</el-button>
<!-- 故障设备视图 --> <!-- 故障设备视图 -->
<el-button v-if="jlmap3dFaultShow" size="small" @click="jumpjlmap3dFault">故障设备</el-button> <el-button v-if="jlmap3dFaultShow" size="small" @click="jumpjlmap3dFault">故障设备</el-button>
<!-- 司机视角 --> <!-- 司机视角 -->
@ -23,11 +29,9 @@
<!-- <el-button v-if="isContest" size="small" @click=" fieldTeach">实操教学</el-button> --> <!-- <el-button v-if="isContest" size="small" @click=" fieldTeach">实操教学</el-button> -->
<!-- <el-button v-if="isContest" size="small" @click=" fieldExam">实操测验</el-button> --> <!-- <el-button v-if="isContest" size="small" @click=" fieldExam">实操测验</el-button> -->
<el-button v-if="isContest" size="small" @click="goTheoryQuiz">理论考试</el-button> <el-button v-if="isContest" size="small" @click="goTheoryQuiz">理论考试</el-button>
<template v-if="project === 'bjd'"> <el-button v-if="project === 'bjd'" size="small" @click="distribute">权限分发</el-button>
<el-button v-if="running" size="small" @click="viewRunPlan">{{ $t('joinTraining.runGraphPreview') }}</el-button> <el-button v-if="isContest || project === 'bjd'" size="small" @click="messageBoardShow">留言板</el-button>
<el-button v-if="!running" size="small" type="warning" @click="loadRunPlan">{{ $t('joinTraining.runGraphLoading') }}</el-button><!-- 运行图加载 --> <el-button v-if="isContest || project === 'bjd'" size="small" @click="contectUs">联系方式</el-button>
<el-button size="small" @click="distribute">权限分发</el-button>
</template>
</el-button-group> </el-button-group>
</div> </div>
<Jl3d-Device <Jl3d-Device
@ -41,6 +45,8 @@
<scheduling v-if="scheduleLoadShow" ref="scheduling" :group="group" /> <scheduling v-if="scheduleLoadShow" ref="scheduling" :group="group" />
<scheduling-view v-if="schedulePreviewShow" ref="schedulingView" :group="group" /> <scheduling-view v-if="schedulePreviewShow" ref="schedulingView" :group="group" />
<qr-code ref="qrCode" /> <qr-code ref="qrCode" />
<message-board ref="messageBoard" />
<contect-us ref="contectUs" />
</div> </div>
</template> </template>
<script> <script>
@ -53,6 +59,8 @@ import SchedulingView from '@/views/newMap/displayNew/demon/schedulingView';
import { EventBus } from '@/scripts/event-bus'; import { EventBus } from '@/scripts/event-bus';
import DistributeDraft from '@/views/components/limits/distribute'; import DistributeDraft from '@/views/components/limits/distribute';
import QrCode from '@/components/QrCode'; import QrCode from '@/components/QrCode';
import MessageBoard from './demon/messageBoard';
import ContectUs from '@/views/newMap/displayNew/dispatherContest/contectUs';
export default { export default {
name:'DemonMenu', name:'DemonMenu',
components:{ components:{
@ -61,7 +69,9 @@ export default {
Scheduling, Scheduling,
SchedulingView, SchedulingView,
DistributeDraft, DistributeDraft,
QrCode QrCode,
ContectUs,
MessageBoard
}, },
props:{ props:{
isAllShow:{ isAllShow:{
@ -213,6 +223,19 @@ export default {
}); });
window.open(routeData.href, '_blank', 'noopener noreferrer'); window.open(routeData.href, '_blank', 'noopener noreferrer');
}, },
jumpjl3dtraffictrain() {
const routeData = this.$router.resolve({
path:'/jlmap3d/traffictrain',
query:{
mapid:this.mapId,
group:this.group,
project: this.project,
noPreLogout: true,
lineCode:this.lineCode
}
});
window.open(routeData.href, '_blank', 'noopener noreferrer');
},
jumpjlmap3dFault() { jumpjlmap3dFault() {
const routeData = this.$router.resolve({ const routeData = this.$router.resolve({
path:'/jlmap3d/maintainer', path:'/jlmap3d/maintainer',
@ -276,6 +299,12 @@ export default {
if (this.$refs) { if (this.$refs) {
this.$refs.distribute.doShow({PermissionType:'03', mapId: this.$route.query.mapId, prdType: this.$route.query.prdType}); this.$refs.distribute.doShow({PermissionType:'03', mapId: this.$route.query.mapId, prdType: this.$route.query.prdType});
} }
},
messageBoardShow() {
this.$refs.messageBoard.doShow();
},
contectUs() {
this.$refs.contectUs.doShow();
} }
} }
}; };

View File

@ -0,0 +1,45 @@
<template>
<el-dialog
title="联系方式"
:visible.sync="dialogVisible"
width="400px"
:before-close="handleClose"
>
<div><span class="el-icon-user" style="font-size:15px;margin-right:8px;" />联系人小九</div>
<div class="eachInfo"><span class="el-icon-mobile-phone" style="font-size:15px;margin-right:7px;" />&nbsp;&nbsp;&nbsp;&nbsp;13289398171</div>
<div class="eachInfo"><span class="el-icon-message" style="font-size:15px;margin-right:7px;" />&nbsp;&nbsp;&nbsp;&nbsp;ServiceEmail@joylink.club</div>
<div class="eachInfo">
<span class="el-icon-chat-round" style="font-size:15px;margin-right:3px;vertical-align:top;" />
<span style="vertical-align: top;">&nbsp;&nbsp;&nbsp;&nbsp;</span>
<img :src="wchatImg" width="80" height="80">
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="dialogVisible = false"> </el-button>
</span>
</el-dialog>
</template>
<script>
import wchat from '@/assets/wchat.png';
export default {
name:'',
data() {
return {
dialogVisible:false,
wchatImg: wchat
};
},
methods:{
handleClose() {
this.dialogVisible = false;
},
doShow() {
this.dialogVisible = true;
}
}
};
</script>
<style lang="scss" scoped>
.eachInfo{
margin-top: 10px;
}
</style>

View File

@ -23,7 +23,6 @@
<el-radio-button :label="scriptModeList.PRACTICE" :disabled="isScriptRun">{{ $t('display.lesson.practiceMode') }}</el-radio-button> <el-radio-button :label="scriptModeList.PRACTICE" :disabled="isScriptRun">{{ $t('display.lesson.practiceMode') }}</el-radio-button>
<el-radio-button :label="scriptModeList.TEST" :disabled="isScriptRun">{{ $t('display.lesson.testMode') }}</el-radio-button> <el-radio-button :label="scriptModeList.TEST" :disabled="isScriptRun">{{ $t('display.lesson.testMode') }}</el-radio-button>
</el-radio-group> </el-radio-group>
<!-- <span v-if="scriptMode === scriptModeList.TEST" class="display-score">{{ $t('display.lesson.score') }}{{ formatScore }}</span> -->
</el-row> </el-row>
</div> </div>
@ -65,8 +64,6 @@
<scene-list ref="sceneList" @selectScript="selectScript" /> <scene-list ref="sceneList" @selectScript="selectScript" />
<theory-exam-select ref="theoryExamSelect" @startTheoryExam="startTheoryExam" /> <theory-exam-select ref="theoryExamSelect" @startTheoryExam="startTheoryExam" />
<theory-exam ref="theoryExam" /> <theory-exam ref="theoryExam" />
<!-- <theory-quiz ref="theoryQuiz" @commitResult="commitResult" />
<throry-result ref="theoryResult" @restart="goTheoryQuiz" /> -->
<select-role ref="selectRole" :member-list="currentPlayList" @selectRole="selectRole" /> <select-role ref="selectRole" :member-list="currentPlayList" @selectRole="selectRole" />
<operational-statistic ref="operationalStatistic" @finishTraining="finishTraining" /> <operational-statistic ref="operationalStatistic" @finishTraining="finishTraining" />
@ -86,10 +83,8 @@ import SceneList from './sceneList';
import MenuSchema from '@/views/newMap/displayNew/menuSchema'; import MenuSchema from '@/views/newMap/displayNew/menuSchema';
import TheoryExamSelect from './theoryExamSelect'; import TheoryExamSelect from './theoryExamSelect';
import TheoryExam from './theoryExam'; import TheoryExam from './theoryExam';
// import TheoryQuiz from './quiz';
// import ThroryResult from './result';
// import { getGoodsTryUse } from '@/api/management/goods'; // import { getGoodsTryUse } from '@/api/management/goods';
import { ranAsPlan, exitRunPlan, clearSimulation, getSimulationInfoNew } from '@/api/simulation'; import {clearSimulation, getSimulationInfoNew } from '@/api/simulation';
// import { PermissionType } from '@/scripts/ConstDic'; // import { PermissionType } from '@/scripts/ConstDic';
// import { getCountTime } from '@/utils/index'; // import { getCountTime } from '@/utils/index';
import { prefixIntrger } from '@/utils/date'; import { prefixIntrger } from '@/utils/date';
@ -116,8 +111,6 @@ export default {
TheoryExam, TheoryExam,
OperationalStatistic, OperationalStatistic,
TestResult, TestResult,
// TheoryQuiz,
// ThroryResult,
SelectRole SelectRole
}, },
props: { props: {
@ -156,7 +149,6 @@ export default {
mapLocation: {}, mapLocation: {},
playerList: [], playerList: [],
currentPlayList: [], currentPlayList: [],
// formatScore: 0,
isGoback: false, isGoback: false,
runing: false, runing: false,
prdTypeMap: { prdTypeMap: {
@ -265,56 +257,14 @@ export default {
this.$refs.setTime.doShow(); this.$refs.setTime.doShow();
}, },
start(model) { // 仿 start(model) { // 仿
const data = { this.$emit('start', model);
time: model.initTime
};
if (this.$route.query.prdType === '04') {
data.loadNumber = model.loadNum;
}
ranAsPlan(data, this.group).then(res => {
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${model.initTime}`));
}).catch(error => {
if (error.code == '5001') {
this.$messageBox(this.$t('error.mapDataError') + '' + this.$t('error.startSimulationFailed'));
} else if (error.code == '5002') {
this.$messageBox(this.$t('error.runningChartDataError') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '5003') {
this.$messageBox(this.$t('error.runningChartIsNotLoaded') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '5004') {
this.$messageBox(this.$t('error.runningDataError') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '5000') {
this.$messageBox(this.$t('error.systemError') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '4000') {
this.$messageBox(this.$t('error.simulationDoesNotExist') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '4001') {
this.$messageBox(this.$t('error.simulationOperationIsNotDefined') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '4002') {
this.$messageBox(this.$t('error.simulationOperationProcessingMethodNotFound') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '4003') {
this.$messageBox(this.$t('error.simulationOperationFailed') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '4004') {
this.$messageBox(this.$t('error.operationConflict') + ',' + this.$t('error.startSimulationFailed'));
} else {
this.$messageBox('按计划行车异常,请退出重试!');
}
});
}, },
setRuning(run) { setRuning(run) {
this.runing = run; this.runing = run;
this.$refs.demonMenu.hideScheduling(run); this.$refs.demonMenu.hideScheduling(run);
}, },
end() { end() {
exitRunPlan(this.group).then(() => { this.$emit('end');
this.$store.dispatch('training/over').then(() => {
this.$store.dispatch('training/setMapDefaultState').then(() => {
this.$store.dispatch('map/resetActiveTrainList', false);
this.$store.dispatch('map/clearJlmapTrainView');
this.$store.dispatch('map/setTrainWindowShow', false);
});
});
}).catch(() => {
this.$messageBox(this.$t('display.demon.endSimulationFail'));
});
}, },
handleQuitQuest() { handleQuitQuest() {
competitionPracticalSceneExit(this.group).then(resp => { competitionPracticalSceneExit(this.group).then(resp => {
@ -411,10 +361,8 @@ export default {
competitionPracticalSceneFinish(this.group, {operationStatisticVO:{}}).then(res=>{ competitionPracticalSceneFinish(this.group, {operationStatisticVO:{}}).then(res=>{
this.isScriptRun = false; this.isScriptRun = false;
// if (this.scriptMode == ScriptMode.TEST) { // if (this.scriptMode == ScriptMode.TEST) {
// this.formatScore = res.data;
this.showResultData(res.data); this.showResultData(res.data);
// this.$store.dispatch('scriptRecord/updateAudioPlay', false); // this.$store.dispatch('scriptRecord/updateAudioPlay', false);
// this.$messageBox('' + this.formatScore);
// } // }
// this.userRole = 'AUDIENCE'; // this.userRole = 'AUDIENCE';
// this.$store.dispatch('training/setRoles', 'AUDIENCE'); // this.$store.dispatch('training/setRoles', 'AUDIENCE');
@ -545,9 +493,6 @@ export default {
this.$refs.operationalStatistic.doShow(res.data); this.$refs.operationalStatistic.doShow(res.data);
}); });
} }
// commitResult(result) {
// this.$refs.theoryResult.doShow(result);
// }
} }
}; };
</script> </script>

View File

@ -1,116 +0,0 @@
<template>
<div class="question">
<div class="ql-editor" v-html="appendIndex($escapeHTML(`${option.topic}`), $vnode.key, option)" />
<template v-if="checkType(option, 'judge')">
<el-radio-group v-model="answer" disabled :class="{'select-box': option.rightAnswer != option.answer}" @change="onChnage">
<el-radio v-for="(el,i) in option.optionList" :key="i" :label="$str2number(el.id)" style="display: inline">
<span>{{ el.content }}</span>
</el-radio>
</el-radio-group>
</template>
<template v-else-if="checkType(option, 'select')">
<el-radio-group v-model="answer" disabled :class="{'select-box': option.rightAnswer != option.answer}" @change="onChnage">
<el-radio v-for="(el,i) in option.optionList" :key="i" :label="$str2number(el.id)" style="display: block">
<span>{{ $asc2chart(i+65) }}. </span>
<div class="ql-editor" style="display: inline; padding: 0" v-html="$escapeHTML(el.content)" />
</el-radio>
</el-radio-group>
</template>
</div>
</template>
<script>
export default {
props: {
value: {
type: String,
default: ''
},
option: {
type: Object,
required: true
}
},
data() {
return {
answer: 0
};
},
watch: {
value(val) {
this.changeValue();
}
},
mounted() {
this.changeValue();
},
methods: {
changeValue() {
this.answer = parseInt(this.value);
},
checkType(option, type) {
return option.type == type;
},
appendIndex(str, index, option) {
let result = '';
const i = option.optionList.findIndex(ele => ele.correct);
if (option.type === 'select') {
if (option.answer == option.optionList[i].id) {
result = `<span style="color: green;margin-left: 10px;">(正确 得分: ${option.score})</span>`;
} else {
result = `<span style="color: red;margin-left: 10px;">(错误 正确答案: ${this.$asc2chart(i + 65)})</span>`;
}
} else if (option.type === 'judge') {
if (option.answer == option.optionList[i].id) {
result = `<span style="color: green;margin-left: 10px;">(正确 得分: ${option.score})</span>`;
} else {
result = `<span style="color: red;margin-left: 10px;">(错误 正确答案: ${option.optionList[i].content})</span>`;
}
}
this.$set(option, 'rightAnswer', option.optionList[i].id);
//
return `${index + 1}. ${str} ${result}`;
},
onChnage(e) {
const answer = `${e}`;
this.$emit('input', answer);
this.$emit('save', {userExamQuestionId: this.option.id, answer: answer});
}
}
};
</script>
<style lang="scss" scoped>
.rich-text {
padding: 0;
display: inline;
}
.question {
/deep/ {
.ql-editor {
line-height: 26px;
padding: 0;
}
.el-radio {
color: #000;
}
.el-radio__label {
font-size: 16px;
line-height: 26px;
}
.el-radio-group .is-disabled .el-radio__label{
color: #333;
}
.select-box.el-radio-group .is-checked.is-disabled .el-radio__label{
color: red;
}
}
}
</style>

View File

@ -1,10 +1,10 @@
<template> <template>
<div> <div>
<el-dialog v-dialogDrag title="场景列表" :visible.sync="dialogVisible" width="920px" center> <el-dialog v-dialogDrag title="场景列表" :visible.sync="dialogVisible" width="920px" center>
<el-tabs v-model="activeName" type="card" style="height:500px"> <el-tabs v-model="activeName" type="card" style="height:650px">
<!-- style="height: 500px;" --> <!-- style="height: 500px;" -->
<el-tab-pane label="主场景列表" name="first"> <el-tab-pane label="主场景列表" name="first">
<el-table :data="mainSceneData" border :span-method="objectSpanMethod" height="436" stripe :cell-style="{padding: '8px 0'}"> <el-table :data="mainSceneData" border :span-method="objectSpanMethod" height="600" stripe :cell-style="{padding: '8px 0'}">
<el-table-column type="index" width="50" label="序号" /> <el-table-column type="index" width="50" label="序号" />
<el-table-column prop="type" width="200" label="类别" /> <el-table-column prop="type" width="200" label="类别" />
<el-table-column prop="scene" width="350" label="场景" /> <el-table-column prop="scene" width="350" label="场景" />
@ -12,9 +12,7 @@
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if="scope.row.result"> <div v-if="scope.row.result">
<template v-for="(each,index) in scope.row.result"> <template v-for="(each,index) in scope.row.result">
<el-tooltip :key="index" class="item" effect="dark" :content="'场景描述: '+ each.description + '\n' + '处置流程: ' +each.disposalProcesses" popper-class="tooltip-box" placement="top"> <el-button type="primary" size="small" style="margin-right: 8px;margin-left: 0;margin-bottom: 5px" @click="handleLoad(each)">{{ each.name }}</el-button>
<el-button type="primary" size="small" style="margin-right: 8px;margin-left: 0;margin-bottom: 5px" @click="handleLoad(each)">{{ each.name }}</el-button>
</el-tooltip>
</template> </template>
</div> </div>
</template> </template>
@ -30,7 +28,7 @@
</el-table-column> --> </el-table-column> -->
</el-table> </el-table>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="副场景列表" name="second"> <!-- <el-tab-pane label="副场景列表" name="second">
<el-table :data="deputySceneData" border stripe> <el-table :data="deputySceneData" border stripe>
<el-table-column type="index" width="50" label="序号" /> <el-table-column type="index" width="50" label="序号" />
<el-table-column prop="scene" width="550" label="场景" /> <el-table-column prop="scene" width="550" label="场景" />
@ -40,7 +38,7 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-tab-pane> </el-tab-pane> -->
</el-tabs> </el-tabs>
</el-dialog> </el-dialog>
</div> </div>
@ -78,17 +76,17 @@ export default {
// {type: '', scene: '', result:[]}, // {type: '', scene: '', result:[]},
{type: '限速', scene: '列车限速', result:[]}, {type: '限速', scene: '列车限速', result:[]},
{type: '轨道故障', scene: '线路故障影响列车运行', result:[]}, {type: '轨道故障', scene: '线路故障影响列车运行', result:[]},
{type: '轨道故障', scene: '计轴故障', result:[]}, {type: '轨道故障', scene: '计轴故障', result:[]}
{type: '在区域控制器故障', scene: '线路故障多车降级', result:[]} // {type: '', scene: '线', result:[]}
],
deputySceneData: [
{ scene: '列车在站停车超时' },
{ scene: '列车无移动授权(站间区间或车站)' },
{ scene: '信号机故障(防护、分界点、出站等)' },
{ scene: '站台门关不上(单个或多个)' },
{ scene: '客流激增行车处置' },
{ scene: '路网协调请求(限流、换乘站通过)' }
] ]
// deputySceneData: [
// { scene: '' },
// { scene: '()' },
// { scene: '()' },
// { scene: '()' },
// { scene: '' },
// { scene: '()' }
// ]
}; };
}, },
mounted() { mounted() {
@ -113,7 +111,7 @@ export default {
} else if (each.name == '场景10') { } else if (each.name == '场景10') {
this.mainSceneData[7].result.push({id:each.id, name:'场景10', description: each.description, disposalProcesses: each.disposalProcesses}); this.mainSceneData[7].result.push({id:each.id, name:'场景10', description: each.description, disposalProcesses: each.disposalProcesses});
} else if (each.name == '场景12') { } else if (each.name == '场景12') {
this.mainSceneData[10].result.push({id:each.id, name:'场景12', description: each.description, disposalProcesses: each.disposalProcesses}); this.mainSceneData[2].result.push({id:each.id, name:'场景12', description: each.description, disposalProcesses: each.disposalProcesses});
} }
}); });
} }

View File

@ -4,11 +4,11 @@
<transition name="el-zoom-in-bottom"> <transition name="el-zoom-in-bottom">
<map-system-draft ref="mapCanvas" @back="back" /> <map-system-draft ref="mapCanvas" @back="back" />
</transition> </transition>
<menu-demon v-if="isDemon" ref="menuDemon" :offset="offset" :offset-bottom="offsetBottom" :data-error="dataError" :text-status-height="textStatusHeight" /> <menu-demon v-if="isDemon" ref="menuDemon" :offset="offset" :offset-bottom="offsetBottom" :data-error="dataError" :text-status-height="textStatusHeight" @start="start" @end="end" />
<menu-lesson v-if="isLesson" ref="lessonMenu" :offset="offset" :data-error="dataError" :offset-bottom="offsetBottom" :tip-bottom="tipBottom" /> <menu-lesson v-if="isLesson" ref="lessonMenu" :offset="offset" :data-error="dataError" :offset-bottom="offsetBottom" :tip-bottom="tipBottom" />
<menu-exam v-if="isExam" ref="menuExam" :offset="offset" :data-error="dataError" :offset-bottom="offsetBottom" /> <menu-exam v-if="isExam" ref="menuExam" :offset="offset" :data-error="dataError" :offset-bottom="offsetBottom" />
<menu-script v-if="isScript" ref="menuScript" :offset-bottom="offsetBottom" :offset="offset" :text-status-height="textStatusHeight" :data-error="dataError" /> <menu-script v-if="isScript" ref="menuScript" :offset-bottom="offsetBottom" :offset="offset" :text-status-height="textStatusHeight" :data-error="dataError" @start="start" @end="end" />
<menu-dispather-contest v-if="isContest" ref="menuDispatherContest" :offset="offset" :offset-bottom="offsetBottom" :data-error="dataError" :text-status-height="textStatusHeight" /> <menu-dispather-contest v-if="isContest" ref="menuDispatherContest" :offset="offset" :offset-bottom="offsetBottom" :data-error="dataError" :text-status-height="textStatusHeight" @start="start" @end="end" />
</template> </template>
<menu-train-list v-if="isDemon||isContest||isScript" @setCenter="setCenter" /> <menu-train-list v-if="isDemon||isContest||isScript" @setCenter="setCenter" />
<menu-system-time ref="menuSystemTime" :offset="offset" :group="group" /> <menu-system-time ref="menuSystemTime" :offset="offset" :group="group" />
@ -19,7 +19,6 @@ import { getSessionStorage } from '@/utils/auth';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { OperateMode } from '@/scripts/ConstDic'; import { OperateMode } from '@/scripts/ConstDic';
import { timeFormat } from '@/utils/date'; import { timeFormat } from '@/utils/date';
import MapSystemDraft from '@/views/newMap/mapsystemNew/index'; import MapSystemDraft from '@/views/newMap/mapsystemNew/index';
import MenuLesson from './lesson/index'; import MenuLesson from './lesson/index';
import MenuDemon from './menuDemon'; import MenuDemon from './menuDemon';
@ -30,7 +29,7 @@ import MenuDispatherContest from './dispatherContest/index';
import MenuTrainList from '@/views/newMap/displayNew/menuTrainList'; import MenuTrainList from '@/views/newMap/displayNew/menuTrainList';
import MenuSystemTime from '@/views/newMap/displayNew/menuSystemTime'; import MenuSystemTime from '@/views/newMap/displayNew/menuSystemTime';
import { clearSimulation, getSimulationInfoNew } from '@/api/simulation'; import { clearSimulation, getSimulationInfoNew, ranAsPlan, exitRunPlan } from '@/api/simulation';
import { loadNewMapDataByGroup } from '@/utils/loaddata'; import { loadNewMapDataByGroup } from '@/utils/loaddata';
import { EventBus } from '@/scripts/event-bus'; import { EventBus } from '@/scripts/event-bus';
@ -238,6 +237,69 @@ export default {
this.$messageBox(`获取地图数据失败: ${error.message}`); this.$messageBox(`获取地图数据失败: ${error.message}`);
this.endViewLoading(); this.endViewLoading();
} }
},
start(model) { // 仿
const data = {
time: model.initTime
};
if (this.$route.query.prdType === '04') {
data.loadNumber = model.loadNum;
}
ranAsPlan(data, this.group).then(res => {
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${model.initTime}`));
}).catch(error => {
let message = '';
switch (error.code) {
case '5001':
message = this.$t('error.mapDataError');
break;
case '5002':
message = this.$t('error.runningChartDataError');
break;
case '5003':
message = this.$t('error.runningChartIsNotLoaded');
break;
case '5004':
message = this.$t('error.runningDataError');
break;
case '5000':
message = this.$t('error.systemError');
break;
case '4000':
message = this.$t('error.simulationDoesNotExist');
break;
case '4001':
message = this.$t('error.simulationOperationIsNotDefined');
break;
case '4002':
message = this.$t('error.simulationOperationProcessingMethodNotFound');
break;
case '4003':
message = this.$t('error.simulationOperationFailed');
break;
case '4004':
message = this.$t('error.operationConflict');
break;
default:
message = '按计划行车异常,请退出重试!';
// this.$messageBox(',退!');
break;
}
this.$messageBox(message + '' + this.$t('error.startSimulationFailed'));
});
},
end() {
exitRunPlan(this.group).then(() => {
this.$store.dispatch('training/over').then(() => {
this.$store.dispatch('training/setMapDefaultState').then(() => {
this.$store.dispatch('map/clearJlmapTrainView');
this.$store.dispatch('map/resetActiveTrainList', false);
this.$store.dispatch('map/setTrainWindowShow', false);
});
});
}).catch(() => {
this.$messageBox(this.$t('display.demon.endSimulationFail'));
});
} }
} }
}; };

View File

@ -59,7 +59,7 @@ import DemonChat from './demonChat';
import { Notification } from 'element-ui'; import { Notification } from 'element-ui';
import MenuSchema from '@/views/newMap/displayNew/menuSchema'; import MenuSchema from '@/views/newMap/displayNew/menuSchema';
import { getGoodsTryUse } from '@/api/management/goods'; import { getGoodsTryUse } from '@/api/management/goods';
import { ranAsPlan, exitRunPlan, getSimulationInfoNew } from '@/api/simulation'; import {getSimulationInfoNew } from '@/api/simulation';
import { PermissionType } from '@/scripts/ConstDic'; import { PermissionType } from '@/scripts/ConstDic';
import { getCountTime } from '@/utils/index'; import { getCountTime } from '@/utils/index';
import { TrainingMode } from '@/scripts/ConstDic'; import { TrainingMode } from '@/scripts/ConstDic';
@ -247,56 +247,14 @@ export default {
this.$refs.setTime.doShow(); this.$refs.setTime.doShow();
}, },
start(model) { // 仿 start(model) { // 仿
const data = { this.$emit('start', model);
time: model.initTime
};
if (this.$route.query.prdType === '04') {
data.loadNumber = model.loadNum;
}
ranAsPlan(data, this.group).then(res => {
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${model.initTime}`));
}).catch(error => {
if (error.code == '5001') {
this.$messageBox(this.$t('error.mapDataError') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '5002') {
this.$messageBox(this.$t('error.runningChartDataError') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '5003') {
this.$messageBox(this.$t('error.runningChartIsNotLoaded') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '5004') {
this.$messageBox(this.$t('error.runningDataError') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '5000') {
this.$messageBox(this.$t('error.systemError') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '4000') {
this.$messageBox(this.$t('error.simulationDoesNotExist') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '4001') {
this.$messageBox(this.$t('error.simulationOperationIsNotDefined') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '4002') {
this.$messageBox(this.$t('error.simulationOperationProcessingMethodNotFound') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '4003') {
this.$messageBox(this.$t('error.simulationOperationFailed') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '4004') {
this.$messageBox(this.$t('error.operationConflict') + ',' + this.$t('error.startSimulationFailed'));
} else {
this.$messageBox('按计划行车异常,请退出重试!');
}
});
}, },
setRuning(run) { setRuning(run) {
this.runing = run; this.runing = run;
this.$refs.demonMenu.hideScheduling(run); this.$refs.demonMenu.hideScheduling(run);
}, },
end() { end() {
exitRunPlan(this.group).then(() => { this.$emit('end');
this.$store.dispatch('training/over').then(() => {
this.$store.dispatch('training/setMapDefaultState').then(() => {
this.$store.dispatch('map/resetActiveTrainList', false);
this.$store.dispatch('map/clearJlmapTrainView');
this.$store.dispatch('map/setTrainWindowShow', false);
});
});
}).catch(() => {
this.$messageBox(this.$t('display.demon.endSimulationFail'));
});
}, },
handleQuitQuest() { handleQuitQuest() {
quitScriptNew(this.group).then(resp => { quitScriptNew(this.group).then(resp => {

View File

@ -55,7 +55,6 @@ import DemonMenu from '@/views/newMap/displayNew/demonMenu';
import TipScriptRecordNew from '@/views/scriptManage/tipScriptRecord'; import TipScriptRecordNew from '@/views/scriptManage/tipScriptRecord';
import SetTime from '@/views/newMap/displayNew/demon/setTime'; import SetTime from '@/views/newMap/displayNew/demon/setTime';
import { Notification } from 'element-ui'; import { Notification } from 'element-ui';
import { ranAsPlan, exitRunPlan } from '@/api/simulation';
import { getSimulationMemberList} from '@/api/simulation'; import { getSimulationMemberList} from '@/api/simulation';
import ChatBox from '@/views/newMap/chatView/chatBox.vue'; import ChatBox from '@/views/newMap/chatView/chatBox.vue';
@ -179,47 +178,10 @@ export default {
this.$refs.setTime.doShow(); this.$refs.setTime.doShow();
}, },
start(model) { start(model) {
const data = { this.$emit('start', model);
time: model.initTime
};
ranAsPlan(data, this.group).then(res => {
this.$store.dispatch('training/setInitTime', +new Date(`${new Date().toLocaleDateString()} ${model.initTime}`));
}).catch((error) => {
if (error.code == '5001') {
this.$messageBox(this.$t('error.mapDataError') + '' + this.$t('error.startSimulationFailed'));
} else if (error.code == '5002') {
this.$messageBox(this.$t('error.runningChartDataError') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '5003') {
this.$messageBox(this.$t('error.runningChartIsNotLoaded') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '5004') {
this.$messageBox(this.$t('error.runningDataError') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '5000') {
this.$messageBox(this.$t('error.systemError') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '4000') {
this.$messageBox(this.$t('error.simulationDoesNotExist') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '4001') {
this.$messageBox(this.$t('error.simulationOperationIsNotDefined') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '4002') {
this.$messageBox(this.$t('error.simulationOperationProcessingMethodNotFound') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '4003') {
this.$messageBox(this.$t('error.simulationOperationFailed') + ',' + this.$t('error.startSimulationFailed'));
} else if (error.code == '4004') {
this.$messageBox(this.$t('error.operationConflict') + ',' + this.$t('error.startSimulationFailed'));
}
});
}, },
end() { end() {
exitRunPlan(this.group).then(() => { this.$emit('end');
this.$store.dispatch('training/over').then(() => {
this.$store.dispatch('training/setMapDefaultState').then(() => {
this.$store.dispatch('map/clearJlmapTrainView');
this.$store.dispatch('map/resetActiveTrainList', false);
this.$store.dispatch('map/setTrainWindowShow', false);
});
});
}).catch(() => {
this.$messageBox(this.$t('display.demon.endSimulationFail'));
});
}, },
back() { back() {
history.go(-1); history.go(-1);

View File

@ -14,6 +14,7 @@
<el-button v-if="isShowScheduling || isStationSupervisor" size="small" @click="jumpjl3dpassflow">{{ $t('display.demon.passengerflow') }}</el-button> <el-button v-if="isShowScheduling || isStationSupervisor" size="small" @click="jumpjl3dpassflow">{{ $t('display.demon.passengerflow') }}</el-button>
<!-- 客流规划视图 --> <!-- 客流规划视图 -->
<el-button v-if="isShowScheduling || isStationSupervisor" size="small" @click="jumpjl3dtrafficplan">{{ $t('display.demon.trafficplantext') }}</el-button> <el-button v-if="isShowScheduling || isStationSupervisor" size="small" @click="jumpjl3dtrafficplan">{{ $t('display.demon.trafficplantext') }}</el-button>
<el-button v-if="isShowScheduling || isStationSupervisor" size="small" @click="jumpjl3dtraffictrain">{{ $t('display.demon.traffictraintext') }}</el-button>
<el-button v-if="(isShowScheduling || isStationSupervisor)&&project !== 'bjd'" size="small" @click="jumpjl3dfaultdevice">{{ $t('display.demon.maintainer') }}</el-button> <el-button v-if="(isShowScheduling || isStationSupervisor)&&project !== 'bjd'" size="small" @click="jumpjl3dfaultdevice">{{ $t('display.demon.maintainer') }}</el-button>
<!-- <el-button v-if="isAdmin" size="small" @click="otherVrView">VR第三人称视角</el-button> --> <!-- <el-button v-if="isAdmin" size="small" @click="otherVrView">VR第三人称视角</el-button> -->
@ -374,17 +375,30 @@ export default {
this.$emit('passflow'); this.$emit('passflow');
}, },
jumpjl3dtrafficplan() { jumpjl3dtrafficplan() {
const routeData = this.$router.resolve({ const routeData = this.$router.resolve({
path:'/jlmap3d/trafficplan', path:'/jlmap3d/trafficplan',
query:{ query:{
mapid:this.mapId, mapid:this.mapId,
group:this.group, group:this.group,
project: this.project, project: this.project,
noPreLogout: true, noPreLogout: true,
lineCode:this.lineCode lineCode:this.lineCode
} }
}); });
window.open(routeData.href, '_blank', 'noopener noreferrer'); window.open(routeData.href, '_blank', 'noopener noreferrer');
},
jumpjl3dtraffictrain() {
const routeData = this.$router.resolve({
path:'/jlmap3d/traffictrain',
query:{
mapid:this.mapId,
group:this.group,
project: this.project,
noPreLogout: true,
lineCode:this.lineCode
}
});
window.open(routeData.href, '_blank', 'noopener noreferrer');
}, },
jumpjl3dfaultdevice() { jumpjl3dfaultdevice() {
this.$emit('faultdevice'); this.$emit('faultdevice');

View File

@ -3,22 +3,16 @@
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" /> <data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button> <el-button type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
<el-button @click="dialogVisible = false">{{ $t('global.cancel') }}</el-button> <el-button @click="handleClose">{{ $t('global.cancel') }}</el-button>
</span> </span>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { create, checkDicCodeExist, getData, update } from '@/api/management/dictionary'; import { create, checkDicCodeExist, update } from '@/api/management/dictionary';
import { validateCharCode } from '@/utils/validate'; import { validateCharCode } from '@/utils/validate';
export default { export default {
name: 'DictionaryEdit', name: 'DictionaryEdit',
props: {
type: {
type: String,
required: true
}
},
data() { data() {
return { return {
dialogVisible: false, dialogVisible: false,
@ -27,16 +21,17 @@ export default {
name: '', name: '',
status: '1', status: '1',
remarks: '' remarks: ''
} },
title:'',
isAdd:false
}; };
}, },
computed: { computed: {
form() { form() {
const isAdd = this.type === 'ADD';
const form = { const form = {
labelWidth: '60px', labelWidth: '60px',
items: [ items: [
{ prop: 'code', label: this.$t('system.code'), type: 'text', required: true, disabled: !isAdd }, { prop: 'code', label: this.$t('system.code'), type: 'text', required: true, disabled: !this.isAdd },
{ prop: 'name', label: this.$t('system.name'), type: 'text', required: true }, { prop: 'name', label: this.$t('system.name'), type: 'text', required: true },
{ {
prop: 'status', label: this.$t('system.status'), type: 'select', required: true, options: this.$ConstSelect.Status prop: 'status', label: this.$t('system.status'), type: 'select', required: true, options: this.$ConstSelect.Status
@ -58,8 +53,9 @@ export default {
remarks: [ remarks: [
{ max: 50, message: this.$t('rules.strLengthNotExceed50'), trigger: 'blur' } { max: 50, message: this.$t('rules.strLengthNotExceed50'), trigger: 'blur' }
] ]
}; };
if (this.type === 'ADD') { if (this.isAdd) {
return Object.assign(crules, { return Object.assign(crules, {
code: [ code: [
{ required: true, message: this.$t('rules.pleaseInputCode'), trigger: 'blur' }, { required: true, message: this.$t('rules.pleaseInputCode'), trigger: 'blur' },
@ -70,13 +66,6 @@ export default {
} else { } else {
return crules; return crules;
} }
},
title() {
if (this.type === 'ADD') {
return this.$t('system.createDirectory');
} else {
return this.$t('system.editDictionary');
}
} }
}, },
methods: { methods: {
@ -95,19 +84,30 @@ export default {
}); });
} }
}, },
show(id) { doShow(row) {
this.dialogVisible = true; if (row) {
if (id) { this.title = this.$t('system.editDictionary');
getData(id).then(response => { this.isAdd = false;
this.formModel = response.data; this.formModel = row;
this.$refs.dataform.resetForm(); } else {
}); this.title = this.$t('system.createDirectory');
this.isAdd = true;
this.formModel = {
code: '',
name: '',
status: '1',
remarks: ''
};
} }
this.dialogVisible = true;
this.$nextTick(()=>{
this.$refs.dataform.clearValidate();
});
}, },
doSave() { doSave() {
const self = this; const self = this;
this.$refs.dataform.validateForm(() => { this.$refs.dataform.validateForm(() => {
if (self.type === 'ADD') { if (self.isAdd) {
self.create(); self.create();
} else { } else {
self.update(); self.update();
@ -134,19 +134,8 @@ export default {
self.$message.error(`${this.$t('error.updateDictionaryFailed')}:${error.message}`); self.$message.error(`${this.$t('error.updateDictionaryFailed')}:${error.message}`);
}); });
}, },
handleClose(done) { handleClose() {
this.formModel = { this.dialogVisible = false;
code: '',
name: '',
status: '1',
remarks: ''
};
this.$refs.dataform.resetForm();
if (done) {
done();
} else {
this.dialogVisible = false;
}
} }
} }
}; };

View File

@ -1,8 +1,7 @@
<template> <template>
<div> <div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" /> <QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<dictionary-edit ref="create" type="ADD" @reloadTable="reloadTable" /> <dictionary-edit ref="edit" @reloadTable="reloadTable" />
<dictionary-edit ref="edit" type="EDIT" @reloadTable="reloadTable" />
</div> </div>
</template> </template>
@ -104,11 +103,11 @@ export default {
}, },
handleEdit(index, row) { handleEdit(index, row) {
this.$refs.edit.show(row.id); this.$refs.edit.doShow(row);
}, },
handleAdd() { handleAdd() {
this.$refs.create.show(); this.$refs.edit.doShow();
}, },
handleBatchDelete() { handleBatchDelete() {