Browse Source

合同代码

yuansh 5 months ago
parent
commit
53de110629

+ 77 - 0
src/views/saleCode/saleContract/SaleContract.api.ts

@@ -0,0 +1,77 @@
+import {defHttp} from '/@/utils/http/axios';
+import { useMessage } from "/@/hooks/web/useMessage";
+
+const { createConfirm } = useMessage();
+
+enum Api {
+  list = '/saleCode/saleContract/list',
+  save='/saleCode/saleContract/add',
+  edit='/saleCode/saleContract/edit',
+  deleteOne = '/saleCode/saleContract/delete',
+  deleteBatch = '/saleCode/saleContract/deleteBatch',
+  importExcel = '/saleCode/saleContract/importExcel',
+  exportXls = '/saleCode/saleContract/exportXls',
+  saleContractShipList = '/saleCode/saleContract/querySaleContractShipByMainId',
+  saleContractProductList = '/saleCode/saleContract/querySaleContractProductByMainId',
+}
+/**
+ * 导出api
+ * @param params
+ */
+export const getExportUrl = Api.exportXls;
+
+/**
+ * 导入api
+ */
+export const getImportUrl = Api.importExcel;
+/**
+ * 查询子表数据
+ * @param params
+ */
+export const saleContractShipList = Api.saleContractShipList;
+/**
+ * 查询子表数据
+ * @param params
+ */
+export const saleContractProductList = Api.saleContractProductList;
+/**
+ * 列表接口
+ * @param params
+ */
+export const list = (params) =>
+  defHttp.get({url: Api.list, params});
+
+/**
+ * 删除单个
+ */
+export const deleteOne = (params,handleSuccess) => {
+  return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
+    handleSuccess();
+  });
+}
+/**
+ * 批量删除
+ * @param params
+ */
+export const batchDelete = (params, handleSuccess) => {
+  createConfirm({
+    iconType: 'warning',
+    title: '确认删除',
+    content: '是否删除选中数据',
+    okText: '确认',
+    cancelText: '取消',
+    onOk: () => {
+      return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
+        handleSuccess();
+      });
+    }
+  });
+}
+/**
+ * 保存或者更新
+ * @param params
+ */
+export const saveOrUpdate = (params, isUpdate) => {
+  let url = isUpdate ? Api.edit : Api.save;
+  return defHttp.post({url: url, params});
+}

+ 696 - 0
src/views/saleCode/saleContract/SaleContract.data.ts

