前台必填字段

This commit is contained in:
gaoyuanwei 2022-07-26 10:18:34 +08:00
parent 837641ba79
commit 14d684bdfd
2 changed files with 114 additions and 69 deletions

View File

@ -301,6 +301,9 @@
if (!dataFrom.value.name) { if (!dataFrom.value.name) {
notFilled.value.push('应用名称') notFilled.value.push('应用名称')
} }
if (!dataFrom.value.shareCondition) {
notFilled.value.push('共享条件')
}
if (!dataFrom.value.description) { if (!dataFrom.value.description) {
notFilled.value.push('应用描述') notFilled.value.push('应用描述')
} }
@ -337,15 +340,15 @@
) { ) {
notFilled.value.push('应用类型') notFilled.value.push('应用类型')
} }
if ( // if (
!dataFrom.value.infoList.filter( // !dataFrom.value.infoList.filter(
(val) => val.attrType === '共享条件' // (val) => val.attrType === ''
)[0] || // )[0] ||
!dataFrom.value.infoList.filter((val) => val.attrType === '共享条件')[0] // !dataFrom.value.infoList.filter((val) => val.attrType === '')[0]
.attrValue // .attrValue
) { // ) {
notFilled.value.push('共享条件') // notFilled.value.push('')
} // }
if (notFilled.value.length > 0) { if (notFilled.value.length > 0) {
message.warning('请填写必填字段') message.warning('请填写必填字段')
console.log(notFilled.value) console.log(notFilled.value)

View File

@ -14,9 +14,8 @@
<div></div> <div></div>
</div> </div>
<template v-if="title.isConfigure"> <template v-if="title.isConfigure">
<a-form ref="formRef" :model="data" name="basic"> <div class="bottom">
<div class="bottom"> <!-- <div class="items" v-if="data[title.name].length > 0">
<!-- <div class="items" v-if="data[title.name].length > 0">
<div <div
class="item" class="item"
v-for="(val, index) in data[title.name]" v-for="(val, index) in data[title.name]"
@ -44,75 +43,74 @@
</div> </div>
</div> </div>
</div> --> </div> -->
<div
v-for="(val, index) in data[title.name]"
:key="'key1' + val.name + index"
>
<div <div
v-for="(val, index) in data[title.name]" style="
:key="'key1' + val.name + index" font-size: 0.18rem;
font-weight: 600;
display: flex;
justify-content: flex-start;
"
> >
<div <span>{{ title.name }}-{{ index + 1 }}</span>
style=" <a-popconfirm
font-size: 0.18rem; :title="'是否删除该条' + title.name + '?'"
font-weight: 600; ok-text="是"
display: flex; cancel-text="否"
justify-content: flex-start; @confirm="del(title.name, index)"
"
> >
<span>{{ title.name }}-{{ index + 1 }}</span> <div class="del">
<a-popconfirm <i class="delImg"></i>
:title="'是否删除该条' + title.name + '?'" <div>删除</div>
ok-text="是" </div>
cancel-text="否" </a-popconfirm>
@confirm="del(title.name, index)" </div>
> <div
<div class="del"> class="form"
<i class="delImg"></i> v-for="attr in props.configure.filter(
<div>删除</div> (item, index2) => item.name === title.name
</div> )[0].list"
</a-popconfirm> :key="'key2' + attr.name + index2"
</div> >
<div <span>{{ attr.name }}</span>
class="form" <a-input
v-for="attr in props.configure.filter( disabled
(item, index2) => item.name === title.name v-model:value="val[attr.field]"
)[0].list" :maxlength="24"
:key="'key2' + attr.name + index2" :placeholder="'请填写' + attr.name + ',不超过24个字符'"
> v-if="attr.type == 'input'"
<span>{{ attr.name }}</span> />
<template v-if="attr.type == 'input2'">
<a-input <a-input
disabled disabled
v-model:value="val[attr.field]" v-model:value="val[attr.field]"
:maxlength="24"
:placeholder="'请填写' + attr.name + ',不超过24个字符'"
v-if="attr.type == 'input'"
/>
<template v-if="attr.type == 'input2'">
<a-input
disabled
v-model:value="val[attr.field]"
:placeholder="'请填写' + attr.name"
/>
</template>
<a-textarea
disabled
v-model:value="val[attr.field]"
:showCount="true"
:maxlength="200"
:placeholder="'请填写' + attr.name" :placeholder="'请填写' + attr.name"
v-else-if="attr.type == 'textArea'"
/> />
<!-- <a-radio-group </template>
<a-textarea
disabled
v-model:value="val[attr.field]"
:showCount="true"
:maxlength="200"
:placeholder="'请填写' + attr.name"
v-else-if="attr.type == 'textArea'"
/>
<!-- <a-radio-group
v-model:value="val[attr.field]" v-model:value="val[attr.field]"
:options="val.options" :options="val.options"
@change="radioChange" @change="radioChange"
v-else-if="attr.type == 'radio'" v-else-if="attr.type == 'radio'"
/> --> /> -->
<div v-else-if="attr.type == 'radio'"> <div v-else-if="attr.type == 'radio'">
{{ val[attr.field] + (attr.company || '') }} {{ val[attr.field] + (attr.company || '') }}
</div> </div>
<span v-else-if="attr.type === 'image'"> <span v-else-if="attr.type === 'image'">
<a-image :width="85" :height="60" :src="val.img" /> <a-image :width="85" :height="60" :src="val.img" />
</span> </span>
<!-- <upload <!-- <upload
:key="showKey" :key="showKey"
type="图片" type="图片"
btnName="上传图片" btnName="上传图片"
@ -438,7 +436,51 @@
请选择{{ item.name }} 请选择{{ item.name }}
</div> </div>
</div> </div>
</a-form> <!-- 来源应用 -->
<div class="AssociatedApplication">
<a-modal
v-model:visible="visibleAssociatedApplication"
:title="titleName"
@ok="handleOk"
@cancel="handleCancel"
style="width: 9.6rem"
>
<div>
<a-transfer
v-model:target-keys="targetKeys"
v-model:selected-keys="selectedKeys"
:data-source="mockData"
:titles="titles"
:render="(item) => item.title"
@change="handleChange"
@selectChange="handleSelectChange"
/>
</div>
</a-modal>
</div>
<!-- 关联组件 -->
<div class="AssociatedApplication">
<a-modal
v-model:visible="visibleAssociatedApplicationOther"
:title="titleName"
@ok="handleOk"
@cancel="handleCancel"
style="width: 960px"
>
<div>
<a-transfer
v-model:target-keys="targetKeysOther"
v-model:selected-keys="selectedKeysOther"
:data-source="mockDataOther"
:titles="titles"
:render="(item) => item.title"
@change="handleChangeOther"
@selectChange="handleSelectChangeOther"
/>
</div>
</a-modal>
</div>
</div>
</template> </template>
</div> </div>
</div> </div>