Infsea.vue 14 KB
Newer Older
fukai committed
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
<template>
  <div class="eibs-tab">
    <!-- ----------左 ---------->
    <c-col :span="12" class="col-left">
      <c-col :span="24">
        <el-form-item :label="$t('statics.参数代码')" prop="cod">
          <c-input v-model="model.cod" style="width: 100%" >
          </c-input>
        </el-form-item>
      </c-col>
    </c-col>
    <c-col :span="12" class="col-left">
      <c-col :span="24">
        <el-form-item :label="$t('statics.参数描述')" prop="cod">
          <c-input v-model="model.description"  filterable></c-input>
        </el-form-item>
      </c-col>
    </c-col>

    <c-col :span="24">
      <span style="float: left">
        <el-button type="primary" size="small" ref="paramInsertBtn" v-if="showInsertBtn" @click="paramAdd">{{$t('statics.新增')}}</el-button>
      </span>
      <span style="float: right">
        <el-button size="small" @click="handleReset">{{$t('statics.重置')}}</el-button>
        <el-button type="primary" icon="el-icon-search" size="small" :loading="searchLoading" @click="onSearch()">{{$t('statics.查询')}}
        </el-button>
      </span>
    </c-col>

    <c-col :span="24">
      <c-paging-table :data="paramData" :columns="paramColumns" :pageNumber="model.pageNum" :pageSize="model.pageSize"
        :total="model.total" v-on:queryFunc="queryFunc" :border="true" @sort-change="sortChange" sortable="custom">
        <c-table-column fixed="right" prop="op" :label="$t('statics.操作')" width="240px">
          <template slot-scope="{ scope }">
            <c-button style="margin-left: 5px" size="small" type="" ref="paramDisplayBtn" @click="paramInfo(scope.row)">
              {{$t('statics.详情')}}</c-button>
            <c-button style="margin-left: 5px" size="small" type="primary" v-if="showUpdateBtn" ref="paramUpdateBtn"
              @click="paramEdit(scope.row)">{{$t('statics.修改')}}</c-button>
            <c-button size="small" style="margin-left: 5px" type="primary" v-if="showDeleteBtn" ref="paramDeleteBtn"
              @click="paramDelete(scope.row)">{{$t('statics.删除')}}</c-button>
          </template>
        </c-table-column>
      </c-paging-table>
    </c-col>

    <el-dialog :title="$t('statics.' + dialogNam[operaTyp])" :visible.sync="dialogFlg" :modal-append-to-body="false"
      :close-on-click-modal="false" width="70%">
      <el-form :model="dataForm" :rules="rules" ref="dataForm" label-suffix=":" :disabled="isDisabled">
        <c-col :span="24" style="padding-right: 20px;">

          <c-col :span="20">
            <el-form-item :label="$t('statics.参数代码')" :label-width="formLabelWidth" prop="cod">
              <c-input v-model="dataForm.cod" autocomplete="off" :disabled="operaTyp == 'edit'">
              </c-input>
            </el-form-item>
          </c-col>

          <c-col :span="20">
            <el-form-item :label="$t('statics.参数描述')" :label-width="formLabelWidth" prop="description">
              <c-input v-model="dataForm.description" autocomplete="off" :isCache="false"></c-input>
            </el-form-item>
          </c-col>

           <c-col :span="20">
            <el-form-item :label="$t('statics.参数值')" :label-width="formLabelWidth" prop="value">
              <c-input v-model="dataForm.value" autocomplete="off" placeholder="请输入参数值" >
              </c-input>
            </el-form-item>
          </c-col>

           <c-col :span="20">
            <el-form-item :label="$t('statics.状态')" :label-width="formLabelWidth" prop="state">
              <c-select v-model="dataForm.state" autocomplete="off" placeholder="请输入参数值" dbCode="state"  clearable >
              </c-select>
            </el-form-item>
          </c-col>

          <c-col :span="20">
            <el-form-item :label="$t('statics.扩展信息1')" :label-width="formLabelWidth" prop="extfield2">
              <c-input v-model="dataForm.extfield1" autocomplete="off" placeholder="请输入扩展信息" >
              </c-input>
            </el-form-item>
          </c-col>

          <c-col :span="20">
            <el-form-item :label="$t('statics.扩展信息2')" :label-width="formLabelWidth" prop="extfield2">
              <c-input v-model="dataForm.extfield2" autocomplete="off" placeholder="请输入扩展信息" >
              </c-input>
            </el-form-item>
          </c-col>

          <c-col :span="20">
            <el-form-item :label="$t('statics.扩展信息3')" :label-width="formLabelWidth" prop="extfield3">
              <c-input v-model="dataForm.extfield3" autocomplete="off" placeholder="请输入扩展信息" >
              </c-input>
            </el-form-item>
          </c-col>
        </c-col>
        

      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="commitAdd" v-if="operaTyp == 'add'">{{$t('statics.提 交')}}</el-button>
        <el-button type="primary" @click="commitEdit" v-if="operaTyp == 'edit'">{{$t('statics.提 交')}}</el-button>
        <el-button @click="dialogFlg = false" v-if="operaTyp != 'info'">{{$t('statics.取 消')}}</el-button>
        <el-button @click="dialogFlg = false" v-if="operaTyp == 'info'">{{$t('statics.返 回')}}</el-button>
      </div>

    </el-dialog>

  </div>
