Prechádzať zdrojové kódy

经销商授权管理-编辑接口与提交接口参数修改;时间格式化设置默认格式

002390 2 rokov pred
rodič
commit
06c852fa06

+ 11 - 8
src/views/marketing/dealer-authorization/authprivAdd.vue

@@ -106,19 +106,20 @@ export default {
           // 校验通过
           let isTime = this.formData.time && this.formData.time != '' && this.formData.time.length;
 
-          const { name, id, } = this.$store.state.user;
+          // name:工号   nickName:名字
+          const { name, nickName } = this.$store.state.user;
 
           let params = {
             ...this.formData,
             startTime: isTime ? this.formData.time[0] : '',
             endTime: isTime ? this.formData.time[1] : '',
-            updatePerson: name,
-            updateTime: new Date().Format('yyyy-MM-dd HH:mm:ss'),
+            updatePerson: nickName,
+            updateTime: new Date().Format(),
             ...(
               this.isAdd ? {
                 status: '0',
-                createPerson: name,
-                createTime: new Date().Format('yyyy-MM-dd HH:mm:ss'),
+                createPerson: nickName,
+                createTime: new Date().Format(),
               } : {}
             )
 
@@ -128,9 +129,11 @@ export default {
 
           try {
             this.loading = true;
-            let { code, msg } = await (this.isAdd ?
-              dealerApi.insert(params) :
-              dealerApi.update(params))
+            let { code, msg } = await (
+              this.isAdd ?
+                dealerApi.insert(params) :
+                dealerApi.update(params)
+            )
 
             if (code === 200) {
               this.handleCancel();

+ 11 - 8
src/views/marketing/dealer-authorization/authprivSee.vue

@@ -3,14 +3,17 @@
   <el-dialog title="查看" :visible.sync="visible" :close-on-click-modal="false" :close-on-press-escape="false">
     <el-form :model="formData" label-position="left" label-width="120px">
       <el-form-item v-for="column in formColumns" :label="column.title" :prop="column.key">
-        <el-input v-if="column.type == 'Input'" readonly v-model="formData[column.key]" autocomplete="off"></el-input>
+        <el-input v-if="column.type == 'Input'" readonly v-model="formData[column.key]" autocomplete="off">
+        </el-input>
 
         <el-date-picker v-if="column.type == 'DateRange'" readonly v-model="formData[column.key]" type="daterange"
           format="yyyy-MM-dd " value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期"
-          end-placeholder="结束日期"></el-date-picker>
+          end-placeholder="结束日期">
+        </el-date-picker>
 
         <el-date-picker v-if="column.type == 'Date'" readonly v-model="formData[column.key]" type="date"
-          format="yyyy-MM-dd " value-format="yyyy-MM-dd" placeholder="选择日期"></el-date-picker>
+          format="yyyy-MM-dd " value-format="yyyy-MM-dd" placeholder="选择日期">
+        </el-date-picker>
 
       </el-form-item>
     </el-form>
@@ -46,13 +49,13 @@ export default {
 
       if (data.id) {
 
-        let objData = { ...data };
+        this.formData = {
 
-        objData['time'] = [objData.startTime, objData.endTime];
+          ...data,
 
-        // delete data.startTime
-        // delete data.endTime
-        this.formData = objData;
+          time: [data.startTime, data.endTime]
+
+        };
 
       }
 

+ 15 - 11
src/views/marketing/dealer-authorization/index.vue

@@ -41,7 +41,7 @@
         <el-button size="mini" type="primary" @click="handleOpenAddDialog"
           v-hasPermi="['pu:authorization:add']">新增</el-button>
         <!-- <el-button size="mini" @click="handleSubmit">提交</el-button> -->
-        <el-button size="mini" @click="handleDownload">下载授权书</el-button>
+        <!-- <el-button size="mini" @click="handleDownload">下载授权书</el-button> -->
       </el-col>
     </el-row>
 
@@ -59,6 +59,7 @@
       <el-table-column fixed="right" label="操作" width="120">
         <template slot-scope="scope">
           <el-button type="text" size="mini" @click="handleOpenAddDialog(scope.row)"
+            v-if="scope.row.status == '0' || scope.row.status == '3'"
             v-hasPermi="['pu:authorization:edit']">编辑</el-button>
           <el-button type="text" size="mini" @click="handleDelDialog(scope.row)"
             v-if="scope.row.status == '0' || scope.row.status == '3'"
@@ -66,6 +67,7 @@
           <!-- <el-button @click="handleOpenSeeDialog(scope.row)" type="text" size="small">查看</el-button> -->
           <el-button type="text" size="mini" v-if="scope.row.status == '0' || scope.row.status == '3'"
             @click="handleSubmit(scope.row)">提交</el-button>
+          <el-button type="text" size="mini" v-if="scope.row.status == '2'" @click="handleDownload">下载授权书</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -128,17 +130,18 @@ export default {
       delete params['time']
       console.log(params, 'params--------');
 
-      await dealerApi.list(params).then(res => {
-        console.log(res, '获取列表');
-        let { code, rows, total } = res;
-        this.loading = false;
+      try {
+        let { code, rows, total } = await dealerApi.list(params);
         if (code == 200) {
           this.tableData = rows;
           this.page.total = total;
         }
-      }).catch(error => {
+      } catch (error) {
+        console.log(error);
+      } finally {
         this.loading = false;
-      })
+      }
+
     },
     // 重置
     handelResetSearch() {
@@ -230,14 +233,14 @@ export default {
       });
 
     },
-    // 提交
+    // 提交OA
     handleSubmit(row) {
 
-      console.log(row, '提交');
       let params = {
-        id: '',
-        status: ''
+        applicant: '',
+        date: new Date().Format()
       }
+      console.log(row, '提交', params);
       // try {
       //   this.loading = true;
       //   let { code, msg } = await dealerApi.submitOA();
@@ -269,6 +272,7 @@ export default {
   },
   created() {
     this.handelSearch();
+    console.log(this.$store.state.user, 'this.$store.state.user');
   }
 
 }

+ 9 - 9
src/views/marketing/utils/date.js

@@ -5,18 +5,18 @@
 // (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423 
 // (new Date()).Format("yyyy-M-d h:m:s.S")      ==> 2006-7-2 8:9:4.18 
 
-Date.prototype.Format = function (fmt) {
+Date.prototype.Format = function (fmt = 'yyyy-MM-dd HH:mm:ss') {
   var o = {
-      "M+": this.getMonth() + 1, //月份 
-      "d+": this.getDate(), //日 
-      "H+": this.getHours(), //小时 
-      "m+": this.getMinutes(), //分 
-      "s+": this.getSeconds(), //秒 
-      "q+": Math.floor((this.getMonth() + 3) / 3), //季度 
-      "S": this.getMilliseconds() //毫秒 
+    "M+": this.getMonth() + 1, //月份 
+    "d+": this.getDate(), //日 
+    "H+": this.getHours(), //小时 
+    "m+": this.getMinutes(), //分 
+    "s+": this.getSeconds(), //秒 
+    "q+": Math.floor((this.getMonth() + 3) / 3), //季度 
+    "S": this.getMilliseconds() //毫秒 
   };
   if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
   for (var k in o)
-  if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
+    if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
   return fmt;
 }