LitLine.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <template>
  2. <div>
  3. <div class="bigBox" style="position: relative;">
  4. <div style="text-align: center;">
  5. <h2>接线方式管理</h2>
  6. </div>
  7. <div>
  8. <el-button type="primary" plain @click="createType">
  9. <el-icon>
  10. <Plus />
  11. </el-icon>添加新接线方式</el-button>
  12. </div>
  13. <div>
  14. <el-table ref="multipleTableRef" :stripe="true" :data="lineList"
  15. style="width: 100%;height: calc(100vh - 300px);" @selection-change="handleSelectionChange">
  16. <el-table-column type="selection" width="55" />
  17. <el-table-column label="编号" prop="id" width="auto">
  18. <!-- <template #default="scope">{{ scope.row.cr }}</template> -->
  19. </el-table-column>
  20. <el-table-column label="电压等级" prop="vol_level_name" width="auto" />
  21. <el-table-column label="接线方式名称" prop="name" width="auto" />
  22. <el-table-column width="auto" label="线路图" prop="pic">
  23. <template #default="scope">
  24. <span style="color: blue;border-bottom: 1px solid blue;cursor: pointer;"
  25. @click="lookPic(scope.row)">查看</span>
  26. </template>
  27. </el-table-column>
  28. <el-table-column label="创建时间" prop="ct" width="auto" show-overflow-tooltip />
  29. <el-table-column label="操作" width="320">
  30. <template #default="scope">
  31. <el-button link type="primary" size="small" @click="editLine(scope.row)"><el-icon>
  32. <EditPen />
  33. </el-icon>编辑</el-button>
  34. <el-button link type="primary" size="small" @click="lookLine(scope.row)"><el-icon>
  35. <View />
  36. </el-icon>查看</el-button>
  37. <el-button link type="danger" size="small" @click="delLine(scope.row)"><el-icon>
  38. <Delete />
  39. </el-icon>删除</el-button>
  40. </template>
  41. </el-table-column>
  42. </el-table>
  43. </div>
  44. <div style="position: absolute;right: 0px;bottom: 0px;">
  45. <Pagination :totals="totals" @pageBack="pageBack"></Pagination>
  46. </div>
  47. <div>
  48. <AddLine v-if="alModal" :alModal="alModal" :search="search" @alBack="alBack"></AddLine>
  49. <LookLine v-if="lookModal" :lookModal="lookModal" :needList="needList" :search="search" @lookBack="lookBack"
  50. :listNum="listNum"></LookLine>
  51. <DelLine v-if="delModal" :delModal="delModal" :needList="needList" :search="search" @delBack=delBack>
  52. </DelLine>
  53. <PicLook v-if="picModal" :picModal="picModal" :needList="needList" @picBack="picBack"></PicLook>
  54. </div>
  55. </div>
  56. </div>
  57. </template>
  58. <script>
  59. import { ref, onMounted, toRefs, watch } from 'vue';
  60. import litLine from "../../../api/litLine"
  61. import AddLine from '../modalComp/AddLine.vue';
  62. import LookLine from '../modalComp/LookLine.vue';
  63. import DelLine from '../modalComp/DelLine.vue';
  64. import PicLook from '../modalComp/PicLook.vue';
  65. import Pagination from './Pagination.vue';
  66. export default {
  67. props: {
  68. fuckList: {
  69. type: Array,
  70. required: true
  71. }
  72. },
  73. setup(props, { emit }) {
  74. let lineList = ref([])//
  75. let result = props.fuckList
  76. let alModal = ref(false)
  77. let needList = ref([])
  78. let lookModal = ref(false)
  79. let delModal = ref(false)
  80. let picModal = ref(false)
  81. let listNum = ref(0)//0为查看,1为编辑
  82. let totals = ref(0)//总条数
  83. watch(() => props.fuckList, (newVal) => {
  84. lineList.value = newVal
  85. })
  86. function search() {
  87. litLine.getAllLine({ pageno: 1, pagesize: 10 }).then(res => {
  88. if (res.data != null) {
  89. lineList.value = res.data
  90. totals.value = res.count
  91. } else {
  92. lineList.value = []
  93. totals.value = 0
  94. }
  95. })
  96. }
  97. function handleSelectionChange(val) {
  98. console.log(val, 'val');
  99. }
  100. function createType() {
  101. alModal.value = true
  102. }
  103. function alBack(data) {
  104. alModal.value = data
  105. }
  106. function editLine(row) {
  107. needList.value = row
  108. listNum.value = 1
  109. lookModal.value = true
  110. }
  111. function lookLine(row) {
  112. needList.value = row
  113. listNum.value = 0
  114. lookModal.value = true
  115. }
  116. function delLine(row) {
  117. needList.value = row
  118. delModal.value = true
  119. }
  120. function lookPic(row) {
  121. needList.value = row
  122. picModal.value = true
  123. }
  124. function moduleLine(row) {
  125. needList.value = row
  126. }
  127. function lookBack(data) {
  128. lookModal.value = data
  129. }
  130. function delBack(data) {
  131. delModal.value = data
  132. }
  133. function picBack(data) {
  134. picModal.value = data
  135. }
  136. function pageBack(no, index) {
  137. litLine.getAllLine({ pageno: no - 0, pagesize: index - 0 }).then(res => {
  138. if (res.data != null) {
  139. lineList.value = res.data
  140. totals.value = res.count
  141. } else {
  142. lineList.value = []
  143. totals.value = 0
  144. }
  145. })
  146. }
  147. // watch(() => props.fuckList, (newVal) => {
  148. // lineList.value = newVal
  149. // });
  150. onMounted(() => {
  151. search()
  152. })
  153. return {
  154. lineList,
  155. handleSelectionChange,
  156. alModal,
  157. createType,
  158. alBack,
  159. result,
  160. search,
  161. lookLine,
  162. editLine,
  163. delLine,
  164. moduleLine,
  165. needList,
  166. lookModal,
  167. lookBack,
  168. listNum,
  169. delModal,
  170. delBack,
  171. picModal,
  172. lookPic,
  173. picBack,
  174. totals,//总条数
  175. pageBack,//Pagination.vue返回数据
  176. }
  177. },
  178. components: {
  179. AddLine,
  180. LookLine,
  181. DelLine,
  182. PicLook,
  183. Pagination,
  184. }
  185. }
  186. </script>
  187. <style scoped>
  188. .bigBox {
  189. width: 100%;
  190. height: calc(100vh - 175px);
  191. margin-top: 10px;
  192. position: relative;
  193. }
  194. </style>