Newer
Older
KaiFengPC / src / views / floodSys / scada / plcDatasource / index.vue
@zhangdeliang zhangdeliang on 23 May 3 KB 初始化项目
  1. <template>
  2. <div class="water-analysis-page">
  3. <div class="top">
  4. <el-form ref="ruleForm" inline :model="tableData" v-show="showSearch">
  5. <el-form-item v-for="i in queryClouns" :label="i.label" :prop="i.prop">
  6. <el-select v-if="i.prop == 'type'" clearable v-model="tableData.type" :placeholder="i.placeholder">
  7. <el-option v-for="dict in plcDatasource_source" :key="dict.stCode" :label="dict.label" :value="dict.value"></el-option>
  8. </el-select>
  9. <el-select v-else-if="i.prop == 'status'" clearable v-model="tableData.status" :placeholder="i.placeholder">
  10. <el-option v-for="dict in status_source" :key="dict.stCode" :label="dict.label" :value="dict.value"></el-option>
  11. </el-select>
  12. <el-input v-else style="width: 240px" clearable v-model="tableData[i.prop]" :placeholder="i.placeholder"></el-input>
  13. </el-form-item>
  14. <el-form-item>
  15. <el-button type="primary" icon="Search" @click="searchForm"> 查询</el-button>
  16. <el-button icon="Refresh" @click="resectClcik"> 重置</el-button>
  17. </el-form-item>
  18. </el-form>
  19. <el-row :gutter="10" class="mb8">
  20. <el-col :span="1.5">
  21. <el-button type="primary" plain icon="Plus" @click="onCheck(4)">新增</el-button>
  22. </el-col>
  23. <right-toolbar v-model:showSearch="showSearch" @queryTable="searchForm"></right-toolbar>
  24. </el-row>
  25. </div>
  26. <todoDon ref="todoDonRef"></todoDon>
  27. <el-dialog v-model="visible" title="PLC数据接入数据源新增" :modal-append-to-body="false" :close-on-click-modal="false" width="51%">
  28. <tableDalgo :key="isFlag" ref="tableDalgoRef" :typeList="typeList" @onModalClose="onModalClose"></tableDalgo>
  29. <template #footer>
  30. <div class="dialog-footer">
  31. <el-button @click="open2" type="primary">保 存</el-button>
  32. <el-button @click="visible = false">关闭</el-button>
  33. </div>
  34. </template>
  35. </el-dialog>
  36. </div>
  37. </template>
  38. <script setup>
  39. import tableDalgo from './tableDalgo.vue';
  40. import todoDon from './todoDon.vue';
  41. const { proxy } = getCurrentInstance();
  42. import { plcDatasource_source, status_source } from '@/utils/form';
  43. const todoDonRef = ref(null);
  44. const ruleForm = ref(null);
  45. let typeList = ref({});
  46. const tableDalgoRef = ref();
  47. const showSearch = ref(true);
  48. const visible = ref(false);
  49. let isFlag = ref(1);
  50. const queryClouns = [
  51. { label: '类型:', prop: 'type', placeholder: '请选择类型' },
  52. { label: '用户名:', prop: 'userName', placeholder: '请输入用户名' },
  53. { label: '数据源名称:', prop: 'datasourceName', placeholder: '请输入数据源名称' },
  54. { label: '状态:', prop: 'status', placeholder: '请选择状态' },
  55. { label: '端口:', prop: 'port', placeholder: '请输入端口' },
  56. ];
  57. //动态组件
  58. let dataForm = reactive({
  59. tableData: {
  60. pageNum: 1,
  61. pageSize: 10,
  62. type: null,
  63. status: null,
  64. datasourceName: null,
  65. userName: null,
  66. port: null,
  67. },
  68. tableDateTwo: '',
  69. tableLoading: true,
  70. });
  71. let { tableData } = toRefs(dataForm);
  72. //获取列表数据
  73. //搜索
  74. const searchForm = () => {
  75. todoDonRef.value.search(tableData.value);
  76. };
  77. //重置
  78. const resectClcik = () => {
  79. ruleForm.value.resetFields();
  80. todoDonRef.value.search(tableData.value);
  81. };
  82. // 新增
  83. const onCheck = ty => {
  84. // console.log(ty, 'ty1111');
  85. visible.value = true;
  86. typeList.value.types = ty;
  87. nextTick(() => {
  88. tableDalgoRef.value.resetFiled();
  89. });
  90. };
  91. //保存
  92. function open2() {
  93. tableDalgoRef.value.submit();
  94. }
  95. function onModalClose() {
  96. visible.value = false;
  97. todoDonRef.value.search(tableData.value);
  98. }
  99. onMounted(() => {
  100. searchForm();
  101. });
  102. </script>
  103. <style lang="scss" scoped>
  104. .water-analysis-page {
  105. padding: 20px;
  106. overflow-y: hidden;
  107. }
  108. </style>