This commit is contained in:
zyy 2020-06-23 11:24:18 +08:00
commit 5984d0c7ac
3 changed files with 63 additions and 8 deletions

View File

@ -11,6 +11,7 @@ const scriptRecord = {
isScriptCommand:false, // 当前是否为添加剧本动作指令状态
scriptCommand:{}, // 剧本动作添加的指令
updateRoleStatus:0, // 剧本更新角色标志
updateCoversitionStatus:0, // 剧本仿真更新会话信息
userRole:null // 剧本更新的角色
},
getters: {
@ -58,6 +59,9 @@ const scriptRecord = {
updateRole:(state, userRole) => {
state.updateRoleStatus += 1;
state.userRole = userRole;
},
updateCoversitionInfo:(state) => {
state.updateCoversitionStatus += 1;
}
},
actions: {
@ -84,6 +88,9 @@ const scriptRecord = {
},
updateRole:({ commit }, userRole) => {
commit('updateRole', userRole);
},
updateCoversitionInfo:({ commit }) => {
commit('updateCoversitionInfo');
}
}
};

View File

@ -54,6 +54,9 @@ export default {
}
}
},
'$store.state.scriptRecord.updateCoversitionStatus':function (val) {
this.inintData();
},
$route() {
this.inintData();
},

View File

@ -22,7 +22,8 @@
<!-- <span>{{ $t('scriptRecord.speakTo') }}</span> -->
<!-- <span class="roleClass">{{ actionInfo.targetName }}</span> -->
<span>: </span>
<span>{{ actionInfo.reply }}</span>
<span v-if="!isModify">{{ actionInfo.reply }}</span>
<textarea v-else v-model="modifyText" type="text" class="modifyText" />
</span>
<span v-else>
<span class="roleClass">{{ actionInfo.memberName }}</span>
@ -31,7 +32,9 @@
</span>
</div>
<div class="btnGroup">
<!-- <el-button v-if="actionInfo.visible" type="primary" size="mini" style="margin-left:10px;" @click="modifyAction(actionInfo.row)">{{ $t('scriptRecord.modifyConversitionButton') }}</el-button> -->
<el-button v-if="actionInfo.visible && !isModify" type="primary" size="mini" style="margin-left:10px;" @click="modifyAction(actionInfo.row)">{{ $t('scriptRecord.modifyConversitionButton') }}</el-button>
<el-button v-if="actionInfo.visible && isModify" :loading="modifyTextLoading" type="danger" size="mini" style="margin-left:10px;" @click="confirmModify(actionInfo.row)">确定</el-button>
<el-button v-if="actionInfo.visible && isModify" type="" size="mini" style="margin-left:10px;" @click="cancleModify">取消</el-button>
<!-- <el-button type="danger" size="mini" @click="deleteAction(actionInfo.id)">删除</el-button> -->
</div>
</el-card>
@ -41,9 +44,9 @@
</template>
<script>
import Cookies from 'js-cookie';
import {getScriptAllAction, getScriptMemberDataNew } from '@/api/simulation';
import {getScriptAllAction, getScriptMemberDataNew, modifyScriptActionNew } from '@/api/simulation';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import CommandHandler from '@/scripts/cmdPlugin/CommandHandler';
// import CommandHandler from '@/scripts/cmdPlugin/CommandHandler';
import ConstConfig from '@/scripts/ConstConfig';
export default {
name: 'GetActionNew',
@ -64,6 +67,9 @@ export default {
memberVOList:[],
reverse: false,
loading: true,
isModify:false,
modifyText:'',
modifyTextLoading:false,
// behaviorName:"",
memberName: ''
};
@ -180,10 +186,37 @@ export default {
},
reloadTable() {
this.loadInitData();
},
modifyAction(row) {
this.modifyText = row.content;
this.isModify = true;
},
cancleModify() {
this.modifyText = '';
this.isModify = false;
this.modifyTextLoading = false;
},
confirmModify(row) {
if (this.modifyText != row.content) {
const data = {id:row.id};
data.content = this.modifyText;
this.modifyTextLoading = true;
modifyScriptActionNew(this.group, data).then(response=>{
this.modifyText = '';
this.isModify = false;
this.modifyTextLoading = false;
this.reloadTable();
this.$store.dispatch('scriptRecord/updateCoversitionInfo');
});
} else {
if (!this.modifyText) {
this.$messageBox('请输入修改的会话');
} else {
this.modifyText = '';
this.isModify = false;
}
}
}
// modifyAction(row) {
// this.$emit('setAction', row);
// }
}
};
</script>
@ -196,7 +229,7 @@ export default {
line-height: 200%;
}
.btnGroup{
padding: 10px 10px 10px 10px;
padding: 0px 10px 10px 10px;
float: right;
vertical-align: top;
display: inline-block;
@ -224,4 +257,16 @@ export default {
margin-top: 0px;
font-size:13px;
}
.modifyText{
height: 70px;
border: 1px #ccc solid;
border-radius: 3px;
width: 270px;
outline: none;
font-size: 13px;
resize: none;
vertical-align: top;
padding: 5px;
line-height: 20px;
}
</style>