deliveryNoticeList.vue 16 KB

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