Commit b1794e37 by wangyalan-git

库房修改管理员

parent 4c012d27
...@@ -6,7 +6,7 @@ import { getToken } from '@/utils/auth' ...@@ -6,7 +6,7 @@ import { getToken } from '@/utils/auth'
const service = axios.create({ const service = axios.create({
// baseURL: process.env.BASE_API, // baseURL: process.env.BASE_API,
withCredentials: true, withCredentials: true,
baseURL: 'http://192.168.31.118:8201/mall-admin', baseURL: 'http://192.168.31.112:8201/mall-admin',
// baseURL: 'http://hhg.api.jsonpro.cn:8201/mall-admin', // baseURL: 'http://hhg.api.jsonpro.cn:8201/mall-admin',
timeout: 60000 // 请求超时时间 timeout: 60000 // 请求超时时间
}) })
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
</el-table-column> </el-table-column>
<el-table-column label="管理员" <el-table-column label="管理员"
align="center"> align="center">
<template slot-scope="scope">{{scope.row.username}}</template> <template slot-scope="scope">{{scope.row.adminName || '--'}}</template>
</el-table-column> </el-table-column>
<el-table-column label="创建时间" <el-table-column label="创建时间"
align="center"> align="center">
...@@ -128,6 +128,7 @@ export default { ...@@ -128,6 +128,7 @@ export default {
//请求数据 //请求数据
console.log('listQuery', this.listQuery) console.log('listQuery', this.listQuery)
getStockRooms(this.listQuery).then(res => { getStockRooms(this.listQuery).then(res => {
console.log('res',res)
this.listLoading = false this.listLoading = false
this.list = res.data.list this.list = res.data.list
this.total = res.data.total this.total = res.data.total
......
...@@ -66,6 +66,10 @@ ...@@ -66,6 +66,10 @@
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" <el-button size="mini"
type="success" type="success"
@click="handleUpdate(scope.row)">修改库房
</el-button>
<el-button size="mini"
type="danger"
@click="handleDelete(scope.row)">解绑 @click="handleDelete(scope.row)">解绑
</el-button> </el-button>
</template> </template>
...@@ -85,12 +89,15 @@ ...@@ -85,12 +89,15 @@
</el-pagination> </el-pagination>
</div> </div>
</el-card> </el-card>
<update-depot ref="updateDepot"
@ok="getList"></update-depot>
</div> </div>
</template> </template>
<script> <script>
import moment from 'moment' import moment from 'moment'
import { getMemberList, cancleAdmin } from '@/api/user' import { getMemberList, cancleAdmin } from '@/api/user'
import AddDepot from './modules/AddAdmin' import AddDepot from './modules/AddAdmin'
import UpdateDepot from './modules/UpdateDepot'
// 列表查询参数默认值 // 列表查询参数默认值
const defaultListQuery = { const defaultListQuery = {
pageNum: 1, pageNum: 1,
...@@ -101,7 +108,7 @@ const defaultListQuery = { ...@@ -101,7 +108,7 @@ const defaultListQuery = {
export default { export default {
name: 'AdminList', name: 'AdminList',
components: { AddDepot }, components: { AddDepot,UpdateDepot },
data() { data() {
return { return {
listQuery: Object.assign({}, defaultListQuery), listQuery: Object.assign({}, defaultListQuery),
...@@ -171,6 +178,10 @@ export default { ...@@ -171,6 +178,10 @@ export default {
}) })
}).catch(() => { }).catch(() => {
}) })
},
// 修改库房
handleUpdate(row){
this.$refs.updateDepot.update(row)
} }
} }
} }
......
<template>
<el-dialog :visible.sync="visible"
:title="title"
center
width="720px">
<!-- start -->
<el-form :model="model"
ref="myForm"
v-loading="loading"
label-width="200px">
<div class="scroll-container"
ref="scrollContainer">
<!-- <el-form-item label="域账号:"-->
<!-- prop="username"-->
<!-- :rules="[{ required: true, message: '域账号不能为空', trigger: 'blur' }]">-->
<!-- <el-input v-model="model.username"-->
<!-- :disabled="isEdit"-->
<!-- placeholder="请输入ad域账号"-->
<!-- class="input-width"></el-input>-->
<!--&lt;!&ndash; <div class="tip">可使用手机号作为用户名称</div>&ndash;&gt;-->
<!-- </el-form-item>-->
<!-- <el-form-item label="登录密码:"-->
<!-- prop="password"-->
<!-- :rules="[{ required: true, message: '登录密码不能为空', trigger: 'blur' }]">-->
<!-- <el-input-->
<!-- :maxlength="6"-->
<!-- v-model="model.password"-->
<!-- type="password"-->
<!-- auto-complete="new-password"-->
<!-- class="input-width"></el-input>-->
<!-- </el-form-item>-->
<el-form-item label="库房:"
prop="stockRoomId"
:rules="[{ required: true, trigger: 'change', message: '请选择库房' }]">
<el-select size="small"
class="input-width"
v-model="model.stockRoomId">
<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 label="角色分配:"-->
<!-- prop="roleId"-->
<!-- :rules="[{ required: true, message: '角色不能为空', trigger: 'change' }]">-->
<!-- <el-select v-model="model.roleId"-->
<!-- class="input-width">-->
<!-- <el-option v-for="item in allRoleList"-->
<!-- :key="item.id"-->
<!-- :label="item.name"-->
<!-- :value="item.id"></el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
</div>
</el-form>
<div slot="footer">
<el-button type="primary"
@click="submit">确认
</el-button>
<el-button @click="close">取消</el-button>
</div>
<!-- end -->
</el-dialog>
</template>
<script>
import { updateMember } from '@/api/user'
// import { fetchAllRoleList } from '@/api/role'
import { getStockRooms } from '@/api/inventory'
// 添加编辑属性
export default {
name: 'AddAdmin',
data() {
return {
allRoleList: [],
depotOptions: [],
visible: false,
title: null,
loading: false,
id: null,
model: {},
isEdit: false
}
},
methods: {
// 库房
getStockRooms() {
getStockRooms({status: 1}).then(res => {
this.depotOptions = res.data.list
})
},
// 角色分配
fetchAllRoleList() {
fetchAllRoleList().then(response => {
this.allRoleList = response.data
})
},
init() {
// this.fetchAllRoleList()
this.getStockRooms()
this.$nextTick(() => {
this.$refs.myForm.clearValidate()
this.$refs.scrollContainer.scrollTop = 0
})
},
add(row) {
this.id = null
this.visible = true
this.init()
this.model = {
departId: row.departId,
roleId: null,
stockRoomId: null,
password: null,
username: null,
id: row.id,
memberId: row.id
}
this.title = '设置管理员'
},
update(row) {
this.id = row.id
this.visible = true
this.init()
this.model = {
stockRoomId: row.stockRoomId,
id: row.id
}
this.title = '修改库房'
},
// detail(id) {
// this.id = id
// this.init()
// this.visible = true
// this.title = '编辑管理员'
// this.loading = true
// getSupplierDetail({ id: id }).then(res => {
// this.model = res.data
// this.loading = false
// }).catch(err => {
// this.loading = false
// this.close()
// })
// },
// 提交保存
submit() {
this.$refs.myForm.validate((valid) => {
if (valid) {
// 验证通过
// if (this.id) {
// // 修改属性
// this.loading = true
// updateMcht(this.model).then(res => {
// this.loading = false
// this.visible = false
// this.$emit('ok')
// }).catch(err => {
// this.loading = false
// })
// } else {
// 添加属性
this.loading = true
updateMember(this.model).then(res => {
this.loading = false
this.visible = false
this.$emit('ok')
}).catch(err => {
this.loading = false
})
// }
}
})
},
close() {
this.$emit('close')
this.visible = false
}
}
}
</script>
<style scoped>
.scroll-container {
max-height: 50vh;
overflow: hidden;
overflow-y: auto;
}
.input-width {
width: 300px;
}
.tip {
color: #999;
font-size: 10px;
line-height: 30px;
}
</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