multi.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <el-dialog title="设备选择"
  3. v-if="showFlag"
  4. :visible.sync="showFlag"
  5. :modal= false
  6. width="80%"
  7. center
  8. >
  9. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  10. <el-form-item label="项目编码" prop="subjectCode">
  11. <el-input
  12. v-model="queryParams.subjectCode"
  13. placeholder="请输入项目编码"
  14. clearable
  15. @keyup.enter.native="handleQuery"
  16. />
  17. </el-form-item>
  18. <el-form-item label="项目名称" prop="subjectName">
  19. <el-input
  20. v-model="queryParams.subjectName"
  21. placeholder="请输入项目名称"
  22. clearable
  23. @keyup.enter.native="handleQuery"
  24. />
  25. </el-form-item>
  26. <el-form-item label="项目类型" prop="subjectType">
  27. <el-select v-model="queryParams.subjectType" placeholder="请选择项目类型" clearable>
  28. <el-option
  29. v-for="dict in dict.type.mes_dvsubject_type"
  30. :key="dict.value"
  31. :label="dict.label"
  32. :value="dict.value"
  33. />
  34. </el-select>
  35. </el-form-item>
  36. <el-form-item>
  37. <el-button v-no-more-click type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  38. <el-button v-no-more-click icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  39. </el-form-item>
  40. </el-form>
  41. <el-table v-loading="loading" :data="dvsubjectList" @selection-change="handleSelectionChange">
  42. <el-table-column type="selection" width="55" align="center" />
  43. <el-table-column label="项目编码" align="center" prop="subjectCode" />
  44. <el-table-column label="项目类型" align="center" prop="subjectType">
  45. <template slot-scope="scope">
  46. <dict-tag :options="dict.type.mes_dvsubject_type" :value="scope.row.subjectType"/>
  47. </template>
  48. </el-table-column>
  49. <el-table-column label="项目内容" align="center" prop="subjectContent" :show-overflow-tooltip="true"/>
  50. <el-table-column label="标准" align="center" prop="subjectStandard" :show-overflow-tooltip="true"/>
  51. <el-table-column label="是否启用" align="center" prop="enableFlag">
  52. <template slot-scope="scope">
  53. <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.enableFlag"/>
  54. </template>
  55. </el-table-column>
  56. <el-table-column label="备注" align="center" prop="remark" />
  57. </el-table>
  58. <pagination
  59. v-show="total>0"
  60. :total="total"
  61. :page.sync="queryParams.pageNum"
  62. :limit.sync="queryParams.pageSize"
  63. @pagination="getList"
  64. />
  65. <div slot="footer" class="dialog-footer">
  66. <el-button v-no-more-click type="primary" @click="confirmSelect">确 定</el-button>
  67. <el-button v-no-more-click @click="showFlag=false">取 消</el-button>
  68. </div>
  69. </el-dialog>
  70. </template>
  71. <script>
  72. import { listDvsubject} from "@/api/mes/dv/dvsubject";
  73. export default {
  74. name: "DvsubjectSelect",
  75. dicts: ['sys_yes_no', 'mes_dvsubject_type'],
  76. props:{
  77. subjectType: null,
  78. },
  79. data() {
  80. return {
  81. showFlag:false,
  82. // 遮罩层
  83. loading: true,
  84. // 选中数组s
  85. ids: [],
  86. // 非单个禁用
  87. single: true,
  88. // 非多个禁用
  89. multiple: true,
  90. // 显示搜索条件
  91. showSearch: true,
  92. // 总条数
  93. total: 0,
  94. // 设备点检保养项目表格数据
  95. dvsubjectList: [],
  96. // 弹出层标题
  97. title: "",
  98. // 是否显示弹出层
  99. open: false,
  100. // 查询参数
  101. queryParams: {
  102. pageNum: 1,
  103. pageSize: 10,
  104. subjectCode: null,
  105. subjectName: null,
  106. subjectType: this.subjectType,
  107. subjectContent: null,
  108. subjectStandard: null,
  109. enableFlag: null,
  110. },
  111. // 表单参数
  112. form: {}
  113. };
  114. },
  115. created() {
  116. this.getList();
  117. },
  118. methods: {
  119. /** 查询设备点检保养项目列表 */
  120. getList() {
  121. this.loading = true;
  122. listDvsubject(this.queryParams).then(response => {
  123. this.dvsubjectList = response.rows;
  124. this.total = response.total;
  125. this.loading = false;
  126. });
  127. },
  128. /** 搜索按钮操作 */
  129. handleQuery() {
  130. this.queryParams.pageNum = 1;
  131. this.getList();
  132. },
  133. // 多选框选中数据
  134. handleSelectionChange(selection) {
  135. this.ids = selection.map(item => item.subjectId)
  136. this.selectedRows = selection;
  137. this.single = selection.length!==1
  138. this.multiple = !selection.length
  139. },
  140. //确定选中
  141. confirmSelect(){
  142. if(this.ids ==[] || this.ids.length==0){
  143. this.$notify({
  144. title:'提示',
  145. type:'warning',
  146. message: '请至少选择一条数据!'
  147. });
  148. return;
  149. }
  150. this.$emit('onSelected',this.selectedRows);
  151. this.showFlag = false;
  152. }
  153. }
  154. };
  155. </script>