purInAbnormalList.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  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="false"
  21. resultField="records"
  22. labelField="code"
  23. valueField="id"
  24. :params="{ pageSize: -1 }"
  25. />
  26. </a-form-item>
  27. </a-col>
  28. <template v-if="toggleSearchStatus">
  29. <a-col :lg="8">
  30. <a-form-item name="billCode">
  31. <template #label><span title="入库单号(bill code)">入库单号(bill code)</span></template>
  32. <JInput placeholder="请输入入库单号(bill code)" v-model:value="queryParam.billCode" allow-clear AutoComplete="off" />
  33. </a-form-item>
  34. </a-col>
  35. <a-col :lg="16">
  36. <a-form-item name="supplier">
  37. <template #label><span title="供应商(supplier)">供应商(supplier)</span></template>
  38. <JSelect v-model:value="queryParam.supplier" :get-option-url="supplierOption" :showField="showField"></JSelect>
  39. </a-form-item>
  40. </a-col>
  41. <a-col :lg="8">
  42. <a-form-item name="productionClass">
  43. <template #label><span title="产品分类(production class)">产品分类(production class)</span></template>
  44. <ApiSelect
  45. :api="ClassList"
  46. showSearch
  47. v-model:value="queryParam.productionClass"
  48. :filterOption="false"
  49. resultField="records"
  50. labelField="name"
  51. valueField="id"
  52. :params="{ pageSize: -1 }"
  53. />
  54. </a-form-item>
  55. </a-col>
  56. <a-col :lg="8">
  57. <a-form-item name="model">
  58. <template #label><span title="机型(model)">机型(model)</span></template>
  59. <JDictSelectTag v-model:value="queryParam.model" placeholder="请选择" dictCode="model_typer" style="width: 100%" />
  60. </a-form-item>
  61. </a-col>
  62. <a-col :lg="8">
  63. <a-form-item name="maker">
  64. <template #label><span title="厂家(maker)">厂家(maker)</span></template>
  65. <JDictSelectTag v-model:value="queryParam.maker" placeholder="请选择" dictCode="factory" />
  66. </a-form-item>
  67. </a-col>
  68. <a-col :lg="8">
  69. <a-form-item name="warehouse">
  70. <template #label><span title="仓库(warehouse)">仓库(warehouse)</span></template>
  71. <JDictSelectTag v-model:value="queryParam.warehouse" placeholder="请选择" dictCode="warehouse" />
  72. </a-form-item>
  73. </a-col>
  74. <a-col :lg="8">
  75. <a-form-item name="goodsAllocation">
  76. <template #label><span title="货位(goods allocation)">货位(goods allocation)</span></template>
  77. <JDictSelectTag v-model:value="queryParam.goodsAllocation" placeholder="请选择" dictCode="goods_allocation" />
  78. </a-form-item>
  79. </a-col>
  80. <a-col :lg="8">
  81. <a-form-item name="hasDeal">
  82. <template #label><span title="处理(deal)">处理(deal)</span></template>
  83. <JDictSelectTag v-model:value="queryParam.hasDeal" placeholder="请选择" dictCode="yes_or_no" style="width: 100%" />
  84. </a-form-item>
  85. </a-col>
  86. </template>
  87. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  88. <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
  89. <a-col :lg="6">
  90. <a-button type="primary" preIcon="ant-design:search-outlined" @click="reload">查询</a-button>
  91. <a-button preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button>
  92. <a @click="toggleSearchStatus = !toggleSearchStatus" style="margin-left: 8px">
  93. {{ toggleSearchStatus ? '收起' : '展开' }}
  94. <Icon :icon="toggleSearchStatus ? 'ant-design:up-outlined' : 'ant-design:down-outlined'" />
  95. </a>
  96. </a-col>
  97. </span>
  98. </a-col>
  99. </a-row>
  100. </a-form>
  101. </div>
  102. <!--引用表格-->
  103. <BasicTable @register="registerTable" :rowSelection="rowSelection" size="small">
  104. <!--插槽:table标题-->
  105. <template #tableTitle>
  106. <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出(export)</a-button>
  107. <a-button type="primary" preIcon="ant-design:export-outlined" @click="onProcessed"> 已处理(Processed)</a-button>
  108. </template>
  109. <!--操作栏-->
  110. <template #action="{ record }">
  111. <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
  112. </template>
  113. <!--字段回显插槽-->
  114. <template #bodyCell="{ column, record, index, text }"> </template>
  115. </BasicTable>
  116. <!-- 表单区域 -->
  117. <purInAbnormalFormModal @register="registerModal" @success="handleSuccess" />
  118. </div>
  119. </template>
  120. <script lang="ts" name="saleCode-saleInquiryForm" setup>
  121. import { ref, reactive, onMounted } from 'vue';
  122. import { BasicTable, useTable, TableAction } from '/@/components/Table';
  123. import { useListPage } from '/@/hooks/system/useListPage';
  124. import { useModal } from '/@/components/Modal';
  125. import purInAbnormalFormModal from './components/purInAbnormalFormModal.vue';
  126. import { columns } from './purInAbnormalForm.data';
  127. import { list, getImportUrl, getExportUrl, ProcessedList, ProjectOption, supplierOption, ClassList } from './purInAbnormalForm.api';
  128. import { cloneDeep } from 'lodash-es';
  129. import { JDictSelectTag, ApiSelect, JInput,JSelect } from '/@/components/Form';
  130. import { message } from 'ant-design-vue';
  131. const formRef = ref();
  132. const queryParam = reactive<any>({
  133. type: '2',
  134. });
  135. var showField = ref('currency+name');
  136. //注册model
  137. const [registerModal, { openModal }] = useModal();
  138. //注册table数据
  139. const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
  140. tableProps: {
  141. title: '采购入库异常',
  142. api: list,
  143. columns,
  144. canResize: false,
  145. useSearchForm: false,
  146. actionColumn: {
  147. width: 200,
  148. fixed: 'right',
  149. },
  150. scroll: {
  151. x: '2500px',
  152. y:'calc(100vh - 400px)',
  153. },
  154. beforeFetch: async (params) => {
  155. let rangerQuery = await setRangeQuery();
  156. return Object.assign(params, rangerQuery);
  157. },
  158. },
  159. exportConfig: {
  160. name: '采购入库异常',
  161. url: getExportUrl,
  162. params: queryParam,
  163. },
  164. importConfig: {
  165. url: getImportUrl,
  166. success: handleSuccess,
  167. },
  168. });
  169. const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
  170. /**
  171. * 详情
  172. */
  173. function handleDetail(record: Recordable) {
  174. openModal(true, {
  175. record,
  176. isUpdate: true,
  177. showFooter: false,
  178. });
  179. }
  180. function handlTackle(record) {
  181. ProcessedList({ ids: record.id }, handleSuccess);
  182. }
  183. function onProcessed() {
  184. if (selectedRowKeys.value.length == 0) {
  185. message.warning('请选择数据');
  186. } else {
  187. var ids = selectedRowKeys.value.join(',');
  188. ProcessedList({ ids: ids }, handleSuccess);
  189. }
  190. }
  191. /**
  192. * 操作栏
  193. */
  194. function getTableAction(record) {
  195. return [
  196. {
  197. label: '详情(detail)',
  198. onClick: handleDetail.bind(null, record),
  199. },
  200. {
  201. label: '已处理(detail)',
  202. onClick: handlTackle.bind(null, record),
  203. ifShow: record.hasDeal == '0' || !record.hasDeal,
  204. },
  205. ];
  206. }
  207. /**
  208. * 下拉操作栏
  209. */
  210. function getDropDownAction(record) {
  211. return [];
  212. }
  213. /**
  214. * 成功回调
  215. */
  216. function handleSuccess() {
  217. (selectedRowKeys.value = []) && reload();
  218. }
  219. /* ----------------------以下为原生查询需要添加的-------------------------- */
  220. const toggleSearchStatus = ref<boolean>(false);
  221. const labelCol = reactive({
  222. xs: 24,
  223. sm: 8,
  224. });
  225. const wrapperCol = reactive({
  226. xs: 24,
  227. sm: 16,
  228. });
  229. const labelCol1 = reactive({
  230. xs: 24,
  231. sm: 12,
  232. });
  233. const wrapperCol1 = reactive({
  234. xs: 24,
  235. sm: 12,
  236. });
  237. /**
  238. * 重置
  239. */
  240. function searchReset() {
  241. formRef.value.resetFields();
  242. selectedRowKeys.value = [];
  243. //刷新数据
  244. reload();
  245. }
  246. let rangeField = 'billDate,';
  247. /**
  248. * 设置范围查询条件
  249. */
  250. async function setRangeQuery() {
  251. let queryParamClone = cloneDeep(queryParam);
  252. if (rangeField) {
  253. let fieldsValue = rangeField.split(',');
  254. fieldsValue.forEach((item) => {
  255. if (queryParamClone[item]) {
  256. let range = queryParamClone[item];
  257. queryParamClone[item + '_begin'] = range[0];
  258. queryParamClone[item + '_end'] = range[1];
  259. delete queryParamClone[item];
  260. } else {
  261. queryParamClone[item + '_begin'] = '';
  262. queryParamClone[item + '_end'] = '';
  263. }
  264. });
  265. }
  266. return queryParamClone;
  267. }
  268. </script>
  269. <style lang="less" scoped>
  270. .jeecg-basic-table-form-container {
  271. padding: 0;
  272. .table-page-search-submitButtons {
  273. display: block;
  274. margin-bottom: 8px;
  275. white-space: nowrap;
  276. }
  277. .query-group-cust {
  278. min-width: 100px !important;
  279. }
  280. .query-group-split-cust {
  281. width: 30px;
  282. display: inline-block;
  283. text-align: center;
  284. }
  285. .ant-form-item:not(.ant-form-item-with-help) {
  286. margin-bottom: 8px;
  287. height: 32px;
  288. }
  289. :deep(.ant-picker),
  290. :deep(.ant-input-number) {
  291. width: 100%;
  292. }
  293. }
  294. </style>