<!-- 公众号表单 -->
<template>
  <div class="L-assets-info">
    <div class="assets-info-top">
      <el-row style="margin: 10px 0">
        <span class="top-title-box">基本信息</span>
      </el-row>
      <div class="assets-info-box">
        <el-form
          :model="ruleForm"
          :rules="rules"
          ref="ruleForm"
          label-width="170px"
          class="demo-ruleForm"
          label-position="right"
          :disabled="disabled"
        >
          <el-row>
            <el-col :span="12">
              <el-form-item label="所属单位" prop="ssdw">
                <!-- <el-input v-model="ruleForm.ssdw" placeholder="请输入单位名称"></el-input> -->
                <el-autocomplete
                  v-model="ruleForm.ssdw"
                  :fetch-suggestions="querySearchAsync"
                  placeholder="请输入所属单位"
                  disabled
                ></el-autocomplete>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="平台类型" prop="ptlx" required>
                <el-select
                  v-model="ruleForm.ptlx"
                  placeholder="请选择平台类型"
                  disabled
                >
                  <el-option
                    v-for="dict in dict.type.sys_ptlx_type"
                    :key="dict.value"
                    :label="dict.label"
                    :value="dict.value"
                  />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <div v-if="ruleForm.ptlx == 1">
            <el-row>
              <el-col :span="12">
                <el-form-item label="微信号" prop="wxh">
                  <el-input
                    v-model="ruleForm.wxh"
                    style="width: 100%"
                    placeholder="请输入微信号"
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="公众号名称" prop="gzhmc">
                  <el-input
                    v-model="ruleForm.gzhmc"
                    placeholder="请输入公众号名称"
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item
                  prop="tyshxydm"
                  class="daoqitixingren"
                  label="统一社会信用代码"
                  required
                  :rules="[
                    {
                      required: true,

                      pattern: /^[a-zA-Z0-9]{18}$/,
                      message: '请输入正确格式的18位统一社会信用代码',
                      trigger: 'change',
                    },
                  ]"
                >
                  <el-input
                    v-model="ruleForm.tyshxydm"
                    placeholder="请输入统一信用代码"
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="公众号状态" prop="gzhzt">
                  <el-select
                    v-model="ruleForm.gzhzt"
                    placeholder="请选择公众号状态"
                  >
                    <el-option
                      v-for="dict in dict.type.gzh_state"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="公众号ID" prop="gzhId">
                  <el-input
                    v-model="ruleForm.gzhId"
                    style="width: 100%"
                    placeholder="请输入公众号ID"
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="公众号类型" prop="gzhlx">
                  <el-select
                    v-model="ruleForm.gzhlx"
                    placeholder="请选择公众号类型"
                  >
                    <el-option
                      v-for="dict in dict.type.gzh_lx"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="认证状态" prop="rzState">
                  <el-select
                    v-model="ruleForm.rzState"
                    placeholder="请选择认证状态"
                  >
                    <el-option
                      v-for="dict in dict.type.gzh_rzzt"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="认证时间" prop="rzsj">
                  <el-date-picker
                    v-model="ruleForm.rzsj"
                    type="date"
                    format="yyyy-MM-dd"
                    value-format="yyyy-MM-dd"
                    placeholder="选择日期"
                  >
                  </el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="认证类型" prop="rzlx">
                  <el-select
                    v-model="ruleForm.rzlx"
                    placeholder="请选择认证类型"
                  >
                    <el-option
                      v-for="dict in dict.type.gzh_rzlx"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="所属行业" prop="sshy">
                  <el-select
                    v-model="ruleForm.sshy"
                    placeholder="请选择所属行业"
                  >
                    <el-option
                      v-for="dict in dict.type.app_sshy"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="重点行业" prop="zdhy">
                  <el-select
                    v-model="ruleForm.zdhy"
                    placeholder="请选择重点行业"
                  >
                    <el-option
                      v-for="dict in dict.type.app_zdhy"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="行政区划" prop="xzqh">
                  <el-select
                    v-model="ruleForm.xzqh"
                    placeholder="请选择行政区划"
                  >
                    <el-option
                      v-for="dict in dict.type.app_xzqh"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="系统责任人" prop="xtzrr">
                  <el-input
                    v-model="ruleForm.xtzrr"
                    style="width: 100%"
                    placeholder="请输入系统责任人"
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item
                  prop="xtzrrdh"
                  label="系统责任人电话"
                  required
                  :rules="[
                    {
                      required: true,

                      pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
                      message: '请输入正确的手机号码',
                      trigger: 'change',
                    },
                  ]"
                >
                  <el-input
                    v-model="ruleForm.xtzrrdh"
                    style="width: 100%"
                    placeholder="请输入系统责任人电话"
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item
                  prop="xtzrryx"
                  label="系统责任人邮箱"
                  required
                  :rules="[
                    {
                      required: true,

                      type: 'email',
                      message: '请输入正确的邮箱地址',
                      trigger: ['change', 'change'],
                    },
                  ]"
                >
                  <el-input
                    v-model="ruleForm.xtzrryx"
                    style="width: 100%"
                    placeholder="请输入系统责任人邮箱"
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="系统责任人地址" prop="xtzrrdz">
                  <el-input
                    v-model="ruleForm.xtzrrdz"
                    style="width: 100%"
                    placeholder="请输入系统责任人地址"
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>

            <el-row>
              <el-col :span="12">
                <el-form-item label="认证主体" prop="rzzt">
                  <el-input
                    v-model="ruleForm.rzzt"
                    style="width: 100%"
                    placeholder="请输入认证主体"
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="系统简介" prop="xtjj">
                  <el-input
                    type="textarea"
                    resize="none"
                    placeholder="请输入系统简介"
                    :rows="5"
                    v-model="ruleForm.xtjj"
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <div>
              <el-row>
                <span class="top-title-box">菜单信息</span>
              </el-row>
              <el-row v-for="(domain, index) in ruleForm.cdList">
                <el-col :span="12">
                  <el-form-item
                    :label="'菜单名称' + (index == 0 ? '' : index)"
                    required
                    :prop="'cdList.' + index + '.cdmc'"
                    :rules="{
                      required: true,
                      message: '菜单名称不能为空',
                      trigger: 'blur',
                    }"
                  >
                    <el-input
                      v-model="domain.cdmc"
                      style="width: 100%"
                      placeholder="请输入菜单名称"
                    ></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item
                    :label="'菜单链接' + (index == 0 ? '' : index)"
                    required
                    :prop="'cdList.' + index + '.cdlj'"
                    :rules="{
                      required: true,
                      message: '菜单链接不能为空',
                      trigger: 'blur',
                    }"
                  >
                    <el-input
                      v-model="domain.cdlj"
                      style="width: 100%"
                      placeholder="请输入菜单链接"
                    ></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item
                    :label="'菜单类型' + (index == 0 ? '' : index)"
                    required
                    :prop="'cdList.' + index + '.cdlj'"
                    :rules="{
                      required: true,
                      message: '菜单类型不能为空',
                      trigger: 'change',
                    }"
                  >
                    <el-select
                      v-model="domain.cdlx"
                      placeholder="请选择菜单类型"
                    >
                      <el-option
                        v-for="dict in dict.type.gzh_cdlx"
                        :key="dict.value"
                        :label="dict.label"
                        :value="dict.value"
                      />
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col
                  :span="1"
                  style="text-align: center"
                  v-if="!disabled"
                  v-show="index != 0"
                >
                  <i
                    @click="removeDomain(domain, 'cdList')"
                    class="el-icon-remove-outline"
                    style="font-size: 16px; cursor: pointer; margin-top: 8px"
                  ></i>
                </el-col>
              </el-row>
              <el-row v-if="pageType !== 'look'">
                <el-col :span="24">
                  <el-form-item>
                    <el-button @click="addOtherConcat('cdList')"
                      >添加菜单</el-button
                    >
                  </el-form-item>
                </el-col>
              </el-row>
            </div>
          </div>
          <div v-else>
            <el-row>
              <el-col :span="12">
                <el-form-item
                  prop="tyshxydm"
                  class="daoqitixingren"
                  label="统一社会信用代码"
                  required
                >
                  <el-input
                    v-model="ruleForm.tyshxydm"
                    placeholder="请输入统一信用代码"
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item
                  label="账号名称"
                  prop="gzhmc"
                  :rules="[
                    {
                      required: true,
                      message: '账号名称不能为空',
                      trigger: 'blur',
                    },
                  ]"
                >
                  <el-input
                    v-model="ruleForm.gzhmc"
                    placeholder="请输入账号名称"
                    disabled
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item
                  label="账号ID"
                  required
                  prop="gzhId"
                  :rules="[
                    {
                      required: true,
                      message: '账号ID不能为空',
                      trigger: 'blur',
                    },
                  ]"
                >
                  <el-input
                    v-model="ruleForm.gzhId"
                    style="width: 100%"
                    placeholder="请输入账号ID"
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item
                  label="账号状态"
                  required
                  prop="gzhzt"
                  :rules="[
                    {
                      required: true,
                      message: '账号状态不能为空',
                      trigger: 'blur',
                    },
                  ]"
                >
                  <el-select
                    v-model="ruleForm.gzhzt"
                    placeholder="请选择账号状态"
                  >
                    <el-option
                      v-for="dict in dict.type.gzh_state"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item
                  label="开办主体"
                  required
                  prop="rzzt"
                  :rules="[
                    {
                      required: true,
                      message: '开办主体不能为空',
                      trigger: 'blur',
                    },
                  ]"
                >
                  <el-input
                    v-model="ruleForm.rzzt"
                    style="width: 100%"
                    placeholder="请输入开办主体"
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item
                  label="粉丝数"
                  required
                  prop="fss"
                  :rules="[
                    {
                      required: true,
                      message: '粉丝数不能为空',
                      trigger: 'blur',
                    },
                  ]"
                >
                  <el-input
                    v-model="ruleForm.fss"
                    type="number"
                    style="width: 100%"
                    placeholder="请输入粉丝数"
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="重点行业" required prop="zdhy">
                  <el-select
                    v-model="ruleForm.zdhy"
                    placeholder="请选择重点行业"
                  >
                    <el-option
                      v-for="dict in dict.type.app_zdhy"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="所属行业" required prop="sshy">
                  <el-select
                    v-model="ruleForm.sshy"
                    placeholder="请选择所属行业"
                  >
                    <el-option
                      v-for="dict in dict.type.app_sshy"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="系统责任人" required prop="xtzrr">
                  <el-input
                    v-model="ruleForm.xtzrr"
                    style="width: 100%"
                    placeholder="请输入系统责任人"
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item prop="xtzrrdh" label="系统责任人电话" required>
                  <el-input
                    v-model="ruleForm.xtzrrdh"
                    style="width: 100%"
                    placeholder="请输入系统责任人电话"
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="系统责任人邮箱" required prop="xtzrryx">
                  <el-input
                    v-model="ruleForm.xtzrryx"
                    style="width: 100%"
                    placeholder="请输入系统责任人邮箱"
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="系统责任人地址" required prop="xtzrrdz">
                  <el-input
                    v-model="ruleForm.xtzrrdz"
                    style="width: 100%"
                    placeholder="请输入系统责任人地址"
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="系统简介" required prop="xtjj">
                  <el-input
                    type="textarea"
                    resize="none"
                    placeholder="请输入系统简介"
                    :rows="5"
                    v-model="ruleForm.xtjj"
                  ></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </div>
          <el-row style="margin: 10px 0" v-if="ruleForm.bfyy">
            <span class="top-title-box">关停原因</span>
          </el-row>
          <el-row style="margin: 20px 0">
            <el-form-item>
              <div>{{ ruleForm.bfyy }}</div>
            </el-form-item>
          </el-row>
        </el-form>
        <el-row
          style="margin: 10px 0; padding-bottom: 50px; text-align: center"
          v-if="pageType !== 'look' && $route.name == 'mytaskAuditInfo'"
        >
          <el-button type="danger" @click="newAssets(0)">关停</el-button>
          <el-button @click="newAssets(1)">取消</el-button>
          <el-button type="warning" @click="newAssets(2)">暂存</el-button>
          <el-button type="success" @click="newAssets(3)" :loading="loading"
            >提交</el-button
          >
          <!-- <el-button type="primary" @click="sendBack" class="fanhuipiaofu">返回</el-button> -->
        </el-row>
        <el-row
          style="margin: 10px 0; padding-bottom: 50px; text-align: center"
          v-if="pageType == 'look'"
        >
          <el-button type="primary" @click="sendBack" class="fanhuipiaofu"
            >返回</el-button
          >
        </el-row>
        <el-row
          style="margin: 10px 0; padding-bottom: 50px; text-align: center"
          v-if="pageType !== 'look' && $route.name == 'taskAuditInfo'"
        >
          <el-button type="danger" @click="JGnewAssets(0)">不通过</el-button>
          <el-button type="primary" @click="JGnewAssets(1)">通过</el-button>
          <!-- <el-button type="primary" @click="sendBack" class="fanhuipiaofu">返回</el-button> -->
        </el-row>
      </div>
    </div>
    <baofei ref="baofei" :ruleForm="ruleForm" @assetTaskzc="guanting"></baofei>
    <butongguo
      ref="butongguo"
      :chuandemingcheng="ruleForm.gzhmc"
      :ruleForm="this.ruleForm"
      dataname="assetOfficialAccountCpPo"
    ></butongguo>
  </div>
