Blame view

src/views/ywbl/fqsq/components/clxx.vue 11.2 KB
任超 committed
1
<template>
吴蕾 committed
2
  <div class="clxx">
吴蕾 committed
3
    <div class="left">
任超 committed
4
      <div v-for="item in menuList" :key="item.id" :class="['item', checkedId == item.id ? 'active' : '']"
任超 committed
5
        @click="menuClick(item)">
吴蕾 committed
6
        {{ item.label }}
吴蕾 committed
7
      </div>
吴蕾 committed
8 9 10 11 12
    </div>
    <div class="right">
      <!-- 材料目录明细 -->
      <div class="clmlmx-box" v-if="checkedId == '1'">
        <div class="title">申请材料目录</div>
任超 committed
13
        <lb-table :column="column" :key="key" :heightNum="210" :pagination="false" :data="tableData">
吴蕾 committed
14
        </lb-table>
吴蕾 committed
15
      </div>
吴蕾 committed
16
      <!-- 材料预览 -->
任超 committed
17
      <div class="clyl-box" v-else>
任超 committed
18 19 20 21 22 23 24 25 26 27 28 29 30 31
        <div class="menu-tree">
          <div class="item">
            材料目录
            <i :class="iclass" @click="iconClick()"></i>
            <el-collapse-transition>
              <div v-show="menuOpen">
                <div v-for="item in tableData" :key="item.bsmSj"
                  :class="['child', treeCheckId == item.bsmSj ? 'checked' : '']" @click="treeClick(item)">
                  {{ item.sjmc }}
                </div>
              </div>
            </el-collapse-transition>
          </div>
        </div>
任超 committed
32
        <image-preview :previewImg="previewImg" />
吴蕾 committed
33 34
      </div>
    </div>
吴蕾 committed
35
    <clxxAddDialog v-model="isDialog" />
任超 committed
36 37 38
  </div>