@@ -0,0 +1,696 @@
+import {BasicColumn} from '/@/components/Table';
+import {FormSchema} from '/@/components/Table';
+import { rules} from '/@/utils/helper/validator';
+import { render } from '/@/utils/common/renderUtils';
+import {JVxeTypes,JVxeColumn} from '/@/components/jeecg/JVxeTable/types'
+import { getWeekMonthQuarterYear } from '/@/utils';
+//列表数据
+export const columns: BasicColumn[] = [
+   {
+    title: '历史主键',
+    align:"center",
+    dataIndex: 'hisId'
+   },
+   {
+    title: '状态(1-已提交,0-未提交)',
+    align:"center",
+    dataIndex: 'status'
+   },
+   {
+    title: '单据日期',
+    align:"center",
+    sorter: true,
+    dataIndex: 'billDate',
+    customRender:({text}) =>{
+      text = !text ? "" : (text.length > 10 ? text.substr(0,10) : text);
+      return text;
+    },
+   },
+   {
+    title: '单据编码',
+    align:"center",
+    dataIndex: 'billCode'
+   },
+   {
+    title: '报价项目',
+    align:"center",
+    dataIndex: 'quotationProject'
+   },
+   {
+    title: '报价项目名称',
+    align:"center",
+    dataIndex: 'quotationProjectName'
+   },
+   {
+    title: '报价客户',
+    align:"center",
+    dataIndex: 'quotationCustomer'
+   },
+   {
+    title: '报价客户名称',
+    align:"center",
+    dataIndex: 'quotationCustomerName'
+   },
+   {
+    title: '业务类型(busyness type)',
+    align:"center",
+    dataIndex: 'busynessType'
+   },
+   {
+    title: '优先级(priority)',
+    align:"center",
+    dataIndex: 'priority'
+   },
+   {
+    title: '产品分类(production class)',
+    align:"center",
+    dataIndex: 'productionClass'
+   },
+   {
+    title: '机型(model)',
+    align:"center",
+    dataIndex: 'model'
+   },
+   {
+    title: '厂家(maker)',
+    align:"center",
+    dataIndex: 'maker'
+   },
+   {
+    title: '币种(currency)',
+    align:"center",
+    dataIndex: 'currency'
+   },
+   {
+    title: '交货条款(delivery terms)',
+    align:"center",
+    dataIndex: 'deliveryTerms'
+   },
+   {
+    title: '付款条件(payment terms)',
+    align:"center",
+    dataIndex: 'paymentTerms'
+   },
+   {
+    title: '付款条件2',
+    align:"center",
+    dataIndex: 'paymentInfo'
+   },
+   {
+    title: '销售部门(sale department)',
+    align:"center",
+    dataIndex: 'saleDepartment_dictText'
+   },
+   {
+    title: '业务员(salesman)',
+    align:"center",
+    dataIndex: 'salesman_dictText'
+   },
+   {
+    title: '汇率(exchange rate)',
+    align:"center",
+    dataIndex: 'exchangeRate'
+   },
+   {
+    title: '备注(notes)',
+    align:"center",
+    dataIndex: 'notes'
+   },
+   {
+    title: '附件(attachs)',
+    align:"center",
+    dataIndex: 'attachs'
+   },
+   {
+    title: '版本号',
+    align:"center",
+    dataIndex: 'version'
+   },
+   {
+    title: '关闭(1-是,0-否)',
+    align:"center",
+    dataIndex: 'isClose'
+   },
+];
+//查询数据
+export const searchFormSchema: FormSchema[] = [
+	{
+      label: "状态(1-已提交,0-未提交)",
+      field: "status",
+      component: 'InputNumber',
+      //colProps: {span: 6},
+ 	},
+     {
+      label: "单据日期",
+      field: "billDate",
+      component: 'RangePicker',
+      componentProps: {
+        valueType: 'Date',
+      },
+      //colProps: {span: 6},
+	},
+	{
+      label: "单据编码",
+      field: "billCode",
+      component: 'Input',
+      //colProps: {span: 6},
+ 	},
+	{
+      label: "报价项目名称",
+      field: "quotationProjectName",
+      component: 'Input',
+      //colProps: {span: 6},
+ 	},
+	{
+      label: "报价客户名称",
+      field: "quotationCustomerName",
+      component: 'Input',
+      //colProps: {span: 6},
+ 	},
+	{
+      label: "业务类型(busyness type)",
+      field: "busynessType",
+      component: 'Input',
+      //colProps: {span: 6},
+ 	},
+	{
+      label: "优先级(priority)",
+      field: "priority",
+      component: 'Input',
+      //colProps: {span: 6},
+ 	},
+	{
+      label: "产品分类(production class)",
+      field: "productionClass",
+      component: 'Input',
+      //colProps: {span: 6},
+ 	},
+	{
+      label: "机型(model)",
+      field: "model",
+      component: 'Input',
+      //colProps: {span: 6},
+ 	},
+	{
+      label: "厂家(maker)",
+      field: "maker",
+      component: 'Input',
+      //colProps: {span: 6},
+ 	},
+	{
+      label: "销售部门(sale department)",
+      field: "saleDepartment",
+      component: 'JSelectDept',
+      componentProps:{
+      },
+      //colProps: {span: 6},
+ 	},
+	{
+      label: "业务员(salesman)",
+      field: "salesman",
+      component: 'JSelectUser',
+     componentProps:{
+     },
+      //colProps: {span: 6},
+ 	},
+	{
+      label: "关闭(1-是,0-否)",
+      field: "isClose",
+      component: 'InputNumber',
+      //colProps: {span: 6},
+ 	},
+];
+//表单数据
+export const formSchema: FormSchema[] = [
+  {
+    label: '历史主键',
+    field: 'hisId',
+    component: 'Input',
+  },
+  {
+    label: '状态(1-已提交,0-未提交)',
+    field: 'status',
+    component: 'InputNumber',
+  },
+  {
+    label: '单据日期',
+    field: 'billDate',
+    component: 'DatePicker',
+    componentProps:{
+      valueFormat: 'YYYY-MM-DD'
+    },    
+    dynamicRules: ({model,schema}) => {
+          return [
+                 { required: true, message: '请输入单据日期!'},
+          ];
+     },
+  },
+  {
+    label: '单据编码',
+    field: 'billCode',
+    component: 'Input',
+  },
+  {
+    label: '报价项目',
+    field: 'quotationProject',
+    component: 'Input',
+  },
+  {
+    label: '报价项目名称',
+    field: 'quotationProjectName',
+    component: 'Input',
+    dynamicRules: ({model,schema}) => {
+          return [
+                 { required: true, message: '请输入报价项目名称!'},
+          ];
+     },
+  },
+  {
+    label: '报价客户',
+    field: 'quotationCustomer',
+    component: 'Input',
+  },
+  {
+    label: '报价客户名称',
+    field: 'quotationCustomerName',
+    component: 'Input',
+  },
+  {
+    label: '业务类型(busyness type)',
+    field: 'busynessType',
+    component: 'Input',
+  },
+  {
+    label: '优先级(priority)',
+    field: 'priority',
+    component: 'Input',
+  },
+  {
+    label: '产品分类(production class)',
+    field: 'productionClass',
+    component: 'Input',
+  },
+  {
+    label: '机型(model)',
+    field: 'model',
+    component: 'Input',
+  },
+  {
+    label: '厂家(maker)',
+    field: 'maker',
+    component: 'Input',
+  },
+  {
+    label: '币种(currency)',
+    field: 'currency',
+    component: 'Input',
+  },
+  {
+    label: '交货条款(delivery terms)',
+    field: 'deliveryTerms',
+    component: 'Input',
+  },
+  {
+    label: '付款条件(payment terms)',
+    field: 'paymentTerms',
+    component: 'Input',
+  },
+  {
+    label: '付款条件2',
+    field: 'paymentInfo',
+    component: 'Input',
+  },
+  {
+    label: '销售部门(sale department)',
+    field: 'saleDepartment',
+     component: 'JSelectDept',
+     componentProps:{
+     },
+  },
+  {
+    label: '业务员(salesman)',
+    field: 'salesman',
+    component: 'JSelectUser',
+     componentProps:{
+     },
+  },
+  {
+    label: '汇率(exchange rate)',
+    field: 'exchangeRate',
+    component: 'Input',
+  },
+  {
+    label: '备注(notes)',
+    field: 'notes',
+    component: 'Input',
+  },
+  {
+    label: '附件(attachs)',
+    field: 'attachs',
+    component: 'Input',
+  },
+  {
+    label: '版本号',
+    field: 'version',
+    component: 'Input',
+  },
+  {
+    label: '关闭(1-是,0-否)',
+    field: 'isClose',
+    component: 'InputNumber',
+  },
+	// TODO 主键隐藏字段,目前写死为ID
+	{
+	  label: '',
+	  field: 'id',
+	  component: 'Input',
+	  show: false
+	},
+];
+//子表单数据
+//子表表格配置
+export const saleContractShipColumns: JVxeColumn[] = [
+    {
+      title: '状态(1-启用,0-停用)',
+      key: 'status',
+      type: JVxeTypes.inputNumber,
+      width:"200px",
+      placeholder: '请输入${title}',
+      defaultValue:'',
+    },
+    {
+      title: '表头主键(销售合同)',
+      key: 'headId',
+      type: JVxeTypes.input,
+      width:"200px",
+      placeholder: '请输入${title}',
+      defaultValue:'',
+    },
+    {
+      title: '船id',
+      key: 'shipId',
+      type: JVxeTypes.input,
+      width:"200px",
+      placeholder: '请输入${title}',
+      defaultValue:'',
+    },
+    {
+      title: '船名',
+      key: 'shipName',
+      type: JVxeTypes.input,
+      width:"200px",
+      placeholder: '请输入${title}',
+      defaultValue:'',
+    },
+    {
+      title: '主机号',
+      key: 'hostNumber',
+      type: JVxeTypes.input,
+      width:"200px",
+      placeholder: '请输入${title}',
+      defaultValue:'',
+    },
+    {
+      title: '工程编号',
+      key: 'projectNo',
+      type: JVxeTypes.input,
+      width:"200px",
+      placeholder: '请输入${title}',
+      defaultValue:'',
+    },
+    {
+      title: '船厂',
+      key: 'shipFactory',
+      type: JVxeTypes.input,
+      width:"200px",
+      placeholder: '请输入${title}',
+      defaultValue:'',
+    },
+    {
+      title: '船东',
+      key: 'shipowner',
+      type: JVxeTypes.input,
+      width:"200px",
+      placeholder: '请输入${title}',
+      defaultValue:'',
+    },
+  ]
+export const saleContractProductColumns: JVxeColumn[] = [
+    {
+      title: '状态(1-启用,0-停用)',
+      key: 'status',
+      type: JVxeTypes.inputNumber,
+      width:"200px",
+      placeholder: '请输入${title}',
+      defaultValue:'',
+    },
+    {
+      title: '表头主键(销售报价单)',
+      key: 'headId',
+      type: JVxeTypes.input,
+      width:"200px",
+      placeholder: '请输入${title}',
+      defaultValue:'',
+    },
+    {
+      title: '交期',
+      key: 'deliveryTime',
+      type: JVxeTypes.datetime,
+      width:"200px",
+      placeholder: '请输入${title}',
+      defaultValue:'',
+    },
+    {
+      title: '产品id',
+      key: 'productId',
+      type: JVxeTypes.input,
+      width:"200px",
+      placeholder: '请输入${title}',
+      defaultValue:'',
+    },
+    {
+      title: '产品分类',
+      key: 'productClass',
+      type: JVxeTypes.input,
+      width:"200px",
+      placeholder: '请输入${title}',
+      defaultValue:'',
+    },
+    {
+      title: '产品编码',
+      key: 'productCode',
+      type: JVxeTypes.input,
+      width:"200px",
+      placeholder: '请输入${title}',
+      defaultValue:'',
+    },
+    {
+      title: '产品中文名',
+      key: 'chineseName',
+      type: JVxeTypes.input,
+      width:"200px",
+      placeholder: '请输入${title}',
+      defaultValue:'',
+    },
+    {
+      title: '产品英文名',
+      key: 'englishName',
+      type: JVxeTypes.input,
+      width:"200px",
+      placeholder: '请输入${title}',
+      defaultValue:'',
+    },
+    {
+      title: '规格',
+      key: 'specifications',
+      type: JVxeTypes.input,
+      width:"200px",
+      placeholder: '请输入${title}',
+      defaultValue:'',
+    },
+    {
+      title: '型号',
+      key: 'model',
+      type: JVxeTypes.input,
+      width:"200px",
+      placeholder: '请输入${title}',
+      defaultValue:'',
+    },
+    {
+      title: '备件号',
+      key: 'partno',
+      type: JVxeTypes.input,
+      width:"200px",
+      placeholder: '请输入${title}',
+      defaultValue:'',
+    },
+    {
+      title: '图号',
+      key: 'drawingno',
+      type: JVxeTypes.input,
+      width:"200px",
+      placeholder: '请输入${title}',
+      defaultValue:'',
+    },
+    {
+      title: '订货号',
+      key: 'orderno',
+      type: JVxeTypes.input,
+      width:"200px",
+      placeholder: '请输入${title}',
+      defaultValue:'',
+    },
+    {
+      title: '厂家',
+      key: 'factory',
+      type: JVxeTypes.input,
+      width:"200px",
+      placeholder: '请输入${title}',
+      defaultValue:'',
+    },
+    {
+      title: '质量等级',
+      key: 'qualityGrade',
+      type: JVxeTypes.input,
+      width:"200px",
+      placeholder: '请输入${title}',
+      defaultValue:'',
+    },
+    {
+      title: '数量',
+      key: 'quantity',
+      type: JVxeTypes.inputNumber,
+      width:"200px",
+      placeholder: '请输入${title}',
+      defaultValue:'',
+    },
+    {
+      title: '单位',
+      key: 'unit',
+      type: JVxeTypes.input,
+      width:"200px",
+      placeholder: '请输入${title}',
+      defaultValue:'',
+    },
+    {
+      title: '税率(tax rate)',
+      key: 'taxRate',
+      type: JVxeTypes.inputNumber,
+      width:"200px",
+      placeholder: '请输入${title}',
+      defaultValue:'',
+    },
+    {
+      title: '折扣(discount)',
+      key: 'discount',
+      type: JVxeTypes.input,
+      width:"200px",
+      placeholder: '请输入${title}',
+      defaultValue:'',
+    },
+    {
+      title: '含税单价(tax price)',
+      key: 'taxPrice',
+      type: JVxeTypes.inputNumber,
+      width:"200px",
+      placeholder: '请输入${title}',
+      defaultValue:'',
+    },
+    {
+      title: '含税金额(tax amount)',
+      key: 'taxAmount',
+      type: JVxeTypes.inputNumber,
+      width:"200px",
+      placeholder: '请输入${title}',
+      defaultValue:'',
+    },
+    {
+      title: '备注(notes)',
+      key: 'notes',
+      type: JVxeTypes.input,
+      width:"200px",
+      placeholder: '请输入${title}',
+      defaultValue:'',
+    },
+  ]
+
+
+// 高级查询数据
+export const superQuerySchema = {
+  hisId: {title: '历史主键',order: 0,view: 'text', type: 'string',},
+  status: {title: '状态(1-已提交,0-未提交)',order: 1,view: 'number', type: 'number',},
+  billDate: {title: '单据日期',order: 2,view: 'date', type: 'string',},
+  billCode: {title: '单据编码',order: 3,view: 'text', type: 'string',},
+  quotationProject: {title: '报价项目',order: 4,view: 'text', type: 'string',},
+  quotationProjectName: {title: '报价项目名称',order: 5,view: 'text', type: 'string',},
+  quotationCustomer: {title: '报价客户',order: 6,view: 'text', type: 'string',},
+  quotationCustomerName: {title: '报价客户名称',order: 7,view: 'text', type: 'string',},
+  busynessType: {title: '业务类型(busyness type)',order: 8,view: 'text', type: 'string',},
+  priority: {title: '优先级(priority)',order: 9,view: 'text', type: 'string',},
+  productionClass: {title: '产品分类(production class)',order: 10,view: 'text', type: 'string',},
+  model: {title: '机型(model)',order: 11,view: 'text', type: 'string',},
+  maker: {title: '厂家(maker)',order: 12,view: 'text', type: 'string',},
+  currency: {title: '币种(currency)',order: 13,view: 'text', type: 'string',},
+  deliveryTerms: {title: '交货条款(delivery terms)',order: 14,view: 'text', type: 'string',},
+  paymentTerms: {title: '付款条件(payment terms)',order: 15,view: 'text', type: 'string',},
+  paymentInfo: {title: '付款条件2',order: 16,view: 'text', type: 'string',},
+  saleDepartment: {title: '销售部门(sale department)',order: 17,view: 'sel_depart', type: 'string',},
+  salesman: {title: '业务员(salesman)',order: 18,view: 'sel_user', type: 'string',},
+  exchangeRate: {title: '汇率(exchange rate)',order: 19,view: 'text', type: 'string',},
+  notes: {title: '备注(notes)',order: 20,view: 'text', type: 'string',},
+  attachs: {title: '附件(attachs)',order: 21,view: 'text', type: 'string',},
+  version: {title: '版本号',order: 22,view: 'text', type: 'string',},
+  isClose: {title: '关闭(1-是,0-否)',order: 23,view: 'number', type: 'number',},
+  //子表高级查询
+  saleContractShip: {
+    title: '销售合同-船明细',
+    view: 'table',
+    fields: {
+        status: {title: '状态(1-启用,0-停用)',order: 0,view: 'number', type: 'number',},
+        headId: {title: '表头主键(销售合同)',order: 2,view: 'text', type: 'string',},
+        shipId: {title: '船id',order: 3,view: 'text', type: 'string',},
+        shipName: {title: '船名',order: 4,view: 'text', type: 'string',},
+        hostNumber: {title: '主机号',order: 5,view: 'text', type: 'string',},
+        projectNo: {title: '工程编号',order: 6,view: 'text', type: 'string',},
+        shipFactory: {title: '船厂',order: 7,view: 'text', type: 'string',},
+        shipowner: {title: '船东',order: 8,view: 'text', type: 'string',},
+    }
+  },
+  saleContractProduct: {
+    title: '销售合同-产品明细',
+    view: 'table',
+    fields: {
+        status: {title: '状态(1-启用,0-停用)',order: 0,view: 'number', type: 'number',},
+        headId: {title: '表头主键(销售报价单)',order: 2,view: 'text', type: 'string',},
+        deliveryTime: {title: '交期',order: 3,view: 'datetime', type: 'string',},
+        productId: {title: '产品id',order: 4,view: 'text', type: 'string',},
+        productClass: {title: '产品分类',order: 5,view: 'text', type: 'string',},
+        productCode: {title: '产品编码',order: 6,view: 'text', type: 'string',},
+        chineseName: {title: '产品中文名',order: 7,view: 'text', type: 'string',},
+        englishName: {title: '产品英文名',order: 8,view: 'text', type: 'string',},
+        specifications: {title: '规格',order: 9,view: 'text', type: 'string',},
+        model: {title: '型号',order: 10,view: 'text', type: 'string',},
+        partno: {title: '备件号',order: 11,view: 'text', type: 'string',},
+        drawingno: {title: '图号',order: 12,view: 'text', type: 'string',},
+        orderno: {title: '订货号',order: 13,view: 'text', type: 'string',},
+        factory: {title: '厂家',order: 14,view: 'text', type: 'string',},
+        qualityGrade: {title: '质量等级',order: 15,view: 'text', type: 'string',},
+        quantity: {title: '数量',order: 16,view: 'number', type: 'number',},
+        unit: {title: '单位',order: 17,view: 'text', type: 'string',},
+        taxRate: {title: '税率(tax rate)',order: 18,view: 'number', type: 'number',},
+        discount: {title: '折扣(discount)',order: 19,view: 'text', type: 'string',},
+        taxPrice: {title: '含税单价(tax price)',order: 20,view: 'number', type: 'number',},
+        taxAmount: {title: '含税金额(tax amount)',order: 21,view: 'number', type: 'number',},
+        notes: {title: '备注(notes)',order: 22,view: 'text', type: 'string',},
+    }
+  },
+};
+
+/**
+* 流程表单调用这个方法获取formSchema
+* @param param
+*/
+export function getBpmFormSchema(_formData): FormSchema[]{
+// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
+  return formSchema;
+}

