123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273 |
- <template>
- <view class="admin-jiazheng-list">
- <view class="phone-navBar-box">
- <view @click="goUpPage" class="nav-bar-icon"></view>
- <text class="nav-bar-title">家政人员</text>
- <view class="nav-bar-icon-box">
- <text class="nav-bar-right-icon" @click="addJiazhengRenyuan">+</text>
- <uni-icons class="nav-bar-right-icon" type="search" size="18" color="#666"
- @click="toggle('top')"></uni-icons>
- </view>
- </view>
- <view class="jiazheng-search-box">
- <view @click.stop="clickAlltype" class="select-item-box">
- <text>{{data.leixing}}</text>
- <icon :class="allJtClass" />
- </view>
- <view class="jiazheng-search-right">
- <!-- 当前点击 增加 saixuan-active-->
- <view class="saixuan-item-box saixuan-active">
- <text @click="timeClick">更新时间</text>
- <icon :class="updataJtClass" />
- </view>
- <view class="saixuan-item-box">
- <!-- class切换 saixuan-jt-default saixuan-jt-click-->
- <text>录入时间</text>
- <icon :class="luruJtClass" />
- </view>
- </view>
- </view>
- <view class="all-type-box" v-show="isOpen" @click="clickAlltype">
- <dataChecked :list="allType" mode="single" :defaultCount="99" :showAdd="false"
- @change="selectChangeSkill" />
- </view>
- <view>
- <scroll-view scroll-y="true" refresher-enabled="true" :refresher-triggered="data.loading"
- :refresher-threshold="50" refresher-background="transparent" @refresherrefresh="onRefresh"
- class="phone-scroll-view">
- <uni-list class="admin-list-box">
- <uni-list-item v-for="item in data.list" class="admin-list-item-box">
- <template v-slot:body>
- <view>
- <view>{{item.realName}}</view>
- <view @click="telephone(item)">打电话</view>
- </view>
- <view @click="lookUserInfo(item)">
- <image :src="item.icon ||defauleImg" mode=""></image>
- <view>
- <p> {{item.age}}岁|{{item.jingyan}}年经验</p>
- <p>{{item.jiguan}}</p>
- </view>
- <view>
- {{item.zhuangtai}}
- </view>
- </view>
- </template>
- </uni-list-item>
- <uni-load-more :status="data.state" @click="getMore(0)"
- :contentText="data.contentText"></uni-load-more>
- </uni-list>
- </scroll-view>
- </view>
- <view>
- <search-dialog ref="searchDialogRef" @search-btn="dialogSearchBtn"
- @reset-search="dialogSearchReset"></search-dialog>
- </view>
- </view>
- </template>
- <script setup>
- import {
- ref,
- reactive
- } from "vue";
- import {
- onLoad
- } from "@dcloudio/uni-app";
- import {
- getJiazhengList,
- getJiazhengLeixing
- } from "@/api/jiazheng.js"
- import dataChecked from './common/dataChecked.vue';
- import searchDialog from "./common/search.vue";
- const searchDialogRef = ref(null);
- let allType = ref([])
- let data = reactive({
- leixing: '全部类型',
- page: 0,
- size: 10,
- realName: '',
- sortRule: '', //排序规则(1降序,2升序
- sortRule: '', //排序类型(1更新时间,2录入时间)
- userName: '',
- list: [], // 考试列表
- loading: false,
- state: 'more',
- contentText: {
- contentdown: '查看更多',
- contentrefresh: '加载中',
- contentnomore: '没有更多'
- }
- })
- let isOpen = ref(false)
- let defauleImg = ref('@/static/images/my/user-default-img.png')
- const allJtClass = 'select-jt-default';
- const updataJtClass = 'saixuan-jt-default';
- const luruJtClass = 'saixuan-jt-click';
- const isOpenSelect = ref(false);
- const selectedOption = ref('');
- function dialogSearchBtn(name, searchData) {
- switch (name) {
- case '姓名':
- dialogSearchReset();
- data.realName = searchData.value;
- break;
- case '手机号':
- data.userName = searchData.value;
- break;
- }
- data.page = 0;
- refreshData();
- }
- function dialogSearchReset() {
- data.userName = '';
- data.realName = '';
- }
- const clickAlltype = (data) => {
- isOpen.value = !isOpen.value;
- }
- const toggle = (data, index) => {
- searchDialogRef.value.handleShow();
- }
- const addJiazhengRenyuan = () => {
- let pageInfo = {
- status: 'add'
- }
- uni.redirectTo({
- url: "/pages/admin/Jiazheng/jiazhengUserManager?pageInfo=" + JSON.stringify(pageInfo)
- })
- }
- const lookUserInfo = (data) => {
- let pageInfo = {
- status: 'edit',
- id: data.id,
- userId: data.userId
- }
- uni.redirectTo({
- url: `/pages/admin/Jiazheng/jiazhengUserInfo?pageInfo=` + JSON.stringify(pageInfo)
- })
- }
- function goUpPage() {
- uni.redirectTo({
- url: `/pages/admin/ShouYe/shouye`
- })
- }
- function onRefresh() {
- data.page = 0;
- data.list = [];
- data.loading = true;
- refreshData();
- }
- function telephone(data) {
- console.log('data', data);
- uni.makePhoneCall({
- phoneNumber: '114' //仅为示例
- });
- }
- function selectChangeSkill(item) {
- data.leixing = item[0].name
- console.log('selectChangeSkill', item);
- data.page = 0;
- refreshData()
- }
- function refreshData() {
- const opt = {
- "leixing": data.leixing == '全部类型' ? '' : data.leixing,
- "page": 1,
- "realName": data.realName,
- "size": 10,
- "sortRule": data.sortRule,
- "sortType": data.sortType,
- "userName": data.userName
- }
- data.list = [];
- // 数学
- data.state = 'loading';
- data.page++;
- opt.page = data.page;
- getJiazhengList(opt).then(res => {
- data.list = data.list.concat(res.data.data);
- data.loading = false;
- if (res.data.total > data.list.length) {
- data.state = 'more';
- data.loading = false;
- } else {
- data.state = 'no-more';
- data.loading = false;
- }
- }).catch(err => {
- data.state = 'more';
- data.loading = false;
- })
- }
- function timeClick() {
- }
- function getMore() {
- const opt = {
- "leixing": data.leixing == '全部类型' ? '' : data.leixing,
- "page": 1,
- "realName": data.realName,
- "size": 10,
- "sortRule": data.sortRule,
- "sortType": data.sortType,
- "userName": data.userName
- }
- if (data.state == 'no-more') return;
- data.state = 'loading';
- data.page++;
- opt.page = data.page;
- getJiazhengList(opt).then(res => {
- data.list = data.list.concat(res.data.data);
- data.loading = false;
- if (res.data.total > data.list.length) {
- data.state = 'more';
- data.loading = false;
- } else {
- data.state = 'no-more';
- data.loading = false;
- }
- }).catch(err => {
- data.state = 'more';
- data.loading = false;
- })
- }
- function getLeixing() {
- let req = {}
- getJiazhengLeixing(req).then(res => {
- allType = dataConversionObject(res.data)
- console.log('allType', allType.value);
- })
- }
- function dataConversionObject(data) {
- let newList
- newList = data.map((name, index) => ({
- id: index,
- name: name
- }));
- return newList
- }
- onLoad(() => {
- getMore()
- getLeixing()
- })
- </script>
|