</template>
<script>
吴蕾 committed
39
import { mapGetters } from "vuex";
吴蕾 committed
40
import clxxAddDialog from "./clxxAddDialog.vue";
任超 committed
41
import imagePreview from '@/views/components/imagePreview.vue'
吴蕾 committed
42
import { clmlInit, move, save, clmlDelete } from "@/api/fqsq.js";
任超 committed
43
export default {
任超 committed
44
  components: { clxxAddDialog, imagePreview },
任超 committed
45
  data () {
任超 committed
46
    return {
吴蕾 committed
47
      isDialog: false,
吴蕾 committed
48 49 50 51 52 53 54 55 56 57
      menuList: [
        {
          id: "1",
          label: "材料目录明细",
        },
        {
          id: "2",
          label: "材料预览",
        },
      ],
任超 committed
58 59 60
      menuOpen: true,
      iclass: "itemIcon el-icon-caret-bottom",
      treeCheckId: "",
吴蕾 committed
61 62 63 64 65 66 67 68 69
      checkedId: "1",
      column: [
        {
          width: "60",
          renderHeader: (h, scope) => {
            return (
              <i
                class="el-icon-plus pointer"
                onClick={() => {
任超 committed
70
                  this.handleAdd()
吴蕾 committed
71 72 73 74 75
                }}
              ></i>
            );
          },
          render: (h, scope) => {
吴蕾 committed
76 77
            // 新建的材料,可删除
            if (scope.row.sfxjcl === "1") {
吴蕾 committed
78 79 80 81
              return (
                <i
                  class="el-icon-minus pointer"
                  onClick={() => {
吴蕾 committed
82
                    this.handleDelete(scope.$index, scope.row);
吴蕾 committed
83 84 85 86 87 88 89 90 91 92 93 94
                  }}
                ></i>
              );
            }
          },
        },
        {
          width: "60",
          label: "序号",
          type: "index",
        },
        {
吴蕾 committed
95
          prop: "isrequired",
吴蕾 committed
96 97
          label: "是否必选",
          width: "100",
吴蕾 committed
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
          render: (h, scope) => {
            // 新增的材料,全部为系统默认可选
            if (scope.row.sfxjcl === "1") {
              return (
                <div>
                  <span>可选</span>
                </div>
              );
            }
            // 系统配置的材料
            else {
              return (
                <div>
                  <span>必选</span>
                </div>
              );
            }
          },
吴蕾 committed
116 117
        },
        {
吴蕾 committed
118
          prop: "sjmc",
吴蕾 committed
119 120 121
          label: "材料名称",
        },
        {
吴蕾 committed
122
          prop: "sjlx",
吴蕾 committed
123
          label: "材料类型",
吴蕾 committed
124 125 126 127 128 129 130
          render: (h, scope) => {
            return (
              <div>
                <span>{this.dicStatus(scope.row.sjlx, "A40")}</span>
              </div>
            );
          },
吴蕾 committed
131 132
        },
        {
吴蕾 committed
133
          prop: "sjsl",
吴蕾 committed
134 135 136 137 138
          label: "份数",
        },
        {
          prop: "smzt",
          label: "扫描状态",
吴蕾 committed
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
          render: (h, scope) => {
            if (scope.row.children.length > 0) {
              return (
                <div>
                  <span>已扫描</span>
                </div>
              );
            } else {
              return (
                <div>
                  <span>未扫描</span>
                </div>
              );
            }
          },
吴蕾 committed
154 155
        },
        {
吴蕾 committed
156
          prop: "ys",
吴蕾 committed
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
          label: "扫描页数",
        },
        {
          label: "操作",
          width: "90",
          render: (h, scope) => {
            return (
              <div>
                <el-button
                  type="text"
                  disabled={scope.$index == 0}
                  onClick={() => {
                    this.moveUpward(scope.$index, scope.row);
                  }}
                >
                  上移
                </el-button>
                <el-button
                  type="text"
                  disabled={scope.$index + 1 == this.tableData.length}
                  onClick={() => {
                    this.moveDown(scope.$index, scope.row);
                  }}
                >
                  下移
                </el-button>
              </div>
            );
          },
        },
      ],
吴蕾 committed
188 189
      key: 0,
      tableData: [],
任超 committed
190 191 192 193 194 195 196 197 198 199 200 201
      previewImg: {
        index: 0,
        selectedIndex: 0,
        imgList: [
          {
            url: 'https://img2.baidu.com/it/u=2955521104,3257476296&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=1111'
          },
          {
            url: 'https://img1.baidu.com/it/u=2383300938,4241539174&fm=253&fmt=auto&app=138&f=JPEG?w=307&h=500'
          }
        ],
      }
任超 committed
202 203
    };
  },
吴蕾 committed
204 205 206
  computed: {
    ...mapGetters(["dictData"]),
  },
任超 committed
207
  mounted () {
吴蕾 committed
208 209 210
    if (this.$parent.index == 1) {
      this.clmlmxInit();
    }
吴蕾 committed
211
  },
吴蕾 committed
212
  methods: {
吴蕾 committed
213
    // 左侧菜单点击
任超 committed
214
    menuClick (item) {
吴蕾 committed
215 216 217
      this.checkedId = item.id;
    },
    // 添加材料目录
任超 committed
218
    handleAdd () {
吴蕾 committed
219 220 221
      this.isDialog = true;
    },
    // 上移
任超 committed
222
    moveUpward (index, row) {
吴蕾 committed
223 224 225 226 227 228 229 230 231
      let obj = {
        xh: row.xh,
        bsmSlsq: row.bsmSlsq,
        moveDirection: "up",
      };
      // 接口待调
      move(obj).then((res) => {
        this.clmlmxInit();
      });
吴蕾 committed
232 233
    },
    // 下移
任超 committed
234
    moveDown (index, row) {
吴蕾 committed
235 236 237 238 239 240 241 242 243 244
      let obj = {
        xh: row.xh,
        bsmSlsq: row.bsmSlsq,
        moveDirection: "down",
      };
      // 接口待调
      move(obj).then((res) => {
        console.log("222222222", res);
        this.clmlmxInit();
      });
吴蕾 committed
245 246
    },
    // 材料目录明细初始化
任超 committed
247
    clmlmxInit () {
吴蕾 committed
248 249
      this.id = this.$parent.$parent.$parent.id;
      this.unitData = this.$parent.$parent.$parent.unitData;
吴蕾 committed
250 251 252 253 254 255
      var formdata = new FormData();
      formdata.append("bsmSldy", this.unitData[0].bsmSldy);
      formdata.append("bsmSlsq", this.id);
      clmlInit(formdata).then((res) => {
        if (res.result.result) {
          this.tableData = res.result.result;
吴蕾 committed
256 257 258 259
          this.treeCheckId = this.tableData[0].bsmSj;
          this.title = this.tableData[0].sjmc;
          this.titleYs = 1;
          this.titleNum = this.tableData[0].children.length;
吴蕾 committed
260 261 262 263
        }
      });
    },
    // 新增弹窗保存
任超 committed
264
    addSave (data) {
吴蕾 committed
265
      let maxXh = 0;
任超 committed
266
      this.tableData && this.tableData.forEach((item) => {
吴蕾 committed
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284
        if (item.xh > maxXh) {
          maxXh = item.xh;
        }
      });
      let obj = {
        bsmSlsq: this.id,
        xh: maxXh + 1,
        isrequired: "0",
        sjmc: data.clmc,
        sjlx: data.cllx,
        sfxjcl: "1", // 是否是新建材料
      };
      save(obj).then((res) => {
        if (res.code == 200) {
          this.$message({
            message: "新增成功",
            type: "success",
          });
任超 committed
285
          this.tableData = res.result ? res.result : [];
吴蕾 committed
286 287 288 289 290 291
          // 加载表格
          this.clmlmxInit();
        }
      });
    },
    // 材料目录删除
任超 committed
292
    handleDelete (index, row) {
吴蕾 committed
293 294 295 296 297 298 299 300 301 302
      clmlDelete({ sjBsm: row.bsmSj }).then((res) => {
        if (res.code == 200) {
          this.$message({
            message: "删除成功",
            type: "success",
          });
          // 加载表格
          this.clmlmxInit();
        }
      });
吴蕾 committed
303
    },
吴蕾 committed
304
    // 材料目录关闭收起
任超 committed
305
    iconClick () {
吴蕾 committed
306 307 308 309 310 311 312 313
      this.menuOpen = !this.menuOpen;
      if (this.menuOpen) {
        this.iclass = "itemIcon el-icon-caret-bottom close";
      } else {
        this.iclass = "itemIcon el-icon-caret-bottom open";
      }
    },
    // 材料目录点击选中
任超 committed
314
    treeClick (item) {
吴蕾 committed
315 316 317 318
      this.treeCheckId = item.bsmSj;
      this.title = item.sjmc;
      this.titleYs = 1;
      this.titleNum = item.children.length;
吴蕾 committed
319 320
    },
    // 小图片点击
任超 committed
321
    imgClick (item, index) {
吴蕾 committed
322
      this.showImg = item;
吴蕾 committed
323 324 325
      this.titleYs = index + 1;
    },
    // 字典
任超 committed
326
    dicStatus (val, code) {
吴蕾 committed
327 328 329 330 331 332 333 334 335 336
      let data = this.$store.getters.dictData[code],
        name = "暂无";
      if (data) {
        data.map((item) => {
          if (item.dcode == val) {
            name = item.dname;
          }
        });
        return name;
      }
吴蕾 committed
337 338 339
    },
  },
};
任超 committed
340 341
</script>
<style scoped lang='scss'>
任超 committed
342 343 344 345 346 347 348
@import "~@/styles/mixin.scss";

