index.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. <template>
  2. <div class="app-container">
  3. <!-- 筛选start -->
  4. <div class="filter-container mb-10">
  5. <div class="left">
  6. <div>
  7. <a class="" style="margin-right: 30px">登录日志列表待排版</a>
  8. <!-- <el-button
  9. icon="el-icon-plus"
  10. type="success"
  11. @click="addItem()"
  12. >
  13. 添加模板
  14. </el-button> -->
  15. </div>
  16. </div>
  17. </div>
  18. <div class="filter-container mb-10">
  19. <div style="margin-top: 20px">
  20. <div class="filter-item">
  21. 平台名称:
  22. <el-input
  23. v-model="platformName"
  24. placeholder="请输入内容"
  25. style="width: 150px"
  26. ></el-input>
  27. </div>
  28. <div class="filter-item planOutage">
  29. 选择时间范围:
  30. <el-date-picker
  31. v-model="dateTime"
  32. type="datetimerange"
  33. range-separator="至"
  34. start-placeholder="开始日期"
  35. end-placeholder="结束日期"
  36. style="width: auto"
  37. ></el-date-picker>
  38. </div>
  39. <el-button
  40. type="primary"
  41. icon="el-icon-search"
  42. @click="Select()"
  43. class="search-button"
  44. >
  45. 查询
  46. </el-button>
  47. </div>
  48. </div>
  49. <!-- 筛选end -->
  50. <!-- 表格start -->
  51. <el-table
  52. :data="tableData"
  53. border
  54. stripe
  55. :header-cell-style="headClass"
  56. :cell-style="cellStyle"
  57. >
  58. <el-table-column type="index" label="序号" width="50px"></el-table-column>
  59. <el-table-column
  60. prop="platformName"
  61. label="平台名称"
  62. ></el-table-column>
  63. <el-table-column
  64. prop="tenantCount"
  65. label="在用租户数"
  66. ></el-table-column>
  67. <el-table-column
  68. prop="createTime"
  69. label="创建时间"
  70. ></el-table-column>
  71. <el-table-column fixed="right" label="操作" width="80">
  72. <template #default="scope">
  73. <el-button
  74. type="text"
  75. size="small"
  76. @click.prevent="editRow(scope.row)"
  77. >
  78. 编辑
  79. </el-button>
  80. </template>
  81. </el-table-column>
  82. </el-table>
  83. <!-- 表格end -->
  84. <!-- 分页start -->
  85. <div class="paginationBlock">
  86. <el-pagination
  87. v-model:currentPage="page"
  88. :page-sizes="[15, 20, 25, 30]"
  89. :page-size="pageSize"
  90. layout="total, sizes, prev, pager, next, jumper"
  91. :total="total"
  92. @size-change="handleSizeChange"
  93. @current-change="handleCurrentChange"
  94. background
  95. ></el-pagination>
  96. </div>
  97. <!-- 分页end -->
  98. <!--弹框组件开始-----------------------start-->
  99. <dialog-component
  100. :dialog-title="dialogTitle"
  101. :item-info="tableItem"
  102. @closeDialog="closeDialog"
  103. :show_Dialog="showDialog"
  104. ></dialog-component>
  105. <!--弹框组件开始-----------------------end-->
  106. </div>
  107. </template>
  108. <script>
  109. import { useStore } from 'vuex'
  110. import { defineComponent, onMounted, ref } from 'vue'
  111. import DialogComponent from './dialogComponent'
  112. import * as api from '@/api/platManage/index.js'
  113. import { ElMessage } from 'element-plus'
  114. export default defineComponent({
  115. name: 'VariableList',
  116. components: { DialogComponent },
  117. setup() {
  118. const store = useStore()
  119. const tableItem = ref()
  120. const dialogTitle = ref('')
  121. const showDialog = ref(false)
  122. const tableData = ref()
  123. const currentPage = ref(1)
  124. const pageSize = ref(15)
  125. const total = ref(0)
  126. const status = ref(0)
  127. const createTime = ref('')
  128. const platformName = ref('')
  129. const tenantCount = ref('')
  130. const dateTime = ref('')
  131. const select = ref(1)
  132. const input = ref('')
  133. const region = ref()
  134. // 添加操作
  135. const addItem = () => {
  136. tableItem.value = {
  137. platformName: '',
  138. tenantCount: '',
  139. tenantTerm: 3,
  140. geoPosition: '',
  141. createTime: '',
  142. phoneNumber: '',
  143. systemName: '',
  144. email: '',
  145. address: '',
  146. status:0,
  147. domain:''
  148. }
  149. dialogTitle.value = '添加模板'
  150. showDialog.value = true
  151. }
  152. // 编辑操作
  153. const editRow = (row) => {
  154. console.log(row)
  155. tableItem.value = {
  156. id:row.id,
  157. platformName: row.platformName,
  158. tenantCount: row.tenantCount,
  159. tenantTerm: row.tenantTerm=='永久有效'?3:4,
  160. value1:row.tenantTerm,
  161. status: Number(row.status),
  162. geoPosition: row.geoPosition,
  163. createTime: Number(row.createTime),
  164. phoneNumber: row.phoneNumber,
  165. systemName: Number(row.systemName),
  166. email: row.email,
  167. address: row.address,
  168. remark:row.remark,
  169. domain:row.domain
  170. }
  171. dialogTitle.value = '编辑'
  172. showDialog.value = true
  173. }
  174. // 关闭操作
  175. const closeDialog = (flag) => {
  176. if (flag) {
  177. // 重新刷新表格内容
  178. // this.fetchData()
  179. console.log(1)
  180. }
  181. showDialog.value = false
  182. Select()
  183. }
  184. //删除 是否删除 ---- 是
  185. const handleDelete = (row) => {
  186. api.plannedOutageDel({ id: row.id }).then((requset) => {
  187. if (requset.status === 'SUCCESS') {
  188. ElMessage.success({
  189. message: '删除成功',
  190. type: 'success',
  191. })
  192. Select()
  193. } else {
  194. ElMessage.error(requset.msg)
  195. }
  196. })
  197. }
  198. //是否删除 ---- 否
  199. const cancelEvent = () => {
  200. console.log('cancel!')
  201. }
  202. //查询列表
  203. function Select() {
  204. store.commit('TimeAll_function', dateTime.value)
  205. const time = store.state.Time_Data
  206. api
  207. .getPlatformList({
  208. size: pageSize.value,
  209. page: currentPage.value,
  210. startTime: time[0] ? time[0] : '',
  211. endTime: time[1] ? time[1] : '',
  212. // status: status.value,
  213. // createTime: createTime.value,
  214. platformName: platformName.value,
  215. // tenantCount: tenantCount.value,
  216. })
  217. .then((requset) => {
  218. if (requset.status === 'SUCCESS') {
  219. tableData.value = requset.data.records.map((val) => {
  220. store.commit('getTimestampAll', val.startTime)
  221. val.startTime = store.state.timeProcessing
  222. store.commit('getTimestampAll', val.endTime)
  223. val.endTime = store.state.timeProcessing
  224. store.commit('getTimestampAll', val.createTime)
  225. val.createTime = store.state.timeProcessing
  226. })
  227. tableData.value = requset.data.records
  228. total.value = requset.data.total
  229. } else {
  230. ElMessage.error(requset.msg)
  231. }
  232. })
  233. }
  234. onMounted(() => {
  235. Select()
  236. })
  237. const handleSizeChange = (val) => {
  238. pageSize.value = val
  239. Select()
  240. }
  241. const handleCurrentChange = (val) => {
  242. currentPage.value = val
  243. Select()
  244. }
  245. // 表头样式设置
  246. const goVariableList = () => {
  247. // 跳转至订单列表页面传参
  248. this.$router.push({
  249. path: '../siteManage/variableList/index.vue',
  250. })
  251. // this.$router.push({ name:'variableList'})
  252. }
  253. const headClass = () => {
  254. return 'background:#FAFAFA;'
  255. }
  256. //处理状态状态值变色
  257. const cellStyle = ({ row, column, rowIndex, columnIndex }) => {
  258. row, column, rowIndex
  259. // console.log(row, column, rowIndex)
  260. if (columnIndex) {
  261. // return `text-align:left;cursor:pointer;`
  262. } else {
  263. return ''
  264. }
  265. }
  266. //导出
  267. const DataReportExport = () => {
  268. store.commit('TimeAll_function', dateTime.value)
  269. const time = store.state.Time_Data
  270. api
  271. .outagePlanListExport({
  272. type: region.value,
  273. startTime: time[0] ? time[0] : '',
  274. endTime: time[1] ? time[1] : '',
  275. })
  276. .then((requset) => {
  277. if (requset.status === 'SUCCESS') {
  278. window.location.href = window.PLATFROM_CONFIG.fileUrl + requset.data
  279. ElMessage.success({
  280. message: '导出成功',
  281. type: 'success',
  282. })
  283. } else {
  284. ElMessage.error(requset.msg)
  285. }
  286. })
  287. }
  288. return {
  289. cellStyle,
  290. headClass,
  291. goVariableList,
  292. handleDelete,
  293. cancelEvent,
  294. closeDialog,
  295. editRow,
  296. addItem,
  297. Select,
  298. store,
  299. total,
  300. pageSize,
  301. currentPage,
  302. handleSizeChange,
  303. handleCurrentChange,
  304. createTime,
  305. tableData,
  306. platformName,
  307. tenantCount,
  308. status,
  309. showDialog,
  310. select,
  311. dateTime,
  312. tableItem,
  313. dialogTitle,
  314. input,
  315. region,
  316. DataReportExport,
  317. }
  318. },
  319. })
  320. </script>
  321. <style lang="scss" scoped>
  322. </style>