taskSample.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <div>
  3. <div slot="header" class="clearfix">
  4. <el-breadcrumb separator-class="el-icon-arrow-right">
  5. <el-breadcrumb-item >首页</el-breadcrumb-item>
  6. <el-breadcrumb-item>监测任务</el-breadcrumb-item>
  7. <el-breadcrumb-item>抽样单</el-breadcrumb-item>
  8. </el-breadcrumb>
  9. </div>
  10. <!-- 牵头单位弹框 -->
  11. <!-- <el-button icon="el-icon-search" @click="getQtouList()" size="medium">搜索牵头单位</el-button> -->
  12. <!-- 下拉菜单 -->
  13. <!-- <div>
  14. 牵头单位
  15. <el-select v-model="value" placeholder="请选择" clearable>
  16. <el-option
  17. v-for="item in options"
  18. :key="item.value"
  19. :label="item.label"
  20. :value="item.value"
  21. @change="choseQt()">
  22. </el-option>
  23. </el-select> -->
  24. <!-- 返回按钮 -->
  25. <el-form-item label="牵头单位名称" class="select" size="small">
  26. <el-input v-model="queryInfo.unit_name"></el-input>
  27. <el-button type="success" size="small">查询</el-button>
  28. </el-form-item>
  29. <div class="btns">
  30. <el-button plain size="small" @click="returnTask()">
  31. 返回
  32. </el-button>
  33. </div>
  34. <!-- 表格数据区域-->
  35. <div class="table">
  36. <el-table ref="multipleTable" :data="tableData" border stripe highlight-current-row style="width: 100%"
  37. :row-style="rowStyle" :cell-style="cellStyle" @selection-change="handleSelectionChange">
  38. <el-table-column label="序号" width="50px">
  39. <template slot-scope="scope">
  40. {{ scope.$index+1 }}
  41. </template>
  42. </el-table-column>
  43. <el-table-column :key="table.label" v-for="table in tableHeader" :label="table.label" :prop="table.prop"
  44. align="center" :width="table.width" :fixed="table.fixed"/>
  45. <el-table-column label="操作" align="center" fixed="right">
  46. <!-- 操作按钮区域的作用域插槽 -->
  47. <template slot-scope="scope">
  48. <!-- <el-button type="success" size="mini" @click="readDialogVisible1(scope.row)">抽样单详情</el-button> -->
  49. <el-button style="margin: 5px auto;" type="success" size="small" @click="readSampleList(scope.row.sample_id)">查看详情</el-button>
  50. <el-button size="small" @click="sendBack()">退回</el-button>
  51. </template>
  52. </el-table-column>
  53. </el-table>
  54. <!-- 分页器区域-->
  55. <div class="block">
  56. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="queryInfo.pageNum"
  57. :page-sizes="[10, 15, 20]" :page-size="queryInfo.pageSize"
  58. layout="total, sizes, prev, pager, next, jumper" :total="total" background />
  59. </div>
  60. </div>
  61. </div>
  62. </template>
  63. <script>
  64. const token = window.sessionStorage.getItem('token')
  65. export default {
  66. name: '',
  67. data() {
  68. return {
  69. //控制弹框显隐
  70. dialogVisible: false,
  71. total:0,
  72. task_id:'',
  73. queryInfo:{
  74. keyWord: '',
  75. year:'',
  76. task_name:'',
  77. starttime:'',
  78. endtime:'',
  79. ispublic:'',
  80. pageSize:10,
  81. pageNum:1,
  82. task_class:'专项监测',
  83. unit_name:'',
  84. },
  85. cellStyle: {
  86. padding: 2 + 'px'
  87. },
  88. rowStyle: {
  89. height: 35 + 'px'
  90. },
  91. tableHeader: [{
  92. label: '抽样单编码',
  93. prop: 'cyd_code',
  94. width: 260
  95. // fixed: 'left'
  96. },
  97. {
  98. label: '受检单位',
  99. prop: 'inspectedUnit.inspected_name',
  100. width: 200
  101. // fixed: 'left'
  102. }, {
  103. label: '抽样日期',
  104. prop: 'cydProfile.cyd_date',
  105. width: 180
  106. // fixed: 'left'
  107. },
  108. {
  109. label: '状态',
  110. prop: 'cyd_status',
  111. width: 160
  112. },
  113. ],
  114. // 总共多少条数据
  115. total: 0,
  116. // table表格多选选项
  117. // multipleSelection: null,
  118. // getQtListShow: {},
  119. // 选中的牵头单位
  120. orgs: [],
  121. // 数据表格数据
  122. tableData: [],
  123. }
  124. // },
  125. // this.getQtouList()
  126. },
  127. mounted: function() {
  128. this.getCyds()
  129. },
  130. created: function() {
  131. this.getCyds()
  132. console.log(this.$route.params.task_id)
  133. console.log(this.$route.params.task_profile_id)
  134. this.task_id = this.$route.params.task_id
  135. this.task_profile_id = this.$route.params.task_profile_id
  136. // this.getCyds()
  137. },
  138. methods: {
  139. handleSizeChange(val) {
  140. console.log(`每页 ${val} 条`);
  141. },
  142. handleCurrentChange(val) {
  143. this.queryInfo.pageNum = val;
  144. console.log(`当前页: ${val}`);
  145. this.getCyds()
  146. },
  147. //批量选中
  148. // handleSelectionChange(val) {
  149. // this.multipleSelection = val;
  150. // console.log(this.multipleSelection)
  151. // },
  152. //获取牵头单位列表
  153. // async getQtouList() {
  154. // this.dialogVisible = 'ture'
  155. // console.log(this.dialogVisible)
  156. // this.queryInfo['token'] = token
  157. // const result = await this.$http.post('getQtouList',this.queryInfo )
  158. // console.log( result.data.data.rows);
  159. // 判断业务逻辑
  160. // if (result.data.code == 0) {
  161. // this.QtouList = result.data.data.rows
  162. // this.total = result.data.data.total
  163. // }
  164. // },
  165. //返回
  166. returnTask(){
  167. this.$router.push('routineMonitor')
  168. },
  169. /** 监听每页显示多少数据的改变 */
  170. handleSizeChange1(newSize) {
  171. this.queryInfo.pageSize = newSize
  172. this.getCyds()
  173. },
  174. /** 监听页码的改变 */
  175. handleCurrentChange1(newPage) {
  176. this.queryInfo.pageNum = newPage
  177. this.getCyds()
  178. },
  179. // 获取抽样单列表
  180. async getCyds() {
  181. const result = await this.$http.post('getCyds', {
  182. task_id:this.task_id,
  183. task_profile_id:this.task_profile_id,
  184. pageSize:this.queryInfo.pageSize,
  185. pageNum:this.queryInfo.pageNum,
  186. })
  187. console.log( result.data)
  188. console.log(result.data.data)
  189. if (result.data.code == 0) {
  190. for (let i = 0; i < result.data.data.rows.length; i++) {
  191. if (result.data.data.rows[i].sample_status == '0') {
  192. result.data.data.rows[i].sample_status = '未上报'
  193. } else {
  194. result.data.data.rows[i].sample_status = '已上报'
  195. }
  196. this.tableData = result.data.data
  197. this.total = result.data.data.total
  198. console.log( result.data.data.total)
  199. }
  200. console.log(this.tableData)
  201. }
  202. },
  203. //查看详情
  204. async readSampleList(id) {
  205. console.log(id)
  206. this.$router.push({
  207. name: 'jgsampleDetail',
  208. params: {
  209. id: id
  210. }
  211. })
  212. },
  213. }
  214. }
  215. </script>
  216. <style>
  217. .block{
  218. padding: 10px;
  219. }
  220. .btns{
  221. float:left;
  222. margin-bottom: 10px;
  223. /* padding: 10px; */
  224. }
  225. .footer {
  226. margin-top: 5px;
  227. display: flex;
  228. flex-direction: row;
  229. justify-content: space-between;
  230. }
  231. </style>