| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296 | <template>  <div class="app-container">    <el-row :gutter="20">      <!--机构数据-->      <el-col :span="4" :xs="24">        <org-tree          v-model="queryParams.orgId"          @defaultKey="getDefaultKey"          @checkChange="checkChange"          @click="clickTreeNode"          :customRequest="orgTree"        ></org-tree>      </el-col>      <el-col :span="20" :xs="24">        <!--    搜索条件    -->        <el-form          :model="queryParams"          ref="search"          size="small"          :inline="true"          v-show="showSearch"          label-width="100px"        >          <el-form-item prop="name" label="检查库名称">            <el-input              v-model="queryParams.name"              :maxlength="50"              placeholder="请输入检查库名称"              clearable            />          </el-form-item>          <el-form-item prop="orgType" label="受检机构类型">            <el-select              prop="orgType"              label="受检机构类型"              v-model="queryParams.orgType"              placeholder="请选择受检机构类型"              clearable            >              <el-option                v-for="item in dict.type.sys_org_type"                :key="item.value"                :label="item.label"                :value="item.value"              >              </el-option>            </el-select>          </el-form-item>          <el-form-item>            <el-button              type="primary"              icon="el-icon-search"              size="mini"              @click="refresh"              v-hasPermi="['safetycheck:rule:query']"              >搜索</el-button            >            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"              >重置</el-button            >          </el-form-item>        </el-form>        <!--    按纽    -->        <el-row :gutter="10" class="mb8">          <el-col :span="1.5">            <el-button              type="primary"              icon="el-icon-plus"              size="mini"              @click="handleAdd()"              v-hasPermi="['safetycheck:rule:add']"              >新增</el-button            >          </el-col>          <right-toolbar            :showSearch.sync="showSearch"            @queryTable="getList"            :columns="columns"          ></right-toolbar>        </el-row>        <el-table          v-loading="loading"          :data="pageData"          @selection-change="handleSelectionChange"        >          <el-table-column            type="index"            label="序号"            v-if="columns[0].visible"          ></el-table-column>          <el-table-column            prop="name"            label="检查库名称"            v-if="columns[1].visible"          ></el-table-column>          <el-table-column            prop="orgType"            label="受检机构类型"            v-if="columns[2].visible"          >            <template slot-scope="r"              >{{ getLabel(dict.type.sys_org_type, r.row.orgType) }}            </template>          </el-table-column>          <el-table-column            prop="orgName"            label="发布机构"            v-if="columns[3].visible"          ></el-table-column>          <el-table-column prop="status" label="状态" v-if="columns[4].visible">            <template slot-scope="r">              <span>{{ getLabel(dict.type.plan_status, r.row.status) }}</span>            </template>          </el-table-column>          <el-table-column            prop="remark"            label="备注"            v-if="columns[5].visible"          ></el-table-column>          <el-table-column label="操作">            <template slot-scope="r" v-if="orgId == r.row.orgId">              <el-button                size="mini"                type="text"                icon="el-icon-edit-outline"                @click="onEdit(r.row.id)"                v-hasPermi="['safetycheck:rule:edit']"                >编辑</el-button              >              <el-button                type="text"                size="small"                slot="reference"                icon="el-icon-delete"                @click="onDel(r.row.id)"                v-if="orgId == r.row.orgId"                v-hasPermi="['safetycheck:rule:remove']"                >删除</el-button              >            </template>          </el-table-column>        </el-table>        <pagination          v-show="total > 0"          :total="total"          :page.sync="queryParams.pageNum"          :limit.sync="queryParams.pageSize"          @pagination="getList"        />      </el-col>    </el-row>    <dialog-edit      ref="editDialog"      @success="getList()"      :orgTypeOptions="dict.type.sys_org_type"      :statusOptions="dict.type.plan_status"    ></dialog-edit>  </div></template><script>import OrgTree from "@/components/orgTree";import { mapGetters } from "vuex";import DialogEdit from "./dialog.edit";import * as api from "@/api/safetycheck/rule";import { getLabel } from "./../../commonOption";import { wholeTreeByType } from "@/api/system/org.js";export default {  name: "safetycheckruletype",  dicts: ["sys_org_type", "plan_status"],  components: {    DialogEdit,    OrgTree,  },  data() {    const { params, query } = this.$route;    return {      isShow: false,      loading: false,      ids: [],      // 非单个禁用      single: true,      // 非多个禁用      multiple: true,      // 显示搜索条件      showSearch: true,      total: 0,      queryParams: {        orgId: null,        name: null,        type: null,        orgType: null,        checkSub: true,        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"]),  },  methods: {    getLabel,    orgTree() {      return wholeTreeByType(3);    },    refresh() {      this.queryParams.pageNum = 1;      this.getList();    },    getList() {      this.loading = true;      console.info(this.dict.type);      api        .list(this.queryParams)        .then((response) => {          this.pageData = response.rows;          this.total = response.total;          this.loading = false;        })        .catch(() => {          this.loading = false;        });    },    getDefaultKey(key) {      this.queryParams.orgId = key;      this.getList();    },    handleAdd(id, other = {}) {      this.$refs.editDialog.show(id, other);    },    onEdit(id, other = {}) {      this.$refs.editDialog.show(id, other);    },    onDel(id) {      this.$modal        .confirm("确定删除检查内容库定义?")        .then(() => {          return api.remove(id);        })        .then(() => {          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.orgId = undefined;      // this.$refs.tree.setCurrentKey(null);      this.getList();    },    //单选框状态改变    checkChange(state) {      this.queryParams.checkSub = state;      this.getList();    },    // 节点单击事件    clickTreeNode(data) {      this.queryParams.orgId = data.id;      this.getList();    },    //apimark//  },  mounted() {},};</script><style lang="scss" scoped>.brand {}</style>
 |