chore: 添加TODO注释;以更优雅的方式跳出循环
parent
372e2215f0
commit
24e69ecf36
|
@ -31,6 +31,7 @@
|
||||||
class="!w-30"
|
class="!w-30"
|
||||||
@blur="handleInputConfirm(index, item.id)"
|
@blur="handleInputConfirm(index, item.id)"
|
||||||
@keyup.enter="handleInputConfirm(index, item.id)"
|
@keyup.enter="handleInputConfirm(index, item.id)"
|
||||||
|
@change="handleInputConfirm(index, item.id)"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item2 in item.propertyOpts"
|
v-for="item2 in item.propertyOpts"
|
||||||
|
@ -39,7 +40,6 @@
|
||||||
:value="item2.name"
|
:value="item2.name"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
<!-- <el-input :id="`input${index}`" v-model="inputValue" class="!w-20" /> -->
|
|
||||||
<el-button
|
<el-button
|
||||||
v-show="!inputVisible(index)"
|
v-show="!inputVisible(index)"
|
||||||
class="button-new-tag ml-1"
|
class="button-new-tag ml-1"
|
||||||
|
@ -54,7 +54,6 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ElInput } from 'element-plus'
|
|
||||||
import * as PropertyApi from '@/api/mall/product/property'
|
import * as PropertyApi from '@/api/mall/product/property'
|
||||||
import { PropertyAndValues } from '@/views/mall/product/spu/components'
|
import { PropertyAndValues } from '@/views/mall/product/spu/components'
|
||||||
import { propTypes } from '@/utils/propTypes'
|
import { propTypes } from '@/utils/propTypes'
|
||||||
|
|
|
@ -99,15 +99,14 @@ const submitForm = async () => {
|
||||||
values: []
|
values: []
|
||||||
})
|
})
|
||||||
// 判断最终提交的属性名称是否是选择的 自己手动输入的属性名称不执行emit
|
// 判断最终提交的属性名称是否是选择的 自己手动输入的属性名称不执行emit
|
||||||
attrOption.value.forEach((item) => {
|
for (const element of attrOption.value) {
|
||||||
if (item.name === formData.value.name) {
|
if (element.name === formData.value.name) {
|
||||||
emit('success', propertyId, item.id)
|
emit('success', propertyId, element.id)
|
||||||
message.success(t('common.createSuccess'))
|
message.success(t('common.createSuccess'))
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
// 中断循环
|
return
|
||||||
throw new Error()
|
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
message.success(t('common.createSuccess'))
|
message.success(t('common.createSuccess'))
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -127,6 +126,7 @@ const resetForm = () => {
|
||||||
const getAttrOption = async () => {
|
const getAttrOption = async () => {
|
||||||
formLoading.value = true
|
formLoading.value = true
|
||||||
try {
|
try {
|
||||||
|
// TODO @芋艿:需要增加一个全列表接口
|
||||||
const data = await PropertyApi.getPropertyPage({ pageNo: 1, pageSize: 100 })
|
const data = await PropertyApi.getPropertyPage({ pageNo: 1, pageSize: 100 })
|
||||||
attrOption.value = data.list
|
attrOption.value = data.list
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -201,6 +201,7 @@ const generateSkus = (propertyList: any[]) => {
|
||||||
const getPropertyValueList = async (id, propertyId) => {
|
const getPropertyValueList = async (id, propertyId) => {
|
||||||
formLoading.value = true
|
formLoading.value = true
|
||||||
try {
|
try {
|
||||||
|
// TODO @芋艿:需要增加一个全列表接口
|
||||||
const data = await PropertyApi.getPropertyValuePage({ pageNo: 1, pageSize: 100, propertyId })
|
const data = await PropertyApi.getPropertyValuePage({ pageNo: 1, pageSize: 100, propertyId })
|
||||||
propertyList.value.find((item) => item.id === id).propertyOpts = data.list
|
propertyList.value.find((item) => item.id === id).propertyOpts = data.list
|
||||||
} finally {
|
} finally {
|
||||||
|
|
Loading…
Reference in New Issue