</template>

<script>
  import codes from "~/config/CodeTable";
  import Param, {
    Pattern
  } from "./Param.js";

  import commonFunctions from "~/mixin/commonFunctions.js";
  import Api from "~/service/Api";

  export default {
    mixins: [commonFunctions],
    props: ["data"],
    inject: ["root"],
    data() {
      return {
        rules: Pattern,
        model: new Param().data,

        paramData: [],
        paramColumns: [{
            label: '参数代码',
            prop: 'cod',
            width: 'auto'
          },
          {
            label: '参数值',
            prop: 'value',
            width: 'auto'
          },
          {
            label: '参数描述',
            prop: 'description',
            width: 'auto'
          },
          {
            label: '参数状态',
            prop: 'state',
            width: 'auto'
          },
         
         
        ],

        dataForm: new Param().data,
        dialogNam: {
          'add':  '系统参数--新增',
          'edit': '系统参数--修改',
          'info': '系统参数--详情',
        },
        operaTyp: "",
        isDisabled: false,
        showDisplayBtn: true,
        showInsertBtn: true,
        showUpdateBtn: true,
        showDeleteBtn: true,
        dialogFlg: false,
        formLabelWidth: "150px",
        searchLoading: false,
      };
    },

    //初始化查询
    created() {
     
    },

    activated() {
      
    },
    mounted() {
      //this.getHiddenButtonVue();
    },
    computed: {
    
    },
    methods: {
      getHiddenButtonVue() {
        const loading = this.loading();
        this.$buttonControlService.hiddenBtnList()
          .then((res) => {
            // 【详情】按钮
            let hasDisplay = res.some((item) => {
              return item.ITEMID === 'paramDisplayBtn';
            })
            if (hasDisplay) {
              this.showDisplayBtn = false;
            } else {
              this.showDisplayBtn = true;
            }

            // 【新增】按钮
            let hasInsert = res.some((item) => {
              return item.ITEMID === 'paramInsertBtn';
            })
            if (hasInsert) {
              this.showInsertBtn = false;
            } else {
              this.showInsertBtn = true;
            }
            // 【修改】按钮
            let hasUpdate = res.some((item) => {
              return item.ITEMID === 'paramUpdateBtn';
            })
            if (hasUpdate) {
              this.showUpdateBtn = false;
            } else {
              this.showUpdateBtn = true;
            }
            // 【删除】按钮
            let hasDelete = res.some((item) => {
              return item.ITEMID === 'paramDeleteBtn';
            })
            if (hasDelete) {
              this.showDeleteBtn = false;
            } else {
              this.showDeleteBtn = true;
            }
            loading.close();
          }).catch(() => {
            loading.close();
          })
      },

     

      handleReset() {
        //this.root.$refs.modelForm.resetFields();
        this.model.cod = "";
        this.model.description = "";
        
      },

      onSearch() {
        this.model.pageSize = PageSize;
        this.model.pageNum = 1;
        this.onDblparamSearch();
      },

      onDblparamSearch() {
        this.searchLoading = true;
fukai committed
255
        Api.post('/admin/sysparam/listSysparm',this.model).then(res => {
fukai committed
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
          if (res.respCode == SUCCESS) {
            const list = res.data.list
            this.paramData = list
            this.model.pageNum = res.data.pageNumber
            this.model.pageSize = res.data.pageSize
            this.model.total = res.data.total
            this.searchLoading = false;
          } else {
            this.searchLoading = false;
            this.$notify.error("查询失败");
          }
        })
      },
      queryFunc(pageNumber, pageSize) {
        this.model.pageNum = pageNumber
        this.model.pageSize = pageSize
        this.onDblparamSearch()
      },

      //新增弹窗
      paramAdd() {
        this.isDisabled = false;
        this.operaTyp = "add";
        this.dialogFlg = true;
        this.dataForm = new Param().data;
      },
      //新增提交
      commitAdd() {
        this.$refs['dataForm'].validate((valid) => {
          if (valid) {
fukai committed
286
            Api.post('/admin/sysparam/addSysparm',this.dataForm)
fukai committed
287 288
              .then((res) => {
                if (res.respCode == "AAAAAA" || res.respCode == "AAAAAA") {
fukai committed
289
                  this.$notify.success(this.$t('statics.添加成功!'));
fukai committed
290 291 292 293
                  
                  this.dialogFlg = false;
                  this.onDblparamSearch();
                } else {
fukai committed
294
                  this.$notify.error(this.$t('statics.添加失败!'));
fukai committed
295 296 297 298
                }

              })
              .catch((err) => {
fukai committed
299
                this.$notify.error(this.$t('statics.添加失败!'));
fukai committed
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316
              });
          } else {
            this.$notify.error({
              title: '失败',
              message: '请检查必输项!'
            });
          }
        });
      },

      //查看弹窗
      paramInfo(row) {
        let tmp=row;
        console.log("-------",row)
        console.log("-------",tmp)
        let id=row.id
        console.log("-------",row.id)
fukai committed
317
        Api.post('/admin/sysparam/detailSysparm',{"id":row.id})
fukai committed
318 319 320 321 322 323 324 325 326 327 328 329 330
          .then((res) => {
            this.isDisabled = true;
            this.operaTyp = "info"
            this.dataForm = res.data;
            this.dialogFlg = true;
          })
          .catch((err) => {
            this.$notify.error("数据查询失败");
          });
      },
      //修改弹窗
      paramEdit(row) {

fukai committed
331
        Api.post('/admin/sysparam/detailSysparm',{"id":row.id})
fukai committed
332 333 334 335 336 337 338 339 340 341 342 343 344
          .then((res) => {
            this.isDisabled = false;
            this.dataForm = res.data;
            this.operaTyp = "edit"
            this.dialogFlg = true;
          })
          .catch((err) => {
            this.$notify.error("数据查询失败");
          });
      },
      commitEdit() {
        this.$refs['dataForm'].validate((valid) => {
          if (valid) {
fukai committed
345
            Api.post('/admin/sysparam/updateSysparm',this.dataForm)
fukai committed
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
              .then((res) => {
            
                if (res.errorCode == "AAAAAA" || res.respCode == "AAAAAA") {
                  this.$notify.success("修改成功!");
                  
                  this.dialogFlg = false;
                  this.onDblparamSearch();
                } else {
                  this.$notify.error("修改失败!");
                }

              })
              .catch((err) => {
                this.$notify.error("修改失败!");
              });
          } else {
            this.$notify.error(validMsg);
            return false;
          }
        });
      },

      paramDelete(row) {
        this.$confirm("是否确认删除?", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning",
          })
          .then(() => {
fukai committed
375
            Api.post('/admin/sysparam/deleteSysparm',{"id":row.id})
fukai committed
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 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460
              .then((res) => {
                if (res.errorCode == "AAAAAA" || res.respCode == "AAAAAA") {
                  this.$notify.success("删除成功!");
                  
                  this.dialogFlg = false;
                  this.onDblparamSearch();
                } else {
                  this.$notify.error("删除失败!");
                }

              })
              .catch((err) => {
                this.$notify.error("删除失败.!");
              });
          })
          .catch(() => {
            this.$message({
              type: "info",
              message: "已取消删除",
            });
          });
      },

     

     

      //全量排序
      sortChange(obj) {
        let order = obj.order === 'descending' ? 'desc' : 'asc';
        let prop = obj.prop;
        let column = "";
        switch (prop) {
          case 'cod':
            column = "A.COD";
            break;
          case 'cur':
            column = "A.CUR";
            break;
          case 'reg':
            column = "A.REG";
            break;
          case 'bopcod':
            column = "A.BOPCOD";
            break;
          case 'txtBopparam':
            column = "B.TXT";
            break;
          case 'paramnam':
            column = "paramnam";
            break;
        }
        let orderObj = {
          order: order,
          column: column
        }
        this.model.orderStr = orderObj.order;
        this.model.columnStr = orderObj.column;

        this.onDblparamSearch()
      },

    },

  };
</script>

<style scoped>
  .table-button-item-list {
    padding: 0;
    margin: 0;
  }

  .table-button-item-list li {
    list-style: none;
    padding: 5px 0;
    text-align: center;
    color: #606266;
    cursor: pointer;
  }

  .el-dialog {
    min-height: 70%;
  }
</style>