Assumptions.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <div class="eleStyle">
  3. <div style="height:100%;width:94%; background:#ffffff; margin: 4%; border-radius: 8px; overflow: hidden;">
  4. <!--提测报告-->
  5. <div style="margin: 2%; min-height: 73vh; font-size: 14px;">
  6. <div style="margin: 30px 0;">搜索
  7. <el-input v-model="state" size="medium" filterable placeholder="搜索" style="width:20%; margin: 0 10px;" @change="getList(state)" />
  8. <el-button type="primary" plain size="medium" @click="getQueryData(), centerDialogVisible = true">新建提测报告</el-button>
  9. </div>
  10. <template>
  11. <el-table :data="tableData" size="mini" :header-cell-style="{ background: '#F2F3F6' }" fit border style="width: 100%">
  12. <el-table-column label="报告名称" min-width="230" align="center">
  13. <template slot-scope="scope">
  14. <a href="javascript:void(0)" style="color:#20a0ff" @click="toReportView(tableData, scope.row.id)">{{ scope.row.name }}</a>
  15. </template>
  16. </el-table-column>
  17. <el-table-column label="报告人" min-width="150" align="center">
  18. <template slot-scope="scope">{{ scope.row.submitter }}</template>
  19. </el-table-column>
  20. <el-table-column label="日期" min-width="280" align="center">
  21. <template slot-scope="scope">{{ scope.row.gmtCreate }}</template>
  22. </el-table-column>
  23. <el-table-column label="状态" min-width="150" align="center">
  24. <template slot-scope="scope">{{ scope.row.statusString }}</template>
  25. </el-table-column>
  26. <el-table-column label="操作" align="center" fixed="right" min-width="230">
  27. <template slot-scope="scope">
  28. <el-button size="mini" type="primary" plain @click="queryPresentation(scope.row)">更新</el-button>
  29. <el-button size="mini" type="danger" plain @click="delePresentation(scope.row.id)">删除</el-button>
  30. <el-tooltip content="功能正在实现中···" placement="top"><el-button type="info" plain size="mini">权限</el-button></el-tooltip>
  31. </template>
  32. </el-table-column>
  33. </el-table>
  34. </template>
  35. <el-pagination style="margin-top:30px;" align="center" :current-page="curIndex" :page-sizes="[5, 10, 20]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
  36. <el-dialog title="提示" :visible.sync="centerDialogVisible" width="30%" center>
  37. 选择任务 :
  38. <el-select v-model="queryData.state" filterable placeholder="搜索" style="width:80%;" @change="handleSelect($event)">
  39. <el-option v-for="item in restaurants" :key="item.id" :label="item.value" :value="item.id" />
  40. </el-select>
  41. <span slot="footer" class="dialog-footer">
  42. <el-button type="primary" @click="selectionReport(queryData.state)">创建</el-button>
  43. </span>
  44. </el-dialog>
  45. </div>
  46. </div>
  47. </div>
  48. </template>
  49. <script>
  50. import { launchTestList, launchTestDelete, taskListCreate } from '@/api/InterfaceReport'
  51. export default {
  52. name: 'Assumptions',
  53. data() {
  54. return {
  55. userInformation: localStorage.getItem('username'),
  56. userNames: localStorage.getItem('realname'),
  57. bizJson: localStorage.getItem('key'),
  58. z_name: '',
  59. pageSize: 5,
  60. curIndex: 1,
  61. total: 0,
  62. state: '',
  63. restaurants: [],
  64. arrCode: {
  65. id: '',
  66. name: ''
  67. },
  68. centerDialogVisible: false,
  69. queryData: {},
  70. indexPage: {
  71. pageSize: 5,
  72. curIndex: 1
  73. },
  74. tableData: [],
  75. mun: '',
  76. haha: ''
  77. }
  78. },
  79. created() {
  80. this.getList()
  81. },
  82. mounted() {
  83. this.getQueryData()
  84. },
  85. methods: {
  86. getList(ele) {
  87. this.z_name = ele
  88. this.indexPage = {
  89. name: ele,
  90. bizId: localStorage.getItem('key'),
  91. pageSize: this.pageSize,
  92. curIndex: this.curIndex
  93. }
  94. launchTestList(this.indexPage).then(res => {
  95. if (res.code === 200) {
  96. this.tableData = res.data
  97. this.total = res.total
  98. } else {
  99. this.$message({ message: res.msg, type: 'error', duration: 1000, offset: 150 })
  100. }
  101. // this.tableData = res.data
  102. // this.total = res.total
  103. })
  104. },
  105. // 删除报告
  106. delePresentation(e) {
  107. this.$confirm('是否确认删除', '确认信息', {
  108. distinguishCancelAndClose: true,
  109. confirmButtonText: '确定',
  110. cancelButtonText: '取消'
  111. })
  112. .then(() => {
  113. this.userData = { id: '', ename: this.userInformation, name: this.userNames }
  114. launchTestDelete(this.userData, e).then(res => {
  115. this.getList()
  116. })
  117. this.$message({ type: 'success', message: '已删除' })
  118. })
  119. .catch(action => {
  120. this.$message({ type: 'success', message: '已取消' })
  121. })
  122. },
  123. queryPresentation(data) {
  124. console.log(data)
  125. switch (data.type) {
  126. case 1:// 客户端
  127. this.$router.push({ path: '/Platform/presentation/PresentReport', query: { data: data }})
  128. break
  129. case 2:// 服务端
  130. this.$router.push({ path: '/Platform/presentation/presentationReport', query: { data: data }})
  131. break
  132. }
  133. },
  134. selectionReport(e) {
  135. if (this.queryData.state !== '') {
  136. for (var ele of this.restaurants) {
  137. if (ele.id === e) {
  138. var hh = ele
  139. }
  140. }
  141. if (hh.type === 5) {
  142. this.$router.push({ path: '/Platform/presentation/presentationReport', query: { task: hh }})
  143. } else {
  144. this.$router.push({ path: '/Platform/presentation/PresentReport', query: { task: hh }})
  145. }
  146. } else {
  147. this.centerDialogVisible = true
  148. this.$message({ message: '提示,请选择要添加的任务ID', type: 'warning' })
  149. }
  150. },
  151. getQueryData() {
  152. taskListCreate({ status: 5 }).then(res => {
  153. const arr = []
  154. for (var ele of res.data.taskInfoList) {
  155. arr.push({ value: ele.name, id: ele.id, type: ele.type, bizId: ele.bizId, projectId: ele.projectId })
  156. console.log(arr)
  157. }
  158. this.restaurants = arr
  159. })
  160. },
  161. createFilter(queryString) {
  162. return (restaurant) => {
  163. return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0)
  164. }
  165. },
  166. handleSelect(event) {
  167. this.mun = event
  168. },
  169. // clickQuery(e) {
  170. // launchTestList({ name: e }).then(res => {
  171. // this.tableData = res.data
  172. // this.total = res.total
  173. // })
  174. // },
  175. handleSizeChange(size) {
  176. this.pageSize = size
  177. this.getList(this.z_name)
  178. },
  179. handleCurrentChange(curIndex) {
  180. this.curIndex = curIndex
  181. this.getList(this.z_name)
  182. },
  183. toReportView(ele, e) {
  184. for (var vel of ele) {
  185. if (vel.id === e) {
  186. this.haha = { haha: vel }
  187. }
  188. }
  189. this.$router.push({ path: '/Platform/presentation/acceptTheReport', query: { id: e }})
  190. },
  191. errorFun() {
  192. this.$notify({ title: 'Failed', message: 'Created Failed', type: 'error', duration: 2000 })
  193. }
  194. }
  195. }
  196. </script>
  197. <style scoped>
  198. .eleStyle {
  199. width: 100%;
  200. height:100%;
  201. background:#F2F3F6;
  202. display: inline-block;
  203. }
  204. </style>