Browse Source

下发管理

daiqisheng 3 years ago
parent
commit
cf537963b6
1 changed files with 55 additions and 41 deletions
  1. 55 41
      src/pages/main/performance/issue.vue

+ 55 - 41
src/pages/main/performance/issue.vue

@@ -8,9 +8,9 @@
         :loading="table_loading"
         :handle-row="table_handle_row"
         @principalName="(params) => handleVisible('principalName', params)"
-        @detail="handleVisible('template')"
+        @detail="(params) => handleVisible('detail', params)"
         @withdraw="handleWithdraw"
-        @edit="handleVisible('template')"
+        @edit="(params) => handleVisible('edit', params)"
       ></simple-table>
       <simple-pagination
         :page="page"
@@ -32,7 +32,8 @@
           >
         </div>
       </div>
-      <sheet />
+      <simpleSheet v-if="isCheck" :id="edit_rows.id" />
+      <simpleSheet v-else :id="edit_rows.id" type="edit" />
       <template v-slot:footer><div></div></template>
     </simple-dialog>
     <simple-dialog
@@ -58,7 +59,7 @@ import simpleForm from "./components/form.vue";
 import simpleTable from "./components/table.vue";
 import simpleDialog from "./components/dialog.vue";
 import simplePagination from "./components/pagination.vue";
-import sheet from "./components/sheet.vue"
+import simpleSheet from "./components/sheet.vue";
 export default {
   components: {
     // analysis,
@@ -66,13 +67,15 @@ export default {
     simpleDialog,
     simpleForm,
     simplePagination,
-    sheet
+    simpleSheet,
   },
   data() {
     return {
       page: 1,
       rows: 10,
       total: 0,
+      edit_rows: {},
+      isCheck: false,
       template_visible: false,
       receiver_visible: false,
       table_loading: false,
@@ -162,30 +165,15 @@ export default {
   methods: {
     async handleInit(data) {
       this.$http({
-        url: "/CMKIssued/CMKIssuedList",
+        url: "/market/CMKIssued/CMKIssuedList",
         method: "post",
         headers: {
           "Content-Type": "application/json",
         },
         data: data,
-      }).then((res) => {
-        console.log(res);
-        res.data = this.table_list;
-        this.table_list.push(...[{
-          templateName: "模板名称",
-          precautions: "填报注意事项",
-          reason: "填报事由",
-          endTime: new Date(),
-          id: 23,
-          principalName: "接收人",
-        },{
-          templateName: "模板名称",
-          precautions: "填报注意事项",
-          reason: "填报事由",
-          endTime: new Date(),
-          id: 24,
-          principalName: "接收人",
-        }]);
+      }).then(({ data: { data } }) => {
+        console.log(data, "res");
+        this.table_list = data;
       });
       // this.table_loading = true;
       // const data = [];
@@ -205,20 +193,41 @@ export default {
     handleSearch(data) {
       this.table_search = data;
       this.handleReset();
-      this.handleInit({ ...data, page: this.page, pagesize: this.rows });
+      this.handleInit({ ...data, page: this.page, pageSize: this.rows });
     },
     handleChange(page) {
       this.page = page;
       this.handleInit({
         ...this.table_search,
         page: this.page,
-        pagesize: this.rows,
+        pageSize: this.rows,
       });
     },
     handleVisible(props, params) {
       switch (props) {
+        case "detail":
+          if (params) {
+            this.isCheck = true;
+            this.edit_rows = params;
+            this.template_visible = true;
+          } else {
+            this.isCheck = false;
+            this.template_visible = false;
+          }
+          // this.template_visible = !this.template_visible;
+          break;
+        case "edit":
+          if (params) {
+            this.edit_rows = params;
+            this.template_visible = true;
+          } else {
+            this.template_visible = false;
+          }
+          // this.template_visible = !this.template_visible;
+          break;
         case "template":
-          this.template_visible = !this.template_visible;
+            this.template_visible = false;
+          // this.template_visible = !this.template_visible;
           break;
         case "principalName":
           if (params) {
@@ -233,26 +242,31 @@ export default {
     },
     handleWithdraw({ id }) {
       console.log({ id });
-      // this.$http({
-      //   url: "/CMKIssued/CMKDelIssuedById",
-      //   method: "post",
-      //   headers: {
-      //     "Content-Type": "application/json",
-      //   },
-      //   data: { id },
-      // }).then((res) => {
-      //   if (res) {
-      //     this.$message.success("撤回成功");
-      //     this.handleInit();
-      //   }
-      // });
+      this.$http({
+        url: "/market/CMKIssued/CMKDelIssuedById",
+        method: "post",
+        headers: {
+          "Content-Type": "application/json",
+        },
+        data: { id },
+      }).then(({ data }) => {
+        console.log(data);
+        if (data.desc === "删除成功") {
+          this.$message.success("撤回成功");
+          this.handleInit({
+            ...this.table_search,
+            page: this.page,
+            pageSize: this.rows,
+          });
+        }
+      });
     },
   },
   mounted() {
     this.handleInit({
       ...this.table_search,
       page: this.page,
-      pagesize: this.rows,
+      pageSize: this.rows,
     });
   },
 };