浏览代码

合并8.1

Tartarus 2 年之前
父节点
当前提交
450207864b

+ 36 - 1
src/api/contracts.js

xqd xqd
@@ -1,5 +1,19 @@
 import request from '@/utils/request'
-
+
+// 获取合同详情
+export function contractsDetailApi(id) {
+  return request({
+    url: '/api/Contract/' + id,
+    method: 'get'
+  })
+}
+export function contractsExportApi(data) {
+  return request({
+    url: '/api/Contract/export',
+    method: 'post',
+    data: data
+  })
+}
 export function contractsPageApi(data) {
   return request({
     url: '/api/Contract/search',
@@ -14,3 +28,24 @@ export function contractsManageApi(data) {
     data
   })
 }
+export function drawerSearchApi(data) {
+  return request({
+    url: '/api/Drawer/search',
+    method: 'post',
+    data
+  })
+}
+export function acceptorSearchApi(data) {
+  return request({
+    url: '/api/Acceptor/search',
+    method: 'post',
+    data
+  })
+}
+export function contractSubmitApi(data) {
+  return request({
+    url: '/api/Contract',
+    method: 'post',
+    data
+  })
+}

+ 9 - 1
src/api/supplier.js

xqd
@@ -1,9 +1,17 @@
 import request from '@/utils/request'
 
+export function supplierExportApi(data) {
+  return request({
+    url: '/api/Contract/export',
+    method: 'post',
+    //responseType: 'blob', //设置响应的数据类型为一个包含二进制数据的 Blob 对象,必须设置!!!
+    data: data
+  })
+}
 export function getSupplierSearch(data) {
   return request({
     url:'/api/Supplier/search',
     method: 'post',
     data
   })
-}
+}

+ 73 - 0
src/components/AcceptorSelect/AcceptorSelect.vue

xqd
@@ -0,0 +1,73 @@
+<template>
+  <el-select
+    :value="value"
+    filterable
+    remote
+    placeholder="请输入关键词"
+    :loading="loading"
+    :remote-method="remoteMethod"
+    clearable
+    @change="onChange"
+  >
+    <el-option
+      v-for="item in options"
+      :key="item.id"
+      :label="item.name"
+      :value="item.id"
+    />
+  </el-select>
+</template>
+
+<script>
+import { acceptorSearchApi } from '@/api/contracts'
+export default {
+  name: 'AcceptorSelect',
+  props: {
+    value: {
+      type: [String, Number, Array],
+      default: undefined
+    }
+  },
+  data() {
+    return {
+      filter: {
+        pageIndex: 1,
+        pageSize: 100
+      },
+      options: [],
+      loading: false
+    }
+  },
+  mounted() {
+    this.loadData()
+  },
+  methods: {
+    loadData(filter = {}) {
+      const params = {
+        ...this.filter,
+        ...filter
+      }
+      this.loading = true
+      acceptorSearchApi(params).then(res => {
+        const result = res.data.result
+        this.options = result
+        this.loading = false
+      }).catch(err => {
+        console.log(err)
+        this.loading = false
+      })
+    },
+    remoteMethod(query) {
+      this.loadData({ name: query })
+    },
+    onChange(value) {
+      this.emitInput(value)
+    },
+    emitInput(value) {
+      const exist = this.options.find((o) => o.id === value)
+      this.$emit('input', value)
+      this.$emit('change', value, exist)
+    }
+  }
+}
+</script>

+ 71 - 0
src/components/DrawerSelect/DrawerSelect.vue

xqd
@@ -0,0 +1,71 @@
+<template>
+  <el-select
+    :value="value"
+    filterable
+    remote
+    placeholder="请输入关键词"
+    :loading="loading"
+    :remote-method="remoteMethod"
+    clearable
+    @change="onChange"
+  >
+    <el-option
+      v-for="item in options"
+      :key="item.id"
+      :label="item.name"
+      :value="item.id"
+    />
+  </el-select>
+</template>
+
+<script>
+import { drawerSearchApi } from '@/api/contracts'
+export default {
+  name: 'DrawerSelect',
+  props: {
+    value: {
+      type: [String, Number, Array],
+      default: undefined
+    }
+  },
+  data() {
+    return {
+      filter: {
+        pageIndex: 1,
+        pageSize: 100
+      },
+      options: [],
+      loading: false
+    }
+  },
+  mounted() {
+    this.loadData()
+  },
+  methods: {
+    loadData(filter = {}) {
+      const params = {
+        ...this.filter,
+        ...filter
+      }
+      this.loading = true
+      drawerSearchApi(params).then(res => {
+        const result = res.data.result
+        this.options = result
+        this.loading = false
+      }).catch(err => {
+        console.log(err)
+        this.loading = false
+      })
+    },
+    remoteMethod(query) {
+      this.loadData({ name: query })
+    },
+    onChange(value) {
+      this.emitInput(value)
+    },
+    emitInput(value) {
+      this.$emit('input', value)
+    }
+  }
+}
+</script>

+ 256 - 0
src/components/upload/FileUpload.vue

xqd
@@ -0,0 +1,256 @@
+<template>
+  <div>
+    <el-upload
+      :action="action"
+      :file-list="fileList"
+      list-type="picture-card"
+      :limit="limit"
+      :accept="accept"
+      :class="hideUpload || uploading ? 'hideUpload' : ''"
+      :on-error="handleError"
+      :before-upload="beforeUpload"
+      :on-success="handleImageSuccess"
+      multiple
+    >
+
+      <i slot="default" class="el-icon-plus"></i>
+
+      <div slot="file" slot-scope="{ file }">
+        <div>
+
+        <img
+        class="el-upload-list__item-thumbnail"
+        :src="isPDF(file.url) ? pdf : file.url"
+        alt="" />
+
+        <span
+          v-if="file.status === 'success'"
+          class="el-upload-list__item-actions"
+        >
+          <span
+            v-if="preview"
+            class="el-upload-list__item-preview"
+            @click="handlePreview(file)"
+          >
+            <i class="el-icon-zoom-in"></i>
+          </span>
+          <span
+            v-if="download"
+            class="el-upload-list__item-delete"
+            @click="handleDownload(file)"
+          >
+            <i class="el-icon-download"></i>
+          </span>
+          <span
+            v-if="deleted"
+            class="el-upload-list__item-delete"
+            @click="handleRemove(file)"
+          >
+            <i class="el-icon-delete"></i>
+          </span>
+        </span>
+        <span
+          v-else
+          :class="[
+            uploading ? 'uploading' : '',
+            'el-upload-list__item-actions',
+          ]"
+        >
+          <i class="el-icon-loading" /><i style="font-size: 14px">上传中</i>
+        </span>
+
+        <!--<div style="word-break: break-all;
+         text-overflow: ellipsis;
+         display: -webkit-box;
+         -webkit-box-orient: vertical;
+         -webkit-line-clamp: 2;
+         overflow: hidden;">{{ file.name+'.'+file.ext }}</div>-->
+      </div>
+
+      </div>
+    </el-upload>
+
+    <el-dialog :visible.sync="previewVisible">
+      <img width="100%" :src="previewImgUrl" alt="" />
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+
+import logo from '@/assets/pdf.png'
+
+export default {
+  name: 'FileUpload',
+  props: {
+    value: {
+      type: [String, Array],
+      default: ''
+    },
+    // 上传的地址
+    action: {
+      type: String,
+      default: 'https://ht.9026.com/api/File',
+    },
+    // 设置上传的请求头部
+    headers: {
+      type: Object,
+      default: () => {
+        return {}
+      },
+    },
+    // 上传文件大小限制, 默认 50M,单位M
+    size: {
+      type: [Number, String],
+      default: 50,
+    },
+    // 文件上传格式, 默认jpeg, png,jpg
+    accept: {
+      type: String,
+      default: 'image/jpeg,image/png',
+    },
+    // 是否显示删除操作按钮
+    deleted: {
+      type: Boolean,
+      default: true,
+    },
+    // 是否显示预览操作按钮
+    preview: {
+      type: Boolean,
+      default: true,
+    },
+    // 是否显示下载操作按钮
+    download: {
+      type: Boolean,
+      default: true,
+    },
+    // 上传文件个数限制,默认0 不限制
+    limit: {
+      type: [Number, String],
+      default: 0,
+    },
+  },
+  data() {
+    return {
+      fileList: [], // 默认文件列表
+      hideUpload: false, // 超出限制掩藏上传按钮
+      uploading: false, // 是否上传中,上传时隐藏上传按钮
+      previewImgUrl: '', // 预览图片地址
+      previewVisible: false, // 是否显示预览
+      pdf: logo,
+      files: [], // 文件url数组
+    }
+  },
+  watch:{
+    value(val, old) {
+      console.log('value=', val)
+      if(val){
+        this.files = val
+        this.fileList = [] // 先清空
+        for(var i=0; i<val.length;i++){
+          this.fileList.push({
+            url: val[i] // 转化
+          })
+        }
+        this.handleChange()
+      }
+    }
+  },
+  methods: {
+    emitInput() {
+      this.$emit('input', this.files)
+    },
+    // 判断是否pdf
+    isPDF(url) {
+      if(!url){
+        return false
+      }
+      const fileType = ['pdf']
+      const index = url.lastIndexOf('.')
+      const type = url.substr(index + 1)
+      return fileType.indexOf(type) > -1
+    },
+    // 文件上传成功
+    handleImageSuccess(res) {
+      if (res.code === 200) {
+        this.files.push(res.data.file)
+        this.emitInput()
+      } else {
+        this.$message.error('文件上传失败')
+      }
+    },
+    // 上传前文件大小判断
+    beforeUpload(file) {
+      const { size } = this
+      const overSize = size > 0 && file.size < 1024 * 1024 * size
+      if (!overSize) this.$message.error(`上传文件大小不能超过 ${size}MB!`)
+      this.uploading = overSize // 是否上传中
+      return overSize
+    },
+    // 上传出错返回
+    handleError(event, file, fileList) {
+      console.log(event, file, fileList, 'error')
+      this.$message.error('服务出错,上传失败!')
+      this.handleChange()
+    },
+    // 删除图片
+    async handleRemove(file) {
+      this.$confirm(`确认删除文件?`, '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(async () => {
+        const { fileList } = this
+        this.files = this.files.filter((v) => v !== file.url)
+        this.emitInput()
+      }).catch(()=>{})
+    },
+    // 图片预览
+    handlePreview(file) {
+      if(this.isPDF(file.url)){
+        window.open(file.url, "_blank");
+      } else {
+        this.previewImgUrl = file.url
+        this.previewVisible = true
+      }
+    },
+    handleChange(file, list) {
+      const { limit, fileList } = this
+      if (limit > 0 && fileList.length >= limit) this.hideUpload = true
+      else this.hideUpload = false
+      this.uploading = false
+    },
+    handleDownload(file) {
+      window.open(file.url, "_blank");
+      /*const a = document.createElement('a')
+      a.href = file.url
+      a.click() // 模拟点击事件,实现图片文件的同源下载
+      */
+    },
+  },
+}
+</script>
+
+<style>
+.hideUpload .el-upload--picture-card {
+  display: none;
+}
+.el-upload-list--picture-card .uploading.el-upload-list__item-actions {
+  opacity: 1;
+}
+/*添加、删除文件时去掉动画过渡*/
+.el-upload-list__item {
+  transition: none !important;
+}
+
+.el-upload-list--picture-card .el-upload-list__item-thumbnail {
+    width: 148px;
+    height: 148px;
+}
+.el-upload-list--picture-card .el-upload-list__item {
+    background-color: inherit;
+    border: none;
+    width: 148px;
+    height: 148px;
+}
+</style>

+ 167 - 14
src/components/upload/upload.vue

xqd xqd xqd
@@ -4,11 +4,61 @@
       :action="url"
       list-type="picture-card"
       :on-success="handleImageSuccess"
-      :on-preview="handlePictureCardPreview"
-      :on-remove="handleRemove"
+      :file-list="fileList"
+      :limit="limit"
+      :accept="accept"
+      :headers="headers"
+      :before-upload="beforeUpload"
+      multiple
     >
-      <i class="el-icon-plus" />
+      <i slot="default" class="el-icon-plus" />
+      <div slot="file" slot-scope="{ file }">
+        <div class="text-center p-2">
+          <img
+            class="el-upload-list__item-thumbnail"
+            :src="isPDF(file) ? files(file) : pdfImg"
+          >
+          <!-- 成功状态 -->
+          <span
+            v-if="file.status === 'success'"
+            class="el-upload-list__item-actions"
+          >
+            <span
+              v-if="preview"
+              class="el-upload-list__item-preview"
+              @click="handlePreview(file)"
+            >
+              <i class="el-icon-zoom-in" />
+            </span>
+            <span
+              v-if="download"
+              class="el-upload-list__item-delete"
+              @click="handleDownload(file)"
+            >
+              <i class="el-icon-download" />
+            </span>
+            <span
+              v-if="deleted"
+              class="el-upload-list__item-delete"
+              @click="handleRemove(file)"
+            >
+              <i class="el-icon-delete" />
+            </span>
+          </span>
+          <!-- 失败状态 -->
+          <span
+            v-else
+            :class="[
+              uploading ? 'uploading' : '',
+              'el-upload-list__item-actions',
+            ]"
+          >
+            <i class="el-icon-loading" /><i style="font-size: 14px">上传中</i>
+          </span>
+        </div>
+      </div>
     </el-upload>
+    <!-- 预览图片 -->
     <el-dialog :visible.sync="dialogVisible">
       <img width="100%" :src="dialogImageUrl" alt="">
     </el-dialog>
@@ -16,28 +66,72 @@
 </template>
 
 <script>
