returns.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853
  1. <template>
  2. <basic-container>
  3. <avue-crud :option="option"
  4. :table-loading="loading"
  5. :data="data"
  6. :page.sync="page"
  7. :permission="permissionList"
  8. :before-open="beforeOpen"
  9. v-model="form"
  10. ref="crud"
  11. @row-update="rowUpdate"
  12. @row-save="rowSave"
  13. @row-del="rowDel"
  14. @search-change="searchChange"
  15. @search-reset="searchReset"
  16. @selection-change="selectionChange"
  17. @current-change="currentChange"
  18. @size-change="sizeChange"
  19. @refresh-change="refreshChange"
  20. @on-load="onLoad">
  21. <template slot="menuLeft">
  22. <el-button type="danger"
  23. size="small"
  24. icon="el-icon-delete"
  25. plain
  26. :disabled="delBatchBtn"
  27. v-if="permission.returns_delete"
  28. @click="handleDelete">刪 除
  29. </el-button>
  30. <el-button type="primary"
  31. size="small"
  32. icon="el-icon-upload"
  33. plain
  34. v-if="permission.returns_upload"
  35. @click="handleUpload">上 傳
  36. </el-button>
  37. <!--<el-button type="success"
  38. size="small"
  39. icon="el-icon-setting"
  40. plain
  41. v-if="permission.returns_setting"
  42. @click="handleSetting">設置發佈人
  43. </el-button>-->
  44. <el-button type="primary"
  45. size="small"
  46. icon="el-icon-download"
  47. plain
  48. v-if="permission.returns_download"
  49. @click="handleDownload">下載
  50. </el-button>
  51. <el-button type="primary" size="small" :disabled="issueBatchBtn" v-if="permission.returns_issue" @click="issueBatch">批量發佈</el-button>
  52. <el-button type="primary" size="small" :disabled="approveBatchBtn" v-if="permission.returns_approve" @click="approveBatch"><i class="el-icon-check"></i>批量確認</el-button>
  53. </template>
  54. <template slot="menu" slot-scope="{row, index}">
  55. <el-button size="small" class="el-button--text" v-if="permission.returns_view" @click="$refs.crud.rowView(row, index)"><i class="el-icon-view"></i> 查 看</el-button>
  56. <el-button size="small" class="el-button--text" v-if="permission.returns_edit && row.process <= 2 && ((row.personId && row.personId.indexOf(userInfo.user_id) != -1) || row.createUser == userInfo.user_id)" @click="$refs.crud.rowEdit(row, index)"><i class="el-icon-edit"></i> 編 輯</el-button>
  57. <el-button size="small" class="el-button--text" v-if="permission.returns_delete && row.process <= 2 && ((row.personId && row.personId.indexOf(userInfo.user_id) != -1) || row.createUser == userInfo.user_id)" @click="$refs.crud.rowDel(row, index)"><i class="el-icon-delete"></i> 刪 除</el-button>
  58. <el-button size="small" class="el-button--text" v-if="permission.returns_issue && row.process == 2 && (row.personId && row.personId.indexOf(userInfo.user_id) != -1)" @click="form = row,issueVisible = true">去發佈</el-button>
  59. <el-button size="small" class="el-button--text" v-if="permission.returns_approve && row.process == 3" @click="approve(row, index)"><i class="el-icon-check"></i> 確 認</el-button>
  60. </template>
  61. <template slot="process" slot-scope="{row, index}">
  62. <el-tag size="small " type="primary" plain v-if="row.process == 2">待發佈</el-tag>
  63. <el-tag size="small " type="warning" plain v-if="row.process == 3">待確認</el-tag>
  64. <el-tag size="small " type="success" plain v-if="row.process == 4">已確認</el-tag>
  65. </template>
  66. <template slot="personNo" slot-scope="{row}">
  67. <span v-if="row.process != 4">{{row.personName + '-' + row.personNo}}</span>
  68. </template>
  69. </avue-crud>
  70. <el-dialog title="文件上傳"
  71. append-to-body
  72. :visible.sync="attachBox"
  73. width="555px">
  74. <avue-form ref="form" :option="attachOption" v-model="attachForm" :upload-after="uploadAfter">
  75. </avue-form>
  76. </el-dialog>
  77. <el-dialog title="信息分解"
  78. append-to-body
  79. :visible.sync="temVisible"
  80. :fullscreen="true"
  81. :close-on-press-escape="false"
  82. @close="attachBox = false,onLoad(page)"
  83. >
  84. <returns-comfire :data="data2"></returns-comfire>
  85. </el-dialog>
  86. <el-dialog title="批量審核"
  87. append-to-body
  88. :visible.sync="approveBatchVisible"
  89. width="70%">
  90. <returns-approve-batch :data="this.selectionList" @close="approveBatchVisible = false, onLoad(page)"></returns-approve-batch>
  91. </el-dialog>
  92. <el-dialog title="信息確認"
  93. append-to-body
  94. :visible.sync="approveVisible"
  95. width="70%">
  96. <returns-approve :form="approveForm" @close="approveVisible = false, onLoad(page)"></returns-approve>
  97. </el-dialog>
  98. <el-dialog :append-to-body="true" :modal-append-to-body="false" :visible.sync="settingVisible" title="設置發佈人">
  99. <flow-settings :id="personId" :ehr="personNo" :name="personName" :callback="settingCallback" @close="settingVisible = false"></flow-settings>
  100. </el-dialog>
  101. <el-dialog :append-to-body="true" :modal-append-to-body="false" :visible.sync="issueVisible">
  102. <returns-issue :form="form" @close="issueVisible = false, onLoad(page)"></returns-issue>
  103. </el-dialog>
  104. </basic-container>
  105. </template>
  106. <script>
  107. import {getList, getDetail, add, update, remove, returnsSubmit, settingSave, getSetting, issue, getDownloadList} from "@/api/bank/returns";
  108. import {mapGetters} from "vuex";
  109. import {dateFormat} from "../../util/date";
  110. import ReturnsComfire from "../../components/common/returns-comfire";
  111. import ReturnsApprove from "../../components/common/returns-approve";
  112. import FlowSettings from "../../components/common/flow-settings";
  113. import ReturnsIssue from "../../components/common/returns-issue";
  114. import {getDeptTree, getTree} from "@/api/system/dept";
  115. import {getStandardByCode} from "@/api/bank/handoverstandard";
  116. import ReturnsApproveBatch from "../../components/common/returns-approve-batch";
  117. import {getDictValue} from "../../api/system/dict";
  118. export default {
  119. components: {ReturnsApproveBatch, ReturnsIssue, FlowSettings, ReturnsApprove, ReturnsComfire},
  120. data() {
  121. return {
  122. personId: null,
  123. personNo: null,
  124. personName: null,
  125. settingVisible: false,
  126. issueVisible: false,
  127. delBatchBtn: true,
  128. issueBatchBtn: true,
  129. approveBatchBtn: false,
  130. form: {},
  131. approveForm: {},
  132. query: {},
  133. loading: true,
  134. temVisible: false,
  135. approveVisible: false,
  136. approveBatchVisible: false,
  137. page: {
  138. pageSize: 10,
  139. currentPage: 1,
  140. total: 0
  141. },
  142. selectionList: [],
  143. option: {
  144. addTitle: '新增【新開戶退件登記表】',
  145. editTitle: '編輯【新開戶退件登記表】',
  146. viewTitle: '查看【新開戶退件登記表】',
  147. height:'auto',
  148. calcHeight: 30,
  149. tip: false,
  150. searchShow: true,
  151. searchMenuSpan: 6,
  152. border: true,
  153. index: true,
  154. viewBtn: false,
  155. editBtn: false,
  156. addBtn: false,
  157. delBtn: false,
  158. selection: true,
  159. dialogClickModal: false,
  160. column: [
  161. {
  162. label: "業務類型",
  163. prop: "isPublic",
  164. type: "select",
  165. dataType: "string",
  166. dicUrl: `/api/blade-system/dict/dictionary?code=business_type`,
  167. props: {
  168. label: "dictValue",
  169. value: "dictKey"
  170. },
  171. dicFormatter: (res) => {
  172. res.data.forEach(item => {item.disabled = item.isSealed == 1;})
  173. return res.data;
  174. },
  175. rules: [{
  176. required: true,
  177. message: "請輸入業務類型",
  178. trigger: "blur"
  179. }]
  180. },
  181. {
  182. label: "業務類型",
  183. prop: "isPublicSearch",
  184. type: "select",
  185. hide: true,
  186. search: true,
  187. searchSpan: 4,
  188. dataType: "string",
  189. dicUrl: `/api/blade-system/dict/dictionary?code=business_type`,
  190. props: {
  191. label: "dictValue",
  192. value: "dictKey"
  193. },
  194. },
  195. {
  196. label: "銀行號",
  197. prop: "bankNo",
  198. span: 24,
  199. hide: true,
  200. search: true,
  201. searchSpan: 4,
  202. rules: [{
  203. required: true,
  204. message: "請輸入銀行號",
  205. trigger: "blur"
  206. }]
  207. },
  208. {
  209. label: "機構號",
  210. prop: "orgNo",
  211. hide: true,
  212. rules: [{
  213. required: true,
  214. message: "請輸入機構號",
  215. trigger: "blur"
  216. }]
  217. },
  218. {
  219. label: "機構名稱",
  220. prop: "orgName",
  221. hide: true,
  222. disabled: true,
  223. rules: [{
  224. required: true,
  225. message: "請輸入機構號",
  226. trigger: "blur"
  227. }]
  228. },
  229. {
  230. label: "區域/支行",
  231. prop: "orgNos",
  232. hide: true,
  233. display: false,
  234. searchMultiple: true,
  235. search: true,
  236. type: "tree",
  237. dicData: [],
  238. props: {
  239. label: "title",
  240. value: "key"
  241. },
  242. checkStrictly: true,
  243. rules: [{
  244. required: true,
  245. message: "請輸入機構號",
  246. trigger: "blur"
  247. }]
  248. },
  249. /*{
  250. label: "序號",
  251. prop: "serialNo",
  252. rules: [{
  253. required: true,
  254. message: "請輸入序號",
  255. trigger: "blur"
  256. }]
  257. },*/
  258. {
  259. label: "支行",
  260. prop: "subBank",
  261. rules: [{
  262. required: true,
  263. message: "請輸入支行",
  264. trigger: "blur"
  265. }]
  266. },
  267. {
  268. label: "支行機構號",
  269. prop: "subOrgNo",
  270. rules: [{
  271. required: true,
  272. message: "請輸入支行機構號",
  273. trigger: "blur"
  274. }]
  275. },
  276. {
  277. label: "客戶名稱",
  278. prop: "customerName",
  279. search: true,
  280. searchSpan: 4,
  281. rules: [{
  282. required: true,
  283. message: "請輸入客戶名稱",
  284. trigger: "blur"
  285. }]
  286. },
  287. {
  288. label: "狀態",
  289. prop: "status",
  290. type: "select",
  291. dataType: "string",
  292. dicUrl: `/api/blade-system/dict/dictionary?code=returns_status`,
  293. props: {
  294. label: "dictValue",
  295. value: "dictKey"
  296. },
  297. dicFormatter: (res) => {
  298. res.data.forEach(item => {item.disabled = item.isSealed == 1;})
  299. return res.data;
  300. },
  301. rules: [{
  302. required: true,
  303. message: "請輸入狀態",
  304. trigger: "blur"
  305. }]
  306. },
  307. {
  308. label: "退件原因",
  309. prop: "reason",
  310. rules: [{
  311. required: true,
  312. message: "請輸入退件原因",
  313. trigger: "blur"
  314. }]
  315. },
  316. {
  317. label: "備註",
  318. prop: "remark",
  319. rules: [{
  320. required: false,
  321. message: "請輸入備註",
  322. trigger: "blur"
  323. }]
  324. },
  325. {
  326. label: "條碼",
  327. prop: "barCode",
  328. rules: [{
  329. required: false,
  330. message: "請輸入條碼",
  331. trigger: "blur"
  332. }]
  333. },
  334. {
  335. label: "接辦行經辦",
  336. prop: "handlingBank",
  337. search: true,
  338. searchSpan: 4,
  339. rules: [{
  340. required: true,
  341. message: "請輸入接辦行經辦",
  342. trigger: "blur"
  343. }]
  344. },
  345. {
  346. label: "接辦行覆核",
  347. prop: "handlingBankReview",
  348. search: true,
  349. searchSpan: 4,
  350. rules: [{
  351. required: false,
  352. message: "請輸入接辦行覆核",
  353. trigger: "blur"
  354. }]
  355. },
  356. {
  357. label: "處理日期",
  358. prop: "handlingDate",
  359. type: "date",
  360. format: "yyyy-MM-dd",
  361. valueFormat: "yyyy-MM-dd",
  362. rules: [{
  363. required: true,
  364. message: "請輸入處理日期",
  365. trigger: "blur"
  366. }]
  367. },
  368. {
  369. label: "退件日期",
  370. prop: "handlingDateRange",
  371. type: "date",
  372. format: "yyyy-MM-dd",
  373. valueFormat: "yyyy-MM-dd",
  374. searchRange:true,
  375. hide: true,
  376. addDisplay: false,
  377. editDisplay: false,
  378. viewDisplay: false,
  379. search: true,
  380. rules: [{
  381. required: true,
  382. message: "請輸入交接日期",
  383. trigger: "blur"
  384. }]
  385. },
  386. {
  387. label: "經辦",
  388. prop: "handler",
  389. rules: [{
  390. required: true,
  391. message: "請輸入經辦",
  392. trigger: "blur"
  393. }]
  394. },
  395. {
  396. label: "跟進情況",
  397. prop: "handlingStatus",
  398. type: "select",
  399. dataType: "string",
  400. dicUrl: `/api/blade-system/dict/dictionary?code=processing_status`,
  401. props: {
  402. label: "dictValue",
  403. value: "dictKey"
  404. },
  405. dicFormatter: (res) => {
  406. res.data.forEach(item => {item.disabled = item.isSealed == 1;})
  407. return res.data;
  408. },
  409. rules: [{
  410. required: false,
  411. message: "請輸入跟進情況",
  412. trigger: "blur"
  413. }]
  414. },
  415. {
  416. label: "支行備註",
  417. prop: "bankRemark",
  418. viewDisplay: false,
  419. editDisplay: false,
  420. // hide: true,
  421. rules: [{
  422. required: false,
  423. message: "請輸入支行備註",
  424. trigger: "blur"
  425. }]
  426. },
  427. {
  428. label: "支行確認人員工號",
  429. prop: "bankConfirmNo",
  430. viewDisplay: false,
  431. editDisplay: false,
  432. // hide: true,
  433. rules: [{
  434. required: true,
  435. message: "請輸入支行確認人員工號",
  436. trigger: "blur"
  437. }]
  438. },
  439. {
  440. label: "支行確認人姓名",
  441. prop: "bankConfirmName",
  442. viewDisplay: false,
  443. editDisplay: false,
  444. // hide: true,
  445. rules: [{
  446. required: true,
  447. message: "請輸入支行確認人姓名",
  448. trigger: "blur"
  449. }]
  450. },
  451. {
  452. label: "確認日期",
  453. prop: "bankConfirmTime",
  454. type: "datetime",
  455. format: "yyyy-MM-dd HH:mm:ss",
  456. valueFormat: "yyyy-MM-dd HH:mm:ss",
  457. viewDisplay: false,
  458. editDisplay: false,
  459. // hide: true,
  460. rules: [{
  461. required: true,
  462. message: "請輸入確認日期",
  463. trigger: "blur"
  464. }]
  465. },
  466. /*{
  467. label: "待辦人",
  468. prop: 'personNo'
  469. },*/
  470. {
  471. label: "進度",
  472. prop: "process",
  473. viewDisplay: false,
  474. editDisplay: false,
  475. rules: [{
  476. required: true,
  477. message: "請輸入節點",
  478. trigger: "blur"
  479. }]
  480. },
  481. ]
  482. },
  483. data: [],
  484. data2: [],
  485. temForm: {},
  486. attachForm: {},
  487. attachBox: false,
  488. attachOption: {
  489. submitBtn: false,
  490. emptyBtn: false,
  491. column: [
  492. {
  493. label: '文件上傳',
  494. prop: 'attachFile',
  495. type: 'upload',
  496. drag: true,
  497. loadText: '文件上傳中,請稍等',
  498. span: 24,
  499. propsHttp: {
  500. res: 'data'
  501. },
  502. action: "/api/bank/returns/readExcel"
  503. }
  504. ]
  505. }
  506. };
  507. },
  508. computed: {
  509. ...mapGetters(["permission"]),
  510. ...mapGetters(["userInfo"]),
  511. permissionList() {
  512. return {
  513. addBtn: this.vaildData(this.permission.returns_add, false),
  514. viewBtn: this.vaildData(this.permission.returns_view, false),
  515. delBtn: this.vaildData(this.permission.returns_delete, false),
  516. editBtn: this.vaildData(this.permission.returns_edit, false)
  517. };
  518. },
  519. ids() {
  520. let ids = [];
  521. this.selectionList.forEach(ele => {
  522. ids.push(ele.id);
  523. });
  524. return ids.join(",");
  525. }
  526. },
  527. mounted() {
  528. getDeptTree().then(res => {
  529. const column = this.findObject(this.option.column, "orgNos");
  530. let treeData = getTree(res.data.data, this.userInfo.dept_id);
  531. column.dicData = treeData;
  532. });
  533. getStandardByCode("returns").then(res => {
  534. const data = res.data.data;
  535. if (data){
  536. this.option.addTitle = data.content;
  537. this.option.editTitle = data.content;
  538. this.option.viewTitle = data.content;
  539. }
  540. });
  541. },
  542. methods: {
  543. settingCallback(row){
  544. this.form.personId = row.personId;
  545. this.form.personNo = row.personNo;
  546. this.form.personName = row.personName;
  547. settingSave(this.form).then(() => {
  548. this.onLoad(this.page);
  549. this.$message({
  550. type: "success",
  551. message: "操作成功!"
  552. });
  553. }, error => {
  554. window.console.log('error');
  555. });
  556. },
  557. handleDownload(){
  558. if (this.selectionList.length === 0) {
  559. let tip = "確定下載篩選的" + this.page.total + "條數據嗎?"
  560. this.$confirm(tip, {
  561. confirmButtonText: "確定",
  562. cancelButtonText: "取消",
  563. type: "warning"
  564. })
  565. .then(() => {
  566. getDownloadList(this.query).then(res => {
  567. let data = res.data.data;
  568. if (data && data.length > 0){
  569. data.forEach(item => {
  570. item.status = item.returnStatus;
  571. });
  572. }
  573. this.downLoadData(data, true)
  574. });
  575. })
  576. }else{
  577. this.downLoadData(this.selectionList, false)
  578. }
  579. },
  580. downLoadData(data, isAll){
  581. let columns = this.deepClone(this.option.column);
  582. for (let i = 0; i < columns.length; i++) {
  583. let item = columns[i];
  584. if (item.hide || item.prop == 'process'){
  585. columns.splice(i, 1);
  586. i--;
  587. }
  588. if (!isAll && (item.type == 'select' || item.type == 'tree')){
  589. item.prop = '$' + item.prop;
  590. }
  591. }
  592. this.$Export.excel({
  593. title: "新開戶退件登記表" || new Date().getTime(),
  594. columns: columns,
  595. data: data
  596. });
  597. },
  598. handleSetting(){
  599. getSetting().then((res) => {
  600. let data = res.data.data;
  601. if (!!data){
  602. this.personId = data.personId;
  603. this.personNo = data.personNo;
  604. this.personName = data.personName;
  605. }
  606. });
  607. this.settingVisible = true;
  608. },
  609. issueBatch(){
  610. let _this = this;
  611. this.$confirm("確定將選擇數據發佈?", {
  612. confirmButtonText: "確定",
  613. cancelButtonText: "取消",
  614. type: "warning"
  615. })
  616. .then(() => {
  617. for (let i = 0; i < this.selectionList.length; i++) {
  618. let row = this.selectionList[i];
  619. issue(row).then(() => {})
  620. }
  621. this.$confirm("批量發佈成功!",{
  622. type: "success",
  623. showCancelButton: false,
  624. showClose: false,
  625. }).then(() => {
  626. _this.onLoad(this.page)
  627. })
  628. })
  629. },
  630. approveBatch(){
  631. this.$refs.crud.toggleSelection();
  632. let toApproveArr = [];
  633. for (let i = 0; i < this.data.length; i++) {
  634. let item = this.data[i];
  635. if (item.process == 3){
  636. toApproveArr.push(item)
  637. }
  638. }
  639. if (toApproveArr.length == 0){
  640. this.$message.warning("當前頁沒有符合條件的記錄!")
  641. return;
  642. }
  643. this.$refs.crud.toggleSelection(toApproveArr);
  644. this.approveBatchVisible = true;
  645. },
  646. approve(row, index){
  647. this.approveVisible = true;
  648. this.approveForm = row;
  649. },
  650. infoFormat(row){
  651. row.isPublic = row.isPublic == '對公' ? 1 : 0;
  652. let arr = row.subBank.split(' ');
  653. row.subOrgNo = arr[0];
  654. row.subBank = arr[1];
  655. if (row.status == '退件'){
  656. row.status = '1';
  657. }else if (row.status == 'HOLD'){
  658. row.status = '2';
  659. }else if (row.status == '完成'){
  660. row.status = '3';
  661. }
  662. /*let userInfoStr = localStorage.getItem("saber-userInfo");
  663. let userInfo = JSON.parse(userInfoStr);
  664. row.bankConfirmNo = userInfo.content.user_ehr;
  665. row.bankConfirmName = userInfo.content.user_name;
  666. row.bankConfirmTime = dateFormat(new Date(), "yyyy-MM-dd HH:mm:ss");*/
  667. return row;
  668. },
  669. uploadAfter(res, done, loading, column){
  670. if (res && res.length > 0){
  671. for (let i = 0; i < res.length; i++) {
  672. let row = res[i];
  673. row = this.infoFormat(row);
  674. }
  675. this.data2 = res;
  676. }
  677. this.temVisible = true;
  678. loading = false;
  679. done();
  680. },
  681. handleUpload(){
  682. this.attachBox = true;
  683. },
  684. rowSave(row, done, loading) {
  685. add(row).then(() => {
  686. this.onLoad(this.page);
  687. this.$message({
  688. type: "success",
  689. message: "操作成功!"
  690. });
  691. done();
  692. }, error => {
  693. loading();
  694. window.console.log(error);
  695. });
  696. },
  697. rowUpdate(row, index, done, loading) {
  698. update(row).then(() => {
  699. this.onLoad(this.page);
  700. this.$message({
  701. type: "success",
  702. message: "操作成功!"
  703. });
  704. done();
  705. }, error => {
  706. loading();
  707. console.log(error);
  708. });
  709. },
  710. rowDel(row) {
  711. this.$confirm("確定將選擇數據刪除?", {
  712. confirmButtonText: "確定",
  713. cancelButtonText: "取消",
  714. type: "warning"
  715. })
  716. .then(() => {
  717. return remove(row.id);
  718. })
  719. .then(() => {
  720. this.onLoad(this.page);
  721. this.$message({
  722. type: "success",
  723. message: "操作成功!"
  724. });
  725. });
  726. },
  727. handleDelete() {
  728. if (this.selectionList.length === 0) {
  729. this.$message.warning("請選擇至少一條數據");
  730. return;
  731. }
  732. this.$confirm("確定將選擇數據刪除?", {
  733. confirmButtonText: "確定",
  734. cancelButtonText: "取消",
  735. type: "warning"
  736. })
  737. .then(() => {
  738. return remove(this.ids);
  739. })
  740. .then(() => {
  741. this.onLoad(this.page);
  742. this.$message({
  743. type: "success",
  744. message: "操作成功!"
  745. });
  746. this.$refs.crud.toggleSelection();
  747. });
  748. },
  749. beforeOpen(done, type) {
  750. if (["edit", "view"].includes(type)) {
  751. /*getDetail(this.form.id).then(res => {
  752. this.form = res.data.data;
  753. });*/
  754. if (type == "view"){
  755. this.findObject(this.option.column, "bankRemark").viewDisplay = this.form.process == 4;
  756. this.findObject(this.option.column, "bankConfirmNo").viewDisplay = this.form.process == 4;
  757. this.findObject(this.option.column, "bankConfirmName").viewDisplay = this.form.process == 4;
  758. this.findObject(this.option.column, "bankConfirmTime").viewDisplay = this.form.process == 4;
  759. }
  760. }
  761. done();
  762. },
  763. searchReset() {
  764. this.query = {};
  765. this.onLoad(this.page);
  766. },
  767. searchChange(params, done) {
  768. if (params.handlingDateRange){
  769. params.handlingDate_begin = params.handlingDateRange[0], params.handlingDate_end = params.handlingDateRange[1];
  770. params.handlingDateRange = null;
  771. }
  772. if (params.orgNos){
  773. params.orgNostr = params.orgNos.join();
  774. params.orgNos = '';
  775. }
  776. if (params.customerName){
  777. params.customerName = params.customerName.trim()
  778. }
  779. if (params.isPublicSearch){
  780. params.isPublic = params.isPublicSearch;
  781. }
  782. this.query = params;
  783. this.page.currentPage = 1;
  784. this.onLoad(this.page, params);
  785. done();
  786. },
  787. selectionChange(list) {
  788. this.selectionList = list;
  789. if (list && list.length > 0){
  790. let issueFlag = true, approveFlag = true, delFlag = true;
  791. for (let i = 0; i < list.length; i++) {
  792. let item = list[i];
  793. delFlag = delFlag && item.process <= 2 && ((item.personId && item.personId.indexOf(this.userInfo.user_id) != -1) || item.createUser == this.userInfo.user_id);
  794. issueFlag = issueFlag && item.process == 2 && (item.personId && item.personId.indexOf(this.userInfo.user_id) != -1);
  795. approveFlag = approveFlag && item.process == 3;
  796. }
  797. this.delBatchBtn = !delFlag;
  798. this.issueBatchBtn = !issueFlag;
  799. // this.approveBatchBtn = !approveFlag;
  800. }else{
  801. this.delBatchBtn = true;
  802. this.issueBatchBtn = true;
  803. // this.approveBatchBtn = true;
  804. }
  805. },
  806. selectionClear() {
  807. this.selectionList = [];
  808. this.$refs.crud.toggleSelection();
  809. },
  810. currentChange(currentPage){
  811. this.page.currentPage = currentPage;
  812. },
  813. sizeChange(pageSize){
  814. this.page.pageSize = pageSize;
  815. },
  816. refreshChange() {
  817. this.onLoad(this.page, this.query);
  818. },
  819. onLoad(page, params = {}) {
  820. this.loading = true;
  821. getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
  822. const data = res.data.data;
  823. this.page.total = data.total;
  824. this.data = data.records;
  825. this.loading = false;
  826. this.selectionClear();
  827. });
  828. }
  829. }
  830. };
  831. </script>
  832. <style>
  833. </style>