confirmed-keypwd.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859
  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.sync="search"
  15. @search-change="searchChange"
  16. @search-reset="searchReset"
  17. @selection-change="selectionChange"
  18. @current-change="currentChange"
  19. @size-change="sizeChange"
  20. @refresh-change="refreshChange"
  21. @on-load="onLoad">
  22. <template slot="menuLeft">
  23. <el-button type="danger"
  24. size="small"
  25. icon="el-icon-delete"
  26. :disabled="delBatchBtn"
  27. plain
  28. v-if="permission.keypwd_delete"
  29. @click="handleDelete">刪 除
  30. </el-button>
  31. <el-button type="success"
  32. size="small"
  33. icon="el-icon-search"
  34. plain
  35. v-if="permission.keypwd_keep_view"
  36. @click="keepVisible = true">保管人查詢
  37. </el-button>
  38. <el-button type="primary"
  39. size="small"
  40. icon="el-icon-download"
  41. plain
  42. v-if="permission.keypwd_download"
  43. @click="handleDownload">下載
  44. </el-button>
  45. </template>
  46. <template slot="menu" slot-scope="{row, index}">
  47. <el-button size="small" class="el-button--text" v-if="permission.keypwd_edit && userInfo.user_id == row.createUser && row.process == 2" @click="$refs.crud.rowEdit(row, index)"><i class="el-icon-edit"></i> 編 輯</el-button>
  48. <el-button size="small" class="el-button--text" v-if="permission.keypwd_delete && userInfo.user_id == row.createUser && row.process == 2" @click="$refs.crud.rowDel(row, index)"><i class="el-icon-delete"></i> 刪 除</el-button>
  49. <el-button size="small" class="el-button--text" v-if="permission.keypwd_sure && row.process == 2 && row.receiverId == userInfo.user_id" @click="approveForm=row,approveVisible=true"><i class="el-icon-check"></i> 確 認</el-button>
  50. </template>
  51. <template slot="receiverNameForm">
  52. <select-dialog-user :id="form.receiverId" :name="form.receiverName" :ehr="form.receiverNo" :disabled="disabeldReceiver" :callback="selectCallback"></select-dialog-user>
  53. </template>
  54. <template slot="handoverPersonNameForm">
  55. <select-dialog-user :id="form.handoverPersonId" :name="form.handoverPersonName" :ehr="form.handoverPersonNo" :disabled="disabeldHandover" :callback="handoverSelectCallback"></select-dialog-user>
  56. </template>
  57. <template slot-scope="{disabled,size}" slot="categorySearch">
  58. <avue-input-tree :check-strictly="false" v-model="search.category" placeholder="請選擇內容" type="tree" :dic="typeList" :props="props"></avue-input-tree>
  59. </template>
  60. <template slot="isTurnIn" slot-scope="{row}">
  61. <el-tag size="small " type="success" plain v-if="row.isTurnIn">上繳</el-tag>
  62. <el-tag size="small " type="danger" plain v-if="!row.isTurnIn">非上繳</el-tag>
  63. </template>
  64. <template slot="isTurnInForm" slot-scope="{row}">
  65. <el-checkbox v-model="row.isTurnIn" @change="turnInChange"></el-checkbox>
  66. <el-tag size="small " type="success" plain v-if="row.isTurnIn">上繳</el-tag>
  67. <el-tag size="small " type="danger" plain v-if="!row.isTurnIn">非上繳</el-tag>
  68. </template>
  69. <template slot="process" slot-scope="{row, index}">
  70. <el-tag size="small " type="warning" plain v-if="row.process == 2">待確認</el-tag>
  71. <el-tag size="small " type="success" plain v-if="row.process == 3">已確認</el-tag>
  72. </template>
  73. <template slot="titleForm" slot-scope="{row, index}">
  74. <div v-html="title" style="white-space: pre-line;color: red;font-weight: bold;"></div>
  75. </template>
  76. <template slot="titleLabel" slot-scope="{row, index}">
  77. <span style="color: red;font-weight: bold;">注意事項:</span>
  78. </template>
  79. </avue-crud>
  80. <el-dialog :append-to-body="true" :modal-append-to-body="false" :destroy-on-close="true" :fullscreen="true" :visible.sync="keepVisible" title="保管人查詢">
  81. <div v-if="keepVisible">
  82. <keypwd-keep></keypwd-keep>
  83. </div>
  84. </el-dialog>
  85. <el-dialog title="信息確認"
  86. append-to-body
  87. :visible.sync="approveVisible"
  88. width="70%">
  89. <keypwd-sure :form="approveForm" @close="approveVisible = false, onLoad(page)"></keypwd-sure>
  90. </el-dialog>
  91. </basic-container>
  92. </template>
  93. <script>
  94. import {getList, getDetail, add, update, remove, getByCategoryAndType, getKeyType, getDownloadList, getCurrentUserKeepCategory} from "@/api/bank/keypwd";
  95. import {mapGetters} from "vuex";
  96. import {dateFormat} from "@/util/date";
  97. import SelectDialogUser from "@/components/select-dialog/select-dialog-user";
  98. import { getCurrentDept, getChildsDept } from "@/api/system/dept";
  99. import {getDeptTree, getTree} from "@/api/system/dept";
  100. import KeypwdKeep from "@/views/bank/keypwd-keep";
  101. import {getStandardByCode} from "@/api/bank/handoverstandard";
  102. import KeypwdSure from "@/components/common/keypwd-sure";
  103. export default {
  104. name: "confirmed-keypwd",
  105. components: {KeypwdSure, KeypwdKeep, SelectDialogUser},
  106. data() {
  107. return {
  108. isManageUser: false,
  109. userKeepList: [],
  110. currentDept: [],
  111. title: "",
  112. search: {},
  113. typeList: [],
  114. props:{
  115. label: "dictValue",
  116. value: "dictKey",
  117. },
  118. approveForm: {},
  119. approveVisible: false,
  120. delBatchBtn: true,
  121. keepVisible: false,
  122. form: {},
  123. query: {},
  124. loading: true,
  125. page: {
  126. pageSize: 10,
  127. currentPage: 1,
  128. total: 0
  129. },
  130. disabeldReceiver: false,
  131. disabeldHandover: true,
  132. selectionList: [],
  133. selectReceiver: '',
  134. selectHandover: '',
  135. type: '',
  136. option: {
  137. addTitle: '新增【網點鎖匙/密碼/實物交接登記表】',
  138. editTitle: '編輯【網點鎖匙/密碼/實物交接登記表】',
  139. viewTitle: '查看【網點鎖匙/密碼/實物交接登記表】',
  140. height:'auto',
  141. calcHeight: 30,
  142. tip: false,
  143. searchShow: true,
  144. searchMenuSpan: 6,
  145. border: true,
  146. index: true,
  147. viewBtn: true,
  148. editBtn: false,
  149. delBtn: false,
  150. selection: true,
  151. dialogClickModal: false,
  152. column: [
  153. {
  154. label: '注意事項',
  155. prop: 'title',
  156. formslot: true,
  157. hide: true,
  158. type: 'text',
  159. span: 24
  160. },
  161. {
  162. label: "銀行號",
  163. prop: "bankNo",
  164. span: 24,
  165. hide: true,
  166. disabled: true,
  167. search: true,
  168. searchSpan: 4,
  169. rules: [{
  170. required: true,
  171. message: "請輸入銀行號",
  172. trigger: "blur"
  173. }]
  174. },
  175. {
  176. label: "機構號",
  177. prop: "orgNo",
  178. type: "select",
  179. hide: true,
  180. disabled: true,
  181. filterable: true,
  182. dicData: [],
  183. props: {
  184. label: "orgNo",
  185. value: "orgNo"
  186. },
  187. change: ({value, column}) => {
  188. if (!value) return;
  189. let dicData = this.findObject(this.option.column, 'orgNo').dicData;
  190. dicData.forEach(item => {
  191. if (item.orgNo == value){
  192. this.form.orgName = item.deptName;
  193. }
  194. })
  195. },
  196. rules: [{
  197. required: true,
  198. message: "請輸入機構號",
  199. trigger: "blur"
  200. }]
  201. },
  202. {
  203. label: "機構名稱",
  204. prop: "orgName",
  205. disabled: true,
  206. rules: [{
  207. required: true,
  208. message: "請輸入機構號",
  209. trigger: "blur"
  210. }]
  211. },
  212. {
  213. label: "分類種類",
  214. prop: "categoryShow",
  215. checkStrictly: true,
  216. type: "tree",
  217. multiple: true,
  218. addDisplay: false,
  219. editDisplay: false,
  220. viewDisplay: true,
  221. // dicUrl: "/api/blade-system/dict/dictionary?code=key_type",
  222. dicData: [],
  223. dataType: "string",
  224. props:{
  225. label: "dictValue",
  226. value: "dictKey",
  227. },
  228. },
  229. {
  230. label: "分類種類",
  231. prop: "category",
  232. hide: true,
  233. addDisplay: true,
  234. editDisplay: true,
  235. viewDisplay: false,
  236. search: true,
  237. checkStrictly: true,
  238. type: "tree",
  239. multiple: true,
  240. // dicUrl: "/api/blade-system/dict/dictionary?code=key_type",
  241. dicData: [],
  242. dataType: "string",
  243. props:{
  244. label: "dictValue",
  245. value: "dictKey",
  246. },
  247. searchslot: true,
  248. change: ({value, column}) => {
  249. /*if (!value || value.length == 0 || this.type == 'view' || this.form.category == value) return;
  250. getByCategoryAndType(value, this.form.orgNo).then(res => {
  251. const data = res.data.data;
  252. let $handoverNo = this.findObject(this.option.column, 'handoverPersonNo');
  253. let $handoverName = this.findObject(this.option.column, 'handoverPersonName');
  254. if (Object.keys(data).length == 0){
  255. // $handoverNo.disabled = false;
  256. this.form.handoverPersonNo = '';
  257. this.form.handoverPersonName = '';
  258. } else {
  259. $handoverNo.disabled = true;
  260. this.form.handoverPersonNo = data.receiverNo;
  261. this.form.handoverPersonName = data.receiverName;
  262. }
  263. });*/
  264. },
  265. rules: [{
  266. required: true,
  267. message: "請輸入分類",
  268. trigger: "blur"
  269. }]
  270. },
  271. {
  272. label: "區域/支行",
  273. prop: "orgNos",
  274. hide: true,
  275. display: false,
  276. searchMultiple: true,
  277. search: true,
  278. type: "tree",
  279. dicData: [],
  280. props: {
  281. label: "title",
  282. value: "key"
  283. },
  284. checkStrictly: true,
  285. rules: [{
  286. required: true,
  287. message: "請輸入機構號",
  288. trigger: "blur"
  289. }]
  290. },
  291. {
  292. label: "交接日期",
  293. prop: "handoverDateRange",
  294. type: "datetime",
  295. format: "yyyy-MM-dd HH:mm",
  296. valueFormat: "yyyy-MM-dd HH:mm",
  297. // searchValue: [_today + ' 00:00', _today + ' 23:59'],
  298. // searchTime: ['00:00', '23:59'],
  299. searchRange:true,
  300. hide: true,
  301. addDisplay: false,
  302. editDisplay: false,
  303. viewDisplay: false,
  304. search: true,
  305. rules: [{
  306. required: true,
  307. message: "請輸入交接日期",
  308. trigger: "blur"
  309. }]
  310. },
  311. /*{
  312. label: "種類",
  313. prop: "type",
  314. type: "select",
  315. dicUrl: "/api/blade-system/dict/dictionary?code={{key}}",
  316. props:{
  317. label: "dictValue",
  318. value: "dictKey",
  319. },
  320. change: ({value, column}) => {
  321. if (!value || this.type == 'view' || this.type == 'edit') return;
  322. getByCategoryAndType(this.form.category, value, this.form.orgNo).then(res => {
  323. const data = res.data.data;
  324. let $handoverNo = this.findObject(this.option.column, 'handoverPersonNo');
  325. let $handoverName = this.findObject(this.option.column, 'handoverPersonName');
  326. if (Object.keys(data).length == 0){
  327. // $handoverNo.disabled = false;
  328. this.form.handoverPersonNo = '';
  329. this.form.handoverPersonName = '';
  330. } else {
  331. $handoverNo.disabled = true;
  332. this.form.handoverPersonNo = data.receiverNo;
  333. this.form.handoverPersonName = data.receiverName;
  334. }
  335. });
  336. },
  337. rules: [{
  338. required: true,
  339. message: "請輸入種類",
  340. trigger: "blur"
  341. }]
  342. },*/
  343. /* {
  344. label: "數量",
  345. prop: "number",
  346. type: "number",
  347. disabled: true,
  348. hide: true,
  349. display: false,
  350. rules: [{
  351. required: true,
  352. message: "請輸入數量",
  353. trigger: "blur"
  354. }]
  355. },*/
  356. {
  357. label: "是否上繳",
  358. prop: "isTurnIn",
  359. formslot: true,
  360. rules: [{
  361. required: false,
  362. message: "請勾選是否上繳",
  363. trigger: "blur"
  364. }]
  365. },
  366. {
  367. label: "交出人",
  368. prop: "handoverPersonName",
  369. formslot: true,
  370. rules: [{
  371. required: false,
  372. message: "請輸入交出人姓名",
  373. trigger: "blur"
  374. }]
  375. },
  376. {
  377. label: "交出人員工號",
  378. prop: "handoverPersonNo",
  379. disabled: true,
  380. rules: [{
  381. required: false,
  382. message: "請輸入交出人員工號",
  383. trigger: "blur"
  384. }]
  385. },
  386. {
  387. label: "接收人",
  388. prop: "receiverName",
  389. disabled: true,
  390. search: true,
  391. searchSpan: 4,
  392. // formslot: true,
  393. disabled: true,
  394. rules: [{
  395. required: true,
  396. message: "請輸入接收人員工號",
  397. trigger: "focus"
  398. }]
  399. },
  400. {
  401. label: "接收人員工號",
  402. prop: "receiverNo",
  403. disabled: true,
  404. rules: [{
  405. required: true,
  406. message: "請輸入接收人員工號",
  407. trigger: "change"
  408. }]
  409. },
  410. {
  411. label: "交接日期",
  412. prop: "handoverDate",
  413. type: "datetime",
  414. format: "yyyy-MM-dd HH:mm",
  415. valueFormat: "yyyy-MM-dd HH:mm",
  416. change: ({value, culumn}) => {
  417. if (!value) return;
  418. },
  419. rules: [{
  420. required: true,
  421. message: "請輸入交接日期",
  422. trigger: "blur"
  423. }]
  424. },
  425. /* {
  426. label: "接收人姓名",
  427. prop: "receiverName",
  428. rules: [{
  429. required: true,
  430. message: "請輸入接收人姓名",
  431. trigger: "change "
  432. }]
  433. },*/
  434. {
  435. label: "備註",
  436. prop: "remark",
  437. rules: [{
  438. required: false,
  439. message: "請輸入備註",
  440. trigger: "blur"
  441. }]
  442. },
  443. {
  444. label: "填報時間",
  445. prop: "fillingDate",
  446. addDisplay: false,
  447. editDisplay: false,
  448. rules: [{
  449. required: true,
  450. message: "請輸入填報時間",
  451. trigger: "blur"
  452. }]
  453. },
  454. {
  455. label: "填報人",
  456. prop: "fillingPerson",
  457. addDisplay: false,
  458. editDisplay: false,
  459. rules: [{
  460. required: true,
  461. message: "請輸入填報人",
  462. trigger: "blur"
  463. }]
  464. },
  465. {
  466. label: "進度",
  467. prop: "process",
  468. display: false,
  469. },
  470. {
  471. label: "確認時間",
  472. prop: "sureTime",
  473. hide: true,
  474. addDisplay: false,
  475. editDisplay: false,
  476. type: "datetime",
  477. format: "yyyy-MM-dd HH:mm:ss",
  478. valueFormat: "yyyy-MM-dd HH:mm:ss",
  479. },
  480. ]
  481. },
  482. data: []
  483. };
  484. },
  485. computed: {
  486. ...mapGetters(["permission"]),
  487. ...mapGetters(["userInfo"]),
  488. permissionList() {
  489. return {
  490. addBtn: this.vaildData(this.permission.keypwd_add, false),
  491. viewBtn: this.vaildData(this.permission.keypwd_view, false),
  492. delBtn: this.vaildData(this.permission.keypwd_delete, false),
  493. editBtn: this.vaildData(this.permission.keypwd_edit, false)
  494. };
  495. },
  496. ids() {
  497. let ids = [];
  498. this.selectionList.forEach(ele => {
  499. ids.push(ele.id);
  500. });
  501. return ids.join(",");
  502. }
  503. },
  504. created() {
  505. this.initTypeDict();
  506. getDeptTree().then(res => {
  507. const column = this.findObject(this.option.column, "orgNos");
  508. let treeData = getTree(res.data.data, this.userInfo.dept_id);
  509. column.dicData = treeData;
  510. });
  511. getStandardByCode("keypwd").then(res => {
  512. const data = res.data.data;
  513. if (Object.keys(data).length > 0){
  514. this.title = data.content;
  515. }else {
  516. this.option.column.splice(0,1)
  517. }
  518. });
  519. getChildsDept().then(res => {
  520. let dicData = [];
  521. let data = res.data.data;
  522. data.forEach(item => {
  523. if (item.orgNo.indexOf("999") == -1){
  524. dicData.push(item)
  525. }
  526. })
  527. this.findObject(this.option.column, "orgNo").dicData = dicData;
  528. });
  529. // this.initCurrentDeptAndKeepCategroy();
  530. },
  531. methods: {
  532. initCurrentDeptAndKeepCategroy(){
  533. getCurrentDept().then(res => {
  534. const data = res.data.data;
  535. this.currentDept = data;
  536. this.isManageUser = data.deptCategory == 1;
  537. });
  538. },
  539. turnInChange(value){
  540. this.findObject(this.option.column, "receiverNo").rules[0].required = !value;
  541. this.findObject(this.option.column, "receiverName").rules[0].required = !value;
  542. // this.findObject(this.option.column, "receiverNo").disabled = !value;
  543. this.disabeldReceiver = !!value;
  544. this.form.receiverNo = null,this.form.receiverName = null;
  545. },
  546. handleDownload(){
  547. if (this.selectionList.length === 0) {
  548. let tip = "確定下載篩選的" + this.page.total + "條數據嗎?"
  549. this.$confirm(tip, {
  550. confirmButtonText: "確定",
  551. cancelButtonText: "取消",
  552. type: "warning"
  553. })
  554. .then(() => {
  555. getDownloadList(this.query).then(res => {
  556. let data = res.data.data;
  557. data.forEach(item => {item.isTurnIn = item.isTurnIn == 1 ? true : false;item.categoryShow = item.category;})
  558. this.downLoadData(data, true)
  559. });
  560. })
  561. }else{
  562. this.downLoadData(this.selectionList, false)
  563. }
  564. },
  565. downLoadData(data, isAll){
  566. let columns = this.deepClone(this.option.column);
  567. for (let i = 0; i < columns.length; i++) {
  568. let item = columns[i];
  569. if (item.hide || item.prop == 'process'){
  570. columns.splice(i, 1);
  571. i--;
  572. }
  573. if (!isAll && (item.type == 'select' || item.type == 'tree')){
  574. item.prop = '$' + item.prop;
  575. }
  576. }
  577. this.$Export.excel({
  578. title: "網點鎖匙密碼實物交接登記表" || new Date().getTime(),
  579. columns: columns,
  580. data: data
  581. });
  582. },
  583. initTypeDict(){
  584. getKeyType().then(res => {
  585. let data = res.data.data;
  586. let pid = new Set();
  587. for (let i = 0; i < data.length; i++) {
  588. let item = data[i];
  589. pid.add(item.parentId);
  590. }
  591. let arr = [];
  592. pid.forEach(id => {
  593. data.forEach(item => {
  594. if (id == item.id){
  595. arr.push(item)
  596. }
  597. })
  598. })
  599. arr.forEach(item => {
  600. item.disabled = true;
  601. data.forEach(it => {
  602. if (item.id == it.parentId){
  603. if (!item.children){
  604. item.children = [];
  605. }
  606. it.dictValue = item.dictValue + '-' + it.dictValue;
  607. item.children.push(it)
  608. item.hasChildren = true;
  609. }
  610. })
  611. })
  612. this.typeList = arr;
  613. let formDicData = this.deepClone(arr);
  614. formDicData.forEach(item => {
  615. item.disabled = true;
  616. if (item.hasChildren){
  617. item.children.forEach(child => {
  618. child.disabled = child.isSealed == 1;
  619. })
  620. }
  621. });
  622. this.findObject(this.option.column, 'category').dicData = formDicData;
  623. this.findObject(this.option.column, 'categoryShow').dicData = formDicData;
  624. return arr;
  625. })
  626. },
  627. handoverSelectCallback(value){
  628. this.form.handoverPersonNo = value.ehr;
  629. this.form.handoverPersonName = value.name;
  630. },
  631. selectCallback(value){
  632. this.form.receiverId = value.id;
  633. this.form.receiverNo = value.ehr;
  634. this.form.receiverName = value.name;
  635. },
  636. rowSave(row, done, loading) {
  637. row.isTurnIn = !row.isTurnIn ? 0 : 1;
  638. add(row).then(() => {
  639. this.onLoad(this.page);
  640. this.$message({
  641. type: "success",
  642. message: "操作成功!"
  643. });
  644. done();
  645. }, error => {
  646. loading();
  647. window.console.log(error);
  648. });
  649. },
  650. rowUpdate(row, index, done, loading) {
  651. row.isTurnIn = !row.isTurnIn ? 0 : 1;
  652. update(row).then(() => {
  653. this.onLoad(this.page);
  654. this.$message({
  655. type: "success",
  656. message: "操作成功!"
  657. });
  658. done();
  659. }, error => {
  660. loading();
  661. console.log(error);
  662. });
  663. },
  664. rowDel(row) {
  665. this.$confirm("確定將選擇數據刪除?", {
  666. confirmButtonText: "確定",
  667. cancelButtonText: "取消",
  668. type: "warning"
  669. })
  670. .then(() => {
  671. return remove(row.id);
  672. })
  673. .then(() => {
  674. this.onLoad(this.page);
  675. this.$message({
  676. type: "success",
  677. message: "操作成功!"
  678. });
  679. });
  680. },
  681. handleDelete() {
  682. if (this.selectionList.length === 0) {
  683. this.$message.warning("請選擇至少一條數據");
  684. return;
  685. }
  686. this.$confirm("確定將選擇數據刪除?", {
  687. confirmButtonText: "確定",
  688. cancelButtonText: "取消",
  689. type: "warning"
  690. })
  691. .then(() => {
  692. return remove(this.ids);
  693. })
  694. .then(() => {
  695. this.onLoad(this.page);
  696. this.$message({
  697. type: "success",
  698. message: "操作成功!"
  699. });
  700. this.$refs.crud.toggleSelection();
  701. });
  702. },
  703. beforeOpen(done, type) {
  704. this.type = type;
  705. if (type === 'add'){
  706. this.form.number = 1;
  707. this.form.handoverDate = dateFormat(new Date(), "yyyy-MM-dd hh:mm");
  708. const data = this.currentDept;
  709. this.form.bankNo = data.bankNo;
  710. if (data.deptCategory != 1){
  711. //非管理部门
  712. this.form.orgNo = data.orgNo;
  713. this.form.orgName = data.deptName;
  714. this.form.handoverPersonName = this.userInfo.user_name;
  715. this.form.handoverPersonNo = this.userInfo.user_ehr;
  716. this.form.handoverPersonId = this.userInfo.user_id;
  717. let $category = this.findObject(this.option.column, 'category');
  718. let dicDataOld = this.findObject(this.option.column, 'categoryShow').dicData;
  719. $category.dicData = [];
  720. getCurrentUserKeepCategory().then(res => {
  721. let data = res.data.data;
  722. if (!data){
  723. // this.$message.warning("當前用戶暫時並無持有相關鑰匙/密碼/實物!");
  724. }else{
  725. data += ",";
  726. let dicDataNew = [];
  727. dicDataOld.forEach(item => {
  728. item.disabled = true;
  729. if (item.hasChildren){
  730. item.children.forEach(child => {
  731. child.disabled = child.isSealed == 1;
  732. if (data.indexOf(child.dictKey + ',') != -1){
  733. dicDataNew.push(child)
  734. }
  735. })
  736. }
  737. })
  738. $category.dicData = dicDataNew;
  739. this.userKeepList = dicDataNew;
  740. }
  741. done();
  742. });
  743. }else{
  744. this.findObject(this.option.column, 'orgNo').disabled = false;
  745. this.findObject(this.option.column, 'orgName').disabled = false;
  746. done();
  747. }
  748. /*// 支行用户自行添加交接,需要获取当前用户持有的列表作为下拉内容
  749. this.findObject(this.option.column, 'sealType').dicData = this.userKeepList;*/
  750. }
  751. if (["edit", "view"].includes(type)) {
  752. getDetail(this.form.id).then(res => {
  753. this.form = res.data.data;
  754. this.form.categoryShow = this.form.category;
  755. done();
  756. });
  757. }
  758. /*done();*/
  759. },
  760. searchReset() {
  761. this.query = {};
  762. this.onLoad(this.page);
  763. },
  764. searchChange(params, done) {
  765. /*if (params.category){
  766. params.category = params.category.join();
  767. }*/
  768. if (params.orgNos){
  769. params.orgNostr = params.orgNos.join();
  770. params.orgNos = '';
  771. }
  772. if (params.handoverDateRange){
  773. params.handoverDate_begin = params.handoverDateRange[0], params.handoverDate_end = params.handoverDateRange[1];
  774. params.handoverDateRange = null;
  775. }
  776. this.query = params;
  777. this.page.currentPage = 1;
  778. this.onLoad(this.page, params);
  779. done();
  780. },
  781. selectionChange(list) {
  782. this.selectionList = list;
  783. if (list && list.length > 0){
  784. let delFlag = true;
  785. // permission.keypwd_delete && userInfo.user_id == row.createUser
  786. for (let i = 0; i < list.length; i++) {
  787. let item = list[i];
  788. delFlag = delFlag && item.createUser == this.userInfo.user_id;
  789. }
  790. this.delBatchBtn = !delFlag;
  791. }else{
  792. this.delBatchBtn = true;
  793. }
  794. },
  795. selectionClear() {
  796. this.selectionList = [];
  797. this.$refs.crud.toggleSelection();
  798. },
  799. currentChange(currentPage){
  800. this.page.currentPage = currentPage;
  801. },
  802. sizeChange(pageSize){
  803. this.page.pageSize = pageSize;
  804. },
  805. refreshChange() {
  806. this.onLoad(this.page, this.query);
  807. },
  808. onLoad(page, params = {}) {
  809. this.loading = true;
  810. params.status = 1;
  811. params.process = 3;
  812. params.receiverId = this.userInfo.user_id;
  813. getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
  814. const data = res.data.data;
  815. this.page.total = data.total;
  816. data.records.forEach(item => {
  817. item.isTurnIn = item.isTurnIn == 1;
  818. item.categoryShow = item.category;
  819. })
  820. this.data = data.records;
  821. this.loading = false;
  822. this.selectionClear();
  823. });
  824. this.initCurrentDeptAndKeepCategroy();
  825. }
  826. }
  827. };
  828. </script>
  829. <style>
  830. </style>