index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="链接后缀" prop="link">
  5. <el-input
  6. v-model="queryParams.link"
  7. placeholder="请输入链接后缀"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="真实链接" prop="realLink">
  14. <el-input
  15. v-model="queryParams.realLink"
  16. placeholder="请输入真实链接"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item label="公司id" prop="companyId">
  23. <el-input
  24. v-model="queryParams.companyId"
  25. placeholder="请输入公司id"
  26. clearable
  27. size="small"
  28. @keyup.enter.native="handleQuery"
  29. />
  30. </el-form-item>
  31. <el-form-item label="销售id" prop="companyUserId">
  32. <el-input
  33. v-model="queryParams.companyUserId"
  34. placeholder="请输入销售id"
  35. clearable
  36. size="small"
  37. @keyup.enter.native="handleQuery"
  38. />
  39. </el-form-item>
  40. <el-form-item label="企微userId" prop="qwUserId">
  41. <el-input
  42. v-model="queryParams.qwUserId"
  43. placeholder="请输入企微userId"
  44. clearable
  45. size="small"
  46. @keyup.enter.native="handleQuery"
  47. />
  48. </el-form-item>
  49. <el-form-item label="课节id" prop="videoId">
  50. <el-input
  51. v-model="queryParams.videoId"
  52. placeholder="请输入课节id"
  53. clearable
  54. size="small"
  55. @keyup.enter.native="handleQuery"
  56. />
  57. </el-form-item>
  58. <el-form-item label="企微主体id" prop="corpId">
  59. <el-input
  60. v-model="queryParams.corpId"
  61. placeholder="请输入企微主体id"
  62. clearable
  63. size="small"
  64. @keyup.enter.native="handleQuery"
  65. />
  66. </el-form-item>
  67. <el-form-item>
  68. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  69. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  70. </el-form-item>
  71. </el-form>
  72. <el-row :gutter="10" class="mb8">
  73. <el-col :span="1.5">
  74. <el-button
  75. type="primary"
  76. plain
  77. icon="el-icon-plus"
  78. size="mini"
  79. @click="handleAdd"
  80. v-hasPermi="['course:courseLink:add']"
  81. >新增</el-button>
  82. </el-col>
  83. <el-col :span="1.5">
  84. <el-button
  85. type="success"
  86. plain
  87. icon="el-icon-edit"
  88. size="mini"
  89. :disabled="single"
  90. @click="handleUpdate"
  91. v-hasPermi="['course:courseLink:edit']"
  92. >修改</el-button>
  93. </el-col>
  94. <el-col :span="1.5">
  95. <el-button
  96. type="danger"
  97. plain
  98. icon="el-icon-delete"
  99. size="mini"
  100. :disabled="multiple"
  101. @click="handleDelete"
  102. v-hasPermi="['course:courseLink:remove']"
  103. >删除</el-button>
  104. </el-col>
  105. <el-col :span="1.5">
  106. <el-button
  107. type="warning"
  108. plain
  109. icon="el-icon-download"
  110. size="mini"
  111. :loading="exportLoading"
  112. @click="handleExport"
  113. v-hasPermi="['course:courseLink:export']"
  114. >导出</el-button>
  115. </el-col>
  116. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  117. </el-row>
  118. <el-table border v-loading="loading" :data="courseLinkList" @selection-change="handleSelectionChange">
  119. <el-table-column type="selection" width="55" align="center" />
  120. <el-table-column label="主键Id" align="center" prop="linkId" />
  121. <el-table-column label="链接后缀" align="center" prop="link" />
  122. <el-table-column label="真实链接" align="center" prop="realLink" />
  123. <el-table-column label="公司id" align="center" prop="companyId" />
  124. <el-table-column label="销售id" align="center" prop="companyUserId" />
  125. <el-table-column label="企微userId" align="center" prop="qwUserId" />
  126. <el-table-column label="课节id" align="center" prop="videoId" />
  127. <el-table-column label="企微主体id" align="center" prop="corpId" />
  128. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  129. <template slot-scope="scope">
  130. <el-button
  131. size="mini"
  132. type="text"
  133. icon="el-icon-edit"
  134. @click="handleUpdate(scope.row)"
  135. v-hasPermi="['course:courseLink:edit']"
  136. >修改</el-button>
  137. <el-button
  138. size="mini"
  139. type="text"
  140. icon="el-icon-delete"
  141. @click="handleDelete(scope.row)"
  142. v-hasPermi="['course:courseLink:remove']"
  143. >删除</el-button>
  144. </template>
  145. </el-table-column>
  146. </el-table>
  147. <pagination
  148. v-show="total>0"
  149. :total="total"
  150. :page.sync="queryParams.pageNum"
  151. :limit.sync="queryParams.pageSize"
  152. @pagination="getList"
  153. />
  154. <!-- 添加或修改短链对话框 -->
  155. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  156. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  157. <el-form-item label="链接后缀" prop="link">
  158. <el-input v-model="form.link" placeholder="请输入链接后缀" />
  159. </el-form-item>
  160. <el-form-item label="真实链接" prop="realLink">
  161. <el-input v-model="form.realLink" placeholder="请输入真实链接" />
  162. </el-form-item>
  163. <el-form-item label="公司id" prop="companyId">
  164. <el-input v-model="form.companyId" placeholder="请输入公司id" />
  165. </el-form-item>
  166. <el-form-item label="销售id" prop="companyUserId">
  167. <el-input v-model="form.companyUserId" placeholder="请输入销售id" />
  168. </el-form-item>
  169. <el-form-item label="企微userId" prop="qwUserId">
  170. <el-input v-model="form.qwUserId" placeholder="请输入企微userId" />
  171. </el-form-item>
  172. <el-form-item label="课节id" prop="videoId">
  173. <el-input v-model="form.videoId" placeholder="请输入课节id" />
  174. </el-form-item>
  175. <el-form-item label="企微主体id" prop="corpId">
  176. <el-input v-model="form.corpId" placeholder="请输入企微主体id" />
  177. </el-form-item>
  178. </el-form>
  179. <div slot="footer" class="dialog-footer">
  180. <el-button type="primary" @click="submitForm">确 定</el-button>
  181. <el-button @click="cancel">取 消</el-button>
  182. </div>
  183. </el-dialog>
  184. </div>
  185. </template>
  186. <script>
  187. import { listCourseLink, getCourseLink, delCourseLink, addCourseLink, updateCourseLink, exportCourseLink } from "@/api/course/courseLink";
  188. export default {
  189. name: "CourseLink",
  190. data() {
  191. return {
  192. // 遮罩层
  193. loading: true,
  194. // 导出遮罩层
  195. exportLoading: false,
  196. // 选中数组
  197. ids: [],
  198. // 非单个禁用
  199. single: true,
  200. // 非多个禁用
  201. multiple: true,
  202. // 显示搜索条件
  203. showSearch: true,
  204. // 总条数
  205. total: 0,
  206. // 短链表格数据
  207. courseLinkList: [],
  208. // 弹出层标题
  209. title: "",
  210. // 是否显示弹出层
  211. open: false,
  212. // 查询参数
  213. queryParams: {
  214. pageNum: 1,
  215. pageSize: 10,
  216. link: null,
  217. realLink: null,
  218. companyId: null,
  219. companyUserId: null,
  220. qwUserId: null,
  221. videoId: null,
  222. corpId: null
  223. },
  224. // 表单参数
  225. form: {},
  226. // 表单校验
  227. rules: {
  228. }
  229. };
  230. },
  231. created() {
  232. this.getList();
  233. },
  234. methods: {
  235. /** 查询短链列表 */
  236. getList() {
  237. this.loading = true;
  238. listCourseLink(this.queryParams).then(response => {
  239. this.courseLinkList = response.rows;
  240. this.total = response.total;
  241. this.loading = false;
  242. });
  243. },
  244. // 取消按钮
  245. cancel() {
  246. this.open = false;
  247. this.reset();
  248. },
  249. // 表单重置
  250. reset() {
  251. this.form = {
  252. linkId: null,
  253. link: null,
  254. realLink: null,
  255. createTime: null,
  256. updateTime: null,
  257. companyId: null,
  258. companyUserId: null,
  259. qwUserId: null,
  260. videoId: null,
  261. corpId: null
  262. };
  263. this.resetForm("form");
  264. },
  265. /** 搜索按钮操作 */
  266. handleQuery() {
  267. this.queryParams.pageNum = 1;
  268. this.getList();
  269. },
  270. /** 重置按钮操作 */
  271. resetQuery() {
  272. this.resetForm("queryForm");
  273. this.handleQuery();
  274. },
  275. // 多选框选中数据
  276. handleSelectionChange(selection) {
  277. this.ids = selection.map(item => item.linkId)
  278. this.single = selection.length!==1
  279. this.multiple = !selection.length
  280. },
  281. /** 新增按钮操作 */
  282. handleAdd() {
  283. this.reset();
  284. this.open = true;
  285. this.title = "添加短链";
  286. },
  287. /** 修改按钮操作 */
  288. handleUpdate(row) {
  289. this.reset();
  290. const linkId = row.linkId || this.ids
  291. getCourseLink(linkId).then(response => {
  292. this.form = response.data;
  293. this.open = true;
  294. this.title = "修改短链";
  295. });
  296. },
  297. /** 提交按钮 */
  298. submitForm() {
  299. this.$refs["form"].validate(valid => {
  300. if (valid) {
  301. if (this.form.linkId != null) {
  302. updateCourseLink(this.form).then(response => {
  303. this.msgSuccess("修改成功");
  304. this.open = false;
  305. this.getList();
  306. });
  307. } else {
  308. addCourseLink(this.form).then(response => {
  309. this.msgSuccess("新增成功");
  310. this.open = false;
  311. this.getList();
  312. });
  313. }
  314. }
  315. });
  316. },
  317. /** 删除按钮操作 */
  318. handleDelete(row) {
  319. const linkIds = row.linkId || this.ids;
  320. this.$confirm('是否确认删除短链编号为"' + linkIds + '"的数据项?', "警告", {
  321. confirmButtonText: "确定",
  322. cancelButtonText: "取消",
  323. type: "warning"
  324. }).then(function() {
  325. return delCourseLink(linkIds);
  326. }).then(() => {
  327. this.getList();
  328. this.msgSuccess("删除成功");
  329. }).catch(() => {});
  330. },
  331. /** 导出按钮操作 */
  332. handleExport() {
  333. const queryParams = this.queryParams;
  334. this.$confirm('是否确认导出所有短链数据项?', "警告", {
  335. confirmButtonText: "确定",
  336. cancelButtonText: "取消",
  337. type: "warning"
  338. }).then(() => {
  339. this.exportLoading = true;
  340. return exportCourseLink(queryParams);
  341. }).then(response => {
  342. this.download(response.msg);
  343. this.exportLoading = false;
  344. }).catch(() => {});
  345. }
  346. }
  347. };
  348. </script>