inventoryCheckList.vue 11 KB

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