zhangwencui
昨天 ad3ecc9167a5f837e0a6292d8e697b799eb6bfc2
发货审批人列表来源修改
已修改3个文件
198 ■■■■■ 文件已修改
src/api/system/user.js 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/cooperativeOffice/collaborativeApproval/contactSelect.vue 136 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/sales/salesAccount/goOut.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/system/user.js
@@ -1,56 +1,64 @@
import upload from '@/utils/upload'
import request from '@/utils/request'
import upload from "@/utils/upload";
import request from "@/utils/request";
// 用户密码重置
export function updateUserPwd(oldPassword, newPassword) {
  const data = {
    oldPassword,
    newPassword
  }
    newPassword,
  };
  return request({
    url: '/system/user/profile/updatePwd',
    method: 'put',
    params: data
  })
    url: "/system/user/profile/updatePwd",
    method: "put",
    params: data,
  });
}
// 查询用户个人信息
export function getUserProfile() {
  return request({
    url: '/system/user/profile',
    method: 'get'
  })
    url: "/system/user/profile",
    method: "get",
  });
}
// 修改用户个人信息
export function updateUserProfile(data) {
  return request({
    url: '/system/user/profile',
    method: 'put',
    data: data
  })
    url: "/system/user/profile",
    method: "put",
    data: data,
  });
}
// 用户头像上传
export function uploadAvatar(data) {
  return request({
    url: '/system/user/profile/avatar',
    method: 'post',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    data: data
  })
    url: "/system/user/profile/avatar",
    method: "post",
    headers: { "Content-Type": "application/x-www-form-urlencoded" },
    data: data,
  });
}
// 查询用户列表
export function userListNoPage() {
  return request({
    url: '/system/user/userListNoPage',
    method: 'get'
  })
    url: "/system/user/userListNoPage",
    method: "get",
  });
}
// 查询用户列表
export function userListNoPageByTenantId() {
  return request({
    url: '/system/user/userListNoPageByTenantId',
    method: 'get'
  })
    url: "/system/user/userListNoPageByTenantId",
    method: "get",
  });
}
// 查询审批人
export function approveUserList(query) {
  return request({
    url: "/approveUser/getList",
    method: "get",
    params: query,
  });
}
src/pages/cooperativeOffice/collaborativeApproval/contactSelect.vue
@@ -1,12 +1,13 @@
<template>
  <view class="contact-select">
    <!-- 顶部标题栏 -->
    <PageHeader title="选择联系人" @back="goBack">
    <PageHeader title="选择联系人"
                @back="goBack">
      <template #right>
        <text class="confirm-btn" @click="confirmSelect">确定</text>
        <text class="confirm-btn"
              @click="confirmSelect">确定</text>
      </template>
    </PageHeader>
    <!-- 搜索框 -->
<!--    <view class="search-section">-->
<!--      <van-search-->
@@ -16,12 +17,13 @@
<!--        @input="onSearch"-->
<!--      />-->
<!--    </view>-->
    <!-- 已选择的联系人 -->
    <view class="selected-section" v-if="selectedContact">
    <view class="selected-section"
          v-if="selectedContact">
      <view class="selected-header">
        <text class="selected-title">已选择</text>
        <text class="clear-btn" @click="clearSelected">清空</text>
        <text class="clear-btn"
              @click="clearSelected">清空</text>
      </view>
      <view class="selected-item">
        <view class="contact-avatar">
@@ -30,29 +32,26 @@
        <view class="contact-details">
          <text class="contact-name">{{ selectedContact.nickName }}</text>
        </view>
        <u-icon name="close" size="16" color="#999" @click="clearSelected" />
        <u-icon name="close"
                size="16"
                color="#999"
                @click="clearSelected" />
      </view>
    </view>
    <!-- 联系人列表 -->
    <view class="contact-list">
      <view class="list-header">
        <text class="list-title">全部联系人</text>
      </view>
      <u-list
        v-model:loading="loading"
      <u-list v-model:loading="loading"
        :finished="finished"
        finished-text="没有更多了"
        @load="onLoad"
      >
        <view
          v-for="contact in userList"
              @load="onLoading">
        <view v-for="contact in userList"
          :key="contact.userId"
          class="contact-item"
          :class="{ 'selected': isSelected(contact) }"
          @click="selectContact(contact)"
        >
              @click="selectContact(contact)">
          <view class="contact-info">
            <view class="contact-avatar">
              <text class="avatar-text">{{ contact.nickName.charAt(0) }}</text>
