瀏覽代碼

费用报销增加报销凭证

Lijy 3 年之前
父節點
當前提交
f5418a9e58

+ 1 - 1
fhKeeper/formulahousekeeper/timesheet/config/index.js

@@ -1,7 +1,7 @@
 var path = require('path')
 
 //  var ip = '127.0.0.1'
-// var ip = '192.168.2.31'
+// var ip = '192.168.2.36'
 
  
 var ip = '47.100.37.243'

+ 21 - 0
fhKeeper/formulahousekeeper/timesheet/package-lock.json

@@ -9113,6 +9113,22 @@
       "integrity": "sha1-sj5DWK+oogL+ehAK8fX4g/AgB+4=",
       "dev": true
     },
+    "v-viewer": {
+      "version": "1.6.4",
+      "resolved": "https://registry.npmjs.org/v-viewer/-/v-viewer-1.6.4.tgz",
+      "integrity": "sha512-LVkiUHpmsbsZXebeNXnu8krRCi5i2n07FeLFxoIVGhw8lVvTBO0ffpbDC6mLEuacCjrIh09HjIqpciwUtWE8lQ==",
+      "requires": {
+        "throttle-debounce": "^2.0.1",
+        "viewerjs": "^1.5.0"
+      },
+      "dependencies": {
+        "throttle-debounce": {
+          "version": "2.3.0",
+          "resolved": "https://registry.npmjs.org/throttle-debounce/-/throttle-debounce-2.3.0.tgz",
+          "integrity": "sha512-H7oLPV0P7+jgvrk+6mwwwBDmxTaxnu9HMXmloNLXwnNO0ZxZ31Orah2n8lU1eMPvsaowP2CX+USCgyovXfdOFQ=="
+        }
+      }
+    },
     "validate-npm-package-license": {
       "version": "3.0.4",
       "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",
@@ -9146,6 +9162,11 @@
         "extsprintf": "^1.2.0"
       }
     },
