index.vue 15.8 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424
<template>
  <!-- 应用信息 -->
  <div class="SystemInfo item-box common-info-box">
    <div class="item-title">应用信息</div>
    <div class="item-body">
      <div class="NCC-common-layout">
        <div class="NCC-common-layout-center">
          <el-row class="NCC-common-search-box" :gutter="5">
            <el-form @submit.native.prevent size="mini">
              <!-- <el-col :span="3">
                <el-form-item label="">
                  <el-input clearable v-model="query.keyword" placeholder="请输入应用名称、运营主体名称进行查询"/>
                </el-form-item>
              </el-col> -->
              <el-col :span="3" v-if="laderType != 0">
                <el-form-item label="">
                  <el-select v-model="query.areaId" placeholder="请选择所属区(市)县" clearable>
                    <el-option v-for="item in areaOptions" :key="item.id" :label="item.fullName" :value="item.id"/>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="3">
                <el-form-item label="">
                  <el-select v-model="query.systemType" placeholder="请选择应用类型" clearable @change="handleSystemTypeChange">
                    <el-option v-for="item in systemTypeOptions" :key="item.Id" :label="item.FullName" :value="item.Id"/>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="3">
                <el-form-item label="">
                  <el-select v-model="query.systemClass" placeholder="请选择应用分类" :disabled="!query.systemType" clearable>
                    <el-option v-for="item in systemClassOptions" :key="item.Id" :label="item.ClassName" :value="item.Id"/>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="3">
                <el-form-item label="">
                  <el-select v-model="query.specialRecordType" placeholder="请选择特殊备案类型" clearable>
                    <el-option v-for="item in specialRecordTypeOption" :key="item.id" :label="item.fullName" :value="item.id"/>
                  </el-select>
                </el-form-item>
              </el-col>
              <!-- <el-col :span="3">
                <el-form-item label="">
                  <el-input v-model="query.principalName" placeholder="请输入联系人" clearable/>
                </el-form-item>
              </el-col>
              <el-col :span="3">
                <el-form-item label="">
                  <el-input v-model="query.principalPhone" placeholder="请输入联系电话" clearable/>
                </el-form-item>
              </el-col> -->
              <el-col :span="3">
                <el-form-item>
                  <el-button type="primary" icon="el-icon-search" @click="search()" >搜索</el-button>
                  <el-button icon="el-icon-refresh-right" @click="reset()">重置</el-button>
                </el-form-item>
              </el-col>
            </el-form>
            <div class="NCC-common-search-box-right">
              <el-button type="primary" icon="el-icon-download" size="mini" @click="exportData('demo')">导出模板</el-button>
              <el-upload class="uploadXlax" :action="define.APIURl + '/api/Extend/basesysteminfo/Actions/ImportByExcel'" :headers="uploadHeaders" :on-success="uploadSuccess" :show-file-list="false" name="excelfile">
                <div class="avatar-box">
                  <el-button type="warning" icon="el-icon-upload" size="mini">导入</el-button>
                </div>
              </el-upload>
              <el-button type="primary" icon="el-icon-download" size="mini" @click="exportData()">导出</el-button>
            </div>
          </el-row>
          <div class="NCC-common-layout-main NCC-flex-main">
            <NCC-table v-loading="loading" :data="infoDataList">
              <el-table-column show-overflow-tooltip prop="companyName" label="运营主体名称" align="center">
                <template slot-scope="scope">{{ scope.row.companyName || scope.row.companyId }}</template>
              </el-table-column>
              <el-table-column show-overflow-tooltip prop="systemName" label="应用名称" align="center"/>
              <el-table-column label="应用类型" prop="systemType" align="left" show-overflow-tooltip>
                <template slot-scope="scope">{{ scope.row.systemType | dynamicTextUP(systemTypeOptions) }}</template>
              </el-table-column>
              <el-table-column label="特殊备案类型" prop="specialRecordType" align="left" show-overflow-tooltip>
                <template slot-scope="scope">{{ scope.row.specialRecordType | dynamicText(specialRecordTypeOption) }}</template>
              </el-table-column>
              <el-table-column label="应用分类" prop="systemClassStr" align="left" show-overflow-tooltip>
                <!-- <template slot-scope="scope">{{ scope.row.systemClass | dynamicTextUP(systemTypeOptions) }}</template> -->
              </el-table-column>
              <el-table-column show-overflow-tooltip prop="principalName" label="联系人" align="center"/>
              <el-table-column show-overflow-tooltip prop="principalPhone" label="联系电话" align="center"/>
              <el-table-column label="所属区(市)县" prop="areaId" align="left" show-overflow-tooltip>
                <template slot-scope="scope">{{ scope.row.areaId | dynamicText(areaOptions) }}</template>
              </el-table-column>
              <el-table-column label="操作" width="250">
                <!-- 查看,修改,归属地变更,上报 -->
                <template slot-scope="scope">
                  <infoForm class="btn_dialog" type="edit" :systemId="scope.row.id" @reInit="search">
                    <el-button size="mini" type="text">修改</el-button>
                  </infoForm>
                  <el-button size="mini" type="text" @click="toDetail(scope.row)">查看</el-button>
                  <el-button size="mini" type="text" @click="toChangeArea(scope.row)" >归属地变更</el-button>
                  <!-- <el-button size="mini" type="text" @click="toInspection(scope.row)" v-if="!isSHILevel">上报</el-button> -->
                  <!-- <el-button type="text" style="color: red;" @click="delNew(scope.row)" v-if="isSHILevel">删除</el-button> -->
                </template>
              </el-table-column>
            </NCC-table>
            <pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize" @pagination="initList"/>
          </div>
        </div>
        <el-dialog title="归属地变更" :visible.sync="areaChangeVisible" width="50%">
          <el-form :model="areaForm" :rules="areaRules" ref="areaForm" size="small" label-width="100px" v-loading="areaDialogLoading">
            <!-- <el-form-item label="市属" prop="city">
              <el-input v-model="areaForm.city" placeholder="请输入市属" maxlength="20"></el-input>
            </el-form-item> -->
            <el-form-item label="所属区县" prop="areaId">
              <el-radio-group v-model="areaForm.areaId" placeholder="请选择所属区县" style="line-height: 22px">
                <el-radio v-for="v in areaOptions" :key="v.id" :label="v.id">{{ v.fullName }}</el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item label="申请内容描述" prop="applnycontent">
              <el-input type="textarea" v-model="areaForm.applnycontent" placeholder="请输入申请内容描述" maxlength="300"></el-input>
            </el-form-item>
          </el-form>
          <span slot="footer" class="dialog-footer">
            <el-button @click="areaChangeVisible = false">取 消</el-button>
            <el-button type="primary" @click="areaSubmit" :loading="btnLoading">确 定</el-button>
          </span>
        </el-dialog>
        <InspectionForm v-if="InspectionFormVisible" ref="InspectionForm" @refresh="refresh"/>
        <ChangeRecord v-if="ChangeRecordVisible" ref="ChangeRecord"/>
        <DetailForm v-if="DetailFormVisible" :areaOptions="areaOptions" ref="DetailForm"/>
        <ExportBox v-if="ExportBoxVisible" ref="ExportBox" @download="download"/>
      </div>
    </div>
  </div>
