| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284 |
- <template>
- <view class="mainBox">
- <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="转派工单" @clickLeft="backAdd">
- <template slot="right">
- <u-button type="success" size="small" class="u-reset-button" @click="classification"
- text="选择部门"></u-button>
- </template>
- </uni-nav-bar>
- <view class="top-wrapper">
- <uni-section>
- <uni-easyinput prefixIcon="search" style="width: 460rpx" v-model="searchVal" placeholder="搜索名称">
- </uni-easyinput>
- </uni-section>
- <button class="search_btn" @click="getData()">搜索</button>
- <image class="menu_icon" src="~@/static/pda/menu.svg"></image>
- </view>
- <view class="wrapper">
- <u-list @scrolltolower="scrolltolower" class="listContent">
- <checkbox-group v-for="(item, index) in tableList" :key="index"
- @change="e => selectVal(e, item, index)">
- <label>
- <view class="listBox">
- <view class="listBox-sel">
- <checkbox :value="item.id" color="#fff" :checked="item.checked" />
- </view>
- <myCard :columns="columns" :item="item" :index="index+1">
- </myCard>
- </view>
- </label>
- </checkbox-group>
- <u-empty class="noDate" style="margin-top: 20vh" v-if="!tableList.length"></u-empty>
- </u-list>
- </view>
- <view class="footerButton">
- <u-button type="default" text="返回" @click="backAdd"></u-button>
- <u-button type="primary" @click="save" text="保存"></u-button>
- </view>
- <ba-tree-picker ref="treePicker" key="verify" :multiple="false" @select-change="confirm" title="选择分类"
- :selectedData="selectedData" :localdata="classificationList" valueKey="id" textKey="name"
- childrenKey="children" />
- <u-toast ref="uToast"></u-toast>
- </view>
- </template>
- <script>
- import myCard from '@/pages/saleManage/components/myCard.vue'
- import {
- treeByPid
- } from '@/api/pda/workOrder.js'
- import {
- listOrganizations,
- reassignmentSalesWorkOrder
- } from '@/api/salesServiceManagement/workOrder/index.js'
- import {
- toTreeData
- } from '@/utils/utils.js'
- import {
- getUserPage
- } from '@/api/common.js'
- export default {
- components: {
- myCard,
- },
- data() {
- return {
- selectedData: [''],
- classificationList: [],
- searchVal: '',
- isEnd: false,
- pageNum: 1,
- categoryLevelId: '',
- tableList: [],
- columns: [
- [{
- label: '姓名:',
- prop: 'name',
- type: 'title',
- className: 'perce100',
- }],
- [{
- label: '工号:',
- prop: 'jobNumber'
- }],
- [{
- label: '电话:',
- prop: 'phone'
- }],
- [{
- label: '部门:',
- prop: 'groupName'
- }],
- ],
- checkData: {},
- id: ''
- }
- },
- onLoad(params) {
- this.id = params.id;
- },
- created() {
- this.getTreeList();
- },
- methods: {
- getData() {
- this.isEnd = false;
- this.pageNum = 1;
- this.tableList = [];
- this.getList();
- },
- async getList() {
- if (this.isEnd) {
- return
- }
- uni.showLoading({
- title: '加载中'
- })
- try {
- let params = {
- groupId: this.categoryLevelId,
- name: this.searchVal,
- pageNum: this.pageNum,
- size: 15
- }
- let res = await getUserPage(params);
- if (this.pageNum == 1) {
- this.tableList = res.list;
- } else {
- this.tableList.push(...res.list);
- }
- this.pageNum += 1;
- this.isEnd = this.tableList.length >= res.count;
- uni.hideLoading();
- } catch (error) {
- uni.hideLoading();
- }
- },
- selectVal(e, val, index) {
- this.$set(this.tableList[index], 'checked', !this.tableList[index].checked);
- this.tableList.forEach((item, i) => {
- if (item.id != val.id) {
- this.$set(this.tableList[i], 'checked', false)
- }
- });
- this.checkData = val.checked ? val : {};
- },
- scrolltolower() {
- if (this.isEnd) {
- return;
- }
- this.getList();
- },
- //返回添加页
- backAdd() {
- uni.navigateBack();
- },
- classification() {
- this.$refs.treePicker._show();
- },
- confirm(id) {
- this.categoryLevelId = id;
- this.getData();
- },
- async getTreeList() {
- const data = await listOrganizations({});
- let treeList = toTreeData({
- data: data || [],
- idField: 'id',
- parentIdField: 'parentId'
- });
- this.classificationList = treeList;
- this.confirm('');
- // this.confirm(treeList[0].id);
- },
- async save() {
- if (!this.checkData.id) {
- this.$refs.uToast.show({
- type: "warning",
- message: "请选择转派人员",
- })
- return;
- }
- try {
- uni.showLoading({
- title: '加载中'
- })
- let data = {
- id: this.id,
- executeGroupId: this.checkData.groupId,
- executeGroupName: this.checkData.groupName,
- executeUserId: this.checkData.id,
- executeUserName: this.checkData.name,
- }
- const res = await reassignmentSalesWorkOrder(data);
- if (!res) return;
- this.$refs.uToast.show({
- type: "success",
- message: "操作成功",
- })
- this.backAdd();
- uni.hideLoading();
- } catch (error) {
- uni.hideLoading();
- }
- }
- }
- }
- </script>
- <style scoped lang="scss">
- @import url('@/pages/salesServiceManagement/demandList/components/invoice.scss');
- .mainBox {
- height: 100vh;
- display: flex;
- flex-direction: column;
- .wrapper {
- // flex: 1;
- height: calc(100vh - 250rpx);
- overflow: hidden;
- }
- .footerButton {
- width: 100%;
- height: 84rpx;
- display: flex;
- position: fixed;
- bottom: 0;
- z-index: 10;
- /deep/.u-button {
- height: 100%;
- }
- >view {
- flex: 1;
- }
- }
- .top-wrapper {
- background-color: #fff;
- display: flex;
- width: 750rpx;
- height: 88rpx;
- padding: 16rpx 32rpx;
- align-items: center;
- gap: 16rpx;
- /deep/.uni-section {
- margin-top: 0px;
- }
- /deep/.uni-section-header {
- padding: 0px;
- }
- .search_btn {
- width: 120rpx;
- height: 70rpx;
- line-height: 70rpx;
- padding: 0 24rpx;
- background: $theme-color;
- font-size: 32rpx;
- color: #fff;
- margin: 0;
- margin-left: 26rpx;
- }
- .menu_icon {
- width: 44rpx;
- height: 44rpx;
- margin-left: 14rpx;
- }
- }
- .card_box {
- padding: 0;
- border-bottom: none;
- }
- }
- </style>
|