index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <normalTable
  3. :is-select="false"
  4. :sequence="true"
  5. rowKey="w_dataparamid"
  6. ref="list"
  7. size="small"
  8. :param="param"
  9. :columns="utils.TBLayout('dataparamTable')"
  10. >
  11. <template #tb_cell="{ data }">
  12. <div v-if="data.column.dataIndex == 'rwtype'">
  13. {{
  14. data.record.rwtype == 0
  15. ? "读"
  16. : data.record.rwtype == 1
  17. ? "写"
  18. : "上报"
  19. }}
  20. </div>
  21. <div v-else>
  22. {{ data.record[data.column.dataIndex] }}
  23. </div>
  24. </template>
  25. <template #operation>
  26. <div style="display: flex; margin-bottom: 16px">
  27. <div style="margin-right: 16px">
  28. <span>数据类型:</span>
  29. <a-select
  30. ref="select"
  31. v-model:value="param.content.where.datatype"
  32. placeholder="选择数据类型"
  33. style="width: 200px"
  34. @change="
  35. param.content.pageNumber = 1;
  36. $refs.list.listData();
  37. "
  38. allowClear
  39. >
  40. <a-select-option
  41. :value="item.value"
  42. v-for="(item, index) in typeList"
  43. :key="index"
  44. >{{ item.value }}</a-select-option
  45. >
  46. </a-select>
  47. </div>
  48. <div style="margin-right: 16px">
  49. <span>读写类型:</span>
  50. <a-select
  51. ref="select"
  52. v-model:value="param.content.where.rwtype"
  53. placeholder="选择读写类型"
  54. style="width: 200px"
  55. @change="
  56. param.content.pageNumber = 1;
  57. $refs.list.listData();
  58. "
  59. allowClear
  60. >
  61. <a-select-option value="0">读</a-select-option>
  62. <a-select-option value="1">写</a-select-option>
  63. <a-select-option value="2">上报</a-select-option>
  64. </a-select>
  65. </div>
  66. <div>
  67. <a-input
  68. v-model:value="param.content.where.condition"
  69. @keyup.enter="
  70. param.content.pageNumber = 1;
  71. $refs.list.listData();
  72. "
  73. placeholder="名称/标识"
  74. autocomplete="off"
  75. ></a-input>
  76. </div>
  77. </div>
  78. </template>
  79. </normalTable>
  80. </template>
  81. <script setup>
  82. import AddAttrite from "./modules/Add.vue";
  83. import listTemp from "@/components/listTemplate/index.vue";
  84. import normalTable from "@/template/normalTable/index.vue";
  85. import customBtn from "@/components/customHandleBtn/index.vue";
  86. import customBtn2 from "@/components/customHandleBtn/index.vue";
  87. import Edit from "./modules/Edit.vue";
  88. import { useBaseStore } from "@/stores/modules/base";
  89. import {
  90. ref,
  91. defineProps,
  92. defineEmits,
  93. onMounted,
  94. provide,
  95. inject,
  96. defineExpose,
  97. } from "vue";
  98. import { useRouter } from "vue-router";
  99. import Api from "@/api/api";
  100. import utils from "@/utils/utils";
  101. let list = ref();
  102. let base = useBaseStore();
  103. let router = useRouter();
  104. let emit = defineEmits([]);
  105. let props = defineProps(["data", "disabled", "mode"]);
  106. let param = ref({
  107. id: 20230613091602,
  108. content: {
  109. ownertable: "w_device",
  110. ownerid: router.currentRoute.value.query.id,
  111. pageNumber: 1,
  112. pageSize: 20,
  113. mode: props.mode,
  114. where: {
  115. condition: "",
  116. datatype: undefined,
  117. rwtype: undefined,
  118. },
  119. },
  120. });
  121. let searchType = ref([{ label: "搜索", key: "condition", type: "input" }]);
  122. let typeList = ref([]);
  123. let optionList = ref([]);
  124. let unitList = ref([]);
  125. provide("optionList", optionList);
  126. provide("typeList", typeList);
  127. provide("unitList", unitList);
  128. onMounted(async () => {
  129. let res = await base.optiontypeselect("datatype");
  130. typeList.value = res.data;
  131. let res2 = await base.optiontypeselect("optiontype");
  132. optionList.value = res2.data;
  133. let res3 = await base.optiontypeselect("dataunit");
  134. unitList.value = res3.data;
  135. console.log(typeList.value);
  136. });
  137. let getList = () => {
  138. list.value.listData();
  139. };
  140. defineExpose({
  141. param,
  142. getList,
  143. });
  144. </script>
  145. <style scoped>
  146. </style>