diff --git a/hb_client/.env.production b/hb_client/.env.production index a6efc10..9305698 100644 --- a/hb_client/.env.production +++ b/hb_client/.env.production @@ -2,6 +2,7 @@ ENV = 'production' # base api +#VUE_APP_BASE_API = 'http://192.168.1.250/api' VUE_APP_BASE_API = 'http://49.232.14.174:2222/api' #VUE_APP_BASE_API = 'http://127.0.0.1:8000/api' diff --git a/hb_client/package.json b/hb_client/package.json index 8e3aa61..c181bcf 100644 --- a/hb_client/package.json +++ b/hb_client/package.json @@ -29,7 +29,11 @@ "element-ui": "^2.15.5", "file-saver": "^2.0.2", "fuse.js": "^6.4.6", + "html-docx-js": "^0.3.1", + "html-docx-js-typescript": "^0.1.5", + "html2canvas": "^1.4.1", "js-cookie": "^3.0.0", + "jspdf": "^2.5.1", "mammoth": "^1.4.19", "normalize.css": "^8.0.1", "nprogress": "0.2.0", diff --git a/hb_client/src/api/qm.js b/hb_client/src/api/qm.js index 32ddc26..d18d4e2 100644 --- a/hb_client/src/api/qm.js +++ b/hb_client/src/api/qm.js @@ -65,6 +65,13 @@ export function getTestRecord(query) { params: query }) } +//检测记录模板 +export function getTestRecordExport(id) { + return request({ + url: `/qm/testrecord/${id}/export/`, + method: 'get' + }) +} //检测记录 export function getTestRecordItem(id) { return request({ diff --git a/hb_client/src/api/user.js b/hb_client/src/api/user.js index df7dac1..8343375 100644 --- a/hb_client/src/api/user.js +++ b/hb_client/src/api/user.js @@ -8,6 +8,14 @@ export function login(data) { }) } +export function refreshToken(data) { + return request({ + url: '/auth/token/refresh/', + method: 'post', + data + }) +} + export function logout() { return request({ url: '/auth/token/black/', diff --git a/hb_client/src/components/customForm/index.vue b/hb_client/src/components/customForm/index.vue index ad62842..66ab915 100644 --- a/hb_client/src/components/customForm/index.vue +++ b/hb_client/src/components/customForm/index.vue @@ -3,7 +3,7 @@ @@ -32,8 +32,8 @@ required >
- + tupian
@@ -158,8 +158,18 @@ 检查合格 检查不合格 + + + + + + + + + + @@ -169,65 +179,75 @@ - diff --git a/hb_client/src/layout/index.vue b/hb_client/src/layout/index.vue index ef11a7b..bc167a8 100644 --- a/hb_client/src/layout/index.vue +++ b/hb_client/src/layout/index.vue @@ -25,7 +25,7 @@ import { Navbar, Sidebar, AppMain,TagsView } from './components' import ResizeMixin from './mixin/ResizeHandler' import { mapGetters } from 'vuex' -import { getToken } from '@/utils/auth' // get token from cookie +import { getToken,getRefresh } from '@/utils/auth' // get token from cookie export default { name: 'Layout', components: { @@ -64,12 +64,12 @@ export default { }, mounted() { let hasToken = getToken(); - /*debugger; - console.log(hasToken);*/ if (hasToken) { + this.refreshCountData(); this.$store.dispatch("user/getCount", {}); + }else{ + this.$router.push({name:'login'}) } - // this.refreshCountData(); }, methods: { refreshCountData(){ @@ -80,12 +80,11 @@ export default { this.$store.dispatch("user/getCount", {}); } },0) - },5000) + },50000) }, handleClickOutside() { this.$store.dispatch('app/closeSideBar', { withoutAnimation: false }) }, - gotoTicketPage(){ let path = this.$route.path; if(path==='/workflow/ticket'){ diff --git a/hb_client/src/router/index.js b/hb_client/src/router/index.js index d921826..87a1375 100644 --- a/hb_client/src/router/index.js +++ b/hb_client/src/router/index.js @@ -113,7 +113,7 @@ export const asyncRoutes = [ path: 'material/:id', name: 'MaterialDO', component: () => import('@/views/mtm/materialdo.vue'), - meta: { title: '绑定检查表', perms: ['vendor_manage'] }, + meta: { title: '绑定检查表' }, hidden: true } , @@ -121,8 +121,21 @@ export const asyncRoutes = [ path: 'materialDetail/:id', name: 'MaterialDetail', component: () => import('@/views/mtm/materialDetail.vue'), - meta: { title: '物料详情', perms: ['vendor_manage'] }, + meta: { title: '物料详情' }, hidden: true + } + + ,{ + path: 'wproductList', + name: 'wproductList', + component: () => import('@/views/mtm/wproductList'), + meta: { title: '半成品列表', icon: 'material', perms: ['mtm_wproduct'] } + }, + { + path: 'productList', + name: 'productList', + component: () => import('@/views/mtm/productList'), + meta: { title: '成品列表', icon: 'material', perms: ['mtm_product'] } }, { path: 'process', @@ -134,7 +147,7 @@ export const asyncRoutes = [ path: 'step/:id', name: 'Step', component: () => import('@/views/mtm/step.vue'), - meta: { title: '子工序', perms: ['vendor_manage'] }, + meta: { title: '子工序'}, hidden: true } , @@ -142,7 +155,7 @@ export const asyncRoutes = [ path: 'stepdo/:id', name: 'StepDo', component: () => import('@/views/mtm/stepdo.vue'), - meta: { title: '子工序查看', perms: ['vendor_manage'] }, + meta: { title: '子工序查看'}, hidden: true }, { @@ -151,18 +164,7 @@ export const asyncRoutes = [ component: () => import('@/views/mtm/productprocess'), meta: { title: '产品管理', icon: 'product', perms: ['mtm_productprocess'] } } - ,{ - path: 'productList', - name: 'productList', - component: () => import('@/views/mtm/productList'), - meta: { title: '成品列表', icon: 'material', perms: ['mtm_material'] } - } - ,{ - path: 'wproductList', - name: 'wproductList', - component: () => import('@/views/mtm/wproductList'), - meta: { title: '半成品列表', icon: 'material', perms: ['mtm_material'] } - } + ] }, { @@ -183,7 +185,7 @@ export const asyncRoutes = [ path: 'work/:id', name: 'work', component: () => import('@/views/pm/work'), - meta: { title: '生产子计划', perms: ['pm_plan'] }, + meta: { title: '生产子计划'}, hidden: true }, { @@ -199,24 +201,24 @@ export const asyncRoutes = [ component: () => import('@/views/pm/management'), meta: { title: '生产任务管理', icon: 'productionTask', perms: ['pm_testitem'] } }, - + { path: 'plandetails/:id', name: 'plandetails', component: () => import('@/views/pm/plandetails'), - meta: { title: '生产任务详情', perms: ['pm_testitem'] }, + meta: { title: '生产任务详情'}, hidden: true } , - + { path: 'processcard/:id', name: 'processcard', component: () => import('@/views/pm/processcard'), - meta: { title: '流程卡', perms: ['vendor_manage'] }, + meta: { title: '流程卡' }, hidden: true } - + ] }, { @@ -226,7 +228,7 @@ export const asyncRoutes = [ name: 'wpm', meta: { title: '生产执行', icon: 'execute', perms: ['wpm_manage'] }, children: [ - { + { path: 'worktask', name: 'worktask', component: () => import('@/views/wpm/worktask'), @@ -261,9 +263,8 @@ export const asyncRoutes = [ path: 'firstCheck', name: 'firstCheck', component: () => import('@/views/wpm/firstCheck'), - meta: { title: '首件确认', icon: 'finishedCheck', perms: ['wpm_firstCheck'] ,noCache: true} + meta: { title: '首件确认', icon: 'finishedCheck', perms: ['wpm_firstCheck']} } - ] }, { @@ -317,10 +318,10 @@ export const asyncRoutes = [ path: 'contractdetail/:id', name: 'contractdetail', component: () => import('@/views/sam/contractdetail'), - meta: { title: '合同详情', perms: ['sam_contract'] }, + meta: { title: '合同详情'}, hidden: true } - + , { path: 'order', @@ -328,13 +329,13 @@ export const asyncRoutes = [ component: () => import('@/views/sam/order'), meta: { title: '订单管理', icon: 'order', perms: ['sam_order'] } } - + , { path: 'orderdetail/:id', name: 'orderdetail', component: () => import('@/views/sam/orderdetail'), - meta: { title: '订单详情', perms: ['sam_order'] }, + meta: { title: '订单详情'}, hidden: true }, { @@ -348,7 +349,7 @@ export const asyncRoutes = [ path: 'salesdetail/:id', name: 'salesdetail', component: () => import('@/views/sam/salesdetail'), - meta: { title: '销售详情', perms: ['sam_sales'] }, + meta: { title: '销售详情'}, hidden: true } ] @@ -384,7 +385,7 @@ export const asyncRoutes = [ path: 'taskdetails/:id', name: 'taskdetails', component: () => import('@/views/qm/taskdetails'), - meta: { title: '过程检验详情', perms: ['qm_processtest'] }, + meta: { title: '过程检验详情'}, hidden: true } , @@ -392,7 +393,7 @@ export const asyncRoutes = [ path: 'wproduct/:id', name: 'wproduct', component: () => import('@/views/qm/wproduct'), - meta: { title: '工序玻璃', perms: ['vendor_manage'] }, + meta: { title: '工序玻璃' }, hidden: true } , @@ -400,7 +401,7 @@ export const asyncRoutes = [ path: 'taskrecordfrom/:id', name: 'taskrecordfrom', component: () => import('@/views/qm/taskrecordfrom'), - meta: { title: '检验记录', perms: ['vendor_manage'] }, + meta: { title: '检验记录'}, hidden: true } , @@ -416,7 +417,7 @@ export const asyncRoutes = [ component: () => import('@/views/qm/unproduct'), meta: { title: '不合格品', icon: 'unqualified', perms: ['qm_unproduct'] } } - + ] }, { @@ -424,19 +425,19 @@ export const asyncRoutes = [ component: Layout, redirect: '/personnel/user', name: 'personnel', - meta: { title: '人员管理', icon: 'user', perms: ['personnel_set'] }, + meta: { title: '人员管理', icon: 'user', perms: ['employee_manage'] }, children: [ { path: 'user', name: 'user', component: () => import('@/views/personnel/user'), - meta: { title: '人员列表', icon: 'userList', perms: ['personnel_user'] } + meta: { title: '人员列表', icon: 'userList', perms: ['employee_userList'] } }, { path: 'attendance', name: 'attendance', component: () => import('@/views/personnel/attendance'), - meta: { title: '考勤列表', icon: 'attendance', perms: ['personnel_attendance'] } + meta: { title: '考勤列表', icon: 'attendance', perms: ['employee_attendance'] } } ,{ path: 'userupdate/:id', name: 'userupdate', @@ -444,7 +445,7 @@ export const asyncRoutes = [ meta: { title: '人员信息详情', icon: 'home' }, hidden: true }, - + ] }, { @@ -464,7 +465,7 @@ export const asyncRoutes = [ path: 'inventory/:id', name: 'inventory', component: () => import('@/views/inm/inventory'), - meta: { title: '仓库物料', perms: ['vendor_manage'] }, + meta: { title: '仓库物料' }, hidden: true } , @@ -484,7 +485,7 @@ export const asyncRoutes = [ path: 'fifodetail/:id', name: 'fifodetail', component: () => import('@/views/inm/fifodetail'), - meta: { title: '仓库物料', perms: ['vendor_manage'] }, + meta: { title: '仓库物料'}, hidden: true }, { @@ -499,7 +500,7 @@ export const asyncRoutes = [ component: () => import('@/views/inm/product'), meta: { title: '成品库', icon: 'finishedProduct', perms: ['inm_product'] } }, - + ] }, { @@ -507,25 +508,25 @@ export const asyncRoutes = [ component: Layout, redirect: '/procurement/vendor', name: 'procurement', - meta: { title: '采购管理', icon: 'purchase', perms: ['procurement_manage'] }, + meta: { title: '采购管理', icon: 'purchase', perms: ['pum_manage'] }, children: [ { path: 'vendor', name: 'vendor', component: () => import('@/views/procurement/vendor'), - meta: { title: '供应商', icon: 'supplier', perms: ['procurement_vendor'] } + meta: { title: '供应商', icon: 'supplier', perms: ['pum_vendor'] } }, { path: 'puorder', name: 'puorder', component: () => import('@/views/procurement/puorder'), - meta: { title: '采购订单', icon: 'purchaseOrder', perms: ['procurement_puorder'] } + meta: { title: '采购订单', icon: 'purchaseOrder', perms: ['pum_puorder'] } }, { path: 'puorderitem/:id', name: 'puorderitem', component: () => import('@/views/procurement/puorderitem'), - meta: { title: '采购订单项', perms: ['procurement_puorder'] }, + meta: { title: '采购订单项'}, hidden: true } ] @@ -555,18 +556,18 @@ export const asyncRoutes = [ component: () => import('@/views/statistics/personStatistics'), meta: { title: '人员统计', icon: 'personStatistics', perms: ['statistics_personStatistics'] } }, - { - path: 'costStatistics', - name: 'costStatistics', - component: () => import('@/views/statistics/costStatistics'), - meta: { title: '成本统计', icon: 'costStatistics', perms: ['workflow_index'] } - }, - { - path: 'testStatistics', - name: 'testStatistics', - component: () => import('@/views/statistics/testStatistics'), - meta: { title: '检验统计', icon: 'testStatistics', perms: ['workflow_index'] } - }, + /* { + path: 'costStatistics', + name: 'costStatistics', + component: () => import('@/views/statistics/costStatistics'), + meta: { title: '成本统计', icon: 'costStatistics', perms: ['workflow_index'] } + }, + { + path: 'testStatistics', + name: 'testStatistics', + component: () => import('@/views/statistics/testStatistics'), + meta: { title: '检验统计', icon: 'testStatistics', perms: ['workflow_index'] } + },*/ ] }, @@ -648,7 +649,7 @@ export const asyncRoutes = [ meta: { title: '用户管理', icon: 'home', perms: ['user_manage'] } } , - + { path: 'organization', name: 'Organization', @@ -677,7 +678,7 @@ export const asyncRoutes = [ path: 'file', name: 'File', component: () => import('@/views/system/file'), - meta: { title: '文件库', icon: 'home', perms: ['file_room'] } + meta: { title: '文件库', icon: 'home', perms: ['system_file'] } }, { path: 'task', diff --git a/hb_client/src/store/getters.js b/hb_client/src/store/getters.js index 3ff47b0..82d3611 100644 --- a/hb_client/src/store/getters.js +++ b/hb_client/src/store/getters.js @@ -2,6 +2,7 @@ const getters = { sidebar: state => state.app.sidebar, device: state => state.app.device, token: state => state.user.token, + refresh: state => state.user.refresh, avatar: state => state.user.avatar, name: state => state.user.name, perms: state => state.user.perms, diff --git a/hb_client/src/store/modules/user.js b/hb_client/src/store/modules/user.js index 6458db4..5c72760 100644 --- a/hb_client/src/store/modules/user.js +++ b/hb_client/src/store/modules/user.js @@ -1,12 +1,14 @@ import { login, logout, getInfo } from '@/api/user' import { getCount } from '@/api/workflow' -import { getToken, setToken, removeToken } from '@/utils/auth' +import { refreshToken } from '@/api/user' +import { getToken, setToken, removeToken} from '@/utils/auth' import { resetRouter } from '@/router' const getDefaultState = () => { return { token: getToken(), name: '', + refresh: '', avatar: '', count: {}, perms: [] @@ -22,6 +24,9 @@ const mutations = { SET_TOKEN: (state, token) => { state.token = token }, + SET_REFRESH: (state, refresh) => { + state.refresh = refresh + }, SET_NAME: (state, name) => { state.name = name }, @@ -44,9 +49,10 @@ const actions = { login({ username: username.trim(), password: password }).then(response => { const { data } = response; commit('SET_TOKEN', data.access); + commit('SET_REFRESH', data.refresh); + sessionStorage.setItem('refresh',data.refresh); setToken(data.access); resolve() - }).catch(error => { reject(error) }) @@ -63,14 +69,11 @@ const actions = { this.$router.push({name:'login',params:{}}); reject('验证失败,重新登陆.'); } - const { perms, name, avatar } = data; - // perms must be a non-empty array if (!perms || perms.length <= 0) { reject('没有任何权限!') } - commit('SET_PERMS', perms); commit('SET_NAME', name); commit('SET_AVATAR', avatar); @@ -118,6 +121,20 @@ const actions = { }) }) } + , + refreshToken({ commit },ref) { + return new Promise((resolve, reject) => { + refreshToken({refresh:ref}).then((res) => { + const { data } = res; + removeToken(); + commit('SET_TOKEN', data.access); + setToken(data.access); + resolve() + }).catch(error => { + reject(error) + }) + }) + } } export default { diff --git a/hb_client/src/utils/auth.js b/hb_client/src/utils/auth.js index 392db62..b63b921 100644 --- a/hb_client/src/utils/auth.js +++ b/hb_client/src/utils/auth.js @@ -1,6 +1,6 @@ import Cookies from 'js-cookie' -const TokenKey = 'token' +const TokenKey = 'token'; export function getToken() { return Cookies.get(TokenKey) @@ -14,12 +14,3 @@ export function removeToken() { return Cookies.remove(TokenKey) } -// export function refreshToken() { -// let token = getToken() -// let data = {"token": token} -// return request({ -// url: '/token/refresh/', -// method: 'post', -// data -// }) -// } diff --git a/hb_client/src/utils/htmlToPdf.js b/hb_client/src/utils/htmlToPdf.js new file mode 100644 index 0000000..11b33ce --- /dev/null +++ b/hb_client/src/utils/htmlToPdf.js @@ -0,0 +1,98 @@ +// 导出页面为PDF格式 +import html2canvas from 'html2canvas' +import JsPDF from 'jspdf' +/*export default{ + install (Vue, options) { + Vue.prototype.getPdf = function () { + var title = this.htmlTitle; + html2Canvas(document.querySelector('#pdfDom'), { + allowTaint: true + }).then(function (canvas) { + let contentWidth = canvas.width; + let contentHeight = canvas.height; + let pageHeight = contentWidth / 592.28 * 841.89; + let leftHeight = contentHeight; + let position = 0; + let imgWidth = 595.28; + let imgHeight = 592.28 / contentWidth * contentHeight; + let pageData = canvas.toDataURL('image/jpeg', 1.0); + let PDF = new JsPDF('', 'pt', 'a4'); + if (leftHeight < pageHeight) { + PDF.addImage(pageData, 'JPEG', 0, 0, imgWidth, imgHeight) + } else { + while (leftHeight > 0) { + PDF.addImage(pageData, 'JPEG', 0, position, imgWidth, imgHeight); + leftHeight -= pageHeight; + position -= 841.89; + if (leftHeight > 0) { + PDF.addPage() + } + } + } + PDF.save(title + '.pdf') + } + ) + } + } +}*/ +function downloadPDF(ele, pdfName){ + let eleW = ele.offsetWidth;// 获得该容器的宽 + let eleH = ele.offsetHeight;// 获得该容器的高 + let eleOffsetTop = ele.offsetTop; // 获得该容器到文档顶部的距离 + let eleOffsetLeft = ele.offsetLeft; // 获得该容器到文档最左的距离 + var canvas = document.createElement("canvas"); + var abs = 0; + let win_in = document.documentElement.clientWidth || document.body.clientWidth; // 获得当前可视窗口的宽度(不包含滚动条) + let win_out = window.innerWidth; // 获得当前窗口的宽度(包含滚动条) + if(win_out>win_in){ + abs = (win_out - win_in)/2; // 获得滚动条宽度的一半 + } + canvas.width = eleW * 2; // 将画布宽&&高放大两倍 + canvas.height = eleH * 2; + var context = canvas.getContext("2d"); + context.scale(2, 2); + context.translate(-eleOffsetLeft -abs, -eleOffsetTop); + // 这里默认横向没有滚动条的情况,因为offset.left(),有无滚动条的时候存在差值,因此 + // translate的时候,要把这个差值去掉 + html2canvas( ele, { + dpi: 300, + // allowTaint: true, //允许 canvas 污染, allowTaint参数要去掉,否则是无法通过toDataURL导出canvas数据的 + useCORS:true //允许canvas画布内 可以跨域请求外部链接图片, 允许跨域请求。 + } ).then( (canvas)=>{ + var contentWidth = canvas.width; + var contentHeight = canvas.height; + //一页pdf显示html页面生成的canvas高度; + var pageHeight = contentWidth / 592.28 * 841.89; + //未生成pdf的html页面高度 + var leftHeight = contentHeight; + //页面偏移 + var position = 0; + //a4纸的尺寸[595.28,841.89],html页面生成的canvas在pdf中图片的宽高 + var imgWidth = 595.28; + var imgHeight = 595.28/contentWidth * contentHeight; + var pageData = canvas.toDataURL('image/jpeg', 1.0); + var pdf = new JsPDF('', 'pt', 'a4'); + //有两个高度需要区分,一个是html页面的实际高度,和生成pdf的页面高度(841.89) + //当内容未超过pdf一页显示的范围,无需分页 + if (leftHeight < pageHeight) { + //在pdf.addImage(pageData, 'JPEG', 左,上,宽度,高度)设置在pdf中显示; + pdf.addImage(pageData, 'JPEG', 0, 0, imgWidth, imgHeight); + // pdf.addImage(pageData, 'JPEG', 20, 40, imgWidth, imgHeight); + } else { // 分页 + while(leftHeight > 0) { + pdf.addImage(pageData, 'JPEG', 0, position, imgWidth, imgHeight); + leftHeight -= pageHeight; + position -= 841.89; + //避免添加空白页 + if(leftHeight > 0) { + pdf.addPage(); + } + } + } + //可动态生成 + pdf.save(pdfName); + }) +} +export default { + downloadPDF +} diff --git a/hb_client/src/utils/request.js b/hb_client/src/utils/request.js index 6183457..f046f8b 100644 --- a/hb_client/src/utils/request.js +++ b/hb_client/src/utils/request.js @@ -1,8 +1,11 @@ import axios from 'axios' import { MessageBox, Message } from 'element-ui' import store from '@/store' -import { getToken } from '@/utils/auth' - +import { refreshToken } from '@/api/user' +import { getToken,setToken,removeToken } from '@/utils/auth' +let isRefreshing = false; +//重试队列 +let requests = []; // create an axios instance const service = axios.create({ baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url @@ -56,7 +59,7 @@ service.interceptors.response.use( * You can also judge the status by HTTP Status Code */ response => { - const res = response.data + const res = response.data; if(res.code>=200 && res.code<400){ return res } @@ -68,24 +71,60 @@ service.interceptors.response.use( duration: 3 * 1000 }) }else{ - MessageBox.confirm('认证失败,请重新登陆.', '确认退出', { + if (!isRefreshing) { + isRefreshing = true; + //调用刷新token的接口 + return refreshToken({refresh: sessionStorage.getItem('refresh')}).then(res => { + const token = res.data.access; + // 替换token + removeToken(); + setToken(token); + response.headers.Authorization = 'Bearer ' + token; + // token 刷新后将数组的方法重新执行 + requests.forEach((cb) => cb(token)); + requests = []; // 重新请求完清空 + return service(response.config) + }).catch(err => { + //跳到登录页 + removeToken(); + store.dispatch('user/logout').then(() => { + location.reload() + }); + return Promise.reject(err) + }).finally(() => { + isRefreshing = false + }) + }else { + // 返回未执行 resolve 的 Promise + return new Promise(resolve => { + // 用函数形式将 resolve 存入,等待刷新后再执行 + requests.push(token => { + response.headers.Authorization = 'Bearer ' + token; + resolve(service(response.config)) + }) + }) + } + /* MessageBox.confirm('认证失败,请重新登陆.', '确认退出', { confirmButtonText: '重新登陆', cancelButtonText: '取消', type: 'warning' }).then(() => { - store.dispatch('user/resetToken').then(() => { + store.dispatch('user/logout').then(() => { location.reload() }) - }) + })*/ } - } else if (res.code >= 400) { - Message({ - message: res.msg || '请求出错', - type: 'error', - duration: 3 * 1000 - }) - return Promise.reject(new Error(res.msg || '请求出错')) + if(res.msg.indexOf('请调整位置')>-1){ + return; + }else{ + Message({ + message: res.msg || '请求出错', + type: 'error', + duration: 3 * 1000 + }) + return Promise.reject(new Error(res.msg || '请求出错')) + } } }, error => { diff --git a/hb_client/src/views/bigScreen/centerLeft1.vue b/hb_client/src/views/bigScreen/centerLeft1.vue index 9b84107..08d39ec 100644 --- a/hb_client/src/views/bigScreen/centerLeft1.vue +++ b/hb_client/src/views/bigScreen/centerLeft1.vue @@ -46,11 +46,12 @@ return { options: {}, cdata: { - xData: ["冷加工", "热弯", "化学钢化"], + xData: ["冷加工", "热弯","物理钢化", "化学钢化"], seriesData: [ - {value: 25, name: "冷加工"}, - {value: 20, name: "热弯"}, - {value: 30, name: "化学钢化"} + {value: 20, name: "冷加工"}, + {value: 25, name: "热弯"}, + {value: 30, name: "物理钢化"}, + {value: 35, name: "化学钢化"} ] } } diff --git a/hb_client/src/views/bigScreen/centerRight1.vue b/hb_client/src/views/bigScreen/centerRight1.vue index 2b5b409..f8ce660 100644 --- a/hb_client/src/views/bigScreen/centerRight1.vue +++ b/hb_client/src/views/bigScreen/centerRight1.vue @@ -9,9 +9,12 @@ 人员到岗情况
-
- +
+
+ +
+
diff --git a/hb_client/src/views/bigScreen/index.vue b/hb_client/src/views/bigScreen/index.vue index 8a71ee7..8104f81 100644 --- a/hb_client/src/views/bigScreen/index.vue +++ b/hb_client/src/views/bigScreen/index.vue @@ -135,6 +135,7 @@ export default { mixins: [drawMixin], + inject:['reload'], data() { return { timing: null, @@ -419,7 +420,7 @@ ], limitedTwo: false, configArticle: { - header: ['标题', '置顶', '作者', '发布时间'], + header: ['标题', '置顶', '发布时间'], data: [ ['郑成功', '2022-03-05'], ['冯宝宝', '2022-03-05'] @@ -437,6 +438,7 @@ category:[], planData:[], realData:[], + timer:null, } }, components: { @@ -476,6 +478,9 @@ that.getOneData();//车间一 that.getTwoData();//车间二 that.getArticle(); + that.timer = window.setInterval(() => { + that.reload(); + },3600000) }, beforeDestroy() { clearInterval(this.timing) @@ -483,8 +488,8 @@ methods: { timeFn() { this.timing = setInterval(() => { - this.dateDay = formatTimeBigScreen(new Date(), 'HH: mm: ss') - this.dateYear = formatTimeBigScreen(new Date(), 'yyyy-MM-dd') + this.dateDay = formatTimeBigScreen(new Date(), 'HH: mm: ss'); + this.dateYear = formatTimeBigScreen(new Date(), 'yyyy-MM-dd'); this.dateWeek = this.weekday[new Date().getDay()] }, 1000) }, @@ -527,8 +532,19 @@ that.titleItem[3].number.number[0] = respo.data.count_selled; that.titleItem[4].number.number[0] = respo.data.count_notok; let mtestCount = respo.data.count_mtestok + respo.data.count_mtestnotok; - that.titleItem[5].number.number[0] = Math.floor((respo.data.count_mtestok / mtestCount) * 100); - that.rate[0].tips = Math.floor((respo.data.count_ok / respo.data.count) * 100); + if(respo.data.count_mtestok===0){ + that.titleItem[5].number.number[0] = 0; + that.rate[0].tips = 0; + }else if(mtestCount===0){ + that.titleItem[5].number.number[0] = 100; + }else{ + that.titleItem[5].number.number[0] = Math.floor((respo.data.count_mtestok / mtestCount) * 100); + } + if(respo.data.count===0){ + that.rate[0].tips = 100; + }else{ + that.rate[0].tips = Math.floor((respo.data.count_ok / respo.data.count) * 100); + } //工序生产进度 getProcessNow({type: 'big_screen'}).then(res => { if (res.data) { @@ -653,6 +669,7 @@ that.listUser = false; getEmployee({page: 0,type:'big_screen',show_atwork:true}).then((response) => { if (response.data) { + // debugger; let list = response.data; let data = []; list.forEach(item => { @@ -660,10 +677,11 @@ obj.push(item.name); // obj.push(item.dept_.name); if (item.is_atwork) { - obj.push("已到岗") + obj.push("已到岗") } else { - obj.push("未到岗") + obj.push("未到岗") } + // obj.push(item.dept_.name); data.push(obj) }); that.userConfig.data = data; @@ -688,7 +706,7 @@ } else { obj.push('已置顶'); } - obj.push(item.author); + // obj.push(item.author); obj.push(item.create_time); data.push(obj) }); @@ -703,6 +721,8 @@ that.limitedPlan = false; getPlanGantt({type: 'big_screen'}).then(res => { if (res.code === 200) { + that.planData = []; + that.realData = []; let list = res.data.results; list.forEach(item=>{ that.category.push(item.number); @@ -715,6 +735,9 @@ } }) }, + }, + destroyed() { + clearInterval(this.timer) } } diff --git a/hb_client/src/views/dashboard/index.vue b/hb_client/src/views/dashboard/index.vue index 738d691..480d859 100644 --- a/hb_client/src/views/dashboard/index.vue +++ b/hb_client/src/views/dashboard/index.vue @@ -604,7 +604,6 @@ page: val, show_atwork:true, page_size: that.userPageSize, - fields: 'id,name,dept_name,is_atwork' }).then((response) => { if (response.data) { that.userList = response.data.results; diff --git a/hb_client/src/views/em/equipment.vue b/hb_client/src/views/em/equipment.vue index a0e596a..e4e1ae1 100644 --- a/hb_client/src/views/em/equipment.vue +++ b/hb_client/src/views/em/equipment.vue @@ -47,21 +47,21 @@ v-el-height-adaptive-table="{bottomOffset: 42}" > - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/hb_client/src/views/qm/taskdetails.vue b/hb_client/src/views/qm/taskdetails.vue index 117c79e..41f1107 100644 --- a/hb_client/src/views/qm/taskdetails.vue +++ b/hb_client/src/views/qm/taskdetails.vue @@ -99,7 +99,6 @@ > @@ -82,60 +80,59 @@ - - - - - 上传文件 - - - -
- 取消 - 确认 -
-
+ + + + 上传文件 + + + +
+ 取消 + 确认 +
+ - + - - + @@ -183,22 +179,22 @@ - + - +
- 取消 + + 取消 + 确认
@@ -215,13 +211,13 @@ label-position="right" > - +
- 取消 + + 取消 + 确认
@@ -229,63 +225,63 @@ diff --git a/hb_client/src/views/workflow/customfield.vue b/hb_client/src/views/workflow/customfield.vue index 8013b84..7f321d7 100644 --- a/hb_client/src/views/workflow/customfield.vue +++ b/hb_client/src/views/workflow/customfield.vue @@ -39,20 +39,17 @@ width="220px" > diff --git a/hb_client/src/views/workflow/index.vue b/hb_client/src/views/workflow/index.vue index cc750d8..4c7605f 100644 --- a/hb_client/src/views/workflow/index.vue +++ b/hb_client/src/views/workflow/index.vue @@ -119,7 +119,7 @@
- +
@@ -356,7 +356,7 @@ var g = new dagreD3.graphlib.Graph().setGraph({ rankdir: 'DL', nodesep: 100, - edgesep: 10,//两条线之间的距离 + edgesep: 50,//两条线之间的距离 ranksep: 50,//节点之间的距离 marginx: 160, marginy: 20, diff --git a/hb_client/src/views/workflow/transitions.vue b/hb_client/src/views/workflow/transitions.vue index d0827f6..70e0c84 100644 --- a/hb_client/src/views/workflow/transitions.vue +++ b/hb_client/src/views/workflow/transitions.vue @@ -1,23 +1,26 @@ - + - - - - + - - + + - - + - - + + - - - - + + + + - - - + + -
取消 @@ -128,28 +123,35 @@
diff --git a/hb_client/src/views/wpm/firstCheck.vue b/hb_client/src/views/wpm/firstCheck.vue index cf8c402..38c74a0 100644 --- a/hb_client/src/views/wpm/firstCheck.vue +++ b/hb_client/src/views/wpm/firstCheck.vue @@ -16,9 +16,10 @@ :data="subPlanList" fit style="width: 100%" - height="100" stripe border + height="100" + highlight-current-row v-el-height-adaptive-table="{bottomOffset: 50}" > @@ -70,7 +71,7 @@ 首件检验 @@ -90,6 +91,13 @@ > 查看 + + 导出 + @@ -215,12 +223,19 @@
+
审核人员确认
+ +
审核人员确认
+
+ +
+
@@ -231,6 +246,7 @@ import faceLogin from '@/components/faceLogin/review.vue'; import {getProcessList,getrecordformList} from "@/api/mtm"; import {getsubplanList} from "@/api/wpm"; + import {getTestRecordExport} from "@/api/qm"; import {firstTestInit,firstAudit} from "@/api/pm"; import {getTestRecordItem,putTestRecordItem,subTestRecordItem} from "@/api/qm"; @@ -256,6 +272,11 @@ enabled:true, material:null }, + checkParams:{ + id:null, + is_testok:true, + record_data:null, + }, planId:null, leader:null, recordId: null, @@ -272,6 +293,7 @@ reviewVisible:false, recordVisible:false, is_midtesting:false, + limitedUserCheck:false, is_testok:false, formName:'首件确认检查表', update_time:'', @@ -296,6 +318,8 @@ changeIndex(item,index) { this.activeIndex = index; this.listQuery.process = item.id; + this.subPlanList = []; + this.count = 0; this.getTableData(); }, @@ -341,6 +365,7 @@ //首件审批 handleSelectclick(scope,index){ let that = this; + debugger; this.reviewVisible = true; that.planId = scope.row.id; that.leader_1 = scope.row.leader_1_?scope.row.leader_1_.name:null; @@ -445,27 +470,56 @@ }); }, - //提交首件检查 + //提交首件检查:需要人脸识别进行身份验证 recordSubmit(value) { let that = this; - let id = value.id; let params = {}; - params.record_data = value.record_data; + params.id = value.id; params.is_testok = value.is_testok; - putTestRecordItem(id, params).then((res) => { - if (res.code >= 200) { - subTestRecordItem(id, params).then((res) => { + params.record_data = value.record_data; + that.checkParams = params; + that.limitedUserCheck = true; + }, + + //人脸识别获取人员信息后 + checkSubmit(data){ + let that =this; + let id = that.checkParams.id; + let params = new Object(); + params.is_testok = that.checkParams.is_testok; + params.record_data = that.checkParams.record_data; + params.token = data.token; + let text = '确定以操作员'+data.name+'身份提交?'; + if(data.token!==''&&data.token!==null&&data.token!==undefined) { + this.$confirm(text, '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + putTestRecordItem(id, params).then((res) => { if (res.code >= 200) { - that.recordVisible = false; - that.getTableData(); + subTestRecordItem(id, params).then((res) => { + debugger; + that.limitedUserCheck = false; + if (res.code >= 200) { + that.recordVisible = false; + that.getTableData(); + }else{ + that.$message.error(res.msg) + } + }).catch(()=>{ + that.limitedUserCheck = false; + }); + } else { + that.$message.error(res.msg) } + }).catch((err) => { + that.$message.error(err); }); - } else { - that.$message.error(res.msg) - } - }).catch((err) => { - that.$message.error(err); - }); + }).catch(() => { + that.limitedUserCheck = false; + }); + } }, //再次点击首件检验 @@ -550,6 +604,17 @@ }) } }, + handleExportClick(scope){ + let exportFormId = scope.row.id; + getTestRecordExport(exportFormId).then(res=>{ + if(res.code===200){ + let link = document.createElement('a'); + link.href = res.data.path; + document.body.appendChild(link); + link.click(); + } + }) + }, }, mounted() { this.getProcessList(); diff --git a/hb_client/src/views/wpm/need.vue b/hb_client/src/views/wpm/need.vue index 27b5bfa..e637c94 100644 --- a/hb_client/src/views/wpm/need.vue +++ b/hb_client/src/views/wpm/need.vue @@ -61,6 +61,8 @@ >
+ +