ViewHistoryVersionModal.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <a-modal
  3. title="历史版本查看(view historical version)"
  4. width="75%"
  5. :visible="visible"
  6. :maskClosable="false"
  7. switchFullscreen
  8. @cancel="handleCancel">
  9. <template #footer>
  10. <a-button @click="handleCancel" >关闭(close)</a-button>
  11. </template>
  12. <div>
  13. <a-card :body-style="{ padding: '10px' }" :bordered="false" style="margin: 10px;">
  14. <a-alert type="info" show-icon class="alert" style="margin-bottom: 8px">
  15. <template #message>
  16. <template v-if="selectedRowKeys.length > 0">
  17. <span>已选中 {{ selectedRowKeys.length }} 条记录</span>
  18. <a-divider type="vertical" />
  19. <a @click="selectedRowKeys = []">清空</a>
  20. </template>
  21. <template v-else>
  22. <span>未选中任何数据</span>
  23. </template>
  24. </template>
  25. </a-alert>
  26. <a-table
  27. :columns="columns"
  28. :row-key="record => record.id"
  29. :data-source="dataSource"
  30. bordered
  31. size="small"
  32. @change="handleTableChange"
  33. :pagination="pagination"
  34. :scroll="{ x: 1300, y: 300 }"
  35. :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
  36. >
  37. <template #bodyCell="{ column, record }">
  38. <template v-if="column.key === 'operation'">
  39. <span>
  40. <a @click="viewDetail(record)">查看(view)</a>
  41. </span>
  42. </template>
  43. </template>
  44. </a-table>
  45. </a-card>
  46. </div>
  47. <SaleOrderFormModal ref="SaleOrderFormModalRef"></SaleOrderFormModal>
  48. </a-modal>
  49. </template>
  50. <script lang="ts" setup>
  51. import {ref } from 'vue';
  52. import { defHttp } from '/@/utils/http/axios';
  53. import { message } from 'ant-design-vue';
  54. import { filterObj } from '/@/utils/common/compUtils';
  55. import SaleOrderFormModal from './SaleOrderFormModal.vue';
  56. const emit = defineEmits([ 'selectProduct']); //定义emit
  57. var visible = ref(false)
  58. var SaleOrderFormModalRef = ref()
  59. const columns = [
  60. {
  61. title: '版本号(version)',
  62. dataIndex: 'version',
  63. key: 'version',
  64. align:"center"
  65. },
  66. {
  67. title: '创建时间(create time)',
  68. dataIndex: 'createTime',
  69. key: 'createTime',
  70. align:"center"
  71. },
  72. {
  73. title: '创建人(create by)',
  74. dataIndex: 'createBy',
  75. key: 'price',
  76. align:"createBy",
  77. width:200
  78. },
  79. {
  80. title: '修改时间(updateTime)',
  81. dataIndex: 'updateTime',
  82. key: 'updateTime',
  83. align:"center"
  84. },
  85. {
  86. title: '修改人(updateBy)',
  87. dataIndex: 'updateBy',
  88. key: 'updateBy',
  89. align:"center"
  90. },
  91. {
  92. title: '操作(operation)',
  93. key: 'operation',
  94. dataIndex: 'operation',
  95. align:"center",
  96. fixed: 'right',
  97. },
  98. ];
  99. const dataSource =ref([]);
  100. let selectedRowKeys = ref([]);
  101. let selectedRows = ref([]);
  102. var Father = ref({})
  103. let pagination = ref({
  104. current: 1,
  105. pageSize: 10,
  106. total: '', // 假设总共有100条数据
  107. showSizeChanger: true,
  108. showQuickJumper: true,
  109. showTotal: (total, range) => {
  110. return range[0] + "-" + range[1] + " 共" + total + "条"
  111. },
  112. size:'small'
  113. });
  114. function loadData(){
  115. let params = getQueryParams();
  116. defHttp
  117. .get({ url: '/saleCode/saleOrderHis/list',params}, { isTransformResponse: false })
  118. .then((res) => {
  119. if (res.success) {
  120. dataSource.value = res.result.records;
  121. pagination.value.total = res.result.total;
  122. pagination.value.current = res.result.current;
  123. pagination.value.pageSize = res.result.size;
  124. } else {
  125. message.error(res.message);
  126. }
  127. })
  128. .finally(() => {
  129. // loading.value = false;
  130. });
  131. }
  132. function getQueryParams(){
  133. let params = {}
  134. params.pageNo = pagination.value.current;
  135. params.hisId = Father.value.id;
  136. params.pageSize = pagination.value.pageSize;
  137. return filterObj(params);
  138. }
  139. function handleTableChange(paginations, filters, sorter){
  140. pagination.value.total = paginations.total;
  141. pagination.value.current = paginations.current;
  142. pagination.value.pageSize = paginations.pageSize;
  143. loadData()
  144. };
  145. function onSelectChange(keys,rows){
  146. selectedRowKeys.value = keys
  147. selectedRows.value = rows
  148. }
  149. function handleCancel(){
  150. visible.value = false
  151. selectedRowKeys.value = []
  152. selectedRows.value=[]
  153. }
  154. function getTable(record){
  155. visible.value = true
  156. Father.value = record
  157. loadData()
  158. }
  159. function viewDetail(record){
  160. SaleOrderFormModalRef.value.getVersionDetail(record)
  161. }
  162. defineExpose({
  163. getTable
  164. });
  165. </script>
  166. <style scoped lang="less">
  167. /deep/.ant-form-item{
  168. margin-bottom: 8px !important;
  169. }
  170. // /deep/.ant-table-wrapper .ant-table-thead > tr > th, .ant-table-wrapper .ant-table-thead > tr > td{
  171. // padding: 8px !important;
  172. // }
  173. </style>