@@ -23,7 +23,7 @@ module.exports = { | |||||
}], | }], | ||||
"vue/singleline-html-element-content-newline": "off", | "vue/singleline-html-element-content-newline": "off", | ||||
"vue/multiline-html-element-content-newline":"off", | "vue/multiline-html-element-content-newline":"off", | ||||
"vue/name-property-casing": ["error", "PascalCase"], | |||||
"vue/name-property-casing": ["warn", "PascalCase"], | |||||
"vue/no-v-html": "off", | "vue/no-v-html": "off", | ||||
'accessor-pairs': 2, | 'accessor-pairs': 2, | ||||
'arrow-spacing': [2, { | 'arrow-spacing': [2, { | ||||
@@ -47,12 +47,12 @@ module.exports = { | |||||
'curly': [2, 'multi-line'], | 'curly': [2, 'multi-line'], | ||||
'dot-location': [2, 'property'], | 'dot-location': [2, 'property'], | ||||
'eol-last': 2, | 'eol-last': 2, | ||||
'eqeqeq': ["error", "always", {"null": "ignore"}], | |||||
'eqeqeq': ["warn", "always", {"null": "ignore"}], | |||||
'generator-star-spacing': [2, { | 'generator-star-spacing': [2, { | ||||
'before': true, | 'before': true, | ||||
'after': true | 'after': true | ||||
}], | }], | ||||
'handle-callback-err': [2, '^(err|error)$'], | |||||
'handle-callback-err': [2, '^(err|warn)$'], | |||||
'indent': [2, 2, { | 'indent': [2, 2, { | ||||
'SwitchCase': 1 | 'SwitchCase': 1 | ||||
}], | }], | ||||
@@ -0,0 +1 @@ | |||||
node_modules |
@@ -8,10 +8,10 @@ export function getList(data) { | |||||
}) | }) | ||||
} | } | ||||
export function add(data){ | |||||
export function add(data) { | |||||
return request({ | return request({ | ||||
url:'api/ctApply/add', | |||||
method:'post', | |||||
url: 'api/ctApply/add', | |||||
method: 'post', | |||||
data | data | ||||
}) | }) | ||||
} | } | ||||
@@ -40,9 +40,9 @@ export function getById(data) { | |||||
}) | }) | ||||
} | } | ||||
export function getAll(){ | |||||
export function getAll() { | |||||
return request({ | return request({ | ||||
url: 'api/ctApply/getAll', | url: 'api/ctApply/getAll', | ||||
method:'get', | |||||
method: 'get' | |||||
}) | }) | ||||
} | |||||
} |
@@ -8,50 +8,50 @@ export function getList(data) { | |||||
}) | }) | ||||
} | } | ||||
export function add(data){ | |||||
return request({ | |||||
url:'api/quartzJob/add', | |||||
method:'post', | |||||
data | |||||
}) | |||||
} | |||||
export function add(data) { | |||||
return request({ | |||||
url: 'api/quartzJob/add', | |||||
method: 'post', | |||||
data | |||||
}) | |||||
} | |||||
export function getById(data){ | |||||
export function getById(data) { | |||||
return request({ | return request({ | ||||
url:'api/quartzJob/getById', | |||||
method:'post', | |||||
url: 'api/quartzJob/getById', | |||||
method: 'post', | |||||
data | data | ||||
}) | }) | ||||
} | } | ||||
export function editById(data){ | |||||
export function editById(data) { | |||||
return request({ | return request({ | ||||
url:'api/quartzJob/edit', | |||||
method:'post', | |||||
url: 'api/quartzJob/edit', | |||||
method: 'post', | |||||
data | data | ||||
}) | }) | ||||
} | } | ||||
export function delById(data){ | |||||
export function delById(data) { | |||||
return request({ | return request({ | ||||
url:'api/quartzJob/delete', | |||||
method:'post', | |||||
url: 'api/quartzJob/delete', | |||||
method: 'post', | |||||
data | data | ||||
}) | }) | ||||
} | } | ||||
export function modifyStatus(data){ | |||||
export function modifyStatus(data) { | |||||
return request({ | return request({ | ||||
url:'api/quartzJob/modifyStatus', | |||||
method:'post', | |||||
url: 'api/quartzJob/modifyStatus', | |||||
method: 'post', | |||||
data | data | ||||
}) | }) | ||||
} | } | ||||
export function executionById(data){ | |||||
export function executionById(data) { | |||||
return request({ | return request({ | ||||
url:'api/quartzJob/exec', | |||||
method:'post', | |||||
url: 'api/quartzJob/exec', | |||||
method: 'post', | |||||
data | data | ||||
}) | }) | ||||
} | } |
@@ -15,10 +15,10 @@ export function getFreeList(data) { | |||||
data | data | ||||
}) | }) | ||||
} | } | ||||
export function add(data){ | |||||
export function add(data) { | |||||
return request({ | return request({ | ||||
url:'api/ctRebot/add', | |||||
method:'post', | |||||
url: 'api/ctRebot/add', | |||||
method: 'post', | |||||
data | data | ||||
}) | }) | ||||
} | } | ||||
@@ -53,4 +53,4 @@ export function getById(data) { | |||||
method: 'post', | method: 'post', | ||||
data | data | ||||
}) | }) | ||||
} | |||||
} |
@@ -1,389 +0,0 @@ | |||||
<template> | |||||
<div class="app-container"> | |||||
<div style="margin-bottom:10px"> | |||||
<el-button type="success" @click="addBtn">新增</el-button> | |||||
<el-button type="success" @click="importBtn">导入</el-button> | |||||
<el-button type="success" @click="exportTempBtn">模版下载</el-button> | |||||
</div> | |||||
<!--搜索--> | |||||
<el-form class="mt_15" ref="form" inline size="small"> | |||||
<el-form-item label="机器人账号"> | |||||
<el-input v-model.trim="searchParm.accountName" clearable placeholder='机器人账号'></el-input> | |||||
</el-form-item> | |||||
<el-form-item label="uuid"> | |||||
<el-input v-model.trim="searchParm.robotClientUuid" clearable placeholder='uuid'></el-input> | |||||
</el-form-item> | |||||
<el-form-item> | |||||
<el-button type="primary" @click="goSearch">搜索</el-button> | |||||
<el-button type="warning" @click="resetForm">重置</el-button> | |||||
</el-form-item> | |||||
</el-form> | |||||
<!--表格渲染--> | |||||
<el-table ref="table" border size="small" :data="list" :header-cell-style="{textAlign:'center'}" :cell-style="{textAlign:'center'}"> | |||||
<el-table-column label="序号" type="index" width="50" /> | |||||
<el-table-column label="机器人账号" prop="accountName" /> | |||||
<el-table-column label="uuid信息" prop="robotClientUuid" /> | |||||
<el-table-column label="状态" prop="status"> | |||||
<template slot-scope="scope"> | |||||
{{ scope.row.status | getStatus}} | |||||
</template> | |||||
</el-table-column> | |||||
<el-table-column label="创建时间" prop="createdAt" /> | |||||
<el-table-column label="修改时间" prop="updatedAt" /> | |||||
<el-table-column label="操作" width="300"> | |||||
<template slot-scope="scope"> | |||||
<el-button type="info" @click="getBtnById(scope.row.id)">查看</el-button> | |||||
<el-button type="warning" @click="editById(scope.row)">修改</el-button> | |||||
<el-button type="danger" @click="updateStatus(scope.row)">重置</el-button> | |||||
<el-button type="danger" @click="delById(scope.row.id)">删除</el-button> | |||||
</template> | |||||
</el-table-column> | |||||
</el-table> | |||||
<!--分页--> | |||||
<div class="mt_15"> | |||||
<el-pagination | |||||
@size-change="handleSizeChange" | |||||
@current-change="handleCurrentChange" | |||||
:current-page="searchParm.page" | |||||
:page-sizes="[10, 20, 30, 40, 50]" | |||||
:page-size="searchParm.pageSize" | |||||
layout="total, sizes, prev, pager, next, jumper" | |||||
:total="total"> | |||||
</el-pagination> | |||||
</div> | |||||
<!--新增弹窗--> | |||||
<el-dialog :visible.sync="dialogAddVisible" :title="dialogAddTitle" center width="45%"> | |||||
<div class="dialog-content"> | |||||
<el-form ref="addParm" size="small" :model="addParm" :rules="rules" label-width="130px"> | |||||
<el-form-item label="机器人账号" prop="accountName"> | |||||
<el-input v-model.trim="addParm.accountName" clearable></el-input> | |||||
</el-form-item> | |||||
<el-form-item label="uuid信息" prop="robotClientUuid"> | |||||
<el-input v-model.trim="addParm.robotClientUuid" clearable></el-input> | |||||
</el-form-item> | |||||
</el-form> | |||||
</div> | |||||
<span slot="footer"> | |||||
<el-button type="info" @click="sureAddCancle('addParm')">取消</el-button> | |||||
<el-button type="primary" @click="sureAdd('addParm')">确认</el-button> | |||||
</span> | |||||
</el-dialog> | |||||
<!--修改弹窗--> | |||||
<el-dialog :visible.sync="dialogEditVisible" :title="dialogEditTitle" center width="45%"> | |||||
<div class="dialog-content"> | |||||
<el-form ref="editParm" size="small" :model="editParm" :rules="rules" label-width="130px"> | |||||
<el-form-item label="机器人账号" prop="accountName"> | |||||
<el-input v-model.trim="editParm.accountName" clearable></el-input> | |||||
</el-form-item> | |||||
<el-form-item label="uuid信息" prop="robotClientUuid"> | |||||
<el-input v-model.trim="editParm.robotClientUuid" clearable></el-input> | |||||
</el-form-item> | |||||
</el-form> | |||||
</div> | |||||
<span slot="footer"> | |||||
<el-button type="info" @click="sureExitCancle('editParm')">取消</el-button> | |||||
<el-button type="primary" @click="sureEdit('editParm')">确认</el-button> | |||||
</span> | |||||
</el-dialog> | |||||
<!--详情弹窗--> | |||||
<el-dialog :visible.sync="dialogDetailVisible" :title="dialogDetailTitle" center width="45%"> | |||||
<div class="dialog-content"> | |||||
<el-form ref="form" size="small" label-width="130px"> | |||||
<el-form-item label="机器人账号" prop="accountName"> | |||||
<el-input v-model.trim="detailParm.accountName" :disabled="true"></el-input> | |||||
</el-form-item> | |||||
<el-form-item label="uuid信息" prop="robotClientUuid"> | |||||
<el-input v-model.trim="detailParm.robotClientUuid" :disabled="true"></el-input> | |||||
</el-form-item> | |||||
</el-form> | |||||
</div> | |||||
</el-dialog> | |||||
<!--机器人信息导入 importBtn--> | |||||
<el-dialog :visible.sync="dialogImportVisible" :title="dialogImportTitle" center width="23%"> | |||||
<div class="dialog-content"> | |||||
<el-upload | |||||
class="upload-demo" | |||||
drag | |||||
ref="upload" | |||||
:action="uploadFileUrl" | |||||
:headers="uploadHeaders" | |||||
:show-file-list = "false" | |||||
:on-success="uploadSuccess" | |||||
:before-upload="beforeAvatarUpload" | |||||
multiple> | |||||
<i class="el-icon-upload"></i> | |||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div> | |||||
<div class="el-upload__tip" slot="tip">只能上传xlsl文件,且不超过10M</div> | |||||
</el-upload> | |||||
</div> | |||||
</el-dialog> | |||||
</div> | |||||
</template> | |||||
<script> | |||||
import { getList, add, delById, getById, editById, updateStatus} from '@/api/group/rebot' | |||||
export default { | |||||
filters: { | |||||
getStatus: function (value) { | |||||
if(value == 0) { | |||||
return '未占用'; | |||||
} else { | |||||
return '已占用'; | |||||
} | |||||
} | |||||
}, | |||||
// 数据 | |||||
data() { | |||||
return { | |||||
searchParm: { | |||||
page: 1, | |||||
pageSize: 10, | |||||
sort:'created_at', | |||||
order:'desc', | |||||
accountName:null, | |||||
robotClientUuid:null, | |||||
}, | |||||
total:0, | |||||
list: [], | |||||
uploadHeaders:{ Authorization: this.$store.getters.token }, | |||||
dialogAddVisible: false, | |||||
dialogAddTitle: '新增', | |||||
dialogDetailVisible: false, | |||||
dialogDetailTitle: '详情', | |||||
dialogEditVisible: false, | |||||
dialogEditTitle: '修改', | |||||
dialogImportVisible: false, | |||||
dialogImportTitle:'导入', | |||||
uploadFileUrl: process.env.VUE_APP_BASE_API + '/api/ctRebot/import', | |||||
tempUrl: process.env.VUE_APP_BASE_API + '/api/ctRebot/exportTemp', | |||||
addParm: { | |||||
id:null, | |||||
accountName:null, | |||||
robotClientUuid:null, | |||||
}, | |||||
detailParm: { | |||||
id:null, | |||||
accountName:null, | |||||
robotClientUuid:null, | |||||
}, | |||||
editParm: { | |||||
id:null, | |||||
accountName:null, | |||||
robotClientUuid:null, | |||||
}, | |||||
rules: { | |||||
accountName: [ | |||||
{ required: true, message: '请输入机器人账号', trigger: 'blur' } | |||||
], | |||||
robotClientUuid: [ | |||||
{ required: true, message: '请输入uuid信息', trigger: 'blur' } | |||||
], | |||||
} | |||||
} | |||||
}, | |||||
// 调用 | |||||
created() { | |||||
this.goSearch() | |||||
}, | |||||
//方法 | |||||
methods: { | |||||
//重置 | |||||
resetForm() { | |||||
this.searchParm.accountName = null; | |||||
this.searchParm.robotClientUuid = null; | |||||
this.goSearch() | |||||
}, | |||||
// 查询 | |||||
goSearch() { | |||||
this.searchParm.page=1 | |||||
this.getDataList() | |||||
}, | |||||
//导入成功 | |||||
uploadSuccess(res, file) { | |||||
this.dialogImportVisible = false; | |||||
if(res.code==200) { | |||||
console.log("********date:"+res.data) | |||||
if(res.data == true) { | |||||
this.$message.success('导入成功!'); | |||||
} | |||||
else{ | |||||
window.location.href = res.data; | |||||
this.$message.error('导入失败!'); | |||||
} | |||||
} | |||||
this.goSearch(); | |||||
}, | |||||
beforeAvatarUpload(file) { | |||||
console.log(file); | |||||
const isLt10M = file.size / 1024 / 1024 <10; | |||||
if (!isLt10M) { | |||||
this.$message.error('上传Excel文件大小不能超过 10MB!'); | |||||
} | |||||
return isLt10M; | |||||
}, | |||||
// 导入 | |||||
importBtn() { | |||||
this.dialogImportVisible = true | |||||
}, | |||||
//机器人模板 | |||||
exportTempBtn() { | |||||
console.log(this.tempUrl) | |||||
window.location.href = this.tempUrl; | |||||
}, | |||||
// 新增 | |||||
addBtn(addParm){ | |||||
this.addParm = { | |||||
id:null, | |||||
accountName:null, | |||||
robotClientUuid:null, | |||||
} | |||||
this.dialogAddTitle='新增' | |||||
this.dialogAddVisible = true; | |||||
this.$refs.addParm.clearValidate(); | |||||
}, | |||||
// 根据id删除 | |||||
delById(id){ | |||||
this.$confirm('确认删除?','提示',{ | |||||
confirmButtonText: '确定', | |||||
cancelButtonText: '取消', | |||||
type: 'warning' | |||||
}).then(() => { | |||||
delById({id}).then(res => { | |||||
if(res.code==200) { | |||||
this.$message.success('删除成功!') | |||||
this.getDataList() | |||||
} | |||||
}).catch(err => { | |||||
console.log(err) | |||||
}) | |||||
}).catch(() => { | |||||
this.$message.info('取消删除') | |||||
}) | |||||
}, | |||||
// 修改 | |||||
editById(data){ | |||||
getById({id: data.id}).then(res => { | |||||
if(res.code==200) { | |||||
this.editParm.id = res.data.id; | |||||
this.editParm.accountName = res.data.accountName; | |||||
this.editParm.robotClientUuid = res.data.robotClientUuid; | |||||
this.dialogEditVisible = true | |||||
this.$refs.editParm.clearValidate(); | |||||
} | |||||
}).catch(err => { | |||||
console.log(err) | |||||
}) | |||||
}, | |||||
updateStatus(data){ | |||||
console.log("==================updateStatus") | |||||
updateStatus({id: data.id,status: 0}).then(res => { | |||||
if(res.code==200) { | |||||
this.$message.success('初始化状态成功!') | |||||
this.getDataList() | |||||
} | |||||
}).catch(err => { | |||||
console.log(err) | |||||
}) | |||||
}, | |||||
// 确认修改 | |||||
sureEdit(editParm){ | |||||
this.$refs[editParm].validate((valid) => { | |||||
if (valid) { | |||||
this.$refs.editParm.clearValidate(); | |||||
editById(this.editParm).then(res => { | |||||
if(res.code==200) { | |||||
console.log(res) | |||||
this.dialogEditVisible = false; | |||||
this.$message.success('修改成功!') | |||||
this.getDataList() | |||||
} | |||||
}).catch(err => { | |||||
console.log(err) | |||||
}) | |||||
} else { | |||||
console.log('error submit!!'); | |||||
return false; | |||||
} | |||||
}); | |||||
}, | |||||
// 确认新增 | |||||
sureAdd(addParm){ | |||||
this.$refs[addParm].validate((valid) => { | |||||
if (valid) { | |||||
this.$refs.addParm.clearValidate(); | |||||
add(this.addParm).then(res => { | |||||
if(res.code==200) { | |||||
this.dialogAddVisible = false | |||||
this.$message.success('新增成功!') | |||||
this.getDataList() | |||||
} | |||||
}).catch(err => { | |||||
console.log(err) | |||||
}) | |||||
} else { | |||||
console.log('error submit!!'); | |||||
return false; | |||||
} | |||||
}); | |||||
}, | |||||
sureAddCancle(addParm) { | |||||
this.dialogAddVisible=flase; | |||||
this.$refs.addParm.clearValidate(); | |||||
}, | |||||
sureExitCancle(editParm) { | |||||
this.dialogEditVisible=false; | |||||
this.$refs.editParm.clearValidate(); | |||||
}, | |||||
// 查看根据id | |||||
getBtnById(id){ | |||||
getById({id}).then(res => { | |||||
if(res.code==200) { | |||||
this.detailParm.id = res.data.id; | |||||
this.detailParm.accountName = res.data.accountName; | |||||
this.detailParm.robotClientUuid = res.data.robotClientUuid; | |||||
this.detailParm.status = res.data.status; | |||||
this.dialogDetailVisible = true; | |||||
} | |||||
}).catch(err => { | |||||
console.log(err) | |||||
}) | |||||
}, | |||||
// 分页获取表格数据 | |||||
getDataList(){ | |||||
getList(this.searchParm).then(res => { | |||||
console.log(res) | |||||
if(res.code==200) { | |||||
console.log(res) | |||||
this.list = res.data.list; | |||||
this.total = res.data.total; | |||||
} | |||||
}).catch(err => { | |||||
console.log(err) | |||||
}) | |||||
}, | |||||
// 分页 | |||||
handleSizeChange(val) { | |||||
console.log(`每页 ${val} 条`); | |||||
this.searchParm.pageSize = val; | |||||
this.getDataList(); | |||||
}, | |||||
handleCurrentChange(val) { | |||||
console.log(`当前页: ${val}`); | |||||
this.searchParm.page = val; | |||||
this.getDataList(); | |||||
} | |||||
} | |||||
} | |||||
</script> | |||||
<style rel="stylesheet/scss" lang="scss" scoped> | |||||
</style> |
@@ -4,12 +4,12 @@ | |||||
<el-button type="success" @click="addBtn">新增</el-button> | <el-button type="success" @click="addBtn">新增</el-button> | ||||
</div> | </div> | ||||
<!--搜索--> | <!--搜索--> | ||||
<el-form class="mt_15" ref="form" inline size="small"> | |||||
<el-form ref="form" class="mt_15" inline size="small"> | |||||
<el-form-item label="应用名称"> | <el-form-item label="应用名称"> | ||||
<el-input v-model.trim="searchParm.name" clearable placeholder="应用名称"></el-input> | |||||
<el-input v-model.trim="searchParm.name" clearable placeholder="应用名称" /> | |||||
</el-form-item> | </el-form-item> | ||||
<el-form-item label="应用id"> | <el-form-item label="应用id"> | ||||
<el-input v-model.trim="searchParm.robotUuid" clearable placeholder="应用id"></el-input> | |||||
<el-input v-model.trim="searchParm.robotUuid" clearable placeholder="应用id" /> | |||||
</el-form-item> | </el-form-item> | ||||
<el-form-item> | <el-form-item> | ||||
<el-button type="primary" @click="goSearch">搜索</el-button> | <el-button type="primary" @click="goSearch">搜索</el-button> | ||||
@@ -46,14 +46,14 @@ | |||||
<!--分页--> | <!--分页--> | ||||
<div class="mt_15"> | <div class="mt_15"> | ||||
<el-pagination | <el-pagination | ||||
@size-change="handleSizeChange" | |||||
@current-change="handleCurrentChange" | |||||
:current-page="searchParm.page" | :current-page="searchParm.page" | ||||
:page-sizes="[10, 20, 30, 40, 50]" | :page-sizes="[10, 20, 30, 40, 50]" | ||||
:page-size="searchParm.pageSize" | :page-size="searchParm.pageSize" | ||||
layout="total, sizes, prev, pager, next, jumper" | layout="total, sizes, prev, pager, next, jumper" | ||||
:total="total" | :total="total" | ||||
></el-pagination> | |||||
@size-change="handleSizeChange" | |||||
@current-change="handleCurrentChange" | |||||
/> | |||||
</div> | </div> | ||||
<!--新增弹窗--> | <!--新增弹窗--> | ||||
@@ -61,10 +61,10 @@ | |||||
<div class="dialog-content"> | <div class="dialog-content"> | ||||
<el-form ref="addParm" size="small" :model="addParm" :rules="rules" label-width="150px"> | <el-form ref="addParm" size="small" :model="addParm" :rules="rules" label-width="150px"> | ||||
<el-form-item label="应用名称" prop="name"> | <el-form-item label="应用名称" prop="name"> | ||||
<el-input v-model.trim="addParm.name" clearable></el-input> | |||||
<el-input v-model.trim="addParm.name" clearable /> | |||||
</el-form-item> | </el-form-item> | ||||
<el-form-item label="应用ID" prop="robotUuid"> | <el-form-item label="应用ID" prop="robotUuid"> | ||||
<el-input v-model.trim="addParm.robotUuid" clearable></el-input> | |||||
<el-input v-model.trim="addParm.robotUuid" clearable /> | |||||
</el-form-item> | </el-form-item> | ||||
<el-form-item label="任务名称" prop="taskName"> | <el-form-item label="任务名称" prop="taskName"> | ||||
<el-select v-model.trim="addParm.taskName" placeholder="请选择"> | <el-select v-model.trim="addParm.taskName" placeholder="请选择"> | ||||
@@ -73,17 +73,17 @@ | |||||
:key="item.id" | :key="item.id" | ||||
:label="item.name" | :label="item.name" | ||||
:value="item.name" | :value="item.name" | ||||
></el-option> | |||||
/> | |||||
</el-select> | </el-select> | ||||
</el-form-item> | </el-form-item> | ||||
<el-form-item label="accessKeyId" prop="accessKeyId"> | <el-form-item label="accessKeyId" prop="accessKeyId"> | ||||
<el-input v-model.trim="addParm.accessKeyId" clearable></el-input> | |||||
<el-input v-model.trim="addParm.accessKeyId" clearable /> | |||||
</el-form-item> | </el-form-item> | ||||
<el-form-item label="accessKeySecret" prop="accessKeySecret"> | <el-form-item label="accessKeySecret" prop="accessKeySecret"> | ||||
<el-input v-model.trim="addParm.accessKeySecret" clearable></el-input> | |||||
<el-input v-model.trim="addParm.accessKeySecret" clearable /> | |||||
</el-form-item> | </el-form-item> | ||||
<el-form-item label="备注" prop="remark"> | <el-form-item label="备注" prop="remark"> | ||||
<el-input v-model.trim="addParm.remark" clearable></el-input> | |||||
<el-input v-model.trim="addParm.remark" clearable /> | |||||
</el-form-item> | </el-form-item> | ||||
</el-form> | </el-form> | ||||
</div> | </div> | ||||
@@ -98,29 +98,29 @@ | |||||
<div class="dialog-content"> | <div class="dialog-content"> | ||||
<el-form ref="editParm" size="small" :model="editParm" :rules="rules" label-width="150px"> | <el-form ref="editParm" size="small" :model="editParm" :rules="rules" label-width="150px"> | ||||
<el-form-item label="应用名称" prop="name"> | <el-form-item label="应用名称" prop="name"> | ||||
<el-input v-model.trim="editParm.name" clearable></el-input> | |||||
<el-input v-model.trim="editParm.name" clearable /> | |||||
</el-form-item> | </el-form-item> | ||||
<el-form-item label="应用ID" prop="robotUuid"> | <el-form-item label="应用ID" prop="robotUuid"> | ||||
<el-input v-model.trim="editParm.robotUuid" clearable></el-input> | |||||
<el-input v-model.trim="editParm.robotUuid" clearable /> | |||||
</el-form-item> | </el-form-item> | ||||
<el-form-item label="任务名称" prop="taskName"> | <el-form-item label="任务名称" prop="taskName"> | ||||
<el-select v-model.trim="editParm.taskName" placeholder="请选择"> | <el-select v-model.trim="editParm.taskName" placeholder="请选择"> | ||||
<el-option | |||||
<el-option | |||||
v-for="item in taskList" | v-for="item in taskList" | ||||
:key="item.id" | :key="item.id" | ||||
:label="item.name" | :label="item.name" | ||||
:value="item.name"> | |||||
</el-option> | |||||
:value="item.name" | |||||
/> | |||||
</el-select> | </el-select> | ||||
</el-form-item> | </el-form-item> | ||||
<el-form-item label="accessKeyId" prop="accessKeyId"> | <el-form-item label="accessKeyId" prop="accessKeyId"> | ||||
<el-input v-model.trim="editParm.accessKeyId" clearable></el-input> | |||||
<el-input v-model.trim="editParm.accessKeyId" clearable /> | |||||
</el-form-item> | </el-form-item> | ||||
<el-form-item label="accessKeySecret" prop="accessKeySecret"> | <el-form-item label="accessKeySecret" prop="accessKeySecret"> | ||||
<el-input v-model.trim="editParm.accessKeySecret" clearable></el-input> | |||||
<el-input v-model.trim="editParm.accessKeySecret" clearable /> | |||||
</el-form-item> | </el-form-item> | ||||
<el-form-item label="备注" prop="remark"> | <el-form-item label="备注" prop="remark"> | ||||
<el-input v-model.trim="editParm.remark" clearable></el-input> | |||||
<el-input v-model.trim="editParm.remark" clearable /> | |||||
</el-form-item> | </el-form-item> | ||||
</el-form> | </el-form> | ||||
</div> | </div> | ||||
@@ -135,25 +135,25 @@ | |||||
<div class="dialog-content"> | <div class="dialog-content"> | ||||
<el-form ref="form" size="small" label-width="130px"> | <el-form ref="form" size="small" label-width="130px"> | ||||
<el-form-item label="应用名称" prop="name"> | <el-form-item label="应用名称" prop="name"> | ||||
<el-input v-model.trim="detailParm.name" :disabled="true"></el-input> | |||||
<el-input v-model.trim="detailParm.name" :disabled="true" /> | |||||
</el-form-item> | </el-form-item> | ||||
<el-form-item label="应用ID" prop="robotUuid"> | <el-form-item label="应用ID" prop="robotUuid"> | ||||
<el-input v-model.trim="detailParm.robotUuid" :disabled="true"></el-input> | |||||
<el-input v-model.trim="detailParm.robotUuid" :disabled="true" /> | |||||
</el-form-item> | </el-form-item> | ||||
<el-form-item label="任务名称" prop="taskName"> | <el-form-item label="任务名称" prop="taskName"> | ||||
<el-input v-model.trim="detailParm.taskName" :disabled="true"></el-input> | |||||
<el-input v-model.trim="detailParm.taskName" :disabled="true" /> | |||||
</el-form-item> | </el-form-item> | ||||
<el-form-item label="方法名称" prop="methodName"> | <el-form-item label="方法名称" prop="methodName"> | ||||
<el-input v-model.trim="detailParm.methodName" :disabled="true"></el-input> | |||||
<el-input v-model.trim="detailParm.methodName" :disabled="true" /> | |||||
</el-form-item> | </el-form-item> | ||||
<el-form-item label="accessKeyId" prop="accessKeyId"> | <el-form-item label="accessKeyId" prop="accessKeyId"> | ||||
<el-input v-model.trim="detailParm.accessKeyId" :disabled="true"></el-input> | |||||
<el-input v-model.trim="detailParm.accessKeyId" :disabled="true" /> | |||||
</el-form-item> | </el-form-item> | ||||
<el-form-item label="accessKeySecret" prop="accessKeySecret"> | <el-form-item label="accessKeySecret" prop="accessKeySecret"> | ||||
<el-input v-model.trim="detailParm.accessKeySecret" :disabled="true"></el-input> | |||||
<el-input v-model.trim="detailParm.accessKeySecret" :disabled="true" /> | |||||
</el-form-item> | </el-form-item> | ||||
<el-form-item label="备注" prop="remark"> | <el-form-item label="备注" prop="remark"> | ||||
<el-input v-model.trim="detailParm.remark" :disabled="true"></el-input> | |||||
<el-input v-model.trim="detailParm.remark" :disabled="true" /> | |||||
</el-form-item> | </el-form-item> | ||||
</el-form> | </el-form> | ||||
</div> | </div> | ||||
@@ -161,7 +161,7 @@ | |||||
</div> | </div> | ||||
</template> | </template> | ||||
<script> | <script> | ||||
import { getList, add, delById, getById, editById } from "@/api/group/apply"; | |||||
import { getList, add, delById, getById, editById } from '@/api/rpa/apply' | |||||
export default { | export default { | ||||
// 数据 | // 数据 | ||||
data() { | data() { | ||||
@@ -169,21 +169,21 @@ export default { | |||||
taskList: [ | taskList: [ | ||||
{ | { | ||||
id: 1, | id: 1, | ||||
name: "demoTask" | |||||
name: 'demoTask' | |||||
}, | }, | ||||
{ | { | ||||
id: 2, | id: 2, | ||||
name: "clickFarmTask" | |||||
name: 'clickFarmTask' | |||||
}, { | }, { | ||||
id: 3, | id: 3, | ||||
name: "clickFarmSuppleMentTask" | |||||
name: 'clickFarmSuppleMentTask' | |||||
} | } | ||||
], | ], | ||||
searchParm: { | searchParm: { | ||||
page: 1, | page: 1, | ||||
pageSize: 10, | pageSize: 10, | ||||
sort: "created_at", | |||||
order: "desc", | |||||
sort: 'created_at', | |||||
order: 'desc', | |||||
name: null, | name: null, | ||||
robotUuid: null, | robotUuid: null, | ||||
remark: null | remark: null | ||||
@@ -191,13 +191,13 @@ export default { | |||||
total: 0, | total: 0, | ||||
list: [], | list: [], | ||||
dialogAddVisible: false, | dialogAddVisible: false, | ||||
dialogAddTitle: "新增", | |||||
dialogAddTitle: '新增', | |||||
dialogDetailVisible: false, | dialogDetailVisible: false, | ||||
dialogDetailTitle: "详情", | |||||
dialogDetailTitle: '详情', | |||||
dialogEditVisible: false, | dialogEditVisible: false, | ||||
dialogEditTitle: "修改", | |||||
dialogEditTitle: '修改', | |||||
dialogImportVisible: false, | dialogImportVisible: false, | ||||
dialogImportTitle: "导入", | |||||
dialogImportTitle: '导入', | |||||
addParm: { | addParm: { | ||||
id: null, | id: null, | ||||
name: null, | name: null, | ||||
@@ -229,43 +229,43 @@ export default { | |||||
remark: null | remark: null | ||||
}, | }, | ||||
rules: { | rules: { | ||||
name: [{ required: true, message: "请输入应用名称", trigger: "blur" }], | |||||
name: [{ required: true, message: '请输入应用名称', trigger: 'blur' }], | |||||
robotUuid: [ | robotUuid: [ | ||||
{ required: true, message: "请输入应用id", trigger: "blur" } | |||||
{ required: true, message: '请输入应用id', trigger: 'blur' } | |||||
], | ], | ||||
taskName: [ | taskName: [ | ||||
{ required: true, message: "请输入任务名称", trigger: "blur" } | |||||
{ required: true, message: '请输入任务名称', trigger: 'blur' } | |||||
], | ], | ||||
methodName: [ | methodName: [ | ||||
{ required: true, message: "请输入方法名称", trigger: "blur" } | |||||
{ required: true, message: '请输入方法名称', trigger: 'blur' } | |||||
], | ], | ||||
accessKeyId: [ | accessKeyId: [ | ||||
{ required: true, message: "请输入accessKeyId", trigger: "blur" } | |||||
{ required: true, message: '请输入accessKeyId', trigger: 'blur' } | |||||
], | ], | ||||
accessKeySecret: [ | accessKeySecret: [ | ||||
{ required: true, message: "请输入accessKeySecret", trigger: "blur" } | |||||
{ required: true, message: '请输入accessKeySecret', trigger: 'blur' } | |||||
], | ], | ||||
remark: [{ required: true, message: "请输入备注", trigger: "blur" }] | |||||
remark: [{ required: true, message: '请输入备注', trigger: 'blur' }] | |||||
} | } | ||||
}; | |||||
} | |||||
}, | }, | ||||
// 调用 | // 调用 | ||||
created() { | created() { | ||||
this.goSearch(); | |||||
this.goSearch() | |||||
}, | }, | ||||
//方法 | |||||
// 方法 | |||||
methods: { | methods: { | ||||
//重置 | |||||
// 重置 | |||||
resetForm() { | resetForm() { | ||||
this.searchParm.name = null; | |||||
this.searchParm.robotUuid = null; | |||||
this.searchParm.remark = null; | |||||
this.goSearch(); | |||||
this.searchParm.name = null | |||||
this.searchParm.robotUuid = null | |||||
this.searchParm.remark = null | |||||
this.goSearch() | |||||
}, | }, | ||||
// 查询 | // 查询 | ||||
goSearch() { | goSearch() { | ||||
this.searchParm.page = 1; | |||||
this.getDataList(); | |||||
this.searchParm.page = 1 | |||||
this.getDataList() | |||||
}, | }, | ||||
// 新增 | // 新增 | ||||
addBtn() { | addBtn() { | ||||
@@ -278,144 +278,144 @@ export default { | |||||
accessKeyId: null, | accessKeyId: null, | ||||
accessKeySecret: null, | accessKeySecret: null, | ||||
remark: null | remark: null | ||||
}; | |||||
this.dialogAddTitle = "新增"; | |||||
this.dialogAddVisible = true; | |||||
this.$refs.addParm.clearValidate(); | |||||
} | |||||
this.dialogAddTitle = '新增' | |||||
this.dialogAddVisible = true | |||||
this.$refs.addParm.clearValidate() | |||||
}, | }, | ||||
// 根据id删除 | // 根据id删除 | ||||
delById(id) { | delById(id) { | ||||
this.$confirm("确认删除?", "提示", { | |||||
confirmButtonText: "确定", | |||||
cancelButtonText: "取消", | |||||
type: "warning" | |||||
this.$confirm('确认删除?', '提示', { | |||||
confirmButtonText: '确定', | |||||
cancelButtonText: '取消', | |||||
type: 'warning' | |||||
}) | }) | ||||
.then(() => { | .then(() => { | ||||
delById({ id }) | delById({ id }) | ||||
.then(res => { | .then(res => { | ||||
if (res.code == 200) { | if (res.code == 200) { | ||||
this.$message.success("删除成功!"); | |||||
this.getDataList(); | |||||
this.$message.success('删除成功!') | |||||
this.getDataList() | |||||
} | } | ||||
}) | }) | ||||
.catch(err => { | .catch(err => { | ||||
console.log(err); | |||||
}); | |||||
console.log(err) | |||||
}) | |||||
}) | }) | ||||
.catch(() => { | .catch(() => { | ||||
this.$message.info("取消删除"); | |||||
}); | |||||
this.$message.info('取消删除') | |||||
}) | |||||
}, | }, | ||||
// 修改 | // 修改 | ||||
editById(data) { | editById(data) { | ||||
this.$refs.editParm.clearValidate(); | |||||
this.$refs.editParm.clearValidate() | |||||
getById({ id: data.id }) | getById({ id: data.id }) | ||||
.then(res => { | .then(res => { | ||||
if (res.code == 200) { | if (res.code == 200) { | ||||
this.editParm.id = res.data.id; | |||||
this.editParm.name = res.data.name; | |||||
this.editParm.robotUuid = res.data.robotUuid; | |||||
this.editParm.taskName = res.data.taskName; | |||||
this.editParm.accessKeyId = res.data.accessKeyId; | |||||
this.editParm.accessKeySecret = res.data.accessKeySecret; | |||||
this.editParm.remark = res.data.remark; | |||||
this.dialogEditVisible = true; | |||||
this.editParm.id = res.data.id | |||||
this.editParm.name = res.data.name | |||||
this.editParm.robotUuid = res.data.robotUuid | |||||
this.editParm.taskName = res.data.taskName | |||||
this.editParm.accessKeyId = res.data.accessKeyId | |||||
this.editParm.accessKeySecret = res.data.accessKeySecret | |||||
this.editParm.remark = res.data.remark | |||||
this.dialogEditVisible = true | |||||
} | } | ||||
}) | }) | ||||
.catch(err => { | .catch(err => { | ||||
console.log(err); | |||||
}); | |||||
console.log(err) | |||||
}) | |||||
}, | }, | ||||
// 确认修改 | // 确认修改 | ||||
sureEdit(editParm) { | sureEdit(editParm) { | ||||
editById(this.editParm) | editById(this.editParm) | ||||
.then(res => { | .then(res => { | ||||
if (res.code == 200) { | if (res.code == 200) { | ||||
console.log(res); | |||||
this.dialogEditVisible = false; | |||||
this.$message.success("修改成功!"); | |||||
this.getDataList(); | |||||
console.log(res) | |||||
this.dialogEditVisible = false | |||||
this.$message.success('修改成功!') | |||||
this.getDataList() | |||||
} else if (res.code == -1) { | } else if (res.code == -1) { | ||||
this.$message.warning(res.message); | |||||
this.$message.warning(res.message) | |||||
} | } | ||||
}) | }) | ||||
.catch(err => { | .catch(err => { | ||||
console.log(err); | |||||
}); | |||||
console.log(err) | |||||
}) | |||||
}, | }, | ||||
sureEdit(editParm) { | sureEdit(editParm) { | ||||
this.dialogEditVisible=flase | |||||
this.$refs.editParm.clearValidate(); | |||||
this.dialogEditVisible = flase | |||||
this.$refs.editParm.clearValidate() | |||||
}, | }, | ||||
// 确认新增 | // 确认新增 | ||||
sureAdd(addParm) { | sureAdd(addParm) { | ||||
add(this.addParm) | add(this.addParm) | ||||
.then(res => { | .then(res => { | ||||
if (res.code == 200) { | if (res.code == 200) { | ||||
this.dialogAddVisible = false; | |||||
this.$message.success("新增成功!"); | |||||
this.getDataList(); | |||||
this.dialogAddVisible = false | |||||
this.$message.success('新增成功!') | |||||
this.getDataList() | |||||
} else if (res.code == -1) { | } else if (res.code == -1) { | ||||
this.$message.warning(res.message); | |||||
this.$message.warning(res.message) | |||||
} | } | ||||
}) | }) | ||||
.catch(err => { | .catch(err => { | ||||
console.log(err); | |||||
}); | |||||
console.log(err) | |||||
}) | |||||
}, | }, | ||||
sureAdd(addParm) { | sureAdd(addParm) { | ||||
this.dialogAddVisible=flase | |||||
this.$refs.addParm.clearValidate(); | |||||
this.dialogAddVisible = flase | |||||
this.$refs.addParm.clearValidate() | |||||
}, | }, | ||||
// 查看根据id | // 查看根据id | ||||
getBtnById(id) { | getBtnById(id) { | ||||
getById({ id }) | getById({ id }) | ||||
.then(res => { | .then(res => { | ||||
if (res.code == 200) { | if (res.code == 200) { | ||||
this.detailParm.id = res.data.id; | |||||
this.detailParm.name = res.data.name; | |||||
this.detailParm.robotUuid = res.data.robotUuid; | |||||
this.detailParm.taskName = res.data.taskName; | |||||
this.detailParm.methodName = res.data.methodName; | |||||
this.detailParm.accessKeyId = res.data.accessKeyId; | |||||
this.detailParm.accessKeySecret = res.data.accessKeySecret; | |||||
this.detailParm.remark = res.data.remark; | |||||
this.dialogDetailVisible = true; | |||||
this.detailParm.id = res.data.id | |||||
this.detailParm.name = res.data.name | |||||
this.detailParm.robotUuid = res.data.robotUuid | |||||
this.detailParm.taskName = res.data.taskName | |||||
this.detailParm.methodName = res.data.methodName | |||||
this.detailParm.accessKeyId = res.data.accessKeyId | |||||
this.detailParm.accessKeySecret = res.data.accessKeySecret | |||||
this.detailParm.remark = res.data.remark | |||||
this.dialogDetailVisible = true | |||||
} | } | ||||
}) | }) | ||||
.catch(err => { | .catch(err => { | ||||
console.log(err); | |||||
}); | |||||
console.log(err) | |||||
}) | |||||
}, | }, | ||||
// 分页获取表格数据 | // 分页获取表格数据 | ||||
getDataList() { | getDataList() { | ||||
getList(this.searchParm) | getList(this.searchParm) | ||||
.then(res => { | .then(res => { | ||||
console.log(res); | |||||
console.log(res) | |||||
if (res.code == 200) { | if (res.code == 200) { | ||||
console.log(res); | |||||
this.list = res.data.list; | |||||
this.total = res.data.total; | |||||
console.log(res) | |||||
this.list = res.data.list | |||||
this.total = res.data.total | |||||
} | } | ||||
}) | }) | ||||
.catch(err => { | .catch(err => { | ||||
console.log(err); | |||||
}); | |||||
console.log(err) | |||||
}) | |||||
}, | }, | ||||
// 分页 | // 分页 | ||||
handleSizeChange(val) { | handleSizeChange(val) { | ||||
console.log(`每页 ${val} 条`); | |||||
this.searchParm.pageSize = val; | |||||
this.getDataList(); | |||||
console.log(`每页 ${val} 条`) | |||||
this.searchParm.pageSize = val | |||||
this.getDataList() | |||||
}, | }, | ||||
handleCurrentChange(val) { | handleCurrentChange(val) { | ||||
console.log(`当前页: ${val}`); | |||||
this.searchParm.page = val; | |||||
this.getDataList(); | |||||
console.log(`当前页: ${val}`) | |||||
this.searchParm.page = val | |||||
this.getDataList() | |||||
} | } | ||||
} | } | ||||
}; | |||||
} | |||||
</script> | </script> | ||||
<style rel="stylesheet/scss" lang="scss" scoped> | <style rel="stylesheet/scss" lang="scss" scoped> |
@@ -0,0 +1,386 @@ | |||||
<template> | |||||
<div class="app-container"> | |||||
<div style="margin-bottom:10px"> | |||||
<el-button type="success" @click="addBtn">新增</el-button> | |||||
<el-button type="success" @click="importBtn">导入</el-button> | |||||
<el-button type="success" @click="exportTempBtn">模版下载</el-button> | |||||
</div> | |||||
<!--搜索--> | |||||
<el-form ref="form" class="mt_15" inline size="small"> | |||||
<el-form-item label="机器人账号"> | |||||
<el-input v-model.trim="searchParm.accountName" clearable placeholder="机器人账号" /> | |||||
</el-form-item> | |||||
<el-form-item label="uuid"> | |||||
<el-input v-model.trim="searchParm.robotClientUuid" clearable placeholder="uuid" /> | |||||
</el-form-item> | |||||
<el-form-item> | |||||
<el-button type="primary" @click="goSearch">搜索</el-button> | |||||
<el-button type="warning" @click="resetForm">重置</el-button> | |||||
</el-form-item> | |||||
</el-form> | |||||
<!--表格渲染--> | |||||
<el-table ref="table" border size="small" :data="list" :header-cell-style="{textAlign:'center'}" :cell-style="{textAlign:'center'}"> | |||||
<el-table-column label="序号" type="index" width="50" /> | |||||
<el-table-column label="机器人账号" prop="accountName" /> | |||||
<el-table-column label="uuid信息" prop="robotClientUuid" /> | |||||
<el-table-column label="状态" prop="status"> | |||||
<template slot-scope="scope"> | |||||
{{ scope.row.status | getStatus }} | |||||
</template> | |||||
</el-table-column> | |||||
<el-table-column label="创建时间" prop="createdAt" /> | |||||
<el-table-column label="修改时间" prop="updatedAt" /> | |||||
<el-table-column label="操作" width="300"> | |||||
<template slot-scope="scope"> | |||||
<el-button type="info" @click="getBtnById(scope.row.id)">查看</el-button> | |||||
<el-button type="warning" @click="editById(scope.row)">修改</el-button> | |||||
<el-button type="danger" @click="updateStatus(scope.row)">重置</el-button> | |||||
<el-button type="danger" @click="delById(scope.row.id)">删除</el-button> | |||||
</template> | |||||
</el-table-column> | |||||
</el-table> | |||||
<!--分页--> | |||||
<div class="mt_15"> | |||||
<el-pagination | |||||
:current-page="searchParm.page" | |||||
:page-sizes="[10, 20, 30, 40, 50]" | |||||
:page-size="searchParm.pageSize" | |||||
layout="total, sizes, prev, pager, next, jumper" | |||||
:total="total" | |||||
@size-change="handleSizeChange" | |||||
@current-change="handleCurrentChange" | |||||
/> | |||||
</div> | |||||
<!--新增弹窗--> | |||||
<el-dialog :visible.sync="dialogAddVisible" :title="dialogAddTitle" center width="45%"> | |||||
<div class="dialog-content"> | |||||
<el-form ref="addParm" size="small" :model="addParm" :rules="rules" label-width="130px"> | |||||
<el-form-item label="机器人账号" prop="accountName"> | |||||
<el-input v-model.trim="addParm.accountName" clearable /> | |||||
</el-form-item> | |||||
<el-form-item label="uuid信息" prop="robotClientUuid"> | |||||
<el-input v-model.trim="addParm.robotClientUuid" clearable /> | |||||
</el-form-item> | |||||
</el-form> | |||||
</div> | |||||
<span slot="footer"> | |||||
<el-button type="info" @click="sureAddCancle('addParm')">取消</el-button> | |||||
<el-button type="primary" @click="sureAdd('addParm')">确认</el-button> | |||||
</span> | |||||
</el-dialog> | |||||
<!--修改弹窗--> | |||||
<el-dialog :visible.sync="dialogEditVisible" :title="dialogEditTitle" center width="45%"> | |||||
<div class="dialog-content"> | |||||
<el-form ref="editParm" size="small" :model="editParm" :rules="rules" label-width="130px"> | |||||
<el-form-item label="机器人账号" prop="accountName"> | |||||
<el-input v-model.trim="editParm.accountName" clearable /> | |||||
</el-form-item> | |||||
<el-form-item label="uuid信息" prop="robotClientUuid"> | |||||
<el-input v-model.trim="editParm.robotClientUuid" clearable /> | |||||
</el-form-item> | |||||
</el-form> | |||||
</div> | |||||
<span slot="footer"> | |||||
<el-button type="info" @click="sureExitCancle('editParm')">取消</el-button> | |||||
<el-button type="primary" @click="sureEdit('editParm')">确认</el-button> | |||||
</span> | |||||
</el-dialog> | |||||
<!--详情弹窗--> | |||||
<el-dialog :visible.sync="dialogDetailVisible" :title="dialogDetailTitle" center width="45%"> | |||||
<div class="dialog-content"> | |||||
<el-form ref="form" size="small" label-width="130px"> | |||||
<el-form-item label="机器人账号" prop="accountName"> | |||||
<el-input v-model.trim="detailParm.accountName" :disabled="true" /> | |||||
</el-form-item> | |||||
<el-form-item label="uuid信息" prop="robotClientUuid"> | |||||
<el-input v-model.trim="detailParm.robotClientUuid" :disabled="true" /> | |||||
</el-form-item> | |||||
</el-form> | |||||
</div> | |||||
</el-dialog> | |||||
<!--机器人信息导入 importBtn--> | |||||
<el-dialog :visible.sync="dialogImportVisible" :title="dialogImportTitle" center width="23%"> | |||||
<div class="dialog-content"> | |||||
<el-upload | |||||
ref="upload" | |||||
class="upload-demo" | |||||
drag | |||||
:action="uploadFileUrl" | |||||
:headers="uploadHeaders" | |||||
:show-file-list="false" | |||||
:on-success="uploadSuccess" | |||||
:before-upload="beforeAvatarUpload" | |||||
multiple | |||||
> | |||||
<i class="el-icon-upload" /> | |||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div> | |||||
<div slot="tip" class="el-upload__tip">只能上传xlsl文件,且不超过10M</div> | |||||
</el-upload> | |||||
</div> | |||||
</el-dialog> | |||||
</div> | |||||
</template> | |||||
<script> | |||||
import { getList, add, delById, getById, editById, updateStatus } from '@/api/rpa/rebot' | |||||
export default { | |||||
filters: { | |||||
getStatus: function(value) { | |||||
if (value == 0) { | |||||
return '未占用' | |||||
} else { | |||||
return '已占用' | |||||
} | |||||
} | |||||
}, | |||||
// 数据 | |||||
data() { | |||||
return { | |||||
searchParm: { | |||||
page: 1, | |||||
pageSize: 10, | |||||
sort: 'created_at', | |||||
order: 'desc', | |||||
accountName: null, | |||||
robotClientUuid: null | |||||
}, | |||||
total: 0, | |||||
list: [], | |||||
uploadHeaders: { Authorization: this.$store.getters.token }, | |||||
dialogAddVisible: false, | |||||
dialogAddTitle: '新增', | |||||
dialogDetailVisible: false, | |||||
dialogDetailTitle: '详情', | |||||
dialogEditVisible: false, | |||||
dialogEditTitle: '修改', | |||||
dialogImportVisible: false, | |||||
dialogImportTitle: '导入', | |||||
uploadFileUrl: process.env.VUE_APP_BASE_API + '/api/ctRebot/import', | |||||
tempUrl: process.env.VUE_APP_BASE_API + '/api/ctRebot/exportTemp', | |||||
addParm: { | |||||
id: null, | |||||
accountName: null, | |||||
robotClientUuid: null | |||||
}, | |||||
detailParm: { | |||||
id: null, | |||||
accountName: null, | |||||
robotClientUuid: null | |||||
}, | |||||
editParm: { | |||||
id: null, | |||||
accountName: null, | |||||
robotClientUuid: null | |||||
}, | |||||
rules: { | |||||
accountName: [ | |||||
{ required: true, message: '请输入机器人账号', trigger: 'blur' } | |||||
], | |||||
robotClientUuid: [ | |||||
{ required: true, message: '请输入uuid信息', trigger: 'blur' } | |||||
] | |||||
} | |||||
} | |||||
}, | |||||
// 调用 | |||||
created() { | |||||
this.goSearch() | |||||
}, | |||||
// 方法 | |||||
methods: { | |||||
// 重置 | |||||
resetForm() { | |||||
this.searchParm.accountName = null | |||||
this.searchParm.robotClientUuid = null | |||||
this.goSearch() | |||||
}, | |||||
// 查询 | |||||
goSearch() { | |||||
this.searchParm.page = 1 | |||||
this.getDataList() | |||||
}, | |||||
// 导入成功 | |||||
uploadSuccess(res, file) { | |||||
this.dialogImportVisible = false | |||||
if (res.code == 200) { | |||||
console.log('********date:' + res.data) | |||||
if (res.data == true) { | |||||
this.$message.success('导入成功!') | |||||
} else { | |||||
window.location.href = res.data | |||||
this.$message.error('导入失败!') | |||||
} | |||||
} | |||||
this.goSearch() | |||||
}, | |||||
beforeAvatarUpload(file) { | |||||
console.log(file) | |||||
const isLt10M = file.size / 1024 / 1024 < 10 | |||||
if (!isLt10M) { | |||||
this.$message.error('上传Excel文件大小不能超过 10MB!') | |||||
} | |||||
return isLt10M | |||||
}, | |||||
// 导入 | |||||
importBtn() { | |||||
this.dialogImportVisible = true | |||||
}, | |||||
// 机器人模板 | |||||
exportTempBtn() { | |||||
console.log(this.tempUrl) | |||||
window.location.href = this.tempUrl | |||||
}, | |||||
// 新增 | |||||
addBtn(addParm) { | |||||
this.addParm = { | |||||
id: null, | |||||
accountName: null, | |||||
robotClientUuid: null | |||||
} | |||||
this.dialogAddTitle = '新增' | |||||
this.dialogAddVisible = true | |||||
this.$refs.addParm.clearValidate() | |||||
}, | |||||
// 根据id删除 | |||||
delById(id) { | |||||
this.$confirm('确认删除?', '提示', { | |||||
confirmButtonText: '确定', | |||||
cancelButtonText: '取消', | |||||
type: 'warning' | |||||
}).then(() => { | |||||
delById({ id }).then(res => { | |||||
if (res.code == 200) { | |||||
this.$message.success('删除成功!') | |||||
this.getDataList() | |||||
} | |||||
}).catch(err => { | |||||
console.log(err) | |||||
}) | |||||
}).catch(() => { | |||||
this.$message.info('取消删除') | |||||
}) | |||||
}, | |||||
// 修改 | |||||
editById(data) { | |||||
getById({ id: data.id }).then(res => { | |||||
if (res.code == 200) { | |||||
this.editParm.id = res.data.id | |||||
this.editParm.accountName = res.data.accountName | |||||
this.editParm.robotClientUuid = res.data.robotClientUuid | |||||
this.dialogEditVisible = true | |||||
this.$refs.editParm.clearValidate() | |||||
} | |||||
}).catch(err => { | |||||
console.log(err) | |||||
}) | |||||
}, | |||||
updateStatus(data) { | |||||
console.log('==================updateStatus') | |||||
updateStatus({ id: data.id, status: 0 }).then(res => { | |||||
if (res.code == 200) { | |||||
this.$message.success('初始化状态成功!') | |||||
this.getDataList() | |||||
} | |||||
}).catch(err => { | |||||
console.log(err) | |||||
}) | |||||
}, | |||||
// 确认修改 | |||||
sureEdit(editParm) { | |||||
this.$refs[editParm].validate((valid) => { | |||||
if (valid) { | |||||
this.$refs.editParm.clearValidate() | |||||
editById(this.editParm).then(res => { | |||||
if (res.code == 200) { | |||||
console.log(res) | |||||
this.dialogEditVisible = false | |||||
this.$message.success('修改成功!') | |||||
this.getDataList() | |||||
} | |||||
}).catch(err => { | |||||
console.log(err) | |||||
}) | |||||
} else { | |||||
console.log('error submit!!') | |||||
return false | |||||
} | |||||
}) | |||||
}, | |||||
// 确认新增 | |||||
sureAdd(addParm) { | |||||
this.$refs[addParm].validate((valid) => { | |||||
if (valid) { | |||||
this.$refs.addParm.clearValidate() | |||||
add(this.addParm).then(res => { | |||||
if (res.code == 200) { | |||||
this.dialogAddVisible = false | |||||
this.$message.success('新增成功!') | |||||
this.getDataList() | |||||
} | |||||
}).catch(err => { | |||||
console.log(err) | |||||
}) | |||||
} else { | |||||
console.log('error submit!!') | |||||
return false | |||||
} | |||||
}) | |||||
}, | |||||
sureAddCancle(addParm) { | |||||
this.dialogAddVisible = flase | |||||
this.$refs.addParm.clearValidate() | |||||
}, | |||||
sureExitCancle(editParm) { | |||||
this.dialogEditVisible = false | |||||
this.$refs.editParm.clearValidate() | |||||
}, | |||||
// 查看根据id | |||||
getBtnById(id) { | |||||
getById({ id }).then(res => { | |||||
if (res.code == 200) { | |||||
this.detailParm.id = res.data.id | |||||
this.detailParm.accountName = res.data.accountName | |||||
this.detailParm.robotClientUuid = res.data.robotClientUuid | |||||
this.detailParm.status = res.data.status | |||||
this.dialogDetailVisible = true | |||||
} | |||||
}).catch(err => { | |||||
console.log(err) | |||||
}) | |||||
}, | |||||
// 分页获取表格数据 | |||||
getDataList() { | |||||
getList(this.searchParm).then(res => { | |||||
console.log(res) | |||||
if (res.code == 200) { | |||||
console.log(res) | |||||
this.list = res.data.list | |||||
this.total = res.data.total | |||||
} | |||||
}).catch(err => { | |||||
console.log(err) | |||||
}) | |||||
}, | |||||
// 分页 | |||||
handleSizeChange(val) { | |||||
console.log(`每页 ${val} 条`) | |||||
this.searchParm.pageSize = val | |||||
this.getDataList() | |||||
}, | |||||
handleCurrentChange(val) { | |||||
console.log(`当前页: ${val}`) | |||||
this.searchParm.page = val | |||||
this.getDataList() | |||||
} | |||||
} | |||||
} | |||||
</script> | |||||
<style rel="stylesheet/scss" lang="scss" scoped> | |||||
</style> |