<template>
  <view class="zhixing-container" style="margin: 20rpx;margin-top: 220rpx; min-height: 300px; ">
    <view class="zhixing_top" style="display: flex; flex-direction: column;">
      <view style="display: flex; flex-direction: row;margin-bottom: 10px; margin-left: 10px;">
        <view class="querybox">
          <view class="querybox_title">项目编号：</view>
          <!-- <combox-more style="width:150px;" @onSelect="banhaoselectionEvent" label=""></combox-more> -->
          <!-- <piaoyi-select style="300px" :inputValue.sync="queryParams.projectId" ref="piaoyiSelect" :clearable="true"
          :filterable="true" placeholder="请选择项目编号" valueKey="projectId" label="lablename" :options="xmdwlist"
          @changeval="halechange">
        </piaoyi-select> -->
          <!-- 项目自定义选择器组件 -->
          <view @click="xmpickerVisible = true; hideKeyboard()">
            <!-- <u-input style="width:400px" v-model="queryParams.projectname" :clearable="true" disabledColor="#ffffff"
              placeholder="请选择项目编号"></u-input> -->
            <uni-easyinput style="width: 400px;" v-model="queryParams.projectname" clearable disabledColor="#ffffff"
              placeholder="请选择项目编号" @clear="xmhandleclear"></uni-easyinput>

          </view>

        </view>
        <view class="querybox">
          <u-button style="width:100px; float: left;margin-left: 20px;" type="primary" icon="search" text="查询"
            @click="getlistinfo()"></u-button>
        </view>

      </view>
      <view style="margin-top: 20px; margin-bottom: 10px;">
        <u-button style="width:100px; float: left; margin-left:10px;" type="success" icon="plus-circle" text="添加问卷"
          @click="addwenjuan()" size="small"></u-button>
        <u-button style="width:100px; float: left;margin-left: 20px;" type="primary" icon="edit-pen" text="编辑问卷"
          :disabled="activenum!=1" @click="upwenjuan()" size="small"></u-button>
        <u-button style="width:100px; float: left;margin-left: 20px;" type="error" icon="trash" text="删除问卷"
          :disabled="activenum==0" @click="shanchujiancha()" size="small"></u-button>
        <u-button style="width:100px; float: left;margin-left: 20px;" type="primary" icon="list-dot" text="评价表"
          :disabled="activenum!=1" @click="pingjia()" size="small"></u-button>
      </view>
    </view>

    <view class="zhixing_center">
      <!-- <uni-table border ref="pageTable" style="width:98%; margin: 0 auto; max-height:450px; " type="selection"
        @selection-change="handleSelectionChange">
        <uni-tr class="frisytr" style="background-color: #f5f5f5;">
          <uni-th align="center" width="220">项目编号</uni-th>
          <uni-th align="center">是否租赁</uni-th>
          <uni-th align="center">是否存放易燃易爆危险化学品</uni-th>
          <uni-th align="center">近1年内是否发生过火灾</uni-th>
          <uni-th align="center">上一年度是否进行消防设施年度检测</uni-th>
          <uni-th align="center">上一年度是否进行消防安全咨询评估</uni-th>
          <uni-th align="center" width="120">制单</uni-th>
          <uni-th align="center" width="200">创建时间</uni-th>
        </uni-tr>
        <uni-tr v-for="(item, index) in tableData" :key="index">
          <uni-td align="center">{{item.projectName}}</uni-td>
          <uni-td align="center">
            {{item.rentRst=='1'?'是':item.rentRst=='2'?'否':item.rentRst=='3'?'不涉及':''}}
          </uni-td>
          <uni-td align="center">
            {{item.chemicalsRst=='1'?'是':item.chemicalsRst=='2'?'否':item.chemicalsRst=='3'?'不涉及':''}}
          </uni-td>
          <uni-td align="center">
            {{item.fireRst=='1'?'是':item.fireRst=='2'?'否':item.fireRst=='3'?'不涉及':''}}
          </uni-td>
          <uni-td align="center">
            {{item.lastYearCheckRst=='1'?'是':item.lastYearCheckRst=='2'?'否':item.lastYearCheckRst=='3'?'不涉及':''}}
          </uni-td>
          <uni-td align="center">
            {{item.lastYearConsultRst=='1'?'是':item.lastYearConsultRst=='2'?'否':item.lastYearConsultRst=='3'?'不涉及':''}}
          </uni-td>
          <uni-td align="center">{{item.createBy}}</uni-td>
          <uni-td align="center">{{item.createTime?$dayjs(item.createTime).format("YYYY-MM-DD HH:mm:ss"):''}}</uni-td>
        </uni-tr>
      </uni-table> -->


      <u-table row-key="createTime" rowHeight="60" customClass="mewtable2" ref="pageTable" :scrollX="true"
        :cellStyle="{padding:'10px 10px 0px 10px'}" :data="tableData" :ellipsis="false" height="480" :border="true"
        @select="handleSelectionChange" style="width:100%">
        <!-- :span-method="spanMethodWithColspan" -->
        <u-table-column type="selection" fixed width="55" align="center" headerAlign="center"></u-table-column>
        <u-table-column prop="projectName" width="180" label="项目编号" headerAlign="center" />
        <u-table-column prop="" width="180" align="center" label="是否租赁" headerAlign="center">
          <template #default="{ row, index }">
            <u-tag v-if="row.rentRst" :text="row.rentRst=='1'?'是':row.rentRst=='2'?'否':row.result=='3'?'不涉及':''"
              :type="row.rentRst=='1'?'error':row.rentRst=='2'?'success':row.rentRst=='3'?'primary':''"
              size="mini"></u-tag>
          </template>
        </u-table-column>
        <u-table-column prop="" width="180" align="center" label="是否存放易燃易爆危险化学品" headerAlign="center">
          <template #default="{ row, index }">
            <u-tag v-if="row.chemicalsRst"
              :text="row.chemicalsRst=='1'?'是':row.chemicalsRst=='2'?'否':row.chemicalsRst=='3'?'不涉及':''"
              :type="row.chemicalsRst=='1'?'error':row.chemicalsRst=='2'?'success':row.chemicalsRst=='3'?'primary':''"
              size="mini"></u-tag>
          </template>
        </u-table-column>
        <u-table-column prop="" width="180" align="center" label="近1年内是否发生过火灾" headerAlign="center">
          <template #default="{ row, index }">
            <u-tag v-if="row.fireRst" :text="row.fireRst=='1'?'是':row.fireRst=='2'?'否':row.fireRst=='3'?'不涉及':''"
              :type="row.fireRst=='1'?'error':row.fireRst=='2'?'success':row.fireRst=='3'?'primary':''"
              size="mini"></u-tag>
          </template>
        </u-table-column>
        <u-table-column prop="" align="center" width="180" label="上一年度是否进行消防设施年度检测" headerAlign="center">
          <template #default="{ row, index }">
            <u-tag v-if="row.lastYearCheckRst"
              :text="row.lastYearCheckRst=='1'?'是':row.lastYearCheckRst=='2'?'否':row.lastYearCheckRst=='3'?'不涉及':''"
              :type="row.lastYearCheckRst=='1'?'error':row.lastYearCheckRst=='2'?'success':row.lastYearCheckRst=='3'?'primary':''"
              size="mini"></u-tag>
          </template>
        </u-table-column>
        <u-table-column prop="" align="center" width="180" label="上一年度是否进行消防安全咨询评估" headerAlign="center">
          <template #default="{ row, index }">
            <u-tag v-if="row.lastYearConsultRst"
              :text="row.lastYearConsultRst=='1'?'是':row.lastYearConsultRst=='2'?'否':row.lastYearConsultRst=='3'?'不涉及':''"
              :type="row.lastYearConsultRst=='1'?'error':row.lastYearConsultRst=='2'?'success':row.lastYearConsultRst=='3'?'primary':''"
              size="mini"></u-tag>
          </template>
        </u-table-column>

        <u-table-column prop="createBy" width="80" label="制单" align="center" headerAlign="center" />
        <u-table-column prop="createTime" width="180" label="创建时间" align="center" headerAlign="center">
          <template #default=" { row, index }">
            {{row.createTime?$dayjs(row.createTime).format("YYYY-MM-DD HH:mm:ss"):''}}
          </template>
        </u-table-column>
      </u-table>



    </view>
    <u-modal content="" :closeOnClickOverlay="true" :title="modaltitle" :showCancelButton="true" confirmText="保存"
      width="600px" :show="addshow" @confirm="baocun()" @cancel="() => addshow = false">
      <view class="slot-content" style="width: 100%;">
        <view class="wenjuanadbox" style="width: 100%; height: 300px; align-items: left; border-top:1px solid #eee;">
          <view class="querybox" style=" margin-top: 10px;">
            <view class="querybox_title">项目编号：</view>
            <view v-if="!isedit" class="querybox_title" @click="addxmpickerVisible = true; hideKeyboard()">
              <u-input style="width: 400px;" disabled v-model="formdata.projectname" :clearable="true"
                disabledColor="#ffffff" placeholder="请选择项目编号"></u-input>
            </view>
            <view v-else class="querybox_title"> {{activeitem.projectName}}</view>
          </view>
          <view class="querybox1" style=" margin-top:20px;">
            <view class="querybox_title">是否存在租赁情况：</view>
            <view class="querybox_title">
              <u-radio-group v-model="formdata.rentRst" placement="row" activeColor="#007aff">
                <u-radio :name="1" label="是"></u-radio>
                <u-radio :name="2" label="否"></u-radio>
              </u-radio-group>
            </view>
          </view>
          <view class="querybox1" style=" margin-top:20px;">
            <view class="querybox_title">是否存放易燃易爆危险化学品：</view>
            <view class="querybox_title">
              <u-radio-group v-model="formdata.chemicalsRst" placement="row" activeColor="#007aff">
                <u-radio :name="1" label="是"></u-radio>
                <u-radio :name="2" label="否"></u-radio>
              </u-radio-group>
            </view>
          </view>
          <view class="querybox1" style=" margin-top:20px;">
            <view class="querybox_title">近1年内是否发生过火灾：</view>
            <view class="querybox_title">
              <u-radio-group v-model="formdata.fireRst" placement="row" activeColor="#007aff">
                <u-radio :name="1" label="是"></u-radio>
                <u-radio :name="2" label="否"></u-radio>
              </u-radio-group>
            </view>
          </view>
          <view class="querybox1" style=" margin-top:20px;">
            <view class="querybox_title">上一年度是否进行消防设施年度检测：</view>
            <view class="querybox_title">
              <u-radio-group v-model="formdata.lastYearCheckRst" placement="row" activeColor="#007aff">
                <u-radio :name="1" label="是"></u-radio>
                <u-radio :name="2" label="否"></u-radio>
              </u-radio-group>
            </view>
          </view>
          <view class="querybox1" style=" margin-top:20px;">
            <view class="querybox_title"> 上一年度是否进行消防安全咨询评估：</view>
            <view class="querybox_title">
              <u-radio-group v-model="formdata.lastYearConsultRst" placement="row" activeColor="#007aff">
                <u-radio :name="1" label="是"></u-radio>
                <u-radio :name="2" label="否"></u-radio>
                <u-radio :name="3" label="不涉及"></u-radio>
              </u-radio-group>
            </view>
          </view>

        </view>

      </view>

    </u-modal>
    <customPicker :visible="xmpickerVisible" title="选择项目编号" :options="xmpickerConfig.options"
      :displayKey="xmpickerConfig.displayKey" :valueKey="xmpickerConfig.valueKey" :multiple="xmpickerConfig.multiple"
      :searchable="xmpickerConfig.searchable" :value="xmpickerConfig.value" @confirm="xmhandleConfirm"
      @cancel="xmhandleCancel" />
    <customPicker :visible="addxmpickerVisible" title="选择项目编号" :options="addxmpickerConfig.options"
      :displayKey="addxmpickerConfig.displayKey" :valueKey="addxmpickerConfig.valueKey"
      :multiple="addxmpickerConfig.multiple" :searchable="addxmpickerConfig.searchable" :value="addxmpickerConfig.value"
      @confirm="addxmhandleConfirm" @cancel="addxmhandleCancel" />
    <u-modal content="" :closeOnClickOverlay="true" :title="pjmodaltitle" confirmText="关闭" width="800px"
      :show="pjmodalshow" @confirm="() => pjmodalshow = false">
      <view class="slot-content" style="width: 100%;">
        <scroll-view scroll-y="true" style="height: 300px;">
          <view style="display: flex;
       flex-direction: column;
   width: 100%; align-items: left; border-top:1px solid #eee;">
            <uni-table border ref="page1Table" style="width:98%; margin: 0 auto;">
              <uni-tr style="background-color: #f5f5f5;">
                <uni-th align="center">序号</uni-th>
                <uni-th align="center">评价内容</uni-th>
                <uni-th align="center">得分</uni-th>
              </uni-tr>
              <uni-tr v-for="(item, index) in pjtableInfolist" :key="index">
                <uni-td align="center">{{Number(index+1)}}</uni-td>
                <uni-td align="center">
                  {{item.info}}
                </uni-td>
                <uni-td align="center">
                  {{item.score}}
                </uni-td>
              </uni-tr>
            </uni-table>
          </view>
        </scroll-view>
      </view>
    </u-modal>
    <u-toast ref="uToast"></u-toast>
    <UniMenu />
  </view>
