This commit is contained in:
2025-08-27 20:36:31 +08:00
parent 3effbc342c
commit 8a1effedfc
5 changed files with 105 additions and 2 deletions

View File

@@ -0,0 +1,77 @@
<template>
<div class="app-container">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>京东指令台</span>
</div>
<el-row :gutter="20">
<el-col :span="12">
<el-form :model="form" label-width="80px" label-position="top">
<el-form-item label="输入指令">
<el-input v-model="form.command" type="textarea" :rows="10" placeholder="例如:京今日统计 / 京昨日订单 / 慢搜关键词 / 录单20250101-20250107" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="run" :loading="loading">执行</el-button>
<el-button @click="fillMenu">菜单</el-button>
<el-button @click="clearAll">清空</el-button>
</el-form-item>
</el-form>
</el-col>
<el-col :span="12">
<el-form label-position="top">
<el-form-item label="响应">
<el-input :value="result" type="textarea" :rows="18" readonly />
</el-form-item>
</el-form>
</el-col>
</el-row>
</el-card>
</div>
</template>
<script>
import { executeInstruction } from '@/api/system/instruction'
export default {
name: 'JdInstruction',
data() {
return {
form: { command: '' },
loading: false,
result: ''
}
},
methods: {
run() {
const cmd = (this.form.command || '').trim()
if (!cmd) { this.$modal.msgError('请输入指令'); return }
this.loading = true
executeInstruction({ command: cmd }).then(res => {
this.loading = false
if (res && (res.code === 200 || res.msg === '操作成功')) {
this.result = res.data || res.msg || ''
} else {
this.$modal.msgError(res && res.msg ? res.msg : '执行失败')
}
}).catch(() => {
this.loading = false
this.$modal.msgError('执行失败,请稍后重试')
})
},
fillMenu() {
this.form.command = '京菜单'
},
clearAll() {
this.form.command = ''
this.result = ''
}
}
}
</script>
<style scoped>
.box-card { margin: 20px; }
</style>