Blame view

src/views/workflow/components/spyj.vue 8.7 KB
任超 committed
1
<!--
xiaomiao committed
2
 * @Description: 审批意见
3
 * @Autor: renchao
4
 * @LastEditTime: 2023-08-16 14:39:55
任超 committed
5 6
-->
<template>
xiaomiao committed
7
  <div class="spyj loadingtext">
xiaomiao committed
8
    <div class="box">
xiaomiao committed
9 10 11 12 13
      <div class="spyj_title">
        <div class="righttitle">审批表</div>
      </div>

      <div v-for="(item, index) in tableData" :key="index">
xiaomiao committed
14 15 16 17 18
        <el-form
          :model="tableData[index]"
          label-width="120px"
          ref="ruleForm'"
        >
xiaomiao committed
19 20
          <div class="spyj_form">
            <div class="item_left">
xiaomiao committed
21
              <div class="right">{{ item.jdmc }}意见</div>
xiaomiao committed
22 23 24 25
            </div>
            <div class="item_right">
              <el-row>
                <el-col :span="24">
xiaomiao committed
26 27 28 29
                  <el-form-item
                    label-width="0"
                    class="opinion_item"
                  >
xiaomiao committed
30
                    <el-input
31
                      :disabled="!viewEdit || item.show"
xiaomiao committed
32 33 34 35 36 37 38 39 40
                      type="textarea"
                      :rows="4"
                      class="opinion"
                      placeholder="请输入审批意见"
                      v-model="item.shyj"
                    ></el-input>
                    <el-button
                      class="opinion_btn"
                      @click="commonOpinion(index)"
xiaomiao committed
41
                       :disabled="!viewEdit|| item.show"
xiaomiao committed
42 43 44 45 46 47 48 49
                      >常用意见</el-button
                    >
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="16">
                  <el-form-item label="审查人">
xiaomiao committed
50
                    {{ item.shryxm }}
xiaomiao committed
51 52 53
                  </el-form-item>
                </el-col>
                <el-col :span="8">
xiaomiao committed
54
                  <el-form-item disabled label="审核时间" :key="refresh">
xiaomiao committed
55
                    {{ item.shjssj }}
xiaomiao committed
56 57 58 59
                  </el-form-item>
                </el-col>
              </el-row>
            </div>
xiaomiao committed
60
          </div>
xiaomiao committed
61 62
        </el-form>
      </div>
63
      <div class="submit_button" v-if="viewEdit">
xiaomiao committed
64 65 66
        <el-button type="primary" :disabled="shows" @click="onSubmit()"
          >保存</el-button
        >
xiaomiao committed
67
      </div>
xiaomiao committed
68
    </div>
xiaomiao committed
69
    <!-- <el-empty v-if="isNoData" description="暂无数据"></el-empty> -->
任超 committed
70 71 72
  </div>
