editDialog.vue 12.5 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 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 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 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 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439
<!--
 * @Description:
 * @Autor: renchao
 * @LastEditTime: 2023-07-19 14:10:56
-->
<template>
  <dialogBox title="申请业务规则配置" @submitForm="submitForm" @closeDialog="closeDialog" v-model="myValue"
    :btnDisabled="btnDisabled">
    <ul class="edit-title-list" v-if="titleList.length > 0">
      <li v-for="(item, index) in titleList" @click="handleTitleSelct(item, index)" :key="index"
        :class="{ active: index == tn }">{{
            item.nodename
        }}</li>
    </ul>
    <div class="sqywgz-edit">
      <ul class="sqywgz-edit-left">
        <li v-for="(item, index) in leftList" :key="index" :class="{ active: index == n }" @click="hanldeItem(index)">{{
            item.name
        }}</li>
      </ul>
      <div class="sqywgz-edit-right">
        <el-form :model="ruleForm" v-show="n == 0" :rules="rules" label-width="135px" ref="ruleForm">
          <el-row>
            <el-col :span="8">
              <el-form-item label="权利类型编码">
                <el-input v-model="ruleForm.qllxbm" disabled></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="权利类型名称">
                <el-input v-model="ruleForm.qllxmc" disabled></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="申请分类">
                <el-select v-model="ruleForm.sqfl" disabled placeholder="请选择" class="width100">
                  <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="登记类型编码">
                <el-input v-model="ruleForm.djlxbm" disabled></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="登记类型名称">
                <el-input v-model="ruleForm.djlxmc" disabled></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="发起业务单元类型">
                <el-select v-model="ruleForm.fqywdylx" disabled placeholder="请选择" class="width100">
                  <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="登记业务编码">
                <el-input v-model="ruleForm.djywbm" disabled></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="16">
              <el-form-item label="登记业务名称">
                <el-input v-model="ruleForm.djywmc" disabled></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="是否启用" prop="enabled">
                <el-radio-group v-model="ruleForm.enabled">
                  <el-radio label="1">启用</el-radio>
                  <el-radio label="0">禁用</el-radio>
                </el-radio-group>
              </el-form-item>
            </el-col>
            <el-col :span="16">
              <el-form-item label="业务流程ID" prop="flowid">
                <el-input v-model="ruleForm.flowid"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="登记情形及材料">
                <el-input v-model="ruleForm.djqxcl" placeholder="仅支持execl文件导入"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="1">
              <el-upload ref="upload" :action="imgUploadUrl" :limit="1" accept=".xls, .xlsx" :show-file-list="false"
                :disabled='requested' :file-list="fileList" :before-upload="uploadRecord" :on-success="handleSuccess">
                <el-button type="primary" icon="el-icon-upload" :loading="requested">上传材料</el-button>
              </el-upload>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="登记原因设置" prop="sfqydjyymb">
                <el-radio-group v-model="ruleForm.sfqydjyymb">
                  <el-radio label="1">启用</el-radio>
                  <el-radio label="0">禁用</el-radio>
                </el-radio-group>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="24">
              <el-form-item label="登记原因模板" prop="djyy">
                <el-input type="textarea" :rows="4" placeholder="请输入内容" v-model="ruleForm.djyy">
                </el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
        <djqxsd v-show="n == 1" :ruleForm="ruleForm" :djqx="subData.djqx" @updateValue="getDjqxValue" />
        <clgzsd v-show="n == 2" :ruleForm="ruleForm" :clzt="subData.clxx" :djqx="subData.djqx"
          @updateValue="getClgzValue" />
        <dyztsd :ruleForm="ruleForm" :subData="subData" v-show="n == 3" @updateValue="getDyztsdValue" />
      </div>
    </div>
  </dialogBox>
