SelectDeliveryNoticeModal.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  1. <template>
  2. <a-modal
  3. title="选择发货通知单(Select delivery notice)"
  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="{ style: 'width: 200px' }" @keyup.enter.native="searchQuery">
  14. <a-row :gutter="24">
  15. <a-col :md="6" :sm="8">
  16. <a-form-item label="通知单号(bill code)">
  17. <j-input placeholder="请输入" v-model:value="queryParams.billCode"></j-input>
  18. </a-form-item>
  19. </a-col>
  20. <a-col :md="6" :sm="8">
  21. <a-form-item label="发货日期(delivery date)" >
  22. <a-range-picker value-format="YYYY-MM-DD" v-model:value="deliveryDate" @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="ProjectOption"
  30. showSearch
  31. v-model:value="queryParams.project"
  32. optionFilterProp="label"
  33. resultField="records"
  34. labelField="code"
  35. valueField="id"
  36. :params='{pageSize:-1,status:1}'
  37. />
  38. </a-form-item>
  39. </a-col>
  40. <a-col :md="6" :sm="8">
  41. <a-form-item label="优先级(priority)" >
  42. <JDictSelectTag v-model:value="queryParams.priority" placeholder="请选择" dictCode="priority"/>
  43. </a-form-item>
  44. </a-col>
  45. <a-col :md="12" :sm="16">
  46. <a-form-item label="客户(customer)">
  47. <JSelect v-model:value="queryParams.customer" :get-option-url="CustomerOption" :showField="showField" :param="{status:1}"></JSelect>
  48. </a-form-item>
  49. </a-col>
  50. <a-col :md="6" :sm="8">
  51. <a-form-item label="产品分类(production class)" >
  52. <ApiSelect
  53. :api="ClassList"
  54. showSearch
  55. v-model:value="queryParams.productionClass"
  56. optionFilterProp="label"
  57. resultField="records"
  58. labelField="name"
  59. valueField="id"
  60. />
  61. </a-form-item>
  62. </a-col>
  63. <a-col :md="6" :sm="8">
  64. <a-form-item label="机型(model)">
  65. <JDictSelectTag v-model:value="queryParams.headModel" placeholder="请选择" dictCode="model_typer"/>
  66. </a-form-item>
  67. </a-col>
  68. <a-col :md="6" :sm="8">
  69. <a-form-item label="厂家(maker)" >
  70. <j-input placeholder="请输入" v-model:value="queryParams.maker"></j-input>
  71. </a-form-item>
  72. </a-col>
  73. <a-col :md="6" :sm="8">
  74. <a-form-item label="业务员(salesman)">
  75. <j-input placeholder="请输入" v-model:value="queryParams.salesman"></j-input>
  76. </a-form-item>
  77. </a-col>
  78. <a-col :md="6" :sm="8">
  79. <a-form-item label="销售部门(sale department)" >
  80. <j-input placeholder="请输入" v-model:value="queryParams.saleDepartmentName"></j-input>
  81. </a-form-item>
  82. </a-col>
  83. </template>
  84. <a-col :md="6" :sm="8">
  85. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  86. <a-button type="primary" @click="searchQuery" >查询(search)</a-button>
  87. <a-button type="primary" @click="searchReset" style="margin-left: 8px">重置(reset)</a-button>
  88. <a @click="handleToggleSearch" style="margin-left: 8px">
  89. {{ toggleSearchStatus ? '收起' : '展开' }}
  90. <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
  91. </a>
  92. </span>
  93. </a-col>
  94. </a-row>
  95. </a-form>
  96. </div>
  97. </a-card>
  98. <a-card :body-style="{ padding: '10px' }" :bordered="false" style="margin: 10px;">
  99. <a-alert type="info" show-icon class="alert" style="margin-bottom: 8px">
  100. <template #message>
  101. <template v-if="selectedRowKeys.length > 0">
  102. <span>已选中 {{ selectedRowKeys.length }} 条记录</span>
  103. <a-divider type="vertical" />
  104. <a @click="selectedRowKeys = []">清空</a>
  105. </template>
  106. <template v-else>
  107. <span>未选中任何数据</span>
  108. </template>
  109. </template>
  110. </a-alert>
  111. <a-table
  112. :columns="columns"
  113. :row-key="record => record.id"
  114. :data-source="dataSource"
  115. bordered
  116. size="small"
  117. @change="handleTableChange"
  118. :pagination="pagination"
  119. :scroll="{ x: 2500, y: 400 }"
  120. :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
  121. >
  122. </a-table>
  123. </a-card>
  124. </div>
  125. </a-modal>
  126. </template>
  127. <script lang="ts" setup>
  128. import {ref, reactive } from 'vue';
  129. import { defHttp} from '/@/utils/http/axios';
  130. import { message } from 'ant-design-vue';
  131. import { filterObj, getFileAccessHttpUrl } from '/@/utils/common/compUtils';
  132. import { JDictSelectTag,JInput,JSelect} from '/@/components/Form';
  133. import { ApiSelect, } from '/@/components/Form/index';
  134. import {ProjectOption,CustomerOption,ClassList} from '../salesInvoiceForm.api';
  135. const emit = defineEmits([ 'addDelivery']); //定义emit
  136. var showField = ref('currency_dictText+name');
  137. var visible = ref(false)
  138. const columns = [
  139. {
  140. type: 'selection',
  141. fixed: 'left',
  142. width:0
  143. },
  144. {
  145. title: '通知单号(bill code)',
  146. dataIndex: 'billCode',
  147. key: 'billCode',
  148. align:"center",
  149. width:250,
  150. ellipsis: true,
  151. },
  152. {
  153. title: '发货日期(delivery date)',
  154. dataIndex: 'deliveryDate',
  155. key: 'deliveryDate',
  156. align:"center",
  157. ellipsis: true,
  158. },
  159. {
  160. title: '项目(project)',
  161. dataIndex: 'projectName',
  162. key: 'projectName',
  163. align:"center",
  164. width:250,
  165. ellipsis: true,
  166. },
  167. {
  168. title: '客户(customer)',
  169. dataIndex: 'customerName',
  170. key: 'customerName',
  171. align:"center",
  172. ellipsis: true,
  173. },
  174. {
  175. title: '优先级(priority)',
  176. dataIndex: 'priority_dictText',
  177. key: 'priority_dictText',
  178. align:"center"
  179. },
  180. {
  181. title: '产品分类(production class)',
  182. dataIndex: 'productionClass_dictText',
  183. key: 'productionClass_dictText',
  184. align:"center",
  185. width:250,
  186. ellipsis: true,
  187. },
  188. {
  189. title: '机型(model)',
  190. dataIndex: 'model',
  191. key: 'model',
  192. align:"center"
  193. },
  194. {
  195. title: '销售部门(sale department)',
  196. dataIndex: 'saleDepartmentName',
  197. key: 'saleDepartmentName',
  198. align:"center",
  199. width:250,
  200. ellipsis: true,
  201. },
  202. {
  203. title: '业务员(salesman)',
  204. dataIndex: 'salesmanName',
  205. key: 'salesmanName',
  206. align:"center"
  207. },
  208. ];
  209. const labelCol = ref({
  210. xs: { span: 24 },
  211. sm: { span: 9 },
  212. });
  213. const wrapperCol = ref({
  214. xs: { span: 24 },
  215. sm: { span: 15 },
  216. });
  217. const labelCol1 = ref({
  218. xs: { span: 24 },
  219. sm: { span: 12 },
  220. });
  221. const wrapperCol1 = ref({
  222. xs: { span: 24 },
  223. sm: { span: 12 },
  224. });
  225. const dataSource =ref([]);
  226. let selectedRowKeys = ref([]);
  227. let selectedRows = ref([]);
  228. const toggleSearchStatus = ref(false);
  229. var deliveryDate = ref([])
  230. const queryParams = ref({
  231. billCode:'',
  232. project:'',
  233. projectName:'',
  234. productionClass:'',
  235. priority:'',
  236. customerName:'',
  237. customer:'',
  238. headModel:'',
  239. maker:'',
  240. deliveryDate_begin:'',
  241. deliveryDate_end:'',
  242. saleDepartment:'',
  243. salesman:'',
  244. });
  245. let pagination = ref({
  246. current: 1,
  247. pageSize: 100,
  248. total: '', // 假设总共有100条数据
  249. showSizeChanger: true,
  250. showQuickJumper: true,
  251. showTotal: (total, range) => {
  252. return range[0] + "-" + range[1] + " 共" + total + "条"
  253. },
  254. size:'small'
  255. });
  256. function loadData(data){
  257. let params = getQueryParams();
  258. if(data){
  259. queryParams.value.project = data;
  260. }
  261. defHttp.get({ url: '/saleCode/saleDelivery/queryPageListInvoice',params}, { isTransformResponse: false })
  262. .then((res) => {
  263. if (res.success) {
  264. dataSource.value = res.result.records;
  265. pagination.value.total = res.result.total;
  266. pagination.value.current = res.result.current;
  267. pagination.value.pageSize = res.result.size;
  268. } else {
  269. message.error(res.message);
  270. }
  271. })
  272. .finally(() => {
  273. // loading.value = false;
  274. });
  275. }
  276. function getQueryParams(){
  277. let params = Object.assign(queryParams.value);
  278. params.pageNo = pagination.value.current;
  279. params.pageSize = pagination.value.pageSize;
  280. return filterObj(params);
  281. }
  282. function handleTableChange(paginations, filters, sorter){
  283. pagination.value.total = paginations.total;
  284. pagination.value.current = paginations.current;
  285. pagination.value.pageSize = paginations.pageSize;
  286. loadData()
  287. };
  288. function searchQuery(){
  289. pagination.value.current =1;
  290. loadData();
  291. }
  292. function searchReset(){
  293. deliveryDate.value = []
  294. queryParams.value = {
  295. billCode:'',
  296. project:'',
  297. projectName:'',
  298. productionClass:'',
  299. priority:'',
  300. customerName:'',
  301. customer:'',
  302. headModel:'',
  303. maker:'',
  304. deliveryDate_begin:'',
  305. deliveryDate_end:'',
  306. saleDepartment:'',
  307. salesman:'',
  308. }
  309. pagination.value.current =1;
  310. pagination.value.pageSize = 100;
  311. loadData();
  312. }
  313. function handleToggleSearch(){
  314. toggleSearchStatus.value = !toggleSearchStatus.value;
  315. }
  316. function onSelectChange(keys,rows){
  317. selectedRowKeys.value = keys
  318. selectedRows.value = rows
  319. }
  320. function handleOk(){
  321. if(selectedRowKeys.value.length!==1){
  322. message.error('请勾选一条数据');
  323. }else{
  324. emit('addDelivery', selectedRows.value)
  325. handleCancel()
  326. }
  327. }
  328. function handleCancel(){
  329. visible.value = false
  330. selectedRowKeys.value = []
  331. selectedRows.value=[]
  332. deliveryDate.value = []
  333. queryParams.value = {
  334. billCode:'',
  335. project:'',
  336. projectName:'',
  337. productionClass:'',
  338. priority:'',
  339. customerName:'',
  340. customer:'',
  341. headModel:'',
  342. maker:'',
  343. deliveryDate_begin:'',
  344. deliveryDate_end:'',
  345. saleDepartment:'',
  346. salesman:'',
  347. }
  348. pagination.value.current =1;
  349. pagination.value.pageSize = 100;
  350. }
  351. function getTable(formData){
  352. visible.value = true
  353. loadData(formData.project)
  354. }
  355. function changeBillDate(prop){
  356. if(prop){
  357. deliveryDate.value = prop
  358. queryParams.value.deliveryDate_begin = prop[0]
  359. queryParams.value.deliveryDate_end = prop[1]
  360. }else{
  361. deliveryDate.value = []
  362. queryParams.value.deliveryDate_begin = ''
  363. queryParams.value.deliveryDate_end = ''
  364. }
  365. }
  366. defineExpose({
  367. getTable
  368. });
  369. </script>
  370. <style scoped lang="less">
  371. /deep/.ant-form-item{
  372. margin-bottom: 8px !important;
  373. }
  374. // /deep/.ant-table-wrapper .ant-table-thead > tr > th, .ant-table-wrapper .ant-table-thead > tr > td{
  375. // padding: 8px !important;
  376. // }
  377. </style>