Commit c224df34 by 胡悦

提交部分接口

1 parent ccf27b8d
......@@ -161,6 +161,15 @@ export default {
type: Function,
default: null
},
// 搜索前操作
beforeSearchFn: {
type: Function,
default: () => {
return new Promise((resolve, reject) => {
resolve()
})
}
},
// 分页,默认有
hasPage: {
type: Boolean,
......@@ -260,25 +269,27 @@ export default {
},
refreshTable(clearMuti = true) {
// 清空多选
clearMuti && this.clearMutiSelect()
this.loading = true
console.log(this.searchForm)
var params = {
...this.page,
...this.searchForm
}
if (this.sort) {
params.sortColum = this.sortColum
params.sort = this.sort === 'descending' ? 1 : 0
}
this.getListApi(params).then(res => {
var data = res.data
this.data = data[this.tableParams.listName]
this.total = data.total
this.loading = false
}).catch(() => {
this.loading = false
this.beforeSearchFn().then(res => {
// 清空多选
clearMuti && this.clearMutiSelect()
this.loading = true
console.log(this.searchForm)
var params = {
...this.page,
...this.searchForm
}
if (this.sort) {
params.sortColum = this.sortColum
params.sort = this.sort === 'descending' ? 1 : 0
}
this.getListApi(params).then(res => {
var data = res.data
this.data = data[this.tableParams.listName]
this.total = data.total
this.loading = false
}).catch(() => {
this.loading = false
})
})
},
......
......@@ -33,6 +33,17 @@
</el-option>
</el-select>
</template>
<template v-else-if="item.type === 'daterange'">
<el-date-picker
v-model="formModel[item.prop]"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd hh:mm:ss"
>
</el-date-picker>
</template>
</template>
</el-form-item>
<el-form-item>
......
......@@ -34,9 +34,18 @@ const ORGINIZA_API = {
ORGINIZA_TREEORY: BASE_URL + '/usercenter/organization/treeOrg'
}
const DICT_API = {
DICT_SEARCH: {
apiUrl: BASE_URL + '/publiccenter/dict/type/search'
},
DICT_ADD: BASE_URL + '/publiccenter/dict/type/add'
DICT_SEARCH: BASE_URL + '/publiccenter/dict/type/search',
DICT_ADD: BASE_URL + '/publiccenter/dict/type/add',
DICT_EDIT: BASE_URL + '/publiccenter/dict/type/edit',
DICT_DELETE: BASE_URL + '/publiccenter/dict/type/delete',
DICTDATA_SEARCH: BASE_URL + '/publiccenter/dict/data/search',
DICTDATA_EXPORT: BASE_URL + '/publiccenter/dict/data/export',
DICTDATA_ADD: BASE_URL + '/publiccenter/dict/data/add',
DICTDATA_EDIT: BASE_URL + '/publiccenter/dict/data/edit',
DICTDATA_DELETE: BASE_URL + '/publiccenter/dict/data/delete'
}
const WORKLOG_API = {
WORKLOG_SEARCH: BASE_URL + '/loggincenter/loggin/search',
WORKLOG_EXPORT: BASE_URL + '/loggincenter/loggin/export'
}
export { API, USER_API, ROLE_API, ORGINIZA_API, DICT_API }
export { API, USER_API, ROLE_API, ORGINIZA_API, DICT_API, WORKLOG_API }
import HTTP from '@/utils/http'
import { DICT_API } from '@/config/config'
import request from '@/services/request'
// 字典列表
function getDictList (params) {
const url = DICT_API.DICT_SEARCH
return request(params, url)
}
// 新增字典
function addDict (params) {
const url = DICT_API.DICT_ADD
return request(params, url, 'post')
}
// 编辑字典
function editDict (params) {
const url = DICT_API.DICT_EDIT
return request(params, url, 'post')
}
// 删除字典
function deleteDict (params) {
const url = DICT_API.DICT_DELETE
return request(params, url)
}
export default class DictService extends HTTP {
addDict (params) {
return new Promise((resolve, reject) => {
this.axiosPost({
url: DICT_API.DICT_ADD,
data: {params},
success(data) {
resolve(data)
},
error(error) {
// 网络请求失败
console.log('网络请求失败')
}
})
})
}
// 字典数据列表
function getDictDataList (params) {
const url = DICT_API.DICTDATA_SEARCH
return request(params, url)
}
// 新增字典数据类型
function addDictData (params) {
const url = DICT_API.DICTDATA_ADD
return request(params, url, 'post')
}
// 编辑字典数据类型
function editDictData (params) {
const url = DICT_API.DICTDATA_EDIT
return request(params, url, 'post')
}
// 删除字典数据类型
function deleteDictData (params) {
const url = DICT_API.DICTDATA_DELETE
return request(params, url)
}
// 导出字典数据
function exportDictData (params) {
const url = DICT_API.DICTDATA_EXPORT
return request(params, url)
}
export { getDictList, addDict, editDict, deleteDict, getDictDataList, addDictData, editDictData, deleteDictData, exportDictData }
......@@ -2,11 +2,11 @@ import HTTP from '@/utils/http'
const axiosHttp = new HTTP()
function request(data = {}, method = 'GET') {
function request (data = {} , url, method = 'GET') {
return new Promise((resolve, reject) => {
var reqMethod = method.toLocaleLowerCase() === 'get' ? 'axiosGet' : 'axiosPost'
axiosHttp[reqMethod]({
url: data.url,
url: url,
data: data,
success(data) {
resolve(data)
......@@ -18,4 +18,4 @@ function request(data = {}, method = 'GET') {
})
}
export default request
\ No newline at end of file
export default request
import {
USER_API
} from '@/config/config'
import { USER_API} from '@/config/config'
import request from '@/services/request'
// 获取用户列表
function getUserList(params) {
params.url = USER_API.USER_SEARCH
return request(params)
function getUserList (params) {
const url = USER_API.USER_SEARCH
return request(params, url)
}
// 获取上级树
function getSuperUser(params) {
params.url = USER_API.USER_SUPER
return request(params)
function getSuperUser (params) {
const url = USER_API.USER_SUPER
return request(params, url)
}
// 新增用户
function addUser(params) {
params.url = USER_API.USER_ADD
return request(params)
function addUser (params) {
const url = USER_API.USER_ADD
return request(params, url)
}
export {
getUserList,
getSuperUser,
addUser
}
\ No newline at end of file
export { getUserList, getSuperUser, addUser}
import { WORKLOG_API } from '@/config/config'
import request from '@/services/request'
// 获取用户列表
function getWorkLogList (params) {
const url = WORKLOG_API.WORKLOG_SEARCH
return request(params, url)
}
// 导出日志
function exportWorkLog (params) {
const url = WORKLOG_API.WORKLOG_EXPORT
return request(params, url)
}
export { getWorkLogList, exportWorkLog }
......@@ -7,14 +7,15 @@
}
.border-shadow {
border: 1px solid rgb(235, 235, 235);
border-image: initial;
border-radius: 3px;
transition: all 0.2s ease 0s;
}
border: 1px solid rgb(235, 235, 235);
border-image: initial;
border-radius: 3px;
transition: all 0.2s ease 0s;
}
.border-shadow:hover {
box-shadow: rgba(232, 237, 250, 0.6) 0px 0px 8px 0px,
rgba(232, 237, 250, 0.5) 0px 2px 4px 0px;
box-shadow: rgba(232, 237, 250, 0.6) 0px 0px 8px 0px,
rgba(232, 237, 250, 0.5) 0px 2px 4px 0px;
}
.system-container {
......@@ -22,15 +23,18 @@
margin: 20px 24px;
background-color: #ffffff;
overflow: hidden;
.user-tree {
margin-top: 20px;
padding: 20px;
float: left;
width: 18%;
.user-tree-top {
height: 30px;
}
}
.user-container {
padding: 20px 10px 0px 20px;
float: left;
......@@ -52,6 +56,14 @@
margin-right: 2px;
}
.green-text {
color: #00A854;
}
.red-text {
color: rgb(255, 0, 0);
}
.green {
background-color: #00A854;
}
......@@ -78,5 +90,4 @@
.statusText {
vertical-align: middle;
}
}
\ No newline at end of file
......@@ -28,6 +28,11 @@ const Constants = {
'1': '启用, green',
'2': '停用, red'
},
// 日志操作状态
WORKLOG_STATUS: {
'0': '成功, green-text',
'-1': '失败, red-text'
},
// (0:系统管理员,1:服务商,2:门店,3:技工)
USERTYPE: {
'0': '超级管理员',
......
......@@ -4,7 +4,7 @@
<search-form
class="searchTop border-shadow"
:formModel="searchForm"
:formList="dictionaryFormList"
:formList="dictDataFormList"
>
<slot name="form-slot">
<el-button
......@@ -17,6 +17,7 @@
type="primary"
:size="btn_size"
icon="el-icon-refresh"
@click="refresh"
>重置</el-button>
</slot>
</search-form>
......@@ -25,7 +26,7 @@
type="primary"
:size="btn_size"
icon="el-icon-plus"
@click="handleClose"
@click="btnClick('create')"
>新增</el-button>
</div>
<basic-table
......@@ -33,12 +34,16 @@
:getListApi="getListApi"
:searchForm="searchForm"
:hasNum="false"
ref="dictDataTable"
>
<span
slot="status"
slot-scope="scope"
>
<span class="dot green"></span><span class="statusText">正常</span>
<span
class="dot"
:class="scope.scope.enableStatus ? DICTSTATUS[scope.scope.enableStatus].split(',')[1] : ''"
></span><span class="statusText">{{ scope.scope.enableStatus ? DICTSTATUS[scope.scope.enableStatus].split(',')[0] : '--'}}</span>
</span>
<span
slot="table-button"
......@@ -55,17 +60,17 @@
</span>
</basic-table>
<basic-dialog
:title="dictionaryDialogTitle"
:isVisible="dictionaryVisible"
:title="dictDataDialogTitle"
:isVisible="dictDataVisible"
@confirmDialog="handleConfirm"
@closeDialog="handleClose"
>
<slot>
<rule-form
:ruleForm="dictionaryForm"
:rules="dictionaryRules"
:ruleData="dictionaryData"
ref='dictionaryForm'
:ruleForm="dictDataForm"
:rules="dictDataRules"
:ruleData="dictDataData"
ref='dictDataForm'
></rule-form>
</slot>
</basic-dialog>
......@@ -74,11 +79,14 @@
</template>
<script>
import { getDictDataList, addDictData, editDictData, deleteDictData, exportDictData } from 'services/dictionary';
export default {
data() {
return {
DICTSTATUS: this.$Constants.DICT_STATUS,
searchForm: {},
dictionaryFormList: [
dictDataFormList: [
{
type: 'input',
inputType: 'text',
......@@ -107,7 +115,7 @@ export default {
}
],
tableParams: {
mutiSelectName: 'dictionaryData',
mutiSelectName: 'dictDataData',
mutiSelectUniqueKey: 'id',
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
......@@ -117,7 +125,7 @@ export default {
prop: 'id'
}, {
label: '字典标签',
prop: 'dictName'
prop: 'dictLabel'
}, {
label: '字典键值',
prop: 'dictType'
......@@ -152,30 +160,71 @@ export default {
]
}
},
getListApi: null,
getListApi: getDictDataList,
// 弹窗
dictionaryDialogTitle: '新增字典',
dictionaryVisible: false,
dictionaryForm: {},
dictionaryData: [
dictDataDialogTitle: '新增字典',
dictDataVisible: false,
dictDataForm: {
enableStatus: true
},
dictDataData: [
{ label: '字典类型:', prop: 'dictType', type: 'input' },
{ label: '字典标签:', prop: 'dictName', type: 'input' },
{ label: '字典编码:', prop: 'dictName', type: 'input' },
{ label: '字典键值:', prop: 'dictName', type: 'input' },
{ label: '字典顺序:', prop: 'dictName', type: 'input' },
{ label: '字典标签:', prop: 'dictLabel', type: 'input' },
{ label: '字典编码:', prop: 'dictSort', type: 'input' },
{ label: '字典键值:', prop: 'dictValue', type: 'input' },
{ label: '字典顺序:', prop: 'dictSort', type: 'input' },
{ label: '状态', prop: 'enableStatus', type: 'switch' },
{ label: '备注', prop: 'remark', type: 'input', inputText: 'textarea' }
],
dictionaryRules: {}
dictDataRules: {
dictType: [{ required: true, message: '请输入字典类型', trigger: blur }],
dictLabel: [{ required: true, message: '请输入字典标签', trigger: blur }],
dictSort: [{ required: true, message: '请输入字典编码', trigger: blur }],
dictValue: [{ required: true, message: '请输入字典键值', trigger: blur }],
dictSort: [{ required: true, message: '请输入字典顺序', trigger: blur }],
enableStatus: [{ required: true }]
}
}
},
methods: {
// 重置搜索条件
refresh() {
this.searchForm = {}
},
// 确定
handleConfirm() {
this.$refs.dictDataForm.$children[0].validate((valid) => {
if (valid) {
let params = JSON.parse(JSON.stringify(this.dictDataForm))
params.enableStatus = this.dictDataForm.enableStatus ? 1 : 2
console.log(params)
let api = addDictData
if (params.id) api = editDictData
api(params).then(res => {
console.log(res)
this.handleClose()
this.$refs.dictDataTable.refreshTable()
})
} else {
console.log('error')
}
})
},
// 取消
handleClose() {
if (!this.dictDataVisible && this.$refs.dictDataForm) {
this.$refs.dictDataForm.$children[0].resetFields()
}
this.dictDataVisible = !this.dictDataVisible
},
// 按钮事件
btnClick(pType, scope) {
console.log(pType, scope)
switch (pType) {
case 'create':
this.handleClose()
case 'edit':
this.handleClose(scope)
this.editEvent(scope)
break
case 'delete':
this.deleteEvent(scope.id)
......@@ -185,24 +234,12 @@ export default {
break
}
},
// 确定
handleConfirm() {
console.log(this.$refs.dictionaryForm)
this.$refs.dictionaryForm.$children[0].validate((valid) => {
if (valid) {
this.handleClose()
} else {
console.log('error')
}
})
},
// 取消
handleClose(row) {
console.log(row)
if (!this.dictionaryVisible && this.$refs.dictionaryForm) {
this.$refs.dictionaryForm.$children[0].resetFields()
}
this.dictionaryVisible = !this.dictionaryVisible
// 编辑触发事件
editEvent(row) {
this.dictDataForm = JSON.parse(JSON.stringify(row))
this.dictDataForm.enableStatus = row.enableStatus == 1 ? true : false
this.handleClose()
},
// 删除触发事件
deleteEvent(id) {
......@@ -213,9 +250,15 @@ export default {
tipTitle: '提示',
type: 'error',
callBack: () => {
this.$message({
type: 'success',
message: '删除成功!'
const params = {
id: id
}
deleteDictData(params).then(res => {
this.$message({
type: 'success',
message: '删除成功!'
})
this.$refs.dictDataTable.refreshTable()
})
}
}
......
......@@ -17,6 +17,7 @@
type="primary"
:size="btn_size"
icon="el-icon-refresh"
@click="refresh "
>重置</el-button>
</slot>
</search-form>
......@@ -25,12 +26,12 @@
type="primary"
:size="btn_size"
icon="el-icon-plus"
@click="handleClose"
@click="btnClick('create')"
>新增</el-button>
</div>
<basic-table
:tableParams="tableParams"
:apiParame="apiParame"
:getListApi="getListApi"
:searchForm="searchForm"
:hasNum="false"
>
......@@ -77,11 +78,7 @@
</template>
<script>
import {
DICT_API
} from '@/config/config'
import Service from 'services/dictionary';
const dictService = new Service()
import { getDictList, addDict, editDict, deleteDict } from 'services/dictionary';
export default {
data() {
return {
......@@ -163,7 +160,7 @@ export default {
]
}
},
apiParame: DICT_API.DICT_SEARCH,
getListApi: getDictList,
// 弹窗
dictionaryDialogTitle: '新增字典',
dictionaryVisible: false,
......@@ -184,27 +181,22 @@ export default {
}
},
methods: {
// 按钮事件
btnClick(pType, scope) {
console.log(pType, scope)
switch (pType) {
case 'edit':
this.handleClose(scope)
break
case 'delete':
this.deleteEvent(scope.id)
break
case 'list':
console.log('list')
break
}
// 重置搜索条件
refresh() {
this.searchForm = {}
},
// 确定
handleConfirm() {
console.log(this.dictionaryForm)
this.$refs.dictionaryForm.$children[0].validate((valid) => {
if (valid) {
dictService.addDict(this.dictionaryForm).then(res => {
let params = JSON.parse(JSON.stringify(this.dictionaryForm))
params.enableStatus = this.dictionaryForm.enableStatus ? 1 : 2
console.log(params)
let api = addDict
if (params.id) api = editDict
api(params).then(res => {
console.log(res)
this.handleClose()
})
} else {
......@@ -213,17 +205,37 @@ export default {
})
},
// 取消
handleClose(row) {
console.log(row)
if (row) {
this.dictionaryForm = row
// this.dictionaryForm.enableStatus
}
handleClose() {
if (!this.dictionaryVisible && this.$refs.dictionaryForm) {
this.$refs.dictionaryForm.$children[0].resetFields()
}
this.dictionaryVisible = !this.dictionaryVisible
},
// 按钮事件
btnClick(pType, scope) {
console.log(pType, scope)
switch (pType) {
case 'create':
this.handleClose()
break
case 'edit':
this.editEvent(scope)
break
case 'delete':
this.deleteEvent(scope.id)
break
case 'list':
console.log('list')
break
}
},
// 编辑触发时间
editEvent(row) {
this.dictionaryForm = JSON.parse(JSON.stringify(row))
this.dictionaryForm.enableStatus = row.enableStatus == 1 ? true : false
this.handleClose()
},
// 删除触发事件
deleteEvent(id) {
const that = this
......@@ -233,10 +245,16 @@ export default {
tipTitle: '提示',
type: 'error',
callBack: () => {
this.$message({
type: 'success',
message: '删除成功!'
const params = {
id: id
}
deleteDict(params).then(res => {
this.$message({
type: 'success',
message: '删除成功!'
})
})
}
}
this.$Common.confirmDialog(tipData)
......
......@@ -119,7 +119,7 @@
<script>
// import UserService from 'services/user';
import {getUserList, getSuperUser, addUser } from 'services/user';
import { getUserList, getSuperUser, addUser } from 'services/user';
import OrginizaService from 'services/orginizaManage';
const orginizaService = new OrginizaService();
export default {
......@@ -309,7 +309,6 @@ export default {
methods: {
// 重置搜索条件
refresh() {
console.log('chognzhi ')
this.searchForm = {}
},
// 确定,新增用户、编辑用户
......
......@@ -4,7 +4,7 @@
<search-form
class="searchTop border-shadow"
:formModel="searchForm"
:formList="dictionaryFormList"
:formList="worklogFormList"
>
<slot name="form-slot">
<el-button
......@@ -17,6 +17,7 @@
type="primary"
:size="btn_size"
icon="el-icon-refresh"
@click="refresh"
>重置</el-button>
</slot>
</search-form>
......@@ -24,35 +25,40 @@
<el-button
type="primary"
:size="btn_size"
icon="el-icon-plus"
@click="handleClose"
>新增</el-button>
@click="exportTable"
>导出</el-button>
</div>
<basic-table
:tableParams="tableParams"
:getListApi="getListApi"
:searchForm="searchForm"
:beforeSearchFn="beforeSearchFn"
:searchForm="searchDataForm"
:hasNum="false"
>
<span
slot="status"
slot-scope="scope"
>
<span class="dot green"></span><span class="statusText">正常</span>
<span
class="statusText"
:class="scope.scope.operStatus ? WORKLOGSTATUS[scope.scope.operStatus].split(',')[1] : ''"
>
{{scope.scope.operStatus ? WORKLOGSTATUS[scope.scope.operStatus].split(',')[0] : '--'}}
</span>
</span>
</basic-table>
<basic-dialog
:title="dictionaryDialogTitle"
:isVisible="dictionaryVisible"
:title="worklogDialogTitle"
:isVisible="worklogVisible"
@confirmDialog="handleConfirm"
@closeDialog="handleClose"
>
<slot>
<rule-form
:ruleForm="dictionaryForm"
:rules="dictionaryRules"
:ruleData="dictionaryData"
ref='dictionaryForm'
:ruleForm="worklogForm"
:rules="worklogRules"
:ruleData="worklogData"
ref='worklogForm'
></rule-form>
</slot>
</basic-dialog>
......@@ -61,15 +67,17 @@
</template>
<script>
import { getWorkLogList, exportWorkLog } from 'services/worklog';
export default {
data() {
return {
WORKLOGSTATUS: this.$Constants.WORKLOG_STATUS,
searchForm: {},
dictionaryFormList: [
searchDataForm: {},
worklogFormList: [
{
type: 'input',
inputType: 'text',
prop: 'name',
type: 'daterange',
prop: 'daterange',
placeholder: '请输入字典名称'
}
],
......@@ -84,24 +92,22 @@ export default {
prop: 'id'
}, {
label: '系统菜单',
prop: 'dictName'
prop: 'module'
}, {
label: '操作类型',
prop: 'dictType'
prop: 'action'
}, {
label: '操作账号',
prop: 'remark'
prop: 'operatorName'
}, {
label: '所属组织',
prop: 'enableStatus',
addHtml: 'status'
prop: 'belongOrg'
}, {
label: '主机IP',
prop: 'enableStatus',
addHtml: 'status'
prop: 'ip',
}, {
label: '操作状态',
prop: 'enableStatus',
prop: 'operStatus',
addHtml: 'status'
}, {
label: '创建时间',
......@@ -109,21 +115,25 @@ export default {
}
]
},
getListApi: null,
getListApi: getWorkLogList,
// 弹窗
dictionaryDialogTitle: '新增字典',
dictionaryVisible: false,
dictionaryForm: {},
dictionaryData: [
worklogDialogTitle: '新增字典',
worklogVisible: false,
worklogForm: {},
worklogData: [
{ label: '字典名称:', prop: 'dictName', type: 'input' },
{ label: '字典类型', prop: 'dictType', type: 'input' },
{ label: '状态', prop: 'enableStatus', type: 'switch' },
{ label: '备注', prop: 'remark', type: 'input', inputText: 'textarea' }
],
dictionaryRules: {}
worklogRules: {}
}
},
methods: {
refresh() {
this.searchForm = {}
this.searchDataForm = {}
},
// 按钮事件
btnClick(pType, scope) {
console.log(pType, scope)
......@@ -139,10 +149,19 @@ export default {
break
}
},
beforeSearchFn() {
return new Promise((resolve, reject) => {
console.log(this.searchForm)
if (this.searchForm.daterange) this.searchDataForm.sDate = this.searchForm.daterange[0]
if (this.searchForm.daterange) this.searchDataForm.eDate = this.searchForm.daterange[1]
resolve()
})
},
// 确定
handleConfirm() {
console.log(this.$refs.dictionaryForm)
this.$refs.dictionaryForm.$children[0].validate((valid) => {
console.log(this.$refs.worklogForm)
this.$refs.worklogForm.$children[0].validate((valid) => {
if (valid) {
this.handleClose()
} else {
......@@ -153,10 +172,10 @@ export default {
// 取消
handleClose(row) {
console.log(row)
if (!this.dictionaryVisible && this.$refs.dictionaryForm) {
this.$refs.dictionaryForm.$children[0].resetFields()
if (!this.worklogVisible && this.$refs.worklogForm) {
this.$refs.worklogForm.$children[0].resetFields()
}
this.dictionaryVisible = !this.dictionaryVisible
this.worklogVisible = !this.worklogVisible
},
// 删除触发事件
deleteEvent(id) {
......@@ -174,6 +193,12 @@ export default {
}
}
this.$Common.confirmDialog(tipData)
},
// 导出列表
exportTable() {
exportWorkLog().then(res => {
})
}
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!