李林
2023-08-17 861e1c1428046b348f7e963025a454e710792815
增加菜单,增加销售管理
已修改5个文件
374 ■■■■ 文件已修改
src/assets/api/controller.js 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/view/sale.vue 75 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main.js 125 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/index.js 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/view/index.vue 158 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/api/controller.js
@@ -48,7 +48,8 @@
    ...finishedIns,
    selectSaleList: "sale/selectSaleList", //查询销售单列表
    selectSaleDatilById: "sale/selectSaleDatilById", //根据销售单id查看详情,
    addSale: "sale/addSale", //新增销售单
    addSale: "sale/addSale", //新增销售单,
    seleRepe: "sale/seleRepe", //查询成品库存
}
src/components/view/sale.vue
@@ -115,7 +115,7 @@
            <el-row>
                <el-col :span="12" style="line-height: 32px;">销售管理</el-col>
                <el-col :span="12" style="text-align: right;">
                    <el-button type="primary" icon="el-icon-plus" @click="addDia= true">新增</el-button>
                    <el-button type="primary" icon="el-icon-plus" @click="openAddDia">新增</el-button>
                    <el-button icon="el-icon-edit-outline">修改</el-button>
                    <el-button icon="el-icon-delete">删除</el-button>
                    <el-button icon="el-icon-download">导出</el-button>
@@ -281,7 +281,7 @@
            </el-dialog>
        </div>
        <div class="select-model">
            <el-dialog title="销售新增" :visible.sync="addDia" width="750px">
            <el-dialog title="销售新增" :visible.sync="addDia" width="800px">
                <div class="body">
                    <div class="head">基本信息</div>
                    <div class="content">
@@ -346,23 +346,27 @@
                        <el-table :data="addData.saleMaterialList" border style="width: 100%">
                            <el-table-column prop="name" label="产品名称" width="180">
                                <template slot-scope="scope">
                                    <el-input v-model="scope.row.name" size="small" clearable placeholder="请输入产品名称"></el-input>
                                    <el-select v-model="scope.row.name" size="small" clearable placeholder="请输入产品名称"
                                        @change="((index)=>{upRepe(index, scope.$index)})">
                                        <el-option v-for="(a, ai) in repeList" :key="ai" :label="a.name" :value="ai"></el-option>
                                    </el-select>
                                </template>
                            </el-table-column>
                            <el-table-column prop="specifications" label="规格型号" width="200">
                                <template slot-scope="scope">
                                    <el-input v-model="scope.row.specifications" size="small" clearable placeholder="请输入规格型号"></el-input>
                                    <el-input v-model="scope.row.specifications" size="small" readonly></el-input>
                                </template>
                            </el-table-column>
                            <el-table-column prop="unit" label="单位">
                                <template slot-scope="scope">
                                    <el-input v-model="scope.row.unit" size="small" clearable placeholder="请输入"></el-input>
                                    <el-input v-model="scope.row.unit" size="small" readonly></el-input>
                                </template>
                            </el-table-column>
                            <el-table-column prop="number" label="数量">
                                <template slot-scope="scope">
                                    <el-input v-model.number="scope.row.number" size="small"
                                        @change="scope.row.number = isNaN(scope.row.number)?0:scope.row.number" clearable placeholder="请输入"></el-input>
                                        @change="scope.row.number = isNaN(scope.row.number)?0:scope.row.number" clearable
                                        placeholder="请输入"></el-input>
                                </template>
                            </el-table-column>
                            <el-table-column prop="price" label="单价">
@@ -399,10 +403,20 @@
                pageSize: 10,
                selectDia: false,
                oneData: null,
                addDia: true,
                addDia: false,
                addData: {
                    orderNumber: null,
                    code: null,
                    name: null,
                    proname: null,
                    adress: null,
                    username: null,
                    delTime: null,
                    orderName: null,
                    phone: null,
                    saleMaterialList: []
                }
                },
                repeList: []
            }
        },
        mounted() {
@@ -462,6 +476,36 @@
                this.addData.saleMaterialList.push({})
            },
            addSale() {
                for (var a in this.addData) {
                    if (this.addData[a] == null || this.addData[a] == '') {
                        if (a == 'saleMaterialList') {
                            this.$message.error('产品信息不能为空')
                        } else {
                            this.$message.error('销售订单有必填项未填写')
                        }
                        return
                    }
                }
                for (var b = 0; b < this.addData.saleMaterialList.length; b++) {
                    console.log(this.addData.saleMaterialList[b]);
                    if (Object.getOwnPropertyNames(this.addData.saleMaterialList[b]).length==0) {
                        this.addData.saleMaterialList.splice(b, 1)
                        b--
                        if (b < 0) {
                            this.$message.error('产品信息不能为空')
                            return
                        }
                    } else {
                        for (var c in this.addData.saleMaterialList[b]) {
                            if (this.addData.saleMaterialList[b][c] == null || this.addData.saleMaterialList[b][c] == {} || Object
                                .getOwnPropertyNames(this.addData.saleMaterialList[b]).length != 5) {
                                this.$message.error('产品信息有必填项未填写')
                                return
                            }
                        }
                    }
                }
                console.log(this.addData);
                this.axios.post(this.$api.url.addSale, this.addData, {
                    headers: {
                        'Content-Type': 'application/json'
@@ -469,6 +513,21 @@
                }).then(res => {
                    console.log(res);
                })
            },
            openAddDia() {
                this.addDia = !(this.addDia)
                this.$axios.post(this.$api.url.seleRepe).then(res => {
                    this.repeList = res.data
                })
            },
            upRepe(index, i) {
                var data = this.repeList[index]
                if (data == undefined) {
                    this.addData.saleMaterialList[i] = {}
                } else {
                    this.addData.saleMaterialList[i].unit = data.unit
                    this.addData.saleMaterialList[i].specifications = data.specifications
                }
            }
        }
    }
