selectionQuotationFormList.vue 13 KB

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