|
|
@@ -4,8 +4,8 @@
|
|
|
<a-select label-in-value
|
|
|
v-model:value="userinfotype"
|
|
|
placeholder="全部客户类型"
|
|
|
- style="width: 120px"
|
|
|
- @change="handleChange">
|
|
|
+ @change="handleChange"
|
|
|
+ style="width: 120px">
|
|
|
<a-select-option value="1">个人</a-select-option>
|
|
|
<a-select-option value="2">企业</a-select-option>
|
|
|
</a-select>
|
|
|
@@ -25,39 +25,37 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts">
|
|
|
-import { defineComponent, ref, SetupContext } from 'vue';
|
|
|
-
|
|
|
-// 处理 客户类型
|
|
|
-function handleUserInfoType() {
|
|
|
- interface Value {
|
|
|
- key?: string;
|
|
|
- label?: string;
|
|
|
- }
|
|
|
- const userinfotype = ref<number>(0);
|
|
|
- function handleChange(value: Value) {
|
|
|
- console.log(value);
|
|
|
- }
|
|
|
- return { userinfotype, handleChange };
|
|
|
-}
|
|
|
+import { defineComponent, ref, SetupContext, unref } from 'vue';
|
|
|
|
|
|
// 搜索
|
|
|
function handleSearch(context: SetupContext) {
|
|
|
const nickname = ref<string>('');
|
|
|
const name = ref<string>('');
|
|
|
const phone = ref<string>('');
|
|
|
-
|
|
|
+ interface Value {
|
|
|
+ key: string;
|
|
|
+ value: string;
|
|
|
+ }
|
|
|
+ let useType = '';
|
|
|
+ const userinfotype = ref<number>(0);
|
|
|
+ function handleChange(value: Value) {
|
|
|
+ useType = value.value;
|
|
|
+ search();
|
|
|
+ }
|
|
|
function search() {
|
|
|
- const result = { nickname: [nickname.value], name: [name.value], mobile: [phone.value] };
|
|
|
+ const result = { nickname: [nickname.value], name: [name.value], mobile: [phone.value], userinfotype: [useType] };
|
|
|
context.emit('search', result);
|
|
|
}
|
|
|
function reset() {
|
|
|
nickname.value = '';
|
|
|
name.value = '';
|
|
|
phone.value = '';
|
|
|
+ userinfotype.value = 0;
|
|
|
+ useType = '';
|
|
|
search();
|
|
|
}
|
|
|
|
|
|
- return { nickname, name, phone, search, reset };
|
|
|
+ return { nickname, name, phone, search, reset, userinfotype, handleChange };
|
|
|
}
|
|
|
|
|
|
export default defineComponent({
|
|
|
@@ -68,7 +66,6 @@ export default defineComponent({
|
|
|
context.emit('add');
|
|
|
}
|
|
|
return {
|
|
|
- ...handleUserInfoType(),
|
|
|
...handleSearch(context),
|
|
|
add,
|
|
|
};
|