fe37ae55 by xiaomiao

菜单管理

1 parent 7bdc3051
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
11 "@jiaminghi/data-view": "^2.10.0", 11 "@jiaminghi/data-view": "^2.10.0",
12 "axios": "^0.21.1", 12 "axios": "^0.21.1",
13 "clipboard": "^2.0.11", 13 "clipboard": "^2.0.11",
14 "jsoneditor": "^9.9.2",
14 "core-js": "^3.6.5", 15 "core-js": "^3.6.5",
15 "echarts": "^4.6.0", 16 "echarts": "^4.6.0",
16 "js-cookie": "2.2.0", 17 "js-cookie": "2.2.0",
......
...@@ -81,6 +81,29 @@ export const api = { ...@@ -81,6 +81,29 @@ export const api = {
81 crudBusiness : crud + '/rest/business', // crudBusiness 81 crudBusiness : crud + '/rest/business', // crudBusiness
82 crudDatasources : crud + '/rest/datasources', // crudDatasources 82 crudDatasources : crud + '/rest/datasources', // crudDatasources
83 } 83 }
84
85 // 根据code获取字典 params={isTree:true})
86 export function getDictItems(code, params = {}) {
87 return request({
88 url: `${api.baseDataCategory}/${code}/base-datas`,
89 method: 'get',
90 params
91 })
92 }
93 // 获取一级字典值下级接口
94 export function getDictItemsChild(id) {
95 return request({
96 url: `${api.baseData}/dict/${id}`,
97 method: 'get'
98 })
99 }
100 // 获取传入字段的所有级别字典值
101 export function getAllDictItems(name) {
102 return request({
103 url: `${api.baseDataCategory}/${name}/base-datas`,
104 method: 'get'
105 })
106 }
84 // get公共方法 107 // get公共方法
85 export function getAction(url, params = {}) { 108 export function getAction(url, params = {}) {
86 return request({ 109 return request({
......
...@@ -23,7 +23,6 @@ export const getRolesById = categoryId => { ...@@ -23,7 +23,6 @@ export const getRolesById = categoryId => {
23 queryRelation: 'AND' 23 queryRelation: 'AND'
24 } 24 }
25 const params = getParams(conditionGroup); 25 const params = getParams(conditionGroup);
26 console.log(api.roles,params);
27 return getAction(api.roles, params) 26 return getAction(api.roles, params)
28 } 27 }
29 // 人员列表 28 // 人员列表
...@@ -34,3 +33,51 @@ export const getUserRoles = (id) => { ...@@ -34,3 +33,51 @@ export const getUserRoles = (id) => {
34 export const updateUser = (id, data) => { 33 export const updateUser = (id, data) => {
35 return putAction(`${api.userRoles}/${id}/users`, data) 34 return putAction(`${api.userRoles}/${id}/users`, data)
36 } 35 }
36 // 根据条件获取用户
37 export const getUserList = (params) => {
38 return getAction(api.users, params)
39 }
40 // 导出用户列表
41 export const exportUserList = (params) => {
42 return getAction(api.users + '/export', params)
43 }
44 // 更新用户状态
45 export const updateStatus = (id, status) => {
46 return putAction(`${api.users}/${id}/${status}/status`)
47 }
48 // 更新用户解锁状态
49 export const updateLock = (id) => {
50 return putAction(`${api.users}/${id}/lock`)
51 }
52 // 重置用户密码
53 // export const resetPassword = id => {
54 // return putAction(`${api.users}/${id}/reset-password`)
55 // }
56
57 // 重置用户密码
58 export const resetPassword = (ids) => {
59 return putAction(`${api.users}/reset-passwords?ids=${ids}`)
60 }
61
62 // 删除人员
63 export const delUser = (id, data) => {
64 return deleteAction(`${api.userRoles}/${id}/users`, data)
65 }
66 // 获取父级菜单
67 export const getParentMenuListAction = (id) => {
68 let conditionGroup = {}
69 if (id && id !== '') {
70 conditionGroup = {
71 conditions: [
72 {
73 property: 'productId',
74 value: id,
75 operator: 'EQ'
76 }
77 ],
78 queryRelation: 'AND'
79 }
80 }
81 const params = getParams(conditionGroup)
82 return getAction(api.menus, params)
83 }
......
...@@ -23,6 +23,7 @@ export default { ...@@ -23,6 +23,7 @@ export default {
23 try { 23 try {
24 let { result: res } = await work.mapViews("A20"); 24 let { result: res } = await work.mapViews("A20");
25 res.map((item) => { 25 res.map((item) => {
26
26 return ( 27 return (
27 this.cdata.push({ "name": item.areaName, "value": item.ywtotal }) 28 this.cdata.push({ "name": item.areaName, "value": item.ywtotal })
28 ) 29 )
......
1 <template> 1 <template>
2 <div> 2 <div>
3 <i class="icon-tubiao-242 iconfont" :title="title" @click="openDialog" /> 3 <i class="el-icon-s-management icon" :title="title" @click="openDialog" />
4 <el-dialog :key="key" :title="title" :inner-dialog="true" :visible.sync="dialogVisible" width="600px" 4 <el-dialog
5 :close-on-click-modal="false" append-to-body @cancel="cancel"> 5 :key="key"
6 <vue-json-editor id="minejson" v-model="resultInfo" :mode="'code'" lang="zh" @json-change="onJsonChange" 6 :title="title"
7 @json-save="onJsonSave" @has-error="onError" /> 7 :inner-dialog="true"
8 <el-tooltip content="全屏缩放" effect="dark" placement="bottom" fullscreen class="fullScreen"> 8 :visible.sync="dialogVisible"
9 width="600px"
10 :close-on-click-modal="false"
11 append-to-body
12 @cancel="cancel"
13 >
14 <vue-json-editor
15 id="minejson"
16 v-model="resultInfo"
17 :mode="'code'"
18 lang="zh"
19 @json-change="onJsonChange"
20 @json-save="onJsonSave"
21 @has-error="onError"
22 />
23 <el-tooltip
24 content="全屏缩放"
25 effect="dark"
26 placement="bottom"
27 fullscreen
28 class="fullScreen"
29 >
9 <i class="el-icon-full-screen" @click="enLarge" /> 30 <i class="el-icon-full-screen" @click="enLarge" />
10 </el-tooltip> 31 </el-tooltip>
11 <template slot="footer"> 32 <template slot="footer">
12 <div class="dialog-footer flex flex-pack-center"> 33 <div class="dialog-footer flex flex-pack-center">
13 <el-button type="primary" class="confirmBtn" @click="onJsonSave">保存</el-button> 34 <el-button
14 <el-button type="primary" class="cancelBtn" @click="cancel">关闭</el-button> 35 type="primary"
36 class="confirmBtn"
37 @click="onJsonSave"
38 >保存</el-button>
39 <el-button
40 type="primary"
41 class="cancelBtn"
42 @click="cancel"
43 >关闭</el-button>
15 </div> 44 </div>
16 </template> 45 </template>
17 </el-dialog> 46 </el-dialog>
...@@ -33,7 +62,7 @@ export default { ...@@ -33,7 +62,7 @@ export default {
33 default: '' 62 default: ''
34 } 63 }
35 }, 64 },
36 data () { 65 data() {
37 return { 66 return {
38 activeNames: [], 67 activeNames: [],
39 resultInfo: {}, 68 resultInfo: {},
...@@ -46,7 +75,7 @@ export default { ...@@ -46,7 +75,7 @@ export default {
46 }, 75 },
47 watch: { 76 watch: {
48 resultInfos: { 77 resultInfos: {
49 handler: function (val) { 78 handler: function(val) {
50 ++this.key 79 ++this.key
51 this.resultInfo = 80 this.resultInfo =
52 this.resultInfos === '' ? {} : JSON.parse(this.resultInfos) 81 this.resultInfos === '' ? {} : JSON.parse(this.resultInfos)
...@@ -57,18 +86,19 @@ export default { ...@@ -57,18 +86,19 @@ export default {
57 } 86 }
58 }, 87 },
59 88
60 mounted () { 89 mounted() {
61 this.resultInfo = 90 this.resultInfo =
62 this.resultInfos === '' ? {} : JSON.parse(this.resultInfos) 91 this.resultInfos === '' ? {} : JSON.parse(this.resultInfos)
63 }, 92 },
64 93
65 methods: { 94 methods: {
66 onJsonChange (value) { 95 onJsonChange(value) {
67 // 只有在格式正确的时候进入此事件 96 // 只有在格式正确的时候进入此事件
68 this.hasJsonFlag = true 97 this.hasJsonFlag = true
69 }, 98 },
70 onJsonSave () { 99 onJsonSave() {
71 const value = this.resultInfo 100 const value = this.resultInfo
101 console.log(this.resultInfo, 'resultInfo')
72 if (this.hasJsonFlag === false) { 102 if (this.hasJsonFlag === false) {
73 this.$message.error({ message: 'json格式验证失败', showClose: true }) 103 this.$message.error({ message: 'json格式验证失败', showClose: true })
74 // alert("json验证失败") 104 // alert("json验证失败")
...@@ -79,18 +109,19 @@ export default { ...@@ -79,18 +109,19 @@ export default {
79 return true 109 return true
80 } 110 }
81 }, 111 },
82 onError (value) { 112 onError(value) {
83 this.hasJsonFlag = false 113 this.hasJsonFlag = false
84 }, 114 },
85 openDialog () { 115 openDialog() {
86 this.dialogVisible = true 116 this.dialogVisible = true
87 }, 117 },
88 cancel () { 118 cancel() {
119 console.log(this.tmpResultInfo, 'tmpResultInfo')
89 this.resultInfo = this.tmpResultInfo 120 this.resultInfo = this.tmpResultInfo
90 this.dialogVisible = false 121 this.dialogVisible = false
91 }, 122 },
92 // 放大 123 // 放大
93 enLarge () { 124 enLarge() {
94 const fullarea = document.getElementById('minejson') 125 const fullarea = document.getElementById('minejson')
95 if (fullarea.requestFullscreen) { 126 if (fullarea.requestFullscreen) {
96 fullarea.requestFullscreen() 127 fullarea.requestFullscreen()
...@@ -109,17 +140,12 @@ export default { ...@@ -109,17 +140,12 @@ export default {
109 140
110 <style scoped lang="scss"> 141 <style scoped lang="scss">
111 /* jsoneditor右上角默认有一个链接,加css去掉了 */ 142 /* jsoneditor右上角默认有一个链接,加css去掉了 */
112 .iconfont { 143 .icon {
113 cursor: pointer;
114 position: relative;
115 top: 1px;
116 color: #349af3; 144 color: #349af3;
117 } 145 }
118 146 /deep/ .jsoneditor-vue {
119 ::v-deep .jsoneditor-vue {
120 height: 100%; 147 height: 100%;
121 } 148 }
122
123 .fullScreen { 149 .fullScreen {
124 position: absolute; 150 position: absolute;
125 right: 5%; 151 right: 5%;
...@@ -127,28 +153,22 @@ export default { ...@@ -127,28 +153,22 @@ export default {
127 cursor: pointer; 153 cursor: pointer;
128 color: #fff; 154 color: #fff;
129 } 155 }
130 156 /deep/ .jsoneditor-modes {
131 ::v-deep .jsoneditor-modes {
132 display: none !important; 157 display: none !important;
133 } 158 }
134
135 .jsoneditor-poweredBy { 159 .jsoneditor-poweredBy {
136 display: none !important; 160 display: none !important;
137 } 161 }
138
139 .jsoneditor-menu { 162 .jsoneditor-menu {
140 background-color: #9c9e9f !important; 163 background-color: #9c9e9f !important;
141 border-bottom: 1px solid #9c9e9f !important; 164 border-bottom: 1px solid #9c9e9f !important;
142 } 165 }
143
144 .jsoneditor { 166 .jsoneditor {
145 border: 1px solid #9c9e9f !important; 167 border: 1px solid #9c9e9f !important;
146 } 168 }
147
148 .el-collapse { 169 .el-collapse {
149 border: 0; 170 border: 0;
150 } 171 }
151
152 .el-collapse-item__header { 172 .el-collapse-item__header {
153 height: 44px; 173 height: 44px;
154 } 174 }
......
...@@ -25,6 +25,51 @@ VXETable.setup({ ...@@ -25,6 +25,51 @@ VXETable.setup({
25 i18n: (key, args) => XEUtils.toFormatString(XEUtils.get(zhCNLocat, key), args) 25 i18n: (key, args) => XEUtils.toFormatString(XEUtils.get(zhCNLocat, key), args)
26 }) 26 })
27 27
28 import $deepCopy from '../utils/tool'
29
30 Vue.use($deepCopy)
31
32 import $dealArrChildren from '../utils/tool'
33
34 Vue.use($dealArrChildren)
35
36 import $filterNullObj from '../utils/tool'
37
38 Vue.use($filterNullObj)
39
40 import $getNodeRoute from '../utils/tool'
41
42 Vue.use($getNodeRoute)
43
44 import $dealArrDisabled from '../utils/tool'
45
46 Vue.use($dealArrDisabled)
47
48 import $dealArrNotDisabled from '../utils/tool'
49
50 Vue.use($dealArrNotDisabled)
51
52 import $treeConvertToArr from '../utils/tool'
53
54 Vue.use($treeConvertToArr)
55
56 import $setChildArr from '../utils/tool'
57
58 Vue.use($setChildArr)
59
60 import $findParent from '../utils/tool'
61
62 Vue.use($findParent)
63
64 import $findChildren from '../utils/tool'
65
66 Vue.use($findChildren)
67
68 import $getLocalStorage from '../utils/tool'
69
70 Vue.use($getLocalStorage)
71
72
28 Vue.use(Icon) 73 Vue.use(Icon)
29 74
30 Vue.use(Header) 75 Vue.use(Header)
......
...@@ -6,6 +6,7 @@ import '@/styles/element-variables.scss' ...@@ -6,6 +6,7 @@ import '@/styles/element-variables.scss'
6 import '@/styles/index.scss' 6 import '@/styles/index.scss'
7 import Base from './base' // 全局组件引入 7 import Base from './base' // 全局组件引入
8 import mixin from '@/utils/mixin/theme.js' 8 import mixin from '@/utils/mixin/theme.js'
9
9 import dataV from '@jiaminghi/data-view'; 10 import dataV from '@jiaminghi/data-view';
10 import echarts from "echarts" 11 import echarts from "echarts"
11 import { startLoadingAddCount, endLoadingSubCount } from './utils/requestLoading' 12 import { startLoadingAddCount, endLoadingSubCount } from './utils/requestLoading'
......
1 /**
2 * 新增修改完成调用 dialogFormOk方法重置表单,修改新增弹框组件ref定义为dialogForm
3 * 弹框组件中新增方法add 编辑方法 edit
4 * 表格页面的data中tableUrl定义为接口地址
5 * 弹窗页面定义初始this.init()方法,获取弹窗需要的数据
6 * 表格ref=xTree
7 */
8 import { deleteAction, getAction } from '@/api/manageApi'
9
10 export const TableListMixin = {
11 data() {
12 return {
13 // 查询拼接json字符串
14 queryOptions: '',
15 queryParam: {}, // 查询条件
16 /* 数据源 */
17 tableData: [],
18 /* 分页参数*/
19 ipagination: {
20 pageNumber: 0,
21 pageSize: 10
22 },
23 /* table选中行*/
24 selectionRows: [],
25 loading: false // 表格加载状态
26 }
27 },
28 created() {
29 // console.log(' -- mixin created -- ')
30 // 初始化字典配置 在需要页面调用字典值获取方法
31 this.initDictConfig()
32 },
33 methods: {
34 // 加载表格数据
35 loadData(arg) {
36 if (!this.tableUrl) {
37 console.log('请设置tableUrl属性为接口地址!')
38 return
39 }
40 // 加载数据 若传入参数1则加载第一页的内容
41 // if (arg === 1) {
42 // }
43 const params = this.getQueryParams() // 查询条件
44 this.loading = true
45 getAction(this.tableUrl, params)
46 .then(res => {
47 if (res.status === 1) {
48 this.loading = false
49 this.tableData = res.content
50 this.$nextTick(() => {
51 if (this.tableData.length !== 0) {
52 this.$refs.xTree && this.$refs.xTree.setAllTreeExpand(true)
53 }
54 })
55 } else {
56 this.$message.error({ message: res.message, showClose: true })
57 this.loading = false
58 }
59 })
60 .catch(error => {
61 console.log('errrrrrorrrrr', error)
62 this.loading = false
63 })
64 },
65 // 字典值配置
66 initDictConfig() {
67 // console.log('假初始化字典值方法!')
68 },
69 // 选择所有和取消所有
70 selectAllEvent({ checked, records }) {
71 this.selectionRows = records
72 },
73 // 选中节点
74 selectChangeEvent({ records }) {
75 this.selectionRows = records
76 },
77 // 使用查询条件查询
78 searchQuery() {
79 this.loadData()
80 },
81 // 获取查询条件
82 getQueryParams() {
83 if (this.queryOptions !== '') {
84 this.queryParam.queryOptions = JSON.stringify(this.queryOptions)
85 }
86 // console.log(this.$filterNullObj(this.queryParam), '查询条件')
87 return this.$filterNullObj(this.queryParam)
88 },
89 // 新增
90 handleAdd: function() {
91 this.$refs.dialogForm.add()
92 this.$refs.dialogForm.title = '新增'
93 },
94 // 修改
95 handleEdit: function(record) {
96 localStorage.setItem('record', JSON.stringify(record))
97 this.$refs.dialogForm.edit(record)
98 this.$refs.dialogForm.title = '修改'
99 },
100 // 删除
101 handleDelete: function(id, content = '') {
102 this.$confirm(
103 `<div class="customer-message-wrapper">
104 <h5 class="title">您确认要执行该操作用于以下信息:</h5>
105 <p class="content" aria-controls="${content}">${content}
106 </p>
107 <p class="result">执行后,数据将
108 <span >无法恢复</span>
109 </p>
110 </div>`,
111 '执行确认',
112 {
113 dangerouslyUseHTMLString: true,
114 customClass: 'customer-delete',
115 confirmButtonText: '确定',
116 cancelButtonText: '取消',
117 type: 'warning'
118 }
119 )
120 .then(() => {
121 if (!this.tableUrl) {
122 this.$message.error({
123 message: '请设置tableUrl属性为接口地址!',
124 showClose: true
125 })
126 return
127 }
128 const url = this.tableUrl + '/' + id
129 deleteAction(url).then(res => {
130 if (res.status === 1) {
131 this.$message.success({ message: res.message, showClose: true })
132 this.loadDataS(this.subcode)
133 } else {
134 this.$message.error({ message: res.message, showClose: true })
135 }
136 })
137 })
138 .catch(() => {})
139 },
140 // 批量删除
141 batchDel: function() {
142 if (!this.tableUrl) {
143 this.$message.error({
144 message: '请设置tableUrl属性为接口地址!',
145 showClose: true
146 })
147 return
148 }
149 if (this.selectionRows.length === 0) {
150 this.$message.error({
151 message: '请选择删除项!',
152 showClose: true
153 })
154 return
155 }
156 this.$confirm('确定要删除吗?', '提示', {
157 confirmButtonText: '确定',
158 cancelButtonText: '取消',
159 type: 'warning'
160 })
161 .then(() => {
162 const ids = []
163 this.selectionRows.forEach(element => {
164 ids.push(element.id)
165 })
166 deleteAction(this.tableUrl, ids).then(res => {
167 if (res.status === 1) {
168 this.$message.success({ message: res.message, showClose: true })
169 this.loadData()
170 } else {
171 this.$message.error({ message: res.message, showClose: true })
172 }
173 })
174 })
175 .catch(() => {})
176 },
177 // 新增或修改成功时,重载列表
178 dialogFormOk() {
179 this.loadData()
180 },
181 // 导出
182 handleExportXls(data, name) {
183 if (name === '菜单' || name === '部门' || name === '机构' ||
184 name === '资源' || name === '资源分类' || name === '数据字典' || name === '行政区划') {
185 const params = this.getQueryParams() // 查询条件
186 getAction(this.tableUrl + '/export', params)
187 .then(res => {
188 if (res.status === 1) {
189 data = res.content
190 this.$downloadJson(data, name)
191 } else {
192 this.$message.error({ message: '导出失败', showClose: true })
193 }
194 })
195 } else if (name === '人员') {
196 exportUserList(this.queryParam).then((res) => {
197 if (res.status === 1) {
198 data = res.content
199 this.$downloadJson(data, name)
200 } else {
201 this.$message.error({ message: '导出失败', showClose: true })
202 }
203 })
204 } else {
205 this.$downloadJson(data, name)
206 }
207 },
208 /* 导入 */
209 handleImportExcel(info) {}
210 }
211 }
1 const deleteDomStr = content => {
2 return `<div class="customer-message-wrapper"><h5 class="title">您确认要执行该操作用于以下信息:</h5><p class="content">${content}</p><p class="result">执行后,数据将<span >无法恢复</span></p></div>`
3 }
4 export { deleteDomStr }
1 import Vue from 'vue'
2
3 // 下载,导出
4 Vue.prototype.$download = function(name, href) {
5 var a = document.createElement('a') // 创建a标签
6 var e = document.createEvent('MouseEvents') // 创建鼠标事件对象
7 e.initEvent('click', false, false) // 初始化事件对象
8 a.href = href // 设置下载地址
9 a.download = name // 设置下载文件名
10 a.dispatchEvent(e) // 给指定的元素,执行事件click事件
11 }
12 // 导出json文件
13 Vue.prototype.$downloadJson = function(data, name) {
14 // 1 生成文件的 blob 对象
15 const blobData = new Blob([JSON.stringify(data)], {
16 type: 'application/octet-stream'
17 })
18 // 2 手动生成文件的 url
19 const url = window.URL.createObjectURL(blobData)
20 // 3 创建 a 标签,模拟点击事件
21 const link = document.createElement('a')
22 link.href = url
23 // 3.1 重命名下载文件名称
24 link.download = `${name}.json`
25 document.body.appendChild(link)
26 const evt = document.createEvent('MouseEvents')
27 evt.initEvent('click', false, false)
28 link.dispatchEvent(evt)
29 document.body.removeChild(link)
30 }
31 const validConfig = [
32 {
33 validKey: 'idcard',
34 validRule: /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/,
35 message: '请输入正确的身份证号码'
36 },
37 {
38 validKey: 'email',
39 validRule: /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/,
40 message: '请输入正确的邮箱'
41 },
42 {
43 validKey: 'phoneNumber',
44 validRule: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
45 message: '请输入正确的手机号码'
46 }
47 ]
48 // 校验手机号
49 const checkTel = (rule, value, callback) => {
50 const phoneReg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/
51 const rel = /^[0]\d{2,3}-[1-9]\d{7}$/
52 // if (!value) return callback(new Error("请输入联系电话"));
53 setTimeout(() => {
54 if (value && !(phoneReg.test(value) || rel.test(value))) {
55 callback(new Error('请输入正确的联系电话'))
56 } else callback()
57 }, 500)
58 }
59 // 检验系统代码
60 const checkCode = (rule, value, callback) => {
61 const rel = /^[0-9A-Z]+$/
62 if (!value) return callback(new Error('请输入代码'))
63 setTimeout(() => {
64 if (value && !rel.test(value)) {
65 callback(new Error('只能为大写字母和数字'))
66 } else callback()
67 }, 500)
68 }
69 // 校验 idcard身份证号码 email邮箱 phoneNumber手机号码
70 // Vue.prototype.$validator = function(validName) {
71 // const findValidConfig = _.find(validConfig, function(v) {
72 // return v.validKey === validName
73 // })
74 // return validMethods
75
76 // function validMethods(rule, value, callback) {
77 // if (value) {
78 // findValidConfig.validRule.test(value)
79 // ? callback()
80 // : callback(findValidConfig.message)
81 // } else {
82 // callback()
83 // }
84 // }
85 // }
86 // 日期格式转换 "yyyy-MM-dd HH:mm:ss"
87 Vue.prototype.$formdate = function(date) {
88 if (!date) {
89 return ""
90 }
91 var d = new Date(date);
92 var YY = d.getFullYear() + '-';
93 var MM = (d.getMonth() + 1 < 10 ? '0' + (d.getMonth() + 1) : d.getMonth() + 1) + '-';
94 var DD = (d.getDate() < 10 ? '0' + (d.getDate()) : d.getDate());
95 var hh = (d.getHours() < 10 ? '0' + d.getHours() : d.getHours()) + ':';
96 var mm = (d.getMinutes() < 10 ? '0' + d.getMinutes() : d.getMinutes()) + ':';
97 var ss = (d.getSeconds() < 10 ? '0' + d.getSeconds() : d.getSeconds());
98 return YY + MM + DD +" "+hh + mm + ss
99 }
100 // 时间格式过滤
101 Vue.filter('timeFilter', function(timeStr) {
102 if (timeStr) {
103 return timeStr.substring(0, 10)
104 }
105 })
106 export function getType(o) {
107 return Object.prototype.toString.call(o).slice(8, -1)
108 }
109 export function isKeyType(o, type) {
110 return getType(o).toLowerCase() === type.toLowerCase()
111 }
112 // 深拷贝全局挂载
113 Vue.prototype.$deepCopy = function(sth) {
114 // 深度复制数组
115 // if (Object.prototype.toString.call(obj) === "[object Array]") {
116 // const object = [];
117 // for (let i = 0; i < obj.length; i++) {
118 // object.push(this.$deepCopy(obj[i]));
119 // }
120 // return object;
121 // }
122 // 深度复制对象
123 // if (Object.prototype.toString.call(obj) === "[object Object]") {
124 // const object = {};
125 // for (let p in obj) {
126 // object[p] = obj[p];
127 // }
128 // return object;
129 // }
130 let copy
131 if (sth === null || typeof sth !== 'object') return sth
132 if (isKeyType(sth, 'date')) {
133 copy = new Date()
134 copy.setTime(sth.getTime())
135 return copy
136 }
137 if (isKeyType(sth, 'array')) {
138 copy = []
139 for (let i = 0, len = sth.length; i < len; i++) {
140 copy[i] = Vue.prototype.$deepCopy(sth[i])
141 }
142 return copy
143 }
144 if (isKeyType(sth, 'object')) {
145 copy = {}
146 for (const attr in sth) {
147 if (sth.hasOwnProperty(attr)) {
148 copy[attr] = Vue.prototype.$deepCopy(sth[attr])
149 }
150 }
151 return copy
152 }
153 return null
154 }
155 // 递归处理树形数据children为空数组
156 Vue.prototype.$dealArrChildren = arr => {
157 if (arr.length) {
158 for (const i in arr) {
159 if (arr[i].children && arr[i].children.length) {
160 Vue.prototype.$dealArrChildren(arr[i].children)
161 } else {
162 arr[i].children = null
163 }
164 }
165 }
166 return arr
167 }
168 // 过滤对象中为空的属性
169 Vue.prototype.$filterNullObj = obj => {
170 if (!(typeof obj === 'object')) {
171 return
172 }
173 for (var key in obj) {
174 if (
175 obj.hasOwnProperty(key) &&
176 (obj[key] === null || obj[key] === undefined || obj[key] === '')
177 ) {
178 delete obj[key]
179 }
180 }
181 return obj
182 }
183 // 递归处理树形数据可选择项
184 Vue.prototype.$dealArrNotDisabled = arr => {
185 if (arr.length) {
186 for (const i in arr) {
187 if (arr[i].disabled) {
188 delete arr[i].disabled
189 if (arr[i].children) {
190 nodeDeal(arr[i].children)
191 }
192 // return false
193 }
194 if (arr[i].children) {
195 Vue.prototype.$dealArrNotDisabled(arr[i].children)
196 }
197 }
198 }
199 function nodeDeal(arr) {
200 arr.forEach(item => {
201 delete item.disabled
202 if (item.children) {
203 nodeDeal(item.children)
204 }
205 })
206 }
207 return arr
208 }
209 // 递归处理树形数据不可选择项
210 Vue.prototype.$dealArrDisabled = (arr, id) => {
211 if (arr.length) {
212 for (const i in arr) {
213 if (arr[i].id === id) {
214 arr[i]['disabled'] = true
215 if (arr[i].children) {
216 nodeDeal(arr[i].children)
217 }
218 // return false
219 }
220 if (arr[i].children) {
221 Vue.prototype.$dealArrDisabled(arr[i].children, id)
222 }
223 }
224 }
225 function nodeDeal(arr) {
226 arr.forEach(item => {
227 item['disabled'] = true
228 if (item.children) {
229 nodeDeal(item.children)
230 }
231 })
232 }
233 return arr
234 }
235 // 根据子节点id递归获取子节点路径id数组
236 Vue.prototype.$getNodeRoute = (val, id) => {
237 let cid_list = []
238 val.forEach((item, index) => {
239 if (item.id === id) {
240 cid_list = [item.id]
241 return false
242 } else {
243 if (item.children) {
244 const newCid_list = [item.id]
245 const list = nodefun(item.children, id, newCid_list)
246 if (list) {
247 cid_list = list
248 }
249 }
250 }
251 })
252 function nodefun(newVal, newId, newCid_list) {
253 let flag = false
254 newVal.forEach(j => {
255 // console.log(j)
256 if (j.id === newId) {
257 newCid_list.push(j.id)
258 flag = true
259 } else {
260 if (j.children) {
261 const cid_list = JSON.parse(JSON.stringify(newCid_list))
262 cid_list.push(j.id)
263 const list = nodefun(j.children, newId, cid_list)
264 if (list) {
265 newCid_list = list
266 flag = true
267 }
268 }
269 }
270 })
271 if (flag) {
272 return newCid_list
273 }
274 }
275 function result(cid_list) {
276 const arr = cid_list.concat()
277 arr.pop()
278 return arr
279 }
280 return result(cid_list)
281 }
282 // 扁平化树形数组
283 Vue.prototype.$treeConvertToArr = tree => {
284 let arrs = []
285 const result = []
286 arrs = arrs.concat(tree)
287 while (arrs.length) {
288 const first = arrs.shift()
289 if (first.children) {
290 // 如果有children
291 arrs = arrs.concat(first.children)
292 delete first['children']
293 }
294 result.push(first)
295 }
296 return result
297 }
298
299 /**
300 * 递归获取树形数组的所有父节点
301 * @param {*} list 树形数组
302 * @param {*} id 当前子节点判断条件parentId
303 * @returns
304 */
305 Vue.prototype.$findParent = (list, id) => {
306 for (const i in list) {
307 if (list[i].id === id) {
308 return [list[i]]
309 }
310 if (list[i].children) {
311 const node = Vue.prototype.$findParent(list[i].children, id)
312 if (node !== undefined) {
313 return node.concat(list[i])
314 }
315 }
316 }
317 }
318
319 /**
320 * 递归获取树形数组当前点击节点的子节点
321 * @param {*} list 树形数组
322 * @param {*} nodeId 当前点击id
323 * @returns
324 */
325 Vue.prototype.$findChildren = (list, nodeId) => {
326 let newArray = []
327 let flag = false
328 function dealList(list, nodeId) {
329 if (list.length !== 0) {
330 list.forEach(item => {
331 if (!flag) {
332 if (item.id === nodeId) {
333 flag = true
334 newArray = item.children
335 } else if (item.children !== null) {
336 newArray = dealList(item.children, nodeId)
337 }
338 }
339 })
340 }
341 return newArray
342 }
343 return dealList(list, nodeId)
344 }
345 /**
346 * 给子节点添加属性
347 * @param {*} list 树形数组
348 * @param {*} findIndex 操作符第几项
349 * @param {*} flag 属性状态
350 * @returns
351 */
352 Vue.prototype.$setChildren = (arr, findIndex, flag) => {
353 if (arr.length) {
354 for (let i = 0; i < arr.length; i++) {
355 if (arr[i].children && arr[i].children.length) {
356 arr[i].checkArr[findIndex].value = flag
357 Vue.prototype.$setChildren(arr[i].children, findIndex, flag)
358 } else {
359 arr[i].checkArr[findIndex].value = flag
360 }
361 }
362 }
363 return arr
364 }
365 /**
366 * 根据情况联动checkout
367 * @param {*} arr 数组
368 * @param {*} id 当前点击的id
369 * @param {*} checkId 操作符类型
370 * @param {*} flag 选中状态
371 * @param {*} items 当前点击子节点同级节点
372 * @param {*} parentList 父级菜单
373 * @param {*} childList 子级菜单
374 */
375 Vue.prototype.$setChildArr = (
376 arr,
377 id,
378 checkId,
379 flag,
380 items,
381 parentList,
382 childList
383 ) => {
384 if (arr.length) {
385 for (const i in arr) {
386 if (arr[i].id === id) {
387 const wholeArr = Vue.prototype.$deepCopy(items)
388 const treeConvertArr = Vue.prototype.$treeConvertToArr(wholeArr)
389 if (arr[i].children && arr[i].children.length !== 0) {
390 // 勾选父级子级全部勾选 取消父级子级全部取消
391 // for (let j = 0; j < arr[i].children.length; j++) {
392 // let findIndex = arr[i].children[j].checkArr.findIndex((item) => item.id === checkId);
393 // arr[i].children[j].checkArr[findIndex].value = flag
394 // }
395
396 const findIndex = arr[i].checkArr.findIndex(
397 item => item.id === checkId
398 )
399 Vue.prototype.$setChildren(childList, findIndex, flag)
400 }
401 if (flag === true && parentList !== undefined) {
402 // 子级若有一个选中,则父级选中
403 const isFlagCheck = treeConvertArr.some(val => {
404 const checkIndex = val.checkArr.findIndex(
405 item => item.id === checkId
406 )
407 return val.checkArr[checkIndex].value === true
408 })
409 if (isFlagCheck === true) {
410 parentList.forEach(parent => {
411 const checkIndex = parent.checkArr.findIndex(
412 item => item.id === checkId
413 )
414 parent.checkArr[checkIndex].value = true
415 })
416 }
417 } else if (flag === false && parentList !== undefined) {
418 // 子级若都没选中,则父级不选中
419 const isFlagFalse = treeConvertArr.every(val => {
420 const checkIndex = val.checkArr.findIndex(
421 item => item.id === checkId
422 )
423 return val.checkArr[checkIndex].value === false
424 })
425 if (isFlagFalse === true) {
426 parentList.forEach(parent => {
427 const checkIndex = parent.checkArr.findIndex(
428 item => item.id === checkId
429 )
430 parent.checkArr[checkIndex].value = false
431 })
432 }
433 }
434 }
435 if (arr[i].children && arr[i].children.length !== 0) {
436 Vue.prototype.$setChildArr(
437 arr[i].children,
438 id,
439 checkId,
440 flag,
441 items,
442 parentList,
443 childList
444 )
445 }
446 }
447 }
448 }
449 // 处理localStorage获取值转换boolean为string问题 json字符串转为json
450 Vue.prototype.$getLocalStorage = (name, type) => {
451 let data = localStorage.getItem(name)
452 if (type === 'boolean') {
453 if (data === 'false') {
454 data = false
455 } else {
456 data = true
457 }
458 return data
459 }
460 if (type === 'object') {
461 data = JSON.parse(data)
462 return data
463 }
464 return data
465 }
466
467 export default {
468 checkTel,
469 checkCode
470 }
1 <template>
2 <div class="content">
3 <div class="user-info">
4 <el-form
5 ref="form"
6 label-width="100px"
7 :model="form"
8 class="form-wrapper"
9 :rules="rules"
10 >
11 <el-form-item label="用户名:" required>
12 <el-input v-model="form.loginName" clearable disabled />
13 </el-form-item>
14 <el-form-item label="姓名:">
15 <el-input v-model="form.name" clearable />
16 </el-form-item>
17 <el-form-item label="性别:">
18 <el-radio-group v-model="form.sex">
19 <el-radio
20 v-for="(item, index) in sexList"
21 :key="index"
22 :label="item.value"
23 >{{ item.name }}</el-radio
24 >
25 </el-radio-group>
26 </el-form-item>
27 <el-form-item label="身份证号:" prop="idCard">
28 <el-input v-model="form.idCard" clearable />
29 </el-form-item>
30 <el-form-item label="手机号码:" prop="mobilePhone">
31 <el-input v-model="form.mobilePhone" clearable />
32 </el-form-item>
33 <el-form-item label="办公电话:" prop="telephone">
34 <el-input v-model="form.telephone" clearable />
35 </el-form-item>
36 <el-form-item label="办公地址:">
37 <el-input v-model="form.address" clearable />
38 </el-form-item>
39 </el-form>
40 <div class="bottom-wrapper">
41 <el-button type="primary" @click="updateInfo">更新信息</el-button>
42 </div>
43 </div>
44 </div>
45 </template>
46
47 <script>
48 // import { api, getAction, putAction, getDictItems } from '@api/manageApi'
49 export default {
50 props: {
51 // userInfo: {
52 // type: Object,
53 // default: null
54 // }
55 },
56 data() {
57 return {
58 form: {
59 id: "3127e455-43ba-45ff-9326-0e02ef89485e",
60 name: "超级管理员",
61 sort: 1,
62 loginName: "admin",
63 email: null,
64 lastLoginTime: null,
65 mobilePhone: "18291003568",
66 isLocked: false,
67 status: "ACTIVE",
68 passwordChangeTime: "2021-12-10T08:01:01.569+0000",
69 idCard: "612725202111021521",
70 departmentId: "2eae5304-544f-4f5b-b354-8f5d47433c9b",
71 departmentName: null,
72 organizationId: "0bca67ae-1d9e-4b41-b057-f165586d24aa",
73 sex: "0",
74 isDuty: true,
75 code: "123324",
76 jobLevel: null,
77 telephone: "028-87720898",
78 address: "办公地点修改测试",
79 },
80 sexList: [],
81 rules: {
82 mobilePhone: [
83 {
84 pattern:
85 /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/,
86 message: "手机号码格式有误",
87 trigger: "blur",
88 },
89 ],
90 idCard: [
91 {
92 pattern: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
93 message: "身份证号格式有误",
94 trigger: "blur",
95 },
96 ],
97 telephone: [
98 {
99 pattern: /\d{3}-\d{8}|\d{4}-\d{7}/,
100 message: "办公电话格式有误",
101 trigger: "blur",
102 },
103 ],
104 },
105 };
106 },
107 watch: {
108 // userInfo: {
109 // handler: function(val) {
110 // if (val) {
111 // this.getUserInfo(val.id)
112 // }
113 // }
114 // }
115 },
116 mounted() {
117 // getDictItems('XB').then((res) => {
118 // if (res.status === 1) {
119 this.sexList = [
120 {
121 id: "079c72b2-f3de-4a4f-b2a1-e5c8f085cc5f",
122 createdAt: "2021-06-11T02:42:02.000+0000",
123 updatedAt: "2021-09-03T09:21:46.000+0000",
124 createdBy: "3127e455-43ba-45ff-9326-0e02ef89485e",
125 updatedBy: "3127e455-43ba-45ff-9326-0e02ef89485e",
126 sort: 2,
127 name: "男",
128 description: "",
129 code: "N362",
130 value: "0",
131 parentId: null,
132 baseDataCategoryId: "11441374-5e2a-4635-bfa5-d1a430222019",
133 version: 1,
134 valid: true,
135 standard: false,
136 standardName: null,
137 standardValue: null,
138 children: [],
139 commonName: "男(N362)",
140 },
141 {
142 id: "4d6f845d-6f6a-4848-8fc2-a3760764c196",
143 createdAt: "2021-06-11T02:42:12.000+0000",
144 updatedAt: "2021-09-03T09:21:46.000+0000",
145 createdBy: "3127e455-43ba-45ff-9326-0e02ef89485e",
146 updatedBy: "3127e455-43ba-45ff-9326-0e02ef89485e",
147 sort: 1,
148 name: "女",
149 description: "",
150 code: "N922",
151 value: "1",
152 parentId: null,
153 baseDataCategoryId: "11441374-5e2a-4635-bfa5-d1a430222019",
154 version: 1,
155 valid: true,
156 standard: false,
157 standardName: null,
158 standardValue: null,
159 children: [],
160 commonName: "女(N922)",
161 },
162 {
163 id: "637c360b-d4e2-4afb-aa18-33624cf3abcb",
164 createdAt: "2021-06-11T02:42:29.000+0000",
165 updatedAt: "2021-09-03T09:21:43.000+0000",
166 createdBy: "3127e455-43ba-45ff-9326-0e02ef89485e",
167 updatedBy: "3127e455-43ba-45ff-9326-0e02ef89485e",
168 sort: 0,
169 name: "保密",
170 description: "",
171 code: "BM816",
172 value: "2",
173 parentId: null,
174 baseDataCategoryId: "11441374-5e2a-4635-bfa5-d1a430222019",
175 version: 1,
176 valid: true,
177 standard: false,
178 standardName: null,
179 standardValue: null,
180 children: [],
181 commonName: "保密(BM816)",
182 },
183 ];
184 // } else {
185 // this.$message.error({ message: res.message, showClose: true })
186 // }
187 // })
188 },
189 methods: {
190 // getUserInfo(id) {
191 // getAction(`${api.users}/${id}`).then((res) => {
192 // if (res.status === 1) {
193
194 // } else {
195 // this.$message.error({ message: res.message, showClose: true })
196 // }
197 // })
198 // },
199 // 更新信息
200 updateInfo() {
201 // this.$refs.form.validate((valid) => {
202 // if (valid) {
203 // putAction(`${api.users}/${this.form.id}`, this.form).then((res) => {
204 // if (res.status === 1) {
205 // this.$message.success({ message: res.message, showClose: true })
206 // this.getUserInfo(this.form.id)
207 // } else {
208 // this.$message.error({ message: res.message, showClose: true })
209 // }
210 // })
211 // }
212 // })
213 },
214 },
215 };
216 </script>
217
218 <style scoped lang="scss">
219 .user-info {
220 margin: 0.1875rem 1.0417rem;
221 background: #ffffff;
222 max-height: 90%;
223 overflow-y: auto;
224 .form-wrapper {
225 padding: 24px 120px 0px;
226 .el-form-item {
227 margin-bottom: 24px;
228 .el-form-item__label {
229 color: #747e8c;
230 }
231 ::v-deep .el-input .el-input__inner {
232 padding: 0 8px;
233 height: 40px;
234 line-height: 40px;
235 border: 1px solid #6BC1FC;
236 }
237 }
238 }
239 .bottom-wrapper {
240 padding: 32px 120px 24px;
241 text-align: right;
242 }
243 }
244 </style>
1 <template>
2 <div class="information from-clues">
3 <div class="from-clues-header">
4 <el-form ref="ruleForm" label-width="100px">
5 <el-form-item>
6 <Breadcrumb />
7 </el-form-item>
8 <el-row class="mb-5">
9 <el-col :span="3" class="btnColRight">
10 <btn nativeType="cx" @click="information">基本信息</btn>
11 <btn nativeType="cx" @click="password">修改密码</btn>
12 </el-col>
13 </el-row>
14 </el-form>
15 </div>
16 <div class="from-clues-content">
17 <div class="contentbox">
18 <base-set v-show="isshow" />
19 <password-edit v-show="!isshow" />
20 </div>
21 </div>
22 </div>
23 </template>
24 <script>
25 import "@/utils/flexible.js";
26 import BaseSet from "./base-set.vue";
27 import PasswordEdit from "./password-edit.vue";
28 export default {
29 components: {
30 BaseSet,
31 PasswordEdit,
32 },
33 data() {
34 return {
35 active: "baseSet",
36 isshow: true,
37 };
38 },
39 computed: {},
40 watch: {},
41 created() {},
42 mounted() {},
43 methods: {
44 information() {
45 this.isshow = true;
46 },
47 password() {
48 this.isshow = false;
49 },
50 },
51 };
52 </script>
53
54 <style scoped lang="scss">
55 @import "~@/styles/mixin.scss";
56 @import "~@/styles/public.scss";
57 .information{
58 .btnColRight{
59 margin-top: 20px;
60 }
61 /deep/.content {
62 .el-input__inner{
63 background: none;
64 }
65 .user-info {
66 background: none;
67 }
68 }
69 /deep/.el-tabs {
70
71 .el-tabs__content {
72 height: 100%;
73 width: 100%;
74
75
76 }
77 }
78 .contentbox{
79 height: 3.0854rem;
80 }
81 }
82
83 </style>
1 <template>
2 <div class="content">
3 <div class="user-info">
4 <el-form
5 ref="form"
6 label-width="100px"
7 :model="form"
8 class="form-wrapper"
9 :rules="rules"
10 >
11 <el-form-item label="旧密码:" required prop="oldPassword">
12 <el-input
13 v-model="form.oldPassword"
14 clearable
15 type="password"
16 show-password
17 />
18 </el-form-item>
19 <el-form-item label="新密码:" required prop="newPassword">
20 <el-input
21 v-model="form.newPassword"
22 clearable
23 type="password"
24 show-password
25 />
26 </el-form-item>
27 <el-form-item label="确认密码:" required prop="confirmPassword">
28 <el-input
29 v-model="form.confirmPassword"
30 clearable
31 type="password"
32 show-password
33 />
34 </el-form-item>
35 </el-form>
36 <div class="bottom-wrapper">
37 <el-button type="primary" @click="updatePassword">确认修改</el-button>
38 </div>
39 </div>
40 </div>
41 </template>
42
43 <script>
44 // import { updateUserPassword } from '@api/organizationManage'
45 export default {
46 props: {
47 // userInfo: {
48 // type: Object,
49 // default: null
50 // }
51 },
52 data() {
53 return {
54 form: {},
55 sexList: [],
56 userId: '',
57 rules: {
58 oldPassword: [
59 { required: true, message: '旧密码不能为空', trigger: 'blur' }
60 ],
61 newPassword: [
62 { required: true, message: '新密码不能为空', trigger: 'blur' }
63 ],
64 confirmPassword: [
65 { required: true, message: '确认密码不能为空', trigger: 'blur' },
66 { validator: this.validatorConfirmPassword, trigger: 'blur' }
67 ]
68 }
69 }
70 },
71 computed: {},
72 watch: {
73 // userInfo: {
74 // handler: function(val) {
75 // if (val) {
76 // this.userId = val.id
77 // }
78 // }
79 // }
80 },
81 mounted() {},
82 methods: {
83 validatorConfirmPassword(rule, value, callback) {
84 const { newPassword } = this.form
85 if (value !== newPassword) {
86 callback('两次输入密码不一致')
87 } else {
88 callback()
89 }
90 },
91 // 确认修改
92 updatePassword() {
93 // this.$refs.form.validate((valid) => {
94 // if (valid) {
95 // const params = Object.assign({}, this.form, { id: this.userId })
96 // updateUserPassword(params).then((res) => {
97 // if (res.status === 1) {
98 // this.$message.success({ message: res.message, showClose: true })
99 // } else {
100 // this.$message.error({ message: res.message, showClose: true })
101 // }
102 // })
103 // }
104 // })
105 }
106 }
107 }
108 </script>
109
110 <style scoped lang="scss">
111 .user-info {
112 margin: 36px 200px;
113 background: #ffffff;
114 max-height: 90%;
115 overflow-y: auto;
116 .form-wrapper {
117 padding: 24px 120px 0px;
118 .el-form-item {
119 margin-bottom: 24px;
120 .el-form-item__label {
121 color: #747e8c;
122 }
123 ::v-deep .el-input .el-input__inner {
124 padding: 0 8px;
125 height: 40px;
126 line-height: 40px;
127 border: 1px solid #6BC1FC;
128 }
129 }
130 }
131 .bottom-wrapper {
132 padding: 32px 120px 24px;
133 text-align: right;
134 }
135 }
136 </style>
...@@ -11,18 +11,7 @@ ...@@ -11,18 +11,7 @@
11 <el-row :gutter="24"> 11 <el-row :gutter="24">
12 <el-col :span="12"> 12 <el-col :span="12">
13 <el-form-item label="菜单名称:" prop="name" label-width="124px"> 13 <el-form-item label="菜单名称:" prop="name" label-width="124px">
14 <el-input v-model="form.name" placeholder="菜单名称" /> 14 <el-input v-model="form.name" placeholder="请输入菜单名称" />
15 </el-form-item>
16 </el-col>
17 <el-col :span="12">
18 <el-form-item label="图标:" label-width="54px">
19 <el-input
20 v-model="form.icon"
21 placeholder="图标"
22 :prefix-icon="form.icon"
23 clearable
24 @focus="getIconList"
25 />
26 </el-form-item> 15 </el-form-item>
27 </el-col> 16 </el-col>
28 </el-row> 17 </el-row>
...@@ -34,17 +23,20 @@ ...@@ -34,17 +23,20 @@
34 v-model="form.parentId" 23 v-model="form.parentId"
35 :options="parentMenuList" 24 :options="parentMenuList"
36 :props="setProps" 25 :props="setProps"
37 placeholder="上级菜单" 26 placeholder="请选择上级菜单"
38 clearable 27 clearable
39 @change="handleChange" 28 @change="handleChange"
40 /> 29 />
41 </el-form-item> 30 </el-form-item>
42 </el-col> 31 </el-col>
32
33 </el-row>
34 <el-row :gutter="24">
43 <el-col :span="12"> 35 <el-col :span="12">
44 <el-form-item label="代码:" prop="code" label-width="54px"> 36 <el-form-item label="代码:" prop="code" label-width="54px">
45 <el-input 37 <el-input
46 v-model="codeComputed" 38 v-model="codeComputed"
47 placeholder="菜单代码" 39 placeholder="请输入菜单代码"
48 :disabled="type === 1" 40 :disabled="type === 1"
49 /> 41 />
50 </el-form-item> 42 </el-form-item>
...@@ -53,7 +45,7 @@ ...@@ -53,7 +45,7 @@
53 <el-row :gutter="24"> 45 <el-row :gutter="24">
54 <el-col :span="24"> 46 <el-col :span="24">
55 <el-form-item label="链接路径:" label-width="124px"> 47 <el-form-item label="链接路径:" label-width="124px">
56 <el-input v-model="form.uri" placeholder="链接路径" /> 48 <el-input v-model="form.uri" placeholder="请输入链接路径" />
57 </el-form-item> 49 </el-form-item>
58 </el-col> 50 </el-col>
59 </el-row> 51 </el-row>
...@@ -62,7 +54,7 @@ ...@@ -62,7 +54,7 @@
62 <el-form-item label="浏览器跳转模式:" label-width="124px"> 54 <el-form-item label="浏览器跳转模式:" label-width="124px">
63 <el-select 55 <el-select
64 v-model="form.jumpMode" 56 v-model="form.jumpMode"
65 placeholder="浏览器跳转模式" 57 placeholder="请选择浏览器跳转模式"
66 > 58 >
67 <el-option 59 <el-option
68 v-for="item in jumpModeList" 60 v-for="item in jumpModeList"
...@@ -93,7 +85,12 @@ ...@@ -93,7 +85,12 @@
93 </template> 85 </template>
94 <template slot="footer"> 86 <template slot="footer">
95 <el-button class="cancel-button" @click="close()">取消</el-button> 87 <el-button class="cancel-button" @click="close()">取消</el-button>
96 <el-button type="primary" @click="submitForm()">保存</el-button> 88
89
90 <el-button
91 type="primary"
92 @click="submitForm()"
93 >保存</el-button>
97 </template> 94 </template>
98 </Dialog> 95 </Dialog>
99 <!-- 图标列表 --> 96 <!-- 图标列表 -->
...@@ -103,50 +100,56 @@ ...@@ -103,50 +100,56 @@
103 100
104 <script> 101 <script>
105 import Dialog from "@/components/Dialog/"; 102 import Dialog from "@/components/Dialog/";
106 // import JsonEditor from '@components/JsonEditors' 103 import { getParentMenuListAction } from '@/api/quanxianmanagement'
107 import JsonEditor from '../../../components/JsonEditors' 104 import JsonEditor from '@/components/JsonEditors'
108 // import IconList from '@components/IconList' 105 import IconList from '@/components/IconList'
109 import IconList from '../../../components/IconList' 106 import { validateCode } from '@/utils/validate';
110 import { validateCode } from '../../../utils/validate'; 107 import { api, httpAction } from '@/api/manageApi'
111 export default { 108 export default {
112 name: "EditDialog", 109 name: 'MenuModal',
113 components: { 110 components: {
114 Dialog,
115 JsonEditor,
116 IconList, 111 IconList,
112 JsonEditor,
113 Dialog
114 },
115 props: {
116 productId: {
117 type: String,
118 default: ''
119 }
117 }, 120 },
118 data() { 121 data() {
119 return { 122 return {
120 form: { 123 form: {
121 icon: "", 124 icon: '',
122 code: "", 125 code: ''
123 }, 126 },
124 rules: { 127 rules: {
125 name: [{ required: true, message: "请输入菜单名称", trigger: "blur" }], 128 name: [{ required: true, message: '请输入菜单名称', trigger: 'blur' }],
126 code: [ 129 code: [
127 { required: true, message: "必填", trigger: "blur" }, 130 { required: true, message: '必填', trigger: 'blur' },
128 { validator: validateCode, trigger: "blur" }, 131 { validator: validateCode, trigger: 'blur' }
129 ], 132 ]
130 }, 133 },
131 title: "", 134 title: '',
132 type: "", 135 type: '',
133 visible: false, 136 visible: false,
134 parentMenuList: [], 137 parentMenuList: [],
135 menuKey: 0, 138 menuKey: 0,
136 jumpModeList: [ 139 jumpModeList: [
137 { name: "在当前页面显示", value: 1 }, 140 { name: '在当前页面显示', value: 1 },
138 { name: "跳转到新页面", value: 2 }, 141 { name: '跳转到新页面', value: 2 }
139 ], 142 ],
140 setProps: { 143 setProps: {
141 value: "id", 144 value: 'id',
142 label: "name", 145 label: 'name',
143 children: "children", 146 children: 'children',
144 expandTrigger: "hover", 147 expandTrigger: 'hover',
145 checkStrictly: true, // 可取消关联,选择任意一级选项 148 checkStrictly: true, // 可取消关联,选择任意一级选项
146 emitPath: false, 149 emitPath: false
147 }, 150 },
148 // dataUrl: api.menus, 151 dataUrl: api.menus
149 }; 152 }
150 }, 153 },
151 computed: { 154 computed: {
152 codeComputed: { 155 codeComputed: {
...@@ -161,136 +164,120 @@ export default { ...@@ -161,136 +164,120 @@ export default {
161 created() {}, 164 created() {},
162 mounted() {}, 165 mounted() {},
163 methods: { 166 methods: {
164 getParentMenuList() { 167 // 获取父级菜单
165 // getParentMenuListAction(id).then((res) => { 168 getParentMenuList(id) {
166 // if (res.status === 1) { 169 getParentMenuListAction(id).then((res) => {
167 // const list = this.$dealArrChildren(res.content) 170 if (res.status === 1) {
168 // if (id) { 171 const list = this.$dealArrChildren(res.content)
169 // this.parentMenuList = this.$dealArrDisabled( 172 if (id) {
170 // this.$deepCopy(list), 173 this.parentMenuList = this.$dealArrDisabled(
171 // id 174 this.$deepCopy(list),
172 // ) 175 id
173 // this.menuKey++ 176 )
174 // } else { 177 this.menuKey++
175 // this.parentMenuList = list 178 } else {
176 // } 179 this.parentMenuList = list
177 // } else { 180 }
178 // this.$message.error({ message: res.message, showClose: true }) 181 } else {
179 // } 182 this.$message.error({ message: res.message, showClose: true })
180 // }) 183 }
184 })
181 }, 185 },
182 getIconList() { 186 getIconList() {
183 this.$refs.iconList.show(true); 187 this.$refs.iconList.show(true)
184 }, 188 },
185 // 选择图标
186 getIconName(data) { 189 getIconName(data) {
187 this.form.icon = data; 190 this.form.icon = data
188 }, 191 },
192 // 配置参数
189 getJsonString(data) { 193 getJsonString(data) {
190 this.form.metadata = data; 194 this.form.metadata = data
191 }, 195 },
196 // 新增菜单
192 add() { 197 add() {
193 // console.log(this.productId) 198 this.getParentMenuList(this.productId)
194 // if (!this.productId) { 199 this.visible = true
195 // this.$message.info({ 200 this.type = 0
196 // message: '请先选择子系统才能添加菜单,如果没有,请先添加子系统!', 201 this.form.jumpMode = 1
197 // showClose: true
198 // })
199 // return
200 // }
201 // this.getParentMenuList(this.productId)
202 this.visible = true;
203 // this.type = 0
204 // this.form.jumpMode = 1
205 }, 202 },
203 // 编辑菜单
206 edit(record) { 204 edit(record) {
205 this.type = 1
207 // 若有id为编辑 206 // 若有id为编辑
208 if (record.id) { 207 if (record.id) {
209 this.$nextTick(() => { 208 this.$nextTick(() => {
210 this.form = Object.assign({}, record) 209 this.form = Object.assign({}, record)
211 // this.getParentMenuList(this.productId) 210 this.getParentMenuList(this.productId)
212 }) 211 })
213 } 212 }
214 this.visible = true; 213 this.visible = true
215 }, 214 },
215 // 选择上级菜单
216 handleChange(value) { 216 handleChange(value) {
217 // this.form.parentId = value 217 this.form.parentId = value
218 }, 218 },
219 // 保存
219 submitForm(submitType) { 220 submitForm(submitType) {
220 // this.$refs.form.validate((valid) => { 221 this.$refs.form.validate((valid) => {
221 // if (valid) { 222 if (valid) {
222 // let method = ""; 223 let method = ''
223 // let url = ""; 224 let url = ''
224 // const formData = this.form; 225 const formData = this.form
225 // formData.productId = this.productId; 226 formData.productId = this.productId
226 // if (!formData.id) { 227 if (!formData.id) {
227 // method = "post"; 228 method = 'post'
228 // url = this.dataUrl; 229 url = this.dataUrl
229 // } else { 230 } else {
230 // method = "put"; 231 method = 'put'
231 // url = `${this.dataUrl}/${formData.id}`; 232 url = `${this.dataUrl}/${formData.id}`
232 // } 233 }
233 // httpAction(url, formData, method) 234 httpAction(url, formData, method)
234 // .then((res) => { 235 .then((res) => {
235 // if (res.status === 1) { 236 if (res.status === 1) {
236 // this.$message.success({ 237 this.$message.success({
237 // message: res.message, 238 message: res.message,
238 // showClose: true, 239 showClose: true
239 // }); 240 })
240 // // this.$emit("ok"); 241
241 // // this.type 0新增 1编辑 2添加子 242 this.resetForm()
242 // if (this.type === 0) { 243 this.$emit('ok')
243 // if (submitType === 1) { 244 } else {
244 // this.close(); 245 this.$message.error({ message: res.message, showClose: true })
245 // } else { 246 }
246 // this.resetForm(); 247 })
247 // } 248 .catch((err) => {
248 // } else if (this.type === 1) { 249 console.log(err)
249 // this.close(); 250 })
250 // } else if (this.type === 2) { 251 }
251 // if (submitType === 1) { 252 })
252 // this.close();
253 // } else {
254 // this.resetForm();
255 // this.form.parentId = formData.parentId;
256 // }
257 // }
258 // this.$emit("ok");
259 // } else {
260 // this.$message.error({ message: res.message, showClose: true });
261 // }
262 // })
263 // .catch((err) => {
264 // console.log(err);
265 // });
266 // }
267 // });
268 }, 253 },
269 resetForm() { 254 resetForm() {
270 this.$refs.form.resetFields(); 255 this.$refs.form.resetFields()
271 this.form = { 256 this.form = {
272 icon: "", 257 icon: '',
273 code: "", 258 code: ''
274 }; 259 }
275 }, 260 },
276 close() { 261 close() {
277 this.resetForm(); 262 this.resetForm()
278 this.visible = false; 263 this.visible = false
279 }, 264 }
280 }, 265 }
281 }; 266 }
282 </script> 267 </script>
283 <style scoped lang="scss"> 268 <style scoped lang="scss">
284 /deep/.el-input__inner { 269 /deep/.el-dialog__header {
285 background: #07388B; 270 text-align: center;
286 border-radius: 2px; 271 margin-bottom: 10px;
287 border: 1px solid #6BC1FC; 272 .el-dialog__title {
273 color: white;
288 } 274 }
289 /deep/.el-textarea__inner{
290 background: #07388B;
291 color: #fff;
292 } 275 }
276
293 /deep/.el-form-item__label{ 277 /deep/.el-form-item__label{
294 color:#fff; 278 color: white;
279 }
280 /deep/.el-input__inner{
281 background-color: #07388B;
295 } 282 }
296 </style> 283 </style>
......
...@@ -14,186 +14,38 @@ ...@@ -14,186 +14,38 @@
14 </div> 14 </div>
15 <div class="from-clues-content"> 15 <div class="from-clues-content">
16 <lb-table 16 <lb-table
17 :pagination="false"
17 :column="tableData.columns" 18 :column="tableData.columns"
18 :data="tabledata" 19 :data="tablelistData"
19 row-key="id" 20 row-key="id"
20 default-expand-all 21 default-expand-all
21 :tree-props="{ children: 'children', hasChildren: 'hasChildren' }" 22 :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
22 > 23 >
23 </lb-table> 24 </lb-table>
24 </div> 25 </div>
25 <edit-dialog ref="dialogForm" /> 26 <edit-dialog ref="dialogForm"
26 <authorizationdiglog ref="rolesForm" /> 27 :product-id="productId"
28 :resource-category-id="resourceCategoryId"
29 @ok="reloadTableData"/>
30 <!-- <authorizationdiglog ref="rolesForm" /> -->
27 </div> 31 </div>
28 </template> 32 </template>
29 <script> 33 <script>
30 // 定时任务 34 // 定时任务
31 import data from "./data"; 35 import data from "./data";
36 import { deleteAction, getAction, api } from "@/api/manageApi";
32 import EditDialog from "./edit-dialog.vue"; 37 import EditDialog from "./edit-dialog.vue";
33 import authorizationdiglog from "./authorizationdiglog.vue"; 38 // import authorizationdiglog from "./authorizationdiglog.vue";
34 export default { 39 export default {
35 name: "menus", 40 name: "menus",
36 components: { 41 components: {
37 EditDialog, 42 EditDialog,
38 authorizationdiglog, 43 // authorizationdiglog,
39 }, 44 },
40 data() { 45 data() {
41 return { 46 return {
42 tabledata: [ 47 tablelistData: [],
43 { 48 resourceCategoryId:"",
44 id: "c6221838-187b-4a7a-b173-b0543022f560",
45 createdAt: "2021-08-26T07:00:07.101+0000",
46 updatedAt: "2021-08-26T07:00:07.101+0000",
47 createdBy: "3127e455-43ba-45ff-9326-0e02ef89485e",
48 updatedBy: "3127e455-43ba-45ff-9326-0e02ef89485e",
49 sort: 35,
50 name: "概览",
51 code: "GL",
52 description: null,
53 uri: null,
54 parentId: null,
55 state: null,
56 style: null,
57 icon: "",
58 jumpMode: 1,
59 productId: "d798323e-8834-4417-bbb8-837b8d13e7d5",
60 resourceCategoryId: "d798323e-8834-4417-bbb8-837b8d585656",
61 metadata: null,
62 children: [
63 {
64 id: "abf28772-a719-44bd-b461-f63ab9e0a53d",
65 createdAt: "2022-03-04T08:08:25.703+0000",
66 updatedAt: "2022-03-04T09:21:19.578+0000",
67 createdBy: "3127e455-43ba-45ff-9326-0e02ef89485e",
68 updatedBy: "3127e455-43ba-45ff-9326-0e02ef89485e",
69 sort: 197,
70 name: "资源概览",
71 code: "ZYGL2",
72 description: null,
73 uri: "/admin/#/resource-overview",
74 parentId: "c6221838-187b-4a7a-b173-b0543022f560",
75 state: null,
76 style: null,
77 icon: "",
78 jumpMode: 1,
79 productId: "d798323e-8834-4417-bbb8-837b8d13e7d5",
80 resourceCategoryId: "d798323e-8834-4417-bbb8-837b8d585656",
81 metadata:
82 '{"icon":"resource-overview","iconActive":"resource-overview-active"}',
83 children: null,
84 },
85 {
86 id: "06a0807e-11f5-4046-b245-3bb7b835b1c5",
87 createdAt: "2022-03-04T08:09:18.106+0000",
88 updatedAt: "2022-03-04T09:21:24.292+0000",
89 createdBy: "3127e455-43ba-45ff-9326-0e02ef89485e",
90 updatedBy: "3127e455-43ba-45ff-9326-0e02ef89485e",
91 sort: 196,
92 name: "访问概览",
93 code: "FWGL",
94 description: null,
95 uri: "/admin/#/access-overview",
96 parentId: "c6221838-187b-4a7a-b173-b0543022f560",
97 state: null,
98 style: null,
99 icon: "",
100 jumpMode: 1,
101 productId: "d798323e-8834-4417-bbb8-837b8d13e7d5",
102 resourceCategoryId: "d798323e-8834-4417-bbb8-837b8d585656",
103 metadata:
104 '{"icon":"access-overview","iconActive":"access-overview-active"}',
105 children: null,
106 },
107 ],
108 },
109 {
110 id: "f94c92cb-a032-4b89-8722-79dbcc331894",
111 createdAt: null,
112 updatedAt: null,
113 createdBy: null,
114 updatedBy: null,
115 sort: 59,
116 name: "资源管理",
117 code: "ZYGL",
118 description: null,
119 uri: null,
120 parentId: null,
121 state: null,
122 style: null,
123 icon: "",
124 jumpMode: 1,
125 productId: "d798323e-8834-4417-bbb8-837b8d13e7d5",
126 resourceCategoryId: "d798323e-8834-4417-bbb8-837b8d585656",
127 metadata: null,
128 children: [
129 {
130 id: "065fe2d7-d59a-442c-92d0-c91aa19d7fae",
131 createdAt: null,
132 updatedAt: "2021-11-11T09:40:08.951+0000",
133 createdBy: null,
134 updatedBy: "3127e455-43ba-45ff-9326-0e02ef89485e",
135 sort: 35,
136 name: "目录管理",
137 code: "MLGL",
138 description: null,
139 uri: "/admin/#/catalog-manage",
140 parentId: "f94c92cb-a032-4b89-8722-79dbcc331894",
141 state: null,
142 style: null,
143 icon: "",
144 jumpMode: 1,
145 productId: "d798323e-8834-4417-bbb8-837b8d13e7d5",
146 resourceCategoryId: "d798323e-8834-4417-bbb8-837b8d585656",
147 metadata:
148 '{"icon":"tubiao_huaban","iconActive":"tubiao_huaban-active"}',
149 children: [
150 {
151 id: "0b5952bc-dc7f-4d4e-8fcc-af9d33908c2a",
152 createdAt: null,
153 updatedAt: "2022-03-04T01:46:25.515+0000",
154 createdBy: null,
155 updatedBy: "3127e455-43ba-45ff-9326-0e02ef89485e",
156 sort: 137,
157 name: "服务目录",
158 code: "FWML",
159 description: null,
160 uri: "/admin/#/catalog-manage/catalog-service",
161 parentId: "065fe2d7-d59a-442c-92d0-c91aa19d7fae",
162 state: null,
163 style: null,
164 icon: "",
165 jumpMode: 1,
166 productId: "d798323e-8834-4417-bbb8-837b8d13e7d5",
167 resourceCategoryId: "d798323e-8834-4417-bbb8-837b8d585656",
168 metadata: null,
169 children: null,
170 },
171 {
172 id: "2377caf7-22e5-4261-b88a-0fbbbace1452",
173 createdAt: null,
174 updatedAt: "2022-03-04T01:47:00.774+0000",
175 createdBy: null,
176 updatedBy: "3127e455-43ba-45ff-9326-0e02ef89485e",
177 sort: -3,
178 name: "应用目录",
179 code: "YYML",
180 description: null,
181 uri: "/admin/#/catalog-manage/catalog-application",
182 parentId: "065fe2d7-d59a-442c-92d0-c91aa19d7fae",
183 state: null,
184 style: null,
185 icon: "",
186 jumpMode: 1,
187 productId: "d798323e-8834-4417-bbb8-837b8d13e7d5",
188 resourceCategoryId: "d798323e-8834-4417-bbb8-837b8d585656",
189 metadata: null,
190 children: null,
191 },
192 ],
193 },
194 ],
195 },
196 ],
197 taskData: null, 49 taskData: null,
198 form: { 50 form: {
199 job_name: "", 51 job_name: "",
...@@ -207,26 +59,7 @@ export default { ...@@ -207,26 +59,7 @@ export default {
207 departmentId: "", // 部门ID 59 departmentId: "", // 部门ID
208 departmentList: [], // 部门列表 60 departmentList: [], // 部门列表
209 levelList: [], // 职务级别 61 levelList: [], // 职务级别
210 tableData: [],
211 sexList: [], 62 sexList: [],
212 typeOptions: [
213 {
214 value: "0",
215 label: "姓名",
216 },
217 {
218 value: "1",
219 label: "工号",
220 },
221 {
222 value: "2",
223 label: "部门",
224 },
225 {
226 value: "3",
227 label: "机构",
228 },
229 ],
230 63
231 selectionList: [], 64 selectionList: [],
232 tableData: { 65 tableData: {
...@@ -247,16 +80,7 @@ export default { ...@@ -247,16 +80,7 @@ export default {
247 > 80 >
248 修改 81 修改
249 </el-button> 82 </el-button>
250 <el-button 83
251 type="text"
252 size="mini"
253 icon="el-icon-video-pause"
254 onClick={() => {
255 this.authorizationQuery(scope.row);
256 }}
257 >
258 授权
259 </el-button>
260 <el-button 84 <el-button
261 type="text" 85 type="text"
262 size="mini" 86 size="mini"
...@@ -280,12 +104,80 @@ export default { ...@@ -280,12 +104,80 @@ export default {
280 pageSize: 15, 104 pageSize: 15,
281 current: 1, 105 current: 1,
282 }, 106 },
107 tableUrl: api.menus, // 菜单接口地址
108 meumurlid: api.subsystem,// 项目id接口地址
109 productId:""//项目id
283 }; 110 };
284 }, 111 },
112 created() {
113 this.getTableList();
114 },
285 methods: { 115 methods: {
116 // 加载表格数据
117 getTableList() {
118
119 const queryOptionsid = {
120 conditionGroup: {
121 queryRelation: "AND",
122 conditions: [
123 {
124 property: "code",
125 value: "BDCJGPT",
126 operator: "EQ",
127 },
128 ],
129 },
130 };
131 const params = {
132 queryOptions: queryOptionsid,
133 };
134 // 获取系统id
135 getAction(this.meumurlid, params)
136 .then((res) => {
137 this.productId=res.content[0].id;
138 let queryOptions = {
139 conditionGroup: {
140 conditions: [
141 {
142 property: "productId",
143 value: this.productId,
144 operator: "EQ",
145 },
146 ],
147 queryRelation: "AND",
148 },
149 orderBys: [{ property: "sort", direction: "desc" }],
150 };
151 if (!this.tableUrl) {
152 console.log("请设置tableUrl属性为接口地址!");
153 return;
154 }
155 if (this.queryOptions !== "") {
156 this.queryParam.queryOptions = JSON.stringify(queryOptions);
157 }
158 // 查询系统菜单
159 getAction(this.tableUrl, this.queryParam)
160 .then((res) => {
161 if (res.status === 1) {
162 this.loading = false;
163 this.tablelistData = res.content;
164 console.log("this.tablelistData", this.tablelistData);
165 } else {
166 this.$message.error({ message: res.message, showClose: true });
167 this.loading = false;
168 }
169 })
170 .catch((error) => {
171 console.log("errrrrrorrrrr", error);
172 this.loading = false;
173 });
174 })
175 .catch((error) => {
176 console.log("errrrrrorrrrr", error);
177 });
178 },
286 // 新增菜单 179 // 新增菜单
287 handleAdd() { 180 handleAdd() {
288 this.taskData = null;
289 this.$refs.dialogForm.add(); 181 this.$refs.dialogForm.add();
290 this.$refs.dialogForm.title = "添加"; 182 this.$refs.dialogForm.title = "添加";
291 }, 183 },
...@@ -295,43 +187,49 @@ export default { ...@@ -295,43 +187,49 @@ export default {
295 this.$refs.dialogForm.edit(record); 187 this.$refs.dialogForm.edit(record);
296 this.$refs.dialogForm.title = "修改"; 188 this.$refs.dialogForm.title = "修改";
297 }, 189 },
298 // 授权
299 authorizationQuery(record) {
300 this.$refs.rolesForm.authorization(record);
301 this.$refs.rolesForm.title = "授权查询";
302
303 },
304 // 删除 190 // 删除
305 handleDelete(row, id) { 191 handleDelete(id,content) {
306 this.$confirm("此操将进行删除操作, 是否继续?", "提示", { 192 this.$confirm(
307 confirmButtonText: "确定", 193 `<div class="customer-message-wrapper">
308 cancelButtonText: "取消", 194 <h5 class="title">您确认要执行该操作用于以下信息:</h5>
309 type: "warning", 195 <p class="content" aria-controls="${content}">${content}
310 }) 196 </p>
197 <p class="result">执行后,数据将
198 <span >无法恢复</span>
199 </p>
200 </div>`,
201 '执行确认',
202 {
203 dangerouslyUseHTMLString: true,
204 customClass: 'customer-delete',
205 confirmButtonText: '确定',
206 cancelButtonText: '取消',
207 type: 'warning'
208 }
209 )
311 .then(() => { 210 .then(() => {
312 // sjsbTask.sjsbTaskRemove(row.id) 211 if (!this.tableUrl) {
313 // .then((res) => { 212 this.$message.error({
314 // if ((res.code = 200)) { 213 message: '请设置tableUrl属性为接口地址!',
315 // this.$message({ 214 showClose: true
316 // type: 'success',
317 // message: res.message,
318 // })
319 // this.featchData()
320 // }
321 // })
322 // .catch((error) => {
323 // this.$alert(error, '提示', {
324 // confirmButtonText: '确定',
325 // type: 'error'
326 // })
327 // })
328 }) 215 })
329 .catch(() => { 216 return
330 this.$message({ 217 }
331 type: "info", 218 const url = this.tableUrl + '/' + id
332 message: "已取消", 219 deleteAction(url).then(res => {
333 }); 220 if (res.status === 1) {
334 }); 221 this.$message.success({ message: res.message, showClose: true })
222 this.reloadTableData()
223 } else {
224 this.$message.error({ message: res.message, showClose: true })
225 }
226 })
227 })
228 .catch(() => {})
229 },
230 // 新增、编辑回显
231 reloadTableData() {
232 this.getTableList()
335 }, 233 },
336 }, 234 },
337 }; 235 };
...@@ -339,10 +237,10 @@ export default { ...@@ -339,10 +237,10 @@ export default {
339 <style scoped lang="scss"> 237 <style scoped lang="scss">
340 @import "~@/styles/mixin.scss"; 238 @import "~@/styles/mixin.scss";
341 @import "~@/styles/public.scss"; 239 @import "~@/styles/public.scss";
342 .btnColRight{ 240 .btnColRight {
343 margin-top: 20px; 241 margin-top: 20px;
344 } 242 }
345 /deep/.el-table__expand-icon{ 243 /deep/.el-table__expand-icon {
346 color: #fff; 244 color: #fff;
347 } 245 }
348 </style> 246 </style>
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
26 > 26 >
27 </lb-table> 27 </lb-table>
28 </div> 28 </div>
29 <EditDialog ref="addEditDialog" /> 29 <EditDialog ref="addEditDialog" @ok="reloadTableData" />
30 <Roleslistdiglog ref="rolesForm" /> 30 <Roleslistdiglog ref="rolesForm" />
31 </div> 31 </div>
32 </template> 32 </template>
...@@ -38,7 +38,7 @@ import { ...@@ -38,7 +38,7 @@ import {
38 findParents, 38 findParents,
39 removeTreeListItem, 39 removeTreeListItem,
40 } from "@/utils/operation"; 40 } from "@/utils/operation";
41 import { getRolesById, getUserRoles } from "@/api/Rolemanagement"; 41 import { getRolesById, getUserRoles } from "@/api/quanxianmanagement";
42 import data from "./data"; 42 import data from "./data";
43 import sjsbTask from "@/api/sjsbTask.js"; 43 import sjsbTask from "@/api/sjsbTask.js";
44 import { api, getAction,deleteAction } from "@/api/manageApi"; 44 import { api, getAction,deleteAction } from "@/api/manageApi";
...@@ -213,11 +213,9 @@ export default { ...@@ -213,11 +213,9 @@ export default {
213 213
214 getRolesById(1) 214 getRolesById(1)
215 .then((res) => { 215 .then((res) => {
216 console.log("res.content", res.content);
217 Builtinrole = res.content; 216 Builtinrole = res.content;
218 getRolesById(2) 217 getRolesById(2)
219 .then((res) => { 218 .then((res) => {
220 console.log("res.content", res.content);
221 Publicrole = res.content; 219 Publicrole = res.content;
222 220
223 this.listdata = Builtinrole.concat(Publicrole); 221 this.listdata = Builtinrole.concat(Publicrole);
...@@ -336,7 +334,7 @@ export default { ...@@ -336,7 +334,7 @@ export default {
336 deleteAction(url).then(res => { 334 deleteAction(url).then(res => {
337 if (res.status === 1) { 335 if (res.status === 1) {
338 this.$message.success({ message: res.message, showClose: true }) 336 this.$message.success({ message: res.message, showClose: true })
339 this.loadDataS(this.subcode) 337 this.getTableData()
340 } else { 338 } else {
341 this.$message.error({ message: res.message, showClose: true }) 339 this.$message.error({ message: res.message, showClose: true })
342 } 340 }
...@@ -344,6 +342,10 @@ export default { ...@@ -344,6 +342,10 @@ export default {
344 }) 342 })
345 .catch(() => {}) 343 .catch(() => {})
346 }, 344 },
345 // 新增回显
346 reloadTableData() {
347 this.getTableData()
348 },
347 }, 349 },
348 }; 350 };
349 </script> 351 </script>
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
27 27
28 <script> 28 <script>
29 import Dialog from "@/components/Dialog/"; 29 import Dialog from "@/components/Dialog/";
30 import { updateUser } from "@/api/Rolemanagement"; 30 import { updateUser } from "@/api/quanxianmanagement";
31 export default { 31 export default {
32 name: "", 32 name: "",
33 components: { Dialog }, 33 components: { Dialog },
...@@ -87,7 +87,6 @@ export default { ...@@ -87,7 +87,6 @@ export default {
87 adds(a, rid) { 87 adds(a, rid) {
88 this.roleId = rid; 88 this.roleId = rid;
89 this.visible = true; 89 this.visible = true;
90 console.log("a", a);
91 this.tableData.data = a; 90 this.tableData.data = a;
92 this.tableData.data.forEach((item, index) => { 91 this.tableData.data.forEach((item, index) => {
93 if (item.selectStatus === 0) { 92 if (item.selectStatus === 0) {
...@@ -108,9 +107,7 @@ export default { ...@@ -108,9 +107,7 @@ export default {
108 const idList = this.multipleSelection.map((item) => { 107 const idList = this.multipleSelection.map((item) => {
109 return item.id; 108 return item.id;
110 }); 109 });
111 console.log("this.roleId",this.roleId,idList);
112 updateUser(this.roleId, idList).then((res) => { 110 updateUser(this.roleId, idList).then((res) => {
113 console.log("res",res);
114 if (res.status === 1) { 111 if (res.status === 1) {
115 this.$message.success({ message: "保存成功", showClose: true }); 112 this.$message.success({ message: "保存成功", showClose: true });
116 this.visible = false; 113 this.visible = false;
...@@ -120,7 +117,6 @@ export default { ...@@ -120,7 +117,6 @@ export default {
120 }); 117 });
121 }, 118 },
122 handleSelectionChange(val) { 119 handleSelectionChange(val) {
123 console.log("val", val);
124 this.multipleSelection = val; 120 this.multipleSelection = val;
125 }, 121 },
126 }, 122 },
......
...@@ -6,25 +6,20 @@ class data extends filter { ...@@ -6,25 +6,20 @@ class data extends filter {
6 columns () { 6 columns () {
7 return [ 7 return [
8 { 8 {
9 prop: "DCODE", 9 prop: "code",
10 label: "工号", 10 label: "工号",
11 width: 130 11 width: 130
12 }, 12 },
13 { 13 {
14 prop: "DNAME", 14 prop: "name",
15 label: "姓名", 15 label: "姓名",
16 width: 300 16 width: 300
17 }, 17 },
18 { 18 {
19 prop: "PARENTID", 19 prop: "loginName",
20 label: "用户名" 20 label: "用户名"
21 }, 21 },
22 { 22 {
23 prop: "TYPEID",
24 width: 260,
25 label: "负责人"
26 },
27 {
28 prop: "departmentName", 23 prop: "departmentName",
29 label: "所属部门" 24 label: "所属部门"
30 }, 25 },
......
...@@ -103,6 +103,7 @@ ...@@ -103,6 +103,7 @@
103 </template> 103 </template>
104 104
105 <script> 105 <script>
106 import { api, httpAction } from '@/api/manageApi'
106 import Dialog from "@/components/Dialog/"; 107 import Dialog from "@/components/Dialog/";
107 export default { 108 export default {
108 name: "", 109 name: "",
...@@ -126,11 +127,14 @@ export default { ...@@ -126,11 +127,14 @@ export default {
126 showLoginName: false, 127 showLoginName: false,
127 sexList: [{lable:"0",value:"0",name:"男"},{lable:"1",value:"1",name:"女"}], 128 sexList: [{lable:"0",value:"0",name:"男"},{lable:"1",value:"1",name:"女"}],
128 levelList: [{lable:"0",value:"0",name:"干事"},{lable:"1",value:"1",name:"经理"}], 129 levelList: [{lable:"0",value:"0",name:"干事"},{lable:"1",value:"1",name:"经理"}],
129 organizationId: "", // 组织机构ID 130 dataUrl: api.users
130 departmentId: "", // 部门ID
131 }; 131 };
132 }, 132 },
133 computed: {}, 133 computed: {
134 departmentid() {
135 return this.$store.state.user.userInfo;
136 },
137 },
134 watch: {}, 138 watch: {},
135 created() {}, 139 created() {},
136 mounted() {}, 140 mounted() {},
...@@ -151,11 +155,13 @@ export default { ...@@ -151,11 +155,13 @@ export default {
151 // } 155 // }
152 // }) 156 // })
153 // }, 157 // },
158 // 添加人员
154 add() { 159 add() {
155 this.visible = true; 160 this.visible = true;
156 // this.type = 0 161 // this.type = 0
157 this.showLoginName = false 162 this.showLoginName = false
158 }, 163 },
164 // 编辑
159 edit(record) { 165 edit(record) {
160 // this.initDictConfig() 166 // this.initDictConfig()
161 this.showLoginName = true 167 this.showLoginName = true
...@@ -170,11 +176,14 @@ export default { ...@@ -170,11 +176,14 @@ export default {
170 handleChange(value) { 176 handleChange(value) {
171 this.form.departmentId = value; 177 this.form.departmentId = value;
172 }, 178 },
179 // 保存
173 submitForm(submitType) { 180 submitForm(submitType) {
174 this.$refs.form.validate((valid) => { 181 this.$refs.form.validate((valid) => {
175 if (valid) { 182 if (valid) {
176 let method = '' 183 let method = ''
177 let url = '' 184 let url = ''
185 this.form.organizationId=this.departmentid.organizationId;
186 this.form.departmentId=this.departmentid.departmentId;
178 const formData = this.form 187 const formData = this.form
179 if (!formData.id) { 188 if (!formData.id) {
180 method = 'post' 189 method = 'post'
...@@ -183,20 +192,15 @@ export default { ...@@ -183,20 +192,15 @@ export default {
183 method = 'put' 192 method = 'put'
184 url = `${this.dataUrl}/${formData.id}` 193 url = `${this.dataUrl}/${formData.id}`
185 } 194 }
195
186 httpAction(url, formData, method).then((res) => { 196 httpAction(url, formData, method).then((res) => {
187 if (res.status === 1) { 197 if (res.status === 1) {
188 this.$message.success({ message: res.message, showClose: true }) 198 this.$message.success({ message: res.message, showClose: true })
189 // this.type 0新增 1编辑 199
190 if (this.type === 0) {
191 // submitType 1需要关闭页面 0保存&新增暂不关闭页面
192 if (submitType === 1) {
193 this.close()
194 } else {
195 this.resetForm() 200 this.resetForm()
196 } 201
197 } else if (this.type === 1) {
198 this.close() 202 this.close()
199 } 203
200 this.$emit('ok') 204 this.$emit('ok')
201 } else { 205 } else {
202 this.$message.error({ message: res.message, showClose: true }) 206 this.$message.error({ message: res.message, showClose: true })
...@@ -215,9 +219,9 @@ export default { ...@@ -215,9 +219,9 @@ export default {
215 this.$refs.form.resetFields() 219 this.$refs.form.resetFields()
216 }, 220 },
217 close() { 221 close() {
218 // this.resetForm() 222 this.resetForm()
219 this.visible = false; 223 this.visible = false
220 }, 224 }
221 }, 225 },
222 }; 226 };
223 </script> 227 </script>
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
29 > 29 >
30 </lb-table> 30 </lb-table>
31 </div> 31 </div>
32 <edit-dialog ref="dialogForm" /> 32 <edit-dialog ref="dialogForm" @ok="reloadTableData"/>
33 </div> 33 </div>
34 </template> 34 </template>
35 <script> 35 <script>
...@@ -40,7 +40,13 @@ import { ...@@ -40,7 +40,13 @@ import {
40 findParents, 40 findParents,
41 removeTreeListItem, 41 removeTreeListItem,
42 } from "@/utils/operation"; 42 } from "@/utils/operation";
43 import {
44 resetPassword,
45 getUserList,
46 } from "@/api/quanxianmanagement";
47 import { api, deleteAction } from '@/api/manageApi'
43 import data from "./data"; 48 import data from "./data";
49 import { deleteDomStr } from '@/utils/proDomStr'
44 import sjsbTask from "@/api/sjsbTask.js"; 50 import sjsbTask from "@/api/sjsbTask.js";
45 import tableMixin from "@/mixins/tableMixin.js"; 51 import tableMixin from "@/mixins/tableMixin.js";
46 import EditDialog from "./edit-dialog.vue"; 52 import EditDialog from "./edit-dialog.vue";
...@@ -98,8 +104,16 @@ export default { ...@@ -98,8 +104,16 @@ export default {
98 .concat(data.columns()) 104 .concat(data.columns())
99 .concat([ 105 .concat([
100 { 106 {
107 label: "负责人",
108 render: (h, scope) => {
109 return (
110 <i v-show={scope.row.isDuty!==null} class="el-icon-check" />
111 )
112 }
113 },
114 {
101 label: "排序", 115 label: "排序",
102 width: 380, 116 width: 280,
103 render: (h, scope) => { 117 render: (h, scope) => {
104 return ( 118 return (
105 <div> 119 <div>
...@@ -134,16 +148,6 @@ export default { ...@@ -134,16 +148,6 @@ export default {
134 <el-button 148 <el-button
135 type="text" 149 type="text"
136 size="mini" 150 size="mini"
137 icon="el-icon-edit"
138 onClick={() => {
139 this.updateLock(scope.row, scope.row.name);
140 }}
141 >
142 解锁
143 </el-button>
144 <el-button
145 type="text"
146 size="mini"
147 icon="el-icon-video-pause" 151 icon="el-icon-video-pause"
148 onClick={() => { 152 onClick={() => {
149 this.resetPassword(scope.row.id); 153 this.resetPassword(scope.row.id);
...@@ -187,81 +191,79 @@ export default { ...@@ -187,81 +191,79 @@ export default {
187 }; 191 };
188 }, 192 },
189 created() { 193 created() {
190 this.featchData(); 194 this.getTableList();
195 },
196 computed: {
197 departmentid() {
198 return this.$store.state.user.userInfo;
199 },
191 }, 200 },
192 methods: { 201 methods: {
193
194 handleAdd() { 202 handleAdd() {
195 this.taskData = null;
196 this.$refs.dialogForm.add(); 203 this.$refs.dialogForm.add();
197 this.$refs.dialogForm.title = "添加"; 204 this.$refs.dialogForm.title = "添加";
198 }, 205 },
199 featchData() { 206 getTableList() {
200 207 this.loading = true;
201 this.tableData.data = [ 208 this.queryParam = {
202 { 209 organizationId: this.departmentid.organizationId,
203 "dictid": "51b9f487861671f77782c5a23b5fe52e", 210 departmentId: this.departmentid.departmentId,
204 "children": null, 211 };
205 "TYPEID": "1F460F6E5E354C1AA3C470434D7A67DF", 212 getUserList(this.queryParam).then((res) => {
206 "PARENTID": "ouyds", 213 if (res.status === 1) {
207 "DCODE": "1223", 214 this.loading = false;
208 "DNAME": "小红", 215 this.tableData.data = res.content;
209 "SORT": null, 216 this.tableData.data = judgeSort(this.tableData.data);
210 "index": 1, 217 } else {
211 }, 218 this.$message.error({ message: res.message, showClose: true });
212 {
213 "dictid": "2291d9e298274c1ea1f40df63fbcff47",
214 "children": null,
215 "TYPEID": "1F460F6E5E354C1AA3C470434D7A67DF",
216 "PARENTID": "wer",
217 "DCODE": "124334",
218 "DNAME": "小李",
219 "SORT": null,
220 "index": 2,
221 },
222 {
223 "dictid": "e6a5aeb8957b8029fa31586fb30dd5b8",
224 "children": null,
225 "TYPEID": "1F460F6E5E354C1AA3C470434D7A67DF",
226 "PARENTID": "underf",
227 "DCODE": "2344",
228 "DNAME": "小田",
229 "SORT": null,
230 "index": 13,
231 } 219 }
232 ] 220 });
233 this.tableData.data=judgeSort(this.tableData.data) 221 },
234 },
235 222
236 // 更新用户解锁状态 223 // 重置用户密码
237 updateLock(id, name) { 224 resetPassword(data) {
225 const ids = []
226 if (data instanceof Array) {
227 data.forEach((item) => {
228 ids.push(item.id)
229 })
230 } else {
231 ids.push(data)
232 }
233 if (ids.length === 0) {
234 this.$message({
235 message: '请选择需要重置密码的用户!',
236 showClose: true
237 })
238 return
239 }
238 this.$confirm( 240 this.$confirm(
239 `<div class="customer-message-wrapper"> 241 `<div class="customer-message-wrapper">
240 <h5 class="title">确定要更新用户解锁状态吗</h5> 242 <h5 class="title">确定要重置密码吗</h5>
241 <p class="result">执行后,数据将 243 <p class="result">执行后,数据将
242 <span >无法恢复</span> 244 <span >无法恢复</span>
243 </p> 245 </p>
244 </div>`, 246 </div>`,
245 "执行确认", 247 '执行确认',
246 { 248 {
247 dangerouslyUseHTMLString: true, 249 dangerouslyUseHTMLString: true,
248 customClass: "customer-delete", 250 customClass: 'customer-delete',
249 confirmButtonText: "确定", 251 confirmButtonText: '确定',
250 cancelButtonText: "取消", 252 cancelButtonText: '取消',
251 type: "warning", 253 type: 'warning'
252 } 254 }
253 ) 255 )
254 .then(() => { 256 .then(() => {
255 // updateLock(id).then((res) => { 257 resetPassword(ids).then((res) => {
256 // if (res.status === 1) { 258 if (res.status === 1) {
257 // this.$message.success({ message: res.message, showClose: true }) 259 this.$message.success({ message: res.message, showClose: true })
258 // this.getTableList() 260 this.getTableList()
259 // } else { 261 } else {
260 // this.$message.error({ message: res.message, showClose: true }) 262 this.$message.error({ message: res.message, showClose: true })
261 // } 263 }
262 // }) 264 })
263 }) 265 })
264 .catch(() => {}); 266 .catch(() => {})
265 }, 267 },
266 // 上移下移 268 // 上移下移
267 moveUpward(index, row) { 269 moveUpward(index, row) {
...@@ -276,51 +278,6 @@ this.tableData.data=judgeSort(this.tableData.data) ...@@ -276,51 +278,6 @@ this.tableData.data=judgeSort(this.tableData.data)
276 let id = findParents(this.tableData.data, row.dictid); 278 let id = findParents(this.tableData.data, row.dictid);
277 this.keyList = id; 279 this.keyList = id;
278 }, 280 },
279 // 重置用户密码
280 resetPassword(data) {
281 const ids = [];
282 if (data instanceof Array) {
283 data.forEach((item) => {
284 ids.push(item.id);
285 });
286 } else {
287 ids.push(data);
288 }
289 if (ids.length === 0) {
290 this.$message({
291 message: "请选择需要重置密码的用户!",
292 showClose: true,
293 });
294 return;
295 }
296 this.$confirm(
297 `<div class="customer-message-wrapper">
298 <h5 class="title">确定要重置密码吗</h5>
299 <p class="result">执行后,数据将
300 <span >无法恢复</span>
301 </p>
302 </div>`,
303 "执行确认",
304 {
305 dangerouslyUseHTMLString: true,
306 customClass: "customer-delete",
307 confirmButtonText: "确定",
308 cancelButtonText: "取消",
309 type: "warning",
310 }
311 )
312 .then(() => {
313 // resetPassword(ids).then((res) => {
314 // if (res.status === 1) {
315 // this.$message.success({ message: res.message, showClose: true })
316 // this.getTableList()
317 // } else {
318 // this.$message.error({ message: res.message, showClose: true })
319 // }
320 // })
321 })
322 .catch(() => {});
323 },
324 // 修改人员信息 281 // 修改人员信息
325 handleEdit(row) { 282 handleEdit(row) {
326 this.$refs.dialogForm.edit(row); 283 this.$refs.dialogForm.edit(row);
...@@ -328,22 +285,28 @@ this.tableData.data=judgeSort(this.tableData.data) ...@@ -328,22 +285,28 @@ this.tableData.data=judgeSort(this.tableData.data)
328 }, 285 },
329 // 删除 286 // 删除
330 handleDelete(id, content) { 287 handleDelete(id, content) {
331 this.$confirm("此操将进行删除操作, 是否继续?", "提示", { 288 this.$confirm(deleteDomStr(content), '执行确认', {
332 confirmButtonText: "确定", 289 dangerouslyUseHTMLString: true,
333 cancelButtonText: "取消", 290 customClass: 'customer-delete',
334 type: "warning", 291 confirmButtonText: '确定',
292 cancelButtonText: '取消',
293 type: 'warning'
335 }) 294 })
336 .then(() => { 295 .then(() => {
337 // deleteAction(`${api.users}/${id}`).then((res) => { 296 deleteAction(`${api.users}/${id}`).then((res) => {
338 // if (res.status === 1) { 297 if (res.status === 1) {
339 // this.$message.success({ message: res.message, showClose: true }) 298 this.$message.success({ message: res.message, showClose: true })
340 // } else { 299 } else {
341 // this.$message.error({ message: res.message, showClose: true }) 300 this.$message.error({ message: res.message, showClose: true })
342 // } 301 }
343 // this.getTableList() 302 this.getTableList()
344 // })
345 }) 303 })
346 .catch(() => {}); 304 })
305 .catch(() => {})
306 },
307 // 新增回显
308 reloadTableData() {
309 this.getTableList()
347 }, 310 },
348 }, 311 },
349 }; 312 };
......