form.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  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 class="answer">
  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. onShow(() => {
  77. })
  78. /***************************** 定义了一些方法 *****************************/
  79. const addUnfitInfo = (data) => {
  80. const info = {
  81. title: data.title,
  82. standard: data.standard,
  83. result: '',
  84. number: 1
  85. }
  86. unfitInfos.value.push(info)
  87. }
  88. const addConsultation = (data) => {
  89. const info = {
  90. question: data.title,
  91. answer: ''
  92. }
  93. unfitInfos.value.push(info)
  94. }
  95. /***************************** 定义了一些事件 *****************************/
  96. // 添加不合格信息
  97. const handleAddUnfit = () => {
  98. // 监听事件
  99. uni.$once('addUnfitInfoEvent',(data)=>{
  100. addUnfitInfo(data)
  101. })
  102. uni.navigateTo({
  103. url: "/pages/sorting/options"
  104. })
  105. }
  106. // 删除不合格信息
  107. const handleDelUnfit = (index) => {
  108. uni.showModal({
  109. title: '提示',
  110. content: '确定删除该项?',
  111. success: function (res) {
  112. if (res.confirm) {
  113. unfitInfos.value.splice(index, 1)
  114. } else if (res.cancel) {
  115. return
  116. }
  117. }
  118. })
  119. }
  120. // 添加不合格信息
  121. const handleAddConsultation = () => {
  122. // 监听事件
  123. uni.$once('addConsulttationEvent',(data)=>{
  124. addConsultation(data)
  125. })
  126. uni.navigateTo({
  127. url: "/pages/sorting/consultation"
  128. })
  129. }
  130. </script>
  131. <style lang="scss">
  132. .page-container {
  133. height: 100%;
  134. background-color: #ececec;
  135. font-size: 28rpx;
  136. > .title {
  137. font-weight: 700;
  138. margin: 24rpx 16rpx;
  139. }
  140. }
  141. .lot-info {
  142. margin: 32rpx 16rpx 0 16rpx;
  143. padding: 24rpx;
  144. background-color: #ffffff;
  145. border-radius: 8rpx;
  146. .lot-code {
  147. font-size: 32rpx;
  148. font-weight: 700;
  149. margin-bottom: 16rpx;
  150. }
  151. .product-info {
  152. font-size: 28rpx;
  153. color: #9f9f9f;
  154. }
  155. }
  156. .unfit-title {
  157. margin-bottom: 24rpx;
  158. justify-content: space-between;
  159. align-items: center;
  160. text {
  161. font-size: 28rpx;
  162. font-weight: 700;
  163. }
  164. .add-btn {
  165. padding: 12rpx 32rpx;
  166. background-color: #a4adb3;
  167. color: #ffffff;
  168. border-radius: 12rpx;
  169. font-size: 24rpx;
  170. }
  171. }
  172. .unfit-container {
  173. padding: 24rpx;
  174. margin: 0 16rpx;
  175. background-color: #ffffff;
  176. border-radius: 12rpx;
  177. .unfit-item-container {
  178. position: relative;
  179. > * {
  180. margin-bottom: 24rpx;
  181. }
  182. .title {
  183. font-weight: 700;
  184. justify-content: space-between;
  185. align-items: center;
  186. image {
  187. width: 40rpx;
  188. height: 40rpx;
  189. }
  190. }
  191. .standard {
  192. }
  193. .result {
  194. align-items: center;
  195. border-bottom: 1px solid #9f9f9f;
  196. padding-bottom: 32rpx;
  197. .label {
  198. flex: 1;
  199. }
  200. input {
  201. width: 280rpx;
  202. height: 56rpx;
  203. border: 1px solid #9f9f9f;
  204. font-size: 28rpx;
  205. &.number {
  206. width: 104rpx;
  207. text-align: center;
  208. }
  209. }
  210. }
  211. }
  212. .unfit-item-container:last-child {
  213. .result {
  214. border-bottom: none;
  215. padding-bottom: 0;
  216. }
  217. }
  218. }
  219. .consultation-container {
  220. margin: 0 16rpx;
  221. padding: 24rpx;
  222. background-color: #ffffff;
  223. border-radius: 8rpx;
  224. .question, .answer {
  225. .label {
  226. justify-content: space-between;
  227. margin-bottom: 16rpx;
  228. font-weight: 700;
  229. }
  230. .content {
  231. line-height: 40rpx;
  232. }
  233. }
  234. .answer {
  235. margin-top: 24rpx;
  236. }
  237. }
  238. .daywork-container {
  239. margin-top: 24rpx;
  240. padding: 24rpx;
  241. background-color: #ffffff;
  242. border: 1px solid #bcbcbc;
  243. .result {
  244. align-items: center;
  245. .label {
  246. width: 112rpx;
  247. }
  248. input {
  249. flex: 1;
  250. height: 56rpx;
  251. border: 1px solid #9f9f9f;
  252. font-size: 28rpx;
  253. text-align: center;
  254. }
  255. }
  256. .remark {
  257. margin-top: 24rpx;
  258. .label {
  259. width: 112rpx;
  260. }
  261. textarea {
  262. flex: 1;
  263. border: 1px solid #9f9f9f;
  264. height: 168rpx;
  265. }
  266. }
  267. .btns-container {
  268. margin-top: 24rpx;
  269. .finished-btn {
  270. display: flex;
  271. flex: 1;
  272. height: 80rpx;
  273. background-color: #fc6565;
  274. color: #ffffff;
  275. text-align: center;
  276. justify-content: center;
  277. align-items: center;
  278. border-radius: 8rpx;
  279. }
  280. .question-btn {
  281. width: 80rpx;
  282. align-items: flex-end;
  283. image {
  284. width: 48rpx;
  285. height: 48rpx;
  286. }
  287. text {
  288. font-size: 24rpx;
  289. }
  290. }
  291. }
  292. }
  293. </style>