FlowImage.vue 11.4 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
<template>
  <div>
    <div style="height: 40px;overflow:hidden;">
      <div class="target">
        <div class="icon" style="background: #FF0000;"></div>
        <span>待审批</span>
      </div>
      <div class="target">
        <div class="icon" style="background: #F89800;"></div>
        <span>提交</span>
      </div>
      <div class="target">
        <div class="icon" style="background: #FFE76E;"></div>
        <span>重新提交</span>
      </div>
      <div class="target">
        <div class="icon" style="background: #00FF00;"></div>
        <span>同意</span>
      </div>
      <div class="target">
        <div class="icon" style="background: #C33A1F;"></div>
        <span>挂起</span>
      </div>
      <div class="target">
        <div class="icon" style="background: #0000FF;"></div>
        <span>反对</span>
      </div>
      <div class="target">
        <div class="icon" style="background: #8A0902;"></div>
        <span>驳回</span>
      </div>
      <div class="target">
        <div class="icon" style="background: #FFA500;"></div>
        <span>驳回到发起人</span>
      </div>
      <div class="target">
        <div class="icon" style="background: #023B62;"></div>
        <span>撤回</span>
      </div>
      <div class="target">
        <div class="icon" style="background: #F23B62;"></div>
        <span>撤回到发起人</span>
      </div>
      <div class="target">
        <div class="icon" style="background: #338848;"></div>
        <span>会签通过</span>
      </div>
      <div class="target">
        <div class="icon" style="background: #82B7D7;"></div>
        <span>会签不通过</span>
      </div>
      <div class="target">
        <div class="icon" style="background: #EEAF97;"></div>
        <span>人工终止</span>
      </div>
      <div class="target">
        <div class="icon" style="background: #4A4A4A;"></div>
        <span>完成</span>
      </div>
    </div>
    <div :style="'overflow: auto;max-height:' + maxHeightImg + 'px;'">
      <div
        :style="{
          position: positionImg,
          width: widthImg + 'px',
          height: heightImg + 'px',
          background: 'url(' + backGroundImg + ') no-repeat'
        }"
      >
        <el-popover
          @click="nodeClick(layout)"
          v-for="layout in listLayout"
          :key="layout.nodeId"
          placement="bottom-start"
          trigger="hover"
        >
          <div class="opinion-content" v-if="nodeOpinions[layout.nodeId]">
            <span>任务审批详情</span>
            <div v-if="nodeOpinions[layout.nodeId].hasOpinion">
              <table
                v-for="op in nodeOpinions[layout.nodeId].data"
                :key="op.taskKey"
                class="table table-bordered"
              >
                <tr>
                  <th width="80">任务名称</th>
                  <td width="160">{{ op.taskName }}</td>
                </tr>
                <tr v-show="op.auditor">
                  <th>执行人</th>
                  <td>
                    <span class="owner-span">
                      <a href="javascript:void(0)">{{ op.auditorName }}</a>
                    </span>
                  </td>
                </tr>
                <tr v-show="!op.auditor">
                  <th>
                    <label>候选人</label>
                    <el-tooltip
                      class="item"
                      effect="light"
                      content="有资格审批的用户及用户组"
                      placement="right"
                    >
                      <i class="el-icon-question"></i>
                    </el-tooltip>
                  </th>
                  <td>
                    <div class="owner-div">
                      <span
                        class="owner-span"
                        v-for="qualfied in op.qualfieds"
                        :key="qualfied.id"
                      >
                        <a href="javascript:void(0)">{{ qualfied.name }}</a>
                      </span>
                    </div>
                  </td>
                </tr>
                <tr>
                  <th>开始时间</th>
                  <td style="font-size:11px;">
                    {{ op.createTime | dateformat('yyyy-MM-DD HH:mm:ss') }}
                  </td>
                </tr>
                <tr>
                  <th>结束时间</th>
                  <td style="font-size:11px;">
                    {{ op.completeTime | dateformat('yyyy-MM-DD HH:mm:ss') }}
                  </td>
                </tr>
                <tr>
                  <th>审批用时</th>
                  <td>{{ op.durMs | timeLag }}</td>
                </tr>
                <tr>
                  <th>状态</th>
                  <td>{{ op.statusVal }}</td>
                </tr>
                <tr>
                  <th>意见</th>
                  <td class="opinion">{{ op.opinion }}</td>
                </tr>
              </table>
            </div>

            <div v-if="!nodeOpinions[layout.nodeId].hasOpinion">
              <span>节点设置详情</span>
              <table class="table table-bordered">
                <tr>
                  <th width="90">状态</th>
                  <td width="150">未产生过任务</td>
                </tr>
                <tr>
                  <th>
                    <label>暂定候选人</label>
                    <el-tooltip
                      class="item"
                      effect="light"
                      content="暂定的有审批资格的用户及用户组,实际候选人要在产生任务以后才能确定"
                      placement="right"
                    >
                      <i class="el-icon-question"></i>
                    </el-tooltip>
                  </th>
                  <td>
                    <span
                      class="owner-span"
                      v-for="qualfied in nodeOpinions[layout.nodeId].data"
                      :key="qualfied.id"
                    >
                      <a href="javascript:void(0)">{{ qualfied.name }}</a>
                    </span>
                  </td>
                </tr>
              </table>
            </div>
          </div>
          <el-button
            v-if="
              layout.nodeType == 'USERTASK' || layout.nodeType == 'SIGNTASK'
            "
            slot="reference"
            :style="{
              position: 'absolute',
              border: 'none',
              background: 'none',
              left: layout.x + 'px',
              top: layout.y + 'px',
              width: layout.width + 'px',
              height: layout.height + 'px'
            }"
          ></el-button>
        </el-popover>
        <div v-for="layout in listLayout" :key="'sub_' + layout.nodeId">
          <div
            @click="nodeClick(layout)"
            v-if="layout.nodeType == 'CALLACTIVITY'"
            :style="{
              position: 'absolute',
              border: 'none',
              background: 'none',
              left: layout.x + 'px',
              top: layout.y + 'px',
              width: layout.width + 'px',
              height: layout.height + 'px'
            }"
          ></div>
        </div>
      </div>
    </div>
    <!-- 流程图 -->

    <SubFlowImage ref="subTaskImage" />
  </div>
