zh 2 роки тому
батько
коміт
a6d7086566
2 змінених файлів з 78 додано та 79 видалено
  1. 9 0
      src/api/basic_data/taker.js
  2. 69 79
      src/views/basic_data/taker/taker_list.vue

+ 9 - 0
src/api/basic_data/taker.js

@@ -127,3 +127,12 @@ export function exportCarList(params) {
     params
   })
 }
+
+export function updateCar(params) {
+  return request({
+    url: '/taker-record/update',
+    method: 'post',
+    data: params
+  })
+}
+

+ 69 - 79
src/views/basic_data/taker/taker_list.vue

@@ -1,15 +1,15 @@
 <template>
   <template-page
     ref="pageRef"
-    :getList="getList"
+    :get-list="getList"
     :operation="operation()"
-    :optionsEvensGroup="optionsEvensGroup"
-    :exportList="exportList"
-    :columnParsing="columnParsing"
-    :tableAttributes="tableAttributes"
-    :tableEvents="tableEvents"
-    :operationColumnWidth="200"
-    :replaceOrNotMap="false"
+    :options-evens-group="optionsEvensGroup"
+    :export-list="exportList"
+    :column-parsing="columnParsing"
+    :table-attributes="tableAttributes"
+    :table-events="tableEvents"
+    :operation-column-width="200"
+    :replace-or-not-map="false"
   >
     <!-- 弹窗 -->
     <el-dialog
@@ -30,24 +30,24 @@
             >
             </el-option>
           </el-select> -->
-          <el-input disabled v-model="addForm.customerName"></el-input>
+          <el-input v-model="addForm.customerName" disabled />
         </el-form-item>
         <el-row>
           <el-col :span="12">
             <el-form-item label="提货人姓名" prop="takerName">
-              <el-input v-model="addForm.takerName"></el-input>
+              <el-input v-model="addForm.takerName" />
             </el-form-item>
           </el-col>
           <el-col :span="12">
             <el-form-item label="身份证号码" prop="identity">
-              <el-input v-model="addForm.identity"></el-input>
+              <el-input v-model="addForm.identity" />
             </el-form-item>
           </el-col>
         </el-row>
         <el-row>
           <el-col :span="12">
             <el-form-item label="联系电话" prop="phone">
-              <el-input v-model="addForm.phone"></el-input>
+              <el-input v-model="addForm.phone" />
             </el-form-item>
           </el-col>
           <!-- <el-col :span="12">
@@ -76,18 +76,17 @@
                 placeholder="选择日期"
                 format="yyyy 年 MM 月 dd 日"
                 value-format="yyyy-MM-dd"
-              >
-              </el-date-picker>
+              />
             </el-form-item>
           </el-col>
           <el-col :span="12">
             <el-form-item label="备用电话" prop="sparePhone">
-              <el-input v-model="addForm.sparePhone"></el-input>
+              <el-input v-model="addForm.sparePhone" />
             </el-form-item>
           </el-col>
         </el-row>
         <el-form-item label="上传提货人附件" prop="fileUrl">
-          <fileUpload :fileList="fileList" />
+          <fileUpload :file-list="fileList" />
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
@@ -108,7 +107,8 @@ import {
   stopTaker,
   deleDataList,
   v2TakerRecordList,
-  v2TakerRecordListExport
+  v2TakerRecordListExport,
+  updateCar
 } from '@/api/basic_data/taker'
 import { getDealerList } from '@/api/basic_data/dealer'
 import { downloadFiles } from '@/utils/util'
@@ -172,7 +172,7 @@ export default {
         expireTime: '',
         code: ''
       },
-      show: true, //验证码
+      show: true, // 验证码
       count: '',
       timer: null,
 
@@ -213,7 +213,7 @@ export default {
         phoneKeyword: ''
       },
       dealerList: [],
-      id: '', //重建之前的Id
+      id: '', // 重建之前的Id
       showOK: true
     }
   },
