Procházet zdrojové kódy

Merge branch 'master' of http://47.100.37.243:10080/ZHOU/yunsu

před 5 roky
rodič
revize
5c85694247
1 změnil soubory, kde provedl 72 přidání a 131 odebrání
  1. 72 131
      ys_vue/src/views/mold/moldDownload.vue

+ 72 - 131
ys_vue/src/views/mold/moldDownload.vue

@@ -21,7 +21,20 @@
           <el-button type="primary">查询</el-button>
         </el-form-item>
         <el-form-item style="float: right;">
-          <el-button type="primary">下载</el-button>
+          <el-dropdown>
+            <el-button type="primary">
+              下载
+              <i class="el-icon-arrow-down el-icon--right"></i>
+            </el-button>
+            <el-dropdown-menu slot="dropdown">
+              <el-dropdown-item @click.native="download(0)">全部下载</el-dropdown-item>
+              <el-dropdown-item @click.native="download(1)" divided>模具3D图档</el-dropdown-item>
+              <el-dropdown-item @click.native="download(2)">模具2D图档</el-dropdown-item>
+              <el-dropdown-item @click.native="download(3)">零件3D图档</el-dropdown-item>
+              <el-dropdown-item @click.native="download(4)">零件2D图档</el-dropdown-item>
+              <el-dropdown-item @click.native="download(5)">保养方案</el-dropdown-item>
+            </el-dropdown-menu>
+          </el-dropdown>
         </el-form-item>
       </el-form>
     </el-col>
@@ -33,106 +46,44 @@
       highlight-current-row
       v-loading="listLoading"
       style="width: 100%;"
+      @selection-change="selectionChanged"
     >
+      <el-table-column type="selection" width="40"></el-table-column>
       <el-table-column type="index" width="60"></el-table-column>
-      <el-table-column width="200">
-        <template slot="header" slot-scope="scope">
-          <el-checkbox :model="checkBoxArray[0][0].value" @change="checkChanged(0,0)">
-            <span>模具名称</span>
-          </el-checkbox>
-        </template>
+      <el-table-column width="200" label="模具名称" prop="name"></el-table-column>
+      <el-table-column width="200" label="模具3D图档">
         <template slot-scope="scope">
-          <el-checkbox
-            :model="checkBoxArray[scope.row.id][0].value"
-            @change="checkChanged(scope.$index+1,0)"
-          >
-            <span>{{scope.row.name}}</span>
-          </el-checkbox>
+          <span v-if="scope.row.states[0] == 0">未上传</span>
+          <span v-else-if="scope.row.states[0] == 1">审批中</span>
+          <span v-else>已通过</span>
         </template>
       </el-table-column>
-      <el-table-column width="200">
-        <template slot="header" slot-scope="scope">
-          <el-checkbox :model="checkBoxArray[0][1].value" @change="checkChanged(0,1)">
-            <span>模具3D图档</span>
-          </el-checkbox>
-        </template>
+      <el-table-column width="200" label="模具2D图档">
         <template slot-scope="scope">
-          <span v-if="scope.row.states[0] == 0" style="padding-left: 24px;">未上传</span>
-          <span v-else-if="scope.row.states[0] == 1" style="padding-left: 24px;">审批中</span>
-          <span v-else>
-            <el-checkbox
-              :model="checkBoxArray[scope.row.id][1].value"
-              @change="checkChanged(scope.$index+1,1)"
-            >已通过</el-checkbox>
-          </span>
+          <span v-if="scope.row.states[1] == 0">未上传</span>
+          <span v-else-if="scope.row.states[1] == 1">审批中</span>
+          <span v-else>已通过</span>
         </template>
       </el-table-column>
-      <el-table-column width="200">
-        <template slot="header" slot-scope="scope">
-          <el-checkbox :model="checkBoxArray[0][2].value" @change="checkChanged(0,2)">
-            <span>模具2D图档</span>
-          </el-checkbox>
-        </template>
+      <el-table-column width="200" label="零件3D图档">
         <template slot-scope="scope">
-          <span v-if="scope.row.states[1] == 0" style="padding-left: 24px;">未上传</span>
-          <span v-else-if="scope.row.states[1] == 1" style="padding-left: 24px;">审批中</span>
-          <span v-else>
-            <el-checkbox
-              :model="checkBoxArray[scope.row.id][2].value"
-              @change="checkChanged(scope.$index+1,2)"
-            >已通过</el-checkbox>
-          </span>
+          <span v-if="scope.row.states[2] == 0">未上传</span>
+          <span v-else-if="scope.row.states[2] == 1">审批中</span>
+          <span v-else>已通过</span>
         </template>
       </el-table-column>
-      <el-table-column width="200">
-        <template slot="header" slot-scope="scope">
-          <el-checkbox :model="checkBoxArray[0][3].value" @change="checkChanged(0,3)">
-            <span>零件3D图档</span>
-          </el-checkbox>
-        </template>
+      <el-table-column width="200" label="零件2D图档">
         <template slot-scope="scope">
-          <span v-if="scope.row.states[2] == 0" style="padding-left: 24px;">未上传</span>
-          <span v-else-if="scope.row.states[2] == 1" style="padding-left: 24px;">审批中</span>
-          <span v-else>
-            <el-checkbox
-              :model="checkBoxArray[scope.row.id][3].value"
-              @change="checkChanged(scope.$index+1,3)"
-            >已通过</el-checkbox>
-          </span>
+          <span v-if="scope.row.states[3] == 0">未上传</span>
+          <span v-else-if="scope.row.states[3] == 1">审批中</span>
+          <span v-else>已通过</span>
         </template>
       </el-table-column>
