readCheckList copy.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <template>
  2. <div style="width: 100%">
  3. <!-- 标题栏导航 -->
  4. <div slot="header" class="clearfix">
  5. <el-breadcrumb separator-class="el-icon-artableDate-right">
  6. <el-breadcrumb-item >首页</el-breadcrumb-item>
  7. <el-breadcrumb-item>例行监测</el-breadcrumb-item>
  8. <el-breadcrumb-item>查看检测单列表</el-breadcrumb-item>
  9. </el-breadcrumb>
  10. </div>
  11. <!-- 表格区域 -->
  12. <el-table :data="tableData" border stripe highlight-current-row style="width: 100%" >
  13. <el-table-column :key="table.label" v-for="table in tableHeader1" :label="table.label"
  14. :prop="table.prop" align="center" :width="table.width" :fixed="table.fixed" />
  15. <!-- 操作 -->
  16. <el-table-column label="操作" align="center" fixed="right">
  17. <template slot-scope="scope">
  18. <el-button style="margin:5px 0" type="success" size="small" @click="getSampleList(scope.row.id)">获取样品列表</el-button>
  19. </template>
  20. </el-table-column>
  21. </el-table>
  22. <!--原页面分页器区域-->
  23. <el-pagination class="feyeqi" @size-change="handleSizeChange" @current-change="handleCurrentChange"
  24. :current-page="queryInfo.pageNum" :page-sizes="[10, 15, 20]" :page-size="queryInfo.pageSize"
  25. layout="total, sizes, prev, pager, next, jumper" :total="total" background />
  26. <!-- 返回按钮 -->
  27. <div class="btns">
  28. <el-button plain size="medium" @click="returnJcdList()" >
  29. 返回
  30. </el-button>
  31. </div>
  32. <!-- 弹框 样品列表 -->
  33. <el-dialog title="样品列表" :visible.sync="readDialog" width="75%" :close-on-click-modal="false" class="dialogItem">
  34. <el-form v-if="readDialog">
  35. <el-table :data="tableData2" border stripe highlight-current-row style="width: 100%" >
  36. <el-table-column :key="table.label" v-for="table in tableHeader2" :label="table.label"
  37. :prop="table.prop" align="center" :width="table.width" :fixed="table.fixed" />
  38. <!-- 操作 -->
  39. <el-table-column label="操作" align="center" fixed="right">
  40. <template slot-scope="scope">
  41. <el-button style="margin:5px 0" type="success" size="small" @click="getSampleList(scope.row.id)">查看检测单详情</el-button>
  42. </template>
  43. </el-table-column>
  44. </el-table>
  45. <!-- 样品列表分页器区域-->
  46. <el-pagination @size-change="handleSizeChange2" @current-change="handleCurrentChange2"
  47. :current-page="userInfo.pageNum" :page-sizes="[1,10, 15, 20]" :page-size="userInfo.pageSize"
  48. layout="total, sizes, prev, pager, next, jumper" :total="total" background />
  49. </el-form>
  50. </el-dialog>
  51. </div>
  52. </template>
  53. <script>
  54. export default {
  55. data() {
  56. return {
  57. readDialog: false,
  58. // 数据表格数据
  59. total:0,
  60. tableData:[],
  61. tableData2:[],
  62. sampleOrgId:{},
  63. task_id:'',
  64. task_profile_id:'',
  65. underInfo:{
  66. pageNum: 1,
  67. pageSize: 10,
  68. cyd_id: ''
  69. },
  70. queryInfo:{
  71. pageSize:10,
  72. pageNum:1,
  73. task_class:'例行监测',
  74. sample_org_id:'',
  75. check_org_id:'',
  76. cyd_status:'',
  77. cyd_status_condition:'',
  78. cyd_code:''
  79. },
  80. tableHeader1: [{
  81. label: '抽样单编码',
  82. prop: 'cyd_code',
  83. width: 180,
  84. },{
  85. label: '受检单位',
  86. prop: 'inspectedUnit.inspected_name',
  87. width: 120,
  88. },{
  89. label: '单位地址',
  90. prop: 'inspectedUnit.inspected_address',
  91. width: 200,
  92. },{
  93. label: '单位联系人',
  94. prop: 'inspectedUnit.contact_name',
  95. width: 200,
  96. },{
  97. label: '联系人电话',
  98. prop: 'inspectedUnit.contact_phone',
  99. width: 200,
  100. }],
  101. tableHeader2: [{
  102. label: '样品名称',
  103. prop: 'sample_name',
  104. width: 180,
  105. },{
  106. label: '样品品牌',
  107. prop: 'sample_brand',
  108. width: 120,
  109. },{
  110. label: '抽样数量',
  111. prop: 'sample_count',
  112. width: 200,
  113. },{
  114. label: '抽样基数',
  115. prop: 'sample_base',
  116. width: 200,
  117. },{
  118. label: '生产日期',
  119. prop: 'sample_md_date',
  120. width: 200,
  121. },{
  122. label: '样品来源',
  123. prop: 'sample_source',
  124. width: 200,
  125. },{
  126. label: '备注',
  127. prop: 'inspectedUnit.contact_phone',
  128. width: 200,
  129. }]
  130. }
  131. },
  132. mounted() {
  133. this.getJcds()
  134. },
  135. created() {
  136. this.cyd_id = this.$route.params.cyd_id
  137. this.task_id = this.$route.params.task_id
  138. this.task_profile_id = this.$route.params.task_profile_id
  139. console.log(this.task_id)
  140. console.log(this.task_profile_id)
  141. this.getJcds()
  142. this.getSamples()
  143. },
  144. methods: {
  145. //返回
  146. returnSampleList(){
  147. var that = this
  148. this.$router.push({
  149. name:'setTaskJg',
  150. params:{
  151. task_id: that.task_id
  152. }
  153. })
  154. console.log(task_id)
  155. },
  156. // 获取检测单列表
  157. async getJcds() {
  158. var that = this
  159. const {data: res} = await this.$http.post("getJcds", {
  160. task_id: that.task_id,
  161. task_profile_id:that.task_profile_id,
  162. pageNum: that.queryInfo.pageNum,
  163. pageSize: that.queryInfo.pageSize
  164. });
  165. console.log(that.id)
  166. this.tableData = res.data.rows
  167. console.log( this.tableData)
  168. this.total = res.data.total
  169. console.log( this.total)
  170. },
  171. // 获取样品列表
  172. async getSampleList(id) {
  173. this.task_id = this.task_id
  174. this.task_profile_id = id
  175. this.readDialog = true
  176. this.getSamples()
  177. },
  178. async getSamples() {
  179. // var that = this
  180. const {
  181. data: res
  182. } = await this.$http.post("getSamples",{
  183. cyd_id: this.id,
  184. task_id: this.task_id,
  185. task_id: this.task_id,
  186. task_profile_id:this.task_profile_id,
  187. pageNum: this.queryInfo.pageNum,
  188. pageSize: this.queryInfo.pageSize
  189. });
  190. this.tableData2 = res.data.rows
  191. console.log(this.id)
  192. this.total = res.data.total
  193. },
  194. //分页器
  195. handleSizeChange(val) {
  196. console.log(`每页 ${val} 条`);
  197. },
  198. handleCurrentChange(val) {
  199. this.queryInfo.pageNum = val;
  200. console.log(`当前页: ${val}`);
  201. this.getJcds()
  202. },
  203. /** 监听页码的改变 */
  204. handleCurrentChange(newPage) {
  205. this.queryInfo.pageNum = newPage
  206. this.getJcds()
  207. },
  208. /** 监听每页显示多少数据的改变 */
  209. handleSizeChange(newSize) {
  210. this.queryInfo.pageSize = newSize
  211. this.getJcds()
  212. },
  213. //分页器2
  214. /** 监听页码的改变 */
  215. handleCurrentChange2(newPage) {
  216. this.userInfo.pageNum2 = newPage
  217. this.getSamples()
  218. },
  219. /** 监听每页显示多少数据的改变 */
  220. handleSizeChange2(newSize) {
  221. this.userInfo.pageSize2 = newSize
  222. this.getSamples()
  223. },
  224. //查看检测单详情
  225. readCheck(id){
  226. this.$router.push({
  227. name:'readCheck',
  228. params: {
  229. cyd_id:id,
  230. }
  231. })
  232. },
  233. }
  234. }
  235. </script>
  236. <style>
  237. .btns{
  238. float:right;
  239. /* margin-top: 10px; */
  240. padding: 10px;
  241. }
  242. .feyeqi{
  243. margin-top: 10px;
  244. }
  245. </style>