Newer
Older
KaiFengPC / src / views / floodSys / scada / deviceInfo / todoDon.vue
@zhangdeliang zhangdeliang on 23 May 4 KB 初始化项目
  1. <template>
  2. <div class="water-analysis-page">
  3. <el-table :key="isFlag" :data="tableData" v-loading="tableLoading" max-height="600">
  4. <el-table-column type="index" width="70" label="序号" />
  5. <el-table-column :label="i.label" :prop="i.prop" show-overflow-tooltip v-for="i in deviceInfoCloum">
  6. <template #default="{ row }" v-if="i.prop == 'deviceType'">
  7. <dict-tag :options="device_type" :value="row.deviceType" />
  8. </template>
  9. <template #default="{ row }" v-if="i.prop == 'areaName'">
  10. {{ getstationName(row.areaCode) }}
  11. </template>
  12. <template #default="{ row }" v-if="i.prop == 'status'">
  13. <el-tag class="ml-2" :type="row.status == 1 ? 'success' : 'danger'"> {{ row.status == 1 ? '启用' : '停用' }}</el-tag>
  14. </template>
  15. </el-table-column>
  16. <el-table-column label="操作" width="250">
  17. <template #default="{ row }">
  18. <el-button link type="primary" icon="View" @click="onCheck(row, 1, '详情')">详情</el-button>
  19. <el-button link icon="Edit" type="warning" @click="onCheck(row, 2, '修改')">修改</el-button>
  20. <el-button link icon="Delete" type="danger" @click="onCheck(row, 3)">删除</el-button>
  21. </template>
  22. </el-table-column>
  23. </el-table>
  24. <pagination
  25. v-show="totals > 0"
  26. :total="totals"
  27. v-model:page="FormList.pageNum"
  28. v-model:limit="FormList.pageSize"
  29. @pagination="getInfoList(FormList)"
  30. />
  31. </div>
  32. <el-dialog
  33. v-model="visible"
  34. :title="'PLC设备信息' + FormList.title"
  35. :modal-append-to-body="false"
  36. :close-on-click-modal="false"
  37. width="51%"
  38. >
  39. <tableDalgo ref="tableDalgoRef" v-if="visible" @onModalClose="onModalClose" :typeList="typeList" :key="isFlag"></tableDalgo>
  40. <template #footer>
  41. <div class="dialog-footer">
  42. <el-button v-show="typeList.type == '2'" @click="open2" type="primary">保存</el-button>
  43. <el-button @click="visible = false">关闭</el-button>
  44. </div>
  45. </template>
  46. </el-dialog>
  47. </template>
  48. <script setup>
  49. import { areaInfolist } from '@/api/scada/areaInfo';
  50. import { ElMessage, ElMessageBox } from 'element-plus';
  51. import { getInfo, projectInfoDelete, projectInfoGet } from '@/api/scada/deviceInfo';
  52. import { FileSystemList } from '@/api/project/tenderReview';
  53. import tableDalgo from './tableDalgo.vue';
  54. import { deviceInfoCloum } from '@/utils/cloums';
  55. const { proxy } = getCurrentInstance();
  56. const { device_type } = proxy.useDict('device_type');
  57. import { reactive } from 'vue';
  58. const { typeListList } = defineProps(['typeListList']);
  59. let visible = ref(false);
  60. let isFlag = ref(1);
  61. const tableDalgoRef = ref();
  62. const FormList = ref({});
  63. const totals = ref(0);
  64. let dataForm = reactive({
  65. tableData: [],
  66. tableDateTwo: '',
  67. tableLoading: true,
  68. });
  69. let { tableData, tableLoading } = toRefs(dataForm);
  70. //获取列表数据
  71. const getInfoList = async prams => {
  72. tableLoading.value = true;
  73. let { data, total } = await getInfo(prams);
  74. tableData.value = data;
  75. totals.value = total;
  76. tableLoading.value = false;
  77. };
  78. //搜索
  79. const search = p => {
  80. FormList.value = p;
  81. FormList.value.pageNum = 1;
  82. getInfoList(p);
  83. isFlag.value++;
  84. };
  85. defineExpose({ search });
  86. // 查看上报数据
  87. let typeList = ref({});
  88. const onCheck = (row, ty, t) => {
  89. FormList.value.title = t;
  90. if (ty == 1 || ty == 2) {
  91. projectInfoGet(row.id).then(({ code, data }) => {
  92. if (code == 200) {
  93. typeList.value = { ...typeListList, type: ty, ...data };
  94. visible.value = true;
  95. FileSystemList({
  96. refId: row.id,
  97. refType: 'plcDevicePictures',
  98. }).then(({ data }) => {
  99. typeList.value.fileSaveRequestList = data;
  100. });
  101. }
  102. });
  103. // 获取文件列表
  104. } else if (ty == 3) {
  105. ElMessageBox.confirm(`您确定删除吗?`, '提示', {
  106. confirmButtonText: '确定',
  107. cancelButtonText: '取消',
  108. type: 'warning',
  109. })
  110. .then(() => {
  111. proxy.$modal.msgSuccess('操作成功!');
  112. projectInfoDeleteM(row.id);
  113. })
  114. .catch(() => {});
  115. // emgBox(row.id, projectInfoDeleteM, "您确定删除吗?");
  116. }
  117. };
  118. //删除
  119. const projectInfoDeleteM = async id => {
  120. let { code } = await projectInfoDelete(id);
  121. getInfoList();
  122. };
  123. function onModalClose() {
  124. visible.value = false;
  125. getInfoList();
  126. }
  127.  
  128. function open2() {
  129. tableDalgoRef.value.submit();
  130. }
  131. function getstationName(v) {
  132. let arrr = arrrOne.value.filter(i => {
  133. return i.areaCode == v;
  134. });
  135. return arrr[0]?.areaName;
  136. }
  137. const arrrOne = ref([]);
  138.  
  139. const areaInfolistM = async p => {
  140. let { data } = await areaInfolist(p);
  141. arrrOne.value = data;
  142. };
  143. onMounted(() => {
  144. areaInfolistM();
  145. });
  146. </script>
  147. <style lang="scss" scoped></style>