IndexTask.vue 10.3 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
<template>
  <div class="index-container-ty">
    <a-row type="flex" justify="start" :gutter="3">
      <a-col :sm="24" :lg="12">
        <a-card>
          <template #title>
            <div class="index-md-title">
              <img src="../../../../assets/images/daiban.png" />
              我的待办【{{ dataSource1.length }}】
            </div>
          </template>

          <template v-if="dataSource1 && dataSource1.length > 0" #extra>
            <a @click="goPage"
              >更多
              <Icon icon="ant-design:double-right-outlined" />
            </a>
          </template>

          <a-table
            :class="'my-index-table tytable1'"
            ref="table1"
            size="small"
            rowKey="id"
            :columns="columns"
            :dataSource="dataSource1"
            :pagination="false"
          >
            <template #ellipsisText="{ text }">
              <JEllipsis :value="text" :length="textMaxLength"></JEllipsis>
            </template>

            <template #dayWarnning="{ text, record }">
              <BellTwoTone style="font-size: 22px" :twoToneColor="getTipColor(record)" />
            </template>

            <template #action="{ text, record }">
              <a @click="handleData">办理</a>
            </template>
          </a-table>
        </a-card>
      </a-col>

      <a-col :sm="24" :lg="12">
        <a-card>
          <template #title>
            <div class="index-md-title">
              <img src="../../../../assets/images/zaiban.png" />
              我的在办【{{ dataSource2.length }}】
            </div>
          </template>

          <template v-if="dataSource2 && dataSource2.length > 0" #extra>
            <a @click="goPage"
              >更多
              <Icon icon="ant-design:double-right-outlined" />
            </a>
          </template>

          <a-table
            :class="'my-index-table tytable2'"
            ref="table1"
            size="small"
            rowKey="id"
            :columns="columns"
            :dataSource="dataSource2"
            :pagination="false"
          >
            <template #ellipsisText="{ text }">
              <JEllipsis :value="text" :length="textMaxLength"></JEllipsis>
            </template>

            <template #dayWarnning="{ text, record }">
              <BellTwoTone style="font-size: 22px" :twoToneColor="getTipColor(record)" />
            </template>

            <template #action="{ text, record }">
              <a @click="handleData">办理</a>
            </template>
          </a-table>
        </a-card>
      </a-col>

      <a-col :span="24">
        <div style="height: 5px"></div>
      </a-col>

      <a-col :sm="24" :lg="12">
        <a-card>
          <template #title>
            <div class="index-md-title">
              <img src="../../../../assets/images/guaz.png" />
              我的挂账【{{ dataSource4.length }}】
            </div>
          </template>

          <a-table
            :class="'my-index-table tytable4'"
            ref="table1"
            size="small"
            rowKey="id"
            :columns="columns"
            :dataSource="dataSource4"
            :pagination="false"
          >
            <template #ellipsisText="{ text }">
              <JEllipsis :value="text" :length="textMaxLength"></JEllipsis>
            </template>

            <template #dayWarnning="{ text, record }">
              <BellTwoTone style="font-size: 22px" :twoToneColor="getTipColor(record)" />
            </template>

            <template #action="{ text, record }">
              <a @click="handleData">办理</a>
            </template>
          </a-table>
        </a-card>
      </a-col>

      <a-col :sm="24" :lg="12">
        <a-card>
          <template #title>
            <div class="index-md-title">
              <img src="../../../../assets/images/duban.png" />
              我的督办【{{ dataSource3.length }}】
            </div>
          </template>

          <a-table
            :class="'my-index-table tytable3'"
            ref="table1"
            size="small"
            rowKey="id"
            :columns="columns"
            :dataSource="dataSource3"
            :pagination="false"
          >
            <template #ellipsisText="{ text }">
              <JEllipsis :value="text" :length="textMaxLength"></JEllipsis>
            </template>

            <template #dayWarnning="{ text, record }">
              <BellTwoTone style="font-size: 22px" :twoToneColor="getTipColor(record)" />
            </template>

            <template #action="{ text, record }">
              <a @click="handleData">办理</a>
            </template>
          </a-table>
        </a-card>
      </a-col>
    </a-row>
  </div>
</template>

