Merge branch 'master' of http://192.168.5.5:10010/r/web/SRM
New file |
| | |
| | | import request from "@/common/untils/request" |
| | | |
| | | // 重置密码 |
| | | export function initPassword(data) { |
| | | return request({ |
| | | url: "/api/user/initPassword", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| | | // 设置新密码 |
| | | export function modifiedPwd(data) { |
| | | return request({ |
| | | url: "/api/user/modifiedPwd", |
| | | method: "post", |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | |
| | |
| | | import { Message } from "element-ui" |
| | | |
| | | // import router from '@/router' |
| | | // 开发环境下将自己的token复制到这里, 也可以在浏览器中手动添加token到cookie中,cookie中的token优先 |
| | | const DEV_TOKEN = '' |
| | | function environmentType(){ |
| | | let type |
| | | if (location.href.includes('192.168.20.119')) { |
| | | type = 'test' |
| | | } else if (location.href.includes('192.168') || location.href.includes('localhost')) { |
| | | type = 'dev' |
| | | } else { |
| | | type = 'prod' |
| | | } |
| | | |
| | | return type |
| | | } |
| | | |
| | | const isDev = environmentType() === 'dev' |
| | | |
| | | const Axios = axios.create({ |
| | | responseType: "json", |
| | | withCredentials: true // 是否允许带cookie这些 |
| | | }) |
| | | const getApsPage = () => { |
| | | // 首页部署在各个环境的端口 |
| | | const loginPathMap = { |
| | | prod:`//${window.location.hostname}:9080`, |
| | | test:`//192.168.20.119:9080`, |
| | | dev: `//192.168.8.107:8080` |
| | | } |
| | | return loginPathMap[environmentType()] |
| | | } |
| | | |
| | | /* //POST传参序列化(添加请求拦截器) */ |
| | | Axios.interceptors.request.use( |
| | |
| | | /(?:(?:^|.*;\s*)token\s*=\s*([^;]*).*$)|^.*$/, |
| | | "$1", |
| | | ); |
| | | if (isDev){ |
| | | token = token || DEV_TOKEN |
| | | } |
| | | if (token) { |
| | | config.headers.Authorization = "Bearer " + token; |
| | | } |
| | |
| | | /* //对响应数据做些事 */ |
| | | if (res.data.code === 200) { |
| | | return res.data ? res.data : {} |
| | | } else { |
| | | Message({ |
| | | message: res.data.msg, |
| | | type: "error", |
| | | duration: 5 * 1000 |
| | | }) |
| | | } else if([2012,2013,2014,2015].includes(res.data.code)){ |
| | | if (isDev){ |
| | | alert("JWT失效,即将跳转至登录页..") |
| | | window.location = getApsPage()+'/login' |
| | | }else { |
| | | // JWT鉴权失效 跳转到登录页 |
| | | window.location = getApsPage()+'/login' |
| | | } |
| | | // Message({ |
| | | // message: res.data.msg, |
| | | // type: "error", |
| | | // duration: 5 * 1000 |
| | | // }) |
| | | return Promise.reject(res.data) |
| | | }else if([2036].includes(res.data.code)){ |
| | | if (isDev){ |
| | | window.location = getApsPage()+'/commonWeb?resetPwd=true' |
| | | }else { |
| | | // JWT鉴权失效 跳转到登录页 |
| | | window.location = getApsPage()+'/commonWeb?resetPwd=true' |
| | | } |
| | | return Promise.reject(res.data) |
| | | |
| | | // if(window.location.pathname && window.location.pathname !== '/login'){ |
| | | // window.location = window.location.origin+'/login' |
| | | // } |
| | | } |
| | | }, |
| | | (error) => { |
| | | if(error.response.status === 401){ |
| | | if (isDev){ |
| | | alert("JWT失效,即将跳转至登录页..") |
| | | window.location = getApsPage()+'/login' |
| | | }else { |
| | | // JWT鉴权失效 跳转到登录页 |
| | | window.location = getApsPage()+'/login' |
| | | } |
| | | } |
| | | let { message } = error |
| | | if (message === "Network Error") { |
| | | message = "后端接口连接异常" |
New file |
| | |
| | | <template> |
| | | <div> |
| | | <el-dialog |
| | | title="修改密码" |
| | | :visible.sync="editConfig.dialogVisible" |
| | | width="30%" |
| | | :before-close="handleClose"> |
| | | <el-form :label-position="labelPosition" :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm"> |
| | | <el-form-item label="旧密码:" prop="oldPass"> |
| | | <el-input type="password" clearable v-model="ruleForm.oldPass" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="新密码:" prop="pass"> |
| | | <el-input type="password" clearable v-model="ruleForm.pass" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="确认密码:" prop="checkPass"> |
| | | <el-input type="password" clearable v-model="ruleForm.checkPass" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="submitForm('ruleForm')" style="margin-bottom:20px;">确认</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { modifiedPwd } from "@/api/admin/user"; |
| | | export default { |
| | | props: { |
| | | editCommonConfig: { |
| | | type: Object, |
| | | default: () => { |
| | | return { |
| | | dialogVisible:false, |
| | | userId:"", |
| | | }; |
| | | }, |
| | | }, |
| | | }, |
| | | data() { |
| | | var validatePass = (rule, value, callback) => { |
| | | if (value === '') { |
| | | callback(new Error('请输入旧密码')); |
| | | }else{ |
| | | callback(); |
| | | } |
| | | }; |
| | | var validatePass1 = (rule, value, callback) => { |
| | | if (value === '') { |
| | | callback(new Error('请输入新密码')); |
| | | } else { |
| | | if (this.ruleForm.checkPass !== '') { |
| | | this.$refs.ruleForm.validateField('checkPass'); |
| | | } |
| | | callback(); |
| | | } |
| | | }; |
| | | var validatePass2 = (rule, value, callback) => { |
| | | if (value === '') { |
| | | callback(new Error('请再次输入密码')); |
| | | } else if (value !== this.ruleForm.pass) { |
| | | callback(new Error('两次输入密码不一致!')); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }; |
| | | return { |
| | | editConfig:this.editCommonConfig, |
| | | // dialogVisible: false |
| | | ruleForm: { |
| | | oldPass:'', |
| | | pass: '', |
| | | checkPass: '', |
| | | }, |
| | | rules: { |
| | | oldPass: [ |
| | | { validator: validatePass, trigger: 'blur', required: true, } |
| | | ], |
| | | pass: [ |
| | | { validator: validatePass1, trigger: 'blur', required: true, } |
| | | ], |
| | | checkPass: [ |
| | | { validator: validatePass2, trigger: 'blur', required: true, } |
| | | ], |
| | | }, |
| | | labelPosition:"left", |
| | | userId : '', |
| | | }; |
| | | }, |
| | | computed: { |
| | | |
| | | }, |
| | | created() { |
| | | |
| | | }, |
| | | mounted() { |
| | | }, |
| | | watch: { |
| | | |
| | | }, |
| | | methods: { |
| | | // |
| | | environmentType(){ |
| | | let type |
| | | if (location.href.includes('192.168.20.119')) { |
| | | type = 'test' |
| | | } else if (location.href.includes('192.168') || location.href.includes('localhost')) { |
| | | type = 'dev' |
| | | } else { |
| | | type = 'prod' |
| | | } |
| | | return type |
| | | }, |
| | | // |
| | | getApsPage(){ |
| | | // 首页部署在各个环境的端口 |
| | | const loginPathMap = { |
| | | prod:`//${window.location.hostname}:9080`, |
| | | test:`//192.168.20.119:9080`, |
| | | // 想跳到本地启动的登录页的话需要把dev改成你本地项目路径 |
| | | dev: `//192.168.8.108:8080` |
| | | } |
| | | |
| | | return loginPathMap[this.environmentType()] |
| | | }, |
| | | handleClose(done){ |
| | | done(); |
| | | }, |
| | | modifiedPwd(params){ |
| | | modifiedPwd(params).then((res)=>{ |
| | | if(res.code==200){ |
| | | this.editConfig.dialogVisible=false |
| | | alert("密码修改成功,请重新登录!") |
| | | window.location = this.getApsPage()+'/login' |
| | | } |
| | | }) |
| | | }, |
| | | submitForm(formName) { |
| | | this.$refs[formName].validate((valid) => { |
| | | if (valid) { |
| | | console.log(this.ruleForm,"看看表单") |
| | | this.modifiedPwd({ |
| | | userId:this.editConfig.userId, |
| | | oldPwd:this.ruleForm.oldPass, |
| | | newPwd:this.ruleForm.pass, |
| | | }) |
| | | |
| | | } else { |
| | | console.log('error submit!!'); |
| | | return false; |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | }, |
| | | components: { |
| | | |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .el-form{ |
| | | margin-top:20px; |
| | | } |
| | | ::v-deep { |
| | | .el-form-item__content{ |
| | | display: flex; |
| | | flex-direction: row-reverse; |
| | | } |
| | | .el-dialog__header{ |
| | | .el-dialog__title{ |
| | | font-size:18px; |
| | | |
| | | } |
| | | } |
| | | .el-form{ |
| | | margin:20px; |
| | | } |
| | | |
| | | } |
| | | </style> |
| | |
| | | <div class="header-user-info"> |
| | | <div class="avatar"><el-avatar icon="el-icon-user-solid"></el-avatar></div> |
| | | <el-dropdown @command="handleCommand"> |
| | | <div class="el-dropdown-link">{{ username }}<i class="el-icon-arrow-down el-icon--right"></i></div> |
| | | <div class="el-dropdown-link">你好 {{ username }}<i class="el-icon-arrow-down el-icon--right"></i></div> |
| | | <el-dropdown-menu slot="dropdown"> |
| | | <el-dropdown-item command="logout">退出</el-dropdown-item> |
| | | <el-dropdown-item @click.native="updatePwd"> |
| | | <d2-icon name="unlock" class="d2-mr-5" /> |
| | | 修改密码 |
| | | </el-dropdown-item> |
| | | </el-dropdown-menu> |
| | | </el-dropdown> |
| | | <UpdatePassWord :editCommonConfig="editConfig"></UpdatePassWord> |
| | | |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import Cookies from "js-cookie" |
| | | import UpdatePassWord from "./components/updatePassWord" |
| | | export default { |
| | | name: "SalesLead", |
| | | props: { |
| | | headerTitle: String |
| | | }, |
| | | components:{ |
| | | UpdatePassWord, |
| | | }, |
| | | data() { |
| | | return { |
| | | username: "" |
| | | username: "", |
| | | editConfig:{ |
| | | dialogVisible:false, |
| | | userId:"", |
| | | } |
| | | } |
| | | }, |
| | | created(){ |
| | | const userObj = Cookies.get('userObj'); |
| | | if (userObj) { |
| | | let userInfo = JSON.parse(userObj); |
| | | this.editConfig.userId=userInfo.id |
| | | this.username=userInfo.nickName |
| | | } else { |
| | | console.log('Object not found in cookie'); |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.username = document.cookie.replace(/(?:(?:^|.*;\s*)username\s*=\s*([^;]*).*$)|^.*$/, "$1") |
| | | // this.username = document.cookie.replace(/(?:(?:^|.*;\s*)username\s*=\s*([^;]*).*$)|^.*$/, "$1") |
| | | }, |
| | | methods: { |
| | | environmentType() { |
| | |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | }, |
| | | updatePwd(){ |
| | | this.editConfig.dialogVisible=true |
| | | } |
| | | } |
| | | } |
| | |
| | | </el-submenu> |
| | | |
| | | </el-menu> |
| | | <el-empty v-if="this.menus===null||this.menus===undefined||this.menus.length===0" :image-size="130" description="没有侧栏菜单"></el-empty> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import {getMenuTreeByRole} from "@/api/menus/index" |
| | | export default { |
| | | name: "AppSidebar", |
| | | props: {}, |
| | | data() { |
| | | return { |
| | | menus:[] |
| | | } |
| | | }, |
| | | watch: {}, |
| | |
| | | }, |
| | | methods: { |
| | | getMenuTreeByRole(){ |
| | | getMenuTreeByRole().then((res)=>{ |
| | | res.data.list.map((item)=>{ |
| | | if(item.systemType===4){ |
| | | this.menus=item.menus |
| | | } |
| | | }) |
| | | }) |
| | | this.menus=this.$store.state.menus.menus |
| | | }, |
| | | // 监听路由 |
| | | initNavMenu() { |
| | |
| | | <!-- Add "scoped" attribute to limit CSS to this component only --> |
| | | <style lang="scss" scoped> |
| | | @import "./index.scss"; |
| | | ::v-deep .el-empty{ |
| | | .el-empty__description{ |
| | | p{ |
| | | color: #dddd; |
| | | } |
| | | } |
| | | } |
| | | </style> |
| | |
| | | handleSelectClient(item, prop, row) { |
| | | this.tableList.tableData.map((ite) => { |
| | | if (ite.name === item.name) { |
| | | ite.ID = row.ID |
| | | ite.id = row.id |
| | | ite.amount = item.amount || 1 |
| | | ite.number = item.number |
| | | ite.purchasePrice = item.purchasePrice |
| | |
| | | } |
| | | }) |
| | | if (this.detailEnter) { |
| | | this.setEditName(item, row.ID) |
| | | this.setEditName(item, row.id) |
| | | } |
| | | this.$emit("handleProduct",item) |
| | | this.$emit("handleProduct",item,row) |
| | | }, |
| | | setEditName(item, ID) { |
| | | setEditName(item, id) { |
| | | let selRow = { |
| | | ID: ID, |
| | | id: id, |
| | | deliveryTime: item.deliveryTime, |
| | | maximumStock: item.maximumStock, |
| | | minimumStock: item.minimumStock, |
| | |
| | | console.log(this.tableList.tableData) |
| | | if (this.detailEnter) { |
| | | this.tableList.tableData.map((ite) => { |
| | | ite.ID |
| | | ite.id |
| | | ite.name = item.name |
| | | ite.amount = item.amount || 1 |
| | | ite.number = item.number |
| | |
| | | ite.deliveryTime = item.deliveryTime |
| | | ite.shippingDuration = item.shippingDuration |
| | | }) |
| | | this.setEditName(item, this.tableList.tableData[0].ID) |
| | | this.setEditName(item, this.tableList.tableData[0].id) |
| | | } else { |
| | | this.tableList.tableData.map((ite, index) => { |
| | | if (index === this.productIndex) { |
| | | ite.name = item.name |
| | | ite.productId = item.ID |
| | | ite.productId = item.id |
| | | ite.productIndex = this.productIndex+1 |
| | | ite.amount = item.amount || 1 |
| | | ite.number = item.number |
| | | ite.purchasePrice = item.purchasePrice |
| | |
| | | this.$forceUpdate() |
| | | } |
| | | }) |
| | | |
| | | console.log(this.tableList.tableData, "=====chanp") |
| | | } |
| | | }, |
| | |
| | | import purchaseRouter from "./purchase/index.js" |
| | | import productRouter from "./product/index.js" |
| | | import {getMenuTreeByRole} from "@/api/menus/index" |
| | | import store from '@/store/index.js'; |
| | | |
| | | Vue.use(Router) |
| | | const login = (resolve) => require(["@/views/other/login/index"], resolve) |
| | |
| | | }; |
| | | const foundObject = res.data.list.find(obj => obj.systemType === 4); |
| | | if (foundObject) { |
| | | // 存储进vuex |
| | | store.commit('setMenus', foundObject); |
| | | foundObject.menus.forEach(item => { |
| | | const nextPath = item.children.find(obj => obj.path === routePath); |
| | | if (nextPath) { |
| | |
| | | |
| | | export default new Vuex.Store({ |
| | | state: { |
| | | menus:[], |
| | | }, |
| | | getters: { |
| | | }, |
| | | mutations: { |
| | | setMenus(state,payload){ |
| | | state.menus = payload |
| | | } |
| | | }, |
| | | actions: { |
| | | }, |
| | |
| | | > |
| | | <el-option |
| | | v-for="ele in plcBrandList" |
| | | :key="ele.name" |
| | | :key="ele.purchaseTypeId" |
| | | :label="ele.name" |
| | | :value="ele.id" |
| | | ></el-option> |
| | |
| | | } |
| | | }, |
| | | created() { |
| | | console.log(this.editConfig,"参数") |
| | | this.handleGetBomKindDictList() |
| | | this.$store.dispatch("getSupplier") |
| | | this.formInfo() |
| | |
| | | this.plcBrandList = res.data |
| | | this.setTableForm() |
| | | if (val) { |
| | | // this.plcBrandList.map((item)=>{ |
| | | // item.purchaseTypeId=item.id |
| | | // }) |
| | | for (let i in this.plcBrandList) { |
| | | if (this.plcBrandList[i][this.editRow.isDefault]) { |
| | | this.editConfig.infomation.purchaseTypeId = this.editConfig.infomation.purchaseTypeId |
| | | ? this.editConfig.infomation.purchaseTypeId |
| | | : this.plcBrandList[i].id |
| | | this.$set(this.editConfig.infomation, "purchaseTypeId", this.editConfig.infomation.purchaseTypeId) |
| | | |
| | | break |
| | | } |
| | | } |
| | |
| | | this.editConfig.detailEnter = false |
| | | this.editConfig.isDisabled = false |
| | | this.tableLoading = true |
| | | getPurchaseInfo({ id: row.id }).then((res) => { |
| | | getPurchaseInfo({ id: Number(row.id) }).then((res) => { |
| | | if (res.code == 200) { |
| | | this.tableLoading = false |
| | | this.editConfig.visible = true |
| | |
| | | if (!row.supplierName) { |
| | | this.btnEdit(row) |
| | | } else { |
| | | submitPurchase({ id: row.ID, status: 2 }).then((response) => { |
| | | submitPurchase({ id: Number(row.id), status: 2 }).then((response) => { |
| | | if (response.code === 200) { |
| | | this.$message.success("提交成功") |
| | | this.getData() |
| | |
| | | type: "warning" |
| | | }).then( |
| | | () => { |
| | | submitPurchase({ id: row.ID, status: 5 }).then((response) => { |
| | | submitPurchase({ id: Number(row.id), status: 5 }).then((response) => { |
| | | if (response.code === 200) { |
| | | this.$message.success("已取消") |
| | | this.getData() |
| | |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | deletePurchase({ id: row.ID }).then((response) => { |
| | | deletePurchase({ id: Number(row.id) }).then((response) => { |
| | | if (response.code === 200) { |
| | | this.$message.success("删除成功") |
| | | this.getData() |
| | |
| | | @emptyProductClick="emptyProductClick" |
| | | @clearupProduct="clearupProduct" |
| | | @selCommonName="selCommonName" |
| | | @handleProduct="handleProduct" |
| | | /> |
| | | </div> |
| | | </div> |
| | |
| | | let data = this.editConfig.infomation |
| | | let params = { |
| | | deliveryTime: this.deliveryTime || 0, |
| | | id: data.ID || 0, |
| | | id: data.id || 0, |
| | | maximumStock: data.maximumStock || 0, |
| | | minimumStock: data.minimumStock || 0, |
| | | modelNumber: data.modelNumber || "", |
| | |
| | | } |
| | | return params |
| | | }, |
| | | handleProduct(item,row){ |
| | | this.editConfig.infomation.id=row.id |
| | | }, |
| | | setTableForm() { |
| | | if (this.editConfig.title === "添加") { |
| | | this.detailEnter = false |
| | |
| | | number: "", |
| | | price: 0, |
| | | total: 0, |
| | | supplierId: this.supplierId |
| | | supplierId:this.supplierId |
| | | } |
| | | ] |
| | | } else { |
| | | this.tableData = [{ ...this.editConfig.infomation }] |
| | | this.tableData = [{ ...this.editConfig.infomation}] |
| | | this.detailEnter = true |
| | | } |
| | | this.productTableList = { |
| | |
| | | this.tableData.map((item) => { |
| | | if (item.productId === row.productId) { |
| | | item[prop] = val |
| | | item.supplierId = this.supplierId |
| | | item.supplierId =Number(this.supplierId) |
| | | item.deliveryTime = this.deliveryTime |
| | | item.shippingDuration = this.shippingDuration |
| | | item.purchasePrice = this.purchasePrice |
| | |
| | | console.log(err) |
| | | }) |
| | | } else { |
| | | params.id=this.editConfig.infomation.id |
| | | updateSupplier(params).then((res) => { |
| | | this.editConfig.visible = false |
| | | if (res.code === 200) { |
| | |
| | | detailAddress: data.detailAddress || "", |
| | | email: data.email || "", |
| | | fileId: this.file_id || 0, |
| | | id: data.id || 0, |
| | | // id: data.id || 0, |
| | | industry: data.industry || "", |
| | | name: data.name || "", |
| | | number: data.number || "", |
| | | phone: data.phone || "", |
| | | responsiblePersonName: |
| | | data.responsiblePersonName || document.cookie.replace(/(?:(?:^|.*;\s*)username\s*=\s*([^;]*).*$)|^.*$/, "$1"), |
| | | data.responsiblePersonName || document.cookie.replace(/(?:(?:^|.*;\s*)username\s*=\s*([^;]*).*$)|^.*$/, "$1"), |
| | | status: data.status || 0, |
| | | supplierType: data.supplierType || "", |
| | | url: data.url || "" |
| | |
| | | async enableClick(row, value) { |
| | | let status = value === "启用" ? 1 : 0 |
| | | await changeSupplierStatus({ |
| | | id: row.ID, |
| | | id:Number(row.id), |
| | | status: status |
| | | }).then((res) => { |
| | | if (res.code === 200) { |
| | |
| | | }, |
| | | // 修改产品 |
| | | editClick(row) { |
| | | console.log(row) |
| | | this.newProductConfig.visible = true |
| | | this.newProductConfig.title = "修改" |
| | | this.newProductConfig.infomation = { ...row } |
| | |
| | | this.selValueList = list |
| | | }, |
| | | tableRowClick(row) { |
| | | console.log(row) |
| | | this.productPagerOptions.currPage = 1 |
| | | this.selectRow = row |
| | | this.supplierId = row.id |
| | |
| | | }, |
| | | // 详情 |
| | | async selCommonClick(row) { |
| | | await getPurchaseList({ pageSize: 10, page: 1, supplierId: row.ID }).then((res) => { |
| | | await getPurchaseList({ pageSize: 10, page: 1, supplierId: Number(row.id) }).then((res) => { |
| | | this.commonDetail.productListInfo = res.data.list |
| | | }) |
| | | this.commonDetail.visible = true |
| | |
| | | this.editPurchaseConfig.title = "新建" |
| | | this.editPurchaseConfig.infomation = { |
| | | supplierId: this.selectRow.id, |
| | | purchaseTypeId:"2", |
| | | supplierName: this.selectRow.name |
| | | } |
| | | } |