|
|
|
@ -1,14 +1,14 @@ |
|
|
|
|
<script setup> |
|
|
|
|
import {cinema_list} from '@/apis/update.js'; |
|
|
|
|
import {get_overtime_show_info, get_response_json, set_overtime_config} from "@/apis/mock.js"; |
|
|
|
|
import {onMounted} from "vue"; |
|
|
|
|
import {end_mock, get_overtime_show_info, get_response_json, set_overtime_config, start_mock} from "@/apis/mock.js"; |
|
|
|
|
import {onMounted, onBeforeUnmount} from "vue"; |
|
|
|
|
import {ref, computed} from "vue"; |
|
|
|
|
import {InfoFilled} from "@element-plus/icons-vue"; |
|
|
|
|
import JsonEditorVue from "json-editor-vue3"; |
|
|
|
|
|
|
|
|
|
const mockConfigPost = ref() |
|
|
|
|
let cinema_items = ref([]); |
|
|
|
|
const select_ip = ref('') |
|
|
|
|
const selectIp = ref('') |
|
|
|
|
|
|
|
|
|
const checkAll = ref(false) |
|
|
|
|
const isIndeterminate = ref(false) |
|
|
|
@ -33,7 +33,7 @@ const tabs_array = computed(() => { |
|
|
|
|
tabs.push(tab_item) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
console.log(select_ip.value) |
|
|
|
|
console.log(selectIp.value) |
|
|
|
|
return tabs |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
@ -84,7 +84,7 @@ const handleIpChange = () => { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const handleCheckAllChange = (val) => { |
|
|
|
|
if (select_ip.value === '') { |
|
|
|
|
if (selectIp.value === '') { |
|
|
|
|
alert('请先选择测试影院IP!') |
|
|
|
|
checkedMockConfig.value = [] |
|
|
|
|
checkAll.value = false |
|
|
|
@ -98,7 +98,7 @@ const handleCheckAllChange = (val) => { |
|
|
|
|
} |
|
|
|
|
const handleCheckedMockChange = (value) => { |
|
|
|
|
|
|
|
|
|
if (select_ip.value === '') { |
|
|
|
|
if (selectIp.value === '') { |
|
|
|
|
alert('请先选择测试影院IP!') |
|
|
|
|
checkedMockConfig.value = [] |
|
|
|
|
checkAll.value = false |
|
|
|
@ -166,7 +166,7 @@ const handleOvertimeConfigChange = () => { |
|
|
|
|
// 处理选择完全部选项后通知后台存储设置 |
|
|
|
|
const handleOvertimeConfigSave = () => { |
|
|
|
|
if (selectedOvertimeShowType.value !== '' && selectedShowInfo.value !== '' && selectedStatus.value !== '') { |
|
|
|
|
const params = {ip: select_ip.value, show_id: selectedShowInfo.value, audit_status: selectedStatus.value} |
|
|
|
|
const params = {ip: selectIp.value, show_id: selectedShowInfo.value, audit_status: selectedStatus.value} |
|
|
|
|
set_overtime_config(params).then(res => { |
|
|
|
|
console.log(res) |
|
|
|
|
}).catch(err => { |
|
|
|
@ -178,7 +178,7 @@ const handleOvertimeConfigSave = () => { |
|
|
|
|
|
|
|
|
|
// 获取过场售退场次和审核的结果数据用于填充select组件 |
|
|
|
|
async function getOvertimeShowInfo() { |
|
|
|
|
await get_overtime_show_info({ip: select_ip.value}).then( |
|
|
|
|
await get_overtime_show_info({ip: selectIp.value}).then( |
|
|
|
|
res => { |
|
|
|
|
sellShowInfo.value = [...res['sell']] |
|
|
|
|
refundShowInfo.value = [...res['refund']] |
|
|
|
@ -201,7 +201,7 @@ function getResponseJson() { |
|
|
|
|
mockConfigItems.forEach( |
|
|
|
|
(api, index) => { |
|
|
|
|
const req = { |
|
|
|
|
ip: select_ip.value, |
|
|
|
|
ip: selectIp.value, |
|
|
|
|
api: api |
|
|
|
|
} |
|
|
|
|
if (api === 'download_film_info') { |
|
|
|
@ -260,10 +260,11 @@ function getResponseJson() { |
|
|
|
|
// 单独处理超时的json获取 |
|
|
|
|
const getOvertimeResponseJson = () => { |
|
|
|
|
const req = { |
|
|
|
|
ip: select_ip.value, |
|
|
|
|
ip: selectIp.value, |
|
|
|
|
api: 'get_overtime_ticket_status', |
|
|
|
|
sessionCode: selectedShowInfo.value, |
|
|
|
|
overtimeType: selectedOvertimeShowType.value === 'sell' ? '1' : '2' |
|
|
|
|
show: selectedShowInfo.value, |
|
|
|
|
type: selectedOvertimeShowType.value === 'sell' ? '0' : '1', |
|
|
|
|
status: selectedStatus.value |
|
|
|
|
} |
|
|
|
|
get_response_json(req).then(res => { |
|
|
|
|
allJsonData.value.get_overtime_ticket_status = res |
|
|
|
@ -272,6 +273,7 @@ const getOvertimeResponseJson = () => { |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 重新计算顺序 |
|
|
|
|
const checkedItemsOrdered = computed(() => { |
|
|
|
|
let temp = [] |
|
|
|
|
mockConfigItems.forEach( |
|
|
|
@ -284,6 +286,12 @@ const checkedItemsOrdered = computed(() => { |
|
|
|
|
return temp |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
const handleRunningChange = () => { |
|
|
|
|
if (running.value === true) { |
|
|
|
|
alert('开始模拟后修改的接口不会被模拟,如果需要修改接口模拟参数,请停止后再修改!') |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 计算属性: 用于切换标签时,回填对应的Json数据,支持读写的计算属性 |
|
|
|
|
const json_data = computed( |
|
|
|
|
{ |
|
|
|
@ -297,6 +305,7 @@ const json_data = computed( |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
// 处理开始和停止按键的逻辑 |
|
|
|
|
const running = ref(false) |
|
|
|
|
const startBtn_disable = ref(false) |
|
|
|
|
const startBtn_loading = ref(false) |
|
|
|
|
|
|
|
|
@ -304,13 +313,36 @@ const handleStart = () => { |
|
|
|
|
console.log(selectedOvertimeShowType.value) |
|
|
|
|
console.log(selectedShowInfo.value) |
|
|
|
|
console.log(selectedStatus.value) |
|
|
|
|
if (checkedMockConfig.value.indexOf('get_overtime_ticket_status') >= 0) { |
|
|
|
|
if (selectedOvertimeShowType.value === '' || selectedShowInfo.value === '' || selectedStatus.value === '') { |
|
|
|
|
alert('请先设置‘超时票务查询’中的选项!') |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
running.value = true |
|
|
|
|
startBtn_disable.value = true |
|
|
|
|
startBtn_loading.value = true |
|
|
|
|
const params = {ip: selectIp.value} |
|
|
|
|
let mock_config = {} |
|
|
|
|
mockConfigItems.forEach((item) => { |
|
|
|
|
mock_config[item]= checkedMockConfig.value.indexOf(item) >= 0 |
|
|
|
|
}) |
|
|
|
|
console.log(mock_config) |
|
|
|
|
const data = JSON.stringify({mock_config: mock_config}) |
|
|
|
|
console.log(data) |
|
|
|
|
start_mock(params, data).then(res => { |
|
|
|
|
}).catch(err => { |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const handleEnd = () => { |
|
|
|
|
running.value = false |
|
|
|
|
startBtn_disable.value = false |
|
|
|
|
startBtn_loading.value = false |
|
|
|
|
const params = {ip: selectIp.value} |
|
|
|
|
end_mock(params).then(res => { |
|
|
|
|
}).catch(err => { |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -321,6 +353,7 @@ onMounted( |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
@ -329,7 +362,7 @@ onMounted( |
|
|
|
|
> |
|
|
|
|
<el-row justify="start"> |
|
|
|
|
<el-col :span="4"> |
|
|
|
|
<el-select v-model="select_ip" class="m-2" placeholder="选择要模拟的影院IP" @change="handleIpChange"> |
|
|
|
|
<el-select v-model="selectIp" class="m-2" placeholder="选择要模拟的影院IP" @change="handleIpChange"> |
|
|
|
|
<el-option |
|
|
|
|
v-for="item in cinema_items.value" |
|
|
|
|
:key="item.value" |
|
|
|
@ -346,7 +379,7 @@ onMounted( |
|
|
|
|
title="接口设置说明:" |
|
|
|
|
:width="400" |
|
|
|
|
trigger="hover" |
|
|
|
|
content="勾选需要测试的接口,点击‘开始’,启动对应单机的接口模拟,未勾选的接口会直接穿透到专资" |
|
|
|
|
content="勾选需要测试的接口,点击‘开始’,启动对应单机的接口模拟,未勾选的接口会直接穿透到专资。需要指定接口的返回参数,可以在最下方编辑器中修改。" |
|
|
|
|
> |
|
|
|
|
<template #reference> |
|
|
|
|
<el-icon> |
|
|
|
@ -427,7 +460,7 @@ onMounted( |
|
|
|
|
</el-col> |
|
|
|
|
</el-row> |
|
|
|
|
</div> |
|
|
|
|
<JsonEditorVue class="editor" v-model="json_data" language="zh-CN"/> |
|
|
|
|
<JsonEditorVue class="editor" v-model="json_data" language="zh-CN" @change="handleRunningChange"/> |
|
|
|
|
</el-tab-pane> |
|
|
|
|
</el-tabs> |
|
|
|
|
</div> |
|
|
|
|