readCheck.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <template>
  2. <div>
  3. <div id="sampleReport">
  4. <el-descriptions title="农产品质量安全检测单" :column="2" border style="margin-top:20px">
  5. <el-descriptions-item label="抽样单编号" prop="jcd_unit.jcd_code" style="width:200px" class="labelItem" size="mini" required >
  6. {{jcd_unit.jcd_code}}
  7. </el-descriptions-item>
  8. <el-descriptions-item label="检测结果" prop="jcd_unit.jcd_result" style="width:200px" class="labelItem" size="mini" required >
  9. {{jcd_unit.jcd_result}}
  10. </el-descriptions-item>
  11. <el-descriptions-item label="附件链接" prop="jcd_unit.file_url" style="width:200px" class="labelItem" size="mini" required >
  12. {{jcd_unit.file_url}}
  13. </el-descriptions-item>
  14. <el-descriptions-item label="检测单状态" prop="jcd_unit.jcd_status" style="width:200px" class="labelItem" size="mini" required >
  15. {{jcd_unit.jcd_status}}
  16. </el-descriptions-item>
  17. </el-descriptions>
  18. <!-- 检测单未合格项目信息 -->
  19. <el-descriptions id="sampleInfo" :column="1" border style="">
  20. <el-descriptions-item label="未合格项目信息">
  21. <!-- 不合格样品表格区域 -->
  22. <div>
  23. <el-table :data="jcdItem" border stripe highlight-current-row style="width: 100%;border:1px;"
  24. :row-style="rowStyle" :cell-style="cellStyle">
  25. <el-table-column :key="table.label" v-for="table in tableHeader" :label="table.label"
  26. :prop="table.prop" align="center" :width="table.width" :fixed="table.fixed" />
  27. </el-table>
  28. <!-- 不合格项表格分页器 -->
  29. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
  30. :current-page="queryInfo.pageNum" :page-sizes="[10, 15, 20]" :page-size="queryInfo.pageSize"
  31. layout="total, sizes, prev, pager, next, jumper" :total="total" background />
  32. </div>
  33. </el-descriptions-item>
  34. </el-descriptions>
  35. </div>
  36. <!-- 底部按钮 -->
  37. <el-form>
  38. <el-form-item class="btn">
  39. <el-button type="primary" @click="back()">返回任务详情</el-button>
  40. </el-form-item>
  41. </el-form>
  42. </div>
  43. </template>
  44. <script>
  45. const token = window.sessionStorage.getItem('token')
  46. import {
  47. provinceAndCityData,
  48. regionData,
  49. provinceAndCityDataPlus,
  50. regionDataPlus,
  51. CodeToText,
  52. TextToCode
  53. } from 'element-china-area-data'
  54. export default {
  55. name: 'inputSample',
  56. data() {
  57. return {
  58. parentName:'',
  59. myHeaders: {Authorization: 'bearer' + token},
  60. fileList: [],
  61. form: {},
  62. jcd_id:'',
  63. total:0,
  64. jcdItem: [],//不合格项信息
  65. jcd_unit:[],//检测单信息
  66. queryInfo:{
  67. pageNum:1,
  68. pageSize:10
  69. },
  70. units: [],
  71. production: [],
  72. task_id: '',
  73. task_profile_id:'',
  74. cellStyle: {
  75. padding: 2 + 'px'
  76. },
  77. rowStyle: {
  78. height: 35 + 'px'
  79. },
  80. tableHeader: [{
  81. label: '检测项目',
  82. prop: 'item_name',
  83. // fixed: 'left'
  84. width: 200
  85. },
  86. {
  87. label: '检验标准',
  88. prop: 'item_standard',
  89. width: 200
  90. },
  91. {
  92. label: '实测值',
  93. prop: 'item_measured_value',
  94. width: 200
  95. },
  96. {
  97. label: '单项判定结果',
  98. prop: 'item_result',
  99. width: 200
  100. },{
  101. label: '检验依据',
  102. prop: 'item_basis',
  103. width: 200
  104. },
  105. {
  106. label: '检验备注',
  107. prop: 'item_log',
  108. width: 200
  109. }
  110. ],
  111. }
  112. },
  113. created() {
  114. this.task_id = this.$route.params.task_id
  115. this.task_profile_id = this.$route.params.task_profile_id
  116. this.jcd_id = this.$route.params.jcd_id
  117. this.parentName = this.$route.params.parentName
  118. console.log(this.parentName)
  119. this.getJcd()
  120. this.getBuHeGe()
  121. },
  122. methods: {
  123. // 获取检测单信息
  124. async getJcd() {
  125. const result = await this.$http.post('getJcd', {
  126. // task_profile_id: this.task_profile_id,
  127. // task_id: this.task_id,
  128. jcd_id : this.$route.params.jcd_id
  129. })
  130. this.jcd_unit = result.data.data//检测单信息
  131. // console.log(this.jcd_unit.jcd_result)
  132. if(this.jcd_unit.jcd_result == '1'){
  133. this.jcd_unit.jcd_result = '合格'
  134. }else{
  135. this.jcd_unit.jcd_result = '不合格'
  136. }
  137. if(this.jcd_unit.jcd_status == '1'){
  138. this.jcd_unit.jcd_status = '未上报'
  139. }else if(this.jcd_unit.jcd_status == '2'){
  140. this.jcd_unit.jcd_status = '已上报'
  141. }else if(this.jcd_unit.jcd_status == '5'){
  142. this.jcd_unit.jcd_status = '已完成'
  143. }else{
  144. this.jcd_unit.jcd_status = '无'
  145. }
  146. },
  147. //获取不合格项
  148. async getBuHeGe() {
  149. const result = await this.$http.post('getJcdItems', {
  150. jcd_id : this.jcd_id,
  151. queryInfo: this.queryInfo
  152. })
  153. this.jcdItem = result.data.data.rows
  154. this.total = result.data.data.total
  155. console.log( result.data.data.rows)
  156. },
  157. /** 监听页码的改变 */
  158. handleCurrentChange(newPage) {
  159. this.queryInfo.pageNum = newPage
  160. this.getJcdItems()
  161. },
  162. /** 监听每页显示多少数据的改变 */
  163. handleSizeChange(newSize) {
  164. this.queryInfo.pageSize = newSize
  165. this.getJcdItems()
  166. },
  167. // 返回
  168. back() {
  169. // var that = this
  170. // console.log(that.task_id)
  171. this.$router.push({
  172. name: 'readCheckList',
  173. params: {
  174. task_id: this.$route.params.task_id,
  175. task_profile_id: this.$route.params.task_profile_id,
  176. parentName:this.parentName
  177. }
  178. })
  179. console.log(parentName)
  180. }
  181. },
  182. }
  183. </script>
  184. <style lang="less" scoped>
  185. .form {
  186. display: flex;
  187. flex-direction: row;
  188. justify-content: center;
  189. align-content: flex-start;
  190. }
  191. .el-descriptions {
  192. width: 80%;
  193. margin: auto;
  194. }
  195. /deep/ .el-descriptions__title {
  196. margin: auto;
  197. font-size: 1.25rem;
  198. // font-weight: 31.25rem !important;
  199. }
  200. .btn{
  201. margin-top:20px ;
  202. // float: right;
  203. text-align: center;
  204. }
  205. /deep/ #sampleReport{
  206. .el-descriptions-item__label.is-bordered-label{
  207. width: 12%;
  208. font-size: .875rem;
  209. }
  210. .el-descriptions-item__content{
  211. font-size: .875rem;
  212. }
  213. }
  214. </style>