|
@@ -0,0 +1,598 @@
|
|
|
+<template>
|
|
|
+ <a-spin :spinning="loading">
|
|
|
+ <JFormContainer :disabled="disabled">
|
|
|
+ <template #detail>
|
|
|
+ <a-form v-bind="formItemLayout" name="quotationFormForm" ref="formRef">
|
|
|
+ <a-row>
|
|
|
+ <a-col :span="12">
|
|
|
+ <a-form-item label="单据日期(bill date)" v-bind="validateInfos.billDate" id="quotationFormForm-billDate" name="billDate">
|
|
|
+ <a-date-picker placeholder="请选择单据日期(bill date)" v-model:value="formData.billDate" value-format="YYYY-MM-DD" disabled style="width: 100%" allow-clear />
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12">
|
|
|
+ <a-form-item label="报价单号(bill code)" v-bind="validateInfos.billCode" id="quotationFormForm-billCode" name="billCode" :labelCol="formItemLayout.labelCol1" :wrapperCol="formItemLayout.wrapperCol1">
|
|
|
+ <a-input v-model:value="formData.billCode" placeholder="请输入报价单号(bill code)" ></a-input>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12">
|
|
|
+ <a-form-item label="报价项目(quotation project)" v-bind="validateInfos.quotationProjectName" id="quotationFormForm-quotationProjectName" name="quotationProjectName">
|
|
|
+ <a-input-search v-model:value="formData.quotationProjectName" placeholder="请输入报价项目(inquiry project)" allow-clear enter-button="Search" @search="onSearchProject"></a-input-search>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12">
|
|
|
+ <a-form-item label="报价客户(quotation customer)" v-bind="validateInfos.quotationCustomer" id="quotationFormForm-quotationCustomer" name="quotationCustomer" :labelCol="formItemLayout.labelCol1" :wrapperCol="formItemLayout.wrapperCol1">
|
|
|
+ <JSelectInput v-model:value="formData.quotationCustomer" placeholder="请选择" :options="customerOption" disabled></JSelectInput>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12">
|
|
|
+ <a-form-item label="报价有效期(quotation period)" v-bind="validateInfos.quotationPeriod" id="quotationFormForm-quotationPeriod" name="quotationPeriod">
|
|
|
+ <a-range-picker v-model:value="quotationPeriod" :format="['YYYY-MM-DD','YYYY-MM-DD']" @change="onChangequotationPeriod" style="width: 100%" />
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12">
|
|
|
+ <a-form-item label="业务类型(busyness type)" v-bind="validateInfos.busynessType" id="quotationFormForm-busynessType" name="busynessType" :labelCol="formItemLayout.labelCol1" :wrapperCol="formItemLayout.wrapperCol1">
|
|
|
+ <JDictSelectTag v-model:value="formData.busynessType" placeholder="请选择" dictCode="busyness_type"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12">
|
|
|
+ <a-form-item label="优先级(priority)" v-bind="validateInfos.priority" id="quotationFormForm-priority" name="priority">
|
|
|
+ <JDictSelectTag v-model:value="formData.priority" placeholder="请选择" dictCode="priority"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12">
|
|
|
+ <a-form-item label="产品分类(production class)" v-bind="validateInfos.productionClass" id="quotationFormForm-productionClass" name="productionClass" :labelCol="formItemLayout.labelCol1" :wrapperCol="formItemLayout.wrapperCol1">
|
|
|
+ <JSelectInput v-model:value="formData.productionClass" placeholder="请选择" :options="classOption"></JSelectInput>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12">
|
|
|
+ <a-form-item label="机型(model)" v-bind="validateInfos.model" id="quotationFormForm-model" name="model">
|
|
|
+ <JSelectMultiple v-model:value="formData.model" placeholder="请选择" dictCode="model_typer"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12">
|
|
|
+ <a-form-item label="厂家(maker)" v-bind="validateInfos.maker" id="quotationFormForm-maker" name="maker" :labelCol="formItemLayout.labelCol1" :wrapperCol="formItemLayout.wrapperCol1">
|
|
|
+ <a-input v-model:value="formData.maker" placeholder="请输入厂家(maker)" allow-clear ></a-input>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12">
|
|
|
+ <a-form-item label="币种(currency)" v-bind="validateInfos.currency" id="quotationFormForm-currency" name="currency">
|
|
|
+ <JDictSelectTag v-model:value="formData.currency" placeholder="请选择" dictCode="currency" />
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12">
|
|
|
+ <a-form-item label="贸易方式(delivery terms)" v-bind="validateInfos.deliveryTerms" id="quotationFormForm-deliveryTerms" name="deliveryTerms" :labelCol="formItemLayout.labelCol1" :wrapperCol="formItemLayout.wrapperCol1">
|
|
|
+ <JDictSelectTag v-model:value="formData.deliveryTerms" placeholder="请选择" dictCode="delivery_terms"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12">
|
|
|
+ <a-form-item label="交期(delivery time)" v-bind="validateInfos.deliveryTime" id="quotationFormForm-deliveryTime" name="deliveryTime">
|
|
|
+ <a-date-picker placeholder="请选择交期(delivery time)" v-model:value="formData.deliveryTime" @change="changeDelivertTime" value-format="YYYY-MM-DD" format="YYYY-MM-DD" style="width: 100%" allow-clear />
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12">
|
|
|
+ <a-form-item label="付款条件(payment terms)" v-bind="validateInfos.paymentTerms" id="quotationFormForm-paymentTerms" name="paymentTerms" :labelCol="formItemLayout.labelCol1" :wrapperCol="formItemLayout.wrapperCol1">
|
|
|
+ <JDictSelectTag v-model:value="formData.paymentTerms" placeholder="请选择" dictCode="payment_terms"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12">
|
|
|
+ <a-form-item label="交货地点(place of delivery)" v-bind="validateInfos.placeDelivery" id="quotationFormForm-placeDelivery" name="placeDelivery">
|
|
|
+ <a-input v-model:value="formData.placeDelivery" placeholder="请输入交货地点(place of delivery)" allow-clear ></a-input>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12">
|
|
|
+ <a-form-item label="客户折扣(custumer discount)" v-bind="validateInfos.custumerDiscount" id="quotationFormForm-custumerDiscount" name="custumerDiscount" :labelCol="formItemLayout.labelCol1" :wrapperCol="formItemLayout.wrapperCol1">
|
|
|
+ <a-input v-model:value="formData.custumerDiscount" placeholder="请输入客户折扣(custumer discount)" allow-clear ></a-input>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12">
|
|
|
+ <a-form-item label="销售部门(sale department)" v-bind="validateInfos.saleDepartment" id="SaleInquiryFormForm-saleDepartment" name="saleDepartment">
|
|
|
+ <a-input v-model:value="formData.saleDepartment" placeholder="" allow-clear disabled></a-input>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12">
|
|
|
+ <a-form-item label="包装方式(packaging method)" v-bind="validateInfos.packagingMethod" id="quotationFormForm-packagingMethod" name="packagingMethod" :labelCol="formItemLayout.labelCol1" :wrapperCol="formItemLayout.wrapperCol1">
|
|
|
+ <a-input v-model:value="formData.packagingMethod" placeholder="请输入包装方式(packaging method)" allow-clear ></a-input>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12">
|
|
|
+ <a-form-item label="业务员(salesman)" v-bind="validateInfos.salesman" id="quotationFormForm-salesman" name="salesman">
|
|
|
+ <a-input v-model:value="formData.salesman" placeholder="" allow-clear disabled></a-input>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12">
|
|
|
+ <a-form-item label="报价备注(quotation notes)" v-bind="validateInfos.quotationNotes" id="quotationFormForm-quotationNotes" name="quotationNotes" :labelCol="formItemLayout.labelCol1" :wrapperCol="formItemLayout.wrapperCol1">
|
|
|
+ <a-input v-model:value="formData.quotationNotes" placeholder="请输入报价备注(quotation notes)" allow-clear ></a-input>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12">
|
|
|
+ <a-form-item label="附件(attachs)" v-bind="validateInfos.attachs" id="quotationFormForm-attachs" name="attachs">
|
|
|
+ <JUpload v-model:value="formData.attachs"></JUpload>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12">
|
|
|
+ <a-form-item label="供应商技术资料(supplier quotation attachs)" v-bind="validateInfos.supplierAttachs" id="quotationFormForm-supplierAttachs" name="supplierAttachs" :labelCol="formItemLayout.labelCol1" :wrapperCol="formItemLayout.wrapperCol1">
|
|
|
+ <a :href="baseUrl+formData.supplierAttachs" v-if="formData.supplierAttachs">{{formData.supplierAttachs}}</a>
|
|
|
+ <a-input v-model:value="formData.supplierAttachs" disabled v-if="!formData.supplierAttachs"></a-input>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </a-form>
|
|
|
+ </template>
|
|
|
+ </JFormContainer>
|
|
|
+
|
|
|
+ <!-- 子表单区域 -->
|
|
|
+ <a-tabs v-model:activeKey="activeKey" animated style=" padding: 24px;padding-top: 0px;">
|
|
|
+ <a-tab-pane tab="报价单子表 - 船明细(ship details)" key="saleQuotationFormShip" :forceRender="true">
|
|
|
+ <a-button type="primary" @click="selectShip"> 选择船(select ship)</a-button>
|
|
|
+ <j-vxe-table
|
|
|
+ :keep-source="true"
|
|
|
+ resizable
|
|
|
+ ref="saleQuotationFormShipTableRef"
|
|
|
+ :loading="saleQuotationFormShipTable.loading"
|
|
|
+ :columns="saleQuotationFormShipTable.columns"
|
|
|
+ :dataSource="saleQuotationFormShipTable.dataSource"
|
|
|
+ :height="340"
|
|
|
+ :disabled="disabled"
|
|
|
+ :rowNumber="true"
|
|
|
+ :rowSelection="true"
|
|
|
+ >
|
|
|
+ <template #action="props" >
|
|
|
+ <a @click="viewAccessory(props)" >查看配件信息(view accessory information)</a>
|
|
|
+ <a-divider type="vertical"/>
|
|
|
+ <a-popconfirm title="确定删除吗?" @confirm="handleDelete(props)">
|
|
|
+ <a>删除(delete)</a>
|
|
|
+ </a-popconfirm>
|
|
|
+ </template>
|
|
|
+ </j-vxe-table>
|
|
|
+ </a-tab-pane>
|
|
|
+ <a-tab-pane tab="报价单 - 产品明细(product details)" key="saleQuotationFormProduct" :forceRender="true">
|
|
|
+ <a-button type="primary" @click="selectProducts" style="margin-right: 1%;margin-bottom: 1%;"> 选择产品(select product)</a-button>
|
|
|
+ <!-- <a-button type="primary" @click="chooseSupplier"> 选择供应商报价(selete supplier quotation)</a-button> -->
|
|
|
+ <j-vxe-table
|
|
|
+ :keep-source="true"
|
|
|
+ resizable
|
|
|
+ ref="saleQuotationFormProductTableRef"
|
|
|
+ :loading="saleQuotationFormProductTable.loading"
|
|
|
+ :columns="saleQuotationFormProductTable.columns"
|
|
|
+ :dataSource="saleQuotationFormProductTable.dataSource"
|
|
|
+ :height="340"
|
|
|
+ :disabled="disabled"
|
|
|
+ :rowNumber="true"
|
|
|
+ :rowSelection="true"
|
|
|
+ asyncRemove
|
|
|
+ >
|
|
|
+ <template #lastPrice="props">
|
|
|
+ <a @click="viewHistory">{{ props.row.lastPrice }}</a>
|
|
|
+ </template>
|
|
|
+ <template #action="props">
|
|
|
+ <a-popconfirm title="确定删除吗?" @confirm="handleDelete1(props)">
|
|
|
+ <a>删除(delete)</a>
|
|
|
+ </a-popconfirm>
|
|
|
+ </template>
|
|
|
+ </j-vxe-table>
|
|
|
+ </a-tab-pane>
|
|
|
+ </a-tabs>
|
|
|
+ <SelectShipSModal ref="SelectShipSModalRef" @select="addShip"></SelectShipSModal>
|
|
|
+ <BaseShipArchiveAccessoriesList ref="BaseShipArchiveAccessoriesListRef"></BaseShipArchiveAccessoriesList>
|
|
|
+ <SelectPrpductModal ref="SelectPrpductModalRef" @selectProduct="addProduct"></SelectPrpductModal>
|
|
|
+ <SelectProjectModal ref="SelectProjectModalRef" @selectProject="addProject"></SelectProjectModal>
|
|
|
+ <ViewHistoryQuotationModal ref="ViewHistoryQuotationModalRef" ></ViewHistoryQuotationModal>
|
|
|
+ </a-spin>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script lang="ts">
|
|
|
+ import { defineComponent, ref, reactive, computed, toRaw, onMounted } from 'vue';
|
|
|
+ import { defHttp } from '/@/utils/http/axios';
|
|
|
+ import { useValidateAntFormAndTable } from '/@/hooks/system/useJvxeMethods';
|
|
|
+ import { querysaleQuotationFormShipListByMainId,querysaleVersonFormShipListByMainId,querySaleQuotationFormProductListByMainId, querySaleVersonProductListByMainId,queryDataById, saveOrUpdate,HistoryQuotation,queryVersonHistoryById } from '../quotationForm.api';
|
|
|
+ import { JVxeTable } from '/@/components/jeecg/JVxeTable';
|
|
|
+ import {saleQuotationFormShipColumns, saleQuotationFormProductColumns} from '../quotationForm.data';
|
|
|
+ import SelectShipSModal from './SelectShipSModal.vue';
|
|
|
+ import BaseShipArchiveAccessoriesList from './BaseShipArchiveAccessoriesModal.vue';
|
|
|
+ import SelectPrpductModal from './SelectPrpductModal.vue';
|
|
|
+ import SelectProjectModal from './SelectProjectModal.vue';
|
|
|
+ import ViewHistoryQuotationModal from './ViewHistoryQuotationModal.vue';
|
|
|
+ import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
|
|
|
+ import JUpload from '/@/components/Form/src/jeecg/components/JUpload/JUpload.vue';
|
|
|
+ import { JDictSelectTag,JSelectMultiple} from '/@/components/Form';
|
|
|
+ import JSelectInput from '/@/components/Form/src/jeecg/components/JSelectInput.vue';
|
|
|
+ import { Form } from 'ant-design-vue';
|
|
|
+ import { useUserStore } from '/@/store/modules/user';
|
|
|
+ import moment from 'moment';
|
|
|
+ import { useGlobSetting } from '/@/hooks/setting';
|
|
|
+ const { domainUrl } = useGlobSetting();
|
|
|
+ const userStore = useUserStore();
|
|
|
+ const useForm = Form.useForm;
|
|
|
+ export default defineComponent({
|
|
|
+ name: "quotationFormForm",
|
|
|
+ components:{
|
|
|
+ JVxeTable,
|
|
|
+ JFormContainer,
|
|
|
+ SelectShipSModal,
|
|
|
+ BaseShipArchiveAccessoriesList,
|
|
|
+ SelectPrpductModal,
|
|
|
+ JUpload,
|
|
|
+ SelectProjectModal,
|
|
|
+ ViewHistoryQuotationModal,
|
|
|
+ JDictSelectTag,
|
|
|
+ JSelectInput,
|
|
|
+ JSelectMultiple
|
|
|
+ },
|
|
|
+ props:{
|
|
|
+ formDisabled:{
|
|
|
+ type: Boolean,
|
|
|
+ default: false
|
|
|
+ },
|
|
|
+ formData: { type: Object, default: ()=>{} },
|
|
|
+ formBpm: { type: Boolean, default: true }
|
|
|
+ },
|
|
|
+ emits:['success'],
|
|
|
+ setup(props, {emit}) {
|
|
|
+ const baseUrl = domainUrl + '/sys/common/static/';
|
|
|
+ const loading = ref(false);
|
|
|
+ const formRef = ref();
|
|
|
+ var SelectPrpductModalRef = ref()
|
|
|
+ var SelectProjectModalRef = ref()
|
|
|
+ var ViewHistoryQuotationModalRef = ref()
|
|
|
+ var quotationPeriod = ref([])
|
|
|
+ const saleQuotationFormShipTableRef = ref();
|
|
|
+ const saleQuotationFormShipTable = reactive<Record<string, any>>({
|
|
|
+ loading: false,
|
|
|
+ columns:saleQuotationFormShipColumns,
|
|
|
+ dataSource: []
|
|
|
+ });
|
|
|
+ const saleQuotationFormProductTableRef = ref();
|
|
|
+ const saleQuotationFormProductTable = reactive<Record<string, any>>({
|
|
|
+ loading: false,
|
|
|
+ columns: saleQuotationFormProductColumns,
|
|
|
+ dataSource: []
|
|
|
+ });
|
|
|
+ var SelectShipSModalRef = ref();
|
|
|
+ var BaseShipArchiveAccessoriesListRef = ref();
|
|
|
+ const activeKey = ref('saleQuotationFormShip');
|
|
|
+ var classOption = ref([]);
|
|
|
+ var customerOption =ref([]);
|
|
|
+ const formData = reactive<Record<string, any>>({
|
|
|
+ id: '',
|
|
|
+ status: undefined,
|
|
|
+ delFlag: undefined,
|
|
|
+ otherStatus: '',
|
|
|
+ submit: '',
|
|
|
+ billDate: moment(new Date()).format('YYYY-MM-DD'),
|
|
|
+ billCode: '',
|
|
|
+ quotationProject: '',
|
|
|
+ quotationProjectName: '',
|
|
|
+ quotationCustomer: '',
|
|
|
+ quotationCustomerName: '',
|
|
|
+ quotationPeriodBegin: '',
|
|
|
+ quotationPeriodEnd: '',
|
|
|
+ busynessType: '',
|
|
|
+ priority: '',
|
|
|
+ productionClass: '',
|
|
|
+ model: '',
|
|
|
+ maker: '',
|
|
|
+ currency:"",
|
|
|
+ deliveryTerms: '',
|
|
|
+ deliveryTime: '',
|
|
|
+ paymentTerms: '',
|
|
|
+ placeDelivery: '',
|
|
|
+ custumerDiscount: '',
|
|
|
+ saleDepartment:'',
|
|
|
+ packagingMethod:'',
|
|
|
+ salesman: '',
|
|
|
+ quotationNotes:"",
|
|
|
+ attachs: '',
|
|
|
+ supplierAttachs: '',
|
|
|
+ });
|
|
|
+
|
|
|
+ //表单验证
|
|
|
+ const validatorRules = reactive({
|
|
|
+ });
|
|
|
+ const {resetFields, validate, validateInfos} = useForm(formData, validatorRules, {immediate: false});
|
|
|
+ const dbData = {};
|
|
|
+ const formItemLayout = {
|
|
|
+ labelCol: {xs: {span: 24}, sm: {span: 8}},
|
|
|
+ wrapperCol: {xs: {span: 24}, sm: {span: 13}},
|
|
|
+ labelCol1: {xs: {span: 24}, sm: {span: 8}},
|
|
|
+ wrapperCol1: {xs: {span: 24}, sm: {span: 13}},
|
|
|
+ };
|
|
|
+
|
|
|
+ // 表单禁用
|
|
|
+ const disabled = computed(()=>{
|
|
|
+ if(props.formBpm === true){
|
|
|
+ if(props.formData.disabled === false){
|
|
|
+ return false;
|
|
|
+ }else{
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return props.formDisabled;
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ function add() {
|
|
|
+ resetFields();
|
|
|
+ saleQuotationFormShipTable.dataSource = [];
|
|
|
+ saleQuotationFormProductTable.dataSource = [];
|
|
|
+ activeKey.value = 'saleQuotationFormShip'
|
|
|
+ getOptiom()
|
|
|
+ getCustomerOptions()
|
|
|
+ quotationPeriod.value = []
|
|
|
+ formData.salesman=userStore.getUserInfo.username;
|
|
|
+ formData.saleDepartment = userStore.getUserInfo.orgCode
|
|
|
+ }
|
|
|
+
|
|
|
+ async function edit(row) {
|
|
|
+ //主表数据
|
|
|
+ await queryMainData(row.id);
|
|
|
+ //子表数据
|
|
|
+ const saleQuotationFormShipDataList = await querysaleQuotationFormShipListByMainId(row['id']);
|
|
|
+ saleQuotationFormShipTable.dataSource = [...saleQuotationFormShipDataList];
|
|
|
+ const saleQuotationFormProductDataList = await querySaleQuotationFormProductListByMainId(row['id']);
|
|
|
+ saleQuotationFormProductTable.dataSource = [...saleQuotationFormProductDataList];
|
|
|
+ getOptiom()
|
|
|
+ getCustomerOptions()
|
|
|
+ quotationPeriod.value[0]=formData.quotationPeriodBegin?moment(formData.quotationPeriodBegin):''
|
|
|
+ quotationPeriod.value[1]=formData.quotationPeriodEnd?moment(formData.quotationPeriodEnd):''
|
|
|
+
|
|
|
+ }
|
|
|
+ async function queryMainData(id) {
|
|
|
+ const row = await queryDataById(id);
|
|
|
+ resetFields();
|
|
|
+ const tmpData = {};
|
|
|
+ Object.keys(formData).forEach((key) => {
|
|
|
+ if(row.hasOwnProperty(key)){
|
|
|
+ tmpData[key] = row[key]
|
|
|
+ }
|
|
|
+ })
|
|
|
+ //赋值
|
|
|
+ Object.assign(formData,tmpData);
|
|
|
+ }
|
|
|
+
|
|
|
+ const {getSubFormAndTableData, transformData} = useValidateAntFormAndTable(activeKey, {
|
|
|
+ 'saleQuotationShip': saleQuotationFormShipTableRef,
|
|
|
+ 'saleQuotationProduct': saleQuotationFormProductTableRef,
|
|
|
+ });
|
|
|
+
|
|
|
+ async function getFormData() {
|
|
|
+ try {
|
|
|
+ // 触发表单验证
|
|
|
+ await validate();
|
|
|
+ } catch ({ errorFields }) {
|
|
|
+ if (errorFields) {
|
|
|
+ const firstField = errorFields[0];
|
|
|
+ if (firstField) {
|
|
|
+ formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return Promise.reject(errorFields);
|
|
|
+ }
|
|
|
+ return transformData(toRaw(formData))
|
|
|
+ }
|
|
|
+
|
|
|
+ async function submitForm() {
|
|
|
+ const mainData = await getFormData();
|
|
|
+ const subData = await getSubFormAndTableData();
|
|
|
+ const values = Object.assign({}, dbData, mainData, subData);
|
|
|
+ console.log('表单提交数据', values)
|
|
|
+ const isUpdate = values.id ? true : false
|
|
|
+ const isRevise = values.status=='1' ? true : false
|
|
|
+ await saveOrUpdate(values, isUpdate,isRevise);
|
|
|
+ //关闭弹窗
|
|
|
+ emit('success');
|
|
|
+ }
|
|
|
+
|
|
|
+ function setFieldsValue(values) {
|
|
|
+ if(values){
|
|
|
+ Object.keys(values).map(k=>{
|
|
|
+ formData[k] = values[k];
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 值改变事件触发-树控件回调
|
|
|
+ * @param key
|
|
|
+ * @param value
|
|
|
+ */
|
|
|
+ function handleFormChange(key, value) {
|
|
|
+ formData[key] = value;
|
|
|
+ }
|
|
|
+ async function handleDelete(prop) {
|
|
|
+ var newArray = [...saleQuotationFormShipTable.dataSource]
|
|
|
+ newArray.splice(prop.rowIndex, 1)
|
|
|
+ saleQuotationFormShipTable.dataSource = newArray
|
|
|
+ }
|
|
|
+ async function handleDelete1(prop) {
|
|
|
+ var newArray = [...saleQuotationFormProductTable.dataSource]
|
|
|
+ newArray.splice(prop.rowIndex, 1)
|
|
|
+ saleQuotationFormProductTable.dataSource = newArray
|
|
|
+ }
|
|
|
+ function selectShip(){
|
|
|
+ SelectShipSModalRef.value.getTable()
|
|
|
+ }
|
|
|
+ function addShip(data){
|
|
|
+ var arr = data.concat(saleQuotationFormShipTable.dataSource)
|
|
|
+ arr.map(item=>item.shipowner = item.relateCustomer)
|
|
|
+ saleQuotationFormShipTable.dataSource=arr
|
|
|
+ }
|
|
|
+ function addProduct(data){
|
|
|
+ var arrProduct = data.concat(saleQuotationFormProductTable.dataSource)
|
|
|
+ arrProduct.map(item=>{
|
|
|
+ item.productClass = item.classId_dictText
|
|
|
+ item.productCode = item.code
|
|
|
+ item.unit = item.measurementUnit
|
|
|
+ item.deliveryTime = formData.deliveryTime
|
|
|
+ })
|
|
|
+ saleQuotationFormProductTable.dataSource=arrProduct
|
|
|
+ }
|
|
|
+ function addProject(data) {
|
|
|
+ formData.quotationProject = data[0].id
|
|
|
+ formData.quotationProjectName = data[0].name
|
|
|
+ formData.quotationCustomer =data[0].customerId
|
|
|
+ formData.quotationCustomerName =data[0].customerId_dictText
|
|
|
+ customerOption.value.map(item=>{
|
|
|
+ if(item.value==data[0].customerId){
|
|
|
+ formData.priority =item.priority
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ function getCustomerOptions(){
|
|
|
+ let params = {pageSize:'-1',status:1}
|
|
|
+ defHttp.get({url:'/cuspCode/cuspCustomerProfile/list',params}, { isTransformResponse: false }).then(res=>{
|
|
|
+ if(res){
|
|
|
+ customerOption.value = []
|
|
|
+ res.result.records.forEach(item=>{
|
|
|
+ customerOption.value.push({
|
|
|
+ label: item.name,
|
|
|
+ value: item.id,
|
|
|
+ priority:item.priority
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ function viewAccessory(prop){
|
|
|
+ BaseShipArchiveAccessoriesListRef.value.getTable(prop.row)
|
|
|
+ }
|
|
|
+ function selectProducts(){
|
|
|
+ SelectPrpductModalRef.value.getTable()
|
|
|
+ }
|
|
|
+ function onSearchProject(){
|
|
|
+ SelectProjectModalRef.value.getTable()
|
|
|
+ }
|
|
|
+ function getOptiom(){
|
|
|
+ defHttp
|
|
|
+ .get({ url: 'baseCode/baseProductClass/list'}, { isTransformResponse: false })
|
|
|
+ .then((res) => {
|
|
|
+ if (res.success) {
|
|
|
+ classOption.value = []
|
|
|
+ res.result.records.forEach(element => {
|
|
|
+ var obj = {
|
|
|
+ label: element.name?element.name:'无名称请维护',
|
|
|
+ value: element.id?element.id:''
|
|
|
+ };
|
|
|
+ classOption.value.push( obj)
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ // loading.value = false;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ function onChangequotationPeriod(data){
|
|
|
+ quotationPeriod.value = data
|
|
|
+ formData.quotationPeriodBegin = data[0].format('YYYY-MM-DD')
|
|
|
+ formData.quotationPeriodEnd = data[1].format('YYYY-MM-DD')
|
|
|
+ }
|
|
|
+ function chooseSupplier(){
|
|
|
+
|
|
|
+ }
|
|
|
+ function changeDelivertTime(prop){
|
|
|
+ if(saleQuotationFormProductTable.dataSource.length>0){
|
|
|
+ var newArr = [...saleQuotationFormProductTable.dataSource]
|
|
|
+ newArr.map(item=>{
|
|
|
+ item.deliveryTime = prop
|
|
|
+ })
|
|
|
+ saleQuotationFormProductTable.dataSource = newArr
|
|
|
+ }
|
|
|
+ }
|
|
|
+ function viewHistory(){
|
|
|
+ ViewHistoryQuotationModalRef.value.getTable()
|
|
|
+ }
|
|
|
+ async function VersionDetail(record){
|
|
|
+ //主表数据
|
|
|
+ await queryVersonHistoryData(record.id);
|
|
|
+ //子表数据
|
|
|
+ const saleQuotationFormShipDataList = await querysaleVersonFormShipListByMainId(record.id);
|
|
|
+ saleQuotationFormShipTable.dataSource = [...saleQuotationFormShipDataList];
|
|
|
+ const saleQuotationFormProductDataList = await querySaleVersonProductListByMainId(record.id);
|
|
|
+ saleQuotationFormProductTable.dataSource = [...saleQuotationFormProductDataList];
|
|
|
+ getOptiom()
|
|
|
+ getCustomerOptions()
|
|
|
+ quotationPeriod.value[0]=formData.quotationPeriodBegin?moment(formData.quotationPeriodBegin):''
|
|
|
+ quotationPeriod.value[1]=formData.quotationPeriodEnd?moment(formData.quotationPeriodEnd):''
|
|
|
+ }
|
|
|
+ async function queryVersonHistoryData(id){
|
|
|
+ const row = await queryVersonHistoryById(id);
|
|
|
+ resetFields();
|
|
|
+ const tmpData = {};
|
|
|
+ Object.keys(formData).forEach((key) => {
|
|
|
+ if(row.hasOwnProperty(key)){
|
|
|
+ tmpData[key] = row[key]
|
|
|
+ }
|
|
|
+ })
|
|
|
+ //赋值
|
|
|
+ Object.assign(formData,tmpData);
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ saleQuotationFormShipTableRef,
|
|
|
+ saleQuotationFormShipTable,
|
|
|
+ saleQuotationFormProductTableRef,
|
|
|
+ saleQuotationFormProductTable,
|
|
|
+ validatorRules,
|
|
|
+ validateInfos,
|
|
|
+ activeKey,
|
|
|
+ loading,
|
|
|
+ formData,
|
|
|
+ setFieldsValue,
|
|
|
+ handleFormChange,
|
|
|
+ formItemLayout,
|
|
|
+ disabled,
|
|
|
+ getFormData,
|
|
|
+ submitForm,
|
|
|
+ SelectShipSModalRef,
|
|
|
+ add,
|
|
|
+ edit,
|
|
|
+ formRef,
|
|
|
+ selectShip,
|
|
|
+ addShip,
|
|
|
+ addProduct,
|
|
|
+ BaseShipArchiveAccessoriesListRef,
|
|
|
+ viewAccessory,
|
|
|
+ handleDelete,
|
|
|
+ handleDelete1,
|
|
|
+ selectProducts,
|
|
|
+ SelectPrpductModalRef,
|
|
|
+ SelectProjectModalRef,
|
|
|
+ ViewHistoryQuotationModalRef,
|
|
|
+ onSearchProject,
|
|
|
+ addProject,
|
|
|
+ getOptiom,
|
|
|
+ classOption,
|
|
|
+ getCustomerOptions,
|
|
|
+ customerOption,
|
|
|
+ quotationPeriod,
|
|
|
+ onChangequotationPeriod,
|
|
|
+ chooseSupplier,
|
|
|
+ changeDelivertTime,
|
|
|
+ viewHistory,
|
|
|
+ baseUrl,
|
|
|
+ VersionDetail,
|
|
|
+ queryVersonHistoryData
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+</script>
|
|
|
+<style lang="less" scoped>
|
|
|
+ /** 时间和数字输入框样式 */
|
|
|
+ :deep(.ant-input-number) {
|
|
|
+ width: 100%;
|
|
|
+ }
|
|
|
+
|
|
|
+ :deep(.ant-calendar-picker) {
|
|
|
+ width: 100%;
|
|
|
+ }
|
|
|
+ /deep/.vxe-table--body-wrapper{
|
|
|
+ height: 100% !important;
|
|
|
+ }
|
|
|
+ /deep/.ant-modal-body{
|
|
|
+ padding: 24px !important;
|
|
|
+ }
|
|
|
+
|
|
|
+ /deep/.ant-form-item{
|
|
|
+ margin-bottom: 8px !important;
|
|
|
+ }
|
|
|
+
|
|
|
+</style>
|