Infsea.vue 17.2 KB
Newer Older
liu committed
1 2 3 4 5 6 7 8 9
<template>
  <div class="eibs-tab">
    <el-form
      class="m-table-search-form"
      ref="paramsForm"
      :inline="true"
      label-position="right"
      label-width="110px"
      size="small"
10
      :rules="rules"
liu committed
11 12 13 14
    >
      <c-row>
        <c-col :span="24">
          <c-col :span="8">
15
            <el-form-item label="公告标题" prop="theme" style="width: 100%">
liu committed
16 17
              <c-input
                v-model="model.theme"
liu committed
18 19
                maxlength="20"
                placeholder="请输入标题名称"
liu committed
20 21 22 23 24 25 26 27 28 29 30 31
              ></c-input>
            </el-form-item>
          </c-col>
          <c-col :span="8">
            <el-form-item
              label="创建时间"
              prop="opndatfrom"
              style="width: 100%"
            >
              <c-col :span="11">
                <c-date-picker
                  type="date"
32
                  v-model="model.opndatfrom"
liu committed
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
                  style="width: 100%"
                  placeholder="请选择"
                ></c-date-picker>
              </c-col>
              <c-col :span="2" style="text-align: center">
                <label style="display: inline-block; width: 100%">-</label>
              </c-col>
              <c-col :span="11">
                <c-date-picker
                  type="date"
                  v-model="model.opndatto"
                  style="width: 100%"
                  placeholder="请选择"
                ></c-date-picker>
              </c-col>
            </el-form-item>
          </c-col>
          <c-col :span="8">
            <el-form-item label="发布机构" prop="unit" style="width: 100%">
              <c-input
                v-model="model.unit"
                maxlength="40"
                placeholder="请输入机构名称"
              ></c-input>
            </el-form-item>
          </c-col>
        </c-col>
      </c-row>

62 63
      <!-- </template> -->
      <c-col :span="24" style="text-align: right; height: 36.8px">
liu committed
64 65 66 67 68 69 70 71 72 73 74 75 76 77
        <el-button size="small" @click="handleReset">重置</el-button>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="small"
          @click="handleSearch"
          >查询</el-button
        >
      </c-col>
    </el-form>
    <c-col :span="24">
      <div style="border-bottom: 10px solid rgb(232, 232, 232)"></div>
    </c-col>

78 79 80 81 82 83 84 85
    <c-col :span="24" style="margin: 10px 0px">
      <c-button
        class="medium_bcs"
        size="medium"
        type="primary"
        style="margin-left: 0px"
        @click="ruleAdd()"
        >添加公告</c-button
liu committed
86 87 88 89 90 91 92 93 94 95 96
      >
    </c-col>

    <c-col :span="24">
      <!-- <c-istream-table :list="stmData.data" :columns="stmData.columns"> -->
        <el-table
         :border="true"
        :data="stmData.data.slice((currentPage - 1) * pagesize, currentPage * pagesize)"
        
      
        style="width:80%,text-align:center" :header-cell-style="{background:'rgb(235, 235, 235)',color:'#000'}" >
zhoutian committed
97
        <!-- <el-table-column  label="编号"  prop="tid" width="200px"  >
liu committed
98
         
zhoutian committed
99
        </el-table-column> -->
liu committed
100 101 102
        <el-table-column  label="标题"  prop="theme" width="400px"  >
        
        </el-table-column>
103 104

        <el-table-column label="发布机构" prop="unit" width="200px">
zhoutian committed
105 106 107
        </el-table-column>
        <el-table-column  label="发布人" prop="pubname" width="200px"   >
          
liu committed
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
        </el-table-column>
        
        <el-table-column  label="时间"  prop="dat" width="200px "   >
          
        </el-table-column>
        <el-table-column fixed="right" prop="op" label="操作" width="200px">
          <template slot-scope="scope">
            <c-button
              style="margin-left: 0"
              size="small"
              @click="ruleDetail(scope)"
            >
              详情
            </c-button>

            <c-button
              style="margin-left: 0"
              size="small"
              type="primary"
              @click="ruleEdit(scope)"
            >
              编辑
            </c-button>
            <c-button
              style="margin-left: 0"
              size="small"
              type="primary"
              @click="ruleDel(scope.$index)"
            >
              删除
            </c-button>
          </template>
        </el-table-column>
141
      </el-table>
liu committed
142
      <el-pagination
