index.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. <!-- 柜锁配置 -->
  2. <template>
  3. <div class="app-container cabinetLockDisposition">
  4. <div class="cabinetLockDispositionPage" v-if="pageType === 1">
  5. <div class="page-form-title-box">
  6. <el-form :model="queryParams" class="form-box" ref="queryForm"
  7. :inline="true" style="width:100%;">
  8. <el-form-item label="名称" prop="gatewayName" label-width="90px">
  9. <el-input
  10. maxLength="30"
  11. v-model="queryParams.gatewayName"
  12. placeholder="请输入"
  13. clearable
  14. style="width: 200px"
  15. />
  16. </el-form-item>
  17. <el-form-item style="float: right;">
  18. <el-col :span="1.5">
  19. <p class="add-button-one-90"
  20. @click="tableButton(1)"
  21. v-hasPermi="['demo:demo:add']"
  22. >新增</p>
  23. </el-col>
  24. </el-form-item>
  25. <el-form-item>
  26. <p class="inquire-button-one" @click="handleQuery" style="margin-right:10px;">查询</p>
  27. <p class="reset-button-one" @click="resetQuery">重置</p>
  28. </el-form-item>
  29. </el-form>
  30. </div>
  31. <div class="page-content-box">
  32. <el-table class="table-box" v-loading="loading" border :data="dataList">
  33. <el-table-column label="名称" prop="gatewayName" show-overflow-tooltip/>
  34. <el-table-column label="地址" prop="gatewayMac" width="300" show-overflow-tooltip/>
  35. <el-table-column label="创建人" prop="createBy" width="200" show-overflow-tooltip/>
  36. <el-table-column label="创建时间" prop="createTime" width="200" show-overflow-tooltip>
  37. <template slot-scope="scope">
  38. <span>{{ parseTime(scope.row.createTime) }}</span>
  39. </template>
  40. </el-table-column>
  41. <el-table-column label="操作" width="200" show-overflow-tooltip v-if="tableButtonType">
  42. <template slot-scope="scope">
  43. <div class="table-button-box">
  44. <p class="table-button-null"></p>
  45. <p class="table-button-p"
  46. @click="tableButton(2,scope.row)"
  47. v-hasPermi="['demo:demo:detail']"
  48. >详情</p>
  49. <p class="table-button-p"
  50. @click="tableButton(3,scope.row)"
  51. v-hasPermi="['demo:demo:edit']"
  52. >编辑</p>
  53. <p class="table-button-p"
  54. @click="tableButton(4,scope.row)"
  55. v-hasPermi="['demo:demo:del']"
  56. >删除</p>
  57. <p class="table-button-null"></p>
  58. </div>
  59. </template>
  60. </el-table-column>
  61. </el-table>
  62. <pagination :page-sizes="[20, 30, 40, 50]"
  63. v-show="total>0"
  64. :total="total"
  65. :page.sync="queryParams.pageNum"
  66. :limit.sync="queryParams.pageSize"
  67. @pagination="getList"
  68. />
  69. </div>
  70. </div>
  71. <el-dialog :title="dialogTitle" :visible.sync="dialogType " @close="handleClose" width="500px" append-to-body>
  72. <div style="text-align: center">
  73. <el-form ref="dialogForm" :model="dialogForm" :rules="rules" label-width="80px">
  74. <el-form-item label="名称:" prop="gatewayName" style="margin-bottom:40px;">
  75. <el-input
  76. :disabled="dialogForm.showType"
  77. v-model="dialogForm.gatewayName"
  78. maxlength="25"
  79. placeholder="请输入名称"
  80. />
  81. </el-form-item>
  82. <el-form-item label="地址:" prop="gatewayMac" style="margin-bottom:40px;">
  83. <el-input
  84. :disabled="dialogForm.showType"
  85. v-model="dialogForm.gatewayMac"
  86. maxlength="25"
  87. placeholder="请输入地址"
  88. />
  89. </el-form-item>
  90. </el-form>
  91. <div slot="footer" class="dialog-footer">
  92. <p class="dialog-footer-null-p"></p>
  93. <el-button @click="handleClose">{{dialogForm.showType?'关 闭':'取 消'}}</el-button>
  94. <el-button type="primary" @click="submitForm" v-if="!dialogForm.showType">确 定</el-button>
  95. <p class="dialog-footer-null-p"></p>
  96. </div>
  97. <!-- <vue-qr id="form1" style="display: block;height:200px;width:200px;cursor:pointer;margin:0 auto;" text="12123123123123" :size="200"></vue-qr>-->
  98. </div>
  99. </el-dialog>
  100. </div>
  101. </template>
  102. <script>
  103. import { laboratoryLockGatewayList,laboratoryLockGatewayId,laboratoryLockGatewayAdd,laboratoryLockGatewayPut,laboratoryLockGatewayDelGateway } from "@/api/medicUniversity-3_1/index";
  104. export default {
  105. name: 'index',
  106. data () {
  107. return {
  108. tableButtonType:this.hasPermiDom(['demo:demo:detail','demo:demo:edit','demo:demo:del',]),
  109. //页面状态
  110. pageType:1,
  111. //页面遮罩
  112. loading:false,
  113. //下拉列表数据
  114. optionList:[{value:true,label:'启用'},{value:false,label:'停用'}],
  115. //查询条件
  116. queryParams:{
  117. pageNum:1,
  118. pageSize:20,
  119. gatewayName:"",
  120. },
  121. //列表数据
  122. dataList:[],
  123. //数据数量
  124. total:0,
  125. //组件传参
  126. dialogTitle:'',
  127. dialogForm:{},
  128. dialogType:false,
  129. rules: {
  130. gatewayName: [
  131. { required: true, message: "请输入名称", trigger: "blur" },
  132. { required: true, message: "请输入名称", validator: this.spaceJudgmentHTML, trigger: "blur" }
  133. ],
  134. gatewayMac: [
  135. { required: true, message: "请输入地址", trigger: "blur" },
  136. { required: true, message: "请输入地址", validator: this.spaceJudgmentHTML, trigger: "blur" }
  137. ],
  138. },
  139. }
  140. },
  141. created () {
  142. },
  143. mounted () {
  144. this.getList();
  145. },
  146. methods: {
  147. //查询按钮
  148. handleQuery(){
  149. this.$set(this.queryParams,'page',1);
  150. this.getList();
  151. },
  152. //重置按钮
  153. resetQuery(){
  154. this.$set(this,'queryParams',{
  155. pageNum:1,
  156. pageSize:20,
  157. gatewayName:"",
  158. });
  159. this.getList();
  160. },
  161. //获取数据列表
  162. getList(){
  163. this.$set(this,'loading',true);
  164. laboratoryLockGatewayList(this.queryParams).then(response => {
  165. this.$set(this,'dataList',response.rows);
  166. this.$set(this,'total',response.total);
  167. this.$set(this,'loading',false);
  168. });
  169. },
  170. //操作按钮
  171. tableButton(type,row){
  172. let self = this;
  173. if(type == 1){
  174. //新增
  175. this.$set(this,'dialogTitle','新增');
  176. this.$set(this,'dialogForm',{
  177. showType:false,
  178. gatewayName:'',
  179. gatewayMac:'',
  180. });
  181. this.$set(this,'dialogType',true);
  182. }else if(type == 2){
  183. //详情
  184. let obj = JSON.parse(JSON.stringify(row))
  185. obj.showType = true;
  186. this.$set(this,'dialogTitle','详情');
  187. this.$set(this,'dialogForm',obj);
  188. this.$set(this,'dialogType',true);
  189. }else if(type == 3){
  190. //编辑
  191. let obj = JSON.parse(JSON.stringify(row))
  192. obj.showType = false;
  193. this.$set(this,'dialogTitle','编辑');
  194. this.$set(this,'dialogForm',obj);
  195. this.$set(this,'dialogType',true);
  196. }else if(type == 4){
  197. //删除
  198. this.$confirm('是否确认删除?', "警告", {
  199. confirmButtonText: "确定",
  200. cancelButtonText: "取消",
  201. type: "warning"
  202. }).then(function() {
  203. }).then(() => {
  204. laboratoryLockGatewayDelGateway({id:row.id}).then(response => {
  205. self.msgSuccess(response.message)
  206. self.getList();
  207. });
  208. }).catch(() => {});
  209. }
  210. },
  211. //弹窗相关
  212. //监听关联记录弹窗关闭
  213. handleClose(){
  214. this.$refs["dialogForm"].clearValidate();
  215. this.$set(this,'dialogType',false);
  216. },
  217. //提交
  218. submitForm(){
  219. this.$refs["dialogForm"].validate(valid => {
  220. if (valid) {
  221. if(this.dialogForm.id){
  222. //编辑
  223. let obj = {
  224. id:this.dialogForm.id,
  225. gatewayName:this.dialogForm.gatewayName,
  226. gatewayMac:this.dialogForm.gatewayMac,
  227. }
  228. laboratoryLockGatewayPut(obj).then(response => {
  229. this.$set(this,'dialogType',false);
  230. this.msgSuccess(response.msg)
  231. this.getList();
  232. });
  233. }else{
  234. //新增
  235. let obj = {
  236. gatewayName:this.dialogForm.gatewayName,
  237. gatewayMac:this.dialogForm.gatewayMac,
  238. }
  239. laboratoryLockGatewayAdd(obj).then(response => {
  240. this.$set(this,'dialogType',false);
  241. this.msgSuccess(response.msg)
  242. this.getList();
  243. });
  244. }
  245. }
  246. })
  247. }
  248. },
  249. }
  250. </script>
  251. <style scoped lang="scss">
  252. .cabinetLockDisposition{
  253. flex: 1;
  254. display: flex;
  255. flex-direction: column;
  256. overflow: hidden;
  257. .cabinetLockDispositionPage{
  258. flex: 1;
  259. display: flex;
  260. flex-direction: column;
  261. overflow: hidden;
  262. .page-form-title-box{
  263. padding-top:20px;
  264. display: flex;
  265. border-bottom:1px solid #dedede;
  266. }
  267. .page-content-box{
  268. padding:20px;
  269. flex: 1;
  270. display: flex;
  271. flex-direction: column;
  272. overflow: hidden;
  273. }
  274. }
  275. }
  276. </style>