+import pdf from '@/assets/pdf.png'
 export default {
   name: 'Upload',
   props: {
     value: {
-      type: [String, Array],
+      type: [String, Array, Object],
       default: ''
     },
+    // 接口地址
     url: {
       type: String,
       default: 'https://ht.9026.com/api/File'
+    },
+    // 设置上传的请求头部
+    headers: {
+      type: Object,
+      default: () => {
+        return {}
+      }
+    },
+    // 上传文件大小限制, 默认 50M,单位M
+    size: {
+      type: [Number, String],
+      default: 50
+    },
+    // 文件上传格式, 默认jpeg, png,jpg
+    accept: {
+      type: String,
+      default: '.jpg,.jpeg,.png,.pdf'
+    },
+    // 是否显示删除操作按钮
+    deleted: {
+      type: Boolean,
+      default: true
+    },
+    // 是否显示预览操作按钮
+    preview: {
+      type: Boolean,
+      default: false
+    },
+    // 是否显示下载操作按钮
+    download: {
+      type: Boolean,
+      default: true
+    },
+    // 上传文件个数限制,默认0 不限制
+    limit: {
+      type: [Number, String],
+      default: 0
     }
   },
   data() {
     return {
-      dialogVisible: false,
-      dialogImageUrl: '',
-      fileList: []
+      pdfImg: pdf, // pdf图片
+      dialogVisible: false, // 是否显示预览
+      dialogImageUrl: '', // 预览图片地址
+      fileList: [], // 默认文件列表
+      hideUpload: false, // 超出限制掩藏上传按钮
+      uploading: false // 是否上传中,上传时隐藏上传按钮
     }
   },
   methods: {
     emitInput() {
-      this.$emit('input', this.fileList)
+      this.$emit('input', this.fileList.map(o => {
+        return o.response.data.file
+      }))
     },
     // 查看图片
     handlePictureCardPreview(file) {
@@ -45,21 +139,80 @@ export default {
       this.dialogVisible = true
     },
     // 文件上传成功
-    handleImageSuccess(res) {
+    handleImageSuccess(res, file) {
       if (res.code === 200) {
-        this.fileList.push(res.data.file)
+        this.fileList.push(file)
         this.emitInput()
       } else {
         this.$message.error('文件上传失败')
       }
     },
     // 删除文件
-    handleRemove(file, fileList) {
-      this.fileList = fileList.map(o => {
-        return o.response.data.file
+    handleRemove(file) {
+      this.$confirm(`确认删除 ${file.name} 文件?`, '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.fileList = this.fileList.filter((item) => item.uid !== file.uid)
+        this.emitInput()
       })
-      this.emitInput()
+    },
+    files(file) {
+      if (!file.response) return
+      return file.response.data.file
+    },
+    isPDF(file) {
+      const { name } = file
+      const fileType = ['pdf']
+      const index = name.lastIndexOf('.')
+      const type = name.substr(index + 1)
+      return fileType.indexOf(type) === -1
+    },
+    // 图片预览
+    handlePreview(file) {
+      window.open(file.url, '_blank')
+      /*
+        this.dialogImageUrl = file.url
+        this.dialogVisible = true
+      */
+    },
+    // 下载
+    handleDownload(file) {
+      window.open(file.url, '_blank')
+      /* const a = document.createElement('a')
+      a.href = file.url
+      a.click() // 模拟点击事件,实现图片文件的同源下载
+      */
+    },
+    // 上传前文件大小判断
+    beforeUpload(file) {
+      const { size } = this
+      const overSize = size > 0 && file.size < 1024 * 1024 * size
+      if (!overSize) this.$message.error(`上传文件大小不能超过 ${size}MB!`)
+      this.uploading = overSize // 是否上传中
+      return overSize
+    },
+    // 上传出错返回
+    handleError(event, file, fileList) {
+      console.log(event, file, fileList, 'error')
+      this.$message.error('服务出错,上传失败!')
     }
   }
 }
 </script>
+<style scoped>
+.text-center {
+  text-align: center;
+}
+/*添加、删除文件时去掉动画过渡*/
+.el-upload-list__item {
+  transition: none !important;
+}
+.el-upload-list--picture-card .el-upload-list__item {
+    background-color: inherit;
+    border: none;
+    width: 158px;
+    height: 208px;
+}
+</style>

+ 2 - 2
src/layout/components/Sidebar/index.vue

xqd
@@ -1,10 +1,10 @@
 <template>
   <div :class="{'has-logo':showLogo}">
-    <!-- <div class="flex4 boxtitle">
+    <div class="flex4 boxtitle">
       <el-image :src="logo" style="width: 100px; height: 78px;" fit=" fill"></el-image>
       <span style="color: #1F242A ;">55</span>
             <span style="color: #BEBDBB;">2456165645625454151</span>
-    </div> -->
+    </div>
 
 
     <el-scrollbar wrap-class="scrollbar-wrapper">

+ 3 - 2
src/main.js

xqd
@@ -15,10 +15,11 @@ import locale from 'element-ui/lib/locale/lang/zh-CN'
 import '@/directives'
 import '@/icons' // icon
 import '@/permission' // permission control
-import TableWrapper from '@/components/TableWrapper/TableWrapper.vue'
 import Upload from '@/components/upload/upload.vue'
-Vue.component('TableWrapper', TableWrapper)
+import FileUpload from '@/components/upload/FileUpload.vue'
+//Vue.component('TableWrapper', TableWrapper)
 Vue.component('Upload', Upload)
+Vue.component('FileUpload', FileUpload)
 /**
  * If you don't want to use mock-server
  * you want to use MockJs for mock api

+ 3 - 13
src/router/index.js

xqd xqd xqd
@@ -46,17 +46,7 @@ export const asyncRouterMap = [{
 		redirect: {
 			name: 'contracts'
 		},
-		children: [{
-				path: 'list',
-				name: 'contracts-list',
-				component: () => import('@/views/contracts/list'),
-				meta: {
-					title: '合同列表',
-					icon: 'el-icon-s-order',
-					roles: ['admin', 'salesman', 'supplier']
-				},
-				hidden: true
-			},
+		children: [
 			{
 				path: 'contracts',
 				name: 'contracts',
@@ -180,7 +170,7 @@ export const asyncRouterMap = [{
 				component: () => import('@/views/form/addTicketdrawer'),
 				meta: {
 					title: '新增出票人',
-					roles: ['admin', 'salesman', ]
+					roles: ['admin', 'salesman', 'supplier']
 				},
 				hidden: true
 			},
@@ -369,4 +359,4 @@ export function resetRouter() {
 	router.matcher = newRouter.matcher // reset router
 }
 
-export default router
+export default router

+ 4 - 2
src/utils/request.js

xqd xqd
@@ -80,6 +80,7 @@ service.interceptors.response.use(
 
 	console.log(response,"response")
 	console.log(res,"res")
+
     // if (res.code !== 200) {
     //   Message({
     //     message: res.msg || 'Error',
@@ -105,9 +106,10 @@ service.interceptors.response.use(
     // } else {
     //   return res
     // }
-		if(res.type==="application/x-zip-compressed"){
+		if(res.type==="application/x-zip-compressed" ||
+       res.type==="application/vnd.ms-excel"){
 			return response
-		}else if(res.code !== 200){
+		}else if(res.code != 200){
 			Message({
 			    message: res.msg || 'Error',
 			    type: 'error',

+ 8 - 4
src/views/contracts/billDetail.vue

xqd xqd xqd
@@ -1,11 +1,12 @@
 <template>
-  <div>
+  <div class="bill-detail">
 
     <el-descriptions title="汇票详情" :column="3" border style="margin: 20px;">
       <el-descriptions-item label="汇票名">{{
+
         list[0].name
       }}</el-descriptions-item>
-      <el-descriptions-item label="汇票号">{{
+      <el-descriptions-item label="汇票号">{{
         list[0].draftNo
       }}</el-descriptions-item>
       <el-descriptions-item label="汇票状态">{{
@@ -44,11 +45,11 @@
       <el-descriptions-item label="预计贴现日">{{
         list[0].expectDiscountDate
       }}</el-descriptions-item>
-      <el-descriptions-item label="到期日">{{
+      <el-descriptions-item label="汇票到期日">{{
         list[0].issueDate
       }}</el-descriptions-item>
 
-      <el-descriptions-item label="附件">
+      <el-descriptions-item label="发票附件">
         <el-image
           style="width: 100px; height: 100px"
           :src="list[0].picList"
@@ -217,4 +218,7 @@ export default {
   display: flex;
   // justify-content: space-around;
 }
+.bill-detail{
+  padding: 20px;
+}
 </style>

+ 0 - 139
src/views/contracts/components/ListFilterForm.vue

xqd
@@ -1,139 +0,0 @@
-<template>
-  <el-row type="flex" justify="space-between" style="margin-bottom: 20px">
-    <div class="grid-content bg-purple">
-      <el-input
-        v-model="form.name"
-        placeholder="合同名称/编号、承兑人名称或出票..."
-        clearable
-        style="width: 100%"
-        @change="handleFilter"
-      >
-        <i slot="prefix" class="el-input__icon el-icon-search" />
-      </el-input>
-    </div>
-    <div class="grid-content bg-purple">
-      <el-dropdown @command="handleCommand">
-        <div class="pulldown">
-          <span v-if="!status" class="el-dropdown-link"> 合同状态 </span>
-          <span v-if="status" class="el-dropdown-link">
-            {{ status }}
-          </span>
-          <i class="el-icon-arrow-down el-icon--right" />
-        </div>
-        <el-dropdown-menu slot="dropdown">
-          <el-dropdown-item command="合同状态">合同状态</el-dropdown-item>
-          <el-dropdown-item command="正常">正常</el-dropdown-item>
-          <el-dropdown-item command="删除">删除</el-dropdown-item>
-        </el-dropdown-menu>
-      </el-dropdown>
-    </div>
-    <div class="grid-content bg-purple">
-      <el-dropdown @command="handlehpCommand">
-        <div class="pulldown">
-          <span v-if="!hpstatus" class="el-dropdown-link"> 汇票状态 </span>
-          <span v-if="hpstatus" class="el-dropdown-link">
-            {{ hpstatus }}
-          </span>
-          <i class="el-icon-arrow-down el-icon--right" />
-        </div>
-        <el-dropdown-menu slot="dropdown">
-          <el-dropdown-item command="汇票状态">汇票状态</el-dropdown-item>
-          <el-dropdown-item command="正常">正常</el-dropdown-item>
-          <el-dropdown-item command="删除">删除</el-dropdown-item>
-        </el-dropdown-menu>
-      </el-dropdown>
-    </div>
-    <div class="grid-content bg-purple">
-      <el-dropdown @command="handleCommandAuditstatus">
-        <div class="pulldown">
-          <span v-if="!Auditstatus" class="el-dropdown-link"> 审核状态 </span>
-          <span v-if="Auditstatus" class="el-dropdown-link">
-            {{ Auditstatus }}
-          </span>
-          <i class="el-icon-arrow-down el-icon--right" />
-        </div>
-        <el-dropdown-menu slot="dropdown">
-          <el-dropdown-item command="审核状态">审核状态</el-dropdown-item>
-          <el-dropdown-item command="待审核">待审核</el-dropdown-item>
-          <el-dropdown-item command="成功">成功</el-dropdown-item>
-          <el-dropdown-item command="失败">失败</el-dropdown-item>
-        </el-dropdown-menu>
-      </el-dropdown>
-    </div>
-    <div class="grid-content bg-purple">
-      <div class="block">
-        <el-date-picker
-          v-model="value2"
-          type="daterange"
-          align="right"
-          unlink-panels
-          range-separator="至"
-          start-placeholder="开始日期"
-          end-placeholder="结束日期"
-          :picker-options="pickerOptions"
-          value-format="yyyy-MM-dd"
-          @change="handleFilter"
-        />
-      </div>
-    </div>
-  </el-row>
-</template>
-
-<script>
-export default {
-  data() {
-    return {
-      form: {
-        startTime: '',
-        endTime: '',
-        name: '',
-        contractStatus: 0,
-        draftStatus: '',
-        supplierName: ''
-      },
-      pickerOptions: {
-        shortcuts: [{
-          text: '最近一周',
-          onClick(picker) {
-            const end = new Date()
-            const start = new Date()
-            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
-            picker.$emit('pick', [start, end])
-          }
-        },
-        {
-          text: '最近一个月',
-          onClick(picker) {
-            const end = new Date()
-            const start = new Date()
-            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
-            picker.$emit('pick', [start, end])
-          }
-        },
-        {
-          text: '最近三个月',
-          onClick(picker) {
-            const end = new Date()
-            const start = new Date()
-            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
-            picker.$emit('pick', [start, end])
-          }
-        }
-        ]
-      }
-    }
-  },
-  methods: {
-    handleFilter() {
-      this.$emit('filter', {
-        ...this.form,
-        pageIndex: 1
-      })
-    }
-  }
-}
-</script>
-
-<style>
-
-</style>

+ 0 - 99
src/views/contracts/components/ListTable.vue

xqd
@@ -1,99 +0,0 @@
-<template>
-  <TableWrapper
-    :loading="loading"
-    :pagination="pagination"
-    @change="onChange"
-  >
-    <el-table
-      :data="data"
-      element-loading-text="Loading"
-      border
-      fit
-      highlight-current-row
-      @select="onSelectChange"
-      @select-all="onSelectChange"
-    >
-      <el-table-column align="center" label="" width="55" type="selection" />
-      <el-table-column label="合同名称" align="center" prop="name" />
-      <el-table-column label="合同编号" align="center" prop="contractNo" width="155" />
-      <el-table-column label="承兑人" align="center" prop="acceptorName" />
-      <el-table-column label="出票人" align="center" prop="drawersName" />
-      <el-table-column label="汇票状态" align="center" prop="draftStatusText" />
-      <el-table-column label="合同状态" align="center" prop="contractStatusText" />
-      <el-table-column class-name="status-col" label="审核状态" align="center" prop="statusText" />
-      <el-table-column align="center" label="时间" prop="createdAt" width="155" />
-      <el-table-column align="center" prop="created_at" label="操作" width="250">
-        <template slot-scope="scope">
-          <div class="result-table-btns">
-            <!-- <el-button
-              type="primary"
-              @click="$emit('onShow', scope.row)"
-            >详情</el-button>
-            <el-button
-              type="primary"
-              @click="$emit('onEdit', scope.row)"
-            >修改</el-button>
-            <el-button
-              type="primary"
-              @click="$emit('onDelete', scope.row)"
-            >删除</el-button> -->
-            <el-tag class="table-btn" type="primary" style="cursor: pointer" @click="$emit('onShow', scope.row)">详情</el-tag>
-            <el-tag class="table-btn" type="success" style="cursor: pointer" @click="$emit('onEdit', scope.row)">修改</el-tag>
-            <el-tag class="table-btn" type="danger" style="cursor: pointer" @click="$emit('onDelete', scope.row)">删除</el-tag>
-            <el-tag class="table-btn" type="primary" style="cursor: pointer" @click="$emit('onAudit', scope.row)">审核</el-tag>
-          </div>
-          <!-- <el-tag type="primary" style="cursor: pointer" @click="tapDetail(scope.row.id)">查看详情</el-tag>
-          <el-tag v-if="checked === 0" type="success" style="cursor: pointer" @click="Ssuccessed(scope.row.id)">
-            审核成功</el-tag>
-          <el-tag v-if="checked === 0" type="danger" style="cursor: pointer" @click="Sfailed(scope.row.id)">审核失败
-          </el-tag>
-          <el-tag v-if="checked === 1" type="success" style="cursor: pointer">恢复
-          </el-tag>
-          <el-tag v-if="checked === 1" type="danger" style="cursor: pointer">删除</el-tag> -->
-        </template>
-      </el-table-column>
-    </el-table>
-  </TableWrapper>
-</template>
-
-<script>
-
-export default {
-  props: {
-    data: {
-      type: Array,
-      default() {
-        return []
-      }
-    },
-    pagination: {
-      type: Object,
-      default() {
-        return {}
-      }
-    },
-    loading: {
-      type: Boolean,
-      default() {
-        return false
-      }
-    }
-  },
-  methods: {
-    onChange(pagination) {
-      this.$emit('filter', {
-        pageIndex: pagination.pageIndex,
-        pageSize: pagination.pageSize
-      })
-    },
-    onSelectChange(rows, currentRow) {
-      this.$emit('update:selectedRows', rows)
-    }
-  }
-}
-</script>
-<style scoped>
-.table-btn +.table-btn{
-  margin-left: 5px;
-}
-</style>

+ 0 - 1
src/views/contracts/detail.vue

xqd
@@ -265,7 +265,6 @@
           type="primary"
           size="small"
           style="
->>>>>>> a56d1a10ff24406d6daa6c5c7166613d38fb8261
             background-color: #d8ab5a;
             border-color: #d8ab5a;
             margin: 0 20px;

+ 695 - 0
src/views/contracts/editcontract_bak.vue

xqd
@@ -0,0 +1,695 @@
+<template>
+  <div class="app-container">
+    <el-card class="box-card" style="padding: 20px 10px; margin-bottom: 20px">
+      <div class="contract">
+        <div>
+          <p>合同名称</p>
+          <el-input
+            v-model="form.name"
+            placeholder="请输入合同名称"
+            style="width: 500px"
+            clearable
+            @input="getContractNo"
+          />
+        </div>
+        <div>
+          <p>合同编号</p>
+          <el-input
+            v-model="form.contractNo"
+            placeholder="请输入合同编号"
+            style="width: 500px"
+            disabled
+          />
+        </div>
+      </div>
+      <!-- 合同附件图片 -->
+      <div class="titlesa">
+        <span>合同附件</span>
+        <span style="color: #d05c39">*支持上传pdf、jpg/jpeg、png格式</span>
+      </div>
+      <div>
+        <div>
+          <FileUpload
+          v-model="form.pics"
+          accept=".jpg, .jpeg, .png, .pdf"
+          />
+        </div>
+      </div>
+      <!-- 发票附件图片 -->
+      <div class="titlesa">
+        <span>发票附件</span>
+        <span style="color: #d05c39">*支持上传pdf、jpg/jpeg、png格式</span>
+      </div>
+      <div>
+        <FileUpload
+        v-model="form.invoicePics"
+        accept=".jpg, .jpeg, .png, .pdf"
+        />
+      </div>
+      <!-- 贸易附件图片 -->
+      <div class="titlesa">
+        <span>贸易合同</span>
+        <span style="color: #d05c39">*支持上传pdf、jpg/jpeg、png格式</span>
+      </div>
+      <div>
+        <FileUpload
+        v-model="form.tradePics"
+        accept=".jpg, .jpeg, .png, .pdf"
+        />
+      </div>
+    </el-card>
+
+    <!-- 汇票模块 -->
+    <div
+      v-for="(item, index) in form.contractDrafts"
+      :key="index"
+      class="form"
+      style="
+        margin: 20px;
+        border: 1px solid #c0c0c0;
+        padding: 10px;
+        border-radius: 10px;
+      "
+    >
+      <!-- 汇票名称 -->
+      <el-form label-width="90px">
+        <el-form-item label="汇票名称">
+          <el-input
+            v-model="item.name"
+            class="ipwidth"
+            placeholder="请填写汇票名称"
+            style="width: 220px"
+          />
+        </el-form-item>
+        <!-- 预计贴现日 -->
+        <el-form-item label="预计贴现日"
+        :prop="'contractDrafts.' + index + '.expectDiscountDate'">
+          <el-date-picker
+            v-model="item.expectDiscountDate"
+            type="date"
+            placeholder="选择日期"
+            format="yyyy-MM-dd"
+            value-format="yyyy-MM-dd"
+            @change="inputMoney(index, 4)"
+          />
+        </el-form-item>
+        <!-- 出票日期 -->
+        <el-form-item label="出票日期"
+        :prop="'contractDrafts.' + index + '.acceptDate'">
+          <el-date-picker
+            v-model="item.acceptDate"
+            type="date"
+            placeholder="选择日期"
+            format="yyyy-MM-dd"
+            value-format="yyyy-MM-dd"
+            class="ipwidth"
+          />
+        </el-form-item>
+        <!-- 承兑日期 -->
+        <el-form-item label="承兑日期"
+        :prop="'contractDrafts.' + index + '.issueDate'">
+          <el-date-picker
+            v-model="item.issueDate"
+            type="date"
+            placeholder="选择日期"
+            default-value
+            format="yyyy-MM-dd"
+            value-format="yyyy-MM-dd"
+            @change="inputMoney(index, 1)"
+          />
+        </el-form-item>
+        <!-- 到期日期 -->
+        <el-form-item label="到期日期"
+        :prop="'contractDrafts.' + index + '.expireDate'">
+          <el-date-picker
+            v-model="item.expireDate"
+            type="date"
+            placeholder="选择日期"
+            format="yyyy-MM-dd"
+            value-format="yyyy-MM-dd"
+          />
+        </el-form-item>
+      </el-form>
+      <!-- 汇票号码 -->
+      <el-form label-width="100px">
+        <el-form-item label="汇票号码">
+          <el-input
+            v-model="item.draftNo"
+            class="ipwidth"
+            placeholder="请填写汇票号码"
+            style="width: 220px"
+          />
+        </el-form-item>
+
+        <!-- 金额 -->
+        <el-form-item label="金额">
+          <el-input
+            v-model="item.money"
+            class="ipwidth"
+            placeholder="请填写金额"
+            style="width: 220px"
+            @blur="getMoney(index)"
+            @input="inputMoney(index)"
+          />
+        </el-form-item>
+        <!-- 服务费 -->
+        <el-form-item label="服务费">
+          <el-input
+            v-model="item.serviceMoney"
+            class="ipwidth"
+            placeholder="计算得出服务费"
+            style="width: 220px"
+            @input="inputMoney(index)"
+          />
+        </el-form-item>
+        <!-- 最高贷款额度 -->
+        <el-form-item label="最高贷款额度">
+          <el-input
+            v-model="item.loanLimit"
+            class="ipwidth"
+            placeholder="计算得出最高贷款额度"
+            style="width: 220px"
+            @input="inputMoney(index)"
+          />
+        </el-form-item>
+
+        <el-form-item label="利息">
+          <el-input
+            v-model="item.interest"
+            class="ipwidth"
+            placeholder="计算得出利息"
+            style="width: 220px"
+            @input="inputMoney(index)"
+          />
+        </el-form-item>
+      </el-form>
+      <!-- 出票人 -->
+      <el-form label-width="90px">
+        <el-form-item label="出票人">
+          <el-select
+            v-model="item.drawersId"
+            filterable
+            placeholder="请选择出票人"
+          >
+            <el-option
+              label="新增出票人"
+              value=""
+              style="color: darkorange"
+              @click.native="addDrawer"
+            />
+            <el-option
+              v-for="v in drawersList"
+              :key="v.id"
+              :label="v.name"
+              :value="v.id"
+            />
+          </el-select>
+        </el-form-item>
+        <!-- 承兑人 -->
+        <el-form-item label="承兑人">
+          <el-select
+            v-model="item.acceptorId"
+            filterable
+            placeholder="请选择承兑人"
+          >
+            <el-option
+              v-for="v in acceptorList"
+              :key="v.id"
+              :label="v.name"
+              :value="v.id"
+              @click.native="getRate(item, v)"
+            />
+          </el-select>
+        </el-form-item>
+
+        <!-- 服务费率 -->
+        <el-form-item label="服务费率">
+          <el-input
+            v-model="item.serviceRate"
+            class="ipwidth"
+            placeholder="服务费率"
+            style="width: 220px"
+            @input="inputMoney(index)"
+          />
+        </el-form-item>
+        <!-- 利率 -->
+        <el-form-item label="利率">
+          <el-input
+            v-model="item.interestRate"
+            class="ipwidth"
+            placeholder="利率"
+            style="width: 220px"
+            @input="inputMoney(index)"
+          />
+        </el-form-item>
+      </el-form>
+      <!-- 汇票附件上传 -->
+      <div>
+        <el-row>
+          <el-col style="margin: 0 auto">
+            <div class="titlesa">
+              <span>附件</span>
+              <span
+                style="color: #d05c39"
+              >*支持上传pdf、jpg/jpeg、png格式</span>
+            </div>
+            <div>
+              <FileUpload
+              v-model="item.picUrls"
+              accept=".jpg, .jpeg, .png, .pdf"
+              />
+            </div>
+          </el-col>
+        </el-row>
+
+        <!-- 删除汇票 -->
+        <el-button
+          type="primary"
+          style="width: 100px; height: 50px; margin-top: 50px"
+          @click="deletedraft(index)"
+        >删除汇票</el-button>
+      </div>
+    </div>
+
+    <!-- 新增汇票 -->
+    <div class="commit">
+      <div class="addnew">
+        <el-button type="primary" @click="adddraft">新增汇票</el-button>
+      </div>
+      <div class="addall">
+        <el-button
+          type="warning"
+          style="width: 180px; height: 45px; font-size: 16px"
+          @click="onSubmit"
+        >确认上传
+        </el-button>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import { maxLoanAmount, serviceCharge, interest } from '@/utils/calc'
+import { contractsDetailApi } from '@/api/contracts'
+
+export default {
+  data() {
+    return {
+      dialogVisible: false,
+      disabled: false,
+      drawersList: [],
+      acceptorList: [],
+      contractList: [],
+      filesArray: [], // 汇票图片上传数组
+      picsArray: [], // 合同图片上传数组
+      invoicePicsArray: [], // 发票图片上传数组
+      tradePicsArray: [], // 贸易图片上传数组
+      file: '',
+      form: {
+        contractNo: '',
+        supplierId: 2,
+        name: '',
+        invoicePics: [],
+        pics: [],
+        tradePics: [],
+        /* 汇票的数据 */
+        contractDrafts: [
+          {
+            name: '',
+            draftNo: '',
+            acceptorId: '',
+            drawersId: '',
+            money: '',
+            acceptDate: '',
+            loanLimit: '',
+            serviceRate: '',
+            serviceMoney: '',
+            interestRate: '',
+            interest: '',
+            picUrls: [],
+            expectDiscountDate: '',
+            issueDate: '',
+            expireDate: '',
+            limitTime: '',
+            acceptDateTime: '',
+            expectDiscountDateTime: ''
+          }
+        ]
+      },
+      pickerOptions: {
+        disabledDate(time) {
+          return time.getTime() > Date.now()
+        },
+        shortcuts: [
+          {
+            text: '今天',
+            onClick(picker) {
+              picker.$emit('pick', new Date())
+            }
+          },
+          {
+            text: '昨天',
+            onClick(picker) {
+              const date = new Date()
+              date.setTime(date.getTime() - 3600 * 1000 * 24)
+              picker.$emit('pick', date)
+            }
+          },
+          {
+            text: '一周前',
+            onClick(picker) {
+              const date = new Date()
+              date.setTime(date.getTime() - 3600 * 1000 * 24 * 7)
+              picker.$emit('pick', date)
+            }
+          }
+        ]
+      }
+    }
+  },
+  mounted() {
+    // 获取承兑人列表
+    this.$request({
+      url: '/api/Acceptor/search',
+      method: 'post',
+      data: {
+        pageIndex: 1,
+        pageSize: 100
+      }
+    }).then((res) => {
+      this.acceptorList = res.data.result
+    })
+
+    // 获取出票人列表
+    this.$request({
+      url: '/api/Drawer/search',
+      method: 'post',
+      data: {
+        pageIndex: 1,
+        pageSize: 100
+      }
+    }).then((res) => {
+      this.drawersList = res.data.result
+    })
+
+    /* 调用获取当前的时间 */
+    this.loadTime()
+
+    // 编辑获取详情
+    this.getDetail()
+  },
+  methods: {
+    getDetail() {
+      const id = this.$route.query.id
+      if(!id){
+        return
+      }
+      contractsDetailApi(id).then((res) => {
+        console.log('detail=', res.data)
+        this.form.id   = res.data.id
+        this.form.name = res.data.name
+        this.form.contractNo = res.data.contractNo
+        this.form.invoicePics = res.data.invoicePicList
+        this.form.tradePics = res.data.tradePicList
+        this.form.pics = res.data.picList
+        this.form.contractDrafts = res.data.contractDraft.result
+
+        /*{
+        	//"contractNo": "",
+        	//"supplierId": 2,
+        	//"name": "测试123",
+        	//"invoicePics": [
+        	//	"https://zhengda.oss-cn-chengdu.aliyuncs.com/anlian/2022-07/0fc9d62bd3ee4433ae72e6c6bb978ab0.png"
+        	//],
+        	//"pics": [
+        	//	"https://zhengda.oss-cn-chengdu.aliyuncs.com/anlian/2022-07/9b7c81006bcb434fa7cfadc6e1ec809a.png"
+        	//],
+        	//"tradePics": [
+        	//	"https://zhengda.oss-cn-chengdu.aliyuncs.com/anlian/2022-07/baf3fb3079d143cd9c9a19f52ec68953.png"
+        	//],
+        	"contractDrafts": [{
+        		"name": "测试汇票",
+        		"draftNo": "",
+        		"acceptorId": 51,
+        		"drawersId": 56,
+        		"money": "100",
+        		"acceptDate": "2022-07-31",
+        		"loanLimit": "100.00",
+        		"serviceRate": 0.2,
+        		"serviceMoney": "0.00",
+        		"interestRate": 0.6,
+        		"interest": "0.00",
+        		"picUrls": [
+        			"https://zhengda.oss-cn-chengdu.aliyuncs.com/anlian/2022-07/07d0ea4303f1419ebb7251aa7a7f4235.png"
+        		],
+        		"expectDiscountDate": "2022-07-31",
+        		"issueDate": "2022-07-31",
+        		"expireDate": "2022-07-31",
+        		"limitTime": 0,
+        		"acceptDateTime": 1659242900000,
+        		"expectDiscountDateTime": 1659242900000
+        	}]
+        }*/
+
+      });
+    },
+    inputMoney(index) {
+      this.getloanLimt(index)
+      this.getSerMoney(index)
+      this.getInterMoney(index)
+    },
+    /* 计算最高贷款额度 */
+    getloanLimt(index) {
+      const {
+        money,
+        serviceRate,
+        interestRate,
+        expectDiscountDate,
+        issueDate
+      } = this.form.contractDrafts[index]
+      this.form.contractDrafts[index].loanLimit = maxLoanAmount(
+        money,
+        serviceRate,
+        interestRate,
+        expectDiscountDate,
+        issueDate
+      )
+    },
+    // /* 计算服务费 */
+    getSerMoney(index) {
+      const {
+        loanLimit,
+        serviceRate,
+        expectDiscountDate,
+        issueDate
+      } = this.form.contractDrafts[index]
+      this.form.contractDrafts[index].serviceMoney = serviceCharge(
+        loanLimit,
+        serviceRate,
+        expectDiscountDate,
+        issueDate
+      )
+    },
+    /* 利息*/
+    getInterMoney(index) {
+      const {
+        loanLimit,
+        interestRate,
+        expectDiscountDate,
+        issueDate
+      } = this.form.contractDrafts[index]
+      this.form.contractDrafts[index].interest = interest(
+        loanLimit,
+        interestRate,
+        expectDiscountDate,
+        issueDate
+      )
+    },
+    onSubmit() {
+      this.$request({
+        url: '/api/Contract',
+        method: 'post',
+        data: this.form
+      }).then((res) => {
+        console.log(res)
+        this.$message({
+          message: '上传成功',
+          type: 'success'
+        })
+      })
+    },
+
+    /* 默认时间 */
+    loadTime() {
+      const myDate = new Date()
+      const wk = parseInt(Date.now() / 100000).toFixed(0) * 100000
+      const yy = String(myDate.getFullYear())
+      // let mm = myDate.getMonth() + 1
+      const mm = String(
+        myDate.getMonth() + 1 < 10
+          ? '0' + (myDate.getMonth() + 1)
+          : myDate.getMonth() + 1
+      )
+      const dd = String(
+        myDate.getDate() < 10 ? '0' + myDate.getDate() : myDate.getDate()
+      )
+      const nowDate = yy + '-' + mm + '-' + dd
+      this.form.contractDrafts.forEach((item) => {
+        item.acceptDate = nowDate
+        item.issueDate = nowDate
+        item.expireDate = nowDate
+        item.expectDiscountDate = nowDate
+        item.expectDiscountDateTime = wk
+        item.acceptDateTime = wk
+        const nTime = item.acceptDateTime - item.expectDiscountDateTime
+        item.limitTime = Math.floor(nTime / 86400000)
+      })
+    },
+    getContractNo() {
+      const temporaryList = this.contractList.filter(
+        (item) => item.name === this.form.name
+      )
+      if (this.form.name === '' || temporaryList === '') {
+        this.form.contractNo = ''
+      } else {
+        this.form.contractNo = temporaryList[0].contractNo
+      }
+    },
+
+    /* 获取服务率和利率,承兑人id */
+    getRate(item, acceptor) {
+      item.interestRate = acceptor.interest
+      item.serviceRate  = acceptor.serviceRate
+    },
+    addDrawer() {
+      this.$router.push({
+        path: '../form/addTicketdrawer'
+      })
+    },
+    // 新增汇票
+    adddraft() {
+      this.form.contractDrafts.push({
+        name: '',
+        draftNo: '',
+        acceptorId: '',
+        drawersId: '',
+        money: '',
+        acceptDate: '',
+        loanLimit: '',
+        serviceRate: '',
+        serviceMoney: '',
+        interestRate: '',
+        interest: '',
+        picUrls: [],
+        expectDiscountDate: '',
+        issueDate: '',
+        expireDate: '',
+        limitTime: ''
+      })
+    },
+    // 删除汇票
+    deletedraft(index) {
+      const contractDraftsLength = this.form.contractDrafts.length
+      if (contractDraftsLength > 1) {
+        this.form.contractDrafts.splice(index, 1)
+      } else {
+        this.$message.error('至少一个')
+      }
+    },
+
+    /* 计算时间段 */
+    change(e, number) {}
+
+    // /* 获取金额 */
+    // getMoney(index) {
+    //   this.getloanLimt(index)
+    //   this.getSerMoney(index)
+    //   this.getInterMoney(index)
+    // }
+    // /* 计算最高贷款额度 */
+    // getloanLimt(i) {
+    //   if (
+    //     this.form.contractDrafts[i].money &&
+    //     this.form.contractDrafts[i].serviceRate &&
+    //     this.form.contractDrafts[i].interestRate
+    //   ) {
+    //     this.form.contractDrafts[i].loanLimit = (
+    //       ((this.form.contractDrafts[i].money /
+    //         (this.form.contractDrafts[i].serviceRate +
+    //           this.form.contractDrafts[i].interestRate)) *
+    //         this.form.contractDrafts[i].limitTime) /
+    //         360 +
+    //       1
+    //     ).toFixed(2)
+    //   }
+    // },
+    // /* 计算服务费 */
+    // getSerMoney(i) {
+    //   if (
+    //     this.form.contractDrafts[i].money &&
+    //     this.form.contractDrafts[i].serviceRate &&
+    //     this.form.contractDrafts[i].interestRate
+    //   ) {
+    //     this.form.contractDrafts[i].serviceMoney = (
+    //       ((((this.form.contractDrafts[i].money /
+    //         (this.form.contractDrafts[i].serviceRate +
+    //           this.form.contractDrafts[i].interestRate)) *
+    //         this.form.contractDrafts[i].limitTime) /
+    //         360 +
+    //         1) *
+    //         this.form.contractDrafts[i].serviceRate *
+    //         this.form.contractDrafts[i].limitTime) /
+    //       360
+    //     ).toFixed(2)
+    //   }
+    // },
+    // /* 利息*/
+    // getInterMoney(i) {
+    //   if (
+    //     this.form.contractDrafts[i].money &&
+    //     this.form.contractDrafts[i].serviceRate &&
+    //     this.form.contractDrafts[i].interestRate
+    //   ) {
+    //     this.form.contractDrafts[i].interest = (
+    //       ((((this.form.contractDrafts[i].money /
+    //         (this.form.contractDrafts[i].serviceRate +
+    //           this.form.contractDrafts[i].interestRate)) *
+    //         this.form.contractDrafts[i].limitTime) /
+    //         360 +
+    //         1) *
+    //         this.form.contractDrafts[i].interestRate *
+    //         this.form.contractDrafts[i].limitTime) /
+    //       360
+    //     ).toFixed(2)
+    //   }
+    // }
+  }
+}
+</script>
+
+<style lang="scss">
+.contract {
+  display: flex;
+  justify-content: space-between;
+  margin-bottom: 20px;
+}
+
+.form {
+  display: flex;
+  justify-content: space-around;
+}
+
+.addnew {
+  display: flex;
+  justify-content: flex-end;
+}
+
+.addall {
+  display: flex;
+  justify-content: center;
+}
+
+.commit {
+  margin: 20px 0;
+}
+</style>