src/main.js
@@ -12,6 +12,9 @@
import swal from 'sweetalert'
Vue.prototype.LOCATIONVUE = "http://127.0.0.1:80/"; //前端本地端口
Vue.prototype.HaveJson = (val) => {
    return JSON.parse(JSON.stringify(val))
}
Vue.use(VueAxios, axios)
Vue.config.productionTip = false
@@ -30,70 +33,70 @@
Vue.prototype.$axios = axios
import {
  Message
    Message
} from 'element-ui';
axios.interceptors.request.use(function(config) {
  let tk = sessionStorage.getItem("token")
  let token;
  if (tk != undefined && tk != '') {
    token = tk
  }
  if (token) {
    config.headers['token'] = "" + token
    // config.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8'
    // config.headers['Content-Type'] = 'application/json'
  }
  // console.log(config)
  if (config.method === 'post' || config.method === 'put') {
    config.data = qs.stringify(config.data)
  }
  if(config.headers['Content-Type'] =='application/json'){
    config.data = qs.parse(config.data)
    // console.log(config.data)
  }
  return config
    let tk = sessionStorage.getItem("token")
    let token;
    if (tk != undefined && tk != '') {
        token = tk
    }
    if (token) {
        config.headers['token'] = "" + token
        // config.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8'
        // config.headers['Content-Type'] = 'application/json'
    }
    // console.log(config)
    if (config.method === 'post' || config.method === 'put') {
        config.data = qs.stringify(config.data)
    }
    if (config.headers['Content-Type'] == 'application/json') {
        config.data = qs.parse(config.data)
        // console.log(config.data)
    }
    return config
}, function(error) {
  return Promise.reject(error)
    return Promise.reject(error)
})
axios.interceptors.response.use(res => {
  return res.data
    return res.data
}, async function(err) {
  if (JSON.stringify(err).indexOf('timeout of') > -1) {
    Message.error('请求超时,请检查网络设置')
  } else if (JSON.stringify(err).indexOf('ERR_CONNECTION_RESET') > -1 || JSON.stringify(err).indexOf(
      'Network Error') > -1) {
    Message.error('网络连接错误')
  } else if (err.response.status == "503") {
    Message.error('服务未响应')
  } else if (err.response.status == "404") {
    Message.error('请求失败,链接地址不存在')
  } else if (err.response.status == "403") {
    Message.error('token不存在')
  }else if (err.response.status == "402") {
    Message.error('无效签名,请重新登录')
    localStorage.removeItem('autoenter')
    window.location.href = '/enter'
  }  else if (err.response.status == "401") {
    await axios.post(javaApi + "user/refresh", {
      reToken: sessionStorage.getItem('reToken')
    }).then(res => {
      if (res.data.code==201) {
        Message.error('认证失败,需要重新登录')
        localStorage.removeItem('autoenter')
        window.location.href = '/enter'
        return Promise.reject(err)
      }
      sessionStorage.setItem('token', res.data.token)
      sessionStorage.setItem('reToken', res.data.reToken)
    })
    return axios(err.config)
  } else if (err.response.status == "500") {
    Message.error('服务端出现错误')
  }
  return Promise.reject(err)
    if (JSON.stringify(err).indexOf('timeout of') > -1) {
        Message.error('请求超时,请检查网络设置')
    } else if (JSON.stringify(err).indexOf('ERR_CONNECTION_RESET') > -1 || JSON.stringify(err).indexOf(
            'Network Error') > -1) {
        Message.error('网络连接错误')
    } else if (err.response.status == "503") {
        Message.error('服务未响应')
    } else if (err.response.status == "404") {
        Message.error('请求失败,链接地址不存在')
    } else if (err.response.status == "403") {
        Message.error('token不存在')
    } else if (err.response.status == "402") {
        Message.error('无效签名,请重新登录')
        localStorage.removeItem('autoenter')
        window.location.href = '/enter'
    } else if (err.response.status == "401") {
        await axios.post(javaApi + "user/refresh", {
            reToken: sessionStorage.getItem('reToken')
        }).then(res => {
            if (res.data.code == 201) {
                Message.error('认证失败,需要重新登录')
                localStorage.removeItem('autoenter')
                window.location.href = '/enter'
                return Promise.reject(err)
            }
            sessionStorage.setItem('token', res.data.token)
            sessionStorage.setItem('reToken', res.data.reToken)
        })
        return axios(err.config)
    } else if (err.response.status == "500") {
        Message.error('服务端出现错误')
    }
    return Promise.reject(err)
})
// 路由拦截器
@@ -111,7 +114,7 @@
// });
new Vue({
  el: '#app',
  router,
  render: h => h(App)
});
    el: '#app',
    router,
    render: h => h(App)
});
src/router/index.js
@@ -23,18 +23,5 @@
  {
    path: "/enter",
    component: () => import("../view/enter.vue")
  },
  // 添加计量模块
  {
    path: "/measure",
    components: Index,
    redirect: "/manage",
    children: [
      {
        path: "/manage",
        name: "MeasureManage",
        component: () => import('../components/view/measure/index.vue')
      }
    ]
  }]
})
src/view/index.vue
@@ -67,7 +67,7 @@
  color: #fff;
  width: 68px;
  height: 68px;
  margin: 20px 0;
  margin: 8px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
