| | |
| | | <template> |
| | | <view> |
| | | <view class="form-container"> |
| | | <form :modelValue="formData"> |
| | | <view class="form-group"> |
| | | <label class="form-label">首检单号:</label> |
| | | <input class="form-input" disabled="true" type="text" v-model="formData.billNo" /> |
| | | </view> |
| | | <view class="form-group"> |
| | | <label class="form-label">创建时间:</label> |
| | | <input class="form-input" disabled="true" type="text" v-model="formData.createTime" /> |
| | | </view> |
| | | <view class="uni-form-item uni-column form-item edit"> |
| | | <text class="form-label">生产线别:</text> |
| | | <superwei-combox v-if="isUpdate" :candidates="DAA020List" placeholder="请选择或输入" |
| | | v-model="formData.line" @select="onDaa020Change" class="picker form-input" |
| | | style="border: none;"></superwei-combox> |
| | | <input v-else class="form-input" disabled="true" type="text" v-model="formData.line" /> |
| | | </view> |
| | | <view class="uni-form-item uni-column form-item edit"> |
| | | <text class="form-label">物料编码:</text> |
| | | <superwei-combox v-if="isUpdate" :candidates="Daa002" placeholder="请选择或输入" v-model="formData.itemNo" |
| | | :isJSON="true" keyName="itemName" @select="onItemChange" class="picker form-input" |
| | | style="border: none;"></superwei-combox> |
| | | <input v-else class="form-input" disabled="true" type="text" v-model="formData.itemNo" /> |
| | | </view> |
| | | <view class="uni-form-item uni-column form-item edit"> |
| | | <text class="form-label">计划编号:</text> |
| | | <picker v-if="isUpdate" class="picker form-input" name="selector" :range="DAA001List" |
| | | @change="onDaa001Change"> |
| | | <text>{{ DAA001List[DAA001Index] }}</text> |
| | | </picker> |
| | | <input v-else class="form-input" disabled="true" type="text" v-model="formData.daa001" /> |
| | | </view> |
| | | <view class="form-group"> |
| | | <label class="form-label">产品名称:</label> |
| | | <input class="form-input" disabled="true" type="text" v-model="formData.daa003" /> |
| | | </view> |
| | | <view class="form-group"> |
| | | <label class="form-label">规格型号:</label> |
| | | <input class="form-input" disabled="true" type="text" v-model="formData.daa004" /> |
| | | </view> |
| | | <view class="form-group"> |
| | | <label class="form-label">工单数量:</label> |
| | | <input class="form-input" disabled="true" type="text" v-model="formData.daa008" /> |
| | | </view> |
| | | <view class="form-group"> |
| | | <label class="form-label">不合格描述:</label> |
| | | <input class="form-input" disabled="true" type="text" v-model="formData.remarks" /> |
| | | </view> |
| | | </form> |
| | | </view> |
| | | <view class="list-container"> |
| | | <uni-table ref="table" border emptyText="暂无更多数据"> |
| | | <uni-tr> |
| | | <uni-th align="center" class="th" style="color: #FFFFFF;">检验项目</uni-th> |
| | | <uni-th align="center" class="th" style="color: #FFFFFF">是否合格</uni-th> |
| | | <uni-th align="center" class="th" style="color: #FFFFFF">记录(点击)</uni-th> |
| | | </uni-tr> |
| | | <uni-tr v-for="(item, index) in tableData" :key="index"> |
| | | <uni-td align="center"> |
| | | <input class="form-input" disabled="true" type="text" v-model="item.projName" /> |
| | | </uni-td> |
| | | <uni-td align="center"> |
| | | <input class="form-input" disabled="true" type="text" v-model="item.result" /> |
| | | </uni-td> |
| | | <uni-td> |
| | | <view class="uni-group"> |
| | | <button v-if="item.isCheck >=item.levelNum" type="default" @click="toDetail(item)"> |
| | | {{ item.levelNum + '/' + item.isCheck }} |
| | | </button> |
| | | <button v-else type="warn" @click="toDetail(item)"> |
| | | {{ item.levelNum + '/' + item.isCheck }}</button> |
| | | </view> |
| | | </uni-td> |
| | | </uni-tr> |
| | | </uni-table> |
| | | </view> |
| | | <view class="plus-button"> |
| | | |
| | | <view class="plus-button"> |
| | | <button type="warn" v-if="!isUpdate && !isShowTable" @click="submit">审核单据</button> |
| | | <view class="page-container"> |
| | | <view class="form-container card"> |
| | | <view class="card-header"> |
| | | <text class="card-title">首检单信息</text> |
| | | </view> |
| | | <button type="warn" v-if="isUpdate && !isShowTable" @click="save">创建检验单并生成部分默认值</button> |
| | | </view> |
| | | <view class="plus-button"> |
| | | <button type="warn" v-if="!isUpdate && !isShowTable" @click="toImage">上传/查看图片</button> |
| | | </view> |
| | | <!--<view class="plus-button"> |
| | | <button type="warn" v-if="!isUpdate && formData.result == '未完成' && !isShowTable" @click="removeXJ">删除单据 |
| | | </button> |
| | | </view>--> |
| | | <view class="plus-button"> |
| | | <button type="warn" v-if="!isUpdate && !isShowTable" @click="saveRemarks">添加不合格描述</button> |
| | | </view> |
| | | <view class="plus-button"> |
| | | <button type="warn" v-if="isShowTable" @click="getTable">获取检验项目</button> |
| | | </view> |
| | | <view class="plus-button"> |
| | | <button type="warn" v-if="isShowTable && isUpdate" @click="saveTable">生成检验项目</button> |
| | | </view> |
| | | <view v-if="remarksPopup" class="overlay"> |
| | | <view class="popup"> |
| | | <h3>修改不合格描述</h3> |
| | | <form> |
| | | <view class="card-body"> |
| | | <form :modelValue="formData"> |
| | | <view class="form-group"> |
| | | <label class="form-label">首检单号:</label> |
| | | <input class="form-input" disabled="true" type="text" v-model="formData.billNo" /> |
| | | </view> |
| | | <view class="form-group"> |
| | | <label class="form-label">创建时间:</label> |
| | | <input class="form-input" disabled="true" type="text" v-model="formData.createTime" /> |
| | | </view> |
| | | <view class="uni-form-item uni-column form-item edit"> |
| | | <text class="form-label">生产线别:</text> |
| | | <superwei-combox v-if="isUpdate" :candidates="DAA020List" placeholder="请选择或输入" |
| | | v-model="formData.line" @select="onDaa020Change" class="picker form-input" |
| | | style="border: none;"></superwei-combox> |
| | | <input v-else class="form-input" disabled="true" type="text" v-model="formData.line" /> |
| | | </view> |
| | | <view class="uni-form-item uni-column form-item edit"> |
| | | <text class="form-label">物料编码:</text> |
| | | <superwei-combox v-if="isUpdate" :candidates="Daa002" placeholder="请选择或输入" v-model="formData.itemNo" |
| | | :isJSON="true" keyName="itemName" @select="onItemChange" class="picker form-input" |
| | | style="border: none;"></superwei-combox> |
| | | <input v-else class="form-input" disabled="true" type="text" v-model="formData.itemNo" /> |
| | | </view> |
| | | <view class="uni-form-item uni-column form-item edit"> |
| | | <text class="form-label">计划编号:</text> |
| | | <picker v-if="isUpdate" class="picker form-input" name="selector" :range="DAA001List" |
| | | @change="onDaa001Change"> |
| | | <text>{{ DAA001List[DAA001Index] }}</text> |
| | | </picker> |
| | | <input v-else class="form-input" disabled="true" type="text" v-model="formData.daa001" /> |
| | | </view> |
| | | <view class="form-group"> |
| | | <label class="form-label">产品名称:</label> |
| | | <input class="form-input" disabled="true" type="text" v-model="formData.daa003" /> |
| | | </view> |
| | | <view class="form-group"> |
| | | <label class="form-label">规格型号:</label> |
| | | <input class="form-input" disabled="true" type="text" v-model="formData.daa004" /> |
| | | </view> |
| | | <view class="form-group"> |
| | | <label class="form-label">工单数量:</label> |
| | | <input class="form-input" disabled="true" type="text" v-model="formData.daa008" /> |
| | | </view> |
| | | <view class="form-group"> |
| | | <label class="form-label">不合格描述:</label> |
| | | <input class="form-input" type="text" v-model="remarks" /> |
| | | <input class="form-input" disabled="true" type="text" v-model="formData.remarks" /> |
| | | </view> |
| | | <button type="warn" @click="editRemarks">修改</button> |
| | | <button @click="remarksPopup = !remarksPopup">取消</button> |
| | | </form> |
| | | </view> |
| | | </view> |
| | | |
| | | <view class="list-container card"> |
| | | <view class="card-header"> |
| | | <text class="card-title">检验项目列表</text> |
| | | </view> |
| | | <view class="card-body"> |
| | | <uni-table ref="table" border emptyText="暂无更多数据"> |
| | | <uni-tr class="table-header"> |
| | | <uni-th align="center" class="th">检验项目</uni-th> |
| | | <uni-th align="center" class="th">是否合格</uni-th> |
| | | <uni-th align="center" class="th">记录</uni-th> |
| | | </uni-tr> |
| | | <uni-tr v-for="(item, index) in tableData" :key="index" class="table-row" :class="{'table-row-alt': index % 2 === 1}"> |
| | | <uni-td align="center"> |
| | | <input class="form-input" disabled="true" type="text" v-model="item.projName" /> |
| | | </uni-td> |
| | | <uni-td align="center"> |
| | | <span :class="getResultClass(item.result)">{{ item.result }}</span> |
| | | </uni-td> |
| | | <uni-td> |
| | | <view class="action-buttons"> |
| | | <button v-if="item.isCheck >= item.levelNum" type="default" @click="toDetail(item)" class="btn btn-success"> |
| | | {{ item.levelNum + '/' + item.isCheck }} |
| | | </button> |
| | | <button v-else type="warn" @click="toDetail(item)" class="btn btn-warning"> |
| | | {{ item.levelNum + '/' + item.isCheck }} |
| | | </button> |
| | | </view> |
| | | </uni-td> |
| | | </uni-tr> |
| | | </uni-table> |
| | | </view> |
| | | </view> |
| | | |
| | | <view class="action-buttons-container"> |
| | | <view class="button-row"> |
| | | <button type="warn" v-if="!isUpdate && !isShowTable" @click="submit" class="btn btn-primary"> |
| | | 审核单据 |
| | | </button> |
| | | </view> |
| | | <view class="button-row"> |
| | | <button type="warn" v-if="isUpdate && !isShowTable" @click="save" class="btn btn-primary"> |
| | | 创建检验单并生成部分默认值 |
| | | </button> |
| | | </view> |
| | | <view class="button-row"> |
| | | <button type="warn" v-if="!isUpdate && !isShowTable" @click="toImage" class="btn btn-primary"> |
| | | 上传/查看图片 |
| | | </button> |
| | | </view> |
| | | <view class="button-row"> |
| | | <!--<button type="warn" v-if="!isUpdate && formData.result == '未完成' && !isShowTable" @click="removeXJ" class="btn btn-danger"> |
| | | 删除单据 |
| | | </button>--> |
| | | </view> |
| | | <view class="button-row"> |
| | | <button type="warn" v-if="!isUpdate && !isShowTable" @click="saveRemarks" class="btn btn-primary"> |
| | | 添加不合格描述 |
| | | </button> |
| | | </view> |
| | | <view class="button-row"> |
| | | <button type="warn" v-if="isShowTable" @click="getTable" class="btn btn-primary"> |
| | | 获取检验项目 |
| | | </button> |
| | | </view> |
| | | <view class="button-row"> |
| | | <button type="warn" v-if="isShowTable && isUpdate" @click="saveTable" class="btn btn-primary"> |
| | | 生成检验项目 |
| | | </button> |
| | | </view> |
| | | </view> |
| | | |
| | | <view v-if="remarksPopup" class="overlay"> |
| | | <view class="popup card"> |
| | | <view class="popup-header"> |
| | | <h3 class="popup-title">修改不合格描述</h3> |
| | | </view> |
| | | <view class="popup-body"> |
| | | <form> |
| | | <view class="form-group"> |
| | | <label class="form-label">不合格描述:</label> |
| | | <input class="form-input" type="text" v-model="remarks" /> |
| | | </view> |
| | | <view class="popup-actions"> |
| | | <button type="warn" @click="editRemarks" class="btn btn-primary"> |
| | | 修改 |
| | | </button> |
| | | <button @click="remarksPopup = !remarksPopup" class="btn btn-secondary"> |
| | | 取消 |
| | | </button> |
| | | </view> |
| | | </form> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | data() { |
| | |
| | | } |
| | | }, |
| | | |
| | | submit() { |
| | | this.$post({ |
| | | url: "/SJ/SJQaSubmit", |
| | | data: { |
| | | userNo: this.$loginInfo.account, |
| | | gid: this.formData.id |
| | | } |
| | | }).then(res => { |
| | | |
| | | //2024-11-28 kyy 校验合格提交增加提示 |
| | | console.log("Status Code的值:", res.statusCode); |
| | | if (res.statusCode === 200) { |
| | | |
| | | this.$showMessage("成功提交检验"); |
| | | // 使用setTimeout在7秒后隐藏消息 |
| | | setTimeout(() => { |
| | | this.hideCustomMessage(); |
| | | }, 7000); // 7000毫秒等于7秒 |
| | | } else { |
| | | this.$showMessage(res.data.message); |
| | | } |
| | | }) |
| | | }, |
| | | submit() { |
| | | this.$post({ |
| | | url: "/SJ/SJQaSubmit", |
| | | data: { |
| | | userNo: this.$loginInfo.account, |
| | | gid: this.formData.id |
| | | } |
| | | }).then(res => { |
| | | console.log("后端返回结果:", res); |
| | | |
| | | // 根据后端实际返回的status字段判断 |
| | | if (res.status === 0) { // 后端status=0表示成功 |
| | | this.$showMessage("成功提交检验"); |
| | | |
| | | // 7秒后隐藏消息 |
| | | setTimeout(() => { |
| | | this.hideCustomMessage(); |
| | | }, 7000); |
| | | } else { |
| | | // 失败时显示后端返回的错误信息 |
| | | this.$showMessage(res.message || "提交失败,请重试"); |
| | | } |
| | | }).catch(error => { |
| | | // 处理网络错误或异常 |
| | | console.error("提交请求失败:", error); |
| | | this.$showMessage("网络请求失败,请检查网络连接"); |
| | | }); |
| | | }, |
| | | |
| | | init() { |
| | | if (this.formData.id) { |
| | |
| | | uni.navigateTo({ |
| | | url: 'ImageItem?id=' + this.formData.id |
| | | }); |
| | | }, |
| | | // 添加用于获取结果状态样式的方法 |
| | | getResultClass(result) { |
| | | if (result === '合格') return 'result-success'; |
| | | if (result === '不合格') return 'result-fail'; |
| | | return 'result-pending'; |
| | | } |
| | | }, |
| | | onShow() { |
| | |
| | | </script> |
| | | |
| | | <style> |
| | | /* 全局样式 */ |
| | | :root { |
| | | --primary-color: #165DFF; |
| | | --success-color: #00B42A; |
| | | --warning-color: #FF7D00; |
| | | --danger-color: #F53F3F; |
| | | --bg-color: #F2F3F5; |
| | | --card-bg: #FFFFFF; |
| | | --text-color: #333333; |
| | | --text-secondary: #666666; |
| | | --border-color: #E5E6EB; |
| | | --border-radius: 8px; |
| | | --shadow: 0 2px 8px rgba(0, 0, 0, 0.08); |
| | | } |
| | | |
| | | /* 页面容器 */ |
| | | .page-container { |
| | | padding: 16px; |
| | | background-color: var(--bg-color); |
| | | min-height: 100vh; |
| | | } |
| | | |
| | | /* 卡片组件 */ |
| | | .card { |
| | | background-color: var(--card-bg); |
| | | border-radius: var(--border-radius); |
| | | box-shadow: var(--shadow); |
| | | margin-bottom: 16px; |
| | | overflow: hidden; |
| | | } |
| | | |
| | | .card-header { |
| | | padding: 16px; |
| | | background-color: #F7F8FA; |
| | | border-bottom: 1px solid var(--border-color); |
| | | } |
| | | |
| | | .card-title { |
| | | font-size: 18px; |
| | | font-weight: 600; |
| | | color: var(--text-color); |
| | | } |
| | | |
| | | .card-body { |
| | | padding: 16px; |
| | | } |
| | | |
| | | /* 表单样式 */ |
| | | .form-group { |
| | | display: flex; |
| | | align-items: center; |
| | | border-bottom: 1px solid #c9c9c9; |
| | | padding: 12px 0; |
| | | border-bottom: 1px solid #F2F3F5; |
| | | } |
| | | |
| | | .form-group:last-child { |
| | | border-bottom: none; |
| | | } |
| | | |
| | | .form-label { |
| | | margin-bottom: 0; |
| | | padding: 5px; |
| | | width: 100px; |
| | | font-size: 14px; |
| | | color: var(--text-secondary); |
| | | margin-right: 12px; |
| | | } |
| | | |
| | | .form-input { |
| | | flex: 1; |
| | | margin-bottom: 0; |
| | | padding: 5px; |
| | | height: 36px; |
| | | padding: 0 12px; |
| | | border: 1px solid var(--border-color); |
| | | border-radius: 4px; |
| | | font-size: 14px; |
| | | color: var(--text-color); |
| | | } |
| | | |
| | | .form-input:disabled { |
| | | background-color: #F7F8FA; |
| | | color: #999999; |
| | | } |
| | | |
| | | .picker { |
| | | flex: 1; |
| | | margin-bottom: 0; |
| | | padding: 5px; |
| | | font-size: 12px; |
| | | height: 36px; |
| | | padding: 0 12px; |
| | | border: 1px solid var(--border-color); |
| | | border-radius: 4px; |
| | | font-size: 14px; |
| | | color: var(--text-color); |
| | | } |
| | | |
| | | .uni-form-item { |
| | | display: flex; |
| | | border-bottom: 1px solid #c9c9c9; |
| | | /* 表格样式 */ |
| | | .uni-table { |
| | | width: 100%; |
| | | border-collapse: collapse; |
| | | } |
| | | |
| | | .edit { |
| | | background-color: white; |
| | | } |
| | | |
| | | /* 默认样式 */ |
| | | .list-container { |
| | | height: 60vh; |
| | | /* 设置列表容器的高度为剩余空间,并减去表单容器的高度 */ |
| | | overflow-y: auto; |
| | | /* 允许列表容器垂直滚动 */ |
| | | padding: 10px; |
| | | /* 可选:添加一些内边距,使列表内容更美观 */ |
| | | } |
| | | |
| | | /* 在小屏幕设备上,重置高度为适应屏幕 */ |
| | | @media (max-width: 768px) { |
| | | .list-container { |
| | | height: calc(100vh - 376px); |
| | | /* 适当调整高度 */ |
| | | } |
| | | } |
| | | |
| | | |
| | | .form-container { |
| | | padding: 10px; |
| | | /* 可选:添加一些内边距,使表单内容更美观 */ |
| | | .table-header { |
| | | background-color: var(--primary-color); |
| | | } |
| | | |
| | | .th { |
| | | background-color: lightskyblue; |
| | | padding: 12px; |
| | | color: #FFFFFF; |
| | | font-weight: 500; |
| | | text-align: center; |
| | | } |
| | | |
| | | .table-row { |
| | | border-bottom: 1px solid var(--border-color); |
| | | } |
| | | |
| | | .plus-button { |
| | | line-height: 59px; |
| | | font-size: 24px; |
| | | .table-row-alt { |
| | | background-color: #F9FAFC; |
| | | } |
| | | |
| | | .uni-td { |
| | | padding: 12px; |
| | | text-align: center; |
| | | } |
| | | |
| | | .result-success { |
| | | color: var(--success-color); |
| | | font-weight: bold; |
| | | } |
| | | |
| | | .result-fail { |
| | | color: var(--danger-color); |
| | | font-weight: bold; |
| | | } |
| | | |
| | | .result-pending { |
| | | color: var(--warning-color); |
| | | font-weight: bold; |
| | | } |
| | | |
| | | /* 按钮样式 */ |
| | | .btn { |
| | | width: 100%; |
| | | height: 44px; |
| | | border-radius: 4px; |
| | | font-size: 16px; |
| | | font-weight: 500; |
| | | cursor: pointer; |
| | | z-index: 1000; |
| | | margin-bottom: 10px; |
| | | transition: background-color 0.2s; |
| | | } |
| | | |
| | | .btn-primary { |
| | | background-color: var(--primary-color); |
| | | color: #FFFFFF; |
| | | border: none; |
| | | } |
| | | |
| | | .btn-primary:hover { |
| | | background-color: #0E42D2; |
| | | } |
| | | |
| | | .btn-success { |
| | | background-color: var(--success-color); |
| | | color: #FFFFFF; |
| | | border: none; |
| | | } |
| | | |
| | | .btn-warning { |
| | | background-color: var(--warning-color); |
| | | color: #FFFFFF; |
| | | border: none; |
| | | } |
| | | |
| | | .btn-secondary { |
| | | background-color: #F2F3F5; |
| | | color: var(--text-color); |
| | | border: 1px solid var(--border-color); |
| | | } |
| | | |
| | | .btn-secondary:hover { |
| | | background-color: #E5E6EB; |
| | | } |
| | | |
| | | .action-buttons-container { |
| | | padding: 16px; |
| | | } |
| | | |
| | | .button-row { |
| | | margin-bottom: 12px; |
| | | } |
| | | |
| | | /* 弹窗样式 */ |
| | | .overlay { |
| | | position: fixed; |
| | | top: 0; |
| | |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | z-index: 1000; |
| | | } |
| | | |
| | | .popup { |
| | | background-color: #fff; |
| | | padding: 20px; |
| | | border: 1px solid #ccc; |
| | | box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); |
| | | width: 68vw; |
| | | /* 设置宽度为视口宽度的80% */ |
| | | height: 25vh; |
| | | /* 设置高度为视口高度的80% */ |
| | | width: 90%; |
| | | max-width: 500px; |
| | | max-height: 80vh; |
| | | overflow-y: auto; |
| | | } |
| | | </style> |
| | | |
| | | .popup-header { |
| | | padding: 16px; |
| | | border-bottom: 1px solid var(--border-color); |
| | | } |
| | | |
| | | .popup-title { |
| | | font-size: 18px; |
| | | font-weight: 600; |
| | | text-align: center; |
| | | } |
| | | |
| | | .popup-body { |
| | | padding: 16px; |
| | | } |
| | | |
| | | .popup-actions { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | margin-top: 20px; |
| | | } |
| | | |
| | | /* 响应式设计 */ |
| | | @media (max-width: 768px) { |
| | | .page-container { |
| | | padding: 8px; |
| | | } |
| | | |
| | | .card { |
| | | margin-bottom: 8px; |
| | | } |
| | | |
| | | .card-header, .card-body, .popup-header, .popup-body { |
| | | padding: 12px; |
| | | } |
| | | |
| | | .form-label { |
| | | width: 80px; |
| | | font-size: 13px; |
| | | } |
| | | |
| | | .form-input, .picker, .btn { |
| | | height: 40px; |
| | | font-size: 14px; |
| | | } |
| | | |
| | | .popup { |
| | | width: 96%; |
| | | } |
| | | } |
| | | </style> |