| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285 |
- <template>
- <gui-page :custom-header="true" :header-class="['gui-theme-background-color']">
- <template #gHeader>
- <view style="height:44px;" class="gui-flex gui-nowrap gui-rows gui-align-items-center">
- <!-- 使用组件实现返回按钮及返回首页按钮 -->
- <text style="font-size:44rpx;" class="gui-header-leader-btns gui-color-white font-icons"
- @tap="goBack"></text>
- <!-- 导航文本此处也可以是其他自定义内容 -->
- <text
- class="gui-h4 gui-blod gui-flex1 gui-text-center gui-ellipsis gui-color-white gui-primary-text">后段工序</text>
- <!-- 此处加一个右侧展位元素与左侧同宽,实现标题居中 -->
- <!-- 实际宽度请根据自己情况设置 -->
- <view style="width:40px;" />
- <!-- 如果右侧有其他内容可以利用条件编译和定位来实现-->
- </view>
- </template>
- <template #gBody>
- <view class="form">
- <view class="form-item">
- <div class="title">标签码</div>
- <div class="scan-card">
- <uni-easyinput v-model="form.qrCode" class="easyinput" @focus="handleInputFocus" type="text"
- placeholder="请扫描标签码" />
- <text class="font-icons" style="font-size: 20px;" @click="handleScanLabel"></text>
- </div>
- </view>
- <view class="form-item">
- <div class="title">员工码</div>
- <div class="scan-card">
- <uni-easyinput v-model="form.employee" class="easyinput" @focus="handleInputFocus" type="text"
- placeholder="请扫描员工码" />
- <text class="font-icons" style="font-size: 20px;" @click="handleScanEmployee"></text>
- </div>
- </view>
- <view class="form-item">
- <div class="title">不良数</div>
- <div class="content">
- <uni-easyinput v-model="form.badQty" @focus="handleInputFocus" placeholder="请输入不良数"
- type="digit" />
- </div>
- </view>
- <view class="form-item">
- <div class="title">不良类型</div>
- <div class="content">
- <uni-data-select v-model="form.badType" placeholder="请选择不良类型" :localdata="selectList" />
- </div>
- </view>
- <view class="form-item">
- <div class="title">班别</div>
- <div class="content">
- <uni-data-select v-model="form.classFlag" placeholder="请选择班别" :localdata="classFlagList" />
- </div>
- </view>
- </view>
- <view class="operationBtn">
- <button type="primary" style="width: calc(100% - 8px);margin: 0 4px;"
- @click="handleSubmitData">提交</button>
- </view>
- </template>
- </gui-page>
- </template>
- <script>
- import {
- ref,
- onMounted,
- defineComponent
- } from 'vue'
- export default defineComponent({
- setup(options) {
- const selectList = ref([]);
- const form = ref({
- hotPressId: '',
- qrCode: '',
- employee: '',
- badQty: 0,
- badType: '',
- classFlag: '',
- })
- onMounted(() => {
- form.value.hotPressId = options?.hotPressId ?? '';
- uni.$reqGet('getDictDataPage', {
- dictType: 'mes_inspection_type',
- })
- .then(({
- data
- }) => {
- selectList.value = []
- const dataList = data?.list ?? [];
- for (var i = 0; i < dataList.length; i++) {
- selectList.value.push({
- text: dataList[i].label,
- value: dataList[i].value,
- })
- }
- })
- })
- // 扫描标签码
- const handleScanLabel = function() {
- // #ifdef APP-PLUS
- const mpaasScanModule = uni.requireNativePlugin('Mpaas-Scan-Module')
- mpaasScanModule.mpaasScan({
- // 扫码识别类型,参数可多选,qrCode、barCode,不设置,默认识别所有
- 'scanType': ['qrCode', 'barCode'],
- // 是否隐藏相册,默认false不隐藏
- 'hideAlbum': false
- },
- (ret) => {
- if (ret.resp_code === 1000) {
- form.value.qrCode = ret.resp_result;
- }
- })
- // #endif
- }
- // 扫描员工码
- const handleScanEmployee = function() {
- // #ifdef APP-PLUS
- const mpaasScanModule = uni.requireNativePlugin('Mpaas-Scan-Module')
- mpaasScanModule.mpaasScan({
- // 扫码识别类型,参数可多选,qrCode、barCode,不设置,默认识别所有
- 'scanType': ['qrCode', 'barCode'],
- // 是否隐藏相册,默认false不隐藏
- 'hideAlbum': false
- },
- (ret) => {
- if (ret.resp_code === 1000) {
- form.value.employee = ret.resp_result;
- }
- })
- // #endif
- }
- const goBack = function() {
- uni.$goBack('/pages/workbranch/production/processExecution/processDetails')
- }
- // 保存
- const handleSubmitData = function() {
- const { qrCode, employee, classFlag } = form.value
- if (qrCode === '' || employee === '' || classFlag === '') {
- uni.showToast({
- title: msg,
- icon: 'none',
- duration: 2000
- })
- return
- }
- uni.$reqPost('precessExecute', form.value)
- .then(({
- code,
- data,
- msg
- }) => {
- if (code === 0) {
- uni.showToast({
- title: '提交成功',
- icon: 'none',
- duration: 1000
- })
- setTimeout(() => {
- goBack()
- }, 1000)
- } else {
- uni.showToast({
- title: msg,
- icon: 'none',
- duration: 2000
- })
- }
- })
- }
- // 禁用软键盘
- const handleInputFocus = function() {
- // #ifdef APP-PLUS
- setTimeout(() => {
- uni.hideKeyboard()
- }, 100)
- // #endif
- }
- return {
- selectList,
- classFlagList: [{
- text: '白班',
- value: 0
- },
- {
- text: '晚班',
- value: 1
- }
- ],
- form,
- goBack,
- handleScanLabel,
- handleScanEmployee,
- handleInputFocus,
- handleSubmitData
- }
- }
- })
- </script>
- <style lang="scss" scoped>
- .gui-header-leader-btns {
- color: black;
- font-size: 24px !important;
- margin-left: 24rpx;
- }
- .list-content {
- background-color: #edeeee;
- }
- .form {
- margin-top: 80px;
- margin-bottom: 70px;
- font-size: 14px;
- padding: 4px 8px;
- border-radius: 4px;
- background-color: white;
- .form-title {
- height: 32px;
- line-height: 32px;
- text-align: center;
- font-size: 16px;
- font-weight: bold;
- border-bottom: 2px dashed #edeeee;
- }
- .form-item {
- .title {
- height: 32px;
- line-height: 32px;
- text-align: left;
- font-weight: bold;
- color: #333;
- }
- .content {
- height: 42px;
- line-height: 42px;
- margin: 0 0 6px 0;
- }
- .scan-card {
- width: 100%;
- position: relative;
- display: grid;
- grid-template-rows: 1fr;
- grid-template-columns: 1fr 30px;
- align-items: center;
- input {
- height: 35px;
- line-height: 35px;
- }
- text {
- // position: absolute;
- width: 30px;
- display: flex;
- justify-content: center;
- text-align: center;
- }
- }
- }
- }
- .font-icons {
- width: 40px;
- font-size: 20px;
- }
- .operationBtn {
- position: fixed;
- width: 100%;
- bottom: 0;
- padding: 12px 0;
- }
- </style>
|