update AddForm、Search组件修改

This commit is contained in:
赵霄
2023-08-29 16:44:45 +08:00
parent f560c8a64c
commit fecd8c01cc
10 changed files with 577 additions and 93 deletions
+48 -24
View File
@@ -2,14 +2,14 @@
<a-form-model :model="formInline" v-if="isFormInline" class="form-add" :rules="rules" ref="ruleForm">
<div v-for="(val,index) in dataList" :key="index">
<div v-if="val && val.length > 0" class="header-text">{{ index }}</div>
<a-row v-if="val && val.length > 0" :gutter="24">
<a-row v-if="val && val.length > 0">
<div v-for="(item, index) in val" :key="index">
<!-- 1, 日期单选 -->
<a-col :span="12" v-if="item.fieldShowType === FieldType.DATE_SINGLE.value">
<div class="box-title-text">
<div class="title-text">
<span class="required" v-if="item.fieldMustInput === '1'">*</span>
<span class="title-text-text" :title="item.dbFieldTxt">{{item.dbFieldTxt}}</span>
<span class="title-text-text" :title="item.dbFieldTxt">{{ item.dbFieldTxt }}</span>
</div>
<a-form-model-item class="item-model" :prop="item.dbFieldName">
<a-date-picker class="box-input"
@@ -19,7 +19,7 @@
value-format="YYYY-MM-DD"
v-model="formInline[item.dbFieldName]"
:disabled="disabled"
style="width: 100%"/>
style="width: 100%" />
</a-form-model-item>
</div>
</a-col>
@@ -28,14 +28,14 @@
<div class="box-title-text">
<div class="title-text">
<span class="required" v-if="item.fieldMustInput === '1'">*</span>
<span class="title-text-text" :title="item.dbFieldTxt">{{item.dbFieldTxt}}</span>
<span class="title-text-text" :title="item.dbFieldTxt">{{ item.dbFieldTxt }}</span>
</div>
<a-form-model-item class="item-model" :prop="item.dbFieldName">
<user-or-organ-selection :placeholder="$t('pleaseSelect')+item.dbFieldTxt"
v-model="formInline[item.dbFieldName]"
type="radio"
selectType="user"
:disabled="disabled"/>
:disabled="disabled" />
</a-form-model-item>
</div>
</a-col>
@@ -44,14 +44,14 @@
<div class="box-title-text">
<div class="title-text">
<span class="required" v-if="item.fieldMustInput === '1'">*</span>
<span class="title-text-text" :title="item.dbFieldTxt">{{item.dbFieldTxt}}</span>
<span class="title-text-text" :title="item.dbFieldTxt">{{ item.dbFieldTxt }}</span>
</div>
<a-form-model-item class="item-model" :prop="item.dbFieldName">
<user-or-organ-selection :placeholder="$t('pleaseSelect')+item.dbFieldTxt"
v-model="formInline[item.dbFieldName]"
selectType="organ"
type="radio"
:disabled="disabled"/>
:disabled="disabled" />
</a-form-model-item>
</div>
</a-col>
@@ -60,7 +60,7 @@
<div class="box-title-text">
<div class="title-text">
<span class="required" v-if="item.fieldMustInput === '1'">*</span>
<span class="title-text-text" :title="item.dbFieldTxt">{{item.dbFieldTxt}}</span>
<span class="title-text-text" :title="item.dbFieldTxt">{{ item.dbFieldTxt }}</span>
</div>
<a-form-model-item class="item-model" :prop="item.dbFieldName">
<j-multiple-date-picker class="box-input" v-model="formInline[item.dbFieldName]" :fieldName="item.dbFieldName"
@@ -73,14 +73,14 @@
<div class="box-title-text">
<div class="title-text">
<span class="required" v-if="item.fieldMustInput === '1'">*</span>
<span class="title-text-text" :title="item.dbFieldTxt">{{item.dbFieldTxt}}</span>
<span class="title-text-text" :title="item.dbFieldTxt">{{ item.dbFieldTxt }}</span>
</div>
<a-form-model-item class="item-model-textarea" :prop="item.dbFieldName">
<a-textarea
:placeholder="$t('pleaseEnter')+item.dbFieldTxt"
:disabled="disabled"
:maxLength="500"
v-model="formInline[item.dbFieldName]" :rows="4"/>
v-model="formInline[item.dbFieldName]" :rows="4" />
</a-form-model-item>
</div>
</a-col>
@@ -89,14 +89,14 @@
<div class="box-title-text">
<div class="title-text">
<span class="required" v-if="item.fieldMustInput === '1'">*</span>
<span class="title-text-text" :title="item.dbFieldTxt">{{item.dbFieldTxt}}</span>
<span class="title-text-text" :title="item.dbFieldTxt">{{ item.dbFieldTxt }}</span>
</div>
<a-form-model-item class="item-model" :prop="item.dbFieldName">
<standard-selection :query="item"
:disabled="disabled"
:standard="formInline"
@change="standardSelectionChange"
v-model="formInline[item.dbFieldName]"/>
v-model="formInline[item.dbFieldName]" />
</a-form-model-item>
</div>
</a-col>
@@ -105,14 +105,14 @@
<div class="box-title-text">
<div class="title-text">
<span class="required" v-if="item.fieldMustInput === '1'">*</span>
<span class="title-text-text" :title="item.dbFieldTxt">{{item.dbFieldTxt}}</span>
<span class="title-text-text" :title="item.dbFieldTxt">{{ item.dbFieldTxt }}</span>
</div>
<a-form-model-item class="item-model" :prop="item.dbFieldName">
<user-or-organ-selection :placeholder="$t('pleaseSelect')+item.dbFieldTxt"
v-model="formInline[item.dbFieldName]"
selectType="organ"
type="checkbox"
:disabled="disabled"/>
:disabled="disabled" />
</a-form-model-item>
</div>
</a-col>
@@ -121,7 +121,7 @@
<div class="box-title-text">
<div class="title-text">
<span class="required" v-if="item.fieldMustInput === '1'">*</span>
<span class="title-text-text" :title="item.dbFieldTxt">{{item.dbFieldTxt}}</span>
<span class="title-text-text" :title="item.dbFieldTxt">{{ item.dbFieldTxt }}</span>
</div>
<a-form-model-item class="item-model" :prop="item.dbFieldName">
<a-button type="primary" class="button-text"
@@ -141,14 +141,14 @@
<div class="box-title-text">
<div class="title-text">
<span class="required" v-if="item.fieldMustInput === '1'">*</span>
<span class="title-text-text" :title="item.dbFieldTxt">{{item.dbFieldTxt}}</span>
<span class="title-text-text" :title="item.dbFieldTxt">{{ item.dbFieldTxt }}</span>
</div>
<a-form-model-item class="item-model" :prop="item.dbFieldName">
<a-input class="box-input"
:disabled="disabled"
v-model="formInline[item.dbFieldName]"
:maxLength="50"
:placeholder="$t('pleaseEnter')+item.dbFieldTxt"/>
:placeholder="$t('pleaseEnter')+item.dbFieldTxt" />
</a-form-model-item>
</div>
</a-col>
@@ -157,14 +157,14 @@
<div class="box-title-text">
<div class="title-text">
<span class="required" v-if="item.fieldMustInput === '1'">*</span>
<span class="title-text-text" :title="item.dbFieldTxt">{{item.dbFieldTxt}}</span>
<span class="title-text-text" :title="item.dbFieldTxt">{{ item.dbFieldTxt }}</span>
</div>
<a-form-model-item class="item-model" :prop="item.dbFieldName">
<j-dict-select-tag class="box-input" v-model="formInline[item.dbFieldName]"
:disabled="disabled"
:placeholder="$t('pleaseSelect')+item.dbFieldTxt"
:type="'select'"
:triggerChange="false" :dictCode="item.dict_field"/>
:triggerChange="false" :dictCode="item.dict_field" />
</a-form-model-item>
</div>
</a-col>
@@ -173,14 +173,14 @@
<div class="box-title-text">
<div class="title-text">
<span class="required" v-if="item.fieldMustInput === '1'">*</span>
<span class="title-text-text" :title="item.dbFieldTxt">{{item.dbFieldTxt}}</span>
<span class="title-text-text" :title="item.dbFieldTxt">{{ item.dbFieldTxt }}</span>
</div>
<a-form-model-item class="item-model" :prop="item.dbFieldName">
<j-multi-select-tag class="box-input" v-model="formInline[item.dbFieldName]"
:disabled="disabled"
:placeholder="$t('pleaseSelect')+item.dbFieldTxt"
:type="'select'"
:triggerChange="false" :dictCode="item.dict_field"/>
:triggerChange="false" :dictCode="item.dict_field" />
</a-form-model-item>
</div>
</a-col>
@@ -214,7 +214,6 @@
</template>
<script>
import { getAction } from '@/api/manage'
import JDictSelectTag from '../dict/JDictSelectTag'
import JMultiSelectTag from '../dict/JMultiSelectTag'
import UploadFile from '../UploadFile'
@@ -235,6 +234,24 @@ export default {
return {}
}
},
// 获取表单数据的方法
getFormFunc: {
type: Function,
required: false,
default: () => {
return function () {
}
}
},
// 获取详细信息的方法
getDocumentInfoFunc: {
type: Function,
required: false,
default: () => {
return function () {
}
}
},
flag: {
type: String,
default: ''
@@ -348,7 +365,11 @@ export default {
this.type = 'edit'
this.loading = true
this.getForm(() => {
getAction(this.url.getDocumentInfo, { id: item.id }).then((res) => {
if (!this.getDocumentInfoFunc || typeof this.getDocumentInfoFunc !== 'function') {
this.loading = false
return
}
this.getDocumentInfoFunc({ id: item.id }).then((res) => {
if (res.success) {
this.formInline = res.result[0]
this.loading = false
@@ -360,12 +381,15 @@ export default {
},
// 获取表单列表
getForm (callBack) {
if (!this.getFormFunc || typeof this.getFormFunc !== 'function') {
return
}
this.confirmLoading = true
const params = {
module: this.flag,
type: this.type
}
getAction(this.url.getAddForm, params).then((res) => {
this.getFormFunc(params).then((res) => {
if (res.success) {
this.dataList = res.result
this.ruleList = res.result