</template>

<script>
  import {
    getsafety_hazardInfo,

  } from "@/apis/zhixing"
  import {
    getquestionnaireInfo,
    getxmdwdefaultconditionlist,
    addquestionnaire,
    upquestionnaire,
    getquestionnaireIdinfo,
    delquestionnaire,
    getadddefaultcondition,
    getevaluationIdinfo
  } from "@/apis/wenjuan"


  import UniMenu from '@/components/uni-menu/uni-menu.vue'
  import comboxMore from '@/components/wl-combox-more/combox-more.vue'
  import useUserStore from '@/store/user';
  import CustomPicker from '@/components/custom-search-picker/index.vue';
  export default {
    components: {
      UniMenu,
      comboxMore,
      CustomPicker
    },
    data() {
      return {
        // upurl: import.meta.env.VITE_APP_BASE_PRE + '/safety_hazard/table/img',
        //  httpurl: import.meta.env.VITE_APP_BASE_PRE,
        upurl: 'http://219.146.89.198:19388' + '/safety_hazard/table/img',
        httpurl: 'http://219.146.89.198:19388',
        xmpickerVisible: false,
        addxmpickerVisible: false,
        xmpickerConfig: {
          title: '选择项目',
          options: [],
          displayKey: 'lablename',
          valueKey: 'projectId',
          multiple: false,
          searchable: true,
          value: ''
        },
        highRiskFlag: false,
        addxmpickerConfig: {
          title: '选择项目',
          options: [],
          displayKey: 'lablename',
          valueKey: 'projectId',
          multiple: false,
          searchable: true,
          value: ''
        },
        isedit: false,
        formdata: {
          questionnaireId: 0,
          rentRst: 0,
          chemicalsRst: 0,
          fireRst: 0,
          lastYearCheckRst: 0,
          lastYearConsultRst: 0,
          rentArea: "",
          rentPurpose: "",
          rentEndDate: "",
          chemicalsName: "",
          chemicalsQuantity: 0,
          storeAddress: "",
          storeType: "",
          fireDate: "",
          fireAddress: "",
          fireReason: "",
          fireLoss: "",
          fireResult: "",
          checkReportUrl: "",
          correctiveMeasures: "",
          signatureUrl: "",
          projectId: 0,
          remark: ""
        },
        modaltitle: '添加调查问卷',
        pjmodaltitle: '非火灾高危单位',
        pjmodalshow: false,
        pjtableInfolist: [],
        imgboxshow: false,
        imgurlslist: [],
        tableData: [],
        queryParams: {
          // pageNum: 1,
          // pageSize: 10,
          projectId: null,
          projectname: '',
          reasonable: false,
        },
        addshow: false,
        infolist: [],
        activeitem: null,
        activenum: 0,
        addxmdwlist: [],
        activenumlist: [],
        xmdwlist: [
          //   {
          //   projectId: 0,
          //   projectNo: "001",
          //   customerCompany3Name: "撒大苏打",
          //   lablename: "001（撒大苏打）",
          // }, {
          //   projectId: 1,
          //   projectNo: "002",
          //   customerCompany3Name: "法国",
          //   lablename: "002（法国）",
          // },

        ],
      }
    },
    computed: {
      nick() {
        // debugger
        // return  userStore.username
        const userStore = useUserStore();
        return userStore.name
      },
      imageSrc() {

        const userStore = useUserStore();
        return userStore.avatar
      },

      username() {
        // debugger
        // return  userStore.username
        const userStore = useUserStore();
        return userStore.username
      },
      avatar() {
        //debugger
        const userStore = useUserStore();
        return userStore.avatar
      },
      windowHeight() {
        return uni.getSystemInfoSync().windowHeight - 50
      }
    },
    // // 监听页面返回
    // onBackPress() {
    //   //debugger
    //   uni.redirectTo({
    //     url: '/pages/index/index'
    //   });
    //   // 阻止界面返回默认操作， 这一步主要是为了防止界面出现异常，uniapp有对onBackPress的详细讲解
    //   return true;
    // },

    onShow() {
      // this.getlistinfo(); //获取问卷列表
      this.getxmdwlist(); //获取项目单位列表
      const userStore = useUserStore();
      userStore.setparentmenutitle('执行');
      userStore.setchildrenmenutitle('调查问卷');
    },
    onLoad() {
      // this.getUser()
    },
    methods: {
      pingjia() {
        getevaluationIdinfo(this.activeitem.projectId).then((res) => {
          //  debugger
          this.pjtableInfolist = []
          this.highRiskFlag = res.data.highRiskFlag;
          this.pjtableInfolist = res.data.tableInfo || [];


          if (this.highRiskFlag) {
            this.pjmodaltitle = '火灾高危单位';
          } else {
            this.pjmodaltitle = '非火灾高危单位';
          }

          this.pjmodalshow = true;
        });

      },

      hideKeyboard() {
        uni.hideKeyboard()
      },
      xmhandleConfirm(result) {
        // 处理确认项目
        //  debugger
        // console.log(result);
        this.xmpickerConfig.value = result.selectedItem;
        this.queryParams.projectname = result.selectedItem.lablename;
        this.queryParams.projectId = result.selectedItem.projectId;
        this.xmpickerVisible = false;
        this.getlistinfo(); //查询列表
      },
      xmhandleclear() {
        this.xmpickerConfig.value = '';
        this.queryParams.projectname = '';
        this.queryParams.projectId = '';
        setTimeout(() => {
          this.xmpickerVisible = false;
        }, 300);
        this.getlistinfo(); //查询列表

      },
      xmhandleCancel() {
        // 处理取消项目
        this.xmpickerVisible = false
      },
      addxmhandleConfirm(result) {
        // 处理确认项目
        //  debugger
        // console.log(result);
        this.addxmpickerConfig.value = result.selectedItem;
        this.formdata.projectname = result.selectedItem.lablename;
        this.formdata.projectId = result.selectedItem.projectId;
        this.addxmpickerVisible = false;

      },
      addxmhandleCancel() {
        // 处理取消项目
        this.addxmpickerVisible = false
      },


      shanchujiancha() {
        //删除
        // debugger
        let checkTableIds = this.activenumlist;
        //this.activeitem.questionnaireId
        this.$modal.confirm('确定要删除此条信息吗？').then(() => {
          // debugger
          delquestionnaire(checkTableIds).then((res) => {
            //  debugger
            this.$modal.msgSuccess("删除成功！");
            setTimeout(() => {
              this.getlistinfo(); //获取检查列表
            }, 300);
          })
        });
      },
      biangenls() {
        //变更日志


      },
      showimg(item) {
        if (!item.imgNum) return;
        this.imgurlslist = [];
        if (item.imgUrl.includes(',')) {
          // debugger
          // this.imgurlslist = item.imgUrl.split(",");
          let imglist = item.imgUrl.split(",");
          for (let s of imglist) {
            this.imgurlslist.push(this.httpurl + s);
          }
          // this.imgurlslist = imglist;
        } else {
          this.imgurlslist = [this.httpurl + item.imgUrl]
        }
        // debugger
        this.imgboxshow = true;

      },
      baocun() {
        //保存


        // if (!this.formdata.standardCheckTableId) {
        //   this.$modal.msgError("请选择要素！")
        //   return;
        // } else if (!this.formdata.buildingId) {
        //   this.$modal.msgError("请选择建筑物！")
        //   return;
        // }
        if (!this.formdata.projectId) {
          this.$modal.msgError("请选择项目编号！")

          // setTimeout(() => {
          //   debugger
          // }, 1000)

          return;
        }
        // this.formdata.projectId = this.queryParams.projectId;

        // debugger
        if (this.formdata.questionnaireId != null) {
          //编辑
          upquestionnaire(this.formdata).then(res => {
            //debugger
            this.$modal.msgSuccess("修改成功！");
            this.addshow = false;

            setTimeout(() => {
              this.getlistinfo(); //获取问卷列表
            }, 300);

          });
        } else {
          addquestionnaire(this.formdata).then(res => {
            // debugger
            this.$modal.msgSuccess("添加成功！");
            this.addshow = false;
            setTimeout(() => {
              this.getlistinfo();
            }, 300);

          });
        }

      },
      addwenjuan() {
        //新增
        this.isedit = false;
        this.getaddxmdwlist();
        this.modaltitle = '添加调查问卷';
        this.formdata = {
          rentRst: '',
          chemicalsRst: '',
          fireRst: '',
          lastYearCheckRst: '',
          lastYearConsultRst: ''
        }
        this.addshow = true;
      },
      upwenjuan() {
        //编辑
        // uni.navigateTo({
        //   url: `/pages/zhixing/addwenjuanbiao?projectid=${this.activeitem.projectId}&checkTableId=${this.activeitem.checkTableId}&id1=${this.activeitem.standardCheckTable1Id}&id2=${this.activeitem.standardCheckTable2Id}&id3=${this.activeitem.standardCheckTable3Id}&id4=${this.activeitem.standardCheckTable4Id}&projectName=${this.activeitem.projectName}`,
        // })
        this.isedit = true;
        getquestionnaireIdinfo(this.activeitem.questionnaireId).then((res) => {
          //debugger
          this.formdata = res.data;
          this.modaltitle = '编辑调查问卷';
          this.addshow = true;
        });

      },
      clearSelection() {
        //清空选中项
        this.$refs.pageTable.clearSelection();
        this.activeitem = null;
        this.activenum = 0;

      },
      // handleSelectionChange(selection) {
      //   // debugger
      //   // let del_row = selection.shift();
      //   // this.$refs.pageTable.toggleRowSelection(del_row, false);

      //   // console.log('当前选中的行:', JSON.stringify(selection));
      //   //this.$refs.pageTable.toggleAllSelection(false);
      //   //  this.$refs.pageTable.clearSelection();
      //   // this.$refs.pageTable.toggleRowSelection(selection.index, true);
      //   this.activenum = selection.detail.index.length;
      //   if (selection.detail.index.length > 1) {
      //     // debugger
      //     this.$modal.msgError("只能选一个！");
      //     this.activeitem = null;
      //     // this.$refs.pageTable.toggleRowSelection(selection.detail.index[selection.detail.index.length - 1], false);
      //     // this.$refs.pageTable.toggleAllSelection(true);
      //     // this.$refs.pageTable.clearSelection();
      //     return;
      //   }
      //   // this.$refs.pageTable.clearSelection();
      //   if (selection.detail.index.length == 0) {
      //     this.activeitem = null;
      //   } else {
      //     this.activeitem = this.tableData[selection.detail.index[selection.detail.index.length - 1]];
      //   }
      // },
      handleSelectionChange(selection) {
        // debugger
        // let del_row = selection.shift();
        // this.$refs.pageTable.toggleRowSelection(del_row, false);

        // console.log('当前选中的行:', JSON.stringify(selection));
        //this.$refs.pageTable.toggleAllSelection(false);
        //  this.$refs.pageTable.clearSelection();
        // this.$refs.pageTable.toggleRowSelection(selection.index, true);
        this.activenumlist = [];
        this.activenum = selection.length;
        // this.activenumlist=selection.map
        for (let s of selection) {
          if (s.questionnaireId) {
            this.activenumlist.push(s.questionnaireId)
          } else {
            //   this.$refs.pageTable.toggleRowSelection(s, false);

            // this.$refs.pageTable.clearSelection()
            // this.$modal.msgError("此项没有检查点！");

          }

        }


        if (selection.length > 1) {
          // debugger
          // this.$modal.msgError("只能选一个！");
          this.activeitem = null;
          // this.$refs.pageTable.toggleRowSelection(selection.detail.index[selection.detail.index.length - 1], false);
          // this.$refs.pageTable.toggleAllSelection(true);
          // this.$refs.pageTable.clearSelection();
          return;
        }
        if (selection.length == 0) {
          this.activeitem = null;
          //   this.isbutclick = false;
        } else {
          // this.activeitem = this.tableData[selection.detail.index[selection.detail.index.length - 1]];

          this.activeitem = selection[0];
        }
        if (this.activeitem) {
          //debugger
          if (this.activeitem.questionnaireId == null) {
            //   this.isbutclick = false;
          } else {
            //  this.isbutclick = true;
          }
        }





        // this.$refs.pageTable.clearSelection();

      },
      getlistinfo() {
        //获取问卷列表
        this.tableData = [];
        this.clearSelection(); //清空
        getquestionnaireInfo(this.queryParams).then((res) => {
          //debugger
          this.tableData = res.rows || [];

        })
      },


      getaddxmdwlist() {
        //获取新增时的未添加项目
        getadddefaultcondition().then((res) => {
          //debugger
          res.rows = res.rows || [];
          for (let s of res.rows) {
            s.lablename = s.projectNo + `（${s.customerCompany3Name}）`;
          }
          this.addxmdwlist = res.rows || [];

          this.addxmpickerConfig.options = res.rows || [];
          // if (this.addxmdwlist.length > 0) {
          //   //debugger
          //   // this.queryParams.projectId = this.xmdwlist[0].projectId;
          //   // this.queryParams.projectname = this.xmdwlist[0].lablename;
          //   // this.xmpickerConfig.value = this.xmdwlist[0].projectId;
          // }


        })

      },

      getxmdwlist() {
        //获取项目单位列表
        getxmdwdefaultconditionlist().then((res) => {
          //debugger
          res.data.projects = res.data.projects || [];
          for (let s of res.data.projects) {
            s.lablename = s.projectNo + `（${s.customerCompany3Name}）`;
          }
          this.xmdwlist = res.data.projects || [];

          this.xmpickerConfig.options = res.data.projects || [];
          if (this.xmdwlist.length > 0) {
            //debugger
            // this.queryParams.projectId = this.xmdwlist[0].projectId;
            // this.queryParams.projectname = this.xmdwlist[0].lablename;
            // this.xmpickerConfig.value = this.xmdwlist[0].projectId;
          }

          this.getlistinfo(); //获取问卷列表
        })
      },
      clickcell(row, column, cell, event) {
        debugger
      },
      halechange() {
        //查询  
        this.getlistinfo(); //获取问卷列表
      },
      banhaoselectionEvent(selection, selectObj) {
        console.log('selectionEvent:', selection, selectObj)
      }
    }
  }
