|
@@ -0,0 +1,384 @@
|
|
|
+<template>
|
|
|
+ <a-spin :spinning="loading">
|
|
|
+ <JFormContainer :disabled="disabled">
|
|
|
+ <template #detail>
|
|
|
+ <a-form v-bind="formItemLayout" name="SelectQuotationFormForm" ref="formRef">
|
|
|
+ <a-row>
|
|
|
+ <a-col :span="12">
|
|
|
+ <a-form-item label="选定单号(bill code)" v-bind="validateInfos.billCode" id="SelectQuotationFormForm-billCode" name="billCode">
|
|
|
+ <a-input v-model:value="formData.billCode" placeholder="请输入报价单号(bill code)" disabled></a-input>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12">
|
|
|
+ <a-form-item label="单据日期(bill date)" v-bind="validateInfos.billDate" id="SelectQuotationFormForm-billDate" name="billDate">
|
|
|
+ <a-date-picker placeholder="请选择单据日期(bill date)" v-model:value="formData.billDate" value-format="YYYY-MM-DD" style="width: 100%" allow-clear />
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+
|
|
|
+ <a-col :span="12">
|
|
|
+ <a-form-item label="询价项目(inquiry project)" v-bind="validateInfos.projectName" id="SelectQuotationFormForm-projectName" name="projectName">
|
|
|
+ <a-input-search v-model:value="formData.projectName" placeholder="请输入报价项目(inquiry project)" :disabled="SelectQuotationFormProductTable.dataSource.length!==0" allow-clear enter-button="Search" @search="onSearchProject"></a-input-search>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12">
|
|
|
+ <a-form-item label="优先级(priority)" v-bind="validateInfos.priority" id="SelectQuotationFormForm-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="SelectQuotationFormForm-productionClass" name="productionClass">
|
|
|
+ <a-input v-model:value="formData.productionClass" placeholder="请输入" allow-clear disabled></a-input>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12">
|
|
|
+ <a-form-item label="机型(model)" v-bind="validateInfos.model" id="SelectQuotationFormForm-model" name="model">
|
|
|
+ <JDictSelectTag v-model:value="formData.model" placeholder="请选择" dictCode="model_typer" disabled/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12">
|
|
|
+ <a-form-item label="厂家(maker)" v-bind="validateInfos.maker" id="SelectQuotationFormForm-maker" name="maker">
|
|
|
+ <a-input v-model:value="formData.maker" placeholder="请输入厂家(maker)" allow-clear disabled></a-input>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12">
|
|
|
+ <a-form-item label="附件(attachs)" v-bind="validateInfos.attachs" id="SelectQuotationFormForm-attachs" name="attachs">
|
|
|
+ <JUpload v-model:value="formData.attachs"></JUpload>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="12">
|
|
|
+ <a-form-item label="报价备注(quotation notes)" v-bind="validateInfos.inquiryNotes" id="SelectQuotationFormForm-inquiryNotes" name="inquiryNotes">
|
|
|
+ <a-input v-model:value="formData.inquiryNotes" placeholder="请输入报价备注(quotation notes)" allow-clear ></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="SelectQuotationFormShip" :forceRender="true">
|
|
|
+ <j-vxe-table
|
|
|
+ :keep-source="true"
|
|
|
+ resizable
|
|
|
+ ref="SelectQuotationFormShipTableRef"
|
|
|
+ :loading="SelectQuotationFormShipTable.loading"
|
|
|
+ :columns="SelectQuotationFormShipTable.columns"
|
|
|
+ :dataSource="SelectQuotationFormShipTable.dataSource"
|
|
|
+ :height="340"
|
|
|
+ :disabled="disabled"
|
|
|
+ :rowNumber="true"
|
|
|
+ :rowSelection="true"
|
|
|
+ >
|
|
|
+ <template #action="props" >
|
|
|
+ <a @click="viewAccessory(props)" >查看配件信息(view accessory information)</a>
|
|
|
+ </template>
|
|
|
+ </j-vxe-table>
|
|
|
+ </a-tab-pane>
|
|
|
+ <a-tab-pane tab="采购报价单选定子表 - 产品明细(product details)" key="SelectQuotationFormProduct" :forceRender="true">
|
|
|
+ <j-vxe-table
|
|
|
+ :keep-source="true"
|
|
|
+ resizable
|
|
|
+ ref="SelectQuotationFormProductTableRef"
|
|
|
+ :loading="SelectQuotationFormProductTable.loading"
|
|
|
+ :columns="SelectQuotationFormProductTable.columns"
|
|
|
+ :dataSource="SelectQuotationFormProductTable.dataSource"
|
|
|
+ :height="340"
|
|
|
+ :disabled="disabled"
|
|
|
+ :rowNumber="true"
|
|
|
+ :rowSelection="true"
|
|
|
+ asyncRemove
|
|
|
+ >
|
|
|
+ <template #action="props">
|
|
|
+ <a-popconfirm title="确定删除吗?" @confirm="handleDelete1(props)">
|
|
|
+ <a>删除(delete)</a>
|
|
|
+ </a-popconfirm>
|
|
|
+ </template>
|
|
|
+ </j-vxe-table>
|
|
|
+ </a-tab-pane>
|
|
|
+ <a-tab-pane tab="采购报价单选定子表 - 供应商报价明细(supplier quotation details)" key="SupplierQuotationDetails" :forceRender="true">
|
|
|
+ <j-vxe-table
|
|
|
+ :keep-source="true"
|
|
|
+ resizable
|
|
|
+ ref="SupplierQuotationDetailsTableRef"
|
|
|
+ :loading="SupplierQuotationDetailsTable.loading"
|
|
|
+ :columns="SupplierQuotationDetailsTable.columns"
|
|
|
+ :dataSource="SupplierQuotationDetailsTable.dataSource"
|
|
|
+ :height="340"
|
|
|
+ :disabled="disabled"
|
|
|
+ :rowNumber="true"
|
|
|
+ :rowSelection="true"
|
|
|
+ asyncRemove
|
|
|
+ >
|
|
|
+ </j-vxe-table>
|
|
|
+ </a-tab-pane>
|
|
|
+ </a-tabs>
|
|
|
+ <BaseShipArchiveAccessoriesList ref="BaseShipArchiveAccessoriesListRef"></BaseShipArchiveAccessoriesList>
|
|
|
+ <SelectProjectModal ref="SelectProjectModalRef" @selectProject="addProject"></SelectProjectModal>
|
|
|
+ </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 { SelectQuotationFormShippTable, SelectQuotationFormProductListByMainId, queryDataById, saveOrUpdate } from '../SelectionQuotationForm.api';
|
|
|
+ import { JVxeTable } from '/@/components/jeecg/JVxeTable';
|
|
|
+ import {SelectQuotationFormShipTableCloumn, SelectQuotationFormProductColumns,SupplierQuotationColumns} from '../SelectionQuotationForm.data';
|
|
|
+ import BaseShipArchiveAccessoriesList from './BaseShipArchiveAccessoriesModal.vue';
|
|
|
+ import SelectProjectModal from './SelectProjectModal.vue';
|
|
|
+ import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
|
|
|
+ import JUpload from '/@/components/Form/src/jeecg/components/JUpload/JUpload.vue';
|
|
|
+ import { JDictSelectTag} from '/@/components/Form';
|
|
|
+ import JSelectInput from '/@/components/Form/src/jeecg/components/JSelectInput.vue';
|
|
|
+ import { Form } from 'ant-design-vue';
|
|
|
+ import moment from 'moment';
|
|
|
+ const useForm = Form.useForm;
|
|
|
+ export default defineComponent({
|
|
|
+ name: "SelectQuotationFormForm",
|
|
|
+ components:{
|
|
|
+ JVxeTable,
|
|
|
+ JFormContainer,
|
|
|
+ BaseShipArchiveAccessoriesList,
|
|
|
+ JUpload,
|
|
|
+ SelectProjectModal,
|
|
|
+ JDictSelectTag,
|
|
|
+ JSelectInput,
|
|
|
+ },
|
|
|
+ props:{
|
|
|
+ formDisabled:{
|
|
|
+ type: Boolean,
|
|
|
+ default: false
|
|
|
+ },
|
|
|
+ formData: { type: Object, default: ()=>{} },
|
|
|
+ formBpm: { type: Boolean, default: true }
|
|
|
+ },
|
|
|
+ emits:['success'],
|
|
|
+ setup(props, {emit}) {
|
|
|
+ const loading = ref(false);
|
|
|
+ const formRef = ref();
|
|
|
+ var SelectProjectModalRef = ref()
|
|
|
+ const SelectQuotationFormShipTableRef = ref();
|
|
|
+ const SelectQuotationFormShipTable = reactive<Record<string, any>>({
|
|
|
+ loading: false,
|
|
|
+ columns: SelectQuotationFormShipTableCloumn,
|
|
|
+ dataSource: []
|
|
|
+ });
|
|
|
+ const SelectQuotationFormProductTableRef = ref();
|
|
|
+ const SupplierQuotationDetailsTableRef = ref();
|
|
|
+ const SelectQuotationFormProductTable = reactive<Record<string, any>>({
|
|
|
+ loading: false,
|
|
|
+ columns: SelectQuotationFormProductColumns,
|
|
|
+ dataSource: []
|
|
|
+ });
|
|
|
+ const SupplierQuotationDetailsTable = reactive<Record<string, any>>({
|
|
|
+ loading: false,
|
|
|
+ columns: SupplierQuotationColumns,
|
|
|
+ dataSource: []
|
|
|
+ });
|
|
|
+ var BaseShipArchiveAccessoriesListRef = ref();
|
|
|
+ const activeKey = ref('SelectQuotationFormShip');
|
|
|
+ const formData = reactive<Record<string, any>>({
|
|
|
+ id: '',
|
|
|
+ status: undefined,
|
|
|
+ delFlag: undefined,
|
|
|
+ otherStatus: '',
|
|
|
+ submit: '',
|
|
|
+ billDate: moment(new Date()).format('YYYY-MM-DD'),
|
|
|
+ billCode: '',
|
|
|
+ inquiryProject: '',
|
|
|
+ inquirySuppiler:"",
|
|
|
+ inquiryCustomer: '',
|
|
|
+ priority: '',
|
|
|
+ productionClass: '',
|
|
|
+ model: '',
|
|
|
+ maker: '',
|
|
|
+ paymentTerms:'',
|
|
|
+ delivery:'',
|
|
|
+ deliveryTime: '',
|
|
|
+ inquiryTeam: '',
|
|
|
+ quotationValidity:'',
|
|
|
+ attachs: '',
|
|
|
+ inquiryNotes: '',
|
|
|
+ sourceCode:'',
|
|
|
+ projectName:'',
|
|
|
+ placeDelivery:'',
|
|
|
+ suppilerName:'',
|
|
|
+ saleAttachs:''
|
|
|
+ });
|
|
|
+
|
|
|
+ //表单验证
|
|
|
+ const validatorRules = reactive({
|
|
|
+ });
|
|
|
+ const {resetFields, validate, validateInfos} = useForm(formData, validatorRules, {immediate: false});
|
|
|
+ const dbData = {};
|
|
|
+ const formItemLayout = {
|
|
|
+ labelCol: {xs: {span: 24}, sm: {span: 5}},
|
|
|
+ wrapperCol: {xs: {span: 24}, sm: {span: 16}},
|
|
|
+ };
|
|
|
+
|
|
|
+ // 表单禁用
|
|
|
+ const disabled = computed(()=>{
|
|
|
+ if(props.formBpm === true){
|
|
|
+ if(props.formData.disabled === false){
|
|
|
+ return false;
|
|
|
+ }else{
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return props.formDisabled;
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ function add() {
|
|
|
+ resetFields();
|
|
|
+ SelectQuotationFormShipTable.dataSource = [];
|
|
|
+ SelectQuotationFormProductTable.dataSource = [];
|
|
|
+ SupplierQuotationDetailsTable.dataSource = []
|
|
|
+ activeKey.value = 'SelectQuotationFormShip'
|
|
|
+ }
|
|
|
+
|
|
|
+ async function edit(row) {
|
|
|
+ //主表数据
|
|
|
+ await queryMainData(row.id);
|
|
|
+ //子表数据
|
|
|
+ const SelectQuotationFormShipDataList = await SelectQuotationFormShippTable(row['id']);
|
|
|
+ SelectQuotationFormShipTable.dataSource = [...SelectQuotationFormShipDataList];
|
|
|
+ const SelectQuotationFormProductDataList = await SelectQuotationFormProductListByMainId(row['id']);
|
|
|
+ SelectQuotationFormProductTable.dataSource = [...SelectQuotationFormProductDataList];
|
|
|
+ }
|
|
|
+
|
|
|
+ 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, {
|
|
|
+ 'purQuotationSelectionShip': SelectQuotationFormShipTableRef,
|
|
|
+ 'purQuotationSelectionProduct': SelectQuotationFormProductTableRef,
|
|
|
+ });
|
|
|
+
|
|
|
+ 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
|
|
|
+ await saveOrUpdate(values, isUpdate);
|
|
|
+ //关闭弹窗
|
|
|
+ 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 handleDelete1(prop) {
|
|
|
+ var newArray = [...SelectQuotationFormProductTable.dataSource]
|
|
|
+ newArray.splice(prop.rowIndex, 1)
|
|
|
+ SelectQuotationFormProductTable.dataSource = newArray
|
|
|
+ }
|
|
|
+ function addProject(data) {
|
|
|
+ if(data.length!==0){
|
|
|
+ formData.inquiryProject = data[0].id
|
|
|
+ formData.projectName = data[0].name
|
|
|
+ }else{
|
|
|
+ formData.inquiryProject = ''
|
|
|
+ formData.projectName = ''
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ function viewAccessory(prop){
|
|
|
+ BaseShipArchiveAccessoriesListRef.value.getTable(prop.row)
|
|
|
+ }
|
|
|
+ function onSearchProject(){
|
|
|
+ SelectProjectModalRef.value.getTable()
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ SelectQuotationFormShipTableRef,
|
|
|
+ SelectQuotationFormShipTable,
|
|
|
+ SelectQuotationFormProductTableRef,
|
|
|
+ SelectQuotationFormProductTable,
|
|
|
+ validatorRules,
|
|
|
+ validateInfos,
|
|
|
+ activeKey,
|
|
|
+ loading,
|
|
|
+ formData,
|
|
|
+ setFieldsValue,
|
|
|
+ handleFormChange,
|
|
|
+ formItemLayout,
|
|
|
+ disabled,
|
|
|
+ getFormData,
|
|
|
+ submitForm,
|
|
|
+ add,
|
|
|
+ edit,
|
|
|
+ formRef,
|
|
|
+ BaseShipArchiveAccessoriesListRef,
|
|
|
+ viewAccessory,
|
|
|
+ handleDelete1,
|
|
|
+ SelectProjectModalRef,
|
|
|
+ onSearchProject,
|
|
|
+ addProject,
|
|
|
+ SupplierQuotationDetailsTableRef
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+</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>
|