前台必填字段

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

View File

@ -14,9 +14,8 @@
<div></div>
</div>
<template v-if="title.isConfigure">
<a-form ref="formRef" :model="data" name="basic">
<div class="bottom">
<!-- <div class="items" v-if="data[title.name].length > 0">
<div class="bottom">
<!-- <div class="items" v-if="data[title.name].length > 0">
<div
class="item"
v-for="(val, index) in data[title.name]"
@ -44,75 +43,74 @@
</div>
</div>
</div> -->
<div
v-for="(val, index) in data[title.name]"
:key="'key1' + val.name + index"
>
<div
v-for="(val, index) in data[title.name]"
:key="'key1' + val.name + index"
style="
font-size: 0.18rem;
font-weight: 600;
display: flex;
justify-content: flex-start;
"
>
<div
style="
font-size: 0.18rem;
font-weight: 600;
display: flex;
justify-content: flex-start;
"
<span>{{ title.name }}-{{ index + 1 }}</span>
<a-popconfirm
:title="'是否删除该条' + title.name + '?'"
ok-text="是"
cancel-text="否"
@confirm="del(title.name, index)"
>
<span>{{ title.name }}-{{ index + 1 }}</span>
<a-popconfirm
:title="'是否删除该条' + title.name + '?'"
ok-text="是"
cancel-text="否"
@confirm="del(title.name, index)"
>
<div class="del">
<i class="delImg"></i>
<div>删除</div>
</div>
</a-popconfirm>
</div>
<div
class="form"
v-for="attr in props.configure.filter(
(item, index2) => item.name === title.name
)[0].list"
:key="'key2' + attr.name + index2"
>
<span>{{ attr.name }}</span>
<div class="del">
<i class="delImg"></i>
<div>删除</div>
</div>
</a-popconfirm>
</div>
<div
class="form"
v-for="attr in props.configure.filter(
(item, index2) => item.name === title.name
)[0].list"
:key="'key2' + attr.name + index2"
>
<span>{{ attr.name }}</span>
<a-input
disabled
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]"
: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"
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]"
:options="val.options"
@change="radioChange"
v-else-if="attr.type == 'radio'"
/> -->
<div v-else-if="attr.type == 'radio'">
{{ val[attr.field] + (attr.company || '') }}
</div>
<span v-else-if="attr.type === 'image'">
<a-image :width="85" :height="60" :src="val.img" />
</span>
<!-- <upload
<div v-else-if="attr.type == 'radio'">
{{ val[attr.field] + (attr.company || '') }}
</div>
<span v-else-if="attr.type === 'image'">
<a-image :width="85" :height="60" :src="val.img" />
</span>
<!-- <upload
:key="showKey"
type="图片"
btnName="上传图片"
@ -438,7 +436,51 @@
请选择{{ item.name }}
</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>
</div>
</div>