From eb23a7c7faefe86330a88f9118b8211f6b86e75b Mon Sep 17 00:00:00 2001 From: loulijun2021 <1694218219@qq.com> Date: 星期二, 20 九月 2022 19:00:58 +0800 Subject: [PATCH] 1.点检项目开发( 除提交功能外完成) --- pages/sbgl/rcdj.html | 457 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 444 insertions(+), 13 deletions(-) diff --git a/pages/sbgl/rcdj.html b/pages/sbgl/rcdj.html index c7aee17..51480a0 100644 --- a/pages/sbgl/rcdj.html +++ b/pages/sbgl/rcdj.html @@ -6,7 +6,7 @@ <meta name="HandheldFriendly" content="true" /> <meta name="MobileOptimized" content="320" /> <title>鏂板嚡杩埗閫犱簯骞冲彴</title> - + <!-- 寮曞叆鏍峰紡鏂囦欢 --> <link rel="stylesheet" href="../../css/vant.css" /> <!-- 寮曞叆 Vue 鍜� Vant 鐨� JS 鏂囦欢 --> @@ -17,10 +17,150 @@ <script type="text/javascript" src="../../js/axios.min.js"></script> <script type="text/javascript" src="../../js/http.js"></script> + <script type="text/javascript" src="../../js/common.js"></script> - <link rel="stylesheet" href="../css/global.css" type="text/css" charset="utf-8" /> + <!-- <link rel="stylesheet" href="../../css/global.css" type="text/css" charset="utf-8" /> --> + <script type="text/javascript"> + var topContent = [ + // { + // code: 'SB001', + // name: '榻胯疆绠辩粍', + // wksp_code: "CJ002", + // wksp_name: '瑁呴厤杞﹂棿', + // eqpchkmain_code: "djbz002" + // }, + // { + // code: 'SB003', + // name: '榻胯疆绠辩粍', + // wksp_code: "CJ002", + // wksp_name: '瑁呴厤杞﹂棿', + // eqpchkmain_code: "djbz002" + // }, + ]; + + var centerContent = [ + // { + // checkdesc: '姘斿帇姝e父10甯曪紝鏈�楂樹笉瓒呰繃10.5甯曪紝鏈�浣庝笉浣庝簬9.7', + // code: 'BW003', + // name: '閮ㄤ綅3', + // seq: 2, + // cycle: 'D', + // isscan: 'N', + // isOK: 'OK', + // inputValue: '', + // isDisabled: false, + // }, + ] + + + let radioValue = '' + + let resultValue = '' + + + let bwcode = '' + + let number = [] + + function scaned(r) { + + let flag = false + topContent.forEach((item, index) => { + if (item.code === r) { + flag = true + } + }) + if (flag) { + vant.Notify({ + type: 'danger', + message: '姝ゆ潯鐮佸凡鎵弿锛屽凡鍦ㄥ垪琛ㄤ腑锛�' + }); + } else { + get('AppDeviceManage/CheckScanDeviceQrCodeData', { + eqpcode: r + }).then(res => { + if (res.code === '200' && res.data[0].eqpchkmain_code !== null) { + topContent.unshift(res.data[0]) + topContentClcik(topContent[0].code) + } + + if (res.code === '200' && res.data[0].eqpchkmain_code === null) { + vant.Notify({ + type: 'danger', + message: '褰撳墠璁惧鏈缃偣妫�鏍囧噯缁戝畾鐐规椤圭洰锛�' + }); + } + }) + } + + + + } + + + function scaned2(r) { + if (bwcode === r) { + centerContent.forEach(item => { + if (item.code === bwcode) { + item.isDisabled = false + item.isOK = 'OK' + + + if (centerContent.every(r => r.isOK === 'OK')) { + resultValue = 'OK' + } + if (centerContent.some(r => r.isOK === 'NG')) { + resultValue = 'NG' + } + if (centerContent.some(r => r.isOK === '')) { + resultValue = '' + } + + + number.push({ + id: '1' + }) + } + }) + } else { + vant.Notify({ + type: 'danger', + message: '鎵弿鐨勪簩缁寸爜鏈笌姝ょ偣妫�椤圭洰鐩稿尮閰嶏紒' + }); + } + + } + + + function topContentClcik(code) { + radioValue = code + get('AppDeviceManage/SelectScanDeviceQrCodeItem', { + eqpcode: code + }).then(res => { + if (res.code === '200') { + centerContent = res.data + centerContent = JSON.parse(JSON.stringify(centerContent)) + centerContent.forEach(item => { + item.isDisabled = item.isscan === 'Y' + item.inputValue = '' + item.isOK = item.isscan !== 'Y' ? 'OK' : '' + }) + if (centerContent.every(r => r.isOK === 'OK')) { + resultValue = 'OK' + } + if (centerContent.some(r => r.isOK === 'NG')) { + resultValue = 'NG' + } + if (centerContent.some(r => r.isOK === '')) { + resultValue = '' + } + } + }) + } + </script> </head> + <!-- <body onload="loadNodes()"> --> <body> <div id="app"> @@ -28,7 +168,7 @@ <van-nav-bar title="鏃ュ父鐐规" @click-right="onClickRight" left-arrow @click-left="onClickleft"> <template #right> - <van-popover style="" placement="bottom-end" :offset="[13,8]" v-model="showPopover" + <van-popover style="" placement="bottom-end" :offset="[13,8]" v-model="showPopover" trigger="click" :actions="actions" @select="onSelect"> <template #reference> <van-icon name="bars" size='20' color='#fff' /> @@ -37,8 +177,129 @@ </template> </van-nav-bar> - </div> + <div class="head"> + <div class="head_block"> + <div class="head_left"> + <div class="head_bar"></div> + <div class="head_title"> + 鎵弿鐐规宸ヤ綅 + </div> + </div> + + <div style="margin-right: 10px;"> + <van-icon name="scan" color='red' size='24' @click='topScanClick()' /> + </div> + + </div> + + <div class="flex_between" style=""> + <div id="contentLeft" style="width: 100%;margin-top: 10px;"> + <div id="topContentID" v-for="item in topContent" :key="item.code" + style="margin-bottom: 10px;margin-left: 20px;" @click="topContentClcik(item.code)"> + <div style="display: flex;align-items: center;"> + <div> + <div>宸ヤ綅缂栫爜锛�</div> + <div>宸ヤ綅鍚嶇О锛�</div> + <div>鐢熶骇杞﹂棿锛�</div> + </div> + <div> + <div>{{item.code}}</div> + <div>{{item.name}}</div> + <div>{{item.wksp_name}}</div> + </div> + </div> + + </div> + </div> + <div id="contentRight"> + <van-radio-group v-model="radioValue" style="padding-right: 12px;"> + <van-radio checked-color='red' icon-size="18px" + style="height: 63px;margin-bottom: 10px;" v-for="item in topContent" + :key="item.code" :name="item.code"></van-radio> + </van-radio-group> + </div> + </div> + </div> + + <div class="head" + :style="{marginTop:topContent.length===0?'100px':'0',minHeight:topContent.length===0?'0':'220px'}" + style="margin-bottom: 130px;padding-bottom: 10px;overflow-y: ;" + :style="{marginTop:topContent.length===0?'78px':'0'}"> + <div class="head_block" style="margin-bottom:10px;"> + <div class="head_left"> + <div class="head_bar"></div> + <div class="head_title"> + 鐐规椤圭洰鍐呭 + </div> + </div> + </div> + + + <div class="center_border flex_column" style="margin: 5px;" v-for="item in centerContent" + :key="item.code"> + <div class="flex_between"> + <div class="center_title">{{item.name}}</div> + <div style="margin-right: 10px;" v-if="item.isscan==='Y'"> + <van-icon name="scan" color='red' size='24' @click='centerScanClick(item.code)' /> + </div> + </div> + <div class="flex_between "> + <div class='flex_between' style="width: 90%;"> + <van-field class="vanFieldInput" :disabled="item.isDisabled" v-model="item.inputValue" + placeholder="璇疯緭鍏�" /> + </div> + + + <div class="" style="width: 40%;display: flex;justify-content: space-around;"> + <van-button class="buttonSmall" :disabled='item.isDisabled' size="small" + :plain="item.isOK!=='OK'" @click="bwClick(item,'OK')" type="primary">姝e父</van-button> + <van-button class="buttonSmall" size="small" :plain="item.isOK!=='NG'" + @click="bwClick(item,'NG')" :disabled='item.isDisabled' type="danger">寮傚父 + </van-button> + </div> + </div> + <div style="font-weight: lighter;font-size: 14px;padding-right: 5px"> + {{item.checkdesc}} + </div> + </div> + + </div> + + + <div style=""> + <div class="footer"> + <div class="head_block" style="margin-bottom: 20rpx;align-items: center;"> + <div class="head_left"> + <div class="head_bar"></div> + <div class="head_title"> + 鐐规缁撴灉 + </div> + </div> + <div class="flex_center" style="width: 30%;display: flex;justify-content: space-around;"> + + <van-button class="buttonSmall" + :disabled="centerContent.some(item=>item.isDisabled===true)||centerContent.length===0" + size="small" :plain="resultValue!=='OK'" @click="resultClick('OK')" type="primary"> + 姝e父</van-button> + <van-button class="buttonSmall" size="small" :plain="resultValue!=='NG'" + :disabled="centerContent.some(item=>item.isDisabled===true)||centerContent.length===0" + @click="resultClick('NG')" type="danger">寮傚父</van-button> + </div> + + </div> + + <div + style="position:fixed;bottom: 0;width: 96%;display: flex;justify-content: center;flex-direction: column;align-items: center"> + <van-button class="vanButtonInfo" :disabled="resultValue===''" @click="submit" type="info"> + 纭鎻愪氦</van-button> + </div> + + </div> + </div> + + + </div> <van-overlay :show="overlayShow" @click="overlayShow=false" /> @@ -62,17 +323,150 @@ icon: 'revoke', text: '閫�鍑虹櫥褰�' }], - + topContent2: topContent, + centerContent2: centerContent, + number2: number } }, - created() { + watch: { + 'topContent2.length': { + handler(newValue, oldValue) { + if (newValue !== oldValue) { + // this.topContent2 = topContent + // this.$forceUpdate() + if (topContent[0] && topContent[0].code) { + this.$forceUpdate() + this.topContentClcik(topContent[0].code) + } + } + }, + deep: true, + immediate: true, + }, + + 'topContent.length': { + handler(newValue, oldValue) { + if (newValue !== oldValue) { + this.$forceUpdate() + // if (topContent[0]&&topContent[0].code) { + // this.$forceUpdate() + // this.topContentClcik(topContent[0].code) + // } + } + }, + deep: true, + immediate: true, + }, + 'number2.length': { + handler(newValue, oldValue) { + this.$forceUpdate() + }, + deep: true, + immediate: true, + }, + 'number.length': { + handler(newValue, oldValue) { + this.$forceUpdate() + }, + deep: true, + immediate: true, + }, }, - mounted() { - - }, + created() {}, + mounted() {}, methods: { - onClickleft(){ + submit() { + vant.Toast('xxx1') + }, + topContentClcik(code) { + radioValue = code + this.$forceUpdate() + get('AppDeviceManage/SelectScanDeviceQrCodeItem', { + eqpcode: code + }).then(res => { + if (res.code === '200') { + centerContent = res.data + centerContent.forEach(item => { + item.isDisabled = item.isscan === 'Y' + item.inputValue = '' + item.isOK = item.isscan !== 'Y' ? 'OK' : '' + }) + if (centerContent.every(r => r.isOK === 'OK')) { + resultValue = 'OK' + } + if (centerContent.some(r => r.isOK === 'NG')) { + resultValue = 'NG' + } + if (centerContent.some(r => r.isOK === '')) { + resultValue = '' + } + + this.$forceUpdate() + } + }) + }, + + resultClick(val) { + resultValue = val + this.$forceUpdate() + }, + + selected(id) { + alert(id) + }, + + // 鎵弿鐐规宸ヤ綅鎵弿 + topScanClick() { + createWithoutTitle('../../components/barcode_scan.html', { + titleNView: { + type: 'float', + backgroundColor: 'rgba(215,75,40,0.3)', + titleText: '鎵竴鎵�', + titleColor: '#FFFFFF', + autoBackButton: true, + buttons: [{ + fontSrc: '_www/helloh5.ttf', + text: '\ue302', + fontSize: '18px', + onclick: 'javascript:scanPicture()' + }] + } + }); + }, + // 鐐规椤圭洰鍐呭鎵弿 + centerScanClick(code) { + bwcode = code + createWithoutTitle('../../components/barcode_scan2.html', { + titleNView: { + type: 'float', + backgroundColor: 'rgba(215,75,40,0.3)', + titleText: '鎵竴鎵�', + titleColor: '#FFFFFF', + autoBackButton: true, + buttons: [{ + fontSrc: '_www/helloh5.ttf', + text: '\ue302', + fontSize: '18px', + onclick: 'javascript:scanPicture()' + }] + } + }); + }, + + // 閮ㄤ綅姝e父 寮傚父鎸夐挳鐐瑰嚮 + bwClick(item, val) { + item.isOK = val + if (centerContent.every(item => item.isOK !== '')) { + if (centerContent.every(item => item.isOK === 'OK')) { + resultValue = 'OK' + } else { + resultValue = 'NG' + } + } + this.$forceUpdate() //寮哄埗瑙嗗浘鏇存柊 + }, + onClickleft() { history.back() }, onClickRight() { @@ -86,16 +480,18 @@ }) </script> <style type="text/css"> + @import url('../../css/global.css'); + body { background-color: #fff; } .body { - height: 600px; + min-height: 600px; background-color: grey; margin-top: 0px; background-color: #fff; - position: relative; + position: relative; } .van-nav-bar__content { @@ -107,8 +503,43 @@ color: #fff; letter-spacing: 2px; } - .van-nav-bar__arrow{ + + .van-nav-bar__arrow { color: #fff !important; } + + .createElementDiv { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 10px; + margin-left: 20px; + } + + .vanFieldInput { + height: 36px; + line-height: 36px; + align-items: center; + /* width: 200px; */ + + padding: 0; + padding-left: 10px; + /* border-radius: 5px; */ + margin: 5px 0; + /* background-color: #fff; */ + } + + .buttonSmall { + /* border-radius: 5px; */ + } + + .vanButtonInfo { + width: 100%; + letter-spacing: 2px; + height: 50px; + font-size: 18px; + /* margin-left: 0; */ + + } </style> </html> -- Gitblit v1.9.3