<script lang="ts" setup>
  import { ref } from 'vue';
  import noDataPng from '/@/assets/images/nodata.png';
  import { useMessage } from '/@/hooks/web/useMessage';
  import JEllipsis from '/@/components/Form/src/jeecg/components/JEllipsis.vue';
  import { BulbTwoTone, BellTwoTone } from '@ant-design/icons-vue';

  const tempSs1 = [
    {
      id: '001',
      orderNo: '电[1]1267102',
      orderTitle: '药品出问题了',
      restDay: 1,
    },
    {
      id: '002',
      orderNo: '电[4]5967102',
      orderTitle: '吃了xxx医院的药,病情越来越严重',
      restDay: 0,
    },
    {
      id: '003',
      orderNo: '电[3]5988987',
      orderTitle: '今天去超市买鸡蛋,鸡蛋都是坏的',
      restDay: 7,
    },
    {
      id: '004',
      orderNo: '电[2]5213491',
      orderTitle: 'xx宝实体店高价售卖xx',
      restDay: 5,
    },
    {
      id: '005',
      orderNo: '电[1]1603491',
      orderTitle: '以红利相诱,答应退保后扣一年费用',
      restDay: 0,
    },
  ];

  const tempSs2 = [
    {
      id: '001',
      orderTitle: '我要投诉这个大超市',
      orderNo: '电[1]10299456',
      restDay: 6,
    },
    {
      id: '002',
      orderTitle: 'xxx医院乱开药方,售卖假药',
      orderNo: '电[2]20235691',
      restDay: 0,
    },
    {
      id: '003',
      orderTitle: '我想问问这家店是干啥的',
      orderNo: '电[3]495867322',
      restDay: 7,
    },
    {
      id: '004',
      orderTitle: '我要举报朝阳区奥森公园酒店',
      orderNo: '电[2]1193849',
      restDay: 3,
    },
    {
      id: '005',
      orderTitle: '我今天吃饭吃到一个石头子',
      orderNo: '电[4]56782344',
      restDay: 9,
    },
  ];

  //4-7天
  const tip_green = 'rgba(0, 255, 0, 1)';
  //1-3天
  const tip_yellow = 'rgba(255, 255, 0, 1)';
  //超期
  const tip_red = 'rgba(255, 0, 0, 1)';

  const textMaxLength = 8;
  const $message = useMessage();

  const dataSource1 = ref([]);
  const dataSource2 = ref([]);
  const dataSource3 = ref([]);
  const dataSource4 = ref([]);
  const columns = [
    {
      title: '',
      dataIndex: '',
      key: 'rowIndex',
      width: 50,
      fixed: 'left',
      align: 'center',
      slots: { customRender: 'dayWarnning' },
    },
    {
      title: '剩余天数',
      align: 'center',
      dataIndex: 'restDay',
      width: 80,
    },
    {
      title: '工单标题',
      align: 'center',
      dataIndex: 'orderTitle',
      slots: { customRender: 'ellipsisText' },
    },
    {
      title: '工单编号',
      align: 'center',
      dataIndex: 'orderNo',
    },
    {
      title: '操作',
      dataIndex: 'action',
      align: 'center',
      slots: { customRender: 'action' },
    },
  ];

  function getTipColor(rd) {
    let num = rd.restDay;
    if (num <= 0) {
      return tip_red;
    } else if (num >= 1 && num < 4) {
      return tip_yellow;
    } else if (num >= 4) {
      return tip_green;
    }
  }

  function mock() {
    dataSource1.value = tempSs1;
    dataSource2.value = tempSs2;
    dataSource3.value = tempSs1;
    dataSource4.value = tempSs2;
    ifNullDataSource(dataSource4, '.tytable4');
  }

  function ifNullDataSource(ds, tb) {
    if (!ds || ds.length == 0) {
      var tmp = document.createElement('img');
      tmp.src = noDataPng;
      tmp.width = 300;
      let tbclass = `${tb} .ant-table-placeholder`;
      document.querySelector(tbclass).innerHTML = '';
      document.querySelector(tbclass).appendChild(tmp);
    }
  }

  function handleData() {
    $message.createMessage.success('办理完成');
  }

  function goPage() {
    $message.createMessage.success('请根据具体业务跳转页面');
  }

  mock();
</script>

<style scoped lang="less">
  .my-index-table {
    height: 270px;

    table {
      font-size: 14px !important;
    }
  }

  .index-container-ty {
    margin: 12px 12px 0;

    :deep(.ant-card-body) {
      padding: 10px 12px 0 12px;
    }

    :deep(.ant-card-head) {
      line-height: 24px;
      min-height: 24px;
      background: #7196fb !important;

      .ant-card-head-title {
        padding-top: 6px;
        padding-bottom: 6px;
      }

      .ant-card-extra {
        padding: 0;

        a {
          color: #fff;
        }

        a:hover {
          color: #152ede;
        }
      }
    }

    :deep(.ant-table-footer) {
      text-align: right;
      padding: 6px 12px 6px 6px;
      background: #fff;
      border-top: 2px solid #f7f1f1;
    }

    .index-md-title {
      position: relative;
      width: 100%;
      color: #fff;
      font-size: 21px;
      font-family: cursive;
      padding-left: 25px;

      img {
        position: absolute;
        height: 25px;
        left: 0;
      }
    }

    :deep(.ant-table-thead > tr > th),
    :deep(.ant-table-tbody > tr > td) {
      border-bottom: 1px solid #90aeff;
    }

    :deep(
      .ant-table-small
      > .ant-table-content
      > .ant-table-fixed-left
      > .ant-table-body-outer
      > .ant-table-body-inner
      > table
      > .ant-table-thead
      > tr
      > th),
    :deep(
      .ant-table-small
      > .ant-table-content
      > .ant-table-fixed-right
      > .ant-table-body-outer
      > .ant-table-body-inner
      > table
      > .ant-table-thead
      > tr
      > th) {
      border-bottom: 1px solid #90aeff;
    }

    :deep(.ant-table-small > .ant-table-content > .ant-table-scroll > .ant-table-body > table > .ant-table-thead > tr > th) {
      border-bottom: 1px solid #90aeff;
    }

    :deep(.ant-table-small) {
      border: 1px solid #90aeff;
    }

    :deep(.ant-table-placeholder) {
      padding: 0;
      height: 215px;
    }
  }
</style>