transfer.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="转派工单" @clickLeft="backAdd">
  4. <template slot="right">
  5. <u-button type="success" size="small" class="u-reset-button" @click="classification"
  6. text="选择部门"></u-button>
  7. </template>
  8. </uni-nav-bar>
  9. <view class="top-wrapper">
  10. <uni-section>
  11. <uni-easyinput prefixIcon="search" style="width: 460rpx" v-model="searchVal" placeholder="搜索名称">
  12. </uni-easyinput>
  13. </uni-section>
  14. <button class="search_btn" @click="getData()">搜索</button>
  15. <image class="menu_icon" src="~@/static/pda/menu.svg"></image>
  16. </view>
  17. <view class="wrapper">
  18. <u-list @scrolltolower="scrolltolower" class="listContent">
  19. <checkbox-group v-for="(item, index) in tableList" :key="index"
  20. @change="e => selectVal(e, item, index)">
  21. <label>
  22. <view class="listBox">
  23. <view class="listBox-sel">
  24. <checkbox :value="item.id" color="#fff" :checked="item.checked" />
  25. </view>
  26. <myCard :columns="columns" :item="item" :index="index+1">
  27. </myCard>
  28. </view>
  29. </label>
  30. </checkbox-group>
  31. <u-empty class="noDate" style="margin-top: 20vh" v-if="!tableList.length"></u-empty>
  32. </u-list>
  33. </view>
  34. <view class="footerButton">
  35. <u-button type="default" text="返回" @click="backAdd"></u-button>
  36. <u-button type="primary" @click="save" text="保存"></u-button>
  37. </view>
  38. <ba-tree-picker ref="treePicker" key="verify" :multiple="false" @select-change="confirm" title="选择分类"
  39. :selectedData="selectedData" :localdata="classificationList" valueKey="id" textKey="name"
  40. childrenKey="children" />
  41. <u-toast ref="uToast"></u-toast>
  42. </view>
  43. </template>
  44. <script>
  45. import myCard from '@/pages/saleManage/components/myCard.vue'
  46. import {
  47. treeByPid
  48. } from '@/api/pda/workOrder.js'
  49. import {
  50. listOrganizations,
  51. reassignmentSalesWorkOrder
  52. } from '@/api/salesServiceManagement/workOrder/index.js'
  53. import {
  54. toTreeData
  55. } from '@/utils/utils.js'
  56. import {
  57. getUserPage
  58. } from '@/api/common.js'
  59. export default {
  60. components: {
  61. myCard,
  62. },
  63. data() {
  64. return {
  65. selectedData: [''],
  66. classificationList: [],
  67. searchVal: '',
  68. isEnd: false,
  69. pageNum: 1,
  70. categoryLevelId: '',
  71. tableList: [],
  72. columns: [
  73. [{
  74. label: '姓名:',
  75. prop: 'name',
  76. type: 'title',
  77. className: 'perce100',
  78. }],
  79. [{
  80. label: '工号:',
  81. prop: 'jobNumber'
  82. }],
  83. [{
  84. label: '电话:',
  85. prop: 'phone'
  86. }],
  87. [{
  88. label: '部门:',
  89. prop: 'groupName'
  90. }],
  91. ],
  92. checkData: {},
  93. id: ''
  94. }
  95. },
  96. onLoad(params) {
  97. this.id = params.id;
  98. },
  99. created() {
  100. this.getTreeList();
  101. },
  102. methods: {
  103. getData() {
  104. this.isEnd = false;
  105. this.pageNum = 1;
  106. this.tableList = [];
  107. this.getList();
  108. },
  109. async getList() {
  110. if (this.isEnd) {
  111. return
  112. }
  113. uni.showLoading({
  114. title: '加载中'
  115. })
  116. try {
  117. let params = {
  118. groupId: this.categoryLevelId,
  119. name: this.searchVal,
  120. pageNum: this.pageNum,
  121. size: 15
  122. }
  123. let res = await getUserPage(params);
  124. if (this.pageNum == 1) {
  125. this.tableList = res.list;
  126. } else {
  127. this.tableList.push(...res.list);
  128. }
  129. this.pageNum += 1;
  130. this.isEnd = this.tableList.length >= res.count;
  131. uni.hideLoading();
  132. } catch (error) {
  133. uni.hideLoading();
  134. }
  135. },
  136. selectVal(e, val, index) {
  137. this.$set(this.tableList[index], 'checked', !this.tableList[index].checked);
  138. this.tableList.forEach((item, i) => {
  139. if (item.id != val.id) {
  140. this.$set(this.tableList[i], 'checked', false)
  141. }
  142. });
  143. this.checkData = val.checked ? val : {};
  144. },
  145. scrolltolower() {
  146. if (this.isEnd) {
  147. return;
  148. }
  149. this.getList();
  150. },
  151. //返回添加页
  152. backAdd() {
  153. uni.navigateBack();
  154. },
  155. classification() {
  156. this.$refs.treePicker._show();
  157. },
  158. confirm(id) {
  159. this.categoryLevelId = id;
  160. this.getData();
  161. },
  162. async getTreeList() {
  163. const data = await listOrganizations({});
  164. let treeList = toTreeData({
  165. data: data || [],
  166. idField: 'id',
  167. parentIdField: 'parentId'
  168. });
  169. this.classificationList = treeList;
  170. this.confirm('');
  171. // this.confirm(treeList[0].id);
  172. },
  173. async save() {
  174. if (!this.checkData.id) {
  175. this.$refs.uToast.show({
  176. type: "warning",
  177. message: "请选择转派人员",
  178. })
  179. return;
  180. }
  181. try {
  182. uni.showLoading({
  183. title: '加载中'
  184. })
  185. let data = {
  186. id: this.id,
  187. executeGroupId: this.checkData.groupId,
  188. executeGroupName: this.checkData.groupName,
  189. executeUserId: this.checkData.id,
  190. executeUserName: this.checkData.name,
  191. }
  192. const res = await reassignmentSalesWorkOrder(data);
  193. if (!res) return;
  194. this.$refs.uToast.show({
  195. type: "success",
  196. message: "操作成功",
  197. })
  198. this.backAdd();
  199. uni.hideLoading();
  200. } catch (error) {
  201. uni.hideLoading();
  202. }
  203. }
  204. }
  205. }
  206. </script>
  207. <style scoped lang="scss">
  208. @import url('@/pages/salesServiceManagement/demandList/components/invoice.scss');
  209. .mainBox {
  210. height: 100vh;
  211. display: flex;
  212. flex-direction: column;
  213. .wrapper {
  214. // flex: 1;
  215. height: calc(100vh - 250rpx);
  216. overflow: hidden;
  217. }
  218. .footerButton {
  219. width: 100%;
  220. height: 84rpx;
  221. display: flex;
  222. position: fixed;
  223. bottom: 0;
  224. z-index: 10;
  225. /deep/.u-button {
  226. height: 100%;
  227. }
  228. >view {
  229. flex: 1;
  230. }
  231. }
  232. .top-wrapper {
  233. background-color: #fff;
  234. display: flex;
  235. width: 750rpx;
  236. height: 88rpx;
  237. padding: 16rpx 32rpx;
  238. align-items: center;
  239. gap: 16rpx;
  240. /deep/.uni-section {
  241. margin-top: 0px;
  242. }
  243. /deep/.uni-section-header {
  244. padding: 0px;
  245. }
  246. .search_btn {
  247. width: 120rpx;
  248. height: 70rpx;
  249. line-height: 70rpx;
  250. padding: 0 24rpx;
  251. background: $theme-color;
  252. font-size: 32rpx;
  253. color: #fff;
  254. margin: 0;
  255. margin-left: 26rpx;
  256. }
  257. .menu_icon {
  258. width: 44rpx;
  259. height: 44rpx;
  260. margin-left: 14rpx;
  261. }
  262. }
  263. .card_box {
  264. padding: 0;
  265. border-bottom: none;
  266. }
  267. }
  268. </style>