143 144 145 146 147 148 149 150 151 152 153
        style="margin: 12px 0px"
        background
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage"
        :page-sizes="[2, 4, 6, 8]"
        :page-size="pagesize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="stmData.data.length"
      >
      </el-pagination>
liu committed
154 155 156

      <!-- </c-istream-table> -->
    </c-col>
157 158 159 160 161 162
    <el-dialog
      :visible.sync="showPanel"
      :title="opttitle"
      append-to-body
      :before-close="cancel"
    >
liu committed
163 164 165 166 167 168 169
      <el-form
          class="m-table-search-form"
          ref="paramsForm"
          :inline="true"
          label-position="right"
          label-width="110px"
          size="small"
zhoutian committed
170 171
          :rules="rules"
        >  
liu committed
172 173 174 175 176 177 178
          <c-row>
            <c-col :span="24">
              <c-col :span="24">
                <c-input v-if="showIndex" style="visibility: hidden" v-model="model.edit.index" ></c-input>
                    
                        
                              <el-form-item label="标题:"  prop="edit.theme" style="width: 100%">
zhoutian committed
179
                                   <c-input
liu committed
180 181 182 183
                                  v-model="model.edit.theme"
                                   maxlength="200" 
                                   placeholder="请输入标题内容"
                                   :disabled="isDetail"
zhoutian committed
184
                                   @keyup.enter.native="defaultFunction('edit.theme',model.edit.theme)"
liu committed
185 186 187 188 189 190 191 192 193 194 195 196
                                   ></c-input>
                              </el-form-item>
                        
                    </c-col>
                    <c-col :span="24">

                              <el-form-item label="发布机构:" prop="edit.unit" style="width: 100%" >
                                   <c-input 
                                  v-model="model.edit.unit"
                                   maxlength="20" 
                                   placeholder="请输入机构名称"
                                   :disabled="isDetail"
zhoutian committed
197
                                    @keyup.enter.native="defaultFunction('edit.unit',model.edit.unit)"
liu committed
198 199 200 201 202
                                   ></c-input>
                              </el-form-item>
                    </c-col>
                    <c-col :span="24">

203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
            <c-col :span="24">
              <el-form-item
                label="公告内容:"
                prop="edit.content"
                style="width: 100%"
              >
                <c-input
                  v-model="model.edit.content"
                  type="textarea"
                  rows="20"
                  maxlength="2000"
                  show-word-limit
                  placeholder="请输入公告内容"
                  :disabled="isDetail"
                >
                </c-input>
              </el-form-item>
            </c-col>
liu committed
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236

                              <el-form-item label="发布时间:" prop="edit.dat" style="width: 50%">
                               <c-date-picker
                                   type="date"
                                   v-model="model.edit.dat"
                                   value-format="yyyy-MM-dd"
                                   placeholder="请选择时间"
                                   disabled
                              >
                              </c-date-picker>

                              </el-form-item>
                    </c-col>
                    <c-col :span="24">

                     <el-form-item label="可见范围:" prop="edit.visunit" style="width: 100%" >
zhoutian committed
237
                                <!-- <c-select
liu committed
238 239 240 241 242 243 244 245 246 247 248 249 250
                                  v-model="model.edit.visunit"
                                  style="width: 100%"
                                  placeholder="请选择可见范围"
                                  :disabled="isDetail"
                                >
                                  <el-option
                                    v-for="item in range"
                                     :key="item.value"
                                     :label="item.label"
                                     :value="item.value"
                                    
                                  >
                                  </el-option>
zhoutian committed
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267
                               </c-select> -->
                               <c-checkbox-group v-model="model.edit.visunit"
                                  style="width: 100%"
                                  placeholder="请选择可见范围"
                                  :disabled="isDetail">
                                    <el-checkbox label="总行"></el-checkbox>
                                    <el-checkbox label="分行"></el-checkbox>
                                    <br/>
                                    <el-checkbox label="上海总行"></el-checkbox>
                                    <el-checkbox label="北京总行"></el-checkbox>
                                    <el-checkbox label="广州总行"></el-checkbox>
                                    <el-checkbox label="深圳总行"></el-checkbox>
                                    <el-checkbox label="上海分行"></el-checkbox>
                                    <el-checkbox label="北京分行"></el-checkbox>
                                    <el-checkbox label="广州分行"></el-checkbox>
                                    <el-checkbox label="深圳分行"></el-checkbox>
                               </c-checkbox-group>