+    "viewerjs": {
+      "version": "1.10.2",
+      "resolved": "https://registry.npmjs.org/viewerjs/-/viewerjs-1.10.2.tgz",
+      "integrity": "sha512-v/4+OUF/71JthlvYuqfse+WGkMJO0LxvWiOLsAoxWw+RWjMdEBWn0ZQ5Mc+OhNIFd9uLhG62GzfFIplvix8odg=="
+    },
     "vm-browserify": {
       "version": "1.1.0",
       "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.0.tgz",

+ 1 - 0
fhKeeper/formulahousekeeper/timesheet/package.json

@@ -21,6 +21,7 @@
     "jquery": "^3.4.1",
     "nprogress": "^0.2.0",
     "tinymce": "^5.7.1",
+    "v-viewer": "^1.6.4",
     "vue": "^2.6.10",
     "vue-clipboard2": "^0.3.0",
     "vue-pdf": "^4.2.0",

+ 8 - 1
fhKeeper/formulahousekeeper/timesheet/src/main.js

@@ -20,6 +20,13 @@ import $ from 'jquery'
 
 import './day.js' // 加载 dayjs 初始化配置
 
+import Viewer from 'v-viewer'
+import 'viewerjs/dist/viewer.css'
+Vue.use(Viewer)
+Viewer.setDefaults({
+  Options: { 'inline': true, 'button': true, 'navbar': true, 'title': true, 'toolbar': true, 'tooltip': true, 'movable': true, 'zoomable': true, 'rotatable': true, 'scalable': true, 'transition': true, 'fullscreen': true, 'keyboard': true, 'url': 'data-source' }
+})
+
 Vue.prototype.http = http
 Vue.prototype.port = port
 Vue.prototype.echarts = echarts
@@ -57,7 +64,7 @@ router.beforeEach((to, from, next) => {
         return;
     }
 
-    if(to.path != '/daily') {
+    if (to.path != '/daily') {
         sessionStorage.removeItem("from")
     } 
 

+ 205 - 9
fhKeeper/formulahousekeeper/timesheet/src/views/expense/expense.vue

@@ -170,6 +170,15 @@
                 <el-input size="small" v-model="scope.row.remark"></el-input>
               </template>
             </el-table-column>
+            <el-table-column label="报销凭证" width="135px">
+              <template slot-scope="scope">
+                <div @click="abl(scope.$index)">
+                  <el-upload :class="!scope.row.pic ? 'upload-demo' : 'upload-demo icl'" :before-remove="beforeRemove" :http-request="fileonLoad" limit="1" name="multipartFile">
+                    <el-button size="small" type="primary" v-if="!scope.row.pic">点击上传</el-button>
+                  </el-upload>
+                </div>
+              </template>
+            </el-table-column>
             <el-table-column fixed="right"
               label="操作">
               <template slot-scope="scope">
@@ -311,7 +320,12 @@
                   <el-select size="small" v-if="!flg" v-model="scope.row.projectId" placeholder="项目" style="width: 130px">
                     <el-option v-for="(item, index) in projectList" :key="index" :label="item.projectName" :value="item.id" @click="ok(item)"></el-option>
                   </el-select>
-                  <span v-else>{{projectIdName[scope.$index].projectName}}</span>
+                  <!-- <span v-else>{{projectIdName[scope.$index].projectName}}</span> -->
+                  <div v-else>
+                    <div v-for="(item, index) in projectIdName" :key="index">
+                      <span v-if="item.id == scope.row.projectId">{{item.projectName}}</span>
+                    </div>
+                  </div>
                 </template>
             </el-table-column>
             <el-table-column prop="happenDate" label="费用日期" width="172">
@@ -368,6 +382,29 @@
                 <span v-else>{{scope.row.remark}}</span>
               </template>
             </el-table-column>
+            <el-table-column prop="pic" label="报销单据" width="300">
+              <template slot-scope="scope">
+                <!-- <el-input size="small" v-if="!flg" v-model="scope.row.remark"></el-input>
+                <span v-else>{{scope.row.remark}}</span> -->
+                <div v-if="!flg">
+                  <div @click="abl(scope.$index)">
+                    <el-upload :class="!scope.row.pic ? 'upload-demo' : 'upload-demo icl'" :file-list="scope.row.pic" :before-remove="beforeRemoves" :http-request="fileonLoads" limit="1" name="multipartFile">
+                      <el-button size="small" type="primary" v-if="!scope.row.pic">点击上传</el-button>
+                    </el-upload>
+                  </div>
+                </div>
+                <div v-else>
+                  <span v-if="scope.row.pic">
+                    <div class="tups">
+                      <viewer :images="scope.row.pic">
+                        <img ref="imgsa" v-for="src in scope.row.pic" :src="src.url" :key="src.title">
+                    </viewer>
+                    </div>
+                  </span>
+                  <span v-else>暂无</span>    
+                </div>
+              </template>
+            </el-table-column>
             <!-- 删除 -->
             <el-table-column fixed="right"
               label="操作" v-if="!flg">
@@ -375,9 +412,11 @@
                 <el-button  type="default" size="mini" style="display: inline-block;margin-left:0;margin-top: 3px" @click="delec(scope.$index)">删除</el-button>
               </template>
             </el-table-column>
-            
           </el-table>
         </div>
+        <!-- <viewer :images="imgs">
+            <img ref="imgsa" v-for="src in imgs" :src="src.url" :key="src.title">
+        </viewer> -->
         <!-- 取消和确定 -->
         <span slot="footer" class="dialog-footer">
           <el-button @click="dialog = false">取 消</el-button>
@@ -395,6 +434,7 @@ export default {
   props: {},
   data() {
     return {
+      imgs: [],
       isAuditList: false,
       statusTxt:["审核通过","待审核", "已驳回", "已撤销"],
       user: JSON.parse(sessionStorage.getItem("user")),
@@ -434,7 +474,9 @@ export default {
       projectIdName: [], // 点击查看的项目名
       flg: false, // 是否禁用
       shuz: ['一般费用填报', '差旅费用填报', '外包费用填报'],
-      ins: 0
+      ins: 0,
+      apl: '',
+      diz: 'http://worktime.ttkuaiban.com'
     };
   },
   computed: {},
@@ -458,7 +500,7 @@ export default {
   filters: {
       numberToCurrency(value) {
           if (!value) return '0.00'
-          console.log('v=='+value);
+          // console.log('v=='+value);
           value = value.toFixed(2)
           const intPart = Math.trunc(value)
           const intPartFormat = intPart.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,')
@@ -585,6 +627,17 @@ export default {
     },
      adds() {
       // happenDate
+      // console.log(this.ParticularsList.invoiceList, '123')
+      var spl = this.ParticularsList.invoiceList
+      for(var i in spl) {
+        if(spl[i].pic) {
+          if(spl[i].pic[0].name) {
+            spl[i].pic = spl[i].pic[0].name
+          }
+        } 
+      }
+      // console.log(spl)
+      // return
       this.ParticularsList.items = JSON.stringify(this.ParticularsList.invoiceList)//这里要传发票列表的json转string
       
       delete this.ParticularsList.invoiceList
@@ -647,8 +700,7 @@ export default {
     },
     // 点击新增
     addxz() {
-      
-      this.form = {happenDate: null,invoiceType:null,amount:null,invoiceNo:null,taxPercent:null,taxValue:null,remark:null},
+      this.form = {happenDate: null,invoiceType:null,amount:null,invoiceNo:null,taxPercent:null,taxValue:null,remark:null,pic: null},
       this.invoiceList.push(this.form)
     },
     //获取项目列表
@@ -782,14 +834,30 @@ export default {
       this.http.post('/expense-sheet/getDetail', {id: id},
       res => {
             if (res.code == "ok") {this
-                this.ParticularsList = res.data
+                // this.ParticularsList = res.data
                 var s = []
+                // var b = []
+                for(var i in res.data.invoiceList) {
+                  if(res.data.invoiceList[i].pic) {
+                    var b = []
+                    var j = {}
+                    var img = this.diz + '/upload/' + res.data.invoiceList[i].pic
+                    j.url = img
+                    j.title = '报销凭证',
+                    j.name = res.data.invoiceList[i].pic
+                    b.push(j)
+                    res.data.invoiceList[i].pic = b
+                    // console.log(res.data.invoiceList[i].pic)
+                  }
+                }
+                this.ParticularsList = res.data
                 for(var i = 0; i <= this.ParticularsList.invoiceList.length - 1; i++) {
                   s.push(this.ParticularsList.invoiceList[i].projectId)
                 }
                 this.projectIdName =  this.projectList.filter( item => {return s.indexOf(item.id) !== -1})
                 // this.projectIdName = this.projectList.filter(p => p.id == this.ParticularsList.invoiceList[0].projectId)[0].projectName
-                console.log(res.data, '查看当前状态');
+                // console.log(res.data, '查看当前状态');
+                // console.log(this.ParticularsList)
             } else {
                 this.$message({
                 message: res.msg,
@@ -906,11 +974,139 @@ export default {
     zhis(e) {
       var i = e
       this.invoiceList[i].taxValue = this.invoiceList[i].taxValue.toFixed(2)
-    }
+    },
+      fileonLoad(item) {
+        //首先判断文件类型
+        let str = item.file.name.split(".");
+        let format = str[str.length - 1];
+        if (format != "jpg" && format != "png") {
+            this.$message({
+                message: "请选择图片",
+                type: "error"
+            });
+        } else {
+            this.listLoading = true;
+            let formData = new FormData();
+            formData.append("multipartFile", item.file);
+            this.http.uploadFile('/common/uploadFile', formData,
+            res => {
+                this.listLoading = false;
+                if (res.code == "ok") {
+                    this.$message({
+                        message: "上传成功",
+                        type: "success"
+                    });
+                    // this.getList();
+                    this.invoiceList[this.apl].pic = res.data
+                    // console.log(this.invoiceList)
+                } else {
+                    this.$message({
+                        message: res.msg,
+                        type: "error"
+                    });
+                }
+            },
+            error => {
+                this.listLoading = false;
+                this.$message({
+                    message: error,
+                    type: "error"
+                });
+            });
+        }
+      },
+      abl(e) {
+        this.apl = e
+      },
+      beforeRemove(file, fileList) {
+        var that = this
+        setTimeout(function () {
+          that.invoiceList[that.apl].pic = null
+        }, 200)
+      },
+      fileonLoads(item) {
+        //首先判断文件类型
+        let str = item.file.name.split(".");
+        let format = str[str.length - 1];
+        if (format != "jpg" && format != "png") {
+            this.$message({
+                message: "请选择图片",
+                type: "error"
+            });
+        } else {
+            this.listLoading = true;
+            let formData = new FormData();
+            formData.append("multipartFile", item.file);
+            this.http.uploadFile('/common/uploadFile', formData,
+            res => {
+                this.listLoading = false;
+                if (res.code == "ok") {
+                    this.$message({
+                        message: "上传成功",
+                        type: "success"
+                    });
+                    // this.getList();
+                    this.ParticularsList.invoiceList[this.apl].pic = res.data
+                    // console.log(this.invoiceList)
+                } else {
+                    this.$message({
+                        message: res.msg,
+                        type: "error"
+                    });
+                }
+            },
+            error => {
+                this.listLoading = false;
+                this.$message({
+                    message: error,
+                    type: "error"
+                });
+            });
+        }
+      },
+      beforeRemoves(file, fileList) {
+        var that = this
+        setTimeout(function () {
+          // this.ParticularsList.invoiceList
+          that.ParticularsList.invoiceList[that.apl].pic = null
+        }, 200)
+      },
+      imgUrl(img) {
+        // var imgss = this.diz + '/upload/' + img
+        // var sp = []
+        // var is = {}
+        // is.url = imgss
+        // is.title = 1
+        // sp.push(is)
+        // this.imgs = sp
+        // console.log(imgss)
+        // console.log(this.$refs.imgsa)
+        // this.$refs.imgsa.click()
+        // console.log(location.protocol, location.host)
+        // console.log(location.protocol + '//' + location.host + imgs)
+      }
   },
 };
 </script>
 <style scoped>
+.tups {
+  width: 100%;
+  height: 25px;
+  position: relative;
+  z-index: 99;
+}
+.tups img {
+  height: 25px !important;
+  position: relative;
+  z-index: 99;
+}
+.viewer-canvas {
+  position: absolute;
+  z-index: 99999999;
+}
+.icl {
+  margin-top: -25px !important;
+}
 /* 费用报销标题 */
 .headine {
   width: 100%;

+ 43 - 3
fhKeeper/formulahousekeeper/timesheet/src/views/team/index.vue

@@ -18,6 +18,11 @@
             <!--工具条-->
             <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
                 <el-form :inline="true">
+                    <div style="width: 300px;display: inline-block;">
+                        <el-input v-model="keyword" class="input-with-select" placeholder="请输入人员名字搜索" clearable="true">
+                            <el-button slot="append" @click="searchList" icon="el-icon-search"></el-button>
+                        </el-input>
+                    </div>
                     <el-form-item>
                         <div v-if="depData == null || depData.id == -1" class="nowTime" style="cursor:unset">
                             <i class="fa fa-home"></i>全部人员
@@ -379,6 +384,7 @@
                     name: [{ required: true, message: "请输入部门名称", trigger: "blur" }],
                 },
                 timeType:{},
+                keyword: ''
             };
         },
         methods: {
@@ -465,7 +471,8 @@
                 this.http.post(this.port.manage.list, {
                     departmentId: -1,
                     pageIndex: 1,
-                    pageSize: 99999
+                    pageSize: 99999,
+                    keyword: this.keyword
                 },
                 res => {
                     if (res.code == "ok") {
@@ -539,7 +546,8 @@
                 this.http.post(this.port.manage.list, {
                     departmentId: -1,
                     pageIndex: 1,
-                    pageSize: 99999
+                    pageSize: 99999,
+                    keyword: this.keyword
                 },
                 res => {
                     if (res.code == "ok") {
@@ -657,7 +665,8 @@
                 this.http.post( this.port.manage.list, {
                     departmentId: this.depData.id,
                     pageIndex: this.page,
-                    pageSize: this.size
+                    pageSize: this.size,
+                    keyword: this.keyword
                 },
                 res => {
                     this.listLoading = false;
@@ -1126,6 +1135,37 @@
                 })
                 .catch(() => {});
             },
+
+            // 关键搜索
+            searchList() {
+                console.log(this.keyword)
+                this.listLoading = true;
+                this.http.post( this.port.manage.list, {
+                    departmentId: this.depData.id,
+                    pageIndex: this.page,
+                    pageSize: this.size,
+                    keyword: this.keyword
+                },
+                res => {
+                    this.listLoading = false;
+                    if (res.code == "ok") {
+                        this.list = res.data.records;
+                        this.total = res.data.total;
+                    } else {
+                        this.$message({
+                            message: res.msg,
+                            type: "error"
+                        });
+                    }
+                },
+                error => {
+                    this.listLoading = false;
+                    this.$message({
+                        message: error,
+                        type: "error"
+                    });
+                });
+            }
         },
 
         created() {