wujianwei
2025-12-26 b2ca7af3db0d1e2baf37829c33a82cd43d690751
ui/admin-ui3/src/views/tms/tmsProject/index.vue
@@ -60,10 +60,12 @@
  updateTmsProject
} from "@/api/tms/tmsProject";
import useCurrentInstance from "@/utils/useCurrentInstance";
import {computed, reactive, ref, toRefs} from "vue";
import {computed, onMounted, reactive, ref, toRefs, watch} from "vue";
import {PagesInterface, PageQueryInterface} from "@/utils/globalInterface";
import {usePagePlus} from "@/hooks/usePagePlus";
import {hasPermission} from "@/utils/permissionUtils";
import {getTmsCustomerInfo, listTmsCustomerInfo} from "@/api/tms/tmsCustomerInfo";
import {getTmsContract, listTmsContract} from "@/api/tms/tmsContract";
const {proxy} = useCurrentInstance();
const crudRef = ref();
@@ -91,104 +93,273 @@
const option = ref({
  pageKey: 'TmsProject',
  rowKey: 'id',
  group:[
    {
      label: '基础信息',
      prop: 'jcxx',
      column:{
        projectName: {
          label: '项目名称',
          display: true,
          rules: [
            {
              required: true,
              message: "项目名称不能为空", trigger: "blur"
            }
          ],
        },
        projectCode: {
          label: '项目编号',
          display: true,
        },
        relatedCustomerId: {
          label: '关联客户',
          display: true,minWidth: 150,
          type: 'table',suffixIcon:'search',dataType:'string',
          rules: [
            {
              required: true,
              message: "关联客户不能为空", trigger: "change"
            }
          ],
          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,
              },
              signCompanyName: {
                label: '签约公司', minWidth: 150,
              },
            },
          },
          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]
              }
              getTmsCustomerInfo(id).then(res=>{
                return callback(res.data||{})
              })
            }else{
              listTmsCustomerInfo({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?.('relatedCustomerId')?.$refs?.temp;
            if (!table) return;
            let active = table.active;
            if (Array.isArray(active)) active = active[0];
            if (active) {
              Object.assign(form.value, {
                relatedCustomerId: active.id,
                relatedCustomerName: active.customerShortName,
              });
              form.value.relatedContractId = undefined;
              form.value.relatedContractName = undefined;
            }
          },
        },
        relatedContractId: {
          label: '关联合同',
          display: true,minWidth: 150,dataType:'string',
          type: 'table',suffixIcon:'search',
          rules: [
            {
              required: true,
              message: "关联合同不能为空", trigger: "change"
            }
          ],
          children:{
            border: true,
            searchMenuSpan: 5,
            column:{
              contractCode: {
                label: '合同编号', minWidth: 130,
                search: true,
              },
              contractName: {
                label: '合同名称',minWidth: 120,
                search: true,
              },
              contractType: {
                label: '合同类型',minWidth: 120,
                type: 'select', dataType: 'string', dicUrl: '/system/dict/data/type/contract_type',
                search: true,
              },
              signDate: {
                label: '签约日期', minWidth: 150,
              },
              contractDate: {
                label: '合同期限',
                display: false,
                hide: false,
                search: false,minWidth:300,
                formatter: (row:any, column:any) => {
                  if (row.contractStartDate && row.contractEndDate) {
                    return row.contractStartDate + '~' + row.contractEndDate
                  }
                  return ''
                },
              },
            },
          },
          props:{
            label: 'contractName',
            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]
              }
              getTmsContract(id).then(res=>{
                return callback(res.data||{})
              })
            }else{
              listTmsContract({partyAId:form.value.relatedCustomerId,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?.('relatedContractId')?.$refs?.temp;
            if (!table) return;
            let active = table.active;
            if (Array.isArray(active)) active = active[0];
            if (active) {
              Object.assign(form.value, {
                relatedContractId: active.id,
                relatedContractName: active.contractName,
              });
            }
          },
        },
      }
    },
    {
      label: '其他信息',
      prop: 'qtxx',
      column:{
        status: {
          label: '状态',dataType: 'string',
          type: 'radio', dicUrl: '/system/dict/data/type/project_status',
          addDisplay: false,minWidth: 150,
          editDisplay: false,
          viewDisplay: true,
          hide: false,
          search: true,
        },
        createTime: {
          label: '创建时间',
          addDisplay: false,
          editDisplay: false,
          viewDisplay: true,
          hide: true,
          search: false,
        },
        createBy: {
          label: '创建人',
          addDisplay: false,
          editDisplay: false,
          viewDisplay: true,
        },
        updateBy: {
          label: '更新人',
          addDisplay: false,
          editDisplay: false,
          viewDisplay: true,
        },
        updateTime: {
          label: '更新时间',
          addDisplay: false,
          editDisplay: false,
          viewDisplay: true,
        },
        remark: {
          label: '备注',
          type: 'textarea', minRows: 3, maxRows: 5,
          addDisplay: true,span: 24,
          editDisplay: true,
          viewDisplay: true,
          hide: true,
          search: false,
        },
      }
    }
  ],
  column: {
    // id: {
    //   label: '主键ID',
    //   addDisplay: true,
    //   editDisplay: false,
    //   viewDisplay: true,
    //   hide: true,
    //   search: false,
    // },
    projectName: {
      label: '项目名称',
      addDisplay: true,minWidth: 150,
      editDisplay: true,
      viewDisplay: true,
      hide: false,
      display: false,minWidth: 150,
      search: true,
      rules: [
        {
          required: true,
          message: "项目名称不能为空", trigger: "blur"
        }
      ],
    },
    projectCode: {
      label: '项目编号',
      addDisplay: true,minWidth: 150,
      editDisplay: true,
      viewDisplay: true,
      hide: false,
      display: false,minWidth: 150,
      search: true,
      rules: [
        {
          required: true,
          message: "项目编号不能为空", trigger: "blur"
        }
      ],
    },
    relatedContractName: {
      label: '关联合同',
      display: false,minWidth: 150,
      search: true,
    },
    relatedContract: {
      label: '关联合同',
      display: true,minWidth: 150,
      hide: false,
      search: true,
    },
    relatedCustomer: {
    relatedCustomerName: {
      label: '关联客户',
      addDisplay: true,minWidth: 150,
      editDisplay: true,
      viewDisplay: true,
      hide: false,
      display: false,minWidth: 150,
      search: true,
    },
    status: {
      label: '状态',dataType: 'string',
      type: 'radio', dicUrl: '/system/dict/data/type/data_status',
      addDisplay: false,minWidth: 150,
      editDisplay: false,
      viewDisplay: true,
      hide: false,
      type: 'radio', dicUrl: '/system/dict/data/type/project_status',
      display: false,minWidth: 150,
      search: true,
      rules: [
        {
          required: true,
          message: "状态不能为空", trigger: "blur"
        }
      ],
    },
    createTime: {
      label: '创建时间',
      addDisplay: false,
      editDisplay: false,
      viewDisplay: true,
      hide: true,
      search: false,
    },
    updateBy: {
      label: '更新人',
      addDisplay: false,
      editDisplay: false,minWidth: 150,
      viewDisplay: true,
      hide: false,
      display: false,minWidth: 150,
      search: false,
    },
    updateTime: {
      label: '更新时间',
      addDisplay: false,
      editDisplay: false,minWidth: 180,
      viewDisplay: true,
      hide: false,
      search: false,
    },
    remark: {
      label: '备注',
      type: 'textarea', minRows: 3, maxRows: 5,
      addDisplay: true,span: 24,
      editDisplay: true,
      viewDisplay: true,
      hide: true,
      display: false,minWidth: 180,
      search: false,
    },
  }
@@ -230,6 +401,5 @@
    selectionList.value = selection;
  }
})
</script>