deliveryNoticeList.vue 15 KB

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