salesOutboundList.vue 14 KB

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