<template>
  <fullscreen :fullscreen.sync="fullscreen" class="container">
    <div class="container-box">
      <toolList @iconCli='iconCli' :tooltit='tooltit'></toolList>
      <div class="search">
        <!-- <mySearch :searchList="searchList" @searchInfo="searchInfo"></mySearch> -->
        <eltabs :tabList="tabList" @status="clickTabs"></eltabs>
        <!-- <el-button class="btn-check" size="medium" type="primary" @click='jumpadd' 
                v-if="(userInfo.cityName==null&&userInfo.countyName==null)||(userInfo.cityName!=null&&userInfo.countyName==null)">添加
                </el-button> -->
        <el-button class="btn-check" size="medium" type="primary" @click='jumpadd' v-if="userInfo.duty <= 9"
          style="width:100px;height:50px">添加
        </el-button>

        <!-- <el-button size="medium" type="primary" @click="operationZuo()">
                     处理 
                </el-button> -->
      </div>
      <div class="tabbox" v-if="this.childname == 'first' || this.childname == 'two'">
        <tableList :list="Table" ref="TableList" @clickDemand="clickDemand" @changeNum="changeNum"
          @changeSize="changeSize"></tableList>
      </div>
      <div class="tabbox" v-if="this.childname == 'three'">
        <el-table :data="tableData" style="width: 100%" ref="refTable" height="400px" max-height="400px">
          <el-table-column type="expand">
            <template slot-scope="props">
              <!-- <el-table v-loading="loading2" :data="props.row.fxfkProcessList" size="mini" style="width: 95%;margin-left: 5%;"> -->
              <el-table :data="props.row.xcwlProProcessList" size="mini" style="width: 95%;margin-left: 5%;"
                @cell-click="getRowList">
                <el-table-column label="序号" type="index" width="50">
                </el-table-column>
                <el-table-column label="业务名称" prop="needName"></el-table-column>
                <el-table-column label="地市" prop="region"></el-table-column>
                <el-table-column label="区县" prop="district"></el-table-column>
                <el-table-column label="渠道/小区/校园名称" prop="channelQuartersSchool"> </el-table-column>
                <el-table-column label="使用场景" prop="useCase"></el-table-column>
                <el-table-column label="物料名称" prop="material"></el-table-column>
                <el-table-column label="物料编码" prop="materialNo"></el-table-column>
                <el-table-column label="规格尺码" prop="spec"></el-table-column>
                <el-table-column label="长（米）" prop="chang"></el-table-column>
                <el-table-column label="宽（米）" prop="kuan"></el-table-column>
                <el-table-column label="横/竖" prop="hengShu"></el-table-column>
                <el-table-column label="系数" prop="coefficient"></el-table-column>
                <!-- <el-table-column label="单价" prop="price"></el-table-column> -->
                <el-table-column label="数量" prop="quantity"></el-table-column>
                <!-- <el-table-column label="结算金额" prop="replyContent"></el-table-column> -->
                <el-table-column label="麦穗" prop="gys1Price"></el-table-column>
                <el-table-column label="神笔" prop="gys2Price"></el-table-column>

                <el-table-column label="江苏邮电" prop="gys3Price"></el-table-column>
                <el-table-column label="湖州绿包" prop="gys4Price"></el-table-column>
                <el-table-column label="状态" prop="taskname"></el-table-column>
                <el-table-column label="操作" fixed="right" align="center">
                  <template slot-scope="scope">
                    <el-button size="mini" type="text" @click="getinform(scope.row)"
                      v-if="scope.row.taskname == null || scope.row.taskname == '起草'">
                      任务下发</el-button>
                    <el-button size="mini" type="text" @click="chakanfaqi(scope.row)"
                      v-if="scope.row.taskname != null && scope.row.taskname != '起草'">
                      查看</el-button>
                  </template>
                  <!-- <template slot-scope="scope">
                                    
                                </template> -->
                </el-table-column>
              </el-table>
            </template>
          </el-table-column>
          <el-table-column label="业务名称" prop="businessName">
          </el-table-column>
          <el-table-column label="下单周期" prop="cycle">
          </el-table-column>
          <el-table-column label="申请人" prop="proposer">
          </el-table-column>
          <el-table-column label="申请人部门" prop="applydept">
          </el-table-column>
          <el-table-column label="申请人类型" prop="applyType">
          </el-table-column>
          <el-table-column label="申请时间" prop="applyTime">
          </el-table-column>
          <el-table-column label="当前进度" prop="progressBar">
            <template slot-scope="props">
              <el-progress :percentage="props.row.progressBar"></el-progress>
            </template>
          </el-table-column>

        </el-table>
        <!-- v-if="adminpageData.total > 0" -->
        <el-pagination style="display: flex; flex-direction: row-reverse" :current-page.sync="adminpageData.pageNum"
          :page-sizes="adminpageData.pageSizes ? adminpageData.pageSizes : [5, 10, 15, 20]
            " :page-size="adminpageData.pageSize" layout="total, sizes, prev, pager, next, jumper"
          :total="adminpageData.total" @size-change="adminhandleSizeChange" @current-change="adminhandleCurrentChange" />
      </div>
    </div>
    <div class="containtbox">
      <el-dialog title="处理操作" :visible.sync="dialogVisible1" v-if="dialogVisible1" :before-close="handleCloses"
        width="100%" height="100vh" class="dialogClass" top="0" :modal="false" :modal-append-to-body="true"
        :destroy-on-close="true">
        <!--  -->
        <!-- <Workflow :list="ruleForm" :requestForm="requestForm" @dialogVisible1 = "Visible1"/> -->
        <Workflow :list="infolist" @updateForm="updateForm" :requestForm="requestForm"
          :request_formTitle="request_form.title" />
        <!-- @dialogVisible1 = "Visible1" -->
        <!-- <WorkflowEntrance
          :list="infolist"
          v-else
          :lastManList="lastManList"
          
         @beforeClose = "updateForm"
          :requestForm="requestForm"
        /> -->
        <span slot="footer" class="dialog-footer">
        </span>
      </el-dialog>
    </div>
    <el-dialog :visible.sync="dialogVisible" :before-close="handleCloses" width="100%" height="500vh" class="dialogClass"
      top="0" :modal="false" :show-close="false" :modal-append-to-body="true">
      <span class="dialog-body">
        <el-form :model="infolist" ref="infolist" :rules="rules" label-width="100px" class="demo-ruleForm">
          <!--dialogVisible1 = true -->
          <el-form-item style="position: fixed; top: 50px; left: -60px; z-index: 1000">
            <!--  v-if="baocun" @click="newFormgong"-->
            <el-button type="primary" @click="dealwith()" v-if="deal">处理</el-button>
            <el-button type="primary" @click="close()">关闭</el-button>
            <el-button type="primary" @click="saveform()" v-if="baocun">保存</el-button>
            <!-- <el-button type="primary" @click="submitForm()" v-if = "baocun">保存</el-button> -->
          </el-form-item>
          <!-- style="height: calc(100% - 160px); overflow: auto" -->
          <div>
            <el-row :gutter="10">
              <el-col :span="8" style="width: 450px; padding-top: 68px">
                <el-form-item prop="businessName" label="业务名称">
                  <el-input v-model="infolist.businessName" placeholder="业务名称" :disabled="disableStatus"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8" style="width: 450px;padding-top: 68px">
                <el-form-item label="下单周期" prop="cycle">
                  <el-date-picker v-model="infolist.cycle" type="daterange" range-separator="-" start-placeholder="开始日期"
                    end-placeholder="结束日期" :disabled="disableStatus" :picker-options="pickerOptions0">
                  </el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="8" style="width: 450px;padding-top: 68px">
                <el-form-item label="需求编号" prop="needCode">
                  <el-input v-model="infolist.needCode" placeholder="需求编号" disabled></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="10">
              <el-col :span="8" style="width: 450px">
                <el-form-item prop="districtScore" label="区县打分">
                  <el-input v-model="infolist.districtScore" placeholder="区县打分"
                    :disabled="this.infolist.tabletaskName != '区县公司负责人'"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8" style="width: 410px">
                <el-form-item prop="gys" label="供应商">
                  <!-- <span>供应商</span>省公司宣传负责人 -->
                  <el-select @change="gysMing(1, $event)" clearable v-model="infolist.gys" placeholder="供应商"
                    :disabled="this.infolist.tabletaskName != '省公司宣传负责人'">
                    <el-option v-for="(items, index) in gysopt" :key="index" :label="items.name" :value="items.name">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="8" style="width: 470px">
                <el-form-item label="物料验证材料链接" prop="materialUrl" label-width="140px">
                  <el-input v-model="infolist.materialUrl" placeholder="物料验证材料链接"
                    :disabled="this.infolist.tabletaskName != '区县公司负责人'"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item class="info-line online">
                  <el-table :data="infomaterType" style="width: 100%" height="240px" border size="mini">
                    <!-- <el-table-column type="selection" width="55" fixed="left" > -->
                    <!-- </el-table-column> -->
                    <el-table-column prop="riqi" label="日期">
                    </el-table-column>
                    <el-table-column prop="formType" label="表单类型">
                    </el-table-column>
                    <el-table-column prop="region" label="地市公司">
                    </el-table-column>
                    <el-table-column prop="district" label="区县名称">
                    </el-table-column>
                    <el-table-column prop="channelCode" label="渠道编码">
                    </el-table-column>
                    <el-table-column prop="channelQuartersSchool" label="渠道/小区/校园名称">
                    </el-table-column>
                    <!-- <el-table-column prop="useCase" label="场景"> -->
                    <el-table-column prop="useCase" label="场景">
                    </el-table-column>
                    <el-table-column prop="channelCode" label="物料编码">
                    </el-table-column>
                    <el-table-column prop="material" label="物料名称">
                    </el-table-column>
                    <el-table-column prop="unit" label="物料单位">
                    </el-table-column>
                    <el-table-column prop="spec" label="规格尺寸">
                    </el-table-column>
                    <el-table-column prop="chang" label="长"> </el-table-column>
                    <el-table-column prop="kuan" label="宽"> </el-table-column>
                    <el-table-column prop="hengShu" label="横竖">
                    </el-table-column>
                    <el-table-column prop="coefficient" label="系数">
                    </el-table-column>
                    <!-- <el-table-column prop="price" label="单价"> </el-table-column> -->
                    <el-table-column prop="quantity" label="数量">
                    </el-table-column>
                    <el-table-column prop="priority" label="优先级">
                    </el-table-column>
                    <el-table-column label="麦穗" prop="gys1Price">
                      <!-- <template slot-scope="scope">
                      <div>
                        {{
                          (scope.row.gys1Price =
                            scope.row.quantity *
                            scope.row.price *
                            scope.row.coefficient)
                        }}
                      </div>
                    </template> -->
                    </el-table-column>
                    <el-table-column label="神笔" prop="gys2Price">
                      <!-- <template slot-scope="scope">
                      <div>
                        {{
                          (scope.row.gys2Price =
                            scope.row.quantity *
                            scope.row.price *
                            scope.row.coefficient)
                        }}
                      </div>
                    </template> -->
                    </el-table-column>
                    <el-table-column label="江苏邮电" prop="gys3Price"></el-table-column>
                    <el-table-column label="湖州绿包" prop="gys4Price"></el-table-column>
                    <el-table-column label="操作" fixed="right" align="center"
                      v-if="this.infolist.tabletaskName == '起草' || this.infolist.tabletaskName == '地市宣传负责人'">
                      <template slot-scope="scope">
                        <el-button size="mini" type="text" @click="updatexiuform(scope.row)" :disabled="xiugaizhuan">
                          修改</el-button>
                      </template>
                    </el-table-column>
                    <!-- <el-table-column label="供应商3金额" prop="gys3Price">
                    <template slot-scope="scope">
                      <div>
                        {{
                          (scope.row.gys3Price =
                            scope.row.quantity *
                            scope.row.price *
                            scope.row.coefficient)
                        }}
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column label="供应商4金额" prop="gys4Price">
                    <template slot-scope="scope">
                      <div>
                        {{
                          (scope.row.gys4Price =
                            scope.row.quantity *
                            scope.row.price *
                            scope.row.coefficient)
                        }}
                      </div>
                    </template>
                  </el-table-column> -->
                  </el-table>
                </el-form-item>
              </el-col>
            </el-row>

            <div style="width: 96%; margin:20px 0 0 38px">
              <div>
                <myUpload @uploadBack="uploadBack" @clickDownload="download" :disabled="updisabled" :fileInfo="fileInfo"
                  :fileList="fileInfo.fileList">
                </myUpload>
              </div>
            </div>
          </div>


        </el-form>
        <div class="table-title">
          <h2>流程追踪</h2>
        </div>
        <div class="flex-header-process">
          <!-- <tableList :list="processTable" ref="el-form" @clickDemand = "clickDemand"></tableList> -->
          <el-table :data="tableData1" :header-cell-style="{ textAlign: 'center' }" :cell-style="{ textAlign: 'center' }"
            style="width: 100%" max-height="350">
            <el-table-column type="index" label="序号" width="50">
            </el-table-column>
            <el-table-column prop="taskName" label="环节名称" width="280" class="is-center">
            </el-table-column>
            <el-table-column prop="assignee" label="处理人" width="280">
            </el-table-column>
            <el-table-column prop="startTime" label="到达时间" width="280">
            </el-table-column>
            <el-table-column prop="endTime" label="处理时间" width="280">
            </el-table-column>
            <el-table-column prop="content" label="回复意见" width="280">
            </el-table-column>

          </el-table>
        </div>
      </span>
    </el-dialog>
    <el-dialog title="下单信息" :visible.sync="typests" width="50%" :destroy-on-close="true" :modal-append-to-body="false"
      :show-close="false" :before-close="closedia">
      <el-form :model="rulelist" ref="rulelist" style="height: 30vh; overflow-y: scroll" v-loading="loadinged">
        <div class="info-lineform">
          <el-form-item prop="useCase" label="使用场景">
            <el-select @change="changeMing(1, $event)" clearable v-model="rulelist.useCase" placeholder="使用场景" disabled>
              <el-option v-for="(items, index) in useCaseopt" :key="index" :label="items.dataName"
                :value="items.dataName">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item prop="formType" label="表单类型">
            <el-select v-model="rulelist.formType" placeholder="请选择表单类型" disabled>
              <el-option v-for="(item, index) in optionList" :label="item.value" :value="item.value"
                :key="index"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item prop="material" label="物料名称">
            <el-select @change="changeSearch(3, $event)" clearable v-model="rulelist.material" placeholder="物料名称"
              disabled>
              <el-option v-for="(items, index) in metirialOpt" :key="index" :label="items.metirialName"
                :value="items.metirialName">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item prop="quantity" label="数量" label-width="68px">
            <el-input v-model="rulelist.quantity" placeholder="数量" type="number"
              oninput="value=value.replace(/^(0+)|[^\d]+/g,'')" style="width:256px">
            </el-input>

          </el-form-item>
          <el-form-item prop="channelQuartersSchool" label="渠道/小区/校园名称" label-width="137px">
            <el-input v-model="rulelist.channelQuartersSchool" placeholder="渠道/小区/校园名称" style="width:256px">
            </el-input>

          </el-form-item>

        </div>
      </el-form>

      <div class="t-footer">
        <!--  -->
        <el-button type="primary" @click="gengxinge">确 定</el-button>
        <!-- <el-button @click="closediaform">取 消</el-button> -->
      </div>
    </el-dialog>
    <el-dialog :title="titname" :visible.sync="applicationDialogStatus" width="30%" :destroy-on-close="true"
      :modal-append-to-body="false" :close-on-click-modal="false" :before-close="closedia">
      <div v-loading="loadinged">
        <el-form :model="approvalinfolist" ref="approvalinfolist">
          <el-form-item class="info-line online" style="margin-left: 10%">
            <el-radio-group v-model="approvalinfolist.opinionradio">
              <el-radio :label="1">同意</el-radio>
              <el-radio :label="2">打回</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item class="info-line online" style="text-align: center">
            <el-input v-model="approvalinfolist.opinion" placeholder="审批意见" type="textarea" :rows="2"></el-input>
          </el-form-item>
        </el-form>

        <div slot="footer" class="dialog-footer myfooter">
          <el-button @click="dialogCli(4)">取 消</el-button>
          <el-button type="primary" @click="dialogCli(5)">确 定</el-button>

        </div>
      </div>
    </el-dialog>
    <myMessage :messTit='messTit' @closeMessage="closeMessage" :centerDialogVisible="centerDialogVisible"
      v-if="centerDialogVisible"></myMessage>
  </fullscreen>
