rt-sim-training-client/src/views/trainingManage/editOperate.vue

145 lines
4.2 KiB
Vue
Raw Normal View History

2022-08-29 11:06:11 +08:00
<template>
<div>
<div class="editContentTab">
<div v-if="dialogVisible" class="editContentTabLable" @click="minisize">
<span class="titleStyle">{{ $t('trainingManage.editTagTitle') }}</span>
</div>
</div>
<el-dialog :title="title" :visible.sync="dialogVisible" width="500" :modal="false" :close-on-click-modal="false" :show-close="false" center style="margin-left: 200px">
<el-row style="font-size: 16px;padding: 5px;">
<el-col :span="4">步骤描述</el-col>
<el-col :span="20">{{ stepDetail.description }}</el-col>
</el-row>
<el-row style="font-size: 16px;padding: 5px;overflow: hidden;word-wrap: break-word;">
<el-col :span="4">操作详情</el-col>
<el-col :span="20">
<!-- <div v-for="item in stepDetail.operations" :key="item">
<div>{{ item }}</div>
</div>-->
<template v-for="(item, index) in stepDetail.operations">
<div :key="index">
<el-tag closable @close="deleteOperation(index)">
{{ covertString(item) }}
</el-tag>
</div>
</template>
</el-col>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button size="small" type="success" @click="backStepList">返回步骤列表</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default {
name: 'EditOperate',
data() {
return {
2022-08-30 09:30:27 +08:00
title: '编辑操作',
2022-08-29 11:06:11 +08:00
dialogVisible: false,
dialogWidth: 500,
stepDetail: {
id: '',
description: '',
operations: []
}
};
},
watch: {
'$store.state.trainingNew.trainingOperate': function (val) {
if (val && this.dialogVisible) {
const data = {
deviceCode: val.code || '',
userOperationType: val.userOperationType || '',
domId: val.operation || '',
operationType: val.cmdType ? val.cmdType.value : '',
params: val.params || {},
t: 'C'
};
this.stepDetail.operations.push(data);
}
}
},
methods: {
doShow(data) {
if (data) {
this.stepDetail.id = data.id;
this.stepDetail.description = data.description;
this.stepDetail.operations = data.operations || [];
this.dialogVisible = true;
}
},
minisize() {
this.dialogVisible = true;
},
deleteOperation(index) {
this.stepDetail.operations.splice(index, 1);
},
backStepList() {
2022-08-30 09:30:27 +08:00
this.$emit('backStepList', this.stepDetail);
this.dialogVisible = false;
2022-08-29 11:06:11 +08:00
this.stepDetail = {
id: '',
description: '',
operations: []
};
},
covertString(data) {
// const datate = {
// deviceCode: '',
// userOperationType: '',
// domId: '',
// operationType: '',
// params: ''
// };
const userOperationTypeMap = {
rightClick: '右键点击',
leftClick: '左键点击',
chooseValue: '选择',
fillValue: '填写'
};
if (userOperationTypeMap[data.userOperationType]) {
return userOperationTypeMap[data.userOperationType] + data.domId;
} else {
return data.domId;
}
}
}
};
</script>
<style scoped>
/deep/ .el-dialog__wrapper {
width: 1px;
height: 1px;
top: auto;
right: auto;
bottom: auto;
left: auto;
overflow: visible !important;
}
/deep/ .el-dialog--center{
width: 600px;
}
.editContentTab{
position: absolute;
z-index: 10;
right: 12px;
top: calc(45% + 100px);
}
.editContentTabLable{
position: absolute;
background: #fff;
border-radius: 5px 0px 0px 5px ;
padding: 5px 0px;
width: 23px;
text-align: center;
left: 50%;
transform: translateX(-50%);
cursor: pointer;
top:-28px;
}
</style>