<template>
  <div>
    <div v-if="d.w">
      <div style="margin:10px auto;">
        <h3
          v-if="d.w"
          style="font-size:18px;border-bottom:1px solid #ddd;font-weight:400;font-family:pingfangR;padding-bottom:10px;"
        >
          <span class="circle" v-if="d.w.ExamineStatus==0||d.w.ExamineStatus==-1"></span>
          <span class="circle green" v-else-if="d.w.Status==0"></span>
          <span class="circle red" v-else-if="d.w.Status==1||d.w.Status==2"></span>
          <span class="circle black" v-else-if="d.w.Status==3"></span>
          <span style="margin-right:15px;">{{d.w.Title}}</span>
          <el-tag v-if="d.w.Tags.length>0">{{d.w.Tags}}</el-tag>
        </h3>
        <div
          v-if="d.w"
          style="font-size:14px;font-family:pingfangR;margin: 10px 0;padding: 10px;background: #FFF;min-height:200px;"
        >
        <div style='font-size:20px;font-weight:400;color:#333;margin-bottom:12px;'>工作计划内容</div>
        {{d.w.Description}}
        </div>
        <fieldset v-if="d.w" style="border: 1px solid #DDD;padding: 13px;font-size: 12px;">
          <legend style="padding:0 10px; font-size:14px;">计划工时信息</legend>
          <el-row :gutter="12">
            <el-col :span="6">创建人:{{d.w.CreateName}}</el-col>
            <el-col :span="6">创建日期:{{d.w.CreateDate}}</el-col>
            <el-col :span="6">开始时间:{{d.w.BeginTime}}</el-col>
            <el-col :span="6">截止时间:{{d.w.EndTime}}</el-col>
          </el-row>
        </fieldset>
        <fieldset style="border: 1px solid #DDD;padding: 13px;font-size: 12px;margin-top:30px;">
          <legend style="padding:0 10px; font-size:14px;">工作进度反馈</legend>
          <div v-for="(item, index) in d.p" :key="index">
            <el-card class="work-content">
              <h4>
                进度更新:
                <div style="width:120px;display: inline-block;margin-left: 15px;">
                  <el-progress
                    :text-inside="true"
                    :stroke-width="24"
                    :percentage="item.Progree"
                    status="success"
                  ></el-progress>
                </div>
              </h4>
              <p v-if="d.w">{{d.w.CreateName}} 提交于 {{item.CreateDate}}</p>
              <div class="cont">{{item.Content}}</div>
              <div class="attach" v-if="item.Attach!==''">
                附件:
                <span
                  @click="openFile(item.Attach)"
                  style="cursor: pointer;"
                  class="work-file"
                >{{item.Attach.substring(item.Attach.lastIndexOf("/")+1,item.Attach.length)}}</span>
              </div>
              <div class="attach" v-if="item.Linker && item.Linker.length>0">
                相关链接
                <span
                  v-for="lik in item.Linker"
                  :key="lik"
                  @click="openFile(lik)"
                  style="cursor: pointer;display:block;margin-top:10px;"
                  class="work-file"
                >{{lik}}</span>
              </div>
            </el-card>
          </div>
          <div v-if="!d.p || d.p.length==0" style="text-align:center;font-size:12px;color:grey;">
            <div style="display:inline-block">
              <i class="iconfont icon-kong" style="font-size:120px;"></i><br/>
              暂无进度反馈
            </div>
          </div>
        </fieldset>
        <fieldset style="border: 1px solid #DDD;padding: 13px;font-size: 12px;margin-top:30px;">
          <legend style="padding:0 10px; font-size:14px;">总经理审批记录</legend>
          <div v-if="d.w.ZongExamineStatus!=0">
            <el-card
              class="work-content"
              :class="{'blue':d.w.ZongExamineStatus==1,'red':d.w.ZongExamineStatus==-1}"
            >
              <el-row :gutter="10">
                <el-col :span="22">
                  <h4>总经理立项审核{{d.w.ZongExamineStatus==-1?'驳回':'通过'}}</h4>
                  <p>徐总 提交于 {{d.w.ZongExamineDate}}</p>
                  <div class="cont">{{d.w.ZongExamineRemark}}</div>
                </el-col>
                <el-col :span="2">
                  <el-button
                    type="success"
                    v-if="!showZui3 && userInfo.EmployeeId==1"
                    @click="showZui3=true"
                  >追加信息</el-button>
                  <br/><br/>
                  <el-button
                    type="warning"
                    v-if="canCancel3 && userInfo.EmployeeId==1"
                    @click="cancelExamine(3)"
                  >取消审核</el-button>
                </el-col>
              </el-row>
              <div v-if="d.w.ZongExamineRemarkExpand && d.w.ZongExamineRemarkExpand.length>0">
                <div
                  v-for="(item, index) in d.w.ZongExamineRemarkExpand"
                  :key="index"
                  style="margin-top:10px;border-top:1px dotted #Fefefe;padding-top:10px;"
                >
                  <el-row :gutter="12">
                    <el-col :span="24">
                      <el-tag type="success" style="margin-right:12px">追加信息</el-tag>
                      {{item.u}} 提交于 {{item.d}}
                    </el-col>
                  </el-row>
                  <el-row :gutter="12" style="margin-top:12px;">
                    <el-col :span="24">
                      <div class="cont">{{item.c}}</div>
                    </el-col>
                  </el-row>
                </div>
              </div>
              <div
                v-if="showZui3"
                style="margin-top:10px;border-top:1px dotted #Fefefe;padding-top:10px;"
              >
                <div style="margin:10px 0;font-size:18px;">追加信息</div>
                <div style="margin-bottom:10px">
                  <el-input
                    type="textarea"
                    :rows="2"
                    style="width:100%;color:#000 !important;"
                    placeholder="请输入追加内容信息"
                    v-model="examineRemarkExpand"
                  ></el-input>
                </div>
                <div slot="footer" class="dialog-footer">
                  <button class="normalBtn" type="primary" @click="setRemark(2)">确认提交</button>
                  <button class="normalBtn" @click="showZui3=false">取消</button>
                </div>
              </div>
            </el-card>
          </div>
          <div v-if="d.w.ZongFinishExamineStatus!=0">
            <el-card
              class="work-content"
              :class="{'blue':d.w.ZongFinishExamineStatus==1,'red':d.w.ZongFinishExamineStatus==-1}"
            >
              <el-row :gutter="10">
                <el-col :span="22">
                  <h4>总经理完成审核{{d.w.ZongFinishExamineStatus==-1?'驳回':'通过'}}</h4>
                  <p>徐总 提交于 {{d.w.ZongFinishExamineDate}}</p>
                  <div class="cont">{{d.w.ZongFinishExamineRemark}}</div>
                </el-col>
                <el-col :span="2">
                  <el-button
                    type="success"
                    v-if="!showZui4 && userInfo.EmployeeId==1"
                    @click="showZui4=true"
                  >追加信息</el-button>
                  <br/><br/>
                  <el-button
                    type="warning"
                    v-if="canCancel4 && userInfo.EmployeeId==1"
                    @click="cancelExamine(4)"
                  >取消审核</el-button>
                </el-col>
              </el-row>
              <div v-if="d.w.ZongFinishExamineRemarkExpand && d.w.ZongFinishExamineRemarkExpand.length>0">
                <div
                  v-for="(item, index) in d.w.ZongFinishExamineRemarkExpand"
                  :key="index"
                  style="margin-top:10px;border-top:1px dotted #Fefefe;padding-top:10px;"
                >
                  <el-row :gutter="12">
                    <el-col :span="24">
                      <el-tag type="success" style="margin-right:12px">追加信息</el-tag>
                      {{item.u}} 提交于 {{item.d}}
                    </el-col>
                  </el-row>
                  <el-row :gutter="12" style="margin-top:12px;">
                    <el-col :span="24">
                      <div class="cont">{{item.c}}</div>
                    </el-col>
                  </el-row>
                </div>
              </div>
              <div
                v-if="showZui4"
                style="margin-top:10px;border-top:1px dotted #Fefefe;padding-top:10px;"
              >
                <div style="margin:10px 0;font-size:18px;">追加信息</div>
                <div style="margin-bottom:10px">
                  <el-input
                    type="textarea"
                    :rows="2"
                    style="width:100%;color:#000 !important;"
                    placeholder="请输入追加内容信息"
                    v-model="examineRemarkExpand"
                  ></el-input>
                </div>
                <div slot="footer" class="dialog-footer">
                  <button class="normalBtn" type="primary" @click="setRemark(3)">确认提交</button>
                  <button class="normalBtn" @click="showZui4=false">取消</button>
                </div>
              </div>
            </el-card>
          </div>
          <div v-if="d.w.ZongExamineStatus==0 && d.w.ZongFinishExamineStatus==0" style="text-align:center;font-size:12px;color:grey;">
            <div style="display:inline-block">
              <i class="iconfont icon-kong" style="font-size:120px;"></i><br/>
              暂无审核信息
            </div>
          </div>
        </fieldset>
        <fieldset style="border: 1px solid #DDD;padding: 13px;font-size: 12px;margin-top:30px;">
          <legend style="padding:0 10px; font-size:14px;">主管审批记录</legend>
          <div v-if="d.w.ExamineStatus!=0">
            <el-card
              class="work-content"
              :class="{'green':d.w.ExamineStatus==1,'red':d.w.ExamineStatus==-1}"
            >
              <el-row :gutter="10">
                <el-col :span="22">
                  <h4>主管立项审核{{d.w.ExamineStatus==-1?'驳回':'通过'}}</h4>
                  <p>{{d.w.ExamineUserName}} 提交于 {{d.w.ExamineDate}}</p>
                  <div class="cont">{{d.w.ExamineRemark}}</div>
                </el-col>
                <el-col :span="2">
                  <el-button
                    type="primary"
                    v-if="!showZui1 && userInfo.EmployeeId==d.w.ExamineUser"
                    @click="showZui1=true"
                  >追加信息</el-button>
                  <br/><br/>
                  <el-button
                    type="warning"
                    v-if="canCancel1 && userInfo.EmployeeId==d.w.ExamineUser"
                    @click="cancelExamine(0)"
                  >取消审核</el-button>
                </el-col>
              </el-row>
              <div v-if="d.w.ExamineRemarkExpand && d.w.ExamineRemarkExpand.length>0">
                <div
                  v-for="(item, index) in d.w.ExamineRemarkExpand"
                  :key="index"
                  style="margin-top:10px;border-top:1px dotted #Fefefe;padding-top:10px;"
                >
                  <el-row :gutter="12">
                    <el-col :span="24">
                      <el-tag style="margin-right:12px">追加信息</el-tag>
                      {{item.u}} 提交于 {{item.d}}
                    </el-col>
                  </el-row>
                  <el-row :gutter="12" style="margin-top:12px;">
                    <el-col :span="24">
                      <div class="cont">{{item.c}}</div>
                    </el-col>
                  </el-row>
                </div>
              </div>
              <div
                v-if="showZui1"
                style="margin-top:10px;border-top:1px dotted #Fefefe;padding-top:10px;"
              >
                <div style="margin:10px 0;font-size:18px;">追加信息</div>
                <div style="margin-bottom:10px">
                  <el-input
                    type="textarea"
                    :rows="2"
                    style="width:100%;color:#000 !important;"
                    placeholder="请输入追加内容信息"
                    v-model="examineRemarkExpand"
                  ></el-input>
                </div>
                <div slot="footer" class="dialog-footer">
                  <button class="normalBtn" type="primary" @click="setRemark(0)">确认提交</button>
                  <button class="normalBtn" @click="showZui1=false">取消</button>
                </div>
              </div>
            </el-card>
          </div>
          <div v-if="d.w.FinishExamineStatus!=0">
            <el-card
              class="work-content"
              :class="{'green':d.w.FinishExamineStatus==1,'red':d.w.FinishExamineStatus==-1}"
            >
              <el-row :gutter="10">
                <el-col :span="22">
                  <h4>主管完结审核{{d.w.FinishExamineStatus==-1?'驳回':'通过'}}</h4>
                  <p>{{d.w.FinishExamineUserName}} 提交于 {{d.w.FinishExamineDate}}</p>
                  <div class="cont">{{d.w.FinishExamineRemark}}</div>
                </el-col>
                <el-col :span="2">
                  <el-button
                    type="primary"
                    v-if="!showZui2 && userInfo.EmployeeId==d.w.FinishExamineUser"
                    @click="showZui2=true"
                  >追加信息</el-button>
                  <el-button
                    type="warning"
                    v-if="canCancel1 && userInfo.EmployeeId==d.w.ExamineUser"
                    @click="cancelExamine(1)"
                  >取消审核</el-button>
                </el-col>
              </el-row>
              <div v-if="d.w.FinishExamineRemarkExpand && d.w.FinishExamineRemarkExpand.length>0">
                <div
                  v-for="(item, index) in d.w.FinishExamineRemarkExpand"
                  :key="index"
                  style="margin-top:10px;border-top:1px dotted #Fefefe;padding-top:10px;"
                >
                  <el-row :gutter="12">
                    <el-col :span="24">
                      <el-tag style="margin-right:12px">追加信息</el-tag>
                      {{item.u}} 提交于 {{item.d}}
                    </el-col>
                  </el-row>
                  <el-row :gutter="12" style="margin-top:12px;">
                    <el-col :span="24">
                      <div class="cont">{{item.c}}</div>
                    </el-col>
                  </el-row>
                </div>
              </div>
              <div
                v-if="showZui2"
                style="margin-top:10px;border-top:1px dotted #Fefefe;padding-top:10px;"
              >
                <div style="margin:10px 0;font-size:18px;">追加信息</div>
                <div style="margin-bottom:10px">
                  <el-input
                    type="textarea"
                    :rows="2"
                    style="width:100%;color:#000 !important;"
                    placeholder="请输入追加内容信息"
                    v-model="examineRemarkExpand"
                  ></el-input>
                </div>
                <div slot="footer" class="dialog-footer">
                  <button class="normalBtn" type="primary" @click="setRemark(1)">确认提交</button>
                  <button class="normalBtn" @click="showZui2=false">取消</button>
                </div>
              </div>
            </el-card>
          </div>
          <div v-if="d.w.ExamineStatus==0&&d.w.FinishExamineStatus==0" style="text-align:center;font-size:12px;color:grey;">
            <div style="display:inline-block">
              <i class="iconfont icon-kong" style="font-size:120px;"></i><br/>
              暂无审核信息
            </div>
          </div>
        </fieldset>
        
        <fieldset
          v-if="isEaxmine && d.w && (((d.w.ExamineStatus==0 || (d.w.Status>=2 && d.w.FinishExamineStatus==0)) && userInfo.EmployeeId!=1) || ((d.w.ZongExamineStatus==0||(d.w.ZongFinishExamineStatus==0 && d.w.Status>1)) && userInfo.EmployeeId==1))"
          style="border: 1px solid #DDD;padding: 13px;font-size: 12px;margin-top:20px;"
        >
          <legend style="padding:0 10px; font-size:14px;">{{userInfo.EmployeeId==1?"总经理":""}}审批</legend>
          <div style="margin-bottom:10px">
            <el-radio v-model="radio" label="1">通过</el-radio>
            <el-radio v-model="radio" label="-1">驳回</el-radio>
          </div>
          <div style="margin-bottom:10px">
            <el-input
              type="textarea"
              :rows="4"
              style="width:100%"
              placeholder="请输入审批意见"
              v-model="textarea"
            ></el-input>
          </div>
          <div slot="footer" class="dialog-footer">
            <button class="normalBtn" type="primary" @click="goexamine">确认提交</button>
          </div>
        </fieldset>
        <fieldset
          v-if="isUpdate && d.w && ((d.w.Status==0 && (d.w.ExamineStatus==1||d.w.ZongExamineStatus==1)) || d.w.Status==1)"
          style="border: 1px solid #DDD;padding: 13px;font-size: 12px;margin-top:20px;"
        >
          <legend style="padding:0 10px; font-size:14px;">提交进度</legend>

          <div style="margin-bottom:10px">
            进度说明:
            <el-input
              type="textarea"
              :rows="4"
              style="width:100%"
              placeholder="请输入进度说明"
              v-model="textarea2"
            ></el-input>
          </div>
          <div style="margin-bottom:10px">
            相关链接:
            <el-input
              type="textarea"
              :rows="2"
              style="width:100%"
              placeholder="请填写相关链接,附件和相关链接必须二选一提交"
              v-model="linker"
            ></el-input>
            <span style="font-size:12px;color:#aaa;margin:10px 0;">注意,多个URL请使用换行分割</span>
          </div>

          <div style="margin-bottom:10px;width: 32%;" v-loading="loading" element-loading-text="拼命上传中">
            附件上传:
            <el-upload
              ref="my-upload"
              class="upload-demo"
              drag
              :http-request="uploadFileBtn"
              :multiple="true"
              :show-file-list="true"
              :on-preview="previewFile"
              :on-remove="removeFile"
              :limit="1"
              action
            >
              <i class="el-icon-upload"></i>
              <div class="el-upload__text">
                将文件拖到此处,或
                <em>点击上传</em>
              </div>
            </el-upload>
          </div>
          <div style="margin-bottom:10px;">
            <el-row :gutter="12">
              <el-col :span="4">当前进度:</el-col>
            </el-row>
            <el-row :gutter="12">
              <el-col :span="4">
                <el-slider v-model="progree" :min="d.w.Progree" :max="100" :step="1"></el-slider>
              </el-col>
            </el-row>
          </div>
          <div slot="footer" class="dialog-footer">
            <button v-if="loading"  style="background: #909399;border: 1px solid #909399;cursor: no-drop;" class="normalBtn" type="info">上传中...</button>
            <button v-else class="normalBtn" type="primary" @click="setprogress">确认提交</button>
          </div>
        </fieldset>
      </div>
      <viewer :images="images" :options="imageOptions" @inited="inited" class="viewer" ref="viewer">
        <img v-for="src in images" :src="src" :key="src" />
      </viewer>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      d: {},
      radio: "1",
      isEaxmine: false,
      isUpdate: false,
      textarea: "",
      textarea2: "",
      progree: 0,
      fileList: [],
      attach: "",
      linker: "",
      imageOptions: {
        navbar: false,
        title: false
      },
      images: [],
      showZui1: false,
      showZui2: false,
      showZui3: false,
      showZui4:false,
      examineRemarkExpand: "",
      userInfo: {},
      canCancel1:false,
      canCancel2:false,
      canCancel3:false,
      canCancel4:false,
      loading: false,
    };
  },
  mounted() {
    this.userInfo = this.getLocalStorage();
    let id = this.$route.query.id;
    this.isEaxmine = this.$route.query.examine ? true : false;
    this.isUpdate = this.$route.query.update ? true : false;
    this.init(id);
    this.MsgBus.$on('UploadSelfFileErr', content=>{
      this.loading = false
    })
  },
  methods: {
    openFile(file) {
      if (file) {
        window.open(file, "_blank");
      }
    },
    inited(viewer) {
      this.$viewer = viewer;
    },
    removeFile(e) {
      this.attach = "";
    },
    previewFile(e) {
      window.open(this.attach, "_blank");
      return
      const link = document.createElement("a");
      let _loadUrl = this.domainManager().DomainUrl;
      let str = window.location.href;
      link.href = this.attach;
      document.body.appendChild(link);
      link.click();
    },
    uploadFileBtn(file) {
      if (file.file.size > 1024 * 1024 * 100) {
        this.$message.warning('上传文件不能大于100M');
        this.$refs['my-upload'].clearFiles();
        return;
      }
      this.loading = true
      //上传
      let newArr = [];
      newArr.push(file.file);
      let path = "/Upload/Temporary/";
      this.$message.info(this.$t("tips.shangchuanzhong"));
      this.UploadSelfFileT(path, newArr, x => {
        this.attach = this.domainManager().ViittoFileUrl + x.data.FilePath;
        this.$message.success(this.$t("tips.scchenggong"));
        this.loading = false
      });
    },
    init(id) {
      this.apipost(
        "user_post_GetWorkDetails",
        { id },
        res => {
          if (res.data.resultCode == 1) {
            this.d = res.data.data;
            if(this.d.w.ExamineRemarkExpand && this.d.w.ExamineRemarkExpand.length>0){
              this.d.w.ExamineRemarkExpand=JSON.parse(this.d.w.ExamineRemarkExpand);
            }
            if(this.d.w.FinishExamineRemarkExpand && this.d.w.FinishExamineRemarkExpand.length>0){
              this.d.w.FinishExamineRemarkExpand=JSON.parse(this.d.w.FinishExamineRemarkExpand);
            }
            if(this.d.w.ZongExamineRemarkExpand && this.d.w.ZongExamineRemarkExpand.length>0){
              this.d.w.ZongExamineRemarkExpand=JSON.parse(this.d.w.ZongExamineRemarkExpand);
            }
            if(this.d.w.ZongFinishExamineRemarkExpand && this.d.w.ZongFinishExamineRemarkExpand.length>0){
              this.d.w.ZongFinishExamineRemarkExpand=JSON.parse(this.d.w.ZongFinishExamineRemarkExpand);
            }
            
            let dateEnd = new Date();
            if (this.d.w.ExamineStatus!=0) {
              let dateBegin = new Date(this.d.w.ExamineDate.replace(/-/g, "/"))
              let dateDiff = dateEnd.getTime() - dateBegin.getTime();
              if(dateDiff/1000/60<5){
                this.canCancel1=true;
              }
            }
             if (this.d.w.FinishExamineStatus!=0) {
              let dateBegin = new Date(this.d.w.FinishExamineDate.replace(/-/g, "/"))
              let dateDiff = dateEnd.getTime() - dateBegin.getTime();
              if(dateDiff/1000/60<5){
                this.canCancel2=true;
              }
            }
            if (this.d.w.ZongExamineStatus!=0) {
              let dateBegin = new Date(this.d.w.ZongExamineDate.replace(/-/g, "/"))
              let dateDiff = dateEnd.getTime() - dateBegin.getTime();
              if(dateDiff/1000/60<5){
                this.canCancel3=true;
              }
            }
            if (this.d.w.ZongFinishExamineStatus!=0) {
              let dateBegin = new Date(this.d.w.ZongFinishExamineDate.replace(/-/g, "/"))
              let dateDiff = dateEnd.getTime() - dateBegin.getTime();
              if(dateDiff/1000/60<5){
                this.canCancel4=true;
              }
            }
            this.progree = this.d.w.Progree;
            this.d.p.forEach(x => {
              if (x.Linker && x.Linker != "") {
                x.Linker = JSON.parse(x.Linker);
              }
            });
          } else {
            this.$message.error(res.data.message);
          }
        },
        null
      );
    },
    setprogress() {
      if(this.d.w.BeginTime.split(' ')[0]!=this.formatDate("yyyy-MM-dd")){
        this.$message.error("今日事,今日毕,你已经超时,无法提交咯");
        return;
      }
      if (this.textarea2 == "") {
        this.$message.error("请填写进度说明");
        return;
      } else if (this.linker.length == 0 && this.attach.length == 0) {
        this.$message.error("附件和相关链接必须二选一提交");
        return;
      }
      let tempLinker = "";
      if (this.linker.length > 0) {
        tempLinker = JSON.stringify(this.linker.split(/[(\r\n)\r\n]+/));
      }
      this.apipost(
        "user_post_SetWorkProcess",
        {
          pid: this.$route.query.id,
          content: this.textarea2,
          progree: this.progree,
          attach: this.attach,
          linker: tempLinker
        },
        res => {
          if (res.data.resultCode == 1) {
            window.location.reload();
          } else {
            this.$message.error(res.data.message);
          }
        },
        null
      );
    },
    goexamine() {
      if (this.textarea == "") {
        this.$message.error("请填写审批意见");
        return;
      }
      this.apipost(
        "user_post_SetWorkExamine",
        {
          id: this.$route.query.id,
          content: this.textarea,
          status: this.radio
        },
        res => {
          if (res.data.resultCode == 1) {
            this.$router.push({
              name: "workManager",
              query: {}
            });
          } else {
            this.$message.error(res.data.message);
          }
        },
        null
      );
    },
    setRemark(type) {
      let p = {
        type,
        id: this.$route.query.id
      };
      let r = {
        u: this.userInfo.emName,
        d: this.formatDate("yyyy-MM-dd hh:mm"),
        c: this.examineRemarkExpand
      };
      if (type == 0) {
        if (this.d.w.ExamineRemarkExpand && this.d.w.ExamineRemarkExpand.length > 0) {
          this.d.w.ExamineRemarkExpand.push(r);
        } else {
          this.d.w.ExamineRemarkExpand = [];
          this.d.w.ExamineRemarkExpand.push(r);
        }
        p.remark = JSON.stringify(this.d.w.ExamineRemarkExpand);
      } else if (type == 1) {
        if (
          this.d.w.FinishExamineRemarkExpand &&
          this.d.w.FinishExamineRemarkExpand.length > 0
        ) {
          this.d.w.FinishExamineRemarkExpand.push(r);
        } else {
          this.d.w.FinishExamineRemarkExpand = [];
          this.d.w.FinishExamineRemarkExpand.push(r);
        }
        p.remark = JSON.stringify(this.d.w.FinishExamineRemarkExpand);
      } else if (type == 2) {
        if (
          this.d.w.ZongExamineRemarkExpand &&
          this.d.w.ZongExamineRemarkExpand.length > 0
        ) {
          this.d.w.ZongExamineRemarkExpand.push(r);
        } else {
          this.d.w.ZongExamineRemarkExpand = [];
          this.d.w.ZongExamineRemarkExpand.push(r);
        }
        p.remark = JSON.stringify(this.d.w.ZongExamineRemarkExpand);
      } else if (type == 3) {
        if (
          this.d.w.ZongFinishExamineRemarkExpand &&
          this.d.w.ZongFinishExamineRemarkExpand.length > 0
        ) {
          this.d.w.ZongFinishExamineRemarkExpand.push(r);
        } else {
          this.d.w.ZongFinishExamineRemarkExpand = [];
          this.d.w.ZongFinishExamineRemarkExpand.push(r);
        }
        p.remark = JSON.stringify(this.d.w.ZongFinishExamineRemarkExpand);
      }

      this.apipost(
        "UserWork_SetRemarkt",
        p,
        res => {
          if (res.data.resultCode == 1) {
            //window.location.reload();
            this.$message.success(res.data.message);
            this.showZui1=false;
            this.showZui2=false;
            this.showZui3=false;
            this.showZui4=false;
            this.examineRemarkExpand='';
          } else {
            this.$message.error(res.data.message);
          }
        },
        null
      );
    },
    cancelExamine(type){
      this.apipost(
        "user_post_DeleteWorkExamine",
        {
          id:this.$route.query.id,
          type
        },
        res => {
          if (res.data.resultCode == 1) {
            window.location.reload();
          } else {
            this.$message.error(res.data.message);
          }
        },
        null
      );
    },
    formatDate(fmt) {
      let date = new Date();
      var o = {
        "M+": date.getMonth() + 1, //月份
        "d+": date.getDate(), //日
        "h+": date.getHours(), //小时
        "m+": date.getMinutes(), //分
        "s+": date.getSeconds(), //秒
        "q+": Math.floor((date.getMonth() + 3) / 3), //季度
        S: date.getMilliseconds() //毫秒
      };
      if (/(y+)/.test(fmt)) {
        fmt = fmt.replace(
          RegExp.$1,
          (date.getFullYear() + "").substr(4 - RegExp.$1.length)
        );
      }
      for (var k in o) {
        if (new RegExp("(" + k + ")").test(fmt)) {
          fmt = fmt.replace(
            RegExp.$1,
            RegExp.$1.length == 1
              ? o[k]
              : ("00" + o[k]).substr(("" + o[k]).length)
          );
        }
      }
      return fmt;
    }
  }
};
</script>

<style scope>
.circle {
  width: 20px;
  height: 20px;
  display: inline-block;
  vertical-align: text-top;
  background: grey;
  border-radius: 20px;
  margin-right: 5px;
}
.circle.red {
  background: #fe4433;
}
.circle.green {
  background: green;
}
.circle.black {
  background: black;
}
.work-content {
  margin-bottom: 20px;
}
.work-content h4 {
  font-weight: 400;
  font-size: 16px;
  margin-bottom: 10px;
}
.work-content p {
  font-size: 12px;
  color: #ddd !important;
  margin-bottom: 10px;
}
.work-content .cont {
  font-size: 14px;
  font-family: pingfangR;
}
.work-content.green {
  color: #fff;
  background: #67c23a;
}
.work-content.red {
  color: #fff;
  background: #f56c6c;
}
.work-content.blue{
  background: #409eff;
}
.work-content.red *,
.work-content.green *,
.work-content.blue * {
  color: #fff !important;
}
.work-content * {
  color: #333;
}
.work-content .attach {
  margin-top: 10px;
}
.work-content .attach .work-file {
  color: #409eff;
  text-decoration: underline;
}
.work-content .el-textarea__inner {
  color: #333 !important;
}
</style>