|
|
@@ -173,81 +173,81 @@ |
|
|
|
|
|
|
|
<!-- 批量新增 --> |
|
|
|
<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-card class="box-card"> |
|
|
|
<div class="text item"> |
|
|
|
<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-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-form-item label="资源键" prop="resourceName" v-hasPermi="['business:ctResourceLibrary:updateKey']"> |
|
|
|
<el-input v-model="resourceLibrary.resourceName" placeholder="请输入资源键" /> |
|
|
|
</el-form-item> |
|
|
|
参数数量<el-input-number v-model="batch.paramNum" :precision="0" placeholder="请输入参数数量" |
|
|
|
@change="changeNum"></el-input-number> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
<el-row :gutter="24"> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="资源描述" prop="resource""> |
|
|
|
</div> |
|
|
|
</el-card> |
|
|
|
<el-card class="box-card" style="overflow-y:scroll;max-height: 500px "> |
|
|
|
<div class="text item" v-for="(resourceLibrary, index) in batch.list" :key="index"> |
|
|
|
<el-divider content-position="left">第 {{ index+1 }} 个参数</el-divider> |
|
|
|
<el-form ref="batchAddFrom" :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> |
|
|
|
</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> |
|
|
@@ -296,7 +296,7 @@ export default { |
|
|
|
resourceName: null, |
|
|
|
appName: null, |
|
|
|
deptId: null, |
|
|
|
appId:null, |
|
|
|
appId: null, |
|
|
|
}, |
|
|
|
// 表单参数 |
|
|
|
form: {}, |
|
|
@@ -334,20 +334,50 @@ export default { |
|
|
|
methods: { |
|
|
|
/** 修改参数数量 */ |
|
|
|
changeNum(value) { |
|
|
|
while(this.batch.list.length > value){ |
|
|
|
while (this.batch.list.length > value) { |
|
|
|
this.batch.list.pop(); |
|
|
|
} |
|
|
|
while(this.batch.list.length < value){ |
|
|
|
while (this.batch.list.length < value) { |
|
|
|
this.batch.list.push({}); |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
/**批量新增 */ |
|
|
|
handleBatchAdd() { |
|
|
|
this.batch.list = [] |
|
|
|
this.batch.list.push({}); |
|
|
|
this.batch.batchOpen = true; |
|
|
|
}, |
|
|
|
/** 批量提交 */ |
|
|
|
submitBatchForm() { |
|
|
|
let that = this; |
|
|
|
let noAdd = false; |
|
|
|
let msg = ""; |
|
|
|
|
|
|
|
this.batch.list.forEach(function (resourceLibrary, index) { |
|
|
|
console.log("resourceLibrary", resourceLibrary); |
|
|
|
if (!resourceLibrary.resourceType) { |
|
|
|
msg = "资源类型不能为空"; |
|
|
|
noAdd = true; |
|
|
|
console.log(1); |
|
|
|
} |
|
|
|
|
|
|
|
if (!resourceLibrary.resourceName) { |
|
|
|
msg = "资源键不能为空"; |
|
|
|
noAdd = true; |
|
|
|
console.log(2); |
|
|
|
} |
|
|
|
|
|
|
|
if (!resourceLibrary.resource) { |
|
|
|
msg = "资源描述不能为空"; |
|
|
|
noAdd = true; |
|
|
|
console.log(3); |
|
|
|
} |
|
|
|
}); |
|
|
|
if (noAdd) { |
|
|
|
that.$modal.msgError(msg); |
|
|
|
return |
|
|
|
} |
|
|
|
addBatch(this.batch).then(response => { |
|
|
|
this.$modal.msgSuccess("新增成功"); |
|
|
|
this.batch.batchOpen = false; |
|
|
|