form.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. <template>
  2. <view class="page-container uni-column">
  3. <view class="carrier-info uni-column">
  4. <view class="carrier-code uni-row">
  5. <text>箱号</text>
  6. <text style="margin-left: 24rpx;">D2423156000691</text>
  7. </view>
  8. <view class="info-row uni-row">
  9. <view class="label">批次号</view>
  10. <view class="value">{{ data.lot_code }}</view>
  11. </view>
  12. <view class="info-row uni-row">
  13. <view class="label">产品描述</view>
  14. <view class="value">{{ data.product_description }}</view>
  15. </view>
  16. <view class="info-row uni-row">
  17. <view class="label">当前工序</view>
  18. <view class="value">{{ data.current_process }}</view>
  19. </view>
  20. <view class="info-row uni-row">
  21. <view class="label">投产数量</view>
  22. <view class="value">{{ data.production_quantity }}</view>
  23. </view>
  24. </view>
  25. <!-- 废品信息 -->
  26. <view class="title unfit-title uni-row">
  27. <text>废品信息</text>
  28. <view class="add-btn" @click="handleAddWaste">添加</view>
  29. </view>
  30. <view class="unfit-container">
  31. <view class="unfit-item-container uni-column" v-for="(item, index) in unfitInfos" :key="index">
  32. <view class="title uni-row">
  33. <text>检查项-{{ item.title }}</text>
  34. <uni-icons type="trash" size="24" color="#fc6565" @click="handleDelWaste(index)" />
  35. </view>
  36. <view class="standard">检查标准:{{ item.standard }}</view>
  37. <view class="result uni-row">
  38. <view class="label">检查结果</view>
  39. <input v-model="item.result" placeholder="请输入检查结果" />
  40. <view class="label" style="text-align: right; padding-right: 16rpx;">数量</view>
  41. <input class="number" type="number" v-model="item.number" placeholder="" />
  42. </view>
  43. </view>
  44. </view>
  45. <!-- 咨询部分 -->
  46. <view class="title">咨询</view>
  47. <view class="consultation-container uni-column">
  48. <view class="consultation-item-container" v-for="(item, index) in consultations" :key="index">
  49. <view class="question uni-column">
  50. <view class="label uni-row">
  51. <text>问题描述</text>
  52. <text style="color: #fcab53">{{ item.answer === '' ? '待回复' : '已回复' }}</text>
  53. </view>
  54. <view class="content">{{ item.question }}</view>
  55. </view>
  56. <view v-if="item.answer !== ''" class="answer" style="margin-top: 24rpx; padding-top: 24rpx; border-top: 1px dotted #aaaaaa;">
  57. <view class="label">回复</view>
  58. <view class="content">{{ item.answer }}</view>
  59. </view>
  60. </view>
  61. </view>
  62. <!-- 报工部分 -->
  63. <view class="daywork-container">
  64. <view class="result uni-row">
  65. <view class="label">检测量</view>
  66. <input type="number" placeholder="请输入检测量" />
  67. <view class="label" style="text-align: right; padding-right: 24rpx">废品量</view>
  68. <input type="number" placeholder="请输入废品量" />
  69. </view>
  70. <view class="remark uni-row">
  71. <view class="label">备注</view>
  72. <textarea />
  73. </view>
  74. <view class="btns-container uni-row">
  75. <view class="finished-btn">结束报工</view>
  76. <view class="question-btn uni-column" @click.stop="handleAddConsultation">
  77. <uni-icons type="headphones" size="24" />
  78. <text>咨询</text>
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. </template>
  84. <script setup>
  85. import { ref } from 'vue'
  86. import { onLoad, onReady, onUnload, onShow } from '@dcloudio/uni-app'
  87. const data = ref({
  88. lot_code: 'D2423156000691',
  89. current_process: '热处理',
  90. product_description: '产品描述',
  91. production_quantity: 300
  92. })
  93. const unfitInfos = ref([])
  94. const consultations = ref([])
  95. /***************************** 页面生命周期函数 *****************************/
  96. onShow(() => {
  97. })
  98. /***************************** 定义了一些方法 *****************************/
  99. const addWasteInfo = (data) => {
  100. const info = {
  101. title: data.title,
  102. standard: data.standard
  103. }
  104. unfitInfos.value.push(info)
  105. }
  106. const addConsultation = (data) => {
  107. const info = {
  108. question: data.question,
  109. answer: '123'
  110. }
  111. consultations.value.push(info)
  112. }
  113. /***************************** 定义了一些事件 *****************************/
  114. // 添加不合格信息
  115. const handleAddWaste = () => {
  116. // 监听事件
  117. uni.$once('addWasteInfoEvent',(data)=>{
  118. addWasteInfo(data)
  119. })
  120. uni.navigateTo({
  121. url: "/pages/processInspection/options"
  122. })
  123. }
  124. // 删除不合格信息
  125. const handleDelWaste = (index) => {
  126. uni.showModal({
  127. title: '提示',
  128. content: '确定删除该项?',
  129. success: function (res) {
  130. if (res.confirm) {
  131. unfitInfos.value.splice(index, 1)
  132. } else if (res.cancel) {
  133. return
  134. }
  135. }
  136. })
  137. }
  138. // 添加不合格信息
  139. const handleAddConsultation = () => {
  140. // 监听事件
  141. uni.$once('addWasteConsultationEvent',(data)=>{
  142. addConsultation(data)
  143. })
  144. uni.navigateTo({
  145. url: "/pages/processInspection/consultation"
  146. })
  147. }
  148. </script>
  149. <style lang="scss">
  150. .page-container {
  151. height: 100%;
  152. background-color: #ececec;
  153. font-size: 28rpx;
  154. > .title {
  155. font-weight: 700;
  156. margin: 24rpx 16rpx;
  157. }
  158. }
  159. .carrier-info {
  160. margin: 32rpx 16rpx 0 16rpx;
  161. padding: 24rpx;
  162. background-color: #ffffff;
  163. border-radius: 8rpx;
  164. .carrier-code {
  165. font-size: 32rpx;
  166. font-weight: 700;
  167. }
  168. .info-row {
  169. margin-top: 16rpx;
  170. color: #767676;
  171. .label {
  172. width: 160rpx;
  173. }
  174. .value {
  175. flex: 1;
  176. textarea {
  177. flex: 1;
  178. border: 1px solid #888888;
  179. box-sizing: border-box;
  180. padding: 16rpx;
  181. }
  182. }
  183. }
  184. }
  185. .unfit-title {
  186. margin-bottom: 24rpx;
  187. justify-content: space-between;
  188. align-items: center;
  189. text {
  190. font-size: 28rpx;
  191. font-weight: 700;
  192. }
  193. .add-btn {
  194. padding: 12rpx 32rpx;
  195. background-color: #a4adb3;
  196. color: #ffffff;
  197. border-radius: 12rpx;
  198. font-size: 24rpx;
  199. }
  200. }
  201. .unfit-container {
  202. padding: 24rpx;
  203. margin: 0 16rpx;
  204. background-color: #ffffff;
  205. border-radius: 12rpx;
  206. .unfit-item-container {
  207. position: relative;
  208. > * {
  209. margin-bottom: 24rpx;
  210. }
  211. .title {
  212. font-weight: 700;
  213. justify-content: space-between;
  214. align-items: center;
  215. image {
  216. width: 40rpx;
  217. height: 40rpx;
  218. }
  219. }
  220. .standard {
  221. }
  222. .result {
  223. align-items: center;
  224. border-bottom: 1px solid #9f9f9f;
  225. padding-bottom: 32rpx;
  226. .label {
  227. flex: 1;
  228. }
  229. input {
  230. width: 280rpx;
  231. height: 56rpx;
  232. border: 1px solid #9f9f9f;
  233. font-size: 28rpx;
  234. &.number {
  235. width: 104rpx;
  236. text-align: center;
  237. }
  238. }
  239. }
  240. }
  241. .unfit-item-container:last-child {
  242. .result {
  243. border-bottom: none;
  244. padding-bottom: 0;
  245. }
  246. }
  247. }
  248. .consultation-container {
  249. margin: 0 16rpx;
  250. padding: 24rpx;
  251. background-color: #ffffff;
  252. border-radius: 8rpx;
  253. .consultation-item-container {
  254. margin-bottom: 24rpx;
  255. border-bottom: 2px solid #888888;
  256. padding-bottom: 24rpx;
  257. }
  258. .consultation-item-container:last-child {
  259. margin-bottom: 0;
  260. border-bottom: 0;
  261. padding-bottom: 0;
  262. }
  263. .question, .answer {
  264. .label {
  265. justify-content: space-between;
  266. margin-bottom: 16rpx;
  267. font-weight: 700;
  268. }
  269. .content {
  270. line-height: 40rpx;
  271. }
  272. }
  273. .answer {
  274. margin-top: 24rpx;
  275. }
  276. }
  277. .daywork-container {
  278. margin-top: 24rpx;
  279. padding: 24rpx;
  280. background-color: #ffffff;
  281. border: 1px solid #bcbcbc;
  282. .result {
  283. align-items: center;
  284. .label {
  285. width: 112rpx;
  286. }
  287. input {
  288. flex: 1;
  289. height: 56rpx;
  290. border: 1px solid #9f9f9f;
  291. font-size: 28rpx;
  292. text-align: center;
  293. }
  294. }
  295. .remark {
  296. margin-top: 24rpx;
  297. .label {
  298. width: 112rpx;
  299. }
  300. textarea {
  301. flex: 1;
  302. border: 1px solid #9f9f9f;
  303. height: 168rpx;
  304. }
  305. }
  306. .btns-container {
  307. margin-top: 24rpx;
  308. .finished-btn {
  309. display: flex;
  310. flex: 1;
  311. height: 80rpx;
  312. background-color: #fc6565;
  313. color: #ffffff;
  314. text-align: center;
  315. justify-content: center;
  316. align-items: center;
  317. border-radius: 8rpx;
  318. }
  319. .question-btn {
  320. width: 80rpx;
  321. align-items: flex-end;
  322. image {
  323. width: 48rpx;
  324. height: 48rpx;
  325. }
  326. text {
  327. font-size: 24rpx;
  328. }
  329. }
  330. }
  331. }
  332. </style>