fix: 自测问题修复。
This commit is contained in:
@@ -21,14 +21,6 @@
|
||||
inputAlign="right" border="none"></u--input>
|
||||
</u-form-item>
|
||||
|
||||
<u-form-item label="状态" prop="statusName" @click="showStatusPicker = true">
|
||||
<u--input v-model="statusName" disabled disabledColor="#ffffff" placeholder="请选择状态"
|
||||
inputAlign="right" border="none"></u--input>
|
||||
<template #right>
|
||||
<u-icon name="arrow-down"></u-icon>
|
||||
</template>
|
||||
</u-form-item>
|
||||
|
||||
<u-form-item label="备注" prop="remark" labelPosition="top">
|
||||
<u--textarea v-model="form.remark" placeholder="请输入备注" border="none" autoHeight inputAlign="right" count
|
||||
maxlength="500" style="padding:18rpx 0;"></u--textarea>
|
||||
@@ -40,8 +32,6 @@
|
||||
</view>
|
||||
</view>
|
||||
<u-toast ref="uToast"></u-toast>
|
||||
<u-picker itemHeight="88" :show="showStatusPicker" :columns="statusList" keyName="dictLabel" @cancel="showStatusPicker = false"
|
||||
@confirm="handleStatusConfirm"></u-picker>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -52,16 +42,12 @@ import { getDicts } from "@/api/system/dict/data"
|
||||
import { onLoad } from "@dcloudio/uni-app"
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
const statusList = ref([])
|
||||
const title = ref('添加字典类型')
|
||||
const showStatusPicker = ref(false)
|
||||
const statusName = ref('')
|
||||
|
||||
const form = reactive({
|
||||
dictId: undefined,
|
||||
dictName: undefined,
|
||||
dictType: undefined,
|
||||
status: '0',
|
||||
remark: undefined
|
||||
})
|
||||
|
||||
@@ -75,18 +61,9 @@ const rules = {
|
||||
}
|
||||
|
||||
onLoad((option) => {
|
||||
getDicts('sys_normal_disable').then(res => {
|
||||
statusList.value = [res.data]
|
||||
})
|
||||
|
||||
if (option.id) {
|
||||
title.value = '修改字典类型'
|
||||
getDetail(option.id)
|
||||
} else {
|
||||
// 新增时默认显示状态
|
||||
setTimeout(() => {
|
||||
updateStatusName()
|
||||
}, 100)
|
||||
}
|
||||
})
|
||||
|
||||
@@ -94,25 +71,9 @@ onLoad((option) => {
|
||||
function getDetail(id) {
|
||||
getType(id).then(res => {
|
||||
Object.assign(form, res.data)
|
||||
updateStatusName()
|
||||
})
|
||||
}
|
||||
|
||||
// 更新状态名称显示
|
||||
function updateStatusName() {
|
||||
if (statusList.value.length > 0 && statusList.value[0].length > 0) {
|
||||
const item = statusList.value[0].find(v => v.dictValue === form.status)
|
||||
statusName.value = item ? item.dictLabel : ''
|
||||
}
|
||||
}
|
||||
|
||||
// 状态选择确认
|
||||
function handleStatusConfirm(e) {
|
||||
form.status = e.value[0].dictValue
|
||||
statusName.value = e.value[0].dictLabel
|
||||
showStatusPicker.value = false
|
||||
}
|
||||
|
||||
// 提交
|
||||
function submit() {
|
||||
console.log('submit 被调用')
|
||||
|
||||
Reference in New Issue
Block a user