From 1833dd6d7cac01c35840af52fadc1199821e5805 Mon Sep 17 00:00:00 2001 From: Houjie <714924425@qq.com> Date: 星期四, 15 五月 2025 09:28:16 +0800 Subject: [PATCH] 提交优化项 --- pages/maintenanceReport/maintenanceReportDetils/maintenanceReportDetils.vue | 174 - uni_modules/zxz-uni-data-select/package.json | 86 uni_modules/zb-tooltip/readme.md | 22 uni_modules/zb-tooltip/components/zb-tooltip/zb-tooltip.vue | 290 ++ pages/ToDoList/ToDoSpareParts/ToDoSpareParts.vue | 627 ++-- pages/baoZhou/baoZhouDetils/baoZhouDetils.vue | 123 uni_modules/zb-tooltip/changelog.md | 18 pages/maintenanceReport/maintenanceReport.vue | 51 pages/baoZhou/baoZhou.vue | 196 - pages/ToDoList/ToDoListDeils/ToDoCheckDetils/ToDoCheckDetils.vue | 361 ++- store/index.js | 1 pages/user/userexit.vue | 52 pages/TaskManager/TaskManagerDeils/TaskManagerDeils.vue | 89 pages/ToDoList/ToDoBaoZhou/ToDoBaoZhou.vue | 422 ++- static/icon/sear.png | 0 pages/checkList/checkList.vue | 150 pages/ToDoList/ToDoListDeils/ToDoListDeils.vue | 31 pages/reportRepair/reportRepair.vue | 191 - uni_modules/zxz-uni-data-select/changelog.md | 49 pages/ToDoList/ToDoListCheckSure/ToDoListCheckSure.vue | 362 ++- common/service/config.service.js | 2 pages/ToDoList/ToDoBaoZhouSure/ToDoBaoZhouSure.vue | 793 ++++--- uni_modules/zb-tooltip/package.json | 85 pages/TaskManager/TaskManagerList.vue | 318 +- pages/ToDoList/ToDoList.vue | 367 +-- uni_modules/zxz-uni-data-select/components/zxz-uni-data-select/zxz-uni-data-select.vue | 823 +++++++ uni_modules/zxz-uni-data-select/readme.md | 37 pages/user/people.vue | 60 manifest.json | 209 pages/checkList/checkListDetils/checkListDetils.vue | 362 ++- common/service/service.js | 34 common/util/work.js | 2 32 files changed, 3,921 insertions(+), 2,466 deletions(-) diff --git a/common/service/config.service.js b/common/service/config.service.js index 2b48824..5dcaf09 100644 --- a/common/service/config.service.js +++ b/common/service/config.service.js @@ -6,7 +6,7 @@ BASE_URL = '/jeecg-boot' // 鐢熶骇鐜 } let staticDomainURL ='/sys/common/static'; -let staticURL ='https://192.168.1.42:9999/jeecg-boot/sys/common/static'; +let staticURL ='https://http://192.168.4.20:9999/jeecg-boot/sys/common/static'; const configService = { apiUrl: BASE_URL, staticDomainURL: staticDomainURL, diff --git a/common/service/service.js b/common/service/service.js index ee5456c..de4ec21 100644 --- a/common/service/service.js +++ b/common/service/service.js @@ -70,26 +70,32 @@ tip.error('鎷掔粷璁块棶'); break case 500: - if(!token || data.message=="Token澶辨晥锛岃閲嶆柊鐧诲綍"){ - let timeout=setTimeout(tip.alert('鐧诲綍宸茶繃鏈�'), 1000); - store.dispatch('Logout').then(() => { - clearTimeout(timeout) - window.location.reload() - }) - } + this.$tip.alert('鏈嶅姟鍣ㄩ亣鍒颁竴涓敊璇紝鏆傛椂鏃犳硶澶勭悊鎮ㄧ殑璇锋眰'); + // if(!token || data.message=="Token澶辨晥锛岃閲嶆柊鐧诲綍"){ + // let timeout=setTimeout(tip.alert('鐧诲綍宸茶繃鏈�'), 1000); + // store.dispatch('Logout').then(() => { + // clearTimeout(timeout) + // window.location.reload() + // }) + // } break case 404: break case 504: break case 401: - if (token) { - /* store.dispatch('Logout').then(() => { - setTimeout(() => { - window.location.reload() - }, 1500) - }) */ - } + uni.showModal({ + title: '鎻愮ず', + content: '鐧诲綍瓒呮椂锛岄渶瑕侀噸鏂扮櫥褰�!', + showCancel:false, + success: (res)=> { + if (res.confirm) { + uni.reLaunch({ + url: '/pages/login/login' + }) + } + } + }); break default: tip.error({ diff --git a/common/util/work.js b/common/util/work.js index a86b077..abc6250 100644 --- a/common/util/work.js +++ b/common/util/work.js @@ -121,7 +121,7 @@ icon:icon_prefix+"xinwen.png", description:"璁惧鎶ヤ慨", useCount:10000, - page:'reportRepairList' + page:'reportRepair' },{ title:"缁翠慨", icon:icon_prefix+"toupiao.png", diff --git a/manifest.json b/manifest.json index 1873248..903eb2b 100644 --- a/manifest.json +++ b/manifest.json @@ -1,107 +1,106 @@ { - "name" : "璁惧绠$悊", - "appid" : "__UNI__561D9ED", - "description" : "", - "versionName" : "1.0", - "versionCode" : 1, - "transformPx" : false, - "app-plus" : { - /* 5+App鐗规湁鐩稿叧 */// - // "ssl": { - // "cert": "./cert.crt", - // "key": "./cert.key" - // }, - "modules" : { - "Maps" : {}, - "Push" : {} - }, - /* 妯″潡閰嶇疆 */ - "distribute" : { - /* 搴旂敤鍙戝竷淇℃伅 */ - "android" : { - /* android鎵撳寘閰嶇疆 */ - "permissions" : [ - "<uses-feature android:name=\"android.hardware.camera\"/>", - "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>", - "<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>", - "<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>", - "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>", - "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>", - "<uses-permission android:name=\"android.permission.CALL_PHONE\"/>", - "<uses-permission android:name=\"android.permission.CAMERA\"/>", - "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>", - "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>", - "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>", - "<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>", - "<uses-permission android:name=\"android.permission.INTERNET\"/>", - "<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>", - "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>", - "<uses-permission android:name=\"android.permission.READ_CONTACTS\"/>", - "<uses-permission android:name=\"android.permission.READ_LOGS\"/>", - "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>", - "<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>", - "<uses-permission android:name=\"android.permission.VIBRATE\"/>", - "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>", - "<uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/>", - "<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>", - "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>" - ] - }, - "ios" : {}, - /* ios鎵撳寘閰嶇疆 */ - "sdkConfigs" : { - "ad" : {}, - "maps" : { - "amap" : { - "appkey_ios" : "87f4d2a4a0c42e0c86cf312c8b8154e8", - "appkey_android" : "87f4d2a4a0c42e0c86cf312c8b8154e8" - } - }, - "push" : { - "unipush" : {} - } - } - } - }, - /* SDK閰嶇疆 */ - "quickapp" : {}, - /* 蹇簲鐢ㄧ壒鏈夌浉鍏� */ - "mp-weixin" : { - "appid" : "wx2ba5c5690b35d173", - "setting" : { - "urlCheck" : false, - "es6" : true - }, - "permission" : { - "scope.userLocation" : { - "desc" : "鏈夊畾浣嶅姛鑳介渶瑕佸鑸畾浣�" - } - } - }, - "h5" : { - "title" : "璁惧绠$悊", - "domain" : "myhjdc.cn", - "router" : { - "mode" : "hash", - "base" : "/h5" - }, - "devServer" : { - "port" : "8080", - "https" : true, - "proxy": { - /**閰嶇疆鏈嶅姟鍣ㄨ矾寰�**/ - "/jeecg-boot": { - "target": "https://192.168.1.42:9999",// 鐩爣鏈嶅姟鍣� - "changeOrigin": true - } - } - }, - "optimization" : { - "treeShaking" : { - "enable" : false - } - } - } + "name": "璁惧绠$悊", + "appid": "__UNI__561D9ED", + "description": "", + "versionName": "1.0", + "versionCode": 1, + "transformPx": false, + "app-plus": { + /* 5+App鐗规湁鐩稿叧 */ // + // "ssl": { + // "cert": "./cert.crt", + // "key": "./cert.key" + // }, + "modules": { + "Maps": {}, + "Push": {} + }, + /* 妯″潡閰嶇疆 */ + "distribute": { + /* 搴旂敤鍙戝竷淇℃伅 */ + "android": { + /* android鎵撳寘閰嶇疆 */ + "permissions": [ + "<uses-feature android:name=\"android.hardware.camera\"/>", + "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>", + "<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>", + "<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>", + "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>", + "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>", + "<uses-permission android:name=\"android.permission.CALL_PHONE\"/>", + "<uses-permission android:name=\"android.permission.CAMERA\"/>", + "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>", + "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>", + "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>", + "<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>", + "<uses-permission android:name=\"android.permission.INTERNET\"/>", + "<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>", + "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>", + "<uses-permission android:name=\"android.permission.READ_CONTACTS\"/>", + "<uses-permission android:name=\"android.permission.READ_LOGS\"/>", + "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>", + "<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>", + "<uses-permission android:name=\"android.permission.VIBRATE\"/>", + "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>", + "<uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/>", + "<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>", + "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>" + ] + }, + "ios": {}, + /* ios鎵撳寘閰嶇疆 */ + "sdkConfigs": { + "ad": {}, + "maps": { + "amap": { + "appkey_ios": "87f4d2a4a0c42e0c86cf312c8b8154e8", + "appkey_android": "87f4d2a4a0c42e0c86cf312c8b8154e8" + } + }, + "push": { + "unipush": {} + } + } + } + }, + /* SDK閰嶇疆 */ + "quickapp": {}, + /* 蹇簲鐢ㄧ壒鏈夌浉鍏� */ + "mp-weixin": { + "appid": "wx2ba5c5690b35d173", + "setting": { + "urlCheck": false, + "es6": true + }, + "permission": { + "scope.userLocation": { + "desc": "鏈夊畾浣嶅姛鑳介渶瑕佸鑸畾浣�" + } + } + }, + "h5": { + "title": "璁惧绠$悊", + "domain": "myhjdc.cn", + "router": { + "mode": "hash", + "base": "/h5" + }, + "devServer": { + "port": "8080", + "https": true, + "proxy": { + /**閰嶇疆鏈嶅姟鍣ㄨ矾寰�**/ + "/jeecg-boot": { + "target": "https://192.168.4.20:9999", // 鐩爣鏈嶅姟鍣� + "changeOrigin": true + } + } + }, + "optimization": { + "treeShaking": { + "enable": false + } + } + } } -/**閰嶇疆鏈嶅姟鍣ㄨ矾寰�**/// 鐩爣鏈嶅姟鍣� - +/**閰嶇疆鏈嶅姟鍣ㄨ矾寰�**/ // 鐩爣鏈嶅姟鍣� \ No newline at end of file diff --git a/pages/TaskManager/TaskManagerDeils/TaskManagerDeils.vue b/pages/TaskManager/TaskManagerDeils/TaskManagerDeils.vue index 399d52f..b623095 100644 --- a/pages/TaskManager/TaskManagerDeils/TaskManagerDeils.vue +++ b/pages/TaskManager/TaskManagerDeils/TaskManagerDeils.vue @@ -9,7 +9,9 @@ <uni-forms ref="form" :modelValue="formData" validate-trigger="bind" err-show-type="undertext"> <uni-group top="1"> - <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 鍩烘湰淇℃伅 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> + + <view class="divider"><text>鍩烘湰淇℃伅</text></view> + <!-- <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 鍩烘湰淇℃伅 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> --> <uni-forms-item name="num" label="宸ュ崟鍙�:"> <uni-easyinput v-model="formData.orderNum" :disabled="true" /> </uni-forms-item> @@ -41,7 +43,8 @@ </uni-forms-item> </uni-group> </uni-forms> - <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 淇濆吇椤逛俊鎭� 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> + <view class="divider"><text>淇濆吇椤逛俊鎭�</text></view> + <!-- <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 淇濆吇椤逛俊鎭� 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> --> <uni-card margin="10px" spacing="1px" v-for="(item,index) in partTakeAdviceDetailList" :key="index"> @@ -71,7 +74,7 @@ <view class="flex"> <view class="flex-sub text-light bg-white padding-xs margin-xs radius">鐐规缁撴灉:</view> - + <uni-data-select :localdata="restle" v-model="item.inspectionResult" @change="handleCode()" :clear="true" :disabled="true" /> @@ -95,7 +98,8 @@ <uni-forms v-if="isDisplayConfirm == 'WAIT_CONFIRM' || isDisplayConfirm == 'COMPLETE'" ref="form" :modelValue="ScanData" validate-trigger="bind" err-show-type="undertext"> <uni-group top="1"> - <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 鐝粍闀跨‘璁� 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> + <view class="divider"><text>鐝粍闀跨‘璁�</text></view> + <!-- <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 鐝粍闀跨‘璁� 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> --> <uni-forms-item required name="typeName" label="澶勭悊绫诲瀷:"> <uni-data-select v-model="ScanData.typeName" :localdata="ScanData.handlingType" @change="changehandlingType" placeholder="璇烽�夋嫨" :disabled="true" /> @@ -148,7 +152,7 @@ upload: "/eam/sysFiles/batch_upload", stallList: "/eam/eamInspectionOrder/queryById", // getEquipmentList: "eam/equipment/asyncLoadEquipment", - getEquipmentList:'eam/equipment/list', + getEquipmentList: 'eam/equipment/list', BaoList: 'eam/eamInspectionOrderDetail/queryList', approval: 'eam/eamInspectionOrder/approval' }, @@ -310,31 +314,31 @@ // this.$tip.error("鑱旂綉澶辫触") // }) // }, - getEquipment() { - this.$http.get(this.url.getEquipmentList, { - params: { - pageNo: 1, - pageSize: 9999, - order: 'desc', - column: 'createTime' - }, - - }).then(res => { - //璁剧疆鍒楄〃鏁版嵁 - if (res.data.success) { - this.equipmentList = res.data.result.records - } else { - uni.showToast({ - icon: "error", - title: res.data.message, - duration: 2000 - }); - - } - }).catch(() => { - this.$tip.error("鑱旂綉澶辫触") - }) - }, + getEquipment() { + this.$http.get(this.url.getEquipmentList, { + params: { + pageNo: 1, + pageSize: 9999, + order: 'desc', + column: 'createTime' + }, + + }).then(res => { + //璁剧疆鍒楄〃鏁版嵁 + if (res.data.success) { + this.equipmentList = res.data.result.records + } else { + uni.showToast({ + icon: "error", + title: res.data.message, + duration: 2000 + }); + + } + }).catch(() => { + this.$tip.error("鑱旂綉澶辫触") + }) + }, getList() { this.$http.get(this.url.BaoList, { params: { @@ -528,6 +532,31 @@ </script> <style> + .divider { + display: flex; + align-items: center; + text-align: center; + color: gray; + /* 鏂囧瓧棰滆壊 */ + margin: 20px 0; + /* 涓婁笅闂磋窛 */ + } + + .divider::before, + .divider::after { + content: ''; + flex: 1; + border-bottom: 1px solid gray; + /* 妯嚎棰滆壊 */ + margin: 0 16px; + /* 妯嚎涓庢枃瀛椾箣闂寸殑闂磋窛 */ + } + + .divider text { + white-space: nowrap; + /* 闃叉鏂囧瓧鎹㈣ */ + } + .is-hover { color: rgba(255, 255, 255, 0.6); background-color: #55aaff; diff --git a/pages/TaskManager/TaskManagerList.vue b/pages/TaskManager/TaskManagerList.vue index 545dfa2..3570fdb 100644 --- a/pages/TaskManager/TaskManagerList.vue +++ b/pages/TaskManager/TaskManagerList.vue @@ -3,6 +3,11 @@ <cu-custom :bgColor="NavBarColor" :isBack="true" backRouterName="productionTask"> <block slot="backText">杩斿洖</block> <block slot="content">宸插姙</block> + <block slot="right"> + <view @click="search"> + <image class="search" src="/static/icon/sear.png" style="width: 25px; height: 25px;" alt="" /> + </view> + </block> </cu-custom> <view style="width: 100%;"> @@ -11,11 +16,12 @@ <!-- 鍩虹琛ㄥ崟鏍¢獙 --> <uni-forms ref="form" :modelValue="formData" validate-trigger="bind" err-show-type="undertext"> <uni-group title="" top="0"> - <uni-forms-item name="numbers" label="棰嗘枡鐢宠鍗曞彿:"> - <uni-easyinput type="text" v-model="formData.num" placeholder="璇疯緭鍏ラ鏂欑敵璇峰崟鍙锋绱�" /> + <uni-forms-item name="type" :labelWidth="80" label="娴佺▼鍒嗙被:"> + <uni-data-select v-model="formData.type" :localdata="storageTypeList" + @change="changeSelectType" /> </uni-forms-item> - <uni-forms-item name="name" label="棰嗘枡浜у搧:"> - <uni-easyinput v-model="formData.partNumNameModel" placeholder="璇疯緭鍏ラ鏂欎骇鍝�" /> + <uni-forms-item name="num" :labelWidth="80" label="璁惧缂栧彿:"> + <uni-easyinput v-model="formData.num" placeholder="璇疯緭鍏ヨ澶囩紪鍙�" /> </uni-forms-item> </uni-group> </uni-forms> @@ -84,14 +90,16 @@ type: 'top', scrollLeft: 0, formData: { - num: '', - partNumNameModel: '' + type: '', + num:'' }, + storageTypeList: [], NavBarColor: this.NavBarColor, colorIndex: 0, activeColor: '#5277A6', url: { - stallList: "assign/flow/finishedList" + stallList: "assign/flow/finishedList", + storageType: 'sys/dict/getDictItems/flow_type' }, upOption: { @@ -138,81 +146,82 @@ } }, - created() {}, + created() { + this.storageType(); + }, methods: { + changeSelectType(e) { + + this.formData.type = e + }, /** - * @param {Object} item - * 璇︽儏椤甸潰 + * 娴佺▼绫诲瀷 */ - // onClickProductionTask(item) { - // const name = item.category_dictText - // const type= item.taskName - // if (name == '璁惧鐐规' && type =='鐝粍闀跨‘璁�') { - // uni.navigateTo({ - // url: '/pages/ToDoList/ToDoListCheckSure/ToDoListCheckSure?item=' + - // encodeURIComponent(JSON.stringify(item)) - // }) - // }else if(name == '璁惧鍛ㄤ繚' && type =='鐝粍闀跨‘璁�'){ - // uni.navigateTo({ - // url: '/pages/ToDoList/ToDoBaoZhouSure/ToDoBaoZhouSure?item=' + - // encodeURIComponent(JSON.stringify(item)) - // }) - // } + storageType() { + this.$http.get(this.url.storageType).then(res => { + //璁剧疆鍒楄〃鏁版嵁 + if (res.data.success) { + this.storageTypeList = res.data.result + } + }).catch(() => { + //鑱旂綉澶辫触, + }) + }, + onClickProductionTask(item, flag = 'task') { + const name = item.taskName; + const type = item.category_dictText; + let url = ''; + switch (true) { + case (name === '鏄惁闇�瑕侀鐢ㄥ浠�' && type === '璁惧缁翠慨'): + url = '/pages/ToDoList/ToDoSpareParts/ToDoSpareParts'; + break; + case (name === '鐐规鎵ц' && type === '璁惧鐐规'): + url = '/pages/ToDoList/ToDoListCheckSure/ToDoListCheckSure'; + break; + case (name === '鍛ㄤ繚鎵ц' && type === '璁惧鍛ㄤ繚'): + url = '/pages/ToDoList/ToDoBaoZhouSure/ToDoBaoZhouSure'; + break; + case (name === '鐝粍闀跨‘璁�' && type === '璁惧鐐规'): + url = '/pages/ToDoList/ToDoListCheckSure/ToDoListCheckSure'; + break; + case (name === '鐝粍闀跨‘璁�' && type === '璁惧鍛ㄤ繚'): + url = '/pages/ToDoList/ToDoBaoZhouSure/ToDoBaoZhouSure'; + break; + case (name === '璁剧鍛樺垵楠�' && type === '璁惧鍛ㄤ繚'): + url = '/pages/ToDoList/ToDoBaoZhouSure/ToDoBaoZhouSure'; + break; + case (name === '璁捐兘閮ㄧ粓楠�' && type === '璁惧鍛ㄤ繚'): + url = '/pages/ToDoList/ToDoBaoZhouSure/ToDoBaoZhouSure'; + break; + case (name === '绠$悊鍛橀鐢ㄥ浠�' && type === '璁惧缁翠慨'): + url = '/pages/ToDoList/ToDoSpareParts/ToDoSpareParts'; + break; + case (name === '鎿嶄綔宸ョ‘璁�' && type === '璁惧缁翠慨'): + url = '/pages/ToDoList/ToDoSpareParts/ToDoSpareParts'; + break; + case (name === '缁翠慨鎵ц' && type === '璁惧缁翠慨'): + url = '/pages/ToDoList/ToDoSpareParts/ToDoSpareParts'; + break; + case (name === '鐐规宸ュ崟' && type === '璁惧鐐规'): + url = '/pages/ToDoList/ToDoListCheckSure/ToDoListCheckSure'; + break; + case (name === '鐐规寮�濮�' && type === '璁惧鐐规'): + url = '/pages/ToDoList/ToDoListCheckSure/ToDoListCheckSure'; + break; + default: + console.warn(`No URL found for name: ${name} and type: ${type}`); + return; + } + if (url) { + uni.navigateTo({ - // }, - onClickProductionTask(item) { - const name = item.taskName; - const type = item.category_dictText; - let url = ''; - - switch (true) { - case (name === '鏄惁闇�瑕侀鐢ㄥ浠�' && type === '璁惧缁翠慨'): - url = '/pages/ToDoList/ToDoSpareParts/ToDoSpareParts'; - break; - case (name === '鐐规鎵ц' && type === '璁惧鐐规'): - url = '/pages/ToDoList/ToDoListCheckSure/ToDoListCheckSure'; - break; - case (name === '鍛ㄤ繚鎵ц' && type === '璁惧鍛ㄤ繚'): - url = '/pages/ToDoList/ToDoBaoZhouSure/ToDoBaoZhouSure'; - break; - case (name === '鐝粍闀跨‘璁�' && type === '璁惧鐐规'): - url = '/pages/ToDoList/ToDoListCheckSure/ToDoListCheckSure'; - break; - case (name === '鐝粍闀跨‘璁�' && type === '璁惧鍛ㄤ繚'): - url = '/pages/ToDoList/ToDoBaoZhouSure/ToDoBaoZhouSure'; - break; - case (name === '璁剧鍛樺垵楠�' && type === '璁惧鍛ㄤ繚'): - url = '/pages/ToDoList/ToDoBaoZhouSure/ToDoBaoZhouSure'; - break; - case (name === '璁捐兘閮ㄧ粓楠�' && type === '璁惧鍛ㄤ繚'): - url = '/pages/ToDoList/ToDoBaoZhouSure/ToDoBaoZhouSure'; - break; - case (name === '绠$悊鍛橀鐢ㄥ浠�' && type === '璁惧缁翠慨'): - url = '/pages/ToDoList/ToDoSpareParts/ToDoSpareParts'; - break; - case (name === '鎿嶄綔宸ョ‘璁�' && type === '璁惧缁翠慨'): - url = '/pages/ToDoList/ToDoSpareParts/ToDoSpareParts'; - break; - case (name === '缁翠慨鎵ц' && type === '璁惧缁翠慨'): - url = '/pages/ToDoList/ToDoSpareParts/ToDoSpareParts'; - break; - case (name === '鐐规宸ュ崟' && type === '璁惧鐐规'): - url = '/pages/ToDoList/ToDoListCheckSure/ToDoListCheckSure'; - break; - default: - console.warn(`No URL found for name: ${name} and type: ${type}`); - return; - } - - if (url) { - uni.navigateTo({ - url: `${url}?item=${encodeURIComponent(JSON.stringify(item))}` - }); - } + url: `${url}?item=${encodeURIComponent(JSON.stringify(item))}&flag=${flag}` + }); + } }, search() { @@ -224,7 +233,9 @@ this.$http.get(this.url.stallList, { params: { pageNo: page.num, - pageSize: page.size + pageSize: page.size, + column: 'createTime', + order: 'desc' }, }).then(res => { @@ -252,137 +263,54 @@ }, + + + /* 閲嶇疆鏌ヨ鏉′欢 */ resetTask() { - this.formData.num = '' - this.formData.partNumNameModel = '' + this.formData.type = '', + this.formData.num='', this.$refs.popup.close(); this.mescroll.resetUpScroll() }, - /* 妫�绱� */ + + getSera() { this.$refs.popup.close(); - let keyword = this.TabCur this.msgList = []; + this.$http.get(this.url.stallList, { + params: { + pageNo: 1, + pageSize: 9999, + column: 'createTime', + order: 'desc', + category: this.formData.type, + title:this.formData.num + }, - if (keyword == 0) { - this.$http.get(this.url.stallList, { - params: { - pageNo: 1, - pageSize: 999, - order: "desc", - column: "createTime", - num: '*' + this.formData.num + '*', - partNumNameModel: '*' + this.formData.partNumNameModel + '*', - status: 'published' + }).then(res => { + this.announcement1 = res.data.result.records + this.mescroll.endSuccess(this.announcement1.length); + console.log("url", res) + //璁剧疆鍒楄〃鏁版嵁 + if (res.data.success) { + console.log("res", res.data) + this.msg1Count = res.data.result.total + this.msg1Title = "閫氱煡(" + res.data.result.total + ")"; + for (let annItem of this.announcement1) { + this.msgList.push(annItem) } - }).then(res => { - //鑱旂綉鎴愬姛鐨勫洖璋�,闅愯棌涓嬫媺鍒锋柊鍜屼笂鎷夊姞杞界殑鐘舵��; + } + if (page.num == 1) { + this.msgList = []; //濡傛灉鏄涓�椤甸渶鎵嬪姩鍒剁┖鍒楄〃 + this.msgList = this.msgList.concat(this.announcement1); //杩藉姞鏂版暟鎹� + } - this.announcement1 = res.data.result.records - this.mescroll.endSuccess(this.announcement1.length); - console.log("url", res) - //璁剧疆鍒楄〃鏁版嵁 - if (res.data.success) { - console.log("res", res.data) - this.msg1Count = res.data.result.total - this.msg1Title = "閫氱煡(" + res.data.result.total + ")"; - for (let annItem of this.announcement1) { - this.msgList.push(annItem) - } - } - if (page.num == 1) { - this.msgList = []; //濡傛灉鏄涓�椤甸渶鎵嬪姩鍒剁┖鍒楄〃 - this.msgList = this.msgList.concat(this.announcement1); //杩藉姞鏂版暟鎹� - } - - }).catch(() => { - //鑱旂綉澶辫触, 缁撴潫鍔犺浇 - this.mescroll.endErr(); - }) - - } else if (keyword == 1) { - this.$http.get(this.url.stallList, { - params: { - pageNo: 1, - pageSize: 999, - order: "desc", - column: "createTime", - status: 'training', - num: '*' + this.formData.num + '*', - partNumNameModel: '*' + this.formData.partNumNameModel + '*' - - } - }).then(res => { - //鑱旂綉鎴愬姛鐨勫洖璋�,闅愯棌涓嬫媺鍒锋柊鍜屼笂鎷夊姞杞界殑鐘舵��; - - this.announcement1 = res.data.result.records - this.mescroll.endSuccess(this.announcement1.length); - console.log("url", res) - //璁剧疆鍒楄〃鏁版嵁 - if (res.data.success) { - console.log("res", res.data) - this.msg1Count = res.data.result.total - this.msg2Title = "閫氱煡(" + res.data.result.total + ")"; - for (let annItem of this.announcement1) { - this.msgList.push(annItem) - } - } - if (page.num == 1) { - this.msgList = []; //濡傛灉鏄涓�椤甸渶鎵嬪姩鍒剁┖鍒楄〃 - this.msgList = this.msgList.concat(this.announcement1); //杩藉姞鏂版暟鎹� - } - - }).catch(() => { - //鑱旂綉澶辫触, 缁撴潫鍔犺浇 - this.mescroll.endErr(); - }) - - } else if (keyword == 2) { - this.$http.get(this.url.stallList, { - params: { - pageNo: 1, - pageSize: 999, - order: "desc", - column: "createTime", - status: 'completed', - num: '*' + this.formData.num + '*', - partNumNameModel: '*' + this.formData.partNumNameModel + '*' - - } - }).then(res => { - //鑱旂綉鎴愬姛鐨勫洖璋�,闅愯棌涓嬫媺鍒锋柊鍜屼笂鎷夊姞杞界殑鐘舵��; - - this.announcement1 = res.data.result.records - this.mescroll.endSuccess(this.announcement1.length); - console.log("url", res) - //璁剧疆鍒楄〃鏁版嵁 - if (res.data.success) { - console.log("res", res.data) - this.msg3Count = res.data.result.total - this.msg1Title = "閫氱煡(" + res.data.result.total + ")"; - for (let annItem of this.announcement1) { - this.msgList.push(annItem) - } - } - if (page.num == 1) { - this.msgList = []; //濡傛灉鏄涓�椤甸渶鎵嬪姩鍒剁┖鍒楄〃 - this.msgList = this.msgList.concat(this.announcement1); //杩藉姞鏂版暟鎹� - } - - }).catch(() => { - //鑱旂綉澶辫触, 缁撴潫鍔犺浇 - this.mescroll.endErr(); - }) - - } - - - - - + }).catch(() => { + //鑱旂綉澶辫触, 缁撴潫鍔犺浇 + this.mescroll.endErr(); + }) }, - mescrollInit(mescroll) { console.log('mescrollInit') @@ -411,7 +339,7 @@ } .popupView { - margin-top: 85px; + margin-top: 45px; height: auto; } </style> \ No newline at end of file diff --git a/pages/ToDoList/ToDoBaoZhou/ToDoBaoZhou.vue b/pages/ToDoList/ToDoBaoZhou/ToDoBaoZhou.vue index 03fc669..1e9bc64 100644 --- a/pages/ToDoList/ToDoBaoZhou/ToDoBaoZhou.vue +++ b/pages/ToDoList/ToDoBaoZhou/ToDoBaoZhou.vue @@ -2,14 +2,15 @@ <view class="container"> <cu-custom :bgColor="NavBarColor" :isBack="true" backRouterName="productionTask"> <block slot="backText">杩斿洖</block> - <block slot="content">鎵ц</block> + <block slot="content">鍛ㄤ繚鎵ц</block> </cu-custom> <view class="container"> <uni-forms ref="form" :modelValue="formData" validate-trigger="bind" err-show-type="undertext"> <uni-group top="1"> - <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 鍩烘湰淇℃伅 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> + <view class="divider"><text>鍩烘湰淇℃伅</text></view> + <!-- <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 鍩烘湰淇℃伅 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> --> <uni-forms-item :label-width="80" name="orderNum" label="宸ュ崟鍙�:"> <uni-easyinput v-model="formData.orderNum" :disabled="true" /> </uni-forms-item> @@ -28,19 +29,9 @@ <uni-easyinput v-model="formData.remark" placeholder="璇疯緭鍏ュ娉�" :disabled="true" /> </uni-forms-item> <uni-forms-item :label-width="80" name="outNum" label="淇濆吇鍥剧墖:"> - <view class="grid col-4 grid-square flex-sub"> - <view class="bg-img" v-for="(item,index) in imgList" :key="index" @tap="ViewImage" - :data-url="imgList[index]"> - <image :src="imgList[index]" mode="aspectFill"></image> - <view class="cu-tag bg-red radius" @tap.stop="DelImg" :data-index="index"> - <text class='cuIcon-close'></text> - </view> - </view> - <view class="solids" @tap="ChooseImage" v-if="imgList.length<1"> - <text class='cuIcon-cameraadd'></text> - </view> - </view> - + <uni-file-picker limit="9" :value="fileLists" :image-styles="imageStyles" + :sourceType="sourceType" @select="select" @progress="progress" @success="success" + @fail="fail" @delete="deletea" /> </uni-forms-item> <!-- <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 鐝粍闀跨‘璁� 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> <uni-forms-item name="outNum" required label="纭绫诲瀷:"> @@ -60,15 +51,15 @@ - - <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�斾繚鍏婚」淇℃伅鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> + <view class="divider"><text>淇濆吇椤逛俊鎭�</text></view> + <!-- <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�斾繚鍏婚」淇℃伅鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> --> <view class="padding flex flex-direction"> <button :disabled="isClick" class="mini-btn" type="primary" @click.stop="batchnsIpection()" size="mini">鎵归噺淇濆吇姝e父</button> </view> <uni-collapse @change="change"> - <uni-collapse-item :show-animation="true" :show-arrow="true" :accordion="true" title="鏌ョ湅淇濆吇椤�" :border="false" - title-border="none" > + <uni-collapse-item :show-animation="true" :show-arrow="true" :accordion="true" title="鏌ョ湅淇濆吇椤�" + :border="false" title-border="none"> <uni-card margin="10px" spacing="1px" v-for="(item,index) in partTakeAdviceDetailList" :key="index"> <view class="flex"> <view class="flex-sub text-light bg-white padding-xs margin-xs radius">琛屽彿:</view> @@ -83,38 +74,39 @@ </view> <view class="flex"> <view class="flex-sub text-light bg-white padding-xs margin-xs radius">瀛愪繚鍏婚」:</view> - <view class="flex-sub bg-white padding-xs margin-xs radius text-right" + <!-- <view class="flex-sub bg-white padding-xs margin-xs radius text-right" v-if="item.subItemName!=null && item.subItemName.length>10"> {{(item.subItemName).toString().substr(0,10)+'...'}} </view> <view class="flex-sub bg-white padding-xs margin-xs radius text-right" v-else> {{item.subItemName}} + </view> --> + <view class="flex-sub bg-white padding-xs margin-xs radius text-right"> + {{item.subItemName}} </view> </view> <view class="flex"> <view class="flex-sub text-light bg-white padding-xs margin-xs radius">淇濆吇瑕佹眰:</view> - <view class="flex-sub bg-white padding-xs margin-xs radius text-right" - v-if="item.itemDemand!=null && item.itemDemand.length>10"> - {{(item.itemDemand).toString().substr(0,10)+'...'}} - </view> - <view class="flex-sub bg-white padding-xs margin-xs radius text-right" v-else> + <view class="flex-sub bg-white padding-xs margin-xs radius text-right"> {{item.itemDemand}} </view> - </view> - <view class="flex"> - <view class="flex-sub text-light bg-white padding-xs margin-xs radius">鏄惁鎶ヤ慨:</view> - <view class="flex-sub bg-white padding-xs text-right margin-xs radius"> - <uni-data-select :localdata="item.type" @change="handleType($event, index)" v-model="item.reportFlag" - :disabled="item.istrue" /> - </view> + </view> <view class="flex"> <view class="flex-sub text-light bg-white padding-xs margin-xs radius">鐐规缁撴灉:</view> <view class="flex-sub bg-white padding-xs text-right margin-xs radius"> <uni-data-select :localdata="item.restle" v-model="item.maintenanceResult" @change="handleCode($event, index)" /> + </view> + </view> + + <view class="flex"> + <view class="flex-sub text-light bg-white padding-xs margin-xs radius">鏄惁鎶ヤ慨:</view> + <view class="flex-sub bg-white padding-xs text-right margin-xs radius"> + <uni-data-select :localdata="item.type" @change="handleType($event, index)" + v-model="item.reportFlag" :disabled="item.istrue" /> </view> </view> @@ -147,6 +139,15 @@ mixins: [MescrollMixin], // 浣跨敤mixin data() { return { + // 鍥剧墖鍥炴樉 + fileLists: [], + // 涓婁紶鍥剧墖鐨勬牱寮� + imageStyles: { + width: 90, + height: 90, + }, + // uni.chooseImage鍊硷紝浠庣浉鍐岄�夋嫨锛屾媿鎽� + sourceType: ['album', 'camera'], scrollLeft: 0, searchValue: '', imgList: [], @@ -154,7 +155,8 @@ uploadUrl: "/sys/common/upload", formData: { avatar: [], - id:'' + id: '', + num: '' }, istrue: true, @@ -163,7 +165,7 @@ url: { upload: "/eam/sysFiles/batch_upload", stallList: "/eam/weekMaintenanceOrder/queryById", - getEquipmentList:'eam/equipment/list', + getEquipmentList: 'eam/equipment/list', // getEquipmentList: "eam/equipment/asyncLoadEquipment", BaoList: '/eam/weekMaintenanceOrderDetail/queryList', approval: 'eam/weekMaintenanceOrder/approval' @@ -193,7 +195,8 @@ msg1Title: "", procInstId: '', values: '', - isClick:false + isClick: false, + announcement1: {} } }, @@ -224,8 +227,8 @@ methods: { change(e) { - console.log(e); - }, + console.log(e); + }, batchnsIpection() { uni.showModal({ title: '鎻愮ず', @@ -245,76 +248,112 @@ }, ProductionTask() { - if(this.hasInspectionDateArrived()){ - for (let i = 0; i < this.partTakeAdviceDetailList.length; i++) { - if (this.partTakeAdviceDetailList[i].maintenanceResult == undefined || this.partTakeAdviceDetailList[i] - .maintenanceResult == null || this - .partTakeAdviceDetailList[i].maintenanceResult == '') { - /* this.$tip.error("璇疯緭鍏ラ鏂欐暟閲忥紒"); */ - uni.showToast({ - icon: 'none', - title: '鐐规缁撴灉涓嶈兘涓虹┖' - }); - return false; + if (this.hasInspectionDateArrived()) { + for (let i = 0; i < this.partTakeAdviceDetailList.length; i++) { + if (this.partTakeAdviceDetailList[i].maintenanceResult == undefined || this + .partTakeAdviceDetailList[i] + .maintenanceResult == null || this + .partTakeAdviceDetailList[i].maintenanceResult == '') { + uni.showToast({ + icon: 'none', + title: '鐐规缁撴灉涓嶈兘涓虹┖' + }); + return false; + } } - } - - this.$http.put(this.url.approval, { - - confirmComment: '', - id:this.formData.id, - confirmDealType: '', - dataId: this.id, - imageFiles: null, - instanceId: this.procInstId, - tableDetailList: this.partTakeAdviceDetailList, - taskId: this.taskId, - userId: this.assignee, - values: this.values, - maintenanceDate: this.formData.maintenanceDate, - creationMethod: this.formData.creationMethod, - equipmentCode: this.formData.equipmentCode, - equipmentId: this.formData.num, - imageFilesResult: this.formData.avatar, - orderNum: this.formData.orderNum, - remark: this.formData.remark, - standardId: this.formData.standardId, - standardName: this.formData.standardName - }).then(res => { - console.log(res) - this.$tip.loaded(); - if (res.data.success) { + for (let i = 0; i < this.partTakeAdviceDetailList.length; i++) { + if (this.partTakeAdviceDetailList[i].inspectionResult === "2") { + if (this.partTakeAdviceDetailList[i].reportFlag === undefined || this + .partTakeAdviceDetailList[i].reportFlag === null || this.partTakeAdviceDetailList[i] + .reportFlag === '') { + const index = i + 1 + uni.showModal({ + title: "鎻愮ず", + content: '绗�' + index + '琛屽彿鏄惁鎶ヤ慨蹇呴��', + confirmText: '纭畾', + showCancel: false, + }) + return false; + + } + if (this.partTakeAdviceDetailList[i].exceptionDescription == undefined || this + .partTakeAdviceDetailList[i].exceptionDescription == null || this + .partTakeAdviceDetailList[i].exceptionDescription == '') { + const index = i + 1 + uni.showModal({ + title: "鎻愮ず", + content: '绗�' + index + '琛屽彿寮傚父鎻忚堪蹇呭~', + confirmText: '纭畾', + showCancel: false, + }) + return false; + + } + + + } + } + uni.showLoading({ + mask: true, + title: "鍔犺浇涓�....", + }) + this.$http.put(this.url.approval, { + + confirmComment: null, + id: this.formData.id, + confirmDealType: null, + dataId: this.id, + imageFiles: null, + instanceId: this.procInstId, + tableDetailList: this.partTakeAdviceDetailList, + taskId: this.taskId, + userId: this.assignee, + values: this.values, + maintenanceDate: this.formData.maintenanceDate, + creationMethod: this.formData.creationMethod, + equipmentCode: this.formData.equipmentCode, + equipmentId: this.formData.num, + imageFilesResult: this.formData.avatar, + orderNum: this.formData.orderNum, + remark: this.formData.remark, + standardId: this.formData.standardId, + standardName: this.formData.standardName + }).then(res => { + uni.hideLoading() + if (res.data.success) { + uni.showToast({ + icon: "success", + title: '鎻愪氦鎴愬姛', + duration: 2000 + }); + this.$Router.replaceAll({ + name: 'ToDoList' + }) + + } + }).catch(() => { + this.$tip.loaded(); uni.showToast({ - icon: "success", - title: '鎻愪氦鎴愬姛', + icon: "error", + title: res.data.message, duration: 2000 }); - this.$Router.replaceAll({name: 'ToDoList'}) - - } - }).catch(() => { - this.$tip.loaded(); - uni.showToast({ - icon: "error", - title: res.data.message, - duration: 2000 }); - }); - }else{ + } else { uni.showToast({ icon: "error", title: '鏈埌淇濆吇鏃堕棿', duration: 2000 }); } - + }, changeEquipmentList(e) { this.formData.num = e; }, - - handleType(e,index){ + + handleType(e, index) { console.log(e); }, handleCode(e, index) { @@ -327,48 +366,31 @@ this.partTakeAdviceDetailList[index].istrue = true; } }, - getEquipment() { - this.$http.get(this.url.getEquipmentList, { - params: { - pageNo: 1, - pageSize: 9999, - order: 'desc', - column: 'createTime' - }, - - }).then(res => { - //璁剧疆鍒楄〃鏁版嵁 - if (res.data.success) { - this.equipmentList = res.data.result.records - } else { - uni.showToast({ - icon: "error", - title: res.data.message, - duration: 2000 - }); - - } - }).catch(() => { - this.$tip.error("鑱旂綉澶辫触") - }) - }, - // getEquipment() { - // this.$http.get(this.url.getEquipmentList).then(res => { - // //璁剧疆鍒楄〃鏁版嵁 - // if (res.data.success) { - // this.equipmentList = res.data.result - // } else { - // uni.showToast({ - // icon: "error", - // title: res.data.message, - // duration: 2000 - // }); + getEquipment() { + this.$http.get(this.url.getEquipmentList, { + params: { + pageNo: 1, + pageSize: 9999, + order: 'desc', + column: 'createTime' + }, - // } - // }).catch(() => { - // this.$tip.error("鑱旂綉澶辫触") - // }) - // }, + }).then(res => { + //璁剧疆鍒楄〃鏁版嵁 + if (res.data.success) { + this.equipmentList = res.data.result.records + } else { + uni.showToast({ + icon: "error", + title: res.data.message, + duration: 2000 + }); + + } + }).catch(() => { + this.$tip.error("鑱旂綉澶辫触") + }) + }, getList() { this.$http.get(this.url.BaoList, { params: { @@ -409,69 +431,62 @@ //鑱旂綉澶辫触, 缁撴潫鍔犺浇 }) }, - ChooseImage() { - var that = this; - uni.chooseImage({ - count: 4, - sizeType: ['original', 'compressed'], // 鍙互鎸囧畾鏄師鍥捐繕鏄帇缂╁浘锛岄粯璁や簩鑰呴兘鏈� - sourceType: ['album'], // 浠庣浉鍐岄�夋嫨 - success: (res) => { - // 瀛樺偍閫夋嫨鐨勫浘鐗囪矾寰� - that.imgList = res.tempFilePaths; + select(e) { + const tempFilePaths = e.tempFilePaths; - // 鍒濆鍖� formData.avatar 涓虹┖瀛楃涓� - that.formData.avatar = []; + // if (!Array.isArray(tempFilePaths) || tempFilePaths.length === 0) { + // uni.showToast({ + // title: '璇烽�夋嫨鏂囦欢', + // icon: 'none' + // }); + // return; + // } - // 鍒涘缓涓婁紶浠诲姟鐨� Promise 鏁扮粍 - const uploadPromises = res.tempFilePaths.map((filePath, index) => { - return new Promise((resolve, reject) => { - that.$http.upload(that.url.upload, { - filePath: filePath, - name: 'file' - }) - .then(uploadRes => { - // 鍋囪鏈嶅姟鍣ㄨ繑鍥炵殑缁撴灉涓寘鍚枃浠惰矾寰� - const filePath = uploadRes.data.result[0]; - this.formData.avatar.push(filePath); - resolve(filePath); - }) - .catch(err => { - console.error('鍥剧墖' + index + '涓婁紶澶辫触:', err); - reject(err); - }); - }); - }); + uni.showLoading({ + title: '涓婁紶涓�...' + }); - // 骞跺彂鎵ц鎵�鏈変笂浼犱换鍔� - Promise.all(uploadPromises) - .then((uploadedFilePaths) => { - console.log('鎵�鏈夊浘鐗囦笂浼犳垚鍔�:', that.formData.avatar); + const uploadPromises = tempFilePaths.map((filePath, index) => { + return new Promise((resolve, reject) => { + this.$http.upload(this.url.upload, { + filePath: filePath, + name: 'file' }) - .catch((err) => { - console.error('鍥剧墖涓婁紶澶辫触:', err); - that.$tip.error('鍥剧墖涓婁紶澶辫触'); + .then(uploadRes => { + // 鍋囪鏈嶅姟鍣ㄨ繑鍥炵殑缁撴灉涓寘鍚枃浠惰矾寰� + const serverFilePath = uploadRes.data.result[0]; + this.formData.avatar.push(serverFilePath); + resolve(uploadRes); // 杩斿洖缁撴灉缁� Promise.all + }) + .catch(err => { + console.error(`鍥剧墖 ${index + 1} 涓婁紶澶辫触:`, err); + reject(err); }); - } + }); }); + + Promise.all(uploadPromises) + .then(() => { + uni.hideLoading(); + uni.showToast({ + title: '鍏ㄩ儴涓婁紶鎴愬姛' + }); + }) + .catch(err => { + uni.hideLoading(); + uni.showToast({ + title: '閮ㄥ垎涓婁紶澶辫触', + icon: 'none' + }); + console.error('涓婁紶寮傚父:', err); + }); }, - ViewImage(e) { - uni.previewImage({ - urls: this.imgList, - current: e.currentTarget.dataset.url - }); - }, - DelImg(e) { - uni.showModal({ - title: '鎻愮ず', - content: '纭畾瑕佸垹闄よ繖娈靛洖蹇嗗悧锛�', - cancelText: '鍐嶇湅鐪�', - confirmText: '鍐嶈', - success: res => { - if (res.confirm) { - this.imgList.splice(e.currentTarget.dataset.index, 1) - } - } - }) + + + + // 鍒犻櫎 + deletea(e) { + console.log('鍒犻櫎鍥剧墖', e); }, upCallback() { @@ -479,20 +494,18 @@ params: { id: this.id }, - }).then(res => { this.announcement1 = res.data.result console.log("url", res) //璁剧疆鍒楄〃鏁版嵁 if (res.data.success) { - console.log("res", res.data.result.equipmentCode) this.formData.num = this.announcement1.equipmentId, this.formData.orderNum = this.announcement1.orderNum, this.formData.operator = this.announcement1.operator_dictText, this.formData.maintenanceDate = this.announcement1.maintenanceDate, - this.formData.id=this.announcement1.id, + this.formData.id = this.announcement1.id, this.formData.remark = this.announcement1.remark - this.hasInspectionDateArrived(); + this.hasInspectionDateArrived(); } }).catch(() => { //鑱旂綉澶辫触, 缁撴潫鍔犺浇 @@ -579,4 +592,29 @@ margin-top: 85px; height: auto; } + + .divider { + display: flex; + align-items: center; + text-align: center; + color: gray; + /* 鏂囧瓧棰滆壊 */ + margin: 20px 0; + /* 涓婁笅闂磋窛 */ + } + + .divider::before, + .divider::after { + content: ''; + flex: 1; + border-bottom: 1px solid gray; + /* 妯嚎棰滆壊 */ + margin: 0 16px; + /* 妯嚎涓庢枃瀛椾箣闂寸殑闂磋窛 */ + } + + .divider text { + white-space: nowrap; + /* 闃叉鏂囧瓧鎹㈣ */ + } </style> \ No newline at end of file diff --git a/pages/ToDoList/ToDoBaoZhouSure/ToDoBaoZhouSure.vue b/pages/ToDoList/ToDoBaoZhouSure/ToDoBaoZhouSure.vue index dcbebf3..a953048 100644 --- a/pages/ToDoList/ToDoBaoZhouSure/ToDoBaoZhouSure.vue +++ b/pages/ToDoList/ToDoBaoZhouSure/ToDoBaoZhouSure.vue @@ -9,7 +9,8 @@ <uni-forms ref="form" :modelValue="formData" validate-trigger="bind" err-show-type="undertext"> <uni-group top="1"> - <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 鍩烘湰淇℃伅 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> + <view class="divider"><text>鍩烘湰淇℃伅</text></view> + <!-- <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 鍩烘湰淇℃伅 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> --> <uni-forms-item :label-width="80" name="num" label="宸ュ崟鍙�:"> <uni-easyinput v-model="formData.orderNum" :disabled="true" /> </uni-forms-item> @@ -28,24 +29,15 @@ <uni-easyinput v-model="formData.remark" :disabled="true" /> </uni-forms-item> <uni-forms-item :label-width="80" name="outNum" label="淇濆吇鍥剧墖:"> - <view class="grid col-4 grid-square flex-sub"> - <view class="bg-img" v-for="(item,index) in imgList" :key="index" @tap="ViewImage" - :data-url="imgList[index]"> - <image :src="imgList[index]" mode="aspectFill"></image> - <view class="cu-tag bg-red radius" @tap.stop="DelImg" :data-index="index"> - <text class='cuIcon-close'></text> - </view> - </view> - <view class="solids" v-if="imgList.length<1"> - <text class='cuIcon-cameraadd'></text> - </view> - </view> - + <uni-file-picker limit="9" :value="fileLists" :image-styles="imageStyles" + :sourceType="sourceType" @select="select" @progress="progress" @success="success" + @fail="fail" @delete="deletea" :readonly="readonly" /> </uni-forms-item> + </uni-group> </uni-forms> - <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 淇濆吇椤逛俊鎭� 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> - + <!-- <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 淇濆吇椤逛俊鎭� 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> --> + <view class="divider"><text>淇濆吇椤逛俊鎭�</text></view> <uni-collapse> <uni-collapse-item :show-animation="true" :accordion="true" title="鏌ョ湅淇濆吇椤�" :border="false" title-border="none"> @@ -65,31 +57,42 @@ </view> <view class="flex"> <view class="flex-sub text-light bg-white padding-xs margin-xs radius">瀛愪繚鍏婚」:</view> - <view class="flex-sub bg-white padding-xs margin-xs radius text-right" - v-if="item.subItemName!=null && item.subItemName.length>10"> - {{(item.subItemName).toString().substr(0,10)+'...'}} - </view> - - <view class="flex-sub bg-white padding-xs margin-xs radius text-right" v-else> + <view class="flex-sub bg-white padding-xs margin-xs radius text-right"> {{item.subItemName}} </view> + <!-- <view class="flex-sub bg-white padding-xs margin-xs radius text-right" + v-if="item.subItemName!=null && item.subItemName.length>10"> + {{(item.subItemName).toString().substr(0,10)+'...'}} + </view> --> + + <!-- <view class="flex-sub bg-white padding-xs margin-xs radius text-right" v-else> + {{item.subItemName}} + </view> --> </view> <view class="flex"> <view class="flex-sub text-light bg-white padding-xs margin-xs radius">淇濆吇瑕佹眰:</view> - <view class="flex-sub bg-white padding-xs margin-xs radius text-right" - v-if="item.itemDemand!=null && item.itemDemand.length>10"> - {{(item.itemDemand).toString().substr(0,10)+'...'}} - </view> - - <view class="flex-sub bg-white padding-xs margin-xs radius text-right" v-else> + <view class="flex-sub bg-white padding-xs margin-xs radius text-right"> {{item.itemDemand}} </view> + <!-- <zb-tooltip placement="left" ref="tooltip7" > + <view slot="content"> + <view class="flex-sub bg-white padding-xs margin-xs radius text-right"> + {{item.itemDemand}} + </view> + </view> + <view > + <button size="mini">鏇村</button > + </view> + </zb-tooltip> --> + <!-- <view class="flex-sub bg-white padding-xs margin-xs radius text-right" v-else> + {{item.itemDemand}} + </view> --> </view> <view class="flex"> <view class="flex-sub text-light bg-white padding-xs margin-xs radius">鏄惁鎶ヤ慨:</view> <view class="flex-sub bg-white padding-xs text-right margin-xs radius"> - <uni-data-select :localdata="item.type" v-model="item.reportFlag" - :disabled="item.istrue" /> + <uni-data-select :localdata="item.type" @change="handType($event, index)" + v-model="item.reportFlag" :disabled="item.istrue" /> </view> </view> <view class="flex"> @@ -113,12 +116,13 @@ <uni-forms ref="form" :modelValue="ScanData" validate-trigger="bind" err-show-type="undertext"> <uni-group top="1"> - <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�旂彮缁勯暱纭淇℃伅鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> - <uni-forms-item :label-width="80" required name="typeName" label="澶勭悊绫诲瀷:"> + <view class="divider"><text>鐝粍闀跨‘璁や俊鎭�</text></view> + <!-- <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�旂彮缁勯暱纭淇℃伅鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> --> + <uni-forms-item :label-width="80" required name="typeName" label="纭绫诲瀷:"> <uni-data-select v-model="ScanData.typeName" :localdata="ScanData.handlingType" @change="changehandlingType" placeholder="璇烽�夋嫨" :disabled="isShowSure" /> </uni-forms-item> - <uni-forms-item :label-width="80" required name="handlingSuggestion" label="澶勭悊鎰忚:"> + <uni-forms-item :label-width="80" required name="handlingSuggestion" label="纭鎰忚:"> <uni-easyinput type="textarea" v-model="ScanData.handlingSuggestion" :disabled="isShowSure" /> </uni-forms-item> @@ -127,52 +131,40 @@ <uni-forms v-show="isHideFist" ref="form" :modelValue="ScanData" validate-trigger="bind" err-show-type="undertext"> <uni-group top="1"> - <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斿垵楠屾敹淇℃伅鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> + <view class="divider"><text>鍒濋獙鏀朵俊鎭�</text></view> + <uni-forms-item :label-width="80" required name="initialAcceptanceComment" label="鍒濆鎰忚:"> <uni-easyinput type="textarea" v-model="ScanData.initialAcceptanceComment" placeholder="璇疯緭鍏ユ剰瑙�" :disabled="isShowLast" /> </uni-forms-item> - + <uni-forms-item :label-width="80" required name="randomInspectionFlag" label="鎶芥鏍囪:"> + <uni-data-select v-model="ScanData.InspectionFlagName" + :localdata="ScanData.randomInspectionFlagList" @change="changehandlingInspectionFlag" + placeholder="璇烽�夋嫨" :disabled="isShowSure" /> + </uni-forms-item> <uni-forms-item :label-width="80" name="outNum" label="鍒濋獙鏀堕檮浠�:"> - <view class="grid col-4 grid-square flex-sub"> - <view class="bg-img" v-for="(item,index) in imgListinitialAccept" :key="index" - @tap="ViewImageFile" :data-url="imgListinitialAccept[index]"> - <image :src="imgListinitialAccept[index]" mode="aspectFill"></image> - <view class="cu-tag bg-red radius" @tap.stop="DelImgFile" :data-index="index"> - <text class='cuIcon-close'></text> - </view> - </view> - <view class="solids" @click="ChooseImageFile()" v-if="imgListinitialAccept.length<1"> - <text class='cuIcon-cameraadd'></text> - </view> - </view> - + <uni-file-picker limit="9" :value="fileList" :image-styles="imageStyles" + :sourceType="sourceType" @select="selectFirst" @progress="progress" @success="success" + @fail="fail" @delete="deleteFirst" :readonly="readonlyFirst" /> </uni-forms-item> </uni-group> </uni-forms> <uni-forms v-show="isHideLast" ref="form" :modelValue="ScanData" validate-trigger="bind" err-show-type="undertext"> <uni-group top="1"> - <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�旂粓楠屾敹淇℃伅鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> + <view class="divider"><text>缁堥獙鏀朵俊鎭�</text></view> <uni-forms-item :label-width="80" required name="finalAcceptanceComment" label="缁堥獙鏀舵剰瑙�:"> <uni-easyinput type="textarea" v-model="ScanData.finalAcceptanceComment" placeholder="璇疯緭鍏ユ剰瑙�" :disabled="isfinal" /> </uni-forms-item> + <uni-forms-item :label-width="80" required name="finalFlagName" label="鎶芥鏍囪:"> + <uni-data-select v-model="ScanData.finalFlagName" :localdata="ScanData.finalInspectionFlagList" + @change="changehandlingFinalFlag" placeholder="璇烽�夋嫨" :disabled="isfinal" /> + </uni-forms-item> <uni-forms-item :label-width="80" name="outNum" label="缁堥獙鏀堕檮浠�:"> - <view class="grid col-4 grid-square flex-sub"> - <view class="bg-img" v-for="(item,index) in imgListfinalAcceptanceFilesResult" :key="index" - @tap="ViewImageFinal" :data-url="imgListfinalAcceptanceFilesResult[index]"> - <image :src="imgListfinalAcceptanceFilesResult[index]" mode="aspectFill"></image> - <view class="cu-tag bg-red radius" @tap.stop="DelImgFinal" :data-index="index"> - <text class='cuIcon-close'></text> - </view> - </view> - <view class="solids" @click="ChooseImageFinal()" - v-if="imgListfinalAcceptanceFilesResult.length<1"> - <text class='cuIcon-cameraadd'></text> - </view> - </view> - + <uni-file-picker limit="9" :value="fileListFanl" :image-styles="imageStyles" + :sourceType="sourceType" @select="selectFirstFanl" @progress="progress" @success="success" + @fail="fail" @delete="deleteFanl" :readonly="readonlyFirstFanl" /> </uni-forms-item> </uni-group> </uni-forms> @@ -192,6 +184,20 @@ mixins: [MescrollMixin], // 浣跨敤mixin data() { return { + readonly: false, + readonlyFirstFanl: false, + readonlyFirst: false, + // 鍥剧墖鍥炴樉 + fileLists: [], + fileList: [], + fileListFanl: [], + // 涓婁紶鍥剧墖鐨勬牱寮� + imageStyles: { + width: 90, + height: 90, + }, + // uni.chooseImage鍊硷紝浠庣浉鍐岄�夋嫨锛屾媿鎽� + sourceType: ['album', 'camera'], title: '', isShowBtn: true, isHideLast: false, @@ -206,6 +212,8 @@ equipmentList: [], uploadUrl: "/sys/common/upload", ScanData: { + InspectionFlagName: '', + finalFlagName: '', typeName: '', initialAcceptanceComment: '', handlingType: [{ @@ -217,12 +225,32 @@ value: "2" } ], + randomInspectionFlagList: [{ + text: "鍚�", + value: '0' + }, + { + text: "鏄�", + value: '1' + } + ], + finalInspectionFlagList: [{ + text: "鍚�", + value: '0' + }, + { + text: "鏄�", + value: '1' + } + ], handlingSuggestion: '' }, formData: { avatar: [], avatarFile: [], avatarFinal: [], + initialAcceptanceFiles: [], + finalAcceptanceFiles: [], id: '', maintenanceStatus: '' }, @@ -233,8 +261,7 @@ url: { upload: "/eam/sysFiles/batch_upload", stallList: "/eam/weekMaintenanceOrder/queryById", - // getEquipmentList: "eam/equipment/asyncLoadEquipment", - getEquipmentList:'eam/equipment/list', + getEquipmentList: 'eam/equipment/list', BaoList: '/eam/weekMaintenanceOrderDetail/queryList', approval: 'eam/weekMaintenanceOrder/approval' }, @@ -265,8 +292,11 @@ msg1Title: "", procInstId: '', values: '', + flag: '', imageFiles: '', + imageObjectInIt: [], imageFilesList: [], + imageObjectFinal: [], imageFilesnitialAcceptList: [] } }, @@ -283,6 +313,8 @@ }, onLoad(options) { const annItem = JSON.parse(decodeURIComponent(options.item)); + this.flag = options.flag + console.log(this.flag) this.variables = annItem.variables this.id = annItem.dataId this.taskId = annItem.id @@ -296,8 +328,19 @@ }, methods: { + + changehandlingFinalFlag(e) { + this.ScanData.finalFlagName = e; + }, changehandlingType(e) { this.ScanData.typeName = e; + }, + changehandlingInspectionFlag(e) { + this.ScanData.InspectionFlagName = e; + }, + handType(e, index) { + console.log(e) + }, ProductionTask() { if (this.formData.maintenanceStatus == 'WAIT_FINAL_ACCEPTANCE') { @@ -326,27 +369,33 @@ return false; } } + if (this.formData.maintenanceStatus == 'WAIT_CONFIRM' && this.flag != 'task') { + if (this.ScanData.typeName == undefined || this.ScanData.typeName == null || this.ScanData.typeName == + '') { - if (this.ScanData.typeName == undefined || this.ScanData.typeName == null || this.ScanData.typeName == - '') { + uni.showToast({ + icon: 'none', + title: '纭绫诲瀷涓嶈兘涓虹┖' + }); + return false; + } + if (this.ScanData.handlingSuggestion == undefined || this.ScanData.handlingSuggestion == null || this + .ScanData.handlingSuggestion == + '') { - uni.showToast({ - icon: 'none', - title: '澶勭悊绫诲瀷涓嶈兘涓虹┖' - }); - return false; + uni.showToast({ + icon: 'none', + title: '纭鎰忚涓嶈兘涓虹┖' + }); + return false; + } + } - if (this.ScanData.handlingSuggestion == undefined || this.ScanData.handlingSuggestion == null || this - .ScanData.handlingSuggestion == - '') { - - uni.showToast({ - icon: 'none', - title: '澶勭悊鎰忚涓嶈兘涓虹┖' - }); - return false; - } + uni.showLoading({ + mask: true, + title: "鍔犺浇涓�....", + }) this.$http.put(this.url.approval, { finalAcceptanceFilesResult: this.formData.avatarFinal, finalAcceptanceComment: this.ScanData.finalAcceptanceComment, @@ -356,10 +405,12 @@ confirmDealType: this.ScanData.typeName, id: this.formData.id, dataId: this.id, + randomInspectionFlag: this.ScanData.InspectionFlagName, instanceId: this.procInstId, tableDetailList: this.partTakeAdviceDetailList, taskId: this.taskId, userId: this.assignee, + finalRandomInspectionFlag: this.ScanData.finalFlagName, maintenanceDate: this.formData.maintenanceDate, equipmentId: this.formData.num, imageFilesResult: this.imageFilesList, @@ -367,8 +418,7 @@ standardId: this.formData.standardId, standardName: this.formData.standardName }).then(res => { - console.log(res) - this.$tip.loaded(); + uni.hideLoading() if (res.data.success) { uni.showToast({ icon: "success", @@ -404,48 +454,32 @@ this.partTakeAdviceDetailList[index].istrue = true; } }, - // getEquipment() { - // this.$http.get(this.url.getEquipmentList).then(res => { - // //璁剧疆鍒楄〃鏁版嵁 - // if (res.data.success) { - // this.equipmentList = res.data.result - // } else { - // uni.showToast({ - // icon: "error", - // title: res.data.message, - // duration: 2000 - // }); - // } - // }).catch(() => { - // this.$tip.error("鑱旂綉澶辫触") - // }) - // }, - getEquipment() { - this.$http.get(this.url.getEquipmentList, { - params: { - pageNo: 1, - pageSize: 9999, - order: 'desc', - column: 'createTime' - }, - - }).then(res => { - //璁剧疆鍒楄〃鏁版嵁 - if (res.data.success) { - this.equipmentList = res.data.result.records - } else { - uni.showToast({ - icon: "error", - title: res.data.message, - duration: 2000 - }); - - } - }).catch(() => { - this.$tip.error("鑱旂綉澶辫触") - }) - }, + getEquipment() { + this.$http.get(this.url.getEquipmentList, { + params: { + pageNo: 1, + pageSize: 9999, + order: 'desc', + column: 'createTime' + }, + + }).then(res => { + //璁剧疆鍒楄〃鏁版嵁 + if (res.data.success) { + this.equipmentList = res.data.result.records + } else { + uni.showToast({ + icon: "error", + title: res.data.message, + duration: 2000 + }); + + } + }).catch(() => { + this.$tip.error("鑱旂綉澶辫触") + }) + }, getList() { this.$http.get(this.url.BaoList, { params: { @@ -467,11 +501,11 @@ ]; // 鏂板瓧娈碉紝鍊间负涓�涓┖鏁扮粍 item.type = [{ text: "鍚�", - value: 0 + value: '0' }, { text: "鏄�", - value: 1 + value: '1' } ]; // 鏂板瓧娈碉紝鍊间负涓�涓┖鏁扮粍 item.istrue = true; @@ -487,201 +521,143 @@ }) }, - ChooseImageFinal() { - var that = this; - uni.chooseImage({ - count: 4, - sizeType: ['original', 'compressed'], // 鍙互鎸囧畾鏄師鍥捐繕鏄帇缂╁浘锛岄粯璁や簩鑰呴兘鏈� - sourceType: ['album'], // 浠庣浉鍐岄�夋嫨 - success: (res) => { - // 瀛樺偍閫夋嫨鐨勫浘鐗囪矾寰� - that.imgListfinalAcceptanceFilesResult = res.tempFilePaths; - // 鍒濆鍖� formData.avatar 涓虹┖瀛楃涓� - that.formData.avatarFinal = []; - // 鍒涘缓涓婁紶浠诲姟鐨� Promise 鏁扮粍 - const uploadPromises = res.tempFilePaths.map((filePath, index) => { - return new Promise((resolve, reject) => { - that.$http.upload(that.url.upload, { - filePath: filePath, - name: 'file' - }) - .then(uploadRes => { - // 鍋囪鏈嶅姟鍣ㄨ繑鍥炵殑缁撴灉涓寘鍚枃浠惰矾寰� - const filePath = uploadRes.data.result[0]; - this.formData.avatarFinal.push(filePath); - resolve(filePath); - }) - .catch(err => { - console.error('鍥剧墖' + index + '涓婁紶澶辫触:', err); - reject(err); - }); - }); - }); - // 骞跺彂鎵ц鎵�鏈変笂浼犱换鍔� - Promise.all(uploadPromises) - .then((uploadedFilePaths) => { - console.log('鎵�鏈夊浘鐗囦笂浼犳垚鍔�:', that.formData.avatarFinal); + selectFirst(e) { + const tempFilePaths = e.tempFilePaths; + uni.showLoading({ + title: '涓婁紶涓�...' + }); + const uploadPromises = tempFilePaths.map((filePath, index) => { + return new Promise((resolve, reject) => { + this.$http.upload(this.url.upload, { + filePath: filePath, + name: 'file' }) - .catch((err) => { - console.error('鍥剧墖涓婁紶澶辫触:', err); - that.$tip.error('鍥剧墖涓婁紶澶辫触'); - }); - } - }); - }, - - ChooseImageFile() { - var that = this; - uni.chooseImage({ - count: 4, - sizeType: ['original', 'compressed'], // 鍙互鎸囧畾鏄師鍥捐繕鏄帇缂╁浘锛岄粯璁や簩鑰呴兘鏈� - sourceType: ['album'], // 浠庣浉鍐岄�夋嫨 - success: (res) => { - // 瀛樺偍閫夋嫨鐨勫浘鐗囪矾寰� - that.imgListinitialAccept = res.tempFilePaths; - - // 鍒濆鍖� formData.avatar 涓虹┖瀛楃涓� - that.formData.avatarFile = []; - - // 鍒涘缓涓婁紶浠诲姟鐨� Promise 鏁扮粍 - const uploadPromises = res.tempFilePaths.map((filePath, index) => { - return new Promise((resolve, reject) => { - that.$http.upload(that.url.upload, { - filePath: filePath, - name: 'file' - }) - .then(uploadRes => { - // 鍋囪鏈嶅姟鍣ㄨ繑鍥炵殑缁撴灉涓寘鍚枃浠惰矾寰� - const filePath = uploadRes.data.result[0]; - this.formData.avatarFile.push(filePath); - resolve(filePath); - }) - .catch(err => { - console.error('鍥剧墖' + index + '涓婁紶澶辫触:', err); - reject(err); - }); - }); - }); - - // 骞跺彂鎵ц鎵�鏈変笂浼犱换鍔� - Promise.all(uploadPromises) - .then((uploadedFilePaths) => { - console.log('鎵�鏈夊浘鐗囦笂浼犳垚鍔�:', that.formData.avatarFile); + .then(uploadRes => { + // 鍋囪鏈嶅姟鍣ㄨ繑鍥炵殑缁撴灉涓寘鍚枃浠惰矾寰� + const serverFilePath = uploadRes.data.result[0]; + this.formData.avatarFile.push(serverFilePath); + resolve(uploadRes); // 杩斿洖缁撴灉缁� Promise.all }) - .catch((err) => { - console.error('鍥剧墖涓婁紶澶辫触:', err); - that.$tip.error('鍥剧墖涓婁紶澶辫触'); + .catch(err => { + console.error(`鍥剧墖 ${index + 1} 涓婁紶澶辫触:`, err); + reject(err); }); - } + }); }); - }, - ChooseImage() { - var that = this; - uni.chooseImage({ - count: 4, - sizeType: ['original', 'compressed'], // 鍙互鎸囧畾鏄師鍥捐繕鏄帇缂╁浘锛岄粯璁や簩鑰呴兘鏈� - sourceType: ['album'], // 浠庣浉鍐岄�夋嫨 - success: (res) => { - // 瀛樺偍閫夋嫨鐨勫浘鐗囪矾寰� - that.imgList = res.tempFilePaths; - - // 鍒濆鍖� formData.avatar 涓虹┖瀛楃涓� - that.formData.avatar = []; - - // 鍒涘缓涓婁紶浠诲姟鐨� Promise 鏁扮粍 - const uploadPromises = res.tempFilePaths.map((filePath, index) => { - return new Promise((resolve, reject) => { - that.$http.upload(that.url.upload, { - filePath: filePath, - name: 'file' - }) - .then(uploadRes => { - // 鍋囪鏈嶅姟鍣ㄨ繑鍥炵殑缁撴灉涓寘鍚枃浠惰矾寰� - const filePath = uploadRes.data.result[0]; - this.formData.avatar.push(filePath); - resolve(filePath); - }) - .catch(err => { - console.error('鍥剧墖' + index + '涓婁紶澶辫触:', err); - reject(err); - }); - }); + Promise.all(uploadPromises) + .then(() => { + uni.hideLoading(); + uni.showToast({ + title: '鍏ㄩ儴涓婁紶鎴愬姛' }); - - // 骞跺彂鎵ц鎵�鏈変笂浼犱换鍔� - Promise.all(uploadPromises) - .then((uploadedFilePaths) => { - console.log('鎵�鏈夊浘鐗囦笂浼犳垚鍔�:', that.formData.avatar); + }) + .catch(err => { + uni.hideLoading(); + uni.showToast({ + title: '閮ㄥ垎涓婁紶澶辫触111', + icon: 'none' + }); + console.error('涓婁紶寮傚父:', err); + }); + }, + selectFirstFanl(e) { + const tempFilePaths = e.tempFilePaths; + uni.showLoading({ + title: '涓婁紶涓�...' + }); + const uploadPromises = tempFilePaths.map((filePath, index) => { + return new Promise((resolve, reject) => { + this.$http.upload(this.url.upload, { + filePath: filePath, + name: 'file' }) - .catch((err) => { - console.error('鍥剧墖涓婁紶澶辫触:', err); - that.$tip.error('鍥剧墖涓婁紶澶辫触'); + .then(uploadRes => { + // 鍋囪鏈嶅姟鍣ㄨ繑鍥炵殑缁撴灉涓寘鍚枃浠惰矾寰� + const serverFilePath = uploadRes.data.result[0]; + this.formData.avatarFinal.push(serverFilePath); + resolve(uploadRes); // 杩斿洖缁撴灉缁� Promise.all + }) + .catch(err => { + console.error(`鍥剧墖 ${index + 1} 涓婁紶澶辫触:`, err); + reject(err); }); - } + }); }); + + Promise.all(uploadPromises) + .then(() => { + uni.hideLoading(); + uni.showToast({ + title: '鍏ㄩ儴涓婁紶鎴愬姛' + }); + }) + .catch(err => { + uni.hideLoading(); + uni.showToast({ + title: '閮ㄥ垎涓婁紶澶辫触222', + icon: 'none' + }); + console.error('涓婁紶寮傚父:', err); + }); }, - ViewImageFinal(e) { - uni.previewImage({ - urls: this.imgListfinalAcceptanceFilesResult, - current: e.currentTarget.dataset.url + select(e) { + const tempFilePaths = e.tempFilePaths; + uni.showLoading({ + title: '涓婁紶涓�...' }); - }, - ViewImage(e) { - uni.previewImage({ - urls: this.imgList, - current: e.currentTarget.dataset.url + const uploadPromises = tempFilePaths.map((filePath, index) => { + return new Promise((resolve, reject) => { + this.$http.upload(this.url.upload, { + filePath: filePath, + name: 'file' + }) + .then(uploadRes => { + // 鍋囪鏈嶅姟鍣ㄨ繑鍥炵殑缁撴灉涓寘鍚枃浠惰矾寰� + const serverFilePath = uploadRes.data.result[0]; + this.formData.avatar.push(serverFilePath); + resolve(uploadRes); // 杩斿洖缁撴灉缁� Promise.all + }) + .catch(err => { + console.error(`鍥剧墖 ${index + 1} 涓婁紶澶辫触:`, err); + reject(err); + }); + }); }); - }, - ViewImageFile(e) { - uni.previewImage({ - urls: this.imgListinitialAccept, - current: e.currentTarget.dataset.url - }); - }, - DelImgFinal(e) { - uni.showModal({ - title: '鎻愮ず', - content: '纭畾瑕佸垹闄よ繖娈靛洖蹇嗗悧锛�', - cancelText: '鍐嶇湅鐪�', - confirmText: '鍐嶈', - success: res => { - if (res.confirm) { - this.imgListfinalAcceptanceFilesResult.splice(e.currentTarget.dataset.index, 1) - } - } - }) - }, - DelImgFile(e) { - uni.showModal({ - title: '鎻愮ず', - content: '纭畾瑕佸垹闄よ繖娈靛洖蹇嗗悧锛�', - cancelText: '鍐嶇湅鐪�', - confirmText: '鍐嶈', - success: res => { - if (res.confirm) { - this.imgListinitialAccept.splice(e.currentTarget.dataset.index, 1) - } - } - }) - }, - DelImg(e) { - uni.showModal({ - title: '鎻愮ず', - content: '纭畾瑕佸垹闄よ繖娈靛洖蹇嗗悧锛�', - cancelText: '鍐嶇湅鐪�', - confirmText: '鍐嶈', - success: res => { - if (res.confirm) { - this.imgList.splice(e.currentTarget.dataset.index, 1) - } - } - }) + + Promise.all(uploadPromises) + .then(() => { + uni.hideLoading(); + uni.showToast({ + title: '鍏ㄩ儴涓婁紶鎴愬姛' + }); + }) + .catch(err => { + uni.hideLoading(); + uni.showToast({ + title: '閮ㄥ垎涓婁紶澶辫触', + icon: 'none' + }); + console.error('涓婁紶寮傚父:', err); + }); }, + // 鍒犻櫎 + deletea(e) { + console.log('鍒犻櫎鍥剧墖', e); + }, + + // 鍒犻櫎 + deleteFirst(e) { + console.log('鍒犻櫎鍥剧墖', e); + }, + + deleteFanl(e) { + console.log('鍒犻櫎鍥剧墖', e); + }, upCallback() { console.log(configService.staticURL) this.$http.get(this.url.stallList, { @@ -701,35 +677,83 @@ this.formData.maintenanceDate = this.announcement1.maintenanceDate this.formData.remark = this.announcement1.remark this.ScanData.finalAcceptanceComment = this.announcement1.finalAcceptanceComment + if (this.announcement1.randomInspectionFlag != null) { + this.ScanData.InspectionFlagName = this.announcement1.randomInspectionFlag + } + + if (this.announcement1.finalRandomInspectionFlag != null) { + this.ScanData.finalFlagName = this.announcement1.finalRandomInspectionFlag + } this.formData.maintenanceStatus = this.announcement1.maintenanceStatus + switch (this.formData.maintenanceStatus) { /** * 鍒濇 */ case 'WAIT_INITIAL_ACCEPTANCE': - this.title = '鍒濇' - this.isShowSure = true; - this.isHideFist = true; + if (this.flag == 'task') { + this.title = '璇︽儏' + this.readonly = true; + this.readonlyFirst = true; + this.isShowSure = true; + this.isHideFist = true; + this.isShowLast = true; + this.isShowBtn = false; + } else { + this.title = '鍒濇' + this.readonly = true + this.isShowSure = true; + this.isHideFist = true; + } + break /** * 缁堥獙 */ case 'WAIT_FINAL_ACCEPTANCE': - this.title = '缁堥獙' - this.isHideFist = true; - this.isShowLast = true; - this.isShowSure = true; - this.isHideLast = true; + if (this.flag == 'task') { + this.title = '缁堥獙' + this.readonly = true + this.readonlyFirst = true + this.isHideFist = true; + this.isShowLast = true; + this.isShowSure = true; + this.isHideLast = true; + this.isShowBtn = false; + this.isfinal = true; + this.readonlyFirstFanl = true; + } else { + this.title = '璁捐兘閮ㄧ粓楠�' + this.readonly = true + this.readonlyFirst = true + this.isHideFist = true; + this.isShowLast = true; + this.isShowSure = true; + this.isHideLast = true; + } + break /** * 鎵ц */ case 'WAIT_CONFIRM': - this.title = '鎵ц' - this.isHideLast = false - this.isHideFist = false - this.isShowBtn=false - this.isShowSure=true + + if (this.flag == 'task') { + this.title = '璇︽儏' + this.readonly = true + this.isHideLast = false + this.isHideFist = false + this.isShowBtn = false + this.isShowSure = true + } else { + this.title = '鐝粍闀跨‘璁�' + this.isHideLast = false + this.readonly = true + this.isHideFist = false + this.isShowBtn = true + this.isShowSure = false + } + break case 'COMPLETE': this.isShowSure = true; @@ -737,6 +761,9 @@ this.isHideFist = true this.isShowLast = true this.isfinal = true + this.readonlyFirst = true + this.readonly = true + this.readonlyFirstFanl = true this.isShowBtn = false this.title = '璇︽儏' break @@ -745,31 +772,94 @@ this.ScanData.typeName = this.announcement1.confirmDealType this.formData.id = this.announcement1.id this.ScanData.handlingSuggestion = this.announcement1.confirmComment - this.formData.avatar = this.announcement1.imageFiles - this.imageFilesList = JSON.parse(this.formData.avatar) - const imageObjects = JSON.parse(this.formData.avatar); - // 鎻愬彇 filePath 骞舵嫾鎺� IP 鍜岀鍙� - this.imgList = imageObjects.map(imageObj => { - return `${this.ipAndPort}${imageObj.filePath}`; - }); - this.formData.avatarFile = this.announcement1.initialAcceptanceFiles, - this.imageFilesnitialAcceptList = JSON.parse(this.formData.avatarFile) - const imageObjectInIt = JSON.parse(this.formData.avatarFile); - // 鎻愬彇 filePath 骞舵嫾鎺� IP 鍜岀鍙� - this.imgListinitialAccept = imageObjectInIt.map(imageObj => { - return `${this.ipAndPort}${imageObj.filePath}`; - }); + if (this.announcement1.imageFiles) { + try { + const parsedDataFile = JSON.parse(this.announcement1.imageFiles); + this.imageFilesList = parsedDataFile; - this.formData.avatarFinal = this.announcement1.finalAcceptanceFiles, - this.imageObjectFinal = JSON.parse(this.formData.avatarFinal) - const imageObjectFinal = JSON.parse(this.formData.avatarFinal); - // 鎻愬彇 filePath 骞舵嫾鎺� IP 鍜岀鍙� - this.imgListfinalAcceptanceFilesResult = imageObjectFinal.map(imageObj => { - return `${this.ipAndPort}${imageObj.filePath}`; - }); + this.imgList = parsedDataFile.map(imageObj => { + return `${this.ipAndPort}${imageObj.filePath}`; + }); + + this.fileLists = this.imgList.map(url => ({ + url: url, + extname: 'png', + name: 'eam' + })); + } catch (error) { + console.error('JSON 瑙f瀽澶辫触:', error); + this.imageObjectFinal = []; + this.imgListfinalAcceptanceFilesResult = []; + this.fileListFanl = []; + } + } else { + // 褰撳�间负 null 鎴栫┖瀛楃涓叉椂鍒濆鍖栦负绌烘暟缁� + this.imageObjectFinal = []; + this.imgListfinalAcceptanceFilesResult = []; + this.fileListFanl = []; + } + + + if (this.announcement1.initialAcceptanceFiles) { + try { + const parsedDataIn = JSON.parse(this.announcement1.initialAcceptanceFiles); + this.imageObjectInIt = parsedDataIn; + + this.imgListinitialAccept = parsedDataIn.map(imageObj => { + return `${this.ipAndPort}${imageObj.filePath}`; + }); + + this.fileList = this.imgListinitialAccept.map(url => ({ + url: url, + extname: 'png', + name: 'eam' + })); + } catch (error) { + console.error('JSON 瑙f瀽澶辫触:', error); + this.imageObjectInIt = []; + this.imgListinitialAccept = []; + this.fileList = []; + } + } else { + // 澶勭悊绌哄�兼儏鍐� + this.imageObjectInIt = []; + this.imgListinitialAccept = []; + this.fileList = []; + } + + + console.log('finalAcceptanceFiles:', this.announcement1.finalAcceptanceFiles); + + // 鍒ゆ柇鏄惁涓� null 鎴� 绌哄瓧绗︿覆 + if (this.announcement1.finalAcceptanceFiles) { + try { + const parsedData = JSON.parse(this.announcement1.finalAcceptanceFiles); + this.imageObjectFinal = parsedData; + + this.imgListfinalAcceptanceFilesResult = parsedData.map(imageObj => { + return `${this.ipAndPort}${imageObj.filePath}`; + }); + + this.fileListFanl = this.imgListfinalAcceptanceFilesResult.map(url => ({ + url: url, + extname: 'png', + name: 'eam' + })); + } catch (error) { + console.error('JSON 瑙f瀽澶辫触:', error); + this.imageObjectFinal = []; + this.imgListfinalAcceptanceFilesResult = []; + this.fileListFanl = []; + } + } else { + // 褰撳�间负 null 鎴栫┖瀛楃涓叉椂鍒濆鍖栦负绌烘暟缁� + this.imageObjectFinal = []; + this.imgListfinalAcceptanceFilesResult = []; + this.fileListFanl = []; + } } }).catch(() => { @@ -848,4 +938,29 @@ margin-top: 85px; height: auto; } + + .divider { + display: flex; + align-items: center; + text-align: center; + color: gray; + /* 鏂囧瓧棰滆壊 */ + margin: 20px 0; + /* 涓婁笅闂磋窛 */ + } + + .divider::before, + .divider::after { + content: ''; + flex: 1; + border-bottom: 1px solid gray; + /* 妯嚎棰滆壊 */ + margin: 0 16px; + /* 妯嚎涓庢枃瀛椾箣闂寸殑闂磋窛 */ + } + + .divider text { + white-space: nowrap; + /* 闃叉鏂囧瓧鎹㈣ */ + } </style> \ No newline at end of file diff --git a/pages/ToDoList/ToDoList.vue b/pages/ToDoList/ToDoList.vue index ec6a11d..30dfdc5 100644 --- a/pages/ToDoList/ToDoList.vue +++ b/pages/ToDoList/ToDoList.vue @@ -3,6 +3,11 @@ <cu-custom :bgColor="NavBarColor" :isBack="true" backRouterName="productionTask"> <block slot="backText">杩斿洖</block> <block slot="content">寰呭姙</block> + <block slot="right"> + <view @click="search"> + <image class="search" src="/static/icon/sear.png" style="width: 25px; height: 25px;" alt="" /> + </view> + </block> </cu-custom> <view style="width: 100%;"> @@ -11,11 +16,14 @@ <!-- 鍩虹琛ㄥ崟鏍¢獙 --> <uni-forms ref="form" :modelValue="formData" validate-trigger="bind" err-show-type="undertext"> <uni-group title="" top="0"> - <uni-forms-item name="numbers" label="棰嗘枡鐢宠鍗曞彿:"> - <uni-easyinput type="text" v-model="formData.num" placeholder="璇疯緭鍏ラ鏂欑敵璇峰崟鍙锋绱�" /> + <uni-forms-item name="num" :labelWidth="80" label="娴佺▼鍒嗙被:"> + + + <uni-data-select v-model="formData.type" :localdata="typeList" @change="changetypeList" + placeholder="璇烽�夋嫨娴佺▼" /> </uni-forms-item> - <uni-forms-item name="name" label="棰嗘枡浜у搧:"> - <uni-easyinput v-model="formData.partNumNameModel" placeholder="璇疯緭鍏ラ鏂欎骇鍝�" /> + <uni-forms-item name="name" :labelWidth="80" label="璁惧缂栧彿:"> + <uni-easyinput v-model="formData.num" placeholder="璇疯緭鍏ヨ澶囩紪鍙�" /> </uni-forms-item> </uni-group> </uni-forms> @@ -47,7 +55,7 @@ {{item.flowName}} </view> </view> - + <view class="flex"> <view class="flex-sub text-light bg-white padding-xs margin-xs radius">涔嬪墠澶勭悊浜�:</view> <view class="flex-sub bg-white padding-xs margin-xs text-blue radius text-right"> @@ -91,12 +99,12 @@ scrollLeft: 0, formData: { num: '', - partNumNameModel: '' + type: '' }, NavBarColor: this.NavBarColor, activeColor: '#5277A6', url: { - + flowType: "/sys/dict/getDictItems/flow_type", stallList: "/assign/flow/toTaskBySelf" }, @@ -118,6 +126,7 @@ color: '#2979FF', borderColor: '#2979FF' }, + typeList: [], msgList: [], //鍒楄〃鏁版嵁 announcement1: [], msg1Count: 0, @@ -144,152 +153,94 @@ } }, - created() {}, + created() { + this.getTypeList() + }, methods: { + /** + * 娴佺▼鍒嗙被鍒楄〃浜嬩欢 + */ + getTypeList() { + this.$http.get(this.url.flowType).then(res => { + //璁剧疆鍒楄〃鏁版嵁 + if (res.data.success) { + console.log(res) + this.typeList = res.data.result + } + }).catch(() => { + //鑱旂綉澶辫触, 缁撴潫鍔犺浇 + }) + }, + changetypeList(e) { + this.formData.type = e; + }, /** * @param {Object} item * 璇︽儏椤甸潰 */ onClickProductionTask(item) { - const name = item.name; - const type = item.category_dictText; - let url = ''; - - switch (true) { - case (name === '鏄惁闇�瑕侀鐢ㄥ浠�' && type === '璁惧缁翠慨'): - url = '/pages/ToDoList/ToDoSpareParts/ToDoSpareParts'; - break; - case (name === '鐐规鎵ц' && type === '璁惧鐐规'): - url = '/pages/ToDoList/ToDoListDeils/ToDoCheckDetils/ToDoCheckDetils'; - break; - case (name === '鍛ㄤ繚鎵ц' && type === '璁惧鍛ㄤ繚'): - url = '/pages/ToDoList/ToDoBaoZhou/ToDoBaoZhou'; - break; - case (name === '鐝粍闀跨‘璁�' && type === '璁惧鐐规'): - url = '/pages/ToDoList/ToDoListCheckSure/ToDoListCheckSure'; - break; - case (name === '鐝粍闀跨‘璁�' && type === '璁惧鍛ㄤ繚'): - url = '/pages/ToDoList/ToDoBaoZhouSure/ToDoBaoZhouSure'; - break; - case (name === '璁剧鍛樺垵楠�' && type === '璁惧鍛ㄤ繚'): - url = '/pages/ToDoList/ToDoBaoZhouSure/ToDoBaoZhouSure'; - break; - case (name === '璁捐兘閮ㄧ粓楠�' && type === '璁惧鍛ㄤ繚'): - url = '/pages/ToDoList/ToDoBaoZhouSure/ToDoBaoZhouSure'; - break; - case (name === '绠$悊鍛橀鐢ㄥ浠�' && type === '璁惧缁翠慨'): - url = '/pages/ToDoList/ToDoSpareParts/ToDoSpareParts'; - break; - case (name === '鎿嶄綔宸ョ‘璁�' && type === '璁惧缁翠慨'): - url = '/pages/ToDoList/ToDoSpareParts/ToDoSpareParts'; - break; - case (name === '缁翠慨鎵ц' && type === '璁惧缁翠慨'): - url = '/pages/ToDoList/ToDoSpareParts/ToDoSpareParts'; - break; - case (name === '鐐规宸ュ崟' && type === '璁惧鐐规'): - url = '/pages/ToDoList/ToDoListDeils/ToDoCheckDetils/ToDoCheckDetils'; - break; - default: - console.warn(`No URL found for name: ${name} and type: ${type}`); - return; - } - - if (url) { - uni.navigateTo({ - url: `${url}?item=${encodeURIComponent(JSON.stringify(item))}` - }); - } + const name = item.name; + const type = item.category_dictText; + let url = ''; + + switch (true) { + case (name === '鏄惁闇�瑕侀鐢ㄥ浠�' && type === '璁惧缁翠慨'): + url = '/pages/ToDoList/ToDoSpareParts/ToDoSpareParts'; + break; + case (name === '鐐规鎵ц' && type === '璁惧鐐规'): + url = '/pages/ToDoList/ToDoListDeils/ToDoCheckDetils/ToDoCheckDetils'; + break; + case (name === '鍛ㄤ繚鎵ц' && type === '璁惧鍛ㄤ繚'): + url = '/pages/ToDoList/ToDoBaoZhou/ToDoBaoZhou'; + break; + case (name === '鐝粍闀跨‘璁�' && type === '璁惧鐐规'): + url = '/pages/ToDoList/ToDoListCheckSure/ToDoListCheckSure'; + break; + case (name === '鐝粍闀跨‘璁�' && type === '璁惧鍛ㄤ繚'): + url = '/pages/ToDoList/ToDoBaoZhouSure/ToDoBaoZhouSure'; + break; + case (name === '璁剧鍛樺垵楠�' && type === '璁惧鍛ㄤ繚'): + url = '/pages/ToDoList/ToDoBaoZhouSure/ToDoBaoZhouSure'; + break; + case (name === '璁捐兘閮ㄧ粓楠�' && type === '璁惧鍛ㄤ繚'): + url = '/pages/ToDoList/ToDoBaoZhouSure/ToDoBaoZhouSure'; + break; + case (name === '绠$悊鍛橀鐢ㄥ浠�' && type === '璁惧缁翠慨'): + url = '/pages/ToDoList/ToDoSpareParts/ToDoSpareParts'; + break; + case (name === '鎿嶄綔宸ョ‘璁�' && type === '璁惧缁翠慨'): + url = '/pages/ToDoList/ToDoSpareParts/ToDoSpareParts'; + break; + case (name === '缁翠慨鎵ц' && type === '璁惧缁翠慨'): + url = '/pages/ToDoList/ToDoSpareParts/ToDoSpareParts'; + break; + case (name === '鐐规宸ュ崟' && type === '璁惧鐐规'): + url = '/pages/ToDoList/ToDoListDeils/ToDoCheckDetils/ToDoCheckDetils'; + break; + default: + console.warn(`No URL found for name: ${name} and type: ${type}`); + return; + } + + if (url) { + uni.redirectTo({ + url: `${url}?item=${encodeURIComponent(JSON.stringify(item))}` + }); + } }, - - - // onClickProductionTask(item) { - // const name = item.name - // const type=item.category_dictText - // if (name == '鏄惁闇�瑕侀鐢ㄥ浠�' && type=='璁惧缁翠慨') { - // uni.navigateTo({ - // url: '/pages/ToDoList/ToDoSpareParts/ToDoSpareParts?item=' + - // encodeURIComponent(JSON.stringify(item)) - // }) - // } else if (name == '鐐规鎵ц' && type=='璁惧鐐规') { - - // uni.navigateTo({ - // url: '/pages/ToDoList/ToDoListDeils/ToDoCheckDetils/ToDoCheckDetils?item=' + - // encodeURIComponent(JSON.stringify(item)) - - // }) - // } else if (name == '鍛ㄤ繚鎵ц' && type=='璁惧鍛ㄤ繚') { - // uni.navigateTo({ - // url: '/pages/ToDoList/ToDoBaoZhou/ToDoBaoZhou?item=' + - // encodeURIComponent(JSON.stringify(item)) - - // }) - // }else if (name == '鐝粍闀跨‘璁�' && type=='璁惧鐐规') { - // uni.navigateTo({ - // url: '/pages/ToDoList/ToDoListCheckSure/ToDoListCheckSure?item=' + - // encodeURIComponent(JSON.stringify(item)) - - // }) - // }else if (name == '鐝粍闀跨‘璁�' && type=='璁惧鍛ㄤ繚') { - // uni.navigateTo({ - // url: '/pages/ToDoList/ToDoBaoZhouSure/ToDoBaoZhouSure?item=' + - // encodeURIComponent(JSON.stringify(item)) - - // }) - // }else if (name == '璁剧鍛樺垵楠�' && type=='璁惧鍛ㄤ繚') { - // uni.navigateTo({ - // url: '/pages/ToDoList/ToDoBaoZhouSure/ToDoBaoZhouSure?item=' + - // encodeURIComponent(JSON.stringify(item)) - - // }) - // }else if (name == '璁捐兘閮ㄧ粓楠�' && type=='璁惧鍛ㄤ繚') { - // uni.navigateTo({ - // url: '/pages/ToDoList/ToDoBaoZhouSure/ToDoBaoZhouSure?item=' + - // encodeURIComponent(JSON.stringify(item)) - - // }) - // }else if (name == '绠$悊鍛橀鐢ㄥ浠�' && type=='璁惧缁翠慨') { - // uni.navigateTo({ - // url: '/pages/ToDoList/ToDoSpareParts/ToDoSpareParts?item=' + - // encodeURIComponent(JSON.stringify(item)) - - // }) - // }else if (name == '鎿嶄綔宸ョ‘璁�' && type=='璁惧缁翠慨') { - // uni.navigateTo({ - // url: '/pages/ToDoList/ToDoSpareParts/ToDoSpareParts?item=' + - // encodeURIComponent(JSON.stringify(item)) - - // }) - // }else if (name == '缁翠慨鎵ц' && type=='璁惧缁翠慨') { - // uni.navigateTo({ - // url: '/pages/ToDoList/ToDoSpareParts/ToDoSpareParts?item=' + - // encodeURIComponent(JSON.stringify(item)) - - // }) - // }else if (name == '鐐规宸ュ崟' && type=='璁惧鐐规') { - // uni.navigateTo({ - // url: '/pages/ToDoList/ToDoListDeils/ToDoCheckDetils/ToDoCheckDetils?item=' + - // encodeURIComponent(JSON.stringify(item)) - - // }) - // } - - - - // }, search() { this.$refs.popup.open(); }, - upCallback(page) { this.$http.get(this.url.stallList, { params: { pageNo: page.num, pageSize: page.size, - order: 'asc', + order: 'desc', column: 'createTime' }, @@ -321,7 +272,7 @@ resetTask() { this.formData.num = '' - this.formData.partNumNameModel = '' + this.formData.type = '' this.$refs.popup.close(); this.mescroll.resetUpScroll() @@ -329,125 +280,41 @@ /* 妫�绱� */ getSera() { this.$refs.popup.close(); - let keyword = this.TabCur this.msgList = []; + this.$http.get(this.url.stallList, { + params: { + pageNo: 1, + pageSize: 9999, + order: "desc", + column: "createTime", + title: this.formData.num, + category: this.formData.type - if (keyword == 0) { - this.$http.get(this.url.stallList, { - params: { - pageNo: 1, - pageSize: 999, - order: "desc", - column: "createTime", - num: '*' + this.formData.num + '*', - partNumNameModel: '*' + this.formData.partNumNameModel + '*', - status: 'published' + } + }).then(res => { + //鑱旂綉鎴愬姛鐨勫洖璋�,闅愯棌涓嬫媺鍒锋柊鍜屼笂鎷夊姞杞界殑鐘舵��; + + this.announcement1 = res.data.result.records + this.mescroll.endSuccess(this.announcement1.length); + console.log("url", res) + //璁剧疆鍒楄〃鏁版嵁 + if (res.data.success) { + console.log("res", res.data) + this.msg1Count = res.data.result.total + this.msg1Title = "閫氱煡(" + res.data.result.total + ")"; + for (let annItem of this.announcement1) { + this.msgList.push(annItem) } - }).then(res => { - //鑱旂綉鎴愬姛鐨勫洖璋�,闅愯棌涓嬫媺鍒锋柊鍜屼笂鎷夊姞杞界殑鐘舵��; + } + if (page.num == 1) { + this.msgList = []; //濡傛灉鏄涓�椤甸渶鎵嬪姩鍒剁┖鍒楄〃 + this.msgList = this.msgList.concat(this.announcement1); //杩藉姞鏂版暟鎹� + } - this.announcement1 = res.data.result.records - this.mescroll.endSuccess(this.announcement1.length); - console.log("url", res) - //璁剧疆鍒楄〃鏁版嵁 - if (res.data.success) { - console.log("res", res.data) - this.msg1Count = res.data.result.total - this.msg1Title = "閫氱煡(" + res.data.result.total + ")"; - for (let annItem of this.announcement1) { - this.msgList.push(annItem) - } - } - if (page.num == 1) { - this.msgList = []; //濡傛灉鏄涓�椤甸渶鎵嬪姩鍒剁┖鍒楄〃 - this.msgList = this.msgList.concat(this.announcement1); //杩藉姞鏂版暟鎹� - } - - }).catch(() => { - //鑱旂綉澶辫触, 缁撴潫鍔犺浇 - this.mescroll.endErr(); - }) - - } else if (keyword == 1) { - this.$http.get(this.url.stallList, { - params: { - pageNo: 1, - pageSize: 999, - order: "desc", - column: "createTime", - status: 'training', - num: '*' + this.formData.num + '*', - partNumNameModel: '*' + this.formData.partNumNameModel + '*' - - } - }).then(res => { - //鑱旂綉鎴愬姛鐨勫洖璋�,闅愯棌涓嬫媺鍒锋柊鍜屼笂鎷夊姞杞界殑鐘舵��; - - this.announcement1 = res.data.result.records - this.mescroll.endSuccess(this.announcement1.length); - console.log("url", res) - //璁剧疆鍒楄〃鏁版嵁 - if (res.data.success) { - console.log("res", res.data) - this.msg1Count = res.data.result.total - this.msg2Title = "閫氱煡(" + res.data.result.total + ")"; - for (let annItem of this.announcement1) { - this.msgList.push(annItem) - } - } - if (page.num == 1) { - this.msgList = []; //濡傛灉鏄涓�椤甸渶鎵嬪姩鍒剁┖鍒楄〃 - this.msgList = this.msgList.concat(this.announcement1); //杩藉姞鏂版暟鎹� - } - - }).catch(() => { - //鑱旂綉澶辫触, 缁撴潫鍔犺浇 - this.mescroll.endErr(); - }) - - } else if (keyword == 2) { - this.$http.get(this.url.stallList, { - params: { - pageNo: 1, - pageSize: 999, - order: "desc", - column: "createTime", - status: 'completed', - num: '*' + this.formData.num + '*', - partNumNameModel: '*' + this.formData.partNumNameModel + '*' - - } - }).then(res => { - //鑱旂綉鎴愬姛鐨勫洖璋�,闅愯棌涓嬫媺鍒锋柊鍜屼笂鎷夊姞杞界殑鐘舵��; - - this.announcement1 = res.data.result.records - this.mescroll.endSuccess(this.announcement1.length); - console.log("url", res) - //璁剧疆鍒楄〃鏁版嵁 - if (res.data.success) { - console.log("res", res.data) - this.msg3Count = res.data.result.total - this.msg1Title = "閫氱煡(" + res.data.result.total + ")"; - for (let annItem of this.announcement1) { - this.msgList.push(annItem) - } - } - if (page.num == 1) { - this.msgList = []; //濡傛灉鏄涓�椤甸渶鎵嬪姩鍒剁┖鍒楄〃 - this.msgList = this.msgList.concat(this.announcement1); //杩藉姞鏂版暟鎹� - } - - }).catch(() => { - //鑱旂綉澶辫触, 缁撴潫鍔犺浇 - this.mescroll.endErr(); - }) - - } - - - - - + }).catch(() => { + //鑱旂綉澶辫触, 缁撴潫鍔犺浇 + this.mescroll.endErr(); + }) }, diff --git a/pages/ToDoList/ToDoListCheckSure/ToDoListCheckSure.vue b/pages/ToDoList/ToDoListCheckSure/ToDoListCheckSure.vue index 4baac9a..f123279 100644 --- a/pages/ToDoList/ToDoListCheckSure/ToDoListCheckSure.vue +++ b/pages/ToDoList/ToDoListCheckSure/ToDoListCheckSure.vue @@ -5,11 +5,23 @@ <block slot="content">{{title}}</block> </cu-custom> <view class="container"> + <template> + <!-- 娴獥閬僵灞� --> + <view v-if="showPreview" class="overlay" @tap.stop="closePreview"> + <view class="modal"> + <!-- 鍏抽棴鎸夐挳 --> + <text class="close-btn" @tap.stop="showPreview = false">×</text> + <!-- 鍥剧墖灞曠ず --> + <image :src="previewImageSrc" mode="aspectFit" class="preview-image" /> + </view> + </view> + </template> <uni-forms ref="form" :modelValue="formData" validate-trigger="bind" err-show-type="undertext"> <uni-group top="1"> - <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 鍩烘湰淇℃伅 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> + <view class="divider"><text>鍩烘湰淇℃伅</text></view> + <!-- <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 鍩烘湰淇℃伅 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> --> <uni-forms-item :label-width="80" name="num" label="宸ュ崟鍙�:"> <uni-easyinput v-model="formData.orderNum" :disabled="true" /> </uni-forms-item> @@ -25,24 +37,18 @@ <uni-easyinput v-model="formData.operator" :disabled="true" /> </uni-forms-item> <uni-forms-item :label-width="80" name="outNum" label="鐐规鍥剧墖:"> - <view class="grid col-4 grid-square flex-sub"> - <view class="bg-img" v-for="(item,index) in imgList" :key="index" @tap="ViewImage" - :data-url="imgList[index]"> - <image :src="imgList[index]" mode="aspectFill"></image> - <view class="cu-tag bg-red radius" @tap.stop="DelImg" :data-index="index"> - <text class='cuIcon-close'></text> - </view> - </view> - <view class="solids" v-if="imgList.length<1"> - <text class='cuIcon-cameraadd'></text> - </view> - </view> + <uni-file-picker limit="9" :value="fileLists" :image-styles="imageStyles" + :sourceType="sourceType" @select="select" @progress="progress" @success="success" + @fail="fail" @delete="deletea" :readonly="readonly" /> + </uni-forms-item> + <uni-forms-item name="outNum" :label-width="80" label="浣滀笟鎸囧:"> + <button class="cu-btn bg-blue" @tap="showPreview = true">鏌ョ湅</button> </uni-forms-item> </uni-group> </uni-forms> - <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 淇濆吇椤逛俊鎭� 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> - + <!-- <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 淇濆吇椤逛俊鎭� 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> --> + <view class="divider"><text>淇濆吇椤逛俊鎭�</text></view> <uni-collapse> <uni-collapse-item :show-animation="true" :accordion="true" title="鏌ョ湅淇濆吇椤�" :border="false" title-border="none"> @@ -63,13 +69,24 @@ <view class="flex"> <view class="flex-sub text-light bg-white padding-xs margin-xs radius">淇濆吇瑕佹眰:</view> - <view class="flex-sub bg-white padding-xs margin-xs radius text-right" + <view class="flex-sub bg-white padding-xs margin-xs radius text-right"> + {{item.itemDemand}} + </view> + + <!-- <view class="flex-sub bg-white padding-xs margin-xs radius text-right" v-if="item.itemDemand!=null && item.itemDemand.length>10"> {{(item.itemDemand).toString().substr(0,10)+'...'}} </view> <view class="flex-sub bg-white padding-xs margin-xs radius text-right" v-else> {{item.itemDemand}} + </view> --> + </view> + <view class="flex"> + <view class="flex-sub text-light bg-white padding-xs margin-xs radius">鐐规缁撴灉:</view> + <view class="flex-sub bg-white padding-xs text-right margin-xs radius"> + <uni-data-select :localdata="item.restle" v-model="item.inspectionResult" + @change="handleCode($event, index)" :disabled="item.istrue" /> </view> </view> <view class="flex"> @@ -79,13 +96,7 @@ :disabled="item.istrue" /> </view> </view> - <view class="flex"> - <view class="flex-sub text-light bg-white padding-xs margin-xs radius">鐐规缁撴灉:</view> - <view class="flex-sub bg-white padding-xs text-right margin-xs radius"> - <uni-data-select :localdata="item.restle" v-model="item.inspectionResult" - @change="handleCode($event, index)" :disabled="item.istrue" /> - </view> - </view> + <view class="flex"> <view class="flex-sub text-light bg-white padding-xs margin-xs radius">寮傚父鎻忚堪:</view> @@ -98,9 +109,11 @@ </uni-collapse> - <uni-forms v-show="isShowTeam" ref="form" :modelValue="ScanData" validate-trigger="bind" err-show-type="undertext"> + <uni-forms v-show="isShowTeam" ref="form" :modelValue="ScanData" validate-trigger="bind" + err-show-type="undertext"> <uni-group top="1"> - <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 鐝粍闀跨‘璁や俊鎭� 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> + <view class="divider"><text>鐝粍闀跨‘璁や俊鎭�</text></view> + <!-- <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�旂彮缁勯暱纭淇℃伅鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> --> <uni-forms-item :label-width="80" required name="typeName" label="澶勭悊绫诲瀷:"> <uni-data-select v-model="ScanData.typeName" :localdata="ScanData.handlingType" @change="changehandlingType" placeholder="璇烽�夋嫨" :disabled="isTouch" /> @@ -128,9 +141,19 @@ mixins: [MescrollMixin], // 浣跨敤mixin data() { return { - isShowTeam:false, + showPreview: false, + readonly: false, + // 鍥剧墖鍥炴樉 + fileLists: [], + // 涓婁紶鍥剧墖鐨勬牱寮� + imageStyles: { + width: 90, + height: 90, + }, + sourceType: ['album', 'camera'], + isShowTeam: false, isShowBtn: true, - title: '鐝粍闀跨‘璁�', + title: '', isTouch: false, scrollLeft: 0, searchValue: '', @@ -165,7 +188,7 @@ url: { upload: "/eam/sysFiles/batch_upload", stallList: "/eam/eamInspectionOrder/queryById", - // getEquipmentList: "eam/equipment/asyncLoadEquipment", + getStandardFile: "eam/maintenanceStandard/queryById", getEquipmentList: 'eam/equipment/list', BaoList: 'eam/eamInspectionOrderDetail/queryList', approval: 'eam/eamInspectionOrder/approval' @@ -196,7 +219,10 @@ msg2Count: 0, msg1Title: "", procInstId: '', - values: '' + values: '', + flag: '', + standardId: '', + previewImageSrc: '' } @@ -214,11 +240,13 @@ }, onLoad(options) { const annItem = JSON.parse(decodeURIComponent(options.item)); - this.id = annItem.dataId, - this.taskId = annItem.id, - this.procInstId = annItem.procInstId, - this.values = annItem.values, - this.assignee = annItem.assignee + this.flag = options.flag + console.log(this.flag) + this.id = annItem.dataId + this.taskId = annItem.id + this.procInstId = annItem.procInstId + this.values = annItem.values + this.assignee = annItem.assignee }, created() { @@ -231,27 +259,39 @@ changehandlingType(e) { this.ScanData.typeName = e; }, + closePreview() { + this.showPreview = false; + }, ProductionTask() { if (this.hasInspectionDateArrived()) { - if (this.ScanData.typeName == undefined || this.ScanData.typeName == null || this.ScanData.typeName == - '') { + if (this.formData.inspectionStatus == 'WAIT_CONFIRM' && this.flag != 'task') { + if (this.ScanData.typeName == undefined || this.ScanData.typeName == null || this.ScanData + .typeName == + '') { - uni.showToast({ - icon: 'none', - title: '澶勭悊绫诲瀷涓嶈兘涓虹┖' - }); - return false; - } - if (this.ScanData.handlingSuggestion == undefined || this.ScanData.handlingSuggestion == null || this - .ScanData.handlingSuggestion == - '') { + uni.showToast({ + icon: 'none', + title: '澶勭悊绫诲瀷涓嶈兘涓虹┖' + }); + return false; + } + if (this.ScanData.handlingSuggestion == undefined || this.ScanData.handlingSuggestion == null || + this + .ScanData.handlingSuggestion == + '') { - uni.showToast({ - icon: 'none', - title: '澶勭悊鎰忚涓嶈兘涓虹┖' - }); - return false; + uni.showToast({ + icon: 'none', + title: '澶勭悊鎰忚涓嶈兘涓虹┖' + }); + return false; + } } + + uni.showLoading({ + mask: true, + title: "鍔犺浇涓�....", + }) this.$http.post(this.url.approval, { /** * 纭鎰忚 @@ -269,8 +309,7 @@ userId: this.assignee, values: this.values }).then(res => { - console.log(res) - this.$tip.loaded(); + uni.hideLoading(); if (res.data.success) { uni.showToast({ icon: "success", @@ -342,23 +381,6 @@ this.$tip.error("鑱旂綉澶辫触") }) }, - // getEquipment() { - // this.$http.get(this.url.getEquipmentList).then(res => { - // //璁剧疆鍒楄〃鏁版嵁 - // if (res.data.success) { - // this.equipmentList = res.data.result - // } else { - // uni.showToast({ - // icon: "error", - // title: res.data.message, - // duration: 2000 - // }); - - // } - // }).catch(() => { - // this.$tip.error("鑱旂綉澶辫触") - // }) - // }, getList() { this.$http.get(this.url.BaoList, { params: { @@ -399,76 +421,37 @@ //鑱旂綉澶辫触, 缁撴潫鍔犺浇 }) }, - ChooseImage() { - var that = this; - uni.chooseImage({ - count: 4, - sizeType: ['original', 'compressed'], // 鍙互鎸囧畾鏄師鍥捐繕鏄帇缂╁浘锛岄粯璁や簩鑰呴兘鏈� - sourceType: ['album'], // 浠庣浉鍐岄�夋嫨 - success: (res) => { - // 瀛樺偍閫夋嫨鐨勫浘鐗囪矾寰� - that.imgList = res.tempFilePaths; - - // 鍒濆鍖� formData.avatar 涓虹┖瀛楃涓� - - - // 鍒濆鍖� formData.avatar 涓虹┖瀛楃涓� - that.formData.avatar = []; - - - // 鍒涘缓涓婁紶浠诲姟鐨� Promise 鏁扮粍 - const uploadPromises = res.tempFilePaths.map((filePath, index) => { - return new Promise((resolve, reject) => { - that.$http.upload(that.url.upload, { - filePath: filePath, - name: 'file' - }) - .then(uploadRes => { - // 鍋囪鏈嶅姟鍣ㄨ繑鍥炵殑缁撴灉涓寘鍚枃浠惰矾寰� - const filePath = uploadRes.data.result[0]; - this.formData.avatar.push(filePath); - console.log(this.formData.avatar) - resolve(filePath); - }) - .catch(err => { - console.error('鍥剧墖' + index + '涓婁紶澶辫触:', err); - reject(err); - }); - }); - }); - - // 骞跺彂鎵ц鎵�鏈変笂浼犱换鍔� - Promise.all(uploadPromises) - .then((uploadedFilePaths) => { - console.log('鎵�鏈夊浘鐗囦笂浼犳垚鍔�:', that.formData.avatar); - }) - .catch((err) => { - console.error('鍥剧墖涓婁紶澶辫触:', err); - that.$tip.error('鍥剧墖涓婁紶澶辫触'); - }); + getStandardFile() { + this.$http.get(this.url.getStandardFile, { + params: { + id: this.standardId } - }); - }, - ViewImage(e) { - uni.previewImage({ - urls: this.imgList, - current: e.currentTarget.dataset.url - }); - }, - DelImg(e) { - uni.showModal({ - title: '鎻愮ず', - content: '纭畾瑕佸垹闄よ繖娈靛洖蹇嗗悧锛�', - cancelText: '鍐嶇湅鐪�', - confirmText: '鍐嶈', - success: res => { - if (res.confirm) { - this.imgList.splice(e.currentTarget.dataset.index, 1) + }).then(res => { + if (res.data.success) { + console.log("res", res.data.result); + const referenceFileStr = res.data.result.referenceFile; + + // 鍒ゆ柇鏄惁瀛樺湪 referenceFile 骞惰繘琛岃В鏋� + if (referenceFileStr) { + try { + const referenceFileObj = JSON.parse(referenceFileStr); + const filePath = `${this.ipAndPort}${referenceFileObj.filePath}`; + this.previewImageSrc = filePath; + console.log('previewImageSrc:', this.previewImageSrc); + } catch (e) { + console.error("referenceFile 瑙f瀽澶辫触", e); + this.previewImageSrc = ''; + } + } else { + console.warn("referenceFile 涓嶅瓨鍦�"); + this.previewImageSrc = ''; } } - }) + }).catch(err => { + console.error("缃戠粶璇锋眰澶辫触", err); + // 鑱旂綉澶辫触, 缁撴潫鍔犺浇 + }); }, - upCallback() { this.$http.get(this.url.stallList, { params: { @@ -489,17 +472,39 @@ this.ScanData.typeName = this.announcement1.confirmDealType this.formData.confirmComment = this.announcement1.confirmDealType_dictText this.ScanData.handlingSuggestion = this.announcement1.confirmComment - + if (this.announcement1.standardId !== null) { + this.standardId = this.announcement1.standardId + this.getStandardFile() + } if (this.formData.inspectionStatus == 'COMPLETE') { - this.title = '璇︽儏' - this.isTouch = true - this.isShowTeam=true - this.isShowBtn = false + if (this.flag == 'task') { + this.title = '鐝粍闀跨‘璁�' + this.isTouch = true + this.readonly = true + this.isShowTeam = true + this.isShowBtn = false + } } else if (this.formData.inspectionStatus == 'WAIT_CONFIRM') { - this.title = '鐐规寮�濮�'; - this.isShowTeam=true - this.isTouch=true - this.isShowBtn=false + if (this.flag == 'task') { + this.title = '鐐规鎵ц'; + this.readonly = true + this.isShowTeam = true + this.isTouch = true + this.isShowBtn = false + } else { + this.title = '鐐规寮�濮�'; + this.isShowTeam = true + this.isTouch = false + this.readonly = true + this.isShowBtn = true + } + + } else if (this.formData.inspectionStatus == 'UNDER_INSPECTION') { + if (this.flag == 'task') { + this.title = '鐐规寮�濮�'; + this.isShowBtn = false; + + } } this.formData.avatar = this.announcement1.imageFiles this.imageFilesList = JSON.parse(this.formData.avatar) @@ -507,6 +512,13 @@ this.imgList = imageObjects.map(imageObj => { return `${this.ipAndPort}${imageObj.filePath}`; }); + + // 鏍规嵁 imgList 鏋勯�� fileLists + this.fileLists = this.imgList.map(url => ({ + url: url, + extname: 'png', + name: 'eam' + })); this.hasInspectionDateArrived(); } }).catch(() => { @@ -594,4 +606,66 @@ margin-top: 85px; height: auto; } + + .divider { + display: flex; + align-items: center; + text-align: center; + color: gray; + /* 鏂囧瓧棰滆壊 */ + margin: 20px 0; + /* 涓婁笅闂磋窛 */ + } + + .divider::before, + .divider::after { + content: ''; + flex: 1; + border-bottom: 1px solid gray; + /* 妯嚎棰滆壊 */ + margin: 0 16px; + /* 妯嚎涓庢枃瀛椾箣闂寸殑闂磋窛 */ + } + + .divider text { + white-space: nowrap; + /* 闃叉鏂囧瓧鎹㈣ */ + } + + .overlay { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.7); + display: flex; + align-items: center; + justify-content: center; + z-index: 999; + } + + .modal { + position: relative; + width: 90%; + max-width: 600px; + background: #fff; + border-radius: 12rpx; + padding: 20rpx; + box-sizing: border-box; + } + + .preview-image { + width: 100%; + max-height: 80vh; + object-fit: contain; + } + + .close-btn { + position: absolute; + top: 10rpx; + right: 20rpx; + font-size: 40rpx; + color: #333; + } </style> \ No newline at end of file diff --git a/pages/ToDoList/ToDoListDeils/ToDoCheckDetils/ToDoCheckDetils.vue b/pages/ToDoList/ToDoListDeils/ToDoCheckDetils/ToDoCheckDetils.vue index b166a9d..b675259 100644 --- a/pages/ToDoList/ToDoListDeils/ToDoCheckDetils/ToDoCheckDetils.vue +++ b/pages/ToDoList/ToDoListDeils/ToDoCheckDetils/ToDoCheckDetils.vue @@ -5,11 +5,22 @@ <block slot="content">鎵ц</block> </cu-custom> <view class="container"> + <template> + <!-- 娴獥閬僵灞� --> + <view v-if="showPreview" class="overlay" @tap.stop="closePreview"> + <view class="modal"> + <!-- 鍏抽棴鎸夐挳 --> + <text class="close-btn" @tap.stop="showPreview = false">×</text> + <!-- 鍥剧墖灞曠ず --> + <image :src="previewImageSrc" mode="aspectFit" class="preview-image" /> + </view> + </view> - + </template> <uni-forms ref="form" :modelValue="formData" validate-trigger="bind" err-show-type="undertext"> <uni-group top="1"> - <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 鍩烘湰淇℃伅 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> + <view class="divider"><text>鍩烘湰淇℃伅</text></view> + <!-- <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 鍩烘湰淇℃伅 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> --> <uni-forms-item :label-width="80" name="orderNum" label="宸ュ崟鍙�:"> <uni-easyinput v-model="formData.orderNum" :disabled="true" /> </uni-forms-item> @@ -28,41 +39,17 @@ <uni-easyinput type="textarea" v-model="formData.remark" :disabled="true" /> </uni-forms-item> <uni-forms-item :label-width="80" name="outNum" label="鐐规鍥剧墖:"> - <view class="grid col-4 grid-square flex-sub"> - <view class="bg-img" v-for="(item,index) in imgList" :key="index" @tap="ViewImage" - :data-url="imgList[index]"> - <image :src="imgList[index]" mode="aspectFill"></image> - <view class="cu-tag bg-red radius" @tap.stop="DelImg" :data-index="index"> - <text class='cuIcon-close'></text> - </view> - </view> - <view class="solids" @tap="ChooseImage" v-if="imgList.length<1"> - <text class='cuIcon-cameraadd'></text> - </view> - </view> - + <uni-file-picker limit="9" :value="fileLists" :image-styles="imageStyles" + :sourceType="sourceType" @select="select" @progress="progress" @success="success" + @fail="fail" @delete="deletea" /> </uni-forms-item> - <!-- <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 鐝粍闀跨‘璁� 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> - <uni-forms-item name="outNum" required label="纭绫诲瀷:"> - <uni-data-select :localdata="formData.msListCategory" popup-title="璇烽�夋嫨" @change="changeType" - :clear="false"> - </uni-data-select> + <uni-forms-item name="outNum" :label-width="80" label="浣滀笟鎸囧:"> + <button class="cu-btn bg-blue" @tap="showPreview = true">鏌ョ湅</button> </uni-forms-item> - <uni-forms-item name="outNum" required label="纭鎰忚:"> - <uni-easyinput type="textarea" v-model="formData.ttitle" placeholder="璇疯緭鍏ュ唴瀹�"></uni-easyinput> - </uni-forms-item> --> </uni-group> </uni-forms> - - - - - - - <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�斾繚鍏婚」淇℃伅鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> - - + <view class="divider"><text>淇濆吇椤逛俊鎭�</text></view> <view class="padding flex flex-direction"> <button :disabled="isClick" class="mini-btn" type="primary" @click.stop="batchnsIpection()" size="mini">鎵归噺鐐规姝e父</button> @@ -84,33 +71,19 @@ {{item.itemName}} </view> </view> - <!-- <view class="flex"> - <view class="flex-sub text-light bg-white padding-xs margin-xs radius">瀛愪繚鍏婚」:</view> - <view class="flex-sub bg-white padding-xs margin-xs radius text-right" - v-if="item.small!=null && item.small.length>10"> - {{(item.small).toString().substr(0,10)+'...'}} - </view> - - <view class="flex-sub bg-white padding-xs margin-xs radius text-right" v-else> - {{item.small}} - </view> - </view> --> + <view class="flex"> <view class="flex-sub text-light bg-white padding-xs margin-xs radius">淇濆吇瑕佹眰:</view> - <view class="flex-sub bg-white padding-xs margin-xs radius text-right" + <!-- <view class="flex-sub bg-white padding-xs margin-xs radius text-right" v-if="item.itemDemand!=null && item.itemDemand.length>10"> {{(item.itemDemand).toString().substr(0,10)+'...'}} </view> <view class="flex-sub bg-white padding-xs margin-xs radius text-right" v-else> {{item.itemDemand}} - </view> - </view> - <view class="flex"> - <view class="flex-sub text-light bg-white padding-xs margin-xs radius">寮傚父鏄惁鎶ヤ慨:</view> - <view class="flex-sub bg-white padding-xs text-right margin-xs radius"> - <uni-data-select :localdata="item.type" v-model="item.reportFlag" - :disabled="item.istrue" /> + </view> --> + <view class="flex-sub bg-white padding-xs margin-xs radius text-right"> + {{item.itemDemand}} </view> </view> <view class="flex"> @@ -118,6 +91,14 @@ <view class="flex-sub bg-white padding-xs text-right margin-xs radius"> <uni-data-select :localdata="item.restle" v-model="item.inspectionResult" @change="handleCode($event, index)" /> + </view> + </view> + + <view class="flex"> + <view class="flex-sub text-light bg-white padding-xs margin-xs radius">寮傚父鏄惁鎶ヤ慨:</view> + <view class="flex-sub bg-white padding-xs text-right margin-xs radius"> + <uni-data-select :localdata="item.type" @change="handleType($event, index)" + v-model="item.reportFlag" :disabled="item.istrue" /> </view> </view> @@ -145,11 +126,21 @@ </template> <script> + import index from "../../../../store"; import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js"; export default { mixins: [MescrollMixin], // 浣跨敤mixin data() { return { + showPreview: false, + // 鍥剧墖鍥炴樉 + fileLists: [], + // 涓婁紶鍥剧墖鐨勬牱寮� + imageStyles: { + width: 90, + height: 90, + }, + sourceType: ['album', 'camera'], isClick: false, scrollLeft: 0, searchValue: '', @@ -167,10 +158,12 @@ upload: "/eam/sysFiles/batch_upload", stallList: "/eam/eamInspectionOrder/queryById", getEquipmentList: 'eam/equipment/list', - // getEquipmentList: "eam/equipment/asyncLoadEquipment", + getStandardFile: "eam/maintenanceStandard/queryById", BaoList: 'eam/eamInspectionOrderDetail/queryList', approval: 'eam/eamInspectionOrder/approval' }, + previewImageSrc: '', + standardId: '', id: '', taskId: '', inspectionResult: '', @@ -226,7 +219,52 @@ }, methods: { + select(e) { + const tempFilePaths = e.tempFilePaths; + uni.showLoading({ + title: '涓婁紶涓�...' + }); + const uploadPromises = tempFilePaths.map((filePath, index) => { + return new Promise((resolve, reject) => { + this.$http.upload(this.url.upload, { + filePath: filePath, + name: 'file' + }) + .then(uploadRes => { + // 鍋囪鏈嶅姟鍣ㄨ繑鍥炵殑缁撴灉涓寘鍚枃浠惰矾寰� + const serverFilePath = uploadRes.data.result[0]; + this.formData.avatar.push(serverFilePath); + resolve(uploadRes); // 杩斿洖缁撴灉缁� Promise.all + }) + .catch(err => { + console.error(`鍥剧墖 ${index + 1} 涓婁紶澶辫触:`, err); + reject(err); + }); + }); + }); + + Promise.all(uploadPromises) + .then(() => { + uni.hideLoading(); + uni.showToast({ + title: '鍏ㄩ儴涓婁紶鎴愬姛' + }); + }) + .catch(err => { + uni.hideLoading(); + uni.showToast({ + title: '閮ㄥ垎涓婁紶澶辫触', + icon: 'none' + }); + console.error('涓婁紶寮傚父:', err); + }); + }, + + // 鍒犻櫎 + deletea(e) { + console.log('鍒犻櫎鍥剧墖', e); + }, batchnsIpection() { uni.showModal({ title: '鎻愮ず', @@ -252,7 +290,6 @@ .partTakeAdviceDetailList[i] .inspectionResult == null || this .partTakeAdviceDetailList[i].inspectionResult == '') { - /* this.$tip.error("璇疯緭鍏ラ鏂欐暟閲忥紒"); */ uni.showToast({ icon: 'none', title: '鐐规缁撴灉涓嶈兘涓虹┖' @@ -260,6 +297,41 @@ return false; } } + + for (let i = 0; i < this.partTakeAdviceDetailList.length; i++) { + if (this.partTakeAdviceDetailList[i].inspectionResult === "2") { + if (this.partTakeAdviceDetailList[i].reportFlag === undefined || this + .partTakeAdviceDetailList[i].reportFlag === null || this.partTakeAdviceDetailList[i] + .reportFlag === '') { + const index = i + 1 + uni.showModal({ + title: "鎻愮ず", + content: '绗�' + index + '琛屽彿寮傚父鎶ヤ慨蹇呴��', + confirmText: '纭畾', + showCancel: false, + }) + + return false; + + } + if (this.partTakeAdviceDetailList[i].exceptionDescription == undefined || this + .partTakeAdviceDetailList[i].exceptionDescription == null || this + .partTakeAdviceDetailList[i].exceptionDescription == '') { + const index = i + 1 + uni.showModal({ + title: "鎻愮ず", + content: '绗�' + index + '琛屽彿寮傚父鎻忚堪闇�濉啓', + confirmText: '纭畾', + showCancel: false, + }) + return false; + + } + + + } + } + uni.showLoading({ mask: true, @@ -289,9 +361,6 @@ title: '鎻愪氦鎴愬姛', duration: 2000 }); - // this.$Router.replace({ - // name: 'ToDoList' - // }) this.$Router.replaceAll({ name: 'ToDoList' }) @@ -314,7 +383,9 @@ } }, - + closePreview() { + this.showPreview = false; + }, changeEquipmentList(e) { this.formData.num = e; }, @@ -328,23 +399,11 @@ this.partTakeAdviceDetailList[index].istrue = true; } }, - // getEquipment() { - // this.$http.get(this.url.getEquipmentList).then(res => { - // //璁剧疆鍒楄〃鏁版嵁 - // if (res.data.success) { - // this.equipmentList = res.data.result - // } else { - // uni.showToast({ - // icon: "error", - // title: res.data.message, - // duration: 2000 - // }); - // } - // }).catch(() => { - // this.$tip.error("鑱旂綉澶辫触") - // }) - // }, + + handleType(e, index) { + console.log(e) + }, getEquipment() { this.$http.get(this.url.getEquipmentList, { params: { @@ -410,71 +469,38 @@ //鑱旂綉澶辫触, 缁撴潫鍔犺浇 }) }, - ChooseImage() { - var that = this; - uni.chooseImage({ - count: 4, - sizeType: ['original', 'compressed'], // 鍙互鎸囧畾鏄師鍥捐繕鏄帇缂╁浘锛岄粯璁や簩鑰呴兘鏈� - sourceType: ['album'], // 浠庣浉鍐岄�夋嫨 - success: (res) => { - // 瀛樺偍閫夋嫨鐨勫浘鐗囪矾寰� - that.imgList = res.tempFilePaths; - // 鍒濆鍖� formData.avatar 涓虹┖瀛楃涓� - that.formData.avatar = []; - - // 鍒涘缓涓婁紶浠诲姟鐨� Promise 鏁扮粍 - const uploadPromises = res.tempFilePaths.map((filePath, index) => { - return new Promise((resolve, reject) => { - that.$http.upload(that.url.upload, { - filePath: filePath, - name: 'file' - }) - .then(uploadRes => { - const filePath = uploadRes.data.result[0]; - this.formData.avatar.push(filePath); - console.log(this.formData.avatar) - resolve(filePath); - }) - .catch(err => { - console.error('鍥剧墖' + index + '涓婁紶澶辫触:', err); - reject(err); - }); - }); - }); - - // 骞跺彂鎵ц鎵�鏈変笂浼犱换鍔� - Promise.all(uploadPromises) - .then((uploadedFilePaths) => { - console.log('鎵�鏈夊浘鐗囦笂浼犳垚鍔�:', that.formData.avatar); - }) - .catch((err) => { - console.error('鍥剧墖涓婁紶澶辫触:', err); - that.$tip.error('鍥剧墖涓婁紶澶辫触'); - }); + getStandardFile() { + this.$http.get(this.url.getStandardFile, { + params: { + id: this.standardId } - }); - }, - ViewImage(e) { - uni.previewImage({ - urls: this.imgList, - current: e.currentTarget.dataset.url - }); - }, - DelImg(e) { - uni.showModal({ - title: '鎻愮ず', - content: '纭畾瑕佸垹闄よ繖娈靛洖蹇嗗悧锛�', - cancelText: '鍐嶇湅鐪�', - confirmText: '鍐嶈', - success: res => { - if (res.confirm) { - this.imgList.splice(e.currentTarget.dataset.index, 1) + }).then(res => { + if (res.data.success) { + console.log("res", res.data.result); + const referenceFileStr = res.data.result.referenceFile; + + // 鍒ゆ柇鏄惁瀛樺湪 referenceFile 骞惰繘琛岃В鏋� + if (referenceFileStr) { + try { + const referenceFileObj = JSON.parse(referenceFileStr); + const filePath = `${this.ipAndPort}${referenceFileObj.filePath}`; + this.previewImageSrc = filePath; + console.log('previewImageSrc:', this.previewImageSrc); + } catch (e) { + console.error("referenceFile 瑙f瀽澶辫触", e); + this.previewImageSrc = ''; + } + } else { + console.warn("referenceFile 涓嶅瓨鍦�"); + this.previewImageSrc = ''; } } - }) + }).catch(err => { + console.error("缃戠粶璇锋眰澶辫触", err); + // 鑱旂綉澶辫触, 缁撴潫鍔犺浇 + }); }, - upCallback() { this.$http.get(this.url.stallList, { params: { @@ -487,11 +513,15 @@ //璁剧疆鍒楄〃鏁版嵁 if (res.data.success) { console.log("res", res.data.result.equipmentCode) + if (this.announcement1.standardId !== null) { + this.standardId = this.announcement1.standardId + this.getStandardFile() + } this.formData.num = this.announcement1.equipmentId, this.formData.orderNum = this.announcement1.orderNum, this.formData.operator = this.announcement1.operator, - this.formData.inspectionDate = this.announcement1.inspectionDate - this.hasInspectionDateArrived(); + this.formData.inspectionDate = this.announcement1.inspectionDate, + this.hasInspectionDateArrived(); } @@ -567,6 +597,30 @@ border-color: #179b16; } + .divider { + display: flex; + align-items: center; + text-align: center; + color: gray; + /* 鏂囧瓧棰滆壊 */ + margin: 20px 0; + /* 涓婁笅闂磋窛 */ + } + + .divider::before, + .divider::after { + content: ''; + flex: 1; + border-bottom: 1px solid gray; + /* 妯嚎棰滆壊 */ + margin: 0 16px; + /* 妯嚎涓庢枃瀛椾箣闂寸殑闂磋窛 */ + } + + .divider text { + white-space: nowrap; + /* 闃叉鏂囧瓧鎹㈣ */ + } .content { margin-top: 5px; @@ -580,4 +634,41 @@ margin-top: 85px; height: auto; } + + .overlay { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.7); + display: flex; + align-items: center; + justify-content: center; + z-index: 999; + } + + .modal { + position: relative; + width: 90%; + max-width: 600px; + background: #fff; + border-radius: 12rpx; + padding: 20rpx; + box-sizing: border-box; + } + + .preview-image { + width: 100%; + max-height: 80vh; + object-fit: contain; + } + + .close-btn { + position: absolute; + top: 10rpx; + right: 20rpx; + font-size: 40rpx; + color: #333; + } </style> \ No newline at end of file diff --git a/pages/ToDoList/ToDoListDeils/ToDoListDeils.vue b/pages/ToDoList/ToDoListDeils/ToDoListDeils.vue index 5feaf0d..2b3eb10 100644 --- a/pages/ToDoList/ToDoListDeils/ToDoListDeils.vue +++ b/pages/ToDoList/ToDoListDeils/ToDoListDeils.vue @@ -9,7 +9,7 @@ <uni-forms ref="form" :modelValue="formData" validate-trigger="bind" err-show-type="undertext"> <uni-group top="1"> - <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 鍩烘湰淇℃伅 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> + <view class="divider"><text>鍩烘湰淇℃伅</text></view> <uni-forms-item name="num" label="宸ュ崟鍙�:"> <uni-easyinput v-model="formData.equipmentCode" :disabled="true" /> </uni-forms-item> @@ -47,7 +47,7 @@ </view> </uni-forms-item> - <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 鐝粍闀跨‘璁� 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> + <view class="divider"><text>鐝粍闀跨‘璁�</text></view> <uni-forms-item name="outNum" required label="纭绫诲瀷:"> <uni-data-select :localdata="formData.msListCategory" popup-title="璇烽�夋嫨" @change="changeType" :clear="false"> @@ -59,7 +59,8 @@ </uni-group> </uni-forms> - <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 淇濆吇椤逛俊鎭� 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> + <view class="divider"><text>淇濆吇椤逛俊鎭�</text></view> + <!-- <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 淇濆吇椤逛俊鎭� 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> --> <uni-card margin="10px" spacing="1px" v-for="(item,index) in partTakeAdviceDetailList" :key="index"> @@ -330,6 +331,30 @@ </script> <style> + .divider { + display: flex; + align-items: center; + text-align: center; + color: gray; + /* 鏂囧瓧棰滆壊 */ + margin: 20px 0; + /* 涓婁笅闂磋窛 */ + } + + .divider::before, + .divider::after { + content: ''; + flex: 1; + border-bottom: 1px solid gray; + /* 妯嚎棰滆壊 */ + margin: 0 16px; + /* 妯嚎涓庢枃瀛椾箣闂寸殑闂磋窛 */ + } + + .divider text { + white-space: nowrap; + /* 闃叉鏂囧瓧鎹㈣ */ + } .is-hover { color: rgba(255, 255, 255, 0.6); background-color: #55aaff; diff --git a/pages/ToDoList/ToDoSpareParts/ToDoSpareParts.vue b/pages/ToDoList/ToDoSpareParts/ToDoSpareParts.vue index fe98829..31844e8 100644 --- a/pages/ToDoList/ToDoSpareParts/ToDoSpareParts.vue +++ b/pages/ToDoList/ToDoSpareParts/ToDoSpareParts.vue @@ -9,7 +9,8 @@ <uni-forms ref="form" :modelValue="formData" validate-trigger="bind" err-show-type="undertext"> <uni-group top="1"> - <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�旀姤淇熀鏈俊鎭�斺�斺�斺�斺�斺�斺�斺�斺��</view> + <view class="divider"><text>鎶ヤ慨鍩烘湰淇℃伅</text></view> + <!-- <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�旀姤淇熀鏈俊鎭�斺�斺�斺�斺�斺�斺�斺�斺��</view> --> <uni-forms-item :label-width="100" name="num" label="宸ュ崟鍙�:"> <uni-easyinput v-model="formData.repairCode" :disabled="true" /> </uni-forms-item> @@ -28,22 +29,13 @@ <uni-easyinput v-model="formData.remark" :disabled="true" /> </uni-forms-item> <uni-forms-item :label-width="100" name="outNum" label="鎶ヤ慨鍥剧墖:"> - <view class="grid col-4 grid-square flex-sub"> - <view class="bg-img" v-for="(item,index) in imgList" :key="index" @tap="ViewImage" - :data-url="imgList[index]"> - <image :src="imgList[index]" mode="aspectFill"></image> - <view class="cu-tag bg-red radius" @tap.stop="DelImg" :data-index="index"> - <text class='cuIcon-close'></text> - </view> - </view> - <view class="solids" v-if="imgList.length<1"> - <text class='cuIcon-cameraadd'></text> - </view> - </view> + <uni-file-picker limit="9" :value="fileList" :image-styles="imageStyles" @select="select" + :sourceType="sourceType" @progress="progress" @success="success" @fail="fail" @delete="deletea" + :readonly="readonly" /> </uni-forms-item> - <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�旀槸鍚﹂渶瑕侀鐢ㄥ浠垛�斺�斺�斺�斺�斺�斺�斺�斺��</view> + <view class="divider"><text>鏄惁闇�瑕侀鐢ㄥ浠�</text></view> <uni-forms-item :label-width="140" required name="num" label="鏄惁闇�瑕侀鐢ㄥ浠�:"> <uni-data-select v-model="formData.isSpare" :localdata="SpareList" @change="changeisSpareList" placeholder="璇烽�夋嫨" :disabled="isUNDERREPAIR" /> @@ -58,26 +50,17 @@ :disabled="isUNDERREPAIR" /> </uni-forms-item> <uni-forms-item v-show="isShow" :label-width="100" name="outNum" label="缁翠慨鍥剧墖:"> - <view class="grid col-4 grid-square flex-sub"> - <view class="bg-img" v-for="(item,index) in imgTwoList" :key="index" @tap="ViewImageTwo" - :data-url="imgTwoList[index]"> - <image :src="imgTwoList[index]" mode="aspectFill"></image> - <view class="cu-tag bg-red radius" @tap.stop="DelImgTwo" :data-index="index"> - <text class='cuIcon-close'></text> - </view> - </view> - <view class="solids" @tap="ChooseImageTwo" v-if="imgTwoList.length<1"> - <text class='cuIcon-cameraadd'></text> - </view> - </view> - + <uni-file-picker limit="9" :value="fileLists" :image-styles="imageStyles" @select="select" + :sourceType="sourceType" @progress="progress" @success="success" @fail="fail" @delete="deletea" + :readonly="readonlyRepaier" /> </uni-forms-item> </uni-group> </uni-forms> <uni-forms v-show="isShowUNDEREPAIR" ref="form" :modelValue="ScanData" validate-trigger="bind" err-show-type="undertext"> <uni-group top="1"> - <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�旂鐞嗗憳棰嗙敤澶囦欢鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> + <view class="divider"><text>绠$悊鍛橀鐢ㄥ浠�</text></view> + <!-- <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�旂鐞嗗憳棰嗙敤澶囦欢鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> --> <uni-forms-item :label-width="100" required name="sparePartDescription" label="澶囦欢鎻忚堪:"> <uni-easyinput type="textarea" v-model="ScanData.sparePartDescription" placeholder="璇疯緭鍏ュ浠舵弿杩�" :disabled="isRuning" /> @@ -88,7 +71,8 @@ <uni-forms v-show="isShowRepari" ref="form" :modelValue="formData" validate-trigger="bind" err-show-type="undertext"> <uni-group top="1"> - <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�旂淮淇粨鏋滀笂鎶モ�斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> + <view class="divider"><text>缁翠慨缁撴灉涓婃姤</text></view> + <!-- <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�旂淮淇粨鏋滀笂鎶モ�斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> --> <uni-forms-item :label-width="140" required name="faultReason" label="鏁呴殰鍘熷洜:"> <uni-easyinput v-model="formData.faultReason" placeholder="璇疯緭鍏ユ晠闅滃師鍥�" :disabled="isRepari" /> </uni-forms-item> @@ -97,24 +81,13 @@ :disabled="isRepari" /> </uni-forms-item> <uni-forms-item :label-width="100" name="outNum" label="缁翠慨鍥剧墖:"> - <view class="grid col-4 grid-square flex-sub"> - <view class="bg-img" v-for="(item,index) in imgThreeList" :key="index" @tap="ViewImageTwo" - :data-url="imgThreeList[index]"> - <image :src="imgThreeList[index]" mode="aspectFill"></image> - <view class="cu-tag bg-red radius" @tap.stop="DelImgTwo" :data-index="index"> - <text class='cuIcon-close'></text> - </view> - </view> - <view class="solids" @tap="ChooseImageThree" v-if="imgThreeList.length<1"> - <text class='cuIcon-cameraadd'></text> - </view> - </view> - + <uni-file-picker limit="9" :value="fileLists" :image-styles="imageStyles" @select="select" + :sourceType="sourceType" @progress="progress" @success="success" @fail="fail" @delete="deletea" + :readonly="readonlyRepaier" /> </uni-forms-item> - </uni-group> </uni-forms> - <view v-show="isSHowBtn" class="padding flex flex-direction"> + <view v-show="isSHowBtn" class="padding flex flex-direction"> <view class="flex-sub bg-blue padding-sm margin-xl radius text-sm text-center text-white" @click.stop="ProductionTask()" hover-class="is-hover">纭畾</view> </view> @@ -133,9 +106,20 @@ mixins: [MescrollMixin], // 浣跨敤mixin data() { return { - isSHowBtn:true, + readonly: false, + readonlyRepaier: false, + // 鍥剧墖鍥炴樉 + fileLists: [], + fileList: [], + // 涓婁紶鍥剧墖鐨勬牱寮� + imageStyles: { + width: 90, + height: 90, + }, + sourceType: ['album', 'camera'], + isSHowBtn: true, isShowRepari: false, - title: '鏄惁闇�瑕侀鐢ㄥ浠�', + title: '', isRepari: false, isRuning: false, isShowUNDEREPAIR: false, @@ -179,8 +163,7 @@ url: { upload: "/eam/sysFiles/batch_upload", stallList: "/eam/eamRepairOrder/queryById", - getEquipmentList:'eam/equipment/list', - // getEquipmentList: "eam/equipment/asyncLoadEquipment", + getEquipmentList: 'eam/equipment/list', approval: '/eam/eamRepairOrder/perform' }, id: '', @@ -208,7 +191,8 @@ msg1Title: "", procInstId: '', values: '', - isShow: true + isShow: true, + flag: '' } }, @@ -225,7 +209,8 @@ }, onLoad(options) { const annItem = JSON.parse(decodeURIComponent(options.item)); - + this.flag = options.flag + console.log(this.flag) this.id = annItem.dataId, this.taskId = annItem.id, this.procInstId = annItem.procInstId, @@ -246,8 +231,54 @@ this.isShow = false; } }, + + select(e) { + const tempFilePaths = e.tempFilePaths; + uni.showLoading({ + title: '涓婁紶涓�...' + }); + const uploadPromises = tempFilePaths.map((filePath, index) => { + return new Promise((resolve, reject) => { + this.$http.upload(this.url.upload, { + filePath: filePath, + name: 'file' + }) + .then(uploadRes => { + // 鍋囪鏈嶅姟鍣ㄨ繑鍥炵殑缁撴灉涓寘鍚枃浠惰矾寰� + const serverFilePath = uploadRes.data.result[0]; + this.formData.avatar.push(serverFilePath); + resolve(uploadRes); // 杩斿洖缁撴灉缁� Promise.all + }) + .catch(err => { + console.error(`鍥剧墖 ${index + 1} 涓婁紶澶辫触:`, err); + reject(err); + }); + }); + }); + + Promise.all(uploadPromises) + .then(() => { + uni.hideLoading(); + uni.showToast({ + title: '鍏ㄩ儴涓婁紶鎴愬姛' + }); + }) + .catch(err => { + uni.hideLoading(); + uni.showToast({ + title: '閮ㄥ垎涓婁紶澶辫触', + icon: 'none' + }); + console.error('涓婁紶寮傚父:', err); + }); + }, + // 鍒犻櫎 + deletea(e) { + console.log('鍒犻櫎鍥剧墖', e); + }, ProductionTask() { - if (this.formData.reportStatus == 'WAIT_SPARES') { + console.log(this.formData.isSpare) + if (this.formData.reportStatus == 'WAIT_SPARES' && this.formData.isSpare == 1 && this.flag !== 'task') { if (this.ScanData.sparePartDescription == undefined || this.ScanData.sparePartDescription == null || this .ScanData.sparePartDescription == @@ -260,57 +291,112 @@ return false; } } - if (this.formData.reportStatus == 'UNDER_REPAIR') { - if (this.formData.faultReason == undefined || this.formData.faultReason == null || - this - .formData.faultReason == - '') { - uni.showToast({ - icon: 'none', - title: '鏁呴殰鍘熷洜涓嶈兘涓虹┖' - }); - return false; - } - if (this.formData.repairDescription == undefined || this.formData.repairDescription == null || - this - .formData.repairDescription == - '') { + // if (this.formData.reportStatus == 'UNDER_REPAIR' && this.formData.isSpare == 0 && this.flag !== 'task') { + // if (this.formData.faultReason == undefined || this.formData.faultReason == null || + // this + // .formData.faultReason == + // '') { - uni.showToast({ - icon: 'none', - title: '缁翠慨缁撴灉涓嶈兘涓虹┖' - }); - return false; - } + // uni.showToast({ + // icon: 'none', + // title: '鏁呴殰鍘熷洜涓嶈兘涓虹┖' + // }); + // return false; + // } + // if (this.formData.repairDescription == undefined || this.formData.repairDescription == null || + // this + // .formData.repairDescription == + // '') { + // uni.showToast({ + // icon: 'none', + // title: '缁翠慨缁撴灉涓嶈兘涓虹┖' + // }); + // return false; + // } + + // } + // if (this.formData.reportStatus == 'UNDER_REPAIR' && this.formData.isSpare == 1 && this.flag !== 'task') { + // if (this.formData.faultReason == undefined || this.formData.faultReason == null || + // this + // .formData.faultReason == + // '') { + + // uni.showToast({ + // icon: 'none', + // title: '鏁呴殰鍘熷洜涓嶈兘涓虹┖' + // }); + // return false; + // } + // if (this.formData.repairDescription == undefined || this.formData.repairDescription == null || + // this + // .formData.repairDescription == + // '') { + + // uni.showToast({ + // icon: 'none', + // title: '缁翠慨缁撴灉涓嶈兘涓虹┖' + // }); + // return false; + // } + + // } + if (this.formData.reportStatus == 'UNDER_REPAIR' && this.flag !== 'task') { + if (this.formData.faultReason == undefined || this.formData.faultReason == null || this.formData.faultReason == '') { + uni.showToast({ + icon: 'none', + title: '鏁呴殰鍘熷洜涓嶈兘涓虹┖' + }); + return false; + } + if (this.formData.repairDescription == undefined || this.formData.repairDescription == null || this.formData.repairDescription == '') { + uni.showToast({ + icon: 'none', + title: '缁翠慨缁撴灉涓嶈兘涓虹┖' + }); + return false; + } } + if (this.formData.reportStatus == 'UNDER_REPAIR' && this.formData.isSpare == 1) { + if (this.formData.isSpare == undefined || this.formData.isSpare == null || + this + .formData.isSpare == + '') { + + uni.showToast({ + icon: 'none', + title: '鏄惁闇�瑕侀鐢ㄥ浠朵笉鑳戒负绌�' + }); + return false; + } + } + uni.showLoading({ + mask: true, + title: "鍔犺浇涓�....", + }) this.$http.post(this.url.approval, { sparePartDescription: this.ScanData.sparePartDescription, dataId: this.id, equipmentId: this.formData.num, faultReason: this.formData.faultReason, id: this.id, - imageFilesResult: this.formData.avatarTwo, + imageFilesResult: this.formData.avatar, instanceId: this.procInstId, isUseSpare: this.formData.isSpare, repairDescription: this.formData.repairDescription, taskId: this.taskId }).then(res => { - console.log(res) - this.$tip.loaded(); + uni.hideLoading() if (res.data.success) { uni.showToast({ icon: "success", title: '鎻愪氦鎴愬姛', duration: 2000 }); - // this.$Router.replace({ - // name: 'ToDoList' - // }) this.$Router.replaceAll({ name: 'ToDoList' }) @@ -338,11 +424,20 @@ this.partTakeAdviceDetailList[index].istrue = true; } }, + getEquipment() { - this.$http.get(this.url.getEquipmentList).then(res => { + this.$http.get(this.url.getEquipmentList, { + params: { + pageNo: 1, + pageSize: 9999, + order: 'desc', + column: 'createTime' + }, + + }).then(res => { //璁剧疆鍒楄〃鏁版嵁 if (res.data.success) { - this.equipmentList = res.data.result + this.equipmentList = res.data.result.records } else { uni.showToast({ icon: "error", @@ -355,179 +450,8 @@ this.$tip.error("鑱旂綉澶辫触") }) }, - ChooseImageThree() { - var that = this; - uni.chooseImage({ - count: 4, - sizeType: ['original', 'compressed'], // 鍙互鎸囧畾鏄師鍥捐繕鏄帇缂╁浘锛岄粯璁や簩鑰呴兘鏈� - sourceType: ['album'], // 浠庣浉鍐岄�夋嫨 - success: (res) => { - // 瀛樺偍閫夋嫨鐨勫浘鐗囪矾寰� - that.imgThreeList = res.tempFilePaths; - // 鍒濆鍖� formData.avatar 涓虹┖瀛楃涓� - that.formData.avatarTwo = []; - // 鍒涘缓涓婁紶浠诲姟鐨� Promise 鏁扮粍 - const uploadPromises = res.tempFilePaths.map((filePath, index) => { - return new Promise((resolve, reject) => { - that.$http.upload(that.url.upload, { - filePath: filePath, - name: 'file' - }) - .then(uploadRes => { - // 鍋囪鏈嶅姟鍣ㄨ繑鍥炵殑缁撴灉涓寘鍚枃浠惰矾寰� - const filePath = uploadRes.data.result[0]; - this.formData.avatarTwo.push(filePath); - resolve(filePath); - }) - .catch(err => { - console.error('鍥剧墖' + index + '涓婁紶澶辫触:', err); - reject(err); - }); - }); - }); - - // 骞跺彂鎵ц鎵�鏈変笂浼犱换鍔� - Promise.all(uploadPromises) - .then((uploadedFilePaths) => { - console.log('鎵�鏈夊浘鐗囦笂浼犳垚鍔�:', that.formData.avatar); - }) - .catch((err) => { - console.error('鍥剧墖涓婁紶澶辫触:', err); - that.$tip.error('鍥剧墖涓婁紶澶辫触'); - }); - } - }); - }, - ChooseImage() { - var that = this; - uni.chooseImage({ - count: 4, - sizeType: ['original', 'compressed'], // 鍙互鎸囧畾鏄師鍥捐繕鏄帇缂╁浘锛岄粯璁や簩鑰呴兘鏈� - sourceType: ['album'], // 浠庣浉鍐岄�夋嫨 - success: (res) => { - // 瀛樺偍閫夋嫨鐨勫浘鐗囪矾寰� - that.imgList = res.tempFilePaths; - - // 鍒濆鍖� formData.avatar 涓虹┖瀛楃涓� - that.formData.avatar = []; - - // 鍒涘缓涓婁紶浠诲姟鐨� Promise 鏁扮粍 - const uploadPromises = res.tempFilePaths.map((filePath, index) => { - return new Promise((resolve, reject) => { - that.$http.upload(that.url.upload, { - filePath: filePath, - name: 'file' - }) - .then(uploadRes => { - // 鍋囪鏈嶅姟鍣ㄨ繑鍥炵殑缁撴灉涓寘鍚枃浠惰矾寰� - const filePath = uploadRes.data.result[0]; - this.formData.avatar.push(filePath); - resolve(filePath); - }) - .catch(err => { - console.error('鍥剧墖' + index + '涓婁紶澶辫触:', err); - reject(err); - }); - }); - }); - - // 骞跺彂鎵ц鎵�鏈変笂浼犱换鍔� - Promise.all(uploadPromises) - .then((uploadedFilePaths) => { - console.log('鎵�鏈夊浘鐗囦笂浼犳垚鍔�:', that.formData.avatar); - }) - .catch((err) => { - console.error('鍥剧墖涓婁紶澶辫触:', err); - that.$tip.error('鍥剧墖涓婁紶澶辫触'); - }); - } - }); - }, - ChooseImageTwo() { - var that = this; - uni.chooseImage({ - count: 4, - sizeType: ['original', 'compressed'], // 鍙互鎸囧畾鏄師鍥捐繕鏄帇缂╁浘锛岄粯璁や簩鑰呴兘鏈� - sourceType: ['album'], // 浠庣浉鍐岄�夋嫨 - success: (res) => { - // 瀛樺偍閫夋嫨鐨勫浘鐗囪矾寰� - that.imgListTwo = res.tempFilePaths; - - // 鍒濆鍖� formData.avatar 涓虹┖瀛楃涓� - that.formData.avatarTwo = []; - - // 鍒涘缓涓婁紶浠诲姟鐨� Promise 鏁扮粍 - const uploadPromises = res.tempFilePaths.map((filePath, index) => { - return new Promise((resolve, reject) => { - that.$http.upload(that.url.upload, { - filePath: filePath, - name: 'file' - }) - .then(uploadRes => { - const filePath = uploadRes.data.result[0]; - this.formData.avatarTwo.push(filePath); - resolve(filePath); - }) - .catch(err => { - console.error('鍥剧墖' + index + '涓婁紶澶辫触:', err); - reject(err); - }); - }); - }); - - // 骞跺彂鎵ц鎵�鏈変笂浼犱换鍔� - Promise.all(uploadPromises) - .then((uploadedFilePaths) => { - console.log('鎵�鏈夊浘鐗囦笂浼犳垚鍔�:', that.formData.avatarTwo); - }) - .catch((err) => { - console.error('鍥剧墖涓婁紶澶辫触:', err); - that.$tip.error('鍥剧墖涓婁紶澶辫触'); - }); - } - }); - }, - ViewImageTwo(e) { - uni.previewImage({ - urls: this.imgListTwo, - current: e.currentTarget.dataset.url - }); - }, - - ViewImage(e) { - uni.previewImage({ - urls: this.imgList, - current: e.currentTarget.dataset.url - }); - }, - DelImgTwo(e) { - uni.showModal({ - title: '鎻愮ず', - content: '纭畾瑕佸垹闄よ繖娈靛洖蹇嗗悧锛�', - cancelText: '鍐嶇湅鐪�', - confirmText: '鍐嶈', - success: res => { - if (res.confirm) { - this.imgListTwo.splice(e.currentTarget.dataset.index, 1) - } - } - }) - }, - DelImg(e) { - uni.showModal({ - title: '鎻愮ず', - content: '纭畾瑕佸垹闄よ繖娈靛洖蹇嗗悧锛�', - cancelText: '鍐嶇湅鐪�', - confirmText: '鍐嶈', - success: res => { - if (res.confirm) { - this.imgList.splice(e.currentTarget.dataset.index, 1) - } - } - }) - }, upCallback() { this.$http.get(this.url.stallList, { @@ -541,51 +465,120 @@ //璁剧疆鍒楄〃鏁版嵁 if (res.data.success) { this.formData.reportStatus = this.announcement1.reportStatus - - if (this.announcement1.reportStatus === 'WAIT_CONFIRM') { - this.title = '鎿嶄綔宸ョ‘璁�'; - this.isUNDERREPAIR = true; - } else if (this.announcement1.reportStatus === 'WAIT_SPARES') { - this.title = '绠$悊鍛橀鐢ㄥ浠�'; - this.isUNDERREPAIR = true; - this.isShowUNDEREPAIR = true; - } else if (this.announcement1.reportStatus === 'UNDER_REPAIR') { - if (this.announcement1.isUseSpare == 1) { - this.title = '缁翠慨缁撴灉涓婃姤'; - } else { - this.title = '鏄惁闇�瑕侀鐢ㄥ浠�'; + if (this.announcement1.reportStatus === 'WAIT_CONFIRM') { + if (this.flag == 'task') { + this.title = '缁翠慨鎵ц'; + this.isUNDERREPAIR = true + this.readonly = true + this.isRuning = true + this.isSHowBtn=false + this.readonlyRepaier=true + this.isShowRepari = false + } else if (this.flag !== 'task') { + this.title = '鎿嶄綔宸ョ‘璁�'; + this.isUNDERREPAIR = true + this.readonly = true + this.isRuning = true + this.isSHowBtn=true + this.readonlyRepaier=true + this.isShowRepari = false } - this.isUNDERREPAIR = true; - this.isShowUNDEREPAIR = true; - this.isRuning = true; - this.isShowRepari = true; - - }else if (this.announcement1.reportStatus === 'COMPLETE') { - if (this.announcement1.isUseSpare == 0) { - this.title = '绠$悊鍛橀鐢ㄥ浠�'; - this.isShowRepari=false; - this.isSHowBtn=false; - this.isRepari; + } else if (this.announcement1.reportStatus === 'WAIT_SPARES') { + if (this.flag == 'task' && this.announcement1.isUseSpare == 1) { + this.title = '鏄惁闇�瑕侀鐢ㄥ浠�'; + this.isShowUNDEREPAIR = false; this.isUNDERREPAIR = true; - + this.readonly = true + + this.isSHowBtn = false; } else { - this.title = '鎿嶄綔宸ョ‘璁�'; + this.title = '绠$悊鍛橀鐢ㄥ浠�'; + this.readonly = true this.isUNDERREPAIR = true; this.isShowUNDEREPAIR = true; - this.isRuning=true; - this.isShowRepari=true; - this.isRepari=true; - this.isSHowBtn=false; } + + + } else if (this.announcement1.reportStatus === 'UNDER_REPAIR') { + if (this.announcement1.isUseSpare == 1 && this.flag == 'task') { + this.title = '绠$悊鍛橀鐢ㄥ浠�'; + this.isShowRepari = true; + this.readonlyRepaier = true + this.isShowUNDEREPAIR = true; + this.isUNDERREPAIR = true; + this.isRuning = true; + this.isRepari = true; + this.readonly = true + this.isSHowBtn = false; + + } else if (this.announcement1.isUseSpare == 1 && this.flag !== 'task') { + this.title = '缁翠慨鎵ц' + this.isUNDERREPAIR = true + this.readonly = true + this.isShowUNDEREPAIR = true + this.isRuning = true + this.isShowRepari = true + + } else { + this.title = '鏄惁闇�瑕侀鐢ㄥ浠�' + this.isSHowBtn = true + this.readonly = true + } + } else if (this.announcement1.reportStatus === 'COMPLETE') { + if (this.flag == 'task' && this.announcement1.isUseSpare == 0) { + this.title = '鎿嶄綔宸ョ‘璁�' + this.isUNDERREPAIR = true + this.isShowUNDEREPAIR = false + this.readonly = true + this.readonlyRepaier = true + this.isRuning = true + this.isShowRepari = false + this.isRepari = false + this.isSHowBtn = false + } else if (this.flag == 'task' && this.announcement1.isUseSpare == 1) { + this.title = '鎿嶄綔宸ョ‘璁�' + this.isUNDERREPAIR = true + this.isShowUNDEREPAIR = true + this.isRuning = true + this.readonlyRepaier=true + this.isShowRepari = true + this.isRepari = true + this.readonly = true + this.isSHowBtn = false; + }else if (this.flag !== 'task' && this.announcement1.isUseSpare == 0){ + this.title = '缁翠慨鎵ц' + this.isUNDERREPAIR = true + this.readonlyRepaier=true + this.readonly = true + this.isRuning = true - - - - + } } + console.log(this.announcement1.reportImageFiles) + if (this.announcement1.reportImageFiles) { + try { + const parsedData = JSON.parse(this.announcement1.reportImageFiles); + this.imageFilesList = parsedData; + this.imgList = parsedData.map(imageObj => { + return `${this.ipAndPort}${imageObj.filePath}`; + }); + + this.fileList = this.imgList.map(url => ({ + url: url, + extname: 'png', + name: 'eam' + })); + } catch (error) { + console.error('JSON 瑙f瀽澶辫触:', error); + this.imageFilesList = []; + this.imgList = []; + this.fileList = []; + } + } + console.log(this.fileLists) this.formData.num = this.announcement1.equipmentId this.formData.repairCode = this.announcement1.repairCode this.formData.repairer = this.announcement1.repairer @@ -600,29 +593,26 @@ this.isShow = true; } this.ScanData.sparePartDescription = this.announcement1.sparePartDescription - this.formData.avatar = this.announcement1.reportImageFiles - this.imageFilesList = JSON.parse(this.formData.avatar) - const imageObjects = JSON.parse(this.formData.avatar) - this.imgList = imageObjects.map(imageObj => { - return `${this.ipAndPort}${imageObj.filePath}`; - }) - this.formData.avatarTwo = this.announcement1.imageFiles - this.imageAvatarTwo = JSON.parse(this.formData.avatarTwo) - const imageObjectTwo = JSON.parse(this.formData.avatarTwo) - if(this.formData.isSpare == 1){ - this.imgThreeList = imageObjectTwo.map(imageObj => { - return `${this.ipAndPort}${imageObj.filePath}`; - }) - }else{ - this.imgTwoList = imageObjectTwo.map(imageObj => { - return `${this.ipAndPort}${imageObj.filePath}`; - }) + if (this.announcement1.imageFiles) { + try { + const parsedDataIn = JSON.parse(this.announcement1.imageFiles); + this.imageAvatarTwo = parsedDataIn; + this.imgTwoList = parsedDataIn.map(imageObj => { + return `${this.ipAndPort}${imageObj.filePath}`; + }); + + this.fileLists = this.imgTwoList.map(url => ({ + url: url, + extname: 'png', + name: 'eam' + })); + } catch (error) { + console.error('JSON 瑙f瀽澶辫触:', error); + this.imageAvatarTwo = []; + this.imgTwoList = []; + this.fileLists = []; + } } - - - - - } }).catch(() => { //鑱旂綉澶辫触, 缁撴潫鍔犺浇 @@ -686,7 +676,30 @@ border-color: #55aaff; } + .divider { + display: flex; + align-items: center; + text-align: center; + color: gray; + /* 鏂囧瓧棰滆壊 */ + margin: 20px 0; + /* 涓婁笅闂磋窛 */ + } + .divider::before, + .divider::after { + content: ''; + flex: 1; + border-bottom: 1px solid gray; + /* 妯嚎棰滆壊 */ + margin: 0 16px; + /* 妯嚎涓庢枃瀛椾箣闂寸殑闂磋窛 */ + } + + .divider text { + white-space: nowrap; + /* 闃叉鏂囧瓧鎹㈣ */ + } .content { margin-top: 5px; diff --git a/pages/baoZhou/baoZhou.vue b/pages/baoZhou/baoZhou.vue index 87e81cb..1f28e4a 100644 --- a/pages/baoZhou/baoZhou.vue +++ b/pages/baoZhou/baoZhou.vue @@ -3,6 +3,11 @@ <cu-custom :bgColor="NavBarColor" :isBack="true" backRouterName="productionTask"> <block slot="backText">杩斿洖</block> <block slot="content">鍛ㄤ繚</block> + <block slot="right"> + <view @click="search"> + <image class="search" src="/static/icon/sear.png" style="width: 25px; height: 25px;" alt="" /> + </view> + </block> </cu-custom> <view style="width: 100%;"> @@ -11,11 +16,13 @@ <!-- 鍩虹琛ㄥ崟鏍¢獙 --> <uni-forms ref="form" :modelValue="formData" validate-trigger="bind" err-show-type="undertext"> <uni-group title="" top="0"> - <uni-forms-item name="numbers" label="棰嗘枡鐢宠鍗曞彿:"> - <uni-easyinput type="text" v-model="formData.num" placeholder="璇疯緭鍏ラ鏂欑敵璇峰崟鍙锋绱�" /> + <uni-forms-item name="orderNum" label="宸ュ崟鍙�:"> + <uni-easyinput type="text" v-model="formData.orderNum" placeholder="璇疯緭鍏ラ鏂欑敵璇峰崟鍙锋绱�" /> </uni-forms-item> - <uni-forms-item name="name" label="棰嗘枡浜у搧:"> - <uni-easyinput v-model="formData.partNumNameModel" placeholder="璇疯緭鍏ラ鏂欎骇鍝�" /> + <uni-forms-item name="name" label="鎶芥鏍囪:"> + <uni-data-select v-model="formData.InspectionFlagName" + :localdata="formData.randomInspectionFlagList" + @change="changehandlingInspectionFlag" placeholder="璇烽�夋嫨" /> </uni-forms-item> </uni-group> </uni-forms> @@ -53,6 +60,15 @@ {{item.equipmentCode}} </view> </view> + <!-- <view class="flex"> + <view class="flex-sub text-light bg-white padding-xs margin-xs radius">鎶芥鏍囪:</view> + <view v-if="item.randomInspectionFlag =='1'" class="flex-sub bg-white padding-xs margin-xs radius text-right"> + 宸叉娊妫� + </view> + <view v-else class="flex-sub bg-white padding-xs margin-xs radius text-right"> + 鏈娊妫� + </view> + </view> --> <view class="flex"> <view class="flex-sub text-light bg-white padding-xs margin-xs radius">鍛ㄤ繚鏃ユ湡:</view> <view class="flex-sub bg-white padding-xs margin-xs text-blue radius text-right"> @@ -63,10 +79,7 @@ <view class="flex-sub text-light bg-white padding-xs margin-xs radius">鎿嶄綔:</view> <view class="flex-sub bg-blue padding-xs margin-xs radius text-sm text-center" @click.stop="handleStartWork(item)" hover-class="is-hover">棰嗗彇</view> - </view> - - </uni-card> </view> @@ -84,8 +97,17 @@ type: 'top', scrollLeft: 0, formData: { - num: '', - partNumNameModel: '' + orderNum: '', + InspectionFlagName: '', + randomInspectionFlagList: [{ + text: "鍚�", + value: '0' + }, + { + text: "鏄�", + value: '1' + } + ] }, NavBarColor: this.NavBarColor, activeColor: '#5277A6', @@ -141,6 +163,9 @@ created() {}, methods: { + changehandlingInspectionFlag(e) { + this.formData.InspectionFlagName = e; + }, /** * 棰嗗彇 */ @@ -149,7 +174,7 @@ this.$tip.loading(); this.$http.get(this.url.collect, { params: { - id: item.id, + id: item.id, }, }).then(res => { console.log(res) @@ -230,8 +255,8 @@ resetTask() { - this.formData.num = '' - this.formData.partNumNameModel = '' + this.formData.orderNum = '' + this.formData.randomInspectionFlag = '' this.$refs.popup.close(); this.mescroll.resetUpScroll() @@ -239,127 +264,42 @@ /* 妫�绱� */ getSera() { this.$refs.popup.close(); - let keyword = this.TabCur this.msgList = []; - if (keyword == 0) { - this.$http.get(this.url.stallList, { - params: { - pageNo: 1, - pageSize: 999, - order: "desc", - column: "createTime", - num: '*' + this.formData.num + '*', - partNumNameModel: '*' + this.formData.partNumNameModel + '*', - status: 'published' + this.$http.get(this.url.stallList, { + params: { + pageNo: 1, + pageSize: 999, + order: "desc", + column: "createTime", + maintenanceStatus: 'WAIT_MAINTENANCE', + orderNum: this.formData.orderNum, + randomInspectionFlag: this.formData.InspectionFlagName + } + }).then(res => { + //鑱旂綉鎴愬姛鐨勫洖璋�,闅愯棌涓嬫媺鍒锋柊鍜屼笂鎷夊姞杞界殑鐘舵��; + this.announcement1 = res.data.result.records + this.mescroll.endSuccess(this.announcement1.length); + console.log("url", res) + //璁剧疆鍒楄〃鏁版嵁 + if (res.data.success) { + console.log("res", res.data) + this.msg1Count = res.data.result.total + this.msg1Title = "閫氱煡(" + res.data.result.total + ")"; + for (let annItem of this.announcement1) { + this.msgList.push(annItem) } - }).then(res => { - //鑱旂綉鎴愬姛鐨勫洖璋�,闅愯棌涓嬫媺鍒锋柊鍜屼笂鎷夊姞杞界殑鐘舵��; + } + if (page.num == 1) { + this.msgList = []; //濡傛灉鏄涓�椤甸渶鎵嬪姩鍒剁┖鍒楄〃 + this.msgList = this.msgList.concat(this.announcement1); //杩藉姞鏂版暟鎹� + } - this.announcement1 = res.data.result.records - this.mescroll.endSuccess(this.announcement1.length); - console.log("url", res) - //璁剧疆鍒楄〃鏁版嵁 - if (res.data.success) { - console.log("res", res.data) - this.msg1Count = res.data.result.total - this.msg1Title = "閫氱煡(" + res.data.result.total + ")"; - for (let annItem of this.announcement1) { - this.msgList.push(annItem) - } - } - if (page.num == 1) { - this.msgList = []; //濡傛灉鏄涓�椤甸渶鎵嬪姩鍒剁┖鍒楄〃 - this.msgList = this.msgList.concat(this.announcement1); //杩藉姞鏂版暟鎹� - } - - }).catch(() => { - //鑱旂綉澶辫触, 缁撴潫鍔犺浇 - this.mescroll.endErr(); - }) - - } else if (keyword == 1) { - this.$http.get(this.url.stallList, { - params: { - pageNo: 1, - pageSize: 999, - order: "desc", - column: "createTime", - status: 'training', - num: '*' + this.formData.num + '*', - partNumNameModel: '*' + this.formData.partNumNameModel + '*' - - } - }).then(res => { - //鑱旂綉鎴愬姛鐨勫洖璋�,闅愯棌涓嬫媺鍒锋柊鍜屼笂鎷夊姞杞界殑鐘舵��; - - this.announcement1 = res.data.result.records - this.mescroll.endSuccess(this.announcement1.length); - console.log("url", res) - //璁剧疆鍒楄〃鏁版嵁 - if (res.data.success) { - console.log("res", res.data) - this.msg1Count = res.data.result.total - this.msg2Title = "閫氱煡(" + res.data.result.total + ")"; - for (let annItem of this.announcement1) { - this.msgList.push(annItem) - } - } - if (page.num == 1) { - this.msgList = []; //濡傛灉鏄涓�椤甸渶鎵嬪姩鍒剁┖鍒楄〃 - this.msgList = this.msgList.concat(this.announcement1); //杩藉姞鏂版暟鎹� - } - - }).catch(() => { - //鑱旂綉澶辫触, 缁撴潫鍔犺浇 - this.mescroll.endErr(); - }) - - } else if (keyword == 2) { - this.$http.get(this.url.stallList, { - params: { - pageNo: 1, - pageSize: 999, - order: "desc", - column: "createTime", - status: 'completed', - num: '*' + this.formData.num + '*', - partNumNameModel: '*' + this.formData.partNumNameModel + '*' - - } - }).then(res => { - //鑱旂綉鎴愬姛鐨勫洖璋�,闅愯棌涓嬫媺鍒锋柊鍜屼笂鎷夊姞杞界殑鐘舵��; - - this.announcement1 = res.data.result.records - this.mescroll.endSuccess(this.announcement1.length); - console.log("url", res) - //璁剧疆鍒楄〃鏁版嵁 - if (res.data.success) { - console.log("res", res.data) - this.msg3Count = res.data.result.total - this.msg1Title = "閫氱煡(" + res.data.result.total + ")"; - for (let annItem of this.announcement1) { - this.msgList.push(annItem) - } - } - if (page.num == 1) { - this.msgList = []; //濡傛灉鏄涓�椤甸渶鎵嬪姩鍒剁┖鍒楄〃 - this.msgList = this.msgList.concat(this.announcement1); //杩藉姞鏂版暟鎹� - } - - }).catch(() => { - //鑱旂綉澶辫触, 缁撴潫鍔犺浇 - this.mescroll.endErr(); - }) - - } - - - - - + }).catch(() => { + //鑱旂綉澶辫触, 缁撴潫鍔犺浇 + this.mescroll.endErr(); + }) }, - mescrollInit(mescroll) { console.log('mescrollInit') diff --git a/pages/baoZhou/baoZhouDetils/baoZhouDetils.vue b/pages/baoZhou/baoZhouDetils/baoZhouDetils.vue index b0b24c6..b75aff7 100644 --- a/pages/baoZhou/baoZhouDetils/baoZhouDetils.vue +++ b/pages/baoZhou/baoZhouDetils/baoZhouDetils.vue @@ -27,18 +27,9 @@ <uni-easyinput type="textarea" v-model="formData.remark" :disabled="true" /> </uni-forms-item> <uni-forms-item name="outNum" :label-width="80" label="淇濆吇鍥剧墖:"> - <view class="grid col-4 grid-square flex-sub"> - <view class="bg-img" v-for="(item,index) in imgList" :key="index" @tap="ViewImage" - :data-url="imgList[index]"> - <image :src="imgList[index]" mode="aspectFill"></image> - <view class="cu-tag bg-red radius" @tap.stop="DelImg" :data-index="index"> - <text class='cuIcon-close'></text> - </view> - </view> - <view class="solids" v-if="imgList.length<1"> - <text class='cuIcon-cameraadd'></text> - </view> - </view> + <uni-file-picker limit="9" :value="fileLists" :image-styles="imageStyles" + :sourceType="sourceType" @select="select" @progress="progress" @success="success" + @fail="fail" @delete="deletea" :readonly="true" /> </uni-forms-item> </uni-group> </uni-forms> @@ -59,23 +50,29 @@ </view> <view class="flex"> <view class="flex-sub text-light bg-white padding-xs margin-xs radius">瀛愪繚鍏婚」:</view> - <view class="flex-sub bg-white padding-xs margin-xs radius text-right" + <view class="flex-sub bg-white padding-xs margin-xs radius text-right"> + {{item.subItemName}} + </view> + <!-- <view class="flex-sub bg-white padding-xs margin-xs radius text-right" v-if="item.subItemName!=null && item.subItemName.length>10"> {{(item.subItemName).toString().substr(0,10)+'...'}} </view> <view class="flex-sub bg-white padding-xs margin-xs radius text-right" v-else> {{item.subItemName}} - </view> + </view> --> </view> <view class="flex"> <view class="flex-sub text-light bg-white padding-xs margin-xs radius">淇濆吇瑕佹眰:</view> - <view class="flex-sub bg-white padding-xs margin-xs radius text-right" + <!-- <view class="flex-sub bg-white padding-xs margin-xs radius text-right" v-if="item.itemDemand!=null && item.itemDemand.length>10"> {{(item.itemDemand).toString().substr(0,10)+'...'}} </view> <view class="flex-sub bg-white padding-xs margin-xs radius text-right" v-else> + {{item.itemDemand}} + </view> --> + <view class="flex-sub bg-white padding-xs margin-xs radius text-right"> {{item.itemDemand}} </view> </view> @@ -114,6 +111,14 @@ mixins: [MescrollMixin], // 浣跨敤mixin data() { return { + // 鍥剧墖鍥炴樉 + fileLists: [], + // 涓婁紶鍥剧墖鐨勬牱寮� + imageStyles: { + width: 90, + height: 90, + }, + sourceType: ['album', 'camera'], ipAndPort:configService.staticURL, scrollLeft: 0, searchValue: '', @@ -189,23 +194,6 @@ handleCode(e) { this.inspectionResult = e; }, - // getEquipment() { - // this.$http.get(this.url.getEquipmentList).then(res => { - // //璁剧疆鍒楄〃鏁版嵁 - // if (res.data.success) { - // this.equipmentList = res.data.result - // } else { - // uni.showToast({ - // icon: "error", - // title: res.data.message, - // duration: 2000 - // }); - - // } - // }).catch(() => { - // this.$tip.error("鑱旂綉澶辫触") - // }) - // }, getEquipment() { this.$http.get(this.url.getEquipmentList, { params: { @@ -249,71 +237,7 @@ //鑱旂綉澶辫触, 缁撴潫鍔犺浇 }) }, - ChooseImage() { - var that = this; - uni.chooseImage({ - count: 4, - sizeType: ['original', 'compressed'], // 鍙互鎸囧畾鏄師鍥捐繕鏄帇缂╁浘锛岄粯璁や簩鑰呴兘鏈� - sourceType: ['album'], // 浠庣浉鍐岄�夋嫨 - success: (res) => { - // 瀛樺偍閫夋嫨鐨勫浘鐗囪矾寰� - that.imgList = res.tempFilePaths; - // 鍒濆鍖� formData.avatar 涓虹┖瀛楃涓� - that.formData.avatar = ''; - - // 鍒涘缓涓婁紶浠诲姟鐨� Promise 鏁扮粍 - const uploadPromises = res.tempFilePaths.map((filePath, index) => { - return new Promise((resolve, reject) => { - that.$http.upload(that.url.upload, { - filePath: filePath, - name: 'file' - }) - .then(uploadRes => { - // 鍋囪鏈嶅姟鍣ㄨ繑鍥炵殑缁撴灉涓寘鍚枃浠惰矾寰� - const filePath = uploadRes.data.result[0]; - // 杩藉姞鍒� formData.avatar 涓紝骞剁敤閫楀彿鍒嗛殧 - this.formData.avatar.push(filePath); - resolve(filePath); - }) - .catch(err => { - console.error('鍥剧墖' + index + '涓婁紶澶辫触:', err); - reject(err); - }); - }); - }); - - // 骞跺彂鎵ц鎵�鏈変笂浼犱换鍔� - Promise.all(uploadPromises) - .then((uploadedFilePaths) => { - console.log('鎵�鏈夊浘鐗囦笂浼犳垚鍔�:', that.formData.avatar); - }) - .catch((err) => { - console.error('鍥剧墖涓婁紶澶辫触:', err); - that.$tip.error('鍥剧墖涓婁紶澶辫触'); - }); - } - }); - }, - ViewImage(e) { - uni.previewImage({ - urls: this.imgList, - current: e.currentTarget.dataset.url - }); - }, - DelImg(e) { - uni.showModal({ - title: '鎻愮ず', - content: '纭畾瑕佸垹闄よ繖娈靛洖蹇嗗悧锛�', - cancelText: '鍐嶇湅鐪�', - confirmText: '鍐嶈', - success: res => { - if (res.confirm) { - this.imgList.splice(e.currentTarget.dataset.index, 1) - } - } - }) - }, upCallback() { this.$http.get(this.url.stallList, { @@ -337,6 +261,13 @@ this.imgList = imageObjects.map(imageObj => { return `${this.ipAndPort}${imageObj.filePath}`; }); + + // 鏍规嵁 imgList 鏋勯�� fileLists + this.fileLists = this.imgList.map(url => ({ + url: url, + extname: 'png', + name: 'eam' + })); } }).catch(() => { //鑱旂綉澶辫触, 缁撴潫鍔犺浇 diff --git a/pages/checkList/checkList.vue b/pages/checkList/checkList.vue index 5b30de1..8dcfa39 100644 --- a/pages/checkList/checkList.vue +++ b/pages/checkList/checkList.vue @@ -3,6 +3,11 @@ <cu-custom :bgColor="NavBarColor" :isBack="true" backRouterName="productionTask"> <block slot="backText">杩斿洖</block> <block slot="content">鐐规鍒楄〃</block> + <block slot="right"> + <view @click="search"> + <image class="search" src="/static/icon/sear.png" style="width: 25px; height: 25px;" alt="" /> + </view> + </block> </cu-custom> <view style="width: 100%;"> @@ -11,11 +16,14 @@ <!-- 鍩虹琛ㄥ崟鏍¢獙 --> <uni-forms ref="form" :modelValue="formData" validate-trigger="bind" err-show-type="undertext"> <uni-group title="" top="0"> - <uni-forms-item name="numbers" label="棰嗘枡鐢宠鍗曞彿:"> - <uni-easyinput type="text" v-model="formData.num" placeholder="璇疯緭鍏ラ鏂欑敵璇峰崟鍙锋绱�" /> + <uni-forms-item name="orderNum" label="宸ュ崟鍙�:"> + <uni-easyinput type="text" v-model="formData.orderNum" placeholder="璇疯緭鍏ラ鏂欑敵璇峰崟鍙锋绱�" /> </uni-forms-item> - <uni-forms-item name="name" label="棰嗘枡浜у搧:"> - <uni-easyinput v-model="formData.partNumNameModel" placeholder="璇疯緭鍏ラ鏂欎骇鍝�" /> + <uni-forms-item name="name" label="璁惧缂栧彿:"> + <zxz-uni-data-select :localdata="equipmentList" dataKey="text" + field="value as value, text as text, title as label" dataValue="value" + emptyTips="鏆傛棤鏁版嵁" :multiple="false" :filterable='true' @change="changeEquipmentList" + placeholder="璇烽�夋嫨璁惧缂栧彿:" :clear='true' /> </uni-forms-item> </uni-group> </uni-forms> @@ -87,17 +95,19 @@ mixins: [MescrollMixin], // 浣跨敤mixin data() { return { + equipmentList:[], type: 'top', scrollLeft: 0, formData: { num: '', - partNumNameModel: '' + orderNum: '' }, NavBarColor: this.NavBarColor, activeColor: '#5277A6', url: { stallList: "eam/eamInspectionOrder/list", - receive: "eam/eamInspectionOrder/receiveInspectionOrder" + receive: "eam/eamInspectionOrder/receiveInspectionOrder", + getEquipmentList: 'eam/equipment/list' }, upOption: { page: { @@ -143,8 +153,39 @@ } }, - created() {}, + created() { + this.getEquipment() + }, methods: { + getEquipment() { + this.$http.get(this.url.getEquipmentList, { + params: { + pageNo: 1, + pageSize: 9999, + order: 'desc', + column: 'createTime' + }, + + }).then(res => { + //璁剧疆鍒楄〃鏁版嵁 + if (res.data.success) { + this.equipmentList = res.data.result.records + } else { + uni.showToast({ + icon: "error", + title: res.data.message, + duration: 2000 + }); + + } + }).catch(() => { + this.$tip.error("鑱旂綉澶辫触") + }) + }, + changeEquipmentList(e) { + console.log(e.id) + this.formData.num = e.id; + }, /** * 棰嗗彇 */ @@ -153,7 +194,7 @@ this.$tip.loading(); this.$http.get(this.url.receive, { params: { - id: item.id, + id: item.id, }, }).then(res => { console.log(res) @@ -238,8 +279,8 @@ resetTask() { + this.formData.orderNum = '' this.formData.num = '' - this.formData.partNumNameModel = '' this.$refs.popup.close(); this.mescroll.resetUpScroll() @@ -247,19 +288,17 @@ /* 妫�绱� */ getSera() { this.$refs.popup.close(); - let keyword = this.TabCur this.msgList = []; - - if (keyword == 0) { this.$http.get(this.url.stallList, { params: { pageNo: 1, pageSize: 999, order: "desc", column: "createTime", - num: '*' + this.formData.num + '*', - partNumNameModel: '*' + this.formData.partNumNameModel + '*', - status: 'published' + inspectionStatus: 'WAIT_INSPECTION', + equipmentId: this.formData.num, + orderNum: this.formData.orderNum + } }).then(res => { //鑱旂綉鎴愬姛鐨勫洖璋�,闅愯棌涓嬫媺鍒锋柊鍜屼笂鎷夊姞杞界殑鐘舵��; @@ -285,87 +324,6 @@ //鑱旂綉澶辫触, 缁撴潫鍔犺浇 this.mescroll.endErr(); }) - - } else if (keyword == 1) { - this.$http.get(this.url.stallList, { - params: { - pageNo: 1, - pageSize: 999, - order: "desc", - column: "createTime", - status: 'training', - num: '*' + this.formData.num + '*', - partNumNameModel: '*' + this.formData.partNumNameModel + '*' - - } - }).then(res => { - //鑱旂綉鎴愬姛鐨勫洖璋�,闅愯棌涓嬫媺鍒锋柊鍜屼笂鎷夊姞杞界殑鐘舵��; - - this.announcement1 = res.data.result.records - this.mescroll.endSuccess(this.announcement1.length); - console.log("url", res) - //璁剧疆鍒楄〃鏁版嵁 - if (res.data.success) { - console.log("res", res.data) - this.msg1Count = res.data.result.total - this.msg2Title = "閫氱煡(" + res.data.result.total + ")"; - for (let annItem of this.announcement1) { - this.msgList.push(annItem) - } - } - if (page.num == 1) { - this.msgList = []; //濡傛灉鏄涓�椤甸渶鎵嬪姩鍒剁┖鍒楄〃 - this.msgList = this.msgList.concat(this.announcement1); //杩藉姞鏂版暟鎹� - } - - }).catch(() => { - //鑱旂綉澶辫触, 缁撴潫鍔犺浇 - this.mescroll.endErr(); - }) - - } else if (keyword == 2) { - this.$http.get(this.url.stallList, { - params: { - pageNo: 1, - pageSize: 999, - order: "desc", - column: "createTime", - status: 'completed', - num: '*' + this.formData.num + '*', - partNumNameModel: '*' + this.formData.partNumNameModel + '*' - - } - }).then(res => { - //鑱旂綉鎴愬姛鐨勫洖璋�,闅愯棌涓嬫媺鍒锋柊鍜屼笂鎷夊姞杞界殑鐘舵��; - - this.announcement1 = res.data.result.records - this.mescroll.endSuccess(this.announcement1.length); - console.log("url", res) - //璁剧疆鍒楄〃鏁版嵁 - if (res.data.success) { - console.log("res", res.data) - this.msg3Count = res.data.result.total - this.msg1Title = "閫氱煡(" + res.data.result.total + ")"; - for (let annItem of this.announcement1) { - this.msgList.push(annItem) - } - } - if (page.num == 1) { - this.msgList = []; //濡傛灉鏄涓�椤甸渶鎵嬪姩鍒剁┖鍒楄〃 - this.msgList = this.msgList.concat(this.announcement1); //杩藉姞鏂版暟鎹� - } - - }).catch(() => { - //鑱旂綉澶辫触, 缁撴潫鍔犺浇 - this.mescroll.endErr(); - }) - - } - - - - - }, diff --git a/pages/checkList/checkListDetils/checkListDetils.vue b/pages/checkList/checkListDetils/checkListDetils.vue index fc70d2c..ded0835 100644 --- a/pages/checkList/checkListDetils/checkListDetils.vue +++ b/pages/checkList/checkListDetils/checkListDetils.vue @@ -6,7 +6,18 @@ </cu-custom> <view class="container"> + <template> + <!-- 娴獥閬僵灞� --> + <view v-if="showPreview" class="overlay" @tap.stop="closePreview"> + <view class="modal"> + <!-- 鍏抽棴鎸夐挳 --> + <text class="close-btn" @tap.stop="showPreview = false">×</text> + <!-- 鍥剧墖灞曠ず --> + <image :src="previewImageSrc" mode="aspectFit" class="preview-image" /> + </view> + </view> + </template> <uni-forms ref="form" :modelValue="formData" validate-trigger="bind" err-show-type="undertext"> <uni-group top="1"> <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 鍩烘湰淇℃伅 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> @@ -27,18 +38,12 @@ <uni-easyinput type="textarea" v-model="formData.remark" :disabled="true" /> </uni-forms-item> <uni-forms-item name="outNum" :label-width="80" label="鐐规鍥剧墖:"> - <view class="grid col-4 grid-square flex-sub"> - <view class="bg-img" v-for="(item,index) in imgList" :key="index" @tap="ViewImage" - :data-url="imgList[index]"> - <image :src="imgList[index]" mode="aspectFill"></image> - <view class="cu-tag bg-red radius" @tap.stop="DelImg" :data-index="index"> - <text class='cuIcon-close'></text> - </view> - </view> - <view class="solids" v-if="imgList.length<1"> - <text class='cuIcon-cameraadd'></text> - </view> - </view> + <uni-file-picker limit="9" :value="fileLists" :image-styles="imageStyles" + :sourceType="sourceType" @select="select" @progress="progress" @success="success" + @fail="fail" @delete="deletea" :readonly="true" /> + </uni-forms-item> + <uni-forms-item name="outNum" :label-width="80" label="浣滀笟鎸囧:"> + <button class="cu-btn bg-blue" @tap="showPreview = true">鏌ョ湅</button> </uni-forms-item> </uni-group> </uni-forms> @@ -59,14 +64,17 @@ </view> <view class="flex"> <view class="flex-sub text-light bg-white padding-xs margin-xs radius">淇濆吇瑕佹眰:</view> - <view class="flex-sub bg-white padding-xs margin-xs radius text-right" + <view class="flex-sub bg-white padding-xs margin-xs radius text-right"> + {{item.itemDemand}} + </view> + <!-- <view class="flex-sub bg-white padding-xs margin-xs radius text-right" v-if="item.itemDemand!=null && item.itemDemand.length>10"> {{(item.itemDemand).toString().substr(0,10)+'...'}} </view> <view class="flex-sub bg-white padding-xs margin-xs radius text-right" v-else> {{item.itemDemand}} - </view> + </view> --> </view> <view class="flex"> @@ -102,6 +110,16 @@ mixins: [MescrollMixin], // 浣跨敤mixin data() { return { + showPreview: false, + // 鍥剧墖鍥炴樉 + fileLists: [], + // 涓婁紶鍥剧墖鐨勬牱寮� + sourceType: ['album', 'camera'], + imageStyles: { + width: 90, + height: 90, + }, + previewImageSrc: '', ipAndPort: configService.staticURL, scrollLeft: 0, searchValue: '', @@ -120,11 +138,12 @@ url: { upload: "/eam/sysFiles/batch_upload", stallList: "/eam/eamInspectionOrder/queryById", - getEquipmentList:'eam/equipment/list', - // getEquipmentList: "eam/equipment/asyncLoadEquipment", + getEquipmentList: 'eam/equipment/list', + getStandardFile: "eam/maintenanceStandard/queryById", BaoList: 'eam/eamInspectionOrderDetail/queryList' }, id: '', + standardId: '', inspectionResult: '', upOption: { page: { @@ -140,10 +159,12 @@ isShowNoMore: false, textNoMore: '鎴戞槸鏈夊簳绾跨殑 >_<' }, + imgList: [], styles: { color: '#2979FF', borderColor: '#2979FF' }, + referenceFileList: [], msg1Count: 0, msg2Count: 0, msg1Title: "" @@ -171,54 +192,41 @@ }, methods: { + closePreview() { + this.showPreview = false; + }, changeEquipmentList(e) { this.formData.num = e; }, handleCode(e) { this.inspectionResult = e; }, - getEquipment() { - this.$http.get(this.url.getEquipmentList, { - params: { - pageNo: 1, - pageSize: 9999, - order: 'desc', - column: 'createTime' - }, - - }).then(res => { - //璁剧疆鍒楄〃鏁版嵁 - if (res.data.success) { - this.equipmentList = res.data.result.records - } else { - uni.showToast({ - icon: "error", - title: res.data.message, - duration: 2000 - }); - - } - }).catch(() => { - this.$tip.error("鑱旂綉澶辫触") - }) - }, - // getEquipment() { - // this.$http.get(this.url.getEquipmentList).then(res => { - // //璁剧疆鍒楄〃鏁版嵁 - // if (res.data.success) { - // this.equipmentList = res.data.result - // } else { - // uni.showToast({ - // icon: "error", - // title: res.data.message, - // duration: 2000 - // }); + getEquipment() { + this.$http.get(this.url.getEquipmentList, { + params: { + pageNo: 1, + pageSize: 9999, + order: 'desc', + column: 'createTime' + }, - // } - // }).catch(() => { - // this.$tip.error("鑱旂綉澶辫触") - // }) - // }, + }).then(res => { + //璁剧疆鍒楄〃鏁版嵁 + if (res.data.success) { + this.equipmentList = res.data.result.records + } else { + uni.showToast({ + icon: "error", + title: res.data.message, + duration: 2000 + }); + + } + }).catch(() => { + this.$tip.error("鑱旂綉澶辫触") + }) + }, + getList() { this.$http.get(this.url.BaoList, { params: { @@ -237,68 +245,102 @@ //鑱旂綉澶辫触, 缁撴潫鍔犺浇 }) }, - ChooseImage() { - var that = this; - uni.chooseImage({ - count: 4, - sizeType: ['original', 'compressed'], // 鍙互鎸囧畾鏄師鍥捐繕鏄帇缂╁浘锛岄粯璁や簩鑰呴兘鏈� - sourceType: ['album'], // 浠庣浉鍐岄�夋嫨 - success: (res) => { - // 瀛樺偍閫夋嫨鐨勫浘鐗囪矾寰� - that.imgList = res.tempFilePaths; - that.formData.avatar =[]; - // 鍒涘缓涓婁紶浠诲姟鐨� Promise 鏁扮粍 - const uploadPromises = res.tempFilePaths.map((filePath, index) => { - return new Promise((resolve, reject) => { - that.$http.upload(that.url.upload, { - filePath: filePath, - name: 'file' - }) - .then(uploadRes => { - // 鍋囪鏈嶅姟鍣ㄨ繑鍥炵殑缁撴灉涓寘鍚枃浠惰矾寰� - const filePath = uploadRes.data.result[0]; - // 杩藉姞鍒� formData.avatar 涓紝骞剁敤閫楀彿鍒嗛殧 - this.formData.avatar.push(filePath); - resolve(filePath); - }) - .catch(err => { - console.error('鍥剧墖' + index + '涓婁紶澶辫触:', err); - reject(err); - }); - }); - }); - - // 骞跺彂鎵ц鎵�鏈変笂浼犱换鍔� - Promise.all(uploadPromises) - .then((uploadedFilePaths) => { - console.log('鎵�鏈夊浘鐗囦笂浼犳垚鍔�:', that.formData.avatar); - }) - .catch((err) => { - console.error('鍥剧墖涓婁紶澶辫触:', err); - that.$tip.error('鍥剧墖涓婁紶澶辫触'); - }); - } - }); - }, - ViewImage(e) { - uni.previewImage({ - urls: this.imgList, - current: e.currentTarget.dataset.url - }); - }, - DelImg(e) { - uni.showModal({ - title: '鎻愮ず', - content: '纭畾瑕佸垹闄よ繖娈靛洖蹇嗗悧锛�', - cancelText: '鍐嶇湅鐪�', - confirmText: '鍐嶈', - success: res => { - if (res.confirm) { - this.imgList.splice(e.currentTarget.dataset.index, 1) - } - } - }) - }, + + getStandardFile() { + this.$http.get(this.url.getStandardFile, { + params: { + id: this.standardId + } + }).then(res => { + if (res.data.success) { + console.log("res", res.data.result); + const referenceFileStr = res.data.result.referenceFile; + + // 鍒ゆ柇鏄惁瀛樺湪 referenceFile 骞惰繘琛岃В鏋� + if (referenceFileStr) { + try { + const referenceFileObj = JSON.parse(referenceFileStr); + const filePath = `${this.ipAndPort}${referenceFileObj.filePath}`; + this.previewImageSrc = filePath; + console.log('previewImageSrc:', this.previewImageSrc); + } catch (e) { + console.error("referenceFile 瑙f瀽澶辫触", e); + this.previewImageSrc = ''; + } + } else { + console.warn("referenceFile 涓嶅瓨鍦�"); + this.previewImageSrc = ''; + } + } + }).catch(err => { + console.error("缃戠粶璇锋眰澶辫触", err); + // 鑱旂綉澶辫触, 缁撴潫鍔犺浇 + }); + }, + + + // ChooseImage() { + // var that = this; + // uni.chooseImage({ + // count: 4, + // sizeType: ['original', 'compressed'], // 鍙互鎸囧畾鏄師鍥捐繕鏄帇缂╁浘锛岄粯璁や簩鑰呴兘鏈� + // sourceType: ['album'], // 浠庣浉鍐岄�夋嫨 + // success: (res) => { + // // 瀛樺偍閫夋嫨鐨勫浘鐗囪矾寰� + // that.imgList = res.tempFilePaths; + // that.formData.avatar =[]; + // // 鍒涘缓涓婁紶浠诲姟鐨� Promise 鏁扮粍 + // const uploadPromises = res.tempFilePaths.map((filePath, index) => { + // return new Promise((resolve, reject) => { + // that.$http.upload(that.url.upload, { + // filePath: filePath, + // name: 'file' + // }) + // .then(uploadRes => { + // // 鍋囪鏈嶅姟鍣ㄨ繑鍥炵殑缁撴灉涓寘鍚枃浠惰矾寰� + // const filePath = uploadRes.data.result[0]; + // // 杩藉姞鍒� formData.avatar 涓紝骞剁敤閫楀彿鍒嗛殧 + // this.formData.avatar.push(filePath); + // resolve(filePath); + // }) + // .catch(err => { + // console.error('鍥剧墖' + index + '涓婁紶澶辫触:', err); + // reject(err); + // }); + // }); + // }); + + // // 骞跺彂鎵ц鎵�鏈変笂浼犱换鍔� + // Promise.all(uploadPromises) + // .then((uploadedFilePaths) => { + // console.log('鎵�鏈夊浘鐗囦笂浼犳垚鍔�:', that.formData.avatar); + // }) + // .catch((err) => { + // console.error('鍥剧墖涓婁紶澶辫触:', err); + // that.$tip.error('鍥剧墖涓婁紶澶辫触'); + // }); + // } + // }); + // }, + // ViewImage(e) { + // uni.previewImage({ + // urls: this.imgList, + // current: e.currentTarget.dataset.url + // }); + // }, + // DelImg(e) { + // uni.showModal({ + // title: '鎻愮ず', + // content: '纭畾瑕佸垹闄よ繖娈靛洖蹇嗗悧锛�', + // cancelText: '鍐嶇湅鐪�', + // confirmText: '鍐嶈', + // success: res => { + // if (res.confirm) { + // this.imgList.splice(e.currentTarget.dataset.index, 1) + // } + // } + // }) + // }, upCallback() { this.$http.get(this.url.stallList, { @@ -310,23 +352,34 @@ console.log("url", res) //璁剧疆鍒楄〃鏁版嵁 if (res.data.success) { - - this.formData.num = this.announcement1.equipmentId - this.formData.orderNum = this.announcement1.orderNum - this.formData.operator = this.announcement1.operator - this.formData.remark=this.announcement1.remark - this.formData.inspectionDate = this.announcement1.inspectionDate - this.formData.avatar = this.announcement1.imageFiles - if(!this.formData.avatar == null){ - this.imgList = JSON.parse(this.formData.avatar) - const imageObjects = JSON.parse(this.formData.avatar);a - // 鎻愬彇 filePath 骞舵嫾鎺� IP 鍜岀鍙� - this.imgList = imageObjects.map(imageObj => { - return `${this.ipAndPort}${imageObj.filePath}`; - }); - } - - + this.formData.num = this.announcement1.equipmentId + this.formData.orderNum = this.announcement1.orderNum + this.formData.operator = this.announcement1.operator + this.formData.remark = this.announcement1.remark + this.formData.inspectionDate = this.announcement1.inspectionDate + if (this.announcement1.standardId !== null) { + this.standardId = this.announcement1.standardId + this.getStandardFile() + } + this.formData.avatar = this.announcement1.imageFiles + if (!this.formData.avatar == null) { + this.imgList = JSON.parse(this.formData.avatar) + const imageObjects = JSON.parse(this.formData.avatar); + a + // 鎻愬彇 filePath 骞舵嫾鎺� IP 鍜岀鍙� + this.imgList = imageObjects.map(imageObj => { + return `${this.ipAndPort}${imageObj.filePath}`; + }); + + // 鏍规嵁 imgList 鏋勯�� fileLists + this.fileLists = this.imgList.map(url => ({ + url: url, + extname: 'png', + name: 'eam' + })); + } + + } }).catch(() => { //鑱旂綉澶辫触, 缁撴潫鍔犺浇 @@ -404,4 +457,41 @@ margin-top: 85px; height: auto; } + + .overlay { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.7); + display: flex; + align-items: center; + justify-content: center; + z-index: 999; + } + + .modal { + position: relative; + width: 90%; + max-width: 600px; + background: #fff; + border-radius: 12rpx; + padding: 20rpx; + box-sizing: border-box; + } + + .preview-image { + width: 100%; + max-height: 80vh; + object-fit: contain; + } + + .close-btn { + position: absolute; + top: 10rpx; + right: 20rpx; + font-size: 40rpx; + color: #333; + } </style> \ No newline at end of file diff --git a/pages/maintenanceReport/maintenanceReport.vue b/pages/maintenanceReport/maintenanceReport.vue index 6508047..dc80751 100644 --- a/pages/maintenanceReport/maintenanceReport.vue +++ b/pages/maintenanceReport/maintenanceReport.vue @@ -39,8 +39,8 @@ <view class="content"> <uni-card margin="10px" spacing="1px" v-for="(item,index) in msgList" :key="index" @click="onClickProductionTask(item)"> - - + + <view class="flex"> <view class="flex-sub text-light bg-white padding-xs margin-xs radius">璁惧缂栧彿:</view> <view class="flex-sub bg-white padding-xs margin-xs text-bold radius text-right"> @@ -59,7 +59,7 @@ {{item.faultStartTime}} </view> </view> - + <view class="flex"> <view class="flex-sub text-light bg-white padding-xs margin-xs radius">鎿嶄綔:</view> @@ -91,7 +91,7 @@ activeColor: '#5277A6', url: { stallList: "/eam/eamReportRepair/list", - add:'/eam/eamRepairOrder/add' + add: '/eam/eamRepairOrder/add' }, upOption: { @@ -145,44 +145,23 @@ * 棰嗗彇 */ handleStartWork(item) { - - this.$tip.loading(); + + uni.showLoading({ + mask: true, + title: "鍔犺浇涓�....", + }) this.$http.post(this.url.add, { - - actualEndTime: item.actualEndTime, - actualStartTime: item.actualStartTime, - createBy: item.actualStartTime, - createTime: item.createTime, - delFlag: item.delFlag, - equipmentId:item.equipmentId, - equipmentName: item.equipmentName, - faultReason:item.faultReason, - id: item.faultReason, - imageFiles:item.imageFiles, - imageFilesResult:null, - outsourcedEndTime:item.outsourcedEndTime, - outsourcedFlag:item.outsourcedFlag, - outsourcedPerson: item.outsourcedPerson, - outsourcedRepairDescription:item.outsourcedRepairDescription, - outsourcedStartTime:item.outsourcedStartTime, - repairCode:item.repairCode, - repairDescription:item.repairDescription, - repairStatus:item.repairStatus, - repairer:item.repairer, - reportId:item.id, - updateBy:item.updateBy, - updateTime: item.updateTime - + reportId: item.id, }).then(res => { console.log(res) - this.$tip.loaded(); + uni.hideLoading() if (res.data.success) { uni.showToast({ icon: "success", title: '棰嗗彇鎴愬姛', duration: 2000 }); - this.mescroll.resetUpScroll() + this.mescroll.resetUpScroll(); } else { uni.showModal({ title: "鎻愮ず", @@ -205,11 +184,11 @@ * 璇︽儏椤甸潰 */ onClickProductionTask(item) { - + uni.navigateTo({ url: '/pages/maintenanceReport/maintenanceReportDetils/maintenanceReportDetils?item=' + encodeURIComponent(JSON.stringify(item)) - + }) }, @@ -225,7 +204,7 @@ pageSize: page.size, order: 'desc', column: 'createTime', - repairStatus: 'WAIT_REPAIR' + reportStatus: 'WAIT_REPAIR' }, }).then(res => { diff --git a/pages/maintenanceReport/maintenanceReportDetils/maintenanceReportDetils.vue b/pages/maintenanceReport/maintenanceReportDetils/maintenanceReportDetils.vue index a2deddc..8b4c096 100644 --- a/pages/maintenanceReport/maintenanceReportDetils/maintenanceReportDetils.vue +++ b/pages/maintenanceReport/maintenanceReportDetils/maintenanceReportDetils.vue @@ -9,18 +9,21 @@ <uni-forms ref="form" :modelValue="formData" validate-trigger="bind" err-show-type="undertext"> <uni-group top="1"> - <uni-forms-item name="num" :label-width="100" label="宸ュ崟鍙�:"> + <!-- <uni-forms-item name="num" :label-width="100" label="宸ュ崟鍙�:"> <uni-easyinput v-model="formData.repairCode" :disabled="true" /> - </uni-forms-item> + </uni-forms-item> --> <uni-forms-item required name="num" :label-width="100" label="璁惧缂栧彿:"> <uni-data-select v-model="formData.num" :localdata="equipmentList" @change="changeEquipmentList" placeholder="璇烽�夋嫨" :disabled="true" /> </uni-forms-item> - <uni-forms-item name="actualStartTime" :label-width="100" label="缁翠慨寮�濮嬫椂闂�:"> - <uni-easyinput v-model="formData.actualStartTime" :disabled="true" /> + <uni-forms-item name="faultStartTime" :label-width="100" label="鏁呴殰寮�濮嬫椂闂�:"> + <uni-easyinput v-model="formData.faultStartTime" :disabled="true" /> </uni-forms-item> - <uni-forms-item name="outNum" :label-width="100" label="缁翠慨璐熻矗浜�:"> - <uni-easyinput v-model="formData.repairer" :disabled="true" /> + <uni-forms-item name="reportStatus" :label-width="100" label="鎶ヤ慨鐘舵��:"> + <uni-easyinput v-model="formData.reportStatus" :disabled="true" /> + </uni-forms-item> + <uni-forms-item name="faultName" :label-width="100" label="鏁呴殰绠�绉�"> + <uni-easyinput v-model="formData.faultName" :disabled="true" /> </uni-forms-item> <uni-forms-item name="outNum" :label-width="100" label="鏁呴殰鎻忚堪:"> <uni-easyinput v-model="formData.faultDescription" :disabled="true" /> @@ -29,18 +32,10 @@ <uni-easyinput v-model="formData.remark" :disabled="true" /> </uni-forms-item> <uni-forms-item name="outNum" :label-width="100" label="缁翠慨鍥剧墖:"> - <view class="grid col-4 grid-square flex-sub"> - <view class="bg-img" v-for="(item,index) in imgList" :key="index" @tap="ViewImage" - :data-url="imgList[index]"> - <image :src="imgList[index]" mode="aspectFill"></image> - <view class="cu-tag bg-red radius" @tap.stop="DelImg" :data-index="index"> - <text class='cuIcon-close'></text> - </view> - </view> - <view class="solids" v-if="imgList.length<1"> - <text class='cuIcon-cameraadd'></text> - </view> - </view> + <uni-file-picker limit="9" :value="fileLists" :image-styles="imageStyles" + :sourceType="sourceType" @select="select" @progress="progress" @success="success" + @fail="fail" @delete="deletea" :readonly="true" /> + </uni-forms-item> </uni-group> </uni-forms> @@ -57,6 +52,15 @@ mixins: [MescrollMixin], // 浣跨敤mixin data() { return { + // 鍥剧墖鍥炴樉 + fileLists: [], + // 涓婁紶鍥剧墖鐨勬牱寮� + imageStyles: { + width: 90, + height: 90, + }, + // uni.chooseImage鍊硷紝浠庣浉鍐岄�夋嫨锛屾媿鎽� + sourceType: ['album', 'camera'], ipAndPort: configService.staticURL, scrollLeft: 0, searchValue: '', @@ -70,9 +74,8 @@ NavBarColor: this.NavBarColor, url: { upload: "/eam/sysFiles/batch_upload", - stallList: "/eam/eamRepairOrder/queryById", - getEquipmentList:'eam/equipment/list' - // getEquipmentList: "eam/equipment/asyncLoadEquipment" + stallList: "/eam/eamReportRepair/queryById", + getEquipmentList: 'eam/equipment/list' }, id: '', serverBaseUrl: '', @@ -123,72 +126,6 @@ changeEquipmentList(e) { this.formData.num = e; }, - ChooseImage() { - var that = this; - uni.chooseImage({ - count: 4, - sizeType: ['original', 'compressed'], // 鍙互鎸囧畾鏄師鍥捐繕鏄帇缂╁浘锛岄粯璁や簩鑰呴兘鏈� - sourceType: ['album'], // 浠庣浉鍐岄�夋嫨 - success: (res) => { - // 瀛樺偍閫夋嫨鐨勫浘鐗囪矾寰� - that.imgList = res.tempFilePaths; - - // 鍒濆鍖� formData.avatar 涓虹┖瀛楃涓� - that.formData.avatar = ''; - - // 鍒涘缓涓婁紶浠诲姟鐨� Promise 鏁扮粍 - const uploadPromises = res.tempFilePaths.map((filePath, index) => { - return new Promise((resolve, reject) => { - that.$http.upload(that.url.upload, { - filePath: filePath, - name: 'file' - }) - .then(uploadRes => { - // 鍋囪鏈嶅姟鍣ㄨ繑鍥炵殑缁撴灉涓寘鍚枃浠惰矾寰� - const filePath = uploadRes.data.result[0]; - // 杩藉姞鍒� formData.avatar 涓紝骞剁敤閫楀彿鍒嗛殧 - this.formData.avatar.push(filePath); - resolve(filePath); - }) - .catch(err => { - console.error('鍥剧墖' + index + '涓婁紶澶辫触:', err); - reject(err); - }); - }); - }); - - // 骞跺彂鎵ц鎵�鏈変笂浼犱换鍔� - Promise.all(uploadPromises) - .then((uploadedFilePaths) => { - console.log('鎵�鏈夊浘鐗囦笂浼犳垚鍔�:', that.formData.avatar); - }) - .catch((err) => { - console.error('鍥剧墖涓婁紶澶辫触:', err); - that.$tip.error('鍥剧墖涓婁紶澶辫触'); - }); - } - }); - }, - ViewImage(e) { - uni.previewImage({ - urls: this.imgList, - current: e.currentTarget.dataset.url - }); - }, - DelImg(e) { - uni.showModal({ - title: '鎻愮ず', - content: '纭畾瑕佸垹闄よ繖娈靛洖蹇嗗悧锛�', - cancelText: '鍐嶇湅鐪�', - confirmText: '鍐嶈', - success: res => { - if (res.confirm) { - this.imgList.splice(e.currentTarget.dataset.index, 1) - } - } - }) - }, - upCallback() { this.$http.get(this.url.stallList, { params: { @@ -201,42 +138,34 @@ //璁剧疆鍒楄〃鏁版嵁 if (res.data.success) { console.log("res", res.data.result) - this.formData.repairCode=this.announcement1.repairCode + this.formData.repairCode = this.announcement1.repairCode this.formData.num = this.announcement1.equipmentId - this.formData.actualStartTime = this.announcement1.actualStartTime - this.formData.repairer = this.announcement1.repairer + this.formData.faultStartTime = this.announcement1.faultStartTime + this.formData.reportStatus = this.announcement1.reportStatus_dictText + this.formData.faultName = this.announcement1.faultName this.formData.faultDescription = this.announcement1.faultDescription this.formData.remark = this.announcement1.remark - this.formData.avatar = this.announcement1.reportImageFiles + this.formData.avatar = this.announcement1.imageFiles this.imgList = JSON.parse(this.formData.avatar) const imageObjects = JSON.parse(this.formData.avatar); - // 鎻愬彇 filePath 骞舵嫾鎺� IP 鍜岀鍙� + // 鍋囪 imgList 鏄凡鏈夌殑鍥剧墖鍦板潃鏁扮粍 this.imgList = imageObjects.map(imageObj => { return `${this.ipAndPort}${imageObj.filePath}`; }); + + // 鏍规嵁 imgList 鏋勯�� fileLists + this.fileLists = this.imgList.map(url => ({ + url: url, + extname: 'png', + name: 'eam' + })); } }).catch(() => { //鑱旂綉澶辫触, 缁撴潫鍔犺浇 }) }, - // getEquipment() { - // this.$http.get(this.url.getEquipmentList).then(res => { - // //璁剧疆鍒楄〃鏁版嵁 - // if (res.data.success) { - // this.equipmentList = res.data.result - // } else { - // uni.showToast({ - // icon: "error", - // title: res.data.message, - // duration: 2000 - // }); - // } - // }).catch(() => { - // this.$tip.error("鑱旂綉澶辫触") - // }) - // }, - getEquipment() { + getEquipment() { this.$http.get(this.url.getEquipmentList, { params: { pageNo: 1, @@ -244,7 +173,7 @@ order: 'desc', column: 'createTime' }, - + }).then(res => { //璁剧疆鍒楄〃鏁版嵁 if (res.data.success) { @@ -311,6 +240,31 @@ </script> <style> + .divider { + display: flex; + align-items: center; + text-align: center; + color: gray; + /* 鏂囧瓧棰滆壊 */ + margin: 20px 0; + /* 涓婁笅闂磋窛 */ + } + + .divider::before, + .divider::after { + content: ''; + flex: 1; + border-bottom: 1px solid gray; + /* 妯嚎棰滆壊 */ + margin: 0 16px; + /* 妯嚎涓庢枃瀛椾箣闂寸殑闂磋窛 */ + } + + .divider text { + white-space: nowrap; + /* 闃叉鏂囧瓧鎹㈣ */ + } + .is-hover { color: rgba(255, 255, 255, 0.6); background-color: #55aaff; diff --git a/pages/reportRepair/reportRepair.vue b/pages/reportRepair/reportRepair.vue index e48e7d3..4141107 100644 --- a/pages/reportRepair/reportRepair.vue +++ b/pages/reportRepair/reportRepair.vue @@ -11,42 +11,31 @@ <uni-data-select v-model="formData.num" :localdata="equipmentList" @change="changeEquipmentList" placeholder="璇烽�夋嫨" /> </uni-forms-item> --> - <uni-forms-item required name="num" label="璁惧缂栧彿:"> + <uni-forms-item required :label-width="100" name="num" label="璁惧缂栧彿:"> <uni-easyinput v-model=" formData.numSear" placeholder="璇烽�夋嫨" :disabled="true" suffixIcon="search" @iconClick="OnenterpriseId()" /> </uni-forms-item> - <uni-forms-item required name="name" label="鏁呴殰绠�绉�:"> + <uni-forms-item required :label-width="100" name="name" label="鏁呴殰绠�绉�:"> <uni-data-select v-model="formData.faultName" :localdata="formData.faultNameList" @change="changefaultNameList" placeholder="璇烽�夋嫨" /> </uni-forms-item> - <uni-forms-item required name="faultType" label="鏁呴殰鍒嗙被:"> + <uni-forms-item required :label-width="100" name="faultType" label="鏁呴殰鍒嗙被:"> <uni-easyinput v-model="formData.faultType" :disabled='true' /> </uni-forms-item> - <uni-forms-item required name="faultDescription" label="鏁呴殰鎻忚堪:"> + <uni-forms-item required :label-width="100" name="faultDescription" label="鏁呴殰鎻忚堪:"> <uni-easyinput v-model="formData.faultDescription" :disabled='true' /> </uni-forms-item> - - <uni-forms-item required name="desc" label="鏁呴殰寮�濮嬫椂闂�:"> - <uni-datetime-picker type="datetime" v-model="formData.loadTime" /> - </uni-forms-item> - <uni-forms-item required name="name" label="鏄惁鍋滄満:"> + <uni-forms-item required name="name" :label-width="100" label="鏄惁鍋滄満:"> <uni-data-select v-model="formData.breakdownFlag" :localdata="isTrueList" @change="changeisTrueList" placeholder="璇烽�夋嫨" /> </uni-forms-item> - <uni-forms-item name="outNum" label="鎶ヤ慨鍥剧墖:"> - <view class="grid col-4 grid-square flex-sub"> - <view class="bg-img" v-for="(item,index) in imgList" :key="index" @tap="ViewImage" - :data-url="imgList[index]"> - <image :src="imgList[index]" mode="aspectFill"></image> - <view class="cu-tag bg-red radius" @tap.stop="DelImg" :data-index="index"> - <text class='cuIcon-close'></text> - </view> - </view> - <view class="solids" @tap="ChooseImage" v-if="imgList.length<1"> - <text class='cuIcon-cameraadd'></text> - </view> - </view> + <uni-forms-item required :label-width="110" name="desc" label="鏁呴殰寮�濮嬫椂闂�:"> + <uni-datetime-picker type="datetime" v-model="formData.loadTime" /> + </uni-forms-item> + <uni-forms-item name="outNum" label="鎶ヤ慨鍥剧墖:"> + <uni-file-picker limit="9" :value="fileLists" :image-styles="imageStyles" :sourceType="sourceType" + @select="select" @progress="progress" @success="success" @fail="fail" @delete="deletea" /> </uni-forms-item> <uni-forms-item name="faultDescription" label="澶囨敞:"> @@ -70,6 +59,15 @@ mixins: [MescrollMixin], // 浣跨敤mixin data() { return { + // 鍥剧墖鍥炴樉 + fileLists: [], + // 涓婁紶鍥剧墖鐨勬牱寮� + imageStyles: { + width: 90, + height: 90, + }, + // uni.chooseImage鍊硷紝浠庣浉鍐岄�夋嫨锛屾媿鎽� + sourceType: ['album', 'camera'], id: '', equipmentList: [], isTrueList: [{ @@ -207,17 +205,21 @@ }, changefaultNameList(e) { this.formData.faultName = e; - if (e == '1902250920983339009') { - this.formData.faultType = this.formData.faultNameList[0].faultCategory_dictText; - this.formData.faultDescription = this.formData.faultNameList[0].faultDescription; - } else if (e == '1909114668383875074') { - this.formData.faultType = this.formData.faultNameList[1].faultCategory_dictText; - this.formData.faultDescription = this.formData.faultNameList[1].faultDescription; - } else if (e == '1909877534952710145') { - this.formData.faultType = this.formData.faultNameList[2].faultCategory_dictText; - this.formData.faultDescription = this.formData.faultNameList[2].faultDescription; + + this.setFaultReason(this.formData.faultName) + + }, + setFaultReason(value) { + for (let i = 0; i < this.formData.faultNameList.length; i++) { + if (this.formData.faultNameList[i].id === value) { + this.formData.faultType = this.formData.faultNameList[i].faultCategory_dictText + this.formData.faultDescription = this.formData.faultNameList[i].faultDescription + } + } }, + + getfaultReasonList() { this.$http.get(this.url.faultReasonList).then(res => { //璁剧疆鍒楄〃鏁版嵁 @@ -235,96 +237,67 @@ this.$tip.error("鑱旂綉澶辫触") }) }, - // getEquipment() { - // this.$http.get(this.url.getEquipmentList).then(res => { - // //璁剧疆鍒楄〃鏁版嵁 - // if (res.data.success) { - // this.equipmentList = res.data.result - // } else { - // uni.showToast({ - // icon: "error", - // title: res.data.message, - // duration: 2000 - // }); - // } - // }).catch(() => { - // this.$tip.error("鑱旂綉澶辫触") - // }) - // }, - // changeEquipmentList(e) { - // this.formData.num = e; - // }, changeisTrueList(e) { this.formData.breakdownFlag = e; }, + select(e) { + const tempFilePaths = e.tempFilePaths; - ChooseImage() { - var that = this; - uni.chooseImage({ - count: 4, - sizeType: ['original', 'compressed'], // 鍙互鎸囧畾鏄師鍥捐繕鏄帇缂╁浘锛岄粯璁や簩鑰呴兘鏈� - sourceType: ['album'], // 浠庣浉鍐岄�夋嫨 - success: (res) => { - // 瀛樺偍閫夋嫨鐨勫浘鐗囪矾寰� - that.imgList = res.tempFilePaths; + // if (!Array.isArray(tempFilePaths) || tempFilePaths.length === 0) { + // uni.showToast({ + // title: '璇烽�夋嫨鏂囦欢', + // icon: 'none' + // }); + // return; + // } - // 鍒濆鍖� formData.avatar 涓虹┖瀛楃涓� - that.formData.avatar = []; + uni.showLoading({ + title: '涓婁紶涓�...' + }); - // 鍒涘缓涓婁紶浠诲姟鐨� Promise 鏁扮粍 - const uploadPromises = res.tempFilePaths.map((filePath, index) => { - return new Promise((resolve, reject) => { - that.$http.upload(that.url.upload, { - filePath: filePath, - name: 'file' - }) - .then(uploadRes => { - // 鍋囪鏈嶅姟鍣ㄨ繑鍥炵殑缁撴灉涓寘鍚枃浠惰矾寰� - const filePath = uploadRes.data.result[0]; - this.formData.avatar.push(filePath) - resolve(filePath); - }) - .catch(err => { - console.error('鍥剧墖' + index + '涓婁紶澶辫触:', err); - reject(err); - }); - }); - }); - - // 骞跺彂鎵ц鎵�鏈変笂浼犱换鍔� - Promise.all(uploadPromises) - .then((uploadedFilePaths) => { - console.log('鎵�鏈夊浘鐗囦笂浼犳垚鍔�:', that.formData.avatar); + const uploadPromises = tempFilePaths.map((filePath, index) => { + return new Promise((resolve, reject) => { + this.$http.upload(this.url.upload, { + filePath: filePath, + name: 'file' }) - .catch((err) => { - console.error('鍥剧墖涓婁紶澶辫触:', err); - that.$tip.error('鍥剧墖涓婁紶澶辫触'); + .then(uploadRes => { + // 鍋囪鏈嶅姟鍣ㄨ繑鍥炵殑缁撴灉涓寘鍚枃浠惰矾寰� + const serverFilePath = uploadRes.data.result[0]; + this.formData.avatar.push(serverFilePath); + resolve(uploadRes); // 杩斿洖缁撴灉缁� Promise.all + }) + .catch(err => { + console.error(`鍥剧墖 ${index + 1} 涓婁紶澶辫触:`, err); + reject(err); }); - } + }); }); - }, - ViewImage(e) { - uni.previewImage({ - urls: this.imgList, - current: e.currentTarget.dataset.url - }); - }, - DelImg(e) { - uni.showModal({ - title: '鎻愮ず', - content: '纭畾瑕佸垹闄よ繖娈靛洖蹇嗗悧锛�', - cancelText: '鍐嶇湅鐪�', - confirmText: '鍐嶈', - success: res => { - if (res.confirm) { - this.imgList.splice(e.currentTarget.dataset.index, 1) - } - } - }) + + Promise.all(uploadPromises) + .then(() => { + uni.hideLoading(); + uni.showToast({ + title: '鍏ㄩ儴涓婁紶鎴愬姛' + }); + }) + .catch(err => { + uni.hideLoading(); + uni.showToast({ + title: '閮ㄥ垎涓婁紶澶辫触', + icon: 'none' + }); + console.error('涓婁紶寮傚父:', err); + }); }, + + // 鍒犻櫎 + deletea(e) { + console.log('鍒犻櫎鍥剧墖', e); + }, ProductionTask() { if (this.formData.num == 0 || this.formData.num == undefined) { uni.showToast({ @@ -366,7 +339,7 @@ duration: 2000 }); this.$Router.replaceAll({ - name: 'reportRepairList' + name: 'index' }) } diff --git a/pages/user/people.vue b/pages/user/people.vue index 896a5bd..431a2c4 100644 --- a/pages/user/people.vue +++ b/pages/user/people.vue @@ -2,10 +2,12 @@ <view> <scroll-view scroll-y class="page"> <!-- 澶撮儴logo--> - <view class="UCenter-bg"> - <image :src="personalList.avatar" class="png round animation-slide-right margin-bottom-sm" mode="scaleToFill" :style="[{animationDelay: '0.1s'}]"></image> - <image src="https://static.jeecg.com/upload/test/wave_1595818053612.gif" mode="scaleToFill" class="gif-wave"></image> - </view> + <view class="UCenter-bg"> + <image src="/static/avatar_boy.png" class="png round animation-slide-right margin-bottom-sm" + mode="scaleToFill" :style="[{animationDelay: '0.1s'}]"></image> + <image src="https://static.jeecg.com/upload/test/wave_1595818053612.gif" mode="scaleToFill" + class="gif-wave"></image> + </view> <view class="padding flex text-center text-grey bg-white shadow-warp"> <view class="flex flex-sub flex-direction solid-right animation-slide-top" :style="[{animationDelay: '0.2s'}]"> <view class="text-xl text-orange">{{personalList.username}}</view> @@ -19,7 +21,7 @@ </view> <!-- 鍒楄〃list--> <view class="cu-list menu card-menu margin-top-xl margin-bottom-xl shadow-lg radius"> - <view class="cu-item arrow animation-slide-bottom" :style="[{animationDelay: '0.1s'}]"> + <!-- <view class="cu-item arrow animation-slide-bottom" :style="[{animationDelay: '0.1s'}]"> <view class="content" > <text class="cuIcon-favorfill text-yellow"></text> <text class="text-grey">鏀惰棌</text> @@ -42,7 +44,7 @@ <text class="cuIcon-location text-cyan"></text> <text class="text-grey">瀹氫綅</text> </view> - </navigator> + </navigator> --> <navigator class="cu-item arrow animation-slide-bottom" url="/pages/user/userdetail" :style="[{animationDelay: '0.6s'}]"> <view class="content"> <text class="cuIcon-settingsfill text-cyan"></text> @@ -82,15 +84,21 @@ id:'' }; }, - watch: { - cur: { - immediate: true, - handler() { - console.log('watch',this.cur) - this.userId=this.$store.getters.userid; - this.load() - }, - }, + // watch: { + // cur: { + // immediate: true, + // handler() { + // console.log('watch',this.cur) + // this.userId=this.$store.getters.userid; + // this.load() + // }, + // }, + // }, + + created() { + this.id=uni.getStorageSync("userId"); + console.log(this.id); + this.load(); }, methods: { scan(){ @@ -109,20 +117,18 @@ // #endif }, load(){ - if(!this.userId){ + this.$http.get(this.userUrl,{params:{id:this.id}}).then(res=>{ - return; - } - this.$http.get(this.userUrl,{params:{id:this.userId}}).then(res=>{ - console.log("res",res) if (res.data.success) { - let perArr = res.data.result - let avatar=(perArr.avatar && perArr.avatar.length > 0)? api.getFileAccessHttpUrl(perArr.avatar):'/static/avatar_boy.png' - this.personalList.avatar =avatar - this.personalList.realname = perArr.realname - this.personalList.username = perArr.username - this.personalList.depart = perArr.departIds - this.getpost(perArr.post) + console.log("res",res) + + // let avatar=(perArr.avatar && perArr.avatar.length > 0)? api.getFileAccessHttpUrl(perArr.avatar):'/static/avatar_boy.png' + this.personalList.avatar =res.data.result.avatar + + // this.personalList.realname = perArr.realname + this.personalList.username = res.data.result.realname + // this.personalList.depart = perArr.departIds + this.getpost(res.data.result.post) } }).catch(err => { console.log(err); diff --git a/pages/user/userexit.vue b/pages/user/userexit.vue index 3f63abb..91446ff 100644 --- a/pages/user/userexit.vue +++ b/pages/user/userexit.vue @@ -1,14 +1,18 @@ <template name="user"> <view> <scroll-view scroll-y class="page"> - <image src="/static/componentBg.png " mode="widthFix" class="response"></image> + <image src="/static/blue.png" mode="widthFix" class="response"></image> + <!-- <view class="nav-bg"/> --> <view class="nav-list"> - <navigator hover-class="none" :url="'/pages/common/' + item.name" class="nav-li" navigateTo :class="'bg-'+item.color" + <!-- <navigator hover-class="none" :url="'/pages/common/' + item.name" class="nav-li" navigateTo :class="'bg-'+item.color" :style="[{animation: 'show ' + ((index+1)*0.2+1) + 's 1'}]" v-for="(item,index) in elements" :key="index"> <view class="nav-title">{{item.title}}</view> <view class="nav-name">{{item.name}}</view> <text :class="'cuIcon-' + item.cuIcon"></text> - </navigator> + </navigator> --> + </view> + <view class="padding flex flex-direction"> + <button class="cu-btn bg-blue lg" @click="onSubmit" hover-class="is-hover">閫�鍑�</button> </view> <view class="cu-tabbar-height"></view> </scroll-view> @@ -16,24 +20,48 @@ </template> <script> + import { ACCESS_TOKEN,USER_NAME,USER_INFO,X_TENANT_ID } from "@/common/util/constants" export default { name: 'user', data() { return { elements: [{ - title: '閫�鍑�', - name: 'exit', - color: 'cyan', - cuIcon: 'newsfill', - auth: 'ac' - } - ], + title: '閫�鍑�', + name: 'exit', + color: 'cyan', + cuIcon: 'newsfill', + auth: 'ac' + }], } }, - methods: {} + methods: { + onSubmit() { + + uni.removeStorageSync(ACCESS_TOKEN); + uni.removeStorageSync("isLogin"); + uni.removeStorageSync(USER_INFO); + uni.removeStorageSync("userId"); + uni.reLaunch({ + url: '/pages/common/exit' + }) + }, + + + } } </script> <style> + .is-hover { + color: rgba(255, 255, 255, 0.6); + background-color: #55aaff; + border-color: #55aaff; + } -</style> + .nav-bg { + height: 50Vh; + width: 100vw; + border-radius: 2%; + background-color: cornflowerblue; + } +</style> \ No newline at end of file diff --git a/static/icon/sear.png b/static/icon/sear.png new file mode 100644 index 0000000..3b05caf --- /dev/null +++ b/static/icon/sear.png Binary files differ diff --git a/store/index.js b/store/index.js index 0a8a527..4d6b657 100644 --- a/store/index.js +++ b/store/index.js @@ -38,6 +38,7 @@ const userInfo = result.userInfo uni.setStorageSync(ACCESS_TOKEN,result.token); uni.setStorageSync("isLogin",true); + uni.setStorageSync("userId", userInfo.id); uni.setStorageSync(USER_INFO,userInfo); commit('SET_TOKEN', result.token) commit('SET_AVATAR', userInfo.avatar) diff --git a/uni_modules/zb-tooltip/changelog.md b/uni_modules/zb-tooltip/changelog.md new file mode 100644 index 0000000..4d28319 --- /dev/null +++ b/uni_modules/zb-tooltip/changelog.md @@ -0,0 +1,18 @@ +## 1.0.8锛�2022-08-18锛� +浼樺寲缁嗚妭 +## 1.0.67锛�2022-05-09锛� +淇瀹夊崜鎶ラ敊 +## 1.0.6锛�2022-05-07锛� +淇敼榛樿灞曠ず +## 1.0.5锛�2022-04-28锛� +杩涜浼樺寲 +## 1.0.4锛�2022-04-27锛� +杩涜浼樺寲 +## 1.0.3锛�2022-04-25锛� +鍘绘帀澶氫綑寰楁敞閲� +## 1.0.2锛�2022-04-25锛� +澧炲姞鑷畾涔変富棰橀鑹� +## 1.0.1锛�2022-04-25锛� +杩涜浼樺寲鏄剧ず +## 1.0.0锛�2022-04-24锛� +鍒濆鍖� diff --git a/uni_modules/zb-tooltip/components/zb-tooltip/zb-tooltip.vue b/uni_modules/zb-tooltip/components/zb-tooltip/zb-tooltip.vue new file mode 100644 index 0000000..a66fd02 --- /dev/null +++ b/uni_modules/zb-tooltip/components/zb-tooltip/zb-tooltip.vue @@ -0,0 +1,290 @@ +<template> + <view class="zb-tooltip" :style="{ + '--theme-bg-color':color + }"> + <view class="zb_tooltip_content" @click.stop="handleClick"> + <slot></slot> + <view class="zb_tooltip__popper" :style="[style,{ + visibility:isShow?'visible':'hidden', + color:color==='white'?'':'#fff', + boxShadow: color==='white'?'0 3px 6px -4px #0000001f, 0 6px 16px #00000014, 0 9px 28px 8px #0000000d':'' + }]" > + <slot name="content">{{content}}</slot> + <view class="zb_popper__icon" :style="[arrowStyle]" :class="[{ + 'zb_popper__up':placement.indexOf('bottom')===0, + 'zb_popper__arrow':placement.indexOf('top')===0, + 'zb_popper__right':placement.indexOf('right')===0, + 'zb_popper__left':placement.indexOf('left')===0, + }]"> + </view> + </view> + </view> + + </view> +</template> + +<script> + export default { + props:{ + visible:Boolean, + color:{ + type:String, + default:'#303133', + }, + placement:{ + type:String, + default:'top', + }, + content:{ + type:String, + default:'' + }, + show:{ + type:Boolean, + default:false, + } + }, + + data() { + return { + isShow :this.visible, + title: 'Hello', + arrowLeft:0, + query:null, + style:{ + + }, + arrowStyle:{} + } + }, + onLoad() { + + }, + watch:{ + isShow:{ + handler(val){ + this.$emit('update:visible', val) + }, + immediate:true, + }, + visible:{ + handler(val){ + this.isShow = val + if(val){ + this.$nextTick(()=>{ + this.handleClick() + }) + } + }, + immediate:true, + } + }, + mounted(){ + // #ifdef H5 + window.addEventListener('click',()=>{ + this.isShow = false + }) + + // #endif + }, + methods: { + close(){ + this.isShow = false + }, + fixedWrap(){ + + this.isShow = false + }, + handleClick(){ + + uni.createSelectorQuery().in(this).selectAll('.zb_tooltip_content,.zb_tooltip__popper').boundingClientRect(async (data)=>{ + + let {left,bottom,right,top,width,height} = data[0] + let obj1 = data[1] + + let objStyle = {} + let objStyle1 = {} + switch(this.placement){ + case 'top': + if(obj1.width > width){ + objStyle.left = `-${(obj1.width - width)/2}px` + }else{ + objStyle.left = `${Math.abs(obj1.width - width)/2}px` + } + + objStyle.bottom =`${height+8}px` + objStyle1.left = (obj1.width/2-6)+'px' + + + break; + case 'top-start': + objStyle.left = `0px` + objStyle.bottom =`${height+8}px` + break; + + case 'top-end': + objStyle.right = `0px` + objStyle.bottom =`${height+8}px` + objStyle1.right=`8px` + break; + + + case 'bottom': + if(obj1.width>width){ + objStyle.left = `-${(obj1.width - width)/2}px` + }else{ + objStyle.left = `${Math.abs(obj1.width - width)/2}px` + } + + objStyle.top =`${height+8}px` + objStyle1.left = (obj1.width/2-6)+'px' + break; + + case 'bottom-start': + objStyle.left = `0px` + objStyle.top =`${height+8}px` + objStyle1.left = `8px` + break; + + case 'bottom-end': + objStyle.right = `0px` + objStyle.top =`${height+8}px` + objStyle1.right = `8px` + break; + + case 'right': + objStyle.left = `${width+8}px` + if(obj1.height>height){ + objStyle.top =`-${(obj1.height - height)/2}px` + }else{ + objStyle.top =`${Math.abs((obj1.height - height)/2)}px` + } + + objStyle1.top = `${obj1.height/2-6}px` + break; + case 'right-start': + objStyle.left = `${width+8}px` + objStyle.top =`0px` + objStyle1.top = `8px` + break; + + case 'right-end': + objStyle.left = `${width+8}px` + objStyle.bottom =`0px` + objStyle1.bottom = `8px` + break; + + case 'left': + objStyle.right = `${width+8}px` + + if(obj1.height>height){ + objStyle.top =`-${(obj1.height - height)/2}px` + }else{ + objStyle.top =`${Math.abs((obj1.height - height)/2)}px` + } + + objStyle1.top = `${obj1.height/2-6}px` + break; + + case 'left-start': + objStyle.right = `${width+8}px` + objStyle.top =`0px` + objStyle1.top = `8px` + break; + + case 'left-end': + objStyle.right = `${width+8}px` + objStyle.bottom =`0px` + objStyle1.bottom = `8px` + break; + } + this.style = objStyle + // 涓夎褰㈢澶� + this.arrowStyle = objStyle1 + this.isShow = true + + }).exec() + } + } + } +</script> + +<style lang="scss" scoped> + $theme-bg-color: var(--theme-bg-color); + + .zb-tooltip{ + position: relative; + + } + .zb_tooltip_content{ + height: 100%; + /* float: left; */ + position: relative; + display: inline-block; + + // display: flex; + // flex-direction: row; + // align-items: center; + /* overflow: hidden; */ + } + .zb_tooltip__popper{ + /* transform-origin: center top; */ + background: $theme-bg-color; + + visibility: hidden; + // color:'#fff'; + position: absolute; + border-radius: 4px; + font-size: 12px; + padding: 10px; + min-width: 10px; + word-wrap: break-word; + display: inline-block; + white-space: nowrap; + z-index:9; + } + .zb_popper__icon{ + width: 0; + height: 0; + z-index:9; + position: absolute; + } + .zb_popper__arrow{ + bottom: -5px; + /* transform-origin: center top; */ + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-top: 6px solid $theme-bg-color; + + } + .zb_popper__right{ + border-top: 6px solid transparent; + border-bottom: 6px solid transparent; + border-right: 6px solid $theme-bg-color; + left:-5px; + } + + .zb_popper__left{ + border-top: 6px solid transparent; + border-bottom: 6px solid transparent; + border-left: 6px solid $theme-bg-color; + right:-5px; + } + + .zb_popper__up{ + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-bottom: 6px solid $theme-bg-color; + top:-5px; + } + .fixed{ + position: absolute;width: 100vw; + height: 100vh; + position: fixed; + left: 0; + top: 0; + pointer-events: auto; + background: red; + z-index:-1; + } +</style> diff --git a/uni_modules/zb-tooltip/package.json b/uni_modules/zb-tooltip/package.json new file mode 100644 index 0000000..eec3083 --- /dev/null +++ b/uni_modules/zb-tooltip/package.json @@ -0,0 +1,85 @@ +{ + "id": "zb-tooltip", + "displayName": "zb-tooltip 锛堟枃瀛楁彁绀烘皵娉℃锛�", + "version": "1.0.8", + "description": "绠�鍗曠殑鏂囧瓧鎻愮ず姘旀场妗�,鍙互鑷畾涔夌毊鑲ら鑹�", + "keywords": [ + "tooltip", + "tip", + "鏂囧瓧鎻愮ず", + "", + "姘旀场妗�", + "鑷畾涔夌毊鑲ら鑹层�丳opover" +], + "repository": "", + "engines": { + "HBuilderX": "^3.1.0" + }, + "dcloudext": { + "category": [ + "鍓嶇缁勪欢", + "閫氱敤缁勪欢" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "鏃�", + "data": "鏃�", + "permissions": "鏃�" + }, + "npmurl": "" + }, + "uni_modules": { + "dependencies": [], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "Vue": { + "vue2": "y", + "vue3": "y" + }, + "App": { + "app-vue": "y", + "app-nvue": "u" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "寰俊娴忚鍣�(Android)": "y", + "QQ娴忚鍣�(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "灏忕▼搴�": { + "寰俊": "y", + "闃块噷": "y", + "鐧惧害": "y", + "瀛楄妭璺冲姩": "y", + "QQ": "y" + }, + "蹇簲鐢�": { + "鍗庝负": "y", + "鑱旂洘": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/zb-tooltip/readme.md b/uni_modules/zb-tooltip/readme.md new file mode 100644 index 0000000..dcc19a2 --- /dev/null +++ b/uni_modules/zb-tooltip/readme.md @@ -0,0 +1,22 @@ +## 浠嬬粛 +鍩轰簬uni-app寮�鍙戠殑涓�涓櫘閫氱殑鎻愮ず缁勪欢锛屽姛鑳界偣鍑绘彁绀� + + +## 鍙嬫儏閾炬帴 +#### vue-admin-perfect 鈥斺�� [浼佷笟绾с�侀�氱敤鍨嬩腑鍚庡彴鍓嶇瑙e喅鏂规锛堝熀浜巚ue3.0+TS+Element-Plus 鏈�鏂扮増锛屽悓鏃舵敮鎸佺數鑴戯紝鎵嬫満锛屽钩鏉�)](https://github.com/zouzhibin/vue-admin-perfect) +#### vue-admin-perfect 鈥斺�� [浼佷笟绾с�侀�氱敤鍨嬩腑鍚庡彴鍓嶇瑙e喅鏂规 棰勮鍦板潃](http://182.61.5.190:8889/#/table/complex) + +## Tooltip 灞炴�� +| 鍙傛暟 | 璇存槑 | 绫诲瀷 | 鍙�夊�� | 榛樿鍊� |鏄惁蹇呴』| +| ------ | ------ | ------ | ------ | ------ | +| visible | 鏄惁鏄剧ず tooltip锛屾敮鎸� .sync 淇グ绗� | String |visible.sync | -- | +| content | 鏄剧ず鐨勫唴瀹癸紝涔熷彲浠ラ�氳繃 slot#content | String |-- | -- | +| color | 鑷畾涔変富棰橀鑹瞸 String |'#303133' | -- | +| placement | Tooltip 鐨勫嚭鐜颁綅缃� | String |top/top-start/top-end/bottom/bottom-start/bottom-end/left/left-start/left-end/right/right-start/right-end | top | + + +``` +鍥犱负uniapp 涓皬绋嬪簭涓病鏈墂indow瀵硅薄锛岄渶鎵嬪姩璋冪敤 鍏抽棴 + this.$refs.tooltip.close() + +``` \ No newline at end of file diff --git a/uni_modules/zxz-uni-data-select/changelog.md b/uni_modules/zxz-uni-data-select/changelog.md new file mode 100644 index 0000000..32e10e0 --- /dev/null +++ b/uni_modules/zxz-uni-data-select/changelog.md @@ -0,0 +1,49 @@ +## 1.0.20锛�2024-05-09锛� +1.淇APP鐐瑰嚮涓嬫媺妗嗘棤娉曞叧闂� +## 1.0.19锛�2024-04-29锛� +1.淇鐐瑰嚮澶氫釜涓嬫媺妗嗘棤娉曞叧闂� +2.浼樺寲澶氶�夌被鍨嬫敮鎸佷竴娆¢�夋嫨澶氫釜 +3.淇灏忕▼搴忕偣鍑绘湁涓摑鑹插簳 +4.浼樺寲涓嬫媺鑿滃崟婧㈠嚭灞忓箷搴曢儴鏃舵敼涓哄悜涓婂脊鍑� +## 1.0.15锛�2023-11-24锛� +1.浼樺寲澶氶�夐�変腑鏍峰紡锛坱ianheng20**qq.com缃戝弸鎻愪緵锛� +2.浼樺寲chang浜嬩欢锛坈hang浜嬩欢涓皢杩斿洖鎵�閫変腑鐨勫璞★級 +## 1.0.14锛�2023-10-25锛� +浼樺寲vue3寤舵椂娣诲姞鏈覆鏌撻棶棰橈紝澶勭悊37锛涘垎鍙疯鍛婇棶棰� +## 1.0.13锛�2023-10-12锛� +浼樺寲mixinDatacomResData鎶ラ敊鍜宒efValue鎶ラ敊 +## 1.0.12锛�2023-09-27锛� +淇鎼滅储杈撳叆鍐呭鐨勬椂鍊欎笅鎷夋鐨勭澶翠細璺戝埌鏂囨湰妗嗗墠闈㈠幓 +浼樺寲褰撴湁閫変腑椤规椂涓嶆樉绀烘竻闄ゆ寜閽� +## 1.0.11锛�2023-09-05锛� +鏇存崲change浜嬩欢鎵ц椤哄簭 +淇澶氶�夋洿鏀瑰�兼椂鏈嵆鏃舵洿鏀逛笅鎷夋閫夐」 +淇鍗曢�夋悳绱㈡閫変腑浜� +淇澶氶�夌瓫閫夎緭鍏ユ椂鐐瑰嚮鍏朵粬鏈竻绌虹瓫閫夊�� +## 1.0.10锛�2023-08-29锛� +淇鍗曢�夋悳绱㈠洖鏄鹃棶棰� +## 1.0.9锛�2023-08-28锛� +鏇存柊鏂囨。 +## 1.0.8锛�2023-08-28锛� +鏇存柊鏂囨。 +## 1.0.7锛�2023-08-16锛� +淇缁勪欢绂佺敤bug +淇鏁版嵁鍥炴樉闂 +娣诲姞澶氶�夋悳绱㈠姛鑳� +## 1.0.6锛�2023-08-05锛� +淇娓呯┖鍊煎閫変笅鎷夊垪琛ㄨ繕鏄閫変腑bug +## 1.0.5锛�2023-07-10锛� +淇澶氶�夊垵濮嬪寲寮傛鏁版嵁涓嶆樉绀洪棶棰� +## 1.0.4锛�2023-07-07锛� +淇寰俊灏忕▼搴忓閫夋樉绀哄吋瀹归棶棰� +## 1.0.3锛�2023-07-06锛� +淇bug +澶氶�夋儏鍐典笅 鍒濆鍖栦箣鍚庨噸鏂伴�夋嫨绗竴涓笉鏄剧ず +## 1.0.2锛�2023-07-06锛� +鏇存柊VUE3鍏煎 +## 1.0.1锛�2023-06-30锛� +娣诲姞澶氶�夊悎骞跺姛鑳� +## 1.0.0锛�2023-06-16锛� +娣诲姞涓嬫媺妗嗘绱紝澶氶�夊姛鑳斤紝鑷畾涔夋暟鎹� +## 1.0.4锛�2023-06-16锛� + 娣诲姞涓嬫媺妗嗘绱紝澶氶�夊姛鑳斤紝鑷畾涔夋暟鎹� diff --git a/uni_modules/zxz-uni-data-select/components/zxz-uni-data-select/zxz-uni-data-select.vue b/uni_modules/zxz-uni-data-select/components/zxz-uni-data-select/zxz-uni-data-select.vue new file mode 100644 index 0000000..4c689a5 --- /dev/null +++ b/uni_modules/zxz-uni-data-select/components/zxz-uni-data-select/zxz-uni-data-select.vue @@ -0,0 +1,823 @@ +<template> + <view class="uni-stat__select"> + <!-- hide-on-phone --> + <span v-if="label" class="uni-label-text">{{label + '锛�'}}</span> + <view class="uni-stat-box" :class="{'uni-stat__actived': current}"> + <view class="uni-select" :style="{height:multiple?'100%':' 35px'}" + :class="{'uni-select--disabled':disabled}"> + <view class="uni-select__input-box" :style="{height:multiple?'100%':'35px'}" @click="toggleSelector"> + <view class="" style="display: flex;flex-wrap: wrap;width: 100%;" v-if="multiple&¤t.length>0"> + <view class="tag-calss" + v-for="(item,index) in collapseTags?current.slice(0,collapseTagsNum):current" + :key="item[dataValue]"> + <span class="text">{{item[dataKey]}}</span> + <view class="" @click.stop="delItem(item)"> + <uni-icons type="clear" style="margin-left: 4px;" color="#c0c4cc" /> + </view> + </view> + <view v-if="current.length>collapseTagsNum&&collapseTags" class="tag-calss"> + <span class="text">+{{current.length-collapseTagsNum}}</span> + </view> + <input v-if="filterable&&!disabled" @input="inputChange" class="uni-select__input-text" + type="text" style="font-size: 12px;height: 52rpx;margin-left: 6px;width: auto;" + placeholder="璇疯緭鍏�" v-model="filterInput"> + </view> + <view v-else-if="current&¤t.length>0&&!showSelector" class="uni-select__input-text"> + {{current}} + </view> + <input v-else-if="filterable&&showSelector" :focus="isFocus" @input="inputChange" + :disabled="disabled" @click.stop="" class="uni-select__input-text" type="text" + style="font-size: 12px;position: absolute;z-index: 1;" :placeholder="placeholderOld" + v-model="filterInput"> + <view v-else class="uni-select__input-text uni-select__input-placeholder">{{typePlaceholder}}</view> + <uni-icons v-if="(current.length>0 && clear&&!disabled)||(currentArr.length>0&&clear&&!disabled)" + type="clear" color="#c0c4cc" size="24" style="position: absolute;right: 0;" @click="clearVal" /> + <uni-icons style="right: 0;position: absolute;" v-else :type="showSelector? 'top' : 'bottom'" + size="14" color="#999" /> + </view> + <view class="uni-select--mask" v-if="showSelector" @click="toggleSelector" /> + <view class="uni-select__selector" + :class="isDown?'uni-select__selector__down':'uni-select__selector__upwards'" v-if="showSelector"> + <view class="uni-popper__arrow"></view> + <scroll-view scroll-y="true" class="uni-select__selector-scroll"> + <view class="uni-select__selector-empty" v-if="filterMixinDatacomResData.length === 0"> + <span>{{emptyTips}}</span> + </view> + <view v-else :class="['uni-select__selector-item', {'uni-select_selector-item_active' :multiple + && currentArr.includes(item[dataValue])}]" + style="display: flex;justify-content: space-between;align-items: center;" + v-for="(item,index) in filterMixinDatacomResData" :key="index" @click="change(item)"> + <span + :class="{'uni-select__selector__disabled': item.disable}">{{formatItemName(item)}}</span> + <uni-icons v-if="multiple&¤tArr.includes(item[dataValue])" type="checkmarkempty" + color="#007aff" /> + </view> + </scroll-view> + </view> + </view> + </view> + </view> +</template> + +<script> + /** + * DataChecklist 鏁版嵁閫夋嫨鍣� + * @description 閫氳繃鏁版嵁娓叉煋鐨勪笅鎷夋缁勪欢 + * @tutorial https://uniapp.dcloud.io/component/uniui/uni-data-select + * @property {String} collapseTagsNum 澶氶�夋椂閫変腑鍊兼寜鏂囧瓧鐨勫舰寮忓睍绀虹殑鏁伴噺 + * @property {String} collapseTags 澶氶�夋椂鏄惁灏嗛�変腑鍊兼寜鏂囧瓧鐨勫舰寮忓睍绀� + * @property {String} dataKey 浣滀负 key 鍞竴鏍囪瘑鐨勯敭鍚� + * @property {String} dataValue 浣滀负 value 鍞竴鏍囪瘑鐨勯敭鍚� + * @property {Array} multiple 鏄惁澶氶�� + * @property {Array} filterable 鏄惁寮�鍚悳绱� + * @property {Array} localdata 鏈湴鏁版嵁 锛屾牸寮� [{text:'',value:''}] + * @property {Boolean} clear 鏄惁鍙互娓呯┖宸查�夐」 + * @property {Boolean} emptyText 娌℃湁鏁版嵁鏃舵樉绀虹殑鏂囧瓧 锛屾湰鍦版暟鎹棤鏁� + * @property {String} label 宸︿晶鏍囬 + * @property {String} placeholder 杈撳叆妗嗙殑鎻愮ず鏂囧瓧 + * @property {Boolean} disabled 鏄惁绂佺敤 + * @event {Function} change 閫変腑鍙戠敓鍙樺寲瑙﹀彂 + */ + + export default { + name: "uni-stat-select", + mixins: [uniCloud.mixinDatacom || {}], + props: { + collapseTagsNum: { + type: Number, + default: 1 + }, + collapseTags: { + type: Boolean, + default: false + }, + dataKey: { + type: [String], + default: 'text' + }, + dataValue: { + type: [String], + default: 'value' + }, + multiple: { + type: Boolean, + default: false + }, + filterable: { + type: Boolean, + default: false + }, + localdata: { + type: Array, + default () { + return [] + } + }, + // #ifndef VUE3 + value: { + type: [String, Number, Array], + default: '' + }, + // #endif + // #ifdef VUE3 + modelValue: { + type: [String, Number, Array], + default: '' + }, + // #endif + label: { + type: String, + default: '' + }, + placeholder: { + type: String, + default: '璇烽�夋嫨' + }, + emptyTips: { + type: String, + default: '鏃犻�夐」' + }, + clear: { + type: Boolean, + default: true + }, + defItem: { + type: Number, + default: 0 + }, + disabled: { + type: Boolean, + default: false + }, + // 鏍煎紡鍖栬緭鍑� 鐢ㄦ硶 field="_id as value, version as text, uni_platform as label" format="{label} - {text}" + format: { + type: String, + default: '' + }, + }, + data() { + return { + showSelector: false, + current: [], + mixinDatacomResData: [], + apps: [], + channels: [], + cacheKey: "uni-data-select-lastSelectedValue", + placeholderOld: "", + currentArr: [], + filterInput: "", + isFocus: false, + windowHeight:0, + isDown:true,//涓嬫媺妗嗘槸鍚︽湞涓� + }; + }, + created() { + this.windowHeight=uni.getSystemInfoSync().windowHeight + if (this.multiple) { + // #ifndef VUE3 + this.currentArr = this.value || [] + // #endif + // #ifdef VUE3 + this.currentArr = this.modelValue || [] + // #endif + if (this.current.length > 0) { + this.current = [] + } + // #ifndef VUE3 + if (this.value && this.value.length > 0 && this.filterMixinDatacomResData.length > 0) { + this.current = this.value.map(item => { + let current = this.mixinDatacomResData.find(e => + e[this.dataValue] == item + ) + return { + ...current + } + }) + } + // #endif + // #ifdef VUE3 + if (this.modelValue && this.modelValue.length > 0 && this.filterMixinDatacomResData.length > 0) { + this.current = this.modelValue.map(item => { + let current = this.mixinDatacomResData.find(e => + e[this.dataValue] == item + ) + return { + ...current + } + }) + } + // #endif + + } else { + + // #ifndef VUE3 + if (this.value || this.value == 0) { + this.current = this.formatItemName(this.filterMixinDatacomResData.find(e => + e[this.dataValue] == this.value + )) + } + // #endif + // #ifdef VUE3 + if (this.modelValue || this.value == 0) { + this.current = this.formatItemName(this.filterMixinDatacomResData.find(e => + e[this.dataValue] == this.modelValue + )) + } + // #endif + } + this.placeholderOld = this.placeholder + this.debounceGet = this.debounce(() => { + this.query(); + }, 300); + if (this.collection && !this.localdata.length) { + this.debounceGet(); + } + }, + computed: { + filterMixinDatacomResData() { + if (this.filterable && this.filterInput) { + return this.mixinDatacomResData.filter(e => e[this.dataKey].includes(this.filterInput)) + } else { + return this.mixinDatacomResData + } + }, + typePlaceholder() { + const text = { + 'opendb-stat-app-versions': '鐗堟湰', + 'opendb-app-channels': '娓犻亾', + 'opendb-app-list': '搴旂敤' + } + const common = this.placeholder + const placeholder = text[this.collection] + return placeholder ? + common + placeholder : + common + }, + valueCom() { + // #ifdef VUE3 + return this.modelValue; + // #endif + // #ifndef VUE3 + return this.value; + // #endif + } + }, + watch: { + localdata: { + immediate: true, + handler(val, old) { + if (Array.isArray(val) && old !== val) { + this.mixinDatacomResData = val || [] + } + + } + }, + valueCom: { + handler(newVal, oldVal) { + // console.log(newVal, oldVal); + this.initDefVal() + }, + deep: true, + immediate: true + }, + mixinDatacomResData: { + immediate: true, + handler(val) { + if (val.length) { + this.initDefVal() + } + } + }, + }, + methods: { + getIsDown(){ + const query = uni.createSelectorQuery().in(this); + const _this=this + query + .select(".uni-stat-box") + .boundingClientRect((data) => { + if(_this.windowHeight-data.top>200){ + _this.isDown=true + }else{ + _this.isDown=false + } + }) + .exec(); + }, + debounce(fn, time = 100) { + let timer = null + return function(...args) { + if (timer) clearTimeout(timer) + timer = setTimeout(() => { + fn.apply(this, args) + }, time) + } + }, + // 鎵ц鏁版嵁搴撴煡璇� + query() { + this.mixinDatacomEasyGet(); + }, + // 鐩戝惉鏌ヨ鏉′欢鍙樻洿浜嬩欢 + onMixinDatacomPropsChange() { + if (this.collection) { + this.debounceGet(); + } + }, + initDefVal() { + let defValue = '' + if ((this.valueCom || this.valueCom === 0) && !this.isDisabled(this.valueCom)) { + defValue = this.valueCom + } else { + let strogeValue + if (this.collection) { + strogeValue = this.getCache() + } + if (strogeValue || strogeValue === 0) { + defValue = strogeValue + } else { + let defItem = '' + if (this.defItem > 0 && this.defItem <= this.mixinDatacomResData.length) { + defItem = this.mixinDatacomResData[this.defItem - 1][this.dataValue] + } + defValue = defItem + } + if (defValue || defValue === 0) { + this.emit(defValue) + } + } + if (this.multiple) { + const mixinDatacomResData = this.mixinDatacomResData || [] + if (!defValue) defValue = [] + this.current = defValue.map(item => { + const current = mixinDatacomResData.find(e => { + return e[this.dataValue] == item + }) + return { + ...current + } + }) + this.currentArr = this.current.map(e => e[this.dataValue]) + if (defValue.length < 1) { + this.currentArr = [] + } + } else { + const def = this.mixinDatacomResData.find(item => item[this.dataValue] === defValue) + this.current = def ? this.formatItemName(def) : '' + } + }, + /** + * @param {[String, Number]} value + * 鍒ゆ柇鐢ㄦ埛缁欑殑 value 鏄惁鍚屾椂涓虹鐢ㄧ姸鎬� + */ + isDisabled(value) { + let isDisabled = false; + + this.mixinDatacomResData.forEach(item => { + if (item[this.dataValue] === value) { + isDisabled = item.disable + } + }) + return isDisabled; + }, + inputChange(e) { + this.$emit('inputChange', e.detail.value) + }, + clearVal() { + if (this.disabled) { + return + } + if (this.multiple) { + this.current = [] + this.currentArr = [] + this.emit([]) + } else { + this.current = "" + this.currentArr = [] + this.emit('') + } + if (this.collection) { + this.removeCache() + } + this.placeholderOld = this.placeholder + this.filterInput = "" + }, + change(item) { + if (!item.disable) { + if (this.multiple) { + if (!this.current) { + this.current = [] + } + if (!this.currentArr) { + this.currentArr = [] + } + if (this.currentArr.includes(item[this.dataValue])) { + let index = this.current.findIndex(e => { + return e[this.dataValue] == item[this.dataValue] + }) + this.current.splice(index, 1) + this.currentArr.splice(index, 1) + this.emit(this.current) + } else { + this.current.push(item) + this.currentArr.push(item[this.dataValue]) + this.emit(this.current) + + } + this.filterInput = "" + } else { + this.showSelector = false + this.current = this.formatItemName(item) + if (this.filterable) { + this.filterInput = item[this.dataKey] + } + this.emit(item[this.dataValue]) + } + } + }, + delItem(item) { + if (this.disabled) { + return + } + if (this.currentArr.includes(item[this.dataValue])) { + let index = this.current.findIndex(e => { + return e[this.dataValue] == item[this.dataValue] + }) + this.current.splice(index, 1) + this.currentArr.splice(index, 1) + this.emit(this.current) + } + }, + emit(val) { + if (this.multiple) { + this.$emit('input', this.currentArr) + this.$emit('update:modelValue', this.currentArr) + const currentArr = this.mixinDatacomResData.filter(item => this.currentArr.includes(item[this + .dataValue])) + this.$emit('change', currentArr) + } else { + this.$emit('input', val) + this.$emit('update:modelValue', val) + const current = this.mixinDatacomResData.find(item => val == item[this.dataValue]) + console.log(current); + this.$emit('change', current) + } + if (this.collection) { + this.setCache(val); + } + }, + toggleSelector() { + if (this.disabled) { + return + } + // if (this.filterable && this.filterInput && this.mixinDatacomResData.findIndex(e => { + // return e[this.dataKey] == this + // .filterInput + // }) < 0) { + // if (!this.multiple) { + // this.filterInput = "" + // } + + // } + this.getIsDown() + this.showSelector = !this.showSelector + this.isFocus = this.showSelector + if (this.filterable && this.current && this.showSelector) { + if (!this.multiple) { + this.placeholderOld = this.current + // this.filterInput = "" + } + } else if (this.filterable && !this.current && !this.showSelector) { + if (this.placeholderOld != this.placeholder) { + if (!this.multiple) { + this.current = this.placeholderOld + } + } + } + this.filterInput = "" + + }, + formatItemName(item) { + if (!item) { + return "" + } + let text = item[this.dataKey] + let value = item[this.dataValue] + let { + channel_code + } = item + channel_code = channel_code ? `(${channel_code})` : '' + if (this.format) { + // 鏍煎紡鍖栬緭鍑� + let str = ""; + str = this.format; + for (let key in item) { + str = str.replace(new RegExp(`{${key}}`, "g"), item[key]); + } + return str; + } else { + return this.collection.indexOf('app-list') > 0 ? + `${text}(${value})` : + ( + text ? + text : + `鏈懡鍚�${channel_code}` + ) + } + }, + // 鑾峰彇褰撳墠鍔犺浇鐨勬暟鎹� + getLoadData() { + return this.mixinDatacomResData; + }, + // 鑾峰彇褰撳墠缂撳瓨key + getCurrentCacheKey() { + return this.collection; + }, + // 鑾峰彇缂撳瓨 + getCache(name = this.getCurrentCacheKey()) { + let cacheData = uni.getStorageSync(this.cacheKey) || {}; + return cacheData[name]; + }, + // 璁剧疆缂撳瓨 + setCache(value, name = this.getCurrentCacheKey()) { + let cacheData = uni.getStorageSync(this.cacheKey) || {}; + cacheData[name] = value; + uni.setStorageSync(this.cacheKey, cacheData); + }, + // 鍒犻櫎缂撳瓨 + removeCache(name = this.getCurrentCacheKey()) { + let cacheData = uni.getStorageSync(this.cacheKey) || {}; + delete cacheData[name]; + uni.setStorageSync(this.cacheKey, cacheData); + }, + } + } +</script> + +<style lang="scss"> + $uni-base-color: #6a6a6a !default; + $uni-main-color: #333 !default; + $uni-secondary-color: #909399 !default; + $uni-border-3: #e5e5e5; + + + /* #ifndef APP-NVUE */ + @media screen and (max-width: 500px) { + .hide-on-phone { + display: none; + } + } + + /* #endif */ + .uni-stat__select { + display: flex; + align-items: center; + // padding: 15px; + // cursor: pointer; + width: 100%; + flex: 1; + box-sizing: border-box; + } + + .uni-stat-box { + width: 100%; + flex: 1; + } + + .uni-stat__actived { + width: 100%; + flex: 1; + // outline: 1px solid #2979ff; + } + + .uni-label-text { + font-size: 14px; + font-weight: bold; + color: $uni-base-color; + margin: auto 0; + margin-right: 5px; + } + + .uni-select { + font-size: 14px; + border: 1px solid $uni-border-3; + box-sizing: border-box; + border-radius: 4px; + padding: 0 5px; + padding-left: 10px; + position: relative; + /* #ifndef APP-NVUE */ + display: flex; + user-select: none; + /* #endif */ + flex-direction: row; + align-items: center; + border-bottom: solid 1px $uni-border-3; + width: 100%; + flex: 1; + height: 35px; + min-height: 35px; + + &--disabled { + background-color: #f5f7fa; + cursor: not-allowed; + } + } + + .uni-select__label { + font-size: 16px; + // line-height: 22px; + min-height: 35px; + height: 35px; + padding-right: 10px; + color: $uni-secondary-color; + } + + .uni-select__input-box { + width: 100%; + height: 35px; + position: relative; + /* #ifndef APP-NVUE */ + display: flex; + /* #endif */ + flex: 1; + flex-direction: row; + align-items: center; + + .tag-calss { + font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, SimSun, sans-serif; + font-weight: 400; + -webkit-font-smoothing: antialiased; + -webkit-tap-highlight-color: transparent; + font-size: 12px; + border: 1px solid #d9ecff; + border-radius: 4px; + white-space: nowrap; + height: 24px; + padding: 0 4px 0px 8px; + line-height: 22px; + box-sizing: border-box; + margin: 2px 0 2px 6px; + display: flex; + max-width: 100%; + align-items: center; + background-color: #f4f4f5; + border-color: #e9e9eb; + color: #909399; + + .text { + font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, SimSun, sans-serif; + font-weight: 400; + -webkit-font-smoothing: antialiased; + -webkit-tap-highlight-color: transparent; + font-size: 12px; + white-space: nowrap; + line-height: 22px; + color: #909399; + overflow: hidden; + text-overflow: ellipsis; + } + } + } + + .uni-select__input { + flex: 1; + font-size: 14px; + height: 22px; + line-height: 22px; + } + + .uni-select__input-plac { + font-size: 14px; + color: $uni-secondary-color; + } + + .uni-select__selector__down { + top: calc(100% + 12px); + + .uni-popper__arrow { + transform: rotateX(0deg); + top: -6px; + } + } + + .uni-select__selector__upwards { + bottom: calc(100% + 12px); + + .uni-popper__arrow { + transform: rotateX(180deg); + bottom: -6px; + } + } + + .uni-select__selector { + /* #ifndef APP-NVUE */ + box-sizing: border-box; + /* #endif */ + position: absolute; + + left: 0; + width: 100%; + background-color: #FFFFFF; + border: 1px solid #EBEEF5; + border-radius: 6px; + box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); + z-index: 3; + padding: 4px 0; + } + + .uni-select__selector-scroll { + /* #ifndef APP-NVUE */ + max-height: 200px; + box-sizing: border-box; + /* #endif */ + } + + .uni-select__selector-empty, + .uni-select__selector-item { + /* #ifndef APP-NVUE */ + display: flex; + // cursor: pointer; + /* #endif */ + line-height: 35px; + font-size: 14px; + text-align: center; + /* border-bottom: solid 1px $uni-border-3; */ + padding: 0px 10px; + } + + .uni-select__selector-item:hover { + background-color: #f9f9f9; + } + + .uni-select__selector-empty:last-child, + .uni-select__selector-item:last-child { + /* #ifndef APP-NVUE */ + border-bottom: none; + /* #endif */ + } + + .uni-select_selector-item_active { + color: #409eff; + font-weight: bold; + background-color: #f5f7fa; + border-radius: 3px; + } + + .uni-select__selector__disabled { + opacity: 0.4; + cursor: default; + } + + /* picker 寮瑰嚭灞傞�氱敤鐨勬寚绀哄皬涓夎 */ + .uni-popper__arrow, + .uni-popper__arrow::after { + position: absolute; + display: block; + width: 0; + height: 0; + border-color: transparent; + border-style: solid; + border-width: 6px; + } + + .uni-popper__arrow { + filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03)); + + left: 10%; + margin-right: 3px; + border-top-width: 0; + border-bottom-color: #EBEEF5; + } + + .uni-popper__arrow::after { + content: " "; + top: 1px; + margin-left: -6px; + border-top-width: 0; + border-bottom-color: #fff; + } + + .uni-select__input-text { + // width: 280px; + width: 90%; + color: $uni-main-color; + white-space: nowrap; + text-overflow: ellipsis; + -o-text-overflow: ellipsis; + overflow: hidden; + } + + .uni-select__input-placeholder { + color: $uni-base-color; + font-size: 12px; + } + + .uni-select--mask { + position: fixed; + top: 0; + bottom: 0; + right: 0; + left: 0; + z-index: 2; + } +</style> \ No newline at end of file diff --git a/uni_modules/zxz-uni-data-select/package.json b/uni_modules/zxz-uni-data-select/package.json new file mode 100644 index 0000000..397169b --- /dev/null +++ b/uni_modules/zxz-uni-data-select/package.json @@ -0,0 +1,86 @@ +{ + "id": "zxz-uni-data-select", + "displayName": "zxz-uni-data-select 涓嬫媺妗嗛�夋嫨鍣�(娣诲姞涓嬫媺妗嗘绱紝澶氶�夊姛鑳斤紝澶氶�夋悳绱㈠姛鑳斤紝鑷畾涔夋暟鎹�)", + "version": "1.0.20", + "description": "閫氳繃鏁版嵁椹卞姩鐨勪笅鎷夋閫夋嫨鍣�(娣诲姞涓嬫媺妗嗘绱紝澶氶�夊姛鑳斤紝澶氶�夋悳绱㈠姛鑳斤紝鑷畾涔夋暟鎹�)", + "keywords": [ + "uni-ui", + "select", + "uni-data-select", + "涓嬫媺妗�", + "涓嬫媺閫夋嫨妗�" +], + "repository": "", + "engines": { + "HBuilderX": "^3.1.1" + }, + "directories": { + "example": "../../temps/example_temps" + }, +"dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "鏃�", + "data": "鏃�", + "permissions": "鏃�" + }, + "npmurl": "", + "type": "component-vue" + }, + "uni_modules": { + "dependencies": ["uni-load-more"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y", + "alipay": "n" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "寰俊娴忚鍣�(Android)": "y", + "QQ娴忚鍣�(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "灏忕▼搴�": { + "寰俊": "y", + "闃块噷": "y", + "鐧惧害": "y", + "瀛楄妭璺冲姩": "y", + "QQ": "y", + "浜笢": "y" + }, + "蹇簲鐢�": { + "鍗庝负": "y", + "鑱旂洘": "y" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} diff --git a/uni_modules/zxz-uni-data-select/readme.md b/uni_modules/zxz-uni-data-select/readme.md new file mode 100644 index 0000000..cfd4ea0 --- /dev/null +++ b/uni_modules/zxz-uni-data-select/readme.md @@ -0,0 +1,37 @@ +## DataSelect 涓嬫媺妗嗛�夋嫨鍣� <strong style="color:orangered;"><em>鍏堝鍏ョず渚嬮」鐩�</em></strong> 鐪嬬湅鏄惁婊¤冻闇�姹傦紝鐒跺悗鍐嶄笅杞芥彃浠讹紝鏈夐棶棰樺彲浠ュ姞寰�<strong style="color:orangered;"><em>weiyila520</em></strong> +> **缁勪欢鍚嶏細zxz-uni-data-select** +> 浠g爜鍧楋細 `zxz-uni-data-select` + +鏈彃浠跺熀浜庡畼鏂规彃浠� [uni-data-select](https://ext.dcloud.net.cn/plugin?id=7993) 杩涜浜屾寮�鍙戞嫇灞曞姛鑳斤紝鏀寔uni-data-select鏈韩鍔熻兘涓嶅彉锛堣〃鍗曢獙璇佺瓑锛� + +<h1>鎷撳睍鍔熻兘</h1> +<ol> +<li>鏀寔澶氶�夊姛鑳�</li> +<li>鏀寔閫夐」绂佺敤</li> +<li>鏀寔鑷畾涔夋樉绀哄��</li> +<li>鏀寔鎼滅储</li> +<li>鏀寔澶氶�夋椂灏嗛�変腑鍊兼寜鏂囧瓧褰㈠紡灞曠ず</li> +<li>鏀寔涓嬫媺鑿滃崟婧㈠嚭灞忓箷搴曢儴鏃惰嚜鍔ㄦ敼涓哄悜涓婂脊鍑�</li> +<li>鐩戝惉鎼滅储杈撳叆浜嬩欢</li> +</ol> + +<h2>API</h2> +### zxz-uni-data-select Props + +| 灞炴�у悕 | 绫诲瀷 | 榛樿鍊� | 璇存槑 | +| - | - | - | - | +| v-model | String銆丄rray銆丯umber |- | 閫変腑椤圭粦瀹氬�� | +| multiple | Boolean | false | 鏄惁澶氶�� | +| disabled | Boolean |false | 鏄惁绂佺敤 | +| dataKey | String |"key" | 浣滀负 key 鍞竴鏍囪瘑鐨勯敭鍚� | +| dataValue | String | "value" | 浣滀负 value 鍞竴鏍囪瘑鐨勯敭鍚� | +| filterable | Boolean | false | 鏄惁寮�鍚悳绱� | +| collapseTags | Boolean | false | 澶氶�夋椂鏄惁灏嗛�変腑鍊兼寜鏂囧瓧鐨勫舰寮忓睍绀� | +|collapseTagsNum|Number | 1 | 澶氶�夋椂閫変腑鍊兼寜鏂囧瓧鐨勫舰寮忓睍绀虹殑鏁伴噺 | +| localdata | Array |- | 涓嬫媺鍒楄〃鏈湴鏁版嵁 | +|label | String | - | 宸︿晶鏍囬 | +|placeholder | String | "璇烽�夋嫨" | 杈撳叆妗嗙殑鎻愮ず鏂囧瓧 | +|emptyTips | String |"鏃犻�夐」" | 鏃犻�夐」鎻愮ず | +|clear | Boolean | true | 鏄惁娓呯┖ | +|format | String | - | 鏍煎紡鍖栬緭鍑� 鐢ㄦ硶 field="_id as value, version as text, uni_platform as label" format="{label} - {text}"| +|@inputChange | event | event(String) | 鎼滅储杈撳叆浜嬩欢 | \ No newline at end of file -- Gitblit v1.9.3