| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="container"> |
| | | <view class="content"> |
| | | <!-- å¨æè¡¨ååºå --> |
| | | <view id="divid" class="form-container"> |
| | | <!-- 卿çæç表åå
容 --> |
| | | <view class="uni-form" v-if="formData.length > 0"> |
| | | <block v-for="(item, index) in formData" :key="index"> |
| | | <!-- ææ¬è¾å
¥æ¡ --> |
| | | <view class="form-item" v-if="(item[2] === 'VARCHAR2' || item[2] === 'VARCHAR') && item[4] === '3'"> |
| | | <text class="form-label">{{ item[1] }}</text> |
| | | <view class="scan-input-container"> |
| | | <input |
| | | :id="item[0]" |
| | | :disabled="item[3] === '1'" |
| | | :readonly="item[3] === '1'" |
| | | type="text" |
| | | class="form-input" |
| | | :class="{'readonly': item[3] === '1'}" |
| | | v-model="formValues[item[0]]" |
| | | :placeholder="'请è¾å
¥'+item[1]" |
| | | @keyup="(e) => handleKeyUp(e, item[7], item[8], item[0], item[9], item[10])" |
| | | @confirm="() => enterSearch({keyCode: 13}, item[7], item[8], item[0], item[9], item[10])" |
| | | :focus="autoFocusId === item[0]" |
| | | /> |
| | | <!-- æ·»å æ«ç 徿 ï¼æ ¹æ®item[13]å³å®æ¯å¦æ¾ç¤º --> |
| | | <view |
| | | v-if="item[3] === '0'" |
| | | class="scan-icon-btn" |
| | | @tap="() => scanQRCode(item[0])" |
| | | > |
| | | <uni-icons type="scan" size="20" color="#5677fc"></uni-icons> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <!-- ä¸æéæ©æ¡ --> |
| | | <view class="form-item" v-else-if="(item[2] === 'VARCHAR2' || item[2] === 'VARCHAR') && item[4] === '2'"> |
| | | <text class="form-label">{{ item[1] }}</text> |
| | | <view class="select-wrapper"> |
| | | <input |
| | | type="text" |
| | | :id="'selectList-'+item[0]+'-'+item[1]" |
| | | class="form-input select-input" |
| | | readonly |
| | | placeholder="请ç¹å»éæ©" |
| | | @tap="() => openList(item[0], item[1])" |
| | | /> |
| | | <view class="select-icon"> |
| | | <uni-icons type="right" size="16" color="#999"></uni-icons> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | |
| | | <!-- æ«æéæ©æ¡ --> |
| | | <view class="form-item" v-else-if="(item[2] === 'VARCHAR2' || item[2] === 'VARCHAR') && item[4] === '4'"> |
| | | <text class="form-label">{{ item[1] }}</text> |
| | | <!-- ç§»é¤è¿ä¸ªéèçinputï¼ä¸åéè¦ --> |
| | | <!-- <input :id="item[0]" v-model="formValues[item[0]]" type="hidden"> --> |
| | | <view class="scan-select-container"> |
| | | <input |
| | | type="text" |
| | | class="form-input scan-input" |
| | | :id="item[0]" |
| | | v-model="formValues[item[0]]" |
| | | @keyup="(e) => handleScanKeyUp(e, item[8], item[0], item[10], item[7])" |
| | | @confirm="() => enterScanSelect({keyCode: 13}, item[8], item[0], item[10], item[7])" |
| | | :placeholder="'è¯·éæ©/æ«æ'+item[1]" |
| | | /> |
| | | <picker |
| | | :id="'select-'+item[0]" |
| | | :range="selectOptions[item[0]] || []" |
| | | @change="(e) => getCheckItem(item[8], item[0], item[10], item[7], e)" |
| | | > |
| | | <view class="select-btn"> |
| | | <uni-icons type="down" size="18" color="#fff"></uni-icons> |
| | | </view> |
| | | </picker> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- ç
§çæé® --> |
| | | <view class="form-item button-item" v-else-if="(item[2] === 'VARCHAR2' || item[2] === 'VARCHAR') && item[4] === '9'"> |
| | | <view class="action-button photo-btn" @tap="() => photoButton(item)"> |
| | | <uni-icons type="camera" size="18" color="#fff" style="margin-right: 5px;"></uni-icons> |
| | | <text>{{ item[1] }}</text> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- å表æé® --> |
| | | <view class="form-item button-item" v-else-if="(item[2] === 'VARCHAR2' || item[2] === 'VARCHAR') && item[4] === '11'"> |
| | | <view class="action-button list-btn" @tap="() => listButton(item)"> |
| | | <uni-icons type="list" size="18" color="#fff" style="margin-right: 5px;"></uni-icons> |
| | | <text>{{ item[1] }}</text> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- æå°æé® --> |
| | | <view class="form-item button-item" v-else-if="(item[2] === 'VARCHAR2' || item[2] === 'VARCHAR') && item[4] === '13'"> |
| | | <view class="action-button print-btn" @tap="() => clickPrintBtn(item)"> |
| | | <uni-icons type="paperplane" size="18" color="#fff" style="margin-right: 5px;"></uni-icons> |
| | | <text>{{ item[1] }}</text> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- å¼å
³ --> |
| | | <view class="form-item switch-item" v-else-if="(item[2] === 'VARCHAR2' || item[2] === 'VARCHAR')"> |
| | | <text class="form-label">{{ item[1] }}</text> |
| | | <input :id="item[0]" v-model="formValues[item[0]]" type="hidden"> |
| | | <switch |
| | | :id="item[0]+'-switch'" |
| | | :data-href="item[0]" |
| | | @change="(e) => switchChange(e, item[0])" |
| | | color="#5677fc" |
| | | class="custom-switch" |
| | | /> |
| | | </view> |
| | | |
| | | <!-- ææ¬å --> |
| | | <view class="form-item" v-else-if="item[2] === 'MEMO'"> |
| | | <text class="form-label">{{ item[1] }}</text> |
| | | <textarea |
| | | :id="item[0]" |
| | | v-model="formValues[item[0]]" |
| | | class="form-textarea" |
| | | :disabled="item[3] === '1'" |
| | | :readonly="item[3] === '1'" |
| | | :class="{'readonly': item[3] === '1'}" |
| | | :style="{'height': item[14]+'px'}" |
| | | ></textarea> |
| | | </view> |
| | | |
| | | <!-- æé® --> |
| | | <view class="form-item button-item" v-else-if="item[2] === 'BUTTON'"> |
| | | <view class="action-button normal-btn" @tap="() => clickButton(item)"> |
| | | <text>{{ item[1] }}</text> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- å¤éç¼è¾ --> |
| | | <view class="form-item button-item" v-else-if="item[2] === 'EDIT' && item[4] === '11'"> |
| | | <view class="action-button list-btn" @tap="() => listButton(item)"> |
| | | <uni-icons type="list" size="18" color="#fff" style="margin-right: 5px;"></uni-icons> |
| | | <text>{{ item[1] }}</text> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- å¤éæ«æ --> |
| | | <view class="form-item" v-else-if="item[2] === 'EDIT' && item[4] === '4'"> |
| | | <text class="form-label">{{ item[1] }}</text> |
| | | <input :id="item[0]" v-model="formValues[item[0]]" type="hidden"> |
| | | <view class="scan-select-container"> |
| | | <input |
| | | type="text" |
| | | class="form-input scan-input" |
| | | :id="'scanSelect-mul'+item[0]" |
| | | v-model="scanValues['mul'+item[0]]" |
| | | @keyup="(e) => enterScanSelect(e, item[8], item[0], item[10], item[7])" |
| | | :placeholder="'è¯·éæ©/æ«æ'+item[1]" |
| | | /> |
| | | <picker |
| | | mode="multiSelector" |
| | | :id="'select-mul'+item[0]" |
| | | :range="selectOptions['mul'+item[0]] || []" |
| | | @change="(e) => getCheckMultiItem(item[8], item[0], item[10], item[7], e)" |
| | | > |
| | | <view class="select-btn"> |
| | | <uni-icons type="down" size="18" color="#fff"></uni-icons> |
| | | </view> |
| | | </picker> |
| | | </view> |
| | | </view> |
| | | </block> |
| | | </view> |
| | | </view> |
| | | |
| | | |
| | | <!-- è¡¨æ ¼åºå --> |
| | | <view id="tableDiv" class="table-container" v-if="showTable"> |
| | | <view class="table-header"> |
| | | <text class="table-title">æ¥è¯¢ç»æ</text> |
| | | </view> |
| | | <scroll-view scroll-y class="table-scroll"> |
| | | <view class="table"> |
| | | <!-- 表头 --> |
| | | <view class="thead"> |
| | | <view class="tr"> |
| | | <view |
| | | class="th" |
| | | v-for="(col, colIndex) in tableColumns" |
| | | :key="colIndex" |
| | | :style="getColumnStyle(col)" |
| | | > |
| | | {{ getColumnName(col) }} |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- æç´¢è¡ --> |
| | | <view class="tr search-row"> |
| | | <view |
| | | class="td search-cell" |
| | | v-for="(col, colIndex) in tableColumns" |
| | | :key="colIndex" |
| | | :style="getColumnStyle(col)" |
| | | > |
| | | <input |
| | | type="text" |
| | | class="search-input" |
| | | v-model="searchValues[colIndex]" |
| | | :placeholder="'æç´¢...'" |
| | | @input="filterTableData" |
| | | /> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- è¡¨æ ¼å
容 --> |
| | | <view class="tbody"> |
| | | <view |
| | | class="tr" |
| | | v-for="(row, rowIndex) in filteredTableData" |
| | | :key="rowIndex" |
| | | :class="{'tr-alter': rowIndex % 2 === 1}" |
| | | @tap="() => handleRowTap(row)" |
| | | > |
| | | <view |
| | | class="td" |
| | | v-for="(col, colIndex) in tableColumns" |
| | | :key="colIndex" |
| | | :style="getColumnStyle(col)" |
| | | @longpress="() => showFullContent(row[colIndex])" |
| | | > |
| | | <rich-text :nodes="formatCellContent(row[colIndex])"></rich-text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </scroll-view> |
| | | </view> |
| | | |
| | | |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | data() { |
| | | return { |
| | | title: 'MESç§»å¨ç»ç«¯', |
| | | username: '', |
| | | formData: [], |
| | | formValues: {}, |
| | | scanValues: {}, |
| | | selectOptions: {}, |
| | | tableColumns: [], |
| | | tableData: [], |
| | | searchValues: {}, // å卿¯åçæç´¢å¼ |
| | | filteredTableData: [], // è¿æ»¤åçè¡¨æ ¼æ°æ® |
| | | showTable: false, |
| | | isCommitted: false, // è¯·æ±æ¯å¦å·²æäº¤æ è¯ |
| | | bluetoothSocket: null, |
| | | device: null, |
| | | autoFocusId: '' // ç¨äºèªå¨èç¦çID |
| | | }; |
| | | }, |
| | | onReady(){ |
| | | this.username = this.setUsrCode(); |
| | | this.title = uni.getStorageSync("functionName") || 'MESç§»å¨ç»ç«¯'; |
| | | uni.setNavigationBarTitle({ |
| | | title: this.title |
| | | }); |
| | | }, |
| | | onLoad() { |
| | | this.getData(); |
| | | // åå§åèçæå°æº |
| | | if (this.$store.state.serverInfo.Bluetooth === 'true') { |
| | | this.initBluetooth(); |
| | | } |
| | | }, |
| | | methods: { |
| | | // è¿åä¸ä¸é¡µ |
| | | goBack() { |
| | | uni.navigateBack(); |
| | | }, |
| | | // è·åç¨æ·ä»£ç |
| | | setUsrCode() { |
| | | return uni.getStorageSync("code") || ''; |
| | | }, |
| | | |
| | | // è·åè¡¨åæ°æ® |
| | | getData() { |
| | | uni.showLoading({ |
| | | title: 'å è½½ä¸...' |
| | | }); |
| | | |
| | | uni.request({ |
| | | url: this.$store.state.serverInfo.serverAPI + '/modules/getRfSetup', |
| | | data: { |
| | | functionName: uni.getStorageSync("functionName") |
| | | }, |
| | | method: 'POST', |
| | | timeout: 60000, |
| | | header: { |
| | | 'Content-Type': 'application/json' |
| | | }, |
| | | success: (res) => { |
| | | if (res.data.status === 0 && res.data.data && res.data.data.setupData) { |
| | | let fData = res.data.data.setupData; |
| | | console.log("åå§æ°æ®:", fData); |
| | | |
| | | // å¤çåè½¦ç¬¦å· |
| | | if (typeof fData === 'string') { |
| | | while (fData.indexOf('\\r\\n') !== -1) { |
| | | fData = fData.replace("\\r\\n", " "); |
| | | } |
| | | |
| | | // è§£æåç¬¦ä¸²ä¸ºè¡¨åæ°æ®æ°ç» |
| | | try { |
| | | // ææ¹æ¬å·åå²å段 |
| | | const fieldsStr = fData.split('['); |
| | | const formFields = []; |
| | | |
| | | // ä»ç´¢å¼1å¼å§ï¼å 为第ä¸ä¸ªå
ç´ æ¯ç©ºçæåç¼ |
| | | for (let i = 1; i < fieldsStr.length; i++) { |
| | | // 廿ç»å°¾çæ¹æ¬å·å¹¶æ#åå²å±æ§ |
| | | const fieldStr = fieldsStr[i].replace(']', ''); |
| | | const fieldProps = fieldStr.split('#'); |
| | | formFields.push(fieldProps); |
| | | } |
| | | |
| | | this.formData = formFields; |
| | | console.log("è§£æåçè¡¨åæ°æ®:", this.formData); |
| | | |
| | | // åå§å表åå¼ |
| | | this.formData.forEach(item => { |
| | | if (item[12]) { |
| | | this.$set(this.formValues, item[0], item[12]); |
| | | } else { |
| | | this.$set(this.formValues, item[0], ''); |
| | | } |
| | | |
| | | // åå§åæ«æå¼ |
| | | if (item[4] === '4') { |
| | | this.$set(this.scanValues, item[0], ''); |
| | | } |
| | | }); |
| | | |
| | | // èç¦ç¬¬ä¸ä¸ªè¾å
¥æ¡ |
| | | this.$nextTick(() => { |
| | | // æ¾å°ç¬¬ä¸ä¸ªè¾å
¥æ¡å¹¶èç¦ |
| | | const firstInput = this.formData.find(item => item[4] === '3' || item[4] === '4'); |
| | | if (firstInput) { |
| | | setTimeout(() => { |
| | | this.focusInput(firstInput[0]); |
| | | }, 300); |
| | | } |
| | | }); |
| | | |
| | | // åå§åä¸ææ¡æ°æ® |
| | | this.getSelectData(); |
| | | // æ§è¡SQLè¯å¥çé»è®¤å¼ |
| | | this.getExcuteSql(); |
| | | } catch (error) { |
| | | console.error("è§£æè¡¨åæ°æ®åºé:", error); |
| | | uni.showToast({ |
| | | title: 'è§£æè¡¨åæ°æ®åºé', |
| | | content: "è§£æè¡¨åæ°æ®åºé: " + err.errMsg, |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | } else { |
| | | console.error("setupData䏿¯å符串类å"); |
| | | uni.showToast({ |
| | | title: 'æ°æ®æ ¼å¼é误', |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | } else { |
| | | uni.showToast({ |
| | | title: res.data.message || 'è·åæ°æ®å¤±è´¥', |
| | | content: res.data.message || 'è·åæ°æ®å¤±è´¥', |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | }, |
| | | fail: (err) => { |
| | | console.error("请æ±å¤±è´¥:", err); |
| | | uni.showToast({ |
| | | title: "æå¡å¨æå¼", |
| | | icon: 'none' |
| | | }); |
| | | }, |
| | | complete: () => { |
| | | uni.hideLoading(); |
| | | } |
| | | }); |
| | | }, |
| | | // æ«æäºç»´ç |
| | | scanQRCode(fieldId) { |
| | | // #ifdef APP-PLUS |
| | | // è°ç¨åçæ«ç åè½ |
| | | uni.scanCode({ |
| | | scanType: ['qrCode', 'barCode'], // åæ¶æ¯æäºç»´ç 忡形ç |
| | | success: (res) => { |
| | | console.log('æ«ç æå:', res); |
| | | // å°æ«ç ç»æè®¾ç½®å°å¯¹åºçè¾å
¥æ¡ |
| | | this.formValues[fieldId] = res.result; |
| | | |
| | | // æ¥æ¾å½ååæ®µçé
ç½® |
| | | const fieldConfig = this.formData.find(item => item[0] === fieldId); |
| | | if (fieldConfig) { |
| | | // 妿æé
ç½®çå车äºä»¶ï¼å触å |
| | | if (fieldConfig[7] !== 'N') { |
| | | this.doProByFile8(fieldConfig[8], fieldId); |
| | | } |
| | | |
| | | // 妿æé
ç½®çè·³è½¬åæ®µï¼åèç¦å°ä¸ä¸ä¸ªå段 |
| | | if (fieldConfig[10] !== '') { |
| | | this.formValues[fieldConfig[10]] = ''; |
| | | this.focusInput(fieldConfig[10]); |
| | | } |
| | | } |
| | | }, |
| | | fail: (err) => { |
| | | console.error('æ«ç 失败:', err); |
| | | uni.showToast({ |
| | | title: 'æ«ç 失败', |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | }); |
| | | // #endif |
| | | |
| | | // #ifdef H5 |
| | | uni.showToast({ |
| | | title: 'H5ç¯å¢ä¸æ¯ææ«ç åè½', |
| | | icon: 'none' |
| | | }); |
| | | // #endif |
| | | }, |
| | | formatCellContent(content) { |
| | | if (content === undefined || content === null) { |
| | | return ''; |
| | | } |
| | | |
| | | // å°å符串转æ¢ä¸ºå符串 |
| | | const strContent = String(content); |
| | | |
| | | // æ£æ¥æ¯å¦å
å«<br>æ ç¾ |
| | | if (strContent.includes('<br>')) { |
| | | return strContent; |
| | | } else { |
| | | return strContent; |
| | | } |
| | | }, |
| | | |
| | | // æ¾ç¤ºå®æ´å
容 |
| | | showFullContent(content) { |
| | | if (!content) return; |
| | | |
| | | uni.showModal({ |
| | | title: '宿´å
容', |
| | | content: String(content).replace(/<br>/g, '\n'), |
| | | showCancel: false, |
| | | confirmText: 'å
³é' |
| | | }); |
| | | }, |
| | | // èç¦è¾å
¥æ¡ |
| | | // focusInput(id) { |
| | | // setTimeout(() => { |
| | | // // 使ç¨uni-appçåçAPI |
| | | // uni.createSelectorQuery() |
| | | // .select('#' + id) |
| | | // .boundingClientRect(data => { |
| | | // if (data) { |
| | | // // å
ç´ åå¨ï¼å°è¯èç¦ |
| | | // uni.createSelectorQuery() |
| | | // .select('#' + id) |
| | | // .fields({ |
| | | // context: true |
| | | // }, res => { |
| | | // if (res && res.context) { |
| | | // res.context.focus(); |
| | | // } else { |
| | | // console.log('æ æ³è·åå
ç´ ä¸ä¸æ:', id); |
| | | // } |
| | | // }) |
| | | // .exec(); |
| | | // } else { |
| | | // console.log('æªæ¾å°å
ç´ :', id); |
| | | // } |
| | | // }) |
| | | // .exec(); |
| | | // }, 500); // å¢å å»¶è¿æ¶é´ |
| | | // }, |
| | | // èç¦è¾å
¥æ¡ - ç®åç |
| | | focusInput(id) { |
| | | console.log('å°è¯èç¦å
ç´ :', id); |
| | | |
| | | // 设置ä¸ä¸ªä¸´æ¶åéï¼ç¨äºèªå¨èç¦ |
| | | this.autoFocusId = id; |
| | | |
| | | // 使ç¨nextTickç¡®ä¿DOMå·²æ´æ° |
| | | this.$nextTick(() => { |
| | | setTimeout(() => { |
| | | // éç½®èªå¨èç¦IDï¼è§¦åè§å¾æ´æ° |
| | | this.autoFocusId = ''; |
| | | |
| | | // 忬¡è®¾ç½®ï¼è§¦åèªå¨èç¦ |
| | | setTimeout(() => { |
| | | this.autoFocusId = id; |
| | | }, 100); |
| | | }, 200); |
| | | }); |
| | | }, |
| | | // å¤çé®çæé®äºä»¶ |
| | | handleKeyUp(e, file7, str, fileId, file9, file10) { |
| | | // åªæå¨æä¸å车é®(13)æTabé®(9)æ¶æè§¦å |
| | | if (e.keyCode === 13 || e.keyCode === 9) { |
| | | // æ·»å å»¶è¿ï¼ç¡®ä¿è¾å
¥å®æ |
| | | setTimeout(() => { |
| | | this.enterSearch(e, file7, str, fileId, file9, file10); |
| | | }, 100); |
| | | } |
| | | }, |
| | | |
| | | // å¤çæ«æè¾å
¥é®çäºä»¶ |
| | | handleScanKeyUp(e, file8, fileId, file10, file7) { |
| | | // åªæå¨æä¸å车é®(13)æTabé®(9)æ¶æè§¦å |
| | | if (e.keyCode === 13 || e.keyCode === 9) { |
| | | // æ·»å å»¶è¿ï¼ç¡®ä¿è¾å
¥å®æ |
| | | setTimeout(() => { |
| | | this.enterScanSelect(e, file8, fileId, file10, file7); |
| | | }, 100); |
| | | } |
| | | }, |
| | | // å车æç´¢ |
| | | enterSearch(e, file7, str, fileId, file9, file10) { |
| | | // æ£æ¥æ¯å¦æ keyCodeï¼å¦ææ²¡æåé»è®¤ä¸ºåè½¦é® |
| | | const keyCode = e.keyCode || e.which || 13; |
| | | |
| | | if (keyCode == 13 || keyCode == 9) { |
| | | console.log('触åå车æç´¢:', fileId, file7, str); |
| | | |
| | | // 夿æ¯å¦éè¦è°ç¨åå¨è¿ç¨ |
| | | if (file7 != 'N') { |
| | | this.doProByFile8(str, fileId); |
| | | } |
| | | |
| | | // å¤æè·³è½¬åæ®µ |
| | | if (file9 == '1') { |
| | | // å车èªå¨è·³è³ä¸ä¸éåªè¯»å段 |
| | | this.focusNextInput(fileId); |
| | | } |
| | | if (file9 == '0' && file10 == '') { |
| | | // å车åå°±åç卿¬åæ®µï¼æ¬å段å
容å
æ¸
空 |
| | | this.formValues[fileId] = ''; |
| | | this.focusInput(fileId); |
| | | } |
| | | if (file10 != '') { |
| | | // è·³è³æå®å段ï¼å½è¦æ±è·³å°æå®å段æ¶ï¼è¿ä¸ªæå®å段ååé¢é¡ºåºçåæ®µæ¡å
容åéè¦æ¸
空 |
| | | this.formValues[file10] = ''; |
| | | this.focusInput(file10); |
| | | } |
| | | } |
| | | }, |
| | | focusNextInput(currentId) { |
| | | // æ¾å°å½ååæ®µå¨ formData ä¸çç´¢å¼ |
| | | const currentIndex = this.formData.findIndex(item => item[0] === currentId); |
| | | if (currentIndex === -1) return; |
| | | |
| | | // ä»å½ååæ®µä¹åæ¥æ¾ç¬¬ä¸ä¸ªéåªè¯»çè¾å
¥å段 |
| | | for (let i = currentIndex + 1; i < this.formData.length; i++) { |
| | | const item = this.formData[i]; |
| | | // æ£æ¥æ¯å¦æ¯å¯è¾å
¥å段ä¸éåªè¯» |
| | | if ((item[4] === '3' || item[4] === '4') && item[3] !== '1') { |
| | | this.focusInput(item[0]); |
| | | return; |
| | | } |
| | | } |
| | | }, |
| | | |
| | | // æ«æéæ©æ¡å车äºä»¶ |
| | | enterScanSelect(e, file8, fileId, file10, file7) { |
| | | const keyCode = e.keyCode || e.which || 13; |
| | | |
| | | if (keyCode == 13 || keyCode == 9) { |
| | | console.log('è§¦åæ«æéæ©å车:', fileId, file7, file8); |
| | | const value = this.formValues[fileId]; // ç´æ¥ä½¿ç¨formValues |
| | | |
| | | if (value == '') { |
| | | uni.showToast({ |
| | | title: 'è¯·æ«æ', |
| | | icon: 'none' |
| | | }); |
| | | return false; |
| | | } |
| | | |
| | | // ä¸åéè¦è¿ä¸è¡ï¼å 为已ç»ç´æ¥ç»å®å°formValues |
| | | // this.formValues[fileId] = value; |
| | | |
| | | if (file7 != 'N') { |
| | | this.doProByFile8(file8, fileId); |
| | | } |
| | | |
| | | if (file10 != '') { |
| | | this.focusInput(file10); |
| | | } |
| | | } |
| | | }, |
| | | |
| | | // 䏿æ¡éæ©äºä»¶ |
| | | getCheckItem(file8, fileId, file10, file7, e) { |
| | | const index = e.detail.value; |
| | | const value = this.selectOptions[fileId][index]; |
| | | |
| | | if (!value) { |
| | | uni.showToast({ |
| | | title: 'è¯·éæ©', |
| | | icon: 'none' |
| | | }); |
| | | this.formValues[fileId] = ''; |
| | | return false; |
| | | } |
| | | |
| | | // ä¸åéè¦scanValues |
| | | // this.scanValues[fileId] = value; |
| | | this.formValues[fileId] = value; |
| | | |
| | | if (file7 != 'N') { |
| | | this.doProByFile8(file8, fileId); |
| | | } |
| | | |
| | | if (file10 != '') { |
| | | this.formValues[file10] = ''; |
| | | this.focusInput(file10); |
| | | } |
| | | }, |
| | | |
| | | // å¤éæ¡éæ©äºä»¶ |
| | | getCheckMultiItem(file8, fileId, file10, file7, e) { |
| | | const indexes = e.detail.value; |
| | | const values = indexes.map(index => this.selectOptions['mul' + fileId][index]); |
| | | |
| | | if (values.length === 0) { |
| | | uni.showToast({ |
| | | title: 'è¯·éæ©', |
| | | icon: 'none' |
| | | }); |
| | | this.scanValues['mul' + fileId] = ''; |
| | | this.formValues[fileId] = ''; |
| | | return false; |
| | | } |
| | | |
| | | const str = values.join('@'); |
| | | |
| | | this.scanValues['mul' + fileId] = str; |
| | | this.formValues[fileId] = str; |
| | | |
| | | if (file7 != 'N') { |
| | | this.doProByFile8(file8, fileId); |
| | | } |
| | | |
| | | if (file10 != '') { |
| | | this.formValues[file10] = ''; |
| | | this.focusInput(file10); |
| | | } |
| | | }, |
| | | |
| | | // è¿æ»¤è¡¨æ ¼æ°æ® |
| | | filterTableData() { |
| | | // å¦ææ²¡ææç´¢æ¡ä»¶ï¼æ¾ç¤ºå
¨é¨æ°æ® |
| | | if (Object.keys(this.searchValues).length === 0 || |
| | | Object.values(this.searchValues).every(v => !v)) { |
| | | this.filteredTableData = this.tableData; |
| | | return; |
| | | } |
| | | |
| | | // æ ¹æ®æç´¢æ¡ä»¶è¿æ»¤æ°æ® |
| | | this.filteredTableData = this.tableData.filter(row => { |
| | | // æ£æ¥æ¯ä¸åæ¯å¦ç¬¦åæç´¢æ¡ä»¶ |
| | | return Object.keys(this.searchValues).every(colIndex => { |
| | | const searchValue = this.searchValues[colIndex]; |
| | | // å¦æè¯¥åæ²¡ææç´¢å¼ï¼åè§ä¸ºç¬¦åæ¡ä»¶ |
| | | if (!searchValue) return true; |
| | | |
| | | const cellValue = String(row[colIndex] || '').toLowerCase(); |
| | | return cellValue.includes(searchValue.toLowerCase()); |
| | | }); |
| | | }); |
| | | }, |
| | | |
| | | // å¤çè¡¨æ ¼æ°æ®ååæ¶æ´æ°è¿æ»¤ç»æ |
| | | updateFilteredData() { |
| | | this.searchValues = {}; // éç½®æç´¢æ¡ä»¶ |
| | | this.filteredTableData = this.tableData; // éç½®è¿æ»¤ç»æ |
| | | }, |
| | | |
| | | // å¼å
³åæ¢äºä»¶ |
| | | switchChange(e, fileId) { |
| | | this.formValues[fileId] = e.detail.value ? "1" : "0"; |
| | | }, |
| | | |
| | | // è·åä¸ææ¡æ°æ® |
| | | getSelectData() { |
| | | this.formData.forEach(item => { |
| | | if ((item[2] === 'VARCHAR2' || item[2] === 'VARCHAR') && item[4] === '4') { |
| | | this.getExcProc(item[0], uni.getStorageSync("code") + '[_N', '', 'select'); |
| | | } else if (item[2] === 'EDIT' && item[4] === '4') { |
| | | this.getExcProc(item[0], uni.getStorageSync("code") + '[_N', '', 'select'); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | // æ§è¡SQLè¯å¥çé»è®¤å¼ |
| | | getExcuteSql() { |
| | | this.formData.forEach(item => { |
| | | if (item[3] === '1' && (item[2] === 'VARCHAR2' || item[2] === 'VARCHAR') && item[4] === '3') { |
| | | let upperValue = item[12] ? item[12].toUpperCase() : ''; |
| | | |
| | | // è¿æ»¤æ°æ®åºå
³é®è¯ |
| | | const reg = new RegExp(/INSERT|DELETE|UPDATE|DROP|TRUNCATE/); |
| | | if (reg.test(upperValue)) { |
| | | return; |
| | | } |
| | | |
| | | upperValue = upperValue.replace('{USERCODE}', uni.getStorageSync("code")); |
| | | if (upperValue.substring(0, 6) === "SELECT") { |
| | | this.getExcuteSqlData(upperValue, item[0]); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | // æ§è¡SQLæ¥è¯¢è¯å¥ |
| | | getExcuteSqlData(str, inputId) { |
| | | uni.request({ |
| | | url: this.$store.state.serverInfo.serverAPI + '/getExcuteSql', |
| | | data: { |
| | | str: str |
| | | }, |
| | | method: 'POST', |
| | | timeout: 30000, |
| | | success: (res) => { |
| | | if (res.data.result) { |
| | | this.formValues[inputId] = res.data.data[0]; |
| | | } else { |
| | | uni.showToast({ |
| | | title: res.data.message, |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | }, |
| | | fail: (err) => { |
| | | uni.showToast({ |
| | | title: '失败!å¤±è´¥ç±»åæ¯:' + err.errMsg, |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | // æå¼åè¡¨é¡µé¢ |
| | | openList(fileId, fileName) { |
| | | uni.navigateTo({ |
| | | url: '/pages/BasePage/select_search_list?file_name=' + fileId + '&title_name=' + fileName |
| | | }); |
| | | }, |
| | | |
| | | // æ§è¡åå¨è¿ç¨ |
| | | doProByFile8(file8, fileId) { |
| | | if (this.isCommitted === false) { |
| | | this.isCommitted = true; |
| | | this.doProByFile8Prc(file8, fileId); |
| | | } else { |
| | | return false; |
| | | } |
| | | }, |
| | | |
| | | // æ§è¡åå¨è¿ç¨å¤ç |
| | | doProByFile8Prc(file8, fileId) { |
| | | try { |
| | | const date = file8.substring(1, file8.length - 1); |
| | | const a = date.split("}{"); |
| | | const iput = a[0].split(','); |
| | | |
| | | let fileValue = uni.getStorageSync("code") + '['; |
| | | for (let i = 0; i < iput.length; i++) { |
| | | let fv = this.formValues[iput[i]] || ''; |
| | | fv = fv.trim(); |
| | | fileValue += fv + '['; |
| | | } |
| | | fileValue = fileValue.substring(0, fileValue.length - 1); |
| | | console.log(12); |
| | | if (a[1]) { |
| | | const input = a[1].split(','); |
| | | if (input[input.length - 1] === 'FVIEW') { |
| | | this.getExcProc(fileId, fileValue, a[1], 'cursor+proc'); |
| | | } else { |
| | | this.getExcProc(fileId, fileValue, a[1], 'proc'); |
| | | } |
| | | } else { |
| | | this.getExcProc(fileId, fileValue, a[1], 'proc'); |
| | | } |
| | | } catch (e) { |
| | | uni.showModal({ |
| | | title: 'é误', |
| | | content: "åè½åçå¼å¸¸ï¼è¯·èç³»IT人å", |
| | | showCancel: false |
| | | }); |
| | | this.isCommitted = false; |
| | | return false; |
| | | } |
| | | }, |
| | | |
| | | // æ§è¡åå¨è¿ç¨API |
| | | // æ§è¡åå¨è¿ç¨API |
| | | getExcProc(fileName, fileValue, outFiles, stype) { |
| | | const fileId = fileName; |
| | | fileName = fileName.replace(/\s+/g, ""); |
| | | |
| | | uni.request({ |
| | | url: this.$store.state.serverInfo.serverAPI + '/modules/getExcProc', |
| | | data: { |
| | | functionName: uni.getStorageSync("functionName"), |
| | | fileName: fileName, |
| | | pmachtype: '', |
| | | fileValue: fileValue, |
| | | outFiles: outFiles |
| | | }, |
| | | method: 'POST', |
| | | timeout: 60000, |
| | | header: { |
| | | 'Content-Type': 'application/json' |
| | | }, |
| | | success: (res) => { |
| | | console.log(JSON.stringify(res.data)); |
| | | if (res.data.data) { |
| | | if (stype.indexOf('proc') !== -1) { |
| | | const msg_1 = res.data.message; |
| | | if (msg_1 && msg_1.indexOf('999!*') !== -1) { |
| | | uni.showModal({ |
| | | title: 'è¦åæé', |
| | | content: res.data.message, |
| | | showCancel: false |
| | | }); |
| | | } else { |
| | | console.log(1); |
| | | this.afterProc(res.data); |
| | | } |
| | | } else if (stype.indexOf('select') !== -1) { |
| | | console.log(2); |
| | | const t = res.data.data.split(','); |
| | | const options = t.filter(item => item.length > 0); |
| | | |
| | | if (fileName.startsWith('mul')) { |
| | | this.$set(this.selectOptions, fileName, options); |
| | | } else { |
| | | this.$set(this.selectOptions, fileName, options); |
| | | } |
| | | } |
| | | |
| | | if (stype.indexOf('cursor') !== -1) { |
| | | const valueData = res.data.data.toString(); |
| | | const t1 = valueData.substring(valueData.indexOf(',') + 1, valueData.length); |
| | | const tData = t1.split(','); |
| | | const table = tData[tData.length - 1].split('{'); |
| | | |
| | | // å¤ç表头 |
| | | const headerRow = table[0].split('@'); |
| | | this.tableColumns = headerRow; |
| | | |
| | | // å¤çæ°æ®è¡ |
| | | const rows = []; |
| | | for (let i = 1; i < table.length; i++) { |
| | | if (table[i].length > 0) { |
| | | rows.push(table[i].split('@')); |
| | | } |
| | | } |
| | | this.tableData = rows; |
| | | this.filteredTableData = rows; // åå§åè¿æ»¤åçæ°æ® |
| | | this.searchValues = {}; // éç½®æç´¢æ¡ä»¶ |
| | | this.showTable = true; |
| | | } |
| | | |
| | | if (stype.indexOf('print') !== -1) { |
| | | const da = res.data.data[0]; |
| | | if (da && da.length > 0) { |
| | | da.splice(0, 1); |
| | | this.printByIds(da.toString()); |
| | | } |
| | | } |
| | | } else { |
| | | this.playerNo(); |
| | | uni.showModal({ |
| | | title: 'æç¤º', |
| | | content: res.data.message, |
| | | showCancel: false, |
| | | success: () => { |
| | | this.formValues[fileId] = ""; |
| | | this.focusInput(fileId); |
| | | } |
| | | }); |
| | | } |
| | | this.isCommitted = false; |
| | | }, |
| | | fail: (err) => { |
| | | this.isCommitted = false; |
| | | uni.showToast({ |
| | | title: "请æ±å¤±è´¥: " + err.errMsg, |
| | | content: "请æ±å¤±è´¥: " + err.errMsg, |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | // å¤çåå¨è¿ç¨è¿åç»æ |
| | | afterProc(data) { |
| | | this.playerYes(); |
| | | console.log('å¤çè¿åæ°æ®:', JSON.stringify(data)); |
| | | |
| | | // æ£æ¥æ°æ®æ ¼å¼ |
| | | if (!data.data || !Array.isArray(data.data)) { |
| | | console.error('è¿åæ°æ®æ ¼å¼ä¸æ£ç¡®:', data); |
| | | return; |
| | | } |
| | | |
| | | // éåæ°æ®æ°ç» |
| | | for (let i = 0; i < data.data.length; i++) { |
| | | const t = data.data[i]; |
| | | |
| | | // æ£æ¥æ°ç»å
ç´ æ¯å¦ææ |
| | | if (!Array.isArray(t) || t.length < 2) { |
| | | console.warn('æ°æ®é¡¹æ ¼å¼ä¸æ£ç¡®:', t); |
| | | continue; |
| | | } |
| | | |
| | | const fieldId = t[0]; |
| | | const fieldValue = t[1]; |
| | | |
| | | // æ£æ¥å段IDæ¯å¦åå¨äºè¡¨åå¼ä¸ |
| | | if (this.formValues.hasOwnProperty(fieldId)) { |
| | | if (typeof fieldValue === 'string' && fieldValue.indexOf("{") === -1) { |
| | | this.formValues[fieldId] = fieldValue; |
| | | } else if (typeof fieldValue === 'string') { |
| | | const a = fieldValue.split('{'); |
| | | this.setSelect(a, fieldId); |
| | | } else { |
| | | console.warn('åæ®µå¼ç±»å䏿£ç¡®:', fieldValue); |
| | | } |
| | | } else { |
| | | console.warn('表åä¸ä¸åå¨å段:', fieldId); |
| | | } |
| | | } |
| | | }, |
| | | |
| | | // è®¾ç½®ä¸ææ¡é项 |
| | | setSelect(t, fileName) { |
| | | const options = t.filter(item => item.length > 0); |
| | | this.$set(this.selectOptions, fileName, options); |
| | | this.formValues[fileName] = ''; |
| | | }, |
| | | |
| | | // ç¹å»æé® |
| | | clickButton(item) { |
| | | const file10 = item[10]; |
| | | const file8 = item[8]; |
| | | |
| | | this.doProByFile8(file8, item[0]); |
| | | |
| | | if (file10 !== '') { |
| | | this.formValues[file10] = ''; |
| | | this.focusInput(file10); |
| | | } |
| | | }, |
| | | |
| | | // ç¹å»æç
§æé® |
| | | photoButton(item) { |
| | | uni.navigateTo({ |
| | | url: '/pages/BasePage/ftp/pictrue_add' |
| | | }); |
| | | }, |
| | | |
| | | // ç¹å»å表æé® |
| | | listButton(item) { |
| | | const file8 = item[8]; |
| | | this.doProByFile8Cursor(file8, item[0], item[2]); |
| | | }, |
| | | |
| | | // æ§è¡å表æ¥è¯¢ |
| | | doProByFile8Cursor(file8, fileId, fileType) { |
| | | const date = file8.substring(1, file8.length - 1); |
| | | const a = date.split("}{"); |
| | | const iput = a[0].split(','); |
| | | |
| | | let fileValue = uni.getStorageSync("code") + '['; |
| | | for (let i = 0; i < iput.length; i++) { |
| | | let fv = this.formValues[iput[i]] || ''; |
| | | fv = fv.trim(); |
| | | fileValue += fv + '['; |
| | | } |
| | | fileValue = fileValue.substring(0, fileValue.length - 1); |
| | | |
| | | if (fileType === 'EDIT') { |
| | | this.getCursor(fileId, fileValue, a[1], 'cursor'); |
| | | } else { |
| | | this.getExcProc(fileId, fileValue, a[1], 'cursor'); |
| | | } |
| | | }, |
| | | |
| | | // è·åæ¸¸æ æ°æ® |
| | | // è·åæ¸¸æ æ°æ® |
| | | getCursor(fileName, fileValue, outFiles, stype) { |
| | | const fileId = fileName; |
| | | fileName = fileName.replace(/\s+/g, ""); |
| | | |
| | | uni.request({ |
| | | url: this.$store.state.serverInfo.serverAPI + '/getCursor', |
| | | data: { |
| | | functionName: uni.getStorageSync("functionName"), |
| | | fileName: fileName, |
| | | pmachtype: '', |
| | | fileValue: encodeURIComponent(fileValue), |
| | | outFiles: outFiles |
| | | }, |
| | | method: 'POST', |
| | | timeout: 60000, |
| | | header: { |
| | | 'Content-Type': 'application/json' |
| | | }, |
| | | success: (res) => { |
| | | if (res.data.result) { |
| | | if (res.data.data[0]) { |
| | | uni.showModal({ |
| | | title: 'é误', |
| | | content: "åè½åçå¼å¸¸ï¼è¯·èç³»IT人å", |
| | | showCancel: false |
| | | }); |
| | | } else { |
| | | const tdata = res.data.data[2]; |
| | | const col = res.data.data[3]; |
| | | |
| | | this.tableColumns = col; |
| | | this.tableData = tdata.map(item => Object.values(item)); |
| | | this.filteredTableData = this.tableData; // åå§åè¿æ»¤åçæ°æ® |
| | | this.searchValues = {}; // éç½®æç´¢æ¡ä»¶ |
| | | this.showTable = true; |
| | | } |
| | | } else { |
| | | uni.showToast({ |
| | | title: res.data.message, |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | }, |
| | | fail: (err) => { |
| | | uni.showToast({ |
| | | title: "请æ±å¤±è´¥: " + err.errMsg, |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | // ç¹å»æå°æé® |
| | | clickPrintBtn(item) { |
| | | try { |
| | | const file8 = item[8]; |
| | | const file10 = item[10]; |
| | | const fileId = item[0]; |
| | | |
| | | const date = file8.substring(1, file8.length - 1); |
| | | const a = date.split("}{"); |
| | | const iput = a[0].split(','); |
| | | |
| | | let fileValue = uni.getStorageSync("code") + '['; |
| | | for (let i = 0; i < iput.length; i++) { |
| | | let fv = this.formValues[iput[i]] || ''; |
| | | fileValue += fv + '['; |
| | | } |
| | | fileValue = fileValue.substring(0, fileValue.length - 1); |
| | | |
| | | // å
æ¸
ç©ºåæ®µ |
| | | if (file10 !== '') { |
| | | this.formValues[file10] = ''; |
| | | this.focusInput(file10); |
| | | } |
| | | |
| | | setTimeout(() => { |
| | | if (a[1]) { |
| | | const input = a[1].split(','); |
| | | if (input[input.length - 1] === 'FVIEW') { |
| | | this.getExcProc(fileId, fileValue, a[1], 'cursor+print'); |
| | | } else { |
| | | this.getExcProc(fileId, fileValue, a[1], 'print'); |
| | | } |
| | | } |
| | | }, 100); |
| | | } catch (e) { |
| | | uni.showModal({ |
| | | title: 'é误', |
| | | content: "åè½åçå¼å¸¸ï¼è¯·èç³»IT人å", |
| | | showCancel: false |
| | | }); |
| | | } |
| | | }, |
| | | |
| | | // åå§åèçæå°æº |
| | | initBluetooth() { |
| | | // #ifdef APP-PLUS |
| | | try { |
| | | const main = plus.android.runtimeMainActivity(); |
| | | const BluetoothAdapter = plus.android.importClass("android.bluetooth.BluetoothAdapter"); |
| | | const UUID = plus.android.importClass("java.util.UUID"); |
| | | |
| | | const uuid = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"); |
| | | const BAdapter = BluetoothAdapter.getDefaultAdapter(); |
| | | BAdapter.cancelDiscovery(); // åæ¢æ«æ |
| | | |
| | | const address_mac = uni.getStorageSync("printMac") || "DC:1D:30:3F:D2:50"; |
| | | this.device = BAdapter.getRemoteDevice(address_mac); |
| | | plus.android.importClass(this.device); |
| | | |
| | | this.bluetoothSocket = this.device.createInsecureRfcommSocketToServiceRecord(uuid); |
| | | plus.android.importClass(this.bluetoothSocket); |
| | | } catch (err) { |
| | | console.log(err); |
| | | uni.showToast({ |
| | | title: "èçè¿æ¥å¼å¸¸ï¼", |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | // #endif |
| | | }, |
| | | |
| | | // æå°æ ç¾ |
| | | printByIds(ids) { |
| | | // #ifdef APP-PLUS |
| | | try { |
| | | if (!this.bluetoothSocket) { |
| | | uni.showToast({ |
| | | title: "èçæªè¿æ¥", |
| | | icon: 'none' |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | uni.request({ |
| | | url: this.$store.state.serverInfo.serverAPI + '/getPrintData', |
| | | data: { |
| | | ids: ids |
| | | }, |
| | | method: 'POST', |
| | | timeout: 60000, |
| | | success: (res) => { |
| | | if (res.data.result) { |
| | | const printData = res.data.data; |
| | | this.doPrint(printData); |
| | | } else { |
| | | uni.showToast({ |
| | | title: res.data.msg, |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | }, |
| | | fail: (err) => { |
| | | uni.showToast({ |
| | | title: "请æ±å¤±è´¥: " + err.errMsg, |
| | | content: "请æ±å¤±è´¥: " + err.errMsg, |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | }); |
| | | } catch (e) { |
| | | uni.showToast({ |
| | | title: "æå°å¼å¸¸: " + e.message, |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | // #endif |
| | | }, |
| | | |
| | | // æ§è¡æå° |
| | | doPrint(printData) { |
| | | // #ifdef APP-PLUS |
| | | try { |
| | | this.bluetoothSocket.connect(); |
| | | const outputStream = this.bluetoothSocket.getOutputStream(); |
| | | plus.android.importClass(outputStream); |
| | | |
| | | for (let i = 0; i < printData.length; i++) { |
| | | const item = printData[i]; |
| | | const template = item.template; |
| | | const data = item.data; |
| | | |
| | | // è¿éå¯ä»¥æ ¹æ®æ¨¡æ¿åæ°æ®çææå°å
容 |
| | | const printContent = this.generatePrintContent(template, data); |
| | | |
| | | outputStream.write(plus.android.newByteArray(printContent)); |
| | | outputStream.flush(); |
| | | } |
| | | |
| | | outputStream.close(); |
| | | this.bluetoothSocket.close(); |
| | | |
| | | uni.showToast({ |
| | | title: "æå°æå", |
| | | icon: 'success' |
| | | }); |
| | | } catch (e) { |
| | | uni.showToast({ |
| | | title: "æå°å¤±è´¥: " + e.message, |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | // #endif |
| | | }, |
| | | |
| | | // çææå°å
容 |
| | | generatePrintContent(template, data) { |
| | | // æ ¹æ®æ¨¡æ¿åæ°æ®çææå°å
容 |
| | | // è¿ééè¦æ ¹æ®å®é
æå°æºåæ¨¡æ¿æ ¼å¼è¿è¡å®ç° |
| | | return new Uint8Array([0x1B, 0x40]); // 示ä¾: æå°æºåå§åå½ä»¤ |
| | | }, |
| | | |
| | | // ææ¾æåæç¤ºé³ |
| | | playerYes() { |
| | | // #ifdef APP-PLUS |
| | | try { |
| | | const context = plus.audio.createPlayer('static/audio/yes.mp3'); |
| | | context.play(); |
| | | } catch (e) { |
| | | console.log('ææ¾æç¤ºé³å¤±è´¥:', e); |
| | | } |
| | | // #endif |
| | | }, |
| | | |
| | | // ææ¾å¤±è´¥æç¤ºé³ |
| | | playerNo() { |
| | | // #ifdef APP-PLUS |
| | | try { |
| | | const context = plus.audio.createPlayer('static/audio/no.mp3'); |
| | | context.play(); |
| | | } catch (e) { |
| | | console.log('ææ¾æç¤ºé³å¤±è´¥:', e); |
| | | } |
| | | // #endif |
| | | }, |
| | | |
| | | // è·ååå®½æ ·å¼ |
| | | getColumnStyle(col) { |
| | | if (col.indexOf('_') !== -1) { |
| | | const tArr = col.split('_'); |
| | | return { width: tArr[1] + '%' }; |
| | | } |
| | | return {}; |
| | | }, |
| | | |
| | | // è·ååå |
| | | getColumnName(col) { |
| | | if (col.indexOf('_') !== -1) { |
| | | const tArr = col.split('_'); |
| | | return tArr[0]; |
| | | } |
| | | return col; |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style> |
| | | /* 页é¢å®¹å¨ */ |
| | | .container { |
| | | display: flex; |
| | | flex-direction: column; |
| | | height: 100vh; |
| | | background-color: #f5f7fa; |
| | | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; |
| | | } |
| | | |
| | | /* å
容åºå */ |
| | | .content { |
| | | flex: 1; |
| | | overflow-y: auto; |
| | | padding: 8px; |
| | | } |
| | | |
| | | /* 表åå®¹å¨ */ |
| | | .form-container { |
| | | margin-bottom: 12px; |
| | | } |
| | | |
| | | /* 表å项 */ |
| | | .form-item { |
| | | display: flex; |
| | | align-items: center; |
| | | margin-bottom: 8px; |
| | | background-color: #fff; |
| | | border-radius: 6px; |
| | | padding: 0 10px; |
| | | min-height: 44px; |
| | | box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); |
| | | } |
| | | |
| | | .form-label { |
| | | width: 80px; |
| | | font-size: 14px; |
| | | color: #333; |
| | | font-weight: 500; |
| | | padding-right: 10px; |
| | | flex-shrink: 0; |
| | | } |
| | | |
| | | .form-input { |
| | | flex: 1; |
| | | height: 44px; |
| | | padding: 0 10px; |
| | | font-size: 14px; |
| | | border: none; |
| | | background-color: transparent; |
| | | } |
| | | |
| | | .form-input.readonly { |
| | | color: #999; |
| | | background-color: #f5f5f5; |
| | | border-radius: 4px; |
| | | |
| | | } |
| | | |
| | | .form-textarea { |
| | | flex: 1; |
| | | padding: 10px; |
| | | font-size: 14px; |
| | | border: none; |
| | | background-color: transparent; |
| | | min-height: 60px; |
| | | } |
| | | |
| | | .form-textarea.readonly { |
| | | color: #999; |
| | | background-color: #f5f5f5; |
| | | border-radius: 4px; |
| | | |
| | | } |
| | | |
| | | /* ä¸æéæ©æ¡ */ |
| | | .select-wrapper { |
| | | flex: 1; |
| | | position: relative; |
| | | } |
| | | |
| | | .select-icon { |
| | | position: absolute; |
| | | right: 10px; |
| | | top: 50%; |
| | | transform: translateY(-50%); |
| | | pointer-events: none; |
| | | } |
| | | |
| | | /* æ«æéæ©æ¡ */ |
| | | .scan-select-container { |
| | | flex: 1; |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | .scan-input { |
| | | flex: 1; |
| | | } |
| | | |
| | | .select-btn { |
| | | width: 36px; |
| | | height: 36px; |
| | | background: linear-gradient(135deg, #5677fc, #8a9ffc); |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | border-radius: 4px; |
| | | margin-left: 8px; |
| | | } |
| | | |
| | | .select-btn.readonly-btn { |
| | | background: linear-gradient(135deg, #e0e0e0, #d0d0d0); |
| | | cursor: not-allowed; |
| | | } |
| | | |
| | | /* æé®æ ·å¼ */ |
| | | .button-item { |
| | | justify-content: center; |
| | | padding: 6px 0; |
| | | } |
| | | |
| | | .action-button { |
| | | width: 100%; |
| | | height: 40px; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | border-radius: 6px; |
| | | color: #fff; |
| | | font-size: 14px; |
| | | font-weight: 500; |
| | | box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); |
| | | } |
| | | |
| | | .normal-btn { |
| | | background: linear-gradient(135deg, #5677fc, #8a9ffc); |
| | | } |
| | | |
| | | .photo-btn { |
| | | background: linear-gradient(135deg, #52c41a, #95de64); |
| | | } |
| | | |
| | | .list-btn { |
| | | background: linear-gradient(135deg, #fa8c16, #ffc53d); |
| | | } |
| | | |
| | | .print-btn { |
| | | background: linear-gradient(135deg, #13c2c2, #5cdbd3); |
| | | } |
| | | |
| | | /* å¼å
³æ ·å¼ */ |
| | | .switch-item { |
| | | justify-content: space-between; |
| | | } |
| | | |
| | | .custom-switch { |
| | | transform: scale(0.8); |
| | | } |
| | | |
| | | /* è¡¨æ ¼æ ·å¼ */ |
| | | .table-container { |
| | | background-color: #fff; |
| | | border-radius: 6px; |
| | | overflow: hidden; |
| | | box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); |
| | | margin-top: 8px; |
| | | } |
| | | |
| | | .table-header { |
| | | padding: 10px; |
| | | background-color: #f9fafc; |
| | | border-bottom: 1px solid #edf0f7; |
| | | } |
| | | |
| | | .table-title { |
| | | font-size: 14px; |
| | | font-weight: 600; |
| | | color: #333; |
| | | } |
| | | |
| | | .table-scroll { |
| | | max-height: 300px; |
| | | } |
| | | |
| | | .table { |
| | | width: 100%; |
| | | table-layout: fixed; |
| | | } |
| | | |
| | | .tr { |
| | | display: flex; |
| | | border-bottom: 1px solid #edf0f7; |
| | | min-height: 44px; |
| | | } |
| | | |
| | | .tr-alter { |
| | | background-color: #f9fafc; |
| | | } |
| | | |
| | | .th, .td { |
| | | flex: 1; |
| | | padding: 10px 6px; |
| | | text-align: center; |
| | | font-size: 13px; |
| | | word-break: break-word; |
| | | white-space: normal; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | |
| | | .td { |
| | | min-height: 44px; |
| | | position: relative; |
| | | } |
| | | |
| | | .th { |
| | | background-color: #f5f7fa; |
| | | color: #333; |
| | | font-weight: 600; |
| | | position: sticky; |
| | | top: 0; |
| | | z-index: 2; |
| | | } |
| | | |
| | | /* è¡¨æ ¼æç´¢è¡æ ·å¼ */ |
| | | .search-row { |
| | | background-color: #f0f2f5; |
| | | border-bottom: 1px solid #ddd; |
| | | } |
| | | |
| | | .search-cell { |
| | | padding: 5px 3px; |
| | | } |
| | | |
| | | .search-input { |
| | | width: 100%; |
| | | height: 30px; |
| | | border: 1px solid #ddd; |
| | | border-radius: 4px; |
| | | padding: 0 5px; |
| | | font-size: 12px; |
| | | background-color: #fff; |
| | | } |
| | | |
| | | /* ç¡®ä¿è¡¨å¤´åºå®å¨é¡¶é¨ */ |
| | | .thead { |
| | | position: sticky; |
| | | top: 0; |
| | | z-index: 10; |
| | | } |
| | | |
| | | /* éé
å°å±å¹ */ |
| | | @media screen and (max-width: 320px) { |
| | | .form-label { |
| | | width: 70px; |
| | | font-size: 13px; |
| | | } |
| | | |
| | | .form-input, .form-textarea { |
| | | font-size: 13px; |
| | | } |
| | | |
| | | .action-button { |
| | | font-size: 13px; |
| | | } |
| | | } |
| | | .scan-input-container { |
| | | flex: 1; |
| | | display: flex; |
| | | align-items: center; |
| | | position: relative; |
| | | } |
| | | |
| | | /* æ«ç 徿 æé® */ |
| | | .scan-icon-btn { |
| | | width: 36px; |
| | | height: 36px; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | position: absolute; |
| | | right: 0; |
| | | top: 50%; |
| | | transform: translateY(-50%); |
| | | z-index: 1; |
| | | } |
| | | |
| | | /* è°æ´å¸¦æ«ç 徿 çè¾å
¥æ¡å
è¾¹è· */ |
| | | .scan-input-container .form-input { |
| | | padding-right: 36px; |
| | | } |
| | | </style> |