form.vue 7.1 KB

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