556 lines
16 KiB
Vue
556 lines
16 KiB
Vue
<!-- 系统配置 - 权限配置 -->
|
|
<template>
|
|
<div class="page">
|
|
<topBar v-if="topList.length > 0"
|
|
:top-list="topList"
|
|
:moren="moren" />
|
|
<div class="thetopbox">
|
|
<el-form ref="form"
|
|
:model="queryParams"
|
|
label-width="auto">
|
|
<el-row :gutter="20">
|
|
<el-col :span="4">
|
|
<el-form-item label="供应商姓名">
|
|
<el-input v-model="queryParams.nickName"
|
|
clearable />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="4">
|
|
<el-form-item label="供应商编号">
|
|
<el-input v-model="queryParams.userName"
|
|
clearable />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="4">
|
|
<el-form-item label="联系方式">
|
|
<el-input v-model="queryParams.phonenumber"
|
|
clearable />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="4">
|
|
<el-form-item label="启用状态">
|
|
<el-select v-model="queryParams.status"
|
|
clearable>
|
|
<el-option v-for="item,index in smsList"
|
|
:key="index"
|
|
:label="item.name"
|
|
:value="item.id" />
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="4">
|
|
<div class="searchbox">
|
|
<el-button class="my_search"
|
|
style="margin-left: 25px"
|
|
@click="research()"> {{ '搜索' }}</el-button>
|
|
<el-button class="my_reset"
|
|
@click="reChongzhi"> {{ '重置' }}</el-button>
|
|
</div>
|
|
</el-col>
|
|
</el-row>
|
|
</el-form>
|
|
</div>
|
|
<div class="main">
|
|
<div class="maintop">
|
|
<div class="mainbtn">
|
|
<el-button v-has-buttons="['supplyAdminAdd']"
|
|
size="small"
|
|
class="thebtn1"
|
|
@click="addRules">{{'添加'}}</el-button>
|
|
<el-button v-has-buttons="['supplyAdminExport']"
|
|
size="small"
|
|
style="background-color: #FFAD41;margin-left: 10px"
|
|
class="thebtn2"
|
|
@click="handleExport"> {{ '导出' }}</el-button>
|
|
</div>
|
|
</div>
|
|
<div class="maintable">
|
|
<el-table height="680px"
|
|
:data="tableData"
|
|
v-loading="loading"
|
|
style="width: 100%"
|
|
:header-cell-style="{ background: '#EEEEEE' }"
|
|
:row-class-name="tableRowClassName">
|
|
<el-table-column type="selection"
|
|
width="55" />
|
|
<el-table-column align="center"
|
|
prop="nickName"
|
|
label="供应商姓名" />
|
|
<el-table-column align="center"
|
|
prop="userName"
|
|
label="供应商编号" />
|
|
<el-table-column align="center"
|
|
prop="phonenumber"
|
|
label="联系方式" />
|
|
<el-table-column align="center"
|
|
prop="email"
|
|
label="邮箱" />
|
|
<el-table-column align="center"
|
|
prop="statusVal"
|
|
label="启用状态" />
|
|
<el-table-column align="center"
|
|
prop="creationTime"
|
|
label="创建时间" />
|
|
<el-table-column align="center"
|
|
:label="'操作'"
|
|
fixed="right"
|
|
width="200">
|
|
<template slot-scope="scope">
|
|
<el-button v-if="scope.row.status==0"
|
|
v-has-buttons="['supplyAdminQj']"
|
|
style="color: #C73030"
|
|
type="text"
|
|
size="small"
|
|
class="button-s"
|
|
@click="stopRole(scope.row)"> {{'禁用'}} </el-button>
|
|
<el-button v-if="scope.row.status==1"
|
|
v-has-buttons="['supplyAdminQj']"
|
|
style="color: #009B58"
|
|
type="text"
|
|
size="small"
|
|
class="button-s"
|
|
@click="stopRole(scope.row)"> {{'启用'}} </el-button>
|
|
<el-button v-has-buttons="['supplyAdminEdit']"
|
|
class="button-s"
|
|
type="text"
|
|
size="small"
|
|
style="color:#6962F6;"
|
|
@click="updateShow(scope.row)">
|
|
{{ '修改' }}
|
|
</el-button>
|
|
<el-button v-has-buttons="['supplyAdminDel']"
|
|
type="text"
|
|
size="small"
|
|
class="button-s"
|
|
style="color: #c73030"
|
|
@click="delRole(scope.row)">
|
|
{{ '删除' }}
|
|
</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</div>
|
|
</div>
|
|
<el-dialog :title="text"
|
|
:visible.sync="ruleShow"
|
|
width="35%"
|
|
center
|
|
:close-on-click-modal="false"
|
|
:before-close="handleClose"
|
|
:destroy-on-close="true">
|
|
<el-form ref="forms"
|
|
:rules="rules"
|
|
:model="formed"
|
|
label-width="auto">
|
|
<el-row :gutter="20">
|
|
<el-col :span="12">
|
|
<el-form-item label="供应商姓名"
|
|
prop="nickName">
|
|
<el-input v-model="formed.nickName"
|
|
clearable />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="供应商编号"
|
|
prop="userName">
|
|
<el-input v-model="formed.userName"
|
|
clearable />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row :gutter="20">
|
|
<el-col :span="12">
|
|
<el-form-item label="密码"
|
|
prop="password">
|
|
<el-input v-model="formed.password"
|
|
clearable />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="联系方式"
|
|
prop="phonenumber">
|
|
<el-input v-model="formed.phonenumber"
|
|
clearable />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row :gutter="20">
|
|
<el-col :span="12">
|
|
<el-form-item label="邮箱">
|
|
<el-input v-model="formed.email"
|
|
clearable />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="启用状态"
|
|
prop="status">
|
|
<el-select v-model="formed.status"
|
|
clearable>
|
|
<el-option v-for="item,index in smsList"
|
|
:key="index"
|
|
:label="item.name"
|
|
:value="item.id" />
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<div style="padding-top: 10px;display: flex;justify-content: center">
|
|
<el-button type="text"
|
|
size="small"
|
|
class="button-style"
|
|
@click="handleClose"> {{ '取消' }}</el-button>
|
|
<el-button v-preventReClick="3000"
|
|
type="text"
|
|
size="small"
|
|
class="button-style"
|
|
style="margin-left: 40px;background-color: #ed1d25;"
|
|
@click="ruleSubmit()">
|
|
{{ '确认' }}
|
|
</el-button>
|
|
</div>
|
|
</el-form>
|
|
</el-dialog>
|
|
<pagination v-show="total > 0"
|
|
:total="total"
|
|
:page.sync="queryParams.pageNum"
|
|
:limit.sync="queryParams.pageSize"
|
|
@pagination="research" />
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import topBar from '@/components/topBar'
|
|
import * as sys from '@/api/system'
|
|
import { Message } from 'element-ui'
|
|
export default {
|
|
name: 'Qxpz',
|
|
components: {
|
|
topBar,
|
|
},
|
|
data() {
|
|
return {
|
|
rules: {
|
|
nickName: [
|
|
{ required: true, message: this.$t('S_C_70'), trigger: 'blur' },
|
|
],
|
|
userName: [
|
|
{ required: true, message: this.$t('S_C_70'), trigger: 'blur' },
|
|
],
|
|
password: [
|
|
{ required: true, validator: this.passwordPass, trigger: 'blur' },
|
|
],
|
|
phonenumber: [
|
|
{ required: true, message: this.$t('S_C_70'), trigger: 'blur' },
|
|
],
|
|
status: [
|
|
{ required: true, message: this.$t('CK_KS_38'), trigger: 'change' },
|
|
],
|
|
},
|
|
ruleShow: false,
|
|
moren: 'supplyAdmin',
|
|
topList: [
|
|
{
|
|
name: '供应商用户',
|
|
path: 'supplyAdmin',
|
|
},
|
|
],
|
|
formed: {},
|
|
multipleSelection: [],
|
|
queryParams: {
|
|
pageNum: 1,
|
|
pageSize: 50,
|
|
},
|
|
types: 0,
|
|
tableData: [],
|
|
loading:false,
|
|
total: 0,
|
|
text: '',
|
|
statusList: [
|
|
{ name: this.$t('MN_F_T_372'), id: 0 },
|
|
{ name: this.$t('ENU_MACHINE_STATE_3'), id: 1 },
|
|
], // 启用状态
|
|
smsList: [
|
|
{ name: this.$t('MN_F_T_372'), id: 0 },
|
|
{ name: this.$t('ENU_MACHINE_STATE_3'), id: 1 },
|
|
], // 短信启用状态
|
|
authorityList: [
|
|
{ name: '允许', id: 0 },
|
|
{ name: '禁止', id: 1 },
|
|
], // 审核启用状态
|
|
}
|
|
},
|
|
created() {
|
|
this.research()
|
|
},
|
|
methods: {
|
|
passwordPass(rule, value, callback) {
|
|
if (this.types == 1) {
|
|
if (!value) {
|
|
callback(new Error(this.$t('S_C_70')))
|
|
} else {
|
|
callback()
|
|
}
|
|
} else {
|
|
callback()
|
|
}
|
|
},
|
|
/** 导出按钮操作 */
|
|
handleExport() {
|
|
this.$confirm(this.$t('MN_F_T_407'), this.$t('MN_F_T_304'), {
|
|
confirmButtonText: this.$t('w_0035'),
|
|
cancelButtonText: this.$t('ENU_P_TYPE0'),
|
|
type: 'warning',
|
|
}).then((_) => {
|
|
this.download(
|
|
'/system/manage/supplier/export',
|
|
Object.assign({}, this.queryParams),
|
|
`供应商用户${new Date().getTime()}.xlsx`
|
|
)
|
|
})
|
|
},
|
|
stopRole(item) {
|
|
// 停用管理员
|
|
this.$confirm(
|
|
`确认${item.status === 0 ? '禁用' : '启用'}`,
|
|
this.$t('w_0034'),
|
|
{
|
|
confirmButtonText: this.$t('w_0035'),
|
|
cancelButtonText: this.$t('ENU_P_TYPE0'),
|
|
type: 'warning',
|
|
}
|
|
).then(() => {
|
|
sys
|
|
.supplierStatus({
|
|
userId: item.userId,
|
|
status: item.status === 1 ? 0 : 1,
|
|
})
|
|
.then((res) => {
|
|
if (res.code === 200) {
|
|
Message({
|
|
message: res.msg,
|
|
type: 'success',
|
|
})
|
|
this.research()
|
|
} else {
|
|
Message({
|
|
message: res.msg,
|
|
type: 'error',
|
|
})
|
|
}
|
|
})
|
|
})
|
|
},
|
|
// 新增
|
|
addRules() {
|
|
this.types = 1
|
|
this.ruleShow = true
|
|
this.text = this.$t('w_0328')
|
|
},
|
|
// 修改
|
|
updateShow(item) {
|
|
sys.supplierDetials(item.userId).then((res) => {
|
|
if (res.code === 200) {
|
|
this.formed = res.data
|
|
this.types = 2
|
|
this.ruleShow = true
|
|
this.text = this.$t('ENU_CONTROL_TYPE_2')
|
|
}
|
|
})
|
|
},
|
|
// 删除
|
|
delRole(item) {
|
|
this.$confirm(this.$t('MN_F_T_303'), this.$t('w_0034'), {
|
|
confirmButtonText: this.$t('w_0035'),
|
|
cancelButtonText: this.$t('ENU_P_TYPE0'),
|
|
type: 'warning',
|
|
}).then(() => {
|
|
sys.supplierDel(item.userId).then((res) => {
|
|
if (res.code === 200) {
|
|
Message({
|
|
message: this.$t('w_0089'),
|
|
type: 'success',
|
|
})
|
|
this.research()
|
|
} else {
|
|
Message({
|
|
message: res.msg,
|
|
type: 'error',
|
|
})
|
|
}
|
|
})
|
|
})
|
|
},
|
|
// 新增/修改
|
|
ruleSubmit() {
|
|
this.$refs['forms'].validate((valid) => {
|
|
if (valid) {
|
|
let url
|
|
if (this.types == 1) {
|
|
url = sys.supplierAdd
|
|
} else {
|
|
url = sys.supplierEdit
|
|
}
|
|
for (let key in this.formed) {
|
|
if (this.formed[key] == '') {
|
|
delete this.formed[key]
|
|
}
|
|
}
|
|
url(this.formed).then((res) => {
|
|
if (res.code == 200) {
|
|
Message({
|
|
message: res.msg,
|
|
type: 'success',
|
|
})
|
|
this.ruleShow = false
|
|
this.research()
|
|
}
|
|
})
|
|
} else {
|
|
return false
|
|
}
|
|
})
|
|
},
|
|
handleClose() {
|
|
this.ruleShow = false
|
|
this.formed = {}
|
|
},
|
|
research() {
|
|
this.loading = true
|
|
sys.supplierList(this.queryParams).then((res) => {
|
|
this.tableData = res.rows
|
|
this.total = res.total
|
|
this.loading = false
|
|
})
|
|
},
|
|
reChongzhi() {
|
|
this.queryParams = {
|
|
pageNum: 1,
|
|
pageSize: 50,
|
|
}
|
|
this.research()
|
|
},
|
|
tableRowClassName({ row, rowIndex }) {
|
|
if (rowIndex % 2 == 1) {
|
|
return 'warning-row'
|
|
} else if (rowIndex % 2 == 0) {
|
|
return 'success-row'
|
|
}
|
|
return ''
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
<style lang="scss" scoped>
|
|
.thebtn1 {
|
|
background: #3181e5 !important;
|
|
color: #ffffff;
|
|
width: 68px;
|
|
border-color: #3181e5;
|
|
}
|
|
.thebtn2 {
|
|
background: #ffad41;
|
|
color: #ffffff;
|
|
border-color: #ffad41;
|
|
}
|
|
::v-deep .el-input__inner {
|
|
width: 100%;
|
|
}
|
|
::v-deep .el-dialog__title {
|
|
font-weight: bold;
|
|
}
|
|
.button-style {
|
|
width: 209px;
|
|
height: 48px;
|
|
background: #cccccc;
|
|
border-radius: 5px 5px 5px 5px;
|
|
opacity: 1;
|
|
line-height: 48px;
|
|
padding: 0 !important;
|
|
color: #fff;
|
|
font-size: 18px;
|
|
}
|
|
::v-deep .el-dialog__header {
|
|
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
|
}
|
|
.button-s {
|
|
padding: 0 2px !important;
|
|
}
|
|
::v-deep .el-button {
|
|
padding: 10px 20px;
|
|
}
|
|
::v-deep .el-date-editor .el-range__close-icon {
|
|
margin-top: -10px;
|
|
}
|
|
::v-deep .el-date-editor .el-range-separator {
|
|
margin-top: -10px;
|
|
}
|
|
::v-deep .el-date-editor .el-range__icon {
|
|
margin-top: -10px;
|
|
}
|
|
::v-deep .el-input__inner {
|
|
height: 32px;
|
|
line-height: 32px;
|
|
}
|
|
::v-deep .el-form-item {
|
|
margin-bottom: 15px !important;
|
|
}
|
|
::v-deep .el-form-item__label {
|
|
color: #333;
|
|
font-weight: inherit;
|
|
}
|
|
::v-deep .el-row {
|
|
//margin-top: 20px;
|
|
}
|
|
::v-deep .el-table .warning-row {
|
|
background: #f9f9f9;
|
|
}
|
|
|
|
::v-deep .el-table .success-row {
|
|
background: #ffffff;
|
|
}
|
|
::v-deep .el-table thead {
|
|
color: #000000;
|
|
}
|
|
.openClose {
|
|
margin-top: 10px;
|
|
margin-right: 10px;
|
|
color: #666666;
|
|
text-align: center;
|
|
}
|
|
.page {
|
|
padding: 10px 20px;
|
|
background: #f9f9f9;
|
|
font-size: 14px;
|
|
.thetopbox {
|
|
background: #ffffff;
|
|
border-radius: 8px;
|
|
padding-bottom: 10px;
|
|
.searchbox {
|
|
display: flex;
|
|
align-items: center;
|
|
.searchtitle {
|
|
margin-right: 10px;
|
|
}
|
|
.searchbtn {
|
|
background: #08143f;
|
|
color: #ffffff;
|
|
}
|
|
}
|
|
}
|
|
.main {
|
|
.maintop {
|
|
display: flex;
|
|
padding: 0px 0;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
.mainbtn {
|
|
.thebtn1 {
|
|
color: #ffffff;
|
|
background: rgba(67, 145, 253, 1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|