index.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  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. </div>
  9. </div>
  10. <div class="right">
  11. <!-- <el-button type="primary">全部导出</el-button>
  12. <el-button type="primary">导出</el-button> -->
  13. <!-- <el-button
  14. type="primary"
  15. @click="DataReportExport()"
  16. :disabled="store.state.authorities.indexOf('导出') == -1"
  17. >
  18. 导出
  19. </el-button> -->
  20. </div>
  21. </div>
  22. <div class="filter-container mb-10">
  23. <div style="margin-top: 20px">
  24. <div class="filter-item">
  25. 租户名称:
  26. <el-input
  27. v-model="tenantName"
  28. placeholder="请输入内容"
  29. style="width: 130px"
  30. :disabled="store.state.authorities.indexOf('查询') == -1"
  31. ></el-input>
  32. </div>
  33. <div class="filter-item">
  34. 负责人:
  35. <el-input
  36. v-model="tenantManager"
  37. placeholder="请输入内容"
  38. style="width: 150px"
  39. :disabled="store.state.authorities.indexOf('查询') == -1"
  40. ></el-input>
  41. </div>
  42. <el-button
  43. type="primary"
  44. icon="el-icon-search"
  45. @click="Select()"
  46. class="search-button"
  47. :disabled="store.state.authorities.indexOf('查询') == -1"
  48. >
  49. 查询
  50. </el-button>
  51. </div>
  52. </div>
  53. <!-- 筛选end -->
  54. <!-- 表格start -->
  55. <el-table
  56. :data="tableData"
  57. border
  58. stripe
  59. :header-cell-style="headClass"
  60. :cell-style="cellStyle"
  61. >
  62. <el-table-column type="index" label="序号" width="50px"></el-table-column>
  63. <el-table-column prop="tenantName" label="租户名称"></el-table-column>
  64. <el-table-column prop="tenantManager" label="负责人"></el-table-column>
  65. <el-table-column
  66. prop="phoneNumber"
  67. label="负责人手机号"
  68. ></el-table-column>
  69. <el-table-column prop="systemName" label="系统平台"></el-table-column>
  70. <el-table-column prop="tenantType" label="管理员信息">
  71. <template #default="scope">
  72. <el-button
  73. type="text"
  74. size="small"
  75. @click.prevent="checkAdminList(scope.row)"
  76. >
  77. 查看
  78. </el-button>
  79. </template>
  80. </el-table-column>
  81. <el-table-column fixed="right" label="操作">
  82. <template #default="scope">
  83. <el-button
  84. @click="adminConfig(scope.row)"
  85. type="text"
  86. size="small"
  87. style="color: #409eff"
  88. >
  89. 配置管理员
  90. </el-button>
  91. </template>
  92. </el-table-column>
  93. </el-table>
  94. <!-- 表格end -->
  95. <!-- 分页start -->
  96. <div class="paginationBlock">
  97. <el-pagination
  98. v-model:currentPage="page"
  99. :page-sizes="[15, 20, 25, 30]"
  100. :page-size="pageSize"
  101. layout="total, sizes, prev, pager, next, jumper"
  102. :total="total"
  103. @size-change="handleSizeChange"
  104. @current-change="handleCurrentChange"
  105. background
  106. ></el-pagination>
  107. </div>
  108. <!-- 分页end -->
  109. <!--管理员信息组件开始-----------------------start-->
  110. <checkAdmin-list
  111. :dialog-title="dialogTitle"
  112. :item-info="tableItem"
  113. @closeDialog="closeDialog"
  114. :show_Dialog="showDialog"
  115. ></checkAdmin-list>
  116. <!--管理员信息组件开始-----------------------end-->
  117. <!-- 管理员配置组件开始 新增修改 -->
  118. <admin-Dialog
  119. :dialog-title="dialogTitle"
  120. :item-info="tableItem"
  121. @closeNo="closeNo"
  122. :show_dialog2="showDialog2"
  123. :DialogArray="DialogArray"
  124. ></admin-Dialog>
  125. <!-- 管理员配置组件end -->
  126. </div>
  127. </template>
  128. <script>
  129. import { useStore } from 'vuex'
  130. import { defineComponent, onMounted, ref } from 'vue'
  131. import CheckAdminList from './component/checkAdminList'
  132. import adminDialog from './component/adminDialog.vue'
  133. import * as api from '@/api/tenantManage/adminConfig.js'
  134. import { ElMessage } from 'element-plus'
  135. export default defineComponent({
  136. name: 'VariableList',
  137. components: { CheckAdminList, adminDialog },
  138. setup() {
  139. const store = useStore()
  140. const tableItem = ref()
  141. const dialogTitle = ref('')
  142. const showDialog = ref(false)
  143. const tableData = ref()
  144. const currentPage = ref(1)
  145. const pageSize = ref(15)
  146. const total = ref(0)
  147. const status = ref('')
  148. const tenantType = ref('')
  149. const tenantName = ref('')
  150. const tenantManager = ref('')
  151. const dateTime = ref('')
  152. const input = ref('')
  153. const region = ref()
  154. const DialogArray = ref([])
  155. const showDialog2 = ref(false)
  156. //查询设备列表
  157. function Select() {
  158. store.commit('TimeAll_function', dateTime.value)
  159. api
  160. .getTenantDataOne({
  161. size: pageSize.value,
  162. page: currentPage.value,
  163. tenantName: tenantName.value,
  164. tenantManager: tenantManager.value,
  165. })
  166. .then((requset) => {
  167. if (requset.status === 'SUCCESS') {
  168. tableData.value = requset.data.records.map((val) => {
  169. store.commit('getTimestampAll', val.startTime)
  170. val.startTime = store.state.timeProcessing
  171. store.commit('getTimestampAll', val.endTime)
  172. val.endTime = store.state.timeProcessing
  173. store.commit('getTimestampAll', val.createTime)
  174. val.createTime = store.state.timeProcessing
  175. })
  176. tableData.value = requset.data.records
  177. total.value = requset.data.total
  178. } else {
  179. ElMessage.error(requset.msg)
  180. }
  181. })
  182. }
  183. // 管理员信息列表页弹框
  184. const checkAdminList = (row) => {
  185. console.log(row)
  186. tableItem.value = {
  187. tenantId: row.id,
  188. }
  189. dialogTitle.value = '管理员信息'
  190. showDialog.value = true
  191. }
  192. //管理员配置(新增操作)
  193. const adminConfig = (row) => {
  194. tableItem.value = {
  195. tenantId: row.id,
  196. status:0
  197. }
  198. DialogArray.value = row
  199. dialogTitle.value = '配置管理员'
  200. showDialog2.value = true
  201. }
  202. // 关闭操作
  203. const closeDialog = (flag) => {
  204. if (flag) {
  205. // 重新刷新表格内容
  206. // this.fetchData()
  207. console.log(1)
  208. }
  209. showDialog.value = false
  210. Select()
  211. }
  212. //管理员配置弹窗关闭
  213. const closeNo = (value) => {
  214. showDialog2.value = value
  215. }
  216. onMounted(() => {
  217. Select()
  218. })
  219. const handleSizeChange = (val) => {
  220. pageSize.value = val
  221. Select()
  222. }
  223. const handleCurrentChange = (val) => {
  224. currentPage.value = val
  225. Select()
  226. }
  227. // 表头样式设置
  228. const goVariableList = () => {
  229. // 跳转至订单列表页面传参
  230. this.$router.push({
  231. path: '../siteManage/variableList/index.vue',
  232. })
  233. // this.$router.push({ name:'variableList'})
  234. }
  235. const headClass = () => {
  236. return 'background:#FAFAFA;'
  237. }
  238. //处理状态状态值变色
  239. const cellStyle = ({ row, column, rowIndex, columnIndex }) => {
  240. row, column, rowIndex
  241. // console.log(row, column, rowIndex)
  242. if (columnIndex) {
  243. // return `text-align:left;cursor:pointer;`
  244. } else {
  245. return ''
  246. }
  247. }
  248. //导出
  249. const DataReportExport = () => {
  250. store.commit('TimeAll_function', dateTime.value)
  251. const time = store.state.Time_Data
  252. api
  253. .outagePlanListExport({
  254. type: region.value,
  255. startTime: time[0] ? time[0] : '',
  256. endTime: time[1] ? time[1] : '',
  257. })
  258. .then((requset) => {
  259. if (requset.status === 'SUCCESS') {
  260. window.location.href = process.env.VUE_APP_FILE_URL + requset.data
  261. ElMessage.success({
  262. message: '导出成功',
  263. type: 'success',
  264. })
  265. } else {
  266. ElMessage.error(requset.msg)
  267. }
  268. })
  269. }
  270. return {
  271. cellStyle,
  272. headClass,
  273. goVariableList,
  274. closeDialog,
  275. checkAdminList,
  276. Select,
  277. store,
  278. total,
  279. pageSize,
  280. currentPage,
  281. handleSizeChange,
  282. handleCurrentChange,
  283. tenantType,
  284. tableData,
  285. tenantName,
  286. tenantManager,
  287. status,
  288. showDialog,
  289. dateTime,
  290. tableItem,
  291. dialogTitle,
  292. input,
  293. region,
  294. DataReportExport,
  295. DialogArray,
  296. showDialog2,
  297. adminConfig, //管理员配置按钮事件
  298. closeNo, //管理员配置弹窗关闭事件
  299. }
  300. },
  301. })
  302. </script>
  303. <style lang="scss" scoped>
  304. </style>