Преглед изворни кода

Merge branch 'master' of http://47.100.37.243:10191/wutt/manHourHousekeeper

Min пре 1 година
родитељ
комит
becb03e8f1

+ 372 - 354
fhKeeper/formulahousekeeper/timesheet-workshop-h5/src/views/index/index.vue

@@ -2,13 +2,12 @@
     <div class="body">
         <van-swipe class="my-swipe" :autoplay="3000" :height="200" indicator-color="white">
             <van-swipe-item v-for="(item, index) in images" :key="index" class="swipe-img">
-                <img :src="item"/>
-            </van-swipe-item> 
+                <img :src="item" />
+            </van-swipe-item>
         </van-swipe>
         <van-grid :column-num="3">
-            <van-grid-item v-for="(item,index) in routers" :key="index" :icon="item.icon" :text="item.name" 
-            :info="(item.name=='消息记录'&&unreadNum>0)?unreadNum:''"
-            :to="item.url" @click="pfdClick(item)">
+            <van-grid-item v-for="(item, index) in routers" :key="index" :icon="item.icon" :text="item.name"
+                :info="(item.name == '消息记录' && unreadNum > 0) ? unreadNum : ''" :to="item.url" @click="pfdClick(item)">
             </van-grid-item>
         </van-grid>
         <div v-if="isCorpWX" class="kefu" @click="tokefu"><img src="../../assets/icon/kefu.png" alt=""></div>
@@ -16,260 +15,277 @@
     </div>
 </template>
 <script>
