index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  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: '0',
  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. created() {
  228. // userDeptLevel用户部门等级字段,0-总部,1-公司,2-大区,3-销售部,4-业务员
  229. this.userDeptLevel = localStorage.getItem('userDeptLevel');
  230. if (this.userDeptLevel == '4') {
  231. this.isHandle = '2';
  232. }
  233. this.radio = [];
  234. getStoreTypeList({}).then((res) => {
  235. this.storeTypeList = res.data;
  236. });
  237. moduleList({}).then((res) => {
  238. var moduleList = [{ key: '', name: '全部流程' }];
  239. this.moduleList = moduleList.concat(res.rows);
  240. });
  241. // this.approveList()
  242. },
  243. watch: {
  244. $route(to, from) {
  245. this.powerGrade = localStorage.getItem('powerGrade');
  246. this.pageNum = 1;
  247. this.radio = [];
  248. if (to.path == '/signApprovalList' && from.path == '/home') {
  249. window.scrollTo(0, 0);
  250. this.approveList();
  251. }
  252. if (to.path == '/signApprovalList' && from.path == '/signApproval') {
  253. this.pageNum = 1;
  254. this.tabChange();
  255. }
  256. },
  257. },
  258. methods: {
  259. onregionConfirm(val) {
  260. this.module = val.key;
  261. this.companyName = val.name;
  262. this.RegionShow = false;
  263. },
  264. sortFN() {
  265. if (this.orderByStr == 'asc') {
  266. this.orderByStr = 'desc';
  267. } else {
  268. this.orderByStr = 'asc';
  269. }
  270. this.tabChange();
  271. },
  272. editorFn() {
  273. if (this.radio.length == 0) {
  274. this.$toast('请选择审批项!');
  275. return;
  276. }
  277. this.blackReason = '';
  278. this.submitShow = true;
  279. },
  280. outFn() {
  281. if (this.blackReason.trim() == '') {
  282. this.$toast('请输入审批意见!');
  283. return;
  284. }
  285. var taskIds = [];
  286. var instanceIds = [];
  287. for (var i = 0; i < this.radio.length; i++) {
  288. taskIds.push(this.radio[i].taskId);
  289. instanceIds.push(this.radio[i].instanceId);
  290. }
  291. var dormData = {
  292. taskIds: taskIds.join(','),
  293. instanceIds: instanceIds.join(','),
  294. variables: JSON.stringify({
  295. comment: this.blackReason,
  296. pass: false,
  297. }),
  298. };
  299. this.$dialog
  300. .confirm({
  301. message: '确认提交审批?',
  302. })
  303. .then(() => {
  304. completeAll(dormData).then((res) => {
  305. if (res.code == 200) {
  306. this.submitShow = false;
  307. this.radio = [];
  308. this.$toast('驳回成功!');
  309. this.pageNum = 1;
  310. this.approveList();
  311. } else {
  312. this.$toast(res.msg);
  313. }
  314. });
  315. });
  316. },
  317. submit() {
  318. var taskIds = [];
  319. var instanceIds = [];
  320. for (var i = 0; i < this.radio.length; i++) {
  321. taskIds.push(this.radio[i].taskId);
  322. instanceIds.push(this.radio[i].instanceId);
  323. }
  324. var dormData = {
  325. taskIds: taskIds.join(','),
  326. instanceIds: instanceIds.join(','),
  327. variables: JSON.stringify({
  328. comment: this.blackReason,
  329. pass: true,
  330. }),
  331. };
  332. this.$dialog
  333. .confirm({
  334. message: '确认提交审批?',
  335. })
  336. .then(() => {
  337. completeAll(dormData).then((res) => {
  338. if (res.code == 200) {
  339. this.radio = [];
  340. this.$toast('提交成功!');
  341. this.submitShow = false;
  342. this.pageNum = 1;
  343. this.approveList();
  344. } else {
  345. this.$toast(res.msg);
  346. }
  347. });
  348. });
  349. },
  350. onLoad() {
  351. this.disabled = true;
  352. if (this.isHandle == 2) {
  353. this.approveMyList();
  354. } else {
  355. this.approveList();
  356. }
  357. },
  358. onSearchm() {
  359. this.tabChange();
  360. },
  361. approveFn(row) {
  362. this.list = [];
  363. this.$router.push({
  364. path: '/signApproval',
  365. query: {
  366. signId: row.signId,
  367. addressLine: row.addressLine,
  368. type: this.isHandle,
  369. itemType: row.itemType,
  370. taskId: row.taskId,
  371. instanceId: row.instanceId,
  372. visitsId: row.visitsId,
  373. },
  374. });
  375. },
  376. tabChange() {
  377. window.scrollTo(0, 0);
  378. this.disabled = true;
  379. this.list = [];
  380. this.pageNum = 1;
  381. if (this.isHandle == 2) {
  382. this.approveMyList();
  383. } else {
  384. this.approveList();
  385. }
  386. },
  387. approveMyList() {
  388. let loading1 = this.$toast.loading({
  389. duration: 0,
  390. message: '数据加载中...',
  391. forbidClick: true,
  392. });
  393. if (this.refreshing) {
  394. this.list = [];
  395. this.refreshing = false;
  396. }
  397. getTodoItemMyList({
  398. pageNum: this.pageNum,
  399. module: this.module,
  400. pageSize: this.pageSize,
  401. param: this.param,
  402. orderByStr: this.orderByStr,
  403. }).then((res) => {
  404. loading1.clear();
  405. this.disabled = false;
  406. this.loading = false;
  407. if (this.pageNum == 1) {
  408. this.list = [];
  409. this.refreshing = false;
  410. }
  411. this.list = this.list.concat(res.rows);
  412. if (this.list.length >= res.total) {
  413. this.finished = true;
  414. } else {
  415. this.finished = false;
  416. }
  417. this.pageNum = this.pageNum + 1;
  418. });
  419. },
  420. approveList() {
  421. let loading1 = this.$toast.loading({
  422. duration: 0,
  423. message: '数据加载中...',
  424. forbidClick: true,
  425. });
  426. if (this.refreshing) {
  427. this.list = [];
  428. this.refreshing = false;
  429. }
  430. getTodoItemList({
  431. isHandle: this.isHandle,
  432. module: this.module,
  433. pageNum: this.pageNum,
  434. pageSize: this.pageSize,
  435. param: this.param,
  436. orderByStr: this.orderByStr,
  437. }).then((res) => {
  438. loading1.clear();
  439. this.disabled = false;
  440. this.loading = false;
  441. if (this.pageNum == 1) {
  442. this.list = [];
  443. this.refreshing = false;
  444. }
  445. this.list = this.list.concat(res.rows);
  446. if (this.list.length >= res.total) {
  447. this.finished = true;
  448. } else {
  449. this.finished = false;
  450. }
  451. this.pageNum = this.pageNum + 1;
  452. });
  453. },
  454. onClickLeft() {
  455. this.$router.push('/home');
  456. },
  457. },
  458. };
  459. </script>
  460. <style lang="scss" scoped>
  461. .bgcolor {
  462. background-color: #f5f5f5;
  463. }
  464. .serchInput {
  465. padding: 0 14px;
  466. margin-top: 14px;
  467. }
  468. .monthNow {
  469. height: 34px;
  470. line-height: 34px;
  471. text-align: left;
  472. font-weight: bold;
  473. padding: 0 16px;
  474. box-sizing: border-box;
  475. background-color: #f1f1f1;
  476. border-radius: 20px;
  477. border: 1px solid #ccc;
  478. position: relative;
  479. color: #333;
  480. font-size: 14px;
  481. .van-cell__left-icon,
  482. .van-cell__right-icon {
  483. line-height: 34px;
  484. }
  485. .CalendarIcon {
  486. float: right;
  487. font-size: 24px;
  488. color: #1989fa;
  489. margin-top: 6px;
  490. position: absolute;
  491. right: 12px;
  492. img {
  493. height: 0.8em;
  494. }
  495. }
  496. }
  497. .monthNowpro {
  498. color: #ccc;
  499. }
  500. .cardContent {
  501. box-sizing: border-box;
  502. }
  503. .cardContent .title {
  504. font-size: 14px;
  505. font-weight: bold;
  506. color: #333;
  507. line-height: 14px;
  508. }
  509. .cardContent .info {
  510. font-size: 14px;
  511. color: #999;
  512. line-height: 26px;
  513. }
  514. .cardContent .title p {
  515. padding: 0;
  516. margin: 0;
  517. }
  518. .cardContent .title .textLeft {
  519. display: inline-block;
  520. padding-bottom: 10px;
  521. }
  522. .cardContent .title .textRight {
  523. float: right;
  524. color: #0057ba;
  525. }
  526. .van-tab--active {
  527. color: #0057ba;
  528. }
  529. .brud {
  530. margin: 16px;
  531. border-radius: 8px;
  532. overflow: hidden;
  533. }
  534. .weekList {
  535. border-radius: 0;
  536. }
  537. .Btn {
  538. margin: 0 auto 10px;
  539. display: block;
  540. width: 90%;
  541. border-radius: 5px;
  542. color: #fff !important;
  543. background-color: #0057ba;
  544. border: 1px solid #0057ba;
  545. height: 36px;
  546. }
  547. .BtnBorder {
  548. margin: 0 auto 10px;
  549. display: block;
  550. width: 90%;
  551. border-radius: 5px;
  552. border: 1px solid #0057ba;
  553. color: #0057ba;
  554. height: 36px;
  555. }
  556. .weekList .van-cell {
  557. border-radius: 6px;
  558. overflow: hidden;
  559. }
  560. .weekList .cardContent .title {
  561. line-height: 32px;
  562. }
  563. .weekList .van-cell__right-icon {
  564. top: 4px;
  565. }
  566. .searchDiv {
  567. .van-search {
  568. background: #fff;
  569. }
  570. .van-search__action {
  571. font-size: 14px;
  572. color: #0057ba;
  573. font-weight: bold;
  574. background: #f1f1f1;
  575. border-bottom-right-radius: 60px;
  576. border-top-right-radius: 60px;
  577. border: 1px solid #ccc;
  578. padding: 0 20px;
  579. }
  580. .van-search--show-action {
  581. padding-right: 12px;
  582. }
  583. .van-search__content {
  584. border: 1px solid #ccc;
  585. border-bottom-left-radius: 60px;
  586. border-top-left-radius: 60px;
  587. background: #f1f1f1;
  588. border-right: 0;
  589. }
  590. }
  591. </style>