123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620 |
- <!--
- //参数说明
- propsData参数下
- infoType 为必要参数 0.检查 1.复查 2.整改
- checkType 为必要参数 infoType为0时 代表检查状态 为1时代表复查状态 为2时代表整改状态
-
- //检查时的必要参数
- manageId
-
- //复查时的必要参数
- planId
- planSetId
- subId
-
-
- //隐患时的必要参数
- planId
- planSetId
- subId
-
- //引用方法
-
- <checkItemModule :propsData="propsData" v-if="checkItemModuleType"></checkItemModule>
-
- import {
- checkItemModule
- } from '@/pages/checkItemModule.vue'
-
- components: {
- checkItemModule
- },
-
- checkItemModuleType:false,
- propsData:{
- infoType:0,
- manageId:'1839113478692855815',
- checkType:0,
- planId:'',
- planSetId:'',
- subId:'',
- searchValue:'',
- },
-
- checkItemModuleButton(type,item){
- if(type = 'open'){
- this.$set(this,'propsData',{
- infoType:0,
- manageId:'1839113478692855815',
- checkType:0,
- planId:'',
- planSetId:'',
- subId:'',
- searchValue:'',
- });
- this.$set(this,'checkItemModuleType',true);
- }else if(type = 'out'){
- this.$set(this,'checkItemModuleType',false);
- this.$set(this,'propsData',{});
- }else if(type = 'submit'){
- console.log('已选中-item', item)
- }
- },
- -->
- <template>
- <view class="checkItemModule">
- <!-- 标签选项卡 -->
- <view class="checkItemModule-title-box">
- <view class="checkItemModule-title-p" @click="checkTitleButton(1)"
- :class="pageType==1?'.checkItemModule-title-check':''">
- <view>关键字</view>
- <view></view>
- </view>
- <view class="checkItemModule-title-p" @click="checkTitleButton(2)"
- :class="pageType==2?'.checkItemModule-title-check':''">
- <view>按层级</view>
- <view></view>
- </view>
- </view>
- <!-- 输入搜索模块 -->
- <view class="input-max-big-box" v-if="pageType == 1">
- <view class="input-big-box">
- <view class="input-box">
- <view class="left-icons">
- <uni-icons color="#A2A2A2" type="search" size="20"></uni-icons>
- </view>
- <input type="text" v-model="searchValue" placeholder="搜索检查项" name="search" @confirm='getSearchValue'
- confirm-type='search' @input="theBlur" maxlength="50"
- placeholder-style="color: #666;font-size:24rpx;">
- <view v-if="searchValue" class="left-icons" @click="delSearchValue()">
- <uni-icons color="#0183FA" type="clear" size="20"></uni-icons>
- </view>
- </view>
- <view class="out-button" @click="outButton()">取消</view>
- </view>
- <view class="input-for-max-box">
- <view class="for-box" v-for="(item,index) in dataList" :key="index" v-if="optionData.infoType==0">
- <view class="for-box-n" v-html="brightenKeyword(item.hazardCheckCode1,item.hazardCheckName1,searchValue)">
- {{item.hazardCheckCode1}}{{item.hazardCheckName1}}
- </view>
- <view class="for-box-n" v-html="brightenKeyword(item.hazardCheckCode2,item.hazardCheckName2,searchValue)">
- {{item.hazardCheckCode2}}{{item.hazardCheckName2}}
- </view>
- <view v-for="(item2,index2) in item.data">
- <view class="for-box-n" v-html="brightenKeyword(item2.hazardCheckCode,item2.hazardCheckName,searchValue)">
- {{item2.hazardCheckCode}}{{item2.hazardCheckName}}
- </view>
- <view class="for-box-n" @click="checkItemButton(item2,item3)"
- v-for="(item3,index3) in item2.hazardCheckPointList" v-html="brightenKeyword('',item3,searchValue)">
- {{item3}}
- </view>
- </view>
-
- </view>
-
- <view class="for-box" @click="checkItemButton(item,'')" v-for="(item,index) in dataList" :key="index"
- v-if="optionData.infoType==1 || optionData.infoType==2">
- <view class="for-box-n">
- {{item.hazardCheckCode}}{{item.hazardCheckName}}
- </view>
- </view>
- </view>
- </view>
- <!-- 级联选择模块 -->
- <view class="check-max-big-box" v-if="pageType == 2">
- <view class="check-big-box">
- <view v-if="levelListOne" @click="cascadeButton(1)">一级检查</view>
- <view v-if="levelListTwo" @click="cascadeButton(2)">二级检查</view>
- <view v-if="levelListThree" @click="cascadeButton(3)">三级检查</view>
- </view>
- <view class="check-for-max-box">
- <view v-if="!levelListThree" v-for="(item,index) in checkList" :key="index" @click="cascadeItemButton(item,item2)">
- <view>{{item.hazardCheckCode?item.hazardCheckCode:item.code}}
- {{item.hazardCheckName?item.hazardCheckName:item.name}}
- </view>
- </view>
- <view v-for="(item,index) in checkList" :key="index" v-if="levelListThree">
- <view>{{item.hazardCheckCode?item.hazardCheckCode:item.code}}
- {{item.hazardCheckName?item.hazardCheckName:item.name}}
- </view>
- <view v-for="(item2,index2) in item.hazardCheckPointList" @click="checkItemButton(item,item2)">
- {{item2}}
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- securityCheckOptionSelAllList,
- securityAppCheckSetOptionList,
- securityAppCheckSetOptionGetReviewList,
- securityAppCheckDangerGetCheckDangerSubId,
- } from '@/pages_safetyCheck/api/index.js'
- export default {
- name: "checkItemModule",
- props: {
- propsData: {}
- },
- data() {
- return {
- //父级参数
- optionData: {},
- //选项卡状态
- pageType: 1,
- //输入框数据
- searchValue: "",
- //输入搜索返回列表
- dataList: [],
- //一级-级联数据
- levelListOne: null,
- //二级-级联数据
- levelListTwo: null,
- //三级-级联数据
- levelListThree: null,
- //级联列表
- checkList: [],
- }
- },
- onLoad() {
- },
- mounted() {
- this.$set(this, 'optionData', JSON.parse(JSON.stringify(this.propsData)));
- this.$nextTick(() => {
- this.securityCheckOptionSelAllList();
- })
- },
- methods: {
- theBlur(e) {
- this.searchValue = e.target.value
- },
- //输入框查询
- getSearchValue() {
- if (this.optionData.infoType == 0) {
- //检查
- this.securityAppCheckSetOptionList();
- } else if (this.optionData.infoType == 1) {
- //复查
- this.securityAppCheckSetOptionGetReviewList();
- } else if (this.optionData.infoType == 2) {
- //整改
- this.securityAppCheckDangerGetCheckDangerSubId();
- }
- },
- //选项卡title切换
- checkTitleButton(type) {
- if (this.pageType != type) {
- this.$set(this, 'pageType', type);
- }
- },
- //退出页面
- outButton() {
- this.$parent.checkItemModuleButton('out');
- },
- //清除输入框内容
- delSearchValue() {
- if (this.searchValue) {
- this.$set(this, 'searchValue', '');
- this.$set(this, 'dataList', []);
- this.getSearchValue();
- }
- },
- //级联等级点击
- cascadeButton(type) {
- if (type == 1) {
- this.$set(this, 'levelListTwo', null);
- this.$set(this, 'levelListThree', null);
- this.$set(this, 'checkList', this.levelListOne.children);
- } else if (type == 2) {
- this.$set(this, 'levelListThree', null);
- this.$set(this, 'checkList', this.levelListTwo.children);
- }
- },
- //级联检查项选中
- cascadeItemButton(item) {
- if (item.level == 1) {
- this.$set(this, 'levelListTwo', item);
- this.$set(this, 'checkList', item.children);
- } else if (item.level == 2) {
- this.$set(this, 'levelListThree', item);
- if (item.children[0]) {
- item.children.forEach(function(item) {
- if (item.hazardCheckPoint) {
- item.hazardCheckPointList = item.hazardCheckPoint.split('#')
- }
- })
- }
- this.$set(this, 'checkList', item.children);
- } else if (item.level == 3) {
- this.checkItemButton(item, item2);
- }
- },
- //选中检查项
- checkItemButton(item, item2) {
- this.$parent.checkItemModuleButton('submit', item, item2);
- },
- //高亮
- brightenKeyword(code,val, editKeyword) {
- const Reg = new RegExp(editKeyword);
- if (val) {
- const res = code+ val.replace(Reg, `<span style="color: #0183FA;">${editKeyword }</span>`);
- return res;
- }
- },
- //基础检查项检查
- async securityCheckOptionSelAllList() {
- let self = this;
- const {
- data
- } = await securityCheckOptionSelAllList({});
- if (data.code == 200) {
- let maxList = this.getCascaderData(JSON.parse(JSON.stringify(data.data)), 2)
- this.$nextTick(() => {
- if (this.optionData.infoType == 0) {
- this.securityAppCheckSetOptionList(maxList);
- } else if (this.optionData.infoType == 1) {
- this.securityAppCheckSetOptionGetReviewList(maxList);
- } else if (this.optionData.infoType == 2) {
- this.securityAppCheckDangerGetCheckDangerSubId(maxList);
- }
- })
- }
- },
- /********************** 检查相关查询 **********************/
- async securityAppCheckSetOptionList(maxList) {
- let self = this;
- const {
- data
- } = await securityAppCheckSetOptionList({
- manageId: this.optionData.manageId,
- checkStatus: this.optionData.checkType,
- searchValue: this.searchValue
- });
- if (data.code == 200) {
- //级联数据
- if (maxList) {
- let minList = JSON.parse(JSON.stringify(data.data))
- this.cascadeData(maxList, minList);
- }
- if (data.data[0]) {
- data.data.forEach(function(item) {
- if (item.hazardCheckPoint) {
- item.hazardCheckPointList = item.hazardCheckPoint.split('#')
- }
- })
- }
- //查询数据
- let map = new Map();
- for (let item of data.data) {
- let hazardCheckCode2 = item.hazardCheckCode2;
- if (!map.has(hazardCheckCode2)) {
- map.set(hazardCheckCode2, {
- hazardCheckCode2: hazardCheckCode2,
- hazardCheckName2: item.hazardCheckName2,
- hazardCheckCode1: item.hazardCheckCode1,
- hazardCheckName1: item.hazardCheckName1,
- data: [item]
- });
- } else {
- map.get(hazardCheckCode2).data.push(item);
- }
- }
- let finalResult = Array.from(map.values());
- this.$set(this, 'dataList', finalResult);
-
- }
- },
-
-
- /********************** 复查相关查询 **********************/
- async securityAppCheckSetOptionGetReviewList(maxList) {
- let self = this;
- const {
- data
- } = await securityAppCheckSetOptionGetReviewList({
- planId: this.optionData.planId,
- planSetId: this.optionData.planSetId,
- subId: this.optionData.subId,
- appReviewStatus: this.optionData.checkType,
- searchValue: this.searchValue
- });
- if (data.code == 200) {
- //级联数据
- if (maxList) {
- let minList = JSON.parse(JSON.stringify(data.data.records))
- this.cascadeData(maxList, minList);
- }
- //查询数据
- this.$set(this, 'dataList', JSON.parse(JSON.stringify(data.data.records)));
- }
- },
- /********************** 整改相关查询 **********************/
- async securityAppCheckDangerGetCheckDangerSubId(maxList) {
- let self = this;
- const {
- data
- } = await securityAppCheckDangerGetCheckDangerSubId({
- planId: this.optionData.planId,
- planSetId: this.optionData.planSetId,
- subId: this.optionData.subId,
- appReviewStatus: this.optionData.checkType,
- searchValue: this.searchValue
- });
- if (data.code == 200) {
- //级联数据
- if (maxList) {
-
- let minList = JSON.parse(JSON.stringify(data.data.records))
- this.cascadeData(maxList, minList);
- }
- //查询数据
- this.$set(this, 'dataList', JSON.parse(JSON.stringify(data.data.records)));
- }
- },
- /********************** 处理级联数据 **********************/
- cascadeData(maxList, minList) {
- for (let i = 0; i < maxList.length; i++) {
- for (let o = 0; o < maxList[i].children.length; o++) {
- for (let x = 0; x < minList.length; x++) {
- if (maxList[i].children[o].id == minList[x].hazardCheckPro2) {
- minList[x].level = 3;
- if (maxList[i].children[o].children) {
- maxList[i].children[o].children.push(minList[x])
- } else {
- maxList[i].children[o].children = [minList[x]]
- }
- }
- }
- }
- }
- let list = this.getCascaderData(JSON.parse(JSON.stringify(maxList)), 3)
- this.$nextTick(() => {
- this.$set(this, 'levelListOne', JSON.parse(JSON.stringify({
- level: 0,
- children: list
- })));
- this.$set(this, 'checkList', JSON.parse(JSON.stringify(list)));
- })
-
-
- },
- /********************** 检查项格式处理 **********************/
- getCascaderData(list, type) {
- let self = this
- for (let i = 0; i < list.length; i++) {
- if (list[i].level == type) {
- delete list[i].children
- } else if (list[i].children) {
- if (list[i].children[0]) {
- list[i].children = self.getCascaderData(list[i].children, type)
- } else {
- list.splice(i, 1)
- i--
- }
- } else {
- list.splice(i, 1)
- i--
- }
- }
- for (let i = 0; i < list.length; i++) {
- if (list[i].level == type) {
- delete list[i].children
- } else if (list[i].children) {
- if (list[i].children[0]) {
- list[i].children = self.getCascaderData(list[i].children, type)
- } else {
- list.splice(i, 1)
- i--
- }
- } else {
- list.splice(i, 1)
- i--
- }
- }
- for (let i = 0; i < list.length; i++) {
- if (list[i].level == type) {
- delete list[i].children
- } else if (list[i].children) {
- if (list[i].children[0]) {
- list[i].children = self.getCascaderData(list[i].children, type)
- } else {
- list.splice(i, 1)
- i--
- }
- } else {
- list.splice(i, 1)
- i--
- }
- }
- return list
- },
- }
- }
- </script>
- <style lang="stylus" scoped>
- .checkItemModule {
- position: fixed;
- top: 0;
- left: 0;
- height: 100%;
- width: 100%;
- flex: 1;
- overflow: hidden;
- display: flex;
- flex-direction: column;
- background-color: #fff;
- .checkItemModule-title-box {
- display: flex;
- height: 100rpx;
- background-color: #FFFFFF;
- border-bottom: 1rpx solid #dedede;
- .checkItemModule-title-p {
- width: 140rpx;
- height: 100rpx;
- >view:nth-child(1) {
- color: #333;
- text-align: center;
- font-size: 29rpx;
- line-height: 30rpx;
- margin: 35rpx 0 20rpx 0;
- }
- >view:nth-child(2) {
- width: 56rpx;
- height: 6rpx;
- border-radius: 14rpx;
- margin: 0 auto;
- }
- }
- .checkItemModule-title-check {
- >view:nth-child(1) {
- color: #0183FA;
- }
- >view:nth-child(2) {
- background: #0183FA;
- }
- }
- }
- .input-max-big-box {
- flex: 1;
- display: flex;
- flex-direction: column;
- overflow: hidden;
- .input-big-box {
- height: 104rpx;
- display: flex;
- background-color: #fff;
- border-bottom: 1rpx solid #E0E0E0;
- .input-box {
- width: 611rpx;
- height: 69rpx;
- border: 1px solid #E0E0E0;
- display: flex;
- border-radius: 35px 35px 35px 35px;
- margin: 17rpx 0 17rpx 21rpx;
- .left-icons {
- padding: 15rpx 18rpx 0 22rpx;
- }
- .right-icons {
- padding: 15rpx 15rpx 0 22rpx;
- }
- >input {
- flex: 1;
- height: 69rpx;
- line-height: 69rpx;
- }
- }
- .out-button {
- width: 100rpx;
- margin: 17rpx 0 17rpx 15rpx;
- text-align: center;
- line-height: 69rpx;
- color: #0183FA;
- font-size: 29rpx;
- }
- }
- .input-for-max-box {
- flex: 1;
- display: flex;
- flex-direction: column;
- overflow-y: scroll;
- background-color: #fff;
- .for-box {
- .for-box-n {
- margin: 0 21rpx;
- font-size: 29rpx;
- line-height: 40rpx;
- padding: 20rpx 0;
- background-color: #fff;
- border-bottom: 1rpx solid #E0E0E0;
- }
- }
- }
- }
- .check-max-big-box {
- flex: 1;
- display: flex;
- flex-direction: column;
- overflow: hidden;
- .check-big-box {
- height: 70rpx;
- display: flex;
- background-color: #fff;
- border-bottom: 1rpx solid #E0E0E0;
- >view {
- width: 200rpx;
- line-height: 70rpx;
- text-align: center;
- color: #333;
- font-size: 29rpx;
- }
- .checkView {
- color: #0183FA;
- }
- }
- .check-for-max-box {
- flex: 1;
- display: flex;
- flex-direction: column;
- overflow-y: scroll;
- background-color: #fff;
- >view {
- >view {
- font-size: 25rpx;
- line-height: 70rpx;
- margin: 0 21rpx;
- border-bottom: 1px solid #dedede;
- }
- }
- }
- }
- }
- </style>
|