LitLine.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. <template>
  2. <div>
  3. <div class="bigBox" style="position: relative;" v-loading="loading">
  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" :sunSearch="sunSearch" @alBack="alBack"></AddLine>
  49. <LookLine v-if="lookModal" :lookModal="lookModal" :flashId="flashId" :checkFlash="checkFlash" :needList="needList" :search="search"
  50. @lookBack="lookBack" :listNum="listNum"></LookLine>
  51. <DelLine v-if="delModal" :delModal="delModal" :flashId="flashId" :checkFlash="checkFlash" :needList="needList" :sunSearch="sunSearch"
  52. @delBack=delBack>
  53. </DelLine>
  54. <PicLook v-if="picModal" :picModal="picModal" :needList="needList" @picBack="picBack"></PicLook>
  55. </div>
  56. </div>
  57. </div>
  58. </template>
  59. <script>
  60. import { ref, onMounted, toRefs, watch, onBeforeUnmount } from 'vue';
  61. import litLine from "../../../api/litLine"
  62. import AddLine from '../modalComp/AddLine.vue';
  63. import LookLine from '../modalComp/LookLine.vue';
  64. import DelLine from '../modalComp/DelLine.vue';
  65. import PicLook from '../modalComp/PicLook.vue';
  66. import Pagination from './Pagination.vue';
  67. export default {
  68. props: {
  69. fuckList: {
  70. type: Array,
  71. required: true
  72. },
  73. moduleTotal: {
  74. type: Number,
  75. required: true
  76. },
  77. lineId:{
  78. type:String,
  79. required:true,
  80. },//电压等级的id
  81. },
  82. setup(props, { emit }) {
  83. let lineList = ref([])//
  84. let result = props.fuckList
  85. let alModal = ref(false)
  86. let needList = ref([])
  87. let lookModal = ref(false)
  88. let delModal = ref(false)
  89. let picModal = ref(false)
  90. let listNum = ref(0)//0为查看,1为编辑
  91. let totals = ref(0)//总条数
  92. let loading = ref(false)
  93. let flashId = ref("")//本组件电压等级id
  94. watch(() => props.fuckList, (newVal) => {
  95. lineList.value = newVal
  96. })
  97. watch(() => props.moduleTotal, (newVal) => {
  98. totals.value = newVal
  99. })
  100. watch(()=>props.lineId,(newVal)=>{
  101. flashId.value = newVal
  102. })
  103. function checkFlash(num){
  104. loading.value = true
  105. litLine.getAllLine({ pageno: 1, pagesize: 20, vol_id: num - 0 }).then(res => {
  106. if (res.code == 0) {
  107. loading.value = false
  108. lineList.value = res.data
  109. totals.value = res.count
  110. // counts.value = res.count
  111. // emit("lineBack", loading.value)
  112. // emit("listBack", res.data, e.id, counts.value)
  113. } else {
  114. ElMessage({
  115. message: res.msg,
  116. type: "error"
  117. })
  118. }
  119. })
  120. }
  121. function search() {
  122. flashId.value = props.lineId
  123. if (totals.value) {
  124. console.log('调用了search的if');
  125. totals.value = props.moduleTotal
  126. loading.value = true
  127. litLine.getAllLine({ pageno: 1, pagesize: 10 }).then(res => {
  128. if (res.data != null) {
  129. lineList.value = res.data
  130. totals.value = res.count
  131. loading.value = false
  132. } else {
  133. lineList.value = []
  134. totals.value = 0
  135. loading.value = false
  136. }
  137. })
  138. } else {
  139. console.log('调用了search的else');
  140. loading.value = true
  141. litLine.getAllLine({ pageno: 1, pagesize: 10 }).then(res => {
  142. if (res.data != null) {
  143. lineList.value = res.data
  144. totals.value = res.count
  145. loading.value = false
  146. } else {
  147. lineList.value = []
  148. totals.value = 0
  149. loading.value = false
  150. }
  151. })
  152. }
  153. }
  154. function sunSearch() {
  155. loading.value = true
  156. litLine.getAllLine({ pageno: 1, pagesize: 10 }).then(res => {
  157. if (res.data != null) {
  158. lineList.value = res.data
  159. totals.value = res.count
  160. loading.value = false
  161. } else {
  162. lineList.value = []
  163. totals.value = 0
  164. loading.value = false
  165. }
  166. })
  167. }
  168. function handleSelectionChange(val) {
  169. console.log(val, 'val');
  170. }
  171. function createType() {
  172. alModal.value = true
  173. }
  174. function alBack(data) {
  175. alModal.value = data
  176. }
  177. function editLine(row) {
  178. needList.value = row
  179. listNum.value = 1
  180. lookModal.value = true
  181. }
  182. function lookLine(row) {
  183. needList.value = row
  184. listNum.value = 0
  185. lookModal.value = true
  186. }
  187. function delLine(row) {
  188. needList.value = row
  189. delModal.value = true
  190. }
  191. function lookPic(row) {
  192. needList.value = row
  193. picModal.value = true
  194. }
  195. function moduleLine(row) {
  196. needList.value = row
  197. }
  198. function lookBack(data) {
  199. lookModal.value = data
  200. }
  201. function delBack(data) {
  202. delModal.value = data
  203. }
  204. function picBack(data) {
  205. picModal.value = data
  206. }
  207. function pageBack(no, index) {
  208. loading.value = true
  209. litLine.getAllLine({ pageno: no - 0, pagesize: index - 0 }).then(res => {
  210. if (res.data != null) {
  211. lineList.value = res.data
  212. totals.value = res.count
  213. loading.value = false
  214. } else {
  215. lineList.value = []
  216. totals.value = 0
  217. loading.value = false
  218. }
  219. })
  220. }
  221. // watch(() => props.fuckList, (newVal) => {
  222. // lineList.value = newVal
  223. // });
  224. onMounted(() => {
  225. search()
  226. })
  227. return {
  228. lineList,
  229. handleSelectionChange,
  230. alModal,
  231. createType,
  232. alBack,
  233. result,
  234. search,
  235. lookLine,
  236. editLine,
  237. delLine,
  238. moduleLine,
  239. needList,
  240. lookModal,
  241. lookBack,
  242. listNum,
  243. delModal,
  244. delBack,
  245. picModal,
  246. lookPic,
  247. picBack,
  248. totals,//总条数
  249. pageBack,//Pagination.vue返回数据
  250. loading,
  251. sunSearch,//DelLine.VUE需要的刷新
  252. flashId,//本组件变电站id
  253. checkFlash,//便于刷新的函数
  254. }
  255. },
  256. components: {
  257. AddLine,
  258. LookLine,
  259. DelLine,
  260. PicLook,
  261. Pagination,
  262. }
  263. }
  264. </script>
  265. <style scoped>
  266. .bigBox {
  267. width: 100%;
  268. height: calc(100vh - 175px);
  269. margin-top: 10px;
  270. position: relative;
  271. }
  272. </style>