SaleInquiryFormList.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  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="inquiryProject">
  22. <template #label><span title="询价项目(inquiry project)">询价项目(inquiry project)</span></template>
  23. <a-input v-model:value="queryParam.inquiryProject"/>
  24. </a-form-item>
  25. </a-col>
  26. <a-col :lg="8">
  27. <a-form-item name="inquiryCustomer">
  28. <template #label><span title="询价客户(inquiry customer)">询价客户(inquiry customer)</span></template>
  29. <a-input placeholder="请输入询价客户(inquiry customer)" v-model:value="queryParam.inquiryCustomer" allow-clear ></a-input>
  30. </a-form-item>
  31. </a-col>
  32. <a-col :lg="8">
  33. <a-form-item name="ship">
  34. <template #label><span title="船(ship)">船(ship)</span></template>
  35. <a-input placeholder="请输入船(ship)" v-model:value="queryParam.shipID" allow-clear ></a-input>
  36. </a-form-item>
  37. </a-col>
  38. <a-col :lg="8">
  39. <a-form-item name="priority">
  40. <template #label><span title="优先级(priority)">优先级(priority)</span></template>
  41. <JDictSelectTag v-model:value="queryParam.priority" placeholder="请选择" dictCode="priority"/>
  42. </a-form-item>
  43. </a-col>
  44. <a-col :lg="8">
  45. <a-form-item name="productionClass" >
  46. <template #label><span title="产品分类(production class)">产品分类(production class)</span></template>
  47. <JSelectInput v-model:value="queryParam.productionClass" placeholder="请选择" :options="classOption" ></JSelectInput>
  48. </a-form-item>
  49. </a-col>
  50. <a-col :lg="8">
  51. <a-form-item name="model">
  52. <template #label><span title="机型(model)">机型(model)</span></template>
  53. <JDictSelectTag v-model:value="queryParam.model" placeholder="请选择" dictCode="model_typer"/>
  54. </a-form-item>
  55. </a-col>
  56. <a-col :lg="8">
  57. <a-form-item name="maker">
  58. <template #label><span title="厂家(maker)">厂家(maker)</span></template>
  59. <a-input placeholder="请输入厂家(maker)" v-model:value="queryParam.maker" allow-clear ></a-input>
  60. </a-form-item>
  61. </a-col>
  62. <a-col :lg="8">
  63. <a-form-item name="inquiryPlatform">
  64. <template #label><span title="询价平台(inquiry platform)">询价平台(inquiry platform)</span></template>
  65. <a-input placeholder="请输入询价平台(inquiry platform)" v-model:value="queryParam.inquiryPlatform" allow-clear ></a-input>
  66. </a-form-item>
  67. </a-col>
  68. <a-col :lg="8">
  69. <a-form-item name="submit">
  70. <template #label><span title="状态(status)">状态(status)</span></template>
  71. <JDictSelectTag v-model:value="queryParam.status" placeholder="请选择" dictCode="inquiry_status"/>
  72. </a-form-item>
  73. </a-col>
  74. <a-col :lg="8">
  75. <a-form-item name="saleDepartment" >
  76. <template #label><span title="销售部门(sale department)">销售部门(sale department)</span></template>
  77. <JSelectDept v-model:value="queryParam.saleDepartment" :multiple="false" />
  78. </a-form-item>
  79. </a-col>
  80. <a-col :lg="8">
  81. <a-form-item name="salesman">
  82. <template #label><span title="业务员(salesman)">业务员(salesman)</span></template>
  83. <JSelectUser v-model:value="queryParam.salesman" placeholder="请选择" :multiple="false"></JSelectUser>
  84. </a-form-item>
  85. </a-col>
  86. <a-col :lg="8">
  87. <a-form-item name="inquiryTeam" :label-col="labelCol1" :wrapper-col="wrapperCol1">
  88. <template #label><span title="采购询价组(procurement inquiry team)">采购询价组(procurement inquiry team)</span></template>
  89. <JSelectDept v-model:value="queryParam.inquiryTeam" :multiple="false"/>
  90. </a-form-item>
  91. </a-col>
  92. <a-col :lg="8">
  93. <a-form-item name="submit">
  94. <template #label><span title="提交(submit)">提交(submit)</span></template>
  95. <JDictSelectTag v-model:value="queryParam.submit" placeholder="请选择" dictCode="yes_or_no"/>
  96. </a-form-item>
  97. </a-col>
  98. <a-col :lg="8">
  99. <a-form-item name="submit">
  100. <template #label><span title="其他状态(other status)">其他状态(other statu)</span></template>
  101. <a-input placeholder="其他状态(other status)" v-model:value="queryParam.otherStatus" allow-clear ></a-input>
  102. </a-form-item>
  103. </a-col>
  104. <a-col :lg="8">
  105. <a-form-item name="customerInquiryNumber" :label-col="labelCol1" :wrapper-col="wrapperCol1">
  106. <template #label><span title="客户询价单号(customer inquiry number)">客户询价单号(customer inquiry number)</span></template>
  107. <a-input placeholder="请输入客户询价单号(customer inquiry number)" v-model:value="queryParam.customerInquiryNumber" allow-clear ></a-input>
  108. </a-form-item>
  109. </a-col>
  110. </template>
  111. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  112. <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
  113. <a-col :lg="6">
  114. <a-button type="primary" preIcon="ant-design:search-outlined" @click="reload">查询</a-button>
  115. <a-button preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button>
  116. <a @click="toggleSearchStatus = !toggleSearchStatus" style="margin-left: 8px">
  117. {{ toggleSearchStatus ? '收起' : '展开' }}
  118. <Icon :icon="toggleSearchStatus ? 'ant-design:up-outlined' : 'ant-design:down-outlined'" />
  119. </a>
  120. </a-col>
  121. </span>
  122. </a-col>
  123. </a-row>
  124. </a-form>
  125. </div>
  126. <!--引用表格-->
  127. <BasicTable @register="registerTable" :rowSelection="rowSelection" size="small" >
  128. <!--插槽:table标题-->
  129. <template #tableTitle>
  130. <a-button type="primary" v-auth="'saleCode:sale_inquiry_form:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增(add)</a-button>
  131. <a-button type="primary" v-auth="'saleCode:sale_inquiry_form:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出(export)</a-button>
  132. <a-button type="primary" @click="setStatus"> 设置其他状态(set other status)</a-button>
  133. <a-button type="primary" @click="submit" v-auth="'saleCode:sale_inquiry_form:submitBatch'"> 提交(submit)</a-button>
  134. <a-button type="primary" @click="cancelSubmit" v-auth="'saleCode:sale_inquiry_form:returnSubmitBatch'"> 取消提交(cancelSubmit)</a-button>
  135. <a-dropdown v-if="selectedRowKeys.length > 0">
  136. <template #overlay>
  137. <a-menu>
  138. <a-menu-item key="1" @click="batchHandleDelete" v-auth="'saleCode:sale_inquiry_form:deleteBatch'">
  139. <Icon icon="ant-design:delete-outlined"></Icon>
  140. 删除(delete)
  141. </a-menu-item>
  142. </a-menu>
  143. </template>
  144. <a-button v-auth="'saleCode:sale_inquiry_form:deleteBatch'">批量操作
  145. <Icon icon="mdi:chevron-down"></Icon>
  146. </a-button>
  147. </a-dropdown>
  148. </template>
  149. <!--操作栏-->
  150. <template #action="{ record }">
  151. <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
  152. </template>
  153. <!--字段回显插槽-->
  154. <template v-slot:bodyCell="{ column, record, index, text }">
  155. </template>
  156. </BasicTable>
  157. <!-- 表单区域 -->
  158. <SaleInquiryFormModal @register="registerModal" @success="handleSuccess"></SaleInquiryFormModal>
  159. <SetOtherStatus ref="SetOtherStatusRef" @success="handleSuccess"></SetOtherStatus>
  160. </div>
  161. </template>
  162. <script lang="ts" name="saleCode-saleInquiryForm" setup>
  163. import {ref, reactive, computed, unref,onMounted} from 'vue';
  164. import {BasicTable, useTable, TableAction} from '/@/components/Table';
  165. import { useListPage } from '/@/hooks/system/useListPage'
  166. import {useModal} from '/@/components/Modal';
  167. import SaleInquiryFormModal from './components/SaleInquiryFormModal.vue'
  168. import {columns, superQuerySchema} from './SaleInquiryForm.data';
  169. import {list, deleteOne, batchDelete, getImportUrl,getExportUrl,batchSubmit,cancelBatchSubmit} from './SaleInquiryForm.api';
  170. import {downloadFile} from '/@/utils/common/renderUtils';
  171. import { cloneDeep } from "lodash-es";
  172. import { useUserStore } from '/@/store/modules/user';
  173. import { defHttp } from '/@/utils/http/axios';
  174. import { JDictSelectTag} from '/@/components/Form';
  175. import JSelectInput from '/@/components/Form/src/jeecg/components/JSelectInput.vue';
  176. import JSelectUser from '/@/components/Form/src/jeecg/components/JSelectUser.vue';
  177. import JSelectDept from '/@/components/Form/src/jeecg/components/JSelectDept.vue';
  178. import SetOtherStatus from './components/SetOtherStatus.vue';
  179. import { message } from 'ant-design-vue';
  180. const formRef = ref();
  181. const queryParam = reactive<any>({});
  182. const checkedKeys = ref<Array<string | number>>([]);
  183. //注册model
  184. const [registerModal, {openModal}] = useModal();
  185. const userStore = useUserStore();
  186. var classOption = ref([]);
  187. var SetOtherStatusRef = ref()
  188. //注册table数据
  189. const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
  190. tableProps:{
  191. title: '销售询价单',
  192. api: list,
  193. columns,
  194. canResize:false,
  195. useSearchForm: false,
  196. actionColumn: {
  197. width: 200,
  198. fixed:'right'
  199. },
  200. scroll:{
  201. x:'4000px'
  202. },
  203. beforeFetch: async (params) => {
  204. let rangerQuery = await setRangeQuery();
  205. return Object.assign(params, rangerQuery);
  206. },
  207. },
  208. exportConfig: {
  209. name:"销售询价单",
  210. url: getExportUrl,
  211. params: queryParam,
  212. },
  213. importConfig: {
  214. url: getImportUrl,
  215. success: handleSuccess
  216. },
  217. })
  218. const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
  219. // 高级查询配置
  220. const superQueryConfig = reactive(superQuerySchema);
  221. /**
  222. * 高级查询事件
  223. */
  224. function handleSuperQuery(params) {
  225. Object.keys(params).map((k) => {
  226. queryParam[k] = params[k];
  227. });
  228. reload();
  229. }
  230. // 自动请求并暴露内部方法
  231. onMounted(() => {
  232. getOptiom()
  233. });
  234. /**
  235. * 新增事件
  236. */
  237. function handleAdd() {
  238. openModal(true, {
  239. isUpdate: false,
  240. showFooter: true,
  241. });
  242. }
  243. /**
  244. * 编辑事件
  245. */
  246. function handleEdit(record: Recordable) {
  247. openModal(true, {
  248. record,
  249. isUpdate: true,
  250. showFooter: true,
  251. });
  252. }
  253. // 产品分类
  254. function getOptiom(){
  255. defHttp
  256. .get({ url: 'baseCode/baseProductClass/list'}, { isTransformResponse: false })
  257. .then((res) => {
  258. if (res.success) {
  259. classOption.value = []
  260. res.result.records.forEach(element => {
  261. var obj = {
  262. label: element.name?element.name:'无名称请维护',
  263. value: element.id?element.id:''
  264. };
  265. classOption.value.push( obj)
  266. });
  267. }
  268. })
  269. .finally(() => {
  270. // loading.value = false;
  271. });
  272. }
  273. /**
  274. * 详情
  275. */
  276. function handleDetail(record: Recordable) {
  277. openModal(true, {
  278. record,
  279. isUpdate: true,
  280. showFooter: false,
  281. });
  282. }
  283. /**
  284. * 删除事件
  285. */
  286. async function handleDelete(record) {
  287. await deleteOne({id: record.id}, handleSuccess);
  288. }
  289. /**
  290. * 批量删除事件
  291. */
  292. async function batchHandleDelete() {
  293. await batchDelete({ids: selectedRowKeys.value},handleSuccess);
  294. }
  295. /**
  296. * 成功回调
  297. */
  298. function handleSuccess() {
  299. (selectedRowKeys.value = []) && reload();
  300. }
  301. /**
  302. * 操作栏
  303. */
  304. function getTableAction(record){
  305. return [
  306. {
  307. label: '编辑(edit)',
  308. onClick: handleEdit.bind(null, record),
  309. auth: 'saleCode:sale_inquiry_form:edit'
  310. }
  311. ]
  312. }
  313. /**
  314. * 下拉操作栏
  315. */
  316. function getDropDownAction(record){
  317. return [
  318. {
  319. label: '详情(detail)',
  320. onClick: handleDetail.bind(null, record),
  321. }, {
  322. label: '删除(delete)',
  323. popConfirm: {
  324. title: '是否确认删除',
  325. confirm: handleDelete.bind(null, record),
  326. placement: 'topLeft'
  327. },
  328. auth: 'saleCode:sale_inquiry_form:delete'
  329. }
  330. ]
  331. }
  332. function setStatus(){
  333. if(selectedRowKeys.value.length==0){
  334. message.warning('请选择数据')
  335. }else{
  336. var ids=selectedRowKeys.value.join(',')
  337. SetOtherStatusRef.value.getTable(ids)
  338. }
  339. }
  340. function submit(){
  341. if(selectedRowKeys.value.length==0){
  342. message.warning('请选择数据')
  343. }else{
  344. var ids=selectedRowKeys.value.join(',')
  345. batchSubmit({ids: ids},handleSuccess);
  346. }
  347. }
  348. function cancelSubmit(){
  349. if(selectedRowKeys.value.length==0){
  350. message.warning('请选择数据')
  351. }else{
  352. var ids=selectedRowKeys.value.join(',')
  353. cancelBatchSubmit({ids: ids},handleSuccess);
  354. }
  355. }
  356. /* ----------------------以下为原生查询需要添加的-------------------------- */
  357. const toggleSearchStatus = ref<boolean>(false);
  358. const labelCol = reactive({
  359. xs:24,
  360. sm:8,
  361. });
  362. const wrapperCol = reactive({
  363. xs: 24,
  364. sm: 16,
  365. });
  366. const labelCol1 = reactive({
  367. xs:24,
  368. sm:12,
  369. });
  370. const wrapperCol1 = reactive({
  371. xs: 24,
  372. sm: 12,
  373. });
  374. /**
  375. * 重置
  376. */
  377. function searchReset() {
  378. formRef.value.resetFields();
  379. selectedRowKeys.value = [];
  380. //刷新数据
  381. reload();
  382. }
  383. let rangeField = 'billDate,'
  384. /**
  385. * 设置范围查询条件
  386. */
  387. async function setRangeQuery(){
  388. let queryParamClone = cloneDeep(queryParam);
  389. if (rangeField) {
  390. let fieldsValue = rangeField.split(',');
  391. fieldsValue.forEach(item => {
  392. if (queryParamClone[item]) {
  393. let range = queryParamClone[item];
  394. queryParamClone[item+'_begin'] = range[0];
  395. queryParamClone[item+'_end'] = range[1];
  396. delete queryParamClone[item];
  397. } else {
  398. queryParamClone[item+'_begin'] = '';
  399. queryParamClone[item+'_end'] = '';
  400. }
  401. })
  402. }
  403. return queryParamClone;
  404. }
  405. </script>
  406. <style lang="less" scoped>
  407. .jeecg-basic-table-form-container {
  408. padding: 0;
  409. .table-page-search-submitButtons {
  410. display: block;
  411. margin-bottom: 8px;
  412. white-space: nowrap;
  413. }
  414. .query-group-cust{
  415. min-width: 100px !important;
  416. }
  417. .query-group-split-cust{
  418. width: 30px;
  419. display: inline-block;
  420. text-align: center
  421. }
  422. .ant-form-item:not(.ant-form-item-with-help){
  423. margin-bottom: 8px;
  424. height: 32px;
  425. }
  426. :deep(.ant-picker),:deep(.ant-input-number){
  427. width: 100%;
  428. }
  429. }
  430. </style>