Rap 原分销系统代码Web
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

2b84c643170b9751a148a318a871e2fffb825635.svn-base 14KB

hace 5 meses
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  1. <template>
  2. <div class="app-container">
  3. <div style="margin-bottom:10px">
  4. <el-button type="success" @click="addBtn">新增</el-button>
  5. </div>
  6. <!--搜索-->
  7. <el-form class="mt_15" ref="form" inline size="small">
  8. <el-form-item label="应用名称">
  9. <el-input v-model.trim="searchParm.name" clearable placeholder="应用名称"></el-input>
  10. </el-form-item>
  11. <el-form-item label="应用id">
  12. <el-input v-model.trim="searchParm.robotUuid" clearable placeholder="应用id"></el-input>
  13. </el-form-item>
  14. <el-form-item>
  15. <el-button type="primary" @click="goSearch">搜索</el-button>
  16. <el-button type="warning" @click="resetForm">重置</el-button>
  17. </el-form-item>
  18. </el-form>
  19. <!--表格渲染-->
  20. <el-table
  21. ref="table"
  22. border
  23. size="small"
  24. :data="list"
  25. :header-cell-style="{textAlign:'center'}"
  26. :cell-style="{textAlign:'center'}"
  27. >
  28. <el-table-column label="序号" type="index" width="50" />
  29. <el-table-column label="应用名称" prop="name" />
  30. <el-table-column label="应用id" prop="robotUuid" />
  31. <el-table-column label="任务名称" prop="taskName" />
  32. <el-table-column label="方法名称" prop="methodName" />
  33. <el-table-column label="accessKeyId" prop="accessKeyId" />
  34. <el-table-column label="accessKeySecret" prop="accessKeySecret" />
  35. <el-table-column label="备注" prop="remark" />
  36. <el-table-column label="创建时间" prop="createdAt" />
  37. <el-table-column label="修改时间" prop="updatedAt" />
  38. <el-table-column label="操作" width="220">
  39. <template slot-scope="scope">
  40. <el-button type="info" @click="getBtnById(scope.row.id)">查看</el-button>
  41. <el-button type="warning" @click="editById(scope.row)">修改</el-button>
  42. <el-button type="danger" @click="delById(scope.row.id)">删除</el-button>
  43. </template>
  44. </el-table-column>
  45. </el-table>
  46. <!--分页-->
  47. <div class="mt_15">
  48. <el-pagination
  49. @size-change="handleSizeChange"
  50. @current-change="handleCurrentChange"
  51. :current-page="searchParm.page"
  52. :page-sizes="[10, 20, 30, 40, 50]"
  53. :page-size="searchParm.pageSize"
  54. layout="total, sizes, prev, pager, next, jumper"
  55. :total="total"
  56. ></el-pagination>
  57. </div>
  58. <!--新增弹窗-->
  59. <el-dialog :visible.sync="dialogAddVisible" :title="dialogAddTitle" center width="45%">
  60. <div class="dialog-content">
  61. <el-form ref="addParm" size="small" :model="addParm" :rules="rules" label-width="150px">
  62. <el-form-item label="应用名称" prop="name">
  63. <el-input v-model.trim="addParm.name" clearable></el-input>
  64. </el-form-item>
  65. <el-form-item label="应用ID" prop="robotUuid">
  66. <el-input v-model.trim="addParm.robotUuid" clearable></el-input>
  67. </el-form-item>
  68. <el-form-item label="任务名称" prop="taskName">
  69. <el-select v-model.trim="addParm.taskName" placeholder="请选择">
  70. <el-option
  71. v-for="item in taskList"
  72. :key="item.id"
  73. :label="item.name"
  74. :value="item.name"
  75. ></el-option>
  76. </el-select>
  77. </el-form-item>
  78. <el-form-item label="accessKeyId" prop="accessKeyId">
  79. <el-input v-model.trim="addParm.accessKeyId" clearable></el-input>
  80. </el-form-item>
  81. <el-form-item label="accessKeySecret" prop="accessKeySecret">
  82. <el-input v-model.trim="addParm.accessKeySecret" clearable></el-input>
  83. </el-form-item>
  84. <el-form-item label="备注" prop="remark">
  85. <el-input v-model.trim="addParm.remark" clearable></el-input>
  86. </el-form-item>
  87. </el-form>
  88. </div>
  89. <span slot="footer">
  90. <el-button type="info" @click="sureAddCancle('addParm')">取消</el-button>
  91. <el-button type="primary" @click="sureAdd('addParm')">确认</el-button>
  92. </span>
  93. </el-dialog>
  94. <!--修改弹窗-->
  95. <el-dialog :visible.sync="dialogEditVisible" :title="dialogEditTitle" center width="45%">
  96. <div class="dialog-content">
  97. <el-form ref="editParm" size="small" :model="editParm" :rules="rules" label-width="150px">
  98. <el-form-item label="应用名称" prop="name">
  99. <el-input v-model.trim="editParm.name" clearable></el-input>
  100. </el-form-item>
  101. <el-form-item label="应用ID" prop="robotUuid">
  102. <el-input v-model.trim="editParm.robotUuid" clearable></el-input>
  103. </el-form-item>
  104. <el-form-item label="任务名称" prop="taskName">
  105. <el-select v-model.trim="editParm.taskName" placeholder="请选择">
  106. <el-option
  107. v-for="item in taskList"
  108. :key="item.id"
  109. :label="item.name"
  110. :value="item.name">
  111. </el-option>
  112. </el-select>
  113. </el-form-item>
  114. <el-form-item label="accessKeyId" prop="accessKeyId">
  115. <el-input v-model.trim="editParm.accessKeyId" clearable></el-input>
  116. </el-form-item>
  117. <el-form-item label="accessKeySecret" prop="accessKeySecret">
  118. <el-input v-model.trim="editParm.accessKeySecret" clearable></el-input>
  119. </el-form-item>
  120. <el-form-item label="备注" prop="remark">
  121. <el-input v-model.trim="editParm.remark" clearable></el-input>
  122. </el-form-item>
  123. </el-form>
  124. </div>
  125. <span slot="footer">
  126. <el-button type="info" @click="sureEditCancle('editParm')">取消</el-button>
  127. <el-button type="primary" @click="sureEdit('editParm')">确认</el-button>
  128. </span>
  129. </el-dialog>
  130. <!--详情弹窗-->
  131. <el-dialog :visible.sync="dialogDetailVisible" :title="dialogDetailTitle" center width="45%">
  132. <div class="dialog-content">
  133. <el-form ref="form" size="small" label-width="130px">
  134. <el-form-item label="应用名称" prop="name">
  135. <el-input v-model.trim="detailParm.name" :disabled="true"></el-input>
  136. </el-form-item>
  137. <el-form-item label="应用ID" prop="robotUuid">
  138. <el-input v-model.trim="detailParm.robotUuid" :disabled="true"></el-input>
  139. </el-form-item>
  140. <el-form-item label="任务名称" prop="taskName">
  141. <el-input v-model.trim="detailParm.taskName" :disabled="true"></el-input>
  142. </el-form-item>
  143. <el-form-item label="方法名称" prop="methodName">
  144. <el-input v-model.trim="detailParm.methodName" :disabled="true"></el-input>
  145. </el-form-item>
  146. <el-form-item label="accessKeyId" prop="accessKeyId">
  147. <el-input v-model.trim="detailParm.accessKeyId" :disabled="true"></el-input>
  148. </el-form-item>
  149. <el-form-item label="accessKeySecret" prop="accessKeySecret">
  150. <el-input v-model.trim="detailParm.accessKeySecret" :disabled="true"></el-input>
  151. </el-form-item>
  152. <el-form-item label="备注" prop="remark">
  153. <el-input v-model.trim="detailParm.remark" :disabled="true"></el-input>
  154. </el-form-item>
  155. </el-form>
  156. </div>
  157. </el-dialog>
  158. </div>
  159. </template>
  160. <script>
  161. import { getList, add, delById, getById, editById } from "@/api/group/apply";
  162. export default {
  163. // 数据
  164. data() {
  165. return {
  166. taskList: [
  167. {
  168. id: 1,
  169. name: "demoTask"
  170. },
  171. {
  172. id: 2,
  173. name: "clickFarmTask"
  174. }, {
  175. id: 3,
  176. name: "clickFarmSuppleMentTask"
  177. }
  178. ],
  179. searchParm: {
  180. page: 1,
  181. pageSize: 10,
  182. sort: "created_at",
  183. order: "desc",
  184. name: null,
  185. robotUuid: null,
  186. remark: null
  187. },
  188. total: 0,
  189. list: [],
  190. dialogAddVisible: false,
  191. dialogAddTitle: "新增",
  192. dialogDetailVisible: false,
  193. dialogDetailTitle: "详情",
  194. dialogEditVisible: false,
  195. dialogEditTitle: "修改",
  196. dialogImportVisible: false,
  197. dialogImportTitle: "导入",
  198. addParm: {
  199. id: null,
  200. name: null,
  201. robotUuid: null,
  202. taskName: null,
  203. methodName: null,
  204. accessKeyId: null,
  205. accessKeySecret: null,
  206. remark: null
  207. },
  208. detailParm: {
  209. id: null,
  210. name: null,
  211. robotUuid: null,
  212. taskName: null,
  213. methodName: null,
  214. accessKeyId: null,
  215. accessKeySecret: null,
  216. remark: null
  217. },
  218. editParm: {
  219. id: null,
  220. name: null,
  221. robotUuid: null,
  222. taskName: null,
  223. methodName: null,
  224. accessKeyId: null,
  225. accessKeySecret: null,
  226. remark: null
  227. },
  228. rules: {
  229. name: [{ required: true, message: "请输入应用名称", trigger: "blur" }],
  230. robotUuid: [
  231. { required: true, message: "请输入应用id", trigger: "blur" }
  232. ],
  233. taskName: [
  234. { required: true, message: "请输入任务名称", trigger: "blur" }
  235. ],
  236. methodName: [
  237. { required: true, message: "请输入方法名称", trigger: "blur" }
  238. ],
  239. accessKeyId: [
  240. { required: true, message: "请输入accessKeyId", trigger: "blur" }
  241. ],
  242. accessKeySecret: [
  243. { required: true, message: "请输入accessKeySecret", trigger: "blur" }
  244. ],
  245. remark: [{ required: true, message: "请输入备注", trigger: "blur" }]
  246. }
  247. };
  248. },
  249. // 调用
  250. created() {
  251. this.goSearch();
  252. },
  253. //方法
  254. methods: {
  255. //重置
  256. resetForm() {
  257. this.searchParm.name = null;
  258. this.searchParm.robotUuid = null;
  259. this.searchParm.remark = null;
  260. this.goSearch();
  261. },
  262. // 查询
  263. goSearch() {
  264. this.searchParm.page = 1;
  265. this.getDataList();
  266. },
  267. // 新增
  268. addBtn() {
  269. this.addParm = {
  270. id: null,
  271. name: null,
  272. robotUuid: null,
  273. taskName: null,
  274. methodName: null,
  275. accessKeyId: null,
  276. accessKeySecret: null,
  277. remark: null
  278. };
  279. this.dialogAddTitle = "新增";
  280. this.dialogAddVisible = true;
  281. this.$refs.addParm.clearValidate();
  282. },
  283. // 根据id删除
  284. delById(id) {
  285. this.$confirm("确认删除?", "提示", {
  286. confirmButtonText: "确定",
  287. cancelButtonText: "取消",
  288. type: "warning"
  289. })
  290. .then(() => {
  291. delById({ id })
  292. .then(res => {
  293. if (res.code == 200) {
  294. this.$message.success("删除成功!");
  295. this.getDataList();
  296. }
  297. })
  298. .catch(err => {
  299. console.log(err);
  300. });
  301. })
  302. .catch(() => {
  303. this.$message.info("取消删除");
  304. });
  305. },
  306. // 修改
  307. editById(data) {
  308. this.$refs.editParm.clearValidate();
  309. getById({ id: data.id })
  310. .then(res => {
  311. if (res.code == 200) {
  312. this.editParm.id = res.data.id;
  313. this.editParm.name = res.data.name;
  314. this.editParm.robotUuid = res.data.robotUuid;
  315. this.editParm.taskName = res.data.taskName;
  316. this.editParm.accessKeyId = res.data.accessKeyId;
  317. this.editParm.accessKeySecret = res.data.accessKeySecret;
  318. this.editParm.remark = res.data.remark;
  319. this.dialogEditVisible = true;
  320. }
  321. })
  322. .catch(err => {
  323. console.log(err);
  324. });
  325. },
  326. // 确认修改
  327. sureEdit(editParm) {
  328. editById(this.editParm)
  329. .then(res => {
  330. if (res.code == 200) {
  331. console.log(res);
  332. this.dialogEditVisible = false;
  333. this.$message.success("修改成功!");
  334. this.getDataList();
  335. } else if (res.code == -1) {
  336. this.$message.warning(res.message);
  337. }
  338. })
  339. .catch(err => {
  340. console.log(err);
  341. });
  342. },
  343. sureEdit(editParm) {
  344. this.dialogEditVisible=flase
  345. this.$refs.editParm.clearValidate();
  346. },
  347. // 确认新增
  348. sureAdd(addParm) {
  349. add(this.addParm)
  350. .then(res => {
  351. if (res.code == 200) {
  352. this.dialogAddVisible = false;
  353. this.$message.success("新增成功!");
  354. this.getDataList();
  355. } else if (res.code == -1) {
  356. this.$message.warning(res.message);
  357. }
  358. })
  359. .catch(err => {
  360. console.log(err);
  361. });
  362. },
  363. sureAdd(addParm) {
  364. this.dialogAddVisible=flase
  365. this.$refs.addParm.clearValidate();
  366. },
  367. // 查看根据id
  368. getBtnById(id) {
  369. getById({ id })
  370. .then(res => {
  371. if (res.code == 200) {
  372. this.detailParm.id = res.data.id;
  373. this.detailParm.name = res.data.name;
  374. this.detailParm.robotUuid = res.data.robotUuid;
  375. this.detailParm.taskName = res.data.taskName;
  376. this.detailParm.methodName = res.data.methodName;
  377. this.detailParm.accessKeyId = res.data.accessKeyId;
  378. this.detailParm.accessKeySecret = res.data.accessKeySecret;
  379. this.detailParm.remark = res.data.remark;
  380. this.dialogDetailVisible = true;
  381. }
  382. })
  383. .catch(err => {
  384. console.log(err);
  385. });
  386. },
  387. // 分页获取表格数据
  388. getDataList() {
  389. getList(this.searchParm)
  390. .then(res => {
  391. console.log(res);
  392. if (res.code == 200) {
  393. console.log(res);
  394. this.list = res.data.list;
  395. this.total = res.data.total;
  396. }
  397. })
  398. .catch(err => {
  399. console.log(err);
  400. });
  401. },
  402. // 分页
  403. handleSizeChange(val) {
  404. console.log(`每页 ${val} 条`);
  405. this.searchParm.pageSize = val;
  406. this.getDataList();
  407. },
  408. handleCurrentChange(val) {
  409. console.log(`当前页: ${val}`);
  410. this.searchParm.page = val;
  411. this.getDataList();
  412. }
  413. }
  414. };
  415. </script>
  416. <style rel="stylesheet/scss" lang="scss" scoped>
  417. </style>