+ 193 - 0
src/views/saleCode/saleContract/SaleContractList.vue

@@ -0,0 +1,193 @@
+<template>
+  <div>
+    <!--引用表格-->
+   <BasicTable @register="registerTable" :rowSelection="rowSelection">
+     <!--插槽:table标题-->
+      <template #tableTitle>
+          <a-button type="primary" v-auth="'saleCode:sale_contract:add'"  @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
+          <a-button  type="primary" v-auth="'saleCode:sale_contract:exportXls'"  preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
+          <j-upload-button  type="primary" v-auth="'saleCode:sale_contract:importExcel'"  preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
+          <a-dropdown v-if="selectedRowKeys.length > 0">
+              <template #overlay>
+                <a-menu>
+                  <a-menu-item key="1" @click="batchHandleDelete">
+                    <Icon icon="ant-design:delete-outlined"></Icon>
+                    删除
+                  </a-menu-item>
+                </a-menu>
+              </template>
+              <a-button v-auth="'saleCode:sale_contract:deleteBatch'">批量操作
+                <Icon icon="mdi:chevron-down"></Icon>
+              </a-button>
+        </a-dropdown>
+        <!-- 高级查询 -->
+        <super-query :config="superQueryConfig" @search="handleSuperQuery" />
+      </template>
+       <!--操作栏-->
+      <template #action="{ record }">
+        <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
+      </template>
+      <!--字段回显插槽-->
+      <template v-slot:bodyCell="{ column, record, index, text }">
+      </template>
+    </BasicTable>
+    <!-- 表单区域 -->
+    <SaleContractModal @register="registerModal" @success="handleSuccess"></SaleContractModal>
+  </div>
+</template>
+
+<script lang="ts" name="saleCode-saleContract" setup>
+  import {ref, reactive, computed, unref} from 'vue';
+  import {BasicTable, useTable, TableAction} from '/@/components/Table';
+  import { useListPage } from '/@/hooks/system/useListPage'
+  import {useModal} from '/@/components/Modal';
+  import SaleContractModal from './components/SaleContractModal.vue'
+  import {columns, searchFormSchema, superQuerySchema} from './SaleContract.data';
+  import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './SaleContract.api';
+  import {downloadFile} from '/@/utils/common/renderUtils';
+  import { useUserStore } from '/@/store/modules/user';
+  const queryParam = reactive<any>({});
+  const checkedKeys = ref<Array<string | number>>([]);
+  const userStore = useUserStore();
+  //注册model
+  const [registerModal, {openModal}] = useModal();
+   //注册table数据
+  const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({
+      tableProps:{
+           title: '销售合同主表',
+           api: list,
+           columns,
+           canResize:false,
+           formConfig: {
+                //labelWidth: 120,
+                schemas: searchFormSchema,
+                autoSubmitOnEnter:true,
+                showAdvancedButton:true,
+                fieldMapToNumber: [
+                ],
+                fieldMapToTime: [
+                   ['billDate', ['billDate_begin', 'billDate_end'], 'YYYY-MM-DD'],
+                ],
+            },
+           actionColumn: {
+               width: 120,
+               fixed:'right'
+           },
+           beforeFetch: (params) => {
+             return Object.assign(params, queryParam);
+           },
+        },
+        exportConfig: {
+            name:"销售合同主表",
+            url: getExportUrl,
+            params: queryParam,
+        },
+        importConfig: {
+            url: getImportUrl,
+            success: handleSuccess
+        },
+    })
+
+  const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext
+
+  // 高级查询配置
+  const superQueryConfig = reactive(superQuerySchema);
+
+  /**
+   * 高级查询事件
+   */
+  function handleSuperQuery(params) {
+    Object.keys(params).map((k) => {
+      queryParam[k] = params[k];
+    });
+    reload();
+  }
+
+   /**
+    * 新增事件
+    */
+  function handleAdd() {
+     openModal(true, {
+       isUpdate: false,
+       showFooter: true,
+     });
+  }
+   /**
+    * 编辑事件
+    */
+  function handleEdit(record: Recordable) {
+     openModal(true, {
+       record,
+       isUpdate: true,
+       showFooter: true,
+     });
+   }
+   /**
+    * 详情
+   */
+  function handleDetail(record: Recordable) {
+     openModal(true, {
+       record,
+       isUpdate: true,
+       showFooter: false,
+     });
+   }
+   /**
+    * 删除事件
+    */
+  async function handleDelete(record) {
+     await deleteOne({id: record.id}, handleSuccess);
+   }
+   /**
+    * 批量删除事件
+    */
+  async function batchHandleDelete() {
+     await batchDelete({ids: selectedRowKeys.value},handleSuccess);
+   }
+   /**
+    * 成功回调
+    */
+  function handleSuccess() {
+      (selectedRowKeys.value = []) && reload();
+   }
+   /**
+      * 操作栏
+      */
+  function getTableAction(record){
+       return [
+         {
+           label: '编辑',
+           onClick: handleEdit.bind(null, record),
+           auth: 'saleCode:sale_contract:edit'
+         }
+       ]
+   }
+
+
+  /**
+   * 下拉操作栏
+   */
+  function getDropDownAction(record){
+    return [
+      {
+        label: '详情',
+        onClick: handleDetail.bind(null, record),
+      }, {
+        label: '删除',
+        popConfirm: {
+          title: '是否确认删除',
+          confirm: handleDelete.bind(null, record),
+          placement: 'topLeft'
+        },
+        auth: 'saleCode:sale_contract:delete'
+      }
+    ]
+  }
+
+</script>
+
+<style lang="less" scoped>
+  :deep(.ant-picker),:deep(.ant-input-number){
+    width: 100%;
+  }
+</style>

