Blame view

src/views/workflow/components/dialog/clxxDetailDialog.vue 9.65 KB
1
<!--
xiaomiao committed
2
 * @Description:
3
 * @Autor: renchao
4
 * @LastEditTime: 2023-08-02 09:53:05
5
-->
6 7 8
<template>
  <div class="clmlmx-box">
    <div class="title">申请材料目录</div>
9
    <lb-table :column="column" :key="key" :heightNumSetting="true" :calcHeight="600" :pagination="false" :data="tableData">
10 11 12
    </lb-table>
    <div class="text-center">
      <el-button @click="$popupCacel">取消</el-button>
13
      <el-button type="primary" @click="handleSubmit" :loading="loading" v-if="formData.ableOperation">保存</el-button>
14 15 16 17
    </div>
  </div>
</template>
<script>
18
  import Vue from 'vue'
19
  import store from '@/store/index.js'
20
  import { InitClml, updateClml, deleteSjClml, moveClml } from "@/api/clxx.js";
21 22 23 24 25 26 27 28 29 30 31
  export default {
    props: {
      formData: {
        type: Object,
        default: () => {
          return {}
        }
      }
    },
    data () {
      return {
32
        loading: false,
33 34 35 36
        column: [
          {
            width: "50",
            label: '序号',
37
            type: 'index'
38 39 40 41
          },
          {
            prop: "isrequired",
            label: "是否必选",
42
            width: "80",
43
            render: (h, scope) => {
44
              if (scope.row.isrequired === "1") {
45 46
                return (
                  <div>
47
                    <span>必选</span>
48 49 50 51 52 53
                  </div>
                );
              }
              else {
                return (
                  <div>
54
                    <span>可选</span>
55
                  </div>
56
                )
57
              }
58
            }
59 60 61
          },
          {
            label: "材料名称",
62 63
            render: (h, scope) => {
              return (
64 65
                this.formData.ableOperation ?
                  <el-input value={scope.row.sjmc} onInput={(val) => { scope.row.sjmc = val }}></el-input> : <span>{scope.row.sjmc}</span>
66 67
              )
            }
68 69 70
          },
          {
            label: "材料类型",
71
            width: "110",
72 73
            render: (h, scope) => {
              return (
74 75 76 77 78 79 80 81 82 83 84
                this.formData.ableOperation ?
                  <el-select value={scope.row.sjlx}
                    onChange={(val) => { scope.row.sjlx = val }}>
                    {
                      store.getters.dictData['A40'].map(option => {
                        return (
                          <el-option label={option.dname} value={option.dcode}></el-option>
                        )
                      })
                    }
                  </el-select> : <span>{this.dicStatus(scope.row.sjlx, "A40")}</span>
85 86
              )
            }
87 88 89 90
          },
          {
            prop: "sjsl",
            label: "份数",
91 92 93 94 95 96 97 98 99 100 101
            width: "50",
            render: (h, scope) => {
              return (
                <div>
                  {
                    scope.row.sjsl ?
                      <span>{scope.row.sjsl}</span> : 1
                  }
                </div>
              )
            }
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
          },
          {
            prop: "smzt",
            label: "扫描状态",
            width: "80",
            render: (h, scope) => {
              if (scope.row.children && scope.row.children.length > 0) {
                return (
                  <div>
                    <span>已扫描</span>
                  </div>
                );
              } else {
                return (
                  <div>
                    <span>未扫描</span>
                  </div>
                );
              }
            },
          },
          {
            label: "扫描页数",
125
            width: "80",
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
            render: (h, scope) => {
              if (scope.row.children && scope.row.children.length > 0) {
                return (
                  <div>
                    <span>{scope.row.children.length}</span>
                  </div>
                );
              } else {
                return (
                  <div>
                    <span>0</span>
                  </div>
                );
              }
            },
          },
          {
            label: "操作",
144
            width: "100",
145 146 147 148 149
            render: (h, scope) => {
              return (
                <div>
                  <el-button
                    type="text"
150
                    disabled={scope.$index == 0 || !this.formData.ableOperation}
151 152 153 154 155 156 157 158
                    onClick={() => {
                      this.moveUpward(scope.$index, scope.row);
                    }}
                  >
                    上移
                  </el-button>
                  <el-button
                    type="text"
159
                    disabled={scope.$index + 1 == this.tableData.length || !this.formData.ableOperation}
160 161 162 163 164 165
                    onClick={() => {
                      this.moveDown(scope.$index, scope.row);
                    }}
                  >
                    下移
                  </el-button>
166
                  <i v-show={scope.row.isrequired != '1' && this.formData.ableOperation} onClick={() => {
167 168 169 170 171 172
                    this.handleDelete(scope.$index, scope.row);
                  }} class="el-icon-delete pointer" style="color:#409EFF;margin-left:5px;position: relative;top: 1px;"></i>
                </div >
              )
            }
          }
173 174 175 176 177
        ],
        key: 0,
        tableData: []
      }
    },
178 179 180
    watch: {
      'formData.data': {
        handler: function (val, oldVal) {
renchao@pashanhoo.com committed
181
          this.tableData = _.cloneDeep(val)
182 183 184 185
        },
        immediate: true,
        deep: true
      }
186 187
    },
    methods: {
188
      handleSubmit () {
189 190 191 192 193 194 195 196 197 198 199
        this.loading = true
        updateClml(this.tableData).then(res => {
          this.loading = false
          if (res.code == 200) {
            this.$message({
              message: '保存成功',
              type: 'success'
            })
            this.$popupCacel()
            store.dispatch('user/reWorkFresh', true)
          }
200 201
        }).catch(() => {
          this.loading = false
202
        })
203
      },
yuanbo committed
204 205 206 207
      /**
       * @description: 材料目录明细初始化
       * @author: renchao
       */
208 209 210 211
      clmlInitList () {
        return new Promise(resolve => {
          this.unitData = this.$parent.unitData;
          var formdata = new FormData();
212 213
          formdata.append("bsmSldy", this.formData.unitData[0]?.bsmSldy);
          formdata.append("bsmSlsq", Vue.prototype.$currentRoute.query.bsmSlsq);
214
          formdata.append("clfl", 2);
215 216 217 218
          InitClml(formdata).then((res) => {
            if (res.code == 200) {
              resolve(res.code)
              if (res.result && res.result.length > 0) {
219
                this.tableData = res.result;
220
              } else {
221
                this.tableData = []
222 223 224 225 226 227 228
              }
            } else {
              this.$message.error(res.message)
            }
          })
        })
      },
yuanbo committed
229 230 231 232 233 234
      /**
       * @description: 上移
       * @param {*} index
       * @param {*} row
       * @author: renchao
       */
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255
      moveUpward (index, row) {
        let obj = {
          xh: row.xh,
          bsmSlsq: row.bsmSlsq,
          moveDirection: "UP",
        };
        // 接口待调
        moveClml(obj).then(async (res) => {
          if (res.code == 200) {
            let res = await this.clmlInitList()
            if (res == 200) {
              this.$message({
                message: '上移成功',
                type: 'success'
              })
            }
          } else {
            this.$message.error(res.message);
          }
        })
      },
yuanbo committed
256 257 258 259 260 261
      /**
       * @description: 下移
       * @param {*} index
       * @param {*} row
       * @author: renchao
       */
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282
      moveDown (index, row) {
        let obj = {
          xh: row.xh,
          bsmSlsq: row.bsmSlsq,
          moveDirection: "DOWN",
        }
        // 接口待调
        moveClml(obj).then(async (res) => {
          if (res.code == 200) {
            let res = await this.clmlInitList()
            if (res == 200) {
              this.$message({
                message: '下移成功',
                type: 'success'
              })
            }
          } else {
            this.$message.error(res.message);
          }
        })
      },
yuanbo committed
283 284 285 286 287 288
      /**
       * @description: 材料目录删除
       * @param {*} index
       * @param {*} row
       * @author: renchao
       */
289 290 291 292 293 294 295 296 297 298 299 300 301
      handleDelete (index, row) {
        let that = this
        this.$confirm('此操作将永久删除该 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          deleteSjClml({ sjBsm: row.bsmSj }).then(async (res) => {
            if (res.code == 200) {
              let res = await that.clmlInitList()
              if (res == 200) {
                that.$message({
                  message: "删除成功",
302
                  type: "success"
303 304 305 306 307 308 309 310 311 312 313 314
                })
              }
            }
          })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          })
        })
      },
      // 字典
yuanbo committed
315 316 317 318 319 320
      /**
       * @description: 字典
       * @param {*} val
       * @param {*} code
       * @author: renchao
       */
321
      dicStatus (val, code) {
322
        let data = store.getters.dictData[code],
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349
          name = "暂无";
        if (data) {
          data.map((item) => {
            if (item.dcode == val) {
              name = item.dname;
            }
          });
          return name;
        }
      }
    }
  }
</script>
<style scoped lang='scss'>
  @import "~@/styles/mixin.scss";
  .clmlmx-box {
    margin: 0 auto;
    .title {
      text-align: center;
      height: 60px;
      line-height: 60px;
      border: 1px solid #dfe6ec;
      font-size: 20px;
      background: #81d3f81a;
      margin-bottom: -1px;
    }
  }
xiaomiao committed
350
</style>