@@ -319,6 +319,74 @@
            }
          ]
        },
                {
                  k: 4,
                  v: "生产管理",
                  i: "font icon-shouye",
                  c: [
                    {
                      k: 12,
                      v: "生产订单",
                      i: "font icon-shouye",
                      u: ""
                    },
                    {
                      k: 13,
                      v: "生产计划",
                      i: "font icon-shouye",
                      u: ""
                    },
                    {
                      k: 14,
                      v: "生产报工",
                      i: "font icon-shouye",
                      u: ""
                    }
                  ]
                },
                {
                  k: 5,
                  v: "WMS管理",
                  i: "font icon-shouye",
                  c: [
                    {
                      k: 15,
                      v: "原材料库存",
                      i: "font icon-shouye",
                      u: ""
                    },
                    {
                      k: 16,
                      v: "回单管理",
                      i: "font icon-shouye",
                      u: ""
                    },
                    {
                      k: 17,
                      v: "半成品库存",
                      i: "font icon-shouye",
                      u: ""
                    },
                    {
                      k: 18,
                      v: "成品库存",
                      i: "font icon-shouye",
                      u: ""
                    },
                    {
                      k: 19,
                      v: "成品发货",
                      i: "font icon-shouye",
                      u: ""
                    },
                    {
                      k: 20,
                      v: "成品入库",
                      i: "font icon-shouye",
                      u: ""
                    }
                  ]
                },
        {
          k: 1,
          v: "技术管理",
@@ -390,9 +458,83 @@
              v: "计量管理",
              i: "font icon-shouye",
              u: "measurementManagement"
            },
            {
              k: 10.1,
              v: "巡检",
              i: "font icon-shouye",
              u: ""
            },
            {
              k: 10.2,
              v: "不合格品处置",
              i: "font icon-shouye",
              u: ""
            }
          ]
        }
        },
        {
          k: 6,
          v: "核算管理",
          i: "font icon-shouye",
          c: [
            {
              k: 21,
              v: "产量工资",
              i: "font icon-shouye",
              u: ""
            },
            {
              k: 22,
              v: "员工出勤",
              i: "font icon-shouye",
              u: ""
            }
          ]
        },
                {
                  k: 7,
                  v: "基础数据",
                  i: "font icon-shouye",
                  c: [
                    {
                      k: 23,
                      v: "工序维护",
                      i: "font icon-shouye",
                      u: ""
                    },
                    {
                      k: 24,
                      v: "自检维护",
                      i: "font icon-shouye",
                      u: ""
                    },
                    {
                      k: 25,
                      v: "技术指标维护",
                      i: "font icon-shouye",
                      u: ""
                    },
                    {
                      k: 26,
                      v: "工艺路线维护",
                      i: "font icon-shouye",
                      u: ""
                    },
                    {
                      k: 27,
                      v: "设备维护",
                      i: "font icon-shouye",
                      u: ""
                    },
                    {
                      k: 28,
                      v: "物料清单维护",
                      i: "font icon-shouye",
                      u: ""
                    }
                  ]
                }
      ],
      activeBox: 0,
      activeP: 0,
@@ -445,11 +587,19 @@
        this.activeBox = 0;
      } else if (num > 0 && num <= 2) {
        this.activeBox = 1;
      } else if (num > 2 && num <= 10) {
      } else if (num > 2 && num < 11) {
        this.activeBox = 2;
      } else if (num == 11) {
        this.activeBox = 3;
      }
      } else if (num > 11 && num <=14){
                this.activeBox = 4;
            } else if (num>14 && num<=20){
                this.activeBox = 5
            } else if (num>20 && num<=22){
                this.activeBox = 6
            } else if (num>22 && num<=28){
                this.activeBox = 7
            }
    },
    out() {
      sessionStorage.clear();