6.11宁夏下拉框新增输入功能

This commit is contained in:
FrancisHu 2024-06-11 10:33:53 +08:00
parent ee0b911a56
commit 2fea12cec5
2 changed files with 30 additions and 26 deletions

View File

@ -113,19 +113,21 @@
<uni-easyinput type="number" maxlength="11" v-model="exitFormData.phone" placeholder="请输入"></uni-easyinput>
</uni-forms-item>
<uni-forms-item name="unitId" required label="选择退料单位" label-width="150">
<uni-data-select
<zxz-uni-data-select
v-model="exitFormData.unitId"
:localdata="deptRange"
@change="deptChange"
:clear="false"
></uni-data-select>
filterable
></zxz-uni-data-select>
</uni-forms-item>
<uni-forms-item name="lotId" required label="选择退料工程" label-width="150">
<uni-data-select
<zxz-uni-data-select
v-model="exitFormData.lotId"
:localdata="projRange"
:clear="false"
></uni-data-select>
filterable
></zxz-uni-data-select>
</uni-forms-item>
<uni-forms-item name="exitTime" required label="选择预退料时间" label-width="150">
<uni-datetime-picker type="date" :clear-icon="false" v-model="exitFormData.exitTime"/>
@ -231,25 +233,28 @@ import { basePath } from '../../public'
deptChange (e) {
let that = this
console.log(e, that.fetchedList);
for (let i = 0; i < that.fetchedList.length; i++) {
if (e == that.fetchedList[i].id) {
that.newAdd.unitName = that.fetchedList[i].name
}
}
this.$api.fetchMaterial.getProjList({
id: e
}, null).then(res => {
that.fetchedList.forEach(list => {
if (e.value == list.id) that.newAdd.unitName = list.name
})
that.$api.fetchMaterial.getProjList({
id: e.value
}).then(res => {
console.log(res);
if (res.data.code == 200) {
that.projRange = res.data.data.map((item) => {
that.projRange = res.data.data.map(item => {
return {
text: item['name'],
value: item['id']
}
})
} else {
uni.showToast({
icon: 'none',
title: res.data.msg
})
}
}).catch(err => {
console.log(err);
})
},
formSubmit () {
@ -291,7 +296,10 @@ import { basePath } from '../../public'
}
}
}).catch(err => {
uni.showToast({
icon: 'none',
title: '单位与工程不匹配!'
})
})
})
},

View File

@ -58,17 +58,19 @@
<view class="select-area">
<uni-forms ref="deptForm" :modelValue="deptFormData" :rules="rules">
<uni-forms-item name="deptName" required label="选择部门" label-width="100">
<uni-data-select
<zxz-uni-data-select
v-model="deptFormData.deptName"
:localdata="deptRange"
@change="deptChange"
></uni-data-select>
filterable
></zxz-uni-data-select>
</uni-forms-item>
<uni-forms-item name="projName" required label="选择工程" label-width="100">
<uni-data-select
<zxz-uni-data-select
v-model="deptFormData.projName"
:localdata="projRange"
></uni-data-select>
filterable
></zxz-uni-data-select>
</uni-forms-item>
<button class="submit-btn" @click="formSubmit">保存</button>
</uni-forms>
@ -266,9 +268,6 @@ import { basePath } from '../../public';
let that = this
let nowRole = uni.getStorageSync('roles')
let found = false
/* that.ableUseArr.forEach(item => {
if (nowRole.includes(item)) found = true
}) */
for (let role of nowRole) {
console.log(role);
if (that.ableUseArr.includes(role)) {
@ -278,9 +277,6 @@ import { basePath } from '../../public';
}
console.log(found);
await this.getgreementId()
/* if(this.deptFormData.deptName = ''){
return;
} */
if (!found) {
uni.showToast({
icon: 'none',
@ -350,7 +346,7 @@ import { basePath } from '../../public';
console.log(e);
//
this.$api.fetchMaterial.getProjList({
id: e
id: e.value
}, null).then(res => {
console.log(res);
if (res.data.code == 200) {