purInAbnormalList.vue 12 KB

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