Browse Source

招标单-bug修改

jingbb 3 months ago
parent
commit
a8859ff51d

+ 55 - 91
src/views/saleCode/rfp/SaleRfp.data.ts

@@ -2,7 +2,6 @@ import {BasicColumn} from '/@/components/Table';
 import {FormSchema} from '/@/components/Table';
 import { defHttp } from '/@/utils/http/axios';
 import {ref } from 'vue';
-import moment from 'moment';
 var customerOption = ref([])
 var projectOption = ref([])
 //列表数据
@@ -91,25 +90,33 @@ export const searchFormSchema: FormSchema[] = [
       label: "单据编码(bill code)",
       field: 'billCode',
       component: 'Input',
-      labelWidth:150,
+      labelWidth:180,
       componentProps:{
         AutoComplete:'off'
       },
       //colProps: {span: 6},
  	},
-	
-	{
-      label: "客户(customer)",
-      field: 'customerId',
-      labelWidth:150,
-      component: 'JSelectInput',
-      componentProps:{
-        options:customerOption,
-        stringToNumber:true
-      },
-
-      //colProps: {span: 6},
- 	},
+   {
+    label: "客户(customer)",
+    field: 'customerId',
+    component: 'ApiSelect',
+    componentProps: {
+            // mode: 'multiple',//multiple: 多选;不填写为单选
+            //请求api,返回结果{ result: { records: [{'id':'1',name:'scott'},{'id':'2',name:'小张'}] }}
+            api: ()=> defHttp.get({ url: '/cuspCode/cuspCustomerProfile/list' }),
+            //数值转成String
+            numberToString: false,
+            //标题字段
+            labelField: 'name',
+            //值字段
+            valueField: 'id',
+            //请求参数
+            params:{pageSize:-1},
+            //返回结果字段
+            resultField:'records'
+          },
+    //colProps: {span: 6},
+   },
   {
     label: "投标结果(tender result)",
     field: 'tenderResult',
@@ -133,12 +140,23 @@ export const searchFormSchema: FormSchema[] = [
   {
     label: "系统项目(project)",
     field: 'projectId',
-    component: 'JSelectInput',
-    labelWidth:150,
-    componentProps:{
-      options:projectOption
+    component: 'ApiSelect',
+    labelWidth:180,
+    componentProps: {
+      // mode: 'multiple',//multiple: 多选;不填写为单选
+      //请求api,返回结果{ result: { records: [{'id':'1',name:'scott'},{'id':'2',name:'小张'}] }}
+      api: ()=> defHttp.get({ url: 'baseCode/baseProjectArchive/list' }),
+      //数值转成String
+      numberToString: false,
+      //标题字段
+      labelField: 'name',
+      //值字段
+      valueField: 'id',
+      //请求参数
+      params:{pageSize:-1},
+      //返回结果字段
+      resultField:'records'
     },
-    //colProps: {span: 6},
   },
 	
  {
@@ -177,7 +195,7 @@ export const searchFormSchema: FormSchema[] = [
     label: "备注(notes)",
     field: 'tenderCode',
     component: 'Input',
-    labelWidth:150,
+    labelWidth:180,
     componentProps:{
       AutoComplete:'off'
     },
@@ -212,7 +230,6 @@ export const formSchema: FormSchema[] = [
     component: 'DatePicker',
     componentProps: {
       valueFormat: 'YYYY-MM-DD',
-      defaultValue:moment(new Date()).format('YYYY-MM-DD')
     },
     labelWidth:220,
     dynamicRules: ({model,schema}) => {
@@ -223,20 +240,9 @@ export const formSchema: FormSchema[] = [
   },
   {
     label: '系统项目(project)',
-    field: 'projectId',
+    field: 'projectName',
     component: 'Select',
-    componentProps: ({ formModel, formActionType }) => {
-      return {
-        options:projectOption,
-        onChange: (e: any) => {
-          projectOption.value.map(item=>{
-            if(item.value==e){
-              formActionType.setFieldsValue({customerId:item.customerId})
-            }
-          })
-        }
-        }
-      }
+    slot: 'project',
     },
   {
     label: '采购方式(procurement method)',
@@ -254,11 +260,8 @@ export const formSchema: FormSchema[] = [
   },
   {
     label: '客户(customer)',
-    field: 'customerId',
-    component: 'JSelectInput',
-    componentProps:{
-      options:customerOption
-    },
+    field: 'customerName',
+    component: 'Input',
     labelWidth:150,
     dynamicDisabled:true,
     dynamicRules: ({model,schema}) => {
@@ -372,30 +375,20 @@ export const formSchema: FormSchema[] = [
 	  component: 'Input',
 	  show: false
 	},
+	{
+	  label: '',
+	  field: 'projectId',
+	  component: 'Input',
+	  show: false
+	},
+  {
+	  label: '',
+	  field: 'customerId',
+	  component: 'Input',
+	  show: false
+	},
 ];
 
-// 高级查询数据
-export const superQuerySchema = {
-  status: {title: '状态(1-启用,0-停用)',order: 0,view: 'number', type: 'number',},
-  billDate: {title: '单据日期',order: 2,view: 'date', type: 'string',},
-  billCode: {title: '单据编码',order: 3,view: 'text', type: 'string',},
-  projectId: {title: '项目',order: 4,view: 'text', type: 'string',},
-  customerId: {title: '客户',order: 5,view: 'text', type: 'string',},
-  procurementMethod: {title: '采购方式',order: 6,view: 'number', type: 'number',},
-  tenderCode: {title: '招标项目号',order: 7,view: 'text', type: 'string',},
-  tenderName: {title: '招标项目名称',order: 8,view: 'text', type: 'string',},
-  packetNumber: {title: '包号',order: 9,view: 'text', type: 'string',},
-  bidTime: {title: '投标时间',order: 10,view: 'datetime', type: 'string',},
-  openingTime: {title: '开标时间',order: 11,view: 'datetime', type: 'string',},
-  totalMoney: {title: '项目总价',order: 12,view: 'number', type: 'number',},
-  tenderResult: {title: '投标结果',order: 13,view: 'number', type: 'number',},
-  winningBidder: {title: '中标方',order: 14,view: 'text', type: 'string',},
-  bidPrice: {title: '中标价',order: 15,view: 'number', type: 'number',},
-  households: {title: '参与家数',order: 16,view: 'text', type: 'string',},
-  notes: {title: '备注',order: 17,view: 'text', type: 'string',},
-  attachs: {title: '附件',order: 18,view: 'text', type: 'string',},
-  submit: {title: '提交(0未提交,1已提交)',order: 19,view: 'number', type: 'number',},
-};
 
 /**
 * 流程表单调用这个方法获取formSchema
@@ -405,32 +398,3 @@ export function getBpmFormSchema(_formData): FormSchema[]{
   // 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
   return formSchema;
 }
-export function getCustomerOptions(){
-  let params = {pageSize:'-1',status:1}
-  defHttp.get({url:'/cuspCode/cuspCustomerProfile/list',params}, { isTransformResponse: false }).then(res=>{
-    if(res){
-        customerOption.value.splice(0,customerOption.value.length);
-        res.result.records.forEach(item=>{
-          customerOption.value.push({
-            label: item.abbreviation,
-            value: item.id
-          })
-        })      
-    }
-  })
-}
-export function getProjectOptions(){
-  let params = {pageSize:'-1'}
-  defHttp.get({url:'/baseCode/baseProjectArchive/list',params}, { isTransformResponse: false }).then(res=>{
-    if(res){
-      projectOption.value.splice(0,projectOption.value.length);
-      res.result.records.forEach(item=>{
-        projectOption.value.push({
-          label: item.name,
-          value: item.id,
-          customerId:item.customerId
-        })
-      })
-    }
-  })
-}

+ 1 - 5
src/views/saleCode/rfp/SaleRfpList.vue

@@ -42,7 +42,7 @@
   import { useListPage } from '/@/hooks/system/useListPage'
   import SaleRfpModal from './components/SaleRfpModal.vue'
   import { message } from 'ant-design-vue';
-  import {columns, searchFormSchema, superQuerySchema,getCustomerOptions,getProjectOptions} from './SaleRfp.data';
+  import {columns, searchFormSchema} from './SaleRfp.data';
   import {list, deleteOne, batchDelete, getImportUrl,getExportUrl,batchSubmit,cancelBatchSubmit} from './SaleRfp.api';
   import { downloadFile } from '/@/utils/common/renderUtils';
   import { useUserStore } from '/@/store/modules/user';
@@ -94,10 +94,6 @@
 
   const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
 
-  onMounted(() => {
-    getProjectOptions()
-    getCustomerOptions()
-  })
    /**
     * 新增事件
     */

+ 29 - 1
src/views/saleCode/rfp/components/SaleRfpModal.vue

@@ -1,6 +1,11 @@
 <template>
   <BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" width="95%" @ok="handleSubmit" >
-      <BasicForm @register="registerForm" name="SaleRfpForm" />
+      <BasicForm @register="registerForm" name="SaleRfpForm" >
+          <template #project="props">
+            <a-input-search v-model:value="props.model.projectName"  placeholder="请输入项目(project)" AutoComplete="off"  allow-clear enter-button="Search" @search="onSearchProject()"></a-input-search>
+          </template>
+      </BasicForm>
+      <SelectProjectModal ref="SelectProjectModalRef" @selectProject="addProject"></SelectProjectModal>
   </BasicModal>
 </template>
 
@@ -10,10 +15,13 @@
     import {BasicForm, useForm} from '/@/components/Form/index';
     import {formSchema} from '../SaleRfp.data';
     import {saveOrUpdate} from '../SaleRfp.api';
+    import SelectProjectModal from '../../../publicComponents/SelectProjectModal.vue';
+    import moment from 'moment';
     // Emits声明
     const emit = defineEmits(['register','success']);
     const isUpdate = ref(true);
     const isDetail = ref(false);
+    const SelectProjectModalRef = ref()
     //表单配置
     const [registerForm, { setProps,resetFields,getFieldsValue, setFieldsValue, validate, scrollToField }] = useForm({
         schemas: formSchema,
@@ -31,6 +39,8 @@
             await setFieldsValue({
                 ...data.record,
             });
+        }else{
+          await setFieldsValue({ billDate: moment(new Date()).format('YYYY-MM-DD')});
         }
         // 隐藏底部时禁用整个表单
        setProps({ disabled: !data?.showFooter })    
@@ -61,6 +71,24 @@
             setModalProps({confirmLoading: false});
         }
     }
+    function onSearchProject(){
+        SelectProjectModalRef.value.getTable()
+    }
+    
+    function addProject(data){
+      if(data.length==0){
+        setFieldsValue({ projectId:''});
+        setFieldsValue({ projectName:''});
+        setFieldsValue({ customerName:''});
+        setFieldsValue({ customerId:''});
+    }else{
+      setFieldsValue({ projectId:data[0].id});
+      setFieldsValue({ projectName:data[0].code});
+      setFieldsValue({ customerId:data[0].customerId});
+      setFieldsValue({ customerName:data[0].customerId_dictText});
+    }
+        
+      }
 </script>
 
 <style lang="less" scoped>