+ 286 - 238
src/views/contracts/index.vue

xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd
@@ -3,13 +3,10 @@
     <el-row type="flex" justify="space-between" style="margin-bottom: 20px">
       <!-- 查询表单 -->
       <div class="grid-content bg-purple">
-        <!-- 合同名称/编号、承兑人名称或出票 -->
-        <!-- item.contractNo === this.search ||
-      // //       item.acceptorName === this.search ||
-      // //       item.drawersName === this.search -->
         <el-input
           v-model="formData.name"
           placeholder="合同名称/编号、承兑人名称或出票人名称"
+
           clearable
           style="width:350px"
           @change="Search"
@@ -28,7 +25,7 @@
             <i class="el-icon-arrow-down el-icon--right" />
           </div>
           <el-dropdown-menu slot="dropdown">
-            <el-dropdown-item command="合同状态">合同状态</el-dropdown-item>
+            <el-dropdown-item command="全部">全部</el-dropdown-item>
             <el-dropdown-item command="正常">正常</el-dropdown-item>
             <el-dropdown-item command="删除">删除</el-dropdown-item>
           </el-dropdown-menu>
@@ -46,7 +43,7 @@
             <i class="el-icon-arrow-down el-icon--right" />
           </div>
           <el-dropdown-menu slot="dropdown">
-            <el-dropdown-item command="汇票状态">汇票状态</el-dropdown-item>
+            <el-dropdown-item command="全部">全部</el-dropdown-item>
             <el-dropdown-item command="待审核">待审核</el-dropdown-item>
             <el-dropdown-item command="成功">成功</el-dropdown-item>
             <el-dropdown-item command="失败">失败</el-dropdown-item>
@@ -54,18 +51,20 @@
         </el-dropdown>
       </div>
 
-      <!-- 审核状态 -->
+      <!-- 合同审核状态 -->
       <div class="grid-content bg-purple">
         <el-dropdown @command="handleCommandAuditstatus">
           <div class="pulldown">
-            <span v-if="!Auditstatus" class="el-dropdown-link"> 审核状态 </span>
+            <span v-if="!Auditstatus" class="el-dropdown-link">
+              合同审核状态
+            </span>
             <span v-if="Auditstatus" class="el-dropdown-link">
               {{ Auditstatus }}
             </span>
             <i class="el-icon-arrow-down el-icon--right" />
           </div>
           <el-dropdown-menu slot="dropdown">
-            <el-dropdown-item command="审核状态">审核状态</el-dropdown-item>
+            <el-dropdown-item command="全部">全部</el-dropdown-item>
             <el-dropdown-item command="待审核">待审核</el-dropdown-item>
             <el-dropdown-item command="成功">成功</el-dropdown-item>
             <el-dropdown-item command="失败">失败</el-dropdown-item>
@@ -110,10 +109,25 @@
         prop="contractNo"
         width="155"
       />
-      <el-table-column label="供应商" align="center" prop="supplierName" />
+      <el-table-column
+        label="供应商名称"
+        align="center"
+        prop="supplierName"
+        width="100"
+      />
 
-      <el-table-column label="承兑人" align="center" prop="acceptorName" />
-      <el-table-column label="出票人" align="center" prop="drawersName" />
+      <el-table-column
+        label="承兑人名称"
+        align="center"
+        prop="acceptorName"
+        width="100"
+      />
+      <el-table-column
+        label="出票人名称"
+        align="center"
+        prop="drawersName"
+        width="100"
+      />
       <el-table-column label="汇票状态" align="center" prop="draftStatusText" />
       <el-table-column
         label="合同状态"
@@ -122,13 +136,14 @@
       />
       <el-table-column
         class-name="status-col"
-        label="审核状态"
+        label="合同审核状态"
         align="center"
         prop="statusText"
+        width="120"
       />
       <el-table-column
         align="center"
-        label="时间"
+        label="上传日期"
         prop="createdAt"
         width="155"
       />
@@ -143,20 +158,32 @@
             type="primary"
             style="cursor: pointer"
             @click="tapDetail(scope.row.id)"
-          >查看详情</el-tag>
-          <el-tag
-           v-permission="['salesman','admin']"
+            >查看详情</el-tag
+          >
+          &nbsp;<el-tag
+            v-permission="['salesman', 'admin']"
             type="success"
             style="cursor: pointer"
+            v-if="scope.row.status == 0"
             @click="Ssuccessed(scope.row.id)"
           >
-            审核成功</el-tag>
-          <el-tag
-           v-permission="['salesman','admin']"
+            审核成功</el-tag
+          >
+          &nbsp;<el-tag
+            v-permission="['salesman', 'admin']"
             type="danger"
             style="cursor: pointer"
+            v-if="scope.row.status == 0"
             @click="Sfailed(scope.row.id)"
-          >审核失败
+            >审核失败
+          </el-tag>
+          &nbsp;<el-tag
+            v-permission="['supplier']"
+            type="danger"
+            style="cursor: pointer"
+            v-show="scope.row.status == 2"
+            @click="editNewContract(scope.row)"
+            >重新提交
           </el-tag>
         </template>
       </el-table-column>
@@ -168,18 +195,21 @@
             v-permission="['supplier']"
             type="primary"
             @click="addNewContract"
-          >上传合同</el-button>
-		  <el-button
-		    v-permission="['salesman','admin']"
-		    type="primary"
-		    @click="successed"
-		  >审核成功</el-button>
+            >上传合同</el-button
+          >
+          <el-button
+            v-permission="['salesman', 'admin']"
+            type="primary"
+            @click="successed"
+            >审核成功</el-button
+          >
           <el-button
-            v-permission="['salesman','admin']"
+            v-permission="['salesman', 'admin']"
             type="primary"
             @click="failed"
-          >审核失败</el-button>
-         
+            >审核失败</el-button
+          >
+
           <el-button type="primary" @click="Exports">批量导出</el-button>
           <el-button type="success" @click="recover">恢复</el-button>
           <el-button type="danger" @click="deleted">删除</el-button>
@@ -195,7 +225,7 @@
             margin: 0 20px;
           "
           @click="jumpFirstPage"
-        >首页
+          >首页
         </el-button>
         <el-pagination
           ref="pagination"
@@ -217,7 +247,7 @@
             margin: 0 20px;
           "
           @click="jumpLastPage"
-        >尾页
+          >尾页
         </el-button>
       </div>
     </div>
@@ -225,32 +255,32 @@
 </template>
 
 <script>
-import { dataConversionUtil } from '../../utils/Excel.js'
-import { contractsPageApi } from '@/api/contracts'
+import { dataConversionUtil } from "../../utils/Excel.js";
+import { contractsPageApi, contractsExportApi } from "@/api/contracts";
 export default {
   filters: {
     statusFilter(status) {
       const statusMap = {
-        published: 'success',
-        draft: 'gray',
-        deleted: 'danger'
-      }
-      return statusMap[status]
-    }
+        published: "success",
+        draft: "gray",
+        deleted: "danger",
+      };
+      return statusMap[status];
+    },
   },
   data() {
     return {
       // 表单数据
       formData: {
-        startTime: '',
-        endTime: '',
-        name: '', // 合同名称
-        contractNo: '', // 合同编码
-        supplierName: '', // 供应商
-        acceptorName: '', // 承兑人
-        contractStatusText: '', // 合同状态
-        contractStatus: '',
-        draftStatus: ''
+        startTime: "",
+        endTime: "",
+        name: "", // 合同名称
+        contractNo: "", // 合同编码
+        supplierName: "", // 供应商
+        acceptorName: "", // 承兑人
+        contractStatusText: "", // 合同状态
+        contractStatus: "",
+        draftStatus: "",
       },
       srcList: [],
       list: [],
@@ -259,338 +289,357 @@ export default {
       /* 总条数 */
       total: 20,
       listLoading: false,
-      status: '',
-      hpstatus: '',
-      Auditstatus: '',
-      search: '',
+      status: "",
+      hpstatus: "",
+      Auditstatus: "",
+      search: "",
       /* 当前页数 */
       currentPage: 1,
       /* 每页显示个数 */
       pagesize: 10,
-      checked: '',
+      checked: "",
       pickerOptions: {
         shortcuts: [
           {
-            text: '最近一周',
+            text: "最近一周",
             onClick(picker) {
-              const end = new Date()
-              const start = new Date()
-              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
-              picker.$emit('pick', [start, end])
-            }
+              const end = new Date();
+              const start = new Date();
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
+              picker.$emit("pick", [start, end]);
+            },
           },
           {
-            text: '最近一个月',
+            text: "最近一个月",
             onClick(picker) {
-              const end = new Date()
-              const start = new Date()
-              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
-              picker.$emit('pick', [start, end])
-            }
+              const end = new Date();
+              const start = new Date();
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
+              picker.$emit("pick", [start, end]);
+            },
           },
           {
-            text: '最近三个月',
+            text: "最近三个月",
             onClick(picker) {
-              const end = new Date()
-              const start = new Date()
-              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
-              picker.$emit('pick', [start, end])
-            }
-          }
-        ]
+              const end = new Date();
+              const start = new Date();
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
+              picker.$emit("pick", [start, end]);
+            },
+          },
+        ],
       },
-      value2: ''
-    }
+      value2: "",
+    };
   },
   mounted() {
-    this.checked = this.$store.state.user.checked
-    this.getData()
+    this.checked = this.$store.state.user.checked;
+    this.getData();
   },
   methods: {
     /* ajax发请求获取列表数据 */
     getData(searchForm = {}) {
       const params = {
         pageIndex: this.currentPage,
-        pageSize: this.pagesize
-      }
+        pageSize: this.pagesize,
+      };
       contractsPageApi({ ...params, ...searchForm }).then((res) => {
-        const { data } = res
-        this.filter = params
-        this.temporaryList = data.result
-        this.srcList = data.result
-        this.total = res.data.total
-      })
+        const { data } = res;
+        this.filter = params;
+        this.temporaryList = data.result;
+        this.srcList = data.result;
+        this.total = res.data.total;
+      });
     },
 
     addNewContract() {
       this.$router.push({
-        path: 'contracts/addcontract'
-      })
+        path: "contracts/addcontract",
+      });
+    },
+    editNewContract(row) {
+      this.$router.push({
+        path: "contracts/addcontract?id=" + row.id,
+      });
     },
     tapDetail(id) {
-      console.log(id)
+      console.log(id);
       this.$router.push({
-        path: '/detail',
+        path: "/detail",
         query: {
-          id: id
-        }
-      })
+          id: id,
+        },
+      });
     },
     successed() {
       // let successed = this.list.filter(item => item.id === id)
-      const ids = Array.from(this.multipleSelection, ({ id }) => id)
+      const ids = Array.from(this.multipleSelection, ({ id }) => id);
       this.$request({
-        url: '/api/Contract/manage',
-        method: 'post',
+        url: "/api/Contract/manage",
+        method: "post",
         data: {
           ids: ids,
-          operateType: 3
-        }
+          operateType: 3,
+        },
       }).then((res) => {
         if (res.code === 200) {
           this.$message({
-            type: 'success',
-            message: res.msg
-          })
-		  this.getData()
+            type: "success",
+            message: res.msg,
+          });
+          this.getData();
         } else {
           this.$message({
-            type: 'danger',
-            message: res.msg
-          })
-		  this.getData()
+            type: "danger",
+            message: res.msg,
+          });
+          this.getData();
         }
