globalSubjects.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. <!-- -->
  2. <template>
  3. <div class="m-container">
  4. <h2>
  5. <div class="squrt"></div>
  6. 声部设置
  7. </h2>
  8. <div class="m-core">
  9. <save-form
  10. :inline="true"
  11. :model="searchForm"
  12. @submit="search"
  13. @reset="onReSet"
  14. ref="searchForm"
  15. >
  16. <el-form-item prop="search">
  17. <el-input
  18. v-model.trim="searchForm.search"
  19. clearable
  20. @keyup.enter.native="
  21. e => {
  22. e.target.blur();
  23. $refs.searchForm.save();
  24. search();
  25. }
  26. "
  27. placeholder="请输入编号/名称"
  28. ></el-input>
  29. </el-form-item>
  30. <el-form-item prop="parentSubjectId">
  31. <el-select
  32. v-model="searchForm.parentSubjectId"
  33. placeholder="选择声部分类"
  34. prop="parentSubjectId"
  35. clearable
  36. filterable
  37. >
  38. <el-option
  39. v-for="item in fatherList"
  40. :key="item.id"
  41. :label="item.name"
  42. :value="item.id"
  43. >
  44. </el-option>
  45. </el-select>
  46. </el-form-item>
  47. <el-form-item>
  48. <el-button native-type="submit" type="primary">搜索</el-button>
  49. <el-button native-type="reset" type="danger">重置</el-button>
  50. </el-form-item>
  51. </save-form>
  52. <auth auths="subject/upset/insert" style="margin-bottom: 20px">
  53. <el-button @click="createSubject" type="primary">添加</el-button>
  54. </auth>
  55. <div class="tableWrap">
  56. <el-table
  57. style="width: 100%"
  58. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  59. :data="tableList"
  60. row-key="id"
  61. >
  62. <el-table-column label="编号" prop="id"></el-table-column>
  63. <el-table-column label="声部名称" prop="name"></el-table-column>
  64. <el-table-column
  65. label="乐器名称"
  66. prop="instrumentName"
  67. ></el-table-column>
  68. <!-- <el-table-column label="是否启用" show-overflow-tooltip>
  69. <template #default="scope">
  70. <span>{{ scope.row.enableFlag ? "是" : "否" }}</span>
  71. </template>
  72. </el-table-column> -->
  73. <el-table-column label="乐器分类" prop="parentSubjectName">
  74. </el-table-column>
  75. <el-table-column label="更新时间" show-overflow-tooltip>
  76. <template #default="scope">
  77. <span>{{ scope.row.updateTime }}</span>
  78. </template>
  79. </el-table-column>
  80. <el-table-column label="操作" show-overflow-tooltip width="200px">
  81. <template #default="scope">
  82. <auth auths="subject/upset/reset">
  83. <el-button
  84. size="small"
  85. type="text"
  86. @click="updateSubject(scope.row)"
  87. >修改</el-button
  88. >
  89. </auth>
  90. <auth auths="subject/upset/del">
  91. <el-button
  92. size="small"
  93. type="text"
  94. @click="removeSubjectCategory(scope.row)"
  95. >删除</el-button
  96. >
  97. </auth>
  98. <!-- <el-button
  99. @click="onChangeStatus(scope.row)"
  100. size="small"
  101. type="text"
  102. >{{ !scope.row.enableFlag ? "启用" : "停用" }}</el-button
  103. > -->
  104. <auth auths="subject/upset/reset">
  105. <el-button
  106. @click="updateInstrument(scope.row)"
  107. size="small"
  108. type="text"
  109. >修改乐器</el-button
  110. >
  111. </auth>
  112. </template>
  113. </el-table-column>
  114. </el-table>
  115. <pagination
  116. :total.sync="rules.total"
  117. :page.sync="rules.page"
  118. :limit.sync="rules.limit"
  119. :page-sizes="rules.page_size"
  120. @pagination="getList"
  121. />
  122. </div>
  123. </div>
  124. <el-dialog
  125. :title="'修改乐器'"
  126. :visible.sync="instrumentVisible"
  127. width="770px"
  128. >
  129. <AddSubject
  130. v-if="instrumentVisible"
  131. :detail="activeRow"
  132. :subjectType="instrumentTitle"
  133. :fatherList="fatherList"
  134. @close="instrumentVisible = false"
  135. @getList="getList"
  136. />
  137. </el-dialog>
  138. <el-dialog
  139. :title="subjectTitle === 'add' ? '添加声部' : '修改声部'"
  140. :visible.sync="subjectVisible"
  141. width="560px"
  142. >
  143. <CreateSubject
  144. v-if="subjectVisible"
  145. :detail="activeRow"
  146. :subjectType="subjectTitle"
  147. :fatherList="fatherList"
  148. @close="subjectVisible = false"
  149. @getList="getList"
  150. />
  151. </el-dialog>
  152. <!-- <el-dialog
  153. title="修改乐器"
  154. :visible.sync="updateInstrumentVisiable"
  155. width="500px"
  156. >
  157. <UpdateInstrument
  158. v-if="updateInstrumentVisiable"
  159. :detail="activeRow"
  160. @close="updateInstrumentVisiable = false"
  161. @getList="getList"
  162. />
  163. </el-dialog> -->
  164. </div>
  165. </template>
  166. <script>
  167. import pagination from "@/components/Pagination/index";
  168. import AddSubject from "./components/add-subject";
  169. import CreateSubject from "./components/create-subject";
  170. import UpdateInstrument from "./components/update-instrument";
  171. import {
  172. subjectListTree,
  173. subjectUpset,
  174. subSubjectList
  175. } from "@/api/specialSetting";
  176. export default {
  177. components: { pagination, AddSubject, UpdateInstrument, CreateSubject },
  178. data() {
  179. return {
  180. searchForm: {
  181. search: null,
  182. parentSubjectId: null
  183. },
  184. form: {
  185. name: null,
  186. id: null,
  187. img: null,
  188. parentSubjectId: null
  189. },
  190. tableList: [],
  191. organList: [],
  192. rules: {
  193. // 分页规则
  194. limit: 10, // 限制显示条数
  195. page: 1, // 当前页
  196. total: 0, // 总条数
  197. page_size: [10, 20, 40, 50] // 选择限制显示条数
  198. },
  199. subjectTitle: "add",
  200. subjectVisible: false,
  201. fatherList: [],
  202. instrumentVisible: false,
  203. instrumentTitle: "add",
  204. updateInstrumentVisiable: false,
  205. activeRow: {}
  206. };
  207. },
  208. mounted() {
  209. // 获取分部
  210. this.init();
  211. },
  212. methods: {
  213. init() {
  214. this.getList();
  215. this.getFatherList();
  216. },
  217. getFatherList() {
  218. subjectListTree({
  219. delFlag: "NO",
  220. rows: 9999,
  221. page: 1
  222. }).then(res => {
  223. if (res.code == 200) {
  224. this.fatherList = res.data.rows;
  225. }
  226. });
  227. },
  228. getList() {
  229. subSubjectList({
  230. ...this.searchForm,
  231. page: this.rules.page,
  232. rows: this.rules.limit
  233. }).then(res => {
  234. this.tableList = res.data.rows;
  235. this.rules.total = res.data.total;
  236. });
  237. },
  238. search() {
  239. this.rules.page = 1;
  240. this.getList();
  241. },
  242. onReSet() {
  243. this.$nextTick(() => {
  244. this.search();
  245. });
  246. },
  247. // 修改乐器
  248. // onUpdateInstrument(row) {
  249. // this.activeRow = row;
  250. // this.updateInstrumentVisiable = true;
  251. // },
  252. onChangeInstrument(row) {
  253. const enableStr = row.enableFlag ? "停用" : "启用";
  254. this.$confirm(`是否${enableStr}${row.name}?`, "提示", {
  255. confirmButtonText: "确定",
  256. cancelButtonText: "取消",
  257. type: "warning"
  258. }).then(async () => {});
  259. },
  260. /** 添加乐器 */
  261. createSubject() {
  262. this.subjectVisible = true;
  263. this.subjectTitle = "add";
  264. this.activeRow = {};
  265. },
  266. /** 修改乐器 */
  267. updateSubject(row) {
  268. this.subjectTitle = "update";
  269. this.activeRow = row;
  270. this.subjectVisible = true;
  271. },
  272. /** 修改乐器 */
  273. updateInstrument(row) {
  274. this.instrumentTitle = "update";
  275. this.activeRow = row;
  276. this.instrumentVisible = true;
  277. },
  278. removeSubjectCategory(row) {
  279. this.$confirm("是否确认删除声部", "提示", {
  280. confirmButtonText: "确定",
  281. cancelButtonText: "取消",
  282. type: "warning"
  283. }).then(() => {
  284. subjectUpset({
  285. delFlag: "YES",
  286. id: row.id
  287. }).then(res => {
  288. this.messageTips("删除", res);
  289. this.search();
  290. });
  291. });
  292. },
  293. // onChangeStatus(row) {
  294. // const enableStr = row.enableFlag ? "停用" : "启用";
  295. // this.$confirm(`是否${enableStr}${row.name}?`, "提示", {
  296. // confirmButtonText: "确定",
  297. // cancelButtonText: "取消",
  298. // type: "warning"
  299. // }).then(async () => {
  300. // });
  301. // },
  302. messageTips(title, res) {
  303. if (res.code == 200) {
  304. this.$message.success(title + "成功");
  305. } else {
  306. this.$message.error(res.msg);
  307. }
  308. }
  309. // submitReset() {
  310. // this.$refs.form.validate(valid => {
  311. // if (valid) {
  312. // subjectUpset({
  313. // tenantId: 1,
  314. // ...this.form
  315. // }).then(res => {
  316. // if (res.code == 200) {
  317. // this.messageTips("修改", res);
  318. // this.categoryVisible = false;
  319. // this.getList();
  320. // }
  321. // });
  322. // }
  323. // });
  324. // },
  325. }
  326. };
  327. </script>
  328. <style lang="scss" scoped></style>