</template>
<script>
xiaomiao committed
73 74
import { saveSpyjBySlsq, getSpyjList } from "@/api/opinion.js";
import { mapGetters } from "vuex";
xiaomiao committed
75
import { getNewDatesh } from "@/utils/util";
xiaomiao committed
76 77
export default {
  computed: {
xiaomiao committed
78
    ...mapGetters(["dqhj", "yjsqOptions", "userInfo"]),
xiaomiao committed
79 80 81 82
  },
  data() {
    return {
      currentindex: 0,
xiaomiao committed
83
      refresh: 10,
84
      viewEdit: false,
xiaomiao committed
85 86 87 88
      bsmSlsq: this.$route.query.bsmSlsq,
      bestepid: this.$route.query.bestepid,
      propsParam: {},
      tableData: [],
xiaomiao committed
89
      shows: false,
xiaomiao committed
90 91 92 93 94 95
    };
  },

  watch: {
    yjsqOptions: {
      handler(val) {
xiaomiao committed
96
        this.add(val.opinion);
xiaomiao committed
97 98 99
      },
      deep: true,
      immediate: true,
蔡俊立 committed
100
    },
xiaomiao committed
101 102
     dqhj: {
      handler(val) {
xiaomiao committed
103 104
        this.propsParam = this.$attrs;
        this.dataset()
xiaomiao committed
105 106 107 108 109 110 111 112
        if(this.$parent.dqhj){
            this.getShList();
        }
      },
      deep: true,
      immediate: true,
    },

xiaomiao committed
113 114 115
  },
  created() {},
  methods: {
xiaomiao committed
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
     /**
     * @description: dataset
     * @param {*} 数据处理
     * @author: renchao
     */
    dataset(){
      this.viewEdit = this.$parent.currentSelectTab.ableOperation;
    // switch (this.$parent.dqhj) {
    //   case "cs":
    //     this.indexdqlc = 0;
    //     this.jdmc = "初审";
    //     break;
    //   case "fs":
    //     this.indexdqlc = 1;
    //     this.jdmc = "复审";
    //     break;
    //   case "hd":
    //     this.indexdqlc = 2;
    //     this.jdmc = "核定";
    //     break;
    // }
    },
xiaomiao committed
138 139 140 141 142 143 144 145
    /**
     * @description: getShList
     * @param {*} obj
     * @author: renchao
     */
    getShList() {
      this.$startLoading();
      var formdata = new FormData();
xiaomiao committed
146
      formdata.append("bsmBusiness", this.propsParam.bsmBusiness);
xiaomiao committed
147 148 149
      formdata.append("bestepid", this.$route.query.bestepid);

      getSpyjList(formdata).then((res) => {
xiaomiao committed
150

xiaomiao committed
151
        if (res.code === 200 && res.result) {
xiaomiao committed
152 153 154
            this.tableData = res.result;
            if (this.shows) {
              this.shows = false;
xiaomiao committed
155
            }
xiaomiao committed
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171

            var index = this.tableData.findIndex(
              (item) => item.jddm === this.$parent.dqhj
            );
            if (index == -1) {
              switch (this.$parent.dqhj) {
                case "cs":
                  this.tableData.push({ jdmc: "初审", jddm: "cs", sxh: 1 });
                  break;
                case "fs":
                  this.tableData.push({ jdmc: "复审", jddm: "fs", sxh: 2 });
                  break;
                case "hd":
                  this.tableData.push({ jdmc: "核定", jddm: "hd", sxh: 3 });
                  break;
              }
xiaomiao committed
172
            }
xiaomiao committed
173 174 175 176 177 178 179 180 181 182 183
            this.tableData.forEach((item) => {
              item.show = true;
              if (this.$parent.dqhj == item.jddm) {
                item["stepid"] = this.$route.query.bestepid;
                item.shjssj = getNewDatesh();
                item.shkssj = getNewDatesh();
                item["shryxm"] = this.userInfo.name;
                item["userid"] = this.userInfo.id;
                item.show = false;
              }
            });
xiaomiao committed
184
            this.$endLoading();
xiaomiao committed
185

xiaomiao committed
186
        }
xiaomiao committed
187

xiaomiao committed
188
      });
xiaomiao committed
189

190
    },
xiaomiao committed
191 192 193 194 195
    /**
     * @description: onSubmit
     * @author: renchao
     */
    onSubmit() {
xiaomiao committed
196

xiaomiao committed
197 198 199 200
          this.tableData.forEach((item, index) => {
            item["bsmBusiness"] = this.propsParam.bsmBusiness;
            item["czjg"] = "1";
          });
xiaomiao committed
201
             var index = this.tableData.findIndex(
xiaomiao committed
202
              (item) => item.shyj ==null||item.shyj ==""
xiaomiao committed
203 204 205 206
            );
            if(index==-1){
              this.shows = true;
               saveSpyjBySlsq(this.tableData).then((res) => {
xiaomiao committed
207 208 209 210 211 212 213 214
            if (res.code === 200) {
              this.$message.success("保存成功");
              this.refresh += 1;
              this.getShList();
            } else {
              this.$message.error(res.message);
            }
          });
xiaomiao committed
215 216 217 218
            }else{
             this.$message.error("意见不能为空");
            }

219
    },
xiaomiao committed
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234
    //打开常用意见列表弹窗
    /**
     * @description: 打开常用意见列表弹窗
     * @param {*} index
     * @author: renchao
     */
    commonOpinion(index) {
      this.currentindex = index;
      this.$popupDialog(
        "常用意见",
        "workflow/components/dialog/commonOpinion",
        {},
        "70%",
        true
      );
235
    },
xiaomiao committed
236 237 238 239 240 241
    /**
     * @description: add
     * @param {*} val
     * @author: renchao
     */
    add(val) {
xiaomiao committed
242
      if (val != ""&&this.tableData.length>0) {
xiaomiao committed
243
        this.$set(this.tableData[this.currentindex], "shyj", val);
xiaomiao committed
244
      }
xiaomiao committed
245 246 247
    },
  },
};
任超 committed
248
</script>
xiaomiao committed
249 250
<style scoped lang="scss">
@import "~@/styles/mixin.scss";
任超 committed
251

