428 lines
11 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <template>
  2. <div style="padding:30px;">
  3. <!-- 搜索栏 -->
  4. <div class="search">
  5. <el-form :inline="true">
  6. <el-form-item label="剧本标题:" style="margin-right:50px;">
  7. <el-select
  8. v-model="queryParams.query.scenarioId"
  9. clearable
  10. placeholder="请选择剧本标题"
  11. @change="queryLc"
  12. @visible-change="foucsLc"
  13. >
  14. <el-option
  15. v-for="item in jbData"
  16. :key="item.value"
  17. :label="item.title"
  18. :value="item.id"
  19. >
  20. </el-option>
  21. </el-select>
  22. </el-form-item>
  23. <el-form-item label="流程标题:" style="margin-right:50px;">
  24. <el-select
  25. v-model="queryParams.query.processId"
  26. clearable
  27. placeholder="请选择流程标题"
  28. >
  29. <el-option
  30. v-for="item in lcData"
  31. :key="item.value"
  32. :label="item.title"
  33. :value="item.id"
  34. >
  35. </el-option>
  36. </el-select>
  37. </el-form-item>
  38. <el-form-item label="Tips内容:" style="margin-right:50px;">
  39. <el-input
  40. clearable
  41. v-model="queryParams.query.content"
  42. placeholder="Tips内容"
  43. />
  44. </el-form-item>
  45. </el-form>
  46. <div class="search-button">
  47. <el-button
  48. size="medium"
  49. type="primary"
  50. style="height:36px;width:100px;"
  51. @click="search"
  52. >搜索</el-button
  53. >
  54. <el-button
  55. size="medium"
  56. style="margin-left:20px;height:36px;width:100px;"
  57. @click="refresh"
  58. >重置</el-button
  59. >
  60. </div>
  61. </div>
  62. <div class="add-button">
  63. <el-button
  64. size="medium"
  65. type="primary"
  66. style="height:36px;width:100px;"
  67. @click="handleAdd"
  68. >新建</el-button
  69. >
  70. </div>
  71. <!-- 列表 -->
  72. <div class="content">
  73. <el-table
  74. v-loading="loading"
  75. ref="singleTable"
  76. :data="tableData"
  77. border
  78. style="width: 100%"
  79. >
  80. <el-table-column align="center" type="index" label="序号" width="50" />
  81. <el-table-column
  82. align="center"
  83. property="scenarioTitle"
  84. label="剧本标题"
  85. />
  86. <el-table-column
  87. align="center"
  88. property="processTitle"
  89. label="流程名称"
  90. />
  91. <el-table-column align="center" property="content" label="Tips内容" />
  92. <el-table-column align="center" property="likeCount" label="点赞数量" />
  93. <el-table-column
  94. align="center"
  95. property="createTime"
  96. label="创建时间"
  97. />
  98. <el-table-column align="center" label="操作">
  99. <template slot-scope="scope">
  100. <el-button type="text" size="mini" @click="handleView(scope.row)"
  101. ><div style="color:#000;">查看</div></el-button
  102. >
  103. <el-button type="text" size="mini" @click="handleEdit(scope.row)"
  104. ><div style="color:#02A7F0;">编辑</div></el-button
  105. >
  106. <el-button type="text" size="mini" @click="hanDel(scope.row)"
  107. ><div style="color:#D9001B;">删除</div></el-button
  108. >
  109. </template>
  110. </el-table-column>
  111. </el-table>
  112. <pagination
  113. v-show="total > 0"
  114. :total="total"
  115. :page.sync="queryParams.pageNum"
  116. :limit.sync="queryParams.pageSize"
  117. @pagination="queryTipsList"
  118. />
  119. </div>
  120. <!-- 新增表单 -->
  121. <el-dialog
  122. :title="dialog.title"
  123. :visible.sync="dialog.Visible"
  124. center
  125. width="500px"
  126. >
  127. <el-form ref="form" :model="form" :inline="true" :rules="rules">
  128. <el-form-item label="剧本标题:" prop="scenarioId" style="width:100%">
  129. <el-select
  130. :disabled="disabled"
  131. v-model="form.scenarioId"
  132. clearable
  133. placeholder="请选择剧本标题"
  134. style="width:300px"
  135. @change="chageLc"
  136. >
  137. <el-option
  138. v-for="item in jbData"
  139. :key="item.value"
  140. :label="item.title"
  141. :value="item.id"
  142. >
  143. </el-option>
  144. </el-select>
  145. </el-form-item>
  146. <el-form-item label="流程标题:" style="width:100%" prop="processId">
  147. <el-select
  148. :disabled="disabled"
  149. v-model="form.processId"
  150. clearable
  151. placeholder="请选择流程标题"
  152. style="width:300px"
  153. >
  154. <el-option
  155. v-for="item in lcData"
  156. :key="item.value"
  157. :label="item.title"
  158. :value="item.id"
  159. />
  160. </el-select>
  161. </el-form-item>
  162. <el-form-item label="Tips内容:" style="width:100%" prop="content">
  163. <el-input
  164. :disabled="disabled"
  165. style="width:300px"
  166. v-model="form.content"
  167. type="textarea"
  168. :rows="6"
  169. placeholder="请输入内容"
  170. autocomplete="off"
  171. ></el-input>
  172. </el-form-item>
  173. </el-form>
  174. <div slot="footer" class="dialog-footer">
  175. <el-button @click="dialog.Visible = false"> </el-button>
  176. <el-button v-if="type != 'view'" type="primary" @click="subMitForm()"
  177. > </el-button
  178. >
  179. </div>
  180. </el-dialog>
  181. </div>
  182. </template>
  183. <script>
  184. import {
  185. queryJbInfos,
  186. queryTipsList,
  187. addTipsList,
  188. updateTipsList,
  189. deteleTipsList,
  190. queryTipsDetail,
  191. queryFindList
  192. } from "@/api/sce/sce.js";
  193. export default {
  194. data() {
  195. return {
  196. loading: true,
  197. queryParams: {
  198. pageNum: 1,
  199. pageSize: 15,
  200. query: {
  201. scenarioId: undefined,
  202. processId: undefined,
  203. content: undefined
  204. }
  205. },
  206. rules: {
  207. scenarioId: [
  208. { required: true, message: "请选择剧本", trigger: "blur" }
  209. ],
  210. processId: [{ required: true, message: "请选择流程", trigger: "blur" }],
  211. content: [{ required: true, message: "请输入内容", trigger: "blur" }]
  212. },
  213. form: {},
  214. disabled: false,
  215. dialog: {
  216. title: "新增",
  217. Visible: false
  218. },
  219. tableData: [],
  220. jbData: [],
  221. lcData: [],
  222. total: 0,
  223. type: "add",
  224. data: {}
  225. };
  226. },
  227. mounted() {
  228. this.queryJbInfos();
  229. // this.queryFindList();
  230. this.queryTipsList();
  231. },
  232. methods: {
  233. //获取剧本列表
  234. async queryJbInfos() {
  235. try {
  236. let res = await queryJbInfos({});
  237. // console.log(res.data, "剧本列表");
  238. this.jbData = res.data;
  239. } catch (err) {
  240. console.log(err);
  241. }
  242. },
  243. //获取流程列表
  244. async queryFindList() {
  245. try {
  246. let res = await queryFindList(this.data);
  247. // console.log(res.data, "流程列表");
  248. this.lcData = res.data;
  249. } catch (err) {
  250. console.log(err);
  251. }
  252. },
  253. queryLc(val) {
  254. this.data = {
  255. scenarioId: val
  256. };
  257. delete this.queryParams.query.processId;
  258. this.queryFindList();
  259. this.$router.push({ name: "Tips/index" });
  260. },
  261. chageLc(val) {
  262. console.log(val);
  263. this.data = {
  264. scenarioId: val
  265. };
  266. delete this.form.processId;
  267. // this.form.processId =
  268. this.queryFindList();
  269. },
  270. foucsLc() {
  271. console.log(11110);
  272. },
  273. //获取Tips列表
  274. async queryTipsList() {
  275. this.loading = true;
  276. console.log(this.$route.query.type, 41231231);
  277. if (this.$route.query.type == "sceinfo") {
  278. this.queryParams.query.scenarioId = this.$route.query.scenarioId;
  279. }
  280. try {
  281. let res = await queryTipsList(this.queryParams);
  282. this.tableData = res.data.rows;
  283. this.total = res.data.total;
  284. this.loading = false;
  285. } catch (err) {
  286. console.log(err);
  287. }
  288. },
  289. //搜索
  290. search() {
  291. this.queryTipsList();
  292. },
  293. refresh() {
  294. this.queryParams = {
  295. pageNum: 1,
  296. pageSize: 15,
  297. query: {
  298. scenarioId: undefined,
  299. processId: undefined,
  300. content: undefined
  301. }
  302. };
  303. this.data = {};
  304. // this.queryFindList();
  305. this.queryTipsList();
  306. },
  307. // 新增
  308. handleAdd() {
  309. this.dialog.title = "新增";
  310. this.type = "add";
  311. this.form = {};
  312. this.disabled = false;
  313. this.dialog.Visible = true;
  314. },
  315. //提交表单
  316. async subMitForm() {
  317. try {
  318. this.$refs["form"].validate(async valid => {
  319. if (valid) {
  320. if (this.type == "add") {
  321. let res = await addTipsList(this.form);
  322. if (res.code == 200) {
  323. this.$message.success("新增成功");
  324. this.dialog.Visible = false;
  325. this.form = {};
  326. this.queryTipsList();
  327. } else {
  328. this.$message({
  329. message: res.msg,
  330. type: "error"
  331. });
  332. }
  333. }
  334. if (this.type == "edit") {
  335. let res = await updateTipsList(this.form);
  336. if (res.code == 200) {
  337. this.$message.success("编辑成功");
  338. this.dialog.Visible = false;
  339. this.form = {};
  340. this.queryTipsList();
  341. } else {
  342. this.$message({
  343. message: res.msg,
  344. type: "error"
  345. });
  346. }
  347. }
  348. }
  349. });
  350. } catch (err) {
  351. console.log(err);
  352. }
  353. },
  354. //获取详情
  355. async queryTipsDetail(id) {
  356. try {
  357. let res = await queryTipsDetail(id);
  358. // console.log(res, "详情");
  359. this.form = res.data;
  360. } catch (err) {
  361. console.log(err);
  362. }
  363. },
  364. //查看详情
  365. handleView(row) {
  366. this.queryTipsDetail(row.id);
  367. this.data = {
  368. scenarioId: row.scenarioId
  369. };
  370. this.queryFindList();
  371. setTimeout(() => {
  372. this.dialog.title = "查看";
  373. this.type = "view";
  374. this.disabled = true;
  375. this.dialog.Visible = true;
  376. }, 500);
  377. },
  378. //编辑
  379. handleEdit(row) {
  380. this.queryTipsDetail(row.id);
  381. this.data = {
  382. scenarioId: row.scenarioId
  383. };
  384. this.queryFindList();
  385. setTimeout(() => {
  386. this.dialog.title = "编辑";
  387. this.type = "edit";
  388. this.disabled = false;
  389. this.dialog.Visible = true;
  390. }, 500);
  391. },
  392. //删除
  393. async hanDel(row) {
  394. try {
  395. await this.$confirm("此操作将永久删除,是否继续?", "提示", {
  396. confirmButtonText: "确定",
  397. cancelButtonText: "取消",
  398. type: "warning"
  399. });
  400. let res = await deteleTipsList(row.id);
  401. if (res.code == 200) {
  402. this.$message.success("删除成功");
  403. this.queryTipsList();
  404. } else {
  405. this.$message({
  406. message: res.msg,
  407. type: "error"
  408. });
  409. }
  410. } catch (err) {
  411. console.log(err);
  412. }
  413. }
  414. }
  415. };
  416. </script>
  417. <style scoped>
  418. .content {
  419. background: #fff;
  420. margin-top: 15px;
  421. }
  422. .add-button {
  423. margin-top: 15px;
  424. }
  425. .search-button {
  426. display: flex;
  427. }
  428. </style>