dialog.select.point.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <DialogCom
  3. title="选择检查要点"
  4. :visible.sync="isShow"
  5. class="g-dialog-select-safe-check"
  6. :close-on-click-modal="false"
  7. destroy-on-close
  8. width="55%"
  9. top="10vh"
  10. append-to-body
  11. >
  12. <div class="el-dialog-div">
  13. <g-search-table
  14. ref="st"
  15. url="/core/safetycheck/ruleItem/pointSelectionPage"
  16. method="get"
  17. :search-data="search"
  18. :manual="true"
  19. :pageable="true"
  20. :select="true"
  21. :select-default="selectList"
  22. :drag="false"
  23. @select="onSelect"
  24. >
  25. <!-- 搜索 -->
  26. <template slot="searchs">
  27. <el-form-item prop="ruleId" label="检查内容库">
  28. <el-select v-model="search.ruleId">
  29. <el-option
  30. v-for="item in ruleList"
  31. :value="item.id"
  32. :key="item.id"
  33. :label="item.name"
  34. ></el-option>
  35. </el-select>
  36. </el-form-item>
  37. <el-form-item prop="key" label="关键字">
  38. <el-input
  39. v-model="search.key"
  40. maxlength="50"
  41. placeholder="请输入检查项或检查内容"
  42. ></el-input>
  43. </el-form-item>
  44. </template>
  45. <!-- 表格 -->
  46. <template slot="columns">
  47. <el-table-column
  48. prop="itemName"
  49. label="检查项"
  50. min-width="40%"
  51. ></el-table-column>
  52. <el-table-column label="检查内容" prop="pointName" min-width="40%">
  53. <template slot-scope="scope">
  54. <pre>{{ scope.row.pointName }}</pre>
  55. </template>
  56. </el-table-column>
  57. <el-table-column
  58. prop="areaName"
  59. label="检查区域"
  60. min-width="20%"
  61. ></el-table-column>
  62. <!-- <el-table-column prop="nfcName"
  63. label="采集点"
  64. width="120"></el-table-column>-->
  65. </template>
  66. </g-search-table>
  67. </div>
  68. <div slot="footer" class="dialog-footer">
  69. <el-button type="primary" @click="onSubmit">确定</el-button>
  70. <el-button @click="onHide">关闭</el-button>
  71. </div>
  72. </DialogCom>
  73. </template>
  74. <script>
  75. import GSearchTable from "@/components/table/gx.search.table.vue";
  76. import { ruleListForOrg } from "@/api/safetycheck/rule.js";
  77. export default {
  78. components: { GSearchTable },
  79. data() {
  80. return {
  81. isShow: false,
  82. selectList: [],
  83. ruleList: [],
  84. search: this.emptySearch(),
  85. };
  86. },
  87. computed: {},
  88. watch: {
  89. search: {
  90. deep: true,
  91. handler(v) {
  92. if (v.ruleId) {
  93. this.$refs.st.search();
  94. }
  95. },
  96. },
  97. },
  98. props: {
  99. // defaultSelect:{
  100. // type:Array
  101. // },
  102. orgType: {
  103. type: String,
  104. },
  105. },
  106. methods: {
  107. show(defaultSelect) {
  108. this.search = this.emptySearch();
  109. this.isShow = true;
  110. if (defaultSelect && defaultSelect.map) {
  111. this.selectList = defaultSelect.map((s) => ({ id: s }));
  112. }
  113. ruleListForOrg({ orgType: this.orgType }).then((r) => {
  114. this.ruleList = r.data;
  115. if (r.data && r.data.length > 0) {
  116. this.search.ruleId = r.data[0].id;
  117. }
  118. });
  119. },
  120. onHide() {
  121. this.isShow = false;
  122. },
  123. onSelect(item) {
  124. this.selectList = item;
  125. },
  126. onSubmit() {
  127. let s = this.selectList;
  128. this.$emit("select", this.selectList);
  129. this.onHide();
  130. },
  131. emptySearch() {
  132. return {
  133. ruleId: null,
  134. itemName: null,
  135. };
  136. },
  137. },
  138. mounted() {},
  139. };
  140. </script>
  141. <style lang="scss" scoped>
  142. .el-dialog-div {
  143. overflow: auto;
  144. margin-bottom: 20px;
  145. }
  146. .dialog-footer {
  147. margin-top: 20px;
  148. }
  149. </style>