Browse Source

修复

pull/3/head
lcr 5 months ago
parent
commit
e34c38d217
4 changed files with 255 additions and 102 deletions
  1. +17
    -0
      src/api/business/ctResourceLibrary.js
  2. +2
    -2
      src/components/FileUpload/index.vue
  3. +109
    -90
      src/views/business/ctApplyPlan/index.vue
  4. +127
    -10
      src/views/business/ctResourceLibrary/index.vue

+ 17
- 0
src/api/business/ctResourceLibrary.js View File

@@ -1,5 +1,13 @@
import request from '@/utils/request' import request from '@/utils/request'


// 根据应用id查询所有参数
export function listByAppId(appId) {
return request({
url: '/business/ctResourceLibrary/listByAppId?appId=' + appId,
method: 'get',
})
}

// 查询资源库管理列表 // 查询资源库管理列表
export function listCtResourceLibrary(query) { export function listCtResourceLibrary(query) {
return request({ return request({
@@ -26,6 +34,15 @@ export function addCtResourceLibrary(data) {
}) })
} }


// 批量新增资源库管理
export function addBatch(data) {
return request({
url: '/business/ctResourceLibrary/addBatch',
method: 'post',
data: data
})
}

// 修改资源库管理 // 修改资源库管理
export function updateCtResourceLibrary(data) { export function updateCtResourceLibrary(data) {
return request({ return request({


+ 2
- 2
src/components/FileUpload/index.vue View File

@@ -55,12 +55,12 @@ export default {
// 大小限制(MB) // 大小限制(MB)
fileSize: { fileSize: {
type: Number, type: Number,
default: 5,
default: 50,
}, },
// 文件类型, 例如['png', 'jpg', 'jpeg'] // 文件类型, 例如['png', 'jpg', 'jpeg']
fileType: { fileType: {
type: Array, type: Array,
default: () => ["doc", "docx","xls", "xlsx"],
default: () => ["doc", "docx","xls", "xlsx","zip","rar"],
}, },
// 是否显示提示 // 是否显示提示
isShowTip: { isShowTip: {


+ 109
- 90
src/views/business/ctApplyPlan/index.vue View File

@@ -46,31 +46,33 @@
<el-table-column label="应用名称" align="center" prop="appName" width="250" /> <el-table-column label="应用名称" align="center" prop="appName" width="250" />
<el-table-column label="输出内容" align="center" prop="outParam" width="100"> <el-table-column label="输出内容" align="center" prop="outParam" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag v-if="scope.row.outParam != null && scope.row.outParam.includes('.xlsx')"
@click="downloadUrl(scope.row.outParam)">下载</el-tag>
<el-tag v-if="scope.row.outParam != null && scope.row.outParam.includes('.xlsx')" style='cursor:pointer;'
@click="downloadUrl(scope.row.outParam)">点击下载</el-tag>
<span v-if="scope.row.outParam != null && !scope.row.outParam.includes('.xlsx')">{{ scope.row.outParam <span v-if="scope.row.outParam != null && !scope.row.outParam.includes('.xlsx')">{{ scope.row.outParam
}}</span> }}</span>
<span v-if="scope.row.outParam == null"> 没有文件</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="调度方式" align="center" prop="planType" width="100">
<template slot-scope="scope">
<dict-tag :options="dict.type.plan_type" :value="scope.row.planType" />
</template>
</el-table-column>
<el-table-column label="机器人名称" align="center" prop="robotName" width="150" />
<el-table-column label="应用类型名称" align="center" prop="appTypeName" width="100" />
<el-table-column label="appid" align="center" prop="appId" width="300" />
<el-table-column label="应用类型枚举" align="center" prop="appType" width="100" />
<el-table-column label="计划参数" align="center" prop="planParams" width="100"> <el-table-column label="计划参数" align="center" prop="planParams" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<el-popover trigger="hover" placement="top">
<el-popover v-if="scope.row.planParams != null" trigger="hover" placement="top">
<p> {{ scope.row.planParams }}</p> <p> {{ scope.row.planParams }}</p>
<div slot="reference" class="name-wrapper"> <div slot="reference" class="name-wrapper">
<el-tag size="medium">显示参数</el-tag> <el-tag size="medium">显示参数</el-tag>
</div> </div>
</el-popover> </el-popover>
<span v-if="scope.row.planParams == null">没有参数</span>
</template>
</el-table-column>
<el-table-column label="调度方式" align="center" prop="planType" width="100">
<template slot-scope="scope">
<dict-tag :options="dict.type.plan_type" :value="scope.row.planType" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="机器人名称" align="center" prop="robotName" width="150" />
<el-table-column label="应用类型名称" align="center" prop="appTypeName" width="100" />
<el-table-column label="appid" align="center" prop="appId" width="300" />
<el-table-column label="应用类型枚举" align="center" prop="appType" width="100" />


<el-table-column label="等待超时时间" align="center" prop="waitTimeout" width="100"> <el-table-column label="等待超时时间" align="center" prop="waitTimeout" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
@@ -83,7 +85,7 @@
<dict-tag :options="dict.type.exc_type" :value="scope.row.excType" /> <dict-tag :options="dict.type.exc_type" :value="scope.row.excType" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="执行时间" align="center" prop="excTime" width="100" />
<el-table-column label="执行时间" align="center" prop="excTime" width="160" />
<el-table-column label="执行表达式" align="center" prop="cronExpression" width="100" /> <el-table-column label="执行表达式" align="center" prop="cronExpression" width="100" />
<el-table-column label="任务执行状态" align="center" fixed="right" prop="taskStatus" width="100"> <el-table-column label="任务执行状态" align="center" fixed="right" prop="taskStatus" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
@@ -93,20 +95,21 @@
<dict-tag :options="dict.type.plan_run_status" :value="scope.row.taskStatus" /> <dict-tag :options="dict.type.plan_run_status" :value="scope.row.taskStatus" />
</div> </div>
</el-popover> </el-popover>
<dict-tag v-if="scope.row.taskStatus != 'error'" :options="dict.type.plan_run_status" :value="scope.row.taskStatus" />
<dict-tag v-if="scope.row.taskStatus != 'error'" :options="dict.type.plan_run_status"
:value="scope.row.taskStatus" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="上次执行时间" align="center" prop="lastExecTime" width="170" />
<el-table-column label="下次执行时间" align="center" prop="nextExecTime" width="170" />
<el-table-column label="上次执行时间" align="center" prop="lastExecTime" width="200" />
<el-table-column label="下次执行时间" align="center" prop="nextExecTime" width="200" />
<el-table-column label="任务运行uuid" align="center" prop="taskUuid" width="300" /> <el-table-column label="任务运行uuid" align="center" prop="taskUuid" width="300" />
<el-table-column label="开始时间" align="center" fixed="right" prop="startTime" width="100" />
<el-table-column label="结束时间" align="center" fixed="right" prop="endTime" width="100" />
<el-table-column label="人工耗时" align="center" fixed="right" prop="manualTime" width="100">
<el-table-column label="开始时间" align="center" fixed="right" prop="startTime" width="200" />
<el-table-column label="结束时间" align="center" fixed="right" prop="endTime" width="200" />
<el-table-column label="人工耗时" align="center" prop="manualTime" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.manualTime != null">{{ scope.row.manualTime }} 分钟</span> <span v-if="scope.row.manualTime != null">{{ scope.row.manualTime }} 分钟</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="实际耗时" align="center" fixed="right" prop="planTime" width="100">
<el-table-column label="实际耗时" align="center" prop="planTime" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.planTime != null">{{ scope.row.planTime }} 分钟</span> <span v-if="scope.row.planTime != null">{{ scope.row.planTime }} 分钟</span>
</template> </template>
@@ -125,14 +128,17 @@
<!-- <el-table-column label="备注" align="center" prop="remark" /> --> <!-- <el-table-column label="备注" align="center" prop="remark" /> -->
<el-table-column label="操作" align="center" width="250" fixed="right" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" width="250" fixed="right" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<router-link to="/rpa/ctResourceLibrary">
<!-- <router-link to="/rpa/ctResourceLibrary">
<el-button size="mini" v-if="scope.row.taskStatus == 'await_create'" type="text" icon="el-icon-setting" <el-button size="mini" v-if="scope.row.taskStatus == 'await_create'" type="text" icon="el-icon-setting"
v-hasPermi="['business:ctApplyPlan:edit']">设置参数</el-button> v-hasPermi="['business:ctApplyPlan:edit']">设置参数</el-button>
</router-link>
<el-button size="mini" v-if="scope.row.taskStatus == 'stopped' || scope.row.taskStatus == 'error' || scope.row.taskStatus == 'cancel'" type="text" icon="el-icon-refresh"
@click="appRetry(scope.row)" v-hasPermi="['business:ctApplyPlan:appRetry']">重新运行</el-button>
<el-button size="mini" v-if="scope.row.taskStatus == 'running'" type="text" icon="el-icon-video-pause"
@click="stopRun(scope.row)" v-hasPermi="['business:ctApplyPlan:stopRun']">停止运行</el-button>
</router-link> -->
<el-button size="mini"
v-if="scope.row.taskStatus == 'stopped' || scope.row.taskStatus == 'error' || scope.row.taskStatus == 'cancel'"
type="text" icon="el-icon-refresh" @click="appRetry(scope.row)"
v-hasPermi="['business:ctApplyPlan:appRetry']">重新运行</el-button>
<el-button size="mini" v-if="scope.row.taskStatus == 'running' || scope.row.taskStatus == 'waiting'"
type="text" icon="el-icon-video-pause" @click="stopRun(scope.row)"
v-hasPermi="['business:ctApplyPlan:stopRun']">停止运行</el-button>
<el-button size="mini" v-if="scope.row.taskStatus == 'await_create'" type="text" icon="el-icon-edit" <el-button size="mini" v-if="scope.row.taskStatus == 'await_create'" type="text" icon="el-icon-edit"
@click="handleUpdate(scope.row)" v-hasPermi="['business:ctApplyPlan:edit']">修改</el-button> @click="handleUpdate(scope.row)" v-hasPermi="['business:ctApplyPlan:edit']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
@@ -153,54 +159,27 @@
<el-input v-model="form.planName" placeholder="请输入计划名称" /> <el-input v-model="form.planName" placeholder="请输入计划名称" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12">
<el-form-item label="调度方式" prop="planType">
<el-select v-model="form.planType" placeholder="请选择调度方式">
<el-option v-for="dict in dict.type.plan_type" :key="dict.value" :label="dict.label"
:disabled="dict.value == 0" :value="dict.value"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>

<el-row :gutter="24">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="应用名称" prop="appId"> <el-form-item label="应用名称" prop="appId">
<el-select v-model="form.appId" multiple filterable collapse-tags style="margin-left: 20px;"
placeholder="请选择机器人">
<el-select v-model="form.appId" filterable collapse-tags style="margin-left: 20px;" placeholder="请选择机器人"
@change="changeApp">
<el-option v-for="apply in applyList" :key="apply.appId" :label="apply.appName" :value="apply.appId"> <el-option v-for="apply in applyList" :key="apply.appId" :label="apply.appName" :value="apply.appId">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12">
<el-form-item label="等待超时时间" prop="waitTimeout">
<el-select v-model="form.waitTimeout" placeholder="请选择等待超时时间">
<el-option v-for="dict in dict.type.wait_timeout" :key="dict.value" :label="dict.label"
:value="dict.value"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row> </el-row>


<el-row :gutter="24"> <el-row :gutter="24">
<el-col :span="12">
<el-form-item label="优先级" prop="priority">
<el-input-number v-model="form.priority" label="请输入预计人工用时"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="执行类型" prop="excType">
<el-select v-model="form.excType" placeholder="请选择执行类型">
<el-col :span="8">
<el-form-item label="如何执行" prop="excType">
<el-select v-model="form.excType" placeholder="请选择执行方式">
<el-option v-for="dict in dict.type.exc_type" :key="dict.value" :label="dict.label" <el-option v-for="dict in dict.type.exc_type" :key="dict.value" :label="dict.label"
:value="dict.value"></el-option> :value="dict.value"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row>

<el-row :gutter="24">
<el-col :span="12">
<el-col :span="16">
<el-form-item v-if="form.excType == 1" label="执行时间" prop="excTime"> <el-form-item v-if="form.excType == 1" label="执行时间" prop="excTime">
<el-date-picker clearable v-model="form.excTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" <el-date-picker clearable v-model="form.excTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
format="yyyy-MM-dd HH:mm:ss" placeholder="请选择执行时间"> format="yyyy-MM-dd HH:mm:ss" placeholder="请选择执行时间">
@@ -209,22 +188,44 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item v-if="form.excType == 2" label="cron表达式" prop="cronExpression"> <el-form-item v-if="form.excType == 2" label="cron表达式" prop="cronExpression">
<el-input v-model="form.cronExpression" placeholder="请输入cron执行表达式">
<template slot="append">
<el-button type="primary" @click="handleShowCron">
生成表达式
<i class="el-icon-time el-icon--right"></i>
</el-button>
</template>
</el-input>
<el-input v-model="form.cronExpression" placeholder="请输入cron执行表达式"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col v-if="form.excType == 2" :span="4">
<a style="color: royalblue;" href="https://www.pppet.net/" target="_blank">表达式生成地址</a>
</el-col>
</el-row> </el-row>
<el-row :gutter="24">
<!-- 参数列表 -->
<el-row :gutter="24" v-if="isParam">
<el-col :span="24"> <el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>执行应用需要填写以下内容</span>
</div>
<div class="text item">
<el-table :data="resourceLibrarieList" style="width: 100%">
<el-table-column prop="resource" label="文件描述" />
<el-table-column prop="resourceValue" label="文件内容">
<template slot-scope="scope">
<file-upload v-model="scope.row.resourceValue" v-if="scope.row.resourceType == 'file'" />

<el-input v-if="scope.row.resourceType == null || scope.row.resourceType == 'str'"
v-model="scope.row.resourceValue" type="text" placeholder="请输入资源内容" />

<el-input-number v-model="scope.row.resourceValue" :precision="0"
v-if="scope.row.resourceType == 'int'" placeholder="请输入资源内容"></el-input-number>

<el-input-number v-model="form.resourceValue" :precision="2"
v-if="scope.row.resourceType == 'float'" placeholder="请输入资源内容"></el-input-number>

<el-switch v-model="scope.row.resourceValue" active-text="真" inactive-text="假" active-value="true"
v-if="scope.row.resourceType == 'bool'" inactive-value="false" />
</template>
</el-table-column>
</el-table>
</div>
</el-card>

</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
@@ -241,7 +242,8 @@
</template> </template>


<script> <script>
import { listCtApplyPlan, getCtApplyPlan, delCtApplyPlan, addCtApplyPlan, updateCtApplyPlan,stopRun,appRetry } from "@/api/business/ctApplyPlan";
import { listCtApplyPlan, getCtApplyPlan, delCtApplyPlan, addCtApplyPlan, updateCtApplyPlan, stopRun, appRetry } from "@/api/business/ctApplyPlan";
import { listByAppId } from "@/api/business/ctResourceLibrary";
import { listRebotAll } from "@/api/business/ctRebot"; import { listRebotAll } from "@/api/business/ctRebot";
import { listApplyAll } from "@/api/business/ctApply"; import { listApplyAll } from "@/api/business/ctApply";
import Crontab from '@/components/Crontab' import Crontab from '@/components/Crontab'
@@ -293,24 +295,13 @@ export default {
priority: null, priority: null,
}, },
// 表单参数 // 表单参数
form: {},
form: {
},
// 表单校验 // 表单校验
rules: { rules: {
planName: [
{ required: true, message: "计划名称不能为空", trigger: "blur" }
],
planType: [
{ required: true, message: "执行类型不能为空", trigger: "change" }
],
appId: [ appId: [
{ required: true, message: "请选择一个应用", trigger: "change" } { required: true, message: "请选择一个应用", trigger: "change" }
], ],
waitTimeout: [
{ required: true, message: "等待超时时间不能为空", trigger: "blur" }
],
priority: [
{ required: true, message: "优先级不能为空", trigger: "blur" }
],
excType: [ excType: [
{ required: true, message: "执行类型不能为空", trigger: "change" } { required: true, message: "执行类型不能为空", trigger: "change" }
], ],
@@ -319,16 +310,30 @@ export default {
rebotList: [], rebotList: [],
// 应用列表 // 应用列表
applyList: [], applyList: [],
// 参数集
params: [],
// 单个参数对象
param: {},
applyIsParam: false,
resourceLibrarieList: [],
// 应用是否需要参数
isParam: false,
}; };
}, },
created() { created() {
this.getList(); this.getList();
}, },
methods: { methods: {
/** 新增计划时选中app */
changeApp(newValue) {
this.isParam = false;
this.applyList.forEach(e => {
if (e.appId == newValue && e.supportParam == 1) {
this.isParam = true;
listByAppId(newValue).then(res => {
console.log("res.data", res.data);
this.resourceLibrarieList = res.data;
});
}
})
console.log("this.resourceLibrarieList", this.resourceLibrarieList);
},
/** 停止运行 */ /** 停止运行 */
stopRun(row) { stopRun(row) {
stopRun(row.taskUuid).then(res => { stopRun(row.taskUuid).then(res => {
@@ -420,6 +425,7 @@ export default {
this.reset(); this.reset();
this.listAll(); this.listAll();
this.open = true; this.open = true;
this.isParam = false;
this.title = "添加应用执行计划"; this.title = "添加应用执行计划";
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
@@ -435,8 +441,17 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
if (this.form.excType == 1 && this.form.excTime == null) {
this.$modal.msgError("指定时间执行时间不能为空");
return;
}
if (this.form.excType == 2 && this.form.cronExpression == null) {
this.$modal.msgError("周期执行表达式不能为空");
return;
}
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
this.form.resourceLibrarieList = this.resourceLibrarieList;
if (this.form.id != null) { if (this.form.id != null) {
updateCtApplyPlan(this.form).then(response => { updateCtApplyPlan(this.form).then(response => {
this.$modal.msgSuccess("修改计划成功"); this.$modal.msgSuccess("修改计划成功");
@@ -487,7 +502,7 @@ export default {
return prev; return prev;
} }
}, 0); }, 0);
console.log("column",column);
console.log("column", column);
sums[index] += ' 分钟'; sums[index] += ' 分钟';
} else { } else {
sums[index] = ''; sums[index] = '';
@@ -513,6 +528,10 @@ export default {
link.setAttribute("download", name); link.setAttribute("download", name);
document.body.appendChild(link); document.body.appendChild(link);
link.click(); link.click();
},
getFileName(fileName) {
// return fileName.substring(fileName.lastIndexOf("/") +1,fileName.lastIndexOf("."))
return fileName.substring(fileName.lastIndexOf("/") + 1, fileName.length)
} }
} }
}; };

+ 127
- 10
src/views/business/ctResourceLibrary/index.vue View File

@@ -20,7 +20,9 @@
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['business:ctResourceLibrary:add']">新增</el-button> v-hasPermi="['business:ctResourceLibrary:add']">新增</el-button>
<span style="color: red;"> 提示:该参数跟随计划,修改内容不会影响已经创建的计划</span>
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleBatchAdd"
v-hasPermi="['business:ctResourceLibrary:add']">批量新增</el-button>
<span style="color: red;"> 提示:该参数跟随计划,修改内容不会影响已经创建的计划</span>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
@@ -30,12 +32,12 @@
</el-row> </el-row>


<el-table v-loading="loading" :data="ctResourceLibraryList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="ctResourceLibraryList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" fixed="left" />
<el-table-column label="序号" width="55" align="center" fixed="left">
<!-- <el-table-column type="selection" width="55" align="center" fixed="left" /> -->
<!-- <el-table-column label="序号" width="55" align="center" fixed="left">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.$index + 1 }} {{ scope.$index + 1 }}
</template> </template>
</el-table-column>
</el-table-column> -->
<el-table-column label="所属应用名称" align="center" prop="appName" width="150" /> <el-table-column label="所属应用名称" align="center" prop="appName" width="150" />
<el-table-column label="资源类型" align="center" prop="resourceType" width="100"> <el-table-column label="资源类型" align="center" prop="resourceType" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
@@ -45,9 +47,12 @@
<el-table-column label="资源描述" align="center" prop="resource" width="100" /> <el-table-column label="资源描述" align="center" prop="resource" width="100" />
<el-table-column label="资源内容" align="center" prop="resourceValue" width="100"> <el-table-column label="资源内容" align="center" prop="resourceValue" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag v-if="scope.row.resourceValue.includes('.xlsx')"
@click="downloadUrl(scope.row.resourceValue)">下载</el-tag>
<span v-if="!scope.row.resourceValue.includes('.xlsx')">{{ scope.row.resourceValue }}</span>
<el-tag
v-if="scope.row.resourceValue != null && (scope.row.resourceValue.includes('.xlsx') || scope.row.resourceValue.includes('.docx'))"
style='cursor:pointer;' @click="downloadUrl(scope.row.resourceValue)">下载</el-tag>
<span
v-if="scope.row.resourceValue != null && (!scope.row.resourceValue.includes('.xlsx') && !scope.row.resourceValue.includes('.docx'))">{{
scope.row.resourceValue }}</span>
</template> </template>
.xlsx .xlsx
</el-table-column> </el-table-column>
@@ -80,9 +85,10 @@
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
@pagination="getList" /> @pagination="getList" />



<!-- 添加或修改资源库管理对话框 --> <!-- 添加或修改资源库管理对话框 -->
<el-dialog :title="title" :visible.sync="open" width="900px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="900px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form ref="form" :model="form" :rules="rules" label-width="150px">
<el-row :gutter="24"> <el-row :gutter="24">
<el-col :span="8"> <el-col :span="8">
<el-form-item label="资源类型" prop="resourceType" v-hasPermi="['business:ctResourceLibrary:updateType']"> <el-form-item label="资源类型" prop="resourceType" v-hasPermi="['business:ctResourceLibrary:updateType']">
@@ -146,11 +152,94 @@
<el-button @click="cancel">取 消</el-button> <el-button @click="cancel">取 消</el-button>
</div> </div>
</el-dialog> </el-dialog>

<!-- 批量新增 -->
<el-dialog title="批量新增" :visible.sync="batch.batchOpen" width="900px" append-to-body>
<el-card class="box-card">
<div class="text item">
<el-row :gutter="24">
<el-col :span="12">
所属应用:<el-select v-model="batch.appId" filterable placeholder="请选择应用">
<el-option v-for="apply in applyList" :key="apply.appId" :label="apply.appName"
:value="apply.appId"></el-option>
</el-select>
</el-col>
<el-col :span="12">
参数数量<el-input-number v-model="batch.paramNum" :precision="0" placeholder="请输入参数数量"
@change="changeNum"></el-input-number>
</el-col>
</el-row>
</div>
</el-card>

<el-card class="box-card" v-for="(resourceLibrary, index) in batch.list" :key="index">
<div class="text item">
<el-form :model="resourceLibrary" :rules="rules" label-width="150px">
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="资源类型" prop="resourceType" v-hasPermi="['business:ctResourceLibrary:updateType']">
<el-select v-model="resourceLibrary.resourceType" placeholder="请选择资源类型">
<el-option v-for="dict in dict.type.app_param_type" :key="dict.value" :label="dict.label"
:value="dict.value"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="资源键" prop="resourceName" v-hasPermi="['business:ctResourceLibrary:updateKey']">
<el-input v-model="resourceLibrary.resourceName" placeholder="请输入资源键" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="资源描述" prop="resource"">
<el-input v-model="resourceLibrary.resource" placeholder="请输入资源描述" />
</el-form-item>
</el-col>
<el-col v-if="resourceLibrary.resourceType == null || resourceLibrary.resourceType == 'str'" :span="12">
<el-form-item label="资源内容" prop="value">
<el-input v-model="resourceLibrary.resourceValue" type="text" placeholder="请输入资源内容" />
</el-form-item>
</el-col>
<el-col v-if="resourceLibrary.resourceType == 'int'" :span="12">
<el-form-item label="资源内容" prop="value">
<el-input-number v-model="resourceLibrary.resourceValue" :precision="0"
placeholder="请输入资源内容"></el-input-number>
</el-form-item>
</el-col>
<el-col v-if="resourceLibrary.resourceType == 'float'" :span="12">
<el-form-item label="资源内容" prop="value">
<el-input-number v-model="resourceLibrary.resourceValue" :precision="2"
placeholder="请输入资源内容"></el-input-number>
</el-form-item>
</el-col>
<el-col v-if="resourceLibrary.resourceType == 'bool'" :span="12">
<el-form-item label="资源内容" prop="value">
<el-switch v-model="resourceLibrary.resourceValue" active-text="真" inactive-text="假"
active-value="true" inactive-value="false" />
</el-form-item>
</el-col>
<el-col v-if="resourceLibrary.resourceType == 'file'" :span="12">
<el-form-item label="资源内容" prop="value">
<file-upload v-model="resourceLibrary.resourceValue" />
</el-form-item>
</el-col>
</el-row>

</el-form>
</div>
</el-card>

<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitBatchForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>


<script> <script>
import { listCtResourceLibrary, getCtResourceLibrary, delCtResourceLibrary, addCtResourceLibrary, updateCtResourceLibrary } from "@/api/business/ctResourceLibrary";
import { listCtResourceLibrary, getCtResourceLibrary, delCtResourceLibrary, addCtResourceLibrary, updateCtResourceLibrary, addBatch } from "@/api/business/ctResourceLibrary";
import { listApplyAll } from "@/api/business/ctApply"; import { listApplyAll } from "@/api/business/ctApply";


export default { export default {
@@ -158,6 +247,8 @@ export default {
dicts: ['app_param_type'], dicts: ['app_param_type'],
data() { data() {
return { return {
// 参数的个数
paramNum: 1,
baseUrl: process.env.VUE_APP_BASE_API, baseUrl: process.env.VUE_APP_BASE_API,
// 遮罩层 // 遮罩层
loading: true, loading: true,
@@ -210,6 +301,11 @@ export default {
}, },
// 所有应用列表 // 所有应用列表
applyList: [], applyList: [],
batch: {
batchOpen: false,
paramNum: 1,
list: [{}],
}
}; };
}, },
created() { created() {
@@ -217,6 +313,26 @@ export default {
this.listApplyAll(); this.listApplyAll();
}, },
methods: { methods: {
/** 修改参数数量 */
changeNum(value) {
this.batch.list = []
for (let index = 0; index < value; index++) {
this.batch.list.push({});
}

},
/**批量新增 */
handleBatchAdd() {
this.batch.batchOpen = true;
},
/** 批量提交 */
submitBatchForm() {
addBatch(this.batch).then(response => {
this.$modal.msgSuccess("新增成功");
this.batch.batchOpen = false;
this.getList();
});
},
/**获取所有应用 */ /**获取所有应用 */
listApplyAll() { listApplyAll() {
listApplyAll({}).then(res => { listApplyAll({}).then(res => {
@@ -234,6 +350,7 @@ export default {
}, },
// 取消按钮 // 取消按钮
cancel() { cancel() {
this.batch.batchOpen = false;
this.open = false; this.open = false;
this.reset(); this.reset();
}, },
@@ -324,7 +441,7 @@ export default {
handleExport() { handleExport() {
this.download('business/ctResourceLibrary/export', { this.download('business/ctResourceLibrary/export', {
...this.queryParams ...this.queryParams
}, `ctResourceLibrary_${new Date().getTime()}.xlsx`)
}, `资源_${new Date().getTime()}.xlsx`)
}, },
/**下载文件 */ /**下载文件 */
downloadUrl(url) { downloadUrl(url) {


Loading…
Cancel
Save