index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <!--疏散指示灯-->
  2. <template>
  3. <div class="app-container lightPage">
  4. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch">
  5. <el-form-item label="指示灯类型" prop="lightDirection">
  6. <el-select v-model="queryParams.lightDirection" placeholder="请选择指示灯类型" clearable size="small" label-width="100px">
  7. <el-option label="左指示灯" :value="1" />
  8. <el-option label="右指示灯" :value="2" />
  9. </el-select>
  10. </el-form-item>
  11. <el-form-item label="实验室" prop="subjectId" label-width="100px">
  12. <el-select
  13. v-model="queryParams.subjectId"
  14. filterable
  15. clearable
  16. remote
  17. reserve-keyword
  18. placeholder="请输入实验室关键词"
  19. @visible-change="getUserSelectList"
  20. :remote-method="userSelectList"
  21. :loading="loading">
  22. <el-option
  23. v-for="item in laboratoryOptions"
  24. :key="item.id"
  25. :label="item.name"
  26. :value="item.id">
  27. </el-option>
  28. </el-select>
  29. </el-form-item>
  30. <!--<el-form-item label="状态" prop="lightStatus">-->
  31. <!--<el-select v-model="queryParams.lightStatus" placeholder="请选择状态" clearable size="small" label-width="60px">-->
  32. <!--<el-option label="请选择字典生成" value="" />-->
  33. <!--</el-select>-->
  34. <!--</el-form-item>-->
  35. <el-form-item>
  36. <p class="inquire-button-one" @click="handleQuery">查询</p>
  37. <p class="reset-button-one" @click="resetQuery">重置</p>
  38. </el-form-item>
  39. </el-form>
  40. <el-table v-loading="loading" border :data="lightList" @selection-change="handleSelectionChange">
  41. <!--<el-table-column type="selection" width="55" align="center" />-->
  42. <el-table-column label="实验室" align="center" prop="subName" />
  43. <el-table-column label="指示灯类型" align="center" prop="lightDirection">
  44. <template slot-scope="scope">
  45. {{scope.row.lightDirection == 1?'左指示灯':(scope.row.lightDirection == 2?'右指示灯':'')}}
  46. </template>
  47. </el-table-column>
  48. <el-table-column label="楼栋" align="center" prop="lineDeptName" />
  49. <el-table-column label="楼层" align="center" prop="floorName" />
  50. <el-table-column label="继电器编号" align="center" prop="relayCode" />
  51. <el-table-column label="继电器路数" align="center" prop="relayBit" />
  52. <!--<el-table-column label="继电器状态" align="center" prop="lightStatus" />-->
  53. <el-table-column label="继电器配置名称" align="center" prop="configName" />
  54. <el-table-column label="继电器配置状态" align="center" prop="configStatus" />
  55. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120" v-if="tableButtonType">
  56. <template slot-scope="scope">
  57. <div class="table-button-box">
  58. <p class="table-button-null"></p>
  59. <p class="table-button-p"
  60. @click="handleUpdate(scope.row)"
  61. v-hasPermiAnd="['laboratory:light:query','laboratory:light:edit']"
  62. >编辑</p>
  63. <p class="table-button-null"></p>
  64. </div>
  65. </template>
  66. </el-table-column>
  67. </el-table>
  68. <pagination :page-sizes="[20, 30, 40, 50]"
  69. v-show="total>0"
  70. :total="total"
  71. :page.sync="queryParams.pageNum"
  72. :limit.sync="queryParams.pageSize"
  73. @pagination="getList"
  74. />
  75. <!-- 添加或修改逃生指引灯对话框 -->
  76. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body
  77. :close-on-click-modal="false">
  78. <el-form ref="form" :model="form" :rules="rules" label-width="120px">
  79. <el-form-item label="实验室名称" prop="subjectId">
  80. <el-input v-model="form.subName" placeholder="请输入实验室名称" :disabled="true" />
  81. </el-form-item>
  82. <el-form-item label="楼栋" prop="lineDeptName">
  83. <el-input v-model="form.lineDeptName" placeholder="请输入楼栋名称" :disabled="true" />
  84. </el-form-item>
  85. <el-form-item label="楼层" prop="floorName">
  86. <el-input v-model="form.floorName" placeholder="请输入楼层名称" :disabled="true" />
  87. </el-form-item>
  88. <el-form-item label="继电器编号" prop="relayCode">
  89. <el-input v-model="form.relayCode" placeholder="请输入继电器编号" />
  90. </el-form-item>
  91. <el-form-item label="继电器路数" prop="relayBit">
  92. <el-input v-model="form.relayBit" placeholder="请输入继电器路数" />
  93. </el-form-item>
  94. <el-form-item label="继电器配置名称" prop="relayBit">
  95. <el-input v-model="form.configName" placeholder="请输入继电器配置名称" maxlength="20"/>
  96. </el-form-item>
  97. <el-form-item label="继电器配置状态" prop="relayBit">
  98. <el-input v-model="form.configStatus" placeholder="请输入继电器配置状态" maxlength="20"/>
  99. </el-form-item>
  100. </el-form>
  101. <div slot="footer" class="dialog-footer">
  102. <el-button type="primary" @click="submitForm">确 定</el-button>
  103. <el-button @click="cancel">取 消</el-button>
  104. </div>
  105. </el-dialog>
  106. </div>
  107. </template>
  108. <script>
  109. import { listLight, getLight, delLight, addLight, updateLight } from "@/api/laboratory/light";
  110. import { subjectListAll} from "@/api/laboratory/approval";
  111. export default {
  112. name: "Light",
  113. data() {
  114. return {
  115. tableButtonType:this.hasPermiDom(['laboratory:light:query','laboratory:light:edit']),
  116. // 遮罩层
  117. loading: true,
  118. // 选中数组
  119. ids: [],
  120. // 非单个禁用
  121. single: true,
  122. // 非多个禁用
  123. multiple: true,
  124. // 显示搜索条件
  125. showSearch: true,
  126. // 总条数
  127. total: 0,
  128. // 逃生指引灯表格数据
  129. lightList: [],
  130. // 弹出层标题
  131. title: "",
  132. // 是否显示弹出层
  133. open: false,
  134. // 查询参数
  135. queryParams: {
  136. pageNum: 1,
  137. pageSize:20,
  138. subjectId: null,
  139. buildId: null,
  140. relayCode: null,
  141. relayBit: null,
  142. lightDirection: null,
  143. lightStatus: null,
  144. userId: null,
  145. subName: null,
  146. lineDeptName: null,
  147. floorName: null,
  148. },
  149. // 表单参数
  150. form: {},
  151. // 表单校验
  152. rules: {
  153. },
  154. laboratoryOptions:[],
  155. };
  156. },
  157. created() {
  158. this.getList();
  159. this.userSelectList();
  160. },
  161. methods: {
  162. getUserSelectList(type){
  163. if(!type){
  164. subjectListAll({name:''}).then(response => {
  165. this.laboratoryOptions = response.data;
  166. });
  167. }
  168. },
  169. //懒加载
  170. userSelectList(e){
  171. subjectListAll({name:e}).then(response => {
  172. this.laboratoryOptions = response.data;
  173. });
  174. },
  175. /** 查询逃生指引灯列表 */
  176. getList() {
  177. this.loading = true;
  178. listLight(this.queryParams).then( response => {
  179. this.lightList = response.rows;
  180. this.total = response.total;
  181. this.loading = false;
  182. });
  183. },
  184. // 取消按钮
  185. cancel() {
  186. this.open = false;
  187. this.reset();
  188. },
  189. // 表单重置
  190. reset() {
  191. this.form = {
  192. id: null,
  193. subjectId: null,
  194. buildId: null,
  195. relayCode: null,
  196. relayBit: null,
  197. lightDirection: null,
  198. lightStatus: 0,
  199. userId: null,
  200. createBy: null,
  201. createTime: null,
  202. updateBy: null,
  203. updateTime: null,
  204. remark: null
  205. };
  206. this.resetForm("form");
  207. },
  208. /** 搜索按钮操作 */
  209. handleQuery() {
  210. this.queryParams.pageNum = 1;
  211. this.getList();
  212. },
  213. /** 重置按钮操作 */
  214. resetQuery() {
  215. this.resetForm("queryForm");
  216. this.handleQuery();
  217. },
  218. // 多选框选中数据
  219. handleSelectionChange(selection) {
  220. this.ids = selection.map(item => item.id)
  221. this.single = selection.length!==1
  222. this.multiple = !selection.length
  223. },
  224. /** 新增按钮操作 */
  225. handleAdd() {
  226. this.reset();
  227. this.open = true;
  228. this.title = "添加逃生指引灯";
  229. },
  230. /** 修改按钮操作 */
  231. handleUpdate(row) {
  232. this.reset();
  233. const id = row.id || this.ids
  234. getLight(id).then( response => {
  235. this.form = response.data;
  236. this.open = true;
  237. this.title = "修改逃生指引灯";
  238. });
  239. },
  240. /** 提交按钮 */
  241. submitForm() {
  242. this.$refs["form"].validate(valid => {
  243. if (valid) {
  244. if (this.form.id != null) {
  245. updateLight(this.form).then( response => {
  246. this.msgSuccess("修改成功");
  247. this.open = false;
  248. this.getList();
  249. });
  250. } else {
  251. addLight(this.form).then( response => {
  252. this.msgSuccess("新增成功");
  253. this.open = false;
  254. this.getList();
  255. });
  256. }
  257. }
  258. });
  259. },
  260. /** 删除按钮操作 */
  261. handleDelete(row) {
  262. const ids = row.id || this.ids;
  263. this.$confirm('是否确认删除逃生指引灯编号为"' + ids + '"的数据项?', "警告", {
  264. confirmButtonText: "确定",
  265. cancelButtonText: "取消",
  266. type: "warning"
  267. }).then(function() {
  268. return delLight(ids);
  269. }).then(() => {
  270. this.getList();
  271. this.msgSuccess("删除成功");
  272. }).catch(() => {});
  273. },
  274. /** 导出按钮操作 */
  275. handleExport() {
  276. this.download('laboratory/light/export', {
  277. ...this.queryParams
  278. }, `laboratory_light.xlsx`)
  279. }
  280. }
  281. };
  282. </script>
  283. <style>
  284. .lightPage{
  285. flex:1;
  286. display: flex;
  287. flex-direction: column;
  288. overflow: hidden!important;
  289. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  290. padding:20px!important;
  291. border-radius: 10px;
  292. }
  293. </style>