-      })
+      });
     },
     Ssuccessed(id) {
       this.$request({
-        url: '/api/Contract/manage',
-        method: 'post',
+        url: "/api/Contract/manage",
+        method: "post",
         data: {
           ids: [id],
-          operateType: 3
-        }
+          operateType: 3,
+        },
       }).then((res) => {
         if (res.code === 200) {
           this.$message({
-            type: 'success',
-            message: res.msg
-          })
-		  this.getData()
+            type: "success",
+            message: res.msg,
+          });
+          this.getData();
         } else {
           this.$message({
-            type: 'danger',
-            message: res.msg
-          })
-		  this.getData()
+            type: "danger",
+            message: res.msg,
+          });
+          this.getData();
         }
-      })
+      });
     },
     failed() {
-      // let failed = this.list.filter(item => item.id === id)
-      const ids = Array.from(this.multipleSelection, ({ id }) => id)
+      const ids = Array.from(this.multipleSelection, ({ id }) => id);
       this.$request({
-        url: '/api/Contract/manage',
-        method: 'post',
+        url: "/api/Contract/manage",
+        method: "post",
         data: {
           ids: ids,
-          operateType: 4
-        }
+          operateType: 4,
+        },
       }).then((res) => {
         if (res.code === 200) {
           this.$message({
-            type: 'success',
-            message: res.msg
-          })
-		  this.getData()
+            type: "success",
+            message: res.msg,
+          });
+          this.getData();
         } else {
           this.$message({
-            type: 'danger',
-            message: res.msg
-          })
-		  this.getData()
+            type: "danger",
+            message: res.msg,
+          });
+          this.getData();
         }
-      })
+      });
     },
     Sfailed(id) {
       this.$request({
-        url: '/api/Contract/manage',
-        method: 'post',
+        url: "/api/Contract/manage",
+        method: "post",
         data: {
           ids: [id],
-          operateType: 4
-        }
+          operateType: 4,
+        },
       }).then((res) => {
         if (res.code === 200) {
           this.$message({
-            type: 'success',
-            message: res.msg
-          })
-		  this.getData()
+            type: "success",
+            message: res.msg,
+          });
+          this.getData();
         } else {
           this.$message({
-            type: 'danger',
-            message: res.msg
-          })
-		  this.getData()
+            type: "danger",
+            message: res.msg,
+          });
+          this.getData();
         }
-      })
+      });
     },
     recover(id) {
-      const ids = Array.from(this.multipleSelection, ({ id }) => id)
+      const ids = Array.from(this.multipleSelection, ({ id }) => id);
       this.$request({
-        url: '/api/Contract/manage',
-        method: 'post',
+        url: "/api/Contract/manage",
+        method: "post",
         data: {
           ids: ids,
-          operateType: 2
-        }
+          operateType: 2,
+        },
       }).then((res) => {
         if (res.code === 200) {
           this.$message({
-            type: 'success',
-            message: res.msg
-          })
-		  this.getData()
+            type: "success",
+            message: res.msg,
+          });
+          this.getData();
         } else {
           this.$message({
-            type: 'danger',
-            message: res.msg
-          })
-		  this.getData()
+            type: "danger",
+            message: res.msg,
+          });
+          this.getData();
         }
-      })
+      });
     },
     deleted() {
-      const ids = Array.from(this.multipleSelection, ({ id }) => id)
+      const ids = Array.from(this.multipleSelection, ({ id }) => id);
       this.$request({
-        url: '/api/Contract/manage',
-        method: 'post',
+        url: "/api/Contract/manage",
+        method: "post",
         data: {
           ids: ids,
-          operateType: 1
-        }
+          operateType: 1,
+        },
       }).then((res) => {
         if (res.code === 200) {
           this.$message({
-            type: 'success',
-            message: res.msg
-          })
-		  this.getData()
+            type: "success",
+            message: res.msg,
+          });
+          this.getData();
         } else {
           this.$message({
-            type: 'danger',
-            message: res.msg
-          })
-		  this.getData()
+            type: "danger",
+            message: res.msg,
+          });
+          this.getData();
         }
