zhangback
2025-11-27 d457a0f31290ba12273a51e75f6c2cc714659efc
ui/admin-ui3/src/views/tms/tmsContract/index.vue
@@ -65,7 +65,10 @@
import {usePagePlus} from "@/hooks/usePagePlus";
import {hasPermission} from "@/utils/permissionUtils";
import {getTmsCustomerInfo, listTmsCustomerInfo} from "@/api/tms/tmsCustomerInfo";
import dayjs from 'dayjs';
import {formatDate} from "@/utils/ruoyi";
import {getTmsSettlementEntity, listTmsSettlementEntity} from "@/api/tms/tmsSettlementEntity";
import router from "@/router";
const {proxy} = useCurrentInstance();
const crudRef = ref();
@@ -108,6 +111,19 @@
            {
              required: true,
              message: "系统编号不能为空", trigger: "blur"
            }
          ],
        },
        isTempContract: {
          label: '临时合同',
          type: 'radio', dataType: 'string', dicUrl: '/system/dict/data/type/sys_number_is',
          addDisplay: true,value:'1',
          editDisplay: true,
          viewDisplay: true,
          rules: [
            {
              required: true,
              message: "是否临时合同不能为空", trigger: "change"
            }
          ],
        },
@@ -154,12 +170,6 @@
          addDisplay: true,
          editDisplay: true,
          viewDisplay: true,
          rules: [
            {
              required: true,
              message: "签约日期不能为空", trigger: "blur"
            }
          ],
        },
        contractDate: {
          label: '合同期限',
@@ -176,9 +186,15 @@
          format: 'YYYY-MM-DD HH:mm:ss',
          valueFormat: 'YYYY-MM-DD HH:mm:ss',
          change: ({value}:{value:any}) => {
            if (Array.isArray(value)){
            if (Array.isArray(value) && value.length >1){
              form.value.contractStartDate = value[0]
              form.value.contractEndDate = value[1]
            }
            if (!(Array.isArray(value) && value.length >1)&& form.value.contractStartDate && form.value.contractEndDate){
              form.value.contractDate = [
                formatDate(form.value.contractStartDate),
                formatDate(form.value.contractEndDate)
              ];
            }
          }
        },
@@ -209,7 +225,7 @@
          type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/contract_status',
          addDisplay: true,
          editDisplay: true,
          viewDisplay: true,
          viewDisplay: true,value: '0',
          rules: [
            {
              required: true,
@@ -255,7 +271,7 @@
              contactName: {
                label: '联系人姓名',minWidth: 120,
              },
              signCompany: {
              signCompanyName: {
                label: '签约公司', minWidth: 150,
              },
            },
@@ -283,7 +299,21 @@
              })
            }
          }
          },
          change: (val: any) => {
            const table = crudRef.value?.getPropRef?.('partyAId')?.$refs?.temp;
            if (!table) return;
            let active = table.active;
            if (Array.isArray(active)) active = active[0];
            if (active) {
              Object.assign(form.value, {
                partyAId: active.id,
                partyAName: active.customerShortName,
                partyAContact: active.contactName,
                partyAContactInfo: active.contactPhone,
              });
            }
          },
        },
        partyAContact: {
          label: '甲方联系人',
@@ -303,7 +333,7 @@
      label: '乙方信息',
      prop: 'yfxx',
      column: {
        partyBName: {
        partyBId: {
          label: '乙方名称',
          addDisplay: true,
          editDisplay: true,
@@ -311,10 +341,83 @@
          rules: [
            {
              required: true,
              message: "乙方名称不能为空", trigger: "blur"
              message: "乙方名称不能为空", trigger: "change"
            }
          ],
          type: 'table',suffixIcon:'search',
          children:{
            border: true,
            searchMenuSpan: 5,
            column:{
              customerType: {
                label: '客户类型', minWidth: 120,
                type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/customer_type',
                search: true,
              },
              customerShortName: {
                label: '客户简称', minWidth: 130,
                search: true,
              },
              customerCode: {
                label: '客户编号',minWidth: 120,
                search: true,
              },
              contactName: {
                label: '联系人姓名',minWidth: 120,
              },
            },
          },
          props:{
            label: 'customerShortName',
            value: 'id'
          },
          onLoad: ({ page, value, data }: { page: any, value: any, data: any }, callback:any) => {
            if (value){
              let id = value;
              if (Array.isArray(value)){
                id = value[0]
              }
              getTmsSettlementEntity(id).then(res=>{
                return callback(res.data||{})
              })
            }else{
              listTmsSettlementEntity({pageSize:page.pageSize,pageNum:page.currentPage,...data}).then(res=>{
                return callback({
                  total: res.total,
                  data: res.rows||[],
                })
              })
            }
          },
          change: (val: any) => {
            const table = crudRef.value?.getPropRef?.('partyBId')?.$refs?.temp;
            if (!table) return;
            let active = table.active;
            if (Array.isArray(active)) active = active[0];
            if (active) {
              Object.assign(form.value, {
                partyBId: active.id,
                partyBName: active.customerShortName,
                partyBContact: active.contactName,
                partyBContactInfo: active.contactPhone,
              });
            }
          },
        },
        // partyBName: {
        //   label: '乙方名称',
        //   addDisplay: true,
        //   editDisplay: true,
        //   viewDisplay: true,
        //   rules: [
        //     {
        //       required: true,
        //       message: "乙方名称不能为空", trigger: "blur"
        //     }
        //   ],
        // },
        partyBContact: {
          label: '乙方联系人',
          addDisplay: true,
@@ -345,19 +448,19 @@
            }
          ],
        },
        paymentMethod: {
          label: '付款方式',
          type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/payment_method',
          addDisplay: true,
          editDisplay: true,
          viewDisplay: true,
          rules: [
            {
              required: true,
              message: "付款方式不能为空", trigger: "change"
            }
          ],
        },
        // paymentMethod: {
        //   label: '付款方式',
        //   type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/payment_method',
        //   addDisplay: true,
        //   editDisplay: true,
        //   viewDisplay: true,
        //   rules: [
        //     {
        //       required: true,
        //       message: "付款方式不能为空", trigger: "change"
        //     }
        //   ],
        // },
        paymentCycle: {
          label: '付款周期',
          addDisplay: true,
@@ -382,12 +485,12 @@
          addDisplay: true,
          editDisplay: true,
          viewDisplay: true,
          rules: [
            {
              required: true,
              message: "发票状态不能为空", trigger: "change"
            }
          ],
          // rules: [
          //   {
          //     required: true,
          //     message: "发票状态不能为空", trigger: "change"
          //   }
          // ],
        },
      }
    },
