Commit 3a2a3472 by linjinhong

新增服务管理页面

parent d6f417bc
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
"dom", "dom",
"dom.iterable", "dom.iterable",
"scripthost" "scripthost"
] ],
"noUnusedLocals": false,
"noUnusedParameters": false
} }
} }
<script>
export default {
name: 'CustomForm',
components: {},
props: {
formConfig: {
type: Array,
default: () => []
},
isCustomButton: {
type: Boolean,
default: true
},
isFlex: {
type: Boolean,
default: true
},
formLabelWidth: {
type: String,
default: '50px'
},
formItemWidth: {
type: String,
default: null
},
value: {
type: Object,
default: () => {}
}
},
computed: {},
watch: {
value: {
handler(newValue, oldValue) {
if (Object.keys(newValue).length !== 0) {
this.formData = newValue
} else {
this.initFormData()
}
},
immediate: true,
deep: true
},
formData: {
handler(newValue) {
this.$emit('input', newValue)
},
immediate: true,
deep: true
}
},
data() {
return {
loading: false,
formData: {},
formColumns: []
}
},
methods: {
search() {
this.$emit('searchFn', this.formData)
},
addDialog(obj) {
this.$emit('addDialog')
},
handleSubmit(event) {
event.preventDefault()
},
showToggle() {
this.loading = !this.loading
},
validateForm() {
return this.$refs.form.validate()
},
initFormData() {
this.formConfig.forEach((el) => {
switch (el.type) {
case 'input':
this.$set(this.formData, el.prop, '')
break
case 'select':
case 'radio':
this.$set(this.formData, el.prop, el.defaultValue || '')
break
default:
// 如果有其他类型,可以在这里添加处理逻辑
this.$set(this.formData, el.prop, '')
}
})
},
async resetFields() {
await this.$refs.form?.resetFields()
}
},
created() {
// console.log(104, this.formData)
},
render() {
return (
<el-form
class={this.isFlex ? 'formClass' : ''}
ref="form"
props={{
model: this.formData
}}
size="mini"
inline
onSubmit={this.handleSubmit}
onKeyupenterCapture={this.search}>
{this.formConfig?.map((item, index) => (
<el-form-item
style={{
width: item.type === 'textarea' ? '100%' : this.formItemWidth
}}
class={item.type === 'textarea' ? 'textClass' : ''}
prop={item.prop}
rules={(item.renderRules && item.renderRules(this.formData)) || []}
label-width={item.labelWidth || this.formLabelWidth}
key={index}
label={item.name}>
{item.type === 'input' && (
<el-input
v-model={this.formData[item.prop]}
placeholder={item.placeholder || `请输入${item.name}`}
clearable></el-input>
)}
{item.type === 'textarea' && (
<el-input
type="textarea"
v-model={this.formData[item.prop]}
placeholder={item.placeholder || `请输入${item.name}`}
clearable></el-input>
)}
{item.type === 'select' && (
<el-select
v-model={this.formData[item.prop]}
placeholder={item.placeholder || `请选择${item.name}`}
clearable>
{item.options?.map((el, idx) => (
<el-option
label={el.label}
value={el.value}
key={idx}></el-option>
))}
</el-select>
)}
{item.type === 'datePicker' && (
<el-date-picker
value-format="yyyy-MM-dd"
type={item.dateType || 'date'}
placeholder="选择日期"
v-model={this.formData[item.prop]}
clearable
style="width: 100%;"></el-date-picker>
)}
{item.type === 'radio' &&
item.radioOptions?.map((el, idx) => (
<el-radio
v-model={this.formData[item.prop]}
label={el.value}
key={idx}>
{el.label}
</el-radio>
))}
</el-form-item>
))}
{this.isCustomButton && (
<el-form-item>
<el-button
type="primary"
onClick={this.search}
icon="el-icon-search">
查询
</el-button>
<el-button type="success" onClick={this.addDialog}>
新增
</el-button>
</el-form-item>
)}
{!this.isCustomButton && <slot name="btn"></slot>}
</el-form>
)
}
}
</script>
<style lang="less" scoped>
.formClass {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
.el-form-item {
margin-right: 0;
}
}
.textClass {
display: flex;
::v-deep.el-form-item {
.el-form-item__content {
width: 100%;
flex: 1;
}
}
}
</style>
<script>
export default {
name: 'queryForm',
components: {},
props: {
formConfig: {
type: Array,
default: () => []
},
isCustomButton: {
type: Boolean,
default: true
}
},
computed: {
formColumns() {
return [...this.formConfig]
}
},
watch: {},
data() {
return {
loading: false,
formData: {}
}
},
methods: {
search() {
console.log(25, this.formData)
// this.$emit('search', this.formData)
},
addDialog(obj) {
this.$emit('addDialog')
},
handleSubmit(event) {
event.preventDefault()
},
showToggle() {
this.loading = !this.loading
}
},
render() {
// const { btnSlot } = this.$slots
return (
<el-form
ref="form"
props={{
model: this.formData
}}
size="mini"
inline
onSubmit={this.handleSubmit}
onKeyupenterCapture={this.search}>
{this.formColumns?.map((item, index) => (
<el-form-item key={index} label={item.name}>
{item.type === 'input' && (
<el-input
v-model={this.formData[item.prop]}
placeholder={item.placeholder || '请输入'}
clearable></el-input>
)}
{item.type === 'select' && (
<el-select
v-model={this.formData[item.prop]}
placeholder={item.placeholder || '请选择'}
clearable>
{item.options?.map((el, idx) => (
<el-option label={el} value={el} key={idx}>
{el}
</el-option>
))}
</el-select>
)}
{item.type === 'datePicker' && (
<el-date-picker
value-format="yyyy-MM-dd"
type={item.dateType || 'date'}
placeholder="选择日期"
v-model={this.formData[item.prop]}
clearable
style="width: 100%;"></el-date-picker>
)}
</el-form-item>
))}
{this.isCustomButton && (
<el-form-item>
<el-button
type="primary"
onClick={this.search}
icon="el-icon-search">
查询
</el-button>
<el-button type="success" onClick={this.addDialog}>
新增
</el-button>
</el-form-item>
)}
{!this.isCustomButton}
</el-form>
)
}
}
</script>
<style scoped></style>
...@@ -5,15 +5,13 @@ ...@@ -5,15 +5,13 @@
style="border-bottom: 1px solid #ccc" style="border-bottom: 1px solid #ccc"
:editor="editor" :editor="editor"
:defaultConfig="toolbarConfig" :defaultConfig="toolbarConfig"
:mode="mode" :mode="mode" />
/>
<Editor <Editor
style="height: 300px; overflow-y: hidden" style="height: 300px; overflow-y: hidden"
v-model="html" v-model="html"
:defaultConfig="editorConfig" :defaultConfig="editorConfig"
:mode="mode" :mode="mode"
@onCreated="onCreated" @onCreated="onCreated" />
/>
</div> </div>
</template> </template>
<script> <script>
...@@ -27,32 +25,32 @@ export default { ...@@ -27,32 +25,32 @@ export default {
data() { data() {
return { return {
editor: null, editor: null,
mode: 'default', mode: 'default'
} }
}, },
model: { model: {
prop: 'content', prop: 'content',
event: 'change', event: 'change'
}, },
props: { props: {
content: { content: {
type: String, type: String,
default: '', default: ''
}, },
placeholder: { placeholder: {
type: String, type: String,
default: '', default: ''
}, },
isInsert: { isInsert: {
type: Boolean, type: Boolean,
default: false, default: false
}, },
insertData: { insertData: {
type: Array, type: Array,
default: () => [ default: () => [
{ {
label: '客户名称', label: '客户名称',
value: '{payerName} {payerSurname}', value: '{payerName} {payerSurname}'
}, },
{ label: '订单编号', value: '{id}' }, { label: '订单编号', value: '{id}' },
{ label: '店铺单号', value: '{shopNumber}' }, { label: '店铺单号', value: '{shopNumber}' },
...@@ -61,9 +59,9 @@ export default { ...@@ -61,9 +59,9 @@ export default {
{ label: '发货时间', value: '{shipmentTime}' }, { label: '发货时间', value: '{shipmentTime}' },
{ label: '妥投时间', value: '{properTime}' }, { label: '妥投时间', value: '{properTime}' },
{ label: '商品', value: '{products}' }, { label: '商品', value: '{products}' },
{ label: '收货地址', value: '{address}' }, { label: '收货地址', value: '{address}' }
], ]
}, }
}, },
computed: { computed: {
...@@ -73,12 +71,12 @@ export default { ...@@ -73,12 +71,12 @@ export default {
}, },
set(value) { set(value) {
this.$emit('change', value) this.$emit('change', value)
}, }
}, },
toolbarConfig() { toolbarConfig() {
return { return {
excludeKeys: ['group-video'], excludeKeys: ['group-video'],
insertKeys: insertKeys(this.isInsert), insertKeys: insertKeys(this.isInsert)
} }
}, },
editorConfig() { editorConfig() {
...@@ -87,34 +85,28 @@ export default { ...@@ -87,34 +85,28 @@ export default {
placeholder: this.placeholder || '请输入内容...', placeholder: this.placeholder || '请输入内容...',
MENU_CONF: { MENU_CONF: {
uploadImage: { uploadImage: {
allowedFileTypes: [ allowedFileTypes: ['jpg', 'jpeg', 'png', 'gif', 'bmp'],
'jpg',
'jpeg',
'png',
'gif',
'bmp',
],
async customUpload(files, insertFn) { async customUpload(files, insertFn) {
// JS 语法 // JS 语法
// res 即服务端的返回结果 // res 即服务端的返回结果
const res = await uploadImg(files, { const res = await uploadImg(files, {
url: 'upload/oss', url: 'upload/oss',
businessType: 'other', businessType: 'other'
}) })
console.log(res) console.log(res)
const { filePath } = res const { filePath } = res
const url = _this.setimgUrl(filePath, { const url = _this.setimgUrl(filePath, {
w: 640, w: 640
}) })
// 从 res 中找到 url alt href ,然后插入图片 // 从 res 中找到 url alt href ,然后插入图片
insertFn(url) insertFn(url)
}, }
}, },
insertSelect: { options: this.insertData }, insertSelect: { options: this.insertData }
}, }
} }
}, }
}, },
watch: {}, watch: {},
methods: { methods: {
...@@ -122,7 +114,7 @@ export default { ...@@ -122,7 +114,7 @@ export default {
this.editor = Object.seal(editor) // 一定要用 Object.seal() ,否则会报错 this.editor = Object.seal(editor) // 一定要用 Object.seal() ,否则会报错
console.log(editor.getConfig()) console.log(editor.getConfig())
this.editor.getAllMenuKeys() this.editor.getAllMenuKeys()
}, }
}, },
mounted() { mounted() {
// 模拟 ajax 请求,异步渲染编辑器 // 模拟 ajax 请求,异步渲染编辑器
...@@ -131,7 +123,7 @@ export default { ...@@ -131,7 +123,7 @@ export default {
const editor = this.editor const editor = this.editor
if (editor == null) return if (editor == null) return
editor.destroy() // 组件销毁时,及时销毁编辑器 editor.destroy() // 组件销毁时,及时销毁编辑器
}, }
} }
</script> </script>
<style scoped> <style scoped>
......
...@@ -76,7 +76,7 @@ const routes = [ ...@@ -76,7 +76,7 @@ const routes = [
path: '/saas/services', path: '/saas/services',
component: () => import('@/views/system/services.vue'), component: () => import('@/views/system/services.vue'),
name: 'system_services', name: 'system_services',
meta: { title: '系统服务' } meta: { title: '服务管理' }
}, },
{ {
path: '/saas/countryCode', path: '/saas/countryCode',
......
...@@ -271,7 +271,7 @@ export default { ...@@ -271,7 +271,7 @@ export default {
{ {
id: 5, id: 5,
path: '', path: '',
label: '系统服务', label: '服务管理',
icon: 'el-icon-s-order', icon: 'el-icon-s-order',
index: '/saas/services', index: '/saas/services',
children: [] children: []
......
<template> <template>
<div class="wraper"> <div class="wraper">
<QueryForm :formConfig="queryformConfig" @addDialog="addDialog"></QueryForm> <CustomForm
:formConfig="queryformConfig"
v-model="queryFormData"
@addDialog="addDialog"
@searchFn="search"
:isFlex="false"></CustomForm>
<div class="table_wrap" v-loading="loading"> <div class="table_wrap" v-loading="loading">
<table-vue <table-vue
:sourceData="sourceData" :sourceData="sourceData"
ref="multipleTable" ref="multipleTable"
:tableColumns="usersTableColumns" :tableColumns="usersTableColumns"
@currentChange="currentTabFn" @currentChange="currentTabFn"
:rowClassName="cellClass"
@selectionChange="selectionChange"></table-vue> @selectionChange="selectionChange"></table-vue>
</div> </div>
<div class="pagination"> <div class="pagination">
<el-pagination <el-pagination
layout="sizes, total, prev, pager, next, jumper" layout="sizes, total, prev, pager, next, jumper"
background background
:total="total" :total="paginationOptions.total"
:page-size="pageSize" :page-size="paginationOptions.pageSize"
:current-page="currentPage" :current-page="paginationOptions.currentPage"
@size-change="sizeChange" @size-change="sizeChange"
@current-change="onCurrentChange"></el-pagination> @current-change="onCurrentChange"></el-pagination>
</div> </div>
...@@ -26,40 +30,15 @@ ...@@ -26,40 +30,15 @@
:close-on-click-modal="false" :close-on-click-modal="false"
:title="is_title == 1 ? '新增' : '编辑'" :title="is_title == 1 ? '新增' : '编辑'"
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
@closed="closedFn"
width="590px"> width="590px">
<el-form <CustomForm
label-position="right" formItemWidth="50%"
label-width="100px" ref="formRefs"
size="mini" v-model="formData"
:inline="true" :formConfig="editformConfig"
:model="addcurrencyform" :isCustomButton="false"
:rules="addrules" formLabelWidth="100px"></CustomForm>
ref="addcurrencyform">
<el-form-item label="登录账号" prop="account" required>
<el-input
style="width: 164px"
v-model="addcurrencyform.account"
placeholder="请输入登录账号"
maxlength="30"></el-input>
</el-form-item>
<el-form-item label="姓名" prop="" required>
<el-input
style="width: 164px"
v-model="addcurrencyform.realName"
placeholder="请输入姓名"
maxlength="30"></el-input>
</el-form-item>
<el-form-item label="是否启用" prop="enable">
<div style="width: 164px" placeholder="请选择">
<el-radio :label="true" v-model="addcurrencyform.enable">
</el-radio>
<el-radio :label="false" v-model="addcurrencyform.enable">
</el-radio>
</div>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button <el-button
@click="dialogVisible = false" @click="dialogVisible = false"
...@@ -69,7 +48,7 @@ ...@@ -69,7 +48,7 @@
</el-button> </el-button>
<el-button <el-button
type="primary" type="primary"
@click="addUser()" @click="addServiceManagement"
size="mini" size="mini"
style="width: 100px"> style="width: 100px">
确认 确认
...@@ -80,158 +59,204 @@ ...@@ -80,158 +59,204 @@
</template> </template>
<script> <script>
import axios from '../../common/api/axios' import axios from '../../common/api/axios'
import QueryForm from '@/common/components/base/queryForm.vue' import CustomForm from '@/common/components/base/CustomForm.vue'
import { mapState } from 'vuex' import { mapState } from 'vuex'
import tableVue from '@/common/components/base/tableView.vue' import tableVue from '@/common/components/base/tableView.vue'
export default { export default {
name: 'system_users', name: 'system_users',
components: { components: {
tableVue, tableVue,
QueryForm CustomForm
}, },
data() { data() {
const validatePass = (rule, value, callback) => {
if (this.is_title === 1 && value === '') {
callback(new Error('请输入密码'))
} else {
callback()
}
}
const confirmPass = (rule, value, callback) => {
if (this.is_title === 1 && value === '') {
callback(new Error('确认密码不能为空'))
} else if (
this.is_title === 1 &&
value !== this.addcurrencyform.password
) {
callback(new Error('2次输入的密码不一致'))
} else {
callback()
}
}
return { return {
is_title: 1, is_title: 1,
ishowForm: false,
select: '', select: '',
sourceData: [], sourceData: [],
searchForm: { formData: {},
employeeName: '', queryFormData: {},
enable: true,
platform: ''
},
queryformConfig: [ queryformConfig: [
{ prop: 'activityName', type: 'input', name: '名称' }, { prop: 'name', type: 'input', name: '名称' },
{ {
prop: 'region', prop: 'enable',
type: 'select', type: 'select',
options: ['区域1', '区域2'], name: '状态',
name: '区域' options: [
{ label: '启用', value: true },
{ label: '停用', value: false }
]
}
],
editformConfig: [
{
prop: 'name',
type: 'input',
name: '名称',
renderRules: (item) => [
{
required: true,
message: '请输入名称',
trigger: 'blur'
}
]
}, },
{ prop: 'date', type: 'datePicker', name: '日期' } {
prop: 'type',
type: 'select',
name: '服务类型',
options: [
{ label: '基础', value: 'basics' },
{ label: '增值', value: 'appreciation' }
],
renderRules: (item) => [
{
required: true,
message: '请选择服务类型',
trigger: 'change'
}
]
},
{
prop: 'tollCollectionManner',
type: 'select',
name: '收费方式',
options: [
{ label: '按单', value: 'order' },
{ label: '按月', value: 'monthly' },
{ label: '免费', value: '免费' }
],
renderRules: (item) => [
{
required: true,
message: '请选择收费方式',
trigger: 'change'
}
]
},
{
prop: 'rates',
type: 'input',
name: '收费标准',
renderRules: (item) => [
{
required: item.tollCollectionManner !== '免费',
message: '请输入收费标准',
trigger: 'blur'
}
]
},
{
prop: 'enable',
type: 'radio',
name: '服务启用状态',
defaultValue: true,
radioOptions: [
{ label: '启用', value: true },
{ label: '停用', value: false }
]
},
{
prop: 'discount',
type: 'radio',
name: '参与折扣',
defaultValue: true,
radioOptions: [
{ label: '是', value: true },
{ label: '否', value: false }
]
},
{
prop: 'remarks',
type: 'textarea',
name: '备注'
}
], ],
dialogVisible: false, dialogVisible: false,
addcurrencyform: {
id: '',
loginName: '',
password: '',
confirmpwd: '',
remark: '',
enable: true,
employeeId: '',
roleId: '',
funcRoleIds: [],
platform: ''
},
addcurrencyform2: null,
formId: null, formId: null,
addrules: {
password: [{ validator: validatePass, trigger: 'blur' }],
confirmpwd: [{ validator: confirmPass, trigger: 'blur' }],
loginName: [
{
required: true,
message: '请输入登录账号',
trigger: 'blur'
}
],
employeeName: [
{
required: true,
message: '请选择员工',
trigger: 'change'
}
],
roleId: [
{
required: true,
message: '请选择角色',
trigger: 'change'
}
]
},
roleList: [],
paginationOptions: { paginationOptions: {
pageSize: 100, pageSize: 100,
currentPage: 1, currentPage: 1,
total: 0 total: 0
}, },
details: [], details: [],
roleOptions: [],
platforms: [],
total: 0,
pageSize: 100,
currentPage: 1,
loading: false loading: false
} }
}, },
created() { created() {
this.getList(1) this.getList()
this.addcurrencyform2 = JSON.parse(JSON.stringify(this.addcurrencyform))
// axios.get('sysRole/role_option')
// .then((res) => {
// if (res.code === 200) {
// this.roleOptions = res.data
// }
// })
// .catch((err) => {
// console.log(err)
// })
// axios.get('sysRole/all_list').then((res) => {
// this.roleList = res.data
// })
// axios.get('platform/user/employeePlatformList')
// .then((res) => {
// this.platforms = res.data
// })
// .catch((err) => {
// console.log(err)
// })
}, },
computed: { computed: {
...mapState(['reqMenu', 'employee']), ...mapState(['reqMenu', 'employee']),
usersTableColumns() { usersTableColumns() {
return [ return [
{ {
label: '登录账户', label: '服务名称',
key: 'account', key: 'name',
width: ''
},
{
label: '服务类型',
key: 'type',
width: '',
render: (item) => (
<span>{item.type === 'basics' ? '基础' : '增值'}</span>
)
},
{
label: '收费方式',
key: 'tollCollectionManner',
width: '', width: '',
align: 'left',
render: (item) => ( render: (item) => (
<span> <span>
<i {item.tollCollectionManner === 'order'
class="circle" ? '按单'
style={{ : item.tollCollectionManner === 'monthly'
backgroundColor: item.enable ? 'green' : 'red' ? '按月'
}}></i> : '免费'}
{item.account}
</span> </span>
) )
}, },
{ {
label: '姓名', label: '收费标准',
key: 'realName', key: 'rates',
width: '' width: ''
}, },
{ {
label: '状态',
key: 'enable',
width: '100',
render: (item) => (
<span>{item.enable === true ? '启用' : '停用'}</span>
)
},
{
label: '创建时间',
key: 'createTime',
width: ''
},
{
label: '更新时间',
key: 'updateTime',
width: ''
},
{
label: '是否参与折扣',
key: 'discount',
width: '100',
render: (item) => <span>{item.discount === true ? '是' : '否'}</span>
},
{
label: '备注',
key: 'remarks',
width: '250'
},
{
label: '相关操作', label: '相关操作',
key: '', key: '',
fixed: 'right', fixed: 'right',
...@@ -242,19 +267,14 @@ export default { ...@@ -242,19 +267,14 @@ export default {
<i <i
class="el-icon-edit-outline" class="el-icon-edit-outline"
style="color:#E6A23C" style="color:#E6A23C"
onClick={(e) => this.addDialog(2, item, e)}></i> onClick={(e) => this.addDialog(item.id, e)}></i>
</span>
<span title="重置密码" class="icon-view ">
<i
style="color:#67C23A"
class="el-icon-refresh-left"
onClick={(e) => this.resetPwd(e, item)}></i>
</span> </span>
<span title="删除" class="icon-view "> <span title="删除" class="icon-view ">
<i <i
style="color:#F56C6C" style="color:#F56C6C"
class="el-icon-delete" class="el-icon-delete"
onClick={(e) => this.deleteSection(item)}></i> onClick={(e) => this.deleteSection(item, e)}></i>
</span> </span>
</div> </div>
) )
...@@ -275,81 +295,30 @@ export default { ...@@ -275,81 +295,30 @@ export default {
return [] return []
} }
}, },
watch: {
formData: {
handler(newValue) {
// console.log(368, newValue)
},
immediate: true,
deep: true
}
},
methods: { methods: {
onCurrentChange() {}, sizeChange(value) {
sizeChange() {}, this.paginationOptions.pageSize = value
spentChange(v, item) { this.getList()
axios
.post('platform/user/update', {
...item,
cost: v
})
.then(() => {
this.getList()
})
}, },
cellClass({ row }) { onCurrentChange(value) {
if (row.authAuditFlag === 1) { this.paginationOptions.currentPage = value
return 'first' this.getList()
} else {
return ''
}
}, },
selectionChange(selection) { selectionChange(selection) {
if (selection.length > 0) { if (selection.length > 0) {
this.select = selection this.select = selection
} }
}, },
authorization(item, e) {
e && e.stopPropagation()
},
authorizationDel(item, e) {
e && e.stopPropagation()
this.$confirm('确定删除选中的信息?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {})
.catch(() => {})
},
resetPwd(e, row) {
e && e.stopPropagation()
this.$confirm('确认要重置密码?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
axios.post('platform/user/resetPassword/' + row.id).then((res) => {
this.$alert('重置成功\n\r 新密码为:' + res.data.passWord)
})
})
.catch(() => {})
},
enableChange(val, row) {
axios
.post('platform/user/setEnableStatus', {
enable: val,
userId: row.id
})
.then((res) => {
this.$message.success(res.message)
this.getList()
})
},
bindChange(row) {
axios
.post('platform/user/setBindingStatus', {
bindStatus: !row.bindStatus,
userId: row.id
})
.then((res) => {
this.$message.success(res.message)
this.getList()
})
},
setempNo(id) { setempNo(id) {
for (const iterator of this.employee) { for (const iterator of this.employee) {
if (iterator.id === id) { if (iterator.id === id) {
...@@ -358,11 +327,8 @@ export default { ...@@ -358,11 +327,8 @@ export default {
} }
} }
}, },
search(value) { search() {
console.log(409, value) this.getList()
/* this.currentPage = 1
this.getList(1) */
}, },
currentTabFn(val) { currentTabFn(val) {
if (val.row) { if (val.row) {
...@@ -370,74 +336,90 @@ export default { ...@@ -370,74 +336,90 @@ export default {
} }
}, },
// 修改新增 // 修改新增
async addDialog(i, v = null, e) { async addDialog(id, e) {
e && e.stopPropagation() e && e.stopPropagation()
if (i === 2) { this.ishowForm = true
if (v) this.formId = v.id try {
if (!this.formId) { if (id) {
return this.$message('请勾选至少一条记录') this.is_title = 2
} const url = '/serviceManagement/get'
axios const res = await axios.get(url, { params: { id } })
.get('platform/user/get', {
params: {
id: v.id
}
})
.then((res) => {
const funcRoleIds = []
const dataRoleIds = []
if (res.data.roleIds) {
const roleIds = res?.data?.roleIds.split(',') || []
for (const iterator of roleIds) {
const item = this.roleList.find((item) => item.id === iterator)
if (item) {
if (item.type === 'FUNCTION_ROLE') {
funcRoleIds.push(Number(iterator))
} else {
dataRoleIds.push(Number(iterator))
}
}
}
}
this.addcurrencyform = { this.formData = { ...res.data }
...res.data, } else {
funcRoleIds, this.is_title = 1
dataRoleIds }
}
this.dialogVisible = true
})
} else {
this.addcurrencyform = JSON.parse(JSON.stringify(this.addcurrencyform2))
this.dialogVisible = true this.dialogVisible = true
} } catch (error) {}
this.is_title = i
this.$nextTick(() => {
this.$refs.addcurrencyform && this.$refs.addcurrencyform.clearValidate()
})
}, },
addUser() { async checkData() {
if (this.is_title === 1) { const [isValid, postData] = await Promise.all([
this.addSection() new Promise((resolve) => {
} else { this.$refs.formRefs
this.upSection() .validateForm()
} .then((res) => resolve(true))
.catch((err) => {
resolve(false)
console.log(err)
})
}),
new Promise((resolve) => {
const params = {
name: '',
id: '',
type: '',
tollCollectionManner: '',
rates: '',
enable: '',
discount: '',
remarks: ''
}
for (const key in params) {
params[key] = this.formData[key]
}
resolve(params)
})
])
console.log(isValid, postData)
return { isValid, postData }
}, },
setpaginationOptions(opt) {
for (const key in opt) { // 新增
this.paginationOptions[key] = opt[key] async addServiceManagement() {
const isAdd = this.is_title === 1
const url = isAdd ? '/serviceManagement/add' : '/serviceManagement/update'
try {
const { isValid, postData } = await this.checkData()
if (isValid) {
console.log('add', this.formData)
const finalData = isAdd ? { ...postData, id: undefined } : postData
const res = await axios.post(url, finalData)
if (res.code !== 200) {
this.$alert(res.message, '错误提示', {
dangerouslyUseHTMLString: true
})
}
this.dialogVisible = false
this.getList()
this.$message.success(isAdd ? '新增成功' : '更新成功')
} else {
console.log()
}
} catch (error) {
console.log(error)
} }
this.getList()
}, },
// 查询 // 查询
getList() { getList() {
this.loading = true this.loading = true
const { pageSize, currentPage } = this.paginationOptions const { pageSize, currentPage } = this.paginationOptions
axios axios
.post('platform/user/list_page', { .post('serviceManagement/list_page', {
pageSize, pageSize,
currentPage, currentPage,
...this.searchForm ...this.queryFormData
}) })
.then((res) => { .then((res) => {
this.loading = false this.loading = false
...@@ -452,76 +434,10 @@ export default { ...@@ -452,76 +434,10 @@ export default {
}) })
}, },
// 修改
upSection() {
const url = 'platform/user/update'
this.$refs.addcurrencyform.validate((valid) => {
if (valid) {
const data = JSON.parse(JSON.stringify(this.addcurrencyform))
let roleIds = this.addcurrencyform.funcRoleIds.concat(
this.addcurrencyform.dataRoleIds
)
roleIds = roleIds.join()
data.roleIds = roleIds
axios.post(url, data).then((res) => {
if (res.code === 200) {
this.dialogVisible = false
this.$message({
message: '修改成功',
type: 'success'
})
this.getList(this.currentPage)
} else {
this.$alert(res.message, '错误提示', {
dangerouslyUseHTMLString: true
})
}
})
}
})
},
// 新增
addSection() {
const url = 'platform/user/add'
this.$refs.addcurrencyform.validate((valid) => {
if (valid) {
const data = JSON.parse(JSON.stringify(this.addcurrencyform))
let roleIds = this.addcurrencyform.funcRoleIds.concat(
this.addcurrencyform.dataRoleIds
)
roleIds = roleIds.join()
data.roleIds = roleIds
axios.post(url, data).then((res) => {
if (res.code === 200) {
this.dialogVisible = false
this.$alert(
'添加成功\n\r 用户密码为:' + res.data?.passWord || ''
)
this.getList(this.currentPage)
} else {
this.$alert(res.message, '错误提示', {
dangerouslyUseHTMLString: true
})
}
})
}
})
},
// 删除 // 删除
deleteSection(v) { deleteSection(data, e) {
let arr = [] e && e.stopPropagation()
if (v) arr.push(v) const ids = [data.id].join()
else arr = this.select
const leng = arr.length
if (leng === 0) {
return this.$message('请勾选至少一条记录')
}
let ids = []
ids = arr.map((v) => {
return v.id
})
ids = ids.join()
this.$confirm('确定删除选中的信息?', '提示', { this.$confirm('确定删除选中的信息?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
...@@ -529,9 +445,9 @@ export default { ...@@ -529,9 +445,9 @@ export default {
}) })
.then(() => { .then(() => {
axios axios
.get('platform/user/delete', { .get('serviceManagement/delete', {
params: { params: {
ids: ids ids
} }
}) })
.then((res) => { .then((res) => {
...@@ -540,7 +456,7 @@ export default { ...@@ -540,7 +456,7 @@ export default {
type: 'success', type: 'success',
message: '删除成功!' message: '删除成功!'
}) })
this.getList(this.currentPage) this.getList()
} else { } else {
this.$alert(res.message, '错误提示', { this.$alert(res.message, '错误提示', {
dangerouslyUseHTMLString: true dangerouslyUseHTMLString: true
...@@ -549,6 +465,12 @@ export default { ...@@ -549,6 +465,12 @@ export default {
}) })
}) })
.catch(() => {}) .catch(() => {})
},
async closedFn() {
this.dialogVisible = false
this.formData = { enable: true, discount: true }
await this.$refs.formRefs?.resetFields()
} }
} }
} }
...@@ -563,6 +485,7 @@ export default { ...@@ -563,6 +485,7 @@ export default {
.table_wrap { .table_wrap {
flex: 1; flex: 1;
} }
.circle { .circle {
display: inline-block; display: inline-block;
height: 10px; height: 10px;
...@@ -570,6 +493,7 @@ export default { ...@@ -570,6 +493,7 @@ export default {
border-radius: 5px; border-radius: 5px;
margin-right: 5px; margin-right: 5px;
} }
.my-table >>> .first { .my-table >>> .first {
background-color: red !important; background-color: red !important;
color: #fff !important; color: #fff !important;
......
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