@@ -69,76 +68,93 @@
</template>
<script setup>
import { ref, onMounted } from 'vue'
import { userListNoPageByTenantId } from "@/api/system/user"
const loading = ref(false)
const finished = ref(false)
const selectedContact = ref(null)
const userList = ref([])
  import { ref, onMounted } from "vue";
  import { userListNoPageByTenantId, approveUserList } from "@/api/system/user";
  import { onLoad } from "@dcloudio/uni-app";
  const loading = ref(false);
  const finished = ref(false);
  const selectedContact = ref(null);
  const userList = ref([]);
// 接收传递的参数
const stepIndex = ref(0)
  const stepIndex = ref(0);
onMounted(() => {
  // 从本地存储获取参数
  const storedStepIndex = uni.getStorageSync('stepIndex');
    const storedStepIndex = uni.getStorageSync("stepIndex");
  if (storedStepIndex !== undefined && storedStepIndex !== null) {
    stepIndex.value = parseInt(storedStepIndex)
      stepIndex.value = parseInt(storedStepIndex);
  }
  
  // 初始化联系人数据
  initContacts()
})
    initContacts();
  });
const initContacts = () => {
  userListNoPageByTenantId().then((res) => {
    userList.value = res.data
  })
  finished.value = true
    if (approveType.value) {
      approveUserList({ approveType: approveType.value }).then(res => {
        userList.value = [...res.data];
        userList.value.forEach(item => {
          item.nickName = item.nickName || item.userName;
        });
      });
    } else {
      userListNoPageByTenantId().then(res => {
        userList.value = res.data;
      });
}
    finished.value = true;
  };
const onLoad = () => {
  const onLoading = () => {
  // 模拟加载更多数据
  setTimeout(() => {
    loading.value = false
    finished.value = true
  }, 1000)
}
      loading.value = false;
      finished.value = true;
    }, 1000);
  };
const isSelected = (contact) => {
  return selectedContact.value && selectedContact.value.userId === contact.userId
}
  const isSelected = contact => {
    return (
      selectedContact.value && selectedContact.value.userId === contact.userId
    );
  };
const selectContact = (contact) => {
  const selectContact = contact => {
  // 单选模式,直接替换选中的联系人
  selectedContact.value = contact
}
    selectedContact.value = contact;
  };
const clearSelected = () => {
  selectedContact.value = null
}
    selectedContact.value = null;
  };
const goBack = () => {
  uni.removeStorageSync('stepIndex');
  uni.navigateBack()
}
    uni.removeStorageSync("stepIndex");
    uni.navigateBack();
  };
const confirmSelect = () => {
  if (!selectedContact.value) {
    uni.showToast({
      title: '请选择一个联系人',
      icon: 'none'
    })
    return
        title: "请选择一个联系人",
        icon: "none",
      });
      return;
  }
  // 使用 uni.$emit 发送数据
  uni.$emit('selectContact', {
    uni.$emit("selectContact", {
    stepIndex: stepIndex.value,
    contact: selectedContact.value
  })
  uni.navigateBack()
      contact: selectedContact.value,
    });
    uni.navigateBack();
  };
  const approveType = ref(null);
  onLoad(options => {
    if (options.approveType) {
      approveType.value = options.approveType;
}
  });
</script>
<style scoped lang="scss">
@@ -215,7 +231,7 @@
  position: relative;
  
  &::before {
    content: '';
      content: "";
    position: absolute;
    top: -2px;
    right: -2px;
@@ -228,7 +244,7 @@
  }
  
  &::after {
    content: '✓';
      content: "✓";
    position: absolute;
    top: -1px;
    right: -1px;
@@ -271,7 +287,7 @@
    background-color: #f0f8ff;
    
    &::before {
      content: '';
        content: "";
      position: absolute;
      left: 8px;
      top: 50%;
src/pages/sales/salesAccount/goOut.vue
@@ -242,7 +242,7 @@
    // 跳转到联系人选择页面
    uni.setStorageSync("stepIndex", stepIndex);
    uni.navigateTo({
      url: "/pages/cooperativeOffice/collaborativeApproval/contactSelect",
      url: "/pages/cooperativeOffice/collaborativeApproval/contactSelect?approveType=7",
    });
  };