.active {
  background: $light-blue !important;
  color: #fff;
}

吴蕾 committed
349 350
.clxx {
  width: 100%;
吴蕾 committed
351 352
  display: flex;
  padding-left: 15px;
任超 committed
353
  height: calc(100vh - 150px);
任超 committed
354

吴蕾 committed
355
  .left {
任超 committed
356 357 358
    display: flex;
    flex-direction: column;
    justify-content: space-between;
任超 committed
359

吴蕾 committed
360 361
    .item {
      width: 42px;
任超 committed
362 363 364 365 366
      height: 49%;
      @include flex-center;
      background-color: #E4E7ED;
      border-bottom-right-radius: 10px;
      padding: 15px;
吴蕾 committed
367
      cursor: pointer;
任超 committed
368
      transition: all 0.3s;
任超 committed
369

任超 committed
370 371 372
      &:hover {
        @extend .active;
      }
吴蕾 committed
373
    }
吴蕾 committed
374
  }
任超 committed
375

吴蕾 committed
376
  .right {
任超 committed
377
    width: 100%;
任超 committed
378
    height: 100%;
任超 committed
379
    padding: 0 15px;
吴蕾 committed
380 381 382

    .clmlmx-box {
      margin: 0 auto;
任超 committed
383

吴蕾 committed
384 385 386 387 388 389 390 391
      .title {
        text-align: center;
        height: 60px;
        line-height: 60px;
        border: 1px solid #dfe6ec;
        font-size: 20px;
        background: #81d3f81a;
        margin-bottom: -1px;
吴蕾 committed
392 393
      }
    }
吴蕾 committed
394 395

    .clyl-box {
吴蕾 committed
396
      width: 100%;
吴蕾 committed
397 398 399 400 401 402 403 404 405
      height: 100%;
      display: flex;

      .menu-tree {
        width: 20%;
        height: 100%;
        margin-right: 30px;
        border-right: 1px dotted #d9d9d9;
        padding: 0 24px;
任超 committed
406

吴蕾 committed
407
        .item {
吴蕾 committed
408
          height: 60px;
吴蕾 committed
409 410 411 412
          line-height: 60px;
          border-bottom: 1px solid #e8e8e8;
          font-size: 16px;
          color: #4a4a4a;
任超 committed
413

吴蕾 committed
414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429
          .itemIcon {
            float: right;
            line-height: 60px;
            cursor: pointer;
          }

          @keyframes open {
            100% {
              transform: rotate(180deg);
            }
          }

          @keyframes close {
            0% {
              transform: rotate(180deg);
            }
任超 committed
430

吴蕾 committed
431 432 433 434 435 436 437 438 439
            100% {
              transform: rotate(-0deg);
            }
          }

          .open {
            animation: open 0.5s;
            animation-fill-mode: both;
          }
任超 committed
440

吴蕾 committed
441 442 443 444
          .close {
            animation: close 0.5s;
            animation-fill-mode: both;
          }
任超 committed
445

吴蕾 committed
446 447 448 449 450 451 452
          .child {
            height: 60px;
            line-height: 60px;
            border-bottom: 1px solid #e8e8e8;
            padding-left: 18px;
            color: #6b6b6b;
            cursor: pointer;
任超 committed
453
            box-sizing: border-box;
吴蕾 committed
454
          }
任超 committed
455

吴蕾 committed
456 457 458 459 460 461 462 463 464
          .checked {
            border-radius: 6px;
            border: 1px solid #4083f9;
          }
        }
      }

      .clyl-img {
        width: 75%;
任超 committed
465
        height: 100%;
吴蕾 committed
466 467
        background: #f3f4f7;
        margin: 0 auto;
吴蕾 committed
468
        position: relative;
吴蕾 committed
469 470 471 472
      }
    }
  }
}
任超 committed
473
</style>