-    import Footer from "@/components/Footer";
-    import Vue from "vue";
-    import { ImagePreview } from "vant";
-    Vue.use(ImagePreview);
-    export default {
-        data() {
-            return {
-                isCorpWX:false,
-                isWX:false,
-                user: null,
-                unreadNum:0,
-                images: [
-                    require('../../assets/img/index/banner4.jpeg'),
-                ],
-                routers: [],
-                key: 0,
-                isSyncData: false
-            };
-        },
-        created() {
-            if(localStorage.userInfo) {
-                this.user = JSON.parse(localStorage.userInfo)
-                // 是否为钉钉同步
-                this.isSyncData = this.user.timeType.syncDingding || this.user.timeType.syncFanwei;
-            } 
-        },
-        mounted() {
-            //有错误信息,优先跳转到登录页面去
-            if(window.location.href.indexOf('errorMsg') != '-1') {
-                this.$router.push("/login");
-            }
-            var ua = navigator.userAgent.toLowerCase();
-            if (ua.indexOf("wxwork") > 0) {
-                this.isCorpWX = true;
-            } else if (ua.indexOf("micromessenger") > 0) {
-                this.isWX = true;
-            }
-            let that = this;
-            //企业微信或个人微信是从后台授权后跳转过来的
-            if (this.isCorpWX || this.isWX) {
-                //后台自动授权登录的用户
-                if(window.location.href.indexOf('userId') != '-1') {
-                    let href = window.location.href;
-                    var loginUserId = href.substring(href.indexOf("userId=")+"userId=".length);
-                    if (loginUserId.includes('#/')) {
-                        loginUserId = loginUserId.substring(0, loginUserId.indexOf('#/'));
-                    }
-                    that.getAccountInfo(loginUserId)
-                } else {
-                    //存在一部分用户,没有绑定企业微信,进来后跳到登录页面,登录页面输入账号密码进来后不带userId
-                    if (this.user) {
-                        that.getAccountInfo(that.user.id);
-                    } else {
-                        that.$router.push("/login");
-                    }
+import Footer from "@/components/Footer";
+import Vue from "vue";
+import { ImagePreview } from "vant";
+Vue.use(ImagePreview);
+export default {
+    data() {
+        return {
+            isCorpWX: false,
+            isWX: false,
+            user: null,
+            unreadNum: 0,
+            images: [
+                require('../../assets/img/index/banner4.jpeg'),
+            ],
+            routers: [],
+            key: 0,
+            isSyncData: false
+        };
+    },
+    created() {
+        if (localStorage.userInfo) {
+            this.user = JSON.parse(localStorage.userInfo)
+            // 是否为钉钉同步
+            this.isSyncData = this.user.timeType.syncDingding || this.user.timeType.syncFanwei;
+        }
+    },
+    mounted() {
+        //有错误信息,优先跳转到登录页面去
+        if (window.location.href.indexOf('errorMsg') != '-1') {
+            this.$router.push("/login");
+        }
+        var ua = navigator.userAgent.toLowerCase();
+        if (ua.indexOf("wxwork") > 0) {
+            this.isCorpWX = true;
+        } else if (ua.indexOf("micromessenger") > 0) {
+            this.isWX = true;
+        }
+        let that = this;
+        //企业微信或个人微信是从后台授权后跳转过来的
+        if (this.isCorpWX || this.isWX) {
+            //后台自动授权登录的用户
+            if (window.location.href.indexOf('userId') != '-1') {
+                let href = window.location.href;
+                var loginUserId = href.substring(href.indexOf("userId=") + "userId=".length);
+                if (loginUserId.includes('#/')) {
+                    loginUserId = loginUserId.substring(0, loginUserId.indexOf('#/'));
                 }
+                that.getAccountInfo(loginUserId)
             } else {
-                //其他情况,刷新用户信息
-                if (localStorage.userInfo != null && localStorage.userInfo != 'undefined') {
-                    that.user = JSON.parse(localStorage.userInfo);
+                //存在一部分用户,没有绑定企业微信,进来后跳到登录页面,登录页面输入账号密码进来后不带userId
+                if (this.user) {
                     that.getAccountInfo(that.user.id);
-                } else{
-                    //无用户信息,跳到登录页面去
-                    this.$router.push("/login");
+                } else {
+                    that.$router.push("/login");
                 }
             }
-            if (this.user) {
-                let userss = this.user;
-                if(userss.isMobFirstLogin == 1 && userss.createTime[0] > '2022' && userss.roleName == '超级管理员') {
-                    // 第一次登陆显示
-                    this.previewPicture()
+        } else {
+            //其他情况,刷新用户信息
+            if (localStorage.userInfo != null && localStorage.userInfo != 'undefined') {
+                that.user = JSON.parse(localStorage.userInfo);
+                that.getAccountInfo(that.user.id);
+            } else {
+                //无用户信息,跳到登录页面去
+                this.$router.push("/login");
+            }
+        }
+        if (this.user) {
+            let userss = this.user;
+            if (userss.isMobFirstLogin == 1 && userss.createTime[0] > '2022' && userss.roleName == '超级管理员') {
+                // 第一次登陆显示
+                this.previewPicture()
+            }
+        }
+    },
+    components: {
+        Footer
+    },
+    methods: {
+        pfdClick(item) {
+            if (item.name == '使用说明') {
+                let url = 'http://celiang.oss-cn-hangzhou.aliyuncs.com/measurement/2022-01/18/75it6phpocqYFV1642488558220118.pdf'
+                let name = '使用说明书'
+                // 将要传过去的值
+                this.previewPDF(url, name)
+            }
+        },
+        // 预览pdf
+        previewPDF(url, name) {
+            this.$router.push({
+                path: '/pdf',
+                query: {
+                    url: '',
+                    name: name
                 }
-            } 
+            })
         },
-        components: {
-            Footer
+        // 图片预览
+        previewPicture() {
+            let that = this
+            let arr = [
+                'https://mobworktime.ttkuaiban.com/upload/b9cf863819924106a65255ccffae446d.png',
+                'https://mobworktime.ttkuaiban.com/upload/65afcaed7ad84c51a309db69c888fe6c.png',
+                'https://mobworktime.ttkuaiban.com/upload/3452d33a68bb4092b04147e5482fd0e9.png',
+                'https://mobworktime.ttkuaiban.com/upload/af5b430f48b24b2683fb48a43deab98c.png',
+                'https://mobworktime.ttkuaiban.com/upload/b69779d86be44ef3a1d3585816fde5f3.png'
+            ]
+            ImagePreview({
+                images: arr,
+                startPosition: 0,
+                showIndicators: true,
+                closeable: true,
+                onClose() {
+                    that.previewPictureClose()
+                },
+            });
         },
-        methods: {
-            pfdClick(item) {
-                if(item.name == '使用说明') {
-                    let url = 'http://celiang.oss-cn-hangzhou.aliyuncs.com/measurement/2022-01/18/75it6phpocqYFV1642488558220118.pdf'
-                    let name = '使用说明书'
-                    // 将要传过去的值
-                    this.previewPDF(url, name)
-                }
-            },
-            // 预览pdf
-            previewPDF(url, name) {
-                this.$router.push({
-                    path:  '/pdf',
-                    query: {
-                        url: '',
-                        name: name
-                    }
-                })
-            },
-            // 图片预览
-            previewPicture() {
-                let that = this
-                let arr = [
-                    'https://mobworktime.ttkuaiban.com/upload/b9cf863819924106a65255ccffae446d.png',
-                    'https://mobworktime.ttkuaiban.com/upload/65afcaed7ad84c51a309db69c888fe6c.png',
-                    'https://mobworktime.ttkuaiban.com/upload/3452d33a68bb4092b04147e5482fd0e9.png',
-                    'https://mobworktime.ttkuaiban.com/upload/af5b430f48b24b2683fb48a43deab98c.png',
-                    'https://mobworktime.ttkuaiban.com/upload/b69779d86be44ef3a1d3585816fde5f3.png'
-                ]
-                ImagePreview({
-                    images: arr,
-                    startPosition: 0,
-                    showIndicators: true,
-                    closeable: true,
-                    onClose() {
-                        that.previewPictureClose()
-                    },
-                });
-            },
-            // 处理关闭事件
-            previewPictureClose() {
-                this.$axios.post("/user/mobSkipGuidance", {
-                })
+        // 处理关闭事件
+        previewPictureClose() {
+            this.$axios.post("/user/mobSkipGuidance", {
+            })
                 .then(res => {
-                    if(res.code == "ok") {
-                       let userss = JSON.parse(localStorage.userInfo)
-                       userss.isMobFirstLogin = 0
-                       localStorage.userInfo = JSON.stringify(userss);
-                    } 
-                }).catch(err=> {this.$toast.clear();});
-            },
-            tokefu(){
-                wx.invoke('openThirdAppServiceChat', {
-                    }, function(res) {
-                        console.log('invoke',res);
-                        if (res.err_msg == "openThirdAppServiceChat:ok" || res.err_msg == "openThirdAppServiceChat:cancel") {
-                        }else{
-                            this.$toast.fail('请联系管理员添加客服');
-                        }
-                        
+                    if (res.code == "ok") {
+                        let userss = JSON.parse(localStorage.userInfo)
+                        userss.isMobFirstLogin = 0
+                        localStorage.userInfo = JSON.stringify(userss);
                     }
-                );
-            },
-            // 模块
-            getModule() {
-                if(this.user.userNameNeedTranslate == '1'){
-                    this.agentConfig()
+                }).catch(err => { this.$toast.clear(); });
+        },
+        tokefu() {
+            wx.invoke('openThirdAppServiceChat', {
+            }, function (res) {
+                console.log('invoke', res);
+                if (res.err_msg == "openThirdAppServiceChat:ok" || res.err_msg == "openThirdAppServiceChat:cancel") {
+                } else {
+                    this.$toast.fail('请联系管理员添加客服');
                 }
 
-                this.routers = [
-                    {
-                        name: '今日计划',
-                        url: '/todayPlan',
-                        icon: 'balance-list-o'
-                    },
-                    {
-                        name: '明日计划',
-                        url: '/tomorrowPlan',
-                        icon: 'balance-list-o'
-                    },
-                    {
-                        name: '插单计划',
-                        url: '/InsertionPlan',
-                        icon: 'balance-list-o'
-                    },
-                    {
-                        name: '数据统计',
-                        url: '/statisticsView',
-                        icon: 'balance-list-o'
-                    },
-                    {
-                        name: '班组人员',
-                        url: '/groupView',
-                        icon: 'balance-list-o'
-                    },
-                    {
-                        name: '报工',
-                        url: '/groupView',
-                        icon: 'balance-list-o'
-                    },
-                ]
-            },
-
-            // 获取企业微信参数
-            agentConfig(){
-                let curUrl = window.location.href.split('#')[0]
-                this.$axios.post('/wxcorp/getCorpWXConfig',{
-                    url: curUrl,
-                    token: this.user.id
-                }).then(res => {
-                    if(res.code == 'ok'){
-                        wx.config({
-                            beta: true,
-                            debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
-                            appId: res.data.appid, // 必填,公众号的唯一标识 
-                            timestamp: res.data.timestamp, // 必填,生成签名的时间戳 
-                            nonceStr: res.data.noncestr, // 必填,生成签名的随机串 
-                            signature: res.data.sign, // 必填,签名,见附录1 
-                            jsApiList: ['chooseImage','previewImage','uploadImage','downloadImage','previewFile','getLocation','agentConfig'] 
-                        })
-                        let that = this
-                        wx.ready(function(){
+            }
+            );
+        },
+        // 模块
+        getModule() {
+            if (this.user.userNameNeedTranslate == '1') {
+                this.agentConfig()
+            }
+            const moduleList = this.user.moduleList
+            const modelNameList = []
+            // 取出所有名字,在更具后端返回的名字来判断是否显示
+            moduleList.forEach(module => {
+              modelNameList.push(module.name);
+              if (module.children) {
+                module.children.forEach(child => {
+                  modelNameList.push(child.name);
+                });
+              }
+            });
+            const routersList = [
+                {
+                    name: '今日计划',
+                    moudelName: '今日计划',
+                    url: '/todayPlan',
+                    icon: 'balance-list-o'
+                },
+                {
+                    name: '明日计划',
+                    moudelName: '明日计划',
+                    url: '/tomorrowPlan',
+                    icon: 'balance-list-o'
+                },
+                {
+                    name: '插单计划',
+                    moudelName: '插单计划',
+                    url: '/InsertionPlan',
+                    icon: 'balance-list-o'
+                },
+                {
+                    name: '数据统计',
+                    moudelName: '数据统计',
+                    url: '/statisticsView',
+                    icon: 'balance-list-o'
+                },
+                {
+                    name: '班组人员',
+                    moudelName: '班组人员',
+                    url: '/groupView',
+                    icon: 'balance-list-o'
+                },
+                {
+                    name: '报工',
+                    moudelName: '查看报工',
+                    url: '/groupView',
+                    icon: 'balance-list-o'
+                },
+            ]
+            console.log(routersList, modelNameList)
+            this.routers = routersList.filter(item => modelNameList.includes(item.moudelName))
+        },
+        // 获取企业微信参数
+        agentConfig() {
+            let curUrl = window.location.href.split('#')[0]
+            this.$axios.post('/wxcorp/getCorpWXConfig', {
+                url: curUrl,
+                token: this.user.id
+            }).then(res => {
+                if (res.code == 'ok') {
+                    wx.config({
+                        beta: true,
+                        debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
+                        appId: res.data.appid, // 必填,公众号的唯一标识 
+                        timestamp: res.data.timestamp, // 必填,生成签名的时间戳 
+                        nonceStr: res.data.noncestr, // 必填,生成签名的随机串 
+                        signature: res.data.sign, // 必填,签名,见附录1 
+                        jsApiList: ['chooseImage', 'previewImage', 'uploadImage', 'downloadImage', 'previewFile', 'getLocation', 'agentConfig']
+                    })
+                    let that = this
+                    wx.ready(function () {
                         // config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。
-                            that.$axios.post('/wxcorp/getCorpWXAgentConfig', {
-                                url: curUrl,
-                                token: that.user.id
-                            }).then(res => {
-                                if(res.code == 'ok'){
-                                    wx.agentConfig({
-                                        corpid: res.data.corpid, // 必填,企业微信的corpid,必须与当前登录的企业一致
-                                        agentid: res.data.agentid, // 必填,企业微信的应用id (e.g. 1000247)
-                                        timestamp: res.data.timestamp, // 必填,生成签名的时间戳
-                                        nonceStr: res.data.nonceStr, // 必填,生成签名的随机串
-                                        signature: res.data.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
-                                        jsApiList: ['selectExternalContact','openThirdAppServiceChat', 'openAppManage'], //必填,传入需要使用的接口名称
-                                        success: function (result) {
-                                            // console.log(result, '请求微信成功')
-                                            // console.log(window, 'window')
-                                            //  wx.agentConfig成功回调后,WWOpenData 才会注入到 window 对象上面
-                                            window.WWOpenData.bind(document.querySelector('ww-open-data'))
-                                            // that.kefuShow = true
-                                        },
-                                        fail: function (res) {
-                                            // console.log('查看错误信息', res)
-                                            if (res.errMsg.indexOf('function not exist') > -1) {
-                                                alert('版本过低请升级')
-                                            } else {
-                                                // alert('agentConfig出错:'+res.errMsg);
-                                            }
-                                        },
-                                    })
-                                }
-                            }).catch(err => {
-                                if (err.errMsg.indexOf('function not exist') > -1) {
-                                    alert('版本过低请升级')
-                                }else {
-                                    // alert(res.errMsg);
-                                }
-                            })
-                        });
-                        wx.error(function(res){
-                            // config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
-                            // alert('wxConfig发生异常:'+JSON.stringify(res));
-                            // 企业第一次授权安装进入后会报not in reliable domain的错误,刷新后正常
-                            location.reload();
-                        });
-                    } else {
-                        // alert(''+res);
-                    }
-                }).catch(err => {
-                    alert(err);
-                })
-            },
+                        that.$axios.post('/wxcorp/getCorpWXAgentConfig', {
+                            url: curUrl,
+                            token: that.user.id
+                        }).then(res => {
+                            if (res.code == 'ok') {
+                                wx.agentConfig({
+                                    corpid: res.data.corpid, // 必填,企业微信的corpid,必须与当前登录的企业一致
+                                    agentid: res.data.agentid, // 必填,企业微信的应用id (e.g. 1000247)
+                                    timestamp: res.data.timestamp, // 必填,生成签名的时间戳
+                                    nonceStr: res.data.nonceStr, // 必填,生成签名的随机串
+                                    signature: res.data.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
+                                    jsApiList: ['selectExternalContact', 'openThirdAppServiceChat', 'openAppManage'], //必填,传入需要使用的接口名称
+                                    success: function (result) {
+                                        // console.log(result, '请求微信成功')
+                                        // console.log(window, 'window')
+                                        //  wx.agentConfig成功回调后,WWOpenData 才会注入到 window 对象上面
+                                        window.WWOpenData.bind(document.querySelector('ww-open-data'))
+                                        // that.kefuShow = true
+                                    },
+                                    fail: function (res) {
+                                        // console.log('查看错误信息', res)
+                                        if (res.errMsg.indexOf('function not exist') > -1) {
+                                            alert('版本过低请升级')
+                                        } else {
+                                            // alert('agentConfig出错:'+res.errMsg);
+                                        }
+                                    },
+                                })
+                            }
+                        }).catch(err => {
+                            if (err.errMsg.indexOf('function not exist') > -1) {
+                                alert('版本过低请升级')
+                            } else {
+                                // alert(res.errMsg);
+                            }
+                        })
+                    });
+                    wx.error(function (res) {
+                        // config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
+                        // alert('wxConfig发生异常:'+JSON.stringify(res));
+                        // 企业第一次授权安装进入后会报not in reliable domain的错误,刷新后正常
+                        location.reload();
+                    });
+                } else {
+                    // alert(''+res);
+                }
+            }).catch(err => {
+                alert(err);
+            })
+        },
 
-            //获取账户信息
-            getAccountInfo(userId) {
-                this.$axios.get('/user/loginByUserId', {params:{userId: userId}})
+        //获取账户信息
+        getAccountInfo(userId) {
+            this.$axios.get('/user/loginByUserId', { params: { userId: userId } })
                 .then(res => {
                     // console.log(res);
                     if (res.code == 'error') {
@@ -286,134 +302,136 @@
                         this.redirectIfNess();
                         this.$forceUpdate()
                         // this.bindIfNessary();
-                    } 
-                }).catch(err=> {
+                    }
+                }).catch(err => {
                     alert('err=' + err);
                 });
-            },
-            redirectIfNess() {
-                var href = window.location.href;
-                if (href.indexOf('path') > 0) {
-                    var path = href.split('path=')[1].split('&')[0];
-                    if (path == 'expense' || path == 'task') {
-                        this.$router.push(path);
-                    }
+        },
+        redirectIfNess() {
+            var href = window.location.href;
+            if (href.indexOf('path') > 0) {
+                var path = href.split('path=')[1].split('&')[0];
+                if (path == 'expense' || path == 'task') {
+                    this.$router.push(path);
                 }
-            },
-            bindIfNessary() {
-                let href = window.location.href;
-                var requestUrl = "";
-                if (this.isCorpWX && (this.user.corpwxUserid == null|| this.user.corpwxUserid == undefined || this.user.corpwxUserid == 'undefined')) {//优先检查企业微信环境
-                    requestUrl = "/wxcorp/bindCorpWeiXin";
-                } else if (this.isWX && (this.user.wxOpenid == null || this.user.wxOpenid == undefined || this.user.wxOpenid == 'undefined')) {
-                    requestUrl = "/wechat/bindWeiXin";
-                } 
-                
-                if (requestUrl.length > 0) {
-                    // localStorage.openId = 'o1L3L5lOrOl3_UEJjONaoT2Rne1I';
-                    //会自动跳转到首页
-                    // let href = 'http://hq.tangusoft.com/?code=011Ptjgc2rx1eI09Irgc2Rvsgc2PtjgF&state=1#/index';
-                    
-                    if (href.includes("com/?code")) {  //url包括 com/?code 证明为从微信跳转回来的
-                        var url = href; //vue自动在末尾加了 #/ 符号,截取去掉
-                        var jingPosit = url.indexOf("com/") + 4; //获取域名结束的位置
+            }
+        },
+        bindIfNessary() {
+            let href = window.location.href;
+            var requestUrl = "";
+            if (this.isCorpWX && (this.user.corpwxUserid == null || this.user.corpwxUserid == undefined || this.user.corpwxUserid == 'undefined')) {//优先检查企业微信环境
+                requestUrl = "/wxcorp/bindCorpWeiXin";
+            } else if (this.isWX && (this.user.wxOpenid == null || this.user.wxOpenid == undefined || this.user.wxOpenid == 'undefined')) {
+                requestUrl = "/wechat/bindWeiXin";
+            }
 
-                        // var urlLeft = url.substring(0, jingPosit);//url左侧部分
-                        var urlRight = url.substring(jingPosit, url.length); //url右侧部分
-                        // console.log('urlRight=' + urlRight);
-                        // window.location = urlLeft + "#/home" + urlRight;//拼接跳转
-                        //获取code
-                        var code = urlRight.substring('?code='.length,urlRight.indexOf('#/index'));
-                        if (code.indexOf('&state=1') > 0) {
-                            code = code.substring(0, code.indexOf('&state=1'));
-                        }
+            if (requestUrl.length > 0) {
+                // localStorage.openId = 'o1L3L5lOrOl3_UEJjONaoT2Rne1I';
+                //会自动跳转到首页
+                // let href = 'http://hq.tangusoft.com/?code=011Ptjgc2rx1eI09Irgc2Rvsgc2PtjgF&state=1#/index';
 
-                        //调用后台接口,注册用户
-                        // console.log('获取到code=='+code);
+                if (href.includes("com/?code")) {  //url包括 com/?code 证明为从微信跳转回来的
+                    var url = href; //vue自动在末尾加了 #/ 符号,截取去掉
+                    var jingPosit = url.indexOf("com/") + 4; //获取域名结束的位置
 
-                        this.$axios.get(requestUrl, {params:{code:code, userId: this.user.id}})
-                            .then(res => {
-                                // console.log(res);
-                                if (res == null) {
-                                    this.$toast.fail('绑定失败');
-                                } else if(res.errcode != null) {
-                                    //报错了
-                                    console.log(res.errmsg);
-                                } else {
-                                    //获取openId
-                                    if (res.data != null && ((this.isWX && res.data.wxOpenid != undefined)
-                                                || (this.isCorpWX && res.data.corpwxUserid != undefined))) {
-                                        localStorage.userInfo = JSON.stringify(res.data);
-                                        // console.log('绑定成功');
-                                        this.user = res.data;
-                                        window.location.href = '/#/my/center';
-                                    }
-                                }
-                            }).catch(err=> {
-                                alert('err=' + err);
-                            });
+                    // var urlLeft = url.substring(0, jingPosit);//url左侧部分
+                    var urlRight = url.substring(jingPosit, url.length); //url右侧部分
+                    // console.log('urlRight=' + urlRight);
+                    // window.location = urlLeft + "#/home" + urlRight;//拼接跳转
+                    //获取code
+                    var code = urlRight.substring('?code='.length, urlRight.indexOf('#/index'));
+                    if (code.indexOf('&state=1') > 0) {
+                        code = code.substring(0, code.indexOf('&state=1'));
                     }
+
+                    //调用后台接口,注册用户
+                    // console.log('获取到code=='+code);
+
+                    this.$axios.get(requestUrl, { params: { code: code, userId: this.user.id } })
+                        .then(res => {
+                            // console.log(res);
+                            if (res == null) {
+                                this.$toast.fail('绑定失败');
+                            } else if (res.errcode != null) {
+                                //报错了
+                                console.log(res.errmsg);
+                            } else {
+                                //获取openId
+                                if (res.data != null && ((this.isWX && res.data.wxOpenid != undefined)
+                                    || (this.isCorpWX && res.data.corpwxUserid != undefined))) {
+                                    localStorage.userInfo = JSON.stringify(res.data);
+                                    // console.log('绑定成功');
+                                    this.user = res.data;
+                                    window.location.href = '/#/my/center';
+                                }
+                            }
+                        }).catch(err => {
+                            alert('err=' + err);
+                        });
                 }
-            },
+            }
+        },
 
-            //获取消息
-            getMessage() {
-                this.$axios.post("/information/list", {
-                })
+        //获取消息
+        getMessage() {
+            this.$axios.post("/information/list", {
+            })
                 .then(res => {
-                    if(res.code == "ok") {
+                    if (res.code == "ok") {
                         var list = res.data;
-                        this.unreadNum = list.filter(l=>l.checked==0).length;
+                        this.unreadNum = list.filter(l => l.checked == 0).length;
                         // console.log(this.unreadNum);
-                        
-                    } 
-                }).catch(err=> {this.$toast.clear();});
-            },
 
+                    }
+                }).catch(err => { this.$toast.clear(); });
         },
-        activated(){
-            this.getMessage()
-        },
-        
-    };
+
+    },
+    activated() {
+        this.getMessage()
+    },
+
+};
 </script>
 
 <style lang="less" scoped>
-    .swipe-img {
-        img {
-            width: 100%;
-            height: 100%;
-        }
+.swipe-img {
+    img {
+        width: 100%;
+        height: 100%;
     }
+}
 
-    .body {
-        height: calc(100vh - 50px);
-        position: relative;
-    }
-    .kefu{
-        position: fixed;
-        right: 35px;
-        bottom: 120px;
-        width: 36px;
-        height: 36px;
-        background-color: #fff;
-        z-index: 1000;
-        border-radius: 50%;
-        img{
-            margin: 4px;
-            width: 28px;
-            height: 28px;
-        }
-    }
+.body {
+    height: calc(100vh - 50px);
+    position: relative;
+}
 
-    .tip {
-        position: absolute;
-        width: 100%;
-        bottom: 5px;
-        font-size: 14px;
-        color: #8f8f8f;
-        margin-top: 20px;
-        text-align: center;
-        line-height: 20px;
+.kefu {
+    position: fixed;
+    right: 35px;
+    bottom: 120px;
+    width: 36px;
+    height: 36px;
+    background-color: #fff;
+    z-index: 1000;
+    border-radius: 50%;
+
+    img {
+        margin: 4px;
+        width: 28px;
+        height: 28px;
     }
+}
+
+.tip {
+    position: absolute;
+    width: 100%;
+    bottom: 5px;
+    font-size: 14px;
+    color: #8f8f8f;
+    margin-top: 20px;
+    text-align: center;
+    line-height: 20px;
+}
 </style>

+ 1 - 1
fhKeeper/formulahousekeeper/timesheet-workshop-h5/src/views/login/index.vue

@@ -26,7 +26,7 @@
                 defaultHeight: '0',  //默认屏幕高度
                 nowHeight:  '0',  //实时屏幕高度
                 form: {
-                    username: "",
+                    username: "屈跃庭",
                     password: "",
                 },
                 rules: {

+ 3 - 1
fhKeeper/formulahousekeeper/timesheet-workshop-h5/src/views/planView/InsertionPlan/InsertionPlanAdd.vue

@@ -92,7 +92,7 @@ export default {
     },
     onConfirmDate(value) {
       console.log(value);
-      this.inserFrom.statrTime = value;
+      this.inserFrom.statrTime =  this.formatDate(value);
       this.showPickerDate = false;
     },
     // 日期格式化
@@ -128,6 +128,8 @@ export default {
     flex: 1;
     height: 100%;
     overflow-y: auto;
+    margin: 14px 14px 0 14px;
+    border-radius: 6px;
   }
 
   .InsertionPlanBtn {

+ 12 - 8
fhKeeper/formulahousekeeper/timesheet-workshop-h5/src/views/planView/component/planComponent.vue

@@ -4,23 +4,23 @@
       <div class="planComponent_box" v-for="item, index in productList" :key="index">
         <div class="planComponent_Item">
           <div class="planComponent_ItemTop">
-            <div>产品1</div>
-            <div>001</div>
+            <div>{{ item.productName }}</div>
+            <div>{{ item.productSchedulingNum }}</div>
             <div>
-              <p>20220616-2020618</p><span @click="workShowHide(index)">{{ item.flg ? paiArr[0] : paiArr[1] }}</span>
+              <p>{{ item.startDate }}-{{ item.endDate }}</p><span @click="workShowHide(index)">{{ item.flg ? paiArr[0] : paiArr[1] }}</span>
             </div>
-          </div>
+          </div> 
           <collapse>
             <div v-if="item.flg">
               <div :class="`planComponent_ItemBom planComponent_show`">
                 <div class="PlanItem">
-                  <div>项目代码:</div><span>年后年后年后年后年后年后年后年后年后年后年后年后年后年后年后年后年后</span>
+                  <div>项目代码:</div><span>{{ item.projectCode }}</span>
                 </div>
                 <div class="PlanItem">
                   <div>计划总工价:</div><span class="textBeyondHiding">321</span>
                 </div>
                 <div class="PlanItem">
-                  <div>数量:</div><span class="textBeyondHiding">123</span>
+                  <div>数量:</div><span class="textBeyondHiding">{{ item.num }}</span>
                 </div>
                 <div class="PlanItem">
                   <div>单位:</div><span class="textBeyondHiding">321</span>
@@ -56,6 +56,10 @@ export default {
     titleText: {
       type: String,
       default: '今日计划'
+    },
+    planList: {
+      type: Array,
+      default: []
     }
   },
   components: {
@@ -64,7 +68,7 @@ export default {
   data() {
     return {
       activeNames: ['1'],
-      productList: [{ flg: false }, { flg: false }, { flg: false }, { flg: false }, { flg: false }, { flg: false }, { flg: false }, { flg: false }, { flg: false }, { flg: false }, { flg: false }],
+      productList: [],
       paiArr: ['收起', '派工']
     };
   },
@@ -72,12 +76,12 @@ export default {
   watch: {},
   created() { },
   mounted() { 
-    console.log(this.titleText)
     if(this.titleText == '今日计划') {
       this.paiArr = ['收起', '派工']
     } else {
       this.paiArr = ['收起', '展开']
     }
+    this.productList = this.planList
    },
   methods: {
     workShowHide(index) {

+ 50 - 13
fhKeeper/formulahousekeeper/timesheet-workshop-h5/src/views/planView/todayPlan/todayPlan.vue

@@ -1,8 +1,9 @@
 <template>
   <div class="flexCoum">
-    <van-nav-bar title="今日计划" left-text="返回" @click-left="back" fixed left-arrow/>
+    <van-nav-bar title="今日计划" left-text="返回" @click-left="back" fixed left-arrow />
     <div class="todayPlan flexCoum-box">
-      <PlanComponent :titleText="'今日计划'"></PlanComponent>
+      <PlanComponent :titleText="'今日计划'" :planList="planList" v-if="planList.length > 0"></PlanComponent>
+      <van-empty description="展无数据" v-else />
     </div>
   </div>
 </template>
@@ -16,28 +17,64 @@ export default {
   },
   data() {
     return {
-
+      planList: [], // 今日计划数据
     };
   },
   computed: {},
   watch: {},
-  created() {},
-  mounted() {},
+  created() { },
+  mounted() {
+    this.getPlanList()
+  },
   methods: {
     back() {
       this.$router.go(-1);
     },
+    getPlanList() {
+      this.$axios.post('/plan/list', {
+        pageIndex: 0,
+        pageSize: 10000,
+        planType: 0,
+        date: this.getNowFormatDate()
+      })
+      .then(res => {
+        if (res.code == "ok") {
+          res.data.records.forEach(item => { item.flg = false })
+          this.planList = res.data.records;
+        } else {
+          this.$toast.clear();
+          this.$toast.fail(res.msg);
+        }
+      }).catch(err => { this.$toast.clear(); });
+    },
+    // 返回当天的日期 格式:yyyy-MM-dd
+    getNowFormatDate() {
+      var date = new Date();
+      var seperator1 = "-";
+      var year = date.getFullYear();
+      var month = date.getMonth() + 1;
+      var strDate = date.getDate();
+      if (month >= 1 && month <= 9) {
+        month = "0" + month;
+      }
+      if (strDate >= 0 && strDate <= 9) {
+        strDate = "0" + strDate;
+      }
+      var currentdate = year + seperator1 + month + seperator1 + strDate;
+      return currentdate;
+    },
   },
 };
 </script>
 
 <style scoped>
-  * {
-    box-sizing: border-box;
-  }
-  .todayPlan {
-    height: 100%;
-    background-color: #F4F4F4;
-    padding-top: 46px;
-  }
+* {
+  box-sizing: border-box;
+}
+
+.todayPlan {
+  height: 100%;
+  background-color: #F4F4F4;
+  padding-top: 46px;
+}
 </style>

+ 36 - 2
fhKeeper/formulahousekeeper/timesheet-workshop-h5/src/views/planView/tomorrowPlan/tomorrowPlan.vue

@@ -2,7 +2,8 @@
   <div class="flexCoum">
     <van-nav-bar title="明日计划" left-text="返回" @click-left="back" fixed left-arrow/>
     <div class="todayPlan flexCoum-box">
-      <PlanComponent :titleText="'明日计划'"></PlanComponent>
+      <PlanComponent :titleText="'明日计划'" :planList="planList" v-if="planList.length > 0"></PlanComponent>
+      <van-empty description="展无数据" v-else />
     </div>
   </div>
 </template>
@@ -16,7 +17,7 @@ export default {
   },
   data() {
     return {
-
+      planList: [], // 明日计划数据
     };
   },
   computed: {},
@@ -27,6 +28,39 @@ export default {
     back() {
       this.$router.go(-1);
     },
+    getPlanList() {
+      this.$axios.post('/plan/list', {
+        pageIndex: 0,
+        pageSize: 10000,
+        planType: 1,
+        date: this.getNowFormatDate()
+      })
+      .then(res => {
+        if (res.code == "ok") {
+          res.data.records.forEach(item => { item.flg = false })
+          this.planList = res.data.records;
+        } else {
+          this.$toast.clear();
+          this.$toast.fail(res.msg);
+        }
+      }).catch(err => { this.$toast.clear(); });
+    },
+    // 返回当天的日期 格式:yyyy-MM-dd
+    getNowFormatDate() {
+      var date = new Date();
+      var seperator1 = "-";
+      var year = date.getFullYear();
+      var month = date.getMonth() + 1;
+      var strDate = date.getDate();
+      if (month >= 1 && month <= 9) {
+        month = "0" + month;
+      }
+      if (strDate >= 0 && strDate <= 9) {
+        strDate = "0" + strDate;
+      }
+      var currentdate = year + seperator1 + month + seperator1 + strDate;
+      return currentdate;
+    },
   },
 };
 </script>

+ 2 - 1
fhKeeper/formulahousekeeper/timesheet-workshop-h5/vue.config.js

@@ -5,7 +5,8 @@ const themePath = path.resolve(__dirname,'src/assets/style/theme.less');
 const Timestamp = new Date().getTime();
 
 // var ip = '47.101.180.183'
-var ip = '47.100.37.243'
+// var ip = '47.100.37.243'
+var ip = '192.168.2.12'
 // var ip = '192.168.2.12'
 // var ip = '127.0.0.1'
 

+ 793 - 15
fhKeeper/formulahousekeeper/timesheet-workshop/src/views/plan/orderInsert.vue

@@ -1,23 +1,801 @@
 <template>
-<div class='layout-container'>
+  <div class="layout-container">
+    <div class="layout-container-header">
+      <div class="OutSide">
+        <div class="OutSide_left">
+          <div>{{ titleText }}</div>
+          <div>{{ todayDate }}</div>
+        </div>
+        <div class="OutSide_center">
+          <div class="block" style="padding-left: 30px;">
+            <span class="demonstration">查询以往{{ titleText }}</span>
+            <el-date-picker v-model="planDate" type="date" value-format="yyyy-MM-dd" @change="getTableData(hasChooseDept)"
+              placeholder="选择日期" size="small">
+            </el-date-picker>
+          </div>
+        </div>
+        <div class="OutSide_right">
+          <el-link type="primary" :underline="false" @click="(deptSetDialog = true)">{{ "任务类型管理"
+          }}</el-link>
+          <el-link type="primary" :underline="false" @click="addPlan()">{{
+            `新增${titleText}`
+          }}</el-link>
+          <el-upload ref="upload" action="#" :limit="1" :http-request="importData" :show-file-list="false">
+            <el-link type="primary" :underline="false">{{ "导入" }}</el-link>
+          </el-upload>
+          <el-link type="primary" :underline="false" @click="exportData()"
+            :download="this.planType == 0 ? '今日计划' : this.planType == 1 ? '明日计划' : this.planType == 1 ? '插单计划' : '' + '.xlsx'">{{
+              "导出"
+            }}</el-link>
+        </div>
+      </div>
+    </div>
+    <div class="layout-container-center">
+      <!-- tab 切换 -->
+      <div class="today-tab">
+        <div v-for="(item, index) in hasSetDeptList" :key="index" :class="`${todayTabIndex === index ? 'on' : ''}`"
+          @click="tabChange(item, index)">
+          {{ item.departmentName }}
+        </div>
+      </div>
 
-</div>
-</template>
+      <!-- 各部分数据列表 -->
+      <el-table :data="tableData" style="width: 100%; flex: 1" v-loading="tableDataLoading"
+        @selection-change="handleSelectionChange">
+        <el-table-column type="selection" width="55"> </el-table-column>
+        <el-table-column prop="productSchedulingNum" label="通知号" width="180"></el-table-column>
+        <el-table-column prop="productName" label="任务名称" width="180"></el-table-column>
+        <el-table-column prop="projectCode" label="任务类型" width="180"></el-table-column>
+        <el-table-column prop="num" label="计划人数" width="180"> </el-table-column>
+        <el-table-column prop="mainProcess" label="数量" width="180"></el-table-column>
+        <el-table-column prop="stationName" label="计划工时" width="180"></el-table-column>
+        <el-table-column prop="foremanName" label="工钱" width="180"></el-table-column>
+        <el-table-column prop="startDate" label="工长" width="180"></el-table-column>
+        <el-table-column prop="endDate" label="开工时间" width="180"></el-table-column>
+        <el-table-column prop="endDate" label="完工时间" width="180"></el-table-column>
+        <el-table-column label="编辑">
+          <template slot-scope="scope">
+            <div @click="editPlan(scope.row)" class="colorText">编辑</div>
+          </template>
+        </el-table-column>
+      </el-table>
+    </div>
+    <div class="layout-container-floor">
+      <el-button type="primary" size="mini" @click="allocationPlan">下发计划</el-button>
+      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pageIndex"
+        :page-sizes="[10, 20, 50, 100]" :page-size="pageSize" layout="total, prev, pager, next, sizes, jumper"
+        :total="total">
+      </el-pagination>
+    </div>
+
+    <!-- 新增今日计划 -->
+    <el-dialog :title="titleName" :visible.sync="editPlanDiaLog" width="800px" top="18.5vh" :before-close="handleClose">
+      <div class="planDialog">
+        <el-form ref="todayPlanForm" :rules="todayPlanFormrules" :model="todayPlanForm" label-width="120px">
+          <el-form-item label="任务变更通知号" style="width: 100%" prop="productSchedulingNum">
+            <el-input v-model="todayPlanForm.productSchedulingNum" placeholder="请输入"></el-input>
+          </el-form-item>
+          <el-form-item label="任务名称" style="width: 100%" prop="projectCode">
+            <el-input v-model="todayPlanForm.projectCode" placeholder="请输入"></el-input>
+          </el-form-item>
+          <el-form-item label="任务类型" prop="productId">
+            <el-select v-model="todayPlanForm.productId" placeholder="请选择" class="w100">
+              <el-option v-for="item in productList" :key="item.id" :label="item.name" :value="item.id">
+              </el-option>
+            </el-select>
+          </el-form-item>
+          <el-form-item label="计划人数" prop="projectCode">
+            <el-input v-model="todayPlanForm.projectCode" type="number" placeholder="请输入"></el-input>
+          </el-form-item>
+          <el-form-item label="数量" prop="projectCode">
+            <el-input v-model="todayPlanForm.projectCode" type="number" placeholder="请输入"></el-input>
+          </el-form-item>
+          <el-form-item label="计划工时" prop="projectCode">
+            <div style="display: flex;">
+              <el-input v-model="todayPlanForm.projectCode" type="number" placeholder="请输入" style="flex: 1;"></el-input>
+              <div style="margin-left: 10px;">小时</div>
+            </div>
+          </el-form-item>
+          <el-form-item label="单价" prop="projectCode">
+            <div style="display: flex;">
+              <el-input v-model="todayPlanForm.projectCode" type="number" placeholder="请输入" style="flex: 1;"></el-input>
+              <div style="margin-left: 10px;">元/小时</div>
+            </div>
+          </el-form-item>
+          <el-form-item label="质检类型" prop="productId">
+            <el-select v-model="todayPlanForm.productId" placeholder="请选择" class="w100">
+              <el-option v-for="item in productList" :key="item.id" :label="item.name" :value="item.id">
+              </el-option>
+            </el-select>
+          </el-form-item>
+          <el-form-item label="工位" prop="productId">
+            <el-select v-model="todayPlanForm.productId" placeholder="请选择" class="w100">
+              <el-option v-for="item in productList" :key="item.id" :label="item.name" :value="item.id">
+              </el-option>
+            </el-select>
+          </el-form-item>
+          <el-form-item label="工长" prop="productId">
+            <el-select v-model="todayPlanForm.productId" placeholder="请选择" class="w100">
+              <el-option v-for="item in productList" :key="item.id" :label="item.name" :value="item.id">
+              </el-option>
+            </el-select>
+          </el-form-item>
+          <el-form-item label="开工时间" prop="startDate">
+            <el-date-picker class="w100" v-model="todayPlanForm.startDate" type="date" placeholder="选择日期"
+              value-format="yyyy-MM-dd">
+            </el-date-picker>
+          </el-form-item>
+          <el-form-item label="完工时间" prop="endDate">
+            <el-date-picker class="w100" v-model="todayPlanForm.endDate" type="date" placeholder="选择日期"
+              value-format="yyyy-MM-dd">
+            </el-date-picker>
+          </el-form-item>
+          <el-form-item label="描述" style="width: 100%">
+            <el-input type="textarea" :rows="6" placeholder="请输入描述" v-model="todayPlanForm.describtion">
+            </el-input>
+          </el-form-item>
+        </el-form>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="
+          (editPlanDiaLog = false), $refs['todayPlanForm'].resetFields()
+          ">取 消</el-button>
+        <el-button type="primary" @click="addPlanData('todayPlanForm')">确 定</el-button>
+      </span>
+    </el-dialog>
 
+    <!-- 部门设置弹框 -->
+    <el-dialog title="部门设置" :visible.sync="deptSetDialog" width="800" :before-close="handleClose">
+      <div>
+        你好
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="deptSetDialog = false">取 消</el-button>
+        <el-button type="primary" @click="deptSetDialog = false">确 定</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+  
 <script>
 export default {
-name: '',
-components: {},
-props: { },
-data() { 
-return {}
-},
-computed: {},
-watch: {},
-created () {},
-mounted () {},
-methods: {},
-}
+  name: "planComponent",
+  components: {},
+  props: {
+    planType: {
+      type: String,
+      default: "2",
+    },
+    titleText: {
+      type: String,
+      default: "插单计划",
+    }
+  },
+  data() {
+    return {
+      steelStampNumber: "",
+      todayDate: this.dayjs().format('YYYY-MM-DD'),
+      planDate: this.dayjs().format('YYYY-MM-DD'),
+      deptSetDialog: false,
+      departmentList: [],
+      departmentIdArray: [],
+      deptSetData: "",
+      props: { multiple: true },
+      hasSetDeptList: [],
+      titleName: "",
+      todayPlanForm: {
+        id: null,
+        productSchedulingNum: "",
+        productId: "",
+        projectCode: "",
+        steelStampNumberStart: "",
+        steelStampNumberEnd: "",
+        num: "",
+        mainProcess: "",
+        stationId: "",
+        foremanId: "",
+        foremanName: "",
+        startDate: "",
+        endDate: "",
+        describtion: "",
+        versionNumber: "",
+      },
+      todayTabIndex: 0,
+      tableDataLoading: false,
+      tableData: [],
+      editPlanDiaLog: false,
+      pageIndex: 0,
+      pageSize: 20,
+      total: 0,
+      hasChooseDept: "",
+      productList: [],
+      multipleSelection: [],
+      // 表单规则验证
+      todayPlanFormrules: {
+        productSchedulingNum: [
+          { required: true, message: "排产工单号", trigger: "blur" },
+        ],
+        productId: [{ required: true, message: "产品名称", trigger: "blur" }],
+        projectCode: [{ required: true, message: "项目代码", trigger: "blur" }],
+        steelStampNumberStart: [
+          { required: true, message: "钢印号", trigger: "blur" },
+        ],
+        steelStampNumberEnd: [
+          { required: true, message: "钢印号", trigger: "blur" },
+        ],
+        num: [{ required: true, message: "数量", trigger: "blur" }],
+        mainProcess: [{ required: true, message: "主工序", trigger: "blur" }],
+        stationId: [{ required: true, message: "工位", trigger: "blur" }],
+        startDate: [{ required: true, message: "开工时间", trigger: "blur" }],
+        endDate: [{ required: true, message: "完工时间", trigger: "blur" }],
+      },
+    };
+  },
+  computed: {},
+  watch: {},
+  created() { },
+  mounted() {
+    this.getDepartmentList(),
+      this.getPlanDeptSet(),
+      this.getHasSetPlanDeptList(),
+      this.getProductList();
+  },
+  methods: {
+    today() {
+      let date = new Date();
+      let year = date.getFullYear();
+      let month = (date.getMonth() + 1 + "").padStart(2, "0");
+      let day = (date.getDate() + "").padStart(2, "0");
+      return `${year}-${month}-${day}`;
+    },
+    getDepartmentList() {
+      this.http.post(
+        this.port.manage.depList,
+        {},
+        (res) => {
+          if (res.code == "ok") {
+            let dptlist = JSON.parse(JSON.stringify(res.data));
+            this.departmentList = this.changeArr(dptlist);
+          } else {
+            this.$message({
+              message: res.msg,
+              type: "error",
+            });
+          }
+        },
+        (error) => {
+          this.$message({
+            message: error,
+            type: "error",
+          });
+        }
+      );
+    },
+    changeArr(arr) {
+      for (var i = 0; i < arr.length; i++) {
+        if (arr[i].id != -1 && arr[i].id != 0) {
+          if (arr[i].children != null && arr[i].children.length > 0) {
+            arr[i].children = this.changeArr(arr[i].children);
+          }
+          arr[i].id && (arr[i].value = arr[i].id);
+          delete arr[i].id;
+        }
+      }
+      for (var i in arr) {
+        if (arr[i].id == -1 || arr[i].id == 0) {
+          arr.splice(i, 1);
+        }
+      }
+      return arr;
+    },
+    deptSet() {
+      console.log(
+        this.departmentIdArray,
+        JSON.stringify(this.departmentIdArray)
+      );
+      // return
+      let arr = [];
+      for (var i in this.departmentIdArray) {
+        arr.push(
+          this.departmentIdArray[i][this.departmentIdArray[i].length - 1]
+        );
+      }
+      this.http.post(
+        "/plan/deptSet",
+        { deptIds: arr.join(",") },
+        (res) => {
+          if (res.code == "ok") {
+            this.$message({
+              message: "设置成功",
+              type: "success",
+            });
+            this.getHasSetPlanDeptList();
+          } else {
+            this.$message({
+              message: res.msg,
+              type: "error",
+            });
+          }
+        },
+        (error) => {
+          this.$message({
+            message: error,
+            type: "error",
+          });
+        }
+      );
+    },
+    getPlanDeptSet() {
+      this.http.post(
+        "/plan/deptList",
+        {},
+        (res) => {
+          if (res.code == "ok") {
+            let arr = res.data.split(",") || [];
+            for (var i in arr) {
+              arr[i] = +arr[i];
+            }
+            console.log(arr);
+            this.departmentIdArray = arr;
+          } else {
+            this.$message({
+              message: res.msg,
+              type: "error",
+            });
+          }
+        },
+        (error) => {
+          this.$message({
+            message: error,
+            type: "error",
+          });
+        }
+      );
+    },
+    getHasSetPlanDeptList() {
+      this.http.post(
+        "/plan/hasSetDeptDetail",
+        {},
+        (res) => {
+          if (res.code == "ok") {
+            this.hasSetDeptList = res.data;
+            if (res.data.length > 0) {
+              this.tableDataLoading = true;
+              this.hasChooseDept = res.data[0].departmentId;
+              this.getTableData(res.data[0].departmentId);
+            }
+          } else {
+            this.$message({
+              message: res.msg,
+              type: "error",
+            });
+          }
+        },
+        (error) => {
+          this.$message({
+            message: error,
+            type: "error",
+          });
+        }
+      );
+    },
+
+    // tab 切换事件
+    tabChange(item, index) {
+      console.log(item, "item");
+      this.todayTabIndex = index;
+      this.hasChooseDept = item.departmentId;
+      this.getTableData(item.departmentId);
+    },
+    // 获取车间数据
+    getTableData(departmentId) {
+      console.log(this.planDate);
+      this.tableDataLoading = true;
+      this.http.post(
+        "/plan/list",
+        {
+          deptId: departmentId,
+          planType: this.planType,
+          date: this.planDate,
+          steelStampNumber: this.steelStampNumber,
+          pageIndex: this.pageIndex,
+          pageSize: this.pageSize,
+        },
+        (res) => {
+          this.tableDataLoading = false;
+          if (res.code == "ok") {
+            this.tableData = res.data.records;
+            this.total = res.data.total;
+          } else {
+            this.$message({
+              message: res.msg,
+              type: "error",
+            });
+          }
+        },
+        (error) => {
+          this.tableDataLoading = false;
+          this.$message({
+            message: error,
+            type: "error",
+          });
+        }
+      );
+    },
+    handleSizeChange(val) {
+      console.log(val, "handleSizeChange");
+      this.pageSize = val;
+      this.pageIndex = 1;
+      this.getTableData(this.hasChooseDept);
+    },
+    handleCurrentChange(val) {
+      console.log(val, "handleCurrentChange");
+      this.pageIndex = val;
+      this.getTableData(this.hasChooseDept);
+    },
+    addPlan() {
+      this.titleName = `新增${this.titleText}`;
+      this.editPlanDiaLog = true;
+      this.getDepartmentList();
+      this.getProductList();
+      // this.todayPlanForm
+    },
+    addPlanData(formName) {
+      console.log(this.todayPlanForm);
+      this.$refs[formName].validate((valid) => {
+        if (valid) {
+          console.log(this.todayPlanForm, "传给后端的值");
+          let stationId =
+            this.todayPlanForm.stationId[
+            this.todayPlanForm.stationId.length - 1
+            ];
+          this.http.post(
+            "/plan/addOrUpdatePlan",
+            {
+              ...this.todayPlanForm,
+              stationId,
+              planType: this.planType,
+            },
+            (res) => {
+              if (res.code == "ok") {
+                this.$message({
+                  message:
+                    this.todayPlanForm.id == null ? "新增成功" : "修改成功",
+                  type: "success",
+                });
+                this.editPlanDiaLog = false;
+              } else {
+                this.$message({
+                  message: res.msg,
+                  type: "error",
+                });
+              }
+            },
+            (error) => {
+              this.$message({
+                message: error,
+                type: "error",
+              });
+            }
+          );
+        } else {
+          console.log("error submit!!");
+          return false;
+        }
+      });
+    },
+    editPlan(item) {
+      (this.titleName = `编辑${this.titleText}`), (this.editPlanDiaLog = true);
+      this.todayPlanForm = item;
+      console.log(item);
+    },
+    getProductList() {
+      this.http.post(
+        "/product/getProductPage",
+        {
+          pageIndex: null,
+          pageSize: null,
+        },
+        (res) => {
+          if (res.code == "ok") {
+            this.productList = res.data.records;
+          } else {
+            this.$message({
+              message: res.msg,
+              type: "error",
+            });
+          }
+        },
+        (error) => {
+          this.$message({
+            message: error,
+            type: "error",
+          });
+        }
+      );
+    },
+    getIncharger() {
+      console.log(this.todayPlanForm.stationId);
+      this.http.post(
+        "/department/getIncharger",
+        {
+          deptId:
+            this.todayPlanForm.stationId[
+            this.todayPlanForm.stationId.length - 1
+            ],
+        },
+        (res) => {
+          if (res.code == "ok") {
+            this.todayPlanForm.foremanId = res.data ? res.data.id : '';
+            this.todayPlanForm.foremanName = res.data ? res.data.name : ''
+          } else {
+            this.$message({
+              message: res.msg,
+              type: "error",
+            });
+          }
+        },
+        (error) => {
+          this.$message({
+            message: error,
+            type: "error",
+          });
+        }
+      );
+    },
+    // 跳转至详情
+    toPlanDetil(item) {
+      console.log(item, "详情页面数据");
+      let pathUrl = "";
+      if (this.planType == 1) {
+        pathUrl = "/plan/planDetil";
+      } else {
+        pathUrl = "/plan/planDetil";
+      }
+      console.log(pathUrl);
+      this.$router.push({
+        path: pathUrl,
+        name: "计划详情",
+        params: {
+          id: item.id,
+          topText: item.productSchedulingNum,
+          leftText: item.productName,
+        },
+      });
+    },
+    // 导入数据
+    importData(item) {
+      this.tableDataLoading = true;
+      let formData = new FormData();
+      formData.append("file", item.file);
+      formData.append("planType", this.planType);
+      this.http.uploadFile('/plan/importData', formData,
+        res => {
+          this.$refs.upload.clearFiles();
+          this.tableDataLoading = false;
+          if (res.code == "ok") {
+            this.$message({
+              message: '导入成功',
+              type: "success"
+            });
+            this.getTableData(this.hasChooseDept);
+          } else {
+            this.$message({
+              message: res.msg,
+              type: "error"
+            });
+          }
+        },
+        error => {
+          this.$refs.upload.clearFiles();
+          this.tableDataLoading = false;
+          this.$message({
+            message: error,
+            type: "error"
+          });
+        });
+    },
+    exportData() {
+      let param = {
+        planType: this.planType,
+        date: this.planDate,
+        steelStampNumber: this.steelStampNumber,
+      }
+      this.http.post('/plan/exportData', param,
+        res => {
+          if (res.code == "ok") {
+            var filePath = res.data;
+            const a = document.createElement('a'); // 创建a标签
+            a.setAttribute('download', this.$t('projectexport') + '.xlsx');// download属性
+            a.setAttribute('href', filePath);// href链接
+            a.click(); //自执行点击事件
+            a.remove();
+          }
+        },
+        error => {
+          this.$message({
+            message: error,
+            type: "error"
+          });
+        }
+      );
+    },
+    handleSelectionChange(val) {
+      this.multipleSelection = val.map(item => item.id);
+      console.log(this.multipleSelection)
+    },
+    allocationPlan() {
+      if (this.multipleSelection.length == 0) {
+        return
+      }
+      this.http.post(
+        "/plan/allocationPlan",
+        {
+          ids: this.multipleSelection.join(","),
+          planType: this.planType
+        },
+        (res) => {
+          if (res.code == "ok") {
+            this.$message({
+              message: '下发成功',
+              type: "success",
+            });
+          } else {
+            this.$message({
+              message: res.msg,
+              type: "error",
+            });
+          }
+        },
+        (error) => {
+          this.$message({
+            message: error,
+            type: "error",
+          });
+        }
+      );
+    },
+  },
+};
 </script>
 <style scoped lang='scss'>
+.colorText {
+  color: #02a7f0;
+  cursor: pointer;
+}
+
+.layout-container {
+  width: 100%;
+  height: 100%;
+  display: flex;
+  flex-wrap: wrap;
+  flex-direction: column;
+  box-sizing: border-box;
+  padding: 10px;
+
+  .layout-container-header,
+  .layout-container-center,
+  .layout-container-floor {
+    width: 100%;
+  }
+
+  .layout-container-center {
+    flex: 1;
+    display: flex;
+    flex-direction: column;
+  }
+
+  .layout-container-floor {
+    box-sizing: border-box;
+    display: flex;
+    justify-content: space-between;
+    padding: 10px 20px;
+  }
+
+  .OutSide {
+    width: 100%;
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    flex-direction: initial;
+    padding-bottom: 10px;
+
+    .demonstration {
+      margin-right: 20px;
+      min-width: 48px;
+    }
+
+    .OutSide_left {
+      width: 200px;
+      display: flex;
+      justify-content: space-between;
+      align-items: center;
+
+      div {
+        font-size: 16px;
+      }
+
+      div:first-child {
+        font-size: 20px;
+      }
+    }
+
+    .OutSide,
+    .block {
+      max-width: 400px;
+    }
+
+    .OutSide_center {
+      flex: 1;
+      display: flex;
+      // justify-content: space-between;
+      align-items: center;
+
+      .block {
+        display: flex;
+        align-items: center;
+        margin-right: 30px;
+      }
+    }
+
+    .OutSide_right {
+      display: flex;
+      align-items: center;
+
+      .el-link {
+        margin-right: 15px;
+      }
+    }
+  }
+
+  .today-tab {
+    display: flex;
+    overflow-x: auto;
+    margin-bottom: 10px;
+
+    div {
+      font-size: 16px;
+      margin-left: 15px;
+      cursor: pointer;
+    }
+
+    .on {
+      color: #02a7f0;
+    }
+  }
+
+  .planDialog::-webkit-scrollbar {
+    display: none;
+    /* Chrome Safari */
+  }
+
+  // 新增样式
+  .planDialog {
+    max-height: 50vh;
+    overflow-y: auto;
+    scrollbar-width: none;
+    /* Firefox */
+    -ms-overflow-style: none;
+
+    /* IE 10+ */
+    .el-form {
+      display: flex;
+      flex-wrap: wrap;
+      justify-content: space-between;
+    }
+
+    .w100 {
+      width: 100%;
+    }
+
+    .el-form-item {
+      width: 50%;
+
+      .w45 {
+        width: 49%;
+      }
+    }
+  }
+}
 </style>
+  

+ 132 - 210
fhKeeper/formulahousekeeper/timesheet-workshop/src/views/plan/planComponent.vue

@@ -9,74 +9,44 @@
         <div class="OutSide_center">
           <div class="block">
             <span class="demonstration">查询以往{{ titleText }}</span>
-            <el-date-picker
-              v-model="planDate"
-              type="date"
-              value-format="yyyy-MM-dd"
-              @change="getTableData(hasChooseDept)"
-              placeholder="选择日期"
-              size="small"
-            >
+            <el-date-picker v-model="planDate" type="date" value-format="yyyy-MM-dd" @change="getTableData(hasChooseDept)"
+              placeholder="选择日期" size="small">
             </el-date-picker>
           </div>
-          <div class="OutSide">
-            <span class="demonstration">{{ "钢印号" }}</span
-            ><el-input
-              v-model="steelStampNumber"
-              size="small"
-              @change="getTableData(hasChooseDept)"
-              placeholder="请输入内容"
-              clearable="true"
-            ></el-input>
+          <div class="OutSide" style="padding-bottom: 0;">
+            <span class="demonstration">{{ "钢印号" }}</span><el-input v-model="steelStampNumber" size="small"
+              @change="getTableData(hasChooseDept)" placeholder="请输入内容" clearable="true"></el-input>
           </div>
         </div>
         <div class="OutSide_right">
-          <div>
-            <span>
-              <el-link
-                type="primary"
-                :underline="false"
-                @click="(deptSetDialog = true), getPlanDeptSet()"
-                >{{ "部门设置" }}</el-link
-              >
+              <el-link type="primary" :underline="false" @click="(deptSetDialog = true), getPlanDeptSet()">{{ "部门设置"
+              }}</el-link>
               <el-link type="primary" :underline="false" @click="addPlan()">{{
                 `新增${titleText}`
               }}</el-link>
               <el-upload ref="upload" action="#" :limit="1" :http-request="importData" :show-file-list="false">
-                    <el-link type="primary" :underline="false">{{ "导入" }}</el-link>
+                <el-link type="primary" :underline="false">{{ "导入" }}</el-link>
               </el-upload>
-              <el-link type="primary" :underline="false" @click="exportData()" :download="this.planType==0?'今日计划':this.planType==1?'明日计划':this.planType==1?'插单计划':''+'.xlsx'">{{ "导出" }}</el-link>
-            </span>
-          </div>
+              <el-link type="primary" :underline="false" @click="exportData()"
+                :download="this.planType == 0 ? '今日计划' : this.planType == 1 ? '明日计划' : this.planType == 1 ? '插单计划' : '' + '.xlsx'">{{ "导出"
+                }}</el-link>
         </div>
       </div>
     </div>
     <div class="layout-container-center">
       <!-- tab 切换 -->
       <div class="today-tab">
-        <div
-          v-for="(item, index) in hasSetDeptList"
-          :key="index"
-          :class="`${todayTabIndex === index ? 'on' : ''}`"
-          @click="tabChange(item, index)"
-        >
+        <div v-for="(item, index) in hasSetDeptList" :key="index" :class="`${todayTabIndex === index ? 'on' : ''}`"
+          @click="tabChange(item, index)">
           {{ item.departmentName }}
         </div>
       </div>
 
       <!-- 各部分数据列表 -->
-      <el-table
-        :data="tableData"
-        style="width: 100%; flex: 1"
-        v-loading="tableDataLoading"
-        @selection-change="handleSelectionChange"
-      >
+      <el-table :data="tableData" style="width: 100%; flex: 1" v-loading="tableDataLoading"
+        @selection-change="handleSelectionChange">
         <el-table-column type="selection" width="55"> </el-table-column>
-        <el-table-column
-          prop="productSchedulingNum"
-          label="排产工单号"
-          width="180"
-        >
+        <el-table-column prop="productSchedulingNum" label="排产工单号" width="180">
           <template slot-scope="scope">
             <div @click="toPlanDetil(scope.row)" class="colorText">
               {{ scope.row.productSchedulingNum }}
@@ -107,72 +77,32 @@
     </div>
     <div class="layout-container-floor">
       <el-button type="primary" size="mini" @click="allocationPlan">下发计划</el-button>
-      <el-pagination
-        @size-change="handleSizeChange"
-        @current-change="handleCurrentChange"
-        :current-page="pageIndex"
-        :page-sizes="[10, 20, 50, 100]"
-        :page-size="pageSize"
-        layout="total, prev, pager, next, sizes, jumper"
-        :total="total"
-      >
+      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pageIndex"
+        :page-sizes="[10, 20, 50, 100]" :page-size="pageSize" layout="total, prev, pager, next, sizes, jumper"
+        :total="total">
       </el-pagination>
     </div>
 
     <!-- 新增今日计划 -->
-    <el-dialog
-      :title="titleName"
-      :visible.sync="editPlanDiaLog"
-      width="800px"
-      top="18.5vh"
-      :before-close="handleClose"
-    >
+    <el-dialog :title="titleName" :visible.sync="editPlanDiaLog" width="800px" top="18.5vh" :before-close="handleClose">
       <div class="planDialog">
-        <el-form
-          ref="todayPlanForm"
-          :rules="todayPlanFormrules"
-          :model="todayPlanForm"
-          label-width="120px"
-        >
-          <el-form-item
-            label="排产工单号"
-            style="width: 100%"
-            prop="productSchedulingNum"
-          >
+        <el-form ref="todayPlanForm" :rules="todayPlanFormrules" :model="todayPlanForm" label-width="120px">
+          <el-form-item label="排产工单号" style="width: 100%" prop="productSchedulingNum">
             <el-input v-model="todayPlanForm.productSchedulingNum"></el-input>
           </el-form-item>
           <el-form-item label="产品名称" style="width: 100%" prop="productId">
-            <el-select
-              v-model="todayPlanForm.productId"
-              placeholder="请选择"
-              class="w100"
-            >
-              <el-option
-                v-for="item in productList"
-                :key="item.id"
-                :label="item.name"
-                :value="item.id"
-              >
+            <el-select v-model="todayPlanForm.productId" placeholder="请选择" class="w100">
+              <el-option v-for="item in productList" :key="item.id" :label="item.name" :value="item.id">
               </el-option>
             </el-select>
           </el-form-item>
           <el-form-item label="项目代码" style="width: 100%" prop="projectCode">
             <el-input v-model="todayPlanForm.projectCode"></el-input>
           </el-form-item>
-          <el-form-item
-            label="钢印号"
-            style="width: 100%"
-            prop="steelStampNumberStart"
-          >
-            <el-input
-              class="w45"
-              v-model="todayPlanForm.steelStampNumberStart"
-            ></el-input>
+          <el-form-item label="钢印号" style="width: 100%" prop="steelStampNumberStart">
+            <el-input class="w45" v-model="todayPlanForm.steelStampNumberStart"></el-input>
             {{ "-" }}
-            <el-input
-              class="w45"
-              v-model="todayPlanForm.steelStampNumberEnd"
-            ></el-input>
+            <el-input class="w45" v-model="todayPlanForm.steelStampNumberEnd"></el-input>
           </el-form-item>
           <el-form-item label="数量" prop="num">
             <el-input v-model="todayPlanForm.num"></el-input>
@@ -190,71 +120,39 @@
                   >
                   </el-option>
                 </el-select> -->
-            <el-cascader
-              v-model="todayPlanForm.stationId"
-              :options="departmentList"
-              :props="{ checkStrictly: true }"
-              collapse-tags
-              class="w100"
-              clearable
-              @change="getIncharger()"
-            >
+            <el-cascader v-model="todayPlanForm.stationId" :options="departmentList" :props="{ checkStrictly: true }"
+              collapse-tags class="w100" clearable @change="getIncharger()">
             </el-cascader>
           </el-form-item>
           <el-form-item label="工长" prop="foremanId">
             <el-input v-model="todayPlanForm.foremanName"></el-input>
           </el-form-item>
           <el-form-item label="开工时间" prop="startDate">
-            <el-date-picker
-              class="w100"
-              v-model="todayPlanForm.startDate"
-              type="date"
-              placeholder="选择日期"
-              value-format="yyyy-MM-dd"
-            >
+            <el-date-picker class="w100" v-model="todayPlanForm.startDate" type="date" placeholder="选择日期"
+              value-format="yyyy-MM-dd">
             </el-date-picker>
           </el-form-item>
           <el-form-item label="完工时间" prop="endDate">
-            <el-date-picker
-              class="w100"
-              v-model="todayPlanForm.endDate"
-              type="date"
-              placeholder="选择日期"
-              value-format="yyyy-MM-dd"
-            >
+            <el-date-picker class="w100" v-model="todayPlanForm.endDate" type="date" placeholder="选择日期"
+              value-format="yyyy-MM-dd">
             </el-date-picker>
           </el-form-item>
           <el-form-item label="描述" style="width: 100%">
-            <el-input
-              type="textarea"
-              :rows="6"
-              placeholder="请输入描述"
-              v-model="todayPlanForm.describtion"
-            >
+            <el-input type="textarea" :rows="6" placeholder="请输入描述" v-model="todayPlanForm.describtion">
             </el-input>
           </el-form-item>
         </el-form>
       </div>
       <span slot="footer" class="dialog-footer">
-        <el-button
-          @click="
-            (editPlanDiaLog = false), $refs['todayPlanForm'].resetFields()
-          "
-          >取 消</el-button
-        >
-        <el-button type="primary" @click="addPlanData('todayPlanForm')"
-          >确 定</el-button
-        >
+        <el-button @click="
+          (editPlanDiaLog = false), $refs['todayPlanForm'].resetFields()
+          ">取 消</el-button>
+        <el-button type="primary" @click="addPlanData('todayPlanForm')">确 定</el-button>
       </span>
     </el-dialog>
 
     <!-- 部门设置弹框 -->
-    <el-dialog
-      title="部门设置"
-      :visible.sync="deptSetDialog"
-      width="30%"
-      :before-close="handleClose"
-    >
+    <el-dialog title="部门设置" :visible.sync="deptSetDialog" width="30%" :before-close="handleClose">
       <div>
         <span>{{ "选择部门" }}</span>
         <!-- <el-cascader
@@ -265,11 +163,8 @@
           clearable
         >
         </el-cascader> -->
-        <el-cascader
-          v-model="departmentIdArray"
-          :options="departmentList"
-          :props="{ multiple: true, checkStrictly: true }"
-          clearable>
+        <el-cascader v-model="departmentIdArray" :options="departmentList"
+          :props="{ multiple: true, checkStrictly: true }" clearable>
         </el-cascader>
       </div>
       <span slot="footer" class="dialog-footer">
@@ -280,7 +175,7 @@
   </div>
 </template>
   
-  <script>
+<script>
 export default {
   name: "planComponent",
   components: {},
@@ -296,7 +191,7 @@ export default {
     },
   },
   data() {
-    return { 
+    return {
       steelStampNumber: "",
       planDate: this.todayDate,
       deptSetDialog: false,
@@ -321,7 +216,7 @@ export default {
         startDate: "",
         endDate: "",
         describtion: "",
-        versionNumber:"",
+        versionNumber: "",
       },
       todayTabIndex: 0,
       tableDataLoading: false,
@@ -356,7 +251,7 @@ export default {
   },
   computed: {},
   watch: {},
-  created() {},
+  created() { },
   mounted() {
     this.getDepartmentList(),
       this.getPlanDeptSet(),
@@ -570,7 +465,7 @@ export default {
           console.log(this.todayPlanForm, "传给后端的值");
           let stationId =
             this.todayPlanForm.stationId[
-              this.todayPlanForm.stationId.length - 1
+            this.todayPlanForm.stationId.length - 1
             ];
           this.http.post(
             "/plan/addOrUpdatePlan",
@@ -644,7 +539,7 @@ export default {
         {
           deptId:
             this.todayPlanForm.stationId[
-              this.todayPlanForm.stationId.length - 1
+            this.todayPlanForm.stationId.length - 1
             ],
         },
         (res) => {
@@ -687,80 +582,80 @@ export default {
       });
     },
     // 导入数据
-    importData(item){
-        this.tableDataLoading = true;
-        let formData = new FormData();
-        formData.append("file", item.file);
-        formData.append("planType",this.planType);
-        this.http.uploadFile('/plan/importData', formData,
+    importData(item) {
+      this.tableDataLoading = true;
+      let formData = new FormData();
+      formData.append("file", item.file);
+      formData.append("planType", this.planType);
+      this.http.uploadFile('/plan/importData', formData,
         res => {
-            this.$refs.upload.clearFiles();
-            this.tableDataLoading = false;
-            if (res.code == "ok") {
-                this.$message({
-                    message: '导入成功',
-                    type: "success"
-                });
-                this.getTableData(this.hasChooseDept);
-            } else {
-                this.$message({
-                    message: res.msg,
-                    type: "error"
-                });
-            }
-        },
-        error => {
-            this.$refs.upload.clearFiles();
-            this.tableDataLoading = false;
+          this.$refs.upload.clearFiles();
+          this.tableDataLoading = false;
+          if (res.code == "ok") {
             this.$message({
-                message: error,
-                type: "error"
+              message: '导入成功',
+              type: "success"
             });
+            this.getTableData(this.hasChooseDept);
+          } else {
+            this.$message({
+              message: res.msg,
+              type: "error"
+            });
+          }
+        },
+        error => {
+          this.$refs.upload.clearFiles();
+          this.tableDataLoading = false;
+          this.$message({
+            message: error,
+            type: "error"
+          });
         });
     },
-    exportData(){
+    exportData() {
       let param = {
-          planType: this.planType,
-          date: this.planDate,
-          steelStampNumber: this.steelStampNumber,
+        planType: this.planType,
+        date: this.planDate,
+        steelStampNumber: this.steelStampNumber,
       }
-      this.http.post('/plan/exportData',param,
-      res => {
+      this.http.post('/plan/exportData', param,
+        res => {
           if (res.code == "ok") {
-              var filePath = res.data;
-              const a = document.createElement('a'); // 创建a标签
-              a.setAttribute('download', this.$t('projectexport') + '.xlsx');// download属性
-              a.setAttribute('href', filePath);// href链接
-              a.click(); //自执行点击事件
-              a.remove();
-          } 
-      },
-      error => {
+            var filePath = res.data;
+            const a = document.createElement('a'); // 创建a标签
+            a.setAttribute('download', this.$t('projectexport') + '.xlsx');// download属性
+            a.setAttribute('href', filePath);// href链接
+            a.click(); //自执行点击事件
+            a.remove();
+          }
+        },
+        error => {
           this.$message({
-              message: error,
-              type: "error"
+            message: error,
+            type: "error"
           });
-          }
+        }
       );
     },
     handleSelectionChange(val) {
-        this.multipleSelection = val.map(item => item.id);
-        console.log(this.multipleSelection)
+      this.multipleSelection = val.map(item => item.id);
+      console.log(this.multipleSelection)
     },
-    allocationPlan(){
-      if(this.multipleSelection.length==0){
-          return
+    allocationPlan() {
+      if (this.multipleSelection.length == 0) {
+        return
       }
       this.http.post(
         "/plan/allocationPlan",
         {
-          ids:this.multipleSelection.join(","),
-          planType:this.planType
+          ids: this.multipleSelection.join(","),
+          planType: this.planType
         },
         (res) => {
           if (res.code == "ok") {
             this.$message({
-              message:'下发成功',
+              message: '下发成功',
               type: "success",
             });
           } else {
@@ -781,11 +676,12 @@ export default {
   },
 };
 </script>
-  <style scoped lang='scss'>
+<style scoped lang='scss'>
 .colorText {
   color: #02a7f0;
   cursor: pointer;
 }
+
 .layout-container {
   width: 100%;
   height: 100%;
@@ -794,22 +690,26 @@ export default {
   flex-direction: column;
   box-sizing: border-box;
   padding: 10px;
+
   .layout-container-header,
   .layout-container-center,
   .layout-container-floor {
     width: 100%;
   }
+
   .layout-container-center {
     flex: 1;
     display: flex;
     flex-direction: column;
   }
+
   .layout-container-floor {
     box-sizing: border-box;
     display: flex;
-    justify-content: end;
+    justify-content: space-between;
     padding: 10px 20px;
   }
+
   .OutSide {
     width: 100%;
     display: flex;
@@ -817,29 +717,38 @@ export default {
     justify-content: space-between;
     flex-direction: initial;
     padding-bottom: 10px;
+
     .demonstration {
       margin-right: 20px;
       min-width: 48px;
     }
+
     .OutSide_left {
       width: 200px;
       display: flex;
       justify-content: space-between;
       align-items: center;
+
       div {
         font-size: 16px;
       }
+
       div:first-child {
         font-size: 20px;
       }
     }
-    .OutSide, .block {
+
+    .OutSide,
+    .block {
       max-width: 400px;
     }
+
     .OutSide_center {
       flex: 1;
       display: flex;
       justify-content: center;
+      align-items: center;
+
       .block {
         display: flex;
         align-items: center;
@@ -848,44 +757,57 @@ export default {
     }
 
     .OutSide_right {
+      display: flex;
+      align-items: center;
       .el-link {
         margin-right: 15px;
       }
     }
   }
+
   .today-tab {
     display: flex;
     overflow-x: auto;
     margin-bottom: 10px;
+
     div {
       font-size: 16px;
       margin-left: 15px;
       cursor: pointer;
     }
+
     .on {
       color: #02a7f0;
     }
   }
 
   .planDialog::-webkit-scrollbar {
-    display: none; /* Chrome Safari */
+    display: none;
+    /* Chrome Safari */
   }
+
   // 新增样式
   .planDialog {
     max-height: 50vh;
     overflow-y: auto;
-    scrollbar-width: none; /* Firefox */
-    -ms-overflow-style: none; /* IE 10+ */
+    scrollbar-width: none;
+    /* Firefox */
+    -ms-overflow-style: none;
+
+    /* IE 10+ */
     .el-form {
       display: flex;
       flex-wrap: wrap;
       justify-content: space-between;
     }
+
     .w100 {
       width: 100%;
     }
+
     .el-form-item {
       width: 50%;
+
       .w45 {
         width: 49%;
       }