ZhangXianQiang
2024-05-24 aa05304d221b1883d746e686f390d6f3fba598a7
src/views/system/unit/index.vue
@@ -6,6 +6,7 @@
          v-model="queryParams.unitCode"
          placeholder="请输入单位编码"
          clearable
          @clear="handleQuery"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
@@ -14,6 +15,7 @@
          v-model="queryParams.unitName"
          placeholder="请输入单位名称"
          clearable
          @clear="handleQuery"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
@@ -21,7 +23,7 @@
        <el-date-picker
          v-model="daterangeCreateTime"
          style="width: 240px"
          value-format="yyyy-MM-dd"
          value-format="yyyy-MM-dd HH:mm:ss"
          type="daterange"
          range-separator="-"
          start-placeholder="开始日期"
@@ -42,7 +44,7 @@
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['system:unit:add']"
          v-hasPermi="['unit:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
@@ -53,7 +55,7 @@
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['system:unit:edit']"
          v-hasPermi="['unit:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
@@ -64,7 +66,7 @@
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['system:unit:remove']"
          v-hasPermi="['unit:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
@@ -74,7 +76,7 @@
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['system:unit:export']"
          v-hasPermi="['unit:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
@@ -88,21 +90,22 @@
      <el-table-column label="单位联系人电话" align="center" prop="unitContactPhone" />
      <el-table-column label="单位管理员账号" align="center" prop="unitAdminAccount" />
      <el-table-column label="备注" align="center" prop="remark" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
      <el-table-column label="添加时间" align="center" prop="createTime" />
      <el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['system:unit:edit']"
            v-hasPermi="['unit:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['system:unit:remove']"
            v-hasPermi="['unit:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
@@ -118,24 +121,24 @@
    <!-- 添加或修改运维单位对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
        <el-form-item label="单位编码" prop="unitCode">
          <el-input v-model="form.unitCode" placeholder="请输入单位编码" />
        </el-form-item>
        <el-form-item label="单位名称" prop="unitName">
          <el-input v-model="form.unitName" placeholder="请输入单位名称" />
        </el-form-item>
        <el-form-item label="单位账号" prop="unitAdminAccount">
          <el-input v-model="form.unitAdminAccount" placeholder="请输入单位管理员账号" :disabled="account" />
        </el-form-item>
        <el-form-item label="单位联系人" prop="unitContact">
          <el-input v-model="form.unitContact" placeholder="请输入单位联系人" />
        </el-form-item>
        <el-form-item label="单位联系人电话" prop="unitContactPhone">
        <el-form-item label="联系人电话" prop="unitContactPhone">
          <el-input v-model="form.unitContactPhone" placeholder="请输入单位联系人电话" />
        </el-form-item>
        <el-form-item label="单位管理员账号" prop="unitAdminAccount">
          <el-input v-model="form.unitAdminAccount" placeholder="请输入单位管理员账号" />
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input v-model="form.remark" placeholder="请输入备注" />
          <el-input v-model="form.remark" maxlength="100" show-word-limit rows="3" type="textarea" placeholder="备注信息" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
@@ -153,6 +156,8 @@
  name: "Unit",
  data() {
    return {
      // 账号不可修改
      account: true,
      // 遮罩层
      loading: true,
      // 选中数组
@@ -179,7 +184,8 @@
        pageSize: 10,
        unitCode: null,
        unitName: null,
        createTime: null,
        start: null,
        end: null,
      },
      // 表单参数
      form: {},
@@ -203,6 +209,19 @@
      }
    };
  },
  // computed: {
  //   unitAdminAccount:{
  //     get: function() {
  //       let value = this.form.unitCode ? this.form.unitCode + '_admin' : ""
  //       this.form.unitAdminAccount = value
  //       return value
  //     },
  //     set:function (newValue) {
  //       this.unitAdminAccount = newValue;
  //       this.form.unitAdminAccount = newValue
  //     }
  //   }
  // },
  created() {
    this.getList();
  },
@@ -210,13 +229,12 @@
    /** 查询运维单位列表 */
    getList() {
      this.loading = true;
      this.queryParams.params = {};
      // this.queryParams = {};
      if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) {
        this.queryParams.params["beginCreateTime"] = this.daterangeCreateTime[0];
        this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1];
        this.queryParams.start = this.daterangeCreateTime[0];
        this.queryParams.end = this.daterangeCreateTime[1];
      }
      listUnit(this.queryParams).then(response => {
        console.log(response)
        this.unitList = response.data;
        this.total = response.total;
        this.loading = false;
@@ -251,6 +269,8 @@
    /** 重置按钮操作 */
    resetQuery() {
      this.daterangeCreateTime = [];
      this.queryParams.start = null;
      this.queryParams.end = null;
      this.resetForm("queryForm");
      this.handleQuery();
    },
@@ -262,12 +282,14 @@
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.account = false;
      this.reset();
      this.open = true;
      this.title = "添加运维单位";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.account = true;
      this.reset();
      const id = row.id || this.ids
      getUnit(id).then(response => {
@@ -308,7 +330,7 @@
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('system/unit/export', {
      this.download('yw-unit/export', {
        ...this.queryParams
      }, `unit_${new Date().getTime()}.xlsx`)
    }