Merge remote-tracking branch 'origin/master'
# Conflicts: # config/index.js # package-lock.json # package.json # src/api/api.js # src/api/http.js # src/api/log_api.js # src/api/perm_api.js # src/api/role_api.js # src/api/user.js # src/main.js # src/routes.js
正在显示
42 个修改的文件
包含
4104 行增加
和
149 行删除
.eslintrc.js
100644 → 100755
| @@ -37,7 +37,8 @@ exports.cssLoaders = function (options) { | @@ -37,7 +37,8 @@ exports.cssLoaders = function (options) { | ||
| 37 | if (options.extract) { | 37 | if (options.extract) { |
| 38 | return ExtractTextPlugin.extract({ | 38 | return ExtractTextPlugin.extract({ |
| 39 | use: loaders, | 39 | use: loaders, |
| 40 | - fallback: 'vue-style-loader' | 40 | + fallback: 'vue-style-loader', |
| 41 | + publicPath: '../../' | ||
| 41 | }) | 42 | }) |
| 42 | } else { | 43 | } else { |
| 43 | return ['vue-style-loader'].concat(loaders) | 44 | return ['vue-style-loader'].concat(loaders) |
| @@ -53,6 +53,16 @@ module.exports = { | @@ -53,6 +53,16 @@ module.exports = { | ||
| 53 | limit: 10000, | 53 | limit: 10000, |
| 54 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]') | 54 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]') |
| 55 | } | 55 | } |
| 56 | + }, | ||
| 57 | + { | ||
| 58 | + test: /\.js$/i, | ||
| 59 | + loader: 'babel-loader', | ||
| 60 | + include: [ | ||
| 61 | + resolve('src'), | ||
| 62 | + resolve('test'), | ||
| 63 | + resolve('node_modules/element-ui/src'), | ||
| 64 | + resolve('node_modules/element-ui/packages') | ||
| 65 | + ], | ||
| 56 | } | 66 | } |
| 57 | ] | 67 | ] |
| 58 | } | 68 | } |
| @@ -20,6 +20,7 @@ var webpackConfig = merge(baseWebpackConfig, { | @@ -20,6 +20,7 @@ var webpackConfig = merge(baseWebpackConfig, { | ||
| 20 | }, | 20 | }, |
| 21 | devtool: config.build.productionSourceMap ? '#source-map' : false, | 21 | devtool: config.build.productionSourceMap ? '#source-map' : false, |
| 22 | output: { | 22 | output: { |
| 23 | + publicPath: './', | ||
| 23 | path: config.build.assetsRoot, | 24 | path: config.build.assetsRoot, |
| 24 | filename: utils.assetsPath('js/[name].[chunkhash].js'), | 25 | filename: utils.assetsPath('js/[name].[chunkhash].js'), |
| 25 | chunkFilename: utils.assetsPath('js/[id].[chunkhash].js') | 26 | chunkFilename: utils.assetsPath('js/[id].[chunkhash].js') |
| @@ -5,13 +5,13 @@ import qs from 'qs' | @@ -5,13 +5,13 @@ import qs from 'qs' | ||
| 5 | Vue.prototype.$http = axios; | 5 | Vue.prototype.$http = axios; |
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | -export const getuserMenus = params => { return axios.get(`USER-CENTER/perm/userMenus`, { params: params }); }; | 8 | +export const getuserMenus = params => { return axios.get(`/perm/userMenus`, { params: params }); }; |
| 9 | 9 | ||
| 10 | -export const getUserList = params => { return axios.get(`USER-CENTER/user/list`, { params: params }); }; | 10 | +export const getUserList = params => { return axios.get(`/user/list`, { params: params }); }; |
| 11 | 11 | ||
| 12 | export const getUserListPage = params => { return axios({ | 12 | export const getUserListPage = params => { return axios({ |
| 13 | method: 'GET', | 13 | method: 'GET', |
| 14 | - url: `USER-CENTER/user/list`, | 14 | + url: `/user/list`, |
| 15 | data: params, | 15 | data: params, |
| 16 | headers: { | 16 | headers: { |
| 17 | 'Content-Type': 'application/json;charset=UTF-8' | 17 | 'Content-Type': 'application/json;charset=UTF-8' |
| @@ -21,18 +21,18 @@ export const getUserListPage = params => { return axios({ | @@ -21,18 +21,18 @@ export const getUserListPage = params => { return axios({ | ||
| 21 | 21 | ||
| 22 | export const removeUser = params => { return axios({ | 22 | export const removeUser = params => { return axios({ |
| 23 | method: 'DELETE', | 23 | method: 'DELETE', |
| 24 | - url: `USER-CENTER/user/del`, | 24 | + url: `/user/del`, |
| 25 | data: params, | 25 | data: params, |
| 26 | headers: { | 26 | headers: { |
| 27 | 'Content-Type': 'application/json;charset=UTF-8' | 27 | 'Content-Type': 'application/json;charset=UTF-8' |
| 28 | } | 28 | } |
| 29 | })}; | 29 | })}; |
| 30 | 30 | ||
| 31 | -export const batchRemoveUser = params => { return axios.get(`USER-CENTER/user/batchremove`, { params: params }); }; | 31 | +export const batchRemoveUser = params => { return axios.get(`/user/batchremove`, { params: params }); }; |
| 32 | 32 | ||
| 33 | export const editUser = params => { return axios({ | 33 | export const editUser = params => { return axios({ |
| 34 | method: 'PUT', | 34 | method: 'PUT', |
| 35 | - url: `USER-CENTER/user/edit`, | 35 | + url: `/user/edit`, |
| 36 | data: params, | 36 | data: params, |
| 37 | headers: { | 37 | headers: { |
| 38 | 'Content-Type': 'application/json;charset=UTF-8' | 38 | 'Content-Type': 'application/json;charset=UTF-8' |
| @@ -41,7 +41,7 @@ export const editUser = params => { return axios({ | @@ -41,7 +41,7 @@ export const editUser = params => { return axios({ | ||
| 41 | 41 | ||
| 42 | export const addUser = params => { return axios({ | 42 | export const addUser = params => { return axios({ |
| 43 | method: 'POST', | 43 | method: 'POST', |
| 44 | - url: `USER-CENTER/user/add`, | 44 | + url: `/user/add`, |
| 45 | data: params, | 45 | data: params, |
| 46 | headers: { | 46 | headers: { |
| 47 | 'Content-Type': 'application/json;charset=UTF-8' | 47 | 'Content-Type': 'application/json;charset=UTF-8' |
| @@ -50,9 +50,9 @@ export const addUser = params => { return axios({ | @@ -50,9 +50,9 @@ export const addUser = params => { return axios({ | ||
| 50 | 50 | ||
| 51 | export const setUserRole = params => { return axios({ | 51 | export const setUserRole = params => { return axios({ |
| 52 | method: 'PUT', | 52 | method: 'PUT', |
| 53 | - url: `USER-CENTER/user/roleset`, | 53 | + url: `/user/roleset`, |
| 54 | data: params, | 54 | data: params, |
| 55 | headers: { | 55 | headers: { |
| 56 | 'Content-Type': 'application/json;charset=UTF-8' | 56 | 'Content-Type': 'application/json;charset=UTF-8' |
| 57 | } | 57 | } |
| 58 | -})}; | 58 | +})}; |
src/api/base.js
0 → 100644
src/api/company.js
0 → 100755
| 1 | +import axios from 'axios' | ||
| 2 | + | ||
| 3 | +let base = '/hqpt-user-center/company'; | ||
| 4 | + | ||
| 5 | + | ||
| 6 | +export const getList = params => { return axios.get(`${base}/list`, { params: params }); }; | ||
| 7 | + | ||
| 8 | + | ||
| 9 | +export const remove = params => { return axios({ | ||
| 10 | + method: 'DELETE', | ||
| 11 | + url: `${base}/del`, | ||
| 12 | + data: params, | ||
| 13 | + headers: { | ||
| 14 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 15 | + } | ||
| 16 | +})}; | ||
| 17 | + | ||
| 18 | +//批量删除 | ||
| 19 | +export const batchRemove = params => { return axios.get(`${base}/batchremove`, { params: params }); }; | ||
| 20 | + | ||
| 21 | +export const edit = params => { return axios({ | ||
| 22 | + method: 'PUT', | ||
| 23 | + url: `${base}/edit`, | ||
| 24 | + data: params, | ||
| 25 | + headers: { | ||
| 26 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 27 | + } | ||
| 28 | +})}; | ||
| 29 | + | ||
| 30 | +export const add = params => { return axios({ | ||
| 31 | + method: 'POST', | ||
| 32 | + url: `${base}/add`, | ||
| 33 | + data: params, | ||
| 34 | + headers: { | ||
| 35 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 36 | + } | ||
| 37 | +})}; |
src/api/department.js
0 → 100755
| 1 | +import axios from 'axios' | ||
| 2 | + | ||
| 3 | +let base = '/hqpt-user-center/department'; | ||
| 4 | + | ||
| 5 | + | ||
| 6 | +export const getList = params => { return axios.get(`${base}/list`, { params: params }); }; | ||
| 7 | + | ||
| 8 | + | ||
| 9 | +export const remove = params => { return axios({ | ||
| 10 | + method: 'DELETE', | ||
| 11 | + url: `${base}/del`, | ||
| 12 | + data: params, | ||
| 13 | + headers: { | ||
| 14 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 15 | + } | ||
| 16 | +})}; | ||
| 17 | + | ||
| 18 | +//批量删除 | ||
| 19 | +export const batchRemove = params => { return axios.get(`${base}/batchremove`, { params: params }); }; | ||
| 20 | + | ||
| 21 | +export const edit = params => { return axios({ | ||
| 22 | + method: 'PUT', | ||
| 23 | + url: `${base}/edit`, | ||
| 24 | + data: params, | ||
| 25 | + headers: { | ||
| 26 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 27 | + } | ||
| 28 | +})}; | ||
| 29 | + | ||
| 30 | +export const add = params => { return axios({ | ||
| 31 | + method: 'POST', | ||
| 32 | + url: `${base}/add`, | ||
| 33 | + data: params, | ||
| 34 | + headers: { | ||
| 35 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 36 | + } | ||
| 37 | +})}; |
src/api/empt/location_api.js
0 → 100644
| 1 | +import axios from 'axios' | ||
| 2 | + | ||
| 3 | +let base = 'empt-location/location'; | ||
| 4 | + | ||
| 5 | + | ||
| 6 | +export const getList = params => { return axios.get(`${base}/list`, { params: params }); }; | ||
| 7 | + | ||
| 8 | + | ||
| 9 | +export const remove = params => { return axios({ | ||
| 10 | + method: 'DELETE', | ||
| 11 | + url: `${base}/del`, | ||
| 12 | + data: params, | ||
| 13 | + headers: { | ||
| 14 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 15 | + } | ||
| 16 | +})}; | ||
| 17 | + | ||
| 18 | +//批量删除 | ||
| 19 | +export const batchRemove = params => { return axios.get(`${base}/batchremove`, { params: params }); }; | ||
| 20 | + | ||
| 21 | +export const edit = params => { return axios({ | ||
| 22 | + method: 'PUT', | ||
| 23 | + url: `${base}/edit`, | ||
| 24 | + data: params, | ||
| 25 | + headers: { | ||
| 26 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 27 | + } | ||
| 28 | +})}; | ||
| 29 | + | ||
| 30 | +export const add = params => { return axios({ | ||
| 31 | + method: 'POST', | ||
| 32 | + url: `${base}/add`, | ||
| 33 | + params: params, | ||
| 34 | + headers: { | ||
| 35 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 36 | + } | ||
| 37 | +})}; | ||
| 38 | + | ||
| 39 | +export const update = params => { return axios({ | ||
| 40 | + method: 'PUT', | ||
| 41 | + url: `${base}/update`, | ||
| 42 | + data: params, | ||
| 43 | + headers: { | ||
| 44 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 45 | + } | ||
| 46 | +})}; |
src/api/group_company.js
0 → 100755
| 1 | +import axios from 'axios' | ||
| 2 | + | ||
| 3 | +let base = '/hqpt-user-center/group'; | ||
| 4 | + | ||
| 5 | + | ||
| 6 | +export const getList = params => { return axios.get(`${base}/list`, { params: params }); }; | ||
| 7 | + | ||
| 8 | + | ||
| 9 | +export const remove = params => { return axios({ | ||
| 10 | + method: 'DELETE', | ||
| 11 | + url: `${base}/del`, | ||
| 12 | + data: params, | ||
| 13 | + headers: { | ||
| 14 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 15 | + } | ||
| 16 | +})}; | ||
| 17 | + | ||
| 18 | +//批量删除 | ||
| 19 | +export const batchRemove = params => { return axios.get(`${base}/batchremove`, { params: params }); }; | ||
| 20 | + | ||
| 21 | +export const edit = params => { return axios({ | ||
| 22 | + method: 'PUT', | ||
| 23 | + url: `${base}/edit`, | ||
| 24 | + data: params, | ||
| 25 | + headers: { | ||
| 26 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 27 | + } | ||
| 28 | +})}; | ||
| 29 | + | ||
| 30 | +export const add = params => { return axios({ | ||
| 31 | + method: 'POST', | ||
| 32 | + url: `${base}/add`, | ||
| 33 | + data: params, | ||
| 34 | + headers: { | ||
| 35 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 36 | + } | ||
| 37 | +})}; |
src/api/job_api.js
0 → 100644
| 1 | +import axios from 'axios' | ||
| 2 | + | ||
| 3 | +let base = 'hqpt-process/job'; | ||
| 4 | + | ||
| 5 | + | ||
| 6 | +export const getList = params => { return axios.get(`${base}/list`, { params: params }); }; | ||
| 7 | + | ||
| 8 | + | ||
| 9 | +export const remove = params => { return axios({ | ||
| 10 | + method: 'DELETE', | ||
| 11 | + url: `${base}/del`, | ||
| 12 | + data: params, | ||
| 13 | + headers: { | ||
| 14 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 15 | + } | ||
| 16 | +})}; | ||
| 17 | + | ||
| 18 | +//批量删除 | ||
| 19 | +export const batchRemove = params => { return axios.get(`${base}/batchremove`, { params: params }); }; | ||
| 20 | + | ||
| 21 | +export const edit = params => { return axios({ | ||
| 22 | + method: 'PUT', | ||
| 23 | + url: `${base}/edit`, | ||
| 24 | + data: params, | ||
| 25 | + headers: { | ||
| 26 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 27 | + } | ||
| 28 | +})}; | ||
| 29 | + | ||
| 30 | +export const add = params => { return axios({ | ||
| 31 | + method: 'POST', | ||
| 32 | + url: `${base}/add`, | ||
| 33 | + params: params, | ||
| 34 | + headers: { | ||
| 35 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 36 | + } | ||
| 37 | +})}; | ||
| 38 | + | ||
| 39 | +export const startJob = params => { return axios({ | ||
| 40 | + method: 'PUT', | ||
| 41 | + url: `${base}/start`, | ||
| 42 | + data: params, | ||
| 43 | + headers: { | ||
| 44 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 45 | + } | ||
| 46 | +})}; |
src/api/process_api.js
0 → 100644
| 1 | +import axios from 'axios' | ||
| 2 | + | ||
| 3 | +let base = 'hqpt-process/process'; | ||
| 4 | + | ||
| 5 | + | ||
| 6 | +export const getList = params => { return axios.get(`${base}/list`, { params: params }); }; | ||
| 7 | + | ||
| 8 | + | ||
| 9 | +export const remove = params => { return axios({ | ||
| 10 | + method: 'DELETE', | ||
| 11 | + url: `${base}/del`, | ||
| 12 | + data: params, | ||
| 13 | + headers: { | ||
| 14 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 15 | + } | ||
| 16 | +})}; | ||
| 17 | + | ||
| 18 | +//批量删除 | ||
| 19 | +export const batchRemove = params => { return axios.get(`${base}/batchremove`, { params: params }); }; | ||
| 20 | + | ||
| 21 | +export const edit = params => { return axios({ | ||
| 22 | + method: 'PUT', | ||
| 23 | + url: `${base}/edit`, | ||
| 24 | + data: params, | ||
| 25 | + headers: { | ||
| 26 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 27 | + } | ||
| 28 | +})}; | ||
| 29 | + | ||
| 30 | +export const add = params => { return axios({ | ||
| 31 | + method: 'POST', | ||
| 32 | + url: `${base}/add`, | ||
| 33 | + params: params, | ||
| 34 | + headers: { | ||
| 35 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 36 | + } | ||
| 37 | +})}; | ||
| 38 | + | ||
| 39 | +export const updateRolePerm = params => { return axios({ | ||
| 40 | + method: 'PUT', | ||
| 41 | + url: `${base}/permSet`, | ||
| 42 | + data: params, | ||
| 43 | + headers: { | ||
| 44 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 45 | + } | ||
| 46 | +})}; | ||
| 47 | + | ||
| 48 | +export const vacationTypeOptions = [ | ||
| 49 | + { | ||
| 50 | + value: '0', | ||
| 51 | + label: '运维检查' | ||
| 52 | + }, | ||
| 53 | + { | ||
| 54 | + value: '1', | ||
| 55 | + label: '设备故障' | ||
| 56 | + }, | ||
| 57 | + { | ||
| 58 | + value: '2', | ||
| 59 | + label: '电话报修' | ||
| 60 | + } | ||
| 61 | +]; |
src/api/socket.js
0 → 100644
| 1 | + | ||
| 2 | +var websock = null; | ||
| 3 | +var global_callback = null; | ||
| 4 | +var serverPort = '10003'; //webSocket连接端口 | ||
| 5 | + | ||
| 6 | + | ||
| 7 | +function getWebIP(){ | ||
| 8 | + var curIP = window.location.hostname; | ||
| 9 | + return curIP; | ||
| 10 | +} | ||
| 11 | + | ||
| 12 | +function initWebSocket(){ //初始化weosocket | ||
| 13 | + //ws地址 | ||
| 14 | + var wsuri = "ws://" +getWebIP()+ ":" + serverPort+"/log"; | ||
| 15 | + websock = new WebSocket(wsuri); | ||
| 16 | + websock.onmessage = function(e){ | ||
| 17 | + websocketonmessage(e); | ||
| 18 | + } | ||
| 19 | + websock.onclose = function(e){ | ||
| 20 | + websocketclose(e); | ||
| 21 | + } | ||
| 22 | + websock.onopen = function () { | ||
| 23 | + websocketOpen(); | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + //连接发生错误的回调方法 | ||
| 27 | + websock.onerror = function () { | ||
| 28 | + console.log("WebSocket连接发生错误"); | ||
| 29 | + } | ||
| 30 | +} | ||
| 31 | + | ||
| 32 | +// 实际调用的方法 | ||
| 33 | +function sendSock(agentData,callback){ | ||
| 34 | + global_callback = callback; | ||
| 35 | + if (websock.readyState === websock.OPEN) { | ||
| 36 | + //若是ws开启状态 | ||
| 37 | + websocketsend(agentData) | ||
| 38 | + }else if (websock.readyState === websock.CONNECTING) { | ||
| 39 | + // 若是 正在开启状态,则等待1s后重新调用 | ||
| 40 | + setTimeout(function () { | ||
| 41 | + sendSock(agentData,callback); | ||
| 42 | + }, 1000); | ||
| 43 | + }else { | ||
| 44 | + // 若未开启 ,则等待1s后重新调用 | ||
| 45 | + setTimeout(function () { | ||
| 46 | + sendSock(agentData,callback); | ||
| 47 | + }, 1000); | ||
| 48 | + } | ||
| 49 | +} | ||
| 50 | + | ||
| 51 | +//数据接收 | ||
| 52 | +function websocketonmessage(e){ | ||
| 53 | + global_callback(JSON.parse(e.data)); | ||
| 54 | +} | ||
| 55 | + | ||
| 56 | +//数据发送 | ||
| 57 | +function websocketsend(agentData){ | ||
| 58 | + websock.send(JSON.stringify(agentData)); | ||
| 59 | +} | ||
| 60 | + | ||
| 61 | +//关闭 | ||
| 62 | +function websocketclose(e){ | ||
| 63 | + console.log("connection closed (" + e.code + ")"); | ||
| 64 | +} | ||
| 65 | + | ||
| 66 | +function websocketOpen(e){ | ||
| 67 | + console.log("连接成功"); | ||
| 68 | +} | ||
| 69 | + | ||
| 70 | +// initWebSocket(); | ||
| 71 | + | ||
| 72 | +export{sendSock} | ||
| 73 | + |
src/api/staff/come_car.js
0 → 100755
| 1 | +import axios from 'axios' | ||
| 2 | + | ||
| 3 | +let base = '/hqpt-user-center/come_car'; | ||
| 4 | + | ||
| 5 | + | ||
| 6 | + | ||
| 7 | +export const getList = params => { return axios.get(`${base}/list`, { params: params }); }; | ||
| 8 | + | ||
| 9 | + | ||
| 10 | +export const remove = params => { return axios({ | ||
| 11 | + method: 'DELETE', | ||
| 12 | + url: `${base}/del`, | ||
| 13 | + data: params, | ||
| 14 | + headers: { | ||
| 15 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 16 | + } | ||
| 17 | +})}; | ||
| 18 | + | ||
| 19 | +//批量删除 | ||
| 20 | +export const batchRemove = params => { return axios.get(`${base}/batchremove`, { params: params }); }; | ||
| 21 | + | ||
| 22 | +export const edit = params => { return axios({ | ||
| 23 | + method: 'PUT', | ||
| 24 | + url: `${base}/edit`, | ||
| 25 | + data: params, | ||
| 26 | + headers: { | ||
| 27 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 28 | + } | ||
| 29 | +})}; | ||
| 30 | + | ||
| 31 | +export const add = params => { return axios({ | ||
| 32 | + method: 'POST', | ||
| 33 | + url: `${base}/add`, | ||
| 34 | + data: params, | ||
| 35 | + headers: { | ||
| 36 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 37 | + } | ||
| 38 | +})}; |
src/api/staff/key.js
0 → 100755
| 1 | +import axios from 'axios' | ||
| 2 | + | ||
| 3 | +let base = '/hqpt-user-center/key'; | ||
| 4 | + | ||
| 5 | + | ||
| 6 | + | ||
| 7 | +export const getList = params => { return axios.get(`${base}/list`, { params: params }); }; | ||
| 8 | + | ||
| 9 | + | ||
| 10 | +export const remove = params => { return axios({ | ||
| 11 | + method: 'DELETE', | ||
| 12 | + url: `${base}/del`, | ||
| 13 | + data: params, | ||
| 14 | + headers: { | ||
| 15 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 16 | + } | ||
| 17 | +})}; | ||
| 18 | + | ||
| 19 | +//批量删除 | ||
| 20 | +export const batchRemove = params => { return axios.get(`${base}/batchremove`, { params: params }); }; | ||
| 21 | + | ||
| 22 | +export const edit = params => { return axios({ | ||
| 23 | + method: 'PUT', | ||
| 24 | + url: `${base}/edit`, | ||
| 25 | + data: params, | ||
| 26 | + headers: { | ||
| 27 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 28 | + } | ||
| 29 | +})}; | ||
| 30 | + | ||
| 31 | +export const add = params => { return axios({ | ||
| 32 | + method: 'POST', | ||
| 33 | + url: `${base}/add`, | ||
| 34 | + data: params, | ||
| 35 | + headers: { | ||
| 36 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 37 | + } | ||
| 38 | +})}; |
src/api/staff/maintain.js
0 → 100755
| 1 | +import axios from 'axios' | ||
| 2 | + | ||
| 3 | +let base = '/hqpt-user-center/maintain'; | ||
| 4 | + | ||
| 5 | + | ||
| 6 | + | ||
| 7 | +export const getList = params => { return axios.get(`${base}/list`, { params: params }); }; | ||
| 8 | + | ||
| 9 | + | ||
| 10 | +export const remove = params => { return axios({ | ||
| 11 | + method: 'DELETE', | ||
| 12 | + url: `${base}/del`, | ||
| 13 | + data: params, | ||
| 14 | + headers: { | ||
| 15 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 16 | + } | ||
| 17 | +})}; | ||
| 18 | + | ||
| 19 | +//批量删除 | ||
| 20 | +export const batchRemove = params => { return axios.get(`${base}/batchremove`, { params: params }); }; | ||
| 21 | + | ||
| 22 | +export const edit = params => { return axios({ | ||
| 23 | + method: 'PUT', | ||
| 24 | + url: `${base}/edit`, | ||
| 25 | + data: params, | ||
| 26 | + headers: { | ||
| 27 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 28 | + } | ||
| 29 | +})}; | ||
| 30 | + | ||
| 31 | +export const add = params => { return axios({ | ||
| 32 | + method: 'POST', | ||
| 33 | + url: `${base}/add`, | ||
| 34 | + data: params, | ||
| 35 | + headers: { | ||
| 36 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 37 | + } | ||
| 38 | +})}; |
src/api/staff/on_duty.js
0 → 100755
| 1 | +import axios from 'axios' | ||
| 2 | + | ||
| 3 | +let base = '/hqpt-user-center/on_duty'; | ||
| 4 | + | ||
| 5 | + | ||
| 6 | + | ||
| 7 | +export const getList = params => { return axios.get(`${base}/list`, { params: params }); }; | ||
| 8 | + | ||
| 9 | + | ||
| 10 | +export const remove = params => { return axios({ | ||
| 11 | + method: 'DELETE', | ||
| 12 | + url: `${base}/del`, | ||
| 13 | + data: params, | ||
| 14 | + headers: { | ||
| 15 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 16 | + } | ||
| 17 | +})}; | ||
| 18 | + | ||
| 19 | +//批量删除 | ||
| 20 | +export const batchRemove = params => { return axios.get(`${base}/batchremove`, { params: params }); }; | ||
| 21 | + | ||
| 22 | +export const edit = params => { return axios({ | ||
| 23 | + method: 'PUT', | ||
| 24 | + url: `${base}/edit`, | ||
| 25 | + data: params, | ||
| 26 | + headers: { | ||
| 27 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 28 | + } | ||
| 29 | +})}; | ||
| 30 | + | ||
| 31 | +export const add = params => { return axios({ | ||
| 32 | + method: 'POST', | ||
| 33 | + url: `${base}/add`, | ||
| 34 | + data: params, | ||
| 35 | + headers: { | ||
| 36 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 37 | + } | ||
| 38 | +})}; |
src/api/staff/security_inspection.js
0 → 100755
| 1 | +import axios from 'axios' | ||
| 2 | + | ||
| 3 | +let base = '/hqpt-user-center/inspection'; | ||
| 4 | + | ||
| 5 | + | ||
| 6 | + | ||
| 7 | +export const getList = params => { return axios.get(`${base}/list`, { params: params }); }; | ||
| 8 | + | ||
| 9 | + | ||
| 10 | +export const remove = params => { return axios({ | ||
| 11 | + method: 'DELETE', | ||
| 12 | + url: `${base}/del`, | ||
| 13 | + data: params, | ||
| 14 | + headers: { | ||
| 15 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 16 | + } | ||
| 17 | +})}; | ||
| 18 | + | ||
| 19 | +//批量删除 | ||
| 20 | +export const batchRemove = params => { return axios.get(`${base}/batchremove`, { params: params }); }; | ||
| 21 | + | ||
| 22 | +export const edit = params => { return axios({ | ||
| 23 | + method: 'PUT', | ||
| 24 | + url: `${base}/edit`, | ||
| 25 | + data: params, | ||
| 26 | + headers: { | ||
| 27 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 28 | + } | ||
| 29 | +})}; | ||
| 30 | + | ||
| 31 | +export const add = params => { return axios({ | ||
| 32 | + method: 'POST', | ||
| 33 | + url: `${base}/add`, | ||
| 34 | + data: params, | ||
| 35 | + headers: { | ||
| 36 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 37 | + } | ||
| 38 | +})}; |
src/api/tools.js
100644 → 100755
src/api/water/water_stations_patrol.js
0 → 100755
| 1 | +import axios from 'axios' | ||
| 2 | + | ||
| 3 | +let base = '/hqpt-user-center/water_stations_patrol'; | ||
| 4 | + | ||
| 5 | + | ||
| 6 | + | ||
| 7 | +export const getList = params => { return axios.get(`${base}/list`, { params: params }); }; | ||
| 8 | + | ||
| 9 | + | ||
| 10 | +export const remove = params => { return axios({ | ||
| 11 | + method: 'DELETE', | ||
| 12 | + url: `${base}/del`, | ||
| 13 | + data: params, | ||
| 14 | + headers: { | ||
| 15 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 16 | + } | ||
| 17 | +})}; | ||
| 18 | + | ||
| 19 | +//批量删除 | ||
| 20 | +export const batchRemove = params => { return axios.get(`${base}/batchremove`, { params: params }); }; | ||
| 21 | + | ||
| 22 | +export const edit = params => { return axios({ | ||
| 23 | + method: 'PUT', | ||
| 24 | + url: `${base}/edit`, | ||
| 25 | + data: params, | ||
| 26 | + headers: { | ||
| 27 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 28 | + } | ||
| 29 | +})}; | ||
| 30 | + | ||
| 31 | +export const add = params => { return axios({ | ||
| 32 | + method: 'POST', | ||
| 33 | + url: `${base}/add`, | ||
| 34 | + data: params, | ||
| 35 | + headers: { | ||
| 36 | + 'Content-Type': 'application/json;charset=UTF-8' | ||
| 37 | + } | ||
| 38 | +})}; |
src/axios.js
100644 → 100755
| 1 | var SIGN_REGEXP = /([yMdhsm])(\1*)/g; | 1 | var SIGN_REGEXP = /([yMdhsm])(\1*)/g; |
| 2 | var DEFAULT_PATTERN = 'yyyy-MM-dd'; | 2 | var DEFAULT_PATTERN = 'yyyy-MM-dd'; |
| 3 | + | ||
| 3 | function padding(s, len) { | 4 | function padding(s, len) { |
| 4 | var len = len - (s + '').length; | 5 | var len = len - (s + '').length; |
| 5 | for (var i = 0; i < len; i++) { s = '0' + s; } | 6 | for (var i = 0; i < len; i++) { s = '0' + s; } |
src/utils/companyType.js
100644 → 100755
src/utils/country.js
100644 → 100755
src/utils/dangerGoods.js
100644 → 100755
src/utils/goodsPackage.js
100644 → 100755
src/utils/uld.js
100644 → 100755
| @@ -23,7 +23,7 @@ | @@ -23,7 +23,7 @@ | ||
| 23 | <el-col :span="24" class="main"> | 23 | <el-col :span="24" class="main"> |
| 24 | <aside :class="collapsed?'menu-collapsed':'menu-expanded'"> | 24 | <aside :class="collapsed?'menu-collapsed':'menu-expanded'"> |
| 25 | <!--导航菜单--> | 25 | <!--导航菜单--> |
| 26 | - <el-menu :default-active="$route.path" class="el-menu-vertical-demo" @open="handleopen" @close="handleclose" @select="handleselect" unique-opened router v-show="!collapsed" style="min-width: 230px"> | 26 | + <el-menu :default-active="$route.path" class="el-menu-vertical-demo" @open="handleopen" @close="handleclose" @select="handleselect" unique-opened router v-show="!collapsed" style="min-width: 230px" background-color="#545c64" text-color="#fff" active-text-color="#ffd04b"> |
| 27 | <template v-for="(item,index) in $router.options.routes" v-if="!item.hidden"> | 27 | <template v-for="(item,index) in $router.options.routes" v-if="!item.hidden"> |
| 28 | <el-submenu :index="index+''" v-if="!item.leaf"> | 28 | <el-submenu :index="index+''" v-if="!item.leaf"> |
| 29 | <template slot="title"><i :class="item.iconCls"></i>{{item.name}}</template> | 29 | <template slot="title"><i :class="item.iconCls"></i>{{item.name}}</template> |
| @@ -70,13 +70,14 @@ | @@ -70,13 +70,14 @@ | ||
| 70 | </el-row> | 70 | </el-row> |
| 71 | </template> | 71 | </template> |
| 72 | 72 | ||
| 73 | + | ||
| 73 | <script> | 74 | <script> |
| 74 | import rt from '../routes' | 75 | import rt from '../routes' |
| 75 | export default { | 76 | export default { |
| 76 | 77 | ||
| 77 | data() { | 78 | data() { |
| 78 | return { | 79 | return { |
| 79 | - sysName:'流浪地球管理系统', | 80 | + sysName:'后勤管理平台', |
| 80 | collapsed:false, | 81 | collapsed:false, |
| 81 | sysUserName: '', | 82 | sysUserName: '', |
| 82 | sysUserAvatar: '', | 83 | sysUserAvatar: '', |
src/views/empt/Location.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <section> | ||
| 3 | + <!--工具条--> | ||
| 4 | + <el-col :span="24" class="toolbar" style="padding-bottom: 0px;"> | ||
| 5 | + <el-form :inline="true" :model="filters"> | ||
| 6 | + <el-form-item> | ||
| 7 | + <el-input v-model="filters.processName" placeholder="公寓名称"></el-input> | ||
| 8 | + </el-form-item> | ||
| 9 | + <el-form-item> | ||
| 10 | + <el-button type="primary" v-on:click="getList()">查询</el-button> | ||
| 11 | + </el-form-item> | ||
| 12 | + <el-form-item> | ||
| 13 | + <el-button type="primary" @click="handleAdd()">新增</el-button> | ||
| 14 | + </el-form-item> | ||
| 15 | + </el-form> | ||
| 16 | + </el-col> | ||
| 17 | + | ||
| 18 | + <el-table | ||
| 19 | + :data="locationList" | ||
| 20 | + style="width: 100%;margin-bottom: 20px;" | ||
| 21 | + row-key="id" | ||
| 22 | + border | ||
| 23 | + :row-class-name="tableRowClassName" | ||
| 24 | + default-expand-all | ||
| 25 | + :tree-props="{children: 'children', hasChildren: 'hasChildren'}"> | ||
| 26 | + <el-table-column | ||
| 27 | + prop="adrname" | ||
| 28 | + label="名称" | ||
| 29 | + sortable | ||
| 30 | + width="300"> | ||
| 31 | + </el-table-column> | ||
| 32 | + <el-table-column | ||
| 33 | + prop="type" | ||
| 34 | + label="类型" | ||
| 35 | + align="center" | ||
| 36 | + :formatter="formatType" | ||
| 37 | + width="100"> | ||
| 38 | + </el-table-column> | ||
| 39 | + <el-table-column :label="$t('table.actions')" align="center" class-name="small-padding fixed-width"> | ||
| 40 | + <template slot-scope="scope"> | ||
| 41 | + <el-button type="primary" size="small" @click="handleUpdate(scope.row)">快速编辑</el-button> | ||
| 42 | + <el-button type="primary" size="small" @click="handleUpdate(scope.row)">新增</el-button> | ||
| 43 | + <el-button size="mini" type="danger" @click="handleModifyStatus(scope.row,'deleted')">{{ $t('table.delete') }}</el-button> | ||
| 44 | + <el-button type="primary" size="small" @click="electrixityMeterConfiguration(scope.row)">电表参数配置</el-button> | ||
| 45 | + </template> | ||
| 46 | + </el-table-column> | ||
| 47 | + </el-table> | ||
| 48 | + | ||
| 49 | + <!--工具条--> | ||
| 50 | + <el-col :span="24" class="toolbar"> | ||
| 51 | + <el-button type="danger" @click="batchRemove" :disabled="this.sels.length===0">批量删除</el-button> | ||
| 52 | + <el-pagination layout="prev, pager, next" @current-change="handleCurrentChange" :page-size="5" :total="total" style="float:right;"> | ||
| 53 | + </el-pagination> | ||
| 54 | + </el-col> | ||
| 55 | + | ||
| 56 | + <!--水表新增--> | ||
| 57 | + <el-dialog title="电表参数配置新增" :visible.sync="electrixityAddFormVisible" :close-on-click-modal="false"> | ||
| 58 | + <el-form :model="electrixityAddForm" label-width="110px" :rules="addFormRules" ref="electrixityAddForm"> | ||
| 59 | + <el-form-item label="水电预付费" prop="prepaid"> | ||
| 60 | + <el-switch | ||
| 61 | + v-model="electrixityAddForm.prepaid" | ||
| 62 | + active-color="#00A854" | ||
| 63 | + active-text="是" | ||
| 64 | + active-value="0" | ||
| 65 | + inactive-color="#F04134" | ||
| 66 | + inactive-text="否" | ||
| 67 | + inactive-value="1"> | ||
| 68 | + </el-switch> | ||
| 69 | + </el-form-item> | ||
| 70 | + <el-form-item label="电警告跳闸" prop="warningtrip"> | ||
| 71 | + <el-switch | ||
| 72 | + v-model="electrixityAddForm.warningtrip" | ||
| 73 | + active-color="#00A854" | ||
| 74 | + active-text="是" | ||
| 75 | + active-value="0" | ||
| 76 | + inactive-color="#F04134" | ||
| 77 | + inactive-text="否" | ||
| 78 | + inactive-value="1"> | ||
| 79 | + </el-switch> | ||
| 80 | + <span>告警阀值</span> <el-input v-model="electrixityAddForm.warningthreshold" style="width: 100px;" auto-complete="off"></el-input> <span>元</span> | ||
| 81 | + </el-form-item> | ||
| 82 | + <el-form-item label="透支使能" prop="overdraft"> | ||
| 83 | + <el-switch | ||
| 84 | + v-model="electrixityAddForm.overdraft" | ||
| 85 | + active-color="#00A854" | ||
| 86 | + active-text="是" | ||
| 87 | + active-value="0" | ||
| 88 | + inactive-color="#F04134" | ||
| 89 | + inactive-text="否" | ||
| 90 | + inactive-value="1"> | ||
| 91 | + </el-switch> | ||
| 92 | + <span>可透支额度</span> <el-input v-model="electrixityAddForm.overdraftthreshold" style="width: 100px;" auto-complete="off"></el-input> <span>元</span> | ||
| 93 | + </el-form-item> | ||
| 94 | + <el-form-item label="过负荷跳闸使能" prop="overdraft"> | ||
| 95 | + <el-switch | ||
| 96 | + v-model="electrixityAddForm.load" | ||
| 97 | + active-color="#00A854" | ||
| 98 | + active-text="是" | ||
| 99 | + active-value="0" | ||
| 100 | + inactive-color="#F04134" | ||
| 101 | + inactive-text="否" | ||
| 102 | + inactive-value="1"> | ||
| 103 | + </el-switch> | ||
| 104 | + <span>功率</span> <el-input v-model="electrixityAddForm.power" style="width: 100px;" auto-complete="off"></el-input> <span>KW</span> | ||
| 105 | + <br/> | ||
| 106 | + <br/> | ||
| 107 | + <span>功率因数</span> <el-input v-model="electrixityAddForm.powerfactor" style="width: 100px;" auto-complete="off"></el-input> | ||
| 108 | + </el-form-item> | ||
| 109 | + <el-form-item label="免费电度使能" prop="overdraft"> | ||
| 110 | + <el-switch | ||
| 111 | + v-model="electrixityAddForm.free" | ||
| 112 | + active-color="#00A854" | ||
| 113 | + active-text="是" | ||
| 114 | + active-value="0" | ||
| 115 | + inactive-color="#F04134" | ||
| 116 | + inactive-text="否" | ||
| 117 | + inactive-value="1"> | ||
| 118 | + </el-switch> | ||
| 119 | + <span>免费电度</span> <el-input v-model="electrixityAddForm.overdraftthreshold" style="width: 100px;" auto-complete="off"></el-input> <span>度</span> | ||
| 120 | + </el-form-item> | ||
| 121 | + </el-form> | ||
| 122 | + <div slot="footer" class="dialog-footer"> | ||
| 123 | + <el-button @click.native="electrixityAddFormVisible = false">取消</el-button> | ||
| 124 | + <el-button type="primary" @click.native="addSubmit" :loading="addLoading">提交</el-button> | ||
| 125 | + </div> | ||
| 126 | + </el-dialog> | ||
| 127 | + </section> | ||
| 128 | +</template> | ||
| 129 | +<style> | ||
| 130 | + .el-table .building { | ||
| 131 | + background: oldlace; | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + .el-table .floor { | ||
| 135 | + background: #f0f9eb; | ||
| 136 | + } | ||
| 137 | + | ||
| 138 | + .el-table .house { | ||
| 139 | + background: #99CCCC; | ||
| 140 | + } | ||
| 141 | +</style> | ||
| 142 | +<script> | ||
| 143 | + import { getList,add} from '@/api/empt/location_api'; | ||
| 144 | + import moment from 'moment' | ||
| 145 | + import parseTime from '@/utils' | ||
| 146 | + import loginUserInfo from '@/api/base' | ||
| 147 | + | ||
| 148 | + export default { | ||
| 149 | + data() { | ||
| 150 | + return { | ||
| 151 | + filters: { | ||
| 152 | + processName: '', | ||
| 153 | + parseTime: parseTime | ||
| 154 | + }, | ||
| 155 | + userId: '', | ||
| 156 | + realName: '', | ||
| 157 | + wmId:'', | ||
| 158 | + locationList:[], | ||
| 159 | + total: 0, | ||
| 160 | + pageNum: 1, | ||
| 161 | + pageSize: 5, | ||
| 162 | + listLoading: false, | ||
| 163 | + sels: [],//列表选中列 | ||
| 164 | + //编辑界面是否显示 | ||
| 165 | + editFormVisible: false, | ||
| 166 | + editLoading: false, | ||
| 167 | + editFormRules: { | ||
| 168 | + roleName: [ | ||
| 169 | + { required: true, message: '请输入岗位/角色名称', trigger: 'blur' } | ||
| 170 | + ] | ||
| 171 | + }, | ||
| 172 | + //编辑界面数据 | ||
| 173 | + editForm: { | ||
| 174 | + roleId: 1, | ||
| 175 | + description: '', | ||
| 176 | + roleName: '', | ||
| 177 | + roleSign: 1, | ||
| 178 | + departmentId:'' | ||
| 179 | + }, | ||
| 180 | + //用户ID | ||
| 181 | + //新增界面是否显示 | ||
| 182 | + electrixityAddFormVisible: false, | ||
| 183 | + //设置权限界面是否显示 | ||
| 184 | + addLoading: false, | ||
| 185 | + addFormRules: { | ||
| 186 | + roleName: [ | ||
| 187 | + { required: true, message: '请输入岗位/角色名称', trigger: 'blur' } | ||
| 188 | + ], | ||
| 189 | + description: [ | ||
| 190 | + { required: true, message: '请输入岗位/角色描述', trigger: 'blur' } | ||
| 191 | + ] | ||
| 192 | + }, | ||
| 193 | + //水表参数配置、界面数据 | ||
| 194 | + electrixityAddForm: { | ||
| 195 | + prepaid: '', | ||
| 196 | + warningtrip: '', | ||
| 197 | + warningthreshold: '', | ||
| 198 | + overdraft:'', | ||
| 199 | + overdraftthreshold: '', | ||
| 200 | + load: '', | ||
| 201 | + power: '', | ||
| 202 | + powerfactor: '', | ||
| 203 | + freeelectricitylimit: '', | ||
| 204 | + eeId: '' | ||
| 205 | + }, | ||
| 206 | + permForm: { | ||
| 207 | + roleId: 1, | ||
| 208 | + description: '', | ||
| 209 | + roleName: '', | ||
| 210 | + roleSign: 1, | ||
| 211 | + permissions: [] | ||
| 212 | + }, | ||
| 213 | + centerDialogVisible: false, | ||
| 214 | + dialogData:{ | ||
| 215 | + process:{ | ||
| 216 | + processname: '' | ||
| 217 | + } | ||
| 218 | + }, | ||
| 219 | + pickerOptions: { | ||
| 220 | + disabledDate(time) { | ||
| 221 | + return time.getTime() < Date.now(); | ||
| 222 | + }, | ||
| 223 | + shortcuts: [{ | ||
| 224 | + text: '今天', | ||
| 225 | + onClick(picker) { | ||
| 226 | + picker.$emit('pick', new Date()); | ||
| 227 | + } | ||
| 228 | + }, { | ||
| 229 | + text: '昨天', | ||
| 230 | + onClick(picker) { | ||
| 231 | + const date = new Date(); | ||
| 232 | + date.setTime(date.getTime() - 3600 * 1000 * 24); | ||
| 233 | + picker.$emit('pick', date); | ||
| 234 | + } | ||
| 235 | + }, { | ||
| 236 | + text: '一周前', | ||
| 237 | + onClick(picker) { | ||
| 238 | + const date = new Date(); | ||
| 239 | + date.setTime(date.getTime() - 3600 * 1000 * 24 * 7); | ||
| 240 | + picker.$emit('pick', date); | ||
| 241 | + } | ||
| 242 | + }] | ||
| 243 | + }, | ||
| 244 | + options:[{ | ||
| 245 | + value: '1', | ||
| 246 | + label: '测试公司', | ||
| 247 | + children: [{ | ||
| 248 | + value: '2', | ||
| 249 | + label: '测试部门一', | ||
| 250 | + children: [{ | ||
| 251 | + value: '1', | ||
| 252 | + label: '测试岗位1', | ||
| 253 | + children: [{ | ||
| 254 | + value: '1', | ||
| 255 | + label: '测试人员1' | ||
| 256 | + }] | ||
| 257 | + }] | ||
| 258 | + }, { | ||
| 259 | + value: '3', | ||
| 260 | + label: '测试部门二', | ||
| 261 | + children: [{ | ||
| 262 | + value: '2', | ||
| 263 | + label: '测试岗位2', | ||
| 264 | + children: [{ | ||
| 265 | + value: '1', | ||
| 266 | + label: '测试人员2' | ||
| 267 | + }] | ||
| 268 | + }, { | ||
| 269 | + value: '3', | ||
| 270 | + label: '测试岗位3', | ||
| 271 | + children: [{ | ||
| 272 | + value: '1', | ||
| 273 | + label: '测试人员3' | ||
| 274 | + }] | ||
| 275 | + }] | ||
| 276 | + }] | ||
| 277 | + }], | ||
| 278 | + } | ||
| 279 | + }, | ||
| 280 | + methods: { | ||
| 281 | + //性别显示转换 | ||
| 282 | + formatType: function (row, column) { | ||
| 283 | + let msg = '未知'; | ||
| 284 | + switch (row.type){ | ||
| 285 | + case 0: | ||
| 286 | + msg='公寓'; | ||
| 287 | + break; | ||
| 288 | + case 1: | ||
| 289 | + msg='楼'; | ||
| 290 | + break; | ||
| 291 | + case 2: | ||
| 292 | + msg='层'; | ||
| 293 | + break; | ||
| 294 | + case 3: | ||
| 295 | + msg='门牌'; | ||
| 296 | + break; | ||
| 297 | + } | ||
| 298 | + return msg; | ||
| 299 | + }, | ||
| 300 | + handleCurrentChange(val) { | ||
| 301 | + this.pageNum = val; | ||
| 302 | + }, | ||
| 303 | + //获取列表 | ||
| 304 | + getList() { | ||
| 305 | + let para = { | ||
| 306 | + pageNum: this.pageNum, | ||
| 307 | + pageSize: this.pageSize, | ||
| 308 | + }; | ||
| 309 | + this.listLoading = true; | ||
| 310 | + //NProgress.start(); | ||
| 311 | + getList(para).then((res) => { | ||
| 312 | + let resData = res.data.data; | ||
| 313 | + this.total = resData.total; | ||
| 314 | + this.locationList = resData.list; | ||
| 315 | + this.listLoading = false; | ||
| 316 | + //NProgress.done(); | ||
| 317 | + }).catch((error) => { | ||
| 318 | + this.listLoading = false; | ||
| 319 | + if(null!= error.response && error.response!==undefined){ | ||
| 320 | + let status= error.response.status; | ||
| 321 | + let msg = error.response.statusText; | ||
| 322 | + alert(status+msg); | ||
| 323 | + }else { | ||
| 324 | + alert(error); | ||
| 325 | + } | ||
| 326 | + | ||
| 327 | + }); | ||
| 328 | + | ||
| 329 | + }, | ||
| 330 | + //删除 | ||
| 331 | + handleDel: function (index, row) { | ||
| 332 | + this.$confirm('确认删除该记录吗?', '提示', { | ||
| 333 | + type: 'warning' | ||
| 334 | + }).then(() => { | ||
| 335 | + this.listLoading = true; | ||
| 336 | + //NProgress.start(); | ||
| 337 | + let para = { roleId: row.roleId }; | ||
| 338 | + remove(para).then((res) => { | ||
| 339 | + this.listLoading = false; | ||
| 340 | + //NProgress.done(); | ||
| 341 | + this.$message({ | ||
| 342 | + message: '删除成功', | ||
| 343 | + type: 'success' | ||
| 344 | + }); | ||
| 345 | + }).catch((error) => { | ||
| 346 | + this.listLoading = false; | ||
| 347 | + alert(error); | ||
| 348 | + }); | ||
| 349 | + }).catch(); | ||
| 350 | + }, | ||
| 351 | + /** | ||
| 352 | + * 显示编辑界面 | ||
| 353 | + * @param index | ||
| 354 | + * @param row 为这行的数据对象 | ||
| 355 | + */ | ||
| 356 | + handleEdit: function (index, row) { | ||
| 357 | + this.editFormVisible = true; | ||
| 358 | + this.editForm = Object.assign({}, row); | ||
| 359 | + this.getdepartmentNames(); | ||
| 360 | + }, | ||
| 361 | + //水表参数配置新增界面,每次点开初始化数据 | ||
| 362 | + electrixityMeterConfiguration: function (row) { | ||
| 363 | + this.electrixityAddFormVisible = true; | ||
| 364 | + this.electrixityAddForm = { | ||
| 365 | + prepaid: '', | ||
| 366 | + warningtrip: '', | ||
| 367 | + warningthreshold: '', | ||
| 368 | + overdraft:'', | ||
| 369 | + overdraftthreshold: '', | ||
| 370 | + load: '', | ||
| 371 | + water: '', | ||
| 372 | + free: '', | ||
| 373 | + freeWater: '', | ||
| 374 | + eeId: row.eeId | ||
| 375 | + } | ||
| 376 | + }, | ||
| 377 | + | ||
| 378 | + //新增 | ||
| 379 | + addSubmit: function () { | ||
| 380 | + this.$refs.electrixityAddForm.validate((valid) => { | ||
| 381 | + if (valid) { | ||
| 382 | + this.$confirm('确认提交吗?', '提示', {}).then(() => { | ||
| 383 | + this.addLoading = true; | ||
| 384 | + //NProgress.start(); | ||
| 385 | + let para = Object.assign({}, this.electrixityAddForm); | ||
| 386 | + add(para).then((res) => { | ||
| 387 | + this.addLoading = false; | ||
| 388 | + if (res.status ===200) { | ||
| 389 | + this.$message({ | ||
| 390 | + message: '提交成功', | ||
| 391 | + type: 'success' | ||
| 392 | + }); | ||
| 393 | + this.$refs['permForm'].resetFields(); | ||
| 394 | + this.electrixityAddFormVisible = false; | ||
| 395 | + this.getList(); | ||
| 396 | + } | ||
| 397 | + }).catch(error => alert(error)); | ||
| 398 | + }); | ||
| 399 | + } | ||
| 400 | + }); | ||
| 401 | + }, | ||
| 402 | + | ||
| 403 | + //编辑 | ||
| 404 | + editSubmit: function () { | ||
| 405 | + this.$refs.editForm.validate((valid) => { | ||
| 406 | + if (valid) { | ||
| 407 | + this.$confirm('确认提交吗?', '提示', {}).then(() => { | ||
| 408 | + this.editLoading = true; | ||
| 409 | + //NProgress.start(); | ||
| 410 | + let para = Object.assign({}, this.editForm); | ||
| 411 | + //不需要提交的 去掉,后端不好接收 | ||
| 412 | + para.authorities = null; | ||
| 413 | + para.permissions = null; | ||
| 414 | + para.roles = null; | ||
| 415 | +// para.birth = (!para.birth || para.birth == '') ? '' : util.formatDate.format(new Date(para.birth), 'yyyy-MM-dd'); | ||
| 416 | + /* | ||
| 417 | + 查询之后格式this.filters.column.create_start_date中日期发生变化; | ||
| 418 | + Wed Aug 09 2017 00:00:00 GMT+0800 (中国标准时间) 变成了 "2017-08-08T16:00:00.000Z"; | ||
| 419 | + 所以使用 moment 日期格式化插件将时间转换成 [ Wed Aug 09 2017 00:00:00 GMT+0800 (中国标准时间) ] 格 | ||
| 420 | + 式; | ||
| 421 | + */ | ||
| 422 | + /*moment 安装 npm install moment --save*/ | ||
| 423 | + para.creattime = moment(para.creattime).format('YYYY-MM-DD HH:mm:ss'); | ||
| 424 | + this.editLoading = false; | ||
| 425 | + edit(para).then((res) => { | ||
| 426 | + | ||
| 427 | + //NProgress.done(); | ||
| 428 | + this.$message({ | ||
| 429 | + message: '提交成功', | ||
| 430 | + type: 'success' | ||
| 431 | + }); | ||
| 432 | + this.$refs['editForm'].resetFields(); | ||
| 433 | + this.editFormVisible = false; | ||
| 434 | + }).catch(error => alert(error)); | ||
| 435 | + }); | ||
| 436 | + } | ||
| 437 | + }); | ||
| 438 | + }, | ||
| 439 | + selsChange: function (sels) { | ||
| 440 | + this.sels = sels; | ||
| 441 | + }, | ||
| 442 | + //批量删除 | ||
| 443 | + batchRemove: function () { | ||
| 444 | + var ids = this.sels.map(item => item.roleId).toString(); | ||
| 445 | + this.$confirm('确认删除选中记录吗?', '提示', { | ||
| 446 | + type: 'warning' | ||
| 447 | + }).then(() => { | ||
| 448 | + this.listLoading = true; | ||
| 449 | + //NProgress.start(); | ||
| 450 | + let para = { ids: ids }; | ||
| 451 | + batchRemove(para).then((res) => { | ||
| 452 | + this.listLoading = false; | ||
| 453 | + //NProgress.done(); | ||
| 454 | + this.$message({ | ||
| 455 | + message: '删除成功', | ||
| 456 | + type: 'success' | ||
| 457 | + }) | ||
| 458 | + }); | ||
| 459 | + }).catch(() => { | ||
| 460 | + | ||
| 461 | + }); | ||
| 462 | + }, | ||
| 463 | + tableRowClassName({row, rowIndex}) { | ||
| 464 | + let type = row.type; | ||
| 465 | + if (type === 1) { | ||
| 466 | + return 'building'; | ||
| 467 | + } else if (type === 2) { | ||
| 468 | + return 'floor'; | ||
| 469 | + } else if (type === 3){ | ||
| 470 | + return 'house'; | ||
| 471 | + } | ||
| 472 | + return ''; | ||
| 473 | + }, | ||
| 474 | + handleSelectionChange(val) { | ||
| 475 | + this.multipleSelection = val | ||
| 476 | + }, | ||
| 477 | + }, | ||
| 478 | + mounted() { | ||
| 479 | + this.userId = loginUserInfo.userId; | ||
| 480 | + this.realName = loginUserInfo.realname; | ||
| 481 | + this.getList(); | ||
| 482 | + } | ||
| 483 | + } | ||
| 484 | + | ||
| 485 | +</script> | ||
| 486 | + | ||
| 487 | +<style scoped> | ||
| 488 | + | ||
| 489 | +</style> |
src/views/hqpt/Job.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <section> | ||
| 3 | + <el-dialog | ||
| 4 | + :data="dialogData" | ||
| 5 | + title="执行过程" | ||
| 6 | + :visible.sync="centerDialogVisible" | ||
| 7 | + width="30%" | ||
| 8 | + center> | ||
| 9 | + <span>{{dialogData.process.processname}}</span> | ||
| 10 | + <span>{{dialogData.coment}}</span> | ||
| 11 | + <span slot="footer" class="dialog-footer"> | ||
| 12 | + <el-button @click="centerDialogVisible = false">取 消</el-button> | ||
| 13 | + <el-button type="primary" @click="centerDialogVisible = false">确 定</el-button> | ||
| 14 | + </span> | ||
| 15 | + </el-dialog> | ||
| 16 | + <!--工具条--> | ||
| 17 | + <el-col :span="24" class="toolbar" style="padding-bottom: 0px;"> | ||
| 18 | + <el-form :inline="true" :model="filters"> | ||
| 19 | + <el-form-item> | ||
| 20 | + <el-input v-model="filters.processName" placeholder="工单名称"></el-input> | ||
| 21 | + </el-form-item> | ||
| 22 | + <el-form-item> | ||
| 23 | + <el-button type="primary" v-on:click="getProcessList()">查询</el-button> | ||
| 24 | + </el-form-item> | ||
| 25 | + <el-form-item> | ||
| 26 | + <el-button type="primary" @click="handleAdd()">新增</el-button> | ||
| 27 | + </el-form-item> | ||
| 28 | + </el-form> | ||
| 29 | + </el-col> | ||
| 30 | + | ||
| 31 | + <!--列表--> | ||
| 32 | + <el-table :data="processList" highlight-current-row v-loading="listLoading" @selection-change="selsChange" style="width: 100%;"> | ||
| 33 | + <el-table-column type="selection" width="55"> | ||
| 34 | + </el-table-column> | ||
| 35 | + <el-table-column type="index" width="60"> | ||
| 36 | + </el-table-column> | ||
| 37 | + <el-table-column prop="process.processname" label="工单名称" width="100"> | ||
| 38 | + </el-table-column> | ||
| 39 | + <el-table-column prop="user.realname" label="执行者" min-width="100" sortable> | ||
| 40 | + </el-table-column> | ||
| 41 | + <el-table-column prop="auditresuld" label="执行状态" min-width="80" :formatter="formatType" sortable> | ||
| 42 | + </el-table-column> | ||
| 43 | + <el-table-column label="操作" min-width="260"> | ||
| 44 | + <template slot-scope="scope"> | ||
| 45 | + <el-button size="small" @click="startJob(scope.$index, scope.row)">开始执行</el-button> | ||
| 46 | + <el-button size="small" @click="setPerm(scope.$index, scope.row)">完成任务</el-button> | ||
| 47 | + <el-button size="small" @click="setPerm(scope.$index, scope.row)">任务转交</el-button> | ||
| 48 | + <el-button size="small" @click="shwoDialog(scope.$index, scope.row)">任务内容</el-button> | ||
| 49 | + <el-button type="danger" size="small" @click="handleDel(scope.$index, scope.row)">删除</el-button> | ||
| 50 | + </template> | ||
| 51 | + </el-table-column> | ||
| 52 | + </el-table> | ||
| 53 | + | ||
| 54 | + <!--工具条--> | ||
| 55 | + <el-col :span="24" class="toolbar"> | ||
| 56 | + <el-button type="danger" @click="batchRemove" :disabled="this.sels.length===0">批量删除</el-button> | ||
| 57 | + <el-pagination layout="prev, pager, next" @current-change="handleCurrentChange" :page-size="5" :total="total" style="float:right;"> | ||
| 58 | + </el-pagination> | ||
| 59 | + </el-col> | ||
| 60 | + | ||
| 61 | + <!--编辑界面--> | ||
| 62 | + <el-dialog title="编辑" :visible.sync="editFormVisible" :close-on-click-modal="false"> | ||
| 63 | + <el-form :model="editForm" label-width="80px" :rules="editFormRules" ref="editForm"> | ||
| 64 | + <el-form-item label="ID"> | ||
| 65 | + <span>{{editForm.roleId}}</span> | ||
| 66 | + </el-form-item> | ||
| 67 | + <el-form-item label="岗位名称"> | ||
| 68 | + <el-input v-model="editForm.roleName" auto-complete="off" placeholder="请输入岗位/角色名称:例如:ROLE_name"></el-input> | ||
| 69 | + </el-form-item> | ||
| 70 | + <el-form-item label="岗位描述"> | ||
| 71 | + <el-input v-model="editForm.description" auto-complete="off" placeholder="请输入岗位/角色描述:例如:用户管理员"></el-input> | ||
| 72 | + </el-form-item> | ||
| 73 | + <el-form-item label="部门名称"> | ||
| 74 | + <el-select v-model="editForm.departmentId" placeholder="请选择"> | ||
| 75 | + <el-option | ||
| 76 | + v-for="item in departmentNameList" | ||
| 77 | + :key="item.departmentId" | ||
| 78 | + :label="item.departmentName" | ||
| 79 | + :value="item.departmentId"> | ||
| 80 | + </el-option> | ||
| 81 | + </el-select> | ||
| 82 | + </el-form-item> | ||
| 83 | + </el-form> | ||
| 84 | + <div slot="footer" class="dialog-footer"> | ||
| 85 | + <el-button @click.native="editFormVisible = false">取消</el-button> | ||
| 86 | + <el-button type="primary" @click.native="editSubmit" :loading="editLoading">提交</el-button> | ||
| 87 | + </div> | ||
| 88 | + </el-dialog> | ||
| 89 | + | ||
| 90 | + <!--新增界面--> | ||
| 91 | + <el-dialog title="新增" :visible.sync="addFormVisible" width="60%"> | ||
| 92 | + <el-form :model="addForm" label-width="80px" :rules="addFormRules" ref="addForm"> | ||
| 93 | + <el-form-item label="工单名称" prop="processname"> | ||
| 94 | + <el-input v-model="addForm.processname" auto-complete="off" placeholder="请输入工单标题:"></el-input> | ||
| 95 | + </el-form-item> | ||
| 96 | + <el-form-item label="开始日期" prop="begindate"> | ||
| 97 | + <el-date-picker :picker-options="pickerOptions" value-format="yyyy-MM-dd" placeholder="选择时间" v-model="addForm.begindate" style="width: 100%;"></el-date-picker> | ||
| 98 | + </el-form-item> | ||
| 99 | + <el-form-item label="结束日期" prop="enddate"> | ||
| 100 | + <el-date-picker :picker-options="pickerOptions" value-format="yyyy-MM-dd" placeholder="选择时间" v-model="addForm.enddate" style="width: 100%;"></el-date-picker> | ||
| 101 | + </el-form-item> | ||
| 102 | + <el-form-item label="工单类型" prop="vacationtype"> | ||
| 103 | + <el-select v-model="addForm.vacationtype" placeholder="请选择"> | ||
| 104 | + <el-option label="运维检查" value="0"></el-option> | ||
| 105 | + <el-option label="设备故障" value="1"></el-option> | ||
| 106 | + <el-option label="电话报修" value="3"></el-option> | ||
| 107 | + </el-select> | ||
| 108 | + </el-form-item> | ||
| 109 | + <el-form-item label="工单内容" prop="reason"> | ||
| 110 | + <el-input type="textarea" v-model="addForm.reason"></el-input> | ||
| 111 | + </el-form-item> | ||
| 112 | + <el-form-item> | ||
| 113 | + <el-cascader-panel | ||
| 114 | + :options="options" | ||
| 115 | + v-model="jodUserId" | ||
| 116 | + @change="cascaderhandleChange" | ||
| 117 | + ></el-cascader-panel> | ||
| 118 | + </el-form-item> | ||
| 119 | + </el-form> | ||
| 120 | + <div slot="footer" class="dialog-footer"> | ||
| 121 | + <el-button @click.native="addFormVisible = false">取消</el-button> | ||
| 122 | + <el-button type="primary" @click.native="addSubmit" :loading="addLoading">提交</el-button> | ||
| 123 | + </div> | ||
| 124 | + </el-dialog> | ||
| 125 | + </section> | ||
| 126 | +</template> | ||
| 127 | + | ||
| 128 | +<script> | ||
| 129 | + import util from '../../common/js/util' | ||
| 130 | + import { getList,add,startJob} from '@/api/job_api'; | ||
| 131 | + import moment from 'moment' | ||
| 132 | + import parseTime from '@/utils' | ||
| 133 | + import loginUserInfo from '@/api/base' | ||
| 134 | + import ElFormItem from "../../../node_modules/element-ui/packages/form/src/form-item.vue"; | ||
| 135 | + export default { | ||
| 136 | + components: {ElFormItem}, | ||
| 137 | + data() { | ||
| 138 | + return { | ||
| 139 | + filters: { | ||
| 140 | + processName: '', | ||
| 141 | + parseTime: parseTime | ||
| 142 | + }, | ||
| 143 | + departmentNameList:[], | ||
| 144 | + processList: [], | ||
| 145 | + permissons: [], | ||
| 146 | + permIds: [], | ||
| 147 | + total: 0, | ||
| 148 | + pageNum: 1, | ||
| 149 | + pageSize: 5, | ||
| 150 | + listLoading: false, | ||
| 151 | + sels: [],//列表选中列 | ||
| 152 | + //编辑界面是否显示 | ||
| 153 | + editFormVisible: false, | ||
| 154 | + editLoading: false, | ||
| 155 | + editFormRules: { | ||
| 156 | + roleName: [ | ||
| 157 | + { required: true, message: '请输入岗位/角色名称', trigger: 'blur' } | ||
| 158 | + ] | ||
| 159 | + }, | ||
| 160 | + //编辑界面数据 | ||
| 161 | + editForm: { | ||
| 162 | + roleId: 1, | ||
| 163 | + description: '', | ||
| 164 | + roleName: '', | ||
| 165 | + roleSign: 1, | ||
| 166 | + departmentId:'' | ||
| 167 | + }, | ||
| 168 | + //用户ID | ||
| 169 | + | ||
| 170 | + //执行任务人ID | ||
| 171 | + jodUserId: 0, | ||
| 172 | + //新增界面是否显示 | ||
| 173 | + addFormVisible: false, | ||
| 174 | + //设置权限界面是否显示 | ||
| 175 | + PermFormVisible: false, | ||
| 176 | + addLoading: false, | ||
| 177 | + addFormRules: { | ||
| 178 | + roleName: [ | ||
| 179 | + { required: true, message: '请输入岗位/角色名称', trigger: 'blur' } | ||
| 180 | + ], | ||
| 181 | + description: [ | ||
| 182 | + { required: true, message: '请输入岗位/角色描述', trigger: 'blur' } | ||
| 183 | + ] | ||
| 184 | + }, | ||
| 185 | + //新增界面数据 | ||
| 186 | + addForm: { | ||
| 187 | + processname: '', | ||
| 188 | + begindate: '', | ||
| 189 | + enddate: '', | ||
| 190 | + vacationtype:'', | ||
| 191 | + reason: '', | ||
| 192 | + userId: '' | ||
| 193 | + }, | ||
| 194 | + permForm: { | ||
| 195 | + roleId: 1, | ||
| 196 | + description: '', | ||
| 197 | + roleName: '', | ||
| 198 | + roleSign: 1, | ||
| 199 | + permissions: [] | ||
| 200 | + }, | ||
| 201 | + centerDialogVisible: false, | ||
| 202 | + dialogData:{ | ||
| 203 | + process:{ | ||
| 204 | + processname: '' | ||
| 205 | + } | ||
| 206 | + }, | ||
| 207 | + pickerOptions: { | ||
| 208 | + disabledDate(time) { | ||
| 209 | + return time.getTime() < Date.now(); | ||
| 210 | + }, | ||
| 211 | + shortcuts: [{ | ||
| 212 | + text: '今天', | ||
| 213 | + onClick(picker) { | ||
| 214 | + picker.$emit('pick', new Date()); | ||
| 215 | + } | ||
| 216 | + }, { | ||
| 217 | + text: '昨天', | ||
| 218 | + onClick(picker) { | ||
| 219 | + const date = new Date(); | ||
| 220 | + date.setTime(date.getTime() - 3600 * 1000 * 24); | ||
| 221 | + picker.$emit('pick', date); | ||
| 222 | + } | ||
| 223 | + }, { | ||
| 224 | + text: '一周前', | ||
| 225 | + onClick(picker) { | ||
| 226 | + const date = new Date(); | ||
| 227 | + date.setTime(date.getTime() - 3600 * 1000 * 24 * 7); | ||
| 228 | + picker.$emit('pick', date); | ||
| 229 | + } | ||
| 230 | + }] | ||
| 231 | + }, | ||
| 232 | + options:[{ | ||
| 233 | + value: '1', | ||
| 234 | + label: '测试公司', | ||
| 235 | + children: [{ | ||
| 236 | + value: '2', | ||
| 237 | + label: '测试部门一', | ||
| 238 | + children: [{ | ||
| 239 | + value: '1', | ||
| 240 | + label: '测试岗位1', | ||
| 241 | + children: [{ | ||
| 242 | + value: '1', | ||
| 243 | + label: '测试人员1' | ||
| 244 | + }] | ||
| 245 | + }] | ||
| 246 | + }, { | ||
| 247 | + value: '3', | ||
| 248 | + label: '测试部门二', | ||
| 249 | + children: [{ | ||
| 250 | + value: '2', | ||
| 251 | + label: '测试岗位2', | ||
| 252 | + children: [{ | ||
| 253 | + value: '1', | ||
| 254 | + label: '测试人员2' | ||
| 255 | + }] | ||
| 256 | + }, { | ||
| 257 | + value: '3', | ||
| 258 | + label: '测试岗位3', | ||
| 259 | + children: [{ | ||
| 260 | + value: '1', | ||
| 261 | + label: '测试人员3' | ||
| 262 | + }] | ||
| 263 | + }] | ||
| 264 | + }] | ||
| 265 | + }], | ||
| 266 | + } | ||
| 267 | + }, | ||
| 268 | + methods: { | ||
| 269 | + //性别显示转换 | ||
| 270 | + formatType: function (row, column) { | ||
| 271 | + let msg = '未知'; | ||
| 272 | + switch (row.auditresuld){ | ||
| 273 | + case 0: | ||
| 274 | + msg='未执行'; | ||
| 275 | + break; | ||
| 276 | + case 1: | ||
| 277 | + msg='执行中'; | ||
| 278 | + break; | ||
| 279 | + case 2: | ||
| 280 | + msg='执行完毕'; | ||
| 281 | + break; | ||
| 282 | + case 3: | ||
| 283 | + msg='任务转交'; | ||
| 284 | + break; | ||
| 285 | + } | ||
| 286 | + return msg; | ||
| 287 | + }, | ||
| 288 | + formatState: function (row, column) { | ||
| 289 | + let msg = '未知'; | ||
| 290 | + switch (row.processstatus){ | ||
| 291 | + case 0: | ||
| 292 | + msg='未分配'; | ||
| 293 | + break; | ||
| 294 | + case 1: | ||
| 295 | + msg='已分配'; | ||
| 296 | + break; | ||
| 297 | + case 2: | ||
| 298 | + msg='执行中'; | ||
| 299 | + break; | ||
| 300 | + case 3: | ||
| 301 | + msg='已完成'; | ||
| 302 | + break; | ||
| 303 | + } | ||
| 304 | + return msg; | ||
| 305 | + }, | ||
| 306 | + handleCurrentChange(val) { | ||
| 307 | + this.pageNum = val; | ||
| 308 | + }, | ||
| 309 | + //获取工单列表 | ||
| 310 | + getProcessList() { | ||
| 311 | + let para = { | ||
| 312 | + pageNum: this.pageNum, | ||
| 313 | + pageSize: this.pageSize, | ||
| 314 | + userId: 0, | ||
| 315 | + processid: this.$route.params.formid | ||
| 316 | + }; | ||
| 317 | + this.listLoading = true; | ||
| 318 | + //NProgress.start(); | ||
| 319 | + getList(para).then((res) => { | ||
| 320 | + let resData = res.data.data; | ||
| 321 | + this.total = resData.total; | ||
| 322 | + this.processList = resData.list; | ||
| 323 | + this.listLoading = false; | ||
| 324 | + //NProgress.done(); | ||
| 325 | + }).catch((error) => { | ||
| 326 | + this.listLoading = false; | ||
| 327 | + if(null!= error.response && error.response!==undefined){ | ||
| 328 | + let status= error.response.status; | ||
| 329 | + let msg = error.response.statusText; | ||
| 330 | + alert(status+msg); | ||
| 331 | + }else { | ||
| 332 | + alert(error); | ||
| 333 | + } | ||
| 334 | + | ||
| 335 | + }); | ||
| 336 | + | ||
| 337 | + }, | ||
| 338 | + //删除 | ||
| 339 | + handleDel: function (index, row) { | ||
| 340 | + this.$confirm('确认删除该记录吗?', '提示', { | ||
| 341 | + type: 'warning' | ||
| 342 | + }).then(() => { | ||
| 343 | + this.listLoading = true; | ||
| 344 | + //NProgress.start(); | ||
| 345 | + let para = { roleId: row.roleId }; | ||
| 346 | + remove(para).then((res) => { | ||
| 347 | + this.listLoading = false; | ||
| 348 | + //NProgress.done(); | ||
| 349 | + this.$message({ | ||
| 350 | + message: '删除成功', | ||
| 351 | + type: 'success' | ||
| 352 | + }); | ||
| 353 | + }).catch((error) => { | ||
| 354 | + this.listLoading = false; | ||
| 355 | + alert(error); | ||
| 356 | + }); | ||
| 357 | + }).catch(); | ||
| 358 | + }, | ||
| 359 | + /** | ||
| 360 | + * 显示编辑界面 | ||
| 361 | + * @param index | ||
| 362 | + * @param row 为这行的数据对象 | ||
| 363 | + */ | ||
| 364 | + handleEdit: function (index, row) { | ||
| 365 | + this.editFormVisible = true; | ||
| 366 | + this.editForm = Object.assign({}, row); | ||
| 367 | + this.getdepartmentNames(); | ||
| 368 | + }, | ||
| 369 | + //显示新增界面,每次点开初始化数据 | ||
| 370 | + handleAdd: function () { | ||
| 371 | + this.addFormVisible = true; | ||
| 372 | + this.addForm = { | ||
| 373 | + processname: '', | ||
| 374 | + begindate: '', | ||
| 375 | + enddate: '', | ||
| 376 | + vacationtype:'', | ||
| 377 | + reason: '', | ||
| 378 | + userid: loginUserInfo.userId | ||
| 379 | + } | ||
| 380 | + }, | ||
| 381 | + //编辑 | ||
| 382 | + editSubmit: function () { | ||
| 383 | + this.$refs.editForm.validate((valid) => { | ||
| 384 | + if (valid) { | ||
| 385 | + this.$confirm('确认提交吗?', '提示', {}).then(() => { | ||
| 386 | + this.editLoading = true; | ||
| 387 | + //NProgress.start(); | ||
| 388 | + let para = Object.assign({}, this.editForm); | ||
| 389 | + //不需要提交的 去掉,后端不好接收 | ||
| 390 | + para.authorities = null; | ||
| 391 | + para.permissions = null; | ||
| 392 | + para.roles = null; | ||
| 393 | +// para.birth = (!para.birth || para.birth == '') ? '' : util.formatDate.format(new Date(para.birth), 'yyyy-MM-dd'); | ||
| 394 | + /* | ||
| 395 | + 查询之后格式this.filters.column.create_start_date中日期发生变化; | ||
| 396 | + Wed Aug 09 2017 00:00:00 GMT+0800 (中国标准时间) 变成了 "2017-08-08T16:00:00.000Z"; | ||
| 397 | + 所以使用 moment 日期格式化插件将时间转换成 [ Wed Aug 09 2017 00:00:00 GMT+0800 (中国标准时间) ] 格 | ||
| 398 | + 式; | ||
| 399 | + */ | ||
| 400 | + /*moment 安装 npm install moment --save*/ | ||
| 401 | + para.creattime = moment(para.creattime).format('YYYY-MM-DD HH:mm:ss'); | ||
| 402 | + this.editLoading = false; | ||
| 403 | + edit(para).then((res) => { | ||
| 404 | + | ||
| 405 | + //NProgress.done(); | ||
| 406 | + this.$message({ | ||
| 407 | + message: '提交成功', | ||
| 408 | + type: 'success' | ||
| 409 | + }); | ||
| 410 | + this.$refs['editForm'].resetFields(); | ||
| 411 | + this.editFormVisible = false; | ||
| 412 | + }).catch(error => alert(error)); | ||
| 413 | + }); | ||
| 414 | + } | ||
| 415 | + }); | ||
| 416 | + }, | ||
| 417 | + //新增 | ||
| 418 | + addSubmit: function () { | ||
| 419 | + this.$refs.addForm.validate((valid) => { | ||
| 420 | + if (valid) { | ||
| 421 | + this.$confirm('确认提交吗?', '提示', {}).then(() => { | ||
| 422 | + this.addLoading = true; | ||
| 423 | + //NProgress.start(); | ||
| 424 | + let para = Object.assign({}, this.addForm); | ||
| 425 | + add(para).then((res) => { | ||
| 426 | + this.addLoading = false; | ||
| 427 | + if (res.status ===200) { | ||
| 428 | + this.$message({ | ||
| 429 | + message: '提交成功', | ||
| 430 | + type: 'success' | ||
| 431 | + }); | ||
| 432 | + this.$refs['permForm'].resetFields(); | ||
| 433 | + this.addFormVisible = false; | ||
| 434 | + this.getProcessList(); | ||
| 435 | + } | ||
| 436 | + }).catch(error => alert(error)); | ||
| 437 | + }); | ||
| 438 | + } | ||
| 439 | + }); | ||
| 440 | + }, | ||
| 441 | + startJob: function (index, row) { | ||
| 442 | + let loading = this.$loading({ fullscreen: true, | ||
| 443 | + background: 'gray', | ||
| 444 | + text: '正在处理'}); | ||
| 445 | + let jobdata = Object.assign({}, row); | ||
| 446 | + startJob(jobdata).then((res) => { | ||
| 447 | + if (res.status ===200) { | ||
| 448 | + this.getProcessList(); | ||
| 449 | + this.listLoading = false; | ||
| 450 | + this.$message({ | ||
| 451 | + message: '提交成功', | ||
| 452 | + type: 'success' | ||
| 453 | + }); | ||
| 454 | + } | ||
| 455 | + }).catch(error => alert(error)); | ||
| 456 | + loading.close(); | ||
| 457 | + }, | ||
| 458 | + selsChange: function (sels) { | ||
| 459 | + this.sels = sels; | ||
| 460 | + }, | ||
| 461 | + //批量删除 | ||
| 462 | + batchRemove: function () { | ||
| 463 | + var ids = this.sels.map(item => item.roleId).toString(); | ||
| 464 | + this.$confirm('确认删除选中记录吗?', '提示', { | ||
| 465 | + type: 'warning' | ||
| 466 | + }).then(() => { | ||
| 467 | + this.listLoading = true; | ||
| 468 | + //NProgress.start(); | ||
| 469 | + let para = { ids: ids }; | ||
| 470 | + batchRemove(para).then((res) => { | ||
| 471 | + this.listLoading = false; | ||
| 472 | + //NProgress.done(); | ||
| 473 | + this.$message({ | ||
| 474 | + message: '删除成功', | ||
| 475 | + type: 'success' | ||
| 476 | + }) | ||
| 477 | + }); | ||
| 478 | + }).catch(() => { | ||
| 479 | + | ||
| 480 | + }); | ||
| 481 | + }, | ||
| 482 | + shwoDialog(index,row) { | ||
| 483 | + this.dialogData = Object.assign({}, row); | ||
| 484 | + this.centerDialogVisible = true; | ||
| 485 | + }, | ||
| 486 | + cascaderhandleChange:function (value) { | ||
| 487 | + let defaultvalue = ["0","0","0","0"]; | ||
| 488 | + defaultvalue = value; | ||
| 489 | + console.log(defaultvalue); | ||
| 490 | + this.jodUserId = defaultvalue[3]; | ||
| 491 | + } | ||
| 492 | + }, | ||
| 493 | + mounted() { | ||
| 494 | + this.getProcessList(); | ||
| 495 | + } | ||
| 496 | + } | ||
| 497 | + | ||
| 498 | +</script> | ||
| 499 | + | ||
| 500 | +<style scoped> | ||
| 501 | + | ||
| 502 | +</style> |
src/views/hqpt/Process.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <section> | ||
| 3 | + <el-dialog | ||
| 4 | + :data="dialogData" | ||
| 5 | + title="提示" | ||
| 6 | + :visible.sync="centerDialogVisible" | ||
| 7 | + width="30%" | ||
| 8 | + center> | ||
| 9 | + <span>{{dialogData.reason}}</span> | ||
| 10 | + <span slot="footer" class="dialog-footer"> | ||
| 11 | + <el-button @click="centerDialogVisible = false">取 消</el-button> | ||
| 12 | + <el-button type="primary" @click="centerDialogVisible = false">确 定</el-button> | ||
| 13 | + </span> | ||
| 14 | + </el-dialog> | ||
| 15 | + <!--工具条--> | ||
| 16 | + <el-col :span="24" class="toolbar" style="padding-bottom: 0px;"> | ||
| 17 | + <el-form :inline="true" :model="filters"> | ||
| 18 | + <el-form-item> | ||
| 19 | + <el-input v-model="filters.processName" placeholder="工单名称"></el-input> | ||
| 20 | + </el-form-item> | ||
| 21 | + <el-form-item> | ||
| 22 | + <el-button type="primary" v-on:click="getProcessList()">查询</el-button> | ||
| 23 | + </el-form-item> | ||
| 24 | + <el-form-item> | ||
| 25 | + <el-button type="primary" @click="handleAdd()">新增</el-button> | ||
| 26 | + </el-form-item> | ||
| 27 | + </el-form> | ||
| 28 | + </el-col> | ||
| 29 | + | ||
| 30 | + <!--列表--> | ||
| 31 | + <el-table :data="processList" highlight-current-row v-loading="listLoading" @selection-change="selsChange" style="width: 100%;"> | ||
| 32 | + <el-table-column type="selection" width="55"> | ||
| 33 | + </el-table-column> | ||
| 34 | + <el-table-column type="index" width="60"> | ||
| 35 | + </el-table-column> | ||
| 36 | + <el-table-column prop="processname" label="工单名称" width="100"> | ||
| 37 | + <template slot-scope="scope"> | ||
| 38 | + <el-button size="small" type="text" @click="checkJobs(scope.$index, scope.row)">{{scope.row.processname}}</el-button> | ||
| 39 | + </template> | ||
| 40 | + </el-table-column> | ||
| 41 | + <el-table-column prop="user.realname" label="添加者" min-width="100" sortable> | ||
| 42 | + </el-table-column> | ||
| 43 | + <el-table-column label="开始日期" width="200px" align="center" sortable> | ||
| 44 | + <template slot-scope="scope"> | ||
| 45 | + <span>{{ scope.row.begindate}}</span> | ||
| 46 | + </template> | ||
| 47 | + </el-table-column> | ||
| 48 | + <el-table-column label="结束日期" width="200px" align="center" sortable> | ||
| 49 | + <template slot-scope="scope"> | ||
| 50 | + <span>{{ scope.row.enddate}}</span> | ||
| 51 | + </template> | ||
| 52 | + </el-table-column> | ||
| 53 | + <el-table-column prop="vacationtype" label="工单类型" min-width="80" :formatter="formatType" sortable> | ||
| 54 | + </el-table-column> | ||
| 55 | + <el-table-column prop="processstatus" label="工单状态" min-width="80" :formatter="formatState" sortable> | ||
| 56 | + </el-table-column> | ||
| 57 | + <el-table-column label="操作" min-width="260"> | ||
| 58 | + <template slot-scope="scope"> | ||
| 59 | + <!--<el-button size="small" @click="setPerm(scope.$index, scope.row)">分配工单</el-button>--> | ||
| 60 | + <el-button size="small" @click="shwoDialog(scope.$index, scope.row)">查看内容</el-button> | ||
| 61 | + <el-button size="small" @click="handleEdit(scope.$index, scope.row)">编辑</el-button> | ||
| 62 | + <el-button type="danger" size="small" @click="handleDel(scope.$index, scope.row)">删除</el-button> | ||
| 63 | + </template> | ||
| 64 | + </el-table-column> | ||
| 65 | + </el-table> | ||
| 66 | + | ||
| 67 | + <!--工具条--> | ||
| 68 | + <el-col :span="24" class="toolbar"> | ||
| 69 | + <el-button type="danger" @click="batchRemove" :disabled="this.sels.length===0">批量删除</el-button> | ||
| 70 | + <el-pagination layout="prev, pager, next" @current-change="handleCurrentChange" :page-size="5" :total="total" style="float:right;"> | ||
| 71 | + </el-pagination> | ||
| 72 | + </el-col> | ||
| 73 | + | ||
| 74 | + <!--编辑界面--> | ||
| 75 | + <el-dialog title="编辑" :visible.sync="editFormVisible" :close-on-click-modal="false"> | ||
| 76 | + <el-form :model="editForm" label-width="80px" :rules="editFormRules" ref="editForm"> | ||
| 77 | + <el-form-item label="ID"> | ||
| 78 | + <span>{{editForm.roleId}}</span> | ||
| 79 | + </el-form-item> | ||
| 80 | + <el-form-item label="岗位名称"> | ||
| 81 | + <el-input v-model="editForm.roleName" auto-complete="off" placeholder="请输入岗位/角色名称:例如:ROLE_name"></el-input> | ||
| 82 | + </el-form-item> | ||
| 83 | + <el-form-item label="岗位描述"> | ||
| 84 | + <el-input v-model="editForm.description" auto-complete="off" placeholder="请输入岗位/角色描述:例如:用户管理员"></el-input> | ||
| 85 | + </el-form-item> | ||
| 86 | + <el-form-item label="部门名称"> | ||
| 87 | + <el-select v-model="editForm.departmentId" placeholder="请选择"> | ||
| 88 | + <el-option | ||
| 89 | + v-for="item in departmentNameList" | ||
| 90 | + :key="item.departmentId" | ||
| 91 | + :label="item.departmentName" | ||
| 92 | + :value="item.departmentId"> | ||
| 93 | + </el-option> | ||
| 94 | + </el-select> | ||
| 95 | + </el-form-item> | ||
| 96 | + </el-form> | ||
| 97 | + <div slot="footer" class="dialog-footer"> | ||
| 98 | + <el-button @click.native="editFormVisible = false">取消</el-button> | ||
| 99 | + <el-button type="primary" @click.native="editSubmit" :loading="editLoading">提交</el-button> | ||
| 100 | + </div> | ||
| 101 | + </el-dialog> | ||
| 102 | + | ||
| 103 | + <!--新增界面--> | ||
| 104 | + <el-dialog title="新增" :visible.sync="addFormVisible" width="60%"> | ||
| 105 | + <el-form :model="addForm" label-width="80px" :rules="addFormRules" ref="addForm"> | ||
| 106 | + <el-form-item label="工单名称" prop="processname"> | ||
| 107 | + <el-input v-model="addForm.processname" auto-complete="off" placeholder="请输入工单标题:"></el-input> | ||
| 108 | + </el-form-item> | ||
| 109 | + <el-form-item label="开始日期" prop="begindate"> | ||
| 110 | + <el-date-picker :picker-options="pickerOptions" value-format="yyyy-MM-dd" placeholder="选择时间" v-model="addForm.begindate" style="width: 100%;"></el-date-picker> | ||
| 111 | + </el-form-item> | ||
| 112 | + <el-form-item label="结束日期" prop="enddate"> | ||
| 113 | + <el-date-picker :picker-options="pickerOptions" value-format="yyyy-MM-dd" placeholder="选择时间" v-model="addForm.enddate" style="width: 100%;"></el-date-picker> | ||
| 114 | + </el-form-item> | ||
| 115 | + <el-form-item label="工单类型" prop="vacationtype"> | ||
| 116 | + <el-cascader-panel | ||
| 117 | + :options="vacationTypeOptions" | ||
| 118 | + v-model="addForm.vacationtype" | ||
| 119 | + @change="cascaderhandleChange"></el-cascader-panel> | ||
| 120 | + </el-form-item> | ||
| 121 | + <el-form-item label="工单内容" prop="reason"> | ||
| 122 | + <el-input type="textarea" v-model="addForm.reason"></el-input> | ||
| 123 | + </el-form-item> | ||
| 124 | + <el-form-item label="指定部门"> | ||
| 125 | + <el-tree | ||
| 126 | + :data="options" | ||
| 127 | + v-model="addForm.jobuserid" | ||
| 128 | + show-checkbox | ||
| 129 | + ref="tree" | ||
| 130 | + node-key="value" | ||
| 131 | + @check-change="handleCheckChange" | ||
| 132 | + :props="defaultProps"> | ||
| 133 | + </el-tree> | ||
| 134 | + </el-form-item> | ||
| 135 | + </el-form> | ||
| 136 | + <div slot="footer" class="dialog-footer"> | ||
| 137 | + <el-button @click.native="addFormVisible = false">取消</el-button> | ||
| 138 | + <el-button type="primary" @click.native="addSubmit" :loading="addLoading">提交</el-button> | ||
| 139 | + </div> | ||
| 140 | + </el-dialog> | ||
| 141 | + </section> | ||
| 142 | +</template> | ||
| 143 | + | ||
| 144 | +<script> | ||
| 145 | + import util from '../../common/js/util' | ||
| 146 | + import NProgress from 'nprogress' | ||
| 147 | + import { getList,add,vacationTypeOptions} from '@/api/process_api'; | ||
| 148 | + import moment from 'moment' | ||
| 149 | + import {parseTime, pickerOptions} from '@/utils' | ||
| 150 | + import loginUserInfo from '@/api/base' | ||
| 151 | + import ElFormItem from "../../../node_modules/element-ui/packages/form/src/form-item.vue"; | ||
| 152 | + export default { | ||
| 153 | + components: {ElFormItem}, | ||
| 154 | + data() { | ||
| 155 | + return { | ||
| 156 | + filters: { | ||
| 157 | + processName: '', | ||
| 158 | + parseTime: parseTime | ||
| 159 | + }, | ||
| 160 | + departmentNameList:[], | ||
| 161 | + processList: [], | ||
| 162 | + permissons: [], | ||
| 163 | + permIds: [], | ||
| 164 | + total: 0, | ||
| 165 | + pageNum: 1, | ||
| 166 | + pageSize: 5, | ||
| 167 | + listLoading: false, | ||
| 168 | + sels: [],//列表选中列 | ||
| 169 | + //编辑界面是否显示 | ||
| 170 | + editFormVisible: false, | ||
| 171 | + editLoading: false, | ||
| 172 | + editFormRules: { | ||
| 173 | + roleName: [ | ||
| 174 | + { required: true, message: '请输入岗位/角色名称', trigger: 'blur' } | ||
| 175 | + ] | ||
| 176 | + }, | ||
| 177 | + //编辑界面数据 | ||
| 178 | + editForm: { | ||
| 179 | + roleId: 1, | ||
| 180 | + description: '', | ||
| 181 | + roleName: '', | ||
| 182 | + roleSign: 1, | ||
| 183 | + departmentId:'' | ||
| 184 | + }, | ||
| 185 | + //新增界面是否显示 | ||
| 186 | + addFormVisible: false, | ||
| 187 | + //设置权限界面是否显示 | ||
| 188 | + PermFormVisible: false, | ||
| 189 | + addLoading: false, | ||
| 190 | + addFormRules: { | ||
| 191 | + roleName: [ | ||
| 192 | + { required: true, message: '请输入岗位/角色名称', trigger: 'blur' } | ||
| 193 | + ], | ||
| 194 | + description: [ | ||
| 195 | + { required: true, message: '请输入岗位/角色描述', trigger: 'blur' } | ||
| 196 | + ] | ||
| 197 | + }, | ||
| 198 | + //新增界面数据 | ||
| 199 | + addForm: { | ||
| 200 | + processname: '', | ||
| 201 | + begindate: '', | ||
| 202 | + enddate: '', | ||
| 203 | + vacationtype:'', | ||
| 204 | + reason: '', | ||
| 205 | + userId: '', | ||
| 206 | + jobuserid: 0 | ||
| 207 | + }, | ||
| 208 | + jobForm: { | ||
| 209 | + taskid: 1, | ||
| 210 | + userid: 1, | ||
| 211 | + auditresuld: '' | ||
| 212 | + }, | ||
| 213 | + centerDialogVisible: false, | ||
| 214 | + dialogData:{}, | ||
| 215 | + options:[{ | ||
| 216 | + value: '1', | ||
| 217 | + label: '测试公司', | ||
| 218 | + children: [{ | ||
| 219 | + value: '2', | ||
| 220 | + label: '测试部门一', | ||
| 221 | + children: [{ | ||
| 222 | + value: '1', | ||
| 223 | + label: '测试岗位1' | ||
| 224 | + }] | ||
| 225 | + }, { | ||
| 226 | + value: '3', | ||
| 227 | + label: '测试部门二', | ||
| 228 | + children: [{ | ||
| 229 | + value: '2', | ||
| 230 | + label: '测试岗位2' | ||
| 231 | + }, { | ||
| 232 | + value: '3', | ||
| 233 | + label: '测试岗位3' | ||
| 234 | + }] | ||
| 235 | + }] | ||
| 236 | + }], | ||
| 237 | + defaultProps: { | ||
| 238 | + children: 'children', | ||
| 239 | + label: 'label' | ||
| 240 | + }, | ||
| 241 | + pickerOptions: pickerOptions, | ||
| 242 | + vacationTypeOptions: vacationTypeOptions | ||
| 243 | + } | ||
| 244 | + }, | ||
| 245 | + methods: { | ||
| 246 | + //性别显示转换 | ||
| 247 | + formatType: function (row, column) { | ||
| 248 | + return row.vacationtype == 1 ? '运维检查' : row.vacationtype == 0 ? '设备故障' : '电话报修'; | ||
| 249 | + }, | ||
| 250 | + formatState: function (row, column) { | ||
| 251 | + let msg = '未知'; | ||
| 252 | + switch (row.processstatus){ | ||
| 253 | + case 0: | ||
| 254 | + msg='未分配'; | ||
| 255 | + break; | ||
| 256 | + case 1: | ||
| 257 | + msg='已分配'; | ||
| 258 | + break; | ||
| 259 | + case 2: | ||
| 260 | + msg='执行中'; | ||
| 261 | + break; | ||
| 262 | + case 3: | ||
| 263 | + msg='已完成'; | ||
| 264 | + break; | ||
| 265 | + } | ||
| 266 | + return msg; | ||
| 267 | + }, | ||
| 268 | + handleCurrentChange(val) { | ||
| 269 | + this.pageNum = val; | ||
| 270 | + }, | ||
| 271 | + //获取工单列表 | ||
| 272 | + getProcessList() { | ||
| 273 | + let para = { | ||
| 274 | + pageNum: this.pageNum, | ||
| 275 | + pageSize: this.pageSize, | ||
| 276 | + roleName: this.filters.processName | ||
| 277 | + }; | ||
| 278 | + this.listLoading = true; | ||
| 279 | + //NProgress.start(); | ||
| 280 | + getList(para).then((res) => { | ||
| 281 | + let resData = res.data.data; | ||
| 282 | + this.total = resData.total; | ||
| 283 | + this.processList = resData.list; | ||
| 284 | + this.listLoading = false; | ||
| 285 | + //NProgress.done(); | ||
| 286 | + }).catch((error) => { | ||
| 287 | + this.listLoading = false; | ||
| 288 | + if(null!= error.response && error.response!==undefined){ | ||
| 289 | + let status= error.response.status; | ||
| 290 | + let msg = error.response.statusText; | ||
| 291 | + alert(status+msg); | ||
| 292 | + }else { | ||
| 293 | + alert(error); | ||
| 294 | + } | ||
| 295 | + | ||
| 296 | + }); | ||
| 297 | + | ||
| 298 | + }, | ||
| 299 | + //删除 | ||
| 300 | + handleDel: function (index, row) { | ||
| 301 | + this.$confirm('确认删除该记录吗?', '提示', { | ||
| 302 | + type: 'warning' | ||
| 303 | + }).then(() => { | ||
| 304 | + this.listLoading = true; | ||
| 305 | + //NProgress.start(); | ||
| 306 | + let para = { roleId: row.roleId }; | ||
| 307 | + remove(para).then((res) => { | ||
| 308 | + this.listLoading = false; | ||
| 309 | + //NProgress.done(); | ||
| 310 | + this.$message({ | ||
| 311 | + message: '删除成功', | ||
| 312 | + type: 'success' | ||
| 313 | + }); | ||
| 314 | + }).catch((error) => { | ||
| 315 | + this.listLoading = false; | ||
| 316 | + alert(error); | ||
| 317 | + }); | ||
| 318 | + }).catch(); | ||
| 319 | + }, | ||
| 320 | + /** | ||
| 321 | + * 显示编辑界面 | ||
| 322 | + * @param index | ||
| 323 | + * @param row 为这行的数据对象 | ||
| 324 | + */ | ||
| 325 | + handleEdit: function (index, row) { | ||
| 326 | + this.editFormVisible = true; | ||
| 327 | + this.editForm = Object.assign({}, row); | ||
| 328 | + this.getdepartmentNames(); | ||
| 329 | + }, | ||
| 330 | + //显示新增界面,每次点开初始化数据 | ||
| 331 | + handleAdd: function () { | ||
| 332 | + this.addFormVisible = true; | ||
| 333 | + this.addForm = { | ||
| 334 | + processname: '', | ||
| 335 | + begindate: '', | ||
| 336 | + enddate: '', | ||
| 337 | + vacationtype:'', | ||
| 338 | + reason: '', | ||
| 339 | + userid: loginUserInfo.userId, | ||
| 340 | + jobuserid: 0 | ||
| 341 | + } | ||
| 342 | + }, | ||
| 343 | + //编辑 | ||
| 344 | + editSubmit: function () { | ||
| 345 | + this.$refs.editForm.validate((valid) => { | ||
| 346 | + if (valid) { | ||
| 347 | + this.$confirm('确认提交吗?', '提示', {}).then(() => { | ||
| 348 | + this.editLoading = true; | ||
| 349 | + //NProgress.start(); | ||
| 350 | + let para = Object.assign({}, this.editForm); | ||
| 351 | + //不需要提交的 去掉,后端不好接收 | ||
| 352 | + para.authorities = null; | ||
| 353 | + para.permissions = null; | ||
| 354 | + para.roles = null; | ||
| 355 | +// para.birth = (!para.birth || para.birth == '') ? '' : util.formatDate.format(new Date(para.birth), 'yyyy-MM-dd'); | ||
| 356 | + /* | ||
| 357 | + 查询之后格式this.filters.column.create_start_date中日期发生变化; | ||
| 358 | + Wed Aug 09 2017 00:00:00 GMT+0800 (中国标准时间) 变成了 "2017-08-08T16:00:00.000Z"; | ||
| 359 | + 所以使用 moment 日期格式化插件将时间转换成 [ Wed Aug 09 2017 00:00:00 GMT+0800 (中国标准时间) ] 格 | ||
| 360 | + 式; | ||
| 361 | + */ | ||
| 362 | + /*moment 安装 npm install moment --save*/ | ||
| 363 | + para.creattime = moment(para.creattime).format('YYYY-MM-DD HH:mm:ss'); | ||
| 364 | + this.editLoading = false; | ||
| 365 | + edit(para).then((res) => { | ||
| 366 | + | ||
| 367 | + //NProgress.done(); | ||
| 368 | + this.$message({ | ||
| 369 | + message: '提交成功', | ||
| 370 | + type: 'success' | ||
| 371 | + }); | ||
| 372 | + this.$refs['editForm'].resetFields(); | ||
| 373 | + this.editFormVisible = false; | ||
| 374 | + }).catch(error => alert(error)); | ||
| 375 | + }); | ||
| 376 | + } | ||
| 377 | + }); | ||
| 378 | + }, | ||
| 379 | + //新增 | ||
| 380 | + addSubmit: function () { | ||
| 381 | + this.$refs.addForm.validate((valid) => { | ||
| 382 | + if (valid) { | ||
| 383 | + this.$confirm('确认提交吗?', '提示', {}).then(() => { | ||
| 384 | + this.addLoading = true; | ||
| 385 | + //NProgress.start(); | ||
| 386 | + let para = Object.assign({}, this.addForm); | ||
| 387 | + add(para).then((res) => { | ||
| 388 | + this.addLoading = false; | ||
| 389 | + if (res.status ===200) { | ||
| 390 | + this.$message({ | ||
| 391 | + message: '提交成功', | ||
| 392 | + type: 'success' | ||
| 393 | + }); | ||
| 394 | + this.$refs['jobForm'].resetFields(); | ||
| 395 | + this.addFormVisible = false; | ||
| 396 | + this.getProcessList(); | ||
| 397 | + } | ||
| 398 | + }).catch(error => alert(error)); | ||
| 399 | + }); | ||
| 400 | + } | ||
| 401 | + }); | ||
| 402 | + }, | ||
| 403 | + selsChange: function (sels) { | ||
| 404 | + this.sels = sels; | ||
| 405 | + }, | ||
| 406 | + //批量删除 | ||
| 407 | + batchRemove: function () { | ||
| 408 | + var ids = this.sels.map(item => item.roleId).toString(); | ||
| 409 | + this.$confirm('确认删除选中记录吗?', '提示', { | ||
| 410 | + type: 'warning' | ||
| 411 | + }).then(() => { | ||
| 412 | + this.listLoading = true; | ||
| 413 | + //NProgress.start(); | ||
| 414 | + let para = { ids: ids }; | ||
| 415 | + batchRemove(para).then((res) => { | ||
| 416 | + this.listLoading = false; | ||
| 417 | + //NProgress.done(); | ||
| 418 | + this.$message({ | ||
| 419 | + message: '删除成功', | ||
| 420 | + type: 'success' | ||
| 421 | + }) | ||
| 422 | + }); | ||
| 423 | + }).catch(() => { | ||
| 424 | + | ||
| 425 | + }); | ||
| 426 | + }, | ||
| 427 | + shwoDialog(index,row) { | ||
| 428 | + this.dialogData = Object.assign({}, row); | ||
| 429 | + this.centerDialogVisible = true; | ||
| 430 | + }, | ||
| 431 | + checkJobs(index,row) { | ||
| 432 | + let p = Object.assign({}, row); | ||
| 433 | + this.$router.push( | ||
| 434 | + { | ||
| 435 | + name: '任务管理', | ||
| 436 | + params: { | ||
| 437 | + formid: p.formid | ||
| 438 | + } | ||
| 439 | + } | ||
| 440 | + ) | ||
| 441 | + }, | ||
| 442 | + //级联面板事件 | ||
| 443 | + cascaderhandleChange:function (value) { | ||
| 444 | + let defaultvalue = ["0","0","0","0"]; | ||
| 445 | + defaultvalue = value; | ||
| 446 | + console.log(defaultvalue); | ||
| 447 | + }, | ||
| 448 | + //el-tree绑定事件 | ||
| 449 | + handleCheckChange(data, checked, indeterminate) { | ||
| 450 | +// console.log(data, checked, indeterminate); | ||
| 451 | + console.log(this.$refs.tree.getCheckedNodes()); | ||
| 452 | + console.log(this.$refs.tree.getCheckedKeys()); | ||
| 453 | +// this.addForm.jobuserid = defaultvalue; | ||
| 454 | + } | ||
| 455 | + }, | ||
| 456 | + mounted() { | ||
| 457 | + this.getProcessList(); | ||
| 458 | + } | ||
| 459 | + } | ||
| 460 | + | ||
| 461 | +</script> | ||
| 462 | + | ||
| 463 | +<style scoped> | ||
| 464 | + | ||
| 465 | +</style> |
src/views/nav1/Log.vue
100644 → 100755
| @@ -7,13 +7,10 @@ | @@ -7,13 +7,10 @@ | ||
| 7 | <el-input v-model="filters.username" placeholder="账号"></el-input> | 7 | <el-input v-model="filters.username" placeholder="账号"></el-input> |
| 8 | </el-form-item> | 8 | </el-form-item> |
| 9 | <el-form-item> | 9 | <el-form-item> |
| 10 | - <el-input v-model="filters.methodname" placeholder="系统动作"></el-input> | ||
| 11 | - </el-form-item> | ||
| 12 | - <el-form-item> | ||
| 13 | <el-input v-model="filters.modelnamecn" placeholder="操作模块"></el-input> | 10 | <el-input v-model="filters.modelnamecn" placeholder="操作模块"></el-input> |
| 14 | </el-form-item> | 11 | </el-form-item> |
| 15 | <el-form-item> | 12 | <el-form-item> |
| 16 | - <el-button type="primary" v-on:click="getRoles()">查询</el-button> | 13 | + <el-button type="primary" v-on:click="getLogs()">查询</el-button> |
| 17 | </el-form-item> | 14 | </el-form-item> |
| 18 | </el-form> | 15 | </el-form> |
| 19 | </el-col> | 16 | </el-col> |
| @@ -35,8 +32,6 @@ | @@ -35,8 +32,6 @@ | ||
| 35 | </el-table-column> | 32 | </el-table-column> |
| 36 | <el-table-column prop="modelnamecn" label="操作模块" width="120" sortable> | 33 | <el-table-column prop="modelnamecn" label="操作模块" width="120" sortable> |
| 37 | </el-table-column> | 34 | </el-table-column> |
| 38 | - <!--<el-table-column prop="parameters" label="参数" width="100" sortable>--> | ||
| 39 | - <!--</el-table-column>--> | ||
| 40 | <el-table-column prop="classname" label="系统类" show-overflow-tooltip="true" width="100" sortable> | 35 | <el-table-column prop="classname" label="系统类" show-overflow-tooltip="true" width="100" sortable> |
| 41 | </el-table-column> | 36 | </el-table-column> |
| 42 | <el-table-column prop="result" label="操作结果" min-width="200" sortable> | 37 | <el-table-column prop="result" label="操作结果" min-width="200" sortable> |
| @@ -45,7 +40,7 @@ | @@ -45,7 +40,7 @@ | ||
| 45 | 40 | ||
| 46 | <!--工具条--> | 41 | <!--工具条--> |
| 47 | <el-col :span="24" class="toolbar"> | 42 | <el-col :span="24" class="toolbar"> |
| 48 | - <el-pagination layout="prev, pager, next" @current-change="handleCurrentChange" :page-size="10" :total="total" style="float:right;"> | 43 | + <el-pagination layout="total, prev, pager, next" @current-change="handleCurrentChange" :page-size="10" :total="total" style="float:right;"> |
| 49 | </el-pagination> | 44 | </el-pagination> |
| 50 | </el-col> | 45 | </el-col> |
| 51 | </section> | 46 | </section> |
| @@ -59,7 +54,10 @@ | @@ -59,7 +54,10 @@ | ||
| 59 | export default { | 54 | export default { |
| 60 | data() { | 55 | data() { |
| 61 | return { | 56 | return { |
| 62 | - filters: {}, | 57 | + filters: { |
| 58 | + modelnamecn:'', | ||
| 59 | + username: '' | ||
| 60 | + }, | ||
| 63 | logs: [], | 61 | logs: [], |
| 64 | total: 0, | 62 | total: 0, |
| 65 | pageNum: 1, | 63 | pageNum: 1, |
| @@ -78,13 +76,15 @@ | @@ -78,13 +76,15 @@ | ||
| 78 | }, | 76 | }, |
| 79 | handleCurrentChange(val) { | 77 | handleCurrentChange(val) { |
| 80 | this.pageNum = val; | 78 | this.pageNum = val; |
| 81 | - this.getRoles(); | 79 | + this.getLogs(); |
| 82 | }, | 80 | }, |
| 83 | //获取角色列表 | 81 | //获取角色列表 |
| 84 | getLogs() { | 82 | getLogs() { |
| 85 | let para = { | 83 | let para = { |
| 86 | pageNum: this.pageNum, | 84 | pageNum: this.pageNum, |
| 87 | pageSize: this.pageSize, | 85 | pageSize: this.pageSize, |
| 86 | + modelnamecn: this.filters.modelnamecn, | ||
| 87 | + username: this.filters.username | ||
| 88 | }; | 88 | }; |
| 89 | this.listLoading = true; | 89 | this.listLoading = true; |
| 90 | //NProgress.start(); | 90 | //NProgress.start(); |
| @@ -112,28 +112,6 @@ | @@ -112,28 +112,6 @@ | ||
| 112 | selsChange: function (sels) { | 112 | selsChange: function (sels) { |
| 113 | this.sels = sels; | 113 | this.sels = sels; |
| 114 | }, | 114 | }, |
| 115 | - //批量删除 | ||
| 116 | - batchRemove: function () { | ||
| 117 | - var ids = this.sels.map(item => item.id).toString(); | ||
| 118 | - this.$confirm('确认删除选中记录吗?', '提示', { | ||
| 119 | - type: 'warning' | ||
| 120 | - }).then(() => { | ||
| 121 | - this.listLoading = true; | ||
| 122 | - //NProgress.start(); | ||
| 123 | - let para = { ids: ids }; | ||
| 124 | - batchRemove(para).then((res) => { | ||
| 125 | - this.listLoading = false; | ||
| 126 | - //NProgress.done(); | ||
| 127 | - this.$message({ | ||
| 128 | - message: '删除成功', | ||
| 129 | - type: 'success' | ||
| 130 | - }); | ||
| 131 | - this.getRoles(); | ||
| 132 | - }); | ||
| 133 | - }).catch(() => { | ||
| 134 | - | ||
| 135 | - }); | ||
| 136 | - } | ||
| 137 | }, | 115 | }, |
| 138 | mounted() { | 116 | mounted() { |
| 139 | this.getLogs(); | 117 | this.getLogs(); |
| @@ -55,12 +55,12 @@ | @@ -55,12 +55,12 @@ | ||
| 55 | <!--工具条--> | 55 | <!--工具条--> |
| 56 | <el-col :span="24" class="toolbar"> | 56 | <el-col :span="24" class="toolbar"> |
| 57 | <el-button type="danger" @click="batchRemove" :disabled="this.sels.length===0">批量删除</el-button> | 57 | <el-button type="danger" @click="batchRemove" :disabled="this.sels.length===0">批量删除</el-button> |
| 58 | - <el-pagination layout="prev, pager, next" @current-change="handleCurrentChange" :page-size="5" :total="total" style="float:right;"> | 58 | + <el-pagination layout="total, prev, pager, next" @current-change="handleCurrentChange" :page-size="5" :total="total" style="float:right;"> |
| 59 | </el-pagination> | 59 | </el-pagination> |
| 60 | </el-col> | 60 | </el-col> |
| 61 | 61 | ||
| 62 | <!--编辑界面--> | 62 | <!--编辑界面--> |
| 63 | - <el-dialog title="编辑" v-model="editFormVisible" :close-on-click-modal="false"> | 63 | + <el-dialog title="编辑" :visible.sync="editFormVisible" :close-on-click-modal="false"> |
| 64 | <el-form :model="editForm" label-width="80px" :rules="editFormRules" ref="editForm"> | 64 | <el-form :model="editForm" label-width="80px" :rules="editFormRules" ref="editForm"> |
| 65 | <el-form-item label="ID"> | 65 | <el-form-item label="ID"> |
| 66 | <span>{{editForm.userId}}</span> | 66 | <span>{{editForm.userId}}</span> |
| @@ -109,7 +109,7 @@ | @@ -109,7 +109,7 @@ | ||
| 109 | </el-dialog> | 109 | </el-dialog> |
| 110 | 110 | ||
| 111 | <!--新增界面--> | 111 | <!--新增界面--> |
| 112 | - <el-dialog title="新增" v-model="addFormVisible" :close-on-click-modal="false"> | 112 | + <el-dialog title="新增" :visible.sync="addFormVisible" :close-on-click-modal="false"> |
| 113 | <el-form :model="addForm" label-width="80px" :rules="addFormRules" ref="addForm"> | 113 | <el-form :model="addForm" label-width="80px" :rules="addFormRules" ref="addForm"> |
| 114 | <el-form-item label="账号" prop="username"> | 114 | <el-form-item label="账号" prop="username"> |
| 115 | <el-input v-model="addForm.username"></el-input> | 115 | <el-input v-model="addForm.username"></el-input> |
src/views/nav1/company.vue
0 → 100755
| 1 | +<template> | ||
| 2 | + <section> | ||
| 3 | + <!--工具条--> | ||
| 4 | + <el-col :span="24" class="toolbar" style="padding-bottom: 0px;"> | ||
| 5 | + <el-form :inline="true" :model="filters"> | ||
| 6 | + <el-form-item> | ||
| 7 | + <el-input v-model="filters.companyName" placeholder="公司名称"></el-input> | ||
| 8 | + </el-form-item> | ||
| 9 | + <el-form-item> | ||
| 10 | + <el-button type="primary" v-on:click="getCompanys()">查询</el-button> | ||
| 11 | + </el-form-item> | ||
| 12 | + <el-form-item> | ||
| 13 | + <el-button type="primary" @click="companyAdd">新增</el-button> | ||
| 14 | + </el-form-item> | ||
| 15 | + </el-form> | ||
| 16 | + </el-col> | ||
| 17 | + | ||
| 18 | + <!--列表--> | ||
| 19 | + <el-table :data="companyList" highlight-current-row v-loading="listLoading" @selection-change="selsChange" style="width: 100%;"> | ||
| 20 | + <el-table-column type="selection" width="55"> | ||
| 21 | + </el-table-column> | ||
| 22 | + <el-table-column type="index"> | ||
| 23 | + </el-table-column> | ||
| 24 | + <el-table-column prop="companyId" label="ID" sortable> | ||
| 25 | + </el-table-column> | ||
| 26 | + <el-table-column prop="companyName" label="公司名称" sortable> | ||
| 27 | + </el-table-column> | ||
| 28 | + <el-table-column prop="groupName" label="集团名称" sortable> | ||
| 29 | + </el-table-column> | ||
| 30 | + <el-table-column prop="creatTime" label="入库时间" sortable> | ||
| 31 | + </el-table-column> | ||
| 32 | + <el-table-column label="操作" min-width="150"> | ||
| 33 | + <template slot-scope="scope"> | ||
| 34 | + <el-button size="small" @click="handleEdit(scope.$index, scope.row)">编辑</el-button> | ||
| 35 | + <el-button type="danger" size="small" @click="handleDel(scope.$index, scope.row)">删除</el-button> | ||
| 36 | + </template> | ||
| 37 | + </el-table-column> | ||
| 38 | + </el-table> | ||
| 39 | + | ||
| 40 | + <!--工具条--> | ||
| 41 | + <el-col :span="24" class="toolbar"> | ||
| 42 | + <el-button type="danger" @click="batchRemove" :disabled="this.sels.length===0">批量删除</el-button> | ||
| 43 | + <el-pagination layout="total, prev, pager, next" @current-change="handleCurrentChange" :page-size="5" :total="total" style="float:right;"> | ||
| 44 | + </el-pagination> | ||
| 45 | + </el-col> | ||
| 46 | + | ||
| 47 | + <!--编辑界面--> | ||
| 48 | + <el-dialog title="编辑" :visible.sync="editFormVisible" :close-on-click-modal="false"> | ||
| 49 | + <el-form :model="editForm" label-width="80px" :rules="editFormRules" ref="editForm"> | ||
| 50 | + <el-form-item label="ID"> | ||
| 51 | + <span>{{editForm.companyId}}</span> | ||
| 52 | + </el-form-item> | ||
| 53 | + <el-form-item label="公司名称"> | ||
| 54 | + <el-input v-model="editForm.companyName" auto-complete="off" placeholder="请输入公司名称"></el-input> | ||
| 55 | + </el-form-item> | ||
| 56 | + <el-form-item label="集团名称"> | ||
| 57 | + <el-select v-model="editForm.groupId" placeholder="请选择"> | ||
| 58 | + <el-option | ||
| 59 | + v-for="item in groupLists" | ||
| 60 | + :key="item.groupId" | ||
| 61 | + :label="item.groupName" | ||
| 62 | + :value="item.groupId"> | ||
| 63 | + </el-option> | ||
| 64 | + </el-select> | ||
| 65 | + </el-form-item> | ||
| 66 | + </el-form> | ||
| 67 | + <div slot="footer" class="dialog-footer"> | ||
| 68 | + <el-button @click.native="editFormVisible = false">取消</el-button> | ||
| 69 | + <el-button type="primary" @click.native="editSubmit" :loading="editLoading">提交</el-button> | ||
| 70 | + </div> | ||
| 71 | + </el-dialog> | ||
| 72 | + | ||
| 73 | + <!--新增界面--> | ||
| 74 | + <el-dialog title="新增" :visible.sync="addFormVisible" :close-on-click-modal="false"> | ||
| 75 | + <el-form :model="addForm" label-width="80px" :rules="addFormRules" ref="addForm"> | ||
| 76 | + <el-form-item label="公司名称" prop="companyName"> | ||
| 77 | + <el-input v-model="addForm.companyName" auto-complete="off" placeholder="请输入公司名称"></el-input> | ||
| 78 | + </el-form-item> | ||
| 79 | + <el-form-item label="集团名称" prop="groupId"> | ||
| 80 | + <el-select v-model="addForm.groupId" placeholder="请选择"> | ||
| 81 | + <el-option | ||
| 82 | + v-for="item in groupLists" | ||
| 83 | + :key="item.groupId" | ||
| 84 | + :label="item.groupName" | ||
| 85 | + :value="item.groupId"> | ||
| 86 | + </el-option> | ||
| 87 | + </el-select> | ||
| 88 | + </el-form-item> | ||
| 89 | + </el-form> | ||
| 90 | + <div slot="footer" class="dialog-footer"> | ||
| 91 | + <el-button @click.native="addFormVisible = false">取消</el-button> | ||
| 92 | + <el-button type="primary" @click.native="addSubmit" :loading="addLoading">提交</el-button> | ||
| 93 | + </div> | ||
| 94 | + </el-dialog> | ||
| 95 | + </section> | ||
| 96 | +</template> | ||
| 97 | + | ||
| 98 | +<script> | ||
| 99 | + import util from '../../common/js/util' | ||
| 100 | + import NProgress from 'nprogress' | ||
| 101 | + import { getList, remove, batchRemove, edit, add } from '../../api/company'; | ||
| 102 | + import { getList as groupList } from '../../api/group_company'; | ||
| 103 | + import moment from 'moment' | ||
| 104 | + | ||
| 105 | + export default { | ||
| 106 | + data() { | ||
| 107 | + return { | ||
| 108 | + filters: { | ||
| 109 | + companyName: '' | ||
| 110 | + }, | ||
| 111 | + companyList: [], | ||
| 112 | + // 接受集团名称 | ||
| 113 | + groupLists:[], | ||
| 114 | + permIds: [], | ||
| 115 | + total: 0, | ||
| 116 | + pageNum: 1, | ||
| 117 | + pageSize: 5, | ||
| 118 | + listLoading: false, | ||
| 119 | + sels: [],//列表选中列 | ||
| 120 | + //编辑界面是否显示 | ||
| 121 | + editFormVisible: false, | ||
| 122 | + editLoading: false, | ||
| 123 | + editFormRules: { | ||
| 124 | + companyName: [ | ||
| 125 | + { required: true, message: '请输入公司名称', trigger: 'blur' } | ||
| 126 | + ] | ||
| 127 | + }, | ||
| 128 | + //编辑界面数据 | ||
| 129 | + editForm: { | ||
| 130 | + companyId: '', | ||
| 131 | + companyName: '', | ||
| 132 | + groupId: '' | ||
| 133 | + }, | ||
| 134 | + //设置权限数据 | ||
| 135 | + setPermForm: {}, | ||
| 136 | + //新增界面是否显示 | ||
| 137 | + addFormVisible: false, | ||
| 138 | + //设置权限界面是否显示 | ||
| 139 | + PermFormVisible: false, | ||
| 140 | + addLoading: false, | ||
| 141 | + addFormRules: { | ||
| 142 | + companyName: [ | ||
| 143 | + { required: true, message: '请输入公司名称', trigger: 'blur' } | ||
| 144 | + ] | ||
| 145 | + }, | ||
| 146 | + | ||
| 147 | + //新增界面数据 | ||
| 148 | + addForm: { | ||
| 149 | + companyName: '', | ||
| 150 | + groupId: '' | ||
| 151 | + }, | ||
| 152 | + companyFrom: { | ||
| 153 | + companyId: 1, | ||
| 154 | + companyName: '', | ||
| 155 | + companys: [] | ||
| 156 | + } | ||
| 157 | + | ||
| 158 | + } | ||
| 159 | + }, | ||
| 160 | + mounted() { | ||
| 161 | + this.getCompanys(); | ||
| 162 | + }, | ||
| 163 | + methods: { | ||
| 164 | + | ||
| 165 | + handleCurrentChange(val) { | ||
| 166 | + this.pageNum = val; | ||
| 167 | + this.getRoles(); | ||
| 168 | + }, | ||
| 169 | + //获取公司列表 | ||
| 170 | + getCompanys() { | ||
| 171 | + let para = { | ||
| 172 | + pageNum: this.pageNum, | ||
| 173 | + pageSize: this.pageSize, | ||
| 174 | + companyName: this.filters.companyName | ||
| 175 | + }; | ||
| 176 | + this.listLoading = true; | ||
| 177 | + //NProgress.start(); | ||
| 178 | + getList(para).then((res) => { | ||
| 179 | + this.total = res.data.total; | ||
| 180 | + this.companyList = res.data.list; | ||
| 181 | + console.log(this.companyList); | ||
| 182 | + this.listLoading = false; | ||
| 183 | + //NProgress.done(); | ||
| 184 | + }).catch((error) => { | ||
| 185 | + | ||
| 186 | + this.listLoading = false; | ||
| 187 | + if(null!= error.response && error.response!==undefined){ | ||
| 188 | + let status= error.response.status; | ||
| 189 | + let msg = error.response.statusText; | ||
| 190 | + alert(status+msg); | ||
| 191 | + }else { | ||
| 192 | + alert(error); | ||
| 193 | + } | ||
| 194 | + | ||
| 195 | + }); | ||
| 196 | + | ||
| 197 | + }, | ||
| 198 | + | ||
| 199 | + //获取集团列表 | ||
| 200 | + getGroupComapnys() { | ||
| 201 | + | ||
| 202 | + this.listLoading = true; | ||
| 203 | + //NProgress.start(); | ||
| 204 | + groupList().then((res) => { | ||
| 205 | + this.total = res.data.total; | ||
| 206 | + this.groupLists = res.data.list; | ||
| 207 | + console.log(this.companyList); | ||
| 208 | + this.listLoading = false; | ||
| 209 | + //NProgress.done(); | ||
| 210 | + }).catch((error) => { | ||
| 211 | + | ||
| 212 | + this.listLoading = false; | ||
| 213 | + if(null!= error.response && error.response!==undefined){ | ||
| 214 | + let status= error.response.status; | ||
| 215 | + let msg = error.response.statusText; | ||
| 216 | + alert(status+msg); | ||
| 217 | + }else { | ||
| 218 | + alert(error); | ||
| 219 | + } | ||
| 220 | + | ||
| 221 | + }); | ||
| 222 | + | ||
| 223 | + }, | ||
| 224 | + | ||
| 225 | + //删除 | ||
| 226 | + handleDel: function (index, row) { | ||
| 227 | + this.$confirm('确认删除该记录吗?', '提示', { | ||
| 228 | + type: 'warning' | ||
| 229 | + }).then(() => { | ||
| 230 | + this.listLoading = true; | ||
| 231 | + //NProgress.start(); | ||
| 232 | + let para = { companyId: row.companyId }; | ||
| 233 | + remove(para).then((res) => { | ||
| 234 | + this.listLoading = false; | ||
| 235 | + //NProgress.done(); | ||
| 236 | + this.$message({ | ||
| 237 | + message: '删除成功', | ||
| 238 | + type: 'success' | ||
| 239 | + }); | ||
| 240 | + this.getCompanys(); | ||
| 241 | + }).catch((error) => { | ||
| 242 | + this.listLoading = false; | ||
| 243 | + alert(error); | ||
| 244 | + }); | ||
| 245 | + }).catch(); | ||
| 246 | + }, | ||
| 247 | + /** | ||
| 248 | + * 显示编辑界面 | ||
| 249 | + * @param index | ||
| 250 | + * @param row 为这行的数据对象 | ||
| 251 | + */ | ||
| 252 | + handleEdit: function (index, row) { | ||
| 253 | + this.editFormVisible = true; | ||
| 254 | + this.editForm = Object.assign({}, row); | ||
| 255 | + this.getGroupComapnys(); | ||
| 256 | + }, | ||
| 257 | + setPerm: function (index, row) { | ||
| 258 | + var _this = this; | ||
| 259 | + this.companyIds = []; | ||
| 260 | + this.PermFormVisible = true; | ||
| 261 | + this.companyFrom = Object.assign({}, row); | ||
| 262 | + let rolePerms = this.companyFrom.companys; | ||
| 263 | + if (util.checkNull(rolePerms)){ | ||
| 264 | + rolePerms.forEach(function (company,v_index,v_arr) { | ||
| 265 | + if(util.checkNull(perm)){ | ||
| 266 | + _this.companyIds[v_index] = company.companyId; | ||
| 267 | + } | ||
| 268 | + }); | ||
| 269 | + } | ||
| 270 | + this.getPermList(); | ||
| 271 | + }, | ||
| 272 | + //显示新增界面,每次点开初始化数据 | ||
| 273 | + companyAdd: function () { | ||
| 274 | + this.addFormVisible = true; | ||
| 275 | + this.addForm = { | ||
| 276 | + companyName: '', | ||
| 277 | + groupId: '' | ||
| 278 | + }; | ||
| 279 | + this.getGroupComapnys(); | ||
| 280 | + }, | ||
| 281 | + | ||
| 282 | + //新增 | ||
| 283 | + addSubmit: function () { | ||
| 284 | + this.$refs.addForm.validate((valid) => { | ||
| 285 | + if (valid) { | ||
| 286 | + this.$confirm('确认提交吗?', '提示', {}).then(() => { | ||
| 287 | + this.addLoading = true; | ||
| 288 | + //NProgress.start(); | ||
| 289 | + let para = Object.assign({}, this.addForm); | ||
| 290 | + add(para).then((res) => { | ||
| 291 | + this.addLoading = false; | ||
| 292 | + //NProgress.done(); | ||
| 293 | + this.$message({ | ||
| 294 | + message: '提交成功', | ||
| 295 | + type: 'success' | ||
| 296 | + }); | ||
| 297 | + this.$refs['addForm'].resetFields(); | ||
| 298 | + this.addFormVisible = false; | ||
| 299 | + this.getCompanys(); | ||
| 300 | + }).catch(error => alert(error)); | ||
| 301 | + }); | ||
| 302 | + } | ||
| 303 | + }); | ||
| 304 | + }, | ||
| 305 | + //编辑 | ||
| 306 | + editSubmit: function () { | ||
| 307 | + this.$refs.editForm.validate((valid) => { | ||
| 308 | + if (valid) { | ||
| 309 | + this.$confirm('确认提交吗?', '提示', {}).then(() => { | ||
| 310 | + this.editLoading = true; | ||
| 311 | + let para = Object.assign({}, this.editForm); | ||
| 312 | + this.editLoading = false; | ||
| 313 | + edit(para).then((res) => { | ||
| 314 | + | ||
| 315 | + //NProgress.done(); | ||
| 316 | + this.$message({ | ||
| 317 | + message: '提交成功', | ||
| 318 | + type: 'success' | ||
| 319 | + }); | ||
| 320 | + this.$refs['editForm'].resetFields(); | ||
| 321 | + this.editFormVisible = false; | ||
| 322 | + this.getCompanys(); | ||
| 323 | + }).catch(error => alert(error)); | ||
| 324 | + }); | ||
| 325 | + } | ||
| 326 | + }); | ||
| 327 | + }, | ||
| 328 | + | ||
| 329 | + selsChange: function (sels) { | ||
| 330 | + this.sels = sels; | ||
| 331 | + }, | ||
| 332 | + //批量删除 | ||
| 333 | + batchRemove: function () { | ||
| 334 | + var ids = this.sels.map(item => item.companyId).toString(); | ||
| 335 | + console.log(ids); | ||
| 336 | + this.$confirm('确认删除选中记录吗?', '提示', { | ||
| 337 | + type: 'warning' | ||
| 338 | + }).then(() => { | ||
| 339 | + this.listLoading = true; | ||
| 340 | + //NProgress.start(); | ||
| 341 | + let para = { ids: ids }; | ||
| 342 | + batchRemove(para).then((res) => { | ||
| 343 | + this.listLoading = false; | ||
| 344 | + //NProgress.done(); | ||
| 345 | + this.$message({ | ||
| 346 | + message: '删除成功', | ||
| 347 | + type: 'success' | ||
| 348 | + }); | ||
| 349 | + this.getCompanys(); | ||
| 350 | + }); | ||
| 351 | + }).catch(() => { | ||
| 352 | + | ||
| 353 | + }); | ||
| 354 | + } | ||
| 355 | + }, | ||
| 356 | + | ||
| 357 | + } | ||
| 358 | +</script> |
src/views/nav1/department.vue
0 → 100755
| 1 | +<template> | ||
| 2 | + <section> | ||
| 3 | + <!--工具条--> | ||
| 4 | + <el-col :span="24" class="toolbar" style="padding-bottom: 0px;"> | ||
| 5 | + <el-form :inline="true" :model="filters"> | ||
| 6 | + <el-form-item> | ||
| 7 | + <el-input v-model="filters.departmentName" placeholder="部门名称"></el-input> | ||
| 8 | + </el-form-item> | ||
| 9 | + <el-form-item> | ||
| 10 | + <el-button type="primary" v-on:click="getDepartments()">查询</el-button> | ||
| 11 | + </el-form-item> | ||
| 12 | + <el-form-item> | ||
| 13 | + <el-button type="primary" @click="departmentAdd">新增</el-button> | ||
| 14 | + </el-form-item> | ||
| 15 | + </el-form> | ||
| 16 | + </el-col> | ||
| 17 | + | ||
| 18 | + <!--列表--> | ||
| 19 | + <el-table :data="departmentList" highlight-current-row v-loading="listLoading" @selection-change="selsChange" style="width: 100%;"> | ||
| 20 | + <el-table-column type="selection" width="55"> | ||
| 21 | + </el-table-column> | ||
| 22 | + <el-table-column type="index"> | ||
| 23 | + </el-table-column> | ||
| 24 | + <el-table-column prop="departmentId" label="ID" sortable> | ||
| 25 | + </el-table-column> | ||
| 26 | + <el-table-column prop="departmentName" label="部门名称" sortable> | ||
| 27 | + </el-table-column> | ||
| 28 | + <el-table-column prop="companyName" label="所属公司名称" sortable> | ||
| 29 | + </el-table-column> | ||
| 30 | + <el-table-column prop="creatTime" label="入库时间" sortable> | ||
| 31 | + </el-table-column> | ||
| 32 | + <el-table-column label="操作" min-width="150"> | ||
| 33 | + <template slot-scope="scope"> | ||
| 34 | + <el-button size="small" @click="handleEdit(scope.$index, scope.row)">编辑</el-button> | ||
| 35 | + <el-button type="danger" size="small" @click="handleDel(scope.$index, scope.row)">删除</el-button> | ||
| 36 | + </template> | ||
| 37 | + </el-table-column> | ||
| 38 | + </el-table> | ||
| 39 | + | ||
| 40 | + <!--工具条--> | ||
| 41 | + <el-col :span="24" class="toolbar"> | ||
| 42 | + <el-button type="danger" @click="batchRemove" :disabled="this.sels.length===0">批量删除</el-button> | ||
| 43 | + <el-pagination layout="total, prev, pager, next" @current-change="handleCurrentChange" :page-size="5" :total="total" style="float:right;"> | ||
| 44 | + </el-pagination> | ||
| 45 | + </el-col> | ||
| 46 | + | ||
| 47 | + <!--编辑界面--> | ||
| 48 | + <el-dialog title="编辑" :visible.sync="editFormVisible" :close-on-click-modal="false"> | ||
| 49 | + <el-form :model="editForm" label-width="80px" :rules="editFormRules" ref="editForm"> | ||
| 50 | + <el-form-item label="ID"> | ||
| 51 | + <span>{{editForm.departmentId}}</span> | ||
| 52 | + </el-form-item> | ||
| 53 | + <el-form-item label="部门名称"> | ||
| 54 | + <el-input v-model="editForm.departmentName" auto-complete="off" placeholder="请输入公司名称"></el-input> | ||
| 55 | + </el-form-item> | ||
| 56 | + <el-form-item label="公司名称"> | ||
| 57 | + <el-select v-model="editForm.companyId" placeholder="请选择公司"> | ||
| 58 | + <el-option | ||
| 59 | + v-for="item in companyList" | ||
| 60 | + :key="item.companyId" | ||
| 61 | + :label="item.companyName" | ||
| 62 | + :value="item.companyId"> | ||
| 63 | + </el-option> | ||
| 64 | + </el-select> | ||
| 65 | + </el-form-item> | ||
| 66 | + </el-form> | ||
| 67 | + <div slot="footer" class="dialog-footer"> | ||
| 68 | + <el-button @click.native="editFormVisible = false">取消</el-button> | ||
| 69 | + <el-button type="primary" @click.native="editSubmit" :loading="editLoading">提交</el-button> | ||
| 70 | + </div> | ||
| 71 | + </el-dialog> | ||
| 72 | + | ||
| 73 | + <!--新增界面--> | ||
| 74 | + <el-dialog title="新增" :visible.sync="addFormVisible" :close-on-click-modal="false"> | ||
| 75 | + <el-form :model="addForm" label-width="80px" :rules="addFormRules" ref="addForm"> | ||
| 76 | + <el-form-item label="部门名称" prop="deprtmentName"> | ||
| 77 | + <el-input v-model="addForm.departmentName" auto-complete="off" placeholder="请输入部门名称"></el-input> | ||
| 78 | + </el-form-item> | ||
| 79 | + <el-form-item label="公司名称" prop="companyId"> | ||
| 80 | + <el-select v-model="addForm.companyId" placeholder="请选择公司"> | ||
| 81 | + <el-option | ||
| 82 | + v-for="item in companyList" | ||
| 83 | + :key="item.companyId" | ||
| 84 | + :label="item.companyName" | ||
| 85 | + :value="item.companyId"> | ||
| 86 | + </el-option> | ||
| 87 | + </el-select> | ||
| 88 | + </el-form-item> | ||
| 89 | + </el-form> | ||
| 90 | + <div slot="footer" class="dialog-footer"> | ||
| 91 | + <el-button @click.native="addFormVisible = false">取消</el-button> | ||
| 92 | + <el-button type="primary" @click.native="addSubmit" :loading="addLoading">提交</el-button> | ||
| 93 | + </div> | ||
| 94 | + </el-dialog> | ||
| 95 | + </section> | ||
| 96 | +</template> | ||
| 97 | + | ||
| 98 | +<script> | ||
| 99 | + import util from '../../common/js/util' | ||
| 100 | + import NProgress from 'nprogress' | ||
| 101 | + import { getList, remove, batchRemove, edit, add } from '../../api/department'; | ||
| 102 | + import { getList as getCompanyList } from '../../api/company'; | ||
| 103 | + import moment from 'moment' | ||
| 104 | + | ||
| 105 | + export default { | ||
| 106 | + data() { | ||
| 107 | + return { | ||
| 108 | + filters: { | ||
| 109 | + departmentName: '' | ||
| 110 | + }, | ||
| 111 | + | ||
| 112 | + departmentList: [], | ||
| 113 | + companyList: [], | ||
| 114 | + permIds: [], | ||
| 115 | + total: 0, | ||
| 116 | + pageNum: 1, | ||
| 117 | + pageSize: 10, | ||
| 118 | + listLoading: false, | ||
| 119 | + sels: [],//列表选中列 | ||
| 120 | + //编辑界面是否显示 | ||
| 121 | + editFormVisible: false, | ||
| 122 | + editLoading: false, | ||
| 123 | + editFormRules: { | ||
| 124 | + departmentName: [ | ||
| 125 | + { required: true, message: '请输入部门名称', trigger: 'blur' } | ||
| 126 | + ] | ||
| 127 | + }, | ||
| 128 | + //编辑界面数据 | ||
| 129 | + editForm: { | ||
| 130 | + departmentId: '', | ||
| 131 | + departmentName: '', | ||
| 132 | + companyId: '' | ||
| 133 | + }, | ||
| 134 | + //设置权限数据 | ||
| 135 | + setPermForm: {}, | ||
| 136 | + //新增界面是否显示 | ||
| 137 | + addFormVisible: false, | ||
| 138 | + //设置权限界面是否显示 | ||
| 139 | + PermFormVisible: false, | ||
| 140 | + addLoading: false, | ||
| 141 | + addFormRules: { | ||
| 142 | + departmentName: [ | ||
| 143 | + { required: true, message: '请输入部门名称', trigger: 'blur' } | ||
| 144 | + ] | ||
| 145 | + }, | ||
| 146 | + //新增界面数据 | ||
| 147 | + addForm: { | ||
| 148 | + departmentName: '', | ||
| 149 | + companyId: '' | ||
| 150 | + }, | ||
| 151 | + departmentFrom: { | ||
| 152 | + departmentId: 1, | ||
| 153 | + departmentName: '', | ||
| 154 | + departments: [] | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + } | ||
| 158 | + }, | ||
| 159 | + mounted() { | ||
| 160 | + this.getDepartments(); | ||
| 161 | + }, | ||
| 162 | + methods: { | ||
| 163 | + | ||
| 164 | + handleCurrentChange(val) { | ||
| 165 | + this.pageNum = val; | ||
| 166 | + this.getDepartments(); | ||
| 167 | + }, | ||
| 168 | + //获取列表 | ||
| 169 | + getDepartments() { | ||
| 170 | + let para = { | ||
| 171 | + pageNum: this.pageNum, | ||
| 172 | + pageSize: this.pageSize, | ||
| 173 | + departmentName: this.filters.departmentName | ||
| 174 | + }; | ||
| 175 | + this.listLoading = true; | ||
| 176 | + //NProgress.start(); | ||
| 177 | + getList(para).then((res) => { | ||
| 178 | + this.total = res.data.total; | ||
| 179 | + this.departmentList = res.data.list; | ||
| 180 | + this.listLoading = false; | ||
| 181 | + //NProgress.done(); | ||
| 182 | + }).catch((error) => { | ||
| 183 | + | ||
| 184 | + this.listLoading = false; | ||
| 185 | + if(null!= error.response && error.response!==undefined){ | ||
| 186 | + let status= error.response.status; | ||
| 187 | + let msg = error.response.statusText; | ||
| 188 | + alert(status+msg); | ||
| 189 | + }else { | ||
| 190 | + alert(error); | ||
| 191 | + } | ||
| 192 | + | ||
| 193 | + }); | ||
| 194 | + | ||
| 195 | + }, | ||
| 196 | + //获取列表 | ||
| 197 | + getCompanylists() { | ||
| 198 | + let para = { | ||
| 199 | + }; | ||
| 200 | + this.listLoading = true; | ||
| 201 | + //NProgress.start(); | ||
| 202 | + getCompanyList(para).then((res) => { | ||
| 203 | + this.total = res.data.total; | ||
| 204 | + this.companyList = res.data.list; | ||
| 205 | + this.listLoading = false; | ||
| 206 | + //NProgress.done(); | ||
| 207 | + }).catch((error) => { | ||
| 208 | + this.listLoading = false; | ||
| 209 | + if(null!= error.response && error.response!==undefined){ | ||
| 210 | + let status= error.response.status; | ||
| 211 | + let msg = error.response.statusText; | ||
| 212 | + alert(status+msg); | ||
| 213 | + }else { | ||
| 214 | + alert(error); | ||
| 215 | + } | ||
| 216 | + | ||
| 217 | + }); | ||
| 218 | + | ||
| 219 | + }, | ||
| 220 | + | ||
| 221 | + //删除 | ||
| 222 | + handleDel: function (index, row) { | ||
| 223 | + this.$confirm('确认删除该记录吗?', '提示', { | ||
| 224 | + type: 'warning' | ||
| 225 | + }).then(() => { | ||
| 226 | + this.listLoading = true; | ||
| 227 | + //NProgress.start(); | ||
| 228 | + let para = { departmentId: row.departmentId }; | ||
| 229 | + remove(para).then((res) => { | ||
| 230 | + this.listLoading = false; | ||
| 231 | + //NProgress.done(); | ||
| 232 | + this.$message({ | ||
| 233 | + message: '删除成功', | ||
| 234 | + type: 'success' | ||
| 235 | + }); | ||
| 236 | + this.getDepartments(); | ||
| 237 | + }).catch((error) => { | ||
| 238 | + this.listLoading = false; | ||
| 239 | + alert(error); | ||
| 240 | + }); | ||
| 241 | + }).catch(); | ||
| 242 | + }, | ||
| 243 | + /** | ||
| 244 | + * 显示编辑界面 | ||
| 245 | + * @param index | ||
| 246 | + * @param row 为这行的数据对象 | ||
| 247 | + */ | ||
| 248 | + handleEdit: function (index, row) { | ||
| 249 | + this.editFormVisible = true; | ||
| 250 | + this.editForm = Object.assign({}, row); | ||
| 251 | + this.getCompanylists(); | ||
| 252 | + }, | ||
| 253 | + setPerm: function (index, row) { | ||
| 254 | + var _this = this; | ||
| 255 | + this.departmentIds = []; | ||
| 256 | + this.PermFormVisible = true; | ||
| 257 | + this.departmentFrom = Object.assign({}, row); | ||
| 258 | + let rolePerms = this.departmentFrom.departments; | ||
| 259 | + if (util.checkNull(rolePerms)){ | ||
| 260 | + rolePerms.forEach(function (department,v_index,v_arr) { | ||
| 261 | + if(util.checkNull(perm)){ | ||
| 262 | + _this.departmentIds[v_index] = department.departmentId; | ||
| 263 | + } | ||
| 264 | + }); | ||
| 265 | + } | ||
| 266 | + this.getPermList(); | ||
| 267 | + }, | ||
| 268 | + //显示新增界面,每次点开初始化数据 | ||
| 269 | + departmentAdd: function () { | ||
| 270 | + this.addFormVisible = true; | ||
| 271 | + this.addForm = { | ||
| 272 | + departmentName: '', | ||
| 273 | + companyId: '' | ||
| 274 | + }; | ||
| 275 | + this.getCompanylists(); | ||
| 276 | + }, | ||
| 277 | + | ||
| 278 | + //新增 | ||
| 279 | + addSubmit: function () { | ||
| 280 | + this.$refs.addForm.validate((valid) => { | ||
| 281 | + if (valid) { | ||
| 282 | + this.$confirm('确认提交吗?', '提示', {}).then(() => { | ||
| 283 | + this.addLoading = true; | ||
| 284 | + //NProgress.start(); | ||
| 285 | + let para = Object.assign({}, this.addForm); | ||
| 286 | + add(para).then((res) => { | ||
| 287 | + this.addLoading = false; | ||
| 288 | + //NProgress.done(); | ||
| 289 | + this.$message({ | ||
| 290 | + message: '提交成功', | ||
| 291 | + type: 'success' | ||
| 292 | + }); | ||
| 293 | + this.$refs['addForm'].resetFields(); | ||
| 294 | + this.addFormVisible = false; | ||
| 295 | + this.getDepartments(); | ||
| 296 | + }).catch(error => alert(error)); | ||
| 297 | + }); | ||
| 298 | + } | ||
| 299 | + }); | ||
| 300 | + }, | ||
| 301 | + //编辑 | ||
| 302 | + editSubmit: function () { | ||
| 303 | + this.$refs.editForm.validate((valid) => { | ||
| 304 | + if (valid) { | ||
| 305 | + this.$confirm('确认提交吗?', '提示', {}).then(() => { | ||
| 306 | + this.editLoading = true; | ||
| 307 | + let para = Object.assign({}, this.editForm); | ||
| 308 | + this.editLoading = false; | ||
| 309 | + edit(para).then((res) => { | ||
| 310 | + | ||
| 311 | + //NProgress.done(); | ||
| 312 | + this.$message({ | ||
| 313 | + message: '提交成功', | ||
| 314 | + type: 'success' | ||
| 315 | + }); | ||
| 316 | + this.$refs['editForm'].resetFields(); | ||
| 317 | + this.editFormVisible = false; | ||
| 318 | + this.getDepartments(); | ||
| 319 | + }).catch(error => alert(error)); | ||
| 320 | + }); | ||
| 321 | + } | ||
| 322 | + }); | ||
| 323 | + }, | ||
| 324 | + | ||
| 325 | + selsChange: function (sels) { | ||
| 326 | + this.sels = sels; | ||
| 327 | + }, | ||
| 328 | + //批量删除 | ||
| 329 | + batchRemove: function () { | ||
| 330 | + var ids = this.sels.map(item => item.departmentId).toString(); | ||
| 331 | + console.log(ids); | ||
| 332 | + this.$confirm('确认删除选中记录吗?', '提示', { | ||
| 333 | + type: 'warning' | ||
| 334 | + }).then(() => { | ||
| 335 | + this.listLoading = true; | ||
| 336 | + //NProgress.start(); | ||
| 337 | + let para = { ids: ids }; | ||
| 338 | + batchRemove(para).then((res) => { | ||
| 339 | + this.listLoading = false; | ||
| 340 | + //NProgress.done(); | ||
| 341 | + this.$message({ | ||
| 342 | + message: '删除成功', | ||
| 343 | + type: 'success' | ||
| 344 | + }); | ||
| 345 | + this.getDepartments(); | ||
| 346 | + }); | ||
| 347 | + }).catch(() => { | ||
| 348 | + | ||
| 349 | + }); | ||
| 350 | + } | ||
| 351 | + }, | ||
| 352 | + | ||
| 353 | + } | ||
| 354 | +</script> |
src/views/nav1/groupcompany.vue
0 → 100755
| 1 | +<template> | ||
| 2 | + <section> | ||
| 3 | + <!--工具条--> | ||
| 4 | + <el-col :span="24" class="toolbar" style="padding-bottom: 0px;"> | ||
| 5 | + <el-form :inline="true" :model="filters"> | ||
| 6 | + <el-form-item> | ||
| 7 | + <el-input v-model="filters.groupName" placeholder="集团名称"></el-input> | ||
| 8 | + </el-form-item> | ||
| 9 | + <el-form-item> | ||
| 10 | + <el-button type="primary" v-on:click="getGroupCompanys()">查询</el-button> | ||
| 11 | + </el-form-item> | ||
| 12 | + <el-form-item> | ||
| 13 | + <el-button type="primary" @click="groupCompanyAdd">新增</el-button> | ||
| 14 | + </el-form-item> | ||
| 15 | + </el-form> | ||
| 16 | + </el-col> | ||
| 17 | + | ||
| 18 | + <!--列表--> | ||
| 19 | + <el-table :data="groupCompanyList" highlight-current-row v-loading="listLoading" @selection-change="selsChange" style="width: 100%;"> | ||
| 20 | + <el-table-column type="selection" width="55"> | ||
| 21 | + </el-table-column> | ||
| 22 | + <el-table-column type="index"> | ||
| 23 | + </el-table-column> | ||
| 24 | + <el-table-column prop="groupId" label="ID" sortable> | ||
| 25 | + </el-table-column> | ||
| 26 | + <el-table-column prop="groupName" label="集团名称" sortable> | ||
| 27 | + </el-table-column> | ||
| 28 | + <el-table-column prop="creatTime" label="入库时间" sortable> | ||
| 29 | + </el-table-column> | ||
| 30 | + <el-table-column label="操作" min-width="150"> | ||
| 31 | + <template slot-scope="scope"> | ||
| 32 | + <el-button size="small" @click="handleEdit(scope.$index, scope.row)">编辑</el-button> | ||
| 33 | + <el-button type="danger" size="small" @click="handleDel(scope.$index, scope.row)">删除</el-button> | ||
| 34 | + </template> | ||
| 35 | + </el-table-column> | ||
| 36 | + </el-table> | ||
| 37 | + | ||
| 38 | + <!--工具条--> | ||
| 39 | + <el-col :span="24" class="toolbar"> | ||
| 40 | + <el-button type="danger" @click="batchRemove" :disabled="this.sels.length===0">批量删除</el-button> | ||
| 41 | + <el-pagination layout="total, prev, pager, next" @current-change="handleCurrentChange" :page-size="5" :total="total" style="float:right;"> | ||
| 42 | + </el-pagination> | ||
| 43 | + </el-col> | ||
| 44 | + | ||
| 45 | + <!--编辑界面--> | ||
| 46 | + <el-dialog title="编辑" :visible.sync="editFormVisible" :close-on-click-modal="false"> | ||
| 47 | + <el-form :model="editForm" label-width="80px" :rules="editFormRules" ref="editForm"> | ||
| 48 | + <el-form-item label="ID"> | ||
| 49 | + <span>{{editForm.groupId}}</span> | ||
| 50 | + </el-form-item> | ||
| 51 | + <el-form-item label="集团名称"> | ||
| 52 | + <el-input v-model="editForm.groupName" auto-complete="off" placeholder="请输入公司名称"></el-input> | ||
| 53 | + </el-form-item> | ||
| 54 | + </el-form> | ||
| 55 | + <div slot="footer" class="dialog-footer"> | ||
| 56 | + <el-button @click.native="editFormVisible = false">取消</el-button> | ||
| 57 | + <el-button type="primary" @click.native="editSubmit" :loading="editLoading">提交</el-button> | ||
| 58 | + </div> | ||
| 59 | + </el-dialog> | ||
| 60 | + | ||
| 61 | + <!--新增界面--> | ||
| 62 | + <el-dialog title="新增" :visible.sync="addFormVisible" :close-on-click-modal="false"> | ||
| 63 | + <el-form :model="addForm" label-width="80px" :rules="addFormRules" ref="addForm"> | ||
| 64 | + <el-form-item label="集团名称" prop="groupId"> | ||
| 65 | + <el-input v-model="addForm.groupName" auto-complete="off" placeholder="请输入集团名称"></el-input> | ||
| 66 | + </el-form-item> | ||
| 67 | + </el-form> | ||
| 68 | + <div slot="footer" class="dialog-footer"> | ||
| 69 | + <el-button @click.native="addFormVisible = false">取消</el-button> | ||
| 70 | + <el-button type="primary" @click.native="addSubmit" :loading="addLoading">提交</el-button> | ||
| 71 | + </div> | ||
| 72 | + </el-dialog> | ||
| 73 | + </section> | ||
| 74 | +</template> | ||
| 75 | + | ||
| 76 | +<script> | ||
| 77 | + import util from '../../common/js/util' | ||
| 78 | + import NProgress from 'nprogress' | ||
| 79 | + import { getList, remove, batchRemove, edit, add } from '../../api/group_company'; | ||
| 80 | + import moment from 'moment' | ||
| 81 | + | ||
| 82 | + export default { | ||
| 83 | + data() { | ||
| 84 | + return { | ||
| 85 | + filters: { | ||
| 86 | + groupName: '' | ||
| 87 | + }, | ||
| 88 | + groupCompanyList: [], | ||
| 89 | + permIds: [], | ||
| 90 | + total: 0, | ||
| 91 | + pageNum: 1, | ||
| 92 | + pageSize: 5, | ||
| 93 | + listLoading: false, | ||
| 94 | + sels: [],//列表选中列 | ||
| 95 | + //编辑界面是否显示 | ||
| 96 | + editFormVisible: false, | ||
| 97 | + editLoading: false, | ||
| 98 | + editFormRules: { | ||
| 99 | + groupName: [ | ||
| 100 | + { required: true, message: '请输入集团名称', trigger: 'blur' } | ||
| 101 | + ] | ||
| 102 | + }, | ||
| 103 | + //编辑界面数据 | ||
| 104 | + editForm: { | ||
| 105 | + groupId: '', | ||
| 106 | + groupName: '' | ||
| 107 | + }, | ||
| 108 | + //设置权限数据 | ||
| 109 | + setPermForm: {}, | ||
| 110 | + //新增界面是否显示 | ||
| 111 | + addFormVisible: false, | ||
| 112 | + //设置权限界面是否显示 | ||
| 113 | + PermFormVisible: false, | ||
| 114 | + addLoading: false, | ||
| 115 | + addFormRules: { | ||
| 116 | + groupName: [ | ||
| 117 | + { required: true, message: '请输入集团名称', trigger: 'blur' } | ||
| 118 | + ] | ||
| 119 | + }, | ||
| 120 | + //新增界面数据 | ||
| 121 | + addForm: { | ||
| 122 | + groupName: '' | ||
| 123 | + }, | ||
| 124 | + groupCompanyFrom: { | ||
| 125 | + groupId: 1, | ||
| 126 | + groupName: '', | ||
| 127 | + groupCompanys: [] | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + } | ||
| 131 | + }, | ||
| 132 | + mounted() { | ||
| 133 | + this.getGroupCompanys(); | ||
| 134 | + }, | ||
| 135 | + methods: { | ||
| 136 | + | ||
| 137 | + handleCurrentChange(val) { | ||
| 138 | + this.pageNum = val; | ||
| 139 | + this.getGroupCompanys(); | ||
| 140 | + }, | ||
| 141 | + //获取列表 | ||
| 142 | + getGroupCompanys() { | ||
| 143 | + let para = { | ||
| 144 | + pageNum: this.pageNum, | ||
| 145 | + pageSize: this.pageSize, | ||
| 146 | + groupName: this.filters.groupName | ||
| 147 | + }; | ||
| 148 | + this.listLoading = true; | ||
| 149 | + //NProgress.start(); | ||
| 150 | + getList(para).then((res) => { | ||
| 151 | + this.total = res.data.total; | ||
| 152 | + this.groupCompanyList = res.data.list; | ||
| 153 | + this.listLoading = false; | ||
| 154 | + //NProgress.done(); | ||
| 155 | + }).catch((error) => { | ||
| 156 | + | ||
| 157 | + this.listLoading = false; | ||
| 158 | + if(null!= error.response && error.response!==undefined){ | ||
| 159 | + let status= error.response.status; | ||
| 160 | + let msg = error.response.statusText; | ||
| 161 | + alert(status+msg); | ||
| 162 | + }else { | ||
| 163 | + alert(error); | ||
| 164 | + } | ||
| 165 | + | ||
| 166 | + }); | ||
| 167 | + | ||
| 168 | + }, | ||
| 169 | + | ||
| 170 | + //删除 | ||
| 171 | + handleDel: function (index, row) { | ||
| 172 | + this.$confirm('确认删除该记录吗?', '提示', { | ||
| 173 | + type: 'warning' | ||
| 174 | + }).then(() => { | ||
| 175 | + this.listLoading = true; | ||
| 176 | + //NProgress.start(); | ||
| 177 | + let para = { groupId: row.groupId }; | ||
| 178 | + remove(para).then((res) => { | ||
| 179 | + this.listLoading = false; | ||
| 180 | + //NProgress.done(); | ||
| 181 | + this.$message({ | ||
| 182 | + message: '删除成功', | ||
| 183 | + type: 'success' | ||
| 184 | + }); | ||
| 185 | + this.getGroupCompanys(); | ||
| 186 | + }).catch((error) => { | ||
| 187 | + this.listLoading = false; | ||
| 188 | + alert(error); | ||
| 189 | + }); | ||
| 190 | + }).catch(); | ||
| 191 | + }, | ||
| 192 | + /** | ||
| 193 | + * 显示编辑界面 | ||
| 194 | + * @param index | ||
| 195 | + * @param row 为这行的数据对象 | ||
| 196 | + */ | ||
| 197 | + handleEdit: function (index, row) { | ||
| 198 | + this.editFormVisible = true; | ||
| 199 | + this.editForm = Object.assign({}, row); | ||
| 200 | + }, | ||
| 201 | + setPerm: function (index, row) { | ||
| 202 | + var _this = this; | ||
| 203 | + this.groupIds = []; | ||
| 204 | + this.PermFormVisible = true; | ||
| 205 | + this.groupCompanyFrom = Object.assign({}, row); | ||
| 206 | + let rolePerms = this.groupCompanyFrom.groupCompanys; | ||
| 207 | + if (util.checkNull(rolePerms)){ | ||
| 208 | + rolePerms.forEach(function (group,v_index,v_arr) { | ||
| 209 | + if(util.checkNull(perm)){ | ||
| 210 | + _this.groupIds[v_index] = group.groupId; | ||
| 211 | + } | ||
| 212 | + }); | ||
| 213 | + } | ||
| 214 | + this.getPermList(); | ||
| 215 | + }, | ||
| 216 | + //显示新增界面,每次点开初始化数据 | ||
| 217 | + groupCompanyAdd: function () { | ||
| 218 | + this.addFormVisible = true; | ||
| 219 | + this.addForm = { | ||
| 220 | + groupName: '', | ||
| 221 | + companyId: '' | ||
| 222 | + }; | ||
| 223 | + }, | ||
| 224 | + | ||
| 225 | + //新增 | ||
| 226 | + addSubmit: function () { | ||
| 227 | + this.$refs.addForm.validate((valid) => { | ||
| 228 | + if (valid) { | ||
| 229 | + this.$confirm('确认提交吗?', '提示', {}).then(() => { | ||
| 230 | + this.addLoading = true; | ||
| 231 | + //NProgress.start(); | ||
| 232 | + let para = Object.assign({}, this.addForm); | ||
| 233 | + add(para).then((res) => { | ||
| 234 | + this.addLoading = false; | ||
| 235 | + //NProgress.done(); | ||
| 236 | + this.$message({ | ||
| 237 | + message: '提交成功', | ||
| 238 | + type: 'success' | ||
| 239 | + }); | ||
| 240 | + this.$refs['addForm'].resetFields(); | ||
| 241 | + this.addFormVisible = false; | ||
| 242 | + this.getGroupCompanys(); | ||
| 243 | + }).catch(error => alert(error)); | ||
| 244 | + }); | ||
| 245 | + } | ||
| 246 | + }); | ||
| 247 | + }, | ||
| 248 | + //编辑 | ||
| 249 | + editSubmit: function () { | ||
| 250 | + this.$refs.editForm.validate((valid) => { | ||
| 251 | + if (valid) { | ||
| 252 | + this.$confirm('确认提交吗?', '提示', {}).then(() => { | ||
| 253 | + this.editLoading = true; | ||
| 254 | + let para = Object.assign({}, this.editForm); | ||
| 255 | + this.editLoading = false; | ||
| 256 | + edit(para).then((res) => { | ||
| 257 | + | ||
| 258 | + //NProgress.done(); | ||
| 259 | + this.$message({ | ||
| 260 | + message: '提交成功', | ||
| 261 | + type: 'success' | ||
| 262 | + }); | ||
| 263 | + this.$refs['editForm'].resetFields(); | ||
| 264 | + this.editFormVisible = false; | ||
| 265 | + this.getGroupCompanys(); | ||
| 266 | + }).catch(error => alert(error)); | ||
| 267 | + }); | ||
| 268 | + } | ||
| 269 | + }); | ||
| 270 | + }, | ||
| 271 | + | ||
| 272 | + selsChange: function (sels) { | ||
| 273 | + this.sels = sels; | ||
| 274 | + }, | ||
| 275 | + //批量删除 | ||
| 276 | + batchRemove: function () { | ||
| 277 | + var ids = this.sels.map(item => item.groupId).toString(); | ||
| 278 | + console.log(ids); | ||
| 279 | + this.$confirm('确认删除选中记录吗?', '提示', { | ||
| 280 | + type: 'warning' | ||
| 281 | + }).then(() => { | ||
| 282 | + this.listLoading = true; | ||
| 283 | + //NProgress.start(); | ||
| 284 | + let para = { ids: ids }; | ||
| 285 | + batchRemove(para).then((res) => { | ||
| 286 | + this.listLoading = false; | ||
| 287 | + //NProgress.done(); | ||
| 288 | + this.$message({ | ||
| 289 | + message: '删除成功', | ||
| 290 | + type: 'success' | ||
| 291 | + }); | ||
| 292 | + this.getGroupCompanys(); | ||
| 293 | + }); | ||
| 294 | + }).catch(() => { | ||
| 295 | + | ||
| 296 | + }); | ||
| 297 | + } | ||
| 298 | + }, | ||
| 299 | + | ||
| 300 | + } | ||
| 301 | +</script> |
| @@ -4,10 +4,10 @@ | @@ -4,10 +4,10 @@ | ||
| 4 | <el-col :span="24" class="toolbar" style="padding-bottom: 0px;"> | 4 | <el-col :span="24" class="toolbar" style="padding-bottom: 0px;"> |
| 5 | <el-form :inline="true" :model="filters"> | 5 | <el-form :inline="true" :model="filters"> |
| 6 | <el-form-item> | 6 | <el-form-item> |
| 7 | - <el-input v-model="filters.permName" placeholder="权限名称"></el-input> | 7 | + <el-input v-model="filters.name" placeholder="权限名称"></el-input> |
| 8 | </el-form-item> | 8 | </el-form-item> |
| 9 | <el-form-item> | 9 | <el-form-item> |
| 10 | - <el-button type="primary" v-on:click="getRoles()">查询</el-button> | 10 | + <el-button type="primary" v-on:click="getTableList()">查询</el-button> |
| 11 | </el-form-item> | 11 | </el-form-item> |
| 12 | <el-form-item> | 12 | <el-form-item> |
| 13 | <el-button type="primary" @click="handleAdd">新增</el-button> | 13 | <el-button type="primary" @click="handleAdd">新增</el-button> |
| @@ -23,11 +23,11 @@ | @@ -23,11 +23,11 @@ | ||
| 23 | </el-table-column> | 23 | </el-table-column> |
| 24 | <el-table-column prop="permissionId" label="ID" width="100" sortable> | 24 | <el-table-column prop="permissionId" label="ID" width="100" sortable> |
| 25 | </el-table-column> | 25 | </el-table-column> |
| 26 | - <el-table-column prop="permissionName" label="权限名称" min-width="200" sortable> | 26 | + <el-table-column prop="name" label="权限名称" min-width="200" sortable> |
| 27 | </el-table-column> | 27 | </el-table-column> |
| 28 | <el-table-column prop="description" label="描述" min-width="200" sortable> | 28 | <el-table-column prop="description" label="描述" min-width="200" sortable> |
| 29 | </el-table-column> | 29 | </el-table-column> |
| 30 | - <el-table-column prop="permissionSign" label="排序" width="100" sortable> | 30 | + <el-table-column prop="permissionOrder" label="排序" width="100" sortable> |
| 31 | </el-table-column> | 31 | </el-table-column> |
| 32 | <el-table-column prop="url" label="路径" width="100" sortable> | 32 | <el-table-column prop="url" label="路径" width="100" sortable> |
| 33 | </el-table-column> | 33 | </el-table-column> |
| @@ -42,28 +42,45 @@ | @@ -42,28 +42,45 @@ | ||
| 42 | <!--工具条--> | 42 | <!--工具条--> |
| 43 | <el-col :span="24" class="toolbar"> | 43 | <el-col :span="24" class="toolbar"> |
| 44 | <el-button type="danger" @click="batchRemove" :disabled="this.sels.length===0">批量删除</el-button> | 44 | <el-button type="danger" @click="batchRemove" :disabled="this.sels.length===0">批量删除</el-button> |
| 45 | - <el-pagination layout="prev, pager, next" @current-change="handleCurrentChange" :page-size="5" :total="total" style="float:right;"> | 45 | + <el-pagination layout="total, prev, pager, next" @current-change="handleCurrentChange" :page-size="pageSize" :total="total" style="float:right;"> |
| 46 | </el-pagination> | 46 | </el-pagination> |
| 47 | </el-col> | 47 | </el-col> |
| 48 | 48 | ||
| 49 | <!--编辑界面--> | 49 | <!--编辑界面--> |
| 50 | - <el-dialog title="编辑" v-model="editFormVisible" :close-on-click-modal="false"> | 50 | + <el-dialog title="编辑" :visible.sync="editFormVisible" :close-on-click-modal="false"> |
| 51 | <el-form :model="editForm" label-width="80px" :rules="editFormRules" ref="editForm"> | 51 | <el-form :model="editForm" label-width="80px" :rules="editFormRules" ref="editForm"> |
| 52 | <el-form-item label="ID"> | 52 | <el-form-item label="ID"> |
| 53 | - <span>{{editForm.roleId}}</span> | 53 | + <span>{{editForm.permissionId}}</span> |
| 54 | </el-form-item> | 54 | </el-form-item> |
| 55 | - <el-form-item label="权限名称"> | ||
| 56 | - <el-input v-model="editForm.roleName" auto-complete="off" placeholder="请输入权限名称:例如:ROLE_name"></el-input> | 55 | + <el-form-item label="权限名称" prop="name"> |
| 56 | + <el-input v-model="editForm.name" auto-complete="off" placeholder="请输入权限名称:例如:用户新增权限"></el-input> | ||
| 57 | </el-form-item> | 57 | </el-form-item> |
| 58 | - <el-form-item label="权限描述"> | 58 | + <el-form-item label="权限描述" prop="description"> |
| 59 | <el-input v-model="editForm.description" auto-complete="off" placeholder="请输入权限描述:例如:用户管理员"></el-input> | 59 | <el-input v-model="editForm.description" auto-complete="off" placeholder="请输入权限描述:例如:用户管理员"></el-input> |
| 60 | </el-form-item> | 60 | </el-form-item> |
| 61 | - <el-form-item label="权限排序"> | ||
| 62 | - <el-input v-model="editForm.roleSign" auto-complete="off" placeholder="请输入权限排序:例如:数字123"></el-input> | 61 | + <el-form-item label="权限总路径" prop="path"> |
| 62 | + <el-input v-model="editForm.path" auto-complete="off" placeholder="请输入父目录ID:例如:123"></el-input> | ||
| 63 | + </el-form-item> | ||
| 64 | + <el-form-item label="权限路径" prop="url"> | ||
| 65 | + <el-input v-model="editForm.url" auto-complete="off" placeholder="请输入权限描述:例如:/user/update"></el-input> | ||
| 66 | + </el-form-item> | ||
| 67 | + <el-form-item label="权限排序" prop="permissionOrder"> | ||
| 68 | + <el-input v-model="editForm.permissionOrder" auto-complete="off" placeholder="请输入权限排序:例如:123"></el-input> | ||
| 69 | + </el-form-item> | ||
| 70 | + <el-form-item label="父目录ID" prop="parentId"> | ||
| 71 | + <el-input v-model="editForm.parentId" auto-complete="off" placeholder="请输入父目录ID:例如:123"></el-input> | ||
| 72 | + </el-form-item> | ||
| 73 | + <el-form-item label="ismenu" prop="ismenu"> | ||
| 74 | + <el-switch | ||
| 75 | + v-model="editForm.ismenu" | ||
| 76 | + active-color="#13ce66" | ||
| 77 | + inactive-color="#ff4949" | ||
| 78 | + active-text="是" | ||
| 79 | + inactive-text="否" | ||
| 80 | + active-value="1" | ||
| 81 | + inactive-value="0"> | ||
| 82 | + </el-switch> | ||
| 63 | </el-form-item> | 83 | </el-form-item> |
| 64 | - <!--<el-form-item label="创建日期">--> | ||
| 65 | - <!--<el-date-picker type="date" placeholder="创建日期" v-model="editForm.creattime" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd HH:mm:ss"></el-date-picker>--> | ||
| 66 | - <!--</el-form-item>--> | ||
| 67 | </el-form> | 84 | </el-form> |
| 68 | <div slot="footer" class="dialog-footer"> | 85 | <div slot="footer" class="dialog-footer"> |
| 69 | <el-button @click.native="editFormVisible = false">取消</el-button> | 86 | <el-button @click.native="editFormVisible = false">取消</el-button> |
| @@ -72,25 +89,36 @@ | @@ -72,25 +89,36 @@ | ||
| 72 | </el-dialog> | 89 | </el-dialog> |
| 73 | 90 | ||
| 74 | <!--新增界面--> | 91 | <!--新增界面--> |
| 75 | - <el-dialog title="新增" v-model="addFormVisible" :close-on-click-modal="false"> | 92 | + <el-dialog title="新增" :visible.sync="addFormVisible" :close-on-click-modal="false"> |
| 76 | <el-form :model="addForm" label-width="80px" :rules="addFormRules" ref="addForm"> | 93 | <el-form :model="addForm" label-width="80px" :rules="addFormRules" ref="addForm"> |
| 77 | - <el-form-item label="权限名称" prop="permissionName"> | ||
| 78 | - <el-input v-model="addForm.roleName" auto-complete="off" placeholder="请输入权限名称:例如:用户新增权限"></el-input> | 94 | + <el-form-item label="权限名称" prop="name"> |
| 95 | + <el-input v-model="addForm.name" auto-complete="off" placeholder="请输入权限名称:例如:用户新增权限"></el-input> | ||
| 79 | </el-form-item> | 96 | </el-form-item> |
| 80 | <el-form-item label="权限描述" prop="description"> | 97 | <el-form-item label="权限描述" prop="description"> |
| 81 | <el-input v-model="addForm.description" auto-complete="off" placeholder="请输入权限描述:例如:用户管理员"></el-input> | 98 | <el-input v-model="addForm.description" auto-complete="off" placeholder="请输入权限描述:例如:用户管理员"></el-input> |
| 82 | </el-form-item> | 99 | </el-form-item> |
| 100 | + <el-form-item label="权限总路径" prop="path"> | ||
| 101 | + <el-input v-model="addForm.path" auto-complete="off" placeholder="请输入父目录ID:例如:123"></el-input> | ||
| 102 | + </el-form-item> | ||
| 83 | <el-form-item label="权限路径" prop="url"> | 103 | <el-form-item label="权限路径" prop="url"> |
| 84 | <el-input v-model="addForm.url" auto-complete="off" placeholder="请输入权限描述:例如:/user/update"></el-input> | 104 | <el-input v-model="addForm.url" auto-complete="off" placeholder="请输入权限描述:例如:/user/update"></el-input> |
| 85 | </el-form-item> | 105 | </el-form-item> |
| 86 | - <el-form-item label="权限排序" prop="permissionSign"> | ||
| 87 | - <el-input v-model="addForm.permissionSign" auto-complete="off" placeholder="请输入权限排序:例如:123"></el-input> | 106 | + <el-form-item label="权限排序" prop="permissionOrder"> |
| 107 | + <el-input v-model="addForm.permissionOrder" auto-complete="off" placeholder="请输入权限排序:例如:123"></el-input> | ||
| 88 | </el-form-item> | 108 | </el-form-item> |
| 89 | <el-form-item label="父目录ID" prop="parentId"> | 109 | <el-form-item label="父目录ID" prop="parentId"> |
| 90 | <el-input v-model="addForm.parentId" auto-complete="off" placeholder="请输入父目录ID:例如:123"></el-input> | 110 | <el-input v-model="addForm.parentId" auto-complete="off" placeholder="请输入父目录ID:例如:123"></el-input> |
| 91 | </el-form-item> | 111 | </el-form-item> |
| 92 | - <el-form-item label="父目录ID" prop="parentId"> | ||
| 93 | - <el-input v-model="addForm.parentId" auto-complete="off" placeholder="请输入父目录ID:例如:123"></el-input> | 112 | + <el-form-item label="ismenu" prop="ismenu"> |
| 113 | + <el-switch | ||
| 114 | + v-model="addForm.ismenu" | ||
| 115 | + active-color="#13ce66" | ||
| 116 | + inactive-color="#ff4949" | ||
| 117 | + active-text="是" | ||
| 118 | + inactive-text="否" | ||
| 119 | + active-value="1" | ||
| 120 | + inactive-value="0"> | ||
| 121 | + </el-switch> | ||
| 94 | </el-form-item> | 122 | </el-form-item> |
| 95 | </el-form> | 123 | </el-form> |
| 96 | <div slot="footer" class="dialog-footer"> | 124 | <div slot="footer" class="dialog-footer"> |
| @@ -110,12 +138,12 @@ | @@ -110,12 +138,12 @@ | ||
| 110 | data() { | 138 | data() { |
| 111 | return { | 139 | return { |
| 112 | filters: { | 140 | filters: { |
| 113 | - permName: '' | 141 | + name: '' |
| 114 | }, | 142 | }, |
| 115 | tableList: [], | 143 | tableList: [], |
| 116 | total: 0, | 144 | total: 0, |
| 117 | pageNum: 1, | 145 | pageNum: 1, |
| 118 | - pageSize: 5, | 146 | + pageSize: 10, |
| 119 | listLoading: false, | 147 | listLoading: false, |
| 120 | sels: [],//列表选中列 | 148 | sels: [],//列表选中列 |
| 121 | //编辑界面是否显示 | 149 | //编辑界面是否显示 |
| @@ -128,27 +156,48 @@ | @@ -128,27 +156,48 @@ | ||
| 128 | }, | 156 | }, |
| 129 | //编辑界面数据 | 157 | //编辑界面数据 |
| 130 | editForm: { | 158 | editForm: { |
| 131 | - roleId: 1, | 159 | + permissionId:'', |
| 132 | description: '', | 160 | description: '', |
| 133 | - roleName: '', | ||
| 134 | - roleSign: 1 | 161 | + name: '', |
| 162 | + url: '', | ||
| 163 | + path: '', | ||
| 164 | + parentId: '', | ||
| 165 | + ismenu: '', | ||
| 166 | + permissionOrder:'' | ||
| 135 | }, | 167 | }, |
| 136 | 168 | ||
| 137 | addFormVisible: false,//新增界面是否显示 | 169 | addFormVisible: false,//新增界面是否显示 |
| 138 | addLoading: false, | 170 | addLoading: false, |
| 139 | addFormRules: { | 171 | addFormRules: { |
| 140 | - roleName: [ | 172 | + name: [ |
| 141 | { required: true, message: '请输入权限名称', trigger: 'blur' } | 173 | { required: true, message: '请输入权限名称', trigger: 'blur' } |
| 142 | ], | 174 | ], |
| 143 | description: [ | 175 | description: [ |
| 144 | { required: true, message: '请输入权限描述', trigger: 'blur' } | 176 | { required: true, message: '请输入权限描述', trigger: 'blur' } |
| 145 | - ] | 177 | + ], |
| 178 | + paht: [ | ||
| 179 | + { required: true, message: '请输入总路径', trigger: 'blur' } | ||
| 180 | + ], | ||
| 181 | + url: [ | ||
| 182 | + { required: true, message: '请输入权限路径', trigger: 'blur' } | ||
| 183 | + ], | ||
| 184 | + permissionOrder: [ | ||
| 185 | + { required: true, message: '请输入排序字段', trigger: 'blur' } | ||
| 186 | + ], | ||
| 187 | + parentId: [ | ||
| 188 | + { required: true, message: '请输入父类ID', trigger: 'blur' } | ||
| 189 | + ] | ||
| 146 | }, | 190 | }, |
| 147 | //新增界面数据 | 191 | //新增界面数据 |
| 148 | addForm: { | 192 | addForm: { |
| 149 | description: '', | 193 | description: '', |
| 150 | - roleName: '', | ||
| 151 | - roleSign: 1 | 194 | + name: '', |
| 195 | + url: '', | ||
| 196 | + path: '', | ||
| 197 | + parentId: '', | ||
| 198 | + ismenu: '', | ||
| 199 | + permissionOrder:'' | ||
| 200 | + | ||
| 152 | } | 201 | } |
| 153 | 202 | ||
| 154 | } | 203 | } |
| @@ -170,7 +219,7 @@ | @@ -170,7 +219,7 @@ | ||
| 170 | let para = { | 219 | let para = { |
| 171 | pageNum: this.pageNum, | 220 | pageNum: this.pageNum, |
| 172 | pageSize: this.pageSize, | 221 | pageSize: this.pageSize, |
| 173 | - name: this.filters.permName | 222 | + name: this.filters.name |
| 174 | }; | 223 | }; |
| 175 | this.listLoading = true; | 224 | this.listLoading = true; |
| 176 | //NProgress.start(); | 225 | //NProgress.start(); |
| @@ -202,7 +251,7 @@ | @@ -202,7 +251,7 @@ | ||
| 202 | }).then(() => { | 251 | }).then(() => { |
| 203 | this.listLoading = true; | 252 | this.listLoading = true; |
| 204 | //NProgress.start(); | 253 | //NProgress.start(); |
| 205 | - let para = { userId: row.userId }; | 254 | + let para = { permissionId: row.permissionId }; |
| 206 | remove(para).then((res) => { | 255 | remove(para).then((res) => { |
| 207 | this.listLoading = false; | 256 | this.listLoading = false; |
| 208 | //NProgress.done(); | 257 | //NProgress.done(); |
| @@ -210,7 +259,7 @@ | @@ -210,7 +259,7 @@ | ||
| 210 | message: '删除成功', | 259 | message: '删除成功', |
| 211 | type: 'success' | 260 | type: 'success' |
| 212 | }); | 261 | }); |
| 213 | - this.getRoles(); | 262 | + this.getTableList(); |
| 214 | }).catch((error) => { | 263 | }).catch((error) => { |
| 215 | this.listLoading = false; | 264 | this.listLoading = false; |
| 216 | alert(error); | 265 | alert(error); |
| @@ -248,18 +297,6 @@ | @@ -248,18 +297,6 @@ | ||
| 248 | this.editLoading = true; | 297 | this.editLoading = true; |
| 249 | //NProgress.start(); | 298 | //NProgress.start(); |
| 250 | let para = Object.assign({}, this.editForm); | 299 | let para = Object.assign({}, this.editForm); |
| 251 | - //不需要提交的 去掉,后端不好接收 | ||
| 252 | - para.authorities = null; | ||
| 253 | - para.permissions = null; | ||
| 254 | - para.roles = null; | ||
| 255 | -// para.birth = (!para.birth || para.birth == '') ? '' : util.formatDate.format(new Date(para.birth), 'yyyy-MM-dd'); | ||
| 256 | - /* | ||
| 257 | - 查询之后格式this.filters.column.create_start_date中日期发生变化; | ||
| 258 | - Wed Aug 09 2017 00:00:00 GMT+0800 (中国标准时间) 变成了 "2017-08-08T16:00:00.000Z"; | ||
| 259 | - 所以使用 moment 日期格式化插件将时间转换成 [ Wed Aug 09 2017 00:00:00 GMT+0800 (中国标准时间) ] 格 | ||
| 260 | - 式; | ||
| 261 | - */ | ||
| 262 | - /*moment 安装 npm install moment --save*/ | ||
| 263 | para.creattime = moment(para.creattime).format('YYYY-MM-DD HH:mm:ss'); | 300 | para.creattime = moment(para.creattime).format('YYYY-MM-DD HH:mm:ss'); |
| 264 | this.editLoading = false; | 301 | this.editLoading = false; |
| 265 | edit(para).then((res) => { | 302 | edit(para).then((res) => { |
| @@ -271,7 +308,7 @@ | @@ -271,7 +308,7 @@ | ||
| 271 | }); | 308 | }); |
| 272 | this.$refs['editForm'].resetFields(); | 309 | this.$refs['editForm'].resetFields(); |
| 273 | this.editFormVisible = false; | 310 | this.editFormVisible = false; |
| 274 | - this.getRoles(); | 311 | + this.getTableList(); |
| 275 | }).catch(error => alert(error)); | 312 | }).catch(error => alert(error)); |
| 276 | }); | 313 | }); |
| 277 | } | 314 | } |
| @@ -295,7 +332,7 @@ | @@ -295,7 +332,7 @@ | ||
| 295 | }); | 332 | }); |
| 296 | this.$refs['addForm'].resetFields(); | 333 | this.$refs['addForm'].resetFields(); |
| 297 | this.addFormVisible = false; | 334 | this.addFormVisible = false; |
| 298 | - this.getRoles(); | 335 | + this.getTableList(); |
| 299 | }).catch(error => alert(error)); | 336 | }).catch(error => alert(error)); |
| 300 | }); | 337 | }); |
| 301 | } | 338 | } |
| @@ -306,7 +343,7 @@ | @@ -306,7 +343,7 @@ | ||
| 306 | }, | 343 | }, |
| 307 | //批量删除 | 344 | //批量删除 |
| 308 | batchRemove: function () { | 345 | batchRemove: function () { |
| 309 | - var ids = this.sels.map(item => item.id).toString(); | 346 | + var ids = this.sels.map(item => item.permissionId).toString(); |
| 310 | this.$confirm('确认删除选中记录吗?', '提示', { | 347 | this.$confirm('确认删除选中记录吗?', '提示', { |
| 311 | type: 'warning' | 348 | type: 'warning' |
| 312 | }).then(() => { | 349 | }).then(() => { |
| @@ -320,7 +357,7 @@ | @@ -320,7 +357,7 @@ | ||
| 320 | message: '删除成功', | 357 | message: '删除成功', |
| 321 | type: 'success' | 358 | type: 'success' |
| 322 | }); | 359 | }); |
| 323 | - this.getRoles(); | 360 | + this.getTableList(); |
| 324 | }); | 361 | }); |
| 325 | }).catch(() => { | 362 | }).catch(() => { |
| 326 | 363 |
| @@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
| 4 | <el-col :span="24" class="toolbar" style="padding-bottom: 0px;"> | 4 | <el-col :span="24" class="toolbar" style="padding-bottom: 0px;"> |
| 5 | <el-form :inline="true" :model="filters"> | 5 | <el-form :inline="true" :model="filters"> |
| 6 | <el-form-item> | 6 | <el-form-item> |
| 7 | - <el-input v-model="filters.roleName" placeholder="角色名称"></el-input> | 7 | + <el-input v-model="filters.roleName" placeholder="岗位/角色名称"></el-input> |
| 8 | </el-form-item> | 8 | </el-form-item> |
| 9 | <el-form-item> | 9 | <el-form-item> |
| 10 | <el-button type="primary" v-on:click="getRoles()">查询</el-button> | 10 | <el-button type="primary" v-on:click="getRoles()">查询</el-button> |
| @@ -23,11 +23,11 @@ | @@ -23,11 +23,11 @@ | ||
| 23 | </el-table-column> | 23 | </el-table-column> |
| 24 | <el-table-column prop="roleId" label="ID" width="100" sortable> | 24 | <el-table-column prop="roleId" label="ID" width="100" sortable> |
| 25 | </el-table-column> | 25 | </el-table-column> |
| 26 | - <el-table-column prop="roleName" label="角色名称" min-width="200" sortable> | 26 | + <el-table-column prop="roleName" label="岗位/角色名称" min-width="200" sortable> |
| 27 | </el-table-column> | 27 | </el-table-column> |
| 28 | - <el-table-column prop="description" label="角色描述" min-width="200" sortable> | 28 | + <el-table-column prop="departmentName" label="部门名称" min-width="200" sortable> |
| 29 | </el-table-column> | 29 | </el-table-column> |
| 30 | - <el-table-column prop="roleSign" label="排序" width="100" sortable> | 30 | + <el-table-column prop="description" label="岗位/角色描述" min-width="200" sortable> |
| 31 | </el-table-column> | 31 | </el-table-column> |
| 32 | <el-table-column label="操作" min-width="260"> | 32 | <el-table-column label="操作" min-width="260"> |
| 33 | <template slot-scope="scope"> | 33 | <template slot-scope="scope"> |
| @@ -41,28 +41,32 @@ | @@ -41,28 +41,32 @@ | ||
| 41 | <!--工具条--> | 41 | <!--工具条--> |
| 42 | <el-col :span="24" class="toolbar"> | 42 | <el-col :span="24" class="toolbar"> |
| 43 | <el-button type="danger" @click="batchRemove" :disabled="this.sels.length===0">批量删除</el-button> | 43 | <el-button type="danger" @click="batchRemove" :disabled="this.sels.length===0">批量删除</el-button> |
| 44 | - <el-pagination layout="prev, pager, next" @current-change="handleCurrentChange" :page-size="5" :total="total" style="float:right;"> | 44 | + <el-pagination layout="total, prev, pager, next" @current-change="handleCurrentChange" :page-size="5" :total="total" style="float:right;"> |
| 45 | </el-pagination> | 45 | </el-pagination> |
| 46 | </el-col> | 46 | </el-col> |
| 47 | 47 | ||
| 48 | <!--编辑界面--> | 48 | <!--编辑界面--> |
| 49 | - <el-dialog title="编辑" v-model="editFormVisible" :close-on-click-modal="false"> | 49 | + <el-dialog title="编辑" :visible.sync="editFormVisible" :close-on-click-modal="false"> |
| 50 | <el-form :model="editForm" label-width="80px" :rules="editFormRules" ref="editForm"> | 50 | <el-form :model="editForm" label-width="80px" :rules="editFormRules" ref="editForm"> |
| 51 | <el-form-item label="ID"> | 51 | <el-form-item label="ID"> |
| 52 | <span>{{editForm.roleId}}</span> | 52 | <span>{{editForm.roleId}}</span> |
| 53 | </el-form-item> | 53 | </el-form-item> |
| 54 | - <el-form-item label="角色名称"> | ||
| 55 | - <el-input v-model="editForm.roleName" auto-complete="off" placeholder="请输入角色名称:例如:ROLE_name"></el-input> | 54 | + <el-form-item label="岗位名称"> |
| 55 | + <el-input v-model="editForm.roleName" auto-complete="off" placeholder="请输入岗位/角色名称:例如:ROLE_name"></el-input> | ||
| 56 | </el-form-item> | 56 | </el-form-item> |
| 57 | - <el-form-item label="角色描述"> | ||
| 58 | - <el-input v-model="editForm.description" auto-complete="off" placeholder="请输入角色描述:例如:用户管理员"></el-input> | 57 | + <el-form-item label="岗位描述"> |
| 58 | + <el-input v-model="editForm.description" auto-complete="off" placeholder="请输入岗位/角色描述:例如:用户管理员"></el-input> | ||
| 59 | </el-form-item> | 59 | </el-form-item> |
| 60 | - <el-form-item label="角色排序"> | ||
| 61 | - <el-input v-model="editForm.roleSign" auto-complete="off" placeholder="请输入角色排序:例如:数字123"></el-input> | 60 | + <el-form-item label="部门名称"> |
| 61 | + <el-select v-model="editForm.departmentId" placeholder="请选择"> | ||
| 62 | + <el-option | ||
| 63 | + v-for="item in departmentNameList" | ||
| 64 | + :key="item.departmentId" | ||
| 65 | + :label="item.departmentName" | ||
| 66 | + :value="item.departmentId"> | ||
| 67 | + </el-option> | ||
| 68 | + </el-select> | ||
| 62 | </el-form-item> | 69 | </el-form-item> |
| 63 | - <!--<el-form-item label="创建日期">--> | ||
| 64 | - <!--<el-date-picker type="date" placeholder="创建日期" v-model="editForm.creattime" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd HH:mm:ss"></el-date-picker>--> | ||
| 65 | - <!--</el-form-item>--> | ||
| 66 | </el-form> | 70 | </el-form> |
| 67 | <div slot="footer" class="dialog-footer"> | 71 | <div slot="footer" class="dialog-footer"> |
| 68 | <el-button @click.native="editFormVisible = false">取消</el-button> | 72 | <el-button @click.native="editFormVisible = false">取消</el-button> |
| @@ -71,16 +75,23 @@ | @@ -71,16 +75,23 @@ | ||
| 71 | </el-dialog> | 75 | </el-dialog> |
| 72 | 76 | ||
| 73 | <!--新增界面--> | 77 | <!--新增界面--> |
| 74 | - <el-dialog title="新增" v-model="addFormVisible" :close-on-click-modal="false"> | 78 | + <el-dialog title="新增" :visible.sync="addFormVisible" :close-on-click-modal="false"> |
| 75 | <el-form :model="addForm" label-width="80px" :rules="addFormRules" ref="addForm"> | 79 | <el-form :model="addForm" label-width="80px" :rules="addFormRules" ref="addForm"> |
| 76 | - <el-form-item label="角色名称" prop="roleName"> | ||
| 77 | - <el-input v-model="addForm.roleName" auto-complete="off" placeholder="请输入角色名称:例如:ROLE_name"></el-input> | 80 | + <el-form-item label="岗位/角色名称" prop="roleName"> |
| 81 | + <el-input v-model="addForm.roleName" auto-complete="off" placeholder="请输入岗位/角色名称:例如:ROLE_name"></el-input> | ||
| 78 | </el-form-item> | 82 | </el-form-item> |
| 79 | - <el-form-item label="角色描述" prop="description"> | ||
| 80 | - <el-input v-model="addForm.description" auto-complete="off" placeholder="请输入角色描述:例如:用户管理员"></el-input> | 83 | + <el-form-item label="岗位/角色描述" prop="description"> |
| 84 | + <el-input v-model="addForm.description" auto-complete="off" placeholder="请输入岗位/角色描述:例如:用户管理员"></el-input> | ||
| 81 | </el-form-item> | 85 | </el-form-item> |
| 82 | - <el-form-item label="角色排序" prop="roleSign"> | ||
| 83 | - <el-input v-model="addForm.roleSign" auto-complete="off" placeholder="请输入角色排序:例如:数字123"></el-input> | 86 | + <el-form-item label="部门名称" prop="roleSign"> |
| 87 | + <el-select v-model="addForm.departmentId" placeholder="请选择"> | ||
| 88 | + <el-option | ||
| 89 | + v-for="item in departmentNameList" | ||
| 90 | + :key="item.departmentId" | ||
| 91 | + :label="item.departmentName" | ||
| 92 | + :value="item.departmentId"> | ||
| 93 | + </el-option> | ||
| 94 | + </el-select> | ||
| 84 | </el-form-item> | 95 | </el-form-item> |
| 85 | </el-form> | 96 | </el-form> |
| 86 | <div slot="footer" class="dialog-footer"> | 97 | <div slot="footer" class="dialog-footer"> |
| @@ -90,7 +101,7 @@ | @@ -90,7 +101,7 @@ | ||
| 90 | </el-dialog> | 101 | </el-dialog> |
| 91 | 102 | ||
| 92 | <!--权限设置界面--> | 103 | <!--权限设置界面--> |
| 93 | - <el-dialog title="角色的权限设置" v-model="PermFormVisible" :close-on-click-modal="false"> | 104 | + <el-dialog title="岗位的权限设置" :visible.sync="PermFormVisible" :close-on-click-modal="false"> |
| 94 | <el-form :model="permForm" label-width="80px" ref="permForm"> | 105 | <el-form :model="permForm" label-width="80px" ref="permForm"> |
| 95 | <el-checkbox-group v-model="permIds" size="small"> | 106 | <el-checkbox-group v-model="permIds" size="small"> |
| 96 | <el-checkbox v-for="perm in permissons" :label="perm.permissionId" :key="perm.permissionId">{{perm.name}}</el-checkbox> | 107 | <el-checkbox v-for="perm in permissons" :label="perm.permissionId" :key="perm.permissionId">{{perm.name}}</el-checkbox> |
| @@ -108,6 +119,7 @@ | @@ -108,6 +119,7 @@ | ||
| 108 | import util from '../../common/js/util' | 119 | import util from '../../common/js/util' |
| 109 | import NProgress from 'nprogress' | 120 | import NProgress from 'nprogress' |
| 110 | import { getList, remove, batchRemove, edit, add, updateRolePerm } from '../../api/role_api'; | 121 | import { getList, remove, batchRemove, edit, add, updateRolePerm } from '../../api/role_api'; |
| 122 | + import { getList as getDepartmentList} from '../../api/department'; | ||
| 111 | import { getList as permList } from '../../api/perm_api'; | 123 | import { getList as permList } from '../../api/perm_api'; |
| 112 | import moment from 'moment' | 124 | import moment from 'moment' |
| 113 | export default { | 125 | export default { |
| @@ -116,6 +128,7 @@ | @@ -116,6 +128,7 @@ | ||
| 116 | filters: { | 128 | filters: { |
| 117 | roleName: '' | 129 | roleName: '' |
| 118 | }, | 130 | }, |
| 131 | + departmentNameList:[], | ||
| 119 | roles: [], | 132 | roles: [], |
| 120 | permissons: [], | 133 | permissons: [], |
| 121 | permIds: [], | 134 | permIds: [], |
| @@ -129,7 +142,7 @@ | @@ -129,7 +142,7 @@ | ||
| 129 | editLoading: false, | 142 | editLoading: false, |
| 130 | editFormRules: { | 143 | editFormRules: { |
| 131 | roleName: [ | 144 | roleName: [ |
| 132 | - { required: true, message: '请输入角色名称', trigger: 'blur' } | 145 | + { required: true, message: '请输入岗位/角色名称', trigger: 'blur' } |
| 133 | ] | 146 | ] |
| 134 | }, | 147 | }, |
| 135 | //编辑界面数据 | 148 | //编辑界面数据 |
| @@ -137,10 +150,10 @@ | @@ -137,10 +150,10 @@ | ||
| 137 | roleId: 1, | 150 | roleId: 1, |
| 138 | description: '', | 151 | description: '', |
| 139 | roleName: '', | 152 | roleName: '', |
| 140 | - roleSign: 1 | 153 | + roleSign: 1, |
| 154 | + departmentId:'' | ||
| 141 | }, | 155 | }, |
| 142 | - //设置权限数据 | ||
| 143 | - setPermForm: {}, | 156 | + |
| 144 | //新增界面是否显示 | 157 | //新增界面是否显示 |
| 145 | addFormVisible: false, | 158 | addFormVisible: false, |
| 146 | //设置权限界面是否显示 | 159 | //设置权限界面是否显示 |
| @@ -148,17 +161,18 @@ | @@ -148,17 +161,18 @@ | ||
| 148 | addLoading: false, | 161 | addLoading: false, |
| 149 | addFormRules: { | 162 | addFormRules: { |
| 150 | roleName: [ | 163 | roleName: [ |
| 151 | - { required: true, message: '请输入角色名称', trigger: 'blur' } | 164 | + { required: true, message: '请输入岗位/角色名称', trigger: 'blur' } |
| 152 | ], | 165 | ], |
| 153 | description: [ | 166 | description: [ |
| 154 | - { required: true, message: '请输入角色描述', trigger: 'blur' } | 167 | + { required: true, message: '请输入岗位/角色描述', trigger: 'blur' } |
| 155 | ] | 168 | ] |
| 156 | }, | 169 | }, |
| 157 | //新增界面数据 | 170 | //新增界面数据 |
| 158 | addForm: { | 171 | addForm: { |
| 159 | description: '', | 172 | description: '', |
| 160 | roleName: '', | 173 | roleName: '', |
| 161 | - roleSign: 1 | 174 | + roleSign: 1, |
| 175 | + departmentId:'' | ||
| 162 | }, | 176 | }, |
| 163 | permForm: { | 177 | permForm: { |
| 164 | roleId: 1, | 178 | roleId: 1, |
| @@ -207,11 +221,36 @@ | @@ -207,11 +221,36 @@ | ||
| 207 | alert(error); | 221 | alert(error); |
| 208 | } | 222 | } |
| 209 | 223 | ||
| 210 | - | ||
| 211 | - | ||
| 212 | }); | 224 | }); |
| 213 | 225 | ||
| 214 | }, | 226 | }, |
| 227 | + | ||
| 228 | + | ||
| 229 | + //获取部门列表 | ||
| 230 | + getdepartmentNames() { | ||
| 231 | + | ||
| 232 | + this.listLoading = true; | ||
| 233 | + //NProgress.start(); | ||
| 234 | + getDepartmentList().then((res) => { | ||
| 235 | + this.total = res.data.total; | ||
| 236 | + this.departmentNameList = res.data.list; | ||
| 237 | + this.listLoading = false; | ||
| 238 | + //NProgress.done(); | ||
| 239 | + }).catch((error) => { | ||
| 240 | + | ||
| 241 | + this.listLoading = false; | ||
| 242 | + if(null!= error.response && error.response!==undefined){ | ||
| 243 | + let status= error.response.status; | ||
| 244 | + let msg = error.response.statusText; | ||
| 245 | + alert(status+msg); | ||
| 246 | + }else { | ||
| 247 | + alert(error); | ||
| 248 | + } | ||
| 249 | + | ||
| 250 | + }); | ||
| 251 | + | ||
| 252 | + }, | ||
| 253 | + | ||
| 215 | //获取权限列表 | 254 | //获取权限列表 |
| 216 | getPermList() { | 255 | getPermList() { |
| 217 | let para = { | 256 | let para = { |
| @@ -240,7 +279,7 @@ | @@ -240,7 +279,7 @@ | ||
| 240 | }).then(() => { | 279 | }).then(() => { |
| 241 | this.listLoading = true; | 280 | this.listLoading = true; |
| 242 | //NProgress.start(); | 281 | //NProgress.start(); |
| 243 | - let para = { userId: row.userId }; | 282 | + let para = { roleId: row.roleId }; |
| 244 | remove(para).then((res) => { | 283 | remove(para).then((res) => { |
| 245 | this.listLoading = false; | 284 | this.listLoading = false; |
| 246 | //NProgress.done(); | 285 | //NProgress.done(); |
| @@ -263,6 +302,7 @@ | @@ -263,6 +302,7 @@ | ||
| 263 | handleEdit: function (index, row) { | 302 | handleEdit: function (index, row) { |
| 264 | this.editFormVisible = true; | 303 | this.editFormVisible = true; |
| 265 | this.editForm = Object.assign({}, row); | 304 | this.editForm = Object.assign({}, row); |
| 305 | + this.getdepartmentNames(); | ||
| 266 | }, | 306 | }, |
| 267 | setPerm: function (index, row) { | 307 | setPerm: function (index, row) { |
| 268 | var _this = this; | 308 | var _this = this; |
| @@ -292,6 +332,7 @@ | @@ -292,6 +332,7 @@ | ||
| 292 | mobilephone: '', | 332 | mobilephone: '', |
| 293 | age: 1 | 333 | age: 1 |
| 294 | }; | 334 | }; |
| 335 | + this.getdepartmentNames(); | ||
| 295 | }, | 336 | }, |
| 296 | //编辑 | 337 | //编辑 |
| 297 | editSubmit: function () { | 338 | editSubmit: function () { |
| @@ -386,7 +427,7 @@ | @@ -386,7 +427,7 @@ | ||
| 386 | }, | 427 | }, |
| 387 | //批量删除 | 428 | //批量删除 |
| 388 | batchRemove: function () { | 429 | batchRemove: function () { |
| 389 | - var ids = this.sels.map(item => item.id).toString(); | 430 | + var ids = this.sels.map(item => item.roleId).toString(); |
| 390 | this.$confirm('确认删除选中记录吗?', '提示', { | 431 | this.$confirm('确认删除选中记录吗?', '提示', { |
| 391 | type: 'warning' | 432 | type: 'warning' |
| 392 | }).then(() => { | 433 | }).then(() => { |
| @@ -4,10 +4,10 @@ | @@ -4,10 +4,10 @@ | ||
| 4 | <el-col :span="24" class="toolbar" style="padding-bottom: 0px;"> | 4 | <el-col :span="24" class="toolbar" style="padding-bottom: 0px;"> |
| 5 | <el-form :inline="true" :model="filters"> | 5 | <el-form :inline="true" :model="filters"> |
| 6 | <el-form-item> | 6 | <el-form-item> |
| 7 | - <el-input v-model="filters.realname" placeholder="姓名"></el-input> | 7 | + <el-input v-model="filters.realName" placeholder="姓名"></el-input> |
| 8 | </el-form-item> | 8 | </el-form-item> |
| 9 | <el-form-item> | 9 | <el-form-item> |
| 10 | - <el-input v-model="filters.username" placeholder="账号"></el-input> | 10 | + <el-input v-model="filters.userName" placeholder="账号"></el-input> |
| 11 | </el-form-item> | 11 | </el-form-item> |
| 12 | <el-form-item> | 12 | <el-form-item> |
| 13 | <el-button type="primary" v-on:click="getUsers">查询</el-button> | 13 | <el-button type="primary" v-on:click="getUsers">查询</el-button> |
| @@ -56,12 +56,12 @@ | @@ -56,12 +56,12 @@ | ||
| 56 | <!--工具条--> | 56 | <!--工具条--> |
| 57 | <el-col :span="24" class="toolbar"> | 57 | <el-col :span="24" class="toolbar"> |
| 58 | <el-button type="danger" @click="batchRemove" :disabled="this.sels.length===0">批量删除</el-button> | 58 | <el-button type="danger" @click="batchRemove" :disabled="this.sels.length===0">批量删除</el-button> |
| 59 | - <el-pagination layout="prev, pager, next" @current-change="handleCurrentChange" :page-size="10" :total="total" style="float:right;"> | 59 | + <el-pagination layout="total, prev, pager, next" @current-change="handleCurrentChange" :page-size="10" :total="total" style="float:right;"> |
| 60 | </el-pagination> | 60 | </el-pagination> |
| 61 | </el-col> | 61 | </el-col> |
| 62 | 62 | ||
| 63 | <!--编辑界面--> | 63 | <!--编辑界面--> |
| 64 | - <el-dialog title="编辑" v-model="editFormVisible" :close-on-click-modal="false"> | 64 | + <el-dialog title="编辑" :visible.sync="editFormVisible" :close-on-click-modal="false"> |
| 65 | <el-form :model="editForm" label-width="80px" :rules="editFormRules" ref="editForm"> | 65 | <el-form :model="editForm" label-width="80px" :rules="editFormRules" ref="editForm"> |
| 66 | <el-form-item label="ID"> | 66 | <el-form-item label="ID"> |
| 67 | <span>{{editForm.userId}}</span> | 67 | <span>{{editForm.userId}}</span> |
| @@ -123,7 +123,7 @@ | @@ -123,7 +123,7 @@ | ||
| 123 | </el-dialog> | 123 | </el-dialog> |
| 124 | 124 | ||
| 125 | <!--新增界面--> | 125 | <!--新增界面--> |
| 126 | - <el-dialog title="新增" v-model="addFormVisible" :close-on-click-modal="false"> | 126 | + <el-dialog title="新增" :visible.sync="addFormVisible" :close-on-click-modal="false"> |
| 127 | <el-form :model="addForm" label-width="80px" :rules="addFormRules" ref="addForm"> | 127 | <el-form :model="addForm" label-width="80px" :rules="addFormRules" ref="addForm"> |
| 128 | <el-form-item label="账号" prop="username"> | 128 | <el-form-item label="账号" prop="username"> |
| 129 | <el-input v-model="addForm.username"></el-input> | 129 | <el-input v-model="addForm.username"></el-input> |
| @@ -160,7 +160,7 @@ | @@ -160,7 +160,7 @@ | ||
| 160 | </el-dialog> | 160 | </el-dialog> |
| 161 | 161 | ||
| 162 | <!--权限设置--> | 162 | <!--权限设置--> |
| 163 | - <el-dialog title="权限设置" v-model="roleFormVisible" :close-on-click-modal="false"> | 163 | + <el-dialog title="权限设置" :visible.sync="roleFormVisible" :close-on-click-modal="false"> |
| 164 | <el-form :model="roleEditForm" label-width="80px" ref="roleEditForm" > | 164 | <el-form :model="roleEditForm" label-width="80px" ref="roleEditForm" > |
| 165 | <el-form-item label="ID"> | 165 | <el-form-item label="ID"> |
| 166 | <span>{{roleEditForm.userId}}</span> | 166 | <span>{{roleEditForm.userId}}</span> |
| @@ -168,9 +168,9 @@ | @@ -168,9 +168,9 @@ | ||
| 168 | <el-form-item label="账号"> | 168 | <el-form-item label="账号"> |
| 169 | <span>{{roleEditForm.username}}</span> | 169 | <span>{{roleEditForm.username}}</span> |
| 170 | </el-form-item> | 170 | </el-form-item> |
| 171 | - <el-checkbox-group v-model="roleIds" size="small"> | ||
| 172 | - <el-checkbox-button v-for="role in roles" :label="role.roleId" :key="role.roleId" >{{role.description}}</el-checkbox-button> | ||
| 173 | - </el-checkbox-group> | 171 | + <el-checkbox-group v-model="roleIds" size="small"> |
| 172 | + <el-checkbox-button v-for="role in roles" :label="role.roleId" :key="role.roleId" >{{role.description}}</el-checkbox-button> | ||
| 173 | + </el-checkbox-group> | ||
| 174 | </el-form> | 174 | </el-form> |
| 175 | <div slot="footer" class="dialog-footer"> | 175 | <div slot="footer" class="dialog-footer"> |
| 176 | <el-button @click.native="roleFormVisible = false">取消</el-button> | 176 | <el-button @click.native="roleFormVisible = false">取消</el-button> |
| @@ -190,8 +190,8 @@ | @@ -190,8 +190,8 @@ | ||
| 190 | data() { | 190 | data() { |
| 191 | return { | 191 | return { |
| 192 | filters: { | 192 | filters: { |
| 193 | - username: '', | ||
| 194 | - realname: '' | 193 | + userName: '', |
| 194 | + realName: '' | ||
| 195 | }, | 195 | }, |
| 196 | users: [], | 196 | users: [], |
| 197 | total: 0, | 197 | total: 0, |
| @@ -269,8 +269,8 @@ | @@ -269,8 +269,8 @@ | ||
| 269 | let para = { | 269 | let para = { |
| 270 | pageNum: this.pageNum, | 270 | pageNum: this.pageNum, |
| 271 | pageSize: this.pageSize, | 271 | pageSize: this.pageSize, |
| 272 | - username: this.filters.username, | ||
| 273 | - realname: this.filters.realname | 272 | + userName: this.filters.userName, |
| 273 | + realName: this.filters.realName | ||
| 274 | }; | 274 | }; |
| 275 | this.listLoading = true; | 275 | this.listLoading = true; |
| 276 | getUserList(para).then((res) => { | 276 | getUserList(para).then((res) => { |
| @@ -346,9 +346,6 @@ | @@ -346,9 +346,6 @@ | ||
| 346 | }else { | 346 | }else { |
| 347 | alert(error); | 347 | alert(error); |
| 348 | } | 348 | } |
| 349 | - | ||
| 350 | - | ||
| 351 | - | ||
| 352 | }); | 349 | }); |
| 353 | 350 | ||
| 354 | }, | 351 | }, |
| @@ -409,9 +406,8 @@ | @@ -409,9 +406,8 @@ | ||
| 409 | if (valid) { | 406 | if (valid) { |
| 410 | this.$confirm('确认提交吗?', '提示', {}).then(() => { | 407 | this.$confirm('确认提交吗?', '提示', {}).then(() => { |
| 411 | this.addLoading = true; | 408 | this.addLoading = true; |
| 412 | - //NProgress.start(); | ||
| 413 | let para = Object.assign({}, this.addForm); | 409 | let para = Object.assign({}, this.addForm); |
| 414 | - para.birth = (!para.birth || para.birth == '') ? '' : util.formatDate.format(new Date(para.birth), 'yyyy-MM-dd'); | 410 | +// para.birth = (!para.birth || para.birth == '') ? '' : util.formatDate.format(new Date(para.birth), 'yyyy-MM-dd'); |
| 415 | addUser(para).then((res) => { | 411 | addUser(para).then((res) => { |
| 416 | this.addLoading = false; | 412 | this.addLoading = false; |
| 417 | //NProgress.done(); | 413 | //NProgress.done(); |
src/views/staff/come_car.vue
0 → 100755
| 1 | +<template> | ||
| 2 | + <section> | ||
| 3 | + <!--工具条--> | ||
| 4 | + <el-col :span="24" class="toolbar" style="padding-bottom: 0px;"> | ||
| 5 | + <el-form :inline="true" :model="filters"> | ||
| 6 | + <el-form-item> | ||
| 7 | + <el-input v-model="filters.cometovisitname" placeholder="报修人名称"></el-input> | ||
| 8 | + </el-form-item> | ||
| 9 | + <el-form-item> | ||
| 10 | + <el-button type="primary" v-on:click="getMaintainList()">查询</el-button> | ||
| 11 | + </el-form-item> | ||
| 12 | + <el-form-item> | ||
| 13 | + <el-button type="primary" @click="companyAdd">新增</el-button> | ||
| 14 | + </el-form-item> | ||
| 15 | + </el-form> | ||
| 16 | + </el-col> | ||
| 17 | + | ||
| 18 | + <!--列表--> | ||
| 19 | + <el-table :data="securityInspectionList" highlight-current-row v-loading="listLoading" @selection-change="selsChange" style="width: 100%;"> | ||
| 20 | + <el-table-column type="selection" width="55"> | ||
| 21 | + </el-table-column> | ||
| 22 | + <el-table-column type="index"> | ||
| 23 | + </el-table-column> | ||
| 24 | + <el-table-column prop="id" v-if="false" label="ID" sortable> | ||
| 25 | + </el-table-column> | ||
| 26 | + <el-table-column prop="datetime" label="日期" sortable> | ||
| 27 | + </el-table-column> | ||
| 28 | + <el-table-column prop="cometovisitdate" label="来访时间" sortable> | ||
| 29 | + </el-table-column> | ||
| 30 | + <el-table-column prop="leavedate" label="离开时间" sortable> | ||
| 31 | + </el-table-column> | ||
| 32 | + <el-table-column prop="cometovisitname" label="姓名" sortable> | ||
| 33 | + </el-table-column> | ||
| 34 | + <el-table-column prop="carnumber" label="车辆牌号" sortable> | ||
| 35 | + </el-table-column> | ||
| 36 | + <el-table-column prop="phone" label="联系电话" sortable> | ||
| 37 | + </el-table-column> | ||
| 38 | + <el-table-column prop="comematter" label="来访事由" sortable> | ||
| 39 | + </el-table-column> | ||
| 40 | + <el-table-column prop="warchkeeper" label="值班人员" sortable> | ||
| 41 | + </el-table-column> | ||
| 42 | + <el-table-column label="操作" min-width="150"> | ||
| 43 | + <template slot-scope="scope"> | ||
| 44 | + <el-button size="small" @click="handleEdit(scope.$index, scope.row)">编辑</el-button> | ||
| 45 | + <el-button type="danger" size="small" @click="handleDel(scope.$index, scope.row)">删除</el-button> | ||
| 46 | + </template> | ||
| 47 | + </el-table-column> | ||
| 48 | + </el-table> | ||
| 49 | + | ||
| 50 | + <!--工具条--> | ||
| 51 | + <el-col :span="24" class="toolbar"> | ||
| 52 | + <el-button type="danger" @click="batchRemove" :disabled="this.sels.length===0">批量删除</el-button> | ||
| 53 | + <el-pagination layout="total, prev, pager, next" @current-change="handleCurrentChange" :page-size="5" :total="total" style="float:right;"> | ||
| 54 | + </el-pagination> | ||
| 55 | + </el-col> | ||
| 56 | + | ||
| 57 | + <!--编辑界面--> | ||
| 58 | + <el-dialog title="编辑" :visible.sync="editFormVisible" :close-on-click-modal="false"> | ||
| 59 | + <el-form :model="editForm" label-width="80px" :rules="editFormRules" ref="editForm"> | ||
| 60 | + <el-form-item label="ID"> | ||
| 61 | + <span>{{editForm.id}}</span> | ||
| 62 | + </el-form-item> | ||
| 63 | + <el-form-item label="日期" prop="datetime"> | ||
| 64 | + <el-date-picker | ||
| 65 | + v-model="editForm.datetime" | ||
| 66 | + type="date" | ||
| 67 | + format="yyyy-MM-dd" | ||
| 68 | + value-format="yyyy-MM-dd" | ||
| 69 | + placeholder="选择日期时间"> | ||
| 70 | + </el-date-picker> | ||
| 71 | + </el-form-item> | ||
| 72 | + <el-form-item label="来访时间" prop="cometovisitdate"> | ||
| 73 | + <el-date-picker | ||
| 74 | + v-model="editForm.cometovisitdate" | ||
| 75 | + type="date" | ||
| 76 | + format="yyyy-MM-dd HH:mm:ss" | ||
| 77 | + value-format="yyyy-MM-dd HH:mm:ss" | ||
| 78 | + placeholder="选择日期时间"> | ||
| 79 | + </el-date-picker> | ||
| 80 | + </el-form-item> | ||
| 81 | + <el-form-item label="离开时间" prop="leavedate"> | ||
| 82 | + <el-date-picker | ||
| 83 | + v-model="editForm.leavedate" | ||
| 84 | + type="date" | ||
| 85 | + format="yyyy-MM-dd HH:mm:ss" | ||
| 86 | + value-format="yyyy-MM-dd HH:mm:ss" | ||
| 87 | + placeholder="选择日期时间"> | ||
| 88 | + </el-date-picker> | ||
| 89 | + </el-form-item> | ||
| 90 | + <el-form-item label="姓名" prop="cometovisitname"> | ||
| 91 | + <el-input v-model="editForm.cometovisitname" auto-complete="off" placeholder="请输入姓名"></el-input> | ||
| 92 | + </el-form-item> | ||
| 93 | + <el-form-item label="车辆牌号" prop="carnumber"> | ||
| 94 | + <el-input v-model="editForm.carnumber" auto-complete="off" placeholder="请输入车辆牌号"></el-input> | ||
| 95 | + </el-form-item> | ||
| 96 | + <el-form-item label="联系电话" prop="phone"> | ||
| 97 | + <el-input v-model="editForm.phone" auto-complete="off" placeholder="请输入联系电话"></el-input> | ||
| 98 | + </el-form-item> | ||
| 99 | + <el-form-item label="来访事由" prop="comematter"> | ||
| 100 | + <el-input v-model="editForm.comematter" auto-complete="off" placeholder="请输入来访事由"></el-input> | ||
| 101 | + </el-form-item> | ||
| 102 | + <el-form-item label="值班人员" prop="warchkeeper"> | ||
| 103 | + <el-input v-model="editForm.warchkeeper" auto-complete="off" placeholder="请输值班人员"></el-input> | ||
| 104 | + </el-form-item> | ||
| 105 | + </el-form> | ||
| 106 | + <div slot="footer" class="dialog-footer"> | ||
| 107 | + <el-button @click.native="editFormVisible = false">取消</el-button> | ||
| 108 | + <el-button type="primary" @click.native="editSubmit" :loading="false">提交</el-button> | ||
| 109 | + </div> | ||
| 110 | + </el-dialog> | ||
| 111 | + | ||
| 112 | + <!--新增界面--> | ||
| 113 | + <el-dialog title="新增" :visible.sync="addFormVisible" :close-on-click-modal="false"> | ||
| 114 | + <el-form :model="addForm" label-width="80px" :rules="addFormRules" ref="addForm"> | ||
| 115 | + <el-form-item label="日期" prop="datetime"> | ||
| 116 | + <el-date-picker | ||
| 117 | + v-model="addForm.datetime" | ||
| 118 | + type="date" | ||
| 119 | + format="yyyy-MM-dd" | ||
| 120 | + value-format="yyyy-MM-dd" | ||
| 121 | + placeholder="选择日期时间"> | ||
| 122 | + </el-date-picker> | ||
| 123 | + </el-form-item> | ||
| 124 | + <el-form-item label="来访时间" prop="cometovisitdate"> | ||
| 125 | + <el-date-picker | ||
| 126 | + v-model="addForm.cometovisitdate" | ||
| 127 | + type="date" | ||
| 128 | + format="yyyy-MM-dd HH:mm:ss" | ||
| 129 | + value-format="yyyy-MM-dd HH:mm:ss" | ||
| 130 | + placeholder="选择日期时间"> | ||
| 131 | + </el-date-picker> | ||
| 132 | + </el-form-item> | ||
| 133 | + <el-form-item label="离开时间" prop="leavedate"> | ||
| 134 | + <el-date-picker | ||
| 135 | + v-model="addForm.leavedate" | ||
| 136 | + type="date" | ||
| 137 | + format="yyyy-MM-dd HH:mm:ss" | ||
| 138 | + value-format="yyyy-MM-dd HH:mm:ss" | ||
| 139 | + placeholder="选择日期时间"> | ||
| 140 | + </el-date-picker> | ||
| 141 | + </el-form-item> | ||
| 142 | + <el-form-item label="姓名" prop="cometovisitname"> | ||
| 143 | + <el-input v-model="addForm.cometovisitname" auto-complete="off" placeholder="请输入姓名"></el-input> | ||
| 144 | + </el-form-item> | ||
| 145 | + <el-form-item label="车辆牌号" prop="carnumber"> | ||
| 146 | + <el-input v-model="addForm.carnumber" auto-complete="off" placeholder="请输入车辆牌号"></el-input> | ||
| 147 | + </el-form-item> | ||
| 148 | + <el-form-item label="联系电话" prop="phone"> | ||
| 149 | + <el-input v-model="addForm.phone" auto-complete="off" placeholder="请输入联系电话"></el-input> | ||
| 150 | + </el-form-item> | ||
| 151 | + <el-form-item label="来访事由" prop="comematter"> | ||
| 152 | + <el-input v-model="addForm.comematter" auto-complete="off" placeholder="请输入来访事由"></el-input> | ||
| 153 | + </el-form-item> | ||
| 154 | + <el-form-item label="值班人员" prop="warchkeeper"> | ||
| 155 | + <el-input v-model="addForm.warchkeeper" auto-complete="off" placeholder="请输值班人员"></el-input> | ||
| 156 | + </el-form-item> | ||
| 157 | + </el-form> | ||
| 158 | + <div slot="footer" class="dialog-footer"> | ||
| 159 | + <el-button @click.native="addFormVisible = false">取消</el-button> | ||
| 160 | + <el-button type="primary" @click.native="addSubmit" :loading="addLoading">提交</el-button> | ||
| 161 | + </div> | ||
| 162 | + </el-dialog> | ||
| 163 | + </section> | ||
| 164 | +</template> | ||
| 165 | + | ||
| 166 | +<script> | ||
| 167 | + import util from '../../common/js/util' | ||
| 168 | + import NProgress from 'nprogress' | ||
| 169 | + import { getList, remove, batchRemove, edit, add } from '../../api/staff/come_car'; | ||
| 170 | + import moment from 'moment' | ||
| 171 | + | ||
| 172 | + export default { | ||
| 173 | + data() { | ||
| 174 | + return { | ||
| 175 | + filters: { | ||
| 176 | + cometovisitname: '' | ||
| 177 | + }, | ||
| 178 | + userid: '', | ||
| 179 | + securityInspectionList: [], | ||
| 180 | + total: 0, | ||
| 181 | + pageNum: 1, | ||
| 182 | + pageSize: 5, | ||
| 183 | + listLoading: false, | ||
| 184 | + sels: [],//列表选中列 | ||
| 185 | + //编辑界面是否显示 | ||
| 186 | + editFormVisible: false, | ||
| 187 | + editLoading: false, | ||
| 188 | + editFormRules: { | ||
| 189 | + repairscontent: [ | ||
| 190 | + { required: true, message: '不能为空!!!', trigger: 'blur' } | ||
| 191 | + ], | ||
| 192 | + reflectway: [ | ||
| 193 | + { required: true, message: '不能为空!!!', trigger: 'blur' } | ||
| 194 | + ], | ||
| 195 | + repairsdept: [ | ||
| 196 | + { required: true, message: '不能为空!!!', trigger: 'blur' } | ||
| 197 | + ], | ||
| 198 | + repairsname: [ | ||
| 199 | + { required: true, message: '不能为空!!!', trigger: 'blur' } | ||
| 200 | + ], | ||
| 201 | + answerthephonename: [ | ||
| 202 | + { required: true, message: '不能为空!!!', trigger: 'blur' } | ||
| 203 | + ], | ||
| 204 | + repairsphone: [ | ||
| 205 | + { required: true, message: '不能为空!!!', trigger: 'blur' } | ||
| 206 | + ], | ||
| 207 | + maintaincase: [ | ||
| 208 | + { required: true, message: '不能为空!!!', trigger: 'blur' } | ||
| 209 | + ], | ||
| 210 | + cooperatemaintainname: [ | ||
| 211 | + { required: true, message: '不能为空!!!', trigger: 'blur' } | ||
| 212 | + ], | ||
| 213 | + meno: [ | ||
| 214 | + { required: true, message: '不能为空!!!', trigger: 'blur' } | ||
| 215 | + ], | ||
| 216 | + }, | ||
| 217 | + //编辑界面数据 | ||
| 218 | + editForm: { | ||
| 219 | + id:'', | ||
| 220 | + datetime:'', | ||
| 221 | + cometovisitdate:'', | ||
| 222 | + leavedate:'', | ||
| 223 | + cometovisitname: '', | ||
| 224 | + carnumber: '', | ||
| 225 | + phone: '', | ||
| 226 | + comematter: '', | ||
| 227 | + warchkeeper: '' | ||
| 228 | + | ||
| 229 | + }, | ||
| 230 | + //新增界面是否显示 | ||
| 231 | + addFormVisible: false, | ||
| 232 | + addLoading: false, | ||
| 233 | + addFormRules: { | ||
| 234 | + repairscontent: [ | ||
| 235 | + { required: true, message: '不能为空!!!', trigger: 'blur' } | ||
| 236 | + ], | ||
| 237 | + reflectway: [ | ||
| 238 | + { required: true, message: '不能为空!!!', trigger: 'blur' } | ||
| 239 | + ], | ||
| 240 | + repairsdept: [ | ||
| 241 | + { required: true, message: '不能为空!!!', trigger: 'blur' } | ||
| 242 | + ], | ||
| 243 | + repairsname: [ | ||
| 244 | + { required: true, message: '不能为空!!!', trigger: 'blur' } | ||
| 245 | + ], | ||
| 246 | + answerthephonename: [ | ||
| 247 | + { required: true, message: '不能为空!!!', trigger: 'blur' } | ||
| 248 | + ], | ||
| 249 | + repairsphone: [ | ||
| 250 | + { required: true, message: '不能为空!!!', trigger: 'blur' } | ||
| 251 | + ], | ||
| 252 | + maintaincase: [ | ||
| 253 | + { required: true, message: '不能为空!!!', trigger: 'blur' } | ||
| 254 | + ], | ||
| 255 | + cooperatemaintainname: [ | ||
| 256 | + { required: true, message: '不能为空!!!', trigger: 'blur' } | ||
| 257 | + ], | ||
| 258 | + meno: [ | ||
| 259 | + { required: true, message: '不能为空!!!', trigger: 'blur' } | ||
| 260 | + ], | ||
| 261 | + }, | ||
| 262 | + | ||
| 263 | + //新增界面数据 | ||
| 264 | + addForm: { | ||
| 265 | + datetime:'', | ||
| 266 | + cometovisitdate:'', | ||
| 267 | + leavedate:'', | ||
| 268 | + cometovisitname: '', | ||
| 269 | + carnumber: '', | ||
| 270 | + phone: '', | ||
| 271 | + comematter: '', | ||
| 272 | + warchkeeper: '', | ||
| 273 | + userid: this.userid | ||
| 274 | + } | ||
| 275 | + } | ||
| 276 | + }, | ||
| 277 | + mounted() { | ||
| 278 | + this.userid = JSON.parse(sessionStorage.getItem('user')).userId; | ||
| 279 | + this.getMaintainList(); | ||
| 280 | + | ||
| 281 | + }, | ||
| 282 | + methods: { | ||
| 283 | + | ||
| 284 | + handleCurrentChange(val) { | ||
| 285 | + this.pageNum = val; | ||
| 286 | + this.getMaintainList(); | ||
| 287 | + }, | ||
| 288 | + //获取列表 | ||
| 289 | + getMaintainList() { | ||
| 290 | + let para = { | ||
| 291 | + pageNum: this.pageNum, | ||
| 292 | + pageSize: this.pageSize, | ||
| 293 | + cometovisitname: this.filters.cometovisitname | ||
| 294 | + }; | ||
| 295 | + this.listLoading = true; | ||
| 296 | + getList(para).then((res) => { | ||
| 297 | + this.total = res.data.total; | ||
| 298 | + this.securityInspectionList = res.data.list; | ||
| 299 | + this.listLoading = false; | ||
| 300 | + //NProgress.done(); | ||
| 301 | + }).catch((error) => { | ||
| 302 | + | ||
| 303 | + this.listLoading = false; | ||
| 304 | + if(null!= error.response && error.response!==undefined){ | ||
| 305 | + let status= error.response.status; | ||
| 306 | + let msg = error.response.statusText; | ||
| 307 | + alert(status+msg); | ||
| 308 | + }else { | ||
| 309 | + alert(error); | ||
| 310 | + } | ||
| 311 | + | ||
| 312 | + }); | ||
| 313 | + | ||
| 314 | + }, | ||
| 315 | + | ||
| 316 | + | ||
| 317 | + //删除 | ||
| 318 | + handleDel: function (index, row) { | ||
| 319 | + this.$confirm('确认删除该记录吗?', '提示', { | ||
| 320 | + type: 'warning' | ||
| 321 | + }).then(() => { | ||
| 322 | + this.listLoading = true; | ||
| 323 | + //NProgress.start(); | ||
| 324 | + let para = { id: row.id }; | ||
| 325 | + remove(para).then((res) => { | ||
| 326 | + this.listLoading = false; | ||
| 327 | + //NProgress.done(); | ||
| 328 | + this.$message({ | ||
| 329 | + message: '删除成功', | ||
| 330 | + type: 'success' | ||
| 331 | + }); | ||
| 332 | + this.getMaintainList(); | ||
| 333 | + }).catch((error) => { | ||
| 334 | + this.listLoading = false; | ||
| 335 | + alert(error); | ||
| 336 | + }); | ||
| 337 | + }).catch(); | ||
| 338 | + }, | ||
| 339 | + /** | ||
| 340 | + * 显示编辑界面 | ||
| 341 | + * @param index | ||
| 342 | + * @param row 为这行的数据对象 | ||
| 343 | + */ | ||
| 344 | + handleEdit: function (index, row) { | ||
| 345 | + this.editFormVisible = true; | ||
| 346 | + this.editForm = Object.assign({}, row); | ||
| 347 | + this.getMaintainList(); | ||
| 348 | + }, | ||
| 349 | + //显示新增界面,每次点开初始化数据 | ||
| 350 | + companyAdd: function () { | ||
| 351 | + this.addFormVisible = true; | ||
| 352 | + this.addForm = { | ||
| 353 | + userid: this.userid | ||
| 354 | + }; | ||
| 355 | + this.getMaintainList(); | ||
| 356 | + }, | ||
| 357 | + | ||
| 358 | + //新增 | ||
| 359 | + addSubmit: function () { | ||
| 360 | + this.$refs.addForm.validate((valid) => { | ||
| 361 | + if (valid) { | ||
| 362 | + this.$confirm('确认提交吗?', '提示', {}).then(() => { | ||
| 363 | + //NProgress.start(); | ||
| 364 | + this.listLoading = true; | ||
| 365 | + let para = Object.assign({}, this.addForm); | ||
| 366 | + add(para).then((res) => { | ||
| 367 | + this.addLoading = false; | ||
| 368 | + //NProgress.done(); | ||
| 369 | + this.$message({ | ||
| 370 | + message: '提交成功', | ||
| 371 | + type: 'success' | ||
| 372 | + }); | ||
| 373 | + this.$refs['addForm'].resetFields(); | ||
| 374 | + this.addFormVisible = false; | ||
| 375 | + this.getMaintainList(); | ||
| 376 | + }).catch(error => alert(error)); | ||
| 377 | + }); | ||
| 378 | + } | ||
| 379 | + }); | ||
| 380 | + }, | ||
| 381 | + | ||
| 382 | + //编辑 | ||
| 383 | + editSubmit: function () { | ||
| 384 | + this.$refs.editForm.validate((valid) => { | ||
| 385 | + if (valid) { | ||
| 386 | + this.$confirm('确认提交吗?', '提示', {}).then(() => { | ||
| 387 | + this.editLoading = true; | ||
| 388 | + let para = Object.assign({}, this.editForm); | ||
| 389 | + this.editLoading = true; | ||
| 390 | + edit(para).then((res) => { | ||
| 391 | + | ||
| 392 | + this.$message({ | ||
| 393 | + message: '提交成功', | ||
| 394 | + type: 'success' | ||
| 395 | + }); | ||
| 396 | + this.$refs['editForm'].resetFields(); | ||
| 397 | + this.editFormVisible = false; | ||
| 398 | + this.getMaintainList(); | ||
| 399 | + }).catch(error => alert(error)); | ||
| 400 | + }); | ||
| 401 | + } | ||
| 402 | + }); | ||
| 403 | + }, | ||
| 404 | + | ||
| 405 | + selsChange: function (sels) { | ||
| 406 | + this.sels = sels; | ||
| 407 | + }, | ||
| 408 | + //批量删除 | ||
| 409 | + batchRemove: function () { | ||
| 410 | + var ids = this.sels.map(item => item.id).toString(); | ||
| 411 | + this.$confirm('确认删除选中记录吗?', '提示', { | ||
| 412 | + type: 'warning' | ||
| 413 | + }).then(() => { | ||
| 414 | + this.listLoading = true; | ||
| 415 | + //NProgress.start(); | ||
| 416 | + let para = { ids: ids }; | ||
| 417 | + batchRemove(para).then((res) => { | ||
| 418 | + this.listLoading = false; | ||
| 419 | + //NProgress.done(); | ||
| 420 | + this.$message({ | ||
| 421 | + message: '删除成功', | ||
| 422 | + type: 'success' | ||
| 423 | + }); | ||
| 424 | + this.getMaintainList(); | ||
| 425 | + }); | ||
| 426 | + }).catch(() => { | ||
| 427 | + | ||
| 428 | + }); | ||
| 429 | + } | ||
| 430 | + }, | ||
| 431 | + | ||
| 432 | + } | ||
| 433 | +</script> |
src/views/staff/key.vue
0 → 100755
| 1 | +<template> | ||
| 2 | + <section> | ||
| 3 | + <!--工具条--> | ||
| 4 | + <el-col :span="24" class="toolbar" style="padding-bottom: 0px;"> | ||
| 5 | + <el-form :inline="true" :model="filters"> | ||
| 6 | + <el-form-item> | ||
| 7 | + <el-input v-model="filters.staffname" placeholder="安全巡视员"></el-input> | ||
| 8 | + </el-form-item> | ||
| 9 | + <el-form-item> | ||
| 10 | + <el-button type="primary" v-on:click="getSatffNameList()">查询</el-button> | ||
| 11 | + </el-form-item> | ||
| 12 | + <el-form-item> | ||
| 13 | + <el-button type="primary" @click="companyAdd">新增</el-button> | ||
| 14 | + </el-form-item> | ||
| 15 | + </el-form> | ||
| 16 | + </el-col> | ||
| 17 | + | ||
| 18 | + <!--列表--> | ||
| 19 | + <el-table :data="securityInspectionList" highlight-current-row v-loading="listLoading" @selection-change="selsChange" style="width: 100%;"> | ||
| 20 | + <el-table-column type="selection" width="55"> | ||
| 21 | + </el-table-column> | ||
| 22 | + <el-table-column type="index"> | ||
| 23 | + </el-table-column> | ||
| 24 | + <el-table-column prop="id" v-if="false" label="ID" sortable> | ||
| 25 | + </el-table-column> | ||
| 26 | + <el-table-column prop="usedate" label="日期" sortable> | ||
| 27 | + </el-table-column> | ||
| 28 | + <el-table-column prop="roomnum" label="房间号" sortable> | ||
| 29 | + </el-table-column> | ||
| 30 | + <el-table-column prop="usetime" label="时间" sortable> | ||
| 31 | + </el-table-column> | ||
| 32 | + <el-table-column prop="staffname" label="员工姓名" sortable> | ||
| 33 | + </el-table-column> | ||
| 34 | + <el-table-column prop="dept" label="工作部门" sortable> | ||
| 35 | + </el-table-column> | ||
| 36 | + <el-table-column prop="phone" label="联系电话" sortable> | ||
| 37 | + </el-table-column> | ||
| 38 | + <el-table-column prop="ictype" label="证件类型" sortable> | ||
| 39 | + </el-table-column> | ||
| 40 | + <el-table-column prop="iccard" label="证件号码" sortable> | ||
| 41 | + </el-table-column> | ||
| 42 | + <el-table-column prop="roomduty" label="公寓值班" sortable> | ||
| 43 | + </el-table-column> | ||
| 44 | + <el-table-column label="操作" min-width="150"> | ||
| 45 | + <template slot-scope="scope"> | ||
| 46 | + <el-button size="small" @click="handleEdit(scope.$index, scope.row)">编辑</el-button> | ||
| 47 | + <el-button type="danger" size="small" @click="handleDel(scope.$index, scope.row)">删除</el-button> | ||
| 48 | + </template> | ||
| 49 | + </el-table-column> | ||
| 50 | + </el-table> | ||
| 51 | + | ||
| 52 | + <!--工具条--> | ||
| 53 | + <el-col :span="24" class="toolbar"> | ||
| 54 | + <el-button type="danger" @click="batchRemove" :disabled="this.sels.length===0">批量删除</el-button> | ||
| 55 | + <el-pagination layout="total, prev, pager, next" @current-change="handleCurrentChange" :page-size="5" :total="total" style="float:right;"> | ||
| 56 | + </el-pagination> | ||
| 57 | + </el-col> | ||
| 58 | + | ||
| 59 | + <!--编辑界面--> | ||
| 60 | + <el-dialog title="编辑" :visible.sync="editFormVisible" :close-on-click-modal="false"> | ||
| 61 | + <el-form :model="editForm" label-width="80px" :rules="editFormRules" ref="editForm"> | ||
| 62 | + <el-form-item label="ID"> | ||
| 63 | + <span>{{editForm.id}}</span> | ||
| 64 | + </el-form-item> | ||
| 65 | + <el-form-item label="日期" prop="usedate"> | ||
| 66 | + <el-date-picker | ||
| 67 | + v-model="editForm.usedate" | ||
| 68 | + type="datetime" | ||
| 69 | + format="yyyy-MM-dd" | ||
| 70 | + value-format="yyyy-MM-dd" | ||
| 71 | + placeholder="选择日期时间"> | ||
| 72 | + </el-date-picker> | ||
| 73 | + </el-form-item> | ||
| 74 | + <el-form-item label="房间号" prop="roomnum"> | ||
| 75 | + <el-input v-model="editForm.roomnum" auto-complete="off" placeholder="房间号"></el-input> | ||
| 76 | + </el-form-item> | ||
| 77 | + <el-form-item label="时间" prop="usetime"> | ||
| 78 | + <el-date-picker | ||
| 79 | + v-model="editForm.usetime" | ||
| 80 | + type="datetime" | ||
| 81 | + value-format="yyyy-MM-dd HH:mm:ss" | ||
| 82 | + placeholder="选择日期时间"> | ||
| 83 | + </el-date-picker> | ||
| 84 | + </el-form-item> | ||
| 85 | + <el-form-item label="员工姓名" prop="staffname"> | ||
| 86 | + <el-input v-model="editForm.staffname" auto-complete="off" placeholder="员工姓名"></el-input> | ||
| 87 | + </el-form-item> | ||
| 88 | + <el-form-item label="工作部门" prop="dept"> | ||
| 89 | + <el-input v-model="editForm.dept" auto-complete="off" placeholder="工作部门"></el-input> | ||
| 90 | + </el-form-item> | ||
| 91 | + <el-form-item label="联系电话" prop="phone"> | ||
| 92 | + <el-input v-model="editForm.phone" auto-complete="off" placeholder="联系电话"></el-input> | ||
| 93 | + </el-form-item> | ||
| 94 | + <el-form-item label="证件类型" prop="ictype"> | ||
| 95 | + <el-input v-model="editForm.ictype" auto-complete="off" placeholder="证件类型"></el-input> | ||
| 96 | + </el-form-item> | ||
| 97 | + <el-form-item label="证件号码" prop="iccard"> | ||
| 98 | + <el-input v-model="editForm.iccard" auto-complete="off" placeholder="证件号码"></el-input> | ||
| 99 | + </el-form-item> | ||
| 100 | + <el-form-item label="公寓值班" prop="roomduty"> | ||
| 101 | + <el-input v-model="editForm.roomduty" auto-complete="off" placeholder="公寓值班"></el-input> | ||
| 102 | + </el-form-item> | ||
| 103 | + </el-form> | ||
| 104 | + <div slot="footer" class="dialog-footer"> | ||
| 105 | + <el-button @click.native="editFormVisible = false">取消</el-button> | ||
| 106 | + <el-button type="primary" @click.native="editSubmit" :loading="editLoading">提交</el-button> | ||
| 107 | + </div> | ||
| 108 | + </el-dialog> | ||
| 109 | + | ||
| 110 | + <!--新增界面--> | ||
| 111 | + <el-dialog title="新增" :visible.sync="addFormVisible" :close-on-click-modal="false"> | ||
| 112 | + <el-form :model="addForm" label-width="80px" :rules="addFormRules" ref="addForm"> | ||
| 113 | + <el-form-item label="日期" prop="usedate"> | ||
| 114 | + <el-date-picker | ||
| 115 | + v-model="addForm.usedate" | ||
| 116 | + type="datetime" | ||
| 117 | + format="yyyy-MM-dd" | ||
| 118 | + value-format="yyyy-MM-dd" | ||
| 119 | + placeholder="选择日期时间"> | ||
| 120 | + </el-date-picker> | ||
| 121 | + </el-form-item> | ||
| 122 | + <el-form-item label="房间号" prop="roomnum"> | ||
| 123 | + <el-input v-model="addForm.roomnum" auto-complete="off" placeholder="房间号"></el-input> | ||
| 124 | + </el-form-item> | ||
| 125 | + <el-form-item label="时间" prop="usetime"> | ||
| 126 | + <el-date-picker | ||
| 127 | + v-model="addForm.usetime" | ||
| 128 | + type="datetime" | ||
| 129 | + value-format="yyyy-MM-dd HH:mm:ss" | ||
| 130 | + placeholder="选择日期时间"> | ||
| 131 | + </el-date-picker> | ||
| 132 | + </el-form-item> | ||
| 133 | + <el-form-item label="员工姓名" prop="staffname"> | ||
| 134 | + <el-input v-model="addForm.staffname" auto-complete="off" placeholder="员工姓名"></el-input> | ||
| 135 | + </el-form-item> | ||
| 136 | + <el-form-item label="工作部门" prop="dept"> | ||
| 137 | + <el-input v-model="addForm.dept" auto-complete="off" placeholder="工作部门"></el-input> | ||
| 138 | + </el-form-item> | ||
| 139 | + <el-form-item label="联系电话" prop="phone"> | ||
| 140 | + <el-input v-model="addForm.phone" auto-complete="off" placeholder="联系电话"></el-input> | ||
| 141 | + </el-form-item> | ||
| 142 | + <el-form-item label="证件类型" prop="ictype"> | ||
| 143 | + <el-input v-model="addForm.ictype" auto-complete="off" placeholder="证件类型"></el-input> | ||
| 144 | + </el-form-item> | ||
| 145 | + <el-form-item label="证件号码" prop="iccard"> | ||
| 146 | + <el-input v-model="addForm.iccard" auto-complete="off" placeholder="证件号码"></el-input> | ||
| 147 | + </el-form-item> | ||
| 148 | + <el-form-item label="公寓值班" prop="roomduty"> | ||
| 149 | + <el-input v-model="addForm.roomduty" auto-complete="off" placeholder="公寓值班"></el-input> | ||
| 150 | + </el-form-item> | ||
| 151 | + </el-form> | ||
| 152 | + <div slot="footer" class="dialog-footer"> | ||
| 153 | + <el-button @click.native="addFormVisible = false">取消</el-button> | ||
| 154 | + <el-button type="primary" @click.native="addSubmit" :loading="addLoading">提交</el-button> | ||
| 155 | + </div> | ||
| 156 | + </el-dialog> | ||
| 157 | + </section> | ||
| 158 | +</template> | ||
| 159 | + | ||
| 160 | +<script> | ||
| 161 | + import util from '../../common/js/util' | ||
| 162 | + import NProgress from 'nprogress' | ||
| 163 | + import { getList, remove, batchRemove, edit, add } from '../../api/staff/key'; | ||
| 164 | + import moment from 'moment' | ||
| 165 | + | ||
| 166 | + export default { | ||
| 167 | + data() { | ||
| 168 | + return { | ||
| 169 | + filters: { | ||
| 170 | + staffname: '' | ||
| 171 | + }, | ||
| 172 | + createby: '', | ||
| 173 | + securityInspectionList: [], | ||
| 174 | + total: 0, | ||
| 175 | + pageNum: 1, | ||
| 176 | + pageSize: 5, | ||
| 177 | + listLoading: false, | ||
| 178 | + sels: [],//列表选中列 | ||
| 179 | + //编辑界面是否显示 | ||
| 180 | + editFormVisible: false, | ||
| 181 | + editLoading: false, | ||
| 182 | + editFormRules: { | ||
| 183 | + | ||
| 184 | + roomnum: [ | ||
| 185 | + { required: true, message: '不能为空!!!', trigger: 'blur' } | ||
| 186 | + ], | ||
| 187 | + | ||
| 188 | + staffname: [ | ||
| 189 | + { required: true, message: '不能为空!!!', trigger: 'blur' } | ||
| 190 | + ], | ||
| 191 | + dept: [ | ||
| 192 | + { required: true, message: '不能为空!!!', trigger: 'blur' } | ||
| 193 | + ], | ||
| 194 | + phone: [ | ||
| 195 | + { required: true, message: '不能为空!!!', trigger: 'blur' } | ||
| 196 | + ], | ||
| 197 | + ictype: [ | ||
| 198 | + { required: true, message: '不能为空!!!', trigger: 'blur' } | ||
| 199 | + ], | ||
| 200 | + iccard: [ | ||
| 201 | + { required: true, message: '不能为空!!!', trigger: 'blur' } | ||
| 202 | + ], | ||
| 203 | + roomduty: [ | ||
| 204 | + { required: true, message: '不能为空!!!', trigger: 'blur' } | ||
| 205 | + ], | ||
| 206 | + }, | ||
| 207 | + //编辑界面数据 | ||
| 208 | + editForm: { | ||
| 209 | + usedate: '', | ||
| 210 | + roomnum: '', | ||
| 211 | + usetime: '', | ||
| 212 | + staffname: '', | ||
| 213 | + dept: '', | ||
| 214 | + phone: '', | ||
| 215 | + ictype: '', | ||
| 216 | + iccard: '', | ||
| 217 | + roomduty: '' | ||
| 218 | + }, | ||
| 219 | + //新增界面是否显示 | ||
| 220 | + addFormVisible: false, | ||
| 221 | + addLoading: true, | ||
| 222 | + addFormRules: { | ||
| 223 | + | ||
| 224 | + roomnum: [ | ||
| 225 | + { required: true, message: '不能为空!!!', trigger: 'blur' } | ||
| 226 | + ], | ||
| 227 | + | ||
| 228 | + staffname: [ | ||
| 229 | + { required: true, message: '不能为空!!!', trigger: 'blur' } | ||
| 230 | + ], | ||
| 231 | + dept: [ | ||
| 232 | + { required: true, message: '不能为空!!!', trigger: 'blur' } | ||
| 233 | + ], | ||
| 234 | + phone: [ | ||
| 235 | + { required: true, message: '不能为空!!!', trigger: 'blur' } | ||
| 236 | + ], | ||
| 237 | + ictype: [ | ||
| 238 | + { required: true, message: '不能为空!!!', trigger: 'blur' } | ||
| 239 | + ], | ||
| 240 | + iccard: [ | ||
| 241 | + { required: true, message: '不能为空!!!', trigger: 'blur' } | ||
| 242 | + ], | ||
| 243 | + roomduty: [ | ||
| 244 | + { required: true, message: '不能为空!!!', trigger: 'blur' } | ||
| 245 | + ], | ||
| 246 | + }, | ||
| 247 | + | ||
| 248 | + //新增界面数据 | ||
| 249 | + addForm: { | ||
| 250 | + securityInspectionName: '', | ||
| 251 | +// securityInspectionDate: '', | ||
| 252 | + fireName: '', | ||
| 253 | + securityElectro: '', | ||
| 254 | + fireproofing: '', | ||
| 255 | + doubtfulPerson: '', | ||
| 256 | + violationsCar: '', | ||
| 257 | + builders: '', | ||
| 258 | + otherSituations: '', | ||
| 259 | + optTime:'', | ||
| 260 | + realname:'', | ||
| 261 | + createby: this.createby | ||
| 262 | + } | ||
| 263 | + } | ||
| 264 | + }, | ||
| 265 | + mounted() { | ||
| 266 | + this.createby = JSON.parse(sessionStorage.getItem('user')).userId; | ||
| 267 | + this.getSatffNameList(); | ||
| 268 | + | ||
| 269 | + }, | ||
| 270 | + methods: { | ||
| 271 | + | ||
| 272 | + handleCurrentChange(val) { | ||
| 273 | + this.pageNum = val; | ||
| 274 | + this.getSatffNameList(); | ||
| 275 | + }, | ||
| 276 | + //获取公司列表 | ||
| 277 | + getSatffNameList() { | ||
| 278 | + let para = { | ||
| 279 | + pageNum: this.pageNum, | ||
| 280 | + pageSize: this.pageSize, | ||
| 281 | + staffname: this.filters.staffname | ||
| 282 | + }; | ||
| 283 | + this.listLoading = true; | ||
| 284 | + getList(para).then((res) => { | ||
| 285 | + this.total = res.data.total; | ||
| 286 | + this.securityInspectionList = res.data.list; | ||
| 287 | + this.listLoading = false; | ||
| 288 | + //NProgress.done(); | ||
| 289 | + }).catch((error) => { | ||
| 290 | + | ||
| 291 | + this.listLoading = false; | ||
| 292 | + if(null!= error.response && error.response!==undefined){ | ||
| 293 | + let status= error.response.status; | ||
| 294 | + let msg = error.response.statusText; | ||
| 295 | + alert(status+msg); | ||
| 296 | + }else { | ||
| 297 | + alert(error); | ||
| 298 | + } | ||
| 299 | + | ||
| 300 | + }); | ||
| 301 | + | ||
| 302 | + }, | ||
| 303 | + | ||
| 304 | + | ||
| 305 | + //删除 | ||
| 306 | + handleDel: function (index, row) { | ||
| 307 | + this.$confirm('确认删除该记录吗?', '提示', { | ||
| 308 | + type: 'warning' | ||
| 309 | + }).then(() => { | ||
| 310 | + this.listLoading = true; | ||
| 311 | + //NProgress.start(); | ||
| 312 | + let para = { id: row.id }; | ||
| 313 | + remove(para).then((res) => { | ||
| 314 | + this.listLoading = false; | ||
| 315 | + //NProgress.done(); | ||
| 316 | + this.$message({ | ||
| 317 | + message: '删除成功', | ||
| 318 | + type: 'success' | ||
| 319 | + }); | ||
| 320 | + this.getSatffNameList(); | ||
| 321 | + }).catch((error) => { | ||
| 322 | + this.listLoading = false; | ||
| 323 | + alert(error); | ||
| 324 | + }); | ||
| 325 | + }).catch(); | ||
| 326 | + }, | ||
| 327 | + /** | ||
| 328 | + * 显示编辑界面 | ||
| 329 | + * @param index | ||
| 330 | + * @param row 为这行的数据对象 | ||
| 331 | + */ | ||
| 332 | + handleEdit: function (index, row) { | ||
| 333 | + this.editFormVisible = true; | ||
| 334 | + this.editForm = Object.assign({}, row); | ||
| 335 | + this.getSatffNameList(); | ||
| 336 | + }, | ||
| 337 | + //显示新增界面,每次点开初始化数据 | ||
| 338 | + companyAdd: function () { | ||
| 339 | + this.addFormVisible = true; | ||
| 340 | + this.addForm = { | ||
| 341 | + createby: this.createby | ||
| 342 | + }; | ||
| 343 | + this.getSatffNameList(); | ||
| 344 | + }, | ||
| 345 | + | ||
| 346 | + //新增 | ||
| 347 | + addSubmit: function () { | ||
| 348 | + this.$refs.addForm.validate((valid) => { | ||
| 349 | + if (valid) { | ||
| 350 | + this.$confirm('确认提交吗?', '提示', {}).then(() => { | ||
| 351 | + //NProgress.start(); | ||
| 352 | + this.listLoading = true; | ||
| 353 | + let para = Object.assign({}, this.addForm); | ||
| 354 | + add(para).then((res) => { | ||
| 355 | + this.addLoading = false; | ||
| 356 | + //NProgress.done(); | ||
| 357 | + this.$message({ | ||
| 358 | + message: '提交成功', | ||
| 359 | + type: 'success' | ||
| 360 | + }); | ||
| 361 | + this.$refs['addForm'].resetFields(); | ||
| 362 | + this.addFormVisible = false; | ||
| 363 | + this.getSatffNameList(); | ||
| 364 | + }).catch(error => alert(error)); | ||
| 365 | + }); | ||
| 366 | + } | ||
| 367 | + }); | ||
| 368 | + }, | ||
| 369 | + //编辑 | ||
| 370 | + editSubmit: function () { | ||
| 371 | + this.$refs.editForm.validate((valid) => { | ||
| 372 | + if (valid) { | ||
| 373 | + this.$confirm('确认提交吗?', '提示', {}).then(() => { | ||
| 374 | + this.editLoading = true; | ||
| 375 | + let para = Object.assign({}, this.editForm); | ||
| 376 | + this.editLoading = true; | ||
| 377 | + edit(para).then((res) => { | ||
| 378 | + | ||
| 379 | + this.$message({ | ||
| 380 | + message: '提交成功', | ||
| 381 | + type: 'success' | ||
| 382 | + }); | ||
| 383 | + this.$refs['editForm'].resetFields(); | ||
| 384 | + this.editFormVisible = false; | ||
| 385 | + this.getSatffNameList(); | ||
| 386 | + }).catch(error => alert(error)); | ||
| 387 | + }); | ||
| 388 | + } | ||
| 389 | + }); | ||
| 390 | + }, | ||
| 391 | + | ||
| 392 | + selsChange: function (sels) { | ||
| 393 | + this.sels = sels; | ||
| 394 | + }, | ||
| 395 | + //批量删除 | ||
| 396 | + batchRemove: function () { | ||
| 397 | + var ids = this.sels.map(item => item.id).toString(); | ||
| 398 | + this.$confirm('确认删除选中记录吗?', '提示', { | ||
| 399 | + type: 'warning' | ||
| 400 | + }).then(() => { | ||
| 401 | + this.listLoading = true; | ||
| 402 | + //NProgress.start(); | ||
| 403 | + let para = { ids: ids }; | ||
| 404 | + batchRemove(para).then((res) => { | ||
| 405 | + this.listLoading = false; | ||
| 406 | + //NProgress.done(); | ||
| 407 | + this.$message({ | ||
| 408 | + message: '删除成功', | ||
| 409 | + type: 'success' | ||
| 410 | + }); | ||
| 411 | + this.getSatffNameList(); | ||
| 412 | + }); | ||
| 413 | + }).catch(() => { | ||
| 414 | + | ||
| 415 | + }); | ||
| 416 | + } | ||
| 417 | + }, | ||
| 418 | + | ||
| 419 | + } | ||
| 420 | +</script> |
-
请 注册 或 登录 后发表评论