PerformInventoryTasks.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  1. <template>
  2. <div>
  3. <div class="grid-item-row1">
  4. <div class="btn-group m-panel" role="group">
  5. <div class="form-inline">
  6. <div class="form-group">
  7. <label for="assetName">盘点单名称:</label>
  8. <label for="assetName"> {{ assetInventoryName }}</label>
  9. </div>
  10. <div class="form-group">
  11. <label class="common" for="assetName">盘点单编号:</label>
  12. <label for="assetName"> {{ assetInventoryNo }}</label>
  13. </div>
  14. </div>
  15. <div class="form-inline">
  16. <div class="form-group">
  17. <label for="assetName">资产名称</label>
  18. <input
  19. id="assetName"
  20. v-model="assetName"
  21. autocomplete="off"
  22. type="text"
  23. class="common form-control"
  24. placeholder="资产名称"
  25. @keyup.enter="searchDatas"
  26. />
  27. </div>
  28. <div class="form-group">
  29. <label class="common" for="assetNo">资产编号</label>
  30. <input
  31. id="assetNo"
  32. v-model="assetNo"
  33. autocomplete="off"
  34. type="text"
  35. class="common form-control"
  36. placeholder="资产编号"
  37. @keyup.enter="searchDatas"
  38. />
  39. </div>
  40. <div class="form-group">
  41. <label class="common" for="cardNo">卡片编号</label>
  42. <input
  43. id="cardNo"
  44. v-model="cardNo"
  45. autocomplete="off"
  46. type="text"
  47. class="common form-control"
  48. placeholder="卡片编号"
  49. @keyup.enter="searchDatas"
  50. />
  51. </div>
  52. <a-button
  53. type="primary"
  54. class="common"
  55. @click="searchDatas"
  56. >
  57. 查询
  58. </a-button>
  59. <a-button type="primary" danger class="common" @click="clearFilter">
  60. 清空
  61. </a-button>
  62. </div>
  63. </div>
  64. </div>
  65. <CommonTable
  66. ref="table"
  67. :columns="columns"
  68. :data-source="dataSource"
  69. :total="pagination.total"
  70. @get-pager="getPageParams"
  71. >
  72. <template #bodyCell="{ column, record, index }">
  73. <template v-if="column.key == 'useStatusId'">
  74. <select
  75. v-model="record.useStatusId"
  76. class="form-control"
  77. placeholder="盘点使用状态"
  78. >
  79. <option />
  80. <option
  81. v-for="useStatus in useStatusList"
  82. :key="useStatus.id"
  83. :value="useStatus.id"
  84. >
  85. {{ useStatus.text }}
  86. </option>
  87. </select>
  88. </template>
  89. <template v-if="column.key == 'description'">
  90. <input
  91. id="cardNo"
  92. v-model="record.description"
  93. autocomplete="off"
  94. type="text"
  95. class="form-control"
  96. placeholder="备注"
  97. />
  98. </template>
  99. <template v-if="column.key == 'affirm'">
  100. <a-button
  101. class="btn btn-default"
  102. @click="updateAssetInventoryLine(record, index)"
  103. >
  104. 人工确认
  105. </a-button>
  106. </template>
  107. <template v-if="column.key == 'info'">
  108. <button class="btn btn-link" @click="openCurdWindow(record)">
  109. 查看
  110. </button>
  111. </template>
  112. </template>
  113. </CommonTable>
  114. <div>
  115. <a-button v-if="currentStep == 1" type="primary" class="previousBtn" @click="previous">
  116. 上一步
  117. </a-button>
  118. </div>
  119. <!-- <div class="grid-item-row3">
  120. <div>
  121. <div class="pull-left">
  122. <span>
  123. {{ $t("lang.AssetInventorySearch.the") }}
  124. {{ (pagination.current_page - 1) * pagination.per_page + 1 }}
  125. -
  126. {{ pagination.current_page * pagination.per_page }}
  127. {{ $t("lang.AssetInventorySearch.strip") }},
  128. {{ $t("lang.AssetInventorySearch.inTotal") }}
  129. {{ pagination.total }}{{ $t("lang.AssetInventorySearch.strip") }},
  130. {{ $t("lang.AssetInventorySearch.eachPage") }}
  131. </span>
  132. <PageSizeSelect @page-size-changed="pageSizeChanged" />
  133. <span>{{ $t("lang.AssetInventorySearch.strip") }}</span>
  134. </div>
  135. <div class="pull-right">
  136. <VueBootstrapPagination
  137. :pagination="pagination"
  138. :callback="pageStartChanged"
  139. />
  140. </div>
  141. </div>
  142. </div> -->
  143. <Loading v-if="loading" />
  144. </div>
  145. </template>
  146. <script>
  147. import Common from '../../common/Common.js';
  148. import AssetInventoryResource from '../../api/asset/AssetInventoryResource.js';
  149. import AssetInventoryLineResource from '../../api/asset/AssetInventoryLineResource.js';
  150. import { Notify, Uuid } from 'pc-component-v3';
  151. import { SqlApi } from 'pc-component-v3';
  152. import UseStatusResource from '../../api/asset/UseStatusResource.js';
  153. import CommonTable from '../../common/CommonTable.vue';
  154. export default {
  155. components: {
  156. CommonTable,
  157. },
  158. props: {
  159. currentStep: {
  160. type: Number,
  161. required: true,
  162. default: 1,
  163. },
  164. id: {
  165. type: Number,
  166. required: true,
  167. default: 0,
  168. },
  169. },
  170. emits: ['next', 'changeStep'],
  171. data: function () {
  172. return {
  173. // 表格数据
  174. columns: [
  175. {
  176. title: '资产名称',
  177. key: 'assetName',
  178. dataIndex: 'assetName',
  179. width: 100,
  180. },
  181. {
  182. title: '资产编号',
  183. key: 'assetNo',
  184. dataIndex: 'assetNo',
  185. width: 100,
  186. },
  187. {
  188. title: '卡片编号',
  189. key: 'cardNo',
  190. dataIndex: 'cardNo',
  191. width: 100,
  192. },
  193. {
  194. title: '盘点使用状态',
  195. key: 'useStatusId',
  196. dataIndex: 'useStatusId',
  197. width: 180,
  198. },
  199. {
  200. title: '备注',
  201. key: 'description',
  202. dataIndex: 'description',
  203. width: 180,
  204. },
  205. {
  206. title: '确认',
  207. key: 'affirm',
  208. dataIndex: 'affirm',
  209. width: 100,
  210. },
  211. {
  212. title: '账面位置',
  213. key: 'locationName',
  214. dataIndex: 'locationName',
  215. width: 100,
  216. },
  217. {
  218. title: '账面使用状态',
  219. key: 'useStatusName',
  220. dataIndex: 'useStatusName',
  221. width: 110,
  222. },
  223. {
  224. title: '规格型号',
  225. key: 'assetType',
  226. dataIndex: 'assetType',
  227. width: 100,
  228. },
  229. {
  230. title: '类别名称',
  231. key: 'assetCategoryName',
  232. dataIndex: 'assetCategoryName',
  233. width: 100,
  234. },
  235. {
  236. title: '责任人',
  237. key: 'custodianUserName',
  238. dataIndex: 'custodianUserName',
  239. width: 100,
  240. },
  241. {
  242. title: '使用人',
  243. key: 'useUserName',
  244. dataIndex: 'useUserName',
  245. width: 100,
  246. },
  247. {
  248. title: '保管人',
  249. key: 'depositoryUserName',
  250. dataIndex: 'depositoryUserName',
  251. width: 100,
  252. },
  253. {
  254. title: '所属单位',
  255. key: 'clientName',
  256. dataIndex: 'clientName',
  257. width: 100,
  258. },
  259. {
  260. title: '所属部门',
  261. key: 'organizationName',
  262. dataIndex: 'organizationName',
  263. width: 100,
  264. },
  265. {
  266. title: '使用单位',
  267. key: 'userClientName',
  268. dataIndex: 'userClientName',
  269. width: 100,
  270. },
  271. {
  272. title: '使用部门',
  273. key: 'useOrganizationName',
  274. dataIndex: 'useOrganizationName',
  275. width: 100,
  276. },
  277. {
  278. title: '详细信息',
  279. key: 'info',
  280. dataIndex: 'info',
  281. width: 100,
  282. fixed: 'right',
  283. },
  284. ].map(item => ({ ...item, align: 'center' })),
  285. dataSource: [],
  286. assetInventoryId: null, // 资产盘点单Id
  287. assetInventory: {}, // 资产盘点
  288. assetInventoryNo: null,
  289. assetInventoryName: null,
  290. assetName: null, // 资产名称
  291. assetNo: null, // 资产编号
  292. cardNo: null, // 卡片编号
  293. assetInventoryLines: [],
  294. pagination: {
  295. total: 0,
  296. per_page: Common.pageSize, // required
  297. current_page: 1, // required
  298. last_page: 1, // required
  299. },
  300. totalCount: 0,
  301. uuid: Uuid.createUUID(),
  302. useStatusList: [],
  303. loading: false,
  304. };
  305. },
  306. mounted: function () {
  307. var _self = this;
  308. // 根据UUID获取盘点单的id
  309. // var uuid = _self.$route.params;
  310. _self.assetInventoryId = this.$props.id;
  311. _self.getAssetInventory();
  312. // 固定行
  313. // _self.fixedTableHeader();
  314. // 可调整表格列宽
  315. // _self.$nextTick(function () {
  316. // $('.fixed-table').resizableColumns();
  317. // });
  318. _self.getUseStatusList();
  319. },
  320. methods: {
  321. selectChanged: function () {
  322. var _self = this;
  323. _self.getAssetInventoryLine();
  324. },
  325. // 从子组件获取的分页参数
  326. getPageParams: function (start, length) {
  327. this.pagination.current_page = start;
  328. this.pagination.per_page = length;
  329. this.getAssetInventoryLine();
  330. },
  331. searchDatas: function () {
  332. this.$refs.table.backFirstPage();
  333. },
  334. /**
  335. * 查询盘点单DTO,
  336. * 主要是获取资产盘点中的所属部门集合、使用部门集合、资产类别结合。
  337. * @author yangzhijie 20200806
  338. */
  339. getAssetInventory: function () {
  340. var _self = this;
  341. AssetInventoryResource.getResponseOrganizationsAndOrganizationsAndCategory(
  342. _self.assetInventoryId,
  343. ).then(
  344. data => {
  345. // console.log(data, '11111');
  346. _self.assetInventory = data;
  347. _self.assetInventoryNo = data.data.documentNo;
  348. _self.assetInventoryName = data.data.name;
  349. // 查询资产卡片的数据
  350. _self.getAssetInventoryLine();
  351. },
  352. xmlHttpRequest => {
  353. Common.processException(xmlHttpRequest);
  354. },
  355. );
  356. },
  357. /**
  358. * 根据界面选中的所属部门、使用部门、资产类别、项目查询资产清单
  359. * @author yangzhijie 20200806
  360. */
  361. getAssetInventoryLine: function () {
  362. var _self = this;
  363. // _self.pagination.current_page = 1;
  364. // if (!isPageChange) {
  365. // _self.pagination.current_page = 1;
  366. // }
  367. // _self.clearPageData();
  368. _self.loading = true;
  369. var parameter = {
  370. assetInventoryId: _self.assetInventoryId,
  371. assetNo:
  372. _self.assetNo != null && _self.assetNo.length > 0
  373. ? '%' + _self.assetNo + '%'
  374. : null,
  375. assetName:
  376. _self.assetName != null && _self.assetName.length > 0
  377. ? '%' + _self.assetName + '%'
  378. : null,
  379. no:
  380. _self.cardNo != null && _self.cardNo.length > 0
  381. ? '%' + _self.cardNo + '%'
  382. : null,
  383. pageStart:
  384. (_self.pagination.current_page - 1) * _self.pagination.per_page,
  385. pageLength: _self.pagination.per_page,
  386. };
  387. SqlApi.execute('20220428_145050', parameter).then(
  388. successData => {
  389. // console.log(successData, '222222');
  390. if (successData.errorCode == 0) {
  391. _self.redrawAssetInstance(successData);
  392. _self.dataSource = successData.dataList;
  393. _self.pagination.total = successData.totalSize;
  394. } else {
  395. Notify.error('盘亏数据查询异常', successData.errorMessage, true);
  396. }
  397. _self.loading = false;
  398. },
  399. errorData => {
  400. Common.processException(errorData);
  401. _self.loading = false;
  402. },
  403. );
  404. },
  405. /**
  406. * 重新绘制资产卡片
  407. * @author YangZhiJie 20200806
  408. */
  409. redrawAssetInstance: function (data) {
  410. var _self = this;
  411. if (data.dataList != null) {
  412. data.dataList.forEach(element => {
  413. element.description = '';
  414. element.useStatusId = '';
  415. });
  416. }
  417. _self.assetInventoryLines = data.dataList;
  418. _self.pagination.total = data.totalSize;
  419. _self.pagination.last_page = Math.ceil(
  420. data.totalSize / _self.pagination.per_page,
  421. );
  422. _self.totalCount = data.totalSize;
  423. // _self.fixedTableHeader();
  424. },
  425. /**
  426. * 清空分页数据
  427. * @author YangZhiJie 20200806
  428. */
  429. // clearPageData: function () {
  430. // var data = {
  431. // dataList: [],
  432. // totalSize: 0,
  433. // range: {
  434. // start: 0,
  435. // length: this.pagination.per_page,
  436. // },
  437. // };
  438. // this.redrawAssetInstance(data);
  439. // },
  440. /**
  441. * 清空界面的搜索条件
  442. * @author YangZhiJie 20200806
  443. */
  444. clearFilter: function () {
  445. this.assetName = null;
  446. this.assetNo = null;
  447. this.cardNo = null;
  448. this.searchDatas();
  449. },
  450. /**
  451. * 表格显示行数发生改变
  452. * @author YangZhiJie 20200806
  453. */
  454. // pageSizeChanged: function (newPageSize) {
  455. // this.pagination.per_page = newPageSize;
  456. // this.pagination.current_page = 1;
  457. // this.getAssetInventoryLine();
  458. // },
  459. /**
  460. * 页数发生变化
  461. * @author YangZhiJie 20200806
  462. */
  463. // pageStartChanged: function () {
  464. // this.getAssetInventoryLine(true);
  465. // },
  466. /**
  467. * 冻结表头
  468. */
  469. // fixedTableHeader: function () {
  470. // var _self = this;
  471. // _self.$nextTick(function () {
  472. // $('.fixed-table').tableFixer({
  473. // head: true,
  474. // });
  475. // });
  476. // },
  477. /**
  478. * 打开资产卡片的CURD窗口
  479. */
  480. openCurdWindow: function (assetInventoryLine) {
  481. let index = window.location.href.indexOf('#');
  482. let url = window.location.href.slice(0, index);
  483. let path =
  484. url +
  485. '#/desktop/window/window-read/view/040701/0/' +
  486. assetInventoryLine.assetInstanceId +
  487. '?currPage=1&currIndex=1&totalCount=1&uuid=' +
  488. Uuid.createUUID();
  489. // let url = Common.getRedirectUrl(
  490. // '#/desktop/window/window-read/view/040701/0/' +
  491. // assetInventoryLine.assetInstanceId +
  492. // '?currPage=1&currIndex=1&totalCount=1&uuid=' +
  493. // Uuid.createUUID(),
  494. // );
  495. window.open(path);
  496. },
  497. /**
  498. * 获取使用状况
  499. */
  500. getUseStatusList: function () {
  501. var _self = this;
  502. UseStatusResource.getUseStatus().then(
  503. data => {
  504. _self.useStatusList = data.datas;
  505. },
  506. xmlHttpRequest => {
  507. Common.processException(xmlHttpRequest);
  508. },
  509. );
  510. },
  511. next: function () {
  512. var _self = this;
  513. _self.$emit('next');
  514. },
  515. // 回到上一步
  516. previous: function () {
  517. var _self = this;
  518. _self.$emit('changeStep', {step:0});
  519. },
  520. /**
  521. * 更新资产盘点明细中的备注和使用状态。
  522. */
  523. updateAssetInventoryLine: function (assetInventoryLine, index) {
  524. let _self = this;
  525. if (
  526. assetInventoryLine.description == null ||
  527. assetInventoryLine.description === '' ||
  528. assetInventoryLine.useStatusId == null ||
  529. assetInventoryLine.useStatusId === ''
  530. ) {
  531. Notify.error('错误', '请填写"盘点使用状态"和"备注"信息\'。');
  532. return;
  533. }
  534. AssetInventoryLineResource.checkLossConfirm(
  535. assetInventoryLine.assetInventoryLineId,
  536. assetInventoryLine.description,
  537. true,
  538. assetInventoryLine.useStatusId,
  539. ).then(
  540. data => {
  541. if (data.errorCode == 0) {
  542. if (
  543. assetInventoryLine.useStatusId != null &&
  544. assetInventoryLine.useStatusId != ''
  545. ) {
  546. _self.assetInventoryLines.splice(index, 1);
  547. _self.pagination.total = _self.pagination.total - 1;
  548. _self.pagination.last_page = Math.ceil(
  549. _self.pagination.total / _self.pagination.per_page,
  550. );
  551. }
  552. } else {
  553. Notify.error('错误', '该盘点明细已经被删除,请确认');
  554. }
  555. },
  556. errorData => {
  557. Common.processException(errorData);
  558. },
  559. );
  560. },
  561. },
  562. };
  563. </script>
  564. <style scoped>
  565. .grid-container {
  566. margin-top: 10px;
  567. display: grid;
  568. grid-template-columns: auto;
  569. grid-template-rows: auto 1fr 40px;
  570. gap: 10px;
  571. justify-items: stretch;
  572. align-items: stretch;
  573. height: calc(100vh - 170px);
  574. overflow: auto;
  575. }
  576. .grid-item-row1 {
  577. grid-row-start: 1;
  578. grid-row-end: 2;
  579. grid-column-start: 1;
  580. grid-column-end: 2;
  581. }
  582. /* .grid-item-row2 {
  583. grid-row-start: 2;
  584. grid-row-end: 3;
  585. grid-column-start: 1;
  586. grid-column-end: 2;
  587. overflow: auto;
  588. } */
  589. .grid-item-row3 {
  590. grid-row-start: 3;
  591. grid-row-end: 4;
  592. grid-column-start: 1;
  593. grid-column-end: 2;
  594. }
  595. </style>
  596. <style scoped>
  597. .common {
  598. margin-left: 8px;
  599. }
  600. .m-grid-footer {
  601. padding: 10px;
  602. }
  603. .m-panel {
  604. margin-bottom: 0px;
  605. }
  606. .fixed-table {
  607. table-layout: fixed;
  608. width: 800px !important;
  609. min-width: 800px !important;
  610. }
  611. table.fixed-table tr {
  612. height: 40px;
  613. }
  614. table.fixed-table th,
  615. table.fixed-table td {
  616. overflow: hidden;
  617. white-space: nowrap;
  618. text-overflow: ellipsis;
  619. }
  620. :deep(.ant-table-pagination.ant-pagination) {
  621. margin: 4px 0;
  622. }
  623. .previousBtn {
  624. position: fixed;
  625. top: 90%;
  626. }
  627. </style>