index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  1. <template>
  2. <div class="relationQuery pagePadding">
  3. <div style="min-width: 1260px">
  4. <div style="padding: 5px 0 10px 0">
  5. <el-row :gutter="10" style="padding: 0 0 0px 0">
  6. <el-col :span="6" style="width: 170px">
  7. <el-select
  8. :size="searchSize"
  9. v-model="parmValue.type"
  10. placeholder="查询依据"
  11. @change="typeChange"
  12. >
  13. <el-option
  14. v-for="item in queryBasisList"
  15. :key="item.code"
  16. :label="item.name"
  17. :value="item.code"
  18. ></el-option>
  19. </el-select>
  20. </el-col>
  21. <el-col :span="6" style="width: 470px">
  22. <el-select
  23. v-model="code"
  24. multiple
  25. filterable
  26. :size="searchSize"
  27. remote
  28. style="width: 100%"
  29. :multiple-limit="1"
  30. reserve-keyword
  31. placeholder="请输入公司名称"
  32. :remote-method="remoteMethod"
  33. :loading="selectLoading"
  34. class="setWidth"
  35. >
  36. <el-option
  37. v-for="item in activeOptions"
  38. :key="item.companyNo"
  39. :label="item.companyName"
  40. :value="item.companyNo"
  41. />
  42. </el-select>
  43. </el-col>
  44. <el-col :span="6" style="width: 400px">
  45. <el-input
  46. placeholder="请输入编码"
  47. v-model="parmValue.codeNo"
  48. :size="searchSize"
  49. class="input-with-select"
  50. >
  51. <el-select
  52. v-model="parmValue.type"
  53. slot="prepend"
  54. disabled
  55. @change="
  56. parmValue.page = 1;
  57. searchList();
  58. "
  59. :size="searchSize"
  60. style="width: 120px"
  61. placeholder="请选择"
  62. >
  63. <el-option
  64. v-for="item in queryBasisList"
  65. :key="item.code"
  66. :label="item.name + '编码'"
  67. :value="item.code"
  68. ></el-option>
  69. </el-select>
  70. </el-input>
  71. <!-- <el-input
  72. v-model="parmValue.sequenceNo"
  73. :size="searchSize"
  74. placeholder="请输入确认单编号"
  75. ></el-input> -->
  76. </el-col>
  77. <el-col
  78. :span="6"
  79. style="float: right; width: 226px; text-align: right"
  80. >
  81. <el-button
  82. :size="searchSize"
  83. type="primary"
  84. icon="el-icon-search"
  85. @click="searchList"
  86. />
  87. <el-button
  88. type="warning"
  89. v-if="powers.some((item) => item == '024')"
  90. :size="searchSize"
  91. @click="restSearch"
  92. >
  93. 重置
  94. </el-button>
  95. <el-button
  96. v-if="powers.some((item) => item == '002')"
  97. :size="searchSize"
  98. type="primary"
  99. style="margin-left: 10px"
  100. @click="searchList"
  101. >
  102. 刷新
  103. </el-button>
  104. </el-col>
  105. </el-row>
  106. </div>
  107. <div v-loading="loading">
  108. <div v-if="active && active.length > 0">
  109. <el-row :gutter="20" class="header-j">
  110. <el-col
  111. :span="8"
  112. :class="{ width1: headIndex !== 1, width2: headIndex === 1 }"
  113. v-for="(head, headIndex) in active"
  114. :key="head"
  115. >
  116. <head-template
  117. :title="
  118. head === 'capital'
  119. ? '资金'
  120. : head === 'order'
  121. ? '确认单'
  122. : '发票'
  123. "
  124. :dashdIndex="headIndex"
  125. :type="parmValue.type"
  126. />
  127. </el-col>
  128. </el-row>
  129. <div class="body-main" v-if="tableData && tableData.length > 0">
  130. <div
  131. v-for="(item, index) in tableData"
  132. :key="item + index"
  133. class="body-page-main"
  134. >
  135. <el-row :gutter="20" class="body-page">
  136. <el-col
  137. :span="8"
  138. :class="{ width1: headIndex !== 1, width2: headIndex === 1 }"
  139. class="body-page-item"
  140. v-for="(head, headIndex) in active"
  141. :key="head + headIndex"
  142. >
  143. <item-template
  144. :list="item[head].list"
  145. :headIndex="headIndex"
  146. :type="parmValue.type"
  147. />
  148. <el-tooltip
  149. v-if="headIndex !== 1 && !item[head].btn"
  150. class="item"
  151. effect="dark"
  152. content="核销记录"
  153. placement="top"
  154. >
  155. <div
  156. class="btn"
  157. :class="{ right: headIndex === 0, left: headIndex === 2 }"
  158. v-if="headIndex !== 1 && !item[head].btn"
  159. @click="
  160. openModal(
  161. item[active[1]].No,
  162. item[active[1]].list[0].code,
  163. active[1],
  164. head
  165. )
  166. "
  167. >
  168. <i
  169. class="el-icon-d-arrow-left"
  170. v-if="headIndex === 0"
  171. ></i>
  172. <i class="el-icon-d-arrow-right" v-else></i>
  173. </div>
  174. </el-tooltip>
  175. <div
  176. class="btn dis"
  177. :class="{ right: headIndex === 0, left: headIndex === 2 }"
  178. v-if="headIndex !== 1 && item[head].btn"
  179. >
  180. <i class="el-icon-d-arrow-left" v-if="headIndex === 0"></i>
  181. <i class="el-icon-d-arrow-right" v-else></i>
  182. </div>
  183. </el-col>
  184. </el-row>
  185. </div>
  186. </div>
  187. <div class="body-main" v-else>
  188. <div class="body-page-main">
  189. <el-row :gutter="20" class="body-page">
  190. <el-col
  191. v-for="i in 3"
  192. :key="i"
  193. :span="8"
  194. class="body-page-item"
  195. :class="{ width2: i === 2, width1: i !== 2 }"
  196. >
  197. <div class="nodate">暂无数据</div>
  198. </el-col>
  199. </el-row>
  200. </div>
  201. </div>
  202. </div>
  203. <div class="myCard" v-else>
  204. <div class="excelUploadBox">
  205. <i class="el-icon-receiving"></i>
  206. <span class="boxM">请选择查询依据!</span>
  207. </div>
  208. </div>
  209. </div>
  210. <div
  211. class="Pagination"
  212. style="text-align: right; margin-top: 10px"
  213. v-show="count > 0"
  214. >
  215. <el-pagination
  216. :size="searchSize"
  217. @size-change="handleSizeChange"
  218. @current-change="handlePageChange"
  219. :current-page="parmValue.page"
  220. :page-sizes="[15, 50, 100]"
  221. :page-size="parmValue.size"
  222. layout="total, sizes, prev, pager, next, jumper"
  223. :total="count"
  224. ></el-pagination>
  225. </div>
  226. <add-edit
  227. :id="modelId"
  228. :show-model="showModel"
  229. :No="No"
  230. :is-detail="isDetail"
  231. @refresh="searchList"
  232. @cancel="showModel = false"
  233. />
  234. </div>
  235. </div>
  236. </template>
  237. <script>
  238. import mixinPage from "@/mixins/elPaginationHandle";
  239. import asyncRequest from "@/apis/service/InvoiceSales/relationQuery";
  240. import { mapGetters } from "vuex";
  241. import { invoiceType, capitalType, queryBasisList } from "@/assets/js/linkType";
  242. import headTemplate from "./headTemplate.vue";
  243. import itemTemplate from "./itemTemplate.vue";
  244. import addEdit from "./addEdit";
  245. import resToken from "@/mixins/resToken";
  246. export default {
  247. name: "relationQuery",
  248. components: {
  249. headTemplate,
  250. itemTemplate,
  251. addEdit,
  252. },
  253. computed: {
  254. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  255. powers() {
  256. let tran =
  257. this.$store.getters.btnList.find(
  258. (item) => item.menu_route == "relationQuery"
  259. ) || {};
  260. if (tran && tran.action && tran.action.length > 0) {
  261. return tran.action;
  262. } else {
  263. return [];
  264. }
  265. },
  266. },
  267. data() {
  268. return {
  269. code: [],
  270. input: "",
  271. No: "",
  272. selectLoading: false,
  273. invoiceType: invoiceType,
  274. capitalType: capitalType,
  275. queryBasisList: queryBasisList,
  276. active: ["capital", "order", "invoice"],
  277. loading: false,
  278. showModel: false,
  279. isDetail: false,
  280. modelId: 0,
  281. parmValue: {
  282. type: "",
  283. companyNo: "",
  284. page: 1,
  285. size: 15,
  286. codeNo: "",
  287. },
  288. count: 0, // 总条数
  289. tableData: [],
  290. };
  291. },
  292. mixins: [mixinPage, resToken],
  293. mounted() {
  294. this.restSearch();
  295. },
  296. methods: {
  297. restSearch() {
  298. this.code = [];
  299. this.active = [];
  300. this.parmValue = {
  301. type: "",
  302. companyNo: "",
  303. page: 1,
  304. size: 15,
  305. codeNo: "",
  306. };
  307. this.tableData = [];
  308. // this.searchList();
  309. },
  310. openModal(No, codeNo, from, to) {
  311. console.log(from, to);
  312. this.isDetail = 0;
  313. switch (from + "," + to) {
  314. case "order,invoice":
  315. this.isDetail = "1";
  316. break;
  317. case "order,capital":
  318. this.isDetail = "2";
  319. break;
  320. case "capital,order":
  321. this.isDetail = "3";
  322. break;
  323. case "invoice,capital":
  324. this.isDetail = "4";
  325. break;
  326. case "capital,invoice":
  327. this.isDetail = "5";
  328. break;
  329. case "invoice,order":
  330. this.isDetail = "6";
  331. break;
  332. }
  333. console.log(this.isDetail);
  334. this.modelId = codeNo;
  335. this.No = No;
  336. this.showModel = true;
  337. },
  338. async typeChange(val) {
  339. if (val) {
  340. let index = this.queryBasisList.findIndex((v1) => v1.code === val);
  341. if (index !== -1) {
  342. this.active = this.queryBasisList[index].active;
  343. } else {
  344. this.active = [];
  345. this.tableData = [];
  346. }
  347. } else {
  348. this.active = [];
  349. this.tableData = [];
  350. }
  351. this.parmValue.codeNo = "";
  352. await this.searchList();
  353. },
  354. async searchList() {
  355. if (this.parmValue.type === "") {
  356. this.$message.warning("请选择查询依据!");
  357. return;
  358. }
  359. if (this.active && this.active.length === 3) {
  360. this.parmValue.companyNo = this.code.join(",");
  361. this.loading = true;
  362. this.tableData = [];
  363. // for (let i = 0; i < 5; i++) {
  364. // }
  365. let res = await asyncRequest.list(this.parmValue);
  366. console.log(res);
  367. if (res && res.code === 0 && res.data) {
  368. let data = res.data.list;
  369. data.forEach((v1) => {
  370. let modelA = {
  371. order: {
  372. btn: v1.dashd === "orderinfo" ? true : false,
  373. No: "",
  374. list: [],
  375. },
  376. capital: {
  377. btn: v1.dashd === "tradeinfo" ? true : false,
  378. No: "",
  379. list: [],
  380. },
  381. invoice: {
  382. btn: v1.dashd === "invinfo" ? true : false,
  383. No: "",
  384. list: [],
  385. },
  386. };
  387. v1.orderinfo.forEach((v2) => {
  388. v2.qrdNo.forEach((v3) => {
  389. let itemQ = {
  390. code: v3.qrdNo,
  391. name: v2.companyName,
  392. inv_fee: v3.ainv_fee,
  393. fund_fee: v3.afund_fee,
  394. order_fee: 0,
  395. };
  396. modelA.order.No = v2.orderNo;
  397. modelA.order.list.push(itemQ);
  398. });
  399. });
  400. v1.tradeinfo.forEach((v2) => {
  401. let itemW = {
  402. code: v2.traNo,
  403. name: v2.companyName,
  404. inv_fee: v2.inv_fee,
  405. fund_fee: 0,
  406. order_fee: v2.order_fee,
  407. };
  408. modelA.capital.No = v2.traNo;
  409. modelA.capital.list.push(itemW);
  410. });
  411. v1.invinfo.forEach((v2) => {
  412. let itemE = {
  413. code: v2.invNo,
  414. name: v2.companyName,
  415. inv_fee: 0,
  416. fund_fee: v2.atrade_fee,
  417. order_fee: v2.aorder_fee,
  418. };
  419. modelA.invoice.No = v2.invNo;
  420. modelA.invoice.list.push(itemE);
  421. });
  422. this.tableData.push(modelA);
  423. });
  424. this.count = Number(res.data.count);
  425. } else if (res && res.code >= 100 && res.code <= 104) {
  426. await this.logout();
  427. } else {
  428. this.tableData = [];
  429. this.count = 0;
  430. }
  431. this.loading = false;
  432. }
  433. },
  434. // async statusConfirm(id, status) {
  435. // console.log(id, status);
  436. // let str = status === "1" ? "禁用" : "启用";
  437. // await this.$confirm("确定要改为" + str, {
  438. // confirmButtonText: "确定",
  439. // cancelButtonText: "取消",
  440. // type: "warning",
  441. // })
  442. // .then(async () => {
  443. // this.loading = true;
  444. // const model = {
  445. // id: id,
  446. // status: status === "1" ? "0" : "1",
  447. // };
  448. // const res = await asyncRequest.status(model);
  449. // if (res.code === 0) {
  450. // this.loading = false;
  451. // this.$notify.success({
  452. // title: "状态修改成功!",
  453. // message: "",
  454. // });
  455. // await this.searchList();
  456. // } else {
  457. // this.loading = false;
  458. // }
  459. // })
  460. // .catch(() => {
  461. // console.log("取消");
  462. // });
  463. // },
  464. async remoteMethod(query) {
  465. this.selectLoading = true;
  466. if (query !== "") {
  467. this.activeOptions = [];
  468. const res = await asyncRequest.clist({
  469. page: 1,
  470. size: 100,
  471. company: query,
  472. });
  473. if (res && res.code === 0 && res.data && res.data.list) {
  474. this.activeOptions = res.data.list;
  475. } else if (res && res.code >= 100 && res.code <= 104) {
  476. await this.logout();
  477. } else {
  478. this.$message.warning(res.message);
  479. }
  480. } else {
  481. this.activeOptions = [];
  482. }
  483. this.selectLoading = false;
  484. },
  485. },
  486. };
  487. </script>
  488. <style lang="scss" scoped>
  489. .relationQuery {
  490. // overflow-x: scroll;
  491. width: 100%;
  492. height: 100%;
  493. position: relative;
  494. .header-j {
  495. .width1 {
  496. width: 330px;
  497. }
  498. .width2 {
  499. width: calc(100% - 660px);
  500. }
  501. }
  502. .body-main {
  503. position: relative;
  504. width: 100%;
  505. .body-page-main {
  506. position: relative;
  507. width: 100%;
  508. .body-page {
  509. display: flex;
  510. width: calc(100% + 20px);
  511. align-items: stretch;
  512. .body-page-item {
  513. width: 33.33%;
  514. position: relative;
  515. &.width1 {
  516. width: 330px;
  517. }
  518. &.width2 {
  519. width: calc(100% - 660px);
  520. }
  521. .nodate {
  522. width: 100%;
  523. line-height: 36px;
  524. text-align: center;
  525. color: #909399;
  526. font-size: 13px;
  527. // width: 100%;
  528. // position: relative;
  529. // height: 100%;
  530. border: 1px solid rgb(223, 230, 236);
  531. border-top: 0;
  532. }
  533. .btn {
  534. position: absolute;
  535. // background: #e4393c;
  536. width: 40px;
  537. height: 30px;
  538. box-sizing: border-box;
  539. // border: 1px solid rgb(99, 203, 231);
  540. color: rgb(99, 203, 231);
  541. text-align: center;
  542. line-height: 26px;
  543. font-size: 17px;
  544. z-index: 5;
  545. border-radius: 2px;
  546. top: calc(50% - 15px);
  547. i {
  548. font-weight: 900;
  549. font-family: "Microsoft Yahei", sans-serif "Microsoft Yahei",
  550. sans-serif;
  551. }
  552. &.right {
  553. right: -20px;
  554. }
  555. &.left {
  556. left: -20px;
  557. }
  558. &:hover {
  559. cursor: pointer;
  560. }
  561. &.dis {
  562. color: rgb(213, 220, 226);
  563. i {
  564. font-weight: normal;
  565. }
  566. &:hover {
  567. cursor: not-allowed;
  568. }
  569. }
  570. }
  571. // display: flex;
  572. // align-items: stretch;
  573. }
  574. }
  575. }
  576. }
  577. .myCard {
  578. border-radius: 4px;
  579. border: 1px solid #e6ebf5;
  580. background-color: #ffffff;
  581. padding: 18px;
  582. color: #303133;
  583. box-sizing: content-box;
  584. .excelUploadBox {
  585. position: relative;
  586. width: 100%;
  587. height: 120px;
  588. line-height: 120px;
  589. box-sizing: border-box;
  590. &:hover {
  591. cursor: pointer;
  592. }
  593. .el-icon-receiving {
  594. width: 100%;
  595. text-align: center;
  596. height: 50px;
  597. display: block;
  598. font-size: 32px;
  599. line-height: 90px;
  600. color: #d3d4d6;
  601. }
  602. .boxM {
  603. width: 100%;
  604. display: block;
  605. text-align: center;
  606. line-height: 65px;
  607. height: 60px;
  608. color: #909399;
  609. }
  610. }
  611. }
  612. }
  613. </style>
  614. };