소스 검색

提交价格管理改版以及国内贸易增加库存帐

caojunjie 3 년 전
부모
커밋
53631cc12e

+ 29 - 0
src/api/basicData/inventoryAccount.js

@@ -0,0 +1,29 @@
+import request from '@/router/axios';
+
+//删除单据
+export function deleteTemplate(data) {
+    return request({
+        url: '/api/blade-stock/stockgoods/remove',
+        method: 'post',
+        params: {
+            ids:data
+        }
+    })
+}
+//价格列表查询
+export function customerList(data) {
+    return request({
+        url: '/api/blade-stock/stockgoods/list',
+        method: 'get',
+        params: data
+    })
+}
+
+//列表修改和新增
+export function typeSave(data) {
+    return request({
+        url: '/api/blade-stock/stockgoods/submit',
+        method: 'post',
+        data: data
+    })
+}

+ 14 - 30
src/api/maintenance/priceManagement.js

@@ -1,45 +1,29 @@
 import request from '@/router/axios';
 
+//删除单据
+export function deleteTemplate(data) {
+    return request({
+        url: '/api/blade-mocha-item/priceitem/remove',
+        method: 'post',
+        params: {
+            ids:data
+        }
+    })
+}
 //价格列表查询
 export function customerList(data) {
     return request({
-        url: '/api/blade-mocha-item/price/list',
+        url: '/api/blade-mocha-item/priceitem/list',
         method: 'get',
         params: data
     })
 }
-//价格列表查看明细
-export function detail(data) {
-    return request({
-        url: '/api/blade-mocha-item/price/detail?id='+data,
-        method: 'get'
-    })
-}
-//价格列表修改和新增
+
+//列表修改和新增
 export function typeSave(data) {
     return request({
-        url: '/api/blade-mocha-item/price/submit',
+        url: '/api/blade-mocha-item/priceitem/submit',
         method: 'post',
         data: data
     })
 }
-//价格列表删除
-export function deleteDetails(data) {
-    return request({
-        url: '/api/blade-mocha-item/price/update',
-        method: 'post',
-        data: {
-            id:data
-        }
-    })
-}
-//客户轮胎列表删除
-export function corpsattn(data) {
-    return request({
-        url: '/api/blade-mocha-item/priceitem/update',
-        method: 'post',
-        data: {
-            id:data
-        }
-    })
-}

+ 130 - 0
src/views/businessManagement/inventoryAccount/configuration/mainList.json

@@ -0,0 +1,130 @@
+{
+    "lazy": true,
+    "tip": false,
+    "searchMenuPosition": "right",
+    "simplePage": true,
+    "searchShow": true,
+    "dialogWidth": "60%",
+    "addBtn": false,
+    "tree": true,
+    "border": true,
+    "index": true,
+    "selection": true,
+    "viewBtn": false,
+    "editBtn": false,
+    "delBtn": false,
+    "menuWidth": 300,
+    "dialogClickModal": false,
+    "searchLabelWidth": 120,
+    "column":[
+        {
+            "label": "大字(规格编码)",
+            "prop": "code",
+            "search": true,
+            "index": 1,
+            "width":120
+        },
+        {
+            "label": "名称",
+            "prop": "cname",
+            "search": true,
+            "index": 1,
+            "width":100
+        },
+        {
+            "label": "花纹",
+            "prop": "brandItem",
+            "search": true,
+            "index": 1,
+            "width":100
+        },
+        {
+            "label": "产地",
+            "prop": "placeProduction",
+            "search": true,
+            "index": 1,
+            "width":100
+        },
+        {
+            "label": "规格",
+            "prop": "typeno",
+            "search": true,
+            "index": 1,
+            "width":100
+        },
+        {
+            "label": "规格1",
+            "prop": "typenoOne",
+            "search": true,
+            "index": 1,
+            "width":100
+        },
+        {
+            "label": "品牌",
+            "prop": "brand",
+            "search": true,
+            "index": 1,
+            "width":100
+        },
+        {
+            "label": "总库存",
+            "prop": "balanceQuantity",
+            "search": false,
+            "index": 1,
+            "width":100,
+            "cell": true
+        },
+        {
+            "label": "内贸锁定",
+            "prop": "lockingQuantity",
+            "search": false,
+            "index": 1,
+            "width":100,
+            "cell": true
+        },
+        {
+            "label": "可用库存",
+            "prop": "surplusRouteQuantity",
+            "search": false,
+            "index": 1,
+            "width":100,
+            "cell": true
+        },
+        {
+            "label": "供应商",
+            "prop": "corpName",
+            "search": false,
+            "index": 1,
+            "width":100
+        },
+        {
+            "label": "创建日期",
+            "prop": "createTime",
+            "type": "date",
+            "search": true,
+            "index": 1,
+            "width":100
+        },
+        {
+            "label": "创建人",
+            "prop": "createUserName",
+            "search": false,
+            "index": 1,
+            "width":100
+        },
+        {
+            "label": "更新日期",
+            "prop": "updateTime",
+            "search": false,
+            "index": 1,
+            "width":100
+        },
+        {
+            "label": "更新人",
+            "prop": "updateUserName",
+            "search": false,
+            "index": 1,
+            "width":100
+        }
+    ]
+}

