Commit c224df34 by 胡悦

提交部分接口

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