123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- <template>
- <div>
- <BasicForm @register="registerForm" ref="formRef"/>
-
- <a-tabs v-model:activeKey="activeKey" animated @change="handleChangeTabs">
- <a-tab-pane tab="供应商档案-联系人" key="cuspSupplierProfileMan" :forceRender="true">
- <JVxeTable
- keep-source
- resizable
- ref="cuspSupplierProfileMan"
- v-if="cuspSupplierProfileManTable.show"
- :loading="cuspSupplierProfileManTable.loading"
- :columns="cuspSupplierProfileManTable.columns"
- :dataSource="cuspSupplierProfileManTable.dataSource"
- :height="340"
- :rowNumber="true"
- :rowSelection="true"
- :disabled="formDisabled"
- :toolbar="true"
- />
- </a-tab-pane>
- <a-tab-pane tab="供应商档案-资质信息" key="cuspSupplierProfileQualification" :forceRender="true">
- <JVxeTable
- keep-source
- resizable
- ref="cuspSupplierProfileQualification"
- v-if="cuspSupplierProfileQualificationTable.show"
- :loading="cuspSupplierProfileQualificationTable.loading"
- :columns="cuspSupplierProfileQualificationTable.columns"
- :dataSource="cuspSupplierProfileQualificationTable.dataSource"
- :height="340"
- :rowNumber="true"
- :rowSelection="true"
- :disabled="formDisabled"
- :toolbar="true"
- />
- </a-tab-pane>
- </a-tabs>
- <div style="width: 100%;text-align: center" v-if="!formDisabled">
- <a-button @click="handleSubmit" pre-icon="ant-design:check" type="primary">提 交</a-button>
- </div>
- </div>
- </template>
- <script lang="ts">
- import {BasicForm, useForm} from '/@/components/Form/index';
- import { computed, defineComponent, reactive, ref, unref } from 'vue';
- import {defHttp} from '/@/utils/http/axios';
- import { propTypes } from '/@/utils/propTypes';
- import { useJvxeMethod } from '/@/hooks/system/useJvxeMethods';
- import { VALIDATE_FAILED } from '/@/utils/common/vxeUtils';
- import {getBpmFormSchema,cuspSupplierProfileManColumns,cuspSupplierProfileQualificationColumns} from '../CuspSupplierProfile.data';
- import {saveOrUpdate,cuspSupplierProfileManList,cuspSupplierProfileQualificationList} from '../CuspSupplierProfile.api';
- export default defineComponent({
- name: "CuspSupplierProfileForm",
- components:{
- BasicForm,
- },
- props:{
- formData: propTypes.object.def({}),
- formBpm: propTypes.bool.def(true),
- },
- setup(props){
- const [registerForm, { setFieldsValue, setProps }] = useForm({
- labelWidth: 150,
- schemas: getBpmFormSchema(props.formData),
- showActionButtonGroup: false,
- baseColProps: {span: 8}
- });
- const formDisabled = computed(()=>{
- if(props.formData.disabled === false){
- return false;
- }
- return true;
- });
- const refKeys = ref(['cuspSupplierProfileMan', 'cuspSupplierProfileQualification', ]);
- const activeKey = ref('cuspSupplierProfileMan');
- const cuspSupplierProfileMan = ref();
- const cuspSupplierProfileQualification = ref();
- const tableRefs = {cuspSupplierProfileMan, cuspSupplierProfileQualification, };
- const cuspSupplierProfileManTable = reactive({
- loading: false,
- dataSource: [],
- columns:cuspSupplierProfileManColumns,
- show: false
- })
- const cuspSupplierProfileQualificationTable = reactive({
- loading: false,
- dataSource: [],
- columns:cuspSupplierProfileQualificationColumns,
- show: false
- })
- const [handleChangeTabs,handleSubmit,requestSubTableData,formRef] = useJvxeMethod(requestAddOrEdit,classifyIntoFormData,tableRefs,activeKey,refKeys,validateSubForm);
- function classifyIntoFormData(allValues) {
- let main = Object.assign({}, allValues.formValue)
- return {
- ...main,
- cuspSupplierProfileManList: allValues.tablesValue[0].tableData,
- cuspSupplierProfileQualificationList: allValues.tablesValue[1].tableData,
- }
- }
-
- async function requestAddOrEdit(values) {
- await saveOrUpdate(values, true);
- }
- const queryByIdUrl = '/cuspCode/cuspSupplierProfile/queryById';
- async function initFormData(){
- let params = {id: props.formData.dataId};
- const data = await defHttp.get({url: queryByIdUrl, params});
-
- await setFieldsValue({...data});
- requestSubTableData(cuspSupplierProfileManList, {id: data.id}, cuspSupplierProfileManTable, ()=>{
- cuspSupplierProfileManTable.show = true;
- });
- requestSubTableData(cuspSupplierProfileQualificationList, {id: data.id}, cuspSupplierProfileQualificationTable, ()=>{
- cuspSupplierProfileQualificationTable.show = true;
- });
-
- await setProps({disabled: formDisabled.value})
- }
- initFormData();
- return {
- registerForm,
- formDisabled,
- formRef,
- handleSubmit,
- activeKey,
- handleChangeTabs,
- cuspSupplierProfileMan,
- cuspSupplierProfileQualification,
- cuspSupplierProfileManTable,
- cuspSupplierProfileQualificationTable,
- }
- }
- });
- </script>
|