ClientConfig.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <template>
  2. <div>
  3. <section class="content">
  4. <div class="box box-info">
  5. <!-- 正文信息 -->
  6. <div class="box-body">
  7. <el-form
  8. ref="viewForm"
  9. :inline="true"
  10. :model="viewForm"
  11. inline-message
  12. class="el-form-linemess"
  13. label-position="right"
  14. >
  15. <el-row>
  16. <el-col :span="20"><span>客户端使用权限配置</span></el-col>
  17. <el-col :span="4"
  18. ><div>
  19. <el-button type="primary" size="small" @click="save"
  20. >保存</el-button
  21. >
  22. <el-button type="primary" size="small" @click="downFile"
  23. >下载控制文件</el-button
  24. >
  25. </div></el-col
  26. ></el-row
  27. >
  28. <div class="block-seperator"></div>
  29. <el-row>
  30. <el-form-item
  31. label="时间控制"
  32. prop="properties.CLIENT_TIME_RANGE"
  33. label-width="100px"
  34. >
  35. <el-date-picker
  36. v-model="viewForm.properties.CLIENT_TIME_RANGE"
  37. type="datetimerange"
  38. range-separator="至"
  39. start-placeholder="开始日期"
  40. end-placeholder="结束日期"
  41. value-format="yyyy-MM-dd HH:mm:ss"
  42. :clearable="false"
  43. ></el-date-picker>
  44. </el-form-item>
  45. <span class="text-span"
  46. >在系统使用时间范围内进行配置,未设置客户端默认与系统使用权限时间一致</span
  47. >
  48. </el-row>
  49. <el-row>
  50. <el-form-item
  51. label="IP控制"
  52. prop="properties.CLIENT_IP_RANGE"
  53. label-width="100px"
  54. class="btn-item"
  55. >
  56. <el-button type="primary" size="mini" plain @click="clearIp()"
  57. >清除</el-button
  58. >
  59. <el-button type="primary" size="mini" plain @click="addIp(0)"
  60. >新增</el-button
  61. >
  62. </el-form-item>
  63. <span class="text-span"
  64. >*设置允许使用的IP地址,,用“ * ”表示不固定值</span
  65. >
  66. </el-row>
  67. <el-row>
  68. <div
  69. v-if="viewForm.properties.CLIENT_IP_RANGE.length > 0"
  70. style="padding-left: 100px"
  71. >
  72. <div
  73. v-for="(item, index) in viewForm.properties.CLIENT_IP_RANGE"
  74. :key="index"
  75. >
  76. <el-input
  77. v-model="viewForm.properties.CLIENT_IP_RANGE[index]"
  78. class="input-div"
  79. ></el-input>
  80. <el-button
  81. style="margin: 0 0 0 30px"
  82. type="danger"
  83. circle
  84. size="mini"
  85. icon="el-icon-minus"
  86. @click="delIp(index)"
  87. ></el-button>
  88. <el-button
  89. circle
  90. size="mini"
  91. icon="el-icon-plus"
  92. @click="addIp(index + 1)"
  93. ></el-button>
  94. </div>
  95. </div>
  96. </el-row>
  97. <el-row>
  98. <el-form-item
  99. label="电脑控制"
  100. prop="properties.CLIENT_MAC_RANGE"
  101. label-width="100px"
  102. class="btn-item"
  103. >
  104. <el-button type="primary" size="mini" plain @click="clearMac()"
  105. >清除</el-button
  106. >
  107. <el-button type="primary" size="mini" plain @click="addMac(0)"
  108. >新增</el-button
  109. >
  110. </el-form-item>
  111. <span class="text-span">*设置允许使用的电脑mac地址</span>
  112. </el-row>
  113. <el-row>
  114. <div
  115. v-if="viewForm.properties.CLIENT_MAC_RANGE.length > 0"
  116. style="padding-left: 100px"
  117. >
  118. <div
  119. v-for="(item, index) in viewForm.properties.CLIENT_MAC_RANGE"
  120. :key="index"
  121. >
  122. <el-input
  123. v-model="viewForm.properties.CLIENT_MAC_RANGE[index]"
  124. class="input-div"
  125. ></el-input>
  126. <el-button
  127. style="margin: 0 0 0 30px"
  128. type="danger"
  129. circle
  130. size="mini"
  131. icon="el-icon-minus"
  132. @click="delMac(index)"
  133. ></el-button>
  134. <el-button
  135. circle
  136. size="mini"
  137. icon="el-icon-plus"
  138. @click="addMac(index + 1)"
  139. ></el-button>
  140. </div>
  141. </div>
  142. </el-row>
  143. </el-form>
  144. </div>
  145. </div>
  146. </section>
  147. </div>
  148. </template>
  149. <script>
  150. import { mapState } from "vuex";
  151. import { QUESTION_API } from "@/constants/constants.js";
  152. export default {
  153. components: {},
  154. data() {
  155. return {
  156. viewForm: {
  157. properties: {
  158. CLIENT_TIME_RANGE: [],
  159. CLIENT_IP_RANGE: [],
  160. CLIENT_MAC_RANGE: [],
  161. },
  162. },
  163. form: {
  164. orgId: null,
  165. properties: {
  166. CLIENT_TIME_RANGE: "",
  167. CLIENT_IP_RANGE: "",
  168. CLIENT_MAC_RANGE: "",
  169. },
  170. },
  171. };
  172. },
  173. computed: {
  174. ...mapState({ user: (state) => state.user }),
  175. },
  176. created() {
  177. this.form.orgId = this.user.rootOrgId;
  178. this.init();
  179. },
  180. methods: {
  181. downFile() {},
  182. clearMac() {
  183. this.viewForm.properties.CLIENT_MAC_RANGE = [];
  184. },
  185. delMac(index) {
  186. this.viewForm.properties.CLIENT_MAC_RANGE.splice(index, 1);
  187. },
  188. addMac(index) {
  189. this.viewForm.properties.CLIENT_MAC_RANGE.splice(index, 0, "");
  190. },
  191. clearIp() {
  192. this.viewForm.properties.CLIENT_IP_RANGE = [];
  193. },
  194. delIp(index) {
  195. this.viewForm.properties.CLIENT_IP_RANGE.splice(index, 1);
  196. },
  197. addIp(index) {
  198. this.viewForm.properties.CLIENT_IP_RANGE.splice(index, 0, "");
  199. },
  200. init() {
  201. var url = QUESTION_API + "/org/allProperties/" + this.form.orgId;
  202. this.$httpWithMsg.get(url).then((response) => {
  203. if (response.data) {
  204. if (response.data.CLIENT_TIME_RANGE) {
  205. this.viewForm.properties.CLIENT_TIME_RANGE = JSON.parse(
  206. response.data.CLIENT_TIME_RANGE
  207. );
  208. }
  209. if (response.data.CLIENT_IP_RANGE) {
  210. this.viewForm.properties.CLIENT_IP_RANGE = JSON.parse(
  211. response.data.CLIENT_IP_RANGE
  212. );
  213. }
  214. if (response.data.CLIENT_MAC_RANGE) {
  215. this.viewForm.properties.CLIENT_MAC_RANGE = JSON.parse(
  216. response.data.CLIENT_MAC_RANGE
  217. );
  218. }
  219. }
  220. });
  221. },
  222. setParams() {
  223. this.form.properties.CLIENT_TIME_RANGE = JSON.stringify(
  224. this.viewForm.properties.CLIENT_TIME_RANGE
  225. );
  226. this.form.properties.CLIENT_IP_RANGE = JSON.stringify(
  227. this.viewForm.properties.CLIENT_IP_RANGE
  228. );
  229. this.form.properties.CLIENT_MAC_RANGE = JSON.stringify(
  230. this.viewForm.properties.CLIENT_MAC_RANGE
  231. );
  232. },
  233. save() {
  234. this.setParams();
  235. let url = QUESTION_API + "/org/saveOrgProperties";
  236. this.$httpWithMsg.put(url, this.form).then(() => {
  237. this.$notify({
  238. type: "success",
  239. message: "保存成功",
  240. });
  241. });
  242. },
  243. },
  244. };
  245. </script>
  246. <style scoped>
  247. .input >>> .el-input__inner {
  248. -webkit-appearance: button;
  249. }
  250. .text-span {
  251. line-height: 40px;
  252. margin-left: 80px;
  253. font-size: 14px;
  254. color: #949494;
  255. }
  256. .input-div {
  257. width: 400px;
  258. }
  259. .btn-item {
  260. width: 500px;
  261. }
  262. </style>