+ 147 - 0
src/views/saleCode/saleContract/components/SaleContractForm.vue

@@ -0,0 +1,147 @@
+<template>
+  <div>
+    <BasicForm @register="registerForm" ref="formRef"/>
+    <!-- 子表单区域 -->
+    <a-tabs v-model:activeKey="activeKey" animated  @change="handleChangeTabs">
+      <a-tab-pane tab="销售合同-船明细" key="saleContractShip" :forceRender="true">
+        <JVxeTable
+          keep-source
+          resizable
+          ref="saleContractShip"
+          v-if="saleContractShipTable.show"
+          :loading="saleContractShipTable.loading"
+          :columns="saleContractShipTable.columns"
+          :dataSource="saleContractShipTable.dataSource"
+          :height="340"
+          :rowNumber="true"
+          :rowSelection="true"
+          :disabled="formDisabled"
+          :toolbar="true"
+        />
+      </a-tab-pane>
+      <a-tab-pane tab="销售合同-产品明细" key="saleContractProduct" :forceRender="true">
+        <JVxeTable
+          keep-source
+          resizable
+          ref="saleContractProduct"
+          v-if="saleContractProductTable.show"
+          :loading="saleContractProductTable.loading"
+          :columns="saleContractProductTable.columns"
+          :dataSource="saleContractProductTable.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,saleContractShipColumns,saleContractProductColumns} from '../SaleContract.data';
+  import {saveOrUpdate,saleContractShipList,saleContractProductList} from '../SaleContract.api';
+
+  export default defineComponent({
+    name: "SaleContractForm",
+    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: 12}
+      });
+
+      const formDisabled = computed(()=>{
+        if(props.formData.disabled === false){
+          return false;
+        }
+        return true;
+      });
+
+      const refKeys = ref(['saleContractShip', 'saleContractProduct', ]);
+      const activeKey = ref('saleContractShip');
+      const saleContractShip = ref();
+      const saleContractProduct = ref();
+      const tableRefs = {saleContractShip, saleContractProduct, };
+      const saleContractShipTable = reactive({
+        loading: false,
+        dataSource: [],
+        columns:saleContractShipColumns,
+        show: false
+      })
+      const saleContractProductTable = reactive({
+        loading: false,
+        dataSource: [],
+        columns:saleContractProductColumns,
+        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, // 展开
+          saleContractShipList: allValues.tablesValue[0].tableData,
+          saleContractProductList: allValues.tablesValue[1].tableData,
+        }
+      }
+
+      //表单提交事件
+      async function requestAddOrEdit(values) {
+        await saveOrUpdate(values, true);
+      }
+
+      const queryByIdUrl = '/saleCode/saleContract/queryById';
+      async function initFormData(){
+        let params = {id: props.formData.dataId};
+        const data = await defHttp.get({url: queryByIdUrl, params});
+        //设置表单的值
+        await setFieldsValue({...data});
+        requestSubTableData(saleContractShipList, {id: data.id}, saleContractShipTable, ()=>{
+          saleContractShipTable.show = true;
+        });
+        requestSubTableData(saleContractProductList, {id: data.id}, saleContractProductTable, ()=>{
+          saleContractProductTable.show = true;
+        });
+        //默认是禁用
+        await setProps({disabled: formDisabled.value})
+      }
+
+      initFormData();
+
+      return {
+        registerForm,
+        formDisabled,
+        formRef,
+        handleSubmit,
+        activeKey,
+        handleChangeTabs,
+        saleContractShip,
+        saleContractProduct,
+        saleContractShipTable,
+        saleContractProductTable,
+      }
+    }
+  });
+</script>

