浏览代码

Merge branch 'dev_info' into test-new

daiqisheng 3 年之前
父节点
当前提交
919bb8f682
共有 2 个文件被更改,包括 66 次插入27 次删除
  1. 57 26
      src/pages/main/performance/components/sheet.vue
  2. 9 1
      vue.config.js

+ 57 - 26
src/pages/main/performance/components/sheet.vue

@@ -1,8 +1,8 @@
 <!--
  * @Author       : yuanrunwei
  * @Date         : 2021-12-04 14:23:58
- * @LastEditors: Please set LastEditors
- * @LastEditTime: 2022-02-10 19:30:09
+ * @LastEditors: daiqisheng
+ * @LastEditTime: 2022-02-14 17:17:57
  * @FilePath     : \spfm-market-front\src\pages\main\performance\components\sheet.vue
 -->
 <template>
@@ -117,11 +117,13 @@
                   <span class="form-content">可编辑行:从</span>
                   <el-input
                     v-model="item.row_start"
+                    @input="(params) => handleInput(index, 'row_start', params)"
                     :disabled="type !== 'edit'"
                   />
                   <span class="form-content">到</span>
                   <el-input
                     v-model="item.row_end"
+                    @input="(params) => handleInput(index, 'row_end', params)"
                     :disabled="type !== 'edit'"
                   />
                 </div>
@@ -130,13 +132,12 @@
                   <el-input
                     :disabled="type !== 'edit'"
                     v-model="item.col_start"
-                    @input="(params) => handleInput(index, 'col_start', params)"
                   />
+                  <!-- @input="(params) => handleInput(index, 'col_start', params)" -->
                   <span class="form-content">到</span>
                   <el-input
                     :disabled="type !== 'edit'"
                     v-model="item.col_end"
-                    @input="(params) => handleInput(index, 'col_end', params)"
                   />
                 </div>
               </div>
@@ -310,8 +311,11 @@ export default {
     //     console.log(e,'e');
     // },
     handleAllow({ row, column }) {
-      let public_permisson = (!this.form.permission_type||this.status==='2') && this.type === "edit";
-      let editable = this.row_list.includes(row) && this.column_list.includes(column);
+      let public_permisson =
+        (!this.form.permission_type || this.status === "2") &&
+        this.type === "edit";
+      let editable =
+        this.row_list.includes(row) && this.column_list.includes(column);
       let totalBoolean = (public_permisson || editable) && this.id;
       return totalBoolean;
     },
@@ -406,12 +410,22 @@ export default {
                 .split(",")
                 .map((element) => JSON.parse(element) - 1)
             : [];
-        this.column_list =
-          this.type === "edit" && list[0].allowEditingColumns
-            ? list[0].allowEditingColumns
-                .split(",")
-                .map((element) => JSON.parse(element) - 1)
-            : [];
+        if (this.type === "edit" && list[0].allowEditingColumns) {
+          // this.column_list = list[0].allowEditingColumns
+          //   .split(",")
+          //   .map((element) => JSON.parse(element) - 1);
+          this.column_list =
+            list[0].allowEditingColumnsFlag === "1"
+              ? list[0].allowEditingColumnsShuzi
+                  .split(",")
+                  .map((element) => JSON.parse(element) - 1)
+              : list[0].allowEditingColumns
+                  .split(",")
+                  .map((element) => JSON.parse(element) - 1);
+        } else {
+          this.column_list = [];
+        }
+        // this.formateNumber(list[0].allowEditingColumns);
       }
       this.handleCreate({
         json: templateContent ? JSON.parse(templateContent) : {},
@@ -419,6 +433,10 @@ export default {
         type: "json",
       });
     },
+    // formateNumber(String) {
+    //   console.log(String, "daa");
+    //   if(String.split(','))
+    // },
     handleForbid() {
       // const object = {};
       const { permission_type } = this.form;
@@ -463,9 +481,9 @@ export default {
               that.$message.error("您没有编辑权限");
             }
           },
-          cellUpdated: function (row, column) {
-            that.rowList.push(row);
-          },
+          // cellUpdated: function (row, column) {
+          //   that.rowList.push(row);
+          // },
           cellUpdateBefore: function (row, column) {
             if (!that.handleAllow({ row, column })) {
               return false;
@@ -482,6 +500,11 @@ export default {
               }
             }
           },
+          updated: function ({ range }) {
+            const { row } = range[0];
+            console.log(`第${row[0]}行被更新了`);
+            that.rowList.push(row[0]);
+          },
         },
       };
       switch (type) {
@@ -562,7 +585,9 @@ export default {
           })
         );
       }
