SelectInvoiceModal.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <template>
  2. <a-modal
  3. title="选择发票(Select invoce)"
  4. width="95%"
  5. :visible="visible"
  6. :maskClosable="false"
  7. switchFullscreen
  8. @ok = "handleOk"
  9. @cancel="handleCancel">
  10. <div>
  11. <a-card :body-style="{ padding: '10px' }" :bordered="false" style="margin: 10px;">
  12. <div class="table-page-search-wrapper">
  13. <a-form :model="queryParams" :label-col="labelCol" :wrapper-col="wrapperCol" @keyup.enter.native="searchQuery">
  14. <a-row :gutter="24">
  15. <a-col :md="6" :sm="8">
  16. <a-form-item label="发票编号(bill code)">
  17. <a-input placeholder="请输入" v-model:value="queryParams.billCode"></a-input>
  18. </a-form-item>
  19. </a-col>
  20. <a-col :md="6" :sm="8">
  21. <a-form-item label="发票日期(bill date)">
  22. <a-range-picker value-format="YYYY-MM-DD" v-model:value="billDate" @change="changeBillDate" class="query-group-cust"/>
  23. </a-form-item>
  24. </a-col>
  25. <template v-if="toggleSearchStatus">
  26. <a-col :md="6" :sm="8">
  27. <a-form-item label="项目(project)">
  28. <ApiSelect
  29. :api="projectListList"
  30. showSearch
  31. v-model:value="queryParams.project"
  32. optionFilterProp="label"
  33. resultField="records"
  34. labelField="name"
  35. valueField="id"
  36. />
  37. </a-form-item>
  38. </a-col>
  39. <a-col :md="6" :sm="8">
  40. <a-form-item label="购方(buyer)" >
  41. <ApiSelect
  42. :api="buyerListList"
  43. showSearch
  44. v-model:value="queryParams.buyer"
  45. optionFilterProp="label"
  46. resultField="records"
  47. labelField="name"
  48. valueField="id"
  49. />
  50. </a-form-item>
  51. </a-col>
  52. </template>
  53. <a-col :md="6" :sm="8">
  54. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  55. <a-button type="primary" @click="searchQuery" >查询(search)</a-button>
  56. <a-button type="primary" @click="searchReset" style="margin-left: 8px">重置(reset)</a-button>
  57. <a @click="handleToggleSearch" style="margin-left: 8px">
  58. {{ toggleSearchStatus ? '收起' : '展开' }}
  59. <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
  60. </a>
  61. </span>
  62. </a-col>
  63. </a-row>
  64. </a-form>
  65. </div>
  66. </a-card>
  67. <a-card :body-style="{ padding: '10px' }" :bordered="false" style="margin: 10px;">
  68. <a-alert type="info" show-icon class="alert" style="margin-bottom: 8px">
  69. <template #message>
  70. <template v-if="selectedRowKeys.length > 0">
  71. <span>已选中 {{ selectedRowKeys.length }} 条记录</span>
  72. <a-divider type="vertical" />
  73. <a @click="selectedRowKeys = []">清空</a>
  74. </template>
  75. <template v-else>
  76. <span>未选中任何数据</span>
  77. </template>
  78. </template>
  79. </a-alert>
  80. <a-table
  81. :columns="columns"
  82. :row-key="record => record.childId"
  83. :data-source="dataSource"
  84. bordered
  85. size="small"
  86. @change="handleTableChange"
  87. :pagination="pagination"
  88. :scroll="{ x: 1800, y: 300 }"
  89. :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
  90. >
  91. </a-table>
  92. </a-card>
  93. </div>
  94. </a-modal>
  95. </template>
  96. <script lang="ts" setup>
  97. import {ref } from 'vue';
  98. import { defHttp} from '/@/utils/http/axios';
  99. import { message } from 'ant-design-vue';
  100. import { filterObj, } from '/@/utils/common/compUtils';
  101. import { ApiSelect, } from '/@/components/Form/index';
  102. const emit = defineEmits([ 'selectInvoice']); //定义emit
  103. var visible = ref(false)
  104. const columns = [
  105. {
  106. title: '发票编号(bill code)',
  107. dataIndex: 'billCode',
  108. key: 'billCode',
  109. align:"center",
  110. width:250,
  111. },
  112. {
  113. title: '发票日期(bill date)',
  114. dataIndex: 'billDate',
  115. key: 'billDate',
  116. align:"center"
  117. },
  118. {
  119. title: '项目(project)',
  120. dataIndex: 'projectName',
  121. key: 'projectName',
  122. align:"center",
  123. width:250,
  124. ellipsis: true,
  125. },
  126. {
  127. title: '购方(buyer)',
  128. dataIndex: 'buyer',
  129. key: 'buyer',
  130. align:"center",
  131. ellipsis: true,
  132. },
  133. {
  134. title: '购方税号(buyer tax number)',
  135. dataIndex: 'priority_dictText',
  136. key: 'priority_dictText',
  137. align:"center",
  138. width:250,
  139. },
  140. {
  141. title: '价税合计(tax money)',
  142. dataIndex: 'taxMoney',
  143. key: 'taxMoney',
  144. align:"center",
  145. },
  146. ];
  147. const labelCol = ref({
  148. xs: { span: 24 },
  149. sm: { span: 9 },
  150. });
  151. const wrapperCol = ref({
  152. xs: { span: 24 },
  153. sm: { span: 15 },
  154. });
  155. const labelCol1 = ref({
  156. xs: { span: 24 },
  157. sm: { span: 12 },
  158. });
  159. const wrapperCol1 = ref({
  160. xs: { span: 24 },
  161. sm: { span: 12 },
  162. });
  163. const dataSource =ref([]);
  164. let selectedRowKeys = ref([]);
  165. let selectedRows = ref([]);
  166. const toggleSearchStatus = ref(false);
  167. var billDate = ref([])
  168. const queryParams = ref({
  169. billCode:'',
  170. project:'',
  171. projectName:'',
  172. buyer:'',
  173. billDate_begin :'',
  174. billDate_end :''
  175. });
  176. let pagination = ref({
  177. current: 1,
  178. pageSize: 10,
  179. total: '', // 假设总共有100条数据
  180. showSizeChanger: true,
  181. showQuickJumper: true,
  182. showTotal: (total, range) => {
  183. return range[0] + "-" + range[1] + " 共" + total + "条"
  184. },
  185. size:'small'
  186. });
  187. function loadData(){
  188. // let params = getQueryParams();
  189. // defHttp.get({ url: '/saleCode/saleOrder/selectSaleOrderDetailAlert',params}, { isTransformResponse: false })
  190. // .then((res) => {
  191. // if (res.success) {
  192. // dataSource.value = res.result.records;
  193. // pagination.value.total = res.result.total;
  194. // pagination.value.current = res.result.current;
  195. // pagination.value.pageSize = res.result.size;
  196. // } else {
  197. // message.error(res.message);
  198. // }
  199. // })
  200. // .finally(() => {
  201. // // loading.value = false;
  202. // });
  203. }
  204. function getQueryParams(){
  205. let params = Object.assign(queryParams.value);
  206. params.pageNo = pagination.value.current;
  207. params.pageSize = pagination.value.pageSize;
  208. return filterObj(params);
  209. }
  210. function handleTableChange(paginations, filters, sorter){
  211. pagination.value.total = paginations.total;
  212. pagination.value.current = paginations.current;
  213. pagination.value.pageSize = paginations.pageSize;
  214. loadData()
  215. };
  216. function searchQuery(){
  217. loadData();
  218. }
  219. function searchReset(){
  220. billDate.value = []
  221. queryParams.value = {
  222. billCode:'',
  223. project:'',
  224. projectName:'',
  225. buyer:'',
  226. billDate_begin :'',
  227. billDate_end :''
  228. }
  229. pagination.value.current =1;
  230. pagination.value.pageSize = 10;
  231. loadData();
  232. }
  233. function handleToggleSearch(){
  234. toggleSearchStatus.value = !toggleSearchStatus.value;
  235. }
  236. function onSelectChange(keys,rows){
  237. selectedRowKeys.value = keys
  238. selectedRows.value = rows
  239. }
  240. function handleOk(){
  241. emit('selectInvoice', selectedRows.value)
  242. handleCancel()
  243. }
  244. function handleCancel(){
  245. visible.value = false
  246. selectedRowKeys.value = []
  247. selectedRows.value=[]
  248. billDate.value = []
  249. queryParams.value = {
  250. billCode:'',
  251. project:'',
  252. projectName:'',
  253. buyer:'',
  254. billDate_begin :'',
  255. billDate_end :''
  256. }
  257. }
  258. function getTable(){
  259. visible.value = true
  260. loadData()
  261. }
  262. function changeBillDate(prop){
  263. if(prop){
  264. billDate.value = prop
  265. queryParams.value.billDate_begin = prop[0]
  266. queryParams.value.billDate_end = prop[1]
  267. }else{
  268. billDate.value = []
  269. queryParams.value.billDate_begin = ''
  270. queryParams.value.billDate_end = ''
  271. }
  272. }
  273. function projectListList(){
  274. let params = {pageSize:-1}
  275. return defHttp.get({url:'/baseCode/baseProjectArchive/list',params});
  276. }
  277. function buyerListList(){
  278. let params = {pageSize:-1}
  279. return defHttp.get({url:'/cuspCode/cuspCustomerProfile/list',params});
  280. }
  281. defineExpose({
  282. getTable,
  283. });
  284. </script>
  285. <style scoped lang="less">
  286. /deep/.ant-form-item{
  287. margin-bottom: 8px !important;
  288. }
  289. // /deep/.ant-table-wrapper .ant-table-thead > tr > th, .ant-table-wrapper .ant-table-thead > tr > td{
  290. // padding: 8px !important;
  291. // }
  292. </style>