deliveryNoticeList.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. <template>
  2. <div class="p-2">
  3. <!--查询区域-->
  4. <div class="jeecg-basic-table-form-container">
  5. <a-form ref="formRef" @keyup.enter.native="reload" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">
  6. <a-row :gutter="24">
  7. <a-col :lg="8">
  8. <a-form-item name="billCode">
  9. <template #label><span title="通知单号(bill code)">通知单号(bill code)</span></template>
  10. <JInput placeholder="请输入通知单号(bill code)" v-model:value="queryParam.billCode" allow-clear AutoComplete="off" />
  11. </a-form-item>
  12. </a-col>
  13. <a-col :lg="8">
  14. <a-form-item name="bideliveryDatellDate">
  15. <template #label><span title="发货日期(delivery date)">发货日期(delivery date)</span></template>
  16. <a-range-picker value-format="YYYY-MM-DD" v-model:value="queryParam.deliveryDate" class="query-group-cust" />
  17. </a-form-item>
  18. </a-col>
  19. <template v-if="toggleSearchStatus">
  20. <a-col :lg="8">
  21. <a-form-item name="project">
  22. <template #label><span title="项目(project)">项目(project)</span></template>
  23. <ApiSelect
  24. :api="ProjectOption"
  25. showSearch
  26. v-model:value="queryParam.project"
  27. :filterOption="true"
  28. resultField="records"
  29. labelField="code"
  30. valueField="id"
  31. :params="{ pageSize: -1 }"
  32. optionFilterProp="label"
  33. />
  34. </a-form-item>
  35. </a-col>
  36. <a-col :lg="8">
  37. <a-form-item name="customer">
  38. <template #label><span title="客户(customer)">客户(customer)</span></template>
  39. <ApiSelect
  40. :api="CustomerOption"
  41. showSearch
  42. v-model:value="queryParam.customer"
  43. :filterOption="true"
  44. resultField="records"
  45. labelField="abbreviation"
  46. valueField="id"
  47. :params="{ pageSize: -1 }"
  48. optionFilterProp="label"
  49. />
  50. </a-form-item>
  51. </a-col>
  52. <a-col :lg="8">
  53. <a-form-item name="priority">
  54. <template #label><span title="优先级(priority)">优先级(priority)</span></template>
  55. <JDictSelectTag v-model:value="queryParam.priority" placeholder="请选择" dictCode="priority" />
  56. </a-form-item>
  57. </a-col>
  58. <a-col :lg="8">
  59. <a-form-item name="productionClass">
  60. <template #label><span title="产品分类(production class)">产品分类(production class)</span></template>
  61. <ApiSelect
  62. :api="ClassList"
  63. showSearch
  64. v-model:value="queryParam.productionClass"
  65. :filterOption="true"
  66. resultField="records"
  67. labelField="name"
  68. valueField="id"
  69. :params="{ pageSize: -1 }"
  70. optionFilterProp="label"
  71. />
  72. </a-form-item>
  73. </a-col>
  74. <a-col :lg="8">
  75. <a-form-item name="model">
  76. <template #label><span title="机型(model)">机型(model)</span></template>
  77. <JDictSelectTag v-model:value="queryParam.model" placeholder="请选择" dictCode="model_typer" />
  78. </a-form-item>
  79. </a-col>
  80. <a-col :lg="8">
  81. <a-form-item name="maker">
  82. <template #label><span title="厂家(maker)">厂家(maker)</span></template>
  83. <JDictSelectTag v-model:value="queryParam.maker" placeholder="请选择" dictCode="factory" />
  84. </a-form-item>
  85. </a-col>
  86. <a-col :lg="8">
  87. <a-form-item name="saleDepartment">
  88. <template #label><span title="销售部门(sale department)">销售部门(sale department)</span></template>
  89. <JInput placeholder="请输入销售部门(sale department)" v-model:value="queryParam.saleDepartment" allow-clear AutoComplete="off" />
  90. </a-form-item>
  91. </a-col>
  92. <a-col :lg="8">
  93. <a-form-item name="salesman">
  94. <template #label><span title="业务员(salesman)">业务员(salesman)</span></template>
  95. <JInput placeholder="请输入业务员(salesman)" v-model:value="queryParam.salesman" allow-clear AutoComplete="off" />
  96. </a-form-item>
  97. </a-col>
  98. <a-col :lg="8">
  99. <a-form-item name="submit">
  100. <template #label><span title="提交(submit)">提交(submit)</span></template>
  101. <JDictSelectTag v-model:value="queryParam.submit" placeholder="请选择" dictCode="yes_or_no" />
  102. </a-form-item>
  103. </a-col>
  104. <a-col :lg="8">
  105. <a-form-item name="close">
  106. <template #label><span title="关闭(close)">关闭(close)</span></template>
  107. <JDictSelectTag v-model:value="queryParam.close" placeholder="请选择" dictCode="yes_or_no" />
  108. </a-form-item>
  109. </a-col>
  110. </template>
  111. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  112. <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
  113. <a-col :lg="6">
  114. <a-button type="primary" preIcon="ant-design:search-outlined" @click="reload">查询</a-button>
  115. <a-button preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button>
  116. <a @click="toggleSearchStatus = !toggleSearchStatus" style="margin-left: 8px">
  117. {{ toggleSearchStatus ? '收起' : '展开' }}
  118. <Icon :icon="toggleSearchStatus ? 'ant-design:up-outlined' : 'ant-design:down-outlined'" />
  119. </a>
  120. </a-col>
  121. </span>
  122. </a-col>
  123. </a-row>
  124. </a-form>
  125. </div>
  126. <!--引用表格-->
  127. <BasicTable @register="registerTable" :rowSelection="rowSelection" size="small">
  128. <!--插槽:table标题-->
  129. <template #tableTitle>
  130. <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined" v-auth="'saleCode:sale_delivery:add'"> 新增(add)</a-button>
  131. <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls" v-auth="'saleCode:sale_delivery:exportXls'">
  132. 导出(export)</a-button
  133. >
  134. <a-button type="primary" @click="submit"> 提交(submit)</a-button>
  135. <a-button type="primary" @click="cancelSubmit"> 取消提交(cancelSubmit)</a-button>
  136. <a-button type="primary" @click="close"> 关闭(close)</a-button>
  137. <a-dropdown v-if="selectedRowKeys.length > 0">
  138. <template #overlay>
  139. <a-menu>
  140. <a-menu-item key="1" @click="batchHandleDelete" v-auth="'saleCode:sale_delivery:deleteBatch'">
  141. <Icon icon="ant-design:delete-outlined" />
  142. 删除(delete)
  143. </a-menu-item>
  144. </a-menu>
  145. </template>
  146. <a-button
  147. >批量操作
  148. <Icon icon="mdi:chevron-down" />
  149. </a-button>
  150. </a-dropdown>
  151. </template>
  152. <!--操作栏-->
  153. <template #action="{ record }">
  154. <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
  155. </template>
  156. <!--字段回显插槽-->
  157. <template #bodyCell="{ column, record, index, text }"> </template>
  158. <template #viewFile="props">
  159. <a @click="viewFileDetail(props)">查看(view)</a>
  160. </template>
  161. </BasicTable>
  162. <ViewFileListModal ref="ViewFileListModalRef" />
  163. <deliveryNoticeFormModal @register="registerModal" @success="handleSuccess" />
  164. <!-- 表单区域 -->
  165. </div>
  166. </template>
  167. <script lang="ts" name="saleCode-saleInquiryForm" setup>
  168. import { ref, reactive, computed, unref, onMounted } from 'vue';
  169. import { BasicTable, useTable, TableAction } from '/@/components/Table';
  170. import { useListPage } from '/@/hooks/system/useListPage';
  171. import { useModal } from '/@/components/Modal';
  172. import { columns } from './delivertNoticeForm.data';
  173. import {
  174. list,
  175. deleteOne,
  176. batchDelete,
  177. getImportUrl,
  178. getExportUrl,
  179. batchSubmit,
  180. cancelBatchSubmit,
  181. bacthClose,
  182. ProjectOption,
  183. CustomerOption,
  184. ClassList,
  185. getExportXlsBags,
  186. getExportXlsInvoice
  187. } from './delivertNoticeForm.api';
  188. import { JDictSelectTag, ApiSelect, JInput } from '/@/components/Form';
  189. import ViewFileListModal from './components/ViewFileListModal.vue';
  190. import deliveryNoticeFormModal from './components/deliveryNoticeFormModal.vue';
  191. import { message } from 'ant-design-vue';
  192. import { cloneDeep } from 'lodash-es';
  193. const formRef = ref();
  194. const ViewFileListModalRef = ref();
  195. const queryParam = reactive<any>({});
  196. const checkedKeys = ref<Array<string | number>>([]);
  197. //注册model
  198. const [registerModal, { openModal }] = useModal();
  199. //注册table数据
  200. const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
  201. tableProps: {
  202. title: '发货通知单',
  203. api: list,
  204. columns,
  205. canResize: false,
  206. useSearchForm: false,
  207. actionColumn: {
  208. width: 340,
  209. fixed: 'right',
  210. },
  211. scroll: {
  212. x: '3500px',
  213. },
  214. beforeFetch: async (params) => {
  215. let rangerQuery = await setRangeQuery();
  216. return Object.assign(params, rangerQuery);
  217. },
  218. },
  219. exportConfig: {
  220. name: '发货通知单',
  221. url: getExportUrl,
  222. params: queryParam,
  223. },
  224. importConfig: {
  225. url: getImportUrl,
  226. success: handleSuccess,
  227. },
  228. });
  229. const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
  230. /**
  231. * 新增事件
  232. */
  233. function handleAdd() {
  234. openModal(true, {
  235. isUpdate: false,
  236. showFooter: true,
  237. isRevise: false,
  238. });
  239. }
  240. /**
  241. * 编辑事件
  242. */
  243. function handleEdit(record: Recordable) {
  244. openModal(true, {
  245. record,
  246. isUpdate: true,
  247. showFooter: true,
  248. isRevise: false,
  249. });
  250. }
  251. /**
  252. * 详情
  253. */
  254. function handleDetail(record: Recordable) {
  255. openModal(true, {
  256. record,
  257. isUpdate: true,
  258. showFooter: false,
  259. isRevise: false,
  260. });
  261. }
  262. /**
  263. * 删除事件
  264. */
  265. async function handleDelete(record) {
  266. await deleteOne({ id: record.id }, handleSuccess);
  267. }
  268. /**
  269. * 批量删除事件
  270. */
  271. async function batchHandleDelete() {
  272. await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
  273. }
  274. /**
  275. * 成功回调
  276. */
  277. function handleSuccess() {
  278. (selectedRowKeys.value = []) && reload();
  279. }
  280. /**
  281. * 操作栏
  282. */
  283. function getTableAction(record) {
  284. return [
  285. {
  286. label: '编辑(edit)',
  287. onClick: handleEdit.bind(null, record),
  288. ifShow: record.submit == '0',
  289. auth: 'saleCode:sale_delivery:edit',
  290. },
  291. {
  292. label: '详情(detail)',
  293. onClick: handleDetail.bind(null, record),
  294. ifShow: record.submit == '1',
  295. },
  296. ];
  297. }
  298. /**
  299. * 下拉操作栏
  300. */
  301. function getDropDownAction(record) {
  302. return [
  303. {
  304. label: '删除(delete)',
  305. popConfirm: {
  306. title: '是否确认删除',
  307. confirm: handleDelete.bind(null, record),
  308. placement: 'topLeft',
  309. },
  310. auth: 'saleCode:sale_delivery:delete',
  311. ifShow: record.submit == '0',
  312. },
  313. {
  314. label: '导出装箱单(export paking list)',
  315. onClick: handleExportrow.bind(null,record,'paking'),
  316. },
  317. {
  318. label: '导出签单(export markt)',
  319. },
  320. {
  321. label: '导出唛头(export mark) ',
  322. },
  323. {
  324. label: '导出随货发票(export accompanying invoice) ',
  325. onClick: handleExportrow.bind(null,record,'invoice'),
  326. },
  327. ];
  328. }
  329. async function handleExportrow(record,event){
  330. var obj={
  331. id : record.id
  332. }
  333. var rowUrl = event=='paking'?getExportXlsBags:getExportXlsInvoice
  334. const {onExportXls} = useListPage({
  335. tableProps: {
  336. beforeFetch: async (params) => {
  337. let rangerQuery = await setRangeQuery();
  338. return Object.assign(params, rangerQuery);
  339. },
  340. },
  341. exportConfig: {
  342. name: record.billCode,
  343. url: rowUrl,
  344. params: obj,
  345. },
  346. });
  347. await onExportXls();
  348. }
  349. function submit() {
  350. if (selectedRowKeys.value.length == 0) {
  351. message.warning('请选择数据');
  352. } else {
  353. var ids = selectedRowKeys.value.join(',');
  354. batchSubmit({ ids: ids }, handleSuccess);
  355. }
  356. }
  357. function cancelSubmit() {
  358. if (selectedRowKeys.value.length == 0) {
  359. message.warning('请选择数据');
  360. } else {
  361. var ids = selectedRowKeys.value.join(',');
  362. cancelBatchSubmit({ ids: ids }, handleSuccess);
  363. }
  364. }
  365. function viewFileDetail(props) {
  366. ViewFileListModalRef.value.getTable(props.column.dataIndex, props.record);
  367. }
  368. function close() {
  369. if (selectedRowKeys.value.length == 0) {
  370. message.warning('请选择数据');
  371. } else {
  372. var ids = selectedRowKeys.value.join(',');
  373. bacthClose({ ids: ids }, handleSuccess);
  374. }
  375. }
  376. /* ----------------------以下为原生查询需要添加的-------------------------- */
  377. const toggleSearchStatus = ref<boolean>(false);
  378. const labelCol = reactive({
  379. xs: 24,
  380. sm: 8,
  381. });
  382. const wrapperCol = reactive({
  383. xs: 24,
  384. sm: 16,
  385. });
  386. const labelCol1 = reactive({
  387. xs: 24,
  388. sm: 12,
  389. });
  390. const wrapperCol1 = reactive({
  391. xs: 24,
  392. sm: 12,
  393. });
  394. /**
  395. * 重置
  396. */
  397. function searchReset() {
  398. formRef.value.resetFields();
  399. selectedRowKeys.value = [];
  400. //刷新数据
  401. reload();
  402. }
  403. let rangeField = 'deliveryDate,';
  404. /**
  405. * 设置范围查询条件
  406. */
  407. async function setRangeQuery() {
  408. let queryParamClone = cloneDeep(queryParam);
  409. if (rangeField) {
  410. let fieldsValue = rangeField.split(',');
  411. fieldsValue.forEach((item) => {
  412. if (queryParamClone[item]) {
  413. let range = queryParamClone[item];
  414. queryParamClone[item + '_begin'] = range[0];
  415. queryParamClone[item + '_end'] = range[1];
  416. delete queryParamClone[item];
  417. } else {
  418. queryParamClone[item + '_begin'] = '';
  419. queryParamClone[item + '_end'] = '';
  420. }
  421. });
  422. }
  423. return queryParamClone;
  424. }
  425. </script>
  426. <style lang="less" scoped>
  427. .jeecg-basic-table-form-container {
  428. padding: 0;
  429. .table-page-search-submitButtons {
  430. display: block;
  431. margin-bottom: 8px;
  432. white-space: nowrap;
  433. }
  434. .query-group-cust {
  435. min-width: 100px !important;
  436. }
  437. .query-group-split-cust {
  438. width: 30px;
  439. display: inline-block;
  440. text-align: center;
  441. }
  442. .ant-form-item:not(.ant-form-item-with-help) {
  443. margin-bottom: 8px;
  444. height: 32px;
  445. }
  446. :deep(.ant-picker),
  447. :deep(.ant-input-number) {
  448. width: 100%;
  449. }
  450. }
  451. </style>