li.shaoyi há 3 anos atrás
pai
commit
1f8af2f891
43 ficheiros alterados com 792 adições e 471 exclusões
  1. 24 24
      src/business/goods/index.ts
  2. 3 3
      src/business/menu/index.ts
  3. 302 83
      src/business/order/index.ts
  4. 12 12
      src/business/warehouse/index.ts
  5. 1 2
      src/components/base/tabs/index.less
  6. 2 2
      src/components/base/tabs/index.vue
  7. 9 20
      src/mock/router.ts
  8. 1 1
      src/packages/pc/assets/themes/default/default.less
  9. 9 8
      src/packages/pc/components/base/drawer/index.less
  10. 1 1
      src/packages/pc/components/base/drawer/index.vue
  11. 3 3
      src/packages/pc/components/base/multiple/index.vue
  12. 10 0
      src/packages/pc/components/base/table/index.less
  13. 38 19
      src/packages/pc/components/base/table/index.vue
  14. 15 0
      src/packages/pc/components/layouts/main/index.less
  15. 8 3
      src/packages/pc/components/layouts/main/index.vue
  16. 10 0
      src/packages/pc/components/layouts/page/index.less
  17. 1 0
      src/packages/pc/components/layouts/page/index.vue
  18. 6 3
      src/packages/pc/components/layouts/view/index.less
  19. 3 1
      src/packages/pc/components/modules/auth-operation/index.vue
  20. 50 28
      src/packages/pc/views/listing/buy/components/add/index.vue
  21. 27 0
      src/packages/pc/views/listing/buy/components/delisting/index.vue
  22. 2 2
      src/packages/pc/views/listing/buy/index.vue
  23. 2 2
      src/packages/pc/views/listing/purchase/index.vue
  24. 1 2
      src/packages/pc/views/listing/sale/index.vue
  25. 47 19
      src/packages/pc/views/listing/sell/components/add/index.vue
  26. 1 2
      src/packages/pc/views/listing/sell/index.vue
  27. 21 21
      src/packages/pc/views/system/menu/components/edit/index.vue
  28. 1 1
      src/packages/pc/views/system/menu/index.vue
  29. 1 1
      src/packages/pc/views/system/role/index.vue
  30. 0 6
      src/packages/pc/views/warehousing/out/index.vue
  31. 31 35
      src/packages/pc/views/warehousing/stock/components/edit/diamond.vue
  32. 25 29
      src/packages/pc/views/warehousing/stock/components/edit/diamonds.vue
  33. 33 37
      src/packages/pc/views/warehousing/stock/components/edit/fancy.vue
  34. 8 8
      src/packages/pc/views/warehousing/stock/components/edit/index.vue
  35. 34 38
      src/packages/pc/views/warehousing/stock/components/edit/jewelry.vue
  36. 25 29
      src/packages/pc/views/warehousing/stock/components/edit/rough.vue
  37. 1 2
      src/packages/pc/views/warehousing/stock/index.vue
  38. 14 14
      src/packages/pc/views/warehousing/warehouse/components/edit/index.vue
  39. 1 2
      src/packages/pc/views/warehousing/warehouse/index.vue
  40. 2 2
      src/services/socket/quote/index.ts
  41. 2 2
      src/services/socket/trade/index.ts
  42. 1 1
      src/types/ermcp/goods.d.ts
  43. 4 3
      src/types/proto/order.d.ts

+ 24 - 24
src/business/goods/index.ts

