123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391 |
- <template>
- <view class="container">
- <u-popup :show="showpopup" @close="showpopup=false" :safeAreaInsetBottom='false' :round="10">
- <view class="popupmain">
- <view class="popup_title">
- <text>筛选</text>
- </view>
- <view class="line">
- </view>
- <u-datetime-picker :show="show" @confirm='confirm1' @cancel='show=false'
- mode="date"></u-datetime-picker>
- <u-datetime-picker :show="show2" @confirm='confirm2' @cancel='show2=false'
- mode="date"></u-datetime-picker>
- <view class="project">
- <view class="project_box">
- <view class="title">
- 创建开始时间
- </view>
- <view @click="show=true" class='main'>
- <input style='margin-left:10%' type="text" disabled placeholder="请选择"
- v-model="popupData.timeStart" />
- </view>
- </view>
- <view class="project_box">
- <view class="title">
- 创建结束时间
- </view>
- <view @click="show2=true" class='main'>
- <input style='margin-left:10%' type="text" disabled placeholder="请选择"
- v-model="popupData.timeEnd" />
- </view>
- </view>
- <view class="project_box" v-for="(item,index) in columns" :key="index">
- <view class="title">
- {{item.title}}
- </view>
- <view class="main">
- <view class='btns_main' :class="popupData[item.key]===k.id?'primary':''"
- @click="changetype(item,k)" style="border-radius: 0.7rem;" v-for="k in item.project"
- :key="k.id">{{k.label}}</view>
- </view>
- </view>
- </view>
- <view class="popup_btns">
- <u-button text="重置" @click="repect"></u-button>
- <u-button type="primary" text="确定" @click="surepopup">
- </u-button>
- </view>
- </view>
- </u-popup>
- <view style="position: relative;">
- <view style="display: flex;align-items: center;">
- <input placeholder='管线名称'
- style="background-color: #F2F2F2;border: none;padding: 3px 10px;border-radius: 1rem;"
- :style="'width: 100%;'" v-model="dataForm.lineName" type="text" confirm-type="search"
- @confirm="searchs">
- <u-icon @click="showpopup = true" style="margin-left: 0.3rem;" size="26" name="list-dot"
- color="#C6C7CB"></u-icon>
- </view>
- <view style="position: absolute;right: 2.5rem;top: 0.4rem;z-index:10"
- @click="dataForm.lineName='',getList()">
- <u-icon v-if="dataForm.lineName" name="close-circle-fill" color="#C6C7CB"></u-icon>
- </view>
- </view>
- <scroll-list ref="list" style="margin-top: 10rpx;" :option="option" @refresh="refresh"
- @scrolltolower="loadMore">
- <view class="list-item" :class="item.isHandle=='1'?'red':'green'" v-for="(item, index) in list" :key="index"
- @click="handleTest(item)">
- <view class="main_box">
- <view class="text">
- 管线名称 :{{item.lineName}}
- </view>
- <view class="text">
- 管线单元名称 :{{item.lineUnitName}}
- </view>
- <view class="text">
- 风险类型 :{{item.riskCategory}}
- </view>
- <view class="text">
- 风险状态:
- <span :style="{ color: item.isHandle=='1'?'red':'green' }">
- {{ item.isHandle== 1 ? "未处理" : "已处理"}}
- </span>
- </view>
- </view>
- </view>
- </scroll-list>
- </view>
- </template>
- <script>
- import Config from "@/common/Config.js";
- export default {
- data() {
- return {
- showpopup: false,
- show: false,
- scrollTop: 0,
- show2: false,
- columns: [{
- title: '状态',
- key: 'isHandle',
- project: [{
- label: '未处理',
- id: '1'
- }, {
- label: '已处理',
- id: '0'
- }]
- }],
- popupData: {
- timeStart: "",
- timeEnd: "",
- isHandle: ''
- },
- old: {
- scrollTop: 0
- },
- option: {
- size: 5,
- auto: true
- },
- dataForm: {
- page: 1,
- limit: 10
- },
- showType: false,
- templateIdList: ['JzW-GOYebclYExiTgICih8n5LfO38P7AFP_TAK8E2Ms'],
- list: []
- }
- },
- onLoad() {
- // #ifdef MP
- let that = this
- // uni.showModal({
- // title: '提示',
- // content: '确认进行服务通知提醒系统通知',
- // success: function(res) {
- // if (res.confirm) {
- // that.sureType()
- // } else if (res.cancel) {
- // console.log('用户点击取消');
- // }
- // }
- // });
- // #endif
- },
- onShow() {
- this.list = []
- this.dataForm.limit = 10
- this.getList()
- },
- methods: {
- sureType() {
- let that = this
- wx.requestSubscribeMessage({
- tmplIds: that.templateIdList,
- success(res) {
- console.log(res);
- },
- fail(err) {
- console.error('Failed to request subscribe message:', err);
- },
- complete() {
- that.showType = false
- }
- });
- },
- gettemplateIdList() {
- let that = this
- // this.$api.to_http(`/message/WeChat/templateIdList`, "GET").then((res) => {
- // if (res.data.code != 0) {
- // return uni.$u.toast(res.data.msg)
- // }
- // that.templateIdList = res.data.data
- // })
- wx.getSetting({
- withSubscriptions: true,
- success(res) {
- that.showType = true
- }
- })
- },
- loadMore() {
- // 在触底时,调用加载更多的 API 方法
- this.dataForm.limit += 10; // 页数加1
- this.getList(); // 获取更多数据
- },
- changetype(x, k) {
- this.popupData[x.key] = k.id
- },
- searchs(e) {
- this.checked = []
- this.dataList = []
- this.list = []
- this.dataForm.limit = 10
- this.getList()
- },
- surepopup() {
- this.showpopup = false
- this.list = []
- this.dataForm.limit = 10
- this.dataForm = {
- ...this.dataForm,
- ...this.popupData
- }
- this.getList()
- },
- repect() {
- for (let key in this.popupData) {
- this.popupData[key] = ''
- }
- },
- confirm1(x) {
- this.popupData.timeStart = this.formatTimestamp(x.value)
- this.show = false
- },
- confirm2(x) {
- this.popupData.timeEnd = this.formatTimestamp(x.value)
- this.show2 = false
- },
- formatTimestamp(timestamp) {
- const date = new Date(timestamp);
- const year = date.getFullYear();
- const month = (date.getMonth() + 1).toString().padStart(2, '0'); // 月份是从0开始的,所以加1
- const day = date.getDate().toString().padStart(2, '0'); // 日期补充为两位数
- return `${year}-${month}-${day}`;
- },
- searchs(e) {
- this.checked = []
- this.dataList = []
- this.list = []
- this.dataForm.limit = 10
- this.getList()
- },
- handleTest(x) {
- uni.navigateTo({
- url: '/pages/risk/riskDetail?data=' + JSON.stringify(x)
- })
- },
- getList() {
- this.dataForm.handleUserIds = uni.getStorageSync('userInfo').id
- this.$api.to_http(`/pipe/zhkjwurenjipiperisk/getUserPipeRisk`, this.dataForm, 'get').then((res) => {
- this.list.push(...res.data.data.list)
- this.$refs.list.loadSuccess({
- list: this.list,
- total: res.data.data.total
- });
- })
- },
- // 加载数据
- load(paging) {
- this.$api.to_http(`/pipe/zhkjwurenjipiperisk/getUserPipeRisk`, this.dataForm, 'get').then((res) => {
- let list = [];
- for (var i = 0; i < res.data.data.list.length; i++) {
- list.push(res.data.data.list[i]);
- }
- this.list = [...this.list, ...list];
- // 加载成功 参数对象{list: 当前列表,total: 数据总长度(后端查询的total)}
- this.$refs.list.loadSuccess({
- list: this.list,
- total: res.data.data.total
- });
- // 加载失败
- // this.$refs.list.loadFail()
- })
- },
- // 刷新刷剧
- refresh(paging) {
- this.list = []
- this.dataForm.limit = 10
- this.$api.to_http(`/pipe/zhkjwurenjipiperisk/getUserPipeRisk`, this.dataForm, 'get').then((res) => {
- let list = [];
- for (var i = 0; i < res.data.data.list.length; i++) {
- list.push(res.data.data.list[i]);
- }
- this.list = list;
- // 加载成功 参数对象{list: 当前列表,total: 数据总长度(后端查询的total)}
- this.$refs.list.refreshSuccess({
- list: this.list,
- total: res.data.data.total
- });
- // 加载失败
- // this.$refs.list.loadFail()
- })
- }
- }
- }
- </script>
- <style lang="less" scoped>
- .list-item {
- font-size: 30rpx;
- padding: 10rpx 20rpx;
- position: relative;
- .main_box {
- border-radius: 15rpx;
- // border: 1px solid #000;
- padding: 30rpx;
- background-color: #fff;
- .text {
- margin: 18rpx 0;
- }
- }
- }
- .popupmain {
- .popup_title {
- padding: 0.5rem 1rem;
- text-align: center;
- }
- .line {
- height: 0.4rem;
- background-color: #F3F4F6;
- }
- .project {
- padding: 0.6rem;
- height: 15rem;
- overflow: auto;
- .project_box {
- margin-bottom: 0.5rem;
- .main {
- margin-top: 0.5rem;
- display: grid;
- grid-template-columns: 1fr 1fr 1fr;
- // grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
- grid-gap: 0.8rem;
- .btns_main {
- height: 40px;
- position: relative;
- align-items: center;
- justify-content: center;
- display: flex;
- flex-direction: row;
- box-sizing: border-box;
- flex-direction: row;
- padding: 0 12px;
- font-size: 14px;
- border-color: #ebedf0;
- border-width: 1px;
- border-style: solid;
- }
- .primary {
- background-color: #3c9cff;
- border-color: #3c9cff;
- color: #fff;
- }
- }
- }
- }
- .popup_btns {
- padding: 0.6rem;
- display: flex;
- margin-top: 1rem;
- border-top: 1px solid #f1f1f1;
- .u-button {
- width: 47%;
- }
- }
- }
- .list-item.green::after {
- display: block;
- content: '';
- width: 6rpx;
- height: 120rpx;
- background-color: #67c23a;
- position: absolute;
- top: 30%;
- }
- .list-item.red::after {
- display: block;
- content: '';
- width: 6rpx;
- height: 120rpx;
- background-color: #f56c6c;
- position: absolute;
- top: 30%;
- }
- </style>
|