</template>
<script>
  import { uploadUrl } from '@/api/file'
  import djqxsd from './djqxsd.vue'
  import clgzsd from './clgzsd.vue'
  import dyztsd from './dyztsd.vue'
  import { getSqdjywDetail, saveSqdjyw } from '@/api/sysSqdjyw'
  export default {
    components: {
      djqxsd,
      clgzsd,
      dyztsd
    },
    props: {
      value: { type: Boolean, default: false },
      detailList: {
        type: Array, default: []
      },
      bsmSqyw: {
        type: String, default: ''
      },
    },
    watch: {
      value (val) {
        this.myValue = val
      },
      detailList: {
        handler: function (newValue) {
          if (newValue.length == 0) {
            this.getSqdjywDetail(this.bsmSqyw)
          } else {
            this.titleList = newValue
            this.n = 0
            this.tn = 0
            this.getSqdjywDetail(newValue[0].bsmSqyw)
          }
        },
        deep: true
      }
    },
    data () {
      return {
        djqx: [],
        clzt: [],
        myValue: this.value,
        btnDisabled: false,
        tn: 0,
        titleList: [],
        imgUploadUrl: uploadUrl(),
        n: 0,
        leftList: [
          {
            name: '业务详情',
            select: true
          },
          {
            name: '登记情形设定'
          },
          {
            name: '材料规则设定'
          },
          {
            name: '单元状态设定'
          }
        ],
        ruleForm: {
          qllxbm: '',
          qllxmc: '',
          sqfl: '',
          djlxbm: '',
          djlxmc: '',
          fqywdylx: '',
          djywbm: '',
          djywmc: '',
          enabled: '1',
          flowid: '',
          flowparams: '',
          djqxcl: '',
          sfqydjyymb: '1',
          djyy: ''
        },
        requested: false,
        fileList: [],
        options: [],
        rules: {
          sfqy: [
            { required: true, message: '请选择是否启用', trigger: 'change' },
          ],
          ywlc: [
            { required: true, message: '请输入业务流程ID', trigger: 'blur' },
          ],
          djqxcl: [
            { required: true, message: '请选择登记情形及材料', trigger: 'blur' },
          ],
          djyysz: [
            { required: true, message: '请选择登记原因设置', trigger: 'change' },
          ],
          djyymb: [
            { required: true, message: '请输入登记原因模板', trigger: 'blur' },
          ],
        },
        // 表单提交
        subData: {}
      };
    },
    methods: {
      /**
       * @description: getSqdjywDetail
       * @param {*} bsmSqyw
       * @author: renchao
       */
      getSqdjywDetail (bsmSqyw) {
        getSqdjywDetail(bsmSqyw).then(res => {
          this.subData = res.result
          let { ywDetail } = res.result
          this.ruleForm = ywDetail
        })
      },
      /**
       * @description: handleTitleSelct
       * @param {*} obj
       * @param {*} index
       * @author: renchao
       */
      handleTitleSelct (obj, index) {
        this.n = 0
        this.tn = index
        this.getSqdjywDetail(obj.bsmSqyw)
      },
      /**
       * @description: getDjqxValue
       * @param {*} val
       * @author: renchao
       */
      getDjqxValue (val) {
        if (!_.isEqual(val.djqx, this.subData.djqx)) {
          this.subData.djqx = val.djqx
          this.btnDisabled = val.btnDisabled
        }
      },
      /**
       * @description: getClgzValue
       * @param {*} val
       * @author: renchao
       */
      getClgzValue (val) {
        if (!_.isEqual(val, this.subData.clxx)) {
          this.subData.clxx = val
        }
      },
      // 单元状态设定
      /**
       * @description: 单元状态设定
       * @param {*} val
       * @author: renchao
       */
      getDyztsdValue (val) {
        if (!_.isEqual(val.sxql, this.subData.sxql)) {
          this.subData.sxql = val.sxql
        }
        if (!_.isEqual(val.sxzt, this.subData.sxzt)) {
          this.subData.sxzt = val.sxzt
        }
      },
      /**
       * @description: submitForm
       * @author: renchao
       */
      submitForm () {
        this.$refs['ruleForm'].validate(async (valid) => {
          let that = this
          if (valid) {
            this.subData.ywDetail = this.ruleForm
            saveSqdjyw(this.subData).then(res => {
              if (res.code == 200) {
                that.$message({
                  message: '修改成功',
                  type: 'success'
                })
                // that.$emit('input', false)
              }
            })
          } else {
            this.$message('请检查表单完整性')
            return false
          }
        })
      },
      /**
       * @description: closeDialog
       * @author: renchao
       */
      closeDialog () {
        this.$emit('input', false)
      },
      /**
       * @description: hanldeItem
       * @param {*} index
       * @author: renchao
       */
      hanldeItem (index) {
        this.n = index
      },
      /**
       * @description: uploadRecord
       * @param {*} file
       * @author: renchao
       */
      uploadRecord (file) {
        this.requested = true
        this.files = file;
        const extension = file.name.split('.')[1] === 'xls'
        const extension2 = file.name.split('.')[1] === 'xlsx'
        const isLt5M = file.size / 1024 / 1024 < 5
        if (!extension && !extension2) {
          this.$message.warning('上传模板只能是 xls、xlsx格式!')
          this.requested = false
        }
        if (!isLt5M) {
          this.$message.warning('上传模板大小不能超过 5MB!')
          this.requested = false
        }
        return (extension || extension2) && isLt5M
      },
      /**
       * @description: handleSuccess
       * @param {*} res
       * @author: renchao
       */
      handleSuccess (res) {
        if (res.code === 200) {
          this.requested = false
          this.$message({
            message: '上传成功',
            type: 'success',
          })
        } else {
          this.loading = false
          this.$message.error(res.message)
        }
      }
    }
  };
</script>
<style scoped lang="scss">
  @import "~@/styles/mixin.scss";

  /deep/.el-radio {
    margin-right: 0;
  }

  /deep/.el-radio__label {
    padding-left: 2px;
  }

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

  .edit-title-list {
    @include flex;

    li {
      flex: 1;
      @include flex-center;
      border: 1px solid $borderColor;
      line-height: 36px;
      margin-bottom: 10px;
      cursor: pointer;
      transition: all 0.3s;

      &:hover {
        @extend .active;
      }
    }
  }

  .sqywgz-edit {
    @include flex;
    width: 100%;
    height: 563px;

    &-left {
      width: 26px;

      li {
        @include flex-center;
        background-color: #e4e7ed;
        border-bottom-right-radius: 5px;
        padding: 15px;
        cursor: pointer;
        transition: all 0.3s;

        &:hover {
          @extend .active;
        }
      }

      li:not(:last-child) {
        margin-bottom: 10px;
      }
    }

    &-right {
      margin-left: 20px;
      flex: 1;
      width: 100%;
    }
  }
</style>