list.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <template>
  2. <div class="app-container">
  3. <div class="title-container">
  4. <breadcrumb id="breadcrumb-container" class="breadcrumb-container"/>
  5. </div>
  6. <y-page-list-layout :page-list="pageData" :page-para="listQuery" :get-page-list="getList">
  7. <template slot="left">
  8. <el-input
  9. v-model="listQuery.itemName"
  10. placeholder="项目名称"
  11. clearable
  12. style="margin-left: 20px;width: 320px;float: left;"
  13. >
  14. </el-input>
  15. <el-button
  16. class="filter-item"
  17. style="margin-left: 10px;float: left;"
  18. type="primary"
  19. @click="searchList"
  20. round
  21. >搜索
  22. </el-button>
  23. <el-button
  24. class="filter-item"
  25. style="float: left;"
  26. round
  27. type="warning"
  28. @click="resetSearch()"
  29. >重置
  30. </el-button>
  31. </template>
  32. <parentTable
  33. v-loading="listLoading"
  34. :data="pageData.records"
  35. slot="table"
  36. style="width: 100%;"
  37. >
  38. <el-table-column label="日志日期" align="center">
  39. <template slot-scope="{row}">
  40. <span>{{ row.logDate }}</span>
  41. </template>
  42. </el-table-column>
  43. <el-table-column label="项目名称" align="center">
  44. <template slot-scope="{row}">
  45. <span>{{ row.itemName }}</span>
  46. </template>
  47. </el-table-column>
  48. <el-table-column label="阶段名称" align="center">
  49. <template slot-scope="{row}">
  50. <span>{{ row.stageName }}</span>
  51. </template>
  52. </el-table-column>
  53. <el-table-column label="创建时间" align="center">
  54. <template slot-scope="{row}">
  55. <span>{{ row.created }}</span>
  56. </template>
  57. </el-table-column>
  58. <el-table-column label="操作" align="center" width="200">
  59. <template slot-scope="{row}">
  60. <PermissionButton
  61. menu-code="_views_log_detail"
  62. class-name="filter-item"
  63. name=""
  64. type="primary"
  65. :page-jump="true"
  66. :page-query="{id: row.id,stageName:row.stageName,listQuery:listQuery}"
  67. round
  68. size="mini"
  69. />
  70. <PermissionButton
  71. menu-code="_views_log_remove"
  72. class-name="filter-item"
  73. name=""
  74. type="danger"
  75. round
  76. size="mini"
  77. @click="deleteInfo(row.id)"
  78. />
  79. </template>
  80. </el-table-column>
  81. </parentTable>
  82. </y-page-list-layout>
  83. </div>
  84. </template>
  85. <script>
  86. import YPageListLayout from '@/components/YPageListLayout'
  87. import Breadcrumb from '@/components/Breadcrumb'
  88. import PermissionButton from '@/components/PermissionButton/PermissionButton'
  89. export default {
  90. name: 'ViewsLogList',
  91. components: {
  92. Breadcrumb,
  93. YPageListLayout,
  94. PermissionButton,
  95. },
  96. data() {
  97. return {
  98. isDisable:false,
  99. tableKey: 0,
  100. pageData: { records: [] },
  101. total: 20,
  102. listLoading: true,
  103. listQuery: {
  104. page: 1,
  105. size: 10,
  106. // name: '',
  107. // staffNo: '',
  108. descs: 'id',
  109. me: false
  110. },
  111. listQueryKey: 'keyword',
  112. importLoading: false,
  113. }
  114. },
  115. created() {
  116. const that = this;
  117. if (that.$route.query.current && !isNaN(that.$route.query.current)) {
  118. that.listQuery.current = parseInt(that.$route.query.current);
  119. }
  120. that.getList()
  121. },
  122. methods: {
  123. resetSearch() {
  124. this.$router.push({ query: {} });
  125. this.listQuery = {
  126. current: 1,
  127. size: 10,
  128. descs: 'id',
  129. }
  130. this.getList()
  131. },
  132. removeHandle(row) {
  133. // console.log(data)
  134. const that = this
  135. that
  136. .$confirm('确认删除当前记录吗?', '警告', {
  137. confirmButtonText: '确认',
  138. cancelButtonText: '取消',
  139. type: 'warning',
  140. })
  141. .then(async () => {
  142. this.$api.term.delete(row.id).then((res) => {
  143. if (res.code === 200) {
  144. this.$message({
  145. type: 'success',
  146. message: '删除成功',
  147. })
  148. this.getList()
  149. }
  150. })
  151. })
  152. .catch((err) => {
  153. console.error(err)
  154. })
  155. },
  156. searchList() {
  157. // 重置分页
  158. this.listQuery.page = 1
  159. this.listQuery.size = 20
  160. this.getList()
  161. },
  162. getList() {
  163. const that = this
  164. this.listLoading = true
  165. const key = {}
  166. this.$api.itemLog.list(Object.assign({}, that.listQuery, key)).then((res) => {
  167. that.pageData = res.data
  168. setTimeout(() => {
  169. that.listLoading = false
  170. }, 200)
  171. })
  172. .catch(() => {
  173. that.listLoading = false
  174. })
  175. },
  176. deleteInfo(id) {
  177. const that = this
  178. that.$confirm('请确认是否删除该数据?', '提示', {
  179. confirmButtonText: '确定',
  180. cancelButtonText: '取消',
  181. type: 'warning',
  182. center: true
  183. }).then(() => {
  184. that.$api.itemLog.delete(id).then(data => {
  185. that.loading = false
  186. if (data.code === 200) {
  187. that.getList()
  188. } else {
  189. this.$message({
  190. type: 'error',
  191. message: data.msg
  192. })
  193. }
  194. })
  195. }).catch(() => {
  196. })
  197. }
  198. },
  199. }
  200. </script>
  201. <style lang="scss" scoped>
  202. .right {
  203. flex: 1;
  204. .title {
  205. font-size: 16px;
  206. font-weight: 500;
  207. color: rgba(51, 51, 51, 1);
  208. line-height: 35px;
  209. margin-bottom: 8px;
  210. }
  211. .menu-2-box {
  212. display: flex;
  213. flex-wrap: wrap;
  214. width: 100%;
  215. }
  216. .menu-2-item {
  217. display: flex;
  218. align-items: center;
  219. color: #656565;
  220. font-size: 12px;
  221. width: 230px;
  222. height: 101px;
  223. background: rgb(255, 185, 129);
  224. border-radius: 3px;
  225. padding-left: 20px;
  226. margin-right: 10px;
  227. margin-bottom: 10px;
  228. cursor: pointer;
  229. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
  230. .text {
  231. margin-left: 16px;
  232. }
  233. }
  234. }
  235. </style>