[参数项列表] 编辑

This commit is contained in:
zhaomeijing
2022-04-28 16:37:07 +08:00
parent a4e20ba82b
commit 145a9468b5
2 changed files with 214 additions and 193 deletions
@@ -1,4 +1,5 @@
<template> <template>
<div>
<a-drawer <a-drawer
:title="title" :title="title"
:maskClosable="false" :maskClosable="false"
@@ -31,7 +32,7 @@
<span class="title-text-text" :title="$t('Required')">{{$t('Required')}}</span> <span class="title-text-text" :title="$t('Required')">{{$t('Required')}}</span>
</div> </div>
<a-form-model-item class="itemModel" prop="state"> <a-form-model-item class="itemModel" prop="state">
<a-select :placeholder="$t('PleaseSelect')+$t('Required')" v-model="formInline.isMust"> <a-select :placeholder="$t('PleaseSelect')+$t('Required')" v-model='formInline.isMust'>
<a-select-option v-for="(item, key) in isRequired" :key="key" :value="item.value"> <a-select-option v-for="(item, key) in isRequired" :key="key" :value="item.value">
<span style="display: inline-block;width: 100%" :title=" item.label "> <span style="display: inline-block;width: 100%" :title=" item.label ">
{{ item.label }} {{ item.label }}
@@ -202,11 +203,9 @@
</div> </div>
<a-form-model-item class="itemModel" prop="paramsTemplateName"> <a-form-model-item class="itemModel" prop="paramsTemplateName">
<a-button type="primary" class="button-text" <a-button type="primary" class="button-text"
@click="clickButtonToUpload(item)"> @click="clickButtonToUpload()">
<!-- {{ (formInline[item.db_field_name] === 'null' || formInline[item.db_field_name] === '' ||--> {{ (formInline.fileTemplateConnectId === 'null' || formInline.fileTemplateConnectId === '' ||
<!-- formInline[item.db_field_name] == null) ? $t('clickUpload') : $t('viewUploadedFiles')--> formInline.fileTemplateConnectId == null) ? $t('clickUpload') : $t('viewUploadedFiles')}}
<!-- }}-->
{{ $t('clickUpload') }}
</a-button> </a-button>
</a-form-model-item> </a-form-model-item>
</div> </div>
@@ -272,14 +271,18 @@
<a-button @click="handleSubmit" type="primary" :loading="confirmLoading">{{$t('submit')}}</a-button> <a-button @click="handleSubmit" type="primary" :loading="confirmLoading">{{$t('submit')}}</a-button>
</div> </div>
</a-drawer> </a-drawer>
<uploadFile ref="uploadFile" @uploadSuccess="uploadSuccess"></uploadFile>
</div>
</template> </template>
<script> <script>
import PersonnelSelection from '@/components/PersonnelSelection/index' import PersonnelSelection from '@/components/PersonnelSelection/index'
import { getAction, postAction, downloadFile, putAction } from '@/api/manage' import { getAction, postAction, downloadFile, putAction } from '@/api/manage'
import uploadFile from '@/components/uploadFile/file'
export default { export default {
name: 'addModel', name: 'addModel',
components: { components: {
uploadFile,
PersonnelSelection PersonnelSelection
}, },
props: ['url'], props: ['url'],
@@ -348,10 +351,22 @@ export default {
this.getSysCategoryTree() this.getSysCategoryTree()
}, },
methods: { methods: {
uploadSuccess(data) {
let attIdList = []
if (data && data.length > 0) {
data.map(item => {
attIdList.push(item.id || data.name)
})
}
this.$refs.uploadFile.visible = false
/** 赋值给当前对应的表单文件 */
this.formInline.fileTemplateConnectId = attIdList.join(',')
this.formInline = { ...this.formInline }
},
clickButtonToUpload(item) { clickButtonToUpload(item) {
// this.$refs.uploadFile.perentHandleFunc() // this.$refs.uploadFile.perentHandleFunc()
// this.$refs.uploadFile.state = item.flag // this.$refs.uploadFile.state = item.flag
// this.$refs.uploadFile.visible = true this.$refs.uploadFile.visible = true
// this.uploadName = item.db_field_name // this.uploadName = item.db_field_name
// getAction('sys/common/getFileInfos', { id: this.formInline[item.db_field_name] }).then((res) => { // getAction('sys/common/getFileInfos', { id: this.formInline[item.db_field_name] }).then((res) => {
// if (res.success) { // if (res.success) {
@@ -113,6 +113,7 @@ export default {
dataSource: [], dataSource: [],
confirmLoading: false, confirmLoading: false,
url: { url: {
queryById: 'params/paramsInfo/queryById',
list: 'params/paramsInfo/page', list: 'params/paramsInfo/page',
add: 'params/paramsInfo/add', add: 'params/paramsInfo/add',
edit: 'params/paramsInfo/edit', edit: 'params/paramsInfo/edit',
@@ -227,7 +228,12 @@ export default {
}, },
//编辑 //编辑
edit(item) { edit(item) {
this.$refs.addModelRef.editModel(JSON.parse(JSON.stringify(item))) let _this = this
getAction(_this.url.queryById, { id: item.id }).then((res) => {
if (res.success) {
this.$refs.addModelRef.editModel(JSON.parse(JSON.stringify(res.result)))
}
})
}, },
//删除 //删除
deleteLib(val) { deleteLib(val) {