salesOutboundList.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  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="billDate">
  9. <template #label><span title="出库日期(bill date)">出库日期(bill date)</span></template>
  10. <a-range-picker value-format="YYYY-MM-DD" v-model:value="queryParam.billDate" class="query-group-cust" />
  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 }"
  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="billCode">
  32. <template #label><span title="出库单号(bill code)">出库单号(bill code)</span></template>
  33. <JInput placeholder="请输入出库单号(bill code)" v-model:value="queryParam.billCode" allow-clear AutoComplete="off" />
  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"></JSelect>
  40. </a-form-item>
  41. </a-col>
  42. <a-col :lg="8">
  43. <a-form-item name="productionClass">
  44. <template #label><span title="产品分类(production class)">产品分类(production class)</span></template>
  45. <ApiSelect
  46. :api="ClassList"
  47. showSearch
  48. v-model:value="queryParam.productionClass"
  49. :filterOption="true"
  50. resultField="records"
  51. labelField="name"
  52. valueField="id"
  53. :params="{ pageSize: -1 }"
  54. optionFilterProp="label"
  55. />
  56. </a-form-item>
  57. </a-col>
  58. <a-col :lg="8">
  59. <a-form-item name="model">
  60. <template #label><span title="机型(model)">机型(model)</span></template>
  61. <JDictSelectTag v-model:value="queryParam.model" placeholder="请选择" dictCode="model_typer" style="width: 100%" />
  62. </a-form-item>
  63. </a-col>
  64. <a-col :lg="8">
  65. <a-form-item name="maker">
  66. <template #label><span title="厂家(maker)">厂家(maker)</span></template>
  67. <JDictSelectTag v-model:value="queryParam.maker" placeholder="请选择" dictCode="factory" />
  68. </a-form-item>
  69. </a-col>
  70. <a-col :lg="8">
  71. <a-form-item name="productCode">
  72. <template #label><span title="产品编码(product code)">产品编码(product code)</span></template>
  73. <JInput placeholder="请输入产品编码(product code)" v-model:value="queryParam.productCode" allow-clear AutoComplete="off" />
  74. </a-form-item>
  75. </a-col>
  76. <a-col :lg="8">
  77. <a-form-item name="sourceCode">
  78. <template #label><span title="来源(sourceCode)">来源(sourceCode)</span></template>
  79. <JInput placeholder="来源(sourceCode)" v-model:value="queryParam.sourceCode" allow-clear AutoComplete="off" />
  80. </a-form-item>
  81. </a-col>
  82. <a-col :lg="8">
  83. <a-form-item name="warehouse">
  84. <template #label><span title="仓库(warehouse)">仓库(warehouse)</span></template>
  85. <JDictSelectTag v-model:value="queryParam.warehouse" placeholder="请选择" dictCode="warehouse" />
  86. </a-form-item>
  87. </a-col>
  88. <a-col :lg="8">
  89. <a-form-item name="goodsAllocation">
  90. <template #label><span title="货位(goods allocation)">货位(goods allocation)</span></template>
  91. <JDictSelectTag v-model:value="queryParam.goodsAllocation" placeholder="请选择" dictCode="goods_allocation" />
  92. </a-form-item>
  93. </a-col>
  94. <a-col :lg="8">
  95. <a-form-item name="applyInvoice">
  96. <template #label><span title="开票申请(apply invoice)">开票申请(apply invoice)</span></template>
  97. <JDictSelectTag v-model:value="queryParam.applyInvoice" placeholder="请选择" dictCode="yes_or_no" style="width: 100%" />
  98. </a-form-item>
  99. </a-col>
  100. <a-col :lg="8">
  101. <a-form-item name="submit">
  102. <template #label><span title="提交(submit)">提交(submit)</span></template>
  103. <JDictSelectTag v-model:value="queryParam.submit" placeholder="请选择" dictCode="yes_or_no" style="width: 100%" />
  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" v-auth="'storeCode:store_sale_out:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增(add)</a-button>
  127. <a-button type="primary" v-auth="'storeCode:store_sale_out:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls">
  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" @click="setIsExport"> 设置其他状态(set isExport)</a-button>
  133. <!-- <a-button type="primary" @click="allowInvoice"> 开票申请(apply invoice)</a-button> -->
  134. <a-dropdown v-if="selectedRowKeys.length > 0">
  135. <template #overlay>
  136. <a-menu>
  137. <a-menu-item key="1" @click="batchHandleDelete" v-auth="'storeCode:store_sale_out:deleteBatch'">
  138. <Icon icon="ant-design:delete-outlined" />
  139. 删除(delete)
  140. </a-menu-item>
  141. </a-menu>
  142. </template>
  143. <a-button v-auth="'storeCode:store_sale_out:deleteBatch'"
  144. >批量操作
  145. <Icon icon="mdi:chevron-down" />
  146. </a-button>
  147. </a-dropdown>
  148. </template>
  149. <!--操作栏-->
  150. <template #action="{ record }">
  151. <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
  152. </template>
  153. <!--字段回显插槽-->
  154. <template #bodyCell="{ column, record, index, text }"> </template>
  155. <template #signing="props">
  156. <a @click="viewFile(props)" v-if="!props.record.signing">上传</a>
  157. <a @click="viewFile(props)" v-if="props.record.signing">查看</a>
  158. </template>
  159. </BasicTable>
  160. <!-- 表单区域 -->
  161. <salesOutFormModal @register="registerModal" @success="handleSuccess" />
  162. <SetIsExport ref="setIsExportRef" @success="handleSuccess" />
  163. <ViewFileListModal ref="ViewFileListModalRef" @success="handleSuccess"></ViewFileListModal>
  164. </div>
  165. </template>
  166. <script lang="ts" name="saleCode-saleInquiryForm" setup>
  167. import { ref, reactive, computed, unref, onMounted } from 'vue';
  168. import { BasicTable, useTable, TableAction } from '/@/components/Table';
  169. import { useListPage } from '/@/hooks/system/useListPage';
  170. import { useModal } from '/@/components/Modal';
  171. import salesOutFormModal from './components/salesOutFormModal.vue';
  172. import SetIsExport from './components/SetIsExport.vue';
  173. import ViewFileListModal from './components/ViewFileListModal.vue';
  174. import { columns } from './salesOutboundForm.data';
  175. import {
  176. list,
  177. deleteOne,
  178. batchDelete,
  179. getImportUrl,
  180. getExportUrl,
  181. batchSubmit,
  182. cancelBatchSubmit,
  183. applyInvoice,
  184. ProjectOption,
  185. CustomerOption,
  186. ClassList,
  187. } from './salesOutboundForm.api';
  188. import { cloneDeep } from 'lodash-es';
  189. import { JDictSelectTag, ApiSelect, JInput,JSelect } from '/@/components/Form';
  190. import { message } from 'ant-design-vue';
  191. var ViewFileListModalRef =ref<any>()
  192. var showField = ref('currency_dictText+name');
  193. const formRef = ref();
  194. const queryParam = reactive<any>({});
  195. //注册model
  196. const [registerModal, { openModal }] = useModal();
  197. const setIsExportRef = ref();
  198. //注册table数据
  199. const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
  200. tableProps: {
  201. title: '销售出库',
  202. api: list,
  203. columns,
  204. canResize: false,
  205. useSearchForm: false,
  206. actionColumn: {
  207. width: 200,
  208. fixed: 'right',
  209. },
  210. scroll: {
  211. x: '2500px',
  212. y:'calc(100vh - 400px)',
  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. });
  238. }
  239. /**
  240. * 编辑事件
  241. */
  242. function handleEdit(record: Recordable) {
  243. openModal(true, {
  244. record,
  245. isUpdate: true,
  246. showFooter: true,
  247. });
  248. }
  249. /**
  250. * 详情
  251. */
  252. function handleDetail(record: Recordable) {
  253. openModal(true, {
  254. record,
  255. isUpdate: true,
  256. showFooter: false,
  257. });
  258. }
  259. /**
  260. * 删除事件
  261. */
  262. async function handleDelete(record) {
  263. await deleteOne({ id: record.id }, handleSuccess);
  264. }
  265. /**
  266. * 批量删除事件
  267. */
  268. async function batchHandleDelete() {
  269. await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
  270. }
  271. /**
  272. * 成功回调
  273. */
  274. function handleSuccess() {
  275. (selectedRowKeys.value = []) && reload();
  276. }
  277. /**
  278. * 操作栏
  279. */
  280. function getTableAction(record) {
  281. return [
  282. {
  283. label: '编辑(edit)',
  284. onClick: handleEdit.bind(null, record),
  285. auth: 'storeCode:store_sale_out:edit',
  286. ifShow: record.submit == '0' || !record.submit,
  287. },
  288. {
  289. label: '详情(detail)',
  290. onClick: handleDetail.bind(null, record),
  291. ifShow: record.submit == '1',
  292. },
  293. ];
  294. }
  295. /**
  296. * 下拉操作栏
  297. */
  298. function getDropDownAction(record) {
  299. return [
  300. {
  301. label: '详情(detail)',
  302. onClick: handleDetail.bind(null, record),
  303. ifShow: record.submit == '0' || !record.submit,
  304. },
  305. {
  306. label: '删除(delete)',
  307. popConfirm: {
  308. title: '是否确认删除',
  309. confirm: handleDelete.bind(null, record),
  310. placement: 'topLeft',
  311. },
  312. auth: 'storeCode:store_sale_out:delete',
  313. ifShow: record.submit == '0' || !record.submit,
  314. },
  315. ];
  316. }
  317. function submit() {
  318. if (selectedRowKeys.value.length == 0) {
  319. message.warning('请选择数据');
  320. } else {
  321. var ids = selectedRowKeys.value.join(',');
  322. batchSubmit({ ids: ids }, handleSuccess);
  323. }
  324. }
  325. function cancelSubmit() {
  326. if (selectedRowKeys.value.length == 0) {
  327. message.warning('请选择数据');
  328. } else {
  329. var ids = selectedRowKeys.value.join(',');
  330. cancelBatchSubmit({ ids: ids }, handleSuccess);
  331. }
  332. }
  333. function allowInvoice() {
  334. if (selectedRowKeys.value.length == 0) {
  335. message.warning('请选择数据');
  336. } else {
  337. var ids = selectedRowKeys.value.join(',');
  338. applyInvoice({ ids: ids }, handleSuccess);
  339. }
  340. }
  341. function setIsExport() {
  342. if (selectedRowKeys.value.length == 0) {
  343. message.warning('请选择数据');
  344. } else {
  345. var ids = selectedRowKeys.value.join(',');
  346. setIsExportRef.value.getTable(ids);
  347. }
  348. }
  349. function viewFile(prop){
  350. ViewFileListModalRef.value.getTable(prop.record);
  351. }
  352. /* ----------------------以下为原生查询需要添加的-------------------------- */
  353. const toggleSearchStatus = ref<boolean>(false);
  354. const labelCol = reactive({
  355. xs: 24,
  356. sm: 8,
  357. });
  358. const wrapperCol = reactive({
  359. xs: 24,
  360. sm: 16,
  361. });
  362. const labelCol1 = reactive({
  363. xs: 24,
  364. sm: 12,
  365. });
  366. const wrapperCol1 = reactive({
  367. xs: 24,
  368. sm: 12,
  369. });
  370. /**
  371. * 重置
  372. */
  373. function searchReset() {
  374. formRef.value.resetFields();
  375. selectedRowKeys.value = [];
  376. //刷新数据
  377. reload();
  378. }
  379. let rangeField = 'billDate,';
  380. /**
  381. * 设置范围查询条件
  382. */
  383. async function setRangeQuery() {
  384. let queryParamClone = cloneDeep(queryParam);
  385. if (rangeField) {
  386. let fieldsValue = rangeField.split(',');
  387. fieldsValue.forEach((item) => {
  388. if (queryParamClone[item]) {
  389. let range = queryParamClone[item];
  390. queryParamClone[item + '_begin'] = range[0];
  391. queryParamClone[item + '_end'] = range[1];
  392. delete queryParamClone[item];
  393. } else {
  394. queryParamClone[item + '_begin'] = '';
  395. queryParamClone[item + '_end'] = '';
  396. }
  397. });
  398. }
  399. return queryParamClone;
  400. }
  401. </script>
  402. <style lang="less" scoped>
  403. .jeecg-basic-table-form-container {
  404. padding: 0;
  405. .table-page-search-submitButtons {
  406. display: block;
  407. margin-bottom: 8px;
  408. white-space: nowrap;
  409. }
  410. .query-group-cust {
  411. min-width: 100px !important;
  412. }
  413. .query-group-split-cust {
  414. width: 30px;
  415. display: inline-block;
  416. text-align: center;
  417. }
  418. .ant-form-item:not(.ant-form-item-with-help) {
  419. margin-bottom: 8px;
  420. height: 32px;
  421. }
  422. :deep(.ant-picker),
  423. :deep(.ant-input-number) {
  424. width: 100%;
  425. }
  426. }
  427. </style>