@@ -427,24 +530,37 @@
      label: '附件信息',
      prop: 'fjxx',
      column: {
        attachmentName: {
          label: '附件名称',
          addDisplay: false,
          editDisplay: false,
          viewDisplay: true,
        },
        // attachmentName: {
        //   label: '附件名称',
        //   addDisplay: false,
        //   editDisplay: false,
        //   viewDisplay: true,
        // },
        attachmentPath: {
          label: '附件路径',
          label: '附件',
          addDisplay: true,
          editDisplay: true,
          viewDisplay: true,
          viewDisplay: true,span: 24,
          accept:'string',dataType: 'string',
          type: 'upload',
          action: '/common/upload2',
          propsHttp:{
            home:'url',
            name:'newFileName',
          },
          rules: [
            {
              required: true,
              message: "请上传附件", trigger: "change"
            }
          ],
        },
        uploadedBy: {
          label: '上传人',
          addDisplay: false,
          editDisplay: false,
          viewDisplay: true,
        },
        // uploadedBy: {
        //   label: '上传人',
        //   addDisplay: false,
        //   editDisplay: false,
        //   viewDisplay: true,
        // },
      }
    },
    {
@@ -521,6 +637,13 @@
      hide: false,
      search: true,
    },
    isTempContract: {
      label: '临时合同',
      type: 'radio', dataType: 'string', dicUrl: '/system/dict/data/type/sys_number_is',
      display: false,minWidth:150,
      hide: false,
      search: true,
    },
    contractType: {
      label: '合同类型',
      type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/contract_type',
@@ -577,13 +700,13 @@
      hide: false,minWidth:150,
      search: false,
    },
    paymentMethod: {
      label: '付款方式',
      type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/payment_method',
      display: false,
      hide: false,minWidth:150,
      search: true,
    },
    // paymentMethod: {
    //   label: '付款方式',
    //   type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/payment_method',
    //   display: false,
    //   hide: false,minWidth:150,
    //   search: true,
    // },
    invoiceStatus: {
      label: '发票状态',
@@ -671,39 +794,17 @@
  deleteApi: delTmsContract,
  addApi: addTmsContract,
  updateApi: updateTmsContract,
  getBeginListFunc:()=>{
    queryParams.value.contractStatus = <any>router.currentRoute.value.query.contactStatus || undefined;
  },
  handleUpdateFunc: () => {
    crudRef.value.rowEdit(selectionList.value[0]);
  },
  handleSelectionChangeFunc: (selection: any) => {
    selectionList.value = selection;
  },
  handleEndOpenFunc:()=>{
    if (form.value.contractStartDate && form.value.contractEndDate){
      form.value.contractDate = [form.value.contractStartDate, form.value.contractEndDate]
    }
  }
})
onMounted(() => {
  watch(() => form.value.partyAId, () => {
    if (!form.value.partyAId){
      return;
    }
    const table = crudRef.value?.getPropRef?.('partyAId')?.$refs?.temp;
    if (!table) return;
    let active = table.active;
    if (Array.isArray(active)) active = active[0];
    if (active) {
      Object.assign(form.value, {
        partyAId: active.id,
        partyAName: active.customerShortName,
      });
    }
  });
});
console.log(router.currentRoute.value.query.contactStatus)
</script>