othernList.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  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="supplier">
  38. <template #label><span title="供应商(supplier)">供应商(supplier)</span></template>
  39. <JSelect v-model:value="queryParam.supplier" :get-option-url="supplierOption" :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="产品编号(productCode)">产品编号(productCode)</span></template>
  73. <JInput placeholder="请输入产品编号(productCode)" 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="warehouse">
  78. <template #label><span title="仓库(warehouse)">仓库(warehouse)</span></template>
  79. <JDictSelectTag v-model:value="queryParam.warehouse" placeholder="请选择" dictCode="warehouse" />
  80. </a-form-item>
  81. </a-col>
  82. <a-col :lg="8">
  83. <a-form-item name="goodsAllocation">
  84. <template #label><span title="货位(goods allocation)">货位(goods allocation)</span></template>
  85. <JDictSelectTag v-model:value="queryParam.goodsAllocation" placeholder="请选择" dictCode="goods_allocation" />
  86. </a-form-item>
  87. </a-col>
  88. <a-col :lg="8">
  89. <a-form-item name="submit">
  90. <template #label><span title="提交(submit)">提交(submit)</span></template>
  91. <JDictSelectTag v-model:value="queryParam.submit" placeholder="请选择" dictCode="yes_or_no" style="width: 100%" />
  92. </a-form-item>
  93. </a-col>
  94. </template>
  95. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  96. <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
  97. <a-col :lg="6">
  98. <a-button type="primary" preIcon="ant-design:search-outlined" @click="reload">查询</a-button>
  99. <a-button preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button>
  100. <a @click="toggleSearchStatus = !toggleSearchStatus" style="margin-left: 8px">
  101. {{ toggleSearchStatus ? '收起' : '展开' }}
  102. <Icon :icon="toggleSearchStatus ? 'ant-design:up-outlined' : 'ant-design:down-outlined'" />
  103. </a>
  104. </a-col>
  105. </span>
  106. </a-col>
  107. </a-row>
  108. </a-form>
  109. </div>
  110. <!--引用表格-->
  111. <BasicTable @register="registerTable" :rowSelection="rowSelection" size="small">
  112. <!--插槽:table标题-->
  113. <template #tableTitle>
  114. <a-button type="primary" v-auth="'storeCode:store_purchase_other:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">
  115. 新增(add)</a-button
  116. >
  117. <a-button type="primary" v-auth="'storeCode:store_purchase_other:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls">
  118. 导出(export)</a-button
  119. >
  120. <a-button type="primary" @click="submit"> 提交(submit)</a-button>
  121. <a-button type="primary" @click="cancelSubmit"> 取消提交(cancelSubmit)</a-button>
  122. <a-dropdown v-if="selectedRowKeys.length > 0">
  123. <template #overlay>
  124. <a-menu>
  125. <a-menu-item key="1" @click="batchHandleDelete" v-auth="'storeCode:store_purchase_other:deleteBatch'">
  126. <Icon icon="ant-design:delete-outlined" />
  127. 删除(delete)
  128. </a-menu-item>
  129. </a-menu>
  130. </template>
  131. <a-button v-auth="'saleCode:sale_order:delete'"
  132. >批量操作
  133. <Icon icon="mdi:chevron-down" />
  134. </a-button>
  135. </a-dropdown>
  136. </template>
  137. <!--操作栏-->
  138. <template #action="{ record }">
  139. <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
  140. </template>
  141. <!--字段回显插槽-->
  142. <template #bodyCell="{ column, record, index, text }"> </template>
  143. </BasicTable>
  144. <!-- 表单区域 -->
  145. <otherInFormModal @register="registerModal" @success="handleSuccess" />
  146. </div>
  147. </template>
  148. <script lang="ts" name="saleCode-saleInquiryForm" setup>
  149. import { ref, reactive, computed, unref, onMounted } from 'vue';
  150. import { BasicTable, useTable, TableAction } from '/@/components/Table';
  151. import { useListPage } from '/@/hooks/system/useListPage';
  152. import { useModal } from '/@/components/Modal';
  153. import otherInFormModal from './components/otherInFormModal.vue';
  154. import { columns } from './otherInForm.data';
  155. import {
  156. list,
  157. deleteOne,
  158. batchDelete,
  159. getImportUrl,
  160. getExportUrl,
  161. batchSubmit,
  162. cancelBatchSubmit,
  163. supplierOption,
  164. ProjectOption,
  165. ClassList,
  166. } from './otherInForm.api';
  167. import { cloneDeep } from 'lodash-es';
  168. import { JDictSelectTag, ApiSelect, JInput,JSelect } from '/@/components/Form';
  169. import { message } from 'ant-design-vue';
  170. const formRef = ref();
  171. const queryParam = reactive<any>({});
  172. var showField = ref('currency_dictText+name');
  173. //注册model
  174. const [registerModal, { openModal }] = useModal();
  175. //注册table数据
  176. const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
  177. tableProps: {
  178. title: '其他入库',
  179. api: list,
  180. columns,
  181. canResize: false,
  182. useSearchForm: false,
  183. actionColumn: {
  184. width: 200,
  185. fixed: 'right',
  186. },
  187. scroll: {
  188. x: '2500px',
  189. y:'calc(100vh - 400px)',
  190. },
  191. beforeFetch: async (params) => {
  192. let rangerQuery = await setRangeQuery();
  193. return Object.assign(params, rangerQuery);
  194. },
  195. },
  196. exportConfig: {
  197. name: '其他入库',
  198. url: getExportUrl,
  199. params: queryParam,
  200. },
  201. importConfig: {
  202. url: getImportUrl,
  203. success: handleSuccess,
  204. },
  205. });
  206. const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
  207. /**
  208. * 高级查询事件
  209. */
  210. function handleSuperQuery(params) {
  211. Object.keys(params).map((k) => {
  212. queryParam[k] = params[k];
  213. });
  214. reload();
  215. }
  216. /**
  217. * 新增事件
  218. */
  219. function handleAdd() {
  220. openModal(true, {
  221. isUpdate: false,
  222. showFooter: true,
  223. });
  224. }
  225. /**
  226. * 编辑事件
  227. */
  228. function handleEdit(record: Recordable) {
  229. openModal(true, {
  230. record,
  231. isUpdate: true,
  232. showFooter: true,
  233. });
  234. }
  235. /**
  236. * 详情
  237. */
  238. function handleDetail(record: Recordable) {
  239. openModal(true, {
  240. record,
  241. isUpdate: true,
  242. showFooter: false,
  243. });
  244. }
  245. /**
  246. * 删除事件
  247. */
  248. async function handleDelete(record) {
  249. await deleteOne({ id: record.id }, handleSuccess);
  250. }
  251. /**
  252. * 批量删除事件
  253. */
  254. async function batchHandleDelete() {
  255. await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
  256. }
  257. /**
  258. * 成功回调
  259. */
  260. function handleSuccess() {
  261. (selectedRowKeys.value = []) && reload();
  262. }
  263. /**
  264. * 操作栏
  265. */
  266. function getTableAction(record) {
  267. return [
  268. {
  269. label: '编辑(edit)',
  270. onClick: handleEdit.bind(null, record),
  271. auth: 'storeCode:store_purchase_other:edit',
  272. ifShow: record.submit == '0' || !record.submit,
  273. },
  274. {
  275. label: '详情(detail)',
  276. onClick: handleDetail.bind(null, record),
  277. ifShow: record.submit == '1',
  278. },
  279. ];
  280. }
  281. /**
  282. * 下拉操作栏
  283. */
  284. function getDropDownAction(record) {
  285. return [
  286. {
  287. label: '详情(detail)',
  288. onClick: handleDetail.bind(null, record),
  289. ifShow: record.submit == '0' || !record.submit,
  290. },
  291. {
  292. label: '删除(delete)',
  293. popConfirm: {
  294. title: '是否确认删除',
  295. confirm: handleDelete.bind(null, record),
  296. placement: 'topLeft',
  297. },
  298. auth: 'storeCode:store_purchase_other:delete',
  299. ifShow: record.submit == '0' || !record.submit,
  300. },
  301. ];
  302. }
  303. function submit() {
  304. if (selectedRowKeys.value.length == 0) {
  305. message.warning('请选择数据');
  306. } else {
  307. var ids = selectedRowKeys.value.join(',');
  308. batchSubmit({ ids: ids }, handleSuccess);
  309. }
  310. }
  311. function cancelSubmit() {
  312. if (selectedRowKeys.value.length == 0) {
  313. message.warning('请选择数据');
  314. } else {
  315. var ids = selectedRowKeys.value.join(',');
  316. cancelBatchSubmit({ ids: ids }, handleSuccess);
  317. }
  318. }
  319. /* ----------------------以下为原生查询需要添加的-------------------------- */
  320. const toggleSearchStatus = ref<boolean>(false);
  321. const labelCol = reactive({
  322. xs: 24,
  323. sm: 8,
  324. });
  325. const wrapperCol = reactive({
  326. xs: 24,
  327. sm: 16,
  328. });
  329. const labelCol1 = reactive({
  330. xs: 24,
  331. sm: 12,
  332. });
  333. const wrapperCol1 = reactive({
  334. xs: 24,
  335. sm: 12,
  336. });
  337. /**
  338. * 重置
  339. */
  340. function searchReset() {
  341. formRef.value.resetFields();
  342. selectedRowKeys.value = [];
  343. //刷新数据
  344. reload();
  345. }
  346. let rangeField = 'billDate,';
  347. /**
  348. * 设置范围查询条件
  349. */
  350. async function setRangeQuery() {
  351. let queryParamClone = cloneDeep(queryParam);
  352. if (rangeField) {
  353. let fieldsValue = rangeField.split(',');
  354. fieldsValue.forEach((item) => {
  355. if (queryParamClone[item]) {
  356. let range = queryParamClone[item];
  357. queryParamClone[item + '_begin'] = range[0];
  358. queryParamClone[item + '_end'] = range[1];
  359. delete queryParamClone[item];
  360. } else {
  361. queryParamClone[item + '_begin'] = '';
  362. queryParamClone[item + '_end'] = '';
  363. }
  364. });
  365. }
  366. return queryParamClone;
  367. }
  368. </script>
  369. <style lang="less" scoped>
  370. .jeecg-basic-table-form-container {
  371. padding: 0;
  372. .table-page-search-submitButtons {
  373. display: block;
  374. margin-bottom: 8px;
  375. white-space: nowrap;
  376. }
  377. .query-group-cust {
  378. min-width: 100px !important;
  379. }
  380. .query-group-split-cust {
  381. width: 30px;
  382. display: inline-block;
  383. text-align: center;
  384. }
  385. .ant-form-item:not(.ant-form-item-with-help) {
  386. margin-bottom: 8px;
  387. height: 32px;
  388. }
  389. :deep(.ant-picker),
  390. :deep(.ant-input-number) {
  391. width: 100%;
  392. }
  393. }
  394. </style>