+ 162 - 0
src/views/businessManagement/inventoryAccount/index.vue

@@ -0,0 +1,162 @@
+<template>
+  <basic-container>
+    <avue-crud
+        ref="crud"
+        :option="option"
+        :data="data"
+        :page.sync="page"
+        @search-change="searchChange"
+        @on-load="onLoad"
+        @row-update="rowUpdate">
+      <template slot-scope="{row,index}" slot="menu">
+        <el-button
+            type="text"
+            size="small"
+            @click="rowCell(row,index)"
+        >{{ row.$cellEdit ? '保存' : '修改' }}
+        </el-button>
+        <el-button
+            type="text"
+            size="small"
+            @click="deletePrice(row,index)"
+        >删除
+        </el-button>
+      </template>
+      <template slot="menuLeft">
+        <el-button
+            type="primary"
+            size="small"
+            icon="el-icon-plus"
+            @click="excelBox = !excelBox"
+        >导入
+        </el-button>
+        <el-button
+            type="success"
+            icon="el-icon-upload2"
+            size="small"
+            @click="derivation()"
+        >下载模板
+        </el-button>
+        <el-button
+            type="info"
+            icon="el-icon-printer"
+            size="small"
+        >报 表
+        </el-button>
+      </template>
+    </avue-crud>
+    <el-dialog title="导入价格"
+               append-to-body
+               :visible.sync="excelBox"
+               width="555px">
+      <avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter"/>
+    </el-dialog>
+  </basic-container>
+</template>
+<script>
+import option from "./configuration/mainList.json"
+import {deleteTemplate,customerList,typeSave} from "@/api/basicData/inventoryAccount"
+import {getToken} from "@/util/auth";
+export default {
+  data() {
+    return {
+      data: [],
+      excelForm: {},
+      excelOption: {
+        submitBtn: false,
+        emptyBtn: false,
+        column: [
+          {
+            label: '导入数据',
+            prop: 'excelFile',
+            type: 'upload',
+            drag: true,
+            loadText: '导入数据中,请稍等',
+            span: 24,
+            propsHttp: {
+              res: 'data'
+            },
+            tip: '请上传 .xls,.xlsx 标准格式文件',
+            action: "/api/blade-stock/stockgoods/import-price"
+          }
+        ]
+      },
+      excelBox: false,
+      option: option,
+      page: {
+        pageSize: 10,
+        pagerCount: 5,
+        total: 0,
+      }
+    }
+  },
+  methods: {
+    derivation() {
+      this.$confirm("是否下载模板?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        window.open(`/api/blade-stock/stockgoods/export-template?${this.website.tokenHeader}=${getToken()}`);
+      });
+    },
+    uploadAfter(res, done, loading, column) {
+      window.console.log(column);
+      this.excelBox = false;
+      this.page.currentPage = 1;
+      this.onLoad(this.page);
+      loading()
+      done();
+    },
+    rowCell(row, index) {
+      this.$refs.crud.rowCell(row, index)
+    },
+    deletePrice(row,index){
+      if (row.id){
+        this.$confirm("确定将选择数据删除?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          return deleteTemplate(row.id);
+        }).then(() => {
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          this.page.currentPage = 1;
+          this.onLoad(this.page);
+        })
+      }
+    },
+    //点击搜索按钮触发
+    searchChange(params, done) {
+      console.log(params)
+      this.page.currentPage = 1;
+      this.onLoad(this.page, params);
+      done()
+    },
+    onLoad(page, params = {}) {
+      let queryParams = Object.assign({}, params, {
+        size: page.pageSize,
+        current: page.currentPage,
+      })
+      customerList(queryParams).then(res => {
+        this.data = res.data.data.records
+        this.page.total = res.data.data.total
+      })
+    },
+    rowUpdate(form, index, done) {
+      console.log(form)
+      typeSave(form).then(res => {
+        this.$message({type: "success", message: form.id ? "修改成功!" : "新增成功!"});
+        // this.page.currentPage = 1;
+        // this.onLoad(this.page);
+        //成功关闭此页面回到列表页
+        // this.backToList()
+      })
+      done()
+    }
+  }
+}
+</script>

