Assumptions.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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. <div style="text-align: center; margin-top: 5%;">
  42. <template>
  43. <el-radio v-if="DuanKopu" v-model="queryData.radio" label="1">服务端</el-radio>
  44. <el-radio v-if="DuanKopu" v-model="queryData.radio" label="2">客户端</el-radio>
  45. </template>
  46. </div>
  47. <span slot="footer" class="dialog-footer">
  48. <el-button type="primary" @click="selectionReport(queryData)">创建</el-button>
  49. </span>
  50. </el-dialog>
  51. </div>
  52. </div>
  53. </div>
  54. </template>
  55. <script>
  56. import { launchTestList, launchTestDelete, taskListCreate } from '@/api/InterfaceReport'
  57. export default {
  58. name: 'Assumptions',
  59. data() {
  60. return {
  61. userInformation: localStorage.getItem('username'),
  62. userNames: localStorage.getItem('realname'),
  63. bizJson: localStorage.getItem('key'),
  64. z_name: '',
  65. pageSize: 5,
  66. curIndex: 1,
  67. total: 0,
  68. state: '',
  69. restaurants: [],
  70. arrCode: {
  71. id: '',
  72. name: ''
  73. },
  74. centerDialogVisible: false,
  75. DuanKopu: false,
  76. queryData: {},
  77. indexPage: {
  78. pageSize: 5,
  79. curIndex: 1
  80. },
  81. tableData: [],
  82. typeNumber: '',
  83. haha: '',
  84. data_type: {}
  85. }
  86. },
  87. created() {
  88. this.getList()
  89. },
  90. mounted() {
  91. this.getQueryData()
  92. },
  93. methods: {
  94. getList(ele) {
  95. this.z_name = ele
  96. this.indexPage = {
  97. name: ele,
  98. bizId: localStorage.getItem('key'),
  99. pageSize: this.pageSize,
  100. curIndex: this.curIndex
  101. }
  102. launchTestList(this.indexPage).then(res => {
  103. if (res.code === 200) {
  104. this.tableData = res.data
  105. this.total = res.total
  106. } else {
  107. this.$message({ message: res.msg, type: 'error', duration: 1000, offset: 150 })
  108. }
  109. // this.tableData = res.data
  110. // this.total = res.total
  111. })
  112. },
  113. // 删除报告
  114. delePresentation(e) {
  115. this.$confirm('是否确认删除', '确认信息', {
  116. distinguishCancelAndClose: true,
  117. confirmButtonText: '确定',
  118. cancelButtonText: '取消'
  119. })
  120. .then(() => {
  121. this.userData = { id: '', ename: this.userInformation, name: this.userNames }
  122. launchTestDelete(this.userData, e).then(res => {
  123. this.getList()
  124. })
  125. this.$message({ type: 'success', message: '已删除' })
  126. })
  127. .catch(action => {
  128. this.$message({ type: 'success', message: '已取消' })
  129. })
  130. },
  131. queryPresentation(data) {
  132. console.log(data)
  133. switch (data.type) {
  134. case 1:// 客户端
  135. this.$router.push({ path: '/Platform/presentation/PresentReport', query: { data: data, taskId: data.taskId, projectId: data.projectId, id: data.id }})
  136. break
  137. case 2:// 服务端
  138. this.$router.push({ path: '/Platform/presentation/presentationReport', query: { data: data, taskId: data.taskId, projectId: data.projectId, id: data.id }})
  139. break
  140. }
  141. },
  142. // 创建B端,服务端,客户端跳转
  143. selectionReport(e) {
  144. if (this.queryData.state !== '') {
  145. for (var ele of this.restaurants) {
  146. if (ele.id === e.state) {
  147. this.data_type = ele
  148. }
  149. }
  150. console.log(e.radio)
  151. if (e.radio !== undefined) {
  152. if (e.radio) { // B端可以选择创建服务端或客户端
  153. if (e.radio === '1') {
  154. this.$router.push({ path: '/Platform/presentation/presentationReport', query: { task: this.data_type }})
  155. } else {
  156. this.$router.push({ path: '/Platform/presentation/PresentReport', query: { task: this.data_type }})
  157. }
  158. } else {
  159. if (this.data_type.type === 5) {
  160. this.$router.push({ path: '/Platform/presentation/presentationReport', query: { task: this.data_type }}) // 服务端
  161. } else {
  162. this.$router.push({ path: '/Platform/presentation/PresentReport', query: { task: this.data_type }}) // 客户端
  163. }
  164. }
  165. } else {
  166. this.$message({ message: '请选择想要创建服务端还是客户端', type: 'success', duration: 1000, offset: 150 })
  167. }
  168. } else {
  169. this.centerDialogVisible = true
  170. this.$message({ message: '提示,请选择要添加的任务ID', type: 'warning' })
  171. }
  172. },
  173. getQueryData() {
  174. this.DuanKopu = false
  175. this.$set(this.queryData, 'state', '')
  176. this.$set(this.queryData, 'radio', undefined)
  177. taskListCreate({ status: 5 }).then(res => {
  178. const arr = []
  179. for (var ele of res.data.taskInfoList) {
  180. arr.push({ value: ele.name, id: ele.id, type: ele.type, bizId: ele.bizId, projectId: ele.projectId })
  181. }
  182. this.restaurants = arr
  183. console.log(arr)
  184. })
  185. },
  186. createFilter(queryString) {
  187. return (restaurant) => {
  188. return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0)
  189. }
  190. },
  191. handleSelect(event) {
  192. this.typeNumber = ''
  193. this.restaurants.map(item => {
  194. item.id === event ? this.typeNumber = item.type : ''
  195. })
  196. this.typeNumber === 35 ? this.DuanKopu = true : this.DuanKopu = false
  197. },
  198. handleSizeChange(size) {
  199. this.pageSize = size
  200. this.getList(this.z_name)
  201. },
  202. handleCurrentChange(curIndex) {
  203. this.curIndex = curIndex
  204. this.getList(this.z_name)
  205. },
  206. toReportView(ele, e) {
  207. for (var vel of ele) {
  208. if (vel.id === e) {
  209. this.haha = { haha: vel }
  210. }
  211. }
  212. this.$router.push({ path: '/Platform/presentation/acceptTheReport', query: { id: e }})
  213. },
  214. errorFun() {
  215. this.$notify({ title: 'Failed', message: 'Created Failed', type: 'error', duration: 2000 })
  216. }
  217. }
  218. }
  219. </script>
  220. <style scoped>
  221. .eleStyle {
  222. width: 100%;
  223. height:100%;
  224. background:#F2F3F6;
  225. display: inline-block;
  226. }
  227. </style>