Blame view

src/views/workflow/components/spyj.vue 6.13 KB
任超 committed
1 2 3 4 5
<!--
  功能:审批意见
  作者:calliope
-->
<template>
6
  <div class='spyj loadingtext'>
xiaomiao committed
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
    <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
40
        </div>
xiaomiao committed
41 42
        <div class="submit_button" v-if="ableOperation">
          <el-button type="primary" @click="onSubmit">保存</el-button>
任超 committed
43
        </div>
xiaomiao committed
44 45
      </el-form>
    </div>
46
    <el-empty v-if="isNoData" description="暂无数据"></el-empty>
47
    <commonDialog v-model="commonDialog" />
任超 committed
48 49 50
  </div>
</template>
<script>
xiaomiao committed
51 52 53 54 55 56 57
  import { getSpyjList, saveSpyj, saveSpyjBySlsq } from "@/api/fqsq.js";
  import { popupDialog } from "@/utils/popup.js";
  import commonDialog from "./commonOpinion.vue";
  import { mapGetters } from 'vuex'
  export default {
    components: { commonDialog },
    props: {
蔡俊立 committed
58
    },
xiaomiao committed
59 60
    computed: {
      ...mapGetters(['userData'])
蔡俊立 committed
61
    },
xiaomiao committed
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
    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: [],
        propsParam: {},
        commonDialog: false
      }
81
    },
xiaomiao committed
82 83 84 85 86 87
    mounted () {
      this.propsParam = this.$attrs;
      if (this.$route.query.viewtype) {
        this.ableOperation = false
      }
      this.list();
88
    },
xiaomiao committed
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
    methods: {
      handleClick () {
        console.log(1)
      },
      //审批意见数据初始化
      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 () {
        this.commonDialog = true
      },
      //使用常用意见
      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 205
        /deep/.el-form-item__content {
          display: block;
          text-align: left;
          padding-left: 15px;
          text-indent: 10px;
        }
        .opinion_item {
          /deep/.el-form-item__error {
            margin-top: -16px !important;
            left: 3px;
          }
任超 committed
206

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

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

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

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

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