Blame view

src/views/djbworkflow/djbBook/spyj.vue 8.93 KB
xiaomiao committed
1 2 3 4 5 6
<!--
 * @Description: 审批意见
 * @Autor: renchao
 * @LastEditTime: 2023-05-17 10:41:24
-->
<template>
xiaomiao committed
7
  <div class="spyj loadingtext">
xiaomiao committed
8
    <div class="box">
xiaomiao committed
9
      <div class="spyj_title">
xiaomiao committed
10
        <div class="righttitle">审批表</div>
xiaomiao committed
11 12
      </div>

xiaomiao committed
13
      <div v-for="(item, index) in tableData" :key="index">
xiaomiao committed
14 15 16
        <el-form
          :model="tableData[index]"
          label-width="120px"
xiaomiao committed
17
          ref="ruleFormRef'"
xiaomiao committed
18 19 20 21 22 23 24 25
        >
          <div class="spyj_form">
            <div class="item_left">
              <div class="right">{{ item.jdmc }}意见</div>
            </div>
            <div class="item_right">
              <el-row>
                <el-col :span="24">
xiaomiao committed
26
                  <el-form-item label-width="0" class="opinion_item">
xiaomiao committed
27
                    <el-input
xiaomiao committed
28
                      :disabled="!ableOperation"
xiaomiao committed
29 30 31 32 33 34
                      type="textarea"
                      :rows="4"
                      class="opinion"
                      placeholder="请输入审批意见"
                      v-model="item.shyj"
                    ></el-input>
xiaomiao committed
35 36 37 38 39 40
                    <el-button
                      class="opinion_btn"
                      @click="commonOpinion(index)"
                      v-if="ableOperation"
                      >常用意见</el-button
                    >
xiaomiao committed
41 42 43 44 45
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="16">
xiaomiao committed
46 47
                  <el-form-item label="审查人">
                    <el-input
xiaomiao committed
48
                      :disabled="!ableOperation"
xiaomiao committed
49 50
                      v-model="item.shryxm"
                    ></el-input>
xiaomiao committed
51 52 53
                  </el-form-item>
                </el-col>
                <el-col :span="8">
xiaomiao committed
54
                  <el-form-item class="sjxzq" label="审核时间">
xiaomiao committed
55
                    <el-date-picker
xiaomiao committed
56
                      :disabled="!ableOperation"
xiaomiao committed
57
                      v-model="item.shkssj"
xiaomiao committed
58
                      type="date"
xiaomiao committed
59 60 61
                      placeholder="选择日期"
                      value-format="yyyy-MM-dd HH:mm:ss"
                      format="yyyy-MM-dd"
xiaomiao committed
62 63 64 65 66 67
                    >
                    </el-date-picker>
                  </el-form-item>
                </el-col>
              </el-row>
            </div>
xiaomiao committed
68
          </div>
xiaomiao committed
69 70
        </el-form>
      </div>
xiaomiao committed
71
      <div class="submit_button" v-if="ableOperation">
xiaomiao committed
72
        <el-button type="primary" @click="onSubmit()">保存</el-button>
xiaomiao committed
73
      </div>
xiaomiao committed
74
    </div>
xiaomiao committed
75
    <!-- <el-empty v-if="isNoData" description="暂无数据"></el-empty> -->
xiaomiao committed
76 77 78
  </div>
