rt-sim-training-client/src/views/scriptManage/home.vue

223 lines
6.8 KiB
Vue
Raw Normal View History

2019-07-26 13:32:43 +08:00
<template>
<el-card :style="{height: height+'px'}">
2019-09-26 09:07:19 +08:00
<el-table
:data="tableData"
stripe
border
style="width: 90%;margin-left:5%;margin-top:20px;">
<el-table-column
type="index"
width="150">
</el-table-column>
<el-table-column
prop="name"
:label="$t('scriptRecord.scriptName')"
width="300">
</el-table-column>
<el-table-column
prop="description"
:label="$t('scriptRecord.scriptDescription')"
width="400">
</el-table-column>
<el-table-column
label="操作"
>
<el-button size="small" type="success" @click="drawUp">{{$t('scriptRecord.scriptRecord')}}</el-button>
<el-button size="small" type="primary" @click="modifyScript">{{$t('scriptRecord.scriptModify')}}</el-button>
<el-button size="small" type="danger" @click="deleteScript">{{$t('scriptRecord.scriptDelete')}}</el-button>
</el-table-column>
</el-table>
<!-- <create-script ref='createScript' @reloadTable="reloadTable" @create="handleConfirmCreate" title="创建脚本">
</create-script>
<create-script ref='modifyScript' @reloadTable="reloadTable" @create="handleConfirmModify" title="修改脚本">
</create-script> -->
<!-- <div class="home-box">
<el-card class="box-card">
2019-09-10 16:14:54 +08:00
<div id="scriptTitle">{{ $t('scriptRecord.createScript') }}</div>
<div id="sciptForm">
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
2019-08-15 14:06:53 +08:00
</div>
<div id="btnList">
<span slot="footer" class="btn-footer">
2019-09-10 16:14:54 +08:00
<el-button type="primary" :loading="loading" @click="doCreate">{{$t('scriptRecord.submit')}}</el-button>
</span>
</div>
</el-card>
2019-09-26 09:07:19 +08:00
</div> -->
</el-card>
2019-07-26 13:32:43 +08:00
</template>
<script>
import { UrlConfig } from '@/router/index';
2019-09-26 09:07:19 +08:00
// import {listPublishMap} from '@/api/jmap/map';
import { getQuestPageList,createQuest,deleteQuest,updateQuest} from '@/api/quest';
// import {createQuest} from '@/api/quest';
2019-07-26 13:32:43 +08:00
export default {
name: 'ScriptDraft',
data() {
return {
2019-09-26 09:07:19 +08:00
tableData:[],
// queryList: {
// actions: [
// { text: '创建', btnCode: 'employee_insert', handler: this.handleCreate }
// ]
// },
// loading: false,
// mapList: [],
// taskStatusList: [],
// disabled: true,
// formModel: {
// name: '',
// mapId: '',
// description: ''
// },
// isShow: false
};
},
computed: {
height() {
return this.$store.state.app.height - 50;
}
},
watch: {
2019-09-26 09:07:19 +08:00
// '$store.state.scriptRecord.scriptId': function (val) {
// this.formModel.mapId=val;
// }
},
mounted() {
this.loadInitData();
},
methods: {
2019-09-26 09:07:19 +08:00
loadInitData(){
this.getQuestPageList(this.$route.params.mapId,)
},
2019-09-26 09:07:19 +08:00
async getQuestPageList(id){
let response=await getQuestPageList(id);
this.tableData=response.data;
},
// // 确定创建
// handleConfirmCreate(data) {
// createQuest(data).then(resp => {
// this.reloadTable();
// this.$message.success('创建剧本成功');
// }).catch(error => {
// this.$messageBox(`创建剧本失败: ${error.message}`);
// })
// },
// //修改
// handleModify(index, row){
// this.$refs.modifyScript.doShow(row.id);
// },
// //确认修改
// handleConfirmModify(data){
// updateQuest(data.id,data).then(resp => {
// this.reloadTable();
// this.$message.success('修改剧本成功');
// }).catch(error => {
// this.$messageBox(`修改剧本失败: ${error.message}`);
// })
// },
// // 创建
// handleCreate(index, row) {
// this.$refs.createScript.doShow(null);
// },
// // 录制
// handleRecord(index, row) {
// scriptRecordNotify(row.id).then(resp => {
// let query = { skinStyle: row.skinCode, group: resp.data, scriptId: row.id };
// this.$router.push({ path: `${UrlConfig.display}/script`, query });
// launchFullscreen();
// }).catch(error => {
// this.$messageBox(`创建仿真失败: ${error.message}`);
// })
// },
// // 删除
// handleDelete(index, row) {
// this.$confirm('此操作将删除此剧本脚本, 是否继续?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(() => {
// deleteQuest(row.id).then(response => {
// this.$message.success('删除成功')
// this.reloadTable()
// }).catch(error => {
// this.reloadTable()
// if (error.code == 500) {
// this.$messageBox('删除失败')
// } else if (error.code == 500009) {
// this.$messageBox('该模板已被加载计划使用,无法删除')
// }
// })
// }).catch(() => { })
// },
// reloadTable() {
// this.queryList.reload()
// }
// loadInitData() {
// this.mapList = [];
// listPublishMap().then(response => {
// this.mapList = response.data.map(elem => { return { value: elem.id, label: elem.name }; });
// this.formModel.mapId=this.$store.state.scriptRecord.scriptId|| this.mapList[0].value;
// });
// },
// doCreate() {
// const self = this;
// if (!this.loading) {
// this.$refs.dataform.validateForm(() => {
// this.loading=true;
// const data=this.formModel;
// createQuest(data).then(resp => {
// const data={mapId: self.formModel.mapId, scriptId: resp.data};
// this.$emit('refresh', data);
// this.$message.success(this.$t('scriptRecord.createScriptSuccess'));
2019-09-10 17:32:41 +08:00
2019-09-26 09:07:19 +08:00
// this.formModel={};
// this.loading=false;
// this.$router.push({ path: `${UrlConfig.script.detail}/${resp.data}` });
// }).catch(error => {
// this.loading=false;
// this.$messageBox(`${$t('scriptRecord.createScriptFail')}${error.message}`);
// });
// });
// }
// }
}
};
2019-08-15 09:04:17 +08:00
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.home-box {
2019-08-15 14:06:53 +08:00
padding: 20px 100px;
2019-08-15 09:04:17 +08:00
float: left;
width: 100%;
font-family: 'Microsoft YaHei';
}
2019-08-15 14:06:53 +08:00
.box-card {
width:800px;
margin: 0 auto;
margin-top: 20px;
padding-bottom: 50px;
}
#scriptTitle{
padding: 30px 40px;
}
#sciptForm{
margin-top: 10px;
padding: 0px 130px 0px 100px;
}
#btnList{
margin: 0px 100px;
}
.btn-footer{
margin-left: 100px;
margin-top: 10px;
display: inline-block;
}
2019-08-15 09:04:17 +08:00
</style>