Rap 原分销系统代码Web
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

f4fc021f9a6cdd11a5a347a3a25fda08acab86f2.svn-base 21KB

5 months ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724
  1. <template>
  2. <div class="app-container">
  3. <div style="margin-bottom:10px">
  4. <el-button type="success" @click="addBtn">新增</el-button>
  5. <el-button type="success" @click="importBtn">导入</el-button>
  6. <el-button type="success" @click="exportTempBtn">模版下载</el-button>
  7. </div>
  8. <!--搜索-->
  9. <el-form class="mt_15" ref="form" inline size="small">
  10. <el-form-item label="所属国家简称">
  11. <el-input v-model.trim="searchParm.contntryShort" clearable placeholder='所属国家简称'></el-input>
  12. </el-form-item>
  13. <el-form-item label="IP地址">
  14. <el-input v-model.trim="searchParm.ipAddress" clearable placeholder='IP地址'></el-input>
  15. </el-form-item>
  16. <el-form-item label="父ip地址">
  17. <el-input v-model.trim="searchParm.parentIpAddress" clearable placeholder='父ip地址'></el-input>
  18. </el-form-item>
  19. <el-form-item label="端口">
  20. <el-input v-model.trim="searchParm.port" clearable placeholder='端口'></el-input>
  21. </el-form-item>
  22. <el-form-item label="名称">
  23. <el-input v-model.trim="searchParm.name" clearable placeholder='名称'></el-input>
  24. </el-form-item>
  25. <el-form-item label="密码">
  26. <el-input v-model.trim="searchParm.pwd" clearable placeholder='密码'></el-input>
  27. </el-form-item>
  28. <el-form-item label="mac地址">
  29. <el-input v-model.trim="searchParm.mac" clearable placeholder='mac地址'></el-input>
  30. </el-form-item>
  31. <el-form-item label="VPS类型">
  32. <el-select v-model.trim="searchParm.vpsType" placeholder="请选择">
  33. <el-option
  34. v-for="item in searchVpsTypeList"
  35. :key="item.value"
  36. :label="item.label"
  37. :value="item.value">
  38. </el-option>
  39. </el-select>
  40. </el-form-item>
  41. <el-form-item label="经销商">
  42. <el-select v-model.trim="searchParm.dealer" placeholder="请选择">
  43. <el-option
  44. v-for="item in searchDealerList"
  45. :key="item.value"
  46. :label="item.label"
  47. :value="item.value">
  48. </el-option>
  49. </el-select>
  50. </el-form-item>
  51. <el-form-item label="状态">
  52. <el-select v-model.trim="searchParm.status" placeholder="请选择">
  53. <el-option
  54. v-for="item in searchStatusList"
  55. :key="item.value"
  56. :label="item.label"
  57. :value="item.value">
  58. </el-option>
  59. </el-select>
  60. </el-form-item>
  61. <el-form-item>
  62. <el-button type="primary" @click="goSearch">搜索</el-button>
  63. <el-button type="warning" @click="resetForm">重置</el-button>
  64. </el-form-item>
  65. </el-form>
  66. <!--表格渲染-->
  67. <el-table ref="table" border size="small" :data="list" :header-cell-style="{textAlign:'center'}" :cell-style="{textAlign:'center'}">
  68. <el-table-column label="序号" type="index" width="50" />
  69. <el-table-column label="所属国家简称" prop="contntryShort" />
  70. <el-table-column label="IP地址" prop="ipAddress" />
  71. <el-table-column label="父ip地址" prop="parentIpAddress" />
  72. <el-table-column label="端口" prop="port" />
  73. <el-table-column label="名称" prop="name" />
  74. <el-table-column label="密码" prop="pwd" />
  75. <el-table-column label="VPS类型" prop="vpsType">
  76. <template slot-scope="scope">
  77. {{ scope.row.vpsType | getVpsType}}
  78. </template>
  79. </el-table-column>
  80. <el-table-column label="经销商" prop="dealer">
  81. <template slot-scope="scope">
  82. {{ scope.row.dealer | getDealer}}
  83. </template>
  84. </el-table-column>
  85. <el-table-column label="mac地址" prop="mac" />
  86. <el-table-column label="状态" prop="status">
  87. <template slot-scope="scope">
  88. {{ scope.row.status | getStatus}}
  89. </template>
  90. </el-table-column>
  91. <el-table-column label="创建时间" prop="createdAt" />
  92. <el-table-column label="修改时间" prop="updatedAt" />
  93. <el-table-column label="操作" width="220">
  94. <template slot-scope="scope">
  95. <el-button type="info" @click="getBtnById(scope.row.id)">查看</el-button>
  96. <el-button type="warning" @click="editById(scope.row)">修改</el-button>
  97. <el-button type="danger" @click="delById(scope.row.id)">删除</el-button>
  98. </template>
  99. </el-table-column>
  100. </el-table>
  101. <!--分页-->
  102. <div class="mt_15">
  103. <el-pagination
  104. @size-change="handleSizeChange"
  105. @current-change="handleCurrentChange"
  106. :current-page="searchParm.page"
  107. :page-sizes="[10, 20, 30, 40, 50]"
  108. :page-size="searchParm.pageSize"
  109. layout="total, sizes, prev, pager, next, jumper"
  110. :total="total">
  111. </el-pagination>
  112. </div>
  113. <!--新增弹窗-->
  114. <el-dialog :visible.sync="dialogAddVisible" :title="dialogAddTitle" center width="45%">
  115. <div class="dialog-content">
  116. <el-form ref="addParm" size="small" :model="addParm" :rules="rules" label-width="130px">
  117. <el-form-item label="所属国家简称" prop="contntryShort">
  118. <el-input v-model.trim="addParm.contntryShort" clearable></el-input>
  119. </el-form-item>
  120. <el-form-item label="IP地址" prop="ipAddress">
  121. <el-input v-model.trim="addParm.ipAddress" clearable></el-input>
  122. </el-form-item>
  123. <el-form-item label="父ip地址" prop="parentIpAddress">
  124. <el-input v-model.trim="addParm.parentIpAddress" clearable></el-input>
  125. </el-form-item>
  126. <el-form-item label="端口" prop="port">
  127. <el-input v-model.trim="addParm.port" clearable></el-input>
  128. </el-form-item>
  129. <el-form-item label="名称" prop="name">
  130. <el-input v-model.trim="addParm.name" clearable></el-input>
  131. </el-form-item>
  132. <el-form-item label="密码" prop="pwd">
  133. <el-input v-model.trim="addParm.pwd" clearable></el-input>
  134. </el-form-item>
  135. <el-form-item label="mac地址" prop="mac">
  136. <el-input v-model.trim="addParm.mac" clearable></el-input>
  137. </el-form-item>
  138. <el-form-item label="link" prop="link">
  139. <el-input v-model.trim="addParm.link" clearable></el-input>
  140. </el-form-item>
  141. <el-form-item label="VPS类型">
  142. <el-select v-model.trim="addParm.vpsType" placeholder="请选择">
  143. <el-option
  144. v-for="item in vpsTypeList"
  145. :key="item.value"
  146. :label="item.label"
  147. :value="item.value">
  148. </el-option>
  149. </el-select>`
  150. </el-form-item>
  151. <el-form-item label="经销商">
  152. <el-select v-model.trim="addParm.dealer" placeholder="请选择">
  153. <el-option
  154. v-for="item in dealerList"
  155. :key="item.value"
  156. :label="item.label"
  157. :value="item.value">
  158. </el-option>
  159. </el-select>
  160. </el-form-item>
  161. </el-form>
  162. </div>
  163. <span slot="footer">
  164. <el-button type="info" @click="sureAddCancle('addParm')">取消</el-button>
  165. <el-button type="primary" @click="sureAdd('addParm')">确认</el-button>
  166. </span>
  167. </el-dialog>
  168. <!--修改弹窗-->
  169. <el-dialog :visible.sync="dialogEditVisible" :title="dialogEditTitle" center width="45%">
  170. <div class="dialog-content">
  171. <el-form ref="editParm" size="small" :model="editParm" :rules="rules" label-width="130px">
  172. <el-form-item label="所属国家简称" prop="contntryShort">
  173. <el-input v-model.trim="editParm.contntryShort" clearable></el-input>
  174. </el-form-item>
  175. <el-form-item label="IP地址" prop="ipAddress">
  176. <el-input v-model.trim="editParm.ipAddress" clearable></el-input>
  177. </el-form-item>
  178. <el-form-item label="父ip地址" prop="parentIpAddress">
  179. <el-input v-model.trim="editParm.parentIpAddress" clearable></el-input>
  180. </el-form-item>
  181. <el-form-item label="端口" prop="port">
  182. <el-input v-model.trim="editParm.port" clearable></el-input>
  183. </el-form-item>
  184. <el-form-item label="名称" prop="name">
  185. <el-input v-model.trim="editParm.name" clearable></el-input>
  186. </el-form-item>
  187. <el-form-item label="密码" prop="pwd">
  188. <el-input v-model.trim="editParm.pwd" clearable></el-input>
  189. </el-form-item>
  190. <el-form-item label="mac地址" prop="mac">
  191. <el-input v-model.trim="editParm.mac" clearable></el-input>
  192. </el-form-item>
  193. <el-form-item label="link" prop="link">
  194. <el-input v-model.trim="editParm.link" clearable></el-input>
  195. </el-form-item>
  196. <el-form-item label="VPS类型">
  197. <el-select v-model.trim="editParm.vpsType" placeholder="请选择">
  198. <el-option
  199. v-for="item in vpsTypeList"
  200. :key="item.value"
  201. :label="item.label"
  202. :value="item.value">
  203. </el-option>
  204. </el-select>`
  205. </el-form-item>
  206. <el-form-item label="经销商">
  207. <el-select v-model.trim="editParm.dealer" placeholder="请选择">
  208. <el-option
  209. v-for="item in dealerList"
  210. :key="item.value"
  211. :label="item.label"
  212. :value="item.value">
  213. </el-option>
  214. </el-select>
  215. </el-form-item>
  216. <el-form-item label="状态">
  217. <el-select v-model.trim="editParm.status" placeholder="请选择">
  218. <el-option
  219. v-for="item in statusList"
  220. :key="item.value"
  221. :label="item.label"
  222. :value="item.value">
  223. </el-option>
  224. </el-select>
  225. </el-form-item>
  226. </el-form>
  227. </div>
  228. <span slot="footer">
  229. <el-button type="info" @click="sureEditCancle(editParm)">取消</el-button>
  230. <el-button type="primary" @click="sureEdit('editParm')">确认</el-button>
  231. </span>
  232. </el-dialog>
  233. <!--详情弹窗-->
  234. <el-dialog :visible.sync="dialogDetailVisible" :title="dialogDetailTitle" center width="45%">
  235. <div class="dialog-content">
  236. <el-form ref="form" size="small" label-width="130px">
  237. <el-form-item label="所属国家简称" prop="contntryShort">
  238. <el-input v-model.trim="detailParm.contntryShort" :disabled="true"></el-input>
  239. </el-form-item>
  240. <el-form-item label="IP地址" prop="ipAddress">
  241. <el-input v-model.trim="detailParm.ipAddress" :disabled="true"></el-input>
  242. </el-form-item>
  243. <el-form-item label="父ip地址" prop="parentIpAddress">
  244. <el-input v-model.trim="detailParm.parentIpAddress" :disabled="true"></el-input>
  245. </el-form-item>
  246. <el-form-item label="端口" prop="port">
  247. <el-input v-model.trim="detailParm.port" :disabled="true"></el-input>
  248. </el-form-item>
  249. <el-form-item label="名称" prop="name">
  250. <el-input v-model.trim="detailParm.name" :disabled="true"></el-input>
  251. </el-form-item>
  252. <el-form-item label="密码" prop="pwd">
  253. <el-input v-model.trim="detailParm.pwd" :disabled="true"></el-input>
  254. </el-form-item>
  255. <el-form-item label="mac地址" prop="mac">
  256. <el-input v-model.trim="detailParm.mac" :disabled="true"></el-input>
  257. </el-form-item>
  258. <el-form-item label="link" prop="link">
  259. <el-input v-model.trim="detailParm.link" :disabled="true"></el-input>
  260. </el-form-item>
  261. <el-form-item label="VPS类型">
  262. <el-select v-model.trim="detailParm.vpsType" disabled>
  263. <el-option
  264. v-for="item in vpsTypeList"
  265. :key="item.value"
  266. :label="item.label"
  267. :value="item.value">
  268. </el-option>
  269. </el-select>`
  270. </el-form-item>
  271. <el-form-item label="经销商">
  272. <el-select v-model.trim="detailParm.dealer" disabled placeholder="请选择">
  273. <el-option
  274. v-for="item in dealerList"
  275. :key="item.value"
  276. :label="item.label"
  277. :value="item.value">
  278. </el-option>
  279. </el-select>
  280. </el-form-item>
  281. <el-form-item label="状态" prop="status">
  282. <el-select v-model.trim="detailParm.status" disabled placeholder="请选择">
  283. <el-option
  284. v-for="item in statusList"
  285. :key="item.value"
  286. :label="item.label"
  287. :value="item.value">
  288. </el-option>
  289. </el-select>
  290. </el-form-item>
  291. </el-form>
  292. </div>
  293. </el-dialog>
  294. <!--Vpn信息导入 importBtn-->
  295. <el-dialog :visible.sync="dialogImportVisible" :title="dialogImportTitle" center width="23%">
  296. <div class="dialog-content">
  297. <el-upload
  298. class="upload-demo"
  299. drag
  300. ref="upload"
  301. :action="uploadFileUrl"
  302. :headers="uploadHeaders"
  303. :show-file-list = "false"
  304. :on-success="uploadSuccess"
  305. :before-upload="beforeAvatarUpload"
  306. multiple>
  307. <i class="el-icon-upload"></i>
  308. <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  309. <div class="el-upload__tip" slot="tip">只能上传xlsl文件,且不超过10M</div>
  310. </el-upload>
  311. </div>
  312. </el-dialog>
  313. </div>
  314. </template>
  315. <script>
  316. import { getList, add, delById, getById, editById} from '@/api/group/vpn'
  317. export default {
  318. filters: {
  319. getVpsType: function (value) {
  320. if(value == 1) {
  321. return '传统';
  322. }
  323. },
  324. getDealer: function (value) {
  325. if(value == 1) {
  326. return 'V2';
  327. }
  328. },
  329. getStatus: function (value) {
  330. if(value == 1) {
  331. return '可用';
  332. } else if (value == 2) {
  333. return '禁用';
  334. }
  335. }
  336. },
  337. // 数据
  338. data() {
  339. return {
  340. searchParm: {
  341. page: 1,
  342. pageSize: 10,
  343. sort:'created_at',
  344. order:'desc',
  345. contntryShort:null,
  346. ipAddress:null,
  347. parentIpAddress:null,
  348. port:null,
  349. name:null,
  350. pwd:null,
  351. vpsType:null,
  352. dealer:null,
  353. mac:null,
  354. status:null,
  355. },
  356. total:0,
  357. list: [],
  358. uploadHeaders:{ Authorization: this.$store.getters.token },
  359. dialogAddVisible: false,
  360. dialogAddTitle: '新增',
  361. dialogDetailVisible: false,
  362. dialogDetailTitle: '详情',
  363. dialogEditVisible: false,
  364. dialogEditTitle: '修改',
  365. dialogImportVisible: false,
  366. dialogImportTitle:'导入',
  367. uploadFileUrl: process.env.VUE_APP_BASE_API + '/api/ctVpn/import',
  368. tempUrl: process.env.VUE_APP_BASE_API + '/api/ctVpn/exportTemp',
  369. vpsTypeList:[
  370. {
  371. value:1,
  372. label:"传统"
  373. }],
  374. searchVpsTypeList:[{
  375. value: null,
  376. label: '全部'
  377. },
  378. {
  379. value:1,
  380. label:"传统"
  381. }],
  382. searchDealerList:[{
  383. value: null,
  384. label: '全部'
  385. },
  386. {
  387. value: 1,
  388. label: 'V2'
  389. }],
  390. dealerList:[
  391. {
  392. value: 1,
  393. label: 'V2'
  394. }],
  395. searchStatusList:[{
  396. value: null,
  397. label: '全部'
  398. },
  399. {
  400. value: 1,
  401. label: '可用'
  402. },
  403. {
  404. value: 2,
  405. label: '禁用'
  406. }],
  407. statusList:[{
  408. value: 1,
  409. label: '可用'
  410. },
  411. {
  412. value: 2,
  413. label: '禁用'
  414. }],
  415. addParm: {
  416. id:null,
  417. contntryShort:null,
  418. ipAddress:null,
  419. parentIpAddress:null,
  420. port:null,
  421. name:null,
  422. pwd:null,
  423. vpsType:null,
  424. dealer:null,
  425. mac:null,
  426. link:null,
  427. status:null,
  428. },
  429. detailParm: {
  430. id:null,
  431. contntryShort:null,
  432. ipAddress:null,
  433. parentIpAddress:null,
  434. port:null,
  435. name:null,
  436. pwd:null,
  437. vpsType:null,
  438. dealer:null,
  439. mac:null,
  440. link:null,
  441. status:null,
  442. },
  443. editParm: {
  444. id:null,
  445. contntryShort:null,
  446. ipAddress:null,
  447. parentIpAddress:null,
  448. port:null,
  449. name:null,
  450. pwd:null,
  451. vpsType:null,
  452. dealer:null,
  453. mac:null,
  454. link:null,
  455. status:null,
  456. },
  457. rules: {
  458. contntryShort: [
  459. { required: true, message: '请输入国家简称', trigger: 'blur' }
  460. ],
  461. ipAddress: [
  462. { required: true, message: '请输入IP地址', trigger: 'blur' }
  463. ],
  464. parentIpAddress: [
  465. { required: true, message: '请输入父ip地址', trigger: 'blur' }
  466. ],
  467. port: [
  468. { required: true, message: '请输入端口', trigger: 'blur' },
  469. {pattern: /^[+]?(0|([1-9]\d*))?$/, message: "请输入正确数字", trigger: "blur"}
  470. ],
  471. name: [
  472. { required: true, message: '请输入名称', trigger: 'blur' }
  473. ],
  474. pwd: [
  475. { required: true, message: '请输入密码', trigger: 'blur' }
  476. ],
  477. vpsType: [
  478. { required: true, message: '请输入VPS类型', trigger: 'blur' }
  479. ],
  480. dealer: [
  481. { required: true, message: '请输入经销商', trigger: 'blur' }
  482. ],
  483. mac: [
  484. { required: true, message: '请输入mac地址', trigger: 'blur' }
  485. ],
  486. link: [
  487. { required: true, message: '请输入Link信息', trigger: 'blur' }
  488. ],
  489. status: [
  490. { required: true, message: '请输入状态', trigger: 'blur' }
  491. ]
  492. }
  493. }
  494. },
  495. // 调用
  496. created() {
  497. this.goSearch()
  498. },
  499. //方法
  500. methods: {
  501. //重置
  502. resetForm() {
  503. this.searchParm.contntryShort = null;
  504. this.searchParm.ipAddress = null;
  505. this.searchParm.parentIpAddress = null;
  506. this.searchParm.port = null;
  507. this.searchParm.name = null;
  508. this.searchParm.pwd = null;
  509. this.searchParm.vpsType = null;
  510. this.searchParm.dealer = null;
  511. this.searchParm.mac = null;
  512. this.searchParm.status = null;
  513. this.goSearch()
  514. },
  515. // 查询
  516. goSearch() {
  517. this.searchParm.page=1
  518. this.getDataList()
  519. },
  520. //导入成功
  521. uploadSuccess(res, file) {
  522. this.dialogImportVisible = false;
  523. if(res.code==200) {
  524. console.log(res.data);
  525. if(res.data != null) {
  526. window.location.href = res.data;
  527. this.$message.error('导入失败!');
  528. }
  529. else{
  530. this.$message.success('导入成功!');
  531. }
  532. }
  533. this.goSearch();
  534. },
  535. beforeAvatarUpload(file) {
  536. console.log(file);
  537. const isLt10M = file.size / 1024 / 1024 <10;
  538. if (!isLt10M) {
  539. this.$message.error('上传Excel文件大小不能超过 10MB!');
  540. }
  541. return isLt10M;
  542. },
  543. // 导入
  544. importBtn() {
  545. this.dialogImportVisible = true
  546. },
  547. //vpn模板
  548. exportTempBtn() {
  549. console.log(this.tempUrl)
  550. window.location.href = this.tempUrl;
  551. },
  552. // 新增
  553. addBtn(){
  554. this.addParm = {
  555. id:null,
  556. contntryShort:'',
  557. ipAddress:'',
  558. parentIpAddress:'',
  559. port:'',
  560. name:'',
  561. pwd:'',
  562. vpsType:null,
  563. dealer:null,
  564. mac:'',
  565. link:'',
  566. status:null,
  567. }
  568. this.dialogAddTitle='新增'
  569. this.dialogAddVisible = true;
  570. this.$refs.addParm.clearValidate();
  571. },
  572. // 根据id删除
  573. delById(id){
  574. this.$confirm('确认删除?','提示',{
  575. confirmButtonText: '确定',
  576. cancelButtonText: '取消',
  577. type: 'warning'
  578. }).then(() => {
  579. delById({id}).then(res => {
  580. if(res.code==200) {
  581. this.$message.success('删除成功!')
  582. this.getDataList()
  583. }
  584. }).catch(err => {
  585. console.log(err)
  586. })
  587. }).catch(() => {
  588. this.$message.info('取消删除')
  589. })
  590. },
  591. // 修改
  592. editById(data){
  593. getById({id: data.id}).then(res => {
  594. if(res.code==200) {
  595. this.editParm.id = res.data.id;
  596. this.editParm.contntryShort = res.data.contntryShort;
  597. this.editParm.ipAddress = res.data.ipAddress;
  598. this.editParm.parentIpAddress = res.data.parentIpAddress;
  599. this.editParm.port = res.data.port;
  600. this.editParm.name = res.data.name;
  601. this.editParm.pwd = res.data.pwd;
  602. this.editParm.vpsType = res.data.vpsType;
  603. this.editParm.dealer = res.data.dealer;
  604. this.editParm.mac = res.data.mac;
  605. this.editParm.link = res.data.link;
  606. this.editParm.status = res.data.status;
  607. this.dialogEditVisible = true;
  608. this.$refs.editParm.clearValidate();
  609. }
  610. }).catch(err => {
  611. console.log(err)
  612. })
  613. },
  614. // 确认修改
  615. sureEdit(editParm){
  616. this.$refs[editParm].validate((valid) => {
  617. if (valid) {
  618. editById(this.editParm).then(res => {
  619. if(res.code==200) {
  620. console.log(res);
  621. this.$refs.editParm.clearValidate();
  622. this.dialogEditVisible = false
  623. this.$message.success('修改成功!');
  624. this.getDataList();
  625. }
  626. }).catch(err => {
  627. console.log(err)
  628. })
  629. } else {
  630. console.log('error submit!!');
  631. return false;
  632. }
  633. });
  634. },
  635. // 确认新增
  636. sureAdd(addParm){
  637. this.$refs[addParm].validate((valid) => {
  638. if (valid) {
  639. add(this.addParm).then(res => {
  640. if(res.code==200) {
  641. this.dialogAddVisible = false
  642. this.$message.success('新增成功!');
  643. this.$refs.addParm.clearValidate();
  644. this.getDataList()
  645. }
  646. }).catch(err => {
  647. console.log(err)
  648. })
  649. } else {
  650. console.log('error submit!!');
  651. return false;
  652. }
  653. });
  654. },
  655. sureAddCancle(addParm) {
  656. this.dialogAddVisible=flase;
  657. this.$refs.addParm.clearValidate();
  658. },
  659. sureEditCancle(editParm) {
  660. this.dialogEditVisible=false;
  661. this.$refs.editParm.clearValidate();
  662. },
  663. // 查看根据id
  664. getBtnById(id){
  665. getById({id}).then(res => {
  666. if(res.code==200) {
  667. this.detailParm.id = res.data.id;
  668. this.detailParm.contntryShort = res.data.contntryShort;
  669. this.detailParm.ipAddress = res.data.ipAddress;
  670. this.detailParm.parentIpAddress = res.data.parentIpAddress;
  671. this.detailParm.port = res.data.port;
  672. this.detailParm.name = res.data.name;
  673. this.detailParm.pwd = res.data.pwd;
  674. this.detailParm.vpsType = res.data.vpsType;
  675. this.detailParm.dealer = res.data.dealer;
  676. this.detailParm.mac = res.data.mac;
  677. this.detailParm.link = res.data.link;
  678. this.detailParm.status = res.data.status;
  679. this.dialogDetailVisible = true
  680. }
  681. }).catch(err => {
  682. console.log(err)
  683. })
  684. },
  685. // 分页获取表格数据
  686. getDataList(){
  687. getList(this.searchParm).then(res => {
  688. console.log(res)
  689. if(res.code==200) {
  690. console.log(res)
  691. this.list = res.data.list;
  692. this.total = res.data.total;
  693. }
  694. }).catch(err => {
  695. console.log(err)
  696. })
  697. },
  698. // 分页
  699. handleSizeChange(val) {
  700. console.log(`每页 ${val} 条`);
  701. this.searchParm.pageSize = val;
  702. this.getDataList();
  703. },
  704. handleCurrentChange(val) {
  705. console.log(`当前页: ${val}`);
  706. this.searchParm.page = val;
  707. this.getDataList();
  708. }
  709. }
  710. }
  711. </script>
  712. <style rel="stylesheet/scss" lang="scss" scoped>
  713. </style>