</template>

<script>
import {mapState, mapActions} from 'vuex'
import SubFlowImage from '@/components/flow/SubFlowImage.vue'
export default {
  name: 'taskImage',
  props: ['bpmnInstId', 'instId', 'defId'],
  components: {SubFlowImage},
  data() {
    return {
      imageDialog: false,
      proInst: this.instId,
      widthImg: '',
      heightImg: '',
      backGroundImg: '',
      positionImg: 'relative',
      listLayout: '',
      nodeOpinions: [],
      maxHeightImg: ''
    }
  },
  methods: {
    handleOpen() {},
    handleClose() {
      this.imageDialog = false
    },
    nodeClick(node) {
      this.$refs.subTaskImage.handleOpen(this.defId, this.instId, node.nodeId)
    }
  },
  created() {
    this.imageDialog = true
    this.maxHeightImg = document.body.clientHeight - 100
    let data = {
      bpmnInstId: this.bpmnInstId,
      instId: this.instId,
      defId: this.defId
    }
    this.$store.dispatch('flow/getBpmImage', data).then(res => {
      this.widthImg = res.rows.bpmDefLayout.width
      this.heightImg = res.rows.bpmDefLayout.height
      this.backGroundImg = res.img
      res.rows.bpmDefLayout.listLayout.forEach(element => {
        let styleStr =
          "position: 'absolute', left:" +
          element.x +
          'px, top:' +
          element.y +
          'px, width:' +
          element.width +
          'px, height:' +
          element.height +
          'px'
        element.style = styleStr
      })
      this.listLayout = res.rows.bpmDefLayout.listLayout
      let nodeIds = []
      this.listLayout.forEach(layout => {
        if (layout.nodeType == 'USERTASK' || layout.nodeType == 'SIGNTASK') {
          nodeIds.push(layout.nodeId)
        }
      })
      nodeIds = nodeIds.join(',')
      this.$store
        .dispatch('flow/getNodeopinions', {
          instId: this.instId,
          nodeIds: nodeIds
        })
        .then(resp => {
          if (resp) {
            for (const key in resp) {
              if (resp[key].data && resp[key].hasOpinion) {
                resp[key].data.forEach(element => {
                  if (element.qualfieds) {
                    element.qualfieds = eval('(' + element.qualfieds + ')')
                  }
                })
              }
            }
          }
          this.nodeOpinions = resp
        })
    })
  }
}
</script>

<style lang="scss" scoped>
div.icon {
  border: 1px solid #868686;
  line-height: 10px;
  width: 10px;
  height: 10px;
  float: left;
  overflow: hidden;
  margin-top: 3px;
}

.target span {
  margin: 0 10px 0 3px;
  font-size: 12px;
  font-weight: bold;
  float: left;
  vertical-align: middle;
  white-space: nowrap;
}
.form-table {
  width: 100%;
  border-top: 1px solid #ebeef5;
  border-left: 1px solid #ebeef5;
}

.form-table th {
  text-align: right;
  color: #666;
}

.form-table th > span {
  color: #f00;
}

.form-table th,
.form-table td {
  border-right: 1px solid #ebeef5;
  border-bottom: 1px solid #ebeef5;
  padding: 10px;
  min-width: 0;
  box-sizing: border-box;
  text-overflow: ellipsis;
  vertical-align: middle;
  position: relative;
}

.xh-star {
  color: red;
}

.opinion-content >>> table {
  border-spacing: 0;
  border-bottom: 1px solid #e7eaec;
  border-left: 1px solid #e7eaec;
  margin-bottom: 10px;
}

.opinion-content >>> table > tr > th,
.opinion-content >>> table > tr > td {
  border-top: 1px solid #e7eaec;
  border-right: 1px solid #e7eaec;
  line-height: 1.42857;
  padding: 8px;
  vertical-align: middle;
}

.opinion-content >>> a {
  color: #337ab7;
  text-decoration: none;
  display: block;
}

.opinion-content > span {
  font-size: 14px;
  line-height: 18px;
  display: block;
  padding-bottom: 10px;
  font-weight: bold;
}

.opinion-content > div {
  max-height: 300px;
  overflow: auto;
}

.owner-div {
  padding-right: 10px;
}
.opinion {
  max-width: 250px;
  min-width: 250px;
  word-wrap: break-word;
}
.el-popover {
  position: absolute;
  background: #fff;
  min-width: 250px;
  border-radius: 4px;
  border: 1px solid #ebeef5;
  padding: 12px;
  z-index: 2000;
  color: #606266;
  line-height: 1.4;
  text-align: justify;
  font-size: 14px;
  -webkit-box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}
</style>