-      <el-table-column width="200">
-        <template slot="header" slot-scope="scope">
-          <el-checkbox :model="checkBoxArray[0][4].value" @change="checkChanged(0,4)">
-            <span>零件2D图档</span>
-          </el-checkbox>
-        </template>
+      <el-table-column width="200" label="保养方案">
         <template slot-scope="scope">
-          <span v-if="scope.row.states[3] == 0" style="padding-left: 24px;">未上传</span>
-          <span v-else-if="scope.row.states[3] == 1" style="padding-left: 24px;">审批中</span>
-          <span v-else>
-            <el-checkbox
-              :model="checkBoxArray[scope.row.id][4].value"
-              @change="checkChanged(scope.$index+1,4)"
-            >已通过</el-checkbox>
-          </span>
-        </template>
-      </el-table-column>
-      <el-table-column width="200">
-        <template slot="header" slot-scope="scope">
-          <el-checkbox :model="checkBoxArray[0][5].value" @change="checkChanged(0,5)">
-            <span>保养方案</span>
-          </el-checkbox>
-        </template>
-        <template slot-scope="scope">
-          <span v-if="scope.row.states[4] == 0" style="padding-left: 24px;">未上传</span>
-          <span v-else-if="scope.row.states[4] == 1" style="padding-left: 24px;">审批中</span>
-          <span v-else>
-            <el-checkbox
-              :model="checkBoxArray[scope.row.id][5].value"
-              @change="checkChanged(scope.$index+1,5)"
-            >已通过</el-checkbox>
-          </span>
+          <span v-if="scope.row.states[4] == 0">未上传</span>
+          <span v-else-if="scope.row.states[4] == 1">审批中</span>
+          <span v-else>已通过</span>
         </template>
       </el-table-column>
     </el-table>
@@ -166,27 +117,18 @@ export default {
         { id: 5, name: "墨盒类型5", states: [2, 0, 1, 2, 0] },
         { id: 6, name: "墨盒类型6", states: [2, 2, 2, 2, 2] }
       ],
-      checkBoxArray: [],
-      defaultItem: { value: false, able: true },
-      defaultLine: [
-        { value: false, able: true },
-        { value: false, able: true },
-        { value: false, able: true },
-        { value: false, able: true },
-        { value: false, able: true },
-        { value: false, able: true }
-      ],
       filters: {
         name: "",
         value: ""
       },
       listLoading: false,
       total: 0,
-      tableHeight: 0
+      tableHeight: 0,
+      selectedArray: []
     };
   },
   methods: {
-    //  分页
+    //分页
     handleCurrentChange(val) {
       this.page = val;
       // this.getUsers();
@@ -195,45 +137,44 @@ export default {
       this.size = val;
       // this.getUsers();
     },
-    selsChange(sels) {
-      this.sels = sels;
+    selectionChanged(row) {
+      this.selectedArray = [];
+      row.forEach(item => {
+        this.selectedArray.push(item.id);
+      });
+      console.log(this.selectedArray);
     },
-    // 点击复选框事件
-    checkChanged(y, x) {
-      this.checkBoxArray[y][x].value = !this.checkBoxArray[y][x].value;
-      // if (x == 0 && y == 0 && this.checkBoxArray[0][0].value == true) {
-      //   for (var i = 0; i < this.checkBoxArray.length; i++) {
-      //     for (var j = 0; j < this.checkBoxArray[i].length; j++) {
-      //       if (this.checkBoxArray[i][j].able == true) {
-      //         // this.checkBoxArray[i][j].value = true;
-      //         this.$set(this.checkBoxArray[i], j, {value:true,able:true});
-      //       }
-      //     }
-      //   }
-      // }
-      console.log("(" + x + ", " + y + ") " + this.checkBoxArray[y][x].value);
-      // console.log(this.checkBoxArray);
+    //下载
+    download(type) {
+      if (this.selectedArray == []) {
+        this.$message("请选择要下载的文档");
+      } else {
+        switch (type) {
+          case 0:
+            console.log("点击了下载全部");
+            break;
+          case 1:
+            console.log("点击了下载模具3D图档");
+            break;
+          case 2:
+            console.log("点击了下载模具2D图档");
+            break;
+          case 3:
+            console.log("点击了下载零件3D图档");
+            break;
+          case 4:
+            console.log("点击了下载零件2D图档");
+            break;
+          case 5:
+            console.log("点击了下载保养方案");
+            break;
+        }
+      }
     }
   },
   created() {
     let height = window.innerHeight;
     this.tableHeight = height - 210;
-
-    //向checkBoxArray中push信息
-    this.checkBoxArray = [];
-    this.checkBoxArray.push(this.defaultLine);
-    this.moulds.forEach(mould => {
-      var checkBoxLine = [];
-      checkBoxLine.push(this.defaultItem);
-      for (var i = 0; i < 6; i++) {}
-      mould.states.forEach(state => {
-        var value = false;
-        var able = state == 2;
-        var item = { value, able };
-        checkBoxLine.push(item);
-      });
-      this.checkBoxArray.push(checkBoxLine);
-    });
   },
   mounted() {}
 };