</template>
<script>
xiaomiao committed
79
import { addidea, getShList } from "@/api/djbRepair.js";
xiaomiao committed
80 81 82 83 84 85 86 87
import { mapGetters } from "vuex";
export default {
  computed: {
    ...mapGetters(["userData", "yjsqOptions"]),
  },
  data() {
    return {
      isNoData: false,
xiaomiao committed
88
      currentindex: 0,
xiaomiao committed
89
      ableOperation: false,
xiaomiao committed
90 91 92
      tableData: [{ jdmc: "初审" }, { jdmc: "复审" }, { jdmc: "核定" }],
      falg: false,
      falg1: false,
xiaomiao committed
93 94 95
    };
  },

xiaomiao committed
96 97 98 99
  watch: {
    yjsqOptions: {
      handler(val) {
        console.log("val", val);
xiaomiao committed
100 101
        console.log("this.tableData[this.currentindex]",this.tableData[this.currentindex]);

xiaomiao committed
102
        this.add(val);
xiaomiao committed
103
      },
xiaomiao committed
104 105
      deep: true,
      immediate: true,
xiaomiao committed
106
    },
xiaomiao committed
107
  },
xiaomiao committed
108
  created() {},
xiaomiao committed
109
  mounted() {
xiaomiao committed
110
    this.ableOperation = this.$parent.ableOperation;
xiaomiao committed
111 112
    this.getShList();
  },
xiaomiao committed
113
  methods: {
xiaomiao committed
114
  /**
yuanbo committed
115
     * @description: getShList
xiaomiao committed
116 117 118
     * @param {*} obj
     * @author: renchao
     */
xiaomiao committed
119 120 121 122 123 124 125 126 127 128 129 130 131 132
    getShList() {
      this.$startLoading();
      var formdata = {
        bsmRepair: this.$parent.bsmRepair,
      };
      getShList(formdata).then((res) => {
        this.$endLoading();
        if (res.code === 200 && res.result) {
          if (res.result.length) {
            this.tableData = res.result;
          }
        }
      });
    },
yuanbo committed
133 134 135 136 137
    /**
     * @description: judgment
     * @param {*} obj
     * @author: renchao
     */
xiaomiao committed
138
    judgment(obj) {},
yuanbo committed
139 140 141 142
    /**
     * @description: onSubmit
     * @author: renchao
     */
xiaomiao committed
143 144 145 146 147 148 149 150 151 152 153 154 155
    onSubmit() {
      if (
        this.tableData[2].shyj == null ||
        this.tableData[2].shryxm == null ||
        this.tableData[2].shkssj == null ||
        this.tableData[2].shyj == "" ||
        this.tableData[2].shryxm == "" ||
        this.tableData[2].shkssj == ""
      ) {
        this.falg = false;
        this.$message.error("请完善核定意见信息填写");
      } else {
        this.falg = true;
xiaomiao committed
156 157 158
        if (this.tableData[0].shyj != null && this.tableData[0].shyj != ""||
            this.tableData[0].shryxm != null && this.tableData[0].shryxm != ""||
            this.tableData[0].shkssj != null && this.tableData[0].shkssj != "") {
xiaomiao committed
159
          if (
xiaomiao committed
160 161
            this.tableData[0].shyj == null ||
            this.tableData[0].shyj == ""||
xiaomiao committed
162 163 164 165 166 167 168 169 170
            this.tableData[0].shryxm == null ||
            this.tableData[0].shryxm == "" ||
            this.tableData[0].shkssj == null ||
            this.tableData[0].shkssj == ""
          ) {
            this.$message.error("请完善初审意见信息填写");
            this.falg = false;
          } else {
            this.falg = true;
xiaomiao committed
171
          }
xiaomiao committed
172 173 174
        } else {
          this.falg = true;
        }
xiaomiao committed
175 176 177
         if (this.tableData[1].shyj != null && this.tableData[1].shyj != ""||
            this.tableData[1].shryxm != null && this.tableData[1].shryxm != ""||
            this.tableData[1].shkssj != null && this.tableData[1].shkssj != "") {
xiaomiao committed
178
          if (
xiaomiao committed
179 180
            this.tableData[1].shyj == null ||
            this.tableData[1].shyj == ""||
xiaomiao committed
181 182 183 184 185 186 187 188 189 190 191 192 193
            this.tableData[1].shryxm == null ||
            this.tableData[1].shryxm == "" ||
            this.tableData[1].shkssj == null ||
            this.tableData[1].shkssj == ""
          ) {
            this.$message.error("请完善复审意见信息填写");
            this.falg1 = false;
          } else {
            this.falg1 = true;
          }
        } else {
          this.falg1 = true;
        }
xiaomiao committed
194
      }
xiaomiao committed
195 196

      if (this.falg && this.falg1) {
xiaomiao committed
197 198 199 200 201 202 203 204 205 206 207
        this.tableData.forEach((item, index) => {
          item["bsmBusiness"] = this.$parent.bsmRepair;
        }),
          addidea(this.tableData).then((res) => {
            if (res.code === 200) {
              this.$message.success("保存成功");
              this.refresh += 1;
            } else {
              this.$message.error(res.message);
            }
          });
xiaomiao committed
208
      } else {
xiaomiao committed
209
        return false;
xiaomiao committed
210
      }
xiaomiao committed
211
    },
xiaomiao committed
212
    //打开常用意见列表弹窗
yuanbo committed
213 214 215 216 217
    /**
     * @description: 打开常用意见列表弹窗
     * @param {*} index
     * @author: renchao
     */
xiaomiao committed
218 219 220 221 222 223 224 225 226 227
    commonOpinion(index) {
      this.currentindex = index;
      this.$popupDialog(
        "常用意见",
        "workflow/components/dialog/commonOpinion",
        {},
        "70%",
        true
      );
    },
yuanbo committed
228 229 230 231 232
    /**
     * @description: add
     * @param {*} val
     * @author: renchao
     */
xiaomiao committed
233 234 235
    add(val) {
      if (val != "") {
        this.$set(this.tableData[this.currentindex], "shyj", val);
xiaomiao committed
236
      }
xiaomiao committed
237
    },
xiaomiao committed
238 239
  },
};
xiaomiao committed
240
</script>
xiaomiao committed
241 242
<style scoped lang="scss">
@import "~@/styles/mixin.scss";
xiaomiao committed
243

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