+ 79 - 36
src/views/maintenance/priceManagement/configuration/mainList.json

@@ -1,10 +1,11 @@
 {
     "lazy": true,
     "tip": false,
+    "searchMenuPosition": "right",
     "simplePage": true,
     "searchShow": true,
-    "searchMenuSpan": 6,
     "dialogWidth": "60%",
+    "addBtn": false,
     "tree": true,
     "border": true,
     "index": true,
@@ -18,60 +19,102 @@
     "column":[
         {
             "label": "大字(规格编码)",
-            "prop": "bigCharacter",
+            "prop": "code",
             "search": true,
             "index": 1,
-            "width":100
+            "width":120
         },
         {
-            "label": "品牌",
-            "prop": "brand",
+            "label": "名称",
+            "prop": "bigCharacter",
             "search": true,
-            "index": 2,
+            "index": 1,
             "width":100
-        },{
-            "label": "状态",
-            "prop": "status",
-            "type":"select",
-            "dicData":[{
-                "label":"正常",
-                "value":0
-            },{
-                "label":"停用",
-                "value":1
-            }],
+        },
+        {
+            "label": "花纹",
+            "prop": "brandItem",
             "search": true,
-            "index": 3,
+            "index": 1,
             "width":100
-        },{
-            "label": "创建时间",
-            "prop": "createTime",
+        },
+        {
+            "label": "产地",
+            "prop": "placeProduction",
             "search": true,
-            "index": 4,
+            "index": 1,
             "width":100
-        },{
+        },
+        {
             "label": "规格",
             "prop": "typeno",
             "search": true,
-            "index": 5,
+            "index": 1,
             "width":100
-        },{
-            "label": "花纹",
-            "prop": "brandItem",
+        },
+        {
+            "label": "规格1",
+            "prop": "typenoOne",
             "search": true,
-            "index": 6,
+            "index": 1,
             "width":100
-        },{
-            "label": "类别",
-            "prop": "category",
+        },
+        {
+            "label": "品牌",
+            "prop": "brand",
             "search": true,
-            "index": 7,
+            "index": 1,
+            "width":100
+        },
+        {
+            "label": "销售价格",
+            "prop": "salesPrice",
+            "search": false,
+            "index": 1,
+            "width":100,
+            "cell": true
+        },
+        {
+            "label": "采购价格",
+            "prop": "purchasePrice",
+            "search": false,
+            "index": 1,
+            "width":100,
+            "cell": true
+        },
+        {
+            "label": "供应商",
+            "prop": "corpName",
+            "search": false,
+            "index": 1,
             "width":100
-        },{
-            "label": "产品分类",
-            "prop": "productCategory",
+        },
+        {
+            "label": "创建日期",
+            "prop": "createTime",
             "search": true,
-            "index": 8,
+            "index": 1,
+            "width":100
+        },
+        {
+            "label": "创建人",
+            "prop": "createUserName",
+            "search": false,
+            "index": 1,
+            "width":100
+        },
+        {
+            "label": "更新日期",
+            "prop": "updateTime",
+            "search": false,
+            "index": 1,
+            "width":100
+        },
+        {
+            "label": "更新人",
+            "prop": "updateUserName",
+            "search": false,
+            "index": 1,
             "width":100
         }
     ]

+ 106 - 144
src/views/maintenance/priceManagement/index.vue

@@ -1,62 +1,88 @@
 <template>
   <basic-container>
-    <avue-crud :option="option"
-               :data="dataList"
-               ref="crud"
-               v-model="form"
-               :page.sync="page"
-               @row-del="rowDel"
-               @row-update="rowUpdate"
-               :before-open="beforeOpen"
-               :before-close="beforeClose"
-               @row-save="rowSave"
-               @search-change="searchChange"
-               @search-reset="searchReset"
-               @selection-change="selectionChange"
-               @current-change="currentChange"
-               @size-change="sizeChange"
-               @refresh-change="refreshChange"
-               @on-load="onLoad"
-               @tree-load="treeLoad">
-      <template slot-scope="scope" slot="menu">
+    <avue-crud
+        ref="crud"
+        :option="option"
+        :data="data"
+        :page.sync="page"
+        @search-change="searchChange"
+        @on-load="onLoad"
+        @row-update="rowUpdate">
+      <template slot-scope="{row,index}" slot="menu">
         <el-button
             type="text"
-            icon="el-icon-view"
             size="small"
-            @click.stop="beforeOpenPage(scope.row,scope.index)"
-        >查看
+            @click="rowCell(row,index)"
+        >{{ row.$cellEdit ? '保存' : '修改' }}
         </el-button>
         <el-button
             type="text"
-            icon="el-icon-edit"
             size="small"
-            @click.stop="editOpen(scope.row,scope.index)"
-        >编辑
+            @click="deletePrice(row,index)"
+        >删除
         </el-button>
+      </template>
+      <template slot="menuLeft">
         <el-button
-            type="text"
-            icon="el-icon-delete"
+            type="primary"
             size="small"
-            @click.stop="rowDel(scope.row,scope.index)"
-        >删除
+            icon="el-icon-plus"
+            @click="excelBox = !excelBox"
+        >导入
+        </el-button>
+        <el-button
+            type="success"
+            icon="el-icon-upload2"
+            size="small"
+            @click="derivation()"
+        >下载模板
+        </el-button>
+        <el-button
+            type="info"
+            icon="el-icon-printer"
+            size="small"
+        >报 表
         </el-button>
       </template>
     </avue-crud>
+    <el-dialog title="导入价格"
+               append-to-body
+               :visible.sync="excelBox"
+               width="555px">
+      <avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter"/>
+    </el-dialog>
   </basic-container>
 </template>
-
 <script>
-import option from "./configuration/mainList.json";
-import {customerList, typeSave, deleteDetails} from "@/api/maintenance/priceManagement"
-
+import option from "./configuration/mainList.json"
+import {deleteTemplate,customerList,typeSave} from "@/api/maintenance/priceManagement"
+import {getToken} from "@/util/auth";
 export default {
-  name: "customerInformation",
   data() {
     return {
-      form: {},
+      data: [],
+      excelForm: {},
+      excelOption: {
+        submitBtn: false,
+        emptyBtn: false,
+        column: [
+          {
+            label: '导入数据',
+            prop: 'excelFile',
+            type: 'upload',
+            drag: true,
+            loadText: '导入数据中,请稍等',
+            span: 24,
+            propsHttp: {
+              res: 'data'
+            },
+            tip: '请上传 .xls,.xlsx 标准格式文件',
+            action: "/api/blade-mocha-item/priceitem/import-price"
+          }
+        ]
+      },
+      excelBox: false,
       option: option,
-      parentId: 0,
-      dataList: [],
       page: {
         pageSize: 10,
         pagerCount: 5,
@@ -64,94 +90,45 @@ export default {
       }
     }
   },
-  created() {
-    console.log('wangbadan')
-    // this.onLoad()
-  },
   methods: {
-    //删除列表后面的删除按钮触发触发(row, index, done)
-    rowDel(row, index, done) {
-      this.$confirm("确定将选择数据删除?", {
+    derivation() {
+      this.$confirm("是否下载模板?", "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning"
       }).then(() => {
-        return deleteDetails(row.id);
-      }).then(() => {
-        this.$message({
-          type: "success",
-          message: "操作成功!"
-        });
-        this.page.currentPage = 1;
-        this.onLoad(this.page, {parentId: 0});
-      });
-    },
-    //修改时的修改按钮点击触发
-    rowUpdate(row, index, done, loading) {
-      typeSave(row).then(() => {
-        this.$message({
-          type: "success",
-          message: "操作成功!"
-        });
-        // 数据回调进行刷新
-        done(row);
-      }, error => {
-        window.console.log(error);
-        loading();
-      });
-    },
-    //新增修改时保存触发
-    rowSave(row, done, loading) {
-      typeSave(row).then(res => {
-        console.log(res)
-        done()
-      })
-    },
-    //查询全部
-    initData() {
-      customerList().then(res => {
-        console.log(this.form);
-        const column = this.findObject(this.option.column, "parentId");
-        column.dicData = res.data.data.records;
-      });
-    },
-    //新增子项触发
-    handleAdd(row) {
-      this.parentId = row.id;
-      const column = this.findObject(this.option.column, "parentId");
-      column.value = row.id;
-      column.addDisabled = true;
-      this.$refs.crud.rowAdd();
-    },
-    //查看跳转页面
-    beforeOpenPage(row, index) {
-      this.$router.push({
-        path: "/priceManagement_detailsPageEdit",
-        query: {id: JSON.stringify(row.id)},
-      });
-    },
-    //新增跳转页面
-    beforeOpen(row, index) {
-      console.log(row)
-      this.$router.push({
-        path: "/priceManagement_detailsPageEdit",
-        query: {id: JSON.stringify(row.id)},
-      });
-    },
-    editOpen(row, index) {
-      this.$router.push({
-        path: "/priceManagement_detailsPageEdit",
-        query: {id: JSON.stringify(row.id)},
+        window.open(`/api/blade-mocha-item/priceitem/export-template?${this.website.tokenHeader}=${getToken()}`);
       });
     },
-    //点击新增时触发
-    beforeClose(done) {
-      this.parentId = "";
-      const column = this.findObject(this.option.column, "parentId");
-      column.value = "";
-      column.addDisabled = false;
+    uploadAfter(res, done, loading, column) {
+      window.console.log(column);
+      this.excelBox = false;
+      this.page.currentPage = 1;
+      this.onLoad(this.page);
+      loading()
       done();
     },
+    rowCell(row, index) {
+      this.$refs.crud.rowCell(row, index)
+    },
+    deletePrice(row,index){
+      if (row.id){
+        this.$confirm("确定将选择数据删除?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          return deleteTemplate(row.id);
+        }).then(() => {
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          this.page.currentPage = 1;
+          this.onLoad(this.page);
+        })
+      }
+    },
     //点击搜索按钮触发
     searchChange(params, done) {
       console.log(params)
@@ -159,42 +136,27 @@ export default {
       this.onLoad(this.page, params);
       done()
     },
-    searchReset() {
-      console.log('1')
-    },
-    selectionChange() {
-      console.log('1')
-    },
-    currentChange() {
-      console.log('1')
-    },
-    sizeChange() {
-      console.log('1')
-    },
-    refreshChange() {
-      console.log('1')
-    },
-    onLoad(page, params = {parentId: 0}) {
+    onLoad(page, params = {}) {
       let queryParams = Object.assign({}, params, {
         size: page.pageSize,
         current: page.currentPage,
       })
       customerList(queryParams).then(res => {
-        this.dataList = res.data.data.records
+        this.data = res.data.data.records
         this.page.total = res.data.data.total
       })
     },
-    //树桩列点击展开触发
-    treeLoad(tree, treeNode, resolve) {
-      const parentId = tree.id;
-      customerList({parentId: parentId}).then(res => {
-        resolve(res.data.data.records);
-      });
-    },
+    rowUpdate(form, index, done) {
+      console.log(form)
+      typeSave(form).then(res => {
+        this.$message({type: "success", message: form.id ? "修改成功!" : "新增成功!"});
+        // this.page.currentPage = 1;
+        // this.onLoad(this.page);
+        //成功关闭此页面回到列表页
+        // this.backToList()
+      })
+      done()
+    }
   }
 }
 </script>
-
-<style scoped>
-
-</style>