diff --git a/src/api/simulation.js b/src/api/simulation.js index 43ecc026c..be1d41e60 100644 --- a/src/api/simulation.js +++ b/src/api/simulation.js @@ -385,6 +385,15 @@ export function modifyScriptAction(group, actionId, data) { }); } +/** 修改剧本动作(新版) */ +export function modifyScriptActionNew(group, data) { + return request({ + url: `/api/scriptSimulation/${group}/action/update`, + method: 'put', + data + }); +} + /** 分页查询存在的仿真 */ export function getExistingSimulation(params) { return request({ @@ -709,3 +718,4 @@ export function getMemberInfo(group, memberId) { method: 'get' }); } + diff --git a/src/views/scriptManage/scriptRecord/addAction.vue b/src/views/scriptManage/scriptRecord/addAction.vue index 66bb76afc..46d315955 100644 --- a/src/views/scriptManage/scriptRecord/addAction.vue +++ b/src/views/scriptManage/scriptRecord/addAction.vue @@ -75,7 +75,7 @@ import Vue from 'vue'; import Cookies from 'js-cookie'; import ConstConfig from '@/scripts/ConstConfig'; import CommandOperation from './command'; -import {addScriptAction, addScriptActionNew, modifyScriptAction, getAvailableDeviceCommand, getScriptPlayMember, getScriptPlayMemberNew} from '@/api/simulation'; +import {addScriptAction, addScriptActionNew, modifyScriptAction, modifyScriptActionNew, getAvailableDeviceCommand, getScriptPlayMember, getScriptPlayMemberNew} from '@/api/simulation'; export default { name: 'AddAction', components:{ @@ -451,20 +451,39 @@ export default { } else { const actionId = this.modalData.actionVO.id; - modifyScriptAction(group, actionId, data).then(response=>{ - this.modifying = false; - this.isNotModify = true; - this.$emit('setDisabled', this.isNotModify); - this.buttonName = this.$t('scriptRecord.addConversitionButton'); - this.operateType = 'add'; - this.$message.success(this.$t('scriptRecord.modifyConversitionSuccess')); - this.$emit('create'); - // this.$parent.$parent.$refs['addRole'].resetData([this.modalData.action.memberId,this.modalData.action.targetId]); - this.initActionData(); - }).catch(error => { - this.modifying = false; - this.$messageBox(`${this.$t('scriptRecord.modifyConversitionFail')}: ${error.message}`); - }); + if (this.drawWay) { + data.id = actionId; + modifyScriptActionNew(group, data).then(response=>{ + this.modifying = false; + this.isNotModify = true; + this.$emit('setDisabled', this.isNotModify); + this.buttonName = this.$t('scriptRecord.addConversitionButton'); + this.operateType = 'add'; + this.$message.success(this.$t('scriptRecord.modifyConversitionSuccess')); + this.$emit('create'); + // this.$parent.$parent.$refs['addRole'].resetData([this.modalData.action.memberId,this.modalData.action.targetId]); + this.initActionData(); + }).catch(error => { + this.modifying = false; + this.$messageBox(`${this.$t('scriptRecord.modifyConversitionFail')}: ${error.message}`); + }); + } else { + modifyScriptAction(group, actionId, data).then(response=>{ + this.modifying = false; + this.isNotModify = true; + this.$emit('setDisabled', this.isNotModify); + this.buttonName = this.$t('scriptRecord.addConversitionButton'); + this.operateType = 'add'; + this.$message.success(this.$t('scriptRecord.modifyConversitionSuccess')); + this.$emit('create'); + // this.$parent.$parent.$refs['addRole'].resetData([this.modalData.action.memberId,this.modalData.action.targetId]); + this.initActionData(); + }).catch(error => { + this.modifying = false; + this.$messageBox(`${this.$t('scriptRecord.modifyConversitionFail')}: ${error.message}`); + }); + } + } } else { console.log('error submit!!'); diff --git a/src/views/scriptManage/scriptRecord/getAction.vue b/src/views/scriptManage/scriptRecord/getAction.vue index 3de960ade..0d78946cd 100644 --- a/src/views/scriptManage/scriptRecord/getAction.vue +++ b/src/views/scriptManage/scriptRecord/getAction.vue @@ -20,7 +20,7 @@
- {{ $t('scriptRecord.modifyConversitionButton') }} + {{ $t('scriptRecord.modifyConversitionButton') }}
@@ -158,8 +158,8 @@ export default { // memberVOList = memberVOList.replace(new RegExp(rolename, 'g'), element.label); // }); // memberVOList = JSON.parse(memberVOList); - const lastData = JSON.stringify(response.data); - const memberVOList = this.covert(lastData, ConstConfig.ConstSelect.roleTypeNew); + const lastData = JSON.stringify(response.data.memberVOList); + const memberVOList = this.covert(lastData, ConstConfig.ConstSelect.roleType); const actionList = response.data.actionVOList; @@ -218,9 +218,7 @@ export default { this.loadInitData(); }, modifyAction(row) { - if (!this.drawWay) { - this.$emit('setAction', row); - } + this.$emit('setAction', row); } } };