liu committed
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
                             </el-form-item>
                    </c-col>

                    <c-col :span="24">

                             <el-form-item label="公告内容:" prop="edit.content" style="width: 100%" >

                             <c-input 
                                        v-model="model.edit.content"
                                        type="textarea" 
                                        rows ="20"
                                        maxlength="2000" 
                                        show-word-limit 
                                        placeholder="请输入公告内容"
                                        :disabled="isDetail"
                                         >
                             </c-input>
                             </el-form-item>
                           
                    </c-col>
              </c-col>

          <c-col
            :span="24"
            style="text-align: center; height: 36.8px"
          >
            <el-button
              type="primary"
              size="small"
              @click="submitData"
              v-if="optType"
              >提交</el-button
            >
            <el-button style="margin-left: 0" size="small" @click="cancel">
              返回
            </el-button> 
          </c-col>
zhoutian committed
305
          </c-row>
liu committed
306 307 308 309 310 311 312 313 314
        </el-form>
    </el-dialog>
  </div>
</template>
<script>
import Api from "~/service/Api";
import commonProcess from "~/mixin/commonProcess";
import CodeTable from "~/config/CodeTable";
import Event from "~/model/Notice/Event";
zhoutian committed
315 316
import { my,noticeQuery} from "~/service/notice";