</template>
<script>
import {
  assetOfficialAccount,
  assetOfficialAccountInfo,
  unitAllList,
} from "@/api/auditPagesApi/index";
import {
  assetTaskofficetaskSh,
  assetTaskgzhzc,
  assetTasksh,
  assetTaskgzhjyTj,
  assetTaskhistory,
} from "@/api/renwuApi/index.js";
import baofei from "@/views/components/renwuType/baofei.vue";
import butongguo from "@/views/components/renwuType/butongguo.vue";
import myMixin from "@/views/components/renwuType/minxfanhui.js";

export default {
  mixins: [myMixin],

  components: { baofei, butongguo },

  dicts: [
    "app_xzqh",
    "app_sshy",
    "app_zdhy",
    "gzh_state",
    "gzh_lx",
    "gzh_rzzt",
    "gzh_rzlx",
    "gzh_cdlx",
    "sys_ptlx_type",
  ],
  data() {
    return {
      ruleForm: {
        cdList: [
          {
            cdmc: "",
            cdlj: "",
            cdlx: "",
          },
        ],
      },
      rules: {
        ssdw: [
          { required: true, message: "所属单位不能为空", trigger: "change" },
        ],
        gzhmc: [
          { required: true, message: "公众号名称不能为空", trigger: "change" },
        ],
        wxh: [{ required: true, message: "微信号不能为空", trigger: "change" }],
        rzzt: [
          { required: true, message: "认证主体不能为空", trigger: "change" },
        ],
        tyshxydm: [
          {
            required: true,
            message: "统一社会信用代码不能为空",
            trigger: "change",
          },
          {
            required: true,
            pattern: /^[a-zA-Z0-9]{18}$/,
            message: "请输入正确格式的18位统一社会信用代码",
            trigger: "blur",
          },
        ],
        gzhzt: [
          { required: true, message: "公众号状态不能为空", trigger: "change" },
        ],
        gzhId: [
          { required: true, message: "公众号ID不能为空", trigger: "change" },
        ],
        gzhlx: [
          { required: true, message: "公众号类型不能为空", trigger: "change" },
        ],
        rzState: [
          { required: true, message: "认证状态不能为空", trigger: "change" },
        ],
        rzsj: [
          { required: true, message: "认证时间不能为空", trigger: "change" },
        ],
        rzlx: [
          { required: true, message: "认证类型不能为空", trigger: "change" },
        ],
        sshy: [
          { required: true, message: "所属行业不能为空", trigger: "change" },
        ],
        zdhy: [
          { required: true, message: "重点行业不能为空", trigger: "change" },
        ],
        xzqh: [
          { required: true, message: "行政区划不能为空", trigger: "change" },
        ],
        xtzrr: [
          { required: true, message: "系统责任人不能为空", trigger: "change" },
        ],
        xtzrrdh: [
          {
            required: true,
            message: "系统责任人电话不能为空",
            trigger: "change",
          },
          {
            required: true,
            pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
            message: "请输入正确的手机号码",
            trigger: "blur",
          },
        ],
        xtzrryx: [
          {
            required: true,
            message: "系统责任人邮箱不能为空",
            trigger: "change",
          },
          {
            required: true,
            type: "email",
            message: "请输入正确的邮箱地址",
            trigger: ["blur", "change"],
          },
        ],
        xtzrrdz: [
          {
            required: true,
            message: "系统责任人地址不能为空",
            trigger: "change",
          },
        ],
        // cdmc: [
        //   { required: true, message: "菜单信息（菜单名称）不能为空", trigger: "change" }
        // ],
        // cdlj: [
        //   { required: true, message: "菜单信息（菜单链接）不能为空", trigger: "change" }
        // ],
        // cdlx: [
        //   { required: true, message: "菜单信息（菜单类型）不能为空", trigger: "change" }
        // ],
        xtjj: [
          { required: true, message: "系统简介不能为空", trigger: "change" },
        ],
      },

      loading: false,
      disabled: false,
    };
  },
  props: ["pageType", "id"],
  mounted() {
    if (this.pageType == "look") {
      this.getInfo(this.id);
      this.disabled = true;
      this.$nextTick(() => {
        const inputElements = document.querySelectorAll(".el-input__inner");
        const textareaInputElements = document.querySelectorAll(
          ".el-textarea__inner"
        );
        inputElements.forEach((input) => {
          input.placeholder = "";
        });
        textareaInputElements.forEach((input) => {
          input.placeholder = "";
        });
      });
    } else if (this.pageType == "change") {
      this.getInfo(this.id);
      this.disabled = false;
    }
    // if (this.$route.query.taskInfo == 'taskInfo') {
    //   this.disabled = true;
    // }
  },
  methods: {
    removeDomain(item, type) {
      var index = this.ruleForm[type].indexOf(item);
      if (index !== -1) {
        this.ruleForm[type].splice(index, 1);
      }
    },
    // 新增其他联系人
    addOtherConcat(type) {
      this.ruleForm[type].push({
        cdmc: "",
        cdlj: "",
        cdlx: "",
        // key: Date.now()
      });
    },

    getInfo(id) {
      if (this.$route.query.istijiaoshow) {
        let obj = {
          id: this.$route.query.assetId,
          type: this.$route.query.type,
        };
        assetTaskhistory(obj).then((res) => {
          this.ruleForm = res.data.assetOfficialAccountHistory;

          console.log(111);
          setTimeout(() => {
            this.$refs.ruleForm.clearValidate();
          }, 100);
        });
      } else {
        let obj = {
          taskId: this.$route.query.taskId,
          assetId: this.$route.query.assetId,
        };
        assetTaskofficetaskSh(obj).then((res) => {
          this.ruleForm = res.data;
          if (!this.ruleForm.ptlx) {
            this.ruleForm.ptlx = "1";
          }
          setTimeout(() => {
            this.$refs.ruleForm.clearValidate();
          }, 100);
        });
      }
    },
    // 单位名称模糊查询
    querySearchAsync(queryString, cb) {
      let results = [];
      unitAllList({ nickName: queryString }).then((res) => {
        res.data.forEach((item) => {
          results.push({
            value: item.nickName,
            id: item.id,
          });
        });
      });
      cb(results);
    },
    guanting(ruleForm) {
      assetTaskgzhzc(ruleForm).then((res) => {
        this.$message({
          type: "info",
          message: "已关停",
        });
        this.$router.go(-1);
        this.ruleForm.bfyy = "";
        this.$refs.baofei.resetForm();
      });
    },
    // 新增资产确认按钮
    newAssets(type) {
      if (type == 1) {
        //取消

        this.loading = true;
        this.$router.go(-1);
        this.loading = false;
        return;
      }
      this.ruleForm.taskId = this.$route.query.taskId;
      this.ruleForm.assetId = this.$route.query.assetId;

      if (type == 0) {
        this.$refs.baofei.open();
      }
      //暂存
      if (type == 2) {
        this.loading = true;
        assetTaskgzhzc(this.ruleForm).then((res) => {
          console.log(res, "res");
          this.$modal.msgSuccess("修改成功");
          this.$router.go(-1);
          this.loading = false;
        });
      }
      if (type == 3) {
        this.$refs["ruleForm"].validate((valid) => {
          if (valid) {
            this.loading = true;
            assetTaskgzhjyTj(this.ruleForm).then((res) => {
              this.loading = false;
              this.$modal.msgSuccess("提交成功");
              this.$router.go(-1);
            });
          }
        });
      }
    },
    JGnewAssets(type) {
      this.ruleForm.taskId = this.$route.query.taskId;
      this.ruleForm.assetId = this.$route.query.assetId;
      if (type == 0) {
        this.$refs["ruleForm"].validate((valid) => {
          this.$refs.butongguo.open();
        });
      }
      if (type == 1) {
        this.$refs["ruleForm"].validate((valid) => {
          let tijioaobj = {
            taskId: this.$route.query.taskId,
            assetId: this.$route.query.assetId,
            xtmc: this.ruleForm.gzhmc,
            status: 3,
            type: this.$route.query.type,
            assetOfficialAccountCpPo: this.ruleForm,
          };
          assetTasksh(tijioaobj).then((res) => {
            if (res.code == 200) {
              this.$modal.msgSuccess("审核成功");
              this.$router.go(-1);
            }
          });
        });
      }
    },
  },
};
</script>