</template>

<script>
import request from "@/utils/request";
import { getList } from "@/api/baseData/info";
import { applnyChageArea } from "@/api/baseData/info";
import infoMixin from "@/mixins/info";
import InspectionForm from "./InspectForm.vue";
import DetailForm from './DetailForm.vue';
import ChangeRecord from "./ChangeRecord.vue";
import ExportBox from "./ExportBox.vue";
import define from '@/utils/define'

export default {
  name: "SystemInfo",
  mixins: [infoMixin],
  components: { InspectionForm, ChangeRecord, DetailForm, ExportBox },
  data() {
    return {
      loading: false,
      uploadHeaders: { 
        Authorization: this.$store.getters.token,
        IsLogin: true,
      },
      query: {
        keyword: "",
        systemType: "",
        systemClass: "",
        principalName: "",
        principalPhone: "",
      },
      listQuery: {
        currentPage: 1,
        pageSize: 20,
        sort: "desc",
        sidx: "",
      },
      total: 0,
      infoDataList: [],

      //   归属地变更
      areaChangeVisible: false,
      areaDialogLoading: false,
      activeAreaId: "",
      areaForm: {
        city: '',
        areaId: "",
        applnycontent: "",
      },
      areaRules: {
        areaId: {
          required: true,
          message: "请输入所属区县",
          trigger: "change",
        },
      },
      activeSystemId: "",

      // 上报
      InspectionFormVisible: false,
      ChangeRecordVisible: false,
      btnLoading: false,

      // 详情
      DetailFormVisible: false,

      // 导出
      ExportBoxVisible: false,
      columnList: [
        { prop: "companyName", label: "主体企业" },
        { prop: "systemName", label: "应用名称" },
        { prop: "systemType", label: "应用类型" },
        { prop: "systemClass", label: "系统类型" },
        { prop: "principalName", label: "联系人" },
        { prop: "principalPhone", label: "联系电话" },
        { prop: "areaId", label: "所属区域" },
      ],
      specialRecordTypeOption: [],
    };
  },
  
  created() {
    this.initSpecialRecordTypeOption();
    this.initSystemTypeList();
    this.initAreaTypeList();
    this.initList();
  },
  mounted() {},
  computed: {
    isSHILevel() {
      // 判断角色是否为‘市级办公室’
      return this.$store.state.user.islader;
    },
    laderType() {
      return this.$store.state.user.laderType;
    }
  },
  watch: {
    $route: {
      handler: function (route) {
        this.query.keyword = route.query.keyword || "";
        this.initList();
      },
      immediate: true,
    },
  },
  methods: {
    uploadSuccess(response, file, fileList) {
      let type = response.code == 200 ? 'success' : 'error';
      this.$message({
          type: type,
          message: response.msg,
      });
      this.initList();
    },
    handleSystemTypeChange(val) {
      this.query.systemClass = "";
      this.initSystemClassList(val);
    },

    reset() {
      for (let key in this.query) {
        this.query[key] = undefined;
      }
      this.listQuery = {
        currentPage: 1,
        pageSize: 20,
        sort: "desc",
        sidx: "",
      };
      this.initList();
    },
    search() {
      this.listQuery = {
        currentPage: 1,
        pageSize: 20,
        sort: "desc",
        sidx: "",
      };
      this.initList();
    },
    initList() {
      this.loading = true;
      let query = {
        ...this.listQuery,
        ...this.query,
      };
      getList(query).then(({ data }) => {
        // let list = [];
        // data.list.length &&
        //   data.list.forEach((v) => {
        //     let obj = {
        //       companyName: v.compayInfo.CompanyName,
        //       systemName: v.SysytemInfo.SystemName,
        //       systemType: v.SysytemInfo.SystemType,
        //       systemClass: v.SysytemInfo.SystemClass,
        //       areaId: v.SysytemInfo.AreaId,
        //       principalName: v.SysytemInfo.PrincipalName,
        //       principalPhone: v.SysytemInfo.PrincipalPhone,
        //       Id: v.SysytemInfo.Id,
        //     };
        //     list.push(obj);
        //   });
        // this.infoDataList = list;
        // this.total = data.totalCount;
        this.total = data.pagination.total;
        this.infoDataList = data.list;
        this.loading = false;
      });
    },
    toDetail(row) {
      this.DetailFormVisible = true;
      this.$nextTick(() => {
        this.$refs.DetailForm.init(row);
      });
    },
    // 上报
    toInspection(row) {
      this.InspectionFormVisible = true;
      this.$nextTick(() => {
        this.$refs.InspectionForm.init(row);
      });
    },
    refresh(isrRefresh) {
      this.InspectionFormVisible = false;
      if (isrRefresh) this.reset();
    },
    async toChangeArea(row) {
      this.areaChangeVisible = true;
      this.areaDialogLoading = true;
      this.activeAreaId = row.areaId;
      this.areaForm.areaId = row.areaId;
      this.activeSystemId = row.id;
      await this.initAreaTypeList();
      this.areaDialogLoading = false;
    },
    areaSubmit() {
      if (this.activeAreaId == this.areaForm.areaId) return;
      this.btnLoading = true;
      applnyChageArea({
        id: this.activeSystemId,
        toChangeIntoId: this.areaForm.areaId,
        applnycontent: this.areaForm.applnycontent,
      }).then((res) => {
        this.btnLoading = false;
        this.areaChangeVisible = false;
        this.$message({
          message: res.msg,
          type: 'success'
        });
        this.initList();
      });
    },
    exportData(type) {
      let obj = {};
      if(type) {
        obj = {
          url: '/Extend/basesysteminfo/Actions/GenerateImportTemplate',
          method: "GET",
          responseType: 'blob',
        }
      } else {
        obj ={
          url: '/Extend/basesysteminfo/Actions/Export',
          method: "POST",
          data: this.query,
        }
      };
      request(obj).then((res) => {
        if(type) {
          const blob = new Blob([res], {type: 'application/json'});
          const url = window.URL.createObjectURL(blob);
          let link = document.createElement('a');
          link.style.display = 'none';
          link.href = url;
          link.download = '应用信息模板.xlsx';
          link.click();
        } else {
          if(res.code != 200) return;
          const url = define.APIURl + res.data.url;
          const link = document.createElement("a");
          link.href = url;
          link.download = res.data.name;
          link.click();
        }
      })
    },
    download(data) {
      let query = { ...data, ...this.listQuery, ...this.query };
      request({
        url: `/Extend/BasePrincipalResponsibility/Actions/Export`,
        method: "GET",
        data: query,
      }).then((res) => {
        if (!res.data.url) return;
        window.location.href = this.define.comUrl + res.data.url;
        this.$refs.ExportBox.visible = false;
        this.ExportBoxVisible = false;
      });
    },

    delNew(row) {
      this.$confirm('此操作将永久删除该系统, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(async () => {
        let res = await request({
          url: `/Extend/basesysteminfo/${row.id}`,
          method: "DELETE",
        });
        this.$message({
          message: res.msg,
          type: 'success'
        });
        this.initList();
      });
    },
  },
};
</script>
<style scoped lang="scss">
.common-info-box {
  :deep(.el-table__body-wrapper.is-scrolling-none) {
    height: calc(100% - 47px);
    overflow-y: scroll;
  }
}
.uploadXlax {
  display: inline-block;
  margin: 0 8px;
}
</style>