@@ -237,11 +237,11 @@ export default {
     operation() {
       return (h, { row, index, column }) => {
         return (
-          <div class="operation-btns">
+          <div class='operation-btns'>
             <el-button
-              size="mini"
-              type="text"
-              onClick={async () => {
+              size='mini'
+              type='text'
+              onClick={async() => {
                 this.seeFn(row)
               }}
             >
@@ -250,12 +250,12 @@ export default {
 
             {this.$checkBtnRole('del', this.$route.meta.roles) ? (
               <el-popconfirm
-                onOnConfirm={async () => {
+                onOnConfirm={async() => {
                   this.deleFn(row.id)
                 }}
-                title="是否确定需要删除该项内容?"
+                title='是否确定需要删除该项内容?'
               >
-                <el-button slot="reference" size="mini" type="text">
+                <el-button slot='reference' size='mini' type='text'>
                   删除
                 </el-button>
               </el-popconfirm>
@@ -265,9 +265,9 @@ export default {
 
             {row.flag === 1 ? (
               <el-button
-                size="mini"
-                type="text"
-                onClick={async () => {
+                size='mini'
+                type='text'
+                onClick={async() => {
                   this.stopFn(row.id)
                 }}
               >
@@ -278,9 +278,9 @@ export default {
             )}
             {row.flag === 2 ? (
               <el-button
-                size="mini"
-                type="text"
-                onClick={async () => {
+                size='mini'
+                type='text'
+                onClick={async() => {
                   this.rebuild(row)
                 }}
               >
@@ -294,7 +294,7 @@ export default {
       }
     },
 
-    //重建
+    // 重建
     rebuild(data) {
       this.showOK = true
       this.id = data.id
@@ -311,14 +311,14 @@ export default {
       this.fileList = []
       this.dialogForm = true
     },
-    //删除
+    // 删除
     async deleFn(ids) {
       await deleDataList({ ids })
       this.$message.success('删除成功')
       // this.getDataList()
       this.$refs.pageRef.refreshList()
     },
-    //查看
+    // 查看
     seeFn(data) {
       this.showOK = false
       this.addForm = data
@@ -326,7 +326,7 @@ export default {
       this.dialogForm = true
     },
 
-    //取消
+    // 取消
     cancelFn() {
       if (this.addForm.id) {
         this.addForm = {
@@ -344,7 +344,7 @@ export default {
       this.count = 0
       this.dialogForm = false
     },
-    //上传
+    // 上传
     handlefile(response, file, fileList) {
       console.log(response, file, fileList)
     },
@@ -356,17 +356,17 @@ export default {
     //   };
     //   downloadFiles("/taker-record/export", screenData);
     // },
-    //停用提货人档案
+    // 停用提货人档案
     async stopFn(id) {
       await stopTaker({ id })
       this.$message.success('成功')
       // this.getDataList()
       this.$refs.pageRef.refreshList()
     },
-    //获取验证码
+    // 获取验证码
     async getCodeFn() {
       const res = await getCodeApi({ mobile: this.addForm.phone })
-      const TIME_COUNT = 60 //倒计时的初始值
+      const TIME_COUNT = 60 // 倒计时的初始值
       this.count = TIME_COUNT
       this.show = false
       this.timer = setInterval(() => {
@@ -379,30 +379,30 @@ export default {
         }
       }, 1000)
     },
-    //获取经销商数据
+    // 获取经销商数据
     async getDealerDataList(data) {
       const res = await getDealerList(data)
       this.dealerList = res.data.records
     },
-    //获取列表数据
+    // 获取列表数据
     async getDataList() {
-      let params = {
+      const params = {
         customerName: this.searchForm.customerName,
         takerName: this.searchForm.takerName,
         phoneKeyword: this.searchForm.phoneKeyword,
         pageNum: this.currentPage,
         pageSize: this.pageSize
       }
-      let res = await getList(params)
+      const res = await getList(params)
       this.dataList = res.data.records
       this.listTotal = res.data.total
     },
-    //搜索功能
+    // 搜索功能
     async searchFn() {
       this.currentPage = 1
       await this.getDataList()
     },
-    //重置
+    // 重置
     clearFn() {
       this.$refs.searchForm.resetFields()
     },
@@ -418,50 +418,40 @@ export default {
       this.currentPage = val
       this.getDataList()
     },
-    //新增
+    // 新增
     async addDataFn() {
       await this.$refs.addForm.validate()
-
-      // const res = this.dealerList.filter(
-      //   (v) => v.id === this.addForm.customerId
-      // )[0];
-      // console.log(res);
-
-      if (this.fileList.length == 1) {
-        await addDataList({
+      if (this.id) {
+        await updateCar({
           ...this.addForm,
-
           customerId: this.customerId,
-          fileName: this.fileList[0].name,
-          fileUrl: this.fileList[0].url
+          fileName: this.fileList.length && this.fileList[0].name || '',
+          fileUrl: this.fileList.length && this.fileList[0].url || '',
+          id: this.id
         })
+        this.$message.success('重建成功')
       } else {
-        await addDataList({
-          ...this.addForm,
-          customerId: this.customerId,
-          fileName: '',
-          fileUrl: ''
-        })
-      }
+        if (this.fileList.length == 1) {
+          await addDataList({
+            ...this.addForm,
 
-      if (this.id) {
-        await deleDataList({ ids: this.id })
+            customerId: this.customerId,
+            fileName: this.fileList[0].name,
+            fileUrl: this.fileList[0].url
+          })
+        } else {
+          await addDataList({
+            ...this.addForm,
+            customerId: this.customerId,
+            fileName: '',
+            fileUrl: ''
+          })
+        }
+        this.$message.success('新增成功')
       }
 
-      this.$message.success('新增成功')
       this.id = ''
-      // this.addForm = {
-      //   customerId: "",
-      //   takerName: "",
-      //   identity: "",
-      //   phone: "",
-
-      //   sparePhone: "",
-      //   expireTime: "",
-      //   code: "",
-      // };
       this.count = 0
-      // this.getDataList()
       this.$refs.pageRef.refreshList()
       this.dialogForm = false
     },