-      await this.$http({
+      const {
+        data: { result, desc },
+      } = await this.$http({
         url: this.id
           ? "/market/CMKFileTemplateAuthority/CMKFileTemplateAuthorityUpdate"
           : "/market/CMKFileTemplateAuthority/CMKFileTemplateAuthorityAdd",
@@ -572,7 +597,12 @@ export default {
         },
         data: reqdata,
       });
-      this.$message.success("操作成功");
+      if (result) {
+        this.$message.error(desc);
+      } else {
+        this.$message.success(desc);
+      }
+      return result;
     },
     async handleSave(type) {
       let edit_url = "";
@@ -608,12 +638,13 @@ export default {
             status: type,
           },
         });
-        this.handleAddAuth({ id: body });
+        await this.handleAddAuth({ id: body });
         this.$emit("save");
       } else {
         // 职位
         let duty = JSON.parse(sessionStorage.userInfo).duty;
         // let { permission_type, charge } = this.form;
+        this.rowList.shift();
         let reqdata = {
           rowIndex: [...new Set(this.rowList)]
             .sort(function (a, b) {
@@ -724,19 +755,17 @@ export default {
         return false;
       }
     },
-    handleAuth() {
+    async handleAuth() {
       this.$refs["form"].validate((valid) => {
         if (valid) {
           if (this.handleForbid()) {
             this.$message.error("请完善可编辑信息");
             return false;
           }
-          this.handleVisible();
           if (this.id) {
             this.handleAddAuth({ id: this.id });
-          } else {
-            this.$message.success("设置成功");
           }
+          this.handleVisible();
         }
       });
     },
@@ -767,14 +796,16 @@ export default {
       }
     },
     handleVisible() {
-      console.log(this.form, "aada");
       this.visible = !this.visible;
     },
     handleInput(index, name, value) {
       let reg = /^[0-9]*$/;
       if (!reg.test(value)) {
-       this.form.charge[index][name]=this.form.charge[index][name].substr(0,this.form.charge[index][name].length-1)
-       this.$message.error("请输入纯数字");
+        this.form.charge[index][name] = this.form.charge[index][name].substr(
+          0,
+          this.form.charge[index][name].length - 1
+        );
+        this.$message.error("该处只能填写数字");
       }
     },
     async handleApprove(type) {
@@ -792,6 +823,7 @@ export default {
         const data = window.luckysheet.getSheet(sheet_name);
         const workbook_name = window.luckysheet.getWorkbookName();
         // let { permission_type, charge } = this.form;
+        this.rowList.shift();
         let reqdata = {
           rowIndex: [...new Set(this.rowList)]
             .sort(function (a, b) {
@@ -806,7 +838,6 @@ export default {
               return data.data[el];
             }),
         };
-        console.log(reqdata, "ada");
         // if (permission_type) {
         //   // 特殊权限
         //   reqdata = {

+ 9 - 1
vue.config.js

@@ -100,6 +100,14 @@ module.exports = {
                     "^/market": "",
                 },
             },
+            "/market/mk": {
+                target: "http://192.168.1.9:9114",
+                ws: false,
+                changeOrigin: true,
+                pathRewrite: {
+                    "^/market": "",
+                },
+            },
             "/market/techcentergj": {
                 target: "http://192.168.1.9:9114",
                 ws: false,
@@ -109,7 +117,7 @@ module.exports = {
                 },
             },
             "/mkWangge": {
-                target: "http://192.168.1.19:9114",
+                target: "http://192.168.1.9:9114",
                 ws: false,
                 changeOrigin: true,
                 pathRewrite: {