</script>

<style lang="scss" scoped>
  .zhixing_top {
    width: 100%;
    display: flex;
    flex-direction: column;


  }

  .querybox {
    display: flex;
    flex-direction: row;
    align-items: center;

    .querybox_title {}
  }

  ::v-deep .infotable {
    .xincellclass {}

    .u-table-header {
      z-index: 0;
    }

    .u-table-cell {
      .u-table-cell_content {
        padding: 0rpx 16rpx 0rpx 16rpx;
        white-space: normal;
        text-align: left;

      }
    }
  }


  ::v-deep .uni-table {
    // tr:first-child th:nth-of-type(1) {

    //   /* 你的样式 */
    //   .uni-table-checkbox {
    //     display: none !important;
    //   }

    //   //
    // }
    .frisytr {
      .uni-table-checkbox {
        display: none !important;
      }
    }

    .checkbox__inner {
      z-index: 0 !important;
    }
  }

  .wenjuanadbox {
    display: flex;
    flex-direction: column;

    .querybox1 {
      display: flex;
      flex-direction: row;
      // align-items: center;
      justify-content: space-between;

      .querybox_title {}
    }

  }

  ::v-deep .mewtable2 {
    .u-table__header {
      .u-checkbox {
        // display: none !important;
        visibility: hidden !important;
      }

      .u-table__cell {
        //justify-content: center !important;
        min-height: 50px !important;

      }

      .u-table__rows {
        //border-bottom: 1px solid #dadbde !important;

        ::v-deep .u-table__cell {
          //justify-content: center !important;
          // min-height: 50px !important;
          height: auto !important;
        }

      }


    }

    .u-table__body {
      .u-table__rows {
        border-bottom: 1px solid #dadbde !important;
      }
    }

  }
</style>