huangbin 4 лет назад
Родитель
Сommit
8d1b67ccec

+ 5 - 0
src/common/constants/buttonType.ts

@@ -9,6 +9,11 @@ export interface ButtonType {
     custom_info_btn_cancel: string; // 客户资料 撤销
     custom_info_btn_cancel: string; // 客户资料 撤销
     custom_info_btn_check: string; // 客户资料 审核
     custom_info_btn_check: string; // 客户资料 审核
 
 
+    goods_info_spot_normal_add: string; // 现货品种 新增
+    goods_info_spot_normal_modify: string; // 现货品种 修改
+    goods_info_spot_normal_disable: string; // 现货品种 停用
+    goods_info_spot_disable_recover: string; // 现货品种 恢复
+
     spot_contract_btn_add: string; // 现货合同 添加
     spot_contract_btn_add: string; // 现货合同 添加
     spot_contract_btn_resubmit: string; // 现货合同 重新提交
     spot_contract_btn_resubmit: string; // 现货合同 重新提交
     spot_contract_btn_modify: string; // 现货合同 修改
     spot_contract_btn_modify: string; // 现货合同 修改

+ 1 - 1
src/views/information/goods/components/add/index.vue

@@ -438,7 +438,7 @@ export default defineComponent({
     },
     },
     setup(props, context) {
     setup(props, context) {
         // 控制关闭弹窗
         // 控制关闭弹窗
-        const { visible, cancel } = closeModal('spot_contract_btn_add');
+        const { visible, cancel } = closeModal('goods_info_spot_normal_add');
         // 下单方法
         // 下单方法
         const { loading, addAction } = handleAdd();
         const { loading, addAction } = handleAdd();
         // 单位列表
         // 单位列表

+ 9 - 9
src/views/information/goods/components/disable/index.vue

@@ -110,13 +110,13 @@
 </template>
 </template>
 
 
 <script lang="ts">
 <script lang="ts">
-import {defineComponent, PropType, ref} from 'vue';
+import { defineComponent, PropType, ref } from 'vue';
 import { closeModal } from '@/common/setup/modal/index';
 import { closeModal } from '@/common/setup/modal/index';
-import {updateUserAccount} from "@/views/information/custom/compoments/setup";
-import {QueryCustomInfoType} from "@/services/go/ermcp/customInfo/interface";
-import {formatValue} from "@/common/methods";
-import {getStatusName} from "@/views/information/custom/setup";
-import {Modal} from "ant-design-vue";
+import { updateUserAccount } from '@/views/information/custom/compoments/setup';
+import { QueryCustomInfoType } from '@/services/go/ermcp/customInfo/interface';
+import { formatValue } from '@/common/methods';
+import { getStatusName } from '@/views/information/custom/setup';
+import { Modal } from 'ant-design-vue';
 
 
 export default defineComponent({
 export default defineComponent({
     name: 'custom-disable',
     name: 'custom-disable',
@@ -128,16 +128,16 @@ export default defineComponent({
         },
         },
     },
     },
     setup(props) {
     setup(props) {
-        const { visible, cancel } = closeModal('custom_info_btn_disable');
+        const { visible, cancel } = closeModal('goods_info_spot_normal_disable');
         const maskClosableFlag = ref<boolean>(false);
         const maskClosableFlag = ref<boolean>(false);
-        const  {loading, ModifyUserInfo} = updateUserAccount();
+        const { loading, ModifyUserInfo } = updateUserAccount();
         function submit() {
         function submit() {
             Modal.confirm({
             Modal.confirm({
                 title: '是否确认停用客户资料',
                 title: '是否确认停用客户资料',
                 okText: '确认停用',
                 okText: '确认停用',
                 cancelText: '取消',
                 cancelText: '取消',
                 onOk() {
                 onOk() {
-                    ModifyUserInfo(props.selectedRow.userid, 6, cancel);
+                    ModifyUserInfo(props.selectedRow.userid, 6);
                 },
                 },
                 onCancel() {
                 onCancel() {
                     console.log('Cancel');
                     console.log('Cancel');

+ 2 - 3
src/views/information/goods/components/leftMenu/index.vue

@@ -35,9 +35,8 @@ const handleMenu = (context: SetupContext) => {
     const openKeys = ref<string[]>(['1']);
     const openKeys = ref<string[]>(['1']);
 
 
     function menuClick(value: any) {
     function menuClick(value: any) {
-        console.log('value', value);
-
-        context.emit('chooseMenu', value.key);
+        const is = value.keyPath.includes('goods_info_spot_normal') ? true : false;
+        context.emit('chooseMenu', { key: value.key, is });
     }
     }
     return { collapsed, selectedKeys, openKeys, menuClick };
     return { collapsed, selectedKeys, openKeys, menuClick };
 };
 };

+ 1 - 2
src/views/information/goods/components/modify/index.vue

@@ -201,8 +201,7 @@ export default defineComponent({
         // }
         // }
     },
     },
     setup() {
     setup() {
-        // const { visible, cancel } = closeModal('modifyCustomInfo');
-        const { visible, cancel } = closeModal('custom_info_btn_modify');
+        const { visible, cancel } = closeModal('goods_info_spot_normal_modify');
 
 
         const loading = ref<boolean>(false);
         const loading = ref<boolean>(false);
         const maskClosableFlag = ref<boolean>(false);
         const maskClosableFlag = ref<boolean>(false);

+ 25 - 5
src/views/information/goods/components/rightSpot/index.vue

@@ -12,8 +12,15 @@
         <span class="green ml10">{{selctedDeliveryGoods.data.dgstatus ? '正常' : '停用'}}</span>
         <span class="green ml10">{{selctedDeliveryGoods.data.dgstatus ? '正常' : '停用'}}</span>
       </div>
       </div>
       <div class="tltBtns">
       <div class="tltBtns">
-        <a-button class="blueBtn">修改</a-button>
-        <a-button class="redBtn">停用</a-button>
+        <template v-if="isNormal">
+          <a-button class="blueBtn"
+                    @click="modifyAction">修改</a-button>
+          <a-button class="redBtn"
+                    @click="disableAction">停用</a-button>
+        </template>
+        <template>
+          <a-button class="blueBtn">恢复</a-button>
+        </template>
       </div>
       </div>
     </div>
     </div>
     <div class="spotCont">
     <div class="spotCont">
@@ -108,6 +115,8 @@
         </a-collapse-panel>
         </a-collapse-panel>
       </a-collapse>
       </a-collapse>
     </div>
     </div>
+    <Modify />
+    <Disable />
   </div>
   </div>
 </template>
 </template>
 
 
@@ -115,8 +124,10 @@
 import { defineComponent, ref, PropType } from 'vue';
 import { defineComponent, ref, PropType } from 'vue';
 import { handleDG, getGoodsUnit } from '../../setup';
 import { handleDG, getGoodsUnit } from '../../setup';
 import { ErmcpDeliveryGoodsDetailEx } from '@/services/go/ermcp/goodsInfo/interface';
 import { ErmcpDeliveryGoodsDetailEx } from '@/services/go/ermcp/goodsInfo/interface';
-import APP from '@/services';
 import { initData } from '@/common/methods';
 import { initData } from '@/common/methods';
+import { openModal } from '@/common/setup/modal/index';
+import Modify from '../modify/index.vue';
+import Disable from '../disable/index.vue';
 
 
 export default defineComponent({
 export default defineComponent({
     name: 'rightSpot',
     name: 'rightSpot',
@@ -125,11 +136,20 @@ export default defineComponent({
             default: handleDG,
             default: handleDG,
             type: Object as PropType<ErmcpDeliveryGoodsDetailEx>,
             type: Object as PropType<ErmcpDeliveryGoodsDetailEx>,
         },
         },
+        isNormal: {
+            default: true,
+            type: Boolean,
+        },
+    },
+    components: {
+        Modify,
+        Disable,
     },
     },
-    components: {},
     setup(props, context) {
     setup(props, context) {
+        const { openAction: modifyAction } = openModal('goods_info_spot_normal_modify');
+        const { openAction: disableAction } = openModal('goods_info_spot_normal_disable');
         initData(() => {});
         initData(() => {});
-        return { getGoodsUnit };
+        return { getGoodsUnit, modifyAction, disableAction };
     },
     },
 });
 });
 </script>
 </script>

+ 8 - 9
src/views/information/goods/list/spot-variety/index.vue

@@ -4,6 +4,7 @@
        :loading="loading">
        :loading="loading">
     <filterCustomTable @search="search">
     <filterCustomTable @search="search">
       <a-button class="operBtn"
       <a-button class="operBtn"
+                v-if="isNormal"
                 @click="addAction">新增</a-button>
                 @click="addAction">新增</a-button>
     </filterCustomTable>
     </filterCustomTable>
     <div class="spotTableCont">
     <div class="spotTableCont">
@@ -12,7 +13,8 @@
                   @chooseMenu="chooseDG"></leftMenu>
                   @chooseMenu="chooseDG"></leftMenu>
       </div>
       </div>
       <div class="rightCont">
       <div class="rightCont">
-        <rightSpot :selctedDeliveryGoods="selctedDeliveryGoods"></rightSpot>
+        <rightSpot :selctedDeliveryGoods="selctedDeliveryGoods"
+                   :isNormal="isNormal"></rightSpot>
       </div>
       </div>
     </div>
     </div>
     <!-- 新增商品 -->
     <!-- 新增商品 -->
@@ -21,16 +23,14 @@
 </template>
 </template>
 
 
 <script lang="ts">
 <script lang="ts">
-import { defineComponent, ref } from 'vue';
-
+import { defineComponent } from 'vue';
 import filterCustomTable from '@/views/information/goods/components/filterTable/index.vue';
 import filterCustomTable from '@/views/information/goods/components/filterTable/index.vue';
 import leftMenu from '@/views/information/goods/components/leftMenu/index.vue';
 import leftMenu from '@/views/information/goods/components/leftMenu/index.vue';
 import rightSpot from '@/views/information/goods/components/rightSpot/index.vue';
 import rightSpot from '@/views/information/goods/components/rightSpot/index.vue';
 import { openModal } from '@/common/setup/modal/index';
 import { openModal } from '@/common/setup/modal/index';
 import { initData } from '@/common/methods/index';
 import { initData } from '@/common/methods/index';
 import AddGoods from '@/views/information/goods/components/add/index.vue';
 import AddGoods from '@/views/information/goods/components/add/index.vue';
-import { handleDG, handleGDStatue } from '../../setup';
-import { getThirdMenuData } from '@/common/setup/table/button';
+import { handleDG } from '../../setup';
 
 
 export default defineComponent({
 export default defineComponent({
     name: 'spot-variety',
     name: 'spot-variety',
@@ -42,15 +42,14 @@ export default defineComponent({
     },
     },
     setup() {
     setup() {
         // 控制弹窗
         // 控制弹窗
-        const { openAction: addAction } = openModal('spot_contract_btn_add');
-        const { loading, selctedDeliveryGoods, chooseDG, menuList, queryDG } = handleDG();
-        const { isNormal, changeStatue } = handleGDStatue();
+        const { openAction: addAction } = openModal('goods_info_spot_normal_add');
+        const { loading, selctedDeliveryGoods, chooseDG, isNormal, menuList, queryDG } = handleDG();
 
 
         initData(() => {
         initData(() => {
             // 加载数据在这里
             // 加载数据在这里
             queryDG();
             queryDG();
         });
         });
-        return { addAction, loading, selctedDeliveryGoods, chooseDG, menuList };
+        return { addAction, loading, selctedDeliveryGoods, chooseDG, isNormal, menuList };
     },
     },
 });
 });
 </script>
 </script>

+ 10 - 16
src/views/information/goods/setup.ts

@@ -81,6 +81,7 @@ export function handleDG() {
     const deliveryGoodsList = ref<ErmcpDeliveryGoodsDetailEx[]>([])
     const deliveryGoodsList = ref<ErmcpDeliveryGoodsDetailEx[]>([])
     // 选中的具体某一天现货品种数据
     // 选中的具体某一天现货品种数据
     const selctedDeliveryGoods = reactive<ErmcpDeliveryGoodsDetailEx>(initDG())
     const selctedDeliveryGoods = reactive<ErmcpDeliveryGoodsDetailEx>(initDG())
+    const isNormal = ref<boolean>(true) // true => 正常; false => 停用
     // const menuList = ref<MenuList[]>(initMenu());
     // const menuList = ref<MenuList[]>(initMenu());
     // 获取现货品种数据
     // 获取现货品种数据
     function queryDG(param?: number) {
     function queryDG(param?: number) {
@@ -107,23 +108,28 @@ export function handleDG() {
             })
             })
             // 获取默认第一条数据
             // 获取默认第一条数据
             if (menuList.value[0].children?.length) {
             if (menuList.value[0].children?.length) {
-                chooseDG(menuList.value[0].children[0].key)
+                chooseDG({ key: menuList.value[0].children[0].key, is: true })
             } else if (menuList.value[1].children?.length) {
             } else if (menuList.value[1].children?.length) {
-                chooseDG(menuList.value[1].children[0].key)
+                chooseDG({ key: menuList.value[1].children[0].key, is: false })
             }
             }
         }).catch(err => {
         }).catch(err => {
             message.error(err)
             message.error(err)
         }).finally(() => loading.value = false)
         }).finally(() => loading.value = false)
     }
     }
+    interface Value {
+        key: string;
+        is: boolean;
+    }
     // 选择某条现货数据
     // 选择某条现货数据
-    function chooseDG(key: string) {
+    function chooseDG({ key, is }: Value) {
+        isNormal.value = is
         const obj = deliveryGoodsList.value.find(e => e.data.deliverygoodsid === Number(key))
         const obj = deliveryGoodsList.value.find(e => e.data.deliverygoodsid === Number(key))
         if (obj) {
         if (obj) {
             mergeObj(selctedDeliveryGoods, obj)
             mergeObj(selctedDeliveryGoods, obj)
             console.log('selctedDeliveryGoods', selctedDeliveryGoods);
             console.log('selctedDeliveryGoods', selctedDeliveryGoods);
         }
         }
     }
     }
-    return { loading, deliveryGoodsList, menuList, queryDG, selctedDeliveryGoods, chooseDG }
+    return { loading, deliveryGoodsList, menuList, queryDG, isNormal, selctedDeliveryGoods, chooseDG }
 }
 }
 
 
 /**
 /**
@@ -141,15 +147,3 @@ export function getGoodsUnit(unit: number) {
 export function getGoodsUnitList() {
 export function getGoodsUnitList() {
     return getItemEnum('goodsunit')
     return getItemEnum('goodsunit')
 }
 }
-
-/**
- * 处理现货品种的状态
- * @returns 
- */
-export function handleGDStatue() {
-    const isNormal = ref<boolean>(true) // true => 正常; false => 停用
-    function changeStatue(value: boolean) {
-        isNormal.value = value;
-    }
-    return { isNormal, changeStatue }
-}