</template>
<script>
import eltabs from "../../../components/el-tabs";
import mySearch from "../../../components/search.vue";
import myMessage from "../../../components/myMessage.vue"
import toolList from '../../../components/toolList'
import myUpload from '../../../components/uploadfour'
import tableList from "../../../components/el-formfour";
import Workflow from "../../../components/workflowBase";
import getConfig from '../../../config/dev.js'
// import Workflow from "../../../components/workflow";
// import WorkflowEntrance from "../../../components/workflowEntrance";
import {
  getTodoBase,
  getDoneBase,

} from "../../../http/api.js";
export default {
  components: {
    mySearch,
    myMessage,
    toolList,
    myUpload,
    eltabs,
    tableList,
    Workflow,

  },
  data() {
    // const regionName = (rule, value, callback) => {
    //     if (!this.infolist.regionName) {
    //         callback(new Error('不能为空'))
    //     } else {
    //         callback()
    //     }
    // }
    // const advTypeDesc = (rule, value, callback) => {
    //     if (!this.infolist.advTypeDesc) {
    //         callback(new Error('不能为空'))
    //     } else {
    //         callback()
    //     }
    // }
    return {
      requestForm: {
        fresourceId: getConfig().materialApplicationfresourceId,
        processDefinitionKey: "xcwl_pro_process",
        taskId: "",
      },
      request_form: {
        userId: "",
        userName: "",
        path: this.$router.currentRoute.name,
        userCode: JSON.parse(window.sessionStorage.userInfo).loginNo,
        title: "",
        businessKey: "",
        processDefinitionKey: "xcwl_pro_process",
      },
      lastManList: [],
      tabList: [
        {
          index: "first",
          label: "我的待办",
          number: "",
          name: "prosss_key",
        },
        {
          index: "two",
          label: "我的已办",
          number: "",

        },
        {
          index: "three",
          label: "我发起的",
          number: "",
        },
      ],
      Table: {},
      adminpageData: {
        total: 15, // 总条数
        pageSizes: 10, // 每页数量
        pageNum: 1, // 页码
      },
      firstTable: {
        name: "first",
        height: "350",
        titledata: [
          {
            label: "业务名称",
            prop: "needName",
            width: 200,
          },
          {
            label: "地市",
            prop: "region",
            width: 200,
          },

          {
            label: "区县",
            prop: "district",
            width: 200,
          },
          {
            label: "渠道/小区/校园名称",
            prop: "channelQuartersSchool",
            width: 200,
          },
          {
            label: "使用场景",
            prop: "useCase",
            width: 200,
          },
          {
            label: "物料名称",
            prop: "material",
            width: 200,
          },
          {
            label: "规格尺寸",
            prop: "spec",
            width: 100,
          },
          {
            label: "长",
            prop: "chang",
            width: 100,
          },
          {
            label: "宽",
            prop: "kuan",
            width: 100,
          },
          {
            label: "横/竖",
            prop: "hengShu",
            width: 100,
          },
          {
            label: "系数",
            prop: "coefficient",
            width: 100,
          },
          // {
          //   label: "单价",
          //   prop: "price",
          //   width: 100,
          // },
          {
            label: "数量",
            prop: "quantity",
            width: 100,
          },
          {
            label: "麦穗",
            prop: "gys1Price",
            width: 100,
          },
          {
            label: "神笔",
            prop: "gys2Price",
            width: 100,
          },
          {
            label: "江苏邮电",
            prop: "gys3Price",
            width: 100,
          },
          {
            label: "湖州绿包",
            prop: "gys4Price",
            width: 100,
          },
          {
            label: "状态",
            prop: "taskname",
            width: 200,
          },
        ], //表格头
        data: [
          {
            label: "文件标题", // 操作名
            handleRow: (e, r, o) => {

              this.operationZuo(r);
            }
          }
        ], //内容数据
        loading: true,
        pageData: {
          total: 100, // 总条数
          pageSize: 10, // 每页数量
          pageNum: 1, // 页码
        },
        isSelection: false, // 表格有多选时设置
        isOperation: false, // 表格有操作列时设置
        isIndex: false, // 列表序号
        operation: {
          // 表格有操作列时设置
          label: "操作", // 列名
          width: "50", // 根据实际情况给宽度

          data: [
            {
              label: "任务下发", // 操作名称
              type: "", //按钮类型
              handleRow: function (e, r, o) {

                // getinform
                // this.getinform(r);
              }, // 自定义事件
            },
          ],
        },
      },
      twoTable: {
        name: "first",
        height: "350",
        titledata: [
          {
            label: "业务名称",
            prop: "needName",
            width: 200,
          },
          {
            label: "地市",
            prop: "region",
            width: 200,
          },

          {
            label: "区县",
            prop: "district",
            width: 200,
          },
          {
            label: "渠道/小区/校园名称",
            prop: "channelQuartersSchool",
            width: 200,
          },
          {
            label: "使用场景",
            prop: "useCase",
            width: 200,
          },
          {
            label: "物料名称",
            prop: "material",
            width: 200,
          },
          {
            label: "规格尺寸",
            prop: "spec",
            width: 100,
          },
          {
            label: "长",
            prop: "chang",
            width: 100,
          },
          {
            label: "宽",
            prop: "kuan",
            width: 100,
          },
          {
            label: "横/竖",
            prop: "hengShu",
            width: 100,
          },
          {
            label: "系数",
            prop: "coefficient",
            width: 100,
          },
          // {
          //   label: "单价",
          //   prop: "price",
          //   width: 100,
          // },
          {
            label: "数量",
            prop: "quantity",
            width: 100,
          },
          {
            label: "麦穗",
            prop: "gys1Price",
            width: 100,
          },
          {
            label: "神笔",
            prop: "gys2Price",
            width: 100,
          },
          {
            label: "江苏邮电",
            prop: "gys3Price",
            width: 100,
          },
          {
            label: "湖州绿包",
            prop: "gys4Price",
            width: 100,
          },
          {
            label: "状态",
            prop: "taskname",
            width: 200,
          },
        ], //表格头
        data: [
          {
            label: "文件标题", // 操作名
            handleRow: (e, r, o) => {

              this.operationZuo(r);
            }
          }
        ], //内容数据
        loading: true,
        pageData: {
          total: 100, // 总条数
          pageSize: 10, // 每页数量
          pageNum: 1, // 页码
        },
        isSelection: false, // 表格有多选时设置
        isOperation: false, // 表格有操作列时设置
        isIndex: false, // 列表序号
        operation: {
          // 表格有操作列时设置
          label: "操作", // 列名
          width: "50", // 根据实际情况给宽度

          data: [
            {
              label: "任务下发", // 操作名称
              type: "", //按钮类型
              handleRow: function (e, r, o) {

                // getinform
                // this.getinform(r);
              }, // 自定义事件
            },
          ],
        },
      },
      gysopt: [


      ],
      useCaseopt: [
        {
          dataCode: "1",
          dataName: "小区"
        },
        {
          dataCode: "2",
          dataName: "校园"
        },
        {
          dataCode: "3",
          dataName: "营业厅-VI改造-自有渠道"
        },
        {
          dataCode: "4",
          dataName: "营业厅-常规物料-自有渠道"
        },
        {
          dataCode: "5",
          dataName: '营业厅-VI改造-合作渠道'
        },
        {
          dataCode: "6",
          dataName: '营业厅-常规物料-合作渠道'
        },
        {
          dataCode: "7",
          dataName: "政企"
        }
      ],
      optionList: [
        {
          id: 1,
          value: "自有渠道",
        },
        {
          id: 2,
          value: "合作渠道",
        },
        {
          id: 3,
          value: "家庭市场",
        },
        {
          id: 4,
          value: "个人市场",
        },
        {
          id: 5,
          value: "政企市场",
        },
      ],
      metirialOpt: [
        {
          materialNo: "6",
          metirialName: '常规物料'
        },
        {
          materialNo: "7",
          metirialName: "政企物料"
        }
      ],
      searchList: [
        {
          type: 'input',
          tit: '业务名称',
          value: '',
          width: '32%',
        },
        {
          type: 'sel',
          tit: '状态',
          value: '',
          width: '32%',
          options: [
            {
              dataCode: "0",
              dataName: "待审批"
            },
            {
              dataCode: "1",
              dataName: "待确认"
            },
            {
              dataCode: "2",
              dataName: "待验收"
            },
            {
              dataCode: "3",
              dataName: "已完成"
            }
          ]
        },
        {
          type: 'date',
          tit: '申请时间',
          value: '',
          width: '32%',
        },
      ],
      rules: {
        cycle: [{ type: "array", required: true, trigger: "blur", message: "下单周期不能为空" }],
        needCode: [{ required: true, trigger: "blur", message: "需求编号不能为空" }],
        businessName: [{ required: true, trigger: "blur", message: "业务名称不能为空" }],
        // districtScore: [{required: true,trigger: "blur",message: "区县打分不能为空"}],
        // gys: [{required: true,trigger: "change",message: "请选择供应商"}],
        // materialUrl: [{required: true,trigger: "blur",message: "物料验证材料链接不能为空"}],

      },
      childname: "first",
      tooltit: '物料申请管理',
      // applyType: "省",
      fullscreen: false,
      total: 0,
      pageSize: 1,
      pageNo: "1",
      page: "1",
      selectLetter: "",
      tableData: [],
      tableData1: [],
      typests: false, //修改弹窗
      dialogStatus: false,
      disableStatus: false,
      dialogVisible1: false,
      treeList: [], //候选人列表
      textarea: "未填写意见",
      destroy: false,
      infomaterType: [],
      infolist: [],
      xiugaizhuan: false,
      deal: true,
      baocun: true,
      rulelist: [],
      teshuhuanjie: [],
      isWorkflowStatus: false,
      titname: '',
      infolist: {},
      searchBox: {},
      userInfo: {},
      params: {},
      centerDialogVisible: false,
      dialogVisible: false,
      messTit: '',
      delid: '',
      loading: false,
      loadinged: false,
      updisabled: false,
      fileInfo: {
        limit: 10,
        url: '/market/waf/uploadByMinio',
        fileList: []
      },
      infoApply: {},
      rovaList: [],
      applicationDialogStatus: false,
      approvalinfolist: {
        opinionradio: 1
      },
      pickerOptions0: {
        disabledDate(time) {
          return time.getTime() < Date.now() - 8.64e7; //如果没有后面的-8.64e7就是不可以选择今天的
        },
      },
      stsArr: ['待审批', '待确认', '待验收', '已完成'],
      provinceCityArr: ['省', "地市", "区县"],
      loginNoStr: "",
      cityWoId: "",
    }
  },
  watch: {
    'infolist.tabletaskName': {
      handler(newVal, oldVal) {

        let rule1 = {
          gys: [
            { required: true, validator: this.validatorFile, trigger: "blur" },
          ],
        }
        let rule2 = {
          districtScore: [
            { required: true, validator: this.validatorDafen, trigger: "blur" },],
          materialUrl: [
            { required: true, validator: this.validatorLianjie, trigger: "blur" },],
        }
        if (newVal === '省公司宣传负责人') {

          this.rules = { ...this.rules, ...rule1 }

        }
        else if (newVal === '区县公司负责人') {

          this.rules = { ...this.rules, ...rule2 }
        }
      },
      deep: true,

    },
    //  'infolist.tabletaskName':{
    // handler(newVal,oldVal){

    //   let rule2 = {
    //    districtScore: [
    //       { required: true, validator: this.validatorDafen , trigger: "blur" },],
    //     materialUrl: [
    //       { required: true, validator: this.validatorLianjie , trigger: "blur" },],
    //   }
    //   if(newVal === '省公司宣传负责人'){
    //     this.rules = { ...this.rules, ...rule }
    //     }
    // },
    // deep:true,

    // },
  },
  methods: {
    clickTabs(name) {

      this.pageNo = "1";
      this.page = "1";
      this.childname = name;
      if (name == "first") {
        this.Table = this.firstTable;
        this.getTodoList();
      } else if (name == "two") {
        this.Table = this.twoTable;
        this.haveDone();
      } else {
        this.Table = {}
        this.getIssueList();
      }
    },
    changeNum(val) {
      this.page = val;
      this.pageNo = val;

      switch (this.childname) {
        case "first":
          this.getTodoList();
          // this.iniTiate();

          break;
        case "two":
          this.haveDone();

          break;
        case "three":

        // this.iniTiate();
        // this.Table = this.thirdTable;
      }
    },
    changeSize(val) {
      this.size = val;
      this.pageSize = val;

      switch (this.childname) {
        case "first":
          this.getTodoList();
          // this.iniTiate();

          break;
        case "two":
          this.haveDone();

          break;
        case "three":

        // this.iniTiate();
        // this.Table = this.thirdTable;
      }
    },
    clickDemand(e, r) {

      if (e === "业务名称") {
        if (this.childname == "first") {


        }
        if (this.childname == "two") {
          this.disableStatus = true;
          this.deal = false;
          this.baocun = false;
          this.xiugaizhuan = true;
          // this.shanchu = false;
          // this.xinzeng = false;
        }
        if (this.childname == "three") {
          // this.shanchu = false;
          // this.xinzeng = false;
          // this.isdisabled = true;
          // if(r.taskName == "起草"){

          this.deal = false;
          this.baocun = false;
          // }else{
          //   this.deal = false;
          //   this.baocun = false;
          // }
        }


        this.operationZuo(r); //点标题
        this.clickForm(r);  //流程追踪

      }
    },
    chakanfaqi(r) {

      this.operationZuo(r); //点标题

      if (r.taskname == "起草" || r.taskname == "地市宣传负责人") {
        this.deal = true;
      } else {
        this.deal = false;
      }
      this.baocun = false;
      this.clickForm1(r)
    },
    // operationZuo(){
    //    this.dialogVisible = true;
    // },
    //点击标题
    operationZuo(r) {

      let list = {}
      list.id = r.id,

        this.$http({
          url: "/market/xcwlProcess/query",
          method: "post",
          headers: {
            "Content-Type": "application/json",
          },
          data: list,
        }).then((res) => {

          this.dialogVisible = true;
          this.infolist = res.data;
          this.infolist.businessName = res.data.xcwlProProcessList[0].needName;
          this.infomaterType.riqi = res.data.riqi;
          this.infomaterType.region = res.data.region;
          this.infomaterType = res.data.xcwlProProcessList;
          this.fileInfo.fileList = res.data.mkFileShareAttachList;
          this.infolist.cycle = res.data.cycleList;
          this.infolist.resourceId = r.resourceId;
          this.infolist.taskId = r.taskId;
          this.infolist.id = r.id;
          this.infolist.createId = r.createId;
          this.infolist.tabletaskName = r.taskname;

          this.infolist.gys = res.data.xcwlProProcessList[0].selectedGys;
          this.infolist.districtScore = res.data.xcwlProProcessList[0].districtScore;
          this.infolist.materialUrl = res.data.xcwlProProcessList[0].materialUrl;
          this.infolist.id1 = res.data.xcwlProProcessList[0].xcwlId;
          if (r.taskName != "起草" || r.taskName != "地市宣传负责人") {
            this.disableStatus = true;
            this.updisabled = true;  //上传附件
          } else {
            this.updisabled = false;
          }
          if (this.infolist.tabletaskName === "起草" || this.infolist.tabletaskName === "省公司宣传负责人" || this.infolist.tabletaskName === "区县公司负责人" || this.infolist.tabletaskName === "地市宣传负责人") {

            this.baocun = true;

          } else {
            this.baocun = false;
          }
          this.$http({
            url: "/market/cadvSupplier/queryList",
            method: "post",
            headers: {
              "Content-Type": "application/json",
            },
            data: {},
          }).then((res) => {

            this.gysopt = res.data;

            // this.infomaterType = res.data;
            // if(res.data){
            //  this.typests = false;
            //   return;
            // }
          });
        });
    },
    uploadBack(v) {
      this.attList = v;
      // console.log(this.attList);

    },
    gysMing(n, ev) {
      let that = this;

      let hh = that.gysopt.filter(function (c, i, a) {

        if (c.name == that.infolist.gys) {
          return c;
        }
      });
      this.selectLetter = hh[0].code;
      //  console.log(this.selectLetter);
    },
    dealwith() {
      console.log(this.infolist);
      if (this.infolist.tabletaskName == "省公司宣传负责人" || this.infolist.tabletaskName == "区县公司负责人") {

        if (this.teshuhuanjie.length == 0) {
          this.$message.error("请先点击保存");
        } else {
          this.dialogVisible1 = true;
          this.request_form.title = '[市场经营管理平台]-' + '省宣传物料申请及审批-' + this.infolist.businessName;
        }
      } else {
        this.dialogVisible1 = true;
        this.request_form.title = '[市场经营管理平台]-' + '省宣传物料申请及审批-' + this.infolist.businessName;
      }

    },
    updatexiuform(r) {

      this.typests = true;
      this.rulelist = r;
    },
    closediaform() {
      this.typests = false;
    },
    //更新表格
    gengxinge() {
      this.typests = false;
      let rulelistform = {}
      rulelistform.metirialName = this.rulelist.material;
      rulelistform.quantity = this.rulelist.quantity;
      rulelistform.ratio = this.rulelist.coefficient;
      this.$http({
        url: "/market/xcwlProcessImport/getPriByMetirialName",
        method: "post",
        headers: {
          "Content-Type": "application/json",
        },

        data: rulelistform,
      }).then((res) => {


        this.infomaterType[0].gys1Price = res.data.body.gys1Price;
        this.infomaterType[0].gys2Price = res.data.body.gys2Price;
        this.infomaterType[0].gys3Price = res.data.body.gys3Price;
        this.infomaterType[0].gys4Price = res.data.body.gys4Price;


      });
    },
    validatorFile(rule, value, callback) {
      if (this.infolist.gys == null) {

        callback(new Error('请选择供应商'));
      } else {

        callback();
      }
    },
    validatorDafen(rule, value, callback) {
      if (this.infolist.districtScore == null || "") {

        callback(new Error('请输入区县打分'));
      } else {

        callback();
      }
    },
    validatorLianjie(rule, value, callback) {
      if (this.infolist.materialUrl == null || "") {

        callback(new Error('请输入物料验证材料链接'));
      } else {

        callback();
      }
    },
    //任务下发
    getinform(r) {
      console.log(r);
      this.infolist = r;
      this.infolist.id = r.id;
      this.request_form.businessKey = r.id;
      this.request_form.title = '[市场经营管理平台]-' + '省宣传物料申请及审批-' + r.needName;
      this.getUserIds();

    },

    getUserIds() {
      let id = JSON.parse(window.sessionStorage.userInfo).loginNo
      this.$http({
        url: "/market//api/user/info/queryNodePers?params=" + id,
        method: "post",
        headers: {
          "Content-Type": "application/json",
        },
        data: {
          // params: JSON.parse(window.sessionStorage.userInfo).loginNo,
        },
      }).then((res) => {

        this.request_form.userName = res.data[0].children[0].loginNameStr;
        this.request_form.userId = res.data[0].children[0].loginNoStr;


        this.clickHandle(this.infolist);
      });
    },
    async clickHandle(e) {

      let _this = this;
      let obj = {
        url: this.$url.formList.startWork, //开始工作流接口
        data: _this.request_form,
        status: "form",
        headers: {
          "Content-Type": "application/x-www-form-urlencoded",
        },
      };

      let res = await this.common.httpPost(obj, success);
      function success(data) {

        _this.infolist.processId = data.data;
        let list = {
          id: e.id,
          // taskId:_this.formId,
          processId: data.data,
          tableName: _this.requestForm.processDefinitionKey,

          // resourceId: _this.nextPath.currentShape[0].resourceId,
        };

        _this.setUpdate(list);
      }
    },
    //更新工作流接口

    setUpdate(e) {

      this.$http({
        url: "/market/waf/updateBase",
        method: "post",
        headers: {
          "Content-Type": "application/json",
        },
        data: e,
      }).then((res) => {
        this.infolist.taskId = res.data.body[0].taskId;
        this.clickHandles();
      });
    },
    //是否最后一个人
    async getLastName() {

      let list = {
        procinstid: this.infolist.processId,
        taskid: this.infolist.taskId,

        // taskId:e.taskId
      };
      let _this = this;
      let obj = {
        url: this.$url.formList.getLastName, //流程追踪接口
        data: list,
        // status: "form",
        headers: {
          "Content-Type": "application/json",
        },
      };

      let res = await this.common.httpPost(obj, success);
      function success(data) {

        if (data.lastMan == true) {
          _this.adminResourceId = data.adminResourceId;
        }
        _this.destroy = true;
        _this.dialogVisible1 = true;
        _this.isWorkflowStatus = data.lastMan == false ? false : true;
        _this.lastManList = data;


      }
    },
    getNextPath(e) {
      let list = {
        // fresourceId: "bf79721c-33f3-11ed-ba0b-00505687dcd3", //测试环境
        fresourceId: this.requestForm.fresourceId, // 本地环境
        processId: this.requestForm.processDefinitionKey,
        // processId: this.infolist.processId,
        // fresourceId: "0d94de8a-0281-11ed-a302-4ae7da54db39", // 本地环境
        // processId: "request_form_process",
        // resourceId: e,
      };
      if (e) {
        // this.propsList = [];
        list.resourceId = e;
      }
      this.$http({
        url: "/market/waf/queryPath",
        method: "post",
        headers: {
          "Content-Type": "application/json",
        },
        data: list,
      }).then((res) => {
        if (res.data.body.nextShapes[0].multi) {
          // console.log('这是mulit节点');
          if (res.data.body.nextShapes[0].multi.multi === "true") {
            //  console.log('这是mulit节点');
            this.getLastName();
          } else {
            this.adminResourceId = ''
            // console.log('这不是mulit节点');
            this.destroy = true;
            this.dialogVisible1 = true;
            // this.getMetirialType();
          }
        } else {
          this.adminResourceId = ''
          // console.log('这不是mulit节点');
          this.destroy = true;
          this.dialogVisible1 = true;
          //   this.getMetirialType();
        }
        // if (this.infolist.processId) {
        // } else {
        //   this.$message.error("请先点击保存按钮");
        // }
      });
    },
    //处理按钮,开始工作流接口
    clickHandles() {

      this.dialogVisible1 = true;
    },
    async clickForm(r) {
      let list = {
        processInstanceId: r.processId,
        // taskId:e.taskId
      };
      let _this = this;
      let obj = {
        url: this.$url.formList.getCommentsByProcessId, //流程追踪接口
        data: list,
        headers: {
          "Content-Type": "application/json",
        },
      };

      let res = await this.common.httpPost(obj, success);
      function success(data) {
        _this.tableData1 = data.data.data;
        data.data.data.map((item) => {
          item.startTime = _this.$util.datetimeFormat(item.startTime);
          item.endTime = _this.$util.datetimeFormat(item.endTime);
        });
        // _this.getProcess(e, data.data);
        _this.tableData1 = data.data.data;
      }
    },
    async clickForm1(r) {
      let list = {
        processInstanceId: r.processId,
        // taskId:e.taskId
      };
      let _this = this;
      let obj = {
        url: this.$url.formList.getCommentsByProcessId, //流程追踪接口
        data: list,
        headers: {
          "Content-Type": "application/json",
        },
      };

      let res = await this.common.httpPost(obj, success);
      function success(data) {
        _this.tableData1 = data.data.data;
        data.data.data.map((item) => {
          item.startTime = _this.$util.datetimeFormat(item.startTime);
          item.endTime = _this.$util.datetimeFormat(item.endTime);
        });
        // _this.getProcess(e, data.data);
        _this.tableData1 = data.data.data;
      }
    },
    updateForm() {
      this.dialogVisible1 = false;
      this.dialogVisible = false;
      this.getIssueList();
      this.getTodoList();
      this.haveDone();
      //   this.refreshbtn();
    },

    adminhandleSizeChange(val) {
      // console.log(`每页 ${val} 条`);
    },
    adminhandleCurrentChange(val) {

      this.pageNo = val;

      this.getIssueList()
      // console.log(`当前页: ${val}`);
    },
    handleCloses() {
      this.treeList = [];
      this.textarea = "";
      this.dialogVisible1 = false;
      this.getTodoList();
      this.haveDone();
      this.getIssueList();
    },
    close() {
      this.dialogVisible = false;
      this.tableData1 = [];
    },
    //我发起列表
    getIssueList(e) {
      let list = {

        applyType: "省"
      };
      this.loading2 = true;
      this.$http({
        url: "/market/xcwlProcessImport/queryPage",
        method: "post",
        headers: {
          "Content-Type": "application/json",
          page: '{"pageNo":"' + this.pageNo + '","pageSize":"10"}',
        },
        data: list,
      }).then((res) => {
        this.tableData = res.data.data;
        this.tabList[2].number = res.data.totalRecord;
        this.adminpageData.total = res.data.totalRecord;
        this.loading2 = false;
      });
    },
    //待办列表
    getTodoList(e, status) {
      // this.loading2 = true;
      let list = {
        tableName: this.requestForm.processDefinitionKey,
        applyType: "省"
      };
      if (e) {
        list.taskId = e.taskId
      }
      this.$http({
        url: "/market/xcwlProcess/queryTodoBase",
        method: "post",
        headers: {
          "Content-Type": "application/json",
          page: '{"pageNo":"' + this.pageNo + '","pageSize":"10"}',
        },
        data: list,
      }).then((res) => {
        if (status === 0) {
          this.clickDemand("业务名称", res.data.data[0]);
        }
        this.firstTable.data = res.data.data;
        this.firstTable.pageData.total = res.data.totalRecord;
        this.tabList[0].number = res.data.totalRecord;
        this.Table = this.firstTable;
        // this.adminpageData.total = res.data.totalRecord;
        // this.loading2 = false;
      });
    },
    //   getTodoList(){
    //   let list = {
    //     tableName: this.requestForm.processDefinitionKey,
    //   };
    //   // getInitiateBase   getTodoBase
    //   getTodoBase(this.page,"",list).then((res)=>{
    //     this.firstTable.data = res.data.data;
    //     this.firstTable.pageData.total = res.data.totalRecord;
    //     // this.Table = this.firstTable;
    //     // this.tabList[0].number = res.data.totalRecord;
    //   })

    // },
    //已办
    haveDone() {
      //  let list = {
      //   tableName : this.requestForm.processDefinitionKey
      //  }
      //  getDoneBase(this.page,"",list).then((res)=>{
      //  this.twoTable.data = res.data.data;
      //  this.twoTable.pageData.total = res.data.totalRecord;
      //   this.tabList[1].number = res.data.totalRecord;
      //   this.Table = this.twoTable;

      // //  this.tabList[1].number = res.data.totalRecord;
      // })
      let list = {
        tableName: this.requestForm.processDefinitionKey,
        applyType: "省"
      };
      this.$http({
        url: "/market/xcwlProcess/queryDoneBase",
        method: "post",
        headers: {
          "Content-Type": "application/json",
          page: '{"pageNo":"' + this.pageNo + '","pageSize":"10"}',
        },
        data: list,
      }).then((res) => {
        this.twoTable.data = res.data.data;
        this.twoTable.pageData.total = res.data.totalRecord;
        this.tabList[1].number = res.data.totalRecord;
        // this.Table = this.twoTable;

      });
    },
    saveform() {

      this.$refs.infolist.validate((valid) => {

        if (valid) {
          this.$message.success("保存成功");
          let list = {}
          list.id = this.infolist.id1;
          list.businessName = this.infolist.businessName;//业务名称
          list.cycleList = [this.$util.datetimeFormat(this.infolist.cycle[0]), this.$util.datetimeFormat(this.infolist.cycle[1])];
          list.needCode = this.infolist.needCode;
          list.districtScore = this.infolist.districtScore;
          list.gys = this.infolist.gys;
          list.materialUrl = this.infolist.materialUrl;
          list.xcwlProProcessList = this.infomaterType;
          list.gysCode = this.infolist.tabletaskName == '省公司宣传负责人' ? this.selectLetter : null;
          // list.xcwlProProcessList = this.multipleSelection;

          if (this.attList == null) {
            list.mkFileShareAttachList = this.fileInfo.fileList
          } else {
            list.mkFileShareAttachList = this.attList;
          }
          this.request_form.title = '[市场经营管理平台]-' + '省宣传物料申请及审批-' + this.infolist.needName;
          this.$http({
            url: "/market/xcwlProcessImport/update",
            method: "post",
            headers: {
              "Content-Type": "application/json",
            },

            data: list,
          }).then((res) => {

            this.teshuhuanjie = res.data;

            // this.infomaterType = res.data;
            // if(res.data){
            //  this.typests = false;
            //   return;
            // }
          });
        } else {
          this.$message.error("请完善表单信息");
        }

      });


    },
    download(u) {

      // if (this.ruleForm.wfFileShareAttachList.length > 1) {
      this.$http({
        url: "/market/waf/downAllFileByMinio",
        method: "post",
        headers: {
          "Content-Type": "application/json",
        },
        responseType: "blob",
        data: { wfFileShareAttachList: this.fileInfo.fileList },
      }).then((response) => {
        if (window.navigator && window.navigator.msSaveOrOpenBlob) {
          let blob = new Blob([response.data], {
            type: "application/vnd.ms-excel",
          });
          window.navigator.msSaveOrOpenBlob(
            blob,
            new Date().getTime().toString() + ".zip"
          );
        } else {
          /* 火狐谷歌的文件下载方式 */
          var blob = new Blob([response.data]);
          var downloadElement = document.createElement("a");
          var href = window.URL.createObjectURL(blob);
          downloadElement.href = href;
          // downloadElement.download = this.ruleForm.fileName + ".zip";
          downloadElement.download = "附件.zip";
          document.body.appendChild(downloadElement);
          downloadElement.click();
          document.body.removeChild(downloadElement);
          window.URL.revokeObjectURL(href);
        }
        if (this.infolist.authType === "3") {
          this.dialogCli(10);
        }
      });

    },
    jumpadd() {
      this.$router.push({
        path: '/materialApplicationadd',
        query: { applyType: '省' },

      });
      this.setabList('物料宣传申请', '/materialApplicationadd');
    },
    jump(v, n) {
      if (v === 1) {
        // this.$router.push("/materialApplicationExa?id=" + n.id + "");
        this.$router.push({
          path: '/materialApplicationExa',
          query: { cityWoId: n.cityWoId, id: n.id, btnS: 1 }
        })

      } else if (v === 2) {
        this.$router.push("/materialApplicationDetail?id=" + n.id + "")
      } else if (v === 3) {
        let jumpParams = { cityWoId: n.cityWoId, countyWoId: n.countryWoId, woId: n.id, pcId: n.provinceCity };

        sessionStorage.setItem("jumpParams", JSON.stringify(jumpParams))
        if (n.provinceCity == 1 && n.nextStep == 7) {

          this.$router.push({
            path: '/subtaskList',
            // query: { cityWoId: n.cityWoId, countyWoId: n.countryWoId, woId: n.id, }
            // path: '/subtaskList/:name',
            // name: 'subtaskList',
            // params: { cityWoId: n.cityWoId, countyWoId: n.countryWoId, woId: n.id, }
          })

        } else if ((n.provinceCity == 1 && n.nextStep == 11) || (n.provinceCity == 2 && n.nextStep == 9) || (n.provinceCity == 3 && n.nextStep == 10)) {
          this.$router.push({
            path: '/acceptanceSituation',
            // query: { cityWoId: n.cityWoId, countyWoId: n.countryWoId, woId: n.id, pcId: n.provinceCity}

            // path: '/acceptanceSituation/:name',
            // name: 'acceptanceSituation',
            // params: { cityWoId: n.cityWoId, countyWoId: n.countryWoId, woId: n.id, pcId: n.provinceCity}
          })
        }
      } else if (v === 4) {
        // this.$router.push("/acceptance?cityWoId="+ n.cityWoId + "&countyWoId=" + n.countryWoId)
        this.$router.push({
          path: '/acceptance',
          query: { cityWoId: n.cityWoId, countyWoId: n.countryWoId, woId: n.id }
        })
      }
    },
    setabList(n, p) {
      let params = {
        children: "",
        name: n,
        rountPath: p,
        target: "_self",
      };
      for (let i = 0; i < this.$store.state.tabList.length; i++) {
        if (this.$store.state.tabList[i].name === params.name) {
          this.$store.state.tabList[i] = params;
        }
      }
      let set = new Set([...this.$store.state.tabList, params]);
      set.add(params);
      this.$store.commit("setDefaultActive", params.rountPath);
      this.$store.commit("setTabList", Array.from(set));
    },
    closedia() {
      this.infolist = {};
      this.dialogStatus = false;
      this.approvalinfolist = {};
      this.applicationDialogStatus = false;
    },
    //搜索数据
    searchInfo(v) {
      this.params = {};
      v[0] ? this.params.bizName = v[0] : '';
      v[1] ? this.params.sts = v[1] : '';
      let timeFrom = '';
      let timeTo = '';
      if (v[2]) {
        timeFrom = this.$formatDate(v[2], "YYYY-MM-DD") + ' 00:00:00'
        timeTo = this.$formatDate(v[2], "YYYY-MM-DD") + ' 23:59:59'
      }
      timeFrom ? this.params.opTimeFrom = timeFrom : '';
      timeTo ? this.params.opTimeTo = timeTo : '';
      this.getList(this.params, this.pageSize);
    },
    //获取列表
    getList(v, n) {

      this.pageSize = n;
      let _this = this;
      // this.loading = true;
      this.tableData = [];
      this.$http({
        url: "/market/cadvBusiMetirialWo/queryPage",
        method: "post",
        headers: {
          "Content-Type": "application/json",
          "page": '{"pageNo":"' + n + '","pageSize":"10"}'
        },
        data: v,
      }).then((res) => {
        this.tableData = res.data.body.pageList.data;
        this.total = res.data.body.pageList.totalRecord;

        this.loading = false;

      });
    },
    // 分页
    currchange(v) {
      this.pageSize = v;
      this.getList(this.params, this.pageSize);
    },
    //申请
    dialogCheck(v, n) {
      this.dialogStatus = true;
      // 审批同意对话框
      this.applicationDialogStatus = true;
      this.infolist = Object.assign({}, n);
      if (v === 1) {
        this.titname = '查看';
        this.disableStatus = true;
      } else if (v === 2) {
        this.titname = '审批';
        this.disableStatus = false;
      }
      this.$http({
        url: '/bpm/api/taskInit',
        method: "post",
        headers: {
          "Content-Type": "application/json",
        },
        data: {
          woNo: n.woNo
        },
      }).then((res) => {

        this.infolist = Object.assign({}, res.data);
        this.infoApply = JSON.parse(this.infolist.params.wo);

        this.rovaList = res.data.taskList;
      });
    },


    //添加
    dialogCli(v) {
      if (v === 1) {
        this.infolist = {};
        this.dialogStatus = false;
        return
      } else if (v === 5) {
        if (this.approvalinfolist.opinionradio == 1) {
          this.infolist.opTime = this.$formatDate(new Date(), "YYYY-MM-DD");
          this.infolist.dealType = '2';
          this.infolist.dealTypeDesc = this.approvalinfolist.opinion;
          this.applicationDialogStatus = false;

          this.submitInfo("/bpm/api/submitTask", this.infolist);
        }
      }
      else {
        this.infolist.opTime = this.$formatDate(new Date(), "YYYY-MM-DD");
        if (this.titname === '添加') {
          this.submitInfo("/bpm/api/addBpmPrePlugin");
        } else if (this.titname === '审批') {
          this.submitInfo("/bpm/api/updateBpmPrePlugin", v);
        }
      }
    },
    submitInfo(u) {
      let _this = this;
      //this.$refs.infolist.validate(valid => {
      //if (valid) {
      this.loadinged = true;
      this.$http({
        url: u,
        method: "post",
        headers: {
          "Content-Type": "application/json",
        },
        data: this.infolist,
      }).then((res) => {
        this.loadinged = false;
        if (res.data.result === 1) {
          _this.$message({
            message: res.data.desc,
            type: 'error'
          });
        } else {
          _this.$message({
            message: '成功',
            type: 'success'
          });
          _this.infolist = {};
          _this.dialogStatus = false;
          _this.getList({}, _this.pageSize);
        }

      });
      //}
      //})
    },
    closeMessage(v) {
      this.centerDialogVisible = false;
      let _this = this;
      if (v === 1) {
        _this.$http({
          url: "/market/cadvBusiMetirialWo/del",
          method: "post",
          headers: {
            "Content-Type": "application/json",
          },
          data: {
            woId: this.delid
          },
        }).then((res) => {
          if (res.data.result === 1) {
            _this.$message({
              message: res.data.desc,
              type: 'error'
            });
          } else {
            _this.$message({
              message: '删除成功',
              type: 'success'
            });
            _this.getList(this.params, this.pageSize);
          }
        });
      }
    },
    //删除
    delLine(v) {
      this.centerDialogVisible = true;
      this.messTit = '即将删除此条数据, 是否删除?';
      this.delid = v.id;
    },
    //文件返回值
    uploadBack(v) {

      this.attList = v;
    },
    //功能栏
    iconCli(v) {
      if (v === 1) {
        this.getList(this.params, this.pageSize);
      }
      if (v === 2) {
        this.fullscreen = !this.fullscreen
      }
    },
    getUser() {
      this.userInfo = JSON.parse(window.sessionStorage.userInfo);
      this.loginNoStr = this.userInfo.loginNoStr;

    }
  },
  mounted() {
  },
  created() {
    let status = JSON.stringify(this.$route.query) == "{}";
    if (status) {
      this.Table = this.firstTable;
      this.haveDone();
      this.getIssueList();
      this.getUser();
      this.getTodoList();
    } else {
      let { id, type } = this.$route.query;
      let list = {
        taskId: id,
        tableName: this.tableName
      };
      this.Table = this.firstTable;
      this.haveDone();
      this.getIssueList();
      this.getUser();
      this.getTodoList(list, 0);//代办
    }
  }
}
</script>
<style scoped lang="scss">
.t-footer {
  text-align: center;
  padding: 20px;
  margin: 20px 0 20px 0;

}

