Переглянути джерело

commit 提交仓库信息停用和恢复功能

xkwg 4 роки тому
батько
коміт
c4cdbb6c2f

+ 2 - 2
src/services/funcode/index.ts

@@ -71,8 +71,8 @@ export const funCode: Code = {
     // 仓库信息
     WareHouseApplyReq: 1900685,     /// 仓库申请请求
     WareHouseApplyRsp: 1900686,    /// 仓库申请响应
-    WareHouseStateChangeReq: 1900687,    /// 仓库状态修改请求
-    WareHouseStateChangeRsp: 1900688,    /// 仓库状态修改响应
+    WarehouseStateChangeReq: 1900687,    /// 仓库状态修改请求
+    WarehouseStateChangeRsp: 1900688,    /// 仓库状态修改响应
 
     // 现货合同 -- 新增现货合同
     GldErmcpSpotContractOperateReq: 1900711,    /// 现货合同操作请求(1179653)

+ 3 - 3
src/services/proto/warehouse/index.ts

@@ -45,8 +45,8 @@ export const addWarehouseApply = (param: WarehouseApplyReq): Promise<any> => {
 export const warehouseStateChangeReq = (param: WarehouseStateChangeReq): Promise<any> => {
     return new Promise((resolve, reject) => {
         const params = {
-            protobufName: 'WareHouseStateChangeReq',
-            funCodeName: 'WareHouseStateChangeReq',
+            protobufName: 'WarehouseStateChangeReq',
+            funCodeName: 'WarehouseStateChangeReq',
             reqParams: param,
             msgHeadParams: {
                 AccountID: param.accountid,
@@ -57,7 +57,7 @@ export const warehouseStateChangeReq = (param: WarehouseStateChangeReq): Promise
         const package50 = buildProtoReq50(params);
         APP.sendTradingServer(package50, undefined, {
             onSuccess: (res) => {
-                const { isSuccess, result } = parseProtoRsp50(res, 'WareHouseStateChangeRsp');
+                const { isSuccess, result } = parseProtoRsp50(res, 'WarehouseStateChangeRsp');
                 if (isSuccess) {
                     resolve(result);
                 } else {

+ 114 - 79
src/views/information/warehouse-info/compoments/disable/index.vue

@@ -1,100 +1,135 @@
 <template>
-  <!-- 停用仓库信息-->
-  <a-modal class="commonModal warehouse-disable"
-           title="停用仓库信息"
-           v-model:visible="visible"
-           centered
-           :maskClosable="maskClosableFlag"
-           @cancel="cancel"
-           width="890px">
-    <template #footer>
-      <a-button key="submit"
-                class="cancelBtn"
-                @click="cancel">取消</a-button>
-      <a-button key="submit"
-                type="primary"
-                :loading="loading"
-                @click="submit">确认停用</a-button>
-    </template>
-    <a-form class="inlineForm"
-            :form="form"
-            @submit="handleSearch">
-      <a-row :gutter="24">
-        <a-col :span="12">
-          <a-form-item label="仓库类型">
-            <span class="white">自有库</span>
-          </a-form-item>
-        </a-col>
-        <a-col :span="12">
-          <a-form-item label="仓库名称">
-            <span class="white">深圳市南储公司2号库房</span>
-          </a-form-item>
-        </a-col>
-      </a-row>
-      <a-row :gutter="24">
-        <a-col :span="12">
-          <a-form-item label="仓库简称">
-            <span class="white">南储深圳2号库</span>
-          </a-form-item>
-        </a-col>
-        <a-col :span="12">
-          <a-form-item label="联系人">
-            <span class="white">王平</span>
-          </a-form-item>
-        </a-col>
-      </a-row>
-      <a-row :gutter="24">
-        <a-col :span="12">
-          <a-form-item label="联系电话">
-            <span class="white">13832676234</span>
-          </a-form-item>
-        </a-col>
-        <a-col :span="12">
-          <a-form-item label="状态">
-            <span class="green">正常</span>
-          </a-form-item>
-        </a-col>
-      </a-row>
-      <a-row :gutter="24">
-        <a-col :span="12">
-          <a-form-item label="所在地区">
-            <span class="white">广东省深圳市南山区</span>
-          </a-form-item>
-        </a-col>
-        <a-col :span="12">
-          <a-form-item label="详细地址">
-            <span class="white">深南大道1290号仓库</span>
-          </a-form-item>
-        </a-col>
-      </a-row>
-    </a-form>
-  </a-modal>
+    <!-- 停用仓库信息-->
+    <a-modal class="commonModal warehouse-disable"
+             title="停用仓库信息"
+             v-model:visible="visible"
+             centered
+             :maskClosable="maskClosableFlag"
+             @cancel="cancel"
+             width="890px">
+        <template #footer>
+            <a-button key="cancel"
+                      class="cancelBtn"
+                      @click="cancel">取消
+            </a-button>
+            <a-button key="submit"
+                      type="primary"
+                      :loading="loading"
+                      @click="submit">确认停用
+            </a-button>
+        </template>
+        <a-form class="inlineForm"
+                :form="form"
+                @submit="handleSearch">
+            <a-row :gutter="24">
+                <a-col :span="12">
+                    <a-form-item label="仓库类型">
+                        <span class="white">{{ getWareHouseTypeName(selectedRow.warehousetype) }}</span>
+                    </a-form-item>
+                </a-col>
+                <a-col :span="12">
+                    <a-form-item label="仓库名称">
+                        <span class="white">{{ formatValue(selectedRow.warehousename) }}</span>
+                    </a-form-item>
+                </a-col>
+            </a-row>
+            <a-row :gutter="24">
+                <a-col :span="12">
+                    <a-form-item label="仓库简称">
+                        <span class="white">{{ formatValue(selectedRow.warehousecode) }}</span>
+                    </a-form-item>
+                </a-col>
+                <a-col :span="12">
+                    <a-form-item label="联系人">
+                        <span class="white">{{ formatValue(selectedRow.contactname) }}</span>
+                    </a-form-item>
+                </a-col>
+            </a-row>
+            <a-row :gutter="24">
+                <a-col :span="12">
+                    <a-form-item label="联系电话">
+                        <span class="white">{{ formatValue(selectedRow.contactnum) }}</span>
+                    </a-form-item>
+                </a-col>
+                <a-col :span="12">
+                    <a-form-item label="状态">
+                        <span class="white">{{ gerWareHouseStatusName(selectedRow.warehousestatus) }}</span>
+                    </a-form-item>
+                </a-col>
+            </a-row>
+            <a-row :gutter="24">
+                <a-col :span="12">
+                    <a-form-item label="所在地区">
+                        <span class="white">{{ formatValue(selectedRow.address) }}</span>
+                    </a-form-item>
+                </a-col>
+                <a-col :span="12">
+                    <a-form-item label="详细地址">
+                        <span class="white">{{ formatValue(selectedRow.address) }}</span>
+                    </a-form-item>
+                </a-col>
+            </a-row>
+        </a-form>
+    </a-modal>
 </template>
 
 <script lang="ts">
-import { defineComponent, ref } from 'vue';
-import { closeModal } from '@/common/setup/modal/index';
+import {defineComponent, PropType, ref} from 'vue';
+import {closeModal} from '@/common/setup/modal/index';
+import {stopOrResumeWarehouse, wareType} from "@/views/information/warehouse-info/compoments/setup";
+import {ErmcpWareHouseInfo} from "@/services/go/ermcp/warehouse-info/interface";
+import {message, Modal} from "ant-design-vue";
+import {gerWareHouseStatusName, getWareHouseTypeName} from "@/views/information/warehouse-info/setup";
+import {formatValue} from "@/common/methods";
 
 export default defineComponent({
     name: 'warehouse_info_btn_disable',
     components: {},
-    setup() {
-        const { visible, cancel } = closeModal('warehouse_info_btn_disable');
-        const loading = ref<boolean>(false);
+    props: {
+        selectedRow: {
+            type: Object as PropType<ErmcpWareHouseInfo>,
+            default: {},
+        },
+    },
+    setup(props, context) {
+        const {visible, cancel} = closeModal('warehouse_info_btn_disable');
         const maskClosableFlag = ref<boolean>(false);
+        const {loading, changeStatus} = stopOrResumeWarehouse(wareType.stop);
+
         function submit() {
             loading.value = true;
-            setTimeout(() => {
-                loading.value = false;
-                cancel();
-            }, 2000);
+            Modal.confirm({
+                title: '是否确认停用仓库信息',
+                okText: '确认停用',
+                cancelText: '取消',
+                onOk() {
+                    console.log('OK');
+                    changeStatus(props.selectedRow.autoid)
+                        .then(res => {
+
+                            message.success(res)
+                            context.emit('refresh')
+                            cancel()
+                        })
+                        .catch(err => {
+                            message.error(err)
+                        })
+                },
+                onCancel() {
+                    console.log('Cancel');
+                },
+            });
         }
+
         return {
             visible,
             cancel,
             submit,
             loading,
             maskClosableFlag,
+            gerWareHouseStatusName,
+            getWareHouseTypeName,
+            formatValue,
         };
     },
 });

+ 113 - 79
src/views/information/warehouse-info/compoments/recover/index.vue

@@ -1,100 +1,134 @@
 <template>
-  <!-- 恢复仓库信息-->
-  <a-modal class="modify-custom"
-           title="恢复仓库信息"
-           v-model:visible="visible"
-           centered
-           :maskClosable="maskClosableFlag"
-           @cancel="cancel"
-           width="890px">
-    <template #footer>
-      <a-button key="submit"
-                class="cancelBtn"
-                @click="cancel">取消</a-button>
-      <a-button key="submit"
-                type="primary"
-                :loading="loading"
-                @click="submit">确认恢复</a-button>
-    </template>
-    <a-form class="inlineForm"
-              :form="form"
-              @submit="handleSearch">
-          <a-row :gutter="24">
-              <a-col :span="12">
-                  <a-form-item label="仓库类型">
-                      <span class="white">{{ getWareHouseTypeName(selectedRow.warehousetype) }}</span>
-                  </a-form-item>
-              </a-col>
-              <a-col :span="12">
-                  <a-form-item label="仓库名称">
-                      <span class="white">{{ formatValue(selectedRow.warehousename)}}</span>
-                  </a-form-item>
-              </a-col>
-          </a-row>
-          <a-row :gutter="24">
-              <a-col :span="12">
-                  <a-form-item label="仓库简称">
-                      <span class="white">{{ formatValue(selectedRow.warehousecode) }}</span>
-                  </a-form-item>
-              </a-col>
-              <a-col :span="12">
-                  <a-form-item label="联系人">
-                      <span class="white">{{ formatValue(selectedRow.contactname) }}</span>
-                  </a-form-item>
-              </a-col>
-          </a-row>
-          <a-row :gutter="24">
-              <a-col :span="12">
-                  <a-form-item label="联系电话">
-                      <span class="white">{{ formatValue(selectedRow.contactnum) }}</span>
-                  </a-form-item>
-              </a-col>
-              <a-col :span="12">
-                  <a-form-item label="状态">
-                      <span class="red">{{ gerWareHouseStatusName(selectedRow.warehousestatus) }}</span>
-                  </a-form-item>
-              </a-col>
-          </a-row>
-          <a-row :gutter="24">
-              <a-col :span="12">
-                  <a-form-item label="所在地区">
-                      <span class="white">{{ formatValue(selectedRow.address) }}</span>
-                  </a-form-item>
-              </a-col>
-              <a-col :span="12">
-                  <a-form-item label="详细地址">
-                      <span class="white">{{ formatValue(selectedRow.address) }}</span>
-                  </a-form-item>
-              </a-col>
-          </a-row>
-      </a-form>
-  </a-modal>
+    <!-- 恢复仓库信息-->
+    <a-modal class="modify-custom"
+             title="恢复仓库信息"
+             v-model:visible="visible"
+             centered
+             :maskClosable="maskClosableFlag"
+             @cancel="cancel"
+             width="890px">
+        <template #footer>
+            <a-button key="submit"
+                      class="cancelBtn"
+                      @click="cancel">取消
+            </a-button>
+            <a-button key="submit"
+                      type="primary"
+                      :loading="loading"
+                      @click="submit">确认恢复
+            </a-button>
+        </template>
+        <a-form class="inlineForm"
+                :form="form"
+                @submit="handleSearch">
+            <a-row :gutter="24">
+                <a-col :span="12">
+                    <a-form-item label="仓库类型">
+                        <span class="white">{{ getWareHouseTypeName(selectedRow.warehousetype) }}</span>
+                    </a-form-item>
+                </a-col>
+                <a-col :span="12">
+                    <a-form-item label="仓库名称">
+                        <span class="white">{{ formatValue(selectedRow.warehousename) }}</span>
+                    </a-form-item>
+                </a-col>
+            </a-row>
+            <a-row :gutter="24">
+                <a-col :span="12">
+                    <a-form-item label="仓库简称">
+                        <span class="white">{{ formatValue(selectedRow.warehousecode) }}</span>
+                    </a-form-item>
+                </a-col>
+                <a-col :span="12">
+                    <a-form-item label="联系人">
+                        <span class="white">{{ formatValue(selectedRow.contactname) }}</span>
+                    </a-form-item>
+                </a-col>
+            </a-row>
+            <a-row :gutter="24">
+                <a-col :span="12">
+                    <a-form-item label="联系电话">
+                        <span class="white">{{ formatValue(selectedRow.contactnum) }}</span>
+                    </a-form-item>
+                </a-col>
+                <a-col :span="12">
+                    <a-form-item label="状态">
+                        <span class="white">{{ gerWareHouseStatusName(selectedRow.warehousestatus) }}</span>
+                    </a-form-item>
+                </a-col>
+            </a-row>
+            <a-row :gutter="24">
+                <a-col :span="12">
+                    <a-form-item label="所在地区">
+                        <span class="white">{{ formatValue(selectedRow.address) }}</span>
+                    </a-form-item>
+                </a-col>
+                <a-col :span="12">
+                    <a-form-item label="详细地址">
+                        <span class="white">{{ formatValue(selectedRow.address) }}</span>
+                    </a-form-item>
+                </a-col>
+            </a-row>
+        </a-form>
+    </a-modal>
 </template>
 
 <script lang="ts">
-import { defineComponent, ref } from 'vue';
-import { closeModal } from '@/common/setup/modal/index';
+import {defineComponent, PropType, ref} from 'vue';
+import {closeModal} from '@/common/setup/modal/index';
+import {ErmcpWareHouseInfo} from "@/services/go/ermcp/warehouse-info/interface";
+import {stopOrResumeWarehouse, wareType} from "@/views/information/warehouse-info/compoments/setup";
+import {message, Modal} from "ant-design-vue";
+import {gerWareHouseStatusName, getWareHouseTypeName} from "@/views/information/warehouse-info/setup";
+import {formatValue} from "@/common/methods";
 
 export default defineComponent({
     name: 'warehouse_info_btn_recover',
     components: {},
-    setup() {
-        const { visible, cancel } = closeModal('warehouse_info_btn_recover');
-        const loading = ref<boolean>(false);
+    props: {
+        selectedRow: {
+            type: Object as PropType<ErmcpWareHouseInfo>,
+            default: {},
+        },
+    },
+    setup(props, context) {
+        const {visible, cancel} = closeModal('warehouse_info_btn_recover');
+        const {loading, changeStatus} = stopOrResumeWarehouse(wareType.normal);
         const maskClosableFlag = ref<boolean>(false);
+
         function submit() {
             loading.value = true;
-            setTimeout(() => {
-                loading.value = false;
-                cancel();
-            }, 2000);
+            Modal.confirm({
+                title: '是否确认恢复仓库信息',
+                okText: '确认恢复',
+                cancelText: '取消',
+                onOk() {
+                    console.log('OK');
+                    changeStatus(props.selectedRow.autoid)
+                        .then(res => {
+                            message.success(res)
+                            context.emit('refresh')
+                            cancel()
+                        })
+                        .catch(err => {
+                            message.error(err)
+                        })
+                },
+                onCancel() {
+                    console.log('Cancel');
+                },
+            });
         }
+
         return {
             visible,
             cancel,
             submit,
             loading,
             maskClosableFlag,
+            gerWareHouseStatusName,
+            getWareHouseTypeName,
+            formatValue,
         };
     },
 });

+ 61 - 42
src/views/information/warehouse-info/list/normal-use/index.vue

@@ -1,45 +1,61 @@
 <template>
-  <!-- 仓库信息: 正常 -->
-  <div class="warehouse-info-normal"
-       :loading="loading">
-    <filterCustomTable @search="search">
-      <BtnList :btnList="commonBtn" />
-    </filterCustomTable>
-    <contextMenu :contextMenuList="forDataBtn">
-      <a-table :columns="columns"
-               class="topTable"
-               :pagination="false"
-               :expandedRowKeys="expandedRowKeys"
-               :customRow="Rowclick"
-               rowKey="key"
-               :data-source="tableList">
-        <!-- 额外的展开行 -->
-        <template #expandedRowRender="{  }">
-          <BtnList :btnList="forDataBtn" />
-        </template>
-        <template #warehousetype="{ text }">
-          <span>{{ getWareHouseTypeName(text) }}</span>
-        </template>
-        <template #warehousestatus="{ text }">
-          <span>{{ gerWareHouseStatusName(text) }}</span>
-        </template>
-      </a-table>
-    </contextMenu>
-    <!-- 新增仓库信息 -->
-    <Add />
-    <!-- 停用仓库信息 -->
-    <Disable />
-    <!-- 仓库信息详情 -->
-    <Detail :selectedRow="selectedRow" />
-    <!-- 修改仓息库信 -->
-    <Modify />
-  </div>
+    <!-- 仓库信息: 正常 -->
+    <div class="warehouse-info-normal"
+         :loading="loading">
+        <filterCustomTable @search="search">
+            <BtnList :btnList="commonBtn"/>
+        </filterCustomTable>
+        <contextMenu :contextMenuList="forDataBtn">
+            <a-table :columns="columns"
+                     class="topTable"
+                     :pagination="false"
+                     :expandedRowKeys="expandedRowKeys"
+                     :customRow="Rowclick"
+                     rowKey="key"
+                     :data-source="tableList">
+                <!-- 额外的展开行 -->
+                <template #expandedRowRender="{  }">
+                    <BtnList :btnList="forDataBtn"/>
+                </template>
+                <template #warehousetype="{ text }">
+                    <span>{{ getWareHouseTypeName(text) }}</span>
+                </template>
+                <template #warehousestatus="{ text }">
+                    <span>{{ gerWareHouseStatusName(text) }}</span>
+                </template>
+            </a-table>
+        </contextMenu>
+        <!-- 新增仓库信息 -->
+        <Add/>
+        <!-- 停用仓库信息 -->
+        <Disable :selectedRow="selectedRow"
+                 @refresh="queryTable"/>
+        <!-- 仓库信息详情 -->
+        <Detail :selectedRow="selectedRow"
+                @refresh="queryTable"/>
+        <!-- 修改仓息库信 -->
+        <Modify/>
+    </div>
 </template>
 
 <script lang="ts">
-import { defineComponent, initData, getTableColumns, getTableEvent, getBtnList, contextMenu, BtnList } from '@/common/export/table';
-import { filterCustomTable, Add, Disable, Detail, Modify } from '../../compoments';
-import { gerWareHouseStatusName, getWareHouseTypeName, queryTableList, getFilterTableCB, ErmcpWareHouseInfo } from '../index';
+import {
+    defineComponent,
+    initData,
+    getTableColumns,
+    getTableEvent,
+    getBtnList,
+    contextMenu,
+    BtnList
+} from '@/common/export/table';
+import {filterCustomTable, Add, Disable, Detail, Modify} from '../../compoments';
+import {
+    gerWareHouseStatusName,
+    getWareHouseTypeName,
+    queryTableList,
+    getFilterTableCB,
+    ErmcpWareHouseInfo
+} from '../index';
 
 export default defineComponent({
     name: 'warehouse-info-normal',
@@ -54,25 +70,27 @@ export default defineComponent({
     },
     setup() {
         // 表头数据
-        const { columns, registerColumn, updateColumn, filteredInfo } = getTableColumns();
+        const {columns, registerColumn, updateColumn, filteredInfo} = getTableColumns();
         // 表格事件
-        const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<ErmcpWareHouseInfo>({});
+        const {expandedRowKeys, selectedRow, Rowclick} = getTableEvent<ErmcpWareHouseInfo>({});
         // 表格操作按钮列表
-        const { commonBtn, forDataBtn } = getBtnList('warehouse_info_normal', true);
+        const {commonBtn, forDataBtn} = getBtnList('warehouse_info_normal', true);
         // 表格列表数据
-        const { loading, tableList, queryTable } = queryTableList('1');
+        const {loading, tableList, queryTable} = queryTableList('1');
         initData(() => {
             // 获取列表数据
             queryTable();
             // 注册表头信息 过滤
             registerColumn('table_pcweb_warehouse', getFilterTableCB);
         });
+
         // 查询
         function search(value: any) {
             filteredInfo.value = value;
             // 更新表信息
             updateColumn();
         }
+
         return {
             columns,
             filteredInfo,
@@ -86,6 +104,7 @@ export default defineComponent({
             search,
             getWareHouseTypeName,
             gerWareHouseStatusName,
+            queryTable,
         };
     },
 });

+ 3 - 1
src/views/information/warehouse-info/list/stop-use/index.vue

@@ -27,7 +27,8 @@
     <!-- 新增仓库信息 -->
     <Add />
     <!-- 恢复仓库信息 -->
-    <Recover />
+    <Recover :selectedRow="selectedRow"
+             @refresh="queryTable"/>
   </div>
 </template>
 
@@ -79,6 +80,7 @@ export default defineComponent({
             search,
             getWareHouseTypeName,
             gerWareHouseStatusName,
+            queryTable,
         };
     },
 });