index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  1. <template>
  2. <div class="bgcolor">
  3. <!-- 顶部条-->
  4. <div class="navBarTOP">
  5. <van-nav-bar class="navBar" title="流程审批" left-arrow @click-left="onClickLeft">
  6. <template #right>
  7. <!-- <span class="navRightBtn" @click="editorFn">批量审批</span>-->
  8. </template>
  9. </van-nav-bar>
  10. <div class="serchInput">
  11. <van-cell
  12. class="monthNow selectcell"
  13. :title="companyName"
  14. is-link
  15. arrow-direction="down"
  16. @click="RegionShow = true" />
  17. </div>
  18. <div class="searchDiv">
  19. <van-search
  20. v-model="param"
  21. left-icon="search"
  22. show-action
  23. placeholder="搜索名称/编号/业务员">
  24. <template #action>
  25. <div @click="onSearchm">搜索</div>
  26. </template>
  27. </van-search>
  28. </div>
  29. <van-row>
  30. <van-col span="18">
  31. <van-tabs v-model="isHandle" color="#0057ba" @change="tabChange">
  32. <van-tab
  33. title="待审批"
  34. name="0"
  35. :disabled="disabled"
  36. v-if="userDeptLevel != '4'"></van-tab>
  37. <van-tab
  38. title="已审批"
  39. name="1"
  40. :disabled="disabled"
  41. v-if="userDeptLevel != '4'"></van-tab>
  42. <van-tab title="我发起的" name="2" :disabled="disabled"></van-tab>
  43. </van-tabs>
  44. </van-col>
  45. <van-col span="6" style="text-align: center; margin-top: 10px" @click="sortFN">
  46. <van-icon name="ascending" v-if="orderByStr == 'asc'" color="#0057ba" size="24" />
  47. <van-icon name="descending" v-if="orderByStr == 'desc'" color="#0057ba" size="24" />
  48. </van-col>
  49. </van-row>
  50. </div>
  51. <div class="container">
  52. <div class="lineGrey"></div>
  53. <div class="lineGrey"></div>
  54. <div class="lineGrey"></div>
  55. <div class="lineGrey"></div>
  56. <div class="lineGrey"></div>
  57. <div class="lineGrey"></div>
  58. <div class="lineGrey"></div>
  59. <div class="lineGrey"></div>
  60. <div class="lineGrey"></div>
  61. <div class="lineGrey"></div>
  62. <div class="lineGrey"></div>
  63. <div class="lineGrey"></div>
  64. <div class="lineGrey"></div>
  65. <div class="lineGrey"></div>
  66. <div class="lineGrey"></div>
  67. <div class="lineGrey"></div>
  68. <div class="lineGrey"></div>
  69. <div class="lineGrey"></div>
  70. <div class="lineGrey"></div>
  71. <van-list
  72. v-model="loading"
  73. :finished="finished"
  74. finished-text="--已经到底了--"
  75. @load="onLoad">
  76. <van-checkbox-group v-model="radio">
  77. <div class="cellcontent brud weekList" v-for="(item, index) in list" :key="index">
  78. <van-cell is-link>
  79. <div class="cardContent" @click="approveFn(item)">
  80. <div class="title">
  81. <p class="textLeft">{{ item.storeName }}({{ item.storeCode }})</p>
  82. <p class="textRight" v-if="isHandle == 0">审批</p>
  83. </div>
  84. <div class="info">
  85. 类型:{{ selectDictLabel(storeTypeList, item.storeCategory) }}
  86. </div>
  87. <div class="info">地址:{{ item.addressLine }}</div>
  88. <div class="info">流程类型:{{ item.modelName }}</div>
  89. <div class="info">提交人:{{ item.applyUserName }}</div>
  90. <div class="info" v-if="item.isHandle == 0">
  91. 提交时间:{{ item.applyTime }}
  92. <van-tag
  93. plain
  94. type="primary"
  95. size="medium"
  96. v-if="item.status == 1"
  97. style="float: right"
  98. >待审批</van-tag
  99. >
  100. <van-tag
  101. plain
  102. type="success"
  103. size="medium"
  104. v-if="item.status == 2"
  105. style="float: right"
  106. >审批通过</van-tag
  107. >
  108. <van-tag
  109. plain
  110. type="danger"
  111. size="medium"
  112. v-if="item.status == 3"
  113. style="float: right"
  114. >审批拒绝</van-tag
  115. >
  116. </div>
  117. <div class="info" v-if="item.isHandle == 1">
  118. 审批时间:{{ item.todoTime }}
  119. <van-tag
  120. plain
  121. type="primary"
  122. size="medium"
  123. v-if="item.status == 1"
  124. style="float: right"
  125. >待审批</van-tag
  126. >
  127. <van-tag
  128. plain
  129. type="success"
  130. size="medium"
  131. v-if="item.status == 2"
  132. style="float: right"
  133. >审批通过</van-tag
  134. >
  135. <van-tag
  136. plain
  137. type="danger"
  138. size="medium"
  139. v-if="item.status == 3"
  140. style="float: right"
  141. >审批拒绝</van-tag
  142. >
  143. </div>
  144. <!-- <van-checkbox :name="item" v-if="isHandle=='0'" shape="square" style="float: right"></van-checkbox>-->
  145. </div>
  146. </van-cell>
  147. </div>
  148. </van-checkbox-group>
  149. <van-empty description="" v-if="list.length == 0" />
  150. </van-list>
  151. </div>
  152. <van-popup v-model="submitShow" position="bottom" closeable :style="{ height: '50%' }">
  153. <div>
  154. <p
  155. style="
  156. text-align: center;
  157. padding-bottom: 16px;
  158. border-bottom: 1px solid #f5f5f5;
  159. font-size: 16px;
  160. ">
  161. 审批意见
  162. </p>
  163. <van-field v-model="blackReason" rows="6" type="textarea" placeholder="请输入审批意见" />
  164. <br />
  165. <van-row gutter="20" style="padding: 10px">
  166. <van-col span="12">
  167. <van-button
  168. style="width: 100%"
  169. plain
  170. type="info"
  171. class="E-bgBlue BtnBorder"
  172. @click="outFn"
  173. >驳回</van-button
  174. >
  175. </van-col>
  176. <van-col span="12">
  177. <van-button style="width: 100%" plain type="info" class="E-bgBlue Btn" @click="submit"
  178. >同意</van-button
  179. >
  180. </van-col>
  181. </van-row>
  182. </div>
  183. </van-popup>
  184. <van-popup v-model="RegionShow" capture position="bottom">
  185. <van-picker
  186. show-toolbar
  187. :columns="moduleList"
  188. value-key="name"
  189. @confirm="onregionConfirm"
  190. @cancel="RegionShow = false" />
  191. </van-popup>
  192. </div>
  193. </template>
  194. <script>
  195. import {
  196. getCWStoreTypeList,
  197. getTodoItemList,
  198. completeAll,
  199. getStoreTypeList,
  200. getTodoItemMyList,
  201. } from '@/api/index';
  202. import { moduleList } from '@/api/inventory';
  203. export default {
  204. name: 'MyHistoricalWeekly',
  205. data() {
  206. return {
  207. isHandle: '1',
  208. disabled: false,
  209. pageNum: 1,
  210. pageSize: 10,
  211. loading: false,
  212. finished: false,
  213. RegionShow: false,
  214. storeTypeList: [],
  215. list: [],
  216. radio: [],
  217. blackReason: '',
  218. param: '',
  219. submitShow: false,
  220. orderByStr: 'desc',
  221. moduleList: [],
  222. module: '',
  223. companyName: '全部流程',
  224. userDeptLevel: '',
  225. };
  226. },
  227. activated() {
  228. // userDeptLevel用户部门等级字段,0-总部,1-公司,2-大区,3-销售部,4-业务员
  229. this.$nextTick(() => {
  230. this.userDeptLevel = localStorage.getItem('userDeptLevel');
  231. if (this.userDeptLevel == '4') {
  232. this.isHandle = '2';
  233. }
  234. this.tabChange();
  235. });
  236. this.radio = [];
  237. getStoreTypeList({}).then((res) => {
  238. this.storeTypeList = res.data;
  239. });
  240. moduleList({}).then((res) => {
  241. var moduleList = [{ key: '', name: '全部流程' }];
  242. this.moduleList = moduleList.concat(res.rows);
  243. });
  244. // this.approveList()
  245. },
  246. watch: {
  247. // $route(to, from) {
  248. // this.powerGrade = localStorage.getItem('powerGrade');
  249. // this.pageNum = 1;
  250. // this.radio = [];
  251. // if (to.path == '/signApprovalList' && from.path == '/home') {
  252. // window.scrollTo(0, 0);
  253. // this.approveList();
  254. // }
  255. // if (to.path == '/signApprovalList' && from.path == '/signApproval') {
  256. // this.pageNum = 1;
  257. // this.tabChange();
  258. // }
  259. // },
  260. },
  261. methods: {
  262. onregionConfirm(val) {
  263. this.module = val.key;
  264. this.companyName = val.name;
  265. this.RegionShow = false;
  266. },
  267. sortFN() {
  268. if (this.orderByStr == 'asc') {
  269. this.orderByStr = 'desc';
  270. } else {
  271. this.orderByStr = 'asc';
  272. }
  273. this.tabChange();
  274. },
  275. editorFn() {
  276. if (this.radio.length == 0) {
  277. this.$toast('请选择审批项!');
  278. return;
  279. }
  280. this.blackReason = '';
  281. this.submitShow = true;
  282. },
  283. outFn() {
  284. if (this.blackReason.trim() == '') {
  285. this.$toast('请输入审批意见!');
  286. return;
  287. }
  288. var taskIds = [];
  289. var instanceIds = [];
  290. for (var i = 0; i < this.radio.length; i++) {
  291. taskIds.push(this.radio[i].taskId);
  292. instanceIds.push(this.radio[i].instanceId);
  293. }
  294. var dormData = {
  295. taskIds: taskIds.join(','),
  296. instanceIds: instanceIds.join(','),
  297. variables: JSON.stringify({
  298. comment: this.blackReason,
  299. pass: false,
  300. }),
  301. };
  302. this.$dialog
  303. .confirm({
  304. message: '确认提交审批?',
  305. })
  306. .then(() => {
  307. completeAll(dormData).then((res) => {
  308. if (res.code == 200) {
  309. this.submitShow = false;
  310. this.radio = [];
  311. this.$toast('驳回成功!');
  312. this.pageNum = 1;
  313. this.approveList();
  314. } else {
  315. this.$toast(res.msg);
  316. }
  317. });
  318. });
  319. },
  320. submit() {
  321. var taskIds = [];
  322. var instanceIds = [];
  323. for (var i = 0; i < this.radio.length; i++) {
  324. taskIds.push(this.radio[i].taskId);
  325. instanceIds.push(this.radio[i].instanceId);
  326. }
  327. var dormData = {
  328. taskIds: taskIds.join(','),
  329. instanceIds: instanceIds.join(','),
  330. variables: JSON.stringify({
  331. comment: this.blackReason,
  332. pass: true,
  333. }),
  334. };
  335. this.$dialog
  336. .confirm({
  337. message: '确认提交审批?',
  338. })
  339. .then(() => {
  340. completeAll(dormData).then((res) => {
  341. if (res.code == 200) {
  342. this.radio = [];
  343. this.$toast('提交成功!');
  344. this.submitShow = false;
  345. this.pageNum = 1;
  346. this.approveList();
  347. } else {
  348. this.$toast(res.msg);
  349. }
  350. });
  351. });
  352. },
  353. onLoad() {
  354. this.disabled = true;
  355. if (this.isHandle == 2) {
  356. this.approveMyList();
  357. } else {
  358. this.approveList();
  359. }
  360. },
  361. onSearchm() {
  362. this.tabChange();
  363. },
  364. approveFn(row) {
  365. this.list = [];
  366. this.$router.push({
  367. path: '/signApproval',
  368. query: {
  369. signId: row.signId,
  370. addressLine: row.addressLine,
  371. type: this.isHandle,
  372. itemType: row.itemType,
  373. taskId: row.taskId,
  374. instanceId: row.instanceId,
  375. visitsId: row.visitsId,
  376. },
  377. });
  378. },
  379. tabChange() {
  380. window.scrollTo(0, 0);
  381. this.disabled = true;
  382. this.list = [];
  383. this.pageNum = 1;
  384. if (this.isHandle == 2) {
  385. this.approveMyList();
  386. } else {
  387. this.approveList();
  388. }
  389. },
  390. approveMyList() {
  391. let loading1 = this.$toast.loading({
  392. duration: 0,
  393. message: '数据加载中...',
  394. forbidClick: true,
  395. });
  396. if (this.refreshing) {
  397. this.list = [];
  398. this.refreshing = false;
  399. }
  400. getTodoItemMyList({
  401. pageNum: this.pageNum,
  402. module: this.module,
  403. pageSize: this.pageSize,
  404. param: this.param,
  405. orderByStr: this.orderByStr,
  406. }).then((res) => {
  407. loading1.clear();
  408. this.disabled = false;
  409. this.loading = false;
  410. if (this.pageNum == 1) {
  411. this.list = [];
  412. this.refreshing = false;
  413. }
  414. this.list = this.list.concat(res.rows);
  415. if (this.list.length >= res.total) {
  416. this.finished = true;
  417. } else {
  418. this.finished = false;
  419. }
  420. this.pageNum = this.pageNum + 1;
  421. });
  422. },
  423. approveList() {
  424. let loading1 = this.$toast.loading({
  425. duration: 0,
  426. message: '数据加载中...',
  427. forbidClick: true,
  428. });
  429. if (this.refreshing) {
  430. this.list = [];
  431. this.refreshing = false;
  432. }
  433. getTodoItemList({
  434. isHandle: this.isHandle,
  435. module: this.module,
  436. pageNum: this.pageNum,
  437. pageSize: this.pageSize,
  438. param: this.param,
  439. orderByStr: this.orderByStr,
  440. }).then((res) => {
  441. loading1.clear();
  442. this.disabled = false;
  443. this.loading = false;
  444. if (this.pageNum == 1) {
  445. this.list = [];
  446. this.refreshing = false;
  447. }
  448. this.list = this.list.concat(res.rows);
  449. if (this.list.length >= res.total) {
  450. this.finished = true;
  451. } else {
  452. this.finished = false;
  453. }
  454. this.pageNum = this.pageNum + 1;
  455. });
  456. },
  457. onClickLeft() {
  458. this.$router.push('/home');
  459. },
  460. },
  461. };
  462. </script>
  463. <style lang="scss" scoped>
  464. .bgcolor {
  465. background-color: #f5f5f5;
  466. }
  467. .serchInput {
  468. padding: 0 14px;
  469. margin-top: 14px;
  470. }
  471. .monthNow {
  472. height: 34px;
  473. line-height: 34px;
  474. text-align: left;
  475. font-weight: bold;
  476. padding: 0 16px;
  477. box-sizing: border-box;
  478. background-color: #f1f1f1;
  479. border-radius: 20px;
  480. border: 1px solid #ccc;
  481. position: relative;
  482. color: #333;
  483. font-size: 14px;
  484. .van-cell__left-icon,
  485. .van-cell__right-icon {
  486. line-height: 34px;
  487. }
  488. .CalendarIcon {
  489. float: right;
  490. font-size: 24px;
  491. color: #1989fa;
  492. margin-top: 6px;
  493. position: absolute;
  494. right: 12px;
  495. img {
  496. height: 0.8em;
  497. }
  498. }
  499. }
  500. .monthNowpro {
  501. color: #ccc;
  502. }
  503. .cardContent {
  504. box-sizing: border-box;
  505. }
  506. .cardContent .title {
  507. font-size: 14px;
  508. font-weight: bold;
  509. color: #333;
  510. line-height: 14px;
  511. }
  512. .cardContent .info {
  513. font-size: 14px;
  514. color: #999;
  515. line-height: 26px;
  516. }
  517. .cardContent .title p {
  518. padding: 0;
  519. margin: 0;
  520. }
  521. .cardContent .title .textLeft {
  522. display: inline-block;
  523. padding-bottom: 10px;
  524. }
  525. .cardContent .title .textRight {
  526. float: right;
  527. color: #0057ba;
  528. }
  529. .van-tab--active {
  530. color: #0057ba;
  531. }
  532. .brud {
  533. margin: 16px;
  534. border-radius: 8px;
  535. overflow: hidden;
  536. }
  537. .weekList {
  538. border-radius: 0;
  539. }
  540. .Btn {
  541. margin: 0 auto 10px;
  542. display: block;
  543. width: 90%;
  544. border-radius: 5px;
  545. color: #fff !important;
  546. background-color: #0057ba;
  547. border: 1px solid #0057ba;
  548. height: 36px;
  549. }
  550. .BtnBorder {
  551. margin: 0 auto 10px;
  552. display: block;
  553. width: 90%;
  554. border-radius: 5px;
  555. border: 1px solid #0057ba;
  556. color: #0057ba;
  557. height: 36px;
  558. }
  559. .weekList .van-cell {
  560. border-radius: 6px;
  561. overflow: hidden;
  562. }
  563. .weekList .cardContent .title {
  564. line-height: 32px;
  565. }
  566. .weekList .van-cell__right-icon {
  567. top: 4px;
  568. }
  569. .searchDiv {
  570. .van-search {
  571. background: #fff;
  572. }
  573. .van-search__action {
  574. font-size: 14px;
  575. color: #0057ba;
  576. font-weight: bold;
  577. background: #f1f1f1;
  578. border-bottom-right-radius: 60px;
  579. border-top-right-radius: 60px;
  580. border: 1px solid #ccc;
  581. padding: 0 20px;
  582. }
  583. .van-search--show-action {
  584. padding-right: 12px;
  585. }
  586. .van-search__content {
  587. border: 1px solid #ccc;
  588. border-bottom-left-radius: 60px;
  589. border-top-left-radius: 60px;
  590. background: #f1f1f1;
  591. border-right: 0;
  592. }
  593. }
  594. </style>