xiaomiao committed
286 287 288
  /deep/.el-form-item {
    margin-bottom: 0;
  }
xiaomiao committed
289

xiaomiao committed
290 291 292 293 294 295 296
  .bottom10 {
    margin-bottom: 15px;
  }

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

xiaomiao committed
298 299 300 301
    .item_left {
      width: 150px;
      background-color: #f8f8fa;
      color: #606266;
xiaomiao committed
302
      display: flex;
xiaomiao committed
303
      font-size: 14px;
xiaomiao committed
304
      text-indent: 50px;
xiaomiao committed
305 306 307 308 309 310 311
      align-items: center;
      border-right: 1px solid $borderColor;
    }

    .item_right {
      flex: 1;
      width: 100%;
xiaomiao committed
312

xiaomiao committed
313
      /deep/.el-form-item__label {
xiaomiao committed
314 315
        background-color: #f8f8fa;
      }
xiaomiao committed
316 317 318 319 320 321 322 323
      /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
324 325
        }

xiaomiao committed
326 327
        border-bottom: 1px solid $borderColor;
      }
xiaomiao committed
328

xiaomiao committed
329 330 331
      .opinion {
        position: relative;
        font-size: 14px;
xiaomiao committed
332

xiaomiao committed
333 334
        /deep/.el-textarea__inner {
          border: none;
xiaomiao committed
335
        }
xiaomiao committed
336
      }
xiaomiao committed
337

xiaomiao committed
338 339 340 341
      .opinion_btn {
        position: absolute;
        right: 15px;
        bottom: 10px;
xiaomiao committed
342 343
      }
    }
xiaomiao committed
344
  }
xiaomiao committed
345

xiaomiao committed
346 347 348
  .submit_button {
    text-align: center;
    margin: 15px 0;
xiaomiao committed
349
  }
xiaomiao committed
350

xiaomiao committed
351 352
  .el-date-editor.el-input {
    width: 100%;
xiaomiao committed
353
  }
xiaomiao committed
354
}
xiaomiao committed
355
</style>