.info-lineform {
  width: 100%;
  display: block;
  // padding-left: 20px;

  div {
    width: 50%;
    display: inline-block;
  }

  span {
    width: 80px;
    display: inline-block;
    text-align: left;

    i {
      color: red;
      display: inline-block;
      padding-right: 5px;
    }
  }

  .el-select,
  .el-input {
    width: calc(100% - 100px);
  }

  .el-checkbox-group {
    border: 1px solid #ddd;
    padding-left: 20px;
    height: 40px;
    width: calc(100% - 100px);
    border-radius: 5px;
  }
}

.table-title {
  width: 100%;
  height: 50px;
  margin-top: 100px;
  line-height: 50px;
  background-color: rgb(243, 250, 255);
  // font-size: 18px;
  font-weight: 700;
}

// ::v-deep.online .el-form-item__content {
//   width: 98%;
//   margin-left: 0 !important;
// }
::v-deep .el-tabs__nav {
  margin: 12px 0 0 12px;
}

::v-deep .el-tabs__nav-wrap::after {
  display: none;
}

::v-deep .el-tabs__active-bar {
  display: none;
}

::v-deep .el-tabs .is-active {
  color: #fff;
  background-color: #0583cd;
}

::v-deep .el-tabs__item {
  padding: 0;
  margin-right: 20px;
  width: 166px;
  text-align: center;
  background-color: #d8eaf6;
  color: #000;
  height: 40px;
  box-sizing: border-box;
  line-height: 40px;
  display: inline-block;
  list-style: none;
  font-size: 14px;
  font-weight: 500;
  color: #303133;
  position: relative;
}

