Commit 9062f9ae by wangyalan-git

供应商管理,库存管理

parent 6f8a889b
/**
* 库存管理
*/
import request from '@/utils/request'
// 万科后台_入库查询分页
export function getInboundRecordList(params) {
return request({
url: 'vankeInboundRecord/list',
method: 'get',
params
})
}
// 万科后台_出库查询分页操作
export function getOutboundRecordList(params) {
return request({
url: 'vankeOutboundRecord/list',
method: 'get',
params
})
}
// 万科后台_库房分页操作
export function getStockRooms(params) {
return request({
url: 'vankeStockRoom/list',
method: 'get',
params
})
}
// 万科后台_库房插入操作
export function addDepartment(params) {
return request({
url: 'vankeStockRoom/insertDepartment',
method: 'post',
params
})
}
// 万科后台_根据库房id修改一条数据
export function editDepartment(params) {
return request({
url: 'vankeStockRoom/updateDepartment',
method: 'post',
params
})
}
// 万科后台_物品类别分页操作
export function getGoodsCategoryList(params) {
return request({
url: 'vankeGoodsCategory/list',
method: 'get',
params
})
}
// 万科后台_物品类别插入操作
export function addGoodsCategory(params) {
return request({
url: 'vankeGoodsCategory/insertGoodsCategory',
method: 'post',
params
})
}
// 万科后台_根据物品类别id修改一条数据
export function editGoodsCategory(params) {
return request({
url: 'vankeGoodsCategory/updateGoodsCategory',
method: 'post',
params
})
}
// 万科后台_物品分页操作
export function getGoodsList(params) {
return request({
url: 'vankeGoods/list',
method: 'get',
params
})
}
import request from '@/utils/request'
export function login(username, password) {
// 生成验证码,返回的是 base64
export function getCaptchaImage() {
return request({
url: '/validateCode/getCaptchaBase64',
method: 'get',
})
}
export function login(username, password,authCode) {
return request({
url: '/admin/login',
method: 'post',
data: {
username,
password
password,
authCode
}
})
}
......
/**
* 供应商资料
*/
import request from '@/utils/request'
// 万科后台_供应商分页操作
export function getSuppliersList(params) {
return request({
url: 'vankeSupplier/list',
method: 'get',
params
})
}
// 万科后台_供应商插入操作
export function addSupplier(params) {
return request({
url: 'vankeSupplier/insertSupplier',
method: 'post',
params
})
}
// 万科后台_根据供应商id修改一条数据
export function editSupplier(params) {
return request({
url: 'vankeSupplier/updateSupplier',
method: 'post',
params
})
}
// 万科后台_根据供应商id查询一条数据
export function getSupplierDetail(params) {
return request({
url: 'vankeSupplier/selectById',
method: 'get',
params
})
}
......@@ -81,21 +81,21 @@ const permission = {
const { username } = data
const accessedRouters = asyncRouterMap.filter(v => {
// admin帐号直接返回所有菜单
// if (username === 'admin') return true
if (hasPermission(menus, v)) {
if (v.children && v.children.length > 0) {
v.children = v.children.filter(child => {
if (hasPermission(menus, child)) {
return child
}
return false
})
return v
} else {
return v
}
}
return false
if (username === 'admin') return true
// if (hasPermission(menus, v)) {
// if (v.children && v.children.length > 0) {
// v.children = v.children.filter(child => {
// if (hasPermission(menus, child)) {
// return child
// }
// return false
// })
// return v
// } else {
// return v
// }
// }
// return false
})
//对菜单进行排序
sortRouters(accessedRouters)
......
......@@ -35,7 +35,7 @@ const user = {
Login({ commit }, userInfo) {
const username = userInfo.username.trim()
return new Promise((resolve, reject) => {
login(username, userInfo.password).then(response => {
login(username, userInfo.password, userInfo.authCode).then(response => {
const data = response.data
const tokenStr = data.tokenHead+data.token
setToken(tokenStr)
......
......@@ -2,11 +2,11 @@ import axios from 'axios'
import { Message, MessageBox } from 'element-ui'
import store from '../store'
import { getToken } from '@/utils/auth'
// 创建axios实例
const service = axios.create({
// baseURL: process.env.BASE_API,
baseURL: 'http://192.168.31.254:8201/mall-admin',
withCredentials: true,
baseURL: 'http://192.168.31.127:8201/mall-admin',
// baseURL: 'http://hhg.api.jsonpro.cn:8201/mall-admin',
timeout: 60000 // 请求超时时间
})
......@@ -15,6 +15,8 @@ const service = axios.create({
service.interceptors.request.use(config => {
if (store.getters.token) {
config.headers['Authorization'] = getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
config.headers['Access-Control-Allow-Credentials']= true
}
return config
}, error => {
......@@ -63,5 +65,4 @@ service.interceptors.response.use(
return Promise.reject(error)
}
)
export default service
......@@ -4,7 +4,7 @@
<el-card class="filter-container mt15"
shadow="never">
<el-row type="flex" class="btn-groups">
<el-button type="primary" @click="handleAdd">新增</el-button>
<el-button type="primary" size="medium" @click="handleAdd">新增</el-button>
</el-row>
<div class="table-container">
<el-table :data="list"
......@@ -16,7 +16,7 @@
width="50"></el-table-column>
<el-table-column label="库房名称"
align="center">
<template slot-scope="scope">{{scope.row.username}}</template>
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="管理员"
align="center">
......@@ -24,14 +24,15 @@
</el-table-column>
<el-table-column label="创建时间"
align="center">
<template slot-scope="scope">{{scope.row.email || '--'}}</template>
<template slot-scope="scope">{{scope.row.createtime | formatTime}}</template>
</el-table-column>
<el-table-column label="操作"
align="center">
<template slot-scope="scope">
<el-button size="mini"
type="primary"
@click="editDetail(scope.row.id)">删除</el-button>
type="danger"
@click="handleDelete(scope.row.id)">删除
</el-button>
</template>
</el-table-column>
</el-table>
......@@ -50,36 +51,24 @@
</div>
</el-card>
<!-- 弹窗-->
<add-depot ref="addCategory" @ok="getList"></add-depot>
<add-depot ref="addDepot" @ok="getList"></add-depot>
</div>
</template>
<script>
import moment from 'moment'
import { getSupplier, getAuditDetail, updateMcht } from '@/api/audit'
import { getStockRooms, editDepartment } from '@/api/inventory'
import AddDepot from './modules/addDepot'
// 列表查询参数默认值
const defaultListQuery = {
pageNum: 1,
pageSize: 10,
accouuntType: 1,
name: '',
phone: '',
status: ''
pageSize: 10
}
export default {
name: 'DepotAdmin',
components: {AddDepot},
components: { AddDepot },
data() {
return {
statusOptions: [{
label: '启用',
value: 1
},
{
label: '禁用',
value: 0
}],
listQuery: Object.assign({}, defaultListQuery),
list: [],
total: 0,
......@@ -124,7 +113,7 @@ export default {
this.listLoading = true
//请求数据
console.log('listQuery', this.listQuery)
getSupplier(this.listQuery).then(res => {
getStockRooms(this.listQuery).then(res => {
this.listLoading = false
this.list = res.data.list
this.total = res.data.total
......@@ -132,8 +121,22 @@ export default {
this.listLoading = false
})
},
handleAdd(){
this.$refs.addCategory.init()
// 添加
handleAdd() {
this.$refs.addDepot.add()
},
// 删除
handleDelete(id){
this.$confirm('是否删除该库房?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
editDepartment({id: id,deleteStatus: 0 }).then(res=>{
this.getList()
})
}).catch(() => {
});
}
}
}
......@@ -153,7 +156,8 @@ export default {
.input-width {
width: 180px;
}
.btn-groups button{
.btn-groups button {
width: 100px;
}
</style>
......@@ -16,18 +16,18 @@
width="50"></el-table-column>
<el-table-column label="物品类别"
align="center">
<template slot-scope="scope">{{scope.row.username}}</template>
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="创建时间"
align="center">
<template slot-scope="scope">{{scope.row.email || '--'}}</template>
<template slot-scope="scope">{{scope.row.createtime | formatTime}}</template>
</el-table-column>
<el-table-column label="操作"
align="center">
<template slot-scope="scope">
<el-button size="mini"
type="primary"
@click="editDetail(scope.row.id)">删除</el-button>
type="danger"
@click="handleDelete(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
......@@ -51,16 +51,12 @@
</template>
<script>
import moment from 'moment'
import { getSupplier, getAuditDetail, updateMcht } from '@/api/audit'
import { getGoodsCategoryList, editGoodsCategory } from '@/api/inventory'
import AddCategory from './modules/addCategory'
// 列表查询参数默认值
const defaultListQuery = {
pageNum: 1,
pageSize: 10,
accouuntType: 1,
name: '',
phone: '',
status: ''
pageSize: 10
}
export default {
......@@ -68,14 +64,6 @@ export default {
components: {AddCategory},
data() {
return {
statusOptions: [{
label: '启用',
value: 1
},
{
label: '禁用',
value: 0
}],
listQuery: Object.assign({}, defaultListQuery),
list: [],
total: 0,
......@@ -120,7 +108,7 @@ export default {
this.listLoading = true
//请求数据
console.log('listQuery', this.listQuery)
getSupplier(this.listQuery).then(res => {
getGoodsCategoryList(this.listQuery).then(res => {
this.listLoading = false
this.list = res.data.list
this.total = res.data.total
......@@ -128,8 +116,22 @@ export default {
this.listLoading = false
})
},
// 添加
handleAdd(){
this.$refs.addCategory.init()
this.$refs.addCategory.add()
},
// 删除
handleDelete(id){
this.$confirm('是否删除该物品类别?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
editGoodsCategory({id: id,deleteStatus: 0 }).then(res=>{
this.getList()
})
}).catch(() => {
});
}
}
}
......
......@@ -7,7 +7,7 @@
:model="listQuery"
size="small">
<el-form-item label="物品名称:">
<el-input v-model="listQuery.name"
<el-input v-model="listQuery.goodsMame"
class="input-width"
placeholder="请输入物品名称"></el-input>
</el-form-item>
......@@ -35,23 +35,23 @@
width="50"></el-table-column>
<el-table-column label="物品名称"
align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
<template slot-scope="scope">{{scope.row.goodsName}}</template>
</el-table-column>
<el-table-column label="总数量"
align="center">
<template slot-scope="scope">{{scope.row.username}}</template>
<template slot-scope="scope">{{scope.row.inboundNum}}</template>
</el-table-column>
<el-table-column label="入库人"
align="center">
<template slot-scope="scope">{{scope.row.phone || '--'}}</template>
<template slot-scope="scope">{{scope.row.backInboundName || '--'}}</template>
</el-table-column>
<el-table-column label="入库日期"
align="center">
<template slot-scope="scope">{{scope.row.email || '--'}}</template>
<template slot-scope="scope">{{scope.row.createtime | formatTime}}</template>
</el-table-column>
<el-table-column label="所属库房"
align="center">
<template slot-scope="scope">{{scope.row.email || '--'}}</template>
<template slot-scope="scope">{{scope.row.stockRoomName || '--'}}</template>
</el-table-column>
<el-table-column label="操作"
......@@ -60,10 +60,10 @@
<template slot-scope="scope">
<el-button size="mini"
type="success"
@click="lookDetail(scope.row)">查看详情</el-button>
@click="handleView(scope.row)">查看详情</el-button>
<el-button size="mini"
type="primary"
@click="editDetail(scope.row.id)">生成入库单</el-button>
@click="exportEntry(scope.row.id)">生成入库单</el-button>
</template>
</el-table-column>
</el-table>
......@@ -90,16 +90,13 @@
</template>
<script>
import moment from 'moment'
import { getSupplier, getAuditDetail, updateMcht } from '@/api/audit'
import { getInboundRecordList } from '@/api/inventory'
import inventoryDetailsModal from './modules/inventoryDetailsModal'
// 列表查询参数默认值
const defaultListQuery = {
pageNum: 1,
pageSize: 10,
accouuntType: 1,
name: '',
phone: '',
status: ''
goodsMame: ''
}
export default {
......@@ -151,7 +148,7 @@ export default {
this.listLoading = true
//请求数据
console.log('listQuery',this.listQuery)
getSupplier(this.listQuery).then(res => {
getInboundRecordList(this.listQuery).then(res => {
this.listLoading = false
this.list = res.data.list
this.total = res.data.total
......@@ -160,7 +157,7 @@ export default {
})
},
// 查看
lookDetail(row) {
handleView(id) {
this.$refs.detail.init()
}
}
......
......@@ -12,37 +12,37 @@
placeholder="请输入物品名称"></el-input>
</el-form-item>
<el-form-item label="物品类别:">
<el-select v-model="listQuery.status"
<el-select v-model="listQuery.goodsCategoryId"
class="input-width"
clearable
placeholder="请选择物品类别">
<el-option v-for="item in statusOptions"
:key="item.value"
:label="item.label"
:value="item.value"></el-option>
<el-option v-for="item in categoryOptions"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="供应商:">
<el-select v-model="listQuery.status"
<el-select v-model="listQuery.supplierId"
class="input-width"
clearable
placeholder="请选择供应商">
<el-option v-for="item in statusOptions"
:key="item.value"
:label="item.label"
:value="item.value"></el-option>
<el-option v-for="item in supplierOptions"
:key="item.id"
:label="item.supplierName"
:value="item.id"></el-option>
</el-select>
</el-form-item>
<!-- 超级管理员可见-->
<el-form-item label="库房:">
<el-select v-model="listQuery.status"
<el-select v-model="listQuery.stockRoomId"
class="input-width"
clearable
placeholder="请选择库房">
<el-option v-for="item in statusOptions"
:key="item.value"
:label="item.label"
:value="item.value"></el-option>
<el-option v-for="item in depotOptions"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item>
......@@ -85,23 +85,23 @@
</el-table-column>
<el-table-column label="物品类别"
align="center">
<template slot-scope="scope">{{scope.row.username}}</template>
<template slot-scope="scope">{{scope.row.goodsCategoryName}}</template>
</el-table-column>
<el-table-column label="数量"
align="center">
<template slot-scope="scope">{{scope.row.username}}</template>
<template slot-scope="scope">{{scope.row.goodsNum}}</template>
</el-table-column>
<el-table-column label="价格"
align="center">
<template slot-scope="scope">{{scope.row.phone || '--'}}</template>
<template slot-scope="scope">{{scope.row.prict || 0}}</template>
</el-table-column>
<el-table-column label="供应商"
align="center">
<template slot-scope="scope">{{scope.row.phone || '--'}}</template>
<template slot-scope="scope">{{scope.row.supplierName || '--'}}</template>
</el-table-column>
<el-table-column label="所属库房"
align="center">
<template slot-scope="scope">{{scope.row.email || '--'}}</template>
<template slot-scope="scope">{{scope.row.stockRoomName || '--'}}</template>
</el-table-column>
</el-table>
</div>
......@@ -124,16 +124,17 @@
</template>
<script>
import moment from 'moment'
import { getSupplier, getAuditDetail, updateMcht } from '@/api/audit'
import { getGoodsList,getGoodsCategoryList,getStockRooms, getAuditDetail, updateMcht } from '@/api/inventory'
import {getSuppliersList} from '@/api/supplier'
import AddGoods from './modules/addGoodsModal'
// 列表查询参数默认值
const defaultListQuery = {
pageNum: 1,
pageSize: 10,
accouuntType: 1,
name: '',
phone: '',
status: ''
goodsCategoryId: '',
supplierId: '',
stockRoomId: ''
}
export default {
......@@ -141,23 +142,21 @@ export default {
components: {AddGoods},
data() {
return {
statusOptions: [{
label: '启用',
value: 1
},
{
label: '禁用',
value: 0
}],
listQuery: Object.assign({}, defaultListQuery),
list: [],
total: 0,
listLoading: false,
multipleSelection: [],
categoryOptions: [],
supplierOptions: [],
depotOptions: []
}
},
created() {
this.getList()
this.getGoodsCategoryList()
this.getSuppliersList()
this.getStockRooms()
},
filters: {
formatTime(time) {
......@@ -188,12 +187,30 @@ export default {
handleSelectionChange(vals) {
this.multipleSelection = vals
},
// 物品类别
getGoodsCategoryList(){
getGoodsCategoryList().then(res=>{
this.categoryOptions = res.data.list
})
},
// 供应商
getSuppliersList(){
getSuppliersList().then(res=>{
this.supplierOptions = res.data.list
})
},
// 库房
getStockRooms(){
getStockRooms().then(res=>{
this.depotOptions = res.data.list
})
},
//请求数据
getList() {
this.listLoading = true
//请求数据
console.log('listQuery', this.listQuery)
getSupplier(this.listQuery).then(res => {
getGoodsList(this.listQuery).then(res => {
this.listLoading = false
this.list = res.data.list
this.total = res.data.total
......
......@@ -7,12 +7,12 @@
:model="listQuery"
size="small">
<el-form-item label="物品名称:">
<el-input v-model="listQuery.name"
<el-input v-model="listQuery.goodsMame"
class="input-width"
placeholder="请输入物品名称"></el-input>
</el-form-item>
<el-form-item label="物品类别:">
<el-select v-model="listQuery.status"
<el-select v-model="listQuery.goodsCategoryId"
class="input-width"
clearable
placeholder="请选择物品类别">
......@@ -23,7 +23,7 @@
</el-select>
</el-form-item>
<el-form-item label="部门:">
<el-select v-model="listQuery.status"
<el-select v-model="listQuery.stockRoomId"
class="input-width"
clearable
placeholder="请选择部门">
......@@ -69,7 +69,7 @@
width="50"></el-table-column>
<el-table-column label="物品名称"
align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
<template slot-scope="scope">{{scope.row.goodsName}}</template>
</el-table-column>
<el-table-column label="型号"
align="center">
......@@ -81,23 +81,23 @@
</el-table-column>
<el-table-column label="数量"
align="center">
<template slot-scope="scope">{{scope.row.username}}</template>
<template slot-scope="scope">{{scope.row.outboundNum}}</template>
</el-table-column>
<el-table-column label="申领人"
align="center">
<template slot-scope="scope">{{scope.row.phone || '--'}}</template>
<template slot-scope="scope">{{scope.row.memberName || '--'}}</template>
</el-table-column>
<el-table-column label="所属部门"
align="center">
<template slot-scope="scope">{{scope.row.phone || '--'}}</template>
<template slot-scope="scope">{{scope.row.departmentName || '--'}}</template>
</el-table-column>
<el-table-column label="所属库房"
align="center">
<template slot-scope="scope">{{scope.row.email || '--'}}</template>
<template slot-scope="scope">{{scope.row.stockRoomName || '--'}}</template>
</el-table-column>
<el-table-column label="出库日期"
align="center">
<template slot-scope="scope">{{scope.row.email || '--'}}</template>
<template slot-scope="scope">{{scope.row.createtime | formatTime }}</template>
</el-table-column>
</el-table>
</div>
......@@ -118,7 +118,7 @@
</template>
<script>
import moment from 'moment'
import { getSupplier, getAuditDetail, updateMcht } from '@/api/audit'
import { getOutboundRecordList,getGoodsCategoryList, getAuditDetail, updateMcht } from '@/api/inventory'
// 列表查询参数默认值
const defaultListQuery = {
pageNum: 1,
......@@ -134,14 +134,6 @@ export default {
components: {},
data() {
return {
statusOptions: [ {
label: '启用',
value: 1
},
{
label: '禁用',
value: 0
}],
listQuery: Object.assign({}, defaultListQuery),
list: [],
total: 0,
......@@ -151,6 +143,7 @@ export default {
},
created() {
this.getList()
this.getGoodsCategoryList()
},
filters: {
formatTime(time) {
......@@ -181,12 +174,18 @@ export default {
handleSelectionChange(vals) {
this.multipleSelection = vals
},
// 物品类别
getGoodsCategoryList(){
getGoodsCategoryList().then(res=>{
})
},
//请求数据
getList() {
this.listLoading = true
//请求数据
console.log('listQuery',this.listQuery)
getSupplier(this.listQuery).then(res => {
getOutboundRecordList(this.listQuery).then(res => {
this.listLoading = false
this.list = res.data.list
this.total = res.data.total
......
......@@ -26,10 +26,7 @@
</el-dialog>
</template>
<script>
import { getAttribute, changeAttribute } from '@/api/attribute'
import { fetchAttributeTypeList } from '@/api/attributeType'
import { fetchAttributeGroupList } from '@/api/attributeGroup'
import { addGoodsCategory } from '@/api/inventory'
// 移动属性
export default {
name: 'addCategory',
......@@ -39,51 +36,44 @@ export default {
title: null,
loading: false,
id: null,
model: {
attributeTypeId: null,
attributeGroupId: null
},
typeOptions: [],
groupOptions: []
model: {}
}
},
methods: {
init () {
this.title="新增物品类别"
this.model = {
attributeTypeId: null,
attributeGroupId: null
name: null
}
this.visible= true
this.$nextTick(() => {
this.$refs.attributeForm.clearValidate()
})
},
detail (id) {
this.id = id
add(){
this.id = null
this.title="新增物品类别"
this.init()
this.visible = true
this.title = '移动属性'
this.loading = true
getAttribute(id).then(res => {
this.model = res.data
this.loading = false
}).catch(err => {
this.loading = false
this.close()
})
this.visible= true
},
// detail (id) {
// this.id = id
// this.init()
// this.visible = true
// this.title = '移动属性'
// this.loading = true
// getAttribute(id).then(res => {
// this.model = res.data
// this.loading = false
// }).catch(err => {
// this.loading = false
// this.close()
// })
// },
// 提交保存
submit () {
this.$refs.attributeForm.validate((valid) => {
if (valid) {
// 验证通过
let params = {
id: this.id,
attributeTypeId: this.model.attributeTypeId,
attributeGroupId: this.model.attributeGroupId
}
changeAttribute(params).then(res => {
addGoodsCategory(this.model).then(res => {
this.loading = false
this.visible = false
this.$emit('ok')
......
......@@ -5,7 +5,7 @@
width="500px">
<!-- start -->
<el-form :model="model"
ref="attributeForm"
ref="myForm"
v-loading="loading"
label-width="150px">
<el-form-item label="库房名称:"
......@@ -26,9 +26,7 @@
</el-dialog>
</template>
<script>
import { getAttribute, changeAttribute } from '@/api/attribute'
import { fetchAttributeTypeList } from '@/api/attributeType'
import { fetchAttributeGroupList } from '@/api/attributeGroup'
import { addDepartment} from '@/api/inventory'
// 移动属性
export default {
......@@ -40,8 +38,7 @@ export default {
loading: false,
id: null,
model: {
attributeTypeId: null,
attributeGroupId: null
name: null
},
typeOptions: [],
groupOptions: []
......@@ -49,41 +46,39 @@ export default {
},
methods: {
init () {
this.title="新增库房"
this.model = {
attributeTypeId: null,
attributeGroupId: null
name: null
}
this.visible= true
this.$nextTick(() => {
this.$refs.attributeForm.clearValidate()
this.$refs.myForm.clearValidate()
})
},
detail (id) {
this.id = id
add(){
this.id = null
this.title="新增库房"
this.init()
this.visible = true
this.title = '移动属性'
this.loading = true
getAttribute(id).then(res => {
this.model = res.data
this.loading = false
}).catch(err => {
this.loading = false
this.close()
})
this.visible= true
},
// detail (id) {
// this.id = id
// this.init()
// this.visible = true
// this.title = '移动属性'
// this.loading = true
// getAttribute(id).then(res => {
// this.model = res.data
// this.loading = false
// }).catch(err => {
// this.loading = false
// this.close()
// })
// },
// 提交保存
submit () {
this.$refs.attributeForm.validate((valid) => {
this.$refs.myForm.validate((valid) => {
if (valid) {
// 验证通过
let params = {
id: this.id,
attributeTypeId: this.model.attributeTypeId,
attributeGroupId: this.model.attributeGroupId
}
changeAttribute(params).then(res => {
addDepartment(this.model).then(res => {
this.loading = false
this.visible = false
this.$emit('ok')
......
......@@ -41,20 +41,15 @@
</span> -->
</el-input>
</el-form-item>
<el-row :gutter="20">
<el-col :span="16">
<el-form-item prop="VerificationCode">
       
<el-input type="text" v-model="loginForm.VerificationCode" auto-complete="off"
placeholder="请输入验证码"></el-input>
     
<el-row type="flex" justify="space-between">
<el-col :span="15">
<el-form-item prop="VerificationCode">       
<el-input type="text" v-model="loginForm.authCode" auto-complete="off"
placeholder="请输入验证码"></el-input>     
</el-form-item>
</el-col>
<el-col :span="8">
<div class="ValidCode disabled-select" :style="`width:${width}; height:${height}`" @click="refreshCode"
style="border: 1px solid #DCDFE6;float: right;border-radius: 4px;">
<span v-for="(item, index) in codeList" :key="index" :style="getStyle(item)">{{item.code}}</span>
</div>
<el-col :span="9" v-if="captchaImage" style="text-align: right;" >
<img style="width:100px; padding: 8px;border: 1px solid #DCDFE6;border-radius: 4px;" :src="captchaImage" alt="" @click="refreshCode">
</el-col>
</el-row>
<el-form-item>
......@@ -74,6 +69,7 @@
<script>
import { setSupport, getSupport, setCookie, getCookie } from '@/utils/support'
import {getCaptchaImage} from '@/api/login'
import TopNav from './components/TopNav'
import BottomFooter from './components/BottomFooter'
......@@ -83,20 +79,6 @@ export default {
TopNav,
BottomFooter
},
props: {
width: {
type: String,
default: '80px'
},
height: {
type: String,
default: '38px'
},
length: {
type: Number,
default: 4
}
},
data() {
const validateUsername = (rule, value, callback) => {
if (!value) {
......@@ -112,26 +94,18 @@ export default {
callback()
}
}
const validatePass2 = (rule, value, callback) => {
if (value === '') {
callback(new Error('请输入验证码'))
} else if (value !== this.codeList.map(item => item.code).join('')) {
callback(new Error('请输入正确的验证码!'))
} else {
callback()
}
}
return {
captchaImage: null,
codeList: [],
loginForm: {
username: '',
password: '',
VerificationCode: ''
authCode: '',
},
loginRules: {
username: [{ required: true, trigger: 'blur', validator: validateUsername }],
password: [{ required: true, trigger: 'blur', validator: validatePass }],
VerificationCode: [{ validator: validatePass2, trigger: 'blur' }],
authCode: [{ required: true, trigger: 'blur', message: '验证码不能为空' }],
},
loading: false,
pwdType:
......@@ -147,41 +121,25 @@ export default {
if (password) {
this.loginForm.password = password
}
this.createdCode()
this.getCaptchaImage()
},
methods: {
refreshCode() {
this.createdCode()
},
createdCode() {
let len = this.length,
codeList = [],
chars = 'ABCDEFGHJKMNPQRSTWXYZ0123456789',
charsLen = chars.length
// 生成
for (let i = 0; i < len; i++) {
let rgb = [Math.round(Math.random() * 220), Math.round(Math.random() * 240), Math.round(Math.random() * 200)]
codeList.push({
code: chars.charAt(Math.floor(Math.random() * charsLen)),
color: `rgb(${rgb})`,
fontSize: `1${[Math.floor(Math.random() * 10)]}px`,
padding: `${[Math.floor(Math.random() * 10)]}px`,
transform: `rotate(${Math.floor(Math.random() * 90) - Math.floor(Math.random() * 90)}deg)`
getCaptchaImage() {
// axios.get('/user?ID=12345')
// .then(function (response) {
// console.log(response);
// })
// .catch(function (error) {
// console.log(error);
// });
getCaptchaImage().then(res => {
console.log(res)
this.captchaImage = res.data.url
})
}
// 指向
// this.codeList = codeList
this.codeList.splice(0,this.codeList.length,codeList);
codeList.forEach((item,index)=>{
this.codeList.splice(index,1,item)
})
console.log('this.codeList',this.codeList)
// 将当前数据派发出去
this.$emit('update:value', codeList.map(item => item.code).join(''))
console.log(codeList.map(item => item.code).join(''))
},
getStyle(data) {
return `color: ${data.color}; font-size: ${data.fontSize}; padding: ${data.padding}; transform: ${data.transform}`
refreshCode() {
console.log('re')
this.getCaptchaImage()
},
showPwd() {
if (this.pwdType === 'password') {
......@@ -194,6 +152,7 @@ export default {
this.$refs.loginForm.validate(valid => {
if (valid) {
this.loading = true
console.log('this.loginForm', this.loginForm)
this.$store.dispatch('Login', this.loginForm).then(() => {
this.loading = false
setCookie('username', this.loginForm.username, 15)
......
......@@ -40,26 +40,23 @@
width="50"></el-table-column>
<el-table-column label="供应商名称"
align="center">
<template slot-scope="scope">{{scope.row.name}}</template>
<template slot-scope="scope">{{scope.row.supplierName}}</template>
</el-table-column>
<el-table-column label="联系人"
align="center">
<template slot-scope="scope">{{scope.row.username}}</template>
<template slot-scope="scope">{{scope.row.name}}</template>
</el-table-column>
<el-table-column label="联系方式"
align="center">
<template slot-scope="scope">{{scope.row.phone || '--'}}</template>
<template slot-scope="scope">{{scope.row.tel || '--'}}</template>
</el-table-column>
<el-table-column label="供应物品"
align="center">
<template slot-scope="scope">{{scope.row.email || '--'}}</template>
<template slot-scope="scope">{{scope.row.goodsNum || 0}}</template>
</el-table-column>
<el-table-column label="备注"
align="center">
<template slot-scope="scope">
<router-link class="color-main"
:to="{path: '/pms/product', query: {mchtId: scope.row.id, mchtName: scope.row.name}}">查看商品</router-link>
</template>
<template slot-scope="scope">{{scope.row.remarks}}</template>
</el-table-column>
<el-table-column label="操作"
width="220"
......@@ -67,10 +64,10 @@
<template slot-scope="scope">
<el-button size="mini"
type="primary"
@click="editDetail(scope.row.id)">编辑</el-button>
@click="handleEdit(scope.row.id)">编辑</el-button>
<el-button size="mini"
type="danger"
@click="editDetail(scope.row.id)">删除</el-button>
@click="handleDelete(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
......@@ -96,38 +93,21 @@
</div>
</template>
<script>
import moment from 'moment'
import { getSupplier, getAuditDetail, updateMcht } from '@/api/audit'
import { getSuppliersList, editSupplier } from '@/api/supplier'
import AddSupplier from './modules/AddSupplier'
// 列表查询参数默认值
const defaultListQuery = {
pageNum: 1,
pageSize: 10,
accouuntType: 1,
name: '',
phone: '',
status: ''
name: ''
}
// 账号状态数据
const defaultStatusOptions = [
{
label: '启用',
value: 1
},
{
label: '禁用',
value: 0
}
]
// 供应商入驻账号列表
export default {
name: 'SupplierList',
components: {AddSupplier},
data() {
return {
listQuery: Object.assign({}, defaultListQuery),
statusOptions: defaultStatusOptions,
list: [],
total: 0,
listLoading: false,
......@@ -137,26 +117,7 @@ export default {
created() {
this.getList()
},
filters: {
formatTime(time) {
if (!time) {
return '--'
}
return moment(time).format('YYYY-MM-DD HH:mm:ss')
},
formatStatus(status) {
if (status == 0) {
return '禁用'
} else {
return '启用'
}
}
},
methods: {
// 添加供应商
handleAdd () {
this.$refs.addSupplier.add()
},
handleResetSearch() {
this.listQuery = Object.assign({}, defaultListQuery)
this.getList()
......@@ -181,7 +142,7 @@ export default {
getList() {
this.listLoading = true
//请求数据
getSupplier(this.listQuery).then(res => {
getSuppliersList(this.listQuery).then(res => {
this.listLoading = false
this.list = res.data.list
this.total = res.data.total
......@@ -189,44 +150,25 @@ export default {
this.listLoading = false
})
},
handleStatus(row) {
// 账号禁用
if (row.status == 0) {
this.$confirm('确定启用该账号', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
//启用接口
this.updateMcht(row, 1)
})
} else if (row.status == 1) {
this.$confirm('确定禁用该账号?', '提示', {
// 添加供应商
handleAdd () {
this.$refs.addSupplier.add()
},
// 删除
handleDelete(id) {
this.$confirm('是否删除该供应商?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
//禁用接口
this.updateMcht(row, 0)
})
}
},
//供应商账户启用/禁用
updateMcht(row, status) {
let params = { id: row.id, status: status }
updateMcht(params).then(res => {
this.$message.success(status == 1 ? '启用成功' : '禁用成功')
editSupplier({id: id,deleteStatus: 0 }).then(res=>{
this.getList()
})
},
// 查看
lookDetail(row) {
row.audit = false
row.flag = true
this.$router.push({ name: 'supplier', params: row })
}).catch(() => {
});
},
//编辑
editDetail(id) {
handleEdit(id) {
this.$refs.addSupplier.detail(id)
}
}
......
......@@ -12,35 +12,35 @@
ref="scrollContainer">
<el-form-item label="供应商名称:"
:rules="[{required: true, trigger: 'blur', message: '供应商名称不能为空'}]"
prop="name">
prop="supplierName">
<el-input size="small"
class="input-width"
v-model="model.name"></el-input>
v-model="model.supplierName"></el-input>
</el-form-item>
<el-form-item label="联系人:"
:rules="[{required: true, trigger: 'blur', message: '联系人不能为空'}]"
prop="username">
prop="name">
<el-input size="small"
class="input-width"
v-model="model.username"></el-input>
v-model="model.name"></el-input>
</el-form-item>
<el-form-item label="联系方式:"
:rules="[ {
required: true,
validator: validatePhone,
trigger: 'blur'
}]"
prop="phone">
:rules="[ {required: true,validator: validatePhone, trigger: 'blur'}]"
prop="tel">
<el-input size="small"
class="input-width"
v-model="model.phone"></el-input>
v-model="model.tel"></el-input>
</el-form-item>
<el-form-item label="备注:"
prop="personalizedSignature">
prop="remarks"
:rules="[{required: true, trigger: 'blur', message: '备注不能为空'}]">
<el-input size="small"
type="textarea"
class="input-width"
v-model="model.personalizedSignature"></el-input>
maxlength="32"
show-word-limit
:autosize="{ minRows: 3, maxRows: 6}"
v-model="model.remarks"></el-input>
</el-form-item>
</div>
</el-form>
......@@ -54,8 +54,7 @@
</el-dialog>
</template>
<script>
import { addMember,updateMcht } from '@/api/audit'
import { getSupplierDetail } from '../../../api/audit'
import { addSupplier,getSupplierDetail, editSupplier } from '@/api/supplier'
// 添加编辑属性
export default {
......@@ -84,15 +83,10 @@ export default {
methods: {
init() {
this.model = {
phone: null,
username: null,
supplierName: null,
name: null,
password: null,
accouuntType: 1,
email: null,
payType: null,
cycleType: null,
personalizedSignature: null
remarks: null,
tel: null
}
this.$nextTick(() => {
this.$refs.myForm.clearValidate()
......@@ -127,7 +121,14 @@ export default {
if (this.id) {
// 修改属性
this.loading = true
updateMcht(this.model).then(res => {
let params = {
id: this.model.id,
supplierName: this.model.supplierName,
name: this.model.name,
tel: this.model.tel,
remarks: this.model.remarks
}
editSupplier(params).then(res => {
this.loading = false
this.visible = false
this.$emit('ok')
......@@ -137,7 +138,7 @@ export default {
} else {
// 添加属性
this.loading = true
addMember(this.model).then(res => {
addSupplier(this.model).then(res => {
this.loading = false
this.visible = false
this.$emit('ok')
......@@ -166,8 +167,4 @@ export default {
width: 300px;
}
.tip {
color: #999;
font-size: 12px;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment