|
@@ -1,94 +1,131 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
<!--引用表格-->
|
|
|
- <BasicTable @register="registerTable" :rowSelection="rowSelection">
|
|
|
- <!--插槽:table标题-->
|
|
|
+ <BasicTable @register="registerTable" :rowSelection="rowSelection">
|
|
|
+ <!--插槽:table标题-->
|
|
|
<template #tableTitle>
|
|
|
- <a-button type="primary" v-auth="'saleCode:sale_interface_sync:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
|
|
|
- <a-button type="primary" v-auth="'saleCode:sale_interface_sync:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
|
|
|
- <j-upload-button type="primary" v-auth="'saleCode:sale_interface_sync:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
|
|
|
- <a-dropdown v-if="selectedRowKeys.length > 0">
|
|
|
- <template #overlay>
|
|
|
- <a-menu>
|
|
|
- <a-menu-item key="1" @click="batchHandleDelete">
|
|
|
- <Icon icon="ant-design:delete-outlined"></Icon>
|
|
|
- 删除
|
|
|
- </a-menu-item>
|
|
|
- </a-menu>
|
|
|
- </template>
|
|
|
- <a-button v-auth="'saleCode:sale_interface_sync:deleteBatch'">批量操作
|
|
|
- <Icon icon="mdi:chevron-down"></Icon>
|
|
|
- </a-button>
|
|
|
+ <a-button type="primary" v-auth="'saleCode:sale_interface_sync:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
|
|
|
+ <a-button type="primary" v-auth="'saleCode:sale_interface_sync:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls">
|
|
|
+ 导出</a-button
|
|
|
+ >
|
|
|
+ <j-upload-button type="primary" v-auth="'saleCode:sale_interface_sync:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls"
|
|
|
+ >导入</j-upload-button
|
|
|
+ >
|
|
|
+ <a-dropdown v-if="selectedRowKeys.length > 0">
|
|
|
+ <template #overlay>
|
|
|
+ <a-menu>
|
|
|
+ <a-menu-item key="1" @click="batchHandleDelete">
|
|
|
+ <Icon icon="ant-design:delete-outlined" />
|
|
|
+ 删除
|
|
|
+ </a-menu-item>
|
|
|
+ </a-menu>
|
|
|
+ </template>
|
|
|
+ <a-button v-auth="'saleCode:sale_interface_sync:deleteBatch'"
|
|
|
+ >批量操作
|
|
|
+ <Icon icon="mdi:chevron-down" />
|
|
|
+ </a-button>
|
|
|
</a-dropdown>
|
|
|
<!-- 高级查询 -->
|
|
|
<super-query :config="superQueryConfig" @search="handleSuperQuery" />
|
|
|
+ <!-- 获取接口数据 -->
|
|
|
+ <a-button type="primary" v-auth="'saleCode:sale_interface_sync:deleteBatch'" @click="showSyncModal">获取接口数据</a-button>
|
|
|
+ <!-- 同步订单 -->
|
|
|
+ <a-button type="primary" v-auth="'saleCode:sale_interface_sync:deleteBatch'" @click="handleSyncOrder">同步订单</a-button>
|
|
|
</template>
|
|
|
- <!--操作栏-->
|
|
|
+ <!--操作栏-->
|
|
|
<template #action="{ record }">
|
|
|
- <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
|
|
|
+ <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
|
|
|
</template>
|
|
|
<!--字段回显插槽-->
|
|
|
- <template v-slot:bodyCell="{ column, record, index, text }">
|
|
|
- </template>
|
|
|
+ <template #bodyCell="{ column, record, index, text }"> </template>
|
|
|
</BasicTable>
|
|
|
<!-- 表单区域 -->
|
|
|
- <SaleInterfaceSyncModal @register="registerModal" @success="handleSuccess"></SaleInterfaceSyncModal>
|
|
|
+ <SaleInterfaceSyncModal @register="registerModal" @success="handleSuccess" />
|
|
|
+ <!-- 获取接口弹窗 -->
|
|
|
+ <a-modal v-model:open="syncVisiable" title="获取接口数据" centered @ok="handleSyncOk">
|
|
|
+ <div style="padding: 20px">
|
|
|
+ <a-form ref="syncFormRef" :model="syncForm" :rules="syncRules" :label-col="labelCol" :wrapper-col="wrapperCol">
|
|
|
+ <a-form-item label="开始时间" required name="requestedDeliveryDate">
|
|
|
+ <a-date-picker
|
|
|
+ v-model:value="syncForm.requestedDeliveryDate"
|
|
|
+ type="date"
|
|
|
+ placeholder=""
|
|
|
+ style="width: 100%"
|
|
|
+ valueFormat="YYYY-MM-DD HH:mm:ss"
|
|
|
+ format="YYYY-MM-DD HH:mm:ss"
|
|
|
+ show-time
|
|
|
+ />
|
|
|
+ </a-form-item>
|
|
|
+ <a-form-item label="结束时间" required name="adviseBeforeDate">
|
|
|
+ <a-date-picker
|
|
|
+ v-model:value="syncForm.adviseBeforeDate"
|
|
|
+ type="date"
|
|
|
+ placeholder=""
|
|
|
+ style="width: 100%"
|
|
|
+ valueFormat="YYYY-MM-DD HH:mm:ss"
|
|
|
+ format="YYYY-MM-DD HH:mm:ss"
|
|
|
+ show-time
|
|
|
+ />
|
|
|
+ </a-form-item>
|
|
|
+ </a-form>
|
|
|
+ </div>
|
|
|
+ </a-modal>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" name="saleCode-saleInterfaceSync" setup>
|
|
|
- import {ref, reactive, computed, unref} from 'vue';
|
|
|
- import {BasicTable, useTable, TableAction} from '/@/components/Table';
|
|
|
- import { useListPage } from '/@/hooks/system/useListPage'
|
|
|
- import {useModal} from '/@/components/Modal';
|
|
|
- import SaleInterfaceSyncModal from './components/SaleInterfaceSyncModal.vue'
|
|
|
- import {columns, searchFormSchema, superQuerySchema} from './SaleInterfaceSync.data';
|
|
|
- import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './SaleInterfaceSync.api';
|
|
|
- import {downloadFile} from '/@/utils/common/renderUtils';
|
|
|
+ import { ref, reactive, computed, unref } from 'vue';
|
|
|
+ import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
|
|
+ import { useListPage } from '/@/hooks/system/useListPage';
|
|
|
+ import { useModal } from '/@/components/Modal';
|
|
|
+ import SaleInterfaceSyncModal from './components/SaleInterfaceSyncModal.vue';
|
|
|
+ import { columns, searchFormSchema, superQuerySchema } from './SaleInterfaceSync.data';
|
|
|
+ import { list, deleteOne, batchDelete, getImportUrl, getExportUrl, getData, getSyncOrder } from './SaleInterfaceSync.api';
|
|
|
+ import { downloadFile } from '/@/utils/common/renderUtils';
|
|
|
+ import { message } from 'ant-design-vue';
|
|
|
import { useUserStore } from '/@/store/modules/user';
|
|
|
+ import { useMessage } from '/@/hooks/web/useMessage';
|
|
|
+ const { createConfirm } = useMessage();
|
|
|
const queryParam = reactive<any>({});
|
|
|
const checkedKeys = ref<Array<string | number>>([]);
|
|
|
const userStore = useUserStore();
|
|
|
//注册model
|
|
|
- const [registerModal, {openModal}] = useModal();
|
|
|
- //注册table数据
|
|
|
- const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
|
|
|
- tableProps:{
|
|
|
- title: '询价单-接口同步表',
|
|
|
- api: list,
|
|
|
- columns,
|
|
|
- canResize:false,
|
|
|
- formConfig: {
|
|
|
- //labelWidth: 120,
|
|
|
- schemas: searchFormSchema,
|
|
|
- autoSubmitOnEnter:true,
|
|
|
- showAdvancedButton:true,
|
|
|
- fieldMapToNumber: [
|
|
|
- ],
|
|
|
- fieldMapToTime: [
|
|
|
- ['submittedDate', ['submittedDate_begin', 'submittedDate_end'], 'YYYY-MM-DD HH:mm:ss'],
|
|
|
- ],
|
|
|
- },
|
|
|
- actionColumn: {
|
|
|
- width: 120,
|
|
|
- fixed:'right'
|
|
|
- },
|
|
|
- beforeFetch: (params) => {
|
|
|
- return Object.assign(params, queryParam);
|
|
|
- },
|
|
|
- },
|
|
|
- exportConfig: {
|
|
|
- name:"询价单-接口同步表",
|
|
|
- url: getExportUrl,
|
|
|
- params: queryParam,
|
|
|
- },
|
|
|
- importConfig: {
|
|
|
- url: getImportUrl,
|
|
|
- success: handleSuccess
|
|
|
- },
|
|
|
- })
|
|
|
+ const [registerModal, { openModal }] = useModal();
|
|
|
+ //注册table数据
|
|
|
+ const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
|
|
+ tableProps: {
|
|
|
+ title: '询价单-接口同步表',
|
|
|
+ api: list,
|
|
|
+ columns,
|
|
|
+ canResize: false,
|
|
|
+ formConfig: {
|
|
|
+ //labelWidth: 120,
|
|
|
+ schemas: searchFormSchema,
|
|
|
+ autoSubmitOnEnter: true,
|
|
|
+ showAdvancedButton: true,
|
|
|
+ fieldMapToNumber: [],
|
|
|
+ fieldMapToTime: [['submittedDate', ['submittedDate_begin', 'submittedDate_end'], 'YYYY-MM-DD HH:mm:ss']],
|
|
|
+ },
|
|
|
+ actionColumn: {
|
|
|
+ width: 120,
|
|
|
+ fixed: 'right',
|
|
|
+ },
|
|
|
+ beforeFetch: (params) => {
|
|
|
+ return Object.assign(params, queryParam);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ exportConfig: {
|
|
|
+ name: '询价单-接口同步表',
|
|
|
+ url: getExportUrl,
|
|
|
+ params: queryParam,
|
|
|
+ },
|
|
|
+ importConfig: {
|
|
|
+ url: getImportUrl,
|
|
|
+ success: handleSuccess,
|
|
|
+ },
|
|
|
+ });
|
|
|
|
|
|
- const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
|
|
|
+ const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
|
|
|
|
|
// 高级查询配置
|
|
|
const superQueryConfig = reactive(superQuerySchema);
|
|
@@ -103,91 +140,130 @@
|
|
|
reload();
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 新增事件
|
|
|
- */
|
|
|
+ /**
|
|
|
+ * 新增事件
|
|
|
+ */
|
|
|
function handleAdd() {
|
|
|
- openModal(true, {
|
|
|
- isUpdate: false,
|
|
|
- showFooter: true,
|
|
|
- });
|
|
|
+ openModal(true, {
|
|
|
+ isUpdate: false,
|
|
|
+ showFooter: true,
|
|
|
+ });
|
|
|
}
|
|
|
- /**
|
|
|
- * 编辑事件
|
|
|
- */
|
|
|
+ /**
|
|
|
+ * 编辑事件
|
|
|
+ */
|
|
|
function handleEdit(record: Recordable) {
|
|
|
- openModal(true, {
|
|
|
- record,
|
|
|
- isUpdate: true,
|
|
|
- showFooter: true,
|
|
|
- });
|
|
|
- }
|
|
|
- /**
|
|
|
- * 详情
|
|
|
+ openModal(true, {
|
|
|
+ record,
|
|
|
+ isUpdate: true,
|
|
|
+ showFooter: true,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 详情
|
|
|
*/
|
|
|
function handleDetail(record: Recordable) {
|
|
|
- openModal(true, {
|
|
|
- record,
|
|
|
- isUpdate: true,
|
|
|
- showFooter: false,
|
|
|
- });
|
|
|
- }
|
|
|
- /**
|
|
|
- * 删除事件
|
|
|
- */
|
|
|
+ openModal(true, {
|
|
|
+ record,
|
|
|
+ isUpdate: true,
|
|
|
+ showFooter: false,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 删除事件
|
|
|
+ */
|
|
|
async function handleDelete(record) {
|
|
|
- await deleteOne({id: record.id}, handleSuccess);
|
|
|
- }
|
|
|
- /**
|
|
|
- * 批量删除事件
|
|
|
- */
|
|
|
+ await deleteOne({ id: record.id }, handleSuccess);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 批量删除事件
|
|
|
+ */
|
|
|
async function batchHandleDelete() {
|
|
|
- await batchDelete({ids: selectedRowKeys.value},handleSuccess);
|
|
|
- }
|
|
|
- /**
|
|
|
- * 成功回调
|
|
|
- */
|
|
|
+ await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 成功回调
|
|
|
+ */
|
|
|
function handleSuccess() {
|
|
|
- (selectedRowKeys.value = []) && reload();
|
|
|
- }
|
|
|
- /**
|
|
|
- * 操作栏
|
|
|
- */
|
|
|
- function getTableAction(record){
|
|
|
- return [
|
|
|
- {
|
|
|
- label: '编辑',
|
|
|
- onClick: handleEdit.bind(null, record),
|
|
|
- auth: 'saleCode:sale_interface_sync:edit'
|
|
|
- }
|
|
|
- ]
|
|
|
- }
|
|
|
-
|
|
|
+ (selectedRowKeys.value = []) && reload();
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 操作栏
|
|
|
+ */
|
|
|
+ function getTableAction(record) {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ label: '编辑',
|
|
|
+ onClick: handleEdit.bind(null, record),
|
|
|
+ auth: 'saleCode:sale_interface_sync:edit',
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 下拉操作栏
|
|
|
*/
|
|
|
- function getDropDownAction(record){
|
|
|
+ function getDropDownAction(record) {
|
|
|
return [
|
|
|
{
|
|
|
label: '详情',
|
|
|
onClick: handleDetail.bind(null, record),
|
|
|
- }, {
|
|
|
+ },
|
|
|
+ {
|
|
|
label: '删除',
|
|
|
popConfirm: {
|
|
|
title: '是否确认删除',
|
|
|
confirm: handleDelete.bind(null, record),
|
|
|
- placement: 'topLeft'
|
|
|
+ placement: 'topLeft',
|
|
|
},
|
|
|
- auth: 'saleCode:sale_interface_sync:delete'
|
|
|
- }
|
|
|
- ]
|
|
|
+ auth: 'saleCode:sale_interface_sync:delete',
|
|
|
+ },
|
|
|
+ ];
|
|
|
}
|
|
|
|
|
|
+ const syncVisiable = ref(false);
|
|
|
+ const syncForm = ref({});
|
|
|
+ const syncRules = {
|
|
|
+ requestedDeliveryDate: [{ required: true, message: '请选择开始时间', trigger: 'blur' }],
|
|
|
+ adviseBeforeDate: [{ required: true, message: '请选择结束时间', trigger: 'blur' }],
|
|
|
+ };
|
|
|
+ const syncFormRef = ref();
|
|
|
+ const labelCol = { span: 5 };
|
|
|
+ const wrapperCol = { span: 13 };
|
|
|
+ const showSyncModal = () => {
|
|
|
+ syncForm.value = {};
|
|
|
+ syncVisiable.value = true;
|
|
|
+ };
|
|
|
+ const handleSyncOk = () => {
|
|
|
+ syncFormRef.value.validate().then(() => {
|
|
|
+ getData(syncForm.value).then((res) => {
|
|
|
+ syncVisiable.value = false;
|
|
|
+ handleSuccess();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ const handleSyncOrder = () => {
|
|
|
+ if (selectedRowKeys.value.length == 0) {
|
|
|
+ message.warning('请选择要同步的数据!');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ createConfirm({
|
|
|
+ iconType: 'warning',
|
|
|
+ title: '提示',
|
|
|
+ content: '确定要同步订单吗?',
|
|
|
+ onOk: () => {
|
|
|
+ getSyncOrder({ ids: selectedRowKeys.value.join(',') }).then((res) => {
|
|
|
+ handleSuccess();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ });
|
|
|
+ };
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
- :deep(.ant-picker),:deep(.ant-input-number){
|
|
|
+ :deep(.ant-picker),
|
|
|
+ :deep(.ant-input-number) {
|
|
|
width: 100%;
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|