-      })
+      });
     },
     // 合同状态查询
     handleCommand(command) {
-      this.status = command
-      if (command === '正常') {
-        this.formData.contractStatus = 2
+      this.status = command;
+      if (command === "正常") {
+        this.formData.contractStatus = 2;
       }
-      if (command === '删除') {
-        this.formData.contractStatus = 1
+      if (command === "删除") {
+        this.formData.contractStatus = 1;
       }
-      if (command === '合同状态') {
-        this.formData.contractStatus = 0
+      if (command === "全部") {
+        this.formData.contractStatus = 0;
       }
-      this.currentPage = 1
-      this.searchForm = { ...this.formData }
-      this.getData(this.searchForm)
+      this.currentPage = 1;
+      this.searchForm = { ...this.formData };
+      this.getData(this.searchForm);
     },
 
     // 汇票状态查询
     handlehpCommand(command) {
-      this.hpstatus = command
-      if (command === '汇票状态') {
-        this.formData.draftStatus = 0
+      this.hpstatus = command;
+      if (command === "全部") {
+        this.formData.draftStatus = 0;
       }
-      if (command === '待审核') {
-        this.formData.draftStatus = 1
+      if (command === "待审核") {
+        this.formData.draftStatus = 1;
       }
-      if (command === '成功') {
-        this.formData.draftStatus = 2
+      if (command === "成功") {
+        this.formData.draftStatus = 2;
       }
-      if (command === '失败') {
-        this.formData.draftStatus = 3
+      if (command === "失败") {
+        this.formData.draftStatus = 3;
       }
-      if (command === '删除') {
-        this.formData.draftStatus = 4
+      if (command === "删除") {
+        this.formData.draftStatus = 4;
       }
-      this.currentPage = 1
-      this.searchForm = { ...this.formData }
-      this.getData(this.searchForm)
+      this.currentPage = 1;
+      this.searchForm = { ...this.formData };
+      this.getData(this.searchForm);
     },
 
     // 合同审核状态查询
     handleCommandAuditstatus(command) {
-      this.Auditstatus = command
-      if (command === '审核状态') {
-        this.formData.approveStatus = 0
+      this.Auditstatus = command;
+      if (command === "全部") {
+        this.formData.approveStatus = 0;
       }
-      if (command === '待审核') {
-        this.formData.approveStatus = 1
+      if (command === "待审核") {
+        this.formData.approveStatus = 1;
       }
-      if (command === '成功') {
-        this.formData.approveStatus = 2
+      if (command === "成功") {
+        this.formData.approveStatus = 2;
       }
-      if (command === '失败') {
-        this.formData.approveStatus = 3
+      if (command === "失败") {
+        this.formData.approveStatus = 3;
       }
-      this.currentPage = 1
-      this.searchForm = { ...this.formData }
-      this.getData(this.searchForm)
+      this.currentPage = 1;
+      this.searchForm = { ...this.formData };
+      this.getData(this.searchForm);
     },
 
     // 日期审核状态查询
-    startEndTime() {
-      this.formData.startTime = this.value2[0]
-      this.formData.endTime = this.value2[1]
-      this.currentPage = 1
-      this.searchForm = { ...this.formData }
-      this.getData(this.searchForm)
+    startEndTime(item) {
+      if (item == null) {
+        item = [];
+         this.formData.startTime = ''
+        this.formData.endTime = '';
+         this.currentPage = 1;
+        this.searchForm = { ...this.formData };
+        this.getData(this.searchForm);
+      } else {
+        this.formData.startTime = this.value2[0];
+        this.formData.endTime = this.value2[1];
+        this.currentPage = 1;
+        this.searchForm = { ...this.formData };
+        this.getData(this.searchForm);
+      }
     },
     // 合同名称/编号/承兑人名称/出票查询
     Search() {
-      this.currentPage = 1
-      this.searchForm = { ...this.formData }
-      this.getData(this.searchForm)
+      this.currentPage = 1;
+      this.searchForm = { ...this.formData };
+      this.getData(this.searchForm);
     },
 
     handleSelectionChange(data) {
-      this.multipleSelection = data
-      console.log(this.multipleSelection)
+      this.multipleSelection = data;
+      console.log(this.multipleSelection);
     },
     handleAll(data) {
-      this.multipleSelection = data
-      console.log(this.multipleSelection)
+      this.multipleSelection = data;
+      console.log(this.multipleSelection);
     },
 
     /* 分页功能,改变当前页 */
     handleCurrentChange(val) {
-      this.currentPage = val
-      this.getData(this.searchForm)
+      this.currentPage = val;
+      this.getData(this.searchForm);
     },
 
     /* 分页功能:去首页 */
     jumpFirstPage() {
-      this.$refs.pagination.handleCurrentChange(1)
-      this.$emit('handleCurrentChange', 1)
+      this.$refs.pagination.handleCurrentChange(1);
+      this.$emit("handleCurrentChange", 1);
     },
 
     /* 分页功能:去尾页 */
     jumpLastPage() {
-      const font = this.$refs.pagination
-      const cpage = Math.ceil(font.total / font.pageSize)
-      font.handleCurrentChange(cpage)
+      const font = this.$refs.pagination;
+      const cpage = Math.ceil(font.total / font.pageSize);
+      font.handleCurrentChange(cpage);
     },
 
     Exports() {
-      var tableHeader = [
+      contractsExportApi({
+        supplierId: 1,
+      }).then((res) => {
+        console.log(res);
+      });
+
+      /*var tableHeader = [
         [
           '序号',
           '合同名称',
@@ -619,10 +668,10 @@ export default {
       })
       dataConversionUtil.dataToExcel('合同列表', tableHeader, dataList)
       this.$message.success('导出成功!')
-    }
-  }
-}
-
+      */
+    },
+  },
+};
 </script>
 <style lang="scss">
 .pulldown {
@@ -658,4 +707,3 @@ export default {
   padding: 20px;
 }
 </style>
-

+ 0 - 137
src/views/contracts/list.vue

xqd
@@ -1,137 +0,0 @@
-<template>
-  <div class="app-container">
-    <!-- 搜索表单 -->
-    <div class="result-filter">
-      <ListFilterForm @filter="onFilter" />
-    </div>
-    <!-- 表格内容 -->
-    <div class="result-table">
-      <!-- 表格按钮 -->
-      <div class="result-table-btns">
-        <el-button
-          type="primary"
-          @click="onAdd"
-        >新增</el-button>
-      </div>
-      <!-- 表格 -->
-      <ListTable
-        :loading="loading"
-        :data="tableData"
-        :pagination="pagination"
-        :selected-rows.sync="selectedRows"
-        @filter="onFilter"
-        @onShow="onShow"
-        @onEdit="onEdit"
-        @onDelete="onDelete"
-        @onAudit="onAudit"
-      />
-    </div>
-  </div>
-</template>
-
-<script>
-import { contractsPageApi, contractsManageApi } from '@/api/contracts'
-import ListTable from './components/ListTable.vue'
-import ListFilterForm from './components/ListFilterForm.vue'
-export default {
-  components: {
-    ListTable,
-    ListFilterForm
-  },
-  data() {
-    return {
-      tableData: [],
-      pagination: {
-        pageIndex: 0,
-        total: 0,
-        pageSize: 10
-      },
-      filter: {
-        pageIndex: 1,
-        pageSize: 10
-      },
-      selectedRows: [],
-      loading: false
-    }
-  },
-  mounted() {
-    this.loadData()
-  },
-  methods: {
-    onFilter(filter = {}) {
-      this.loadData(filter)
-    },
-    loadData(filtter = {}) {
-      const params = {
-        ...this.filter,
-        ...filtter
-      }
-      this.loading = true
-      contractsPageApi(params).then(res => {
-        const { data } = res
-        this.filter = params
-        this.tableData = data.result
-        this.pagination = {
-          ...this.pagination,
-          pageIndex: params.pageIndex,
-          pageSize: params.pageSize,
-          total: data.total
-        }
-        this.loading = false
-      }).catch(err => {
-        this.loading = false
-        console.log(err)
-      })
-    },
-    // 添加
-    onAdd() {
-      console.log('onAdd')
-    },
-    // 详情
-    onShow(row) {
-      console.log(row)
-    },
-    // 修改
-    onEdit(row) {
-      console.log(row)
-    },
-    // 删除
-    onDelete(row) {
-      console.log(row)
-    },
-    // 审核
-    onAudit(row) {
-      console.log(row)
-      const params = {
-        id: [row.id],
-        operateType: 3
-      }
-      this.loading = true
-      contractsManageApi(params).then(res => {
-        this.loading = false
-        this.$message({
-          type: 'success',
-          message: res.msg
-        })
-      }).catch(err => {
-        this.loading = false
-        console.log(err)
-        this.$message({
-          type: 'danger',
-          message: err.msg
-        })
-      })
-    }
-  }
-}
-</script>
-
-<style scoped>
-.result-table{
-  background-color: #ffffff;
-}
-.result-table-btns{
-  text-align: right;
-  margin-bottom: 15px;
-}
-</style>

+ 724 - 0
src/views/contracts/new_file copy.vue

xqd
@@ -0,0 +1,724 @@
+<template>
+  <div class="app-container">
+    <el-card class="box-card" style="">
+      <div class="contract">
+        <div>
+          <p>合同名称</p>
+          <el-input
+            v-model="form.name"
+            placeholder="请输入合同名称"
+            style="width: 500px"
+            clearable
+            @input="getContractNo"
+          />
+        </div>
+        <div>
+          <p>合同编号</p>
+          <el-input
+            v-model="form.contractNo"
+            placeholder="请输入合同编号"
+            style="width: 500px"
+            disabled
+          />
+        </div>
+      </div>
+      <!-- 合同附件图片 -->
+      <div class="titlesa">
+        <span>合同附件</span>
+        <span style="color: #d05c39">*支持上传pdf、jpg/jpeg、png格式</span>
+      </div>
+      <div>
+        <div>
+          <Upload v-model="form.pics" />
+          <!-- <el-upload
+            action="https://ht.9026.com/api/File"
+            list-type="picture-card"
+            :on-success="handlepics"
+          >
+            <i class="el-icon-plus" />
+          </el-upload>
+
+          <el-dialog :visible.sync="dialogVisible">
+            <img width="100%" :src="form.pics">
+          </el-dialog> -->
+        </div>
+      </div>
+      <!-- 发票附件图片 -->
+      <div class="titlesa">
+        <span>发票附件</span>
+        <span style="color: #d05c39">*支持上传pdf、jpg/jpeg、png格式</span>
+      </div>
+      <div>
+        <Upload v-model="form.invoicePics" />
+        <!-- <el-upload
+          action="https://ht.9026.com/api/File"
+          list-type="picture-card"
+          :on-success="handleinvoicePics"
+        >
+          <i class="el-icon-plus" />
+        </el-upload>
+        <el-dialog :visible.sync="dialogVisible">
+          <img width="100%" :src="form.invoicePics">
+        </el-dialog> -->
+      </div>
+      <!-- 贸易附件图片 -->
+      <div class="titlesa">
+        <span>贸易合同</span>
+        <span style="color: #d05c39">*支持上传pdf、jpg/jpeg、png格式</span>
+      </div>
+      <div>
+        <Upload v-model="form.tradePics" />
+        <!-- <el-upload
+          action="https://ht.9026.com/api/File"
+          list-type="picture-card"
+          :on-success="handletradePics"
+        >
+          <i class="el-icon-plus" />
+        </el-upload>
+        <el-dialog :visible.sync="dialogVisible">
+          <img width="100%" :src="form.tradePics">
+        </el-dialog> -->
+      </div>
+    </el-card>
+
+    <!-- 汇票模块 -->
+    <div
+      v-for="(item, index) in form.contractDrafts"
+      :key="item.id"
+      class="form"
+      style="
+        margin: 20px;
+        border: 1px solid #c0c0c0;
+        padding: 10px;
+        border-radius: 10px;
+      "
+    >
+      <!-- 汇票名称 -->
+      <el-form ref="form" :model="item" label-width="90px">
+        <el-form-item label="汇票名称">
+          <el-input
+            v-model="item.name"
+            class="ipwidth"
+            placeholder="请填写汇票名称"
+            style="width: 220px"
+          />
+        </el-form-item>
+        <!-- 预计贴现日 -->
+        <el-form-item label="预计贴现日">
+          <el-date-picker
+            v-model="item.expectDiscountDate"
+            type="date"
+            placeholder="选择日期"
+            value-format="yyyy-MM-dd"
+            @change="inputMoney(index, 4)"
+          />
+        </el-form-item>
+        <!-- 出票日期 -->
+        <el-form-item label="出票日期">
+          <el-date-picker
+            v-model="item.acceptDate"
+            type="date"
+            placeholder="选择日期"
+            class="ipwidth"
+          />
+        </el-form-item>
+        <!-- 承兑日期 -->
+        <el-form-item label="承兑日期">
+          <el-date-picker
+            v-model="item.issueDate"
+            type="date"
+            placeholder="选择日期"
+            default-value
+            value-format="yyyy-MM-dd"
+            @change="inputMoney(index, 1)"
+          />
+        </el-form-item>
+        <!-- 到期日期 -->
+        <el-form-item label="到期日期">
+          <el-date-picker
+            v-model="item.expireDate"
+            type="date"
+            placeholder="选择日期"
+          />
+        </el-form-item>
+      </el-form>
+      <!-- 汇票号码 -->
+      <el-form ref="form" :model="form" label-width="100px">
+        <el-form-item label="汇票号码">
+          <el-input
+            v-model="item.draftNo"
+            class="ipwidth"
+            placeholder="请填写汇票号码"
+            style="width: 220px"
+          />
+        </el-form-item>
+
+        <!-- 金额 -->
+        <el-form-item label="金额">
+          <el-input
+            v-model="item.money"
+            class="ipwidth"
+            placeholder="请填写金额"
+            style="width: 220px"
+            @blur="getMoney(index)"
+            @input="inputMoney(index)"
+          />
+        </el-form-item>
+        <!-- 服务费 -->
+        <el-form-item label="服务费">
+          <el-input
+            v-model="item.serviceMoney"
+            class="ipwidth"
+            placeholder="计算得出服务费"
+            style="width: 220px"
+            @input="inputMoney(index)"
+          />
+        </el-form-item>
+        <!-- 最高贷款额度 -->
+        <el-form-item label="最高贷款额度">
+          <el-input
+            v-model="item.loanLimit"
+            class="ipwidth"
+            placeholder="计算得出最高贷款额度"
+            style="width: 220px"
+            @input="inputMoney(index)"
+          />
+        </el-form-item>
+
+        <el-form-item label="利息">
+          <el-input
+            v-model="item.interest"
+            class="ipwidth"
+            placeholder="计算得出利息"
+            style="width: 220px"
+            @input="inputMoney(index)"
+          />
+        </el-form-item>
+      </el-form>
+      <!-- 出票人 -->
+      <el-form ref="form" :model="form" label-width="90px">
+        <el-form-item label="出票人">
+          <el-select
+            v-model="form.drawersName"
+            filterable
+            placeholder="请选择出票人"
+          >
+            <el-option
+              label="新增出票人"
+              value=""
+              style="color: darkorange"
+              @click.native="addDrawer"
+            />
+            <el-option
+              v-for="item in drawersName"
+              :key="item.id"
+              :label="item"
+              :value="item"
+              @click.native="getdrawersId(index, item)"
+            />
+          </el-select>
+        </el-form-item>
+        <!-- 承兑人 -->
+        <el-form-item label="承兑人">
+          <el-select
+            v-model="form.acceptorName"
+            filterable
+            placeholder="请选择承兑人"
+          >
+            <el-option
+              v-for="val in acceptorName"
+              :key="val"
+              :label="val"
+              :value="val"
+              @click.native="getRate(index)"
+            />
+          </el-select>
+        </el-form-item>
+
+        <!-- 服务费率 -->
+
+        <el-form-item label="服务费率">
+          <el-input
+            v-model="item.serviceRate"
+            class="ipwidth"
+            placeholder="服务费率"
+            style="width: 220px"
+            @input="inputMoney(index)"
+          />
+        </el-form-item>
+        <!-- 利率 -->
+        <el-form-item label="利率">
+          <el-input
+            v-model="item.interestRate"
+            class="ipwidth"
+            placeholder="利率"
+            style="width: 220px"
+            @input="inputMoney(index)"
+          />
+        </el-form-item>
+      </el-form>
+      <!-- 汇票附件上传 -->
+      <div>
+        <el-row>
+          <el-col style="margin: 0 auto">
+            <div class="titlesa">
+              <span>附件</span>
+              <span
+                style="color: #d05c39"
+              >*支持上传pdf、jpg/jpeg、png格式</span>
+            </div>
+            <div>
+              <el-upload
+                action="https://ht.9026.com/api/File"
+                list-type="picture-card"
+                :on-success="handlepicUrls"
+              >
+                <i class="el-icon-plus" />
+              </el-upload>
+
+              <el-dialog :visible.sync="dialogVisible">
+                <img
+                  width="100%"
+                  :src="form.contractDrafts[0].picUrls"
+                  alt=""
+                >
+              </el-dialog>
+            </div>
+          </el-col>
+        </el-row>
+
+        <!-- 删除汇票 -->
+        <el-button
+          type="primary"
+          style="width: 100px; height: 50px; margin-top: 50px"
+          @click="deletedraft(index)"
+        >删除汇票</el-button>
+      </div>
+    </div>
+    <!-- 新增汇票 -->
+    <div class="commit">
+      <div class="addnew">
+        <el-button type="primary" @click="adddraft">新增汇票</el-button>
+      </div>
+      <div class="addall">
+        <el-button
+          type="warning"
+          style="width: 180px; height: 45px; font-size: 16px"
+          @click="onSubmit"
+        >确认上传
+        </el-button>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import { maxLoanAmount, serviceCharge, interest } from '@/utils/calc'
+export default {
+  data() {
+    return {
+      dialogVisible: false,
+      disabled: false,
+      drawersList: [],
+      acceptorList: [],
+      contractList: [],
+      filesArray: [], // 汇票图片上传数组
+      picsArray: [], // 合同图片上传数组
+      invoicePicsArray: [], // 发票图片上传数组
+      tradePicsArray: [], // 贸易图片上传数组
+      file: '',
+      form: {
+        // 承兑人列表
+        acceptorName: [],
+        // 出票人列表
+        drawersName: [],
+        contractNo: '',
+        supplierId: 2,
+        name: '',
+        invoicePics: [],
+        pics: [],
+        tradePics: [],
+        /* 汇票的数据 */
+        contractDrafts: [
+          {
+            name: '',
+            draftNo: '',
+            acceptorId: '',
+            drawersId: '',
+            money: '',
+            acceptDate: '',
+            loanLimit: '',
+            serviceRate: '',
+            serviceMoney: '',
+            interestRate: '',
+            interest: '',
+            picUrls: [],
+            expectDiscountDate: '',
+            issueDate: '',
+            expireDate: '',
+            limitTime: '',
+            acceptDateTime: '',
+            expectDiscountDateTime: ''
+          }
+        ]
+      },
+      pickerOptions: {
+        disabledDate(time) {
+          return time.getTime() > Date.now()
+        },
+        shortcuts: [
+          {
+            text: '今天',
+            onClick(picker) {
+              picker.$emit('pick', new Date())
+            }
+          },
+          {
+            text: '昨天',
+            onClick(picker) {
+              const date = new Date()
+              date.setTime(date.getTime() - 3600 * 1000 * 24)
+              picker.$emit('pick', date)
+            }
+          },
+          {
+            text: '一周前',
+            onClick(picker) {
+              const date = new Date()
+              date.setTime(date.getTime() - 3600 * 1000 * 24 * 7)
+              picker.$emit('pick', date)
+            }
+          }
+        ]
+      }
+    }
+  },
+  mounted() {
+    this.$request({
+      url: '/api/Contract/search',
+      method: 'post',
+      data: {
+        pageIndex: 1,
+        pageSize: 100
+      }
+    }).then((res) => {
+      this.contractList = res.data.result
+    })
+    this.$request({
+      url: '/api/Acceptor/search',
+      method: 'post',
+      data: {
+        pageIndex: 1,
+        pageSize: 100
+      }
+    }).then((res) => {
+      this.acceptorList = res.data.result
+      this.acceptorName = Array.from(this.acceptorList, ({ name }) => name)
+    })
+    this.$request({
+      url: '/api/Drawer/search',
+      method: 'post',
+      data: {
+        pageIndex: 1,
+        pageSize: 100
+      }
+    }).then((res) => {
+      this.drawersList = res.data.result
+      this.drawersName = Array.from(this.drawersList, ({ name }) => name)
+      // 去除重复的出票人
+      for (var i = 0; i < this.drawersName.length; i++) {
+        // 首次遍历数组
+        for (var j = i + 1; j < this.drawersName.length; j++) {
+          // 再次遍历数组
+          if (this.drawersName[i] === this.drawersName[j]) {
+            // 判断连个值是否相等
+            this.drawersName.splice(j, 1) // 相等删除后者
+            j--
+          }
+        }
+      }
+    })
+    /* 调用获取当前的时间 */
+    this.loadTime()
+  },
+  methods: {
+    inputMoney(index) {
+      this.getloanLimt(index)
+      this.getSerMoney(index)
+      this.getInterMoney(index)
+    },
+    /* 计算最高贷款额度 */
+    getloanLimt(index) {
+      const {
+        money,
+        serviceRate,
+        interestRate,
+        expectDiscountDate,
+        issueDate
+      } = this.form.contractDrafts[index]
+      this.form.contractDrafts[index].loanLimit = maxLoanAmount(
+        money,
+        serviceRate,
+        interestRate,
+        expectDiscountDate,
+        issueDate
+      )
+    },
+    // /* 计算服务费 */
+    getSerMoney(index) {
+      const {
+        loanLimit,
+        serviceRate,
+        expectDiscountDate,
+        issueDate
+      } = this.form.contractDrafts[index]
+      this.form.contractDrafts[index].serviceMoney = serviceCharge(
+        loanLimit,
+        serviceRate,
+        expectDiscountDate,
+        issueDate
+      )
+    },
+    /* 利息*/
+    getInterMoney(index) {
+      const {
+        loanLimit,
+        interestRate,
+        expectDiscountDate,
+        issueDate
+      } = this.form.contractDrafts[index]
+      this.form.contractDrafts[index].interest = interest(
+        loanLimit,
+        interestRate,
+        expectDiscountDate,
+        issueDate
+      )
+    },
+    onSubmit() {
+      this.$request({
+        url: '/api/Contract',
+        method: 'post',
+        data: this.form
+      }).then((res) => {
+        console.log(res)
+        this.$message({
+          message: '上传成功',
+          type: 'success'
+        })
+      })
+    },
+
+    /* 默认时间 */
+    loadTime() {
+      const myDate = new Date()
+      const wk = parseInt(Date.now() / 100000).toFixed(0) * 100000
+      const yy = String(myDate.getFullYear())
+      // let mm = myDate.getMonth() + 1
+      const mm = String(
+        myDate.getMonth() + 1 < 10
+          ? '0' + (myDate.getMonth() + 1)
+          : myDate.getMonth() + 1
+      )
+      const dd = String(
+        myDate.getDate() < 10 ? '0' + myDate.getDate() : myDate.getDate()
+      )
+      const nowDate = yy + '-' + mm + '-' + dd
+      this.form.contractDrafts.forEach((item) => {
+        item.acceptDate = nowDate
+        item.issueDate = nowDate
+        item.expireDate = nowDate
+        item.expectDiscountDate = nowDate
+        item.expectDiscountDateTime = wk
+        item.acceptDateTime = wk
+        const nTime = item.acceptDateTime - item.expectDiscountDateTime
+        item.limitTime = Math.floor(nTime / 86400000)
+      })
+    },
+
+    /* 合同附件上传 */
+    handlepics(res) {
+      // 解构
+      const { file } = res.data
+      this.picsArray.push(file)
+      this.form.pics = this.picsArray
+    },
+    /* 发票附件上传 */
+    handleinvoicePics(res) {
+      const { file } = res.data
+      this.invoicePicsArray.push(file)
+      this.form.invoicePics = this.invoicePicsArray
+    },
+    /* 贸易附件上传 */
+    handletradePics(res) {
+      const { file } = res.data
+      this.tradePicsArray.push(file)
+      this.form.tradePics = this.tradePicsArray
+    },
+
+    /* 上传图片到浏览器成功回调 */
+    handlepicUrls(res) {
+      // 解构
+      const { file } = res.data
+      this.filesArray.push(file)
+      this.form.contractDrafts[0].picUrls = this.filesArray
+    },
+    getContractNo() {
+      const temporaryList = this.contractList.filter(
+        (item) => item.name === this.form.name
+      )
+      if (this.form.name === '' || temporaryList === '') {
+        this.form.contractNo = ''
+      } else {
+        this.form.contractNo = temporaryList[0].contractNo
+      }
+    },
+
+    /* 获取服务率和利率,承兑人id */
+    getRate(index) {
+      const list = this.acceptorList.filter(
+        (item) => item.name === this.form.acceptorName
+      )
+      console.log(list)
+      this.form.contractDrafts[index].acceptorId = list[index].id
+      this.form.contractDrafts[index].interestRate = list[index].interest
+      this.form.contractDrafts[index].serviceRate = list[index].serviceRate
+    },
+    // 获取出票人id
+    getdrawersId(index, name) {
+      const drawers = this.drawersList.filter((item) => item.name === name)
+      console.log(drawers)
+      this.form.contractDrafts[index].drawersId = drawers[index].id
+      console.log(drawers[index].id)
+    },
+    addDrawer() {
+      this.$router.push({
+        path: '/form/addTicketdrawer'
+      })
+    },
+    // 新增汇票
+    adddraft() {
+      this.form.contractDrafts.push({
+        name: '',
+        draftNo: '',
+        acceptorId: '',
+        drawersId: '',
+        money: '',
+        acceptDate: '',
+        loanLimit: '',
+        serviceRate: '',
+        serviceMoney: '',
+        interestRate: '',
+        interest: '',
+        picUrls: [],
+        expectDiscountDate: '',
+        issueDate: '',
+        expireDate: '',
+        limitTime: ''
+      })
+    },
+    // 删除汇票
+    deletedraft(index) {
+      const contractDraftsLength = this.form.contractDrafts.length
+      if (contractDraftsLength > 1) {
+        this.form.contractDrafts.splice(index, 1)
+      } else {
+        this.$message.error('至少一个')
+      }
+    },
+
+    /* 计算时间段 */
+    change(e, number) {}
+
+    // /* 获取金额 */
+    // getMoney(index) {
+    //   this.getloanLimt(index)
+    //   this.getSerMoney(index)
+    //   this.getInterMoney(index)
+    // }
+    // /* 计算最高贷款额度 */
+    // getloanLimt(i) {
+    //   if (
+    //     this.form.contractDrafts[i].money &&
+    //     this.form.contractDrafts[i].serviceRate &&
+    //     this.form.contractDrafts[i].interestRate
+    //   ) {
+    //     this.form.contractDrafts[i].loanLimit = (
+    //       ((this.form.contractDrafts[i].money /
+    //         (this.form.contractDrafts[i].serviceRate +
+    //           this.form.contractDrafts[i].interestRate)) *
+    //         this.form.contractDrafts[i].limitTime) /
+    //         360 +
+    //       1
+    //     ).toFixed(2)
+    //   }
+    // },
+    // /* 计算服务费 */
+    // getSerMoney(i) {
+    //   if (
+    //     this.form.contractDrafts[i].money &&
+    //     this.form.contractDrafts[i].serviceRate &&
+    //     this.form.contractDrafts[i].interestRate
+    //   ) {
+    //     this.form.contractDrafts[i].serviceMoney = (
+    //       ((((this.form.contractDrafts[i].money /
+    //         (this.form.contractDrafts[i].serviceRate +
+    //           this.form.contractDrafts[i].interestRate)) *
+    //         this.form.contractDrafts[i].limitTime) /
+    //         360 +
+    //         1) *
+    //         this.form.contractDrafts[i].serviceRate *
+    //         this.form.contractDrafts[i].limitTime) /
+    //       360
+    //     ).toFixed(2)
+    //   }
+    // },
+    // /* 利息*/
+    // getInterMoney(i) {
+    //   if (
+    //     this.form.contractDrafts[i].money &&
+    //     this.form.contractDrafts[i].serviceRate &&
+    //     this.form.contractDrafts[i].interestRate
+    //   ) {
+    //     this.form.contractDrafts[i].interest = (
+    //       ((((this.form.contractDrafts[i].money /
+    //         (this.form.contractDrafts[i].serviceRate +
+    //           this.form.contractDrafts[i].interestRate)) *
+    //         this.form.contractDrafts[i].limitTime) /
+    //         360 +
+    //         1) *
+    //         this.form.contractDrafts[i].interestRate *
+    //         this.form.contractDrafts[i].limitTime) /
+    //       360
+    //     ).toFixed(2)
+    //   }
+    // }
+  }
+}
+</script>
+
+<style lang="scss">
+.contract {
+  display: flex;
+  justify-content: space-between;
+  margin-bottom: 20px;
+}
+
+.form {
+  display: flex;
+  justify-content: space-around;
+}
+
+.addnew {
+  display: flex;
+  justify-content: flex-end;
+}
+
+.addall {
+  display: flex;
+  justify-content: center;
+}
+
+.commit {
+  margin: 20px 0;
+}
+</style>

+ 440 - 592
src/views/contracts/new_file.vue

xqd xqd xqd xqd xqd xqd
@@ -1,18 +1,18 @@
 <template>
   <div class="app-container">
     <el-card class="box-card" style="padding: 20px 10px; margin-bottom: 20px">
-      <div class="contract">
-        <div>
+      <el-row class="contract">
+        <el-col :span="12">
           <p>合同名称</p>
           <el-input
             v-model="form.name"
             placeholder="请输入合同名称"
             style="width: 500px"
             clearable
-            @input="getContractNo"
+            @change="getContractNo"
           />
-        </div>
-        <div>
+        </el-col>
+        <el-col :span="12">
           <p>合同编号</p>
           <el-input
             v-model="form.contractNo"
@@ -20,28 +20,19 @@
             style="width: 500px"
             disabled
           />
-        </div>
-      </div>
+        </el-col>
+      </el-row>
       <!-- 合同附件图片 -->
       <div class="titlesa">
         <span>合同附件</span>
-        <span style="color: #d05c39">*支持上传pdf、jpg/jpeg、png格式</span>
+        <span style="color: #d05c39"> *支持上传pdf、jpg/jpeg、png格式</span>
       </div>
       <div>
-        <div>
-          <Upload v-model="form.pics" />
-          <!-- <el-upload
-            action="https://ht.9026.com/api/File"
-            list-type="picture-card"
-            :on-success="handlepics"
-          >
-            <i class="el-icon-plus" />
-          </el-upload>
-
-          <el-dialog :visible.sync="dialogVisible">
-            <img width="100%" :src="form.pics">
-          </el-dialog> -->
-        </div>
+        <FileUpload
+        v-model="form.pics"
+        accept=".jpg, .jpeg, .png, .pdf"
+        />
+        <!--<Upload v-model="form.pics" />-->
       </div>
       <!-- 发票附件图片 -->
       <div class="titlesa">
@@ -49,17 +40,10 @@
         <span style="color: #d05c39">*支持上传pdf、jpg/jpeg、png格式</span>
       </div>
       <div>
-        <Upload v-model="form.invoicePics" />
-        <!-- <el-upload
-          action="https://ht.9026.com/api/File"
-          list-type="picture-card"
-          :on-success="handleinvoicePics"
-        >
-          <i class="el-icon-plus" />
-        </el-upload>
-        <el-dialog :visible.sync="dialogVisible">
-          <img width="100%" :src="form.invoicePics">
-        </el-dialog> -->
+        <FileUpload
+        v-model="form.invoicePics"
+        accept=".jpg, .jpeg, .png, .pdf"
+        />
       </div>
       <!-- 贸易附件图片 -->
       <div class="titlesa">
@@ -67,381 +51,404 @@
         <span style="color: #d05c39">*支持上传pdf、jpg/jpeg、png格式</span>
       </div>
       <div>
-        <Upload v-model="form.tradePics" />
-        <!-- <el-upload
-          action="https://ht.9026.com/api/File"
-          list-type="picture-card"
-          :on-success="handletradePics"
-        >
-          <i class="el-icon-plus" />
-        </el-upload>
-        <el-dialog :visible.sync="dialogVisible">
-          <img width="100%" :src="form.tradePics">
-        </el-dialog> -->
+        <FileUpload
+        v-model="form.tradePics"
+        accept=".jpg, .jpeg, .png, .pdf"
+        />
       </div>
-    </el-card>
-
-    <!-- 汇票模块 -->
-    <div
-      v-for="(item, index) in form.contractDrafts"
-      :key="item.id"
-      class="form"
-      style="
-        margin: 20px;
-        border: 1px solid #c0c0c0;
-        padding: 10px;
-        border-radius: 10px;
-      "
-    >
-      <!-- 汇票名称 -->
-      <el-form ref="form" :model="item" label-width="90px">
-        <el-form-item label="汇票名称">
-          <el-input
-            v-model="item.name"
-            class="ipwidth"
-            placeholder="请填写汇票名称"
-            style="width: 220px"
-          />
-        </el-form-item>
-        <!-- 预计贴现日 -->
-        <el-form-item label="预计贴现日">
-          <el-date-picker
-            v-model="item.expectDiscountDate"
-            type="date"
-            placeholder="选择日期"
-            value-format="yyyy-MM-dd"
-            @change="inputMoney(index, 4)"
-          />
-        </el-form-item>
-        <!-- 出票日期 -->
-        <el-form-item label="出票日期">
-          <el-date-picker
-            v-model="item.acceptDate"
-            type="date"
-            placeholder="选择日期"
-            class="ipwidth"
-          />
-        </el-form-item>
-        <!-- 承兑日期 -->
-        <el-form-item label="承兑日期">
-          <el-date-picker
-            v-model="item.issueDate"
-            type="date"
-            placeholder="选择日期"
-            default-value
-            value-format="yyyy-MM-dd"
-            @change="inputMoney(index, 1)"
-          />
-        </el-form-item>
-        <!-- 到期日期 -->
-        <el-form-item label="到期日期">
-          <el-date-picker
-            v-model="item.expireDate"
-            type="date"
-            placeholder="选择日期"
-          />
-        </el-form-item>
-      </el-form>
-      <!-- 汇票号码 -->
-      <el-form ref="form" :model="form" label-width="100px">
-        <el-form-item label="汇票号码">
-          <el-input
-            v-model="item.draftNo"
-            class="ipwidth"
-            placeholder="请填写汇票号码"
-            style="width: 220px"
-          />
-        </el-form-item>
 
-        <!-- 金额 -->
-        <el-form-item label="金额">
-          <el-input
-            v-model="item.money"
-            class="ipwidth"
-            placeholder="请填写金额"
-            style="width: 220px"
-            @blur="getMoney(index)"
-            @input="inputMoney(index)"
-          />
-        </el-form-item>
-        <!-- 服务费 -->
-        <el-form-item label="服务费">
-          <el-input
-            v-model="item.serviceMoney"
-            class="ipwidth"
-            placeholder="计算得出服务费"
-            style="width: 220px"
-            @input="inputMoney(index)"
-          />
-        </el-form-item>
-        <!-- 最高贷款额度 -->
-        <el-form-item label="最高贷款额度">
-          <el-input
-            v-model="item.loanLimit"
-            class="ipwidth"
-            placeholder="计算得出最高贷款额度"
-            style="width: 220px"
-            @input="inputMoney(index)"
-          />
-        </el-form-item>
-
-        <el-form-item label="利息">
-          <el-input
-            v-model="item.interest"
-            class="ipwidth"
-            placeholder="计算得出利息"
-            style="width: 220px"
-            @input="inputMoney(index)"
-          />
-        </el-form-item>
-      </el-form>
-      <!-- 出票人 -->
-      <el-form ref="form" :model="form" label-width="90px">
-        <el-form-item label="出票人">
-          <el-select
-            v-model="form.drawersName"
-            filterable
-            placeholder="请选择出票人"
-          >
-            <el-option
-              label="新增出票人"
-              value=""
-              style="color: darkorange"
-              @click.native="addDrawer"
-            />
-            <el-option
-              v-for="item in drawersName"
-              :key="item.id"
-              :label="item"
-              :value="item"
-              @click.native="getdrawersId(index, item)"
-            />
-          </el-select>
-        </el-form-item>
-        <!-- 承兑人 -->
-        <el-form-item label="承兑人">
-          <el-select
-            v-model="form.acceptorName"
-            filterable
-            placeholder="请选择承兑人"
-          >
-            <el-option
-              v-for="val in acceptorName"
-              :key="val"
-              :label="val"
-              :value="val"
-              @click.native="getRate(index)"
-            />
-          </el-select>
-        </el-form-item>
-
-        <!-- 服务费率 -->
-
-        <el-form-item label="服务费率">
-          <el-input
-            v-model="item.serviceRate"
-            class="ipwidth"
-            placeholder="服务费率"
-            style="width: 220px"
-            @input="inputMoney(index)"
-          />
-        </el-form-item>
-        <!-- 利率 -->
-        <el-form-item label="利率">
-          <el-input
-            v-model="item.interestRate"
-            class="ipwidth"
-            placeholder="利率"
-            style="width: 220px"
-            @input="inputMoney(index)"
-          />
-        </el-form-item>
-      </el-form>
-      <!-- 汇票附件上传 -->
-      <div>
-        <el-row>
-          <el-col style="margin: 0 auto">
-            <div class="titlesa">
-              <span>附件</span>
-              <span
-                style="color: #d05c39"
-              >*支持上传pdf、jpg/jpeg、png格式</span>
-            </div>
-            <div>
-              <el-upload
-                action="https://ht.9026.com/api/File"
-                list-type="picture-card"
-                :on-success="handlepicUrls"
-              >
-                <i class="el-icon-plus" />
-              </el-upload>
-
-              <el-dialog :visible.sync="dialogVisible">
-                <img
-                  width="100%"
-                  :src="form.contractDrafts[0].picUrls"
-                  alt=""
-                >
-              </el-dialog>
-            </div>
+      <el-form ref="form" :model="form" label-width="110px" label-position="right" class="form-container">
+        <el-row
+          v-for="(item, index) in form.contractDrafts"
+          :key="index"
+          class="form-container-items"
+        >
+          <!-- 汇票名称 -->
+          <el-col :span="colSpan">
+            <el-form-item label="汇票名称" :prop="`contractDrafts.${index}.name`" :rules="rules.name">
+              <el-input
+                v-model="item.name"
+                class="ipwidth"
+                placeholder="请填写"
+                clearable
+              />
+            </el-form-item>
+          </el-col>
+          <!-- 汇票号码 -->
+          <el-col :span="colSpan">
+            <el-form-item label="汇票号码" :prop="`contractDrafts.${index}.draftNo`" :rules="rules.draftNo">
+              <el-input
+                v-model="item.draftNo"
+                class="ipwidth"
+                placeholder="请填写汇票号码"
+                clearable
+              />
+            </el-form-item>
+          </el-col>
+          <!-- 出票人 -->
+          <el-col :span="colSpan">
+            <el-form-item label="出票人" :prop="`contractDrafts.${index}.drawersId`" :rules="rules.drawersId">
+              <DrawerSelect v-model="item.drawersId" />
+              <i class="el-icon-circle-plus-outline" style="font-size:20px;cursor: pointer;" @click="addDrawer" />
+            </el-form-item>
+          </el-col>
+          <!-- 预计贴现日 -->
+          <el-col :span="colSpan">
+            <el-form-item label="预计贴现日" :prop="`contractDrafts.${index}.expectDiscountDate`" :rules="rules.expectDiscountDate">
+              <el-date-picker
+                v-model="item.expectDiscountDate"
+                type="date"
+                placeholder="选择日期"
+                value-format="yyyy-MM-dd"
+                :picker-options="pickerStart(index)"
+                @change="inputMoney(index)"
+              />
+            </el-form-item>
+          </el-col>
+          <!-- 金额 -->
+          <el-col :span="colSpan">
+            <el-form-item label="金额" :prop="`contractDrafts.${index}.money`" :rules="rules.money">
+              <el-input
+                v-model="item.money"
+                class="ipwidth"
+                placeholder="请填写金额"
+                clearable
+                @input="inputMoney(index)"
+              />
+            </el-form-item>
+          </el-col>
+          <!-- 承兑人 -->
+          <el-col :span="colSpan">
+            <el-form-item label="承兑人" :prop="`contractDrafts.${index}.acceptorName`" :rules="rules.acceptorName">
+              <AcceptorSelect
+                v-model="item.acceptorName"
+                @change="(...args)=> changeAcceptorName(...args, index)"
+              />
+            </el-form-item>
+          </el-col>
+          <!-- 承兑日期 -->
+          <el-col :span="colSpan">
+            <el-form-item label="承兑日期" :prop="`contractDrafts.${index}.issueDate`" :rules="rules.issueDate">
+              <el-date-picker
+                v-model="item.issueDate"
+                type="date"
+                placeholder="选择日期"
+                value-format="yyyy-MM-dd"
+                :picker-options="pickerEnd(index)"
+                :disabled="!item.expectDiscountDate"
+                @change="inputMoney(index)"
+              />
+            </el-form-item>
+          </el-col>
+          <!-- 服务费 -->
+          <el-col :span="colSpan">
+            <el-form-item label="服务费" :prop="`contractDrafts.${index}.serviceMoney`" :rules="rules.serviceMoney">
+              <el-input
+                v-model="item.serviceMoney"
+                class="ipwidth"
+                placeholder="计算得出服务费"
+                clearable
+                disabled
+              />
+            </el-form-item>
+          </el-col>
+          <!-- 服务费率 -->
+          <el-col :span="colSpan">
+            <el-form-item label="服务费率" :prop="`contractDrafts.${index}.serviceRate`" :rules="rules.serviceRate">
+              <el-input
+                v-model="item.serviceRate"
+                class="ipwidth"
+                placeholder="服务费率"
+                clearable
+                disabled
+              />
+            </el-form-item>
+          </el-col>
+          <!-- 出票日期 -->
+          <el-col :span="colSpan">
+            <el-form-item label="出票日期" :prop="`contractDrafts.${index}.acceptDate`" :rules="rules.acceptDate">
+              <el-date-picker
+                v-model="item.acceptDate"
+                type="date"
+                placeholder="选择日期"
+                value-format="yyyy-MM-dd"
+              />
+            </el-form-item>
+          </el-col>
+          <!-- 最高贷款额度 -->
+          <el-col :span="colSpan">
+            <el-form-item label="最高贷款额度" :prop="`contractDrafts.${index}.loanLimit`" :rules="rules.loanLimit">
+              <el-input
+                v-model="item.loanLimit"
+                class="ipwidth"
+                clearable
+                placeholder="计算得出最高贷款额度"
+                disabled
+              />
+            </el-form-item>
+          </el-col>
+          <!-- 利率 -->
+          <el-col :span="colSpan">
+            <el-form-item label="利率" :prop="`contractDrafts.${index}.interestRate`" :rules="rules.interestRate">
+              <el-input
+                v-model="item.interestRate"
+                clearable
+                class="ipwidth"
+                placeholder="利率"
+                disabled
+              />
+            </el-form-item>
+          </el-col>
+          <!-- 到期日期 -->
+          <el-col :span="colSpan">
+            <el-form-item label="到期日期" :prop="`contractDrafts.${index}.expireDate`" :rules="rules.expireDate">
+              <el-date-picker
+                v-model="item.expireDate"
+                type="date"
+                placeholder="选择日期"
+                value-format="yyyy-MM-dd"
+              />
+            </el-form-item>
+          </el-col>
+          <!-- 利息 -->
+          <el-col :span="colSpan">
+            <el-form-item label="利息" :prop="`contractDrafts.${index}.interest`" :rules="rules.interest">
+              <el-input
+                v-model="item.interest"
+                class="ipwidth"
+                placeholder="计算得出利息"
+                clearable
+                disabled
+              />
+            </el-form-item>
+          </el-col>
+          <!-- 利率 -->
+          <el-col :span="colSpan">
+            <el-form-item label="附件" :prop="`contractDrafts.${index}.picUrls`" :rules="rules.picUrls">
+              <Upload v-model="item.picUrls" />
+            </el-form-item>
+          </el-col>
+          <!-- 删除汇票 -->
+          <el-col :span="24" style="text-align:right">
+            <el-button
+              type="primary"
+              @click="onDelete(index)"
+            >删除汇票</el-button>
           </el-col>
         </el-row>
-
-        <!-- 删除汇票 -->
-        <el-button
-          type="primary"
-          style="width: 100px; height: 50px; margin-top: 50px"
-          @click="deletedraft(index)"
-        >删除汇票</el-button>
-      </div>
-    </div>
-    <!-- 新增汇票 -->
-    <div class="commit">
-      <div class="addnew">
-        <el-button type="primary" @click="adddraft">新增汇票</el-button>
-      </div>
-      <div class="addall">
-        <el-button
-          type="warning"
-          style="width: 180px; height: 45px; font-size: 16px"
-          @click="onSubmit"
-        >确认上传
-        </el-button>
-      </div>
-    </div>
+        <!-- 新增汇票 -->
+        <div class="commit">
+          <div class="addnew">
+            <el-button type="primary" @click.stop="onAdd">新增汇票</el-button>
+          </div>
+          <div class="addall">
+            <el-button
+              type="warning"
+              style="width: 180px; height: 45px; font-size: 16px"
+              @click="onSubmit"
+            >确认上传
+            </el-button>
+          </div>
+        </div>
+      </el-form>
+    </el-card>
   </div>
 </template>
-
 <script>
+import { contractSubmitApi, contractsPageApi, contractsDetailApi } from '@/api/contracts'
 import { maxLoanAmount, serviceCharge, interest } from '@/utils/calc'
+import DrawerSelect from '@/components/DrawerSelect/DrawerSelect.vue'
+import AcceptorSelect from '@/components/AcceptorSelect/AcceptorSelect.vue'
 export default {
+  components: {
+    DrawerSelect,
+    AcceptorSelect
+  },
   data() {
     return {
-      dialogVisible: false,
-      disabled: false,
-      drawersList: [],
-      acceptorList: [],
+      colSpan: 8,
       contractList: [],
-      filesArray: [], // 汇票图片上传数组
-      picsArray: [], // 合同图片上传数组
-      invoicePicsArray: [], // 发票图片上传数组
-      tradePicsArray: [], // 贸易图片上传数组
-      file: '',
       form: {
-        // 承兑人列表
-        acceptorName: [],
-        // 出票人列表
-        drawersName: [],
-        contractNo: '',
-        supplierId: 2,
-        name: '',
-        invoicePics: [],
-        pics: [],
-        tradePics: [],
+        name: '', // 合同名称
+        contractNo: '', // 合同编号
+        pics: [], // 合同附件
+        invoicePics: [], // 发票附件
+        tradePics: [], // 贸易合同
+        supplierId: 2, // 不知道干啥的
         /* 汇票的数据 */
         contractDrafts: [
           {
-            name: '',
-            draftNo: '',
-            acceptorId: '',
-            drawersId: '',
-            money: '',
-            acceptDate: '',
-            loanLimit: '',
-            serviceRate: '',
-            serviceMoney: '',
-            interestRate: '',
-            interest: '',
-            picUrls: [],
-            expectDiscountDate: '',
-            issueDate: '',
-            expireDate: '',
-            limitTime: '',
-            acceptDateTime: '',
-            expectDiscountDateTime: ''
+            name: '', // 汇票名称
+            draftNo: '', // 汇票号码
+            acceptorId: '', // 承兑人id
+            drawersId: '', // 出票人
+            money: '', // 金额
+            acceptDate: '', // 出票日期
+            loanLimit: '', // 最高贷款额度
+            serviceRate: '', // 服务费率
+            serviceMoney: '', // 服务费
+            interestRate: '', // 利率
+            interest: '', // 利息
+            picUrls: [], // 汇票名称
+            expectDiscountDate: '', // 预计贴现日
+            issueDate: '', // 承兑日期
+            expireDate: '' // 到期日期
+            // limitTime: '', //
+            // acceptDateTime: '', //
+            // expectDiscountDateTime: ''//
           }
         ]
       },
-      pickerOptions: {
-        disabledDate(time) {
-          return time.getTime() > Date.now()
-        },
-        shortcuts: [
-          {
-            text: '今天',
-            onClick(picker) {
-              picker.$emit('pick', new Date())
-            }
-          },
-          {
-            text: '昨天',
-            onClick(picker) {
-              const date = new Date()
-              date.setTime(date.getTime() - 3600 * 1000 * 24)
-              picker.$emit('pick', date)
-            }
-          },
-          {
-            text: '一周前',
-            onClick(picker) {
-              const date = new Date()
-              date.setTime(date.getTime() - 3600 * 1000 * 24 * 7)
-              picker.$emit('pick', date)
-            }
-          }
+      rules: {
+        name: [
+          { required: true, message: '请输入', trigger: 'change' }
+        ],
+        draftNo: [
+          { required: true, message: '请输入', trigger: 'change' }
+        ],
+        drawersId: [
+          { required: true, message: '请输入', trigger: 'change' }
+        ],
+        expectDiscountDate: [
+          { required: true, message: '请选择', trigger: 'change' }
+        ],
+        money: [
+          { required: true, message: '请输入', trigger: 'change' }
+        ],
+        acceptorName: [
+          { required: true, message: '请选择', trigger: 'change' }
+        ],
+        issueDate: [
+          { required: true, message: '请选择', trigger: 'change' }
+        ],
+        serviceMoney: [
+          { required: true, message: '请输入', trigger: 'change' }
+        ],
+        serviceRate: [
+          { required: true, message: '请输入', trigger: 'change' }
+        ],
+        acceptDate: [
+          { required: true, message: '请选择', trigger: 'change' }
+        ],
+        loanLimit: [
+          { required: true, message: '请输入', trigger: 'change' }
+        ],
+        interestRate: [
+          { required: true, message: '请输入', trigger: 'change' }
+        ],
+        expireDate: [
+          { required: true, message: '请选择', trigger: 'change' }
+        ],
+        interest: [
+          { required: true, message: '请输入', trigger: 'change' }
+        ],
+        picUrls: [
+          { trigger: ['change', 'input'], validator: this.validatePicUrls }
         ]
       }
     }
   },
   mounted() {
-    this.$request({
-      url: '/api/Contract/search',
-      method: 'post',
-      data: {
-        pageIndex: 1,
-        pageSize: 100
+    // this.loadData()
+
+    // 编辑获取详情
+    this.getDetail()
+  },
+  methods: {
+    getDetail() {
+      const id = this.$route.query.id
+      if(!id){
+        return
       }
-    }).then((res) => {
-      this.contractList = res.data.result
-    })
-    this.$request({
-      url: '/api/Acceptor/search',
-      method: 'post',
-      data: {
+      contractsDetailApi(id).then((res) => {
+        console.log('detail=', res.data)
+        this.form.id   = res.data.id
+        this.form.name = res.data.name
+        this.form.contractNo = res.data.contractNo
+        this.form.invoicePics = res.data.invoicePicList
+        this.form.tradePics = res.data.tradePicList
+        this.form.pics = res.data.picList
+        this.form.contractDrafts = res.data.contractDraft.result
+      });
+    },
+    loadData() {
+      contractsPageApi({
         pageIndex: 1,
         pageSize: 100
+      }).then((res) => {
+        this.contractList = res.data.result
+      })
+    },
+    getContractNo() {
+      const temporaryList = this.contractList.filter(
+        (item) => item.name === this.form.name
+      )
+      if (this.form.name === '' || temporaryList === '') {
+        this.form.contractNo = ''
+      } else {
+        this.form.contractNo = temporaryList[0].contractNo
       }
-    }).then((res) => {
-      this.acceptorList = res.data.result
-      this.acceptorName = Array.from(this.acceptorList, ({ name }) => name)
-    })
-    this.$request({
-      url: '/api/Drawer/search',
-      method: 'post',
-      data: {
-        pageIndex: 1,
-        pageSize: 100
+    },
+    onAdd() {
+      this.form.contractDrafts.push({
+        name: '', // 汇票名称
+        draftNo: '', // 汇票号码
+        acceptorId: '', // 承兑人id
+        drawersId: '', // 出票人
+        money: '', // 金额
+        acceptDate: '', // 出票日期
+        loanLimit: '', // 最高贷款额度
+        serviceRate: '', // 服务费率
+        serviceMoney: '', // 服务费
+        interestRate: '', // 利率
+        interest: '', // 利息
+        picUrls: [], // 汇票名称
+        expectDiscountDate: '', // 预计贴现日
+        issueDate: '', // 承兑日期
+        expireDate: '' // 到期日期
+      })
+    },
+    addDrawer() {
+      this.$router.push({
+        path: '/form/addTicketdrawer'
+      })
+    },
+    onDelete(index) {
+      const contractDraftsLength = this.form.contractDrafts.length
+      if (contractDraftsLength > 1) {
+        this.form.contractDrafts.splice(index, 1)
+      } else {
+        this.$message.error('默认汇票禁止删除')
       }
-    }).then((res) => {
-      this.drawersList = res.data.result
-      this.drawersName = Array.from(this.drawersList, ({ name }) => name)
-      // 去除重复的出票人
-      for (var i = 0; i < this.drawersName.length; i++) {
-        // 首次遍历数组
-        for (var j = i + 1; j < this.drawersName.length; j++) {
-          // 再次遍历数组
-          if (this.drawersName[i] === this.drawersName[j]) {
-            // 判断连个值是否相等
-            this.drawersName.splice(j, 1) // 相等删除后者
-            j--
-          }
+    },
+    onSubmit(o) {
+      this.$refs.form.validate((valid) => {
+        if (valid) {
+          contractSubmitApi(this.form).then(res => {
+            if (res.code === 200) {
+              // this.onBack()
+              this.$message({
+                type: 'success',
+                message: res.msg
+              })
+            }
+          })
+        } else {
+          console.log('error submit!!')
+          return false
         }
+      })
+    },
+    changeAcceptorName(value, exist, index) {
+      if (exist) {
+        const { id, interest, serviceRate } = exist
+        this.form.contractDrafts[index].acceptorId = id
+        this.form.contractDrafts[index].interestRate = interest
+        this.form.contractDrafts[index].serviceRate = serviceRate
+        this.inputMoney(index)
       }
-    })
-    /* 调用获取当前的时间 */
-    this.loadTime()
-  },
-  methods: {
+    },
+    // 计算金额
     inputMoney(index) {
       this.getloanLimt(index)
       this.getSerMoney(index)
@@ -464,7 +471,7 @@ export default {
         issueDate
       )
     },
-    // /* 计算服务费 */
+    /* 计算服务费 */
     getSerMoney(index) {
       const {
         loanLimit,
@@ -494,231 +501,72 @@ export default {
         issueDate
       )
     },
-    onSubmit() {
-      this.$request({
-        url: '/api/Contract',
-        method: 'post',
-        data: this.form
-      }).then((res) => {
-        console.log(res)
-        this.$message({
-          message: '上传成功',
-          type: 'success'
-        })
-      })
-    },
-
-    /* 默认时间 */
-    loadTime() {
-      const myDate = new Date()
-      const wk = parseInt(Date.now() / 100000).toFixed(0) * 100000
-      const yy = String(myDate.getFullYear())
-      // let mm = myDate.getMonth() + 1
-      const mm = String(
-        myDate.getMonth() + 1 < 10
-          ? '0' + (myDate.getMonth() + 1)
-          : myDate.getMonth() + 1
-      )
-      const dd = String(
-        myDate.getDate() < 10 ? '0' + myDate.getDate() : myDate.getDate()
-      )
-      const nowDate = yy + '-' + mm + '-' + dd
-      this.form.contractDrafts.forEach((item) => {
-        item.acceptDate = nowDate
-        item.issueDate = nowDate
-        item.expireDate = nowDate
-        item.expectDiscountDate = nowDate
-        item.expectDiscountDateTime = wk
-        item.acceptDateTime = wk
-        const nTime = item.acceptDateTime - item.expectDiscountDateTime
-        item.limitTime = Math.floor(nTime / 86400000)
-      })
+    onBack() {
+      this.$router.go(-1)
     },
-
-    /* 合同附件上传 */
-    handlepics(res) {
-      // 解构
-      const { file } = res.data
-      this.picsArray.push(file)
-      this.form.pics = this.picsArray
-    },
-    /* 发票附件上传 */
-    handleinvoicePics(res) {
-      const { file } = res.data
-      this.invoicePicsArray.push(file)
-      this.form.invoicePics = this.invoicePicsArray
-    },
-    /* 贸易附件上传 */
-    handletradePics(res) {
-      const { file } = res.data
-      this.tradePicsArray.push(file)
-      this.form.tradePics = this.tradePicsArray
-    },
-
-    /* 上传图片到浏览器成功回调 */
-    handlepicUrls(res) {
-      // 解构
-      const { file } = res.data
-      this.filesArray.push(file)
-      this.form.contractDrafts[0].picUrls = this.filesArray
-    },
-    getContractNo() {
-      const temporaryList = this.contractList.filter(
-        (item) => item.name === this.form.name
-      )
-      if (this.form.name === '' || temporaryList === '') {
-        this.form.contractNo = ''
-      } else {
-        this.form.contractNo = temporaryList[0].contractNo
+    // 预计贴现日
+    pickerStart(index) {
+      const that = this
+      return {
+        disabledDate(time) {
+          if (that.form.contractDrafts[index].issueDate) { // 如果结束时间不为空,则小于结束时间
+            return new Date(that.form.contractDrafts[index].issueDate).getTime() < time.getTime()
+          }
+        }
       }
     },
-
-    /* 获取服务率和利率,承兑人id */
-    getRate(index) {
-      const list = this.acceptorList.filter(
-        (item) => item.name === this.form.acceptorName
-      )
-      console.log(list)
-      this.form.contractDrafts[index].acceptorId = list[index].id
-      this.form.contractDrafts[index].interestRate = list[index].interest
-      this.form.contractDrafts[index].serviceRate = list[index].serviceRate
-    },
-    // 获取出票人id
-    getdrawersId(index, name) {
-      const drawers = this.drawersList.filter((item) => item.name === name)
-      console.log(drawers)
-      this.form.contractDrafts[index].drawersId = drawers[index].id
-      console.log(drawers[index].id)
-    },
-    addDrawer() {
-      this.$router.push({
-        path: '/form/addTicketdrawer'
-      })
-    },
-    // 新增汇票
-    adddraft() {
-      this.form.contractDrafts.push({
-        name: '',
-        draftNo: '',
-        acceptorId: '',
-        drawersId: '',
-        money: '',
-        acceptDate: '',
-        loanLimit: '',
-        serviceRate: '',
-        serviceMoney: '',
-        interestRate: '',
-        interest: '',
-        picUrls: [],
-        expectDiscountDate: '',
-        issueDate: '',
-        expireDate: '',
-        limitTime: ''
-      })
-    },
-    // 删除汇票
-    deletedraft(index) {
-      const contractDraftsLength = this.form.contractDrafts.length
-      if (contractDraftsLength > 1) {
-        this.form.contractDrafts.splice(index, 1)
-      } else {
-        this.$message.error('至少一个')
+    // 承兑日期
+    pickerEnd(index) {
+      const that = this
+      return {
+        disabledDate(time) {
+          if (that.form.contractDrafts[index].expectDiscountDate) { // 如果开始时间不为空,则结束时间大于开始时间
+            return new Date(that.form.contractDrafts[index].expectDiscountDate).getTime() > time.getTime()
+          }
+        }
       }
     },
-
-    /* 计算时间段 */
-    change(e, number) {}
-
-    // /* 获取金额 */
-    // getMoney(index) {
-    //   this.getloanLimt(index)
-    //   this.getSerMoney(index)
-    //   this.getInterMoney(index)
-    // }
-    // /* 计算最高贷款额度 */
-    // getloanLimt(i) {
-    //   if (
-    //     this.form.contractDrafts[i].money &&
-    //     this.form.contractDrafts[i].serviceRate &&
-    //     this.form.contractDrafts[i].interestRate
-    //   ) {
-    //     this.form.contractDrafts[i].loanLimit = (
-    //       ((this.form.contractDrafts[i].money /
-    //         (this.form.contractDrafts[i].serviceRate +
-    //           this.form.contractDrafts[i].interestRate)) *
-    //         this.form.contractDrafts[i].limitTime) /
-    //         360 +
-    //       1
-    //     ).toFixed(2)
-    //   }
-    // },
-    // /* 计算服务费 */
-    // getSerMoney(i) {
-    //   if (
-    //     this.form.contractDrafts[i].money &&
-    //     this.form.contractDrafts[i].serviceRate &&
-    //     this.form.contractDrafts[i].interestRate
-    //   ) {
-    //     this.form.contractDrafts[i].serviceMoney = (
-    //       ((((this.form.contractDrafts[i].money /
-    //         (this.form.contractDrafts[i].serviceRate +
-    //           this.form.contractDrafts[i].interestRate)) *
-    //         this.form.contractDrafts[i].limitTime) /
-    //         360 +
-    //         1) *
-    //         this.form.contractDrafts[i].serviceRate *
-    //         this.form.contractDrafts[i].limitTime) /
-    //       360
-    //     ).toFixed(2)
-    //   }
-    // },
-    // /* 利息*/
-    // getInterMoney(i) {
-    //   if (
-    //     this.form.contractDrafts[i].money &&
-    //     this.form.contractDrafts[i].serviceRate &&
-    //     this.form.contractDrafts[i].interestRate
-    //   ) {
-    //     this.form.contractDrafts[i].interest = (
-    //       ((((this.form.contractDrafts[i].money /
-    //         (this.form.contractDrafts[i].serviceRate +
-    //           this.form.contractDrafts[i].interestRate)) *
-    //         this.form.contractDrafts[i].limitTime) /
-    //         360 +
-    //         1) *
-    //         this.form.contractDrafts[i].interestRate *
-    //         this.form.contractDrafts[i].limitTime) /
-    //       360
-    //     ).toFixed(2)
-    //   }
-    // }
+    validatePicUrls(rule, value, callback) {
+      debugger
+      console.log(Object.keys(value).length, value)
+      if (value && Object.keys(value).length > 0) {
+        callback()
+        return
+      }
+      callback('请选择')
+    }
   }
 }
 </script>
-
-<style lang="scss">
-.contract {
-  display: flex;
-  justify-content: space-between;
+<style lang="scss" scoped>
+.box-card {
+  padding: 20px 10px;
   margin-bottom: 20px;
+  .titlesa {
+    margin-bottom: 10px;
+  }
+  .titlesa~.titlesa{
+    margin-top: 20px;
+  }
 }
-
-.form {
-  display: flex;
-  justify-content: space-around;
-}
-
-.addnew {
-  display: flex;
-  justify-content: flex-end;
-}
-
-.addall {
-  display: flex;
-  justify-content: center;
+.form-container {
+  margin-top: 15px;
+  .el-input,.el-select {
+    width: 220px;
+    text-align: left;
+  }
+  .form-container-items {
+    margin: 20px 0;
+    border: 1px solid #c0c0c0;
+    padding: 30px 10px 0 10px;
+    border-radius: 10px;
+  }
 }
-
 .commit {
-  margin: 20px 0;
+  text-align: center;
+  .addnew {
+    text-align: right;
+    margin-right: 10px;
+  }
 }
 </style>

+ 34 - 12
src/views/databackup/index.vue

xqd xqd xqd xqd xqd xqd
@@ -4,7 +4,7 @@
       <div class="grid-content bg-purple">
         <div class="grid-content bg-purple" style="margin-left: 30px">
           <el-input
-            placeholder="请输入查询内容"
+            placeholder="请输入文件名称"
             v-model="formData.fileName"
             @change="Search"
             style="width: 80%"
@@ -13,10 +13,10 @@
           </el-input>
         </div>
       </div>
-      <div class="grid-content bg-purple">
+      <!-- <div class="grid-content bg-purple">
         <el-dropdown @command="handleCommand">
           <div class="pulldown">
-            <span class="el-dropdown-link" v-if="!status"> 本地 </span>
+            <span class="el-dropdown-link" v-if="!status"> 存储对象 </span>
             <span class="el-dropdown-link" v-if="status">
               {{ status }}
             </span>
@@ -27,7 +27,7 @@
             
           </el-dropdown-menu>
         </el-dropdown>
-      </div>
+      </div> -->
       <div class="grid-content bg-purple">
         <div class="block">
           <el-date-picker
@@ -65,7 +65,7 @@
     >
       <el-table-column align="center" label="" width="55" type="selection">
       </el-table-column>
-      <el-table-column label="文件名称" align="center" prop="fileName">
+      <el-table-column label="文件名称" align="center" prop="fileName" width="200">
       </el-table-column>
       <el-table-column label="存储对象" align="center" prop="storeType">
       </el-table-column>
@@ -225,9 +225,22 @@ export default {
       });
 	},
 
-
+     /* 存储对象查询 */
     handleCommand(command) {
       this.status = command;
+       if(command === '全部'){
+          this.formData.isDeleted=''
+        }
+            if (command === '正常') {
+            this.formData.isDeleted = 0
+          }
+          if (command === '删除') {
+            this.formData.isDeleted = 1
+          }
+        this.currentPage = 1;
+        this.searchForm = { ...this.formData };
+        this.getAllList(this.searchForm);
+
     },
 	  /* 请输入查询内容 */
     Search() {
@@ -238,12 +251,21 @@ export default {
 	
 
 	 // 日期审核状态查询
-    startEndTime(val) {
-      this.formData.startTime = this.value2[0];
-      this.formData.endTime = this.value2[1];
-      this.currentPage = 1;
-      this.searchForm = { ...this.formData };
-      this.getAllList(this.searchForm);
+    startEndTime(item) {
+       if (item == null) {
+        item = [];
+        this.formData.startTime ='';
+        this.formData.endTime = '';
+        this.currentPage = 1;
+        this.searchForm = { ...this.formData };
+        this.getAllList(this.searchForm);
+      } else {
+        this.formData.startTime = this.value2[0];
+        this.formData.endTime = this.value2[1];
+        this.currentPage = 1;
+        this.searchForm = { ...this.formData };
+        this.getAllList(this.searchForm);
+      }
       
     },
 

+ 4 - 4
src/views/delivery/edit.vue

xqd
@@ -3,13 +3,13 @@
 		<el-descriptions title="供应商详情" :column="3" :size="size" border style="margin: 20px;">
 			<el-descriptions-item label="供应商名称">{{ list.name }}</el-descriptions-item>
 			<el-descriptions-item label="id">{{ list.id }}</el-descriptions-item>
-			<el-descriptions-item label="社会统一信用代码">{{ list.socialCode }}</el-descriptions-item>
+			<el-descriptions-item label="统一社会信用代码">{{ list.socialCode }}</el-descriptions-item>
 			<el-descriptions-item label="账号">{{ list.account }}</el-descriptions-item>
 			<el-descriptions-item label="创建时间">{{ list.createdAt }}</el-descriptions-item>
-			<el-descriptions-item label="法人名">{{ list.legalPerson }}</el-descriptions-item>
+			<el-descriptions-item label="法人名">{{ list.legalPerson }}</el-descriptions-item>
 			<el-descriptions-item label="联系人">{{ list.contacts }}</el-descriptions-item>
-			<el-descriptions-item label="电话">{{ list.contactsMobile }}</el-descriptions-item>
-			<el-descriptions-item label="审核状态">{{ list.statusText }}</el-descriptions-item>
+			<el-descriptions-item label="联系电话">{{ list.contactsMobile }}</el-descriptions-item>
+			<el-descriptions-item label="认证状态">{{ list.statusText }}</el-descriptions-item>
 			<el-descriptions-item label="认证照片">
 				<el-image v-for="(item,index) in list.proxyFileList" :key="index" style="width: 100px; height: 100px"
 					:src="item" />

+ 58 - 40
src/views/delivery/index.vue

xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd
@@ -25,7 +25,7 @@
             <i class="el-icon-arrow-down el-icon--right" />
           </div>
           <el-dropdown-menu slot="dropdown">
-            <el-dropdown-item command="审核状态">审核状态</el-dropdown-item>
+            <el-dropdown-item command="正常">全部</el-dropdown-item>
             <el-dropdown-item command="正常">正常</el-dropdown-item>
             <el-dropdown-item command="删除">删除</el-dropdown-item>
           </el-dropdown-menu>
@@ -44,7 +44,7 @@
             <i class="el-icon-arrow-down el-icon--right" />
           </div>
           <el-dropdown-menu slot="dropdown">
-            <el-dropdown-item command="供应商状态">供应商状态</el-dropdown-item>
+            <el-dropdown-item command="全部">全部</el-dropdown-item>
             <el-dropdown-item command="已认证">已认证</el-dropdown-item>
             <el-dropdown-item command="未认证">未认证</el-dropdown-item>
           </el-dropdown-menu>
@@ -61,11 +61,10 @@
             range-separator="至"
             start-placeholder="开始日期"
             end-placeholder="结束日期"
-            value-format="yyyy-MM-dd"
             :picker-options="pickerOptions"
+            value-format="yyyy-MM-dd"
             @change="startEndTime"
-          >
-          </el-date-picker>
+          />
         </div>
       </div>
     </el-row>
@@ -88,7 +87,7 @@
       >
       </el-table-column>
       <el-table-column
-        label="社会统一信用代码"
+        label="统一社会信用代码"
         width="200"
         align="center"
         prop="socialCode"
@@ -97,7 +96,7 @@
       <el-table-column label="账号" width="150" align="center" prop="account">
       </el-table-column>
       <el-table-column
-        label="法人名"
+        label="法人名"
         width="180"
         align="center"
         prop="legalPerson"
@@ -112,7 +111,7 @@
       </el-table-column>
 
       <el-table-column
-        label="电话"
+        label="联系电话"
         width="180"
         align="center"
         prop="contactsMobile"
@@ -125,7 +124,7 @@
         prop="statusText"
       >
       </el-table-column>
-      <el-table-column label="状态" align="center" prop="isDeletedText">
+      <el-table-column label="审核状态" align="center" prop="isDeletedText">
       </el-table-column>
       <el-table-column align="center" prop="createdAt" label="时间" width="180">
       </el-table-column>
@@ -219,7 +218,7 @@
 
 <script>
 import { dataConversionUtil } from "../../utils/Excel.js";
-import { getSupplierSearch } from "@/api/supplier";
+import { getSupplierSearch, supplierExportApi } from "@/api/supplier";
 
 export default {
   filters: {
@@ -331,34 +330,44 @@ export default {
     },
 
     // 日期审核状态查询
-    startEndTime() {
-      this.formData.startTime = this.value2[0];
-      this.formData.endTime = this.value2[1];
-      this.currentPage = 1;
-      this.searchForm = { ...this.formData };
-      this.getAllList(this.searchForm);
+    startEndTime(item) {
+      if (item == null) {
+        item = [];
+        this.formData.startTime ='';
+        this.formData.endTime = '';
+        this.currentPage = 1;
+        this.searchForm = { ...this.formData };
+        this.getAllList(this.searchForm);
+      } else {
+        this.formData.startTime = this.value2[0];
+        this.formData.endTime = this.value2[1];
+        this.currentPage = 1;
+        this.searchForm = { ...this.formData };
+        this.getAllList(this.searchForm);
+      }
+     
     },
     /* 审核状态查询 */
     handleCommand(command) {
       this.providerStatus = command;
-        if(command === '审核状态'){
-          this.formData.isDeleted=''
-        }
-            if (command === '正常') {
-            this.formData.isDeleted = 0
-          }
-          if (command === '删除') {
-            this.formData.isDeleted = 1
-          }
-        this.currentPage = 1;
-        this.searchForm = { ...this.formData };
-        this.getAllList(this.searchForm);
+      if (command === "全部") {
+        this.formData.isDeleted = "";
+      }
+      if (command === "正常") {
+        this.formData.isDeleted = 0;
+      }
+      if (command === "删除") {
+        this.formData.isDeleted = 1;
+      }
+      this.currentPage = 1;
+      this.searchForm = { ...this.formData };
+      this.getAllList(this.searchForm);
     },
 
     // 输入供应商状态查询
     AhandleCommand(command) {
       this.Auditstatus = command;
-      if (command === "供应商状态") {
+      if (command === "全部") {
         this.formData.status = "";
       }
       if (command === "已认证") {
@@ -372,16 +381,7 @@ export default {
       this.getAllList(this.searchForm);
     },
 
-    // 日期审核状态查询
-    startEndTime() {
-      this.formData.startTime = this.value2[0];
-      this.formData.endTime = this.value2[1];
-      this.currentPage = 1;
-      this.searchForm = {
-        ...this.formData,
-      };
-      this.getAllList(this.searchForm);
-    },
+  
 
     /* 输入出票人名称查询 */
     Search() {
@@ -412,13 +412,30 @@ export default {
 
     /* 导出 */
     Exports() {
+      supplierExportApi({}).then((data) => {
+        console.log(data);
+        if (!data) {
+          return;
+        }
+        var blob = new Blob([data]);
+        var url = window.URL.createObjectURL(blob);
+        var aLink = document.createElement("a");
+        aLink.style.display = "none";
+        aLink.href = url;
+        aLink.setAttribute("download", "列表.xls");
+        document.body.appendChild(aLink);
+        aLink.click();
+        document.body.removeChild(aLink); //下载完成移除元素
+        window.URL.revokeObjectURL(url); //释放掉blob对象
+      });
+
       if (this.multipleSelection == "") {
         this.$message({
           type: "warning",
           message: "请选择数据!",
         });
       } else {
-        var tableHeader = [
+        /*var tableHeader = [
           [
             "序号",
             "供应商名称",
@@ -447,6 +464,7 @@ export default {
         });
         dataConversionUtil.dataToExcel("供应商列表", tableHeader, dataList);
         this.$message.success("导出成功!");
+        */
       }
     },
     success() {

+ 4 - 4
src/views/form/detail.vue

xqd
@@ -3,10 +3,10 @@
 		<el-descriptions title="出票人详情" :column="3" :size="size" border style="margin: 20px;">
 			<el-descriptions-item label="id">{{ tableData.id }}</el-descriptions-item>
 			<el-descriptions-item label="起始时间">{{ tableData.createdAt }}</el-descriptions-item>
-			<el-descriptions-item label="状态">{{ tableData.statusText }}</el-descriptions-item>
-			<el-descriptions-item label="姓名">{{ tableData.name }}</el-descriptions-item>
-			<el-descriptions-item label="银行账户">{{ tableData.bankAccount }}</el-descriptions-item>
-			<el-descriptions-item label="行名称">{{ tableData.bankName }}</el-descriptions-item>
+			<el-descriptions-item label="出票人状态">{{ tableData.statusText }}</el-descriptions-item>
+			<el-descriptions-item label="出票人">{{ tableData.name }}</el-descriptions-item>
+			<el-descriptions-item label="账户">{{ tableData.bankAccount }}</el-descriptions-item>
+			<el-descriptions-item label="开户行名称">{{ tableData.bankName }}</el-descriptions-item>
 		</el-descriptions>
 		<el-dialog title="修改出票人" :visible.sync="dialogVisible" width="30%">
 		<el-form ref="form" :model="tableData" label-width="80px">

+ 5 - 2
src/views/form/index.vue

xqd xqd xqd
@@ -25,7 +25,7 @@
             <i class="el-icon-arrow-down el-icon--right"></i>
           </div>
           <el-dropdown-menu slot="dropdown">
-            <el-dropdown-item command="出票人状态">出票人状态</el-dropdown-item>
+            <el-dropdown-item command="全部">全部</el-dropdown-item>
             <el-dropdown-item command="正常">正常</el-dropdown-item>
             <el-dropdown-item command="删除">删除</el-dropdown-item>
           </el-dropdown-menu>
@@ -59,7 +59,7 @@
       </el-table-column>
       <el-table-column align="center" prop="bankName" label="开户行名称">
       </el-table-column>
-      <el-table-column align="center" prop="statusText" label="状态">
+      <el-table-column align="center" prop="statusText" label="出票人状态">
       </el-table-column>
       <el-table-column align="center" prop="createdAt" label="时间">
       </el-table-column>
@@ -302,6 +302,9 @@ export default {
         if (command === '删除') {
           this.formData.status = 4
         }
+        if (command === '全部') {
+          this.formData.status = ''
+        }
       this.currentPage = 1;
       this.searchForm = { ...this.formData };
       this.getAllList(this.searchForm);

+ 9 - 4
src/views/management/index.vue

xqd xqd xqd xqd xqd xqd xqd
@@ -5,7 +5,7 @@
         <el-input
           v-model="formData.name"
           @change="Search"
-          placeholder="业务管理员名称搜索"
+          placeholder="请输入业务管理员名称"
           style="width: 100%"
         >
           <i slot="prefix" class="el-input__icon el-icon-search" />
@@ -15,7 +15,7 @@
         <el-dropdown @command="handleCommand">
           <div class="pulldown">
             <span v-if="!status" class="el-dropdown-link">
-              业务员状态筛选
+              业务管理员状态
             </span>
             <span v-if="status" class="el-dropdown-link">
               {{ status }}
@@ -33,7 +33,7 @@
         <el-dropdown @command="handlehpCommand">
           <div class="pulldown">
             <span v-if="!Auditstatus" class="el-dropdown-link">
-              审核状态筛选
+              审核状态
             </span>
             <span v-if="Auditstatus" class="el-dropdown-link">
               {{ Auditstatus }}
@@ -41,6 +41,7 @@
             <i class="el-icon-arrow-down el-icon--right" />
           </div>
           <el-dropdown-menu slot="dropdown">
+            <el-dropdown-item command="全部">全部</el-dropdown-item>
             <el-dropdown-item command="待审核">待审核</el-dropdown-item>
             <el-dropdown-item command="通过">通过</el-dropdown-item>
             <el-dropdown-item command="未通过">未通过</el-dropdown-item>
@@ -71,7 +72,7 @@
       <el-table-column align="center" label="" width="55" type="selection" />
       <el-table-column label="id" align="center" prop="id" />
       <el-table-column
-        label="业务管理员名"
+        label="业务管理员名"
         align="center"
         width="180"
         prop="realName"
@@ -87,6 +88,7 @@
         label="业务管理员状态"
         align="center"
         prop="statusText"
+        width="180"
       />
       <el-table-column
         label="审核状态"
@@ -435,6 +437,9 @@ export default {
     /* 审核状态筛选 */
     handlehpCommand(command) {
       this.Auditstatus = command;
+       if (command === "全部") {
+        this.formData.status = "";
+      }
       if (command === "待审核") {
         this.formData.status = 1;
       }

+ 54 - 26
src/views/shipments/index.vue

xqd xqd xqd xqd
@@ -55,7 +55,7 @@
     >
       <el-table-column align="center" label="" width="55" type="selection">
       </el-table-column>
-      <el-table-column label="承兑人名" align="center" prop="acceptorName">
+      <el-table-column label="承兑人名" align="center" prop="acceptorName">
       </el-table-column>
       <el-table-column
         label="统计周期(按照承兑日)"
@@ -133,7 +133,7 @@ export default {
       total: 20,
       /* 列表数据 */
       srcList: [],
-      number:'',//区分是月季年度
+      number: "", //区分是月季年度
       list: [],
       listLoading: false,
       status: "",
@@ -181,19 +181,18 @@ export default {
   },
   methods: {
     /* 获取承兑人分类报表 */
-    getReportList(number,startDate,endDate,pageSize,
-        pageIndex) {
+    getReportList(number, startDate, endDate, pageSize, pageIndex) {
       let params = {
         frequency: number || 1,
         startDate,
         endDate,
-        pageSize,//页大小
-        pageIndex//页面
+        pageSize, //页大小
+        pageIndex, //页面
       };
       getReportSearch({ ...params }).then((res) => {
         const { data } = res;
         this.srcList = data.result;
-        this.total = data.total
+        this.total = data.total;
       });
     },
 
@@ -218,39 +217,68 @@ export default {
       if (command === "年度") {
         this.formData.frequency = 3;
       }
-      this.number = this.formData.frequency
-      this.getReportList(this.formData.frequency);
+      this.number = this.formData.frequency;
+      this.getReportList(
+        this.formData.frequency,
+        this.formData.startTime,
+        this.formData.endTime,
+        this.pagesize,
+        this.currentPage
+      );
     },
 
-     // 日期审核状态查询
-    startEndTime() {
-      this.formData.startTime = this.value2[0]
-      this.formData.endTime = this.value2[1]
-      this.currentPage = 1
-       this.getReportList(this.number,this.formData.startTime,this.formData.endTime,this.pagesize,this.currentPage);
+    // 日期审核状态查询
+    startEndTime(item) {
+      if (item == null) {
+        item = [];
+        this.formData.startTime = "";
+        this.formData.endTime = "";
+        this.currentPage = 1;
+        this.getReportList(
+          this.number,
+          this.formData.startTime,
+          this.formData.endTime,
+          this.pagesize,
+          this.currentPage
+        );
+      } else {
+        this.formData.startTime = this.value2[0];
+        this.formData.endTime = this.value2[1];
+        this.currentPage = 1;
+        this.getReportList(
+          this.number,
+          this.formData.startTime,
+          this.formData.endTime,
+          this.pagesize,
+          this.currentPage
+        );
+      }
     },
-      /* 分页功能,改变当前页 */
+    /* 分页功能,改变当前页 */
     handleCurrentChange(val) {
-      this.currentPage = val
-      this.getReportList(this.number,this.formData.startTime,this.formData.endTime,this.pagesize,this.currentPage)
+      this.currentPage = val;
+      this.getReportList(
+        this.number,
+        this.formData.startTime,
+        this.formData.endTime,
+        this.pagesize,
+        this.currentPage
+      );
     },
 
     /* 分页功能:去首页 */
     jumpFirstPage() {
-      this.$refs.pagination.handleCurrentChange(1)
-      this.$emit('handleCurrentChange', 1)
+      this.$refs.pagination.handleCurrentChange(1);
+      this.$emit("handleCurrentChange", 1);
     },
 
     /* 分页功能:去尾页 */
     jumpLastPage() {
-      const font = this.$refs.pagination
-      const cpage = Math.ceil(font.total / font.pageSize)
-      font.handleCurrentChange(cpage)
+      const font = this.$refs.pagination;
+      const cpage = Math.ceil(font.total / font.pageSize);
+      font.handleCurrentChange(cpage);
     },
 
-
-
-
     shipments1() {
       this.$router.push({
         path: "/shipments1",

+ 30 - 13
src/views/shipments/shipments1.vue

xqd xqd
@@ -56,7 +56,7 @@
     >
       <el-table-column align="center" label="" width="55" type="selection">
       </el-table-column>
-      <el-table-column label="出票人" align="center" prop="drawerName">
+      <el-table-column label="出票人名称" align="center" prop="drawerName">
       </el-table-column>
       <el-table-column
         label="统计周期(按照出票日)"
@@ -235,20 +235,37 @@ export default {
         this.formData.frequency = 3;
       }
       this.number = this.formData.frequency;
-      this.getReportList(this.formData.frequency);
-    },
-    // 日期审核状态查询
-    startEndTime() {
-      this.formData.startTime = this.value2[0];
-      this.formData.endTime = this.value2[1];
-      this.currentPage = 1;
-      this.getReportList(
-        this.number,
-        this.formData.startTime,
+      this.getReportList(this.formData.frequency, this.formData.startTime,
         this.formData.endTime,
         this.pagesize,
-        this.currentPage
-      );
+        this.currentPage);
+    },
+    // 日期审核状态查询
+    startEndTime(item) {
+     if (item == null) {
+        item = [];
+        this.formData.startTime = "";
+        this.formData.endTime = "";
+        this.currentPage = 1;
+        this.getReportList(
+          this.number,
+          this.formData.startTime,
+          this.formData.endTime,
+          this.pagesize,
+          this.currentPage
+        );
+      } else {
+        this.formData.startTime = this.value2[0];
+        this.formData.endTime = this.value2[1];
+        this.currentPage = 1;
+        this.getReportList(
+          this.number,
+          this.formData.startTime,
+          this.formData.endTime,
+          this.pagesize,
+          this.currentPage
+        );
+      }
     },
     /* 分页功能,改变当前页 */
     handleCurrentChange(val) {

+ 29 - 13
src/views/shipments/shipments2.vue

xqd xqd xqd
@@ -3,7 +3,7 @@
     <el-row type="flex" justify="space-between" style="margin-bottom: 20px">
       <div class="grid-content bg-purple">
         <el-input
-          placeholder="请输入查询内容"
+          placeholder="请输入合同名称"
           v-model="string"
           @change="Search"
           style="width: 100%"
@@ -220,18 +220,6 @@ export default {
 
     // 合同查询
     Search() {
-      this.getReportList(
-        this.string,
-        this.formData.startTime,
-        this.formData.endTime
-      );
-    },
-
-    // 日期审核状态查询
-    startEndTime() {
-      this.formData.startTime = this.value2[0];
-      this.formData.endTime = this.value2[1];
-      this.currentPage = 1;
       this.getReportList(
         this.string,
         this.formData.startTime,
@@ -241,6 +229,34 @@ export default {
       );
     },
 
+    // 日期审核状态查询
+    startEndTime(item) {
+      if (item == null) {
+        item = [];
+        this.formData.startTime = "";
+        this.formData.endTime = "";
+        this.currentPage = 1;
+        this.getReportList(
+          this.number,
+          this.formData.startTime,
+          this.formData.endTime,
+          this.pagesize,
+          this.currentPage
+        );
+      } else {
+        this.formData.startTime = this.value2[0];
+        this.formData.endTime = this.value2[1];
+        this.currentPage = 1;
+        this.getReportList(
+          this.number,
+          this.formData.startTime,
+          this.formData.endTime,
+          this.pagesize,
+          this.currentPage
+        );
+      }
+    },
+
     /* 分页功能,改变当前页 */
     handleCurrentChange(val) {
       this.currentPage = val;

+ 27 - 7
src/views/shipments/shipments3.vue

xqd xqd
@@ -4,7 +4,7 @@
       <div class="grid-content bg-purple">
         <div class="grid-content bg-purple">
           <el-input
-            placeholder="请输入查询内容"
+            placeholder="请输入供应商名称"
             v-model="string"
             @change="Search"
             style="width: 100%"
@@ -225,15 +225,35 @@ export default {
     
     // 供应商查询
     Search() {
-      this.getReportList(this.string,this.formData.startTime,this.formData.endTime);
+      this.getReportList(this.string,this.formData.startTime,this.formData.endTime,this.pagesize,this.currentPage);
     },
 
     // 日期审核状态查询
-    startEndTime() {
-      this.formData.startTime = this.value2[0]
-      this.formData.endTime = this.value2[1]
-       this.currentPage = 1
-      this.getReportList(this.string,this.formData.startTime,this.formData.endTime,this.pagesize,this.currentPage);
+    startEndTime(item) {
+     if (item == null) {
+        item = [];
+        this.formData.startTime = "";
+        this.formData.endTime = "";
+        this.currentPage = 1;
+        this.getReportList(
+          this.number,
+          this.formData.startTime,
+          this.formData.endTime,
+          this.pagesize,
+          this.currentPage
+        );
+      } else {
+        this.formData.startTime = this.value2[0];
+        this.formData.endTime = this.value2[1];
+        this.currentPage = 1;
+        this.getReportList(
+          this.number,
+          this.formData.startTime,
+          this.formData.endTime,
+          this.pagesize,
+          this.currentPage
+        );
+      }
     },
         /* 分页功能,改变当前页 */
     handleCurrentChange(val) {

+ 19 - 11
src/views/sucuirtyaudit/annexList.vue

xqd xqd xqd xqd xqd xqd
@@ -4,7 +4,7 @@
       <div class="grid-content bg-purple">
         <div class="grid-content bg-purple" style="margin-left: 30px">
           <el-input
-            placeholder="请输入查询内容"
+            placeholder="请输入合同名称"
             v-model="formData.content"
             @change="Search"
             style="width: 80%"
@@ -15,7 +15,7 @@
       </div>
       <div class="grid-content bg-purple">
          <el-input
-          placeholder="操作人员查询"
+          placeholder="请输入供应商名称"
           v-model="formData.operateUser"
           @change="SearchOperateUser"
           style="width: 100%"
@@ -67,7 +67,7 @@
       </el-table-column>
 
       <el-table-column
-        label="供应商"
+        label="供应商名称"
         align="center"
         width="340"
         prop="supplierName"
@@ -144,7 +144,6 @@
     </div>
   </div>
 </template>
->>>>>>> a56d1a10ff24406d6daa6c5c7166613d38fb8261
 
 <script>
 import { getAuditLogAttachmentsSearch } from "@/api/auditlog";
@@ -261,12 +260,21 @@ export default {
     },
 
     // 日期审核状态查询
-    startEndTime() {
-      this.formData.startTime = this.value2[0];
-      this.formData.endTime = this.value2[1];
-      this.currentPage = 1;
-      this.searchForm = { ...this.formData };
-      this.getAllList(this.searchForm);
+    startEndTime(item) {
+      if (item == null) {
+        item = [];
+        this.formData.startTime ='';
+        this.formData.endTime = '';
+        this.currentPage = 1;
+        this.searchForm = { ...this.formData };
+        this.getAllList(this.searchForm);
+      } else {
+        this.formData.startTime = this.value2[0];
+        this.formData.endTime = this.value2[1];
+        this.currentPage = 1;
+        this.searchForm = { ...this.formData };
+        this.getAllList(this.searchForm);
+      }
     },
 
     /* 分页功能,改变当前页 */
@@ -404,7 +412,7 @@ export default {
 				})
 			}
 		}
-	
+
 
 </script>
 <style lang="scss">

+ 6 - 1
src/views/sucuirtyaudit/detail.vue

xqd xqd
@@ -1,6 +1,8 @@
 <template>
+
 	<div>
 		<el-descriptions title="详情信息" :column="2" border style="margin: 20px;">
+
 			<el-descriptions-item label="姓名">{{tableData.userName}}</el-descriptions-item>
 			<el-descriptions-item label="状态">{{tableData.status}}</el-descriptions-item>
 			<el-descriptions-item label="id">{{tableData.recordId}}</el-descriptions-item>
@@ -69,5 +71,8 @@
 	}
 </script>
 
-<style>
+<style lang="scss">
+.sucuirtyaudit-deatil{
+	padding: 20px;
+}
 </style>

+ 21 - 11
src/views/sucuirtyaudit/index.vue

xqd xqd xqd xqd
@@ -4,7 +4,7 @@
       <div class="grid-content bg-purple">
         <div class="grid-content bg-purple">
           <el-input
-            placeholder="请输入查询内容"
+            placeholder="请输入操作事件"
             v-model="formData.content"
             @change="Search"
             style="width: 100%"
@@ -15,7 +15,7 @@
       </div>
       <div class="grid-content bg-purple">
         <el-input
-          placeholder="操作人员查询"
+          placeholder="请输入操作人员名称"
           v-model="formData.operateUser"
           @change="SearchOperateUser"
           style="width: 100%"
@@ -63,15 +63,15 @@
     >
       <el-table-column align="center" label="" width="55" type="selection">
       </el-table-column>
-      <el-table-column align="center" prop="created_at" label="操作日">
+      <el-table-column align="center" prop="created_at" label="操作日" width="200">
         <template slot-scope="scope">
           <i class="el-icon-time" />
           <span>{{ scope.row.createdAt }}</span>
         </template>
       </el-table-column>
-      <el-table-column label="事件" align="center" width="340" prop="event">
+      <el-table-column label="操作事件名称" align="center" width="340" prop="event">
       </el-table-column>
-      <el-table-column label="操作人员" align="center" prop="userName">
+      <el-table-column label="操作人员名称" align="center" prop="userName" width="120">
       </el-table-column>
       <el-table-column label="操作状态" align="center" prop="status">
       </el-table-column>
@@ -237,12 +237,22 @@ export default {
     },
 
     // 日期审核状态查询
-    startEndTime() {
-      this.formData.startTime = this.value2[0];
-      this.formData.endTime = this.value2[1];
-      this.currentPage = 1;
-      this.searchForm = { ...this.formData };
-      this.getAllList(this.searchForm);
+    startEndTime(item) {
+       if (item == null) {
+        item = [];
+        this.formData.startTime ='';
+        this.formData.endTime = '';
+        this.currentPage = 1;
+        this.searchForm = { ...this.formData };
+        this.getAllList(this.searchForm);
+      } else {
+        this.formData.startTime = this.value2[0];
+        this.formData.endTime = this.value2[1];
+        this.currentPage = 1;
+        this.searchForm = { ...this.formData };
+        this.getAllList(this.searchForm);
+      }
+
     },
 
     /* 分页功能,改变当前页 */

+ 3 - 3
src/views/table/detail.vue

xqd
@@ -1,11 +1,11 @@
 <template>
 	<div  >
 		<el-descriptions title="承兑人详情" :column="3" :size="size" border style="margin: 20px;">
-			<el-descriptions-item label="姓名">{{ tableData.name }}</el-descriptions-item>
+			<el-descriptions-item label="承兑人名称">{{ tableData.name }}</el-descriptions-item>
 			<el-descriptions-item label="服务费率">{{ tableData.serviceRate }}</el-descriptions-item>
 			<el-descriptions-item label="利率">{{ tableData.interest }}</el-descriptions-item>
-			<el-descriptions-item label="银行账户">{{ tableData.bankAccount }}</el-descriptions-item>
-			<el-descriptions-item label="行名称">{{ tableData.bankName }}</el-descriptions-item>
+			<el-descriptions-item label="账号">{{ tableData.bankAccount }}</el-descriptions-item>
+			<el-descriptions-item label="开户行名称">{{ tableData.bankName }}</el-descriptions-item>
 		</el-descriptions>
 		<el-dialog title="修改供应商" :visible.sync="dialogVisible" width="40%">
 		<el-form ref="form" :model="tableData" label-width="80px" >

+ 7 - 3
src/views/table/index.vue

xqd xqd xqd
@@ -20,7 +20,7 @@
 						<i class="el-icon-arrow-down el-icon--right"></i>
 					</div>
 					<el-dropdown-menu slot="dropdown">
-						<el-dropdown-item command="承兑人状态">承兑人状态</el-dropdown-item>
+						<el-dropdown-item command="全部">全部</el-dropdown-item>
 						<el-dropdown-item command="正常">正常</el-dropdown-item>
 						<el-dropdown-item command="删除">删除</el-dropdown-item>
 					</el-dropdown-menu>
@@ -47,9 +47,9 @@
 			<el-table-column align="center" label="利率" prop="interest">
 				<template slot-scope="scope"> {{ scope.row.interest }}% </template>
 			</el-table-column>
-			<el-table-column align="center" label="状态" prop="statusText">
+			<el-table-column align="center" label="承兑人状态" prop="statusText">
 			</el-table-column>
-			<el-table-column align="center" label="时间" prop="createdAt">
+			<el-table-column align="center" label="时间" prop="createdAt" width='200'>
 			</el-table-column>
 			<el-table-column align="center" prop="created_at" label="操作" width="300">
 				<template slot-scope="scope">
@@ -264,6 +264,10 @@
 				  if (command === '删除') {
 				    this.formData.status = 4
 				  }
+				  if (command === '全部') {
+				    this.formData.status =''
+				  }
+				  
 				this.currentPage = 1;
 				this.searchForm = {
 					...this.formData