.onetab {
  margin-bottom: 20px;
  padding: 0 20px;
}

.titbox {
  div {
    float: right;

    i {
      font-size: 22px;
      margin-left: 20px;
      cursor: pointer;
    }
  }
}

.tabbox {
  margin-top: 15px;
}

.pageBox {
  text-align: right;
  margin-top: 10px;
}

.info-line {
  width: 100%;
  display: block;
  // padding-left: 20px;
  margin: 20px 0 0 -35px;

  div {
    width: 50%;
    display: inline-block;
  }

  span {
    width: 80px;
    display: inline-block;
    text-align: left;

    i {
      color: red;
      display: inline-block;
      padding-right: 5px;
    }
  }

  .el-select,
  .el-input {
    width: calc(100% - 100px);
  }
}

.online {
  width: 100%;

  .el-select {
    width: calc(100% - 100px);
  }

  span {
    vertical-align: top;
  }

  .el-textarea {
    width: calc(100% - 100px);
  }
}

.adv-type {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  // border: 1px solid #ddd;
  border-radius: 5px;
  padding: 20px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);

  div {
    width: 33%;
    text-align: center;
    height: 80px;
    overflow: hidden;
    min-width: 100px;
    cursor: pointer;
    padding-top: 10px;
    margin: 10px 0;
  }

  div:hover {
    background: #CFE8FC;
    border-radius: 5px;
  }

  span {
    width: 100%;
    display: inline-block;
    height: 40px;

    // line-height: 40px;
    i {
      color: #0074D9;
      font-size: 36px;
    }
  }
}

.boximgc {
  display: flex;
  flex-wrap: wrap;
  width: 100% !important;
  margin-top: 20px;

  div {
    display: inline-block;
    width: 18% !important;
    margin-right: 2%;
    margin-bottom: 20px;
    overflow: hidden;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #fff;
    position: relative;
    height: 100px;

    img {
      width: 100%;
      position: absolute;
      top: 0;
      bottom: 0;
      margin: auto;
      // height: 100%;
    }

  }
}
</style>