liu committed
317 318
export default {
  inject: ["root"],
319
  props: ["model", "rules"],
liu committed
320 321 322 323 324
  mixins: [commonProcess],
  components: {},
  data() {
    return {
      showPanel: false,
325 326
      opttitle: "",
      optType: true,
liu committed
327
      dialogTableVisible: false,
328 329 330
      isDetail: true,
      showIndex: false,
      nowDate: "",
liu committed
331 332

      currentPage: 1, //初始页
liu committed
333
      pagesize: 6, //    每页的数据
liu committed
334 335
      total: 0,

336
      indexNum: 0, //定义一级菜单的下标
liu committed
337
      trnData: {
338
        columns: ['1 1 "附加条款内容文本" 300', '2 2 "智能审单规则" 500'],
liu committed
339 340 341
        data: [],
      },
      stmData: {
342
        columns: ['1 1 "标题" 400', '2 2 "发布机构" 400', '3 3 "发布时间" 200'],
liu committed
343 344
        data: [],
      },
345
      range: [
liu committed
346
        {
347 348
          value: "all",
          label: "所有机构可见",
liu committed
349 350
        },
        {
351 352
          value: "under",
          label: "下属机构可见",
liu committed
353 354
        },
        {
355 356 357
          value: "sl",
          label: "平级机构可见",
        },
liu committed
358
      ],
zhoutian committed
359
      
liu committed
360 361 362 363 364 365
     
    };
  },
  methods: {
    ...Event,

366 367 368 369 370 371 372 373
    ruleDetail(scope) {
      this.model.edit.theme = scope.row.theme;
      this.model.edit.unit = scope.row.unit;
      this.model.edit.dat = scope.row.dat;
      this.model.edit.pubname = scope.row.pubname;
      this.model.edit.content = scope.row.content;
      this.model.edit.index = scope.row.tid;
      this.model.edit.visunit = scope.row.visunit;
liu committed
374 375 376 377 378
      this.isDetail = true;
      this.opttitle = "公告详情";
      this.optType = false;
      this.showPanel = true;
    },
379 380 381 382 383 384 385 386

    ruleEdit(scope) {
      this.model.edit.theme = scope.row.theme;
      this.model.edit.unit = scope.row.unit;
      this.model.edit.dat = scope.row.dat;
      this.model.edit.pubname = scope.row.pubname;
      this.model.edit.content = scope.row.content;
      this.model.edit.visunit = scope.row.visunit;
liu committed
387 388 389 390 391
      this.isDetail = false;
      this.opttitle = "公告修改";
      this.optType = true;
      this.showPanel = true;
    },
392
    ruleAdd() {
liu committed
393 394
      this.model.edit.dat = this.nowDate;

395
      this.isDetail = false;
liu committed
396 397 398 399
      this.opttitle = "公告新增";
      this.optType = true;
      this.showPanel = true;
    },
400 401
    ruleDel(idx) {
      this.stmData.data.splice(idx, 1);
liu committed
402
    },
403
    changeMod() {
liu committed
404
      let i = 0;
405 406
      for (i = 0; i < this.select01.length; i++) {
        if (this.select01[i].value == this.model.edit.mod) {
liu committed
407
          this.indexNum = i;
408
          break;
liu committed
409 410 411 412
        }
      }
      this.select02 = this.select01[this.indexNum].obj;
    },
413 414 415 416 417 418 419
    chooseField() {
      this.model.edit.ruleInfo =
        this.model.edit.ruleInfo +
        "{" +
        this.model.edit.mod +
        this.model.edit.field +
        "}";
liu committed
420
    },
421
    submitData() {
liu committed
422 423
      const length = this.stmData.data.length;
      let btnStr = this.stmData.data;
424 425 426
      let str;
      if (this.model.edit.index == "") {
        //新增
liu committed
427
        let max = 0;
428
        for (let i = 0; i < length; i++) {
liu committed
429
          //获取数组中每行的数据
430 431
          let arr = btnStr[i];
          if (arr[0] > max) {
liu committed
432
            max = arr[0];
433
          }
liu committed
434 435
        }
        max++;
zhoutian committed
436 437
        var newObj={"edit.theme":this.model.edit.theme,"edit.unit":this.model.edit.unit,
        "edit.pubname":this.model.edit.pubname,"edit. dat":this.model.edit. dat,"edit. content":this.model.edit. content,}
liu committed
438 439 440
        
        // str = max +'\t' + this.model.edit.theme + '\t' + this.model.edit.unit + '\t' + this.model.edit.dat + '\t'+ +  'mbf'; 
       
zhoutian committed
441 442
        //this.stmData.data.splice(length,0,newObj);
        this.stmData.data.push(newObj);
liu committed
443 444 445 446 447 448
        console.log(this.stmData.data);
      }
      // else{  //修改
      //   let num = 0;
      //   for(let i=0;  i < length; i++){
      //     //获取数组中每行的数据
449
      //     let arr = btnStr[i].split("\t");
liu committed
450
      //     if(arr[0] == this.model.edit.index ) {
451
      //       str = arr[0]+'\t' + this.model.edit.ruleDesc + '\t' + this.model.edit.ruleInfo + '\t' + arr[3] + '\t' +  arr[4];
liu committed
452 453
      //       num = i;
      //       break;
454
      //     }
liu committed
455 456 457 458
      //   }
      //   this.stmData.data.splice(num,1,str);
      // }
      // this.$store.commit('setCheckRuleData', this.stmData.data)
459 460 461 462 463 464
      this.model.edit.theme = "";
      this.model.edit.unit = "";
      this.model.edit.pubname = "";
      this.model.edit.dat = "";
      this.model.edit.content = "";
      this.model.edit.index = "";
liu committed
465 466
      this.showPanel = false;
    },
467 468 469 470 471 472 473
    cancel() {
      this.model.edit.theme = "";
      this.model.edit.unit = "";
      this.model.edit.pubname = "";
      this.model.edit.dat = "";
      this.model.edit.content = "";
      this.model.edit.index = "";
liu committed
474 475
      this.showPanel = false;
    },
zhoutian committed
476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491
    handleReset() {
      this.model.theme='';
      this.model.opndatto = '';
      this.model.opndatfrom='';
      this.model.unit='';   
    },
    handleSearch(){
       noticeQuery({
          "theme":this.model.theme,
          "opndatfrom":this.model.opndatfrom,
          "opndatto":this.model.opndatto,
          "unit":this.model.unit  
        }).then(res=>{
           this.stmData.data=res
        })
    },
liu committed
492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507
    handleSizeChange: function (size) {
      this.pagesize = size;
      console.log(this.pagesize); //每页下拉显示数据
    },
    handleCurrentChange: function (currentPage) {
      this.currentPage = currentPage;
      console.log(this.currentPage); //点击第几页
    },
  },
  created: function () {
    //  this.stmData.data = this.$store.state.Status.checkRuleData;
    let date = new Date();
    let year = date.getFullYear();
    let month = date.getMonth() + 1;
    let day = date.getDate();
    this.nowDate = year + '-' + month + '-' + day;
zhoutian committed
508 509
    // this.model.opndatfrom = this.nowDate;
    // this.model.opndatto = this.nowDate;
liu committed
510 511 512 513 514 515 516 517 518 519 520 521
    my().then(res => {
         
          this.stmData.data=res
          
      })
  },
};
</script>
<style>
.el-dialog__body {
  padding: 10px 5px 50px;
}
522
.m-table-search-form {
liu committed
523 524 525 526 527 528
  position: flex;
  flex-direction: row;
}
.m-table-search-form .el-form-item__content {
  width: calc(100% - 110px);
}
529 530

</style>