Blame view

src/views/workflow/components/spyj.vue 6.12 KB
任超 committed
1
<!--
2 3 4
 * @Description: 功能:审批意见
 * @Autor: renchao
 * @LastEditTime: 2023-05-17 10:41:24
任超 committed
5 6
-->
<template>
7
  <div class='spyj loadingtext'>
xiaomiao committed
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
    <div class="box">
      <b class="spyj_title">审批表</b>
      <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px">
        <div class="spyj_form" v-for="(item, index) in tableData" :key="index">
          <div class="item_left">
            {{ item.jdmc }}意见
          </div>
          <div class="item_right">
            <el-row>
              <el-col :span="24">
                <el-form-item label-width="0" class="opinion_item" prop="shyj">
                  <el-input type="textarea" :rows="4" class="opinion" placeholder="请输入审批意见"
                    v-if="item.stepShjy == '1' && ableOperation" v-model="ruleForm.shyj"></el-input>
                  <el-input type="textarea" :rows="4" class="opinion" v-model="item.shyj" v-else :disabled="true">
                  </el-input>
                  <el-button class="opinion_btn" @click="commonOpinion"
                    v-if="item.stepShjy == '1' && ableOperation">常用意见</el-button>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="16">
                <el-form-item label="审查人" prop="shryxm">
                  {{ item.shryxm }}
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="审核时间" prop="shjssj" :key="refresh">
                  {{ item.shjssj }}
                </el-form-item>
              </el-col>
            </el-row>
          </div>
任超 committed
41
        </div>
xiaomiao committed
42 43
        <div class="submit_button" v-if="ableOperation">
          <el-button type="primary" @click="onSubmit">保存</el-button>
任超 committed
44
        </div>
xiaomiao committed
45 46
      </el-form>
    </div>
47
    <el-empty v-if="isNoData" description="暂无数据"></el-empty>
任超 committed
48 49 50
  </div>
</template>
<script>
xiaomiao committed
51 52 53 54
  import { getSpyjList, saveSpyj, saveSpyjBySlsq } from "@/api/fqsq.js";
  import { mapGetters } from 'vuex'
  export default {
    computed: {
55
      ...mapGetters(['userData', 'yjsqOptions'])
蔡俊立 committed
56
    },
xiaomiao committed
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
    data () {
      return {
        isNoData: false,
        bsmSlsq: '',
        //刷新值
        refresh: 10,
        ableOperation: true,
        bsmSlsq: this.$route.query.bsmSlsq,
        bestepid: this.$route.query.bestepid,
        ruleForm: {},
        rules: {
          shyj: [
            { required: true, message: '请输入审批意见', trigger: 'blur' }
          ],
        },
        tableData: [],
73
        propsParam: {}
xiaomiao committed
74
      }
75
    },
76 77 78 79 80 81 82 83 84
    watch: {
      yjsqOptions: {
        handler (val) {
          this.ruleForm.shyj = val
        },
        deep: true,
        immediate: true
      },
    },
xiaomiao committed
85 86 87 88 89 90
    mounted () {
      this.propsParam = this.$attrs;
      if (this.$route.query.viewtype) {
        this.ableOperation = false
      }
      this.list();
91
    },
xiaomiao committed
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
    methods: {
      //审批意见数据初始化
      list () {
        let that = this
        this.$startLoading()
        var formdata = new FormData();
        formdata.append("bsmBusiness", this.propsParam.bsmBusiness);
        formdata.append("bestepid", this.$route.query.bestepid);
        formdata.append("ableOperation", this.ableOperation)
        getSpyjList(formdata).then((res) => {
          this.$endLoading()
          if (res.code === 200 && res.result) {
            this.tableData = res.result ? res.result : []
            if (res.result.length == 0) {
              that.isNoData = true
            }
            this.ruleForm = res.result[res.result.length - 1]
          }
        })
      },
      onSubmit () {
        this.ruleForm.bsmSlsq = this.bsmSlsq
        this.ruleForm.bestepid = this.bestepid
        saveSpyjBySlsq(this.ruleForm).then(res => {
          if (res.code === 200) {
            this.$message.success("保存成功")
            this.refresh += 1
          } else {
            this.$message.error(res.message)
          }
        })
      },
      //打开常用意见列表弹窗
      commonOpinion () {
126
        this.$popupDialog("常用意见", "workflow/components/dialog/commonOpinion", {}, "70%", true)
xiaomiao committed
127 128 129 130 131
      },
      //使用常用意见
      useOpinion (opinion) {
        this.ruleForm.shyj = opinion
      }
任超 committed
132 133
    }
  }
任超 committed
134 135
</script>
<style scoped lang='scss'>
xiaomiao committed
136
  @import "~@/styles/mixin.scss";
任超 committed
137

xiaomiao committed
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
  .spyj {
    width: 100%;
    height: 100%;
    background-color: #f5f5f5;
    padding: 5px;
    .box {
      overflow-x: auto;
      width: 100%;
      height: 95%;
      background: #fff;
      text-align: center;
      padding: 4px;
      overflow-y: scroll;
      padding-top: 20px;
      padding: 20px 40px;
    }
    .spyj_title {
      line-height: 68px;
      border: 1px solid $borderColor;
      text-align: center;
      font-size: 22px;
      font-weight: 400;
      background-color: #eceef2;
      display: block;
      border-bottom: none;
    }
任超 committed
164

xiaomiao committed
165 166 167
    /deep/.el-form-item {
      margin-bottom: 0;
    }
任超 committed
168

xiaomiao committed
169 170
    .bottom10 {
      margin-bottom: 15px;
任超 committed
171 172
    }

xiaomiao committed
173 174 175
    .spyj_form {
      display: flex;
      border: 1px solid $borderColor;
任超 committed
176

xiaomiao committed
177 178 179 180 181 182 183 184 185
      .item_left {
        width: 150px;
        background-color: #f8f8fa;
        color: #606266;
        display: flex;
        font-size: 14px;
        text-indent: 80px;
        align-items: center;
        border-right: 1px solid $borderColor;
任超 committed
186 187
      }

xiaomiao committed
188 189 190 191 192 193
      .item_right {
        flex: 1;
        width: 100%;

        /deep/.el-form-item__label {
          background-color: #f8f8fa;
任超 committed
194
        }
xiaomiao committed
195 196 197 198 199 200 201 202 203 204
        /deep/.el-form-item__content {
          display: block;
          text-align: left;
          text-indent: 10px;
        }
        .opinion_item {
          /deep/.el-form-item__error {
            margin-top: -16px !important;
            left: 3px;
          }
任超 committed
205

xiaomiao committed
206 207
          border-bottom: 1px solid $borderColor;
        }
任超 committed
208

xiaomiao committed
209 210 211
        .opinion {
          position: relative;
          font-size: 14px;
任超 committed
212

xiaomiao committed
213 214 215
          /deep/.el-textarea__inner {
            border: none;
          }
任超 committed
216 217
        }

xiaomiao committed
218 219 220 221 222
        .opinion_btn {
          position: absolute;
          right: 15px;
          bottom: 10px;
        }
任超 committed
223 224 225
      }
    }

xiaomiao committed
226 227 228 229
    .submit_button {
      text-align: center;
      margin: 15px 0;
    }
任超 committed
230
  }
xiaomiao committed
231
</style>