From f26f29d84e0a68831a6af14dab3eec5500496d2e Mon Sep 17 00:00:00 2001 From: spring <2396852758@qq.com> Date: 星期三, 28 五月 2025 16:48:52 +0800 Subject: [PATCH] 初始化项目 --- pages/daily/tag-list/add.vue | 168 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 168 insertions(+), 0 deletions(-) diff --git a/pages/daily/tag-list/add.vue b/pages/daily/tag-list/add.vue new file mode 100644 index 0000000..e37a697 --- /dev/null +++ b/pages/daily/tag-list/add.vue @@ -0,0 +1,168 @@ +<template> + <view class="tag-add"> + <u-form :model="form" ref="uForm" :error-type="['toast']"> + <u-form-item label="绫诲瀷" prop="type" required v-if="info.workCenter === 'ZZ-03'"> + <u-input v-model="form.type" type="select" input-align="right" placeholder="璇烽�夋嫨"/> + <u-icon name="arrow-right" @click="show = true"></u-icon> + </u-form-item> + <u-form-item label="鏁伴噺" :border-bottom="false" style="width: calc(100% - 40rpx);" prop="num" required> + <u-input v-model="form.num" input-align="right" placeholder="璇疯緭鍏�"/> + </u-form-item> + </u-form> + <u-button type="primary" style="margin: 30rpx;" :loading="loading" @click="submit" :custom-style="{ + backgroundColor: '#214DED', + height:'80rpx'}" class="btn">鎻愪氦</u-button> + <u-select :list="actionSheetList" v-model="show" @confirm="actionSheetCallback"></u-select> + </view> +</template> + +<script> +import UIcon from "../../../uview-ui/components/u-icon/u-icon.vue"; + +export default { + components: {UIcon}, + data(){ + return{ + form:{ + type: '', + num: '', + value: '', + reportType: '' + }, + show:false, + actionSheetList:[], + rules: { + type: [ + { + required: true, + message: '璇烽�夋嫨绫诲瀷', + trigger: ['change'], + } + ], + num: [ + { + required: true, + message: '璇疯緭鍏ユ暟閲�', + trigger: ['change','blur'], + }, + // 姝e垯鍒ゆ柇鍙兘涓烘暟瀛� + { + validator: (rule, value, callback) => { + return this.$u.test.digits(value); + }, + message: '鍙兘涓烘暟瀛�', + trigger: ['change','blur'], + }, + ] + }, + loading:false, + info: {} + } + }, + onLoad(options) { + this.info = JSON.parse(decodeURIComponent(options.info)) + }, + methods:{ + actionSheetCallback(item){ + this.form.type = item[0].label + this.form.value = item[0].value + }, + submit(){ + this.$refs.uForm.validate(valid => { + if (valid) { + this.form.operationTaskId = this.info.id + this.form.workstationId = this.info.workstationId + this.form.reportType = this.info.workCenter === 'ZZ-03' ? 'CHENGTAO_PRODUCT_REPORT' : 'WAIKE_PRODUCT_REPORT' + let type ="" + + if(this.form.type ==="楂樺帇鏌�" ){ + type ="GY" + }else if(this.form.type ==="浣庡帇鏌�"){ + type ="DY" + }else{ + type ="XT" + } + + let param ={ + type: type, + num: this.form.num, + value: this.form.value, + reportType: this.form.reportType, + operationTaskId:this.form.operationTaskId, + workstationId:this.form.workstationId, + reportType:this.form.reportType + } + this.$u.api.dailyPaper.generateLabel(param).then(res => { + console.log(res) + if (res.code === 0) { + this.$u.toast('鎿嶄綔鎴愬姛') + this.loading = true; + uni.navigateBack({ + //鍏抽棴褰撳墠椤甸潰锛岃繑鍥炰笂涓�椤甸潰鎴栧绾ч〉闈€�� + delta:1 + }); + this.loading = false; + } + }) + } else { + console.log('楠岃瘉澶辫触'); + } + }); + }, + getCabinetType () { + this.$u.api.dictData({dictType: 'cabinet_type'}).then(res => { + if (res.code === 0 && res.data.length > 0) { + res.data.forEach(i => { + const obj = Object.assign({ + label: i.label, + value: i.value, + }) + this.actionSheetList.push(obj) + }) + } + }) + } + }, + onReady() { + this.$refs.uForm.setRules(this.rules); + this.actionSheetList = [] + // 杩涘叆椤甸潰鏌ヨ绫诲瀷鍒楄〃 + this.getCabinetType() + } +} +</script> + +<style lang="scss" scoped> +.tag-add{ + height: calc(100vh - 88rpx); + background: linear-gradient(to bottom, #E5F0FF, #FFF); + box-sizing: border-box; + padding-top: 32rpx; + .u-form{ + margin: 0 30rpx; + background: #FFFFFF; + border-radius: 10rpx; + padding: 20rpx 26rpx; + } + .btn{ + position: fixed; + bottom: 40rpx; + width: calc(100% - 60rpx); + } +} +::v-deep.uicon-arrow-down-fill:before { + display: none; +} +::v-deep.u-form-item--left__content__label { + width: 100rpx; + padding-left: 26rpx; + font-weight: 500; + font-size: 30rpx; + color: #4F4F4F; + line-height: 80rpx; +} +::v-deep.u-form-item--left__content--required { + left: 8rpx; + top: 0; +} +</style> -- Gitblit v1.9.3