+ 137 - 0
src/views/saleCode/saleContract/components/SaleContractModal.vue

@@ -0,0 +1,137 @@
+<template>
+  <BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose :title="title" :width="896" @ok="handleSubmit">
+    <BasicForm @register="registerForm" ref="formRef" name="SaleContractForm"/>
+    <!-- 子表单区域 -->
+    <a-tabs v-model:activeKey="activeKey" animated @change="handleChangeTabs">
+      <a-tab-pane tab="销售合同-船明细" key="saleContractShip" :forceRender="true">
+        <JVxeTable
+          keep-source
+          resizable
+          ref="saleContractShip"
+          :loading="saleContractShipTable.loading"
+          :columns="saleContractShipTable.columns"
+          :dataSource="saleContractShipTable.dataSource"
+          :height="340"
+          :rowNumber="true"
+          :rowSelection="true"
+          :disabled="formDisabled"
+          :toolbar="true"
+          />
+      </a-tab-pane>
+      <a-tab-pane tab="销售合同-产品明细" key="saleContractProduct" :forceRender="true">
+        <JVxeTable
+          keep-source
+          resizable
+          ref="saleContractProduct"
+          :loading="saleContractProductTable.loading"
+          :columns="saleContractProductTable.columns"
+          :dataSource="saleContractProductTable.dataSource"
+          :height="340"
+          :rowNumber="true"
+          :rowSelection="true"
+          :disabled="formDisabled"
+          :toolbar="true"
+          />
+      </a-tab-pane>
+    </a-tabs>
+  </BasicModal>
+</template>
+
+<script lang="ts" setup>
+    import {ref, computed, unref,reactive} from 'vue';
+    import {BasicModal, useModalInner} from '/@/components/Modal';
+    import {BasicForm, useForm} from '/@/components/Form/index';
+    import { JVxeTable } from '/@/components/jeecg/JVxeTable'
+    import { useJvxeMethod } from '/@/hooks/system/useJvxeMethods.ts'
+    import {formSchema,saleContractShipColumns,saleContractProductColumns} from '../SaleContract.data';
+    import {saveOrUpdate,saleContractShipList,saleContractProductList} from '../SaleContract.api';
+    import { VALIDATE_FAILED } from '/@/utils/common/vxeUtils'
+    // Emits声明
+    const emit = defineEmits(['register','success']);
+    const isUpdate = ref(true);
+    const formDisabled = ref(false);
+    const refKeys = ref(['saleContractShip', 'saleContractProduct', ]);
+    const activeKey = ref('saleContractShip');
+    const saleContractShip = ref();
+    const saleContractProduct = ref();
+    const tableRefs = {saleContractShip, saleContractProduct, };
+    const saleContractShipTable = reactive({
+          loading: false,
+          dataSource: [],
+          columns:saleContractShipColumns
+    })
+    const saleContractProductTable = reactive({
+          loading: false,
+          dataSource: [],
+          columns:saleContractProductColumns
+    })
+    //表单配置
+    const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({
+        schemas: formSchema,
+        showActionButtonGroup: false,
+        baseColProps: {span: 12}
+    });
+     //表单赋值
+    const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => {
+        //重置表单
+        await reset();
+        setModalProps({confirmLoading: false,showCancelBtn:data?.showFooter,showOkBtn:data?.showFooter});
+        isUpdate.value = !!data?.isUpdate;
+        formDisabled.value = !data?.showFooter;
+        if (unref(isUpdate)) {
+            //表单赋值
+            await setFieldsValue({
+                ...data.record,
+            });
+             requestSubTableData(saleContractShipList, {id:data?.record?.id}, saleContractShipTable)
+             requestSubTableData(saleContractProductList, {id:data?.record?.id}, saleContractProductTable)
+        }
+        // 隐藏底部时禁用整个表单
+       setProps({ disabled: !data?.showFooter })
+    });
+    //方法配置
+    const [handleChangeTabs,handleSubmit,requestSubTableData,formRef] = useJvxeMethod(requestAddOrEdit,classifyIntoFormData,tableRefs,activeKey,refKeys);
+
+    //设置标题
+    const title = computed(() => (!unref(isUpdate) ? '新增' : !unref(formDisabled) ? '编辑' : '详情'));
+
+    async function reset(){
+      await resetFields();
+      activeKey.value = 'saleContractShip';
+      saleContractShipTable.dataSource = [];
+      saleContractProductTable.dataSource = [];
+    }
+    function classifyIntoFormData(allValues) {
+         let main = Object.assign({}, allValues.formValue)
+         return {
+           ...main, // 展开
+           saleContractShipList: allValues.tablesValue[0].tableData,
+           saleContractProductList: allValues.tablesValue[1].tableData,
+         }
+       }
+    //表单提交事件
+    async function requestAddOrEdit(values) {
+        try {
+            setModalProps({confirmLoading: true});
+            //提交表单
+            await saveOrUpdate(values, isUpdate.value);
+            //关闭弹窗
+            closeModal();
+            //刷新列表
+            emit('success');
+        } finally {
+            setModalProps({confirmLoading: false});
+        }
+    }
+</script>
+
+<style lang="less" scoped>
+	/** 时间和数字输入框样式 */
+  :deep(.ant-input-number) {
+    width: 100%;
+  }
+
+  :deep(.ant-calendar-picker) {
+    width: 100%;
+  }
+</style>