Blame view

src/views/workflow/components/spyj.vue 4.9 KB
任超 committed
1 2 3 4 5 6 7 8
<!--
  功能:审批意见
  作者:calliope
-->
<template>
  <div class='spyj'>
    <b class="spyj_title">审批表</b>
    <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px">
蔡俊立 committed
9
      <div class="spyj_form" v-for="(item,index) in tableData" :key="index">
任超 committed
10
        <div class="item_left">
蔡俊立 committed
11
          {{item.jdmc}}意见
任超 committed
12 13
        </div>
        <div class="item_right">
任超 committed
14
          <el-row>
任超 committed
15
            <el-col :span="24">
蔡俊立 committed
16
              <el-form-item label-width="0" class="opinion_item" prop="shyj">
17
                <el-input type="textarea" :rows="4" class="opinion" placeholder="请输入审批意见" v-if="item.stepShjy == '1' && ableOperation"
任超 committed
18 19 20
                  v-model="ruleForm.shyj"></el-input>
                <el-input type="textarea" :rows="4" class="opinion" v-model="item.shyj" v-else :disabled="true">
                </el-input>
21
                <el-button class="opinion_btn" @click="commonOpinion" v-if="item.stepShjy == '1' && ableOperation">常用意见</el-button>
任超 committed
22 23 24 25
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
蔡俊立 committed
26
            <el-col :span="16">
蔡俊立 committed
27 28
              <el-form-item label="审查人:" prop="shryxm">
                {{item.shryxm }}
任超 committed
29 30
              </el-form-item>
            </el-col>
蔡俊立 committed
31 32 33
            <el-col :span="8" >
              <el-form-item label="审核时间:" prop="shjssj" :key="refresh">
                {{item.shjssj }}
任超 committed
34 35 36 37 38
              </el-form-item>
            </el-col>
          </el-row>
        </div>
      </div>
39 40
      <div class="submit_button" v-if="ableOperation">
        <el-button type="primary"  @click="onSubmit">保存</el-button>
任超 committed
41 42
      </div>
    </el-form>
任超 committed
43
    <el-empty v-if="tableData.length==0" description="暂无数据"></el-empty>
44
    <commonDialog v-model="commonDialog" />
任超 committed
45 46 47
  </div>
</template>
<script>
任超 committed
48
import { getSpyjList, saveSpyj, saveSpyjBySlsq } from "@/api/fqsq.js";
49 50 51
import { popupDialog } from "@/utils/popup.js";
import commonDialog from "./commonOpinion.vue";
import { mapGetters } from 'vuex'
任超 committed
52
export default {
53
  components: {commonDialog},
蔡俊立 committed
54 55
  props: {
  },
56 57 58
  computed: {
    ...mapGetters([ 'userData'])
  },
任超 committed
59 60
  data () {
    return {
蔡俊立 committed
61
      bsmSlsq: '',
蔡俊立 committed
62 63
      //刷新值
      refresh : 10,
64 65 66 67
      ableOperation: true,
      bsmSlsq: this.$route.query.bsmSlsq,
      bestepid: this.$route.query.bestepid,
      ruleForm: {},
任超 committed
68
      rules: {
蔡俊立 committed
69
        shyj: [
任超 committed
70 71
          { required: true, message: '请输入审批意见', trigger: 'blur' }
        ],
蔡俊立 committed
72
      },
蔡俊立 committed
73 74
      tableData: [],
      propsParam: {},
75
      commonDialog: false
任超 committed
76 77
    }
  },
任超 committed
78
  created () {
蔡俊立 committed
79
    this.propsParam = this.$attrs;
80 81 82
    if(this.$route.query.viewtype){
      this.ableOperation = false
    }
蔡俊立 committed
83 84
    this.list();
  },
任超 committed
85 86 87
  methods: {
    handleClick () {
      console.log(1)
蔡俊立 committed
88 89
    },
    //审批意见数据初始化
蔡俊立 committed
90
    list () {
蔡俊立 committed
91
      var formdata = new FormData();
蔡俊立 committed
92 93
      formdata.append("bsmBusiness", this.propsParam.bsmBusiness);
      formdata.append("bestepid", this.$route.query.bestepid);
94
      formdata.append("ableOperation",this.ableOperation)
蔡俊立 committed
95 96
      getSpyjList(formdata).then((res) => {
        if (res.code === 200 && res.result) {
蔡俊立 committed
97
          this.tableData = res.result
98
          this.ruleForm = res.result[res.result.length - 1]
蔡俊立 committed
99 100 101
        }
      })
    },
任超 committed
102
    onSubmit () {
103 104
      this.ruleForm.bsmSlsq = this.bsmSlsq
      this.ruleForm.bestepid = this.bestepid
任超 committed
105
      saveSpyjBySlsq(this.ruleForm).then(res => {
蔡俊立 committed
106
        if (res.code === 200) {
蔡俊立 committed
107
          this.$message.success("保存成功")
蔡俊立 committed
108
          this.refresh += 1
任超 committed
109
        } else {
蔡俊立 committed
110 111 112
          this.$message.error(res.message)
        }
      })
113 114 115 116 117 118 119 120
    },
    //打开常用意见列表弹窗
    commonOpinion(){
      this.commonDialog = true
    },
    //使用常用意见
    useOpinion(opinion){
        this.ruleForm.shyj = opinion
任超 committed
121 122
    }
  }
任超 committed
123 124 125 126
}
</script>
<style scoped lang='scss'>
@import '~@/styles/mixin.scss';
任超 committed
127

任超 committed
128 129 130
.spyj {
  margin-left: 5px;

任超 committed
131
  .spyj_title {
任超 committed
132
    text-align: center;
任超 committed
133
    font-size: 18px;
任超 committed
134
    display: block;
任超 committed
135
    margin: 5px;
任超 committed
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
  }

  /deep/.el-form-item {
    margin-bottom: 0;
  }

  .bottom10 {
    margin-bottom: 15px;
  }

  .spyj_form {
    display: flex;
    border: 1px solid $borderColor;

    .item_left {
      width: 150px;
      background-color: #F8F8FA;
      color: #606266;
      @include flex-center;
      border-right: 1px solid $borderColor;
    }

    .item_right {
      flex: 1;
      width: 100%;

      /deep/.el-form-item__label {
        background-color: #F8F8FA;
      }

      .opinion_item {
        /deep/.el-form-item__error {
          margin-top: -16px !important;
          left: 3px;
        }

        border-bottom: 1px solid $borderColor;
      }

      .opinion {
        position: relative;
蔡俊立 committed
177
        font-size: 16px;
任超 committed
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197

        /deep/.el-textarea__inner {
          border: none;
        }
      }

      .opinion_btn {
        position: absolute;
        right: 15px;
        bottom: 10px;
      }
    }
  }

  .submit_button {
    text-align: center;
    margin: 15px 0;
  }
}
</style>