Subject.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. <style lang="scss" scoped>
  2. .preview {
  3. .el-form-item {
  4. margin-bottom: 15px;
  5. }
  6. label,
  7. p {
  8. line-height: 25px !important;
  9. }
  10. }
  11. .el-cascader {
  12. width: 100%;
  13. }
  14. a {
  15. text-decoration: none;
  16. color: #409eff;
  17. cursor: pointer;
  18. }
  19. // 右边
  20. .item-main {
  21. // margin:34px;
  22. // height:600px;
  23. // background: #FFFFFF;
  24. border: 1px solid #dddddd;
  25. box-shadow: 0px 5px 10px 0px rgba(0, 0, 0, 0.13);
  26. border-radius: 20px;
  27. .el-form.over_y {
  28. max-height: calc(100vh - 340px);
  29. }
  30. /deep/.el-form-item__label {
  31. float: none;
  32. }
  33. }
  34. // label样式
  35. .edit_label {
  36. /deep/.el-input__inner {
  37. background: #f5faff;
  38. border: 0px;
  39. padding: 0px;
  40. }
  41. }
  42. /deep/.opicon {
  43. font-weight: bold;
  44. padding: 5px;
  45. color: #3895fe;
  46. }
  47. .tpl_title {
  48. font-size: 18px;
  49. margin: 20px 0;
  50. }
  51. .tpl_form {
  52. margin: 20px;
  53. border: 1px solid #ccc;
  54. border-radius: 20px;
  55. /deep/.el-form-item {
  56. background: none;
  57. }
  58. /deep/.el-form-item__content {
  59. width: 100%;
  60. }
  61. }
  62. .survey_logo {
  63. position: relative;
  64. top: 15px;
  65. left: 20px;
  66. }
  67. .result_dialog .el-dialog{
  68. width: 40%;
  69. margin-top:20vh!important;
  70. }
  71. .result-item{
  72. height: 35px;
  73. .label{
  74. font-weight: 600;
  75. }
  76. }
  77. // 上传
  78. /deep/.avatar-uploader .el-upload {
  79. width: 148px;
  80. height: 148px;
  81. line-height: 148px;
  82. border: 1px dashed #d9d9d9;
  83. border-radius: 6px;
  84. cursor: pointer;
  85. position: relative;
  86. overflow: hidden;
  87. .avatar {
  88. width: 100%;
  89. height: auto;
  90. }
  91. }
  92. .avatar-uploader .el-upload:hover {
  93. border-color: #409eff;
  94. }
  95. .avatar-uploader-icon {
  96. font-size: 28px;
  97. color: #8c939d;
  98. width: 68px;
  99. height: 68px;
  100. line-height: 68px;
  101. text-align: center;
  102. }
  103. .avatar {
  104. width: 68px;
  105. height: 68px;
  106. display: block;
  107. }
  108. /deep/.speaker_avatar .el-upload {
  109. width: 80px;
  110. height: 80px;
  111. line-height: 80px;
  112. }
  113. .hotel_imgs {
  114. /deep/.el-upload--picture-card {
  115. width: 79px;
  116. height: 79px;
  117. line-height: 79px;
  118. }
  119. }
  120. </style>
  121. <template>
  122. <section>
  123. <p><span>刊群导览></span>学科</p>
  124. <div class="content">
  125. <div class="filter">
  126. <el-form
  127. size="small"
  128. label-width="70px"
  129. :inline="true"
  130. label-position="left"
  131. >
  132. <el-form-item label="">
  133. <el-input
  134. clearable
  135. placeholder="请输入标题"
  136. v-model="form.name"
  137. ></el-input>
  138. </el-form-item>
  139. <el-form-item>
  140. <el-button type="primary" @click="search">搜索</el-button>
  141. </el-form-item>
  142. <el-form-item style="float: right">
  143. <el-button @click="add" type="primary">添加学科</el-button>
  144. </el-form-item>
  145. </el-form>
  146. </div>
  147. <el-table
  148. class="table"
  149. :data="list"
  150. height="50vh"
  151. border
  152. v-loading="loading"
  153. default-expand-all
  154. row-key="id"
  155. style="width: 100%"
  156. >
  157. <el-table-column prop="name" label="学科名称"> </el-table-column>
  158. <el-table-column prop="desc" label="学科简介" width="1200px"></el-table-column>
  159. <el-table-column prop="journal_name" label="期刊数量"></el-table-column>
  160. <el-table-column prop="zip" width="150" label="操作">
  161. <template slot-scope="scope">
  162. <el-button class="edit" type="text" @click="edit(scope.row)"
  163. >编辑</el-button
  164. >
  165. <el-button class="del" @click="del(scope.row.id)" type="text"
  166. >删除</el-button
  167. >
  168. </template>
  169. </el-table-column>
  170. </el-table>
  171. <Page
  172. ref="pageButton"
  173. :current="form.page"
  174. :page_size="form.page_size"
  175. :total="total"
  176. @pageChange="gopage"
  177. />
  178. </div>
  179. <!--新增编辑-->
  180. <el-dialog
  181. class='fu-dialog'
  182. :title="dialogTitle"
  183. :close-on-click-modal="false"
  184. :visible.sync="dialogVisible"
  185. >
  186. <el-form
  187. size="small"
  188. class="preview"
  189. :inline="false"
  190. label-width="80px"
  191. :model="form1"
  192. ref="form1"
  193. :rules="rules"
  194. >
  195. <el-form-item label="学科名称" prop="name">
  196. <el-input v-model="form1.name" placeholder="请输入学科名称" maxlength="50" show-word-limit></el-input>
  197. </el-form-item>
  198. <el-form-item label="学科简介" prop="desc">
  199. <el-input type="textarea" v-model="form1.desc" placeholder="请输入学科简介"></el-input>
  200. </el-form-item>
  201. </el-form>
  202. <span slot="footer" class="dialog-footer">
  203. <el-button size="small" type="primary" @click="save">确 定</el-button>
  204. </span>
  205. </el-dialog>
  206. </section>
  207. </template>
  208. <script>
  209. import Page from "../../components/Page";
  210. import fuEditor from '../../components/fuEditor'
  211. export default {
  212. components: {
  213. Page,
  214. fuEditor
  215. },
  216. data() {
  217. return {
  218. form: { name: "", page: 1, page_size: 20 },
  219. total: 1,
  220. list: [{ name: "2333" }],
  221. loading: false,
  222. dialogTitle:false,
  223. rules: {
  224. name: [{ required: true, message: "请输入学科名称", trigger: "blur" }],
  225. desc: [{ required: true, message: "请输入学科简介", trigger: "blur" }]
  226. },
  227. form1:{}
  228. };
  229. },
  230. methods: {
  231. //封面
  232. handleAvatarSuccess(res, file) {
  233. this.form1.img = file.response.data;
  234. console.log(this.form1.img);
  235. },
  236. search() {
  237. let parm = this.form;
  238. this.getData();
  239. },
  240. add() {
  241. this.form1 = {};
  242. this.dialogVisible = true;
  243. this.dialogTitle = "添加主办单位";
  244. },
  245. addArticle(){
  246. this.$router.push({path:'/article/article/add'})
  247. },
  248. gopage(size) {
  249. if (size) {
  250. this.form.page_size = size;
  251. }
  252. this.form.page = this.$refs.pageButton.page;
  253. this.getData();
  254. },
  255. getData() {
  256. var parm = this.form;
  257. this.loading = true;
  258. this.$api.getSubjectList().then((res) => {
  259. console.log(res)
  260. this.list = res.data.data.list;
  261. this.loading = false;
  262. });
  263. },
  264. del(id) {
  265. this.$confirm("确定删除吗", "提示", {
  266. type: "warning",
  267. }).then(() => {
  268. this.$api.delArticle({ id: id }).then((res) => {
  269. this.$message({
  270. message: "删除成功",
  271. type: "success",
  272. });
  273. this.getData();
  274. });
  275. });
  276. },
  277. edit(row) {
  278. this.$router.push({path:'/article/article/add',query:{id:row.id}})
  279. },
  280. save() {
  281. this.$refs["form1"].validate((valid) => {
  282. if (valid) {
  283. let parm = this.form1;
  284. let id = this.form1.id;
  285. parm.receiver_id = JSON.stringify(parm.receiver_id);
  286. if (id) {
  287. this.$api.editSubject(parm).then((res) => {
  288. if (res.data.code == 0) {
  289. this.$message({
  290. type: "success",
  291. message: "保存成功!",
  292. });
  293. } else {
  294. this.$message.error("保存失败!");
  295. }
  296. this.getData();
  297. this.dialogVisible = false;
  298. });
  299. } else {
  300. this.$api.addSubject(parm).then((res) => {
  301. if (res.data.code == 0) {
  302. this.$message({
  303. type: "success",
  304. message: "保存成功!",
  305. });
  306. } else {
  307. this.$message.error("保存失败!");
  308. }
  309. this.getData();
  310. this.dialogVisible = false;
  311. });
  312. }
  313. }
  314. });
  315. },
  316. },
  317. created() {
  318. this.getData();
  319. },
  320. };
  321. </script>