xiaomiao committed
252 253 254 255 256 257 258
.spyj {
  width: 100%;
  height: 100%;
  background-color: #f5f5f5;
  padding: 5px;
  .box {
    overflow-x: auto;
xiaomiao committed
259
    width: 100%;
xiaomiao committed
260 261 262 263 264 265 266 267
    height: 95%;
    background: #fff;
    text-align: center;
    padding: 4px;
    overflow-y: scroll;
    padding-top: 20px;
    padding: 20px 40px;
    .spyj_title {
xiaomiao committed
268
      width: 100%;
xiaomiao committed
269 270 271 272
      height: 80px;
      border: 1px solid $borderColor;
      background-color: #eceef2;
      display: flex;
xiaomiao committed
273
    }
xiaomiao committed
274 275 276 277 278 279 280
    .leftadd {
      width: 3%;
      height: 100%;
      display: flex;
      font-size: 14px;
      text-indent: 20px;
      align-items: center;
xiaomiao committed
281
      border: 1px solid $borderColor;
xiaomiao committed
282 283 284 285 286 287 288
    }
    .righttitle {
      width: 80%;
      height: 100%;
      line-height: 80px;
      border: 1px solid $borderColor;
      margin: auto;
xiaomiao committed
289 290 291
      font-size: 22px;
      font-weight: 400;
    }
xiaomiao committed
292
  }
任超 committed
293

xiaomiao committed
294 295 296
  /deep/.el-form-item {
    margin-bottom: 0;
  }
任超 committed
297

xiaomiao committed
298 299 300 301 302 303 304
  .bottom10 {
    margin-bottom: 15px;
  }

  .spyj_form {
    display: flex;
    border: 1px solid $borderColor;
任超 committed
305

xiaomiao committed
306 307 308 309
    .item_left {
      width: 150px;
      background-color: #f8f8fa;
      color: #606266;
xiaomiao committed
310
      display: flex;
xiaomiao committed
311 312 313 314 315 316 317 318 319
      font-size: 14px;
      text-indent: 50px;
      align-items: center;
      border-right: 1px solid $borderColor;
    }

    .item_right {
      flex: 1;
      width: 100%;
任超 committed
320

xiaomiao committed
321
      /deep/.el-form-item__label {
xiaomiao committed
322
        background-color: #f8f8fa;
任超 committed
323
      }
xiaomiao committed
324 325 326 327 328 329 330 331
      /deep/.el-form-item__content {
        display: block;
        text-align: left;
      }
      .opinion_item {
        /deep/.el-form-item__error {
          margin-top: -16px !important;
          left: 3px;
xiaomiao committed
332
        }
xiaomiao committed
333 334
        border-bottom: 1px solid $borderColor;
      }
任超 committed
335

xiaomiao committed
336 337 338
      .opinion {
        position: relative;
        font-size: 14px;
任超 committed
339

xiaomiao committed
340 341
        /deep/.el-textarea__inner {
          border: none;
任超 committed
342
        }
xiaomiao committed
343
      }
任超 committed
344

xiaomiao committed
345 346 347 348
      .opinion_btn {
        position: absolute;
        right: 15px;
        bottom: 10px;
任超 committed
349 350
      }
    }
xiaomiao committed
351
  }
任超 committed
352

xiaomiao committed
353 354 355 356 357 358 359
  .submit_button {
    text-align: center;
    margin: 15px 0;
  }

  .el-date-editor.el-input {
    width: 100%;
任超 committed
360
  }
xiaomiao committed
361
}
xiaomiao committed
362
</style>