| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426 | <template>  <div class="app-container">    <el-row :gutter="10">      <!--机构数据-->      <!-- <el-col :span="4" :xs="24">        <org-tree          v-model="queryParams.orgId"          @defaultOrg="getDefaultOrg"          @checkChange="checkChange"          @click="clickTreeNode"        ></org-tree>      </el-col> -->      <el-col :span="24" :xs="24">        <div class="main-right-box">          <!--    搜索条件    -->          <div class="main-search-box">            <el-form              :model="queryParams"              ref="search"              size="small"              :inline="true"              v-show="showSearch"            >              <el-form-item label="所属机构">                <org-tree                  v-model="queryParams.orgId"                  @defaultOrg="getDefaultOrg"                  @checkChange="checkChange"                  @click="clickTreeNode"                  ref="orgTree"                ></org-tree>              </el-form-item>              <el-form-item prop="key" label="报警控制器名称">                <el-input                  v-model="queryParams.key"                  :maxlength="50"                  placeholder="请输入报警控制器名称"                  clearable                />              </el-form-item>              <el-form-item prop="status" label="报警控制器状态">                <el-select                  label="报警控制器状态"                  v-model="queryParams.status"                  placeholder="请选择报警控制器状态"                  clearable                >                  <el-option                    v-for="dict in dict.type.protection_status"                    :key="dict.value"                    :label="dict.label"                    :value="dict.value"                  />                </el-select>              </el-form-item>              <el-form-item prop="dateRange" label="布撤防登记时间">                <DataRangePicker                  v-model="queryParams.dateRange"                  key="daterange"                  type="daterange"                  range-separator="至"                  start-placeholder="开始日期"                  end-placeholder="结束日期"                >                </DataRangePicker>              </el-form-item>            </el-form>            <!--    按纽    -->            <el-row :gutter="10">              <el-col :span="1.5">                <el-button                  type="primary"                  icon="el-icon-search"                  size="mini"                  @click="getList"                  v-hasPermi="['device:protection']"                  >搜索</el-button                >                <el-button                  type="primary"                  icon="el-icon-refresh"                  size="mini"                  @click="resetQuery"                  >重置</el-button                >                <!-- <el-button                  type="primary"                  icon="el-icon-plus"                  size="mini"                  @click="handleAdd()"                  v-hasPermi="['device:protection:add']"                  >新增</el-button                > -->                <el-button                  type="primary"                  icon="el-icon-download"                  size="mini"                  @click="handleExport()"                  v-hasPermi="['device:protection']"                  >导出数据</el-button                >              </el-col>              <right-toolbar                :showSearch.sync="showSearch"                @queryTable="getList"              ></right-toolbar>            </el-row>          </div>          <el-table            size="small"            border            v-loading="loading"            :data="pageData"            @selection-change="handleSelectionChange"            height="594"          >            <el-table-column              align="center"              type="index"              label="序号"              width="60"              v-if="columns[0].visible"            >              <template slot-scope="scope">                {{                  (queryParams.pageNum - 1) * queryParams.pageSize +                  scope.$index +                  1                }}              </template>            </el-table-column>            <el-table-column              align="center"              prop="orgName"              label="所属机构"              v-if="columns[1].visible"            ></el-table-column>            <el-table-column              align="center"              prop="name"              label="报警控制器名称"              show-overflow-tooltip              v-if="columns[2].visible"            >            </el-table-column>            <el-table-column              align="center"              prop="status"              label="报警控制器状态"              width="150"              v-if="columns[3].visible"            >              <template slot-scope="r"                >{{                  getLabel(dict.type.protection_status, r.row.status, "未知")                }}              </template>            </el-table-column>            <el-table-column              align="center"              prop="statusUpdatorName"              label="登记人/数据来源"              show-overflow-tooltip              width="150"              v-if="columns[4].visible"            >            </el-table-column>            <el-table-column              align="center"              prop="statusUpdateTime"              label="最近登记时间"              width="150"              v-if="columns[5].visible"            >            </el-table-column>            <el-table-column              align="center"              prop="statusUpdateTime"              label="布撤防登记时间"              width="150"              v-if="columns[5].visible"            >            </el-table-column>            <el-table-column align="center" label="操作">              <template slot-scope="r">                <!-- <el-button                size="mini"                type="text"                icon="el-icon-edit-outline"                @click="updateStatus(r.row.id, 1)"                v-hasPermi="['device:protectionstatus:maintain']"                >布防</el-button              >              <el-button                size="mini"                type="text"                icon="el-icon-edit-outline"                @click="updateStatus(r.row.id, 0)"                v-hasPermi="['device:protectionstatus:maintain']"                >撤防</el-button              > -->                <!-- <el-button                  size="mini"                  type="text"                  icon="el-icon-edit-outline"                  @click="onEdit(r.row.id)"                  v-hasPermi="['device:protection:edit']"                  >编辑</el-button                > -->                <el-button                  size="mini"                  type="text"                  icon="el-icon-document-copy"                  @click="onHistory(r.row)"                  v-hasPermi="['device:protection']"                  >布撤防历史</el-button                >                <!-- <el-popconfirm                  @confirm="onDel(r.row.id)"                  title="点击确定删除报警控制器"                >                  <el-button                    size="mini"                    type="text"                    icon="el-icon-delete"                    v-hasPermi="['device:protection:remove']"                    slot="reference"                    >删除</el-button                  >                </el-popconfirm> -->              </template>            </el-table-column>          </el-table>          <pagination            v-show="total > 0"            :total="total"            :page.sync="queryParams.pageNum"            :limit.sync="queryParams.pageSize"            @pagination="getList"          />        </div>      </el-col>    </el-row>    <dialog-edit      ref="editDialog"      @success="getList()"      :orgTypeOptions="dict.type.sys_org_type"      :ruleTypeOptions="dict.type.rule_type"    ></dialog-edit>    <dialog-history      ref="historyDialog"      :statusDict="dict.type.protection_status"    ></dialog-history>  </div></template><script>// import OrgTree from "@/components/orgTree";import OrgTree from "@/components/orgTree/orgQuerySelector.vue";import DialogEdit from "./dialog.edit";import DialogHistory from "./dialog.history";import * as api from "@/api/resumption/protection";import { getLabel } from "@/views/commonOption.js";import { mapGetters } from "vuex";import dayjs from "dayjs";import DataRangePicker from "@/components/dateTime/daterange.picker.vue";export default {  name: "protection",  dicts: ["protection_status"],  components: {    DialogEdit,    OrgTree,    DialogHistory,    DataRangePicker,  },  data() {    const { params, query } = this.$route;    return {      isShow: false,      loading: false,      ids: [],      // 非单个禁用      single: true,      // 非多个禁用      multiple: true,      // 显示搜索条件      showSearch: true,      total: 0,      selectedOrgName: null,      queryParams: {        orgId: null,        checkSub: true,        key: null,        status: null,        dateRange: null,        pageNum: 1,        pageSize: 10,        ...query,      },      pageData: [],      // 列信息      columns: [        { key: 0, label: `序号`, visible: true },        { key: 1, label: `所属机构`, visible: true },        { key: 2, label: `报警控制器名称`, visible: true },        { key: 3, label: `报警控制器状态`, visible: true },        { key: 4, label: `登记人`, visible: true },        { key: 5, label: `最近登记时间`, visible: true },      ],    };  },  props: {},  watch: {},  computed: {    ...mapGetters(["orgId", "orgName"]),  },  methods: {    getLabel,    getList() {      this.loading = true;      this.pageData = [];      api        .list(this.queryParams)        .then((response) => {          this.pageData = response.rows;          this.total = response.total;          this.loading = false;        })        .catch(() => {          this.loading = false;        });    },    handleAdd(id, other = {}) {      this.$refs.editDialog.show(id, other);    },    handleExport() {      if (this.total == 0) {        this.$message.error({          message: `无可用数据导出!`,          type: "error",          duration: 2000,        });        return;      }      this.download(        "/core/resumption/protection/export",        {          ...this.queryParams,        },        `${this.selectedOrgName}-布撤防情况跟踪-${dayjs(new Date()).format(          "YYYYMMDD"        )}.xlsx`      );    },    onEdit(id, other = {}) {      this.$refs.editDialog.show(id, other);    },    onHistory(row) {      this.$refs.historyDialog.show(row);    },    async onDel(id) {      let b = (await api.del(id)).data;      if (b) {        this.$message.info("删除成功");      }      this.getList();    },    updateStatus(id, status) {      api.updateStatus(id, status).then((r) => {        this.$message.info("更新状态成功");        this.getList();      });    },    // 多选框选中数据    handleSelectionChange(selection) {      this.ids = selection.map((item) => item.userId);      this.single = selection.length != 1;      this.multiple = !selection.length;    },    /** 重置按钮操作 */    resetQuery() {      this.resetForm("search");      this.queryParams.dateRange = null;      this.queryParams.orgId = this.orgId;      this.selectedOrgName = this.orgName;      this.queryParams.checkSub = true;      this.$refs["orgTree"].setCheckSub(this.queryParams.checkSub);      // this.queryParams.orgId = undefined;      // this.$refs.tree.setCurrentKey(null);      this.getList();    },    //单选框状态改变    checkChange(state) {      this.queryParams.checkSub = state;      this.getList();    },    getDefaultOrg(node) {      this.queryParams.orgId = node.id;      this.selectedOrgName = node.shortName;      this.getList();    },    // 节点单击事件    clickTreeNode(data) {      this.queryParams.orgId = data.id;      this.selectedOrgName = data.shortName;      this.getList();    },  },  mounted() {},};</script><style lang="scss" scoped>/* .search_key{  ::v-deep .el-form-item__label{    width:60px !important;  }} */</style>
 |