index.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <script>
  2. import useColumns from "./columns";
  3. import { dicts } from "./dicts";
  4. import { LIST } from "@/api/business/purchase/task";
  5. export default {
  6. name: "PuchaseTask",
  7. dicts: dicts,
  8. components: {
  9. DcButton: () => import("./dao-chu/index.vue"),
  10. SeeButton: () => import("./see/index.vue"),
  11. ZpButton: () => import("./zhuan-pai/index.vue"),
  12. ThxqButton: () => import("./tui-hui-xu-qiu/index.vue"),
  13. XyzcButton: () => import("./xie-yi-zhi-cai/index.vue"),
  14. ElSuperTable: () => import("@/components/super-table/index.vue"),
  15. ElSuperSearch: () => import("@/components/super-search/index.vue"),
  16. },
  17. data() {
  18. const { TableColumns, SearchColumns } = useColumns();
  19. const page = this.$init.page();
  20. const params = this.$init.params(SearchColumns);
  21. return {
  22. size: "mini",
  23. loading: false,
  24. page: page,
  25. params: params,
  26. tableData: [],
  27. selectData: [],
  28. TableColumns: TableColumns,
  29. SearchColumns: SearchColumns,
  30. };
  31. },
  32. computed: {},
  33. watch: {},
  34. created() {
  35. this.useQuery(this.params, this.page);
  36. },
  37. methods: {
  38. //
  39. setSelectable(row) {
  40. const { status } = row;
  41. if (status === "1") {
  42. // 已执行协议直采
  43. return false;
  44. } else {
  45. return true;
  46. }
  47. },
  48. //
  49. async fetchList(prop, page) {
  50. try {
  51. this.loading = true;
  52. this.tableData = [];
  53. const { code, rows, total } = await LIST(prop, page);
  54. if (code === 200) {
  55. this.tableData = rows;
  56. this.page.total = total;
  57. }
  58. } catch (err) {
  59. // catch
  60. } finally {
  61. // finally
  62. this.loading = false;
  63. }
  64. },
  65. // 查 询
  66. async useQuery(prop, page) {
  67. const { pageNum, pageSize } = page;
  68. const { date, documentsCodes: dCode, materialCodes: mCode } = prop;
  69. const [startDate, endDate] = date || [];
  70. const documentsCodes = dCode
  71. ? dCode.replace(/\s*/g, "").replaceAll(",", ",")
  72. : undefined;
  73. const materialCodes = Array.isArray(mCode)
  74. ? mCode
  75. : mCode
  76. ? mCode.replace(/\s*/g, "").replaceAll(",", ",").split(",")
  77. : undefined;
  78. await this.fetchList(
  79. {
  80. ...prop,
  81. endDate,
  82. startDate,
  83. materialCodes,
  84. documentsCodes,
  85. date: undefined,
  86. },
  87. { pageNum, pageSize, isAsc: "desc", orderByColumn: "updateTime" }
  88. );
  89. },
  90. // 重 置
  91. useReset() {
  92. this.page = this.$init.page();
  93. this.params = this.$init.params(this.SearchColumns);
  94. this.useQuery(this.params, this.page);
  95. },
  96. // 选 择
  97. useSelect(prop, value) {
  98. this.selectData = prop;
  99. },
  100. },
  101. };
  102. </script>
  103. <template>
  104. <el-card
  105. v-loading="loading"
  106. :body-style="{
  107. height: '100%',
  108. padding: 0,
  109. display: 'flex',
  110. 'flex-direction': 'column',
  111. }"
  112. >
  113. <el-super-search
  114. v-model="params"
  115. :size="size"
  116. :dict="dict"
  117. :columns="SearchColumns"
  118. @reset="useReset"
  119. @submit="useQuery(params, page)"
  120. @aaa="useQuery(params, page)"
  121. ></el-super-search>
  122. <div class="my-4" style="text-align: right">
  123. <el-button-group>
  124. <see-button
  125. :size="size"
  126. :dict="dict"
  127. :select-data="selectData"
  128. @success="useQuery(params, page)"
  129. ></see-button>
  130. </el-button-group>
  131. <el-button-group>
  132. <thxq-button
  133. :size="size"
  134. :select-data="selectData"
  135. @success="useQuery(params, page)"
  136. ></thxq-button>
  137. <xyzc-button
  138. :size="size"
  139. :dict="dict"
  140. :select-data="selectData"
  141. @success="useQuery(params, page)"
  142. ></xyzc-button>
  143. </el-button-group>
  144. <el-button-group>
  145. <zp-button
  146. :size="size"
  147. :select-data="selectData"
  148. @success="useQuery(params, page)"
  149. >
  150. </zp-button>
  151. </el-button-group>
  152. <!-- <el-button-group>
  153. <dc-button
  154. :size="size"
  155. :page="page"
  156. :data="params"
  157. @success="useQuery(params, page)"
  158. ></dc-button>
  159. </el-button-group> -->
  160. </div>
  161. <el-super-table
  162. v-model="tableData"
  163. :size="size"
  164. :dict="dict"
  165. :page="page"
  166. :columns="TableColumns"
  167. index
  168. checkbox
  169. pagination
  170. convenitentOperation
  171. @row-select="useSelect"
  172. @pagination="useQuery(params, page)"
  173. >
  174. </el-super-table>
  175. </el-card>
  176. </template>
  177. <style scoped lang="scss">
  178. .el-card {
  179. width: calc(100% - 32px);
  180. height: calc(100vh - 32px);
  181. margin: 16px;
  182. padding: 16px;
  183. border-radius: 8px;
  184. }
  185. .el-button-group + .el-button-group {
  186. margin: 0 0 0 8px;
  187. }
  188. </style>