@@ -191,52 +191,52 @@ export function useDiamondForm(category: Category) {
     const warehouseList = shallowRef<Ermcp.WarehouseInfoRsp[]>([]) // 仓库列表
     const performanceId = shallowRef<number>() // 选中的履约模板ID
     const shapeId = shallowRef<number>() // 选中的形状ID
-    const formItem = reactive<Partial<Proto.GZWRStandardExInfo>>({
+    const formData = reactive<Partial<Proto.GZWRStandardExInfo>>({
         ZSCategory: category,
     })
 
     // 选中的枚举类型
     const selectedType = reactive({
         colorType: computed({
-            get: () => [formItem.ZSColorType1, formItem.ZSColorType2],
+            get: () => [formData.ZSColorType1, formData.ZSColorType2],
             set: (val) => {
-                formItem.ZSColorType1 = val[0]
-                formItem.ZSColorType2 = val[1]
+                formData.ZSColorType1 = val[0]
+                formData.ZSColorType2 = val[1]
             }
         }),
         cutType: computed({
-            get: () => [formItem.ZSCutType1, formItem.ZSCutType2],
+            get: () => [formData.ZSCutType1, formData.ZSCutType2],
             set: (val) => {
-                formItem.ZSCutType1 = val[0]
-                formItem.ZSCutType2 = val[1]
+                formData.ZSCutType1 = val[0]
+                formData.ZSCutType2 = val[1]
             }
         }),
         clarityType: computed({
-            get: () => [formItem.ZSClarityType1, formItem.ZSClarityType2],
+            get: () => [formData.ZSClarityType1, formData.ZSClarityType2],
             set: (val) => {
-                formItem.ZSClarityType1 = val[0]
-                formItem.ZSClarityType2 = val[1]
+                formData.ZSClarityType1 = val[0]
+                formData.ZSClarityType2 = val[1]
             }
         }),
         polishType: computed({
-            get: () => [formItem.ZSPolishType1, formItem.ZSPolishType2],
+            get: () => [formData.ZSPolishType1, formData.ZSPolishType2],
             set: (val) => {
-                formItem.ZSPolishType1 = val[0]
-                formItem.ZSPolishType2 = val[1]
+                formData.ZSPolishType1 = val[0]
+                formData.ZSPolishType2 = val[1]
             }
         }),
         symmetryType: computed({
-            get: () => [formItem.ZSSymmetryType1, formItem.ZSSymmetryType2],
+            get: () => [formData.ZSSymmetryType1, formData.ZSSymmetryType2],
             set: (val) => {
-                formItem.ZSSymmetryType1 = val[0]
-                formItem.ZSSymmetryType2 = val[1]
+                formData.ZSSymmetryType1 = val[0]
+                formData.ZSSymmetryType2 = val[1]
             }
         }),
         fluorescenceType: computed({
-            get: () => [formItem.ZSFluorescenceType1, formItem.ZSFluorescenceType2],
+            get: () => [formData.ZSFluorescenceType1, formData.ZSFluorescenceType2],
             set: (val) => {
-                formItem.ZSFluorescenceType1 = val[0]
-                formItem.ZSFluorescenceType2 = val[1]
+                formData.ZSFluorescenceType1 = val[0]
+                formData.ZSFluorescenceType2 = val[1]
             }
         }),
     })
@@ -260,12 +260,12 @@ export function useDiamondForm(category: Category) {
     }
 
     if (enums.currencyTypeList.length) {
-        formItem.ZSCurrencyType = enums.currencyTypeList[0].value
+        formData.ZSCurrencyType = enums.currencyTypeList[0].value
     }
 
     // 克拉单位
     const caratUnit = computed(() => {
-        const { Price, Weight } = formItem
+        const { Price, Weight } = formData
         if (Price && Weight) {
             return formatDecimal(Price / Weight)
         }
@@ -273,7 +273,7 @@ export function useDiamondForm(category: Category) {
     })
 
     // 货币信息
-    const currencyInfo = computed(() => getCurrencyTypeInfo(formItem.ZSCurrencyType ?? 0))
+    const currencyInfo = computed(() => getCurrencyTypeInfo(formData.ZSCurrencyType ?? 0))
 
     const formSubmit = () => {
         loading.value = true
@@ -286,7 +286,7 @@ export function useDiamondForm(category: Category) {
                 OrderSrc: 2,
                 ClientType: ClientType.Web,
                 ClientSerialNo: v4(),
-                GZ_WRStandardExInfo: formItem,
+                GZ_WRStandardExInfo: formData,
                 PerformanceTemplateID: performanceId.value,
             },
             complete: () => {
@@ -309,7 +309,7 @@ export function useDiamondForm(category: Category) {
 
     return {
         loading,
-        formItem,
+        formData,
         performanceId,
         shapeId,
         caratUnit,

+ 3 - 3
src/business/menu/index.ts

@@ -75,7 +75,7 @@ export function useMenu() {
 export function useMenuForm(selectedRow?: Ermcp.NewFuncmenuRsp) {
     const { dataList, getMenuList } = useMenu()
     const loading = ref(false)
-    const formItem = reactive<Partial<Ermcp.NewFuncmenuRsp>>({
+    const formData = reactive<Partial<Ermcp.NewFuncmenuRsp>>({
         menutype: 5,
         parentcode: '',
         ...selectedRow
@@ -94,7 +94,7 @@ export function useMenuForm(selectedRow?: Ermcp.NewFuncmenuRsp) {
     const formSubmit = () => {
         loading.value = true
         return insertNewFuncmenu({
-            data: formItem,
+            data: formData,
             complete: () => {
                 loading.value = false
             }
@@ -106,7 +106,7 @@ export function useMenuForm(selectedRow?: Ermcp.NewFuncmenuRsp) {
     return {
         loading,
         menus,
-        formItem,
+        formData,
         formSubmit,
     }
 }

+ 302 - 83
src/business/order/index.ts

@@ -22,6 +22,7 @@ import {
     getStyleTypeList,
 } from '@/constants/enum/diamond'
 import moment from 'moment'
+import Long from 'long'
 
 /**
  * 求购大厅
@@ -75,6 +76,7 @@ export function useBuyOrder() {
             label: '操作',
             show: true,
             fixed: 'right',
+            width: 180,
         }
     ])
 
@@ -146,8 +148,9 @@ export function useBuyOrder() {
 export function useBuyOrderForm() {
     const { UserID, AccountIDs } = sessionData.getValue('loginInfo')
     const loading = shallowRef(false)
-    const performanceId = shallowRef<number>() // 履约模板ID
-    const formItem = reactive<Proto.GZBuyOrderDetailExInfo>({
+    const performanceId = shallowRef<number>() // 选中的履约模板ID
+    const currencyId = shallowRef<number>() // 选中的货币类型ID
+    const formData = reactive<Proto.GZBuyOrderDetailExInfo>({
         UserID,
         AccountID: AccountIDs[0],
         ZSCategory: Category.Diamonds,
@@ -183,8 +186,8 @@ export function useBuyOrderForm() {
 
     const formSubmit = () => {
         loading.value = true
-        if (formItem.Size.some((val) => !val)) {
-            formItem.Size = []
+        if (formData.Size.some((val) => !val)) {
+            formData.Size = []
         }
         return zsBuyOrderListing({
             data: {
@@ -198,7 +201,7 @@ export function useBuyOrderForm() {
                 ClientType: ClientType.Web,
                 ClientSerialNo: v4(),
                 PerformanceTemplateID: performanceId.value,
-                GZ_BuyOrderDetailExInfo: formItem
+                GZ_BuyOrderDetailExInfo: formData
             },
             complete: () => {
                 loading.value = false
@@ -209,7 +212,8 @@ export function useBuyOrderForm() {
     return {
         loading,
         performanceId,
-        formItem,
+        currencyId,
+        formData,
         enums,
         formSubmit,
     }
@@ -352,114 +356,329 @@ export function useSellOrder() {
 export function useSellOrderForm() {
     const { dataList } = useDataTable<Ermcp.MyWRPositionRsp>()
     const { UserID, AccountIDs } = sessionData.getValue('loginInfo')
-    const loading = shallowRef(false)
+    const submitLoading = shallowRef(false)
+    const tableLoading = shallowRef(false)
+    const columns = shallowRef<Ermcp.TableColumn[]>([])
     const categoryList = getCategoryList() // 分类列表
     const selectedCategoryId = shallowRef(Category.Diamonds)
 
-    const formItem = reactive<Proto.ZSSellOrderListingReq>({
+    const formData = reactive<Proto.ZSSellOrderListingReq>({
         Header: {
             AccountID: AccountIDs[0],
         },
         UserID,
         AccountID: AccountIDs[0],
         WRStandardID: 0,
-        WRFactorTypeID: 0,
         OrderQty: 0,
-        LadingBillID: 0,
+        LadingBillID: Long.fromNumber(0),
         SubNum: 0,
-        TimevalidType: 4,
-        ValidTime: '',
+        TimevalidType: 4, // 4:一直有效
         OrderSrc: 2,
-        ClientSerialNo: v4(),
-        ClientOrderTime: moment().format('YYYY-MM-DD HH:mm:ss'),
+        ClientSerialNo: '',
+        ClientOrderTime: '',
         ClientType: ClientType.Web,
         MarketID: Market.GZ,
     })
 
-    const columns = shallowRef<Ermcp.TableColumn[]>([
-        {
-            prop: 'goodsno',
-            label: '商品编号',
-            show: true,
-        },
-        {
-            prop: 'price',
-            label: '总价',
-            show: true,
-        },
-        {
-            prop: 'weight',
-            label: '总重量',
-            show: true,
-        },
-        {
-            prop: 'weightavg',
-            label: '平均单颗重量',
-            show: true,
-        },
-        {
-            prop: 'priceper',
-            label: '克拉单位',
-            show: true,
-        },
-        {
-            prop: 'ftotalqty',
-            label: '库存重量',
-            show: true,
-        },
-        {
-            prop: 'remainqty',
-            label: '剩余重量',
-            show: true,
-        },
-        {
-            prop: 'zsshapetypedisplay',
-            label: '形状',
-            show: true,
-            width: 200,
-        },
-        {
-            prop: 'zscolortype',
-            label: '颜色',
-            show: true,
-        },
-        {
-            prop: 'zsclaritytype',
-            label: '净度',
-            show: true,
+    // 获取商品列表
+    const getDiamondList = () => {
+        dataList.value = []
+        formData.WRStandardID = 0
+        tableLoading.value = true
+        queryDiamondList({
+            data: {
+                wruserid: UserID,
+                zscategory: selectedCategoryId.value,
+            },
+            success: (res) => {
+                dataList.value = res.data.filter((e) => e.ftotalqty - e.ffreezeqty > 0)
+            },
+            complete: () => {
+                tableLoading.value = false
+            }
+        })
+    }
+
+    // 切换商品分类
+    const categoryChange = () => {
+        switch (selectedCategoryId.value) {
+            case Category.Diamonds: {
+                columns.value = [
+                    {
+                        prop: 'goodsno',
+                        label: '商品编号',
+                        show: true,
+                    },
+                    {
+                        prop: 'price',
+                        label: '总价',
+                        show: true,
+                    },
+                    {
+                        prop: 'weight',
+                        label: '总重量',
+                        show: true,
+                    },
+                    {
+                        prop: 'weightavg',
+                        label: '平均单颗重量',
+                        show: true,
+                    },
+                    {
+                        prop: 'priceper',
+                        label: '克拉单位',
+                        show: true,
+                    },
+                    {
+                        prop: 'ftotalqty',
+                        label: '库存重量',
+                        show: true,
+                    },
+                    {
+                        prop: 'remainqty',
+                        label: '剩余重量',
+                        show: true,
+                    },
+                    {
+                        prop: 'zsshapetypedisplay',
+                        label: '形状',
+                        show: true,
+                        width: 200,
+                    },
+                    {
+                        prop: 'zscolortype',
+                        label: '颜色',
+                        show: true,
+                    },
+                    {
+                        prop: 'zsclaritytype',
+                        label: '净度',
+                        show: true,
+                    }
+                ]
+                break
+            }
+            case Category.Diamond: {
+                columns.value = [
+                    {
+                        prop: 'goodsno',
+                        label: '商品编号',
+                        show: true,
+                    },
+                    {
+                        prop: 'price',
+                        label: '价格',
+                        show: true,
+                    },
+                    {
+                        prop: 'weight',
+                        label: '克拉重量',
+                        show: true,
+                    },
+                    {
+                        prop: 'priceper',
+                        label: '克拉单位',
+                        show: true,
+                    },
+                    {
+                        prop: 'zsshapetypedisplay',
+                        label: '形状',
+                        width: 200,
+                        show: true,
+                    },
+                    {
+                        prop: 'zscolortype1display',
+                        label: '颜色',
+                        show: true,
+                    },
+                    {
+                        prop: 'zsclaritytype1display',
+                        label: '净度',
+                        show: true,
+                    }
+                ]
+                break
+            }
+            case Category.Rough: {
+                columns.value = [
+                    {
+                        prop: 'goodsno',
+                        label: '商品编号',
+                        show: true,
+                    },
+                    {
+                        prop: 'price',
+                        label: '总价',
+                        show: true,
+                    },
+                    {
+                        prop: 'weight',
+                        label: '总重量',
+                        show: true,
+                    },
+                    {
+                        prop: 'weightavg',
+                        label: '平均单颗重量',
+                        show: true,
+                    },
+                    {
+                        prop: 'priceper',
+                        label: '克拉单位',
+                        show: true,
+                    },
+                    {
+                        prop: 'ftotalqty',
+                        label: '库存重量',
+                        show: true,
+                    },
+                    {
+                        prop: 'remainqty',
+                        label: '剩余重量',
+                        show: true,
+                    },
+                    {
+                        prop: 'zscrystaltypedisplay',
+                        label: '晶型',
+                        width: 200,
+                        show: true,
+                    },
+                    {
+                        prop: 'zscolortype',
+                        label: '颜色',
+                        show: true,
+                    },
+                    {
+                        prop: 'zsclaritytype',
+                        label: '净度',
+                        show: true,
+                    }
+                ]
+                break
+            }
+            case Category.Jewelry: {
+                columns.value = [
+                    {
+                        prop: 'goodsno',
+                        label: '商品编号',
+                        show: true,
+                    },
+                    {
+                        prop: 'price',
+                        label: '价格',
+                        show: true,
+                    },
+                    {
+                        prop: 'weight',
+                        label: '主石重量',
+                        show: true,
+                    },
+                    {
+                        prop: 'priceper',
+                        label: '克拉单位',
+                        show: true,
+                    },
+                    {
+                        prop: 'zsstyletypedisplay',
+                        label: '款式',
+                        width: 200,
+                        show: true,
+                    },
+                    {
+                        prop: 'zsstyletypedisplay',
+                        label: '主石形状',
+                        width: 200,
+                        show: true,
+                    },
+                    {
+                        prop: 'zsclaritytype1display',
+                        label: '主石净度',
+                        show: true,
+                    },
+                    {
+                        prop: 'zscuttype1display',
+                        label: '主石切工',
+                        show: true,
+                    },
+                    {
+                        prop: 'zssymmetrytype1display',
+                        label: '主石对称度',
+                        show: true,
+                    }
+                ]
+                break
+            }
+            case Category.Fancy: {
+                columns.value = [
+                    {
+                        prop: 'goodsno',
+                        label: '商品编号',
+                        show: true,
+                    },
+                    {
+                        prop: 'price',
+                        label: '价格',
+                        show: true,
+                    },
+                    {
+                        prop: 'weight',
+                        label: '克拉重量',
+                        show: true,
+                    },
+                    {
+                        prop: 'priceper',
+                        label: '克拉单位',
+                        show: true,
+                    },
+                    {
+                        prop: 'zsshapetypedisplay',
+                        label: '形状',
+                        width: 200,
+                        show: true,
+                    },
+                    {
+                        prop: 'zsczcolortype',
+                        label: '颜色',
+                        width: 200,
+                        show: true,
+                    },
+                    {
+                        prop: 'zsclaritytype1display',
+                        label: '净度',
+                        show: true,
+                    }
+                ]
+                break
+            }
         }
-    ])
+        getDiamondList()
+    }
 
     const formSubmit = () => {
-        loading.value = true
+        submitLoading.value = true
         return zsSellOrderListing({
-            data: formItem,
+            data: {
+                ...formData,
+                ClientSerialNo: v4(),
+                ClientOrderTime: moment().format('YYYY-MM-DD HH:mm:ss')
+            },
             complete: () => {
-                loading.value = false
+                submitLoading.value = false
             }
         })
     }
 
-    queryDiamondList({
-        data: {
-            wruserid: UserID,
-            zscategory: Category.Diamonds,
-        },
-        success: (res) => {
-            dataList.value = res.data.filter((e) => e.ftotalqty - e.ffreezeqty > 0)
-        },
-        fail: () => {
-            dataList.value = []
-        },
-    })
+    // 初始化
+    categoryChange()
 
     return {
-        loading,
-        formItem,
+        submitLoading,
+        tableLoading,
+        formData,
         dataList,
         columns,
         categoryList,
         selectedCategoryId,
+        categoryChange,
         formSubmit,
     }
 }

+ 12 - 12
src/business/warehouse/index.ts

@@ -78,7 +78,7 @@ export function useWarehouse() {
 export function useWarehouseForm(selectedRow?: Ermcp.WarehouseInfoRsp) {
     const loading = shallowRef(false)
     const accountName = commonStore.getAccountName()
-    const formItem = reactive<Proto.WarehouseApplyReq>({
+    const formData = reactive<Proto.WarehouseApplyReq>({
         type: selectedRow?.warehousecode ? 2 : 1,
         userid: sessionData.getLoginInfo('UserID'),
         warehousetype: 2,
@@ -90,22 +90,22 @@ export function useWarehouseForm(selectedRow?: Ermcp.WarehouseInfoRsp) {
 
     if (selectedRow) {
         ({
-            autoid: formItem.warehouseid,
-            warehousecode: formItem.warehousecode,
-            warehousename: formItem.warehousename,
-            provinceid: formItem.provinceid,
-            cityid: formItem.cityid,
-            districtid: formItem.districtid,
-            address: formItem.address,
-            contactname: formItem.contactname,
-            contactnum: formItem.contactnum,
+            autoid: formData.warehouseid,
+            warehousecode: formData.warehousecode,
+            warehousename: formData.warehousename,
+            provinceid: formData.provinceid,
+            cityid: formData.cityid,
+            districtid: formData.districtid,
+            address: formData.address,
+            contactname: formData.contactname,
+            contactnum: formData.contactnum,
         } = selectedRow)
     }
 
     const warehouseOperate = () => {
         loading.value = true
         return warehouseApply({
-            data: formItem,
+            data: formData,
             complete: () => {
                 loading.value = false
             }
@@ -115,7 +115,7 @@ export function useWarehouseForm(selectedRow?: Ermcp.WarehouseInfoRsp) {
     return {
         loading,
         accountName,
-        formItem,
+        formData,
         warehouseOperate,
     }
 }

+ 1 - 2
src/components/base/tabs/index.less

@@ -31,7 +31,6 @@
     }
 
     &__container {
-        flex      : 1;
-        overflow-y: auto;
+        height: 100%;
     }
 }

+ 2 - 2
src/components/base/tabs/index.vue

@@ -9,9 +9,9 @@
             </ul>
             <slot name="navbar"></slot>
         </div>
-        <div class="app-tabs__container">
+        <el-scrollbar view-class="app-tabs__container" always>
             <slot></slot>
-        </div>
+        </el-scrollbar>
     </div>
 </template>
 

+ 9 - 20
src/mock/router.ts

@@ -75,12 +75,20 @@ const appmenu = {
                             },
                             {
                                 authType: 3,
-                                title: '求购信息',
+                                title: '详情',
                                 code: 'listing_buy_details',
                                 component: 'views/listing/buy/components/details/index.vue',
                                 buttonName: 'details',
                                 buttonType: 'primary',
                             },
+                            {
+                                authType: 3,
+                                title: '摘牌',
+                                code: 'listing_buy_delisting',
+                                component: 'views/listing/buy/components/delisting/index.vue',
+                                buttonName: 'delisting',
+                                buttonType: 'primary',
+                            },
                         ]
                     },
                     {
@@ -188,25 +196,6 @@ const appmenu = {
                     {
                         authType: 1,
                         sort: 1,
-                        title: '我的出库',
-                        code: 'warehousing_out',
-                        url: 'out',
-                        urlType: 1,
-                        component: 'views/warehousing/out/index.vue',
-                        children: [
-                            {
-                                authType: 3,
-                                title: '新增出库',
-                                code: 'warehousing_out_add',
-                                component: 'views/warehousing/out/components/edit/index.vue',
-                                buttonName: 'add',
-                                buttonType: 'primary',
-                            }
-                        ]
-                    },
-                    {
-                        authType: 1,
-                        sort: 1,
                         title: '我的仓库',
                         code: 'warehousing_warehouse',
                         url: 'warehouse',

+ 1 - 1
src/packages/pc/assets/themes/default/default.less

@@ -76,7 +76,7 @@
 
     .app-tabs {
         &__navbar {
-            z-index         : 1;
+            z-index         : 10;
             display         : flex;
             align-items     : center;
             background-color: #fff;

+ 9 - 8
src/packages/pc/components/base/drawer/index.less

@@ -28,17 +28,18 @@
     }
 
     &__body {
-        flex      : 1;
-        overflow-y: auto;
-        padding   : 24px 48px;
+        flex       : 1;
+        overflow-y : auto;
+        line-height: normal;
+        padding    : 24px 48px 0 48px;
+
+        &:last-child {
+            padding-bottom: 24px;
+        }
     }
 
     &__footer {
         text-align: center;
-        padding   : 24px 48px;
-
-        &:empty {
-            display: none;
-        }
+        padding   : 32px 48px;
     }
 }

+ 1 - 1
src/packages/pc/components/base/drawer/index.vue

@@ -11,7 +11,7 @@
       <div class="app-drawer__body">
         <slot></slot>
       </div>
-      <div class="app-drawer__footer">
+      <div class="app-drawer__footer" v-if="$slots.footer">
         <slot name="footer"></slot>
       </div>
     </div>

+ 3 - 3
src/packages/pc/components/base/multiple/index.vue

@@ -63,13 +63,13 @@ const onChecked = () => {
 
 const onSelected = () => {
     const selection = [selectedValue.value[0] ?? '', selectedValue.value[1] ?? '']
+    selectList1.value.forEach((e) => e.disabled = false)
+    selectList2.value.forEach((e) => e.disabled = false)
+
     // 判断所有选项值是否为空
     if (selection.every((val) => val.toString() === '')) {
         onChange([])
     } else {
-        selectList1.value.forEach((e) => e.disabled = false)
-        selectList2.value.forEach((e) => e.disabled = false)
-
         if (selection[0].toString()) {
             selectList2.value.forEach((e) => {
                 if (selection[0] > e.value) {

+ 10 - 0
src/packages/pc/components/base/table/index.less

@@ -54,6 +54,16 @@
             }
         }
 
+        &-column {
+            &--selection {
+                &.single {
+                    .el-checkbox {
+                        display: none;
+                    }
+                }
+            }
+        }
+
         &__expanded-cell {
             .app-auth__button {
                 text-align: right;

+ 38 - 19
src/packages/pc/components/base/table/index.vue

@@ -12,24 +12,17 @@
       </div>
     </div>
     <div class="app-table__container">
-      <el-table ref="tableRef" v-bind="$attrs" v-loading="loading" highlight-current-row scrollbar-always-on>
+      <el-table ref="tableRef" :header-cell-class-name="selectionType" v-bind="$attrs" v-loading="loading"
+        highlight-current-row scrollbar-always-on @row-click="onRowClick" @select="onSelect">
         <!-- 展开行 -->
         <el-table-column type="expand" v-if="$slots.expand">
           <template #default="{ row, $index }">
             <slot name="expand" :row="row" :index="$index"></slot>
           </template>
         </el-table-column>
+        <!-- 选择列 -->
+        <el-table-column type="selection" width="55" align="center" fixed v-if="selectionType" />
         <!-- 数据列 -->
-        <template v-if="selectionType === 'checkbox'">
-
-        </template>
-        <el-table-column class-name="radio" align="center" width="55" v-if="selectionType === 'radio'">
-          <template #default="{ $index }">
-            <el-radio v-model="tableRadio" :label="$index" @change="radioChange">
-              <i />
-            </el-radio>
-          </template>
-        </el-table-column>
         <template v-for="(item, index) in columns" :key="index">
           <el-table-column :class-name="item.className" :align="item.align ?? 'center'" :min-width="120"
             :width="item.width" :label="item.label" :prop="item.prop" :fixed="item.fixed || false"
@@ -61,7 +54,7 @@ export default defineComponent({
   components: {
     AppTableSetting
   },
-  emits: ['refresh', 'update:columns', 'radioChange'],
+  emits: ['refresh', 'update:columns', 'rowClick', 'select'],
   props: {
     columns: {
       type: Array as PropType<Ermcp.TableColumn[]>,
@@ -77,8 +70,7 @@ export default defineComponent({
     },
     // 选择列类型
     selectionType: {
-      type: String as PropType<'none' | 'checkbox' | 'radio'>,
-      default: 'none'
+      type: String as PropType<'single' | 'multiple'>,
     }
   },
   setup(props, { emit, expose }) {
@@ -88,20 +80,47 @@ export default defineComponent({
     const refresh = () => emit('refresh')
     const updateColumn = (value: Ermcp.TableColumn[]) => emit('update:columns', value)
 
-    // 单选项中被选中时触发的事件
-    const radioChange = (index: number) => {
-      emit('radioChange', index)
+    // 当某一行被勾选时触发的事件
+    const onSelect = (selection: unknown[], currentRow: unknown) => {
+      const el = tableRef.value
+      const rows = selection.filter((e) => {
+        if (props.selectionType === 'single') {
+          if (e === currentRow) {
+            el.setCurrentRow(currentRow) // 高亮行
+            return true
+          } else {
+            el.toggleRowSelection(e, false) // 单选取消其他选中的行
+            return false
+          }
+        }
+        return true
+      })
+      emit('select', rows, currentRow)
+    }
+
+    // 当某一行被点击时选中该行
+    const onRowClick = (row: unknown) => {
+      // if (props.selectionType) {
+      //   const el = tableRef.value
+      //   const selection = el.getSelectionRows()
+      //   const selected = selection.find((e: unknown) => e === row)
+      //   el.toggleRowSelection(row, selected ? false : true)
+      //   onSelect(el.getSelectionRows(), row)
+      // }
+      emit('rowClick', row)
     }
 
+    // 暴露组件属性
     expose({
-      getRef: tableRef
+      elTable: tableRef
     })
 
     return {
       tableRef,
       tableRadio,
       showTableSetting,
-      radioChange,
+      onSelect,
+      onRowClick,
       handleNoneValue,
       refresh,
       updateColumn,

+ 15 - 0
src/packages/pc/components/layouts/main/index.less

@@ -0,0 +1,15 @@
+.app-main {
+    &__container {
+        height: 100%;
+    }
+
+    /* teleport 为空时隐藏元素 */
+    &__teleport:empty {
+        display: none;
+    }
+
+    /* teleport 非空时隐藏兄弟元素 */
+    &__teleport:not(:empty)+&__container {
+        display: none;
+    }
+}

+ 8 - 3
src/packages/pc/components/layouts/main/index.vue

@@ -1,11 +1,12 @@
 <template>
     <app-tabs class="app-main" :data-list="secondMenus" v-model:data-index="dataIndex" @change="onTabChange">
-        <el-scrollbar class="app-main__container" always>
+        <div id="appMainTeleport" class="app-main__container app-main__teleport"></div>
+        <div class="app-main__container">
             <!-- 二级路由 -->
             <router-view v-slot="{ Component, route }">
                 <component :is="Component" :key="route.fullPath" />
             </router-view>
-        </el-scrollbar>
+        </div>
     </app-tabs>
 </template>
 
@@ -33,4 +34,8 @@ if (parentRoute) {
 const onTabChange = (index: number, { name }: AuthMenu) => {
     router.push({ name })
 }
-</script>
+</script>
+
+<style lang="less">
+@import './index.less';
+</style>

+ 10 - 0
src/packages/pc/components/layouts/page/index.less

@@ -44,6 +44,16 @@
         overflow      : hidden;
     }
 
+    /* teleport 为空时隐藏元素 */
+    &__wrapper &__teleport:empty {
+        display: none;
+    }
+
+    /* teleport 非空时隐藏兄弟元素 */
+    &__wrapper &__teleport:not(:empty)+&__main {
+        display: none;
+    }
+
     .view-enter-from,
     .view-leave-to {
         transform: translateX(20px);

+ 1 - 0
src/packages/pc/components/layouts/page/index.vue

@@ -13,6 +13,7 @@
           </template>
         </app-header>
       </div>
+      <div id="appPageTeleport" class="app-page__main app-page__teleport"></div>
       <div class="app-page__main">
         <router-view v-slot="{ Component, route }">
           <component :is="Component" :key="route.fullPath" />

+ 6 - 3
src/packages/pc/components/layouts/view/index.less

@@ -1,8 +1,5 @@
 .app-view {
     flex                      : 1;
-    display                   : flex;
-    flex-direction            : column;
-    height                    : 100%;
     overflow                  : auto;
     -webkit-overflow-scrolling: touch;
 
@@ -34,6 +31,12 @@
         padding         : 20px;
     }
 
+    &--flex {
+        display       : flex;
+        flex-direction: column;
+        height        : 100%;
+    }
+
     &--flex &__main {
         flex    : 1;
         overflow: hidden;

+ 3 - 1
src/packages/pc/components/modules/auth-operation/index.vue

@@ -45,7 +45,7 @@
 </template>
 
 <script lang="ts" setup>
-import { onMounted, shallowRef, PropType, computed, watch } from 'vue'
+import { onMounted, onUnmounted, onDeactivated, shallowRef, PropType, computed, watch } from 'vue'
 import { useAuth } from '@/hooks/auth'
 
 const emit = defineEmits(['click', 'closed'])
@@ -123,6 +123,8 @@ const closeComponent = (isCallback?: boolean) => {
 watch(() => props.contextmenu, (val) => contextmenuOption.value = val)
 
 onMounted(() => auth.value = getAuthButton())
+onUnmounted(() => closeComponent())
+onDeactivated(() => closeComponent())
 </script>
 
 <style lang="less">

+ 50 - 28
src/packages/pc/views/listing/buy/components/add/index.vue

@@ -1,79 +1,82 @@
 <!-- 求购大厅-我要求购 -->
 <template>
     <app-drawer title="我要求购" :width="960" v-model:show="show" :loading="loading" :refresh="refresh">
-        <el-form ref="formRef" class="el-form--horizontal" label-width="100px" :model="formItem" :rules="formRules">
+        <el-form ref="formRef" class="el-form--horizontal" label-width="100px" :model="formData" :rules="formRules">
             <el-form-item label="商品分类" prop="ZSCategory">
-                <el-select v-model="formItem.ZSCategory">
+                <el-select v-model="formData.ZSCategory">
                     <el-option :label="item.label" :value="item.value" v-for="(item, index) in enums.categoryList"
                         :key="index" />
                 </el-select>
             </el-form-item>
             <el-form-item label="货币类型" prop="ZSCurrencyType">
-                <app-multiple class="el-form-item--col" :data-list="enums.currencyTypeList"
-                    v-model="formItem.ZSCurrencyType" checkbox />
+                <el-radio-group v-model="currencyId" @change="currencyChange">
+                    <el-radio :label="item.value" v-for="(item, index) in enums.currencyTypeList" :key="index">
+                        {{ item.label }}
+                    </el-radio>
+                </el-radio-group>
             </el-form-item>
             <el-form-item label="履约方式" prop="PerformanceTemplateID">
                 <component :is="components.performance" v-model="performanceId" />
             </el-form-item>
             <el-form-item label="尺寸" prop="Size">
                 <div class="el-form-item--col">
-                    <el-input-number type="number" v-model="formItem.Size[0]" :precision="2" :controls="false" />
+                    <el-input-number type="number" v-model="formData.Size[0]" :precision="2" :controls="false" />
                     <span>-</span>
-                    <el-input-number type="number" v-model="formItem.Size[1]" :precision="2" :controls="false" />
+                    <el-input-number type="number" v-model="formData.Size[1]" :precision="2" :controls="false" />
                 </div>
             </el-form-item>
             <el-form-item class="el-form-item--row" label="晶型" prop="ZSCrystalType"
-                v-if="formItem.ZSCategory === Category.Rough">
+                v-if="formData.ZSCategory === Category.Rough">
                 <app-multiple class="el-form-item--col" :data-list="enums.crystalTypeList"
-                    v-model="formItem.ZSCrystalType" checkbox />
+                    v-model="formData.ZSCrystalType" checkbox />
             </el-form-item>
             <el-form-item class="el-form-item--row" label="形状" prop="ZSShapeType" v-else>
-                <app-multiple class="el-form-item--col" :data-list="enums.shapeTypeList" v-model="formItem.ZSShapeType"
+                <app-multiple class="el-form-item--col" :data-list="enums.shapeTypeList" v-model="formData.ZSShapeType"
                     checkbox />
             </el-form-item>
             <el-form-item label="净度" prop="ZSClarityType">
                 <app-multiple class="el-form-item--col" :data-list="enums.clarityTypeList"
-                    v-model="formItem.ZSClarityType" />
+                    v-model="formData.ZSClarityType" />
             </el-form-item>
-            <el-form-item label="彩钻颜色" prop="ZSCZColor1Type" v-if="formItem.ZSCategory === Category.Fancy">
+            <el-form-item label="彩钻颜色" prop="ZSCZColor1Type" v-if="formData.ZSCategory === Category.Fancy">
                 <app-multiple class="el-form-item--col" :data-list="enums.fancyColorType1List"
-                    v-model="formItem.ZSCZColor1Type" />
+                    v-model="formData.ZSCZColor1Type" />
             </el-form-item>
             <el-form-item label="颜色" prop="ZSColorType" v-else>
                 <app-multiple class="el-form-item--col" :data-list="enums.colorTypeList"
-                    v-model="formItem.ZSColorType" />
+                    v-model="formData.ZSColorType" />
             </el-form-item>
-            <template v-if="formItem.ZSCategory !== Category.Rough">
+            <template v-if="formData.ZSCategory !== Category.Rough">
                 <el-form-item label="对称" prop="ZSSymmetryType">
                     <app-multiple class="el-form-item--col" :data-list="enums.symmetryTypeList"
-                        v-model="formItem.ZSSymmetryType" />
+                        v-model="formData.ZSSymmetryType" />
                 </el-form-item>
-                <el-form-item label="切工" prop="ZSCutType" v-if="formItem.ZSCategory !== Category.Fancy">
+                <el-form-item label="切工" prop="ZSCutType" v-if="formData.ZSCategory !== Category.Fancy">
                     <app-multiple class="el-form-item--col" :data-list="enums.cutTypeList"
-                        v-model="formItem.ZSCutType" />
+                        v-model="formData.ZSCutType" />
                 </el-form-item>
                 <el-form-item label="抛光" prop="ZSPolishType">
                     <app-multiple class="el-form-item--col" :data-list="enums.polishTypeList"
-                        v-model="formItem.ZSPolishType" />
+                        v-model="formData.ZSPolishType" />
                 </el-form-item>
             </template>
             <el-form-item label="荧光" prop="ZSFluorescenceType">
                 <app-multiple class="el-form-item--col" :data-list="enums.fluorescenceTypeList"
-                    v-model="formItem.ZSFluorescenceType" />
+                    v-model="formData.ZSFluorescenceType" />
             </el-form-item>
-            <el-form-item label="原产地" prop="Origin" v-if="formItem.ZSCategory === Category.Rough">
-                <el-input v-model="formItem.Origin" />
+            <el-form-item label="原产地" prop="Origin" v-if="formData.ZSCategory === Category.Rough">
+                <el-input v-model="formData.Origin" />
             </el-form-item>
             <el-form-item class="el-form-item--row" label="款式" prop="ZSStyleType"
-                v-if="formItem.ZSCategory === Category.Jewelry">
-                <app-multiple class="el-form-item--col" :data-list="enums.styleTypeList" v-model="formItem.ZSStyleType"
+                v-if="formData.ZSCategory === Category.Jewelry">
+                <app-multiple class="el-form-item--col" :data-list="enums.styleTypeList" v-model="formData.ZSStyleType"
                     checkbox />
             </el-form-item>
-            <el-form-item class="el-form-item--row">
-                <el-button type="primary" @click="onSubmit">提交</el-button>
-                <el-button @click="onCancel(false)" plain>取消</el-button>
-            </el-form-item>
         </el-form>
+        <template #footer>
+            <el-button @click="onCancel(false)" plain>取消</el-button>
+            <el-button type="primary" @click="onSubmit">提交</el-button>
+        </template>
     </app-drawer>
 </template>
 
@@ -90,7 +93,7 @@ const components = {
     performance: defineAsyncComponent(() => import('@pc/components/modules/performance/index.vue')),
 }
 
-const { loading, performanceId, formItem, enums, formSubmit } = useBuyOrderForm()
+const { loading, performanceId, currencyId, formData, enums, formSubmit } = useBuyOrderForm()
 const show = ref(true)
 const refresh = ref(false)
 const formRef = ref<FormInstance>()
@@ -107,6 +110,16 @@ const formRules: FormRules = {
             }
         }
     }],
+    ZSCurrencyType: [{
+        required: true,
+        validator: (rule, value, callback) => {
+            if (currencyId.value) {
+                callback()
+            } else {
+                callback(new Error('请选择货币类型'))
+            }
+        }
+    }],
     Size: [{
         validator: (rule, value, callback) => {
             const size = [value[0], value[1]]
@@ -188,6 +201,15 @@ const formRules: FormRules = {
     }],
 }
 
+// 选择货币类型
+const currencyChange = (value: number) => {
+    if (value) {
+        formData.ZSCurrencyType = [value]
+    } else {
+        formData.ZSCurrencyType = []
+    }
+}
+
 const onCancel = (isRefresh = false) => {
     show.value = false
     refresh.value = isRefresh

+ 27 - 0
src/packages/pc/views/listing/buy/components/delisting/index.vue

@@ -0,0 +1,27 @@
+<template>
+    <teleport to="#appMainTeleport">
+        <app-view v-bind="$attrs">
+            <template #header>
+                <el-button @click="onClick">返回</el-button>
+            </template>
+            摘牌
+        </app-view>
+    </teleport>
+</template>
+
+<script lang="ts" setup>
+import { PropType } from 'vue'
+
+defineProps({
+    selectedRow: {
+        type: Object as PropType<Ermcp.GoodsRsp>,
+        default: () => ({})
+    }
+})
+
+const emit = defineEmits(['closed'])
+
+const onClick = () => {
+    emit('closed')
+}
+</script>

+ 2 - 2
src/packages/pc/views/listing/buy/index.vue

@@ -11,8 +11,8 @@
             </template>
             <!-- 操作 -->
             <template #operate="{ row }">
-                <app-auth-operation :menus="['details']" :options="{ selectedRow: row }" @closed="getBuyOrderList"
-                    linkButton />
+                <app-auth-operation :menus="['details', 'delisting']" :options="{ selectedRow: row }"
+                    @closed="getBuyOrderList" />
             </template>
             <template #footer v-if="total > pageSize">
                 <app-pagination :total="total" v-model:page-size="pageSize" v-model:page-index="pageIndex"

+ 2 - 2
src/packages/pc/views/listing/purchase/index.vue

@@ -8,8 +8,8 @@
         <app-table :data="dataList" v-model:columns="columns" :loading="loading">
             <!-- 操作 -->
             <template #operate="{ row }">
-                <app-auth-operation :menus="['details']" :options="{ selectedRow: row }" @closed="getPurchaseOrderList"
-                    linkButton />
+                <app-auth-operation :menus="['details']" :options="{ selectedRow: row }"
+                    @closed="getPurchaseOrderList" />
             </template>
             <template #footer v-if="total > pageSize">
                 <app-pagination :total="total" v-model:page-size="pageSize" v-model:page-index="pageIndex"

+ 1 - 2
src/packages/pc/views/listing/sale/index.vue

@@ -8,8 +8,7 @@
         <app-table :data="dataList" v-model:columns="columns" :loading="loading">
             <!-- 操作 -->
             <template #operate="{ row }">
-                <app-auth-operation :menus="['details']" :options="{ selectedRow: row }" @closed="getSaleOrderList"
-                    linkButton />
+                <app-auth-operation :menus="['details']" :options="{ selectedRow: row }" @closed="getSaleOrderList" />
             </template>
             <template #footer v-if="total > pageSize">
                 <app-pagination :total="total" v-model:page-size="pageSize" v-model:page-index="pageIndex"

+ 47 - 19
src/packages/pc/views/listing/sell/components/add/index.vue

@@ -1,35 +1,46 @@
 <!-- 求购大厅-我要出售 -->
 <template>
-    <app-drawer title="我要出售" :width="960" v-model:show="show" :loading="loading" :refresh="refresh">
-        <el-form ref="formRef" class="el-form--horizontal" label-width="100px" :model="formItem" :rules="formRules">
+    <app-drawer title="我要出售" :width="960" v-model:show="show" :loading="submitLoading" :refresh="refresh">
+        <el-form ref="formRef" class="el-form--horizontal" label-width="100px" :model="formData" :rules="formRules">
             <el-form-item label="商品分类" prop="ZSCategory">
-                <el-select v-model="selectedCategoryId">
+                <el-select v-model="selectedCategoryId" :disabled="tableLoading" @change="categoryChange">
                     <el-option :label="item.label" :value="item.value" v-for="(item, index) in categoryList"
                         :key="index" />
                 </el-select>
             </el-form-item>
             <el-form-item label="履约方式" prop="PerformanceTemplateID">
-                <component :is="components.performance" v-model="formItem.PerformanceTemplateID" />
-            </el-form-item>
-            <el-form-item class="el-form-item--row">
-                <el-button type="primary" @click="onSubmit">提交</el-button>
-                <el-button @click="onCancel(false)" plain>取消</el-button>
+                <component :is="components.performance" v-model="formData.PerformanceTemplateID" />
             </el-form-item>
         </el-form>
-        <app-table :data="dataList" :columns="columns" :height="400" selection-type="radio" border>
-            <template #header>
-                <el-input placeholder="搜索商品" />
-            </template>
+        <app-table :data="dataList" :columns="columns" :max-height="400" :show-header="false" :loading="tableLoading"
+            selection-type="single" border @select="onTableSelect">
             <!-- 剩余数量 -->
             <template #remainqty="{ row }">
                 {{ row.ftotalqty - row.ffreezeqty }}
             </template>
+            <!-- 颜色 -->
+            <template #zscolortype="{ row }">
+                {{ [row.zscolortype1display, row.zscolortype2display].join('-') }}
+            </template>
+            <!-- 净度 -->
+            <template #zsclaritytype="{ row }">
+                {{ [row.zsclaritytype1display, row.zsclaritytype2display].join('-') }}
+            </template>
+            <!-- 彩钻颜色 -->
+            <template #zsczcolortype="{ row }">
+                {{ [row.zsczcolor1typedisplay, row.zsczcolor2typedisplay, row.zsczcolor3typedisplay].join('-') }}
+            </template>
         </app-table>
+        <template #footer>
+            <el-button @click="onCancel(false)" plain>取消</el-button>
+            <el-button type="primary" @click="onSubmit">提交</el-button>
+        </template>
     </app-drawer>
 </template>
 
 <script lang="ts" setup>
 import { ref, defineAsyncComponent } from 'vue'
+import Long from 'long'
 import { ElMessage } from 'element-plus'
 import type { FormInstance, FormRules } from 'element-plus'
 import { useSellOrderForm } from '@/business/order'
@@ -40,7 +51,7 @@ const components = {
     performance: defineAsyncComponent(() => import('@pc/components/modules/performance/index.vue')),
 }
 
-const { loading, formItem, dataList, columns, selectedCategoryId, categoryList, formSubmit } = useSellOrderForm()
+const { tableLoading, submitLoading, formData, dataList, columns, selectedCategoryId, categoryList, categoryChange, formSubmit } = useSellOrderForm()
 const show = ref(true)
 const refresh = ref(false)
 const formRef = ref<FormInstance>()
@@ -59,6 +70,19 @@ const formRules: FormRules = {
     PerformanceTemplateID: [{ required: true, message: '请选择履约方式' }],
 }
 
+// 勾选表格行
+const onTableSelect = (rows: Ermcp.MyWRPositionRsp[]) => {
+    const row = rows[0]
+    if (row) {
+        formData.WRStandardID = row.wrstandardid
+        formData.LadingBillID = Long.fromString(row.ladingbillid)
+        formData.OrderQty = row.ftotalqty - row.ffreezeqty
+        formData.SubNum = row.subnum
+    } else {
+        formData.WRStandardID = 0
+    }
+}
+
 const onCancel = (isRefresh = false) => {
     show.value = false
     refresh.value = isRefresh
@@ -67,12 +91,16 @@ const onCancel = (isRefresh = false) => {
 const onSubmit = () => {
     formRef.value?.validate((valid) => {
         if (valid) {
-            formSubmit().then(() => {
-                ElMessage.success('提交成功')
-                onCancel(true)
-            }).catch((err) => {
-                ElMessage.error('提交失败:' + err)
-            })
+            if (formData.WRStandardID) {
+                formSubmit().then(() => {
+                    ElMessage.success('提交成功')
+                    onCancel(true)
+                }).catch((err) => {
+                    ElMessage.error('提交失败:' + err)
+                })
+            } else {
+                ElMessage.warning('请选择商品')
+            }
         }
     })
 }

+ 1 - 2
src/packages/pc/views/listing/sell/index.vue

@@ -11,8 +11,7 @@
             </template>
             <!-- 操作 -->
             <template #operate="{ row }">
-                <app-auth-operation :menus="['details']" :options="{ selectedRow: row }" @closed="getSellOrderList"
-                    linkButton />
+                <app-auth-operation :menus="['details']" :options="{ selectedRow: row }" @closed="getSellOrderList" />
             </template>
             <template #footer v-if="total > pageSize">
                 <app-pagination :total="total" v-model:page-size="pageSize" v-model:page-index="pageIndex"

+ 21 - 21
src/packages/pc/views/system/menu/components/edit/index.vue

@@ -2,29 +2,29 @@
     <app-drawer class="system-menu-edit" title="编辑" width="680" v-model:show="show" :loading="loading"
         :refresh="refresh">
         <template #default>
-            <el-form ref="formRef" label-width="90px" :model="formItem">
+            <el-form ref="formRef" label-width="90px" :model="formData">
                 <el-form-item label="权限类型" prop="authtype">
-                    <el-radio-group v-model="formItem.authtype">
+                    <el-radio-group v-model="formData.authtype">
                         <el-radio :label="item.value" v-for="(item, index) in getAuthTypeList()" :key="index">
                             {{ item.label }}
                         </el-radio>
                     </el-radio-group>
                 </el-form-item>
                 <el-form-item label="所属层级" prop="parentcode">
-                    <el-tree-select :data="menus" v-model="formItem.parentcode"
+                    <el-tree-select :data="menus" v-model="formData.parentcode"
                         :props="{ label: 'resourcename', value: 'resourcecode' }" check-strictly default-expand-all />
                 </el-form-item>
                 <el-form-item label="权限标题" prop="resourcename">
-                    <el-input v-model="formItem.resourcename" />
+                    <el-input v-model="formData.resourcename" />
                 </el-form-item>
                 <el-form-item label="权限代码" prop="resourcecode">
-                    <el-input v-model="formItem.resourcecode" />
+                    <el-input v-model="formData.resourcecode" />
                 </el-form-item>
-                <el-form-item label="按钮代码" prop="buttonname" v-if="formItem.authtype === AuthType.Button">
-                    <el-input v-model="formItem.buttonname" />
+                <el-form-item label="按钮代码" prop="buttonname" v-if="formData.authtype === AuthType.Button">
+                    <el-input v-model="formData.buttonname" />
                 </el-form-item>
-                <el-form-item label="按钮样式" v-if="formItem.authtype === AuthType.Button">
-                    <el-select v-model="formItem.buttontype" style="margin-right:12px">
+                <el-form-item label="按钮样式" v-if="formData.authtype === AuthType.Button">
+                    <el-select v-model="formData.buttontype" style="margin-right:12px">
                         <el-option label="默认" value="default" />
                         <el-option label="主要" value="primary" />
                         <el-option label="成功" value="success" />
@@ -32,18 +32,18 @@
                         <el-option label="警告" value="warning" />
                         <el-option label="危险" value="danger" />
                     </el-select>
-                    <el-button :type="formItem.buttontype">
-                        <component :is="components.appIcon" :icon="formItem.iconame" />
-                        <span>{{ formItem.resourcename }}</span>
+                    <el-button :type="formData.buttontype">
+                        <component :is="components.appIcon" :icon="formData.iconame" />
+                        <span>{{ formData.resourcename }}</span>
                     </el-button>
                 </el-form-item>
                 <el-form-item label="图标">
-                    <component :is="components.appIconSelect" v-model="formItem.iconame" />
+                    <component :is="components.appIconSelect" v-model="formData.iconame" />
                 </el-form-item>
-                <el-form-item label="链接地址" prop="url" v-if="formItem.authtype === AuthType.Menu">
-                    <el-input v-model="formItem.url">
+                <el-form-item label="链接地址" prop="url" v-if="formData.authtype === AuthType.Menu">
+                    <el-input v-model="formData.url">
                         <template #prepend>
-                            <el-select v-model="formItem.urltype" style="width: 120px">
+                            <el-select v-model="formData.urltype" style="width: 120px">
                                 <el-option :label="item.label" :value="item.value"
                                     v-for="(item, index) in getUrlTypeList()" :key="index" />
                             </el-select>
@@ -51,14 +51,14 @@
                     </el-input>
                 </el-form-item>
                 <el-form-item label="组件地址" prop="component"
-                    v-if="formItem.authtype !== AuthType.Menu || formItem.urltype === UrlType.Path">
-                    <el-input v-model="formItem.component" />
+                    v-if="formData.authtype !== AuthType.Menu || formData.urltype === UrlType.Path">
+                    <el-input v-model="formData.component" />
                 </el-form-item>
                 <el-form-item label="备注" prop="remark">
-                    <el-input type="textarea" :rows="2" v-model="formItem.remark" />
+                    <el-input type="textarea" :rows="2" v-model="formData.remark" />
                 </el-form-item>
                 <el-form-item label="是否隐藏">
-                    <el-switch :active-value="1" :inactive-value="0" v-model="formItem.hidden" />
+                    <el-switch :active-value="1" :inactive-value="0" v-model="formData.hidden" />
                 </el-form-item>
             </el-form>
         </template>
@@ -88,7 +88,7 @@ const props = defineProps({
     }
 })
 
-const { loading, menus, formItem, formSubmit } = useMenuForm(props.selectedRow)
+const { loading, menus, formData, formSubmit } = useMenuForm(props.selectedRow)
 const show = ref(true)
 const refresh = ref(false)
 

+ 1 - 1
src/packages/pc/views/system/menu/index.vue

@@ -42,7 +42,7 @@ const openEditComponent = (row?: Ermcp.NewFuncmenuRsp) => {
 
 // 展开或收起表格
 const tableExpandAll = () => {
-    const table = tableRef.value.getRef
+    const table = tableRef.value.elTable
     isRowExpansion.value = !isRowExpansion.value
     const toggleRowExpansionAll = (data: Ermcp.NewFuncmenuRsp[]) => {
         data.forEach((item) => {

+ 1 - 1
src/packages/pc/views/system/role/index.vue

@@ -6,7 +6,7 @@
             </template>
             <template #operate="{ row }">
                 <app-auth-operation :menus="['system_role_auth', 'system_role_edit', 'system_role_delete']"
-                    :options="{ selectedRow: row }" linkButton />
+                    :options="{ selectedRow: row }" />
             </template>
         </app-table>
     </app-view>

+ 0 - 6
src/packages/pc/views/warehousing/out/index.vue

@@ -1,6 +0,0 @@
-<template>
-    <app-view>出库</app-view>
-</template>
-
-<script lang="ts" setup>
-</script>

+ 31 - 35
src/packages/pc/views/warehousing/stock/components/edit/diamond.vue

@@ -1,26 +1,26 @@
 <!-- 添加商品-单颗裸钻 -->
 <template>
-    <el-form ref="formRef" class="el-form--horizontal" label-width="100px" :model="formItem" :rules="formRules">
+    <el-form ref="formRef" class="el-form--horizontal" label-width="100px" :model="formData" :rules="formRules">
         <el-form-item label="商品编号" prop="GoodsNo">
-            <el-input placeholder="请输入" v-model="formItem.GoodsNo" />
+            <el-input placeholder="请输入" v-model="formData.GoodsNo" />
         </el-form-item>
         <el-form-item label="履约方式" prop="PerformanceTemplateID" v-if="code === 'warehousing_stock_sell'">
             <component :is="components.performance" v-model="performanceId" />
         </el-form-item>
         <el-form-item label="货币类型" prop="ZSCurrencyType">
-            <el-radio-group v-model="formItem.ZSCurrencyType">
+            <el-radio-group v-model="formData.ZSCurrencyType">
                 <el-radio :label="item.value" v-for="(item, index) in enums.currencyTypeList" :key="index">
                     {{ item.label }}
                 </el-radio>
             </el-radio-group>
         </el-form-item>
         <el-form-item label="价格" prop="Price">
-            <el-input type="number" placeholder="请输入" v-model.number="formItem.Price">
+            <el-input type="number" placeholder="请输入" v-model.number="formData.Price">
                 <template #append>{{ currencyInfo?.enumitemvalue }}</template>
             </el-input>
         </el-form-item>
         <el-form-item label="克拉重量" prop="Weight">
-            <el-input type="number" placeholder="请输入" v-model.number="formItem.Weight">
+            <el-input type="number" placeholder="请输入" v-model.number="formData.Weight">
                 <template #append>(克拉)</template>
             </el-input>
         </el-form-item>
@@ -35,84 +35,80 @@
         </el-form-item>
         <el-form-item label="尺寸" prop="Size">
             <div class="el-form-item--col">
-                <el-input-number type="number" v-model="formItem.Size1" :controls="false" />
+                <el-input-number type="number" v-model="formData.Size1" :controls="false" />
                 <span>×</span>
-                <el-input-number type="number" v-model="formItem.Size2" :controls="false" />
+                <el-input-number type="number" v-model="formData.Size2" :controls="false" />
                 <span>×</span>
-                <el-input-number type="number" v-model="formItem.Size3" :controls="false" />
+                <el-input-number type="number" v-model="formData.Size3" :controls="false" />
             </div>
         </el-form-item>
         <el-form-item label="颜色" prop="ZSColorType1">
-            <el-select v-model="formItem.ZSColorType1">
+            <el-select v-model="formData.ZSColorType1">
                 <el-option :label="item.label" :value="item.value" v-for="(item, index) in enums.colorTypeList"
                     :key="index" />
             </el-select>
         </el-form-item>
         <el-form-item label="切工" prop="ZSCutType1">
-            <el-select v-model="formItem.ZSCutType1" clearable>
+            <el-select v-model="formData.ZSCutType1" clearable>
                 <el-option :label="item.label" :value="item.value" v-for="(item, index) in enums.cutTypeList"
                     :key="index" />
             </el-select>
         </el-form-item>
         <el-form-item label="净度" prop="ZSClarityType1">
-            <el-select v-model="formItem.ZSClarityType1">
+            <el-select v-model="formData.ZSClarityType1">
                 <el-option :label="item.label" :value="item.value" v-for="(item, index) in enums.clarityTypeList"
                     :key="index" />
             </el-select>
         </el-form-item>
         <el-form-item label="抛光" prop="ZSPolishType1">
-            <el-select v-model="formItem.ZSPolishType1" clearable>
+            <el-select v-model="formData.ZSPolishType1" clearable>
                 <el-option :label="item.label" :value="item.value" v-for="(item, index) in enums.polishTypeList"
                     :key="index" />
             </el-select>
         </el-form-item>
         <el-form-item label="对称" prop="ZSSymmetryType1">
-            <el-select v-model="formItem.ZSSymmetryType1" clearable>
+            <el-select v-model="formData.ZSSymmetryType1" clearable>
                 <el-option :label="item.label" :value="item.value" v-for="(item, index) in enums.symmetryTypeList"
                     :key="index" />
             </el-select>
         </el-form-item>
         <el-form-item label="荧光" prop="ZSFluorescenceType1">
-            <el-select v-model="formItem.ZSFluorescenceType1" clearable>
+            <el-select v-model="formData.ZSFluorescenceType1" clearable>
                 <el-option :label="item.label" :value="item.value" v-for="(item, index) in enums.fluorescenceTypeList"
                     :key="index" />
             </el-select>
         </el-form-item>
         <el-form-item label="仓库" prop="WarehouseID">
-            <el-select v-model="formItem.WarehouseID">
+            <el-select v-model="formData.WarehouseID">
                 <el-option :label="item.warehousename" :value="item.autoid" v-for="(item, index) in warehouseList"
                     :key="index" />
             </el-select>
         </el-form-item>
         <el-form-item label="市场价" prop="MarketPrice">
-            <el-input type="number" placeholder="请输入" v-model.number="formItem.MarketPrice">
+            <el-input type="number" placeholder="请输入" v-model.number="formData.MarketPrice">
                 <template #append>{{ currencyInfo?.enumitemvalue }}</template>
             </el-input>
         </el-form-item>
         <el-form-item label="证书类型" prop="ZSCertType">
-            <el-select v-model="formItem.ZSCertType" clearable>
+            <el-select v-model="formData.ZSCertType" clearable>
                 <el-option :label="item.label" :value="item.value" v-for="(item, index) in enums.certTypeList"
                     :key="index" />
             </el-select>
         </el-form-item>
         <el-form-item label="证书编号" prop="CerNo">
-            <el-input placeholder="请输入" v-model="formItem.CerNo" />
+            <el-input placeholder="请输入" v-model="formData.CerNo" />
         </el-form-item>
         <el-form-item label="商品照片" prop="ImagePath">
             <app-upload />
         </el-form-item>
         <el-form-item class="el-form-item--row" label="备注" prop="Remark">
-            <el-input type="textarea" v-model="formItem.Remark" />
-        </el-form-item>
-        <el-form-item class="el-form-item--row">
-            <el-button type="primary" :loading="loading" @click="onSubmit">提交</el-button>
-            <el-button :loading="loading" @click="onCancel(false)" plain>取消</el-button>
+            <el-input type="textarea" v-model="formData.Remark" />
         </el-form-item>
     </el-form>
 </template>
 
 <script lang="ts" setup>
-import { ref, PropType, defineAsyncComponent, watch } from 'vue'
+import { ref, PropType, defineAsyncComponent } from 'vue'
 import { ElMessage } from 'element-plus'
 import type { FormInstance, FormRules } from 'element-plus'
 import { Category } from '@/constants/enum/diamond'
@@ -131,8 +127,8 @@ const components = {
     performance: defineAsyncComponent(() => import('@pc/components/modules/performance/index.vue')),
 }
 
-const emit = defineEmits(['loading', 'cancel'])
-const { loading, formItem, performanceId, shapeId, caratUnit, enums, warehouseList, currencyInfo, formSubmit } = useDiamondForm(Category.Diamond)
+const emit = defineEmits(['cancel'])
+const { loading, formData, performanceId, shapeId, caratUnit, enums, warehouseList, currencyInfo, formSubmit } = useDiamondForm(Category.Diamond)
 const formRef = ref<FormInstance>()
 
 const formRules: FormRules = {
@@ -166,7 +162,7 @@ const formRules: FormRules = {
     }],
     Size: [{
         validator: (rule, value, callback) => {
-            const { Size1, Size2, Size3 } = formItem
+            const { Size1, Size2, Size3 } = formData
             if ((!Size1 && !Size2 && !Size3) || (Size1 && Size2 && Size3)) {
                 callback()
             } else {
@@ -179,22 +175,18 @@ const formRules: FormRules = {
 // 选择形状
 const shapeChange = (value: number) => {
     if (value) {
-        formItem.ZSShapeType = [value]
+        formData.ZSShapeType = [value]
     } else {
-        formItem.ZSShapeType = []
+        formData.ZSShapeType = []
     }
 }
 
-const onCancel = (isRefresh = false) => {
-    emit('cancel', isRefresh)
-}
-
 const onSubmit = () => {
     formRef.value?.validate((valid) => {
         if (valid) {
             formSubmit().then(() => {
                 ElMessage.success('提交成功')
-                onCancel(true)
+                emit('cancel', true)
             }).catch((err) => {
                 ElMessage.error('提交失败:' + err)
             })
@@ -202,5 +194,9 @@ const onSubmit = () => {
     })
 }
 
-watch(loading, (val) => emit('loading', val))
+// 暴露组件属性给父组件调用
+defineExpose({
+    loading,
+    submit: onSubmit
+})
 </script>

+ 25 - 29
src/packages/pc/views/warehousing/stock/components/edit/diamonds.vue

@@ -1,31 +1,31 @@
 <!-- 添加商品-成批裸钻 -->
 <template>
-    <el-form ref="formRef" class="el-form--horizontal" label-width="100px" :model="formItem" :rules="formRules">
+    <el-form ref="formRef" class="el-form--horizontal" label-width="100px" :model="formData" :rules="formRules">
         <el-form-item label="商品编号" prop="GoodsNo">
-            <el-input placeholder="请输入" v-model="formItem.GoodsNo" />
+            <el-input placeholder="请输入" v-model="formData.GoodsNo" />
         </el-form-item>
         <el-form-item label="履约方式" prop="PerformanceTemplateID" v-if="code === 'warehousing_stock_sell'">
             <component :is="components.performance" v-model="performanceId" />
         </el-form-item>
         <el-form-item label="货币类型" prop="ZSCurrencyType">
-            <el-radio-group v-model="formItem.ZSCurrencyType">
+            <el-radio-group v-model="formData.ZSCurrencyType">
                 <el-radio :label="item.value" v-for="(item, index) in enums.currencyTypeList" :key="index">
                     {{ item.label }}
                 </el-radio>
             </el-radio-group>
         </el-form-item>
         <el-form-item label="总价" prop="Price">
-            <el-input type="number" placeholder="请输入" v-model.number="formItem.Price">
+            <el-input type="number" placeholder="请输入" v-model.number="formData.Price">
                 <template #append>{{ currencyInfo?.enumitemvalue }}</template>
             </el-input>
         </el-form-item>
         <el-form-item label="总重量" prop="Weight">
-            <el-input type="number" placeholder="请输入" v-model.number="formItem.Weight">
+            <el-input type="number" placeholder="请输入" v-model.number="formData.Weight">
                 <template #append>(克拉)</template>
             </el-input>
         </el-form-item>
         <el-form-item label="平均重量" prop="WeightAvg">
-            <el-input type="number" placeholder="请输入" v-model.number="formItem.WeightAvg">
+            <el-input type="number" placeholder="请输入" v-model.number="formData.WeightAvg">
                 <template #append>(克拉)</template>
             </el-input>
         </el-form-item>
@@ -33,7 +33,7 @@
             <span>{{ currencyInfo?.param2 }}{{ caratUnit }} (总价/总重量)</span>
         </el-form-item>
         <el-form-item class="el-form-item--row" label="形状" prop="ZSShapeType">
-            <app-multiple class="el-form-item--col" :data-list="enums.shapeTypeList" v-model="formItem.ZSShapeType"
+            <app-multiple class="el-form-item--col" :data-list="enums.shapeTypeList" v-model="formData.ZSShapeType"
                 checkbox />
         </el-form-item>
         <el-form-item label="颜色" prop="ZSColorType">
@@ -59,13 +59,13 @@
                 v-model="selectedType.fluorescenceType" />
         </el-form-item>
         <el-form-item label="仓库" prop="WarehouseID">
-            <el-select v-model="formItem.WarehouseID">
+            <el-select v-model="formData.WarehouseID">
                 <el-option :label="item.warehousename" :value="item.autoid" v-for="(item, index) in warehouseList"
                     :key="index" />
             </el-select>
         </el-form-item>
         <el-form-item label="市场价" prop="MarketPrice">
-            <el-input type="number" placeholder="请输入" v-model.number="formItem.MarketPrice">
+            <el-input type="number" placeholder="请输入" v-model.number="formData.MarketPrice">
                 <template #append>{{ currencyInfo?.enumitemvalue }}</template>
             </el-input>
         </el-form-item>
@@ -73,17 +73,13 @@
             <app-upload />
         </el-form-item>
         <el-form-item class="el-form-item--row" label="备注" prop="Remark">
-            <el-input type="textarea" v-model="formItem.Remark" />
-        </el-form-item>
-        <el-form-item class="el-form-item--row">
-            <el-button type="primary" @click="onSubmit">提交</el-button>
-            <el-button @click="onCancel(false)" plain>取消</el-button>
+            <el-input type="textarea" v-model="formData.Remark" />
         </el-form-item>
     </el-form>
 </template>
 
 <script lang="ts" setup>
-import { ref, PropType, defineAsyncComponent, watch } from 'vue'
+import { ref, PropType, defineAsyncComponent } from 'vue'
 import { ElMessage } from 'element-plus'
 import type { FormInstance, FormRules } from 'element-plus'
 import { Category } from '@/constants/enum/diamond'
@@ -103,8 +99,8 @@ const components = {
     performance: defineAsyncComponent(() => import('@pc/components/modules/performance/index.vue')),
 }
 
-const emit = defineEmits(['loading', 'cancel'])
-const { loading, formItem, performanceId, caratUnit, selectedType, enums, warehouseList, currencyInfo, formSubmit } = useDiamondForm(Category.Diamonds)
+const emit = defineEmits(['cancel'])
+const { loading, formData, performanceId, caratUnit, selectedType, enums, warehouseList, currencyInfo, formSubmit } = useDiamondForm(Category.Diamonds)
 const formRef = ref<FormInstance>()
 
 const formRules: FormRules = {
@@ -129,7 +125,7 @@ const formRules: FormRules = {
     ZSColorType: [{
         required: true,
         validator: (rule, value, callback) => {
-            if (formItem.ZSColorType1 && formItem.ZSColorType2) {
+            if (formData.ZSColorType1 && formData.ZSColorType2) {
                 callback()
             } else {
                 callback(new Error('请选择颜色'))
@@ -139,7 +135,7 @@ const formRules: FormRules = {
     ZSClarityType: [{
         required: true,
         validator: (rule, value, callback) => {
-            if (formItem.ZSClarityType1 && formItem.ZSClarityType2) {
+            if (formData.ZSClarityType1 && formData.ZSClarityType2) {
                 callback()
             } else {
                 callback(new Error('请选择净度'))
@@ -148,7 +144,7 @@ const formRules: FormRules = {
     }],
     ZSCutType: [{
         validator: (rule, value, callback) => {
-            if ((!formItem.ZSCutType1 && !formItem.ZSCutType2) || (formItem.ZSCutType1 && formItem.ZSCutType2)) {
+            if ((!formData.ZSCutType1 && !formData.ZSCutType2) || (formData.ZSCutType1 && formData.ZSCutType2)) {
                 callback()
             } else {
                 callback(new Error('请选择切工'))
@@ -157,7 +153,7 @@ const formRules: FormRules = {
     }],
     ZSPolishType: [{
         validator: (rule, value, callback) => {
-            if ((!formItem.ZSPolishType1 && !formItem.ZSPolishType2) || (formItem.ZSPolishType1 && formItem.ZSPolishType2)) {
+            if ((!formData.ZSPolishType1 && !formData.ZSPolishType2) || (formData.ZSPolishType1 && formData.ZSPolishType2)) {
                 callback()
             } else {
                 callback(new Error('请选择抛光'))
@@ -166,7 +162,7 @@ const formRules: FormRules = {
     }],
     ZSSymmetryType: [{
         validator: (rule, value, callback) => {
-            if ((!formItem.ZSSymmetryType1 && !formItem.ZSSymmetryType2) || (formItem.ZSSymmetryType1 && formItem.ZSSymmetryType2)) {
+            if ((!formData.ZSSymmetryType1 && !formData.ZSSymmetryType2) || (formData.ZSSymmetryType1 && formData.ZSSymmetryType2)) {
                 callback()
             } else {
                 callback(new Error('请选择对称'))
@@ -175,7 +171,7 @@ const formRules: FormRules = {
     }],
     ZSFluorescenceType: [{
         validator: (rule, value, callback) => {
-            if ((!formItem.ZSFluorescenceType1 && !formItem.ZSFluorescenceType2) || (formItem.ZSFluorescenceType1 && formItem.ZSFluorescenceType2)) {
+            if ((!formData.ZSFluorescenceType1 && !formData.ZSFluorescenceType2) || (formData.ZSFluorescenceType1 && formData.ZSFluorescenceType2)) {
                 callback()
             } else {
                 callback(new Error('请选择荧光'))
@@ -184,16 +180,12 @@ const formRules: FormRules = {
     }]
 }
 
-const onCancel = (isRefresh = false) => {
-    emit('cancel', isRefresh)
-}
-
 const onSubmit = () => {
     formRef.value?.validate((valid) => {
         if (valid) {
             formSubmit().then(() => {
                 ElMessage.success('提交成功')
-                onCancel(true)
+                emit('cancel', true)
             }).catch((err) => {
                 ElMessage.error('提交失败:' + err)
             })
@@ -201,5 +193,9 @@ const onSubmit = () => {
     })
 }
 
-watch(loading, (val) => emit('loading', val))
+// 暴露组件属性给父组件调用
+defineExpose({
+    loading,
+    submit: onSubmit
+})
 </script>

+ 33 - 37
src/packages/pc/views/warehousing/stock/components/edit/fancy.vue

@@ -1,26 +1,26 @@
 <!-- 添加商品-彩色钻石 -->
 <template>
-    <el-form ref="formRef" class="el-form--horizontal" label-width="100px" :model="formItem" :rules="formRules">
+    <el-form ref="formRef" class="el-form--horizontal" label-width="100px" :model="formData" :rules="formRules">
         <el-form-item label="商品编号" prop="GoodsNo">
-            <el-input placeholder="请输入" v-model="formItem.GoodsNo" />
+            <el-input placeholder="请输入" v-model="formData.GoodsNo" />
         </el-form-item>
         <el-form-item label="履约方式" prop="PerformanceTemplateID" v-if="code === 'warehousing_stock_sell'">
             <component :is="components.performance" v-model="performanceId" />
         </el-form-item>
         <el-form-item label="货币类型" prop="ZSCurrencyType">
-            <el-radio-group v-model="formItem.ZSCurrencyType">
+            <el-radio-group v-model="formData.ZSCurrencyType">
                 <el-radio :label="item.value" v-for="(item, index) in enums.currencyTypeList" :key="index">
                     {{ item.label }}
                 </el-radio>
             </el-radio-group>
         </el-form-item>
         <el-form-item label="价格" prop="Price">
-            <el-input type="number" placeholder="请输入" v-model.number="formItem.Price">
+            <el-input type="number" placeholder="请输入" v-model.number="formData.Price">
                 <template #append>{{ currencyInfo?.enumitemvalue }}</template>
             </el-input>
         </el-form-item>
         <el-form-item label="克拉重量" prop="Weight">
-            <el-input type="number" placeholder="请输入" v-model.number="formItem.Weight">
+            <el-input type="number" placeholder="请输入" v-model.number="formData.Weight">
                 <template #append>(克拉)</template>
             </el-input>
         </el-form-item>
@@ -29,11 +29,11 @@
         </el-form-item>
         <el-form-item label="尺寸" prop="Size">
             <div class="el-form-item--col">
-                <el-input-number type="number" v-model="formItem.Size1" :controls="false" />
+                <el-input-number type="number" v-model="formData.Size1" :controls="false" />
                 <span>×</span>
-                <el-input-number type="number" v-model="formItem.Size2" :controls="false" />
+                <el-input-number type="number" v-model="formData.Size2" :controls="false" />
                 <span>×</span>
-                <el-input-number type="number" v-model="formItem.Size3" :controls="false" />
+                <el-input-number type="number" v-model="formData.Size3" :controls="false" />
             </div>
         </el-form-item>
         <el-form-item label="形状" prop="ZSShapeType">
@@ -44,79 +44,75 @@
         </el-form-item>
         <el-form-item label="颜色" prop="ZSCZColorType">
             <div class="el-form-item--col">
-                <el-select v-model="formItem.ZSCZColor1Type">
+                <el-select v-model="formData.ZSCZColor1Type">
                     <el-option :label="item.label" :value="item.value"
                         v-for="(item, index) in enums.fancyColorType1List" :key="index" />
                 </el-select>
-                <el-select v-model="formItem.ZSCZColor2Type">
+                <el-select v-model="formData.ZSCZColor2Type">
                     <el-option :label="item.label" :value="item.value"
                         v-for="(item, index) in enums.fancyColorType2List" :key="index" />
                 </el-select>
-                <el-select v-model="formItem.ZSCZColor3Type">
+                <el-select v-model="formData.ZSCZColor3Type">
                     <el-option :label="item.label" :value="item.value"
                         v-for="(item, index) in enums.fancyColorType3List" :key="index" />
                 </el-select>
             </div>
         </el-form-item>
         <el-form-item label="净度" prop="ZSClarityType1">
-            <el-select v-model="formItem.ZSClarityType1">
+            <el-select v-model="formData.ZSClarityType1">
                 <el-option :label="item.label" :value="item.value" v-for="(item, index) in enums.clarityTypeList"
                     :key="index" />
             </el-select>
         </el-form-item>
         <el-form-item label="抛光" prop="ZSPolishType1">
-            <el-select v-model="formItem.ZSPolishType1" clearable>
+            <el-select v-model="formData.ZSPolishType1" clearable>
                 <el-option :label="item.label" :value="item.value" v-for="(item, index) in enums.polishTypeList"
                     :key="index" />
             </el-select>
         </el-form-item>
         <el-form-item label="对称" prop="ZSSymmetryType1">
-            <el-select v-model="formItem.ZSSymmetryType1" clearable>
+            <el-select v-model="formData.ZSSymmetryType1" clearable>
                 <el-option :label="item.label" :value="item.value" v-for="(item, index) in enums.symmetryTypeList"
                     :key="index" />
             </el-select>
         </el-form-item>
         <el-form-item label="荧光" prop="ZSFluorescenceType1">
-            <el-select v-model="formItem.ZSFluorescenceType1" clearable>
+            <el-select v-model="formData.ZSFluorescenceType1" clearable>
                 <el-option :label="item.label" :value="item.value" v-for="(item, index) in enums.fluorescenceTypeList"
                     :key="index" />
             </el-select>
         </el-form-item>
         <el-form-item label="仓库" prop="WarehouseID">
-            <el-select v-model="formItem.WarehouseID">
+            <el-select v-model="formData.WarehouseID">
                 <el-option :label="item.warehousename" :value="item.autoid" v-for="(item, index) in warehouseList"
                     :key="index" />
             </el-select>
         </el-form-item>
         <el-form-item label="市场价" prop="MarketPrice">
-            <el-input type="number" placeholder="请输入" v-model.number="formItem.MarketPrice">
+            <el-input type="number" placeholder="请输入" v-model.number="formData.MarketPrice">
                 <template #append>{{ currencyInfo?.enumitemvalue }}</template>
             </el-input>
         </el-form-item>
         <el-form-item label="证书类型" prop="ZSCertType">
-            <el-select v-model="formItem.ZSCertType" clearable>
+            <el-select v-model="formData.ZSCertType" clearable>
                 <el-option :label="item.label" :value="item.value" v-for="(item, index) in enums.certTypeList"
                     :key="index" />
             </el-select>
         </el-form-item>
         <el-form-item label="证书编号" prop="CerNo">
-            <el-input placeholder="请输入" v-model="formItem.CerNo" />
+            <el-input placeholder="请输入" v-model="formData.CerNo" />
         </el-form-item>
         <el-form-item label="商品照片" prop="ImagePath">
             <app-upload />
         </el-form-item>
         <el-form-item class="el-form-item--row" label="备注" prop="Remark">
-            <el-input type="textarea" v-model="formItem.Remark" />
-        </el-form-item>
-        <el-form-item class="el-form-item--row">
-            <el-button type="primary" :loading="loading" @click="onSubmit">提交</el-button>
-            <el-button :loading="loading" @click="onCancel(false)" plain>取消</el-button>
+            <el-input type="textarea" v-model="formData.Remark" />
         </el-form-item>
     </el-form>
 </template>
 
 <script lang="ts" setup>
-import { ref, PropType, defineAsyncComponent, watch } from 'vue'
+import { ref, PropType, defineAsyncComponent } from 'vue'
 import { ElMessage } from 'element-plus'
 import type { FormInstance, FormRules } from 'element-plus'
 import { Category } from '@/constants/enum/diamond'
@@ -135,8 +131,8 @@ const components = {
     performance: defineAsyncComponent(() => import('@pc/components/modules/performance/index.vue')),
 }
 
-const emit = defineEmits(['loading', 'cancel'])
-const { loading, formItem, performanceId, shapeId, caratUnit, enums, warehouseList, currencyInfo, formSubmit } = useDiamondForm(Category.Fancy)
+const emit = defineEmits(['cancel'])
+const { loading, formData, performanceId, shapeId, caratUnit, enums, warehouseList, currencyInfo, formSubmit } = useDiamondForm(Category.Fancy)
 const formRef = ref<FormInstance>()
 
 const formRules: FormRules = {
@@ -170,7 +166,7 @@ const formRules: FormRules = {
     ZSCZColorType: [{
         required: true,
         validator: (rule, value, callback) => {
-            if (formItem.ZSCZColor1Type && formItem.ZSCZColor2Type && formItem.ZSCZColor3Type) {
+            if (formData.ZSCZColor1Type && formData.ZSCZColor2Type && formData.ZSCZColor3Type) {
                 callback()
             } else {
                 callback(new Error('请选择颜色'))
@@ -179,7 +175,7 @@ const formRules: FormRules = {
     }],
     Size: [{
         validator: (rule, value, callback) => {
-            const { Size1, Size2, Size3 } = formItem
+            const { Size1, Size2, Size3 } = formData
             if ((!Size1 && !Size2 && !Size3) || (Size1 && Size2 && Size3)) {
                 callback()
             } else {
@@ -192,22 +188,18 @@ const formRules: FormRules = {
 // 选择形状
 const shapeChange = (value: number) => {
     if (value) {
-        formItem.ZSShapeType = [value]
+        formData.ZSShapeType = [value]
     } else {
-        formItem.ZSShapeType = []
+        formData.ZSShapeType = []
     }
 }
 
-const onCancel = (isRefresh = false) => {
-    emit('cancel', isRefresh)
-}
-
 const onSubmit = () => {
     formRef.value?.validate((valid) => {
         if (valid) {
             formSubmit().then(() => {
                 ElMessage.success('提交成功')
-                onCancel(true)
+                emit('cancel', true)
             }).catch((err) => {
                 ElMessage.error('提交失败:' + err)
             })
@@ -215,5 +207,9 @@ const onSubmit = () => {
     })
 }
 
-watch(loading, (val) => emit('loading', val))
+// 暴露组件属性给父组件调用
+defineExpose({
+    loading,
+    submit: onSubmit
+})
 </script>

+ 8 - 8
src/packages/pc/views/warehousing/stock/components/edit/index.vue

@@ -1,14 +1,18 @@
 <!-- 账号权限 -->
 <template>
     <app-drawer :title="code === 'warehousing_stock_sell' ? '商品上架' : '添加商品'" :width="960" v-model:show="show"
-        :loading="loading" :refresh="refresh">
+        :loading="formRef?.loading" :refresh="refresh">
         <el-tabs v-model="componentId">
             <template v-for="(item, index) in categoryList" :key="index">
                 <el-tab-pane :label="item.label" :name="Category[item.value]" />
             </template>
         </el-tabs>
-        <component :is="componentMap.get(componentId)" v-bind="{ code, selectedRow }" style="padding-bottom:24px"
-            @cancel="onCancel" @loading="onLoading" v-if="componentId" />
+        <component ref="formRef" :is="componentMap.get(componentId)" v-bind="{ code, selectedRow }" @cancel="onCancel"
+            v-if="componentId" />
+        <template #footer>
+            <el-button @click="onCancel(false)" plain>取消</el-button>
+            <el-button type="primary" @click="formRef?.submit">提交</el-button>
+        </template>
     </app-drawer>
 </template>
 
@@ -33,8 +37,8 @@ const componentMap = new Map<string, unknown>([
     ['Fancy', defineAsyncComponent(() => import('./fancy.vue'))],
 ])
 
+const formRef = shallowRef()
 const show = shallowRef(true)
-const loading = shallowRef(false)
 const refresh = shallowRef(false)
 const componentId = shallowRef('')
 const categoryList = getCategoryList()
@@ -44,10 +48,6 @@ if (categoryList.length) {
     componentId.value = Category[value]
 }
 
-const onLoading = (isLoading: boolean) => {
-    loading.value = isLoading
-}
-
 const onCancel = (isRefresh: boolean) => {
     show.value = false
     refresh.value = isRefresh

+ 34 - 38
src/packages/pc/views/warehousing/stock/components/edit/jewelry.vue

@@ -1,42 +1,42 @@
 <!-- 添加商品-钻石首饰 -->
 <template>
-    <el-form ref="formRef" class="el-form--horizontal" label-width="100px" :model="formItem" :rules="formRules">
+    <el-form ref="formRef" class="el-form--horizontal" label-width="100px" :model="formData" :rules="formRules">
         <el-form-item label="商品编号" prop="GoodsNo">
-            <el-input placeholder="请输入" v-model="formItem.GoodsNo" />
+            <el-input placeholder="请输入" v-model="formData.GoodsNo" />
         </el-form-item>
         <el-form-item label="履约方式" prop="PerformanceTemplateID" v-if="code === 'warehousing_stock_sell'">
             <component :is="components.performance" v-model="performanceId" />
         </el-form-item>
         <el-form-item label="货币类型" prop="ZSCurrencyType">
-            <el-radio-group v-model="formItem.ZSCurrencyType">
+            <el-radio-group v-model="formData.ZSCurrencyType">
                 <el-radio :label="item.value" v-for="(item, index) in enums.currencyTypeList" :key="index">
                     {{ item.label }}
                 </el-radio>
             </el-radio-group>
         </el-form-item>
         <el-form-item label="价格" prop="Price">
-            <el-input type="number" placeholder="请输入" v-model.number="formItem.Price">
+            <el-input type="number" placeholder="请输入" v-model.number="formData.Price">
                 <template #append>{{ currencyInfo?.enumitemvalue }}</template>
             </el-input>
         </el-form-item>
         <el-form-item label="主石重量" prop="Weight">
-            <el-input type="number" placeholder="请输入" v-model.number="formItem.Weight">
+            <el-input type="number" placeholder="请输入" v-model.number="formData.Weight">
                 <template #append>(克拉)</template>
             </el-input>
         </el-form-item>
         <el-form-item label="款式" prop="ZSStyleType">
-            <el-select v-model="formItem.ZSStyleType">
+            <el-select v-model="formData.ZSStyleType">
                 <el-option :label="item.label" :value="item.value" v-for="(item, index) in enums.styleTypeList"
                     :key="index" />
             </el-select>
         </el-form-item>
         <el-form-item label="尺寸" prop="Size">
             <div class="el-form-item--col">
-                <el-input-number type="number" v-model="formItem.Size1" :controls="false" />
+                <el-input-number type="number" v-model="formData.Size1" :controls="false" />
                 <span>×</span>
-                <el-input-number type="number" v-model="formItem.Size2" :controls="false" />
+                <el-input-number type="number" v-model="formData.Size2" :controls="false" />
                 <span>×</span>
-                <el-input-number type="number" v-model="formItem.Size3" :controls="false" />
+                <el-input-number type="number" v-model="formData.Size3" :controls="false" />
             </div>
         </el-form-item>
         <el-form-item label="形状" prop="ZSShapeType">
@@ -46,82 +46,78 @@
             </el-select>
         </el-form-item>
         <el-form-item label="切工" prop="ZSCutType1">
-            <el-select v-model="formItem.ZSCutType1" clearable>
+            <el-select v-model="formData.ZSCutType1" clearable>
                 <el-option :label="item.label" :value="item.value" v-for="(item, index) in enums.cutTypeList"
                     :key="index" />
             </el-select>
         </el-form-item>
         <el-form-item label="颜色" prop="ZSColorType1">
-            <el-select v-model="formItem.ZSColorType1">
+            <el-select v-model="formData.ZSColorType1">
                 <el-option :label="item.label" :value="item.value" v-for="(item, index) in enums.colorTypeList"
                     :key="index" />
             </el-select>
         </el-form-item>
         <el-form-item label="抛光" prop="ZSPolishType1">
-            <el-select v-model="formItem.ZSPolishType1" clearable>
+            <el-select v-model="formData.ZSPolishType1" clearable>
                 <el-option :label="item.label" :value="item.value" v-for="(item, index) in enums.polishTypeList"
                     :key="index" />
             </el-select>
         </el-form-item>
         <el-form-item label="净度" prop="ZSClarityType1">
-            <el-select v-model="formItem.ZSClarityType1">
+            <el-select v-model="formData.ZSClarityType1">
                 <el-option :label="item.label" :value="item.value" v-for="(item, index) in enums.clarityTypeList"
                     :key="index" />
             </el-select>
         </el-form-item>
         <el-form-item label="荧光" prop="ZSFluorescenceType1">
-            <el-select v-model="formItem.ZSFluorescenceType1" clearable>
+            <el-select v-model="formData.ZSFluorescenceType1" clearable>
                 <el-option :label="item.label" :value="item.value" v-for="(item, index) in enums.fluorescenceTypeList"
                     :key="index" />
             </el-select>
         </el-form-item>
         <el-form-item label="对称" prop="ZSSymmetryType1">
-            <el-select v-model="formItem.ZSSymmetryType1" clearable>
+            <el-select v-model="formData.ZSSymmetryType1" clearable>
                 <el-option :label="item.label" :value="item.value" v-for="(item, index) in enums.symmetryTypeList"
                     :key="index" />
             </el-select>
         </el-form-item>
         <el-form-item label="市场价" prop="MarketPrice">
-            <el-input type="number" placeholder="请输入" v-model.number="formItem.MarketPrice">
+            <el-input type="number" placeholder="请输入" v-model.number="formData.MarketPrice">
                 <template #append>{{ currencyInfo?.enumitemvalue }}</template>
             </el-input>
         </el-form-item>
         <el-form-item label="仓库" prop="WarehouseID">
-            <el-select v-model="formItem.WarehouseID">
+            <el-select v-model="formData.WarehouseID">
                 <el-option :label="item.warehousename" :value="item.autoid" v-for="(item, index) in warehouseList"
                     :key="index" />
             </el-select>
         </el-form-item>
         <el-form-item label="镶嵌材料" prop="SettingMaterial">
-            <el-input placeholder="请输入" v-model="formItem.SettingMaterial" />
+            <el-input placeholder="请输入" v-model="formData.SettingMaterial" />
         </el-form-item>
         <el-form-item label="证书类型" prop="ZSCertType">
-            <el-select v-model="formItem.ZSCertType" clearable>
+            <el-select v-model="formData.ZSCertType" clearable>
                 <el-option :label="item.label" :value="item.value" v-for="(item, index) in enums.certTypeList"
                     :key="index" />
             </el-select>
         </el-form-item>
         <el-form-item label="证书编号" prop="CerNo">
-            <el-input placeholder="请输入" v-model="formItem.CerNo" />
+            <el-input placeholder="请输入" v-model="formData.CerNo" />
         </el-form-item>
         <el-form-item label="配石描述" prop="StoneDesc">
-            <el-input placeholder="请输入" v-model="formItem.StoneDesc" />
+            <el-input placeholder="请输入" v-model="formData.StoneDesc" />
         </el-form-item>
         <el-form-item label="商品照片" prop="ImagePath">
             <app-upload />
         </el-form-item>
         <el-form-item class="el-form-item--row" label="备注" prop="Remark">
-            <el-input type="textarea" v-model="formItem.Remark" />
-        </el-form-item>
-        <el-form-item class="el-form-item--row">
-            <el-button type="primary" :loading="loading" @click="onSubmit">提交</el-button>
-            <el-button :loading="loading" @click="onCancel(false)" plain>取消</el-button>
+            <el-input type="textarea" v-model="formData.Remark" />
         </el-form-item>
     </el-form>
 </template>
 
 <script lang="ts" setup>
-import { ref, PropType, defineAsyncComponent, watch } from 'vue'
+import { ref, PropType, defineAsyncComponent } from 'vue'
 import { ElMessage } from 'element-plus'
 import type { FormInstance, FormRules } from 'element-plus'
 import { Category } from '@/constants/enum/diamond'
@@ -140,8 +136,8 @@ const components = {
     performance: defineAsyncComponent(() => import('@pc/components/modules/performance/index.vue')),
 }
 
-const emit = defineEmits(['loading', 'cancel'])
-const { loading, formItem, performanceId, shapeId, enums, warehouseList, currencyInfo, formSubmit } = useDiamondForm(Category.Jewelry)
+const emit = defineEmits(['cancel'])
+const { loading, formData, performanceId, shapeId, enums, warehouseList, currencyInfo, formSubmit } = useDiamondForm(Category.Jewelry)
 const formRef = ref<FormInstance>()
 
 const formRules: FormRules = {
@@ -177,7 +173,7 @@ const formRules: FormRules = {
     }],
     Size: [{
         validator: (rule, value, callback) => {
-            const { Size1, Size2, Size3 } = formItem
+            const { Size1, Size2, Size3 } = formData
             if ((!Size1 && !Size2 && !Size3) || (Size1 && Size2 && Size3)) {
                 callback()
             } else {
@@ -190,22 +186,18 @@ const formRules: FormRules = {
 // 选择形状
 const shapeChange = (value: number) => {
     if (value) {
-        formItem.ZSShapeType = [value]
+        formData.ZSShapeType = [value]
     } else {
-        formItem.ZSShapeType = []
+        formData.ZSShapeType = []
     }
 }
 
-const onCancel = (isRefresh = false) => {
-    emit('cancel', isRefresh)
-}
-
 const onSubmit = () => {
     formRef.value?.validate((valid) => {
         if (valid) {
             formSubmit().then(() => {
                 ElMessage.success('提交成功')
-                onCancel(true)
+                emit('cancel', true)
             }).catch((err) => {
                 ElMessage.error('提交失败:' + err)
             })
@@ -213,5 +205,9 @@ const onSubmit = () => {
     })
 }
 
-watch(loading, (val) => emit('loading', val))
+// 暴露组件属性给父组件调用
+defineExpose({
+    loading,
+    submit: onSubmit
+})
 </script>

+ 25 - 29
src/packages/pc/views/warehousing/stock/components/edit/rough.vue

@@ -1,31 +1,31 @@
 <!-- 添加商品-成批毛坯 -->
 <template>
-    <el-form ref="formRef" class="el-form--horizontal" label-width="110px" :model="formItem" :rules="formRules">
+    <el-form ref="formRef" class="el-form--horizontal" label-width="110px" :model="formData" :rules="formRules">
         <el-form-item label="商品编号" prop="GoodsNo">
-            <el-input placeholder="请输入" v-model="formItem.GoodsNo" />
+            <el-input placeholder="请输入" v-model="formData.GoodsNo" />
         </el-form-item>
         <el-form-item label="履约方式" prop="PerformanceTemplateID" v-if="code === 'warehousing_stock_sell'">
             <component :is="components.performance" v-model="performanceId" />
         </el-form-item>
         <el-form-item label="货币类型" prop="ZSCurrencyType">
-            <el-radio-group v-model="formItem.ZSCurrencyType">
+            <el-radio-group v-model="formData.ZSCurrencyType">
                 <el-radio :label="item.value" v-for="(item, index) in enums.currencyTypeList" :key="index">
                     {{ item.label }}
                 </el-radio>
             </el-radio-group>
         </el-form-item>
         <el-form-item label="总价" prop="Price">
-            <el-input type="number" placeholder="请输入" v-model.number="formItem.Price">
+            <el-input type="number" placeholder="请输入" v-model.number="formData.Price">
                 <template #append>{{ currencyInfo?.enumitemvalue }}</template>
             </el-input>
         </el-form-item>
         <el-form-item label="总重量" prop="Weight">
-            <el-input type="number" placeholder="请输入" v-model.number="formItem.Weight">
+            <el-input type="number" placeholder="请输入" v-model.number="formData.Weight">
                 <template #append>(克拉)</template>
             </el-input>
         </el-form-item>
         <el-form-item label="平均重量" prop="WeightAvg">
-            <el-input type="number" placeholder="请输入" v-model.number="formItem.WeightAvg">
+            <el-input type="number" placeholder="请输入" v-model.number="formData.WeightAvg">
                 <template #append>(克拉)</template>
             </el-input>
         </el-form-item>
@@ -33,7 +33,7 @@
             <span>{{ currencyInfo?.param2 }}{{ caratUnit }} (总价/总重量)</span>
         </el-form-item>
         <el-form-item class="el-form-item--row" label="晶型" prop="ZSCrystalType">
-            <app-multiple class="el-form-item--col" :data-list="enums.crystalTypeList" v-model="formItem.ZSCrystalType"
+            <app-multiple class="el-form-item--col" :data-list="enums.crystalTypeList" v-model="formData.ZSCrystalType"
                 checkbox />
         </el-form-item>
         <el-form-item label="颜色" prop="ZSColorType">
@@ -48,24 +48,24 @@
                 v-model="selectedType.clarityType" />
         </el-form-item>
         <el-form-item label="原产地" prop="Origin">
-            <el-input placeholder="请输入" v-model="formItem.Origin" />
+            <el-input placeholder="请输入" v-model="formData.Origin" />
         </el-form-item>
         <el-form-item label="仓库" prop="WarehouseID">
-            <el-select v-model="formItem.WarehouseID">
+            <el-select v-model="formData.WarehouseID">
                 <el-option :label="item.warehousename" :value="item.autoid" v-for="(item, index) in warehouseList"
                     :key="index" />
             </el-select>
         </el-form-item>
         <el-form-item label="金伯利编号" prop="CPCertNo">
-            <el-input placeholder="请输入" v-model="formItem.CPCertNo" />
+            <el-input placeholder="请输入" v-model="formData.CPCertNo" />
         </el-form-item>
         <el-form-item label="市场价" prop="MarketPrice">
-            <el-input type="number" placeholder="请输入" v-model.number="formItem.MarketPrice">
+            <el-input type="number" placeholder="请输入" v-model.number="formData.MarketPrice">
                 <template #append>{{ currencyInfo?.enumitemvalue }}</template>
             </el-input>
         </el-form-item>
         <el-form-item label="金伯利重量" prop="KPWeight">
-            <el-input type="number" placeholder="请输入" v-model.number="formItem.KPWeight">
+            <el-input type="number" placeholder="请输入" v-model.number="formData.KPWeight">
                 <template #append>(克拉)</template>
             </el-input>
         </el-form-item>
@@ -79,17 +79,13 @@
             <app-upload />
         </el-form-item>
         <el-form-item class="el-form-item--row" label="备注" prop="Remark">
-            <el-input type="textarea" v-model="formItem.Remark" />
-        </el-form-item>
-        <el-form-item class="el-form-item--row">
-            <el-button :loading="loading" type="primary" @click="onSubmit">提交</el-button>
-            <el-button :loading="loading" @click="onCancel(false)" plain>取消</el-button>
+            <el-input type="textarea" v-model="formData.Remark" />
         </el-form-item>
     </el-form>
 </template>
 
 <script lang="ts" setup>
-import { ref, PropType, defineAsyncComponent, watch } from 'vue'
+import { ref, PropType, defineAsyncComponent } from 'vue'
 import { ElMessage } from 'element-plus'
 import type { FormInstance, FormRules } from 'element-plus'
 import { Category } from '@/constants/enum/diamond'
@@ -109,8 +105,8 @@ const components = {
     performance: defineAsyncComponent(() => import('@pc/components/modules/performance/index.vue')),
 }
 
-const emit = defineEmits(['loading', 'cancel'])
-const { loading, formItem, performanceId, caratUnit, selectedType, enums, warehouseList, currencyInfo, formSubmit } = useDiamondForm(Category.Rough)
+const emit = defineEmits(['cancel'])
+const { loading, formData, performanceId, caratUnit, selectedType, enums, warehouseList, currencyInfo, formSubmit } = useDiamondForm(Category.Rough)
 const formRef = ref<FormInstance>()
 
 const formRules: FormRules = {
@@ -138,7 +134,7 @@ const formRules: FormRules = {
     ZSColorType: [{
         required: true,
         validator: (rule, value, callback) => {
-            if (formItem.ZSColorType1 && formItem.ZSColorType2) {
+            if (formData.ZSColorType1 && formData.ZSColorType2) {
                 callback()
             } else {
                 callback(new Error('请选择颜色'))
@@ -147,7 +143,7 @@ const formRules: FormRules = {
     }],
     ZSClarityType: [{
         validator: (rule, value, callback) => {
-            if ((!formItem.ZSClarityType1 && !formItem.ZSClarityType2) || (formItem.ZSClarityType1 && formItem.ZSClarityType2)) {
+            if ((!formData.ZSClarityType1 && !formData.ZSClarityType2) || (formData.ZSClarityType1 && formData.ZSClarityType2)) {
                 callback()
             } else {
                 callback(new Error('请选择净度'))
@@ -156,7 +152,7 @@ const formRules: FormRules = {
     }],
     ZSFluorescenceType: [{
         validator: (rule, value, callback) => {
-            if ((!formItem.ZSFluorescenceType1 && !formItem.ZSFluorescenceType2) || (formItem.ZSFluorescenceType1 && formItem.ZSFluorescenceType2)) {
+            if ((!formData.ZSFluorescenceType1 && !formData.ZSFluorescenceType2) || (formData.ZSFluorescenceType1 && formData.ZSFluorescenceType2)) {
                 callback()
             } else {
                 callback(new Error('请选择荧光'))
@@ -165,16 +161,12 @@ const formRules: FormRules = {
     }]
 }
 
-const onCancel = (isRefresh = false) => {
-    emit('cancel', isRefresh)
-}
-
 const onSubmit = () => {
     formRef.value?.validate((valid) => {
         if (valid) {
             formSubmit().then(() => {
                 ElMessage.success('提交成功')
-                onCancel(true)
+                emit('cancel', true)
             }).catch((err) => {
                 ElMessage.error('提交失败:' + err)
             })
@@ -182,5 +174,9 @@ const onSubmit = () => {
     })
 }
 
-watch(loading, (val) => emit('loading', val))
+// 暴露组件属性给父组件调用
+defineExpose({
+    loading,
+    submit: onSubmit
+})
 </script>

+ 1 - 2
src/packages/pc/views/warehousing/stock/index.vue

@@ -19,8 +19,7 @@
             </template>
             <!-- 操作 -->
             <template #operate="{ row }">
-                <app-auth-operation :menus="['details']" :options="{ selectedRow: row }" @closed="getDiamondList"
-                    linkButton />
+                <app-auth-operation :menus="['details']" :options="{ selectedRow: row }" @closed="getDiamondList" />
             </template>
             <template #footer v-if="total > pageSize">
                 <app-pagination :total="total" v-model:page-size="pageSize" v-model:page-index="pageIndex"

+ 14 - 14
src/packages/pc/views/warehousing/warehouse/components/edit/index.vue

@@ -2,37 +2,37 @@
 <template>
     <app-drawer :title="selectedRow.warehousecode ? '修改仓库' : '新增仓库'" :width="880" v-model:show="show" :loading="loading"
         :refresh="refresh">
-        <el-form ref="formRef" class="el-form--horizontal" label-width="100px" :model="formItem" :rules="formRules">
+        <el-form ref="formRef" class="el-form--horizontal" label-width="100px" :model="formData" :rules="formRules">
             <el-form-item label="仓库代码" prop="warehousecode">
-                <el-input placeholder="请输入" v-model="formItem.warehousecode" />
+                <el-input placeholder="请输入" v-model="formData.warehousecode" />
             </el-form-item>
             <el-form-item label="所属机构">
                 <span>{{ accountName }}</span>
             </el-form-item>
             <el-form-item label="仓库名称" prop="warehousename">
-                <el-input placeholder="请输入" v-model="formItem.warehousename" />
+                <el-input placeholder="请输入" v-model="formData.warehousename" />
             </el-form-item>
             <el-form-item label="仓库类型" prop="warehousetype">
                 <span>自有库</span>
             </el-form-item>
             <el-form-item label="联系人" prop="contactname">
-                <el-input placeholder="请输入" v-model="formItem.contactname" />
+                <el-input placeholder="请输入" v-model="formData.contactname" />
             </el-form-item>
             <el-form-item label="联系电话" prop="contactnum">
-                <el-input placeholder="请输入" v-model="formItem.contactnum" />
+                <el-input placeholder="请输入" v-model="formData.contactnum" />
             </el-form-item>
             <el-form-item class="el-form-item--row" label="仓库地址" prop="area">
-                <app-region class="el-form-item--col" v-model:province="formItem.provinceid"
-                    v-model:city="formItem.cityid" v-model:district="formItem.districtid" />
+                <app-region class="el-form-item--col" v-model:province="formData.provinceid"
+                    v-model:city="formData.cityid" v-model:district="formData.districtid" />
             </el-form-item>
             <el-form-item class="el-form-item--row" prop="address">
-                <el-input placeholder="请输入" v-model="formItem.address" />
-            </el-form-item>
-            <el-form-item class="el-form-item--row">
-                <el-button type="primary" @click="onSubmit">提交</el-button>
-                <el-button @click="onCancel(false)" plain>取消</el-button>
+                <el-input placeholder="请输入" v-model="formData.address" />
             </el-form-item>
         </el-form>
+        <template #footer>
+            <el-button @click="onCancel(false)" plain>取消</el-button>
+            <el-button type="primary" @click="onSubmit">提交</el-button>
+        </template>
     </app-drawer>
 </template>
 
@@ -51,7 +51,7 @@ const props = defineProps({
     }
 })
 
-const { loading, formItem, accountName, warehouseOperate } = useWarehouseForm(props.selectedRow)
+const { loading, formData, accountName, warehouseOperate } = useWarehouseForm(props.selectedRow)
 const show = ref(true)
 const refresh = ref(false)
 const formRef = ref<FormInstance>()
@@ -66,7 +66,7 @@ const formRules: FormRules = {
         {
             required: true,
             validator: (rule, value, callback) => {
-                if (formItem.provinceid && formItem.cityid && formItem.districtid) {
+                if (formData.provinceid && formData.cityid && formData.districtid) {
                     callback()
                 } else {
                     callback(new Error('请选择仓库地区'))

+ 1 - 2
src/packages/pc/views/warehousing/warehouse/index.vue

@@ -6,8 +6,7 @@
                 <app-auth-operation :menus="['add']" @closed="getWarehouseList" />
             </template>
             <template #operate="{ row }">
-                <app-auth-operation :menus="['edit']" :options="{ selectedRow: row }" @closed="getWarehouseList"
-                    linkButton />
+                <app-auth-operation :menus="['edit']" :options="{ selectedRow: row }" @closed="getWarehouseList" />
             </template>
             <template #footer v-if="total > pageSize">
                 <app-pagination :total="total" v-model:page-size="pageSize" v-model:page-index="pageIndex"

+ 2 - 2
src/services/socket/quote/index.ts

@@ -25,8 +25,8 @@ function quoteServerMiddleware(params: QuoteRequest): Promise<Proto.QuoteRsp[]>
                 if (raw.content) {
                     parseSubscribeRsp(raw.content).then((res) => {
                         resolve(res);
-                    }).catch((err) => {
-                        console.warn('报文解析失败', err);
+                    }).catch(() => {
+                        console.warn('报文解析失败', raw);
                         reject('报文解析失败')
                     })
                 } else {

+ 2 - 2
src/services/socket/trade/index.ts

@@ -46,8 +46,8 @@ function tradeServerMiddleware<Req, Rsp>(reqCode: keyof typeof FunCode, rspCode:
                     protobuf.responseDecode<Rsp>(rspCode, raw.content).then((res) => {
                         console.log(rspCode, FunCode[rspCode], res);
                         resolve(res);
-                    }).catch((msg) => {
-                        console.warn(rspCode, msg);
+                    }).catch(() => {
+                        console.warn(rspCode, raw);
                         reject('报文解析失败');
                     })
                 },

+ 1 - 1
src/types/ermcp/goods.d.ts

@@ -29,7 +29,7 @@ declare namespace Ermcp {
         isvalid: number; // 是否有效 - 0:无效 1:有效
         kppath: string; // 金伯利证书图片(相对地址) - 类型:3
         kpweight: string; // 金伯利证书重量 - 类型:3
-        ladingbillid: number; // 提单ID(208+Unix秒时间戳(10位)+xxxxxx)
+        ladingbillid: string; // 提单ID(208+Unix秒时间戳(10位)+xxxxxx)
         marketprice: string; // 市场价
         origin: string; // 原产地 - 类型:3
         price: number; // 总价(价格) - 类型:1,2,3,4,5

+ 4 - 3
src/types/proto/order.d.ts

@@ -1,4 +1,5 @@
 import { IMessageHead } from '@/services/socket/trade/protobuf/proto'
+import Long from 'long'
 
 declare global {
     namespace Proto {
@@ -58,13 +59,13 @@ declare global {
             UserID: number; // 用户ID,必填
             AccountID: number; // 资金账户ID,必填
             WRStandardID: number; // 现货商品ID,必填
-            WRFactorTypeID: number; // 仓单要素类型ID,必填
+            WRFactorTypeID?: number; // 仓单要素类型ID,必填
             OrderQty: number; // 挂牌数量,必填2位小数,为WeigthAvg的整数倍
-            LadingBillID: number; // 提单ID,必填
+            LadingBillID: Long; // 提单ID,必填
             SubNum: number; // 提单子单号,必填
             PerformanceTemplateID?: number; // 履约计划模板ID
             TimevalidType: number; // 时间有效类型
-            ValidTime: string; // 有效期限
+            ValidTime?: string; // 有效期限
             OrderSrc: number; // 委托来源
             ClientSerialNo: string; // 客户端流水号
             ClientOrderTime: string; // 客户端委托时间