|
@@ -68,6 +68,17 @@
|
|
<up-icon name="arrow-right"></up-icon>
|
|
<up-icon name="arrow-right"></up-icon>
|
|
</template>
|
|
</template>
|
|
</up-form-item>
|
|
</up-form-item>
|
|
|
|
+
|
|
|
|
+ <up-form-item v-if="item.type === 'cascader'" :label="item.label" :prop="item.key" borderBottom
|
|
|
|
+ labelWidth="94" :required="item.required">
|
|
|
|
+ <view @click.self="() => clickPick(item)">
|
|
|
|
+ <up-input v-model="formData[item.key]" disabled disabledColor="#ffffff"
|
|
|
|
+ :placeholder="'请选择' + item.label" border="none"></up-input>
|
|
|
|
+ </view>
|
|
|
|
+ <template #right>
|
|
|
|
+ <up-icon name="arrow-right"></up-icon>
|
|
|
|
+ </template>
|
|
|
|
+ </up-form-item>
|
|
</view>
|
|
</view>
|
|
</up-form>
|
|
</up-form>
|
|
<!-- <up-button type="primary" text="提交" customStyle="margin-top: 50px" @click="onSubmit"></up-button> -->
|
|
<!-- <up-button type="primary" text="提交" customStyle="margin-top: 50px" @click="onSubmit"></up-button> -->
|
|
@@ -81,19 +92,21 @@
|
|
|
|
|
|
<!-- 省市区选择 province city area初始省市区设置 show:是否显示 @changeClick:更改省市区事件 @sureSelectArea:确认事件 @hideShow:隐藏事件-->
|
|
<!-- 省市区选择 province city area初始省市区设置 show:是否显示 @changeClick:更改省市区事件 @sureSelectArea:确认事件 @hideShow:隐藏事件-->
|
|
<CcSelectDity :province="cityData.province" :city="cityData.city" :area="cityData.area" :show="cityShow"
|
|
<CcSelectDity :province="cityData.province" :city="cityData.city" :area="cityData.area" :show="cityShow"
|
|
- @sureSelectArea="onsetCity" @cityShow="() => cityShow = false"></CcSelectDity>
|
|
|
|
|
|
+ @sureSelectArea="onsetCity" @hideShow="onCityShow"></CcSelectDity>
|
|
|
|
+
|
|
|
|
+ <Picker :columnData="pickerData" ref="pickerRef" @submit="ActionSheetSelect" />
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
<script setup>
|
|
<script setup>
|
|
import { onMounted, reactive, ref } from "vue";
|
|
import { onMounted, reactive, ref } from "vue";
|
|
import CcSelectDity from '@/components/cc-selectDity/cc-selectDity.vue';
|
|
import CcSelectDity from '@/components/cc-selectDity/cc-selectDity.vue';
|
|
-
|
|
|
|
|
|
+import Picker from '@/components/picker/index.vue'
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
column: {
|
|
column: {
|
|
type: Array,
|
|
type: Array,
|
|
default: [],
|
|
default: [],
|
|
},
|
|
},
|
|
- isCode:{
|
|
|
|
|
|
+ isCode: {
|
|
type: Boolean,
|
|
type: Boolean,
|
|
default: true
|
|
default: true
|
|
}
|
|
}
|
|
@@ -119,6 +132,57 @@ const showSex = ref(false);
|
|
const actions = ref({
|
|
const actions = ref({
|
|
option: []
|
|
option: []
|
|
});
|
|
});
|
|
|
|
+const pickerData = ref([
|
|
|
|
+ {
|
|
|
|
+ businessName: '家庭教育',
|
|
|
|
+ id: '1',
|
|
|
|
+ children: [
|
|
|
|
+ {
|
|
|
|
+ businessName: '语文',
|
|
|
|
+ id: '2',
|
|
|
|
+ children: [
|
|
|
|
+ {
|
|
|
|
+ businessName: '一年级',
|
|
|
|
+ id: '4',
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ businessName: '二年级',
|
|
|
|
+ id: '5',
|
|
|
|
+ }
|
|
|
|
+ ]
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ businessName: '数学',
|
|
|
|
+ id: '3',
|
|
|
|
+ }
|
|
|
|
+ ]
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ businessName: '家庭清洁',
|
|
|
|
+ id: '6',
|
|
|
|
+ children: [
|
|
|
|
+ {
|
|
|
|
+ businessName: '清洁1',
|
|
|
|
+ id: '7',
|
|
|
|
+ children: [
|
|
|
|
+ {
|
|
|
|
+ businessName: '清洁11',
|
|
|
|
+ id: '8',
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ businessName: '清洁22',
|
|
|
|
+ id: '9',
|
|
|
|
+ }
|
|
|
|
+ ]
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ businessName: '清洁3',
|
|
|
|
+ id: '10',
|
|
|
|
+ }
|
|
|
|
+ ]
|
|
|
|
+ }
|
|
|
|
+])
|
|
|
|
+const pickerRef = ref(null)
|
|
|
|
|
|
const cityData = reactive({
|
|
const cityData = reactive({
|
|
province: "广东省",
|
|
province: "广东省",
|
|
@@ -144,6 +208,10 @@ function openActionSheet(row) {
|
|
showSex.value = true;
|
|
showSex.value = true;
|
|
actions.value = row
|
|
actions.value = row
|
|
}
|
|
}
|
|
|
|
+function onCityShow() {
|
|
|
|
+ console.log('onCityShow');
|
|
|
|
+ cityShow.value = false;
|
|
|
|
+}
|
|
|
|
|
|
function openCity(row) {
|
|
function openCity(row) {
|
|
console.log(row);
|
|
console.log(row);
|
|
@@ -166,6 +234,11 @@ function ActionSheetSelect(e) {
|
|
Object.assign(formData, {
|
|
Object.assign(formData, {
|
|
[actions.value.key]: e.key || e.name
|
|
[actions.value.key]: e.key || e.name
|
|
})
|
|
})
|
|
|
|
+ if(actions.value.type === 'cascader'){
|
|
|
|
+ Object.assign(formData, {
|
|
|
|
+ [actions.value.key + 'key' ]: e.value
|
|
|
|
+ })
|
|
|
|
+ }
|
|
console.log('formData.value', formData);
|
|
console.log('formData.value', formData);
|
|
|
|
|
|
// form_ref.value.validateField(actions.key)
|
|
// form_ref.value.validateField(actions.key)
|
|
@@ -201,11 +274,25 @@ function startFace() {
|
|
|
|
|
|
|
|
|
|
function setData(data) {
|
|
function setData(data) {
|
|
- console.log('setData=>data',data);
|
|
|
|
-
|
|
|
|
- Object.assign(formData, {...data,
|
|
|
|
- sex: data.sex === 0 ? '男' : '女',
|
|
|
|
|
|
+ console.log('setData=>data', data);
|
|
|
|
+ for (let i = 0; i < props.column.length; i++) {
|
|
|
|
+ const element = props.column[i];
|
|
|
|
+
|
|
|
|
+ if(element.type === 'cascader') {
|
|
|
|
+ const key = "5"
|
|
|
|
+ const lable = pickerRef.value.piceInit(key);
|
|
|
|
+ console.log('element.type',lable,key);
|
|
|
|
+ Object.assign(formData, {
|
|
|
|
+ [element.key]: lable,
|
|
|
|
+ [element.key+'key']: key
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ Object.assign(formData, {
|
|
|
|
+ ...data,
|
|
|
|
+ sex: data.sex === 0 ? '男' : '女',
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
@@ -226,19 +313,21 @@ function onResetField() {
|
|
form_ref.value.clearValidate()
|
|
form_ref.value.clearValidate()
|
|
}
|
|
}
|
|
|
|
|
|
-function cityChange(e) {
|
|
|
|
- console.log('e', e);
|
|
|
|
|
|
+function clickPick(row) {
|
|
|
|
+ console.log('e', row);
|
|
|
|
+ actions.value = row
|
|
|
|
+ console.log('e', actions.value);
|
|
|
|
+ pickerRef.value.show();
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
const rules = {};
|
|
const rules = {};
|
|
for (let i = 0; i < props.column.length; i++) {
|
|
for (let i = 0; i < props.column.length; i++) {
|
|
rules[props.column[i].key] = props.column[i].rules
|
|
rules[props.column[i].key] = props.column[i].rules
|
|
}
|
|
}
|
|
form_ref.value && form_ref.value.setRules(rules)
|
|
form_ref.value && form_ref.value.setRules(rules)
|
|
-
|
|
|
|
-
|
|
|
|
console.log('uni=====>', uni);
|
|
console.log('uni=====>', uni);
|
|
|
|
|
|
})
|
|
})
|