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