Pārlūkot izejas kodu

修改仓库信息

huangbin 4 gadi atpakaļ
vecāks
revīzija
f4351e139a

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

@@ -14,4 +14,9 @@ export interface ButtonType {
     spot_contract_btn_finish: string; // 现货合同 正常完结
     spot_contract_btn_check: string; // 现货合同 审核
     spot_contract_btn_cancel: string; // 现货合同 撤销
+
+    warehouse_info_btn_add: string; // 仓库信息 新增
+    warehouse_info_btn_modify: string; // 现货合同 修改
+    warehouse_info_btn_disable: string; // 现货合同 停用
+    warehouse_info_btn_recover: string; // 现货合同 恢复
 }

+ 3 - 0
src/common/setup/buttonPermission/interface.ts

@@ -6,6 +6,9 @@ export interface MenuType {
     spot_contract_checkpending: string; // 现货合同 待审核
     spot_contract_performance: string; // 现货合同 履约中
     spot_contract_finished: string; // 现货合同 已完成
+    warehouse_info_normal: string; // 仓库信息 正常
+    warehouse_info_disabled: string; // 仓库信息 停用
+
 }
 
 export interface BtnType {

+ 2 - 2
src/views/information/custom/compoments/recover/index.vue

@@ -1,7 +1,7 @@
 <template>
-  <!-- 修改客户资料-->
+  <!-- 恢复客户资料-->
   <a-modal class="modify-custom"
-           title="修改客户资料"
+           title="恢复客户资料"
            v-model:visible="visible"
            @cancel="cancel"
            width="890px">

+ 2 - 2
src/views/information/warehouse-info/compoments/addWarehouse/index.vue → src/views/information/warehouse-info/compoments/add/index.vue

@@ -117,10 +117,10 @@ import { closeModal } from '@/common/setup/modal/index';
 import { initData } from '@/common/methods/index';
 
 export default defineComponent({
-    name: 'add-warehouse',
+    name: 'warehouse_info_btn_add',
     components: {},
     setup() {
-        const { visible, cancel } = closeModal('custom_info_btn_add');
+        const { visible, cancel } = closeModal('warehouse_info_btn_add');
         const loading = ref<boolean>(false);
         function submit() {
             loading.value = true;

+ 46 - 0
src/views/information/warehouse-info/compoments/detail/index.vue

@@ -0,0 +1,46 @@
+<template>
+  <!-- 仓库信息 详情-->
+  <a-modal class="add-custom custom-detail"
+           title="仓库信息详情"
+           v-model:visible="visible"
+           @cancel="cancel"
+           width="890px">
+    <template #footer>
+      <a-button key="submit"
+                type="primary"
+                :loading="loading"
+                @click="submit">关闭</a-button>
+    </template>
+    仓库信息详情
+  </a-modal>
+</template>
+
+<script lang="ts">
+import { defineComponent, ref } from 'vue';
+import { closeModal } from '@/common/setup/modal/index';
+
+export default defineComponent({
+    name: 'warehouse_info_btn-detail',
+    components: {},
+    setup() {
+        const { visible, cancel } = closeModal('detail');
+        const loading = ref<boolean>(false);
+        function submit() {
+            loading.value = true;
+            setTimeout(() => {
+                loading.value = false;
+                cancel();
+            }, 2000);
+        }
+        return {
+            visible,
+            cancel,
+            submit,
+            loading,
+        };
+    },
+});
+</script>
+
+<style lang="less">
+</style>;

+ 2 - 2
src/views/information/warehouse-info/compoments/disableWarehouse/index.vue → src/views/information/warehouse-info/compoments/disable/index.vue

@@ -74,10 +74,10 @@ import { defineComponent, ref } from 'vue';
 import { closeModal } from '@/common/setup/modal/index';
 
 export default defineComponent({
-    name: 'custom-disable',
+    name: 'warehouse_info_btn_disable',
     components: {},
     setup() {
-        const { visible, cancel } = closeModal('custom_info_btn_disable');
+        const { visible, cancel } = closeModal('warehouse_info_btn_disable');
         const loading = ref<boolean>(false);
         function submit() {
             loading.value = true;

+ 8 - 7
src/views/information/warehouse-info/compoments/filterTable/index.vue

@@ -4,11 +4,12 @@
     <a-select label-in-value
               class="conditionSelect"
               style="width: 120px"
-              v-model:value="userinfotype"
+              v-model:value="warehousetype"
               placeholder="全部仓库类型"
               @change="handleChange">
-      <a-select-option value="1">仓库类型一</a-select-option>
-      <a-select-option value="2">仓库类型二</a-select-option>
+      <a-select-option value="1">厂库</a-select-option>
+      <a-select-option value="2">自有库</a-select-option>
+      <a-select-option value="3">合作库</a-select-option>
     </a-select>
     <a-input v-model:value="nickname"
              class="tableConditionInput"
@@ -36,24 +37,24 @@ function handleSearch(context: SetupContext) {
         value: string;
     }
     let useType = '';
-    const userinfotype = ref<number>(0);
+    const warehousetype = ref<number | undefined>(undefined);
     function handleChange(value: Value) {
         useType = value.value;
         search();
     }
     function search() {
-        const result = { nickname: [nickname.value], name: [name.value], userinfotype: [useType] };
+        const result = { warehousename: [nickname.value], address: [name.value], warehousetype: [useType] };
         context.emit('search', result);
     }
     function reset() {
         nickname.value = '';
         name.value = '';
-        userinfotype.value = 0;
+        warehousetype.value = undefined;
         useType = '';
         search();
     }
 
-    return { nickname, name, search, reset, userinfotype, handleChange };
+    return { nickname, name, search, reset, warehousetype, handleChange };
 }
 
 export default defineComponent({

+ 48 - 0
src/views/information/warehouse-info/compoments/modify/index.vue

@@ -0,0 +1,48 @@
+<template>
+  <!-- 修改仓库信息-->
+  <a-modal class="modify-custom"
+           title="修改仓库信息"
+           v-model:visible="visible"
+           @cancel="cancel"
+           width="890px">
+    <template #footer>
+      <a-button key="submit"
+                type="primary"
+                :loading="loading"
+                @click="submit">完成</a-button>
+    </template>
+  </a-modal>
+</template>
+
+<script lang="ts">
+import { defineComponent, ref } from 'vue';
+import { closeModal } from '@/common/setup/modal/index';
+
+export default defineComponent({
+    name: 'warehouse_info_btn_modify',
+    components: {},
+    setup() {
+        const { visible, cancel } = closeModal('warehouse_info_btn_modify');
+        const loading = ref<boolean>(false);
+        function submit() {
+            loading.value = true;
+            setTimeout(() => {
+                loading.value = false;
+                cancel();
+            }, 2000);
+        }
+        return {
+            visible,
+            cancel,
+            submit,
+            loading,
+        };
+    },
+});
+</script>
+
+<style lang="less">
+.modify-custom {
+}
+</style
+>;

+ 48 - 0
src/views/information/warehouse-info/compoments/recover/index.vue

@@ -0,0 +1,48 @@
+<template>
+  <!-- 恢复仓库信息-->
+  <a-modal class="modify-custom"
+           title="恢复仓库信息"
+           v-model:visible="visible"
+           @cancel="cancel"
+           width="890px">
+    <template #footer>
+      <a-button key="submit"
+                type="primary"
+                :loading="loading"
+                @click="submit">完成</a-button>
+    </template>
+  </a-modal>
+</template>
+
+<script lang="ts">
+import { defineComponent, ref } from 'vue';
+import { closeModal } from '@/common/setup/modal/index';
+
+export default defineComponent({
+    name: 'warehouse_info_btn_recover',
+    components: {},
+    setup() {
+        const { visible, cancel } = closeModal('warehouse_info_btn_recover');
+        const loading = ref<boolean>(false);
+        function submit() {
+            loading.value = true;
+            setTimeout(() => {
+                loading.value = false;
+                cancel();
+            }, 2000);
+        }
+        return {
+            visible,
+            cancel,
+            submit,
+            loading,
+        };
+    },
+});
+</script>
+
+<style lang="less">
+.modify-custom {
+}
+</style
+>;

+ 66 - 85
src/views/information/warehouse-info/list/normal-use/index.vue

@@ -1,109 +1,82 @@
 <template>
   <!-- 仓库信息: 正常 -->
-  <div class="warehouse-info-normal">
+  <div class="warehouse-info-normal"
+       :loading="loading">
     <filterCustomTable @search="search">
       <a-button class="operBtn"
-                @click="openAction">新增</a-button>
+                v-for="item in commonBtn"
+                :key="item.lable"
+                @click="item.callback">{{item.lable}}</a-button>
     </filterCustomTable>
-    <a-table class="topTable"
-             :columns="columns"
-             :pagination="false"
-             rowKey="key"
-             :data-source="wareHouseInfos" />
+    <contextMenu :contextMenuList="forDataBtn"
+                 :tableList="tableList">
+      <a-table :columns="columns"
+               class="topTable"
+               :pagination="false"
+               rowKey="key"
+               :data-source="tableList">
+        <template #warehousetype="{ text }">
+          <span>{{ getWareHouseType(text) }}</span>
+        </template>
+        <template #warehousestatus="{ text }">
+          <span>{{ getWareHouseStatus(text) }}</span>
+        </template>
+      </a-table>
+    </contextMenu>
+    <!-- 新增仓库信息 -->
+    <Add />
+    <!-- 停用仓库信息 -->
+    <Disable />
+    <!-- 仓库信息详情 -->
+    <Detail />
+    <!-- 修改仓息库信 -->
+    <Modify />
   </div>
 </template>
 
 <script lang="ts">
-import { computed, defineComponent, ref } from 'vue';
-
+import { defineComponent } from 'vue';
 import { initData } from '@/common/methods';
 import filterCustomTable from '@/views/information/warehouse-info/compoments/filterTable/index.vue';
-import { QueryWareHouse } from '@/services/go/ermcp/warehouse-info/index';
-import { ErmcpWareHouseInfo } from '@/services/go/ermcp/warehouse-info/interface';
-import { message } from 'ant-design-vue';
-import { getTableHead } from '@/common/methods/table';
-import { getUserId } from '@/services/bus/account';
-
-// 查询客户资料列表
-function getWarehouseInfoList() {
-    interface ColumnType {
-        key: string;
-        dataIndex: string;
-        title: string;
-        onFilter?: Function;
-        sorter?: Function;
-    }
-
-    // 仓库数据
-    const wareHouseInfos = ref<ErmcpWareHouseInfo[]>([]);
-    // 列头
-    const columns = ref<ColumnType[]>([]);
-    // 过滤
-    const filteredInfo = ref();
-
-    // 获取表头
-    function getColumns() {
-        interface ColumnType {
-            key: string;
-            dataIndex: string;
-            title: string;
-            filteredValue?: string | null;
-            onFilter?: Function;
-            sorter?: Function;
-        }
-        const list = getTableHead('table_pcweb_warehouse');
-        console.log('list', list);
-
-        const filtered = filteredInfo.value || {};
-        columns.value.length = 0;
-        list.forEach((e, i) => {
-            const { columnfield, columntitle } = e;
-            const item: ColumnType = {
-                key: String(i),
-                dataIndex: columnfield,
-                title: columntitle,
-            };
-            columns.value.push(item);
-        });
-        console.log('columns', columns);
-    }
-
-    // 获取仓库信息
-    const wareHouseInfoList = ref<ErmcpWareHouseInfo[]>([]);
-    function actionQuery() {
-        const reqParam = { userid: getUserId(), status: '1' };
-        QueryWareHouse(reqParam)
-            .then((res) => {
-                wareHouseInfos.value = res.map((e, i) => {
-                    return { ...e, key: String(i) };
-                });
-                console.log('查询仓库列表', wareHouseInfos);
-            })
-            .catch((err) => message.error(err));
-    }
-    // 查询
-    function search(value: any) {}
-
-    return { wareHouseInfos, actionQuery, columns, getColumns, search };
-}
-
-// 新增
-function add() {
-    console.log('add');
-}
+import { getTableList, getWareHouseType, getWareHouseStatus } from '../setup';
+import { getBtnList } from '@/common/setup/contextMenu/index';
+import contextMenu from '@/common/components/contextMenu/index.vue';
+import Add from '../../compoments/add/index.vue';
+import Disable from '../../compoments/disable/index.vue';
+import Detail from '../../compoments/detail/index.vue';
+import Modify from '../../compoments/modify/index.vue';
 
 export default defineComponent({
     name: 'warehouse-info-normal',
     components: {
+        contextMenu,
         filterCustomTable,
+        Add,
+        Disable,
+        Detail,
+        Modify,
     },
     setup() {
-        const { wareHouseInfos, actionQuery, columns, getColumns, search } = getWarehouseInfoList();
+        const { tableList, actionQuery, columns, filteredInfo, getColumns, search, loading } = getTableList();
+        const { commonBtn, forDataBtn } = getBtnList('warehouse_info_normal');
+        console.log('forDataBtn', forDataBtn);
+
         initData(() => {
-            actionQuery();
+            actionQuery('1');
             getColumns();
         });
-        return { wareHouseInfos, add, columns, search };
+
+        return {
+            tableList,
+            filteredInfo,
+            columns,
+            search,
+            loading,
+            commonBtn,
+            forDataBtn,
+            getWareHouseStatus,
+            getWareHouseType,
+        };
     },
 });
 </script>
@@ -113,3 +86,11 @@ export default defineComponent({
 }
 </style
 >;
+
+function getTableList(): {} {
+  throw new Error('Function not implemented.');
+}
+
+function getTableList(): { tableList: any; actionQuery: any; columns: any; filteredInfo: any; getColumns: any; search: any; loading: any; } {
+  throw new Error('Function not implemented.');
+}

+ 116 - 0
src/views/information/warehouse-info/list/setup.ts

@@ -0,0 +1,116 @@
+import { ColumnType, getTableHead } from '@/common/methods/table';
+import { getUserId } from '@/services/bus/account';
+import { QueryWareHouse } from '@/services/go/ermcp/warehouse-info/index';
+import { ErmcpWareHouseInfo } from '@/services/go/ermcp/warehouse-info/interface';
+import { message } from 'ant-design-vue';
+import { ref } from 'vue';
+
+// 客户资料列表
+export function getTableList() {
+    // 表格数据
+    const tableList = ref<ErmcpWareHouseInfo[]>([]);
+    // 表头数据
+    const columns = ref<ColumnType[]>([]);
+    // 过滤项
+    const filteredInfo = ref();
+    const loading = ref<boolean>(false);
+    // 获取表头
+    function getColumns() {
+        const list = getTableHead('table_pcweb_warehouse');
+        const filtered = filteredInfo.value || {};
+        columns.value.length = 0;
+        list.forEach((e, i) => {
+            const { columnfield, columntitle, aligntype } = e;
+            const item: ColumnType = {
+                key: String(i),
+                dataIndex: columnfield, // 表格数据对应的key
+                title: columntitle,
+                align: aligntype === 1 ? 'center' : aligntype === 2 ? 'left' : 'right',
+                slots: { customRender: columnfield },
+            };
+            // 以下添加过滤数据对应的方法
+            if (e.columnfield === 'warehousetype') {
+                item.onFilter = (value: string, record: ErmcpWareHouseInfo) => String(record.warehousetype).includes(String(value));
+                item.filteredValue = filtered.warehousetype || null;
+            }
+            if (e.columnfield === 'warehousename') {
+                item.onFilter = (value: string, record: ErmcpWareHouseInfo) => record.warehousename.includes(value);
+                item.filteredValue = filtered.warehousename || null;
+            }
+            if (e.columnfield === 'address') {
+                item.onFilter = (value: string, record: ErmcpWareHouseInfo) => record.address.includes(value);
+                item.filteredValue = filtered.address || null;
+            }
+            columns.value.push(item);
+        });
+    }
+    // 查询列表
+    function actionQuery(status: string) {
+        loading.value = true;
+        const reqParam = { userid: getUserId(), status };
+        QueryWareHouse(reqParam)
+            .then((res) => {
+                tableList.value = res.map((e, i) => {
+                    return { ...e, key: String(i) };
+                });
+                loading.value = false;
+                console.log('查询列表', tableList);
+            })
+            .catch((err) => {
+                message.error(err);
+                loading.value = false;
+            });
+    }
+    // 查询
+    function search(value: any) {
+        filteredInfo.value = value;
+        getColumns();
+    }
+
+    return { tableList, actionQuery, columns, filteredInfo, getColumns, search, loading, };
+}
+
+/**
+ * 获取仓库类型
+ * @param type 
+ * @returns 
+ */
+export function getWareHouseType(type: number): string {
+    let result = '--';
+    switch (type) {
+        case 1:
+            result = '厂库'
+            break
+        case 2:
+            result = '自有库'
+            break
+        case 3:
+            result = '合作库'
+            break
+    }
+    return result;
+}
+
+/**
+ * 获取仓库状态
+ * @param status 
+ * @returns 
+ */
+export function getWareHouseStatus(status: number): string {
+    let result = '--';
+    switch (status) {
+        case 1:
+            result = '正常'
+            break
+        case 2:
+            result = '注销'
+            break
+        case 3:
+            result = '待审核'
+            break
+        case 4:
+            result = '审核拒绝'
+            break
+    }
+    return result;
+}

+ 68 - 73
src/views/information/warehouse-info/list/stop-use/index.vue

@@ -1,83 +1,78 @@
 <template>
-    <!-- 仓库信息: 停用 -->
-    <div class="warehouse-info-stop">
-        仓库信息: 停用
-    </div>
+  <!-- 仓库信息: 停用 -->
+  <div class="warehouse-info-stop">
+    <filterCustomTable @search="search">
+      <a-button class="operBtn"
+                v-for="item in commonBtn"
+                :key="item.lable"
+                @click="item.callback">{{item.lable}}</a-button>
+    </filterCustomTable>
+    <contextMenu :contextMenuList="forDataBtn"
+                 :tableList="tableList">
+      <a-table :columns="columns"
+               class="topTable"
+               :pagination="false"
+               rowKey="key"
+               :data-source="tableList">
+        <template #warehousetype="{ text }">
+          <span>{{ getWareHouseType(text) }}</span>
+        </template>
+        <template #warehousestatus="{ text }">
+          <span>{{ getWareHouseStatus(text) }}</span>
+        </template>
+      </a-table>
+    </contextMenu>
+    <!-- 新增仓库信息 -->
+    <Add />
+    <!-- 恢复仓库信息 -->
+    <Recover />
+  </div>
 </template>
 
 <script lang="ts">
-    import { defineComponent, ref } from 'vue';
-    import { QueryCustomInfo } from '@/services/go/ermcp/customInfo/index';
-    import { QueryCustomInfoType } from '@/services/go/ermcp/customInfo/interface';
-    import { message } from 'ant-design-vue';
-    import { initData } from '@/common/methods';
+import { defineComponent } from 'vue';
+import { initData } from '@/common/methods';
+import filterCustomTable from '@/views/information/warehouse-info/compoments/filterTable/index.vue';
+import { getTableList, getWareHouseType, getWareHouseStatus } from '../setup';
+import { getBtnList } from '@/common/setup/contextMenu/index';
+import contextMenu from '@/common/components/contextMenu/index.vue';
+import Add from '../../compoments/add/index.vue';
+import Recover from '../../compoments/recover/index.vue';
 
-    // 查询客户资料列表
-    function getCustomList() {
-        // const filteredInfo = ref();
-        // const sortedInfo = ref();
-        // const columns = computed(() => {
-        //     const filtered = filteredInfo.value || {};
-        //     const sorted = sortedInfo.value || {};
-        //     return [
-        //         {
-        //             title: '序号',
-        //             dataIndex: 'index',
-        //             key: 'index',
-        //             align: 'center',
-        //             width: 50,
-        //             customRender: (param: any) => `${param.index + 1}`,
-        //         },
-        //         {
-        //             title: 'Age',
-        //             dataIndex: 'age',
-        //             key: 'age',
-        //             sorter: (a: DataItem, b: DataItem) => a.age - b.age,
-        //             sortOrder: sorted.columnKey === 'age' && sorted.order,
-        //         },
-        //         {
-        //             title: 'Address',
-        //             dataIndex: 'address',
-        //             key: 'address',
-        //             filters: [
-        //                 { text: 'London', value: 'London' },
-        //                 { text: 'New York', value: 'New York' },
-        //             ],
-        //             filteredValue: filtered.address || null,
-        //             onFilter: (value: string, record: DataItem) => record.address.includes(value),
-        //             sorter: (a: DataItem, b: DataItem) => a.address.length - b.address.length,
-        //             sortOrder: sorted.columnKey === 'address' && sorted.order,
-        //             ellipsis: true,
-        //         },
-        //     ];
-        // });
-        const customList = ref<QueryCustomInfoType[]>([]);
-        function actionQuery() {
-            QueryCustomInfo(4)
-                .then((res) => {
-                    console.log('L', res);
-                })
-                .catch((err) => message.error(err));
-        }
+export default defineComponent({
+    name: 'warehouse-info-stop',
+    components: {
+        contextMenu,
+        filterCustomTable,
+        Add,
+        Recover,
+    },
+    setup() {
+        const { tableList, actionQuery, columns, filteredInfo, getColumns, search, loading } = getTableList();
+        const { commonBtn, forDataBtn } = getBtnList('warehouse_info_normal');
+        console.log('forDataBtn', forDataBtn);
 
-        return { customList, actionQuery };
-    }
-
-    export default defineComponent({
-        name: 'warehouse-info-stop',
-        components: {},
-        setup() {
-            const { customList, actionQuery } = getCustomList();
-            initData(() => {
-                actionQuery();
-                // 加载数据在这里
-            });
-            return { customList };
-        },
-    });
+        initData(() => {
+            actionQuery('2');
+            getColumns();
+        });
+        return {
+            tableList,
+            filteredInfo,
+            columns,
+            search,
+            loading,
+            commonBtn,
+            forDataBtn,
+            getWareHouseStatus,
+            getWareHouseType,
+        };
+    },
+});
 </script>
 
 <style lang="less">
-    .warehouse-info-stop {
-    }</style
+.warehouse-info-stop {
+}
+</style
 >;