PrintPlanManage.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. <template>
  2. <div class="print-plan-manage">
  3. <div class="part-box part-box-filter part-box-flex">
  4. <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
  5. <template v-if="checkPrivilege('condition', 'condition')">
  6. <el-form-item label="印刷计划:">
  7. <print-plan-select
  8. v-model.trim="filter.printPlanIdList"
  9. placeholder="印刷计划"
  10. multiple
  11. clearable
  12. style="width:300px"
  13. ></print-plan-select>
  14. </el-form-item>
  15. <el-form-item label="计划状态:">
  16. <el-select
  17. v-model="filter.status"
  18. style="width: 142px;"
  19. placeholder="计划状态"
  20. clearable
  21. >
  22. <el-option
  23. v-for="(val, key) in PRINT_PLAN_STATUS"
  24. :key="key"
  25. :value="key"
  26. :label="val"
  27. ></el-option>
  28. </el-select>
  29. </el-form-item>
  30. <el-form-item label="创建时间:">
  31. <el-date-picker
  32. v-model="createTime"
  33. type="datetimerange"
  34. :picker-options="pickerOptions"
  35. range-separator="至"
  36. start-placeholder="创建开始时间"
  37. end-placeholder="创建结束时间"
  38. value-format="timestamp"
  39. align="right"
  40. unlink-panels
  41. >
  42. </el-date-picker>
  43. </el-form-item>
  44. </template>
  45. <el-form-item label-width="0px">
  46. <el-button
  47. v-if="checkPrivilege('button', 'select')"
  48. type="primary"
  49. @click="search"
  50. >查询</el-button
  51. >
  52. </el-form-item>
  53. </el-form>
  54. <div class="part-box-action">
  55. <el-button
  56. v-if="checkPrivilege('button', 'add')"
  57. icon="el-icon-circle-plus-outline"
  58. type="primary"
  59. @click="toAdd"
  60. >
  61. 新建印刷计划
  62. </el-button>
  63. </div>
  64. </div>
  65. <div class="part-box part-box-pad">
  66. <el-table ref="TableList" :data="dataList">
  67. <el-table-column
  68. type="index"
  69. label="序号"
  70. width="70"
  71. :index="indexMethod"
  72. ></el-table-column>
  73. <el-table-column
  74. prop="name"
  75. label="印刷计划"
  76. min-width="200"
  77. ></el-table-column>
  78. <el-table-column
  79. prop="semesterName"
  80. label="学期"
  81. min-width="200"
  82. ></el-table-column>
  83. <el-table-column
  84. prop="examName"
  85. label="考试"
  86. min-width="200"
  87. ></el-table-column>
  88. <el-table-column prop="examStartTime" label="考试开始时间" width="170">
  89. <span slot-scope="scope">{{
  90. scope.row.examStartTime | timestampFilter
  91. }}</span>
  92. </el-table-column>
  93. <el-table-column prop="examEndTime" label="考试结束时间" width="170">
  94. <span slot-scope="scope">{{
  95. scope.row.examEndTime | timestampFilter
  96. }}</span>
  97. </el-table-column>
  98. <el-table-column
  99. prop="createName"
  100. label="创建人"
  101. min-width="100"
  102. ></el-table-column>
  103. <el-table-column prop="createTime" label="创建时间" width="170">
  104. <span slot-scope="scope">{{
  105. scope.row.createTime | timestampFilter
  106. }}</span>
  107. </el-table-column>
  108. <el-table-column prop="status" label="计划状态" width="100">
  109. <span slot-scope="scope">
  110. {{ scope.row.status | printPlanStatusFilter }}
  111. </span>
  112. </el-table-column>
  113. <el-table-column
  114. class-name="action-column"
  115. label="操作"
  116. width="140"
  117. fixed="right"
  118. >
  119. <template slot-scope="scope">
  120. <el-button
  121. v-if="checkPrivilege('link', 'preview')"
  122. class="btn-primary"
  123. type="text"
  124. @click="toPreview(scope.row)"
  125. >查看</el-button
  126. >
  127. <el-button
  128. class="btn-primary"
  129. type="text"
  130. @click="toEdit(scope.row)"
  131. v-if="
  132. scope.row.createId === curUserId &&
  133. scope.row.status === 'NEW' &&
  134. checkPrivilege('link', 'edit')
  135. "
  136. >修改</el-button
  137. >
  138. <el-button
  139. class="btn-danger"
  140. type="text"
  141. @click="toDelete(scope.row)"
  142. v-if="
  143. scope.row.createId === curUserId &&
  144. scope.row.status === 'NEW' &&
  145. checkPrivilege('link', 'delete')
  146. "
  147. >删除</el-button
  148. >
  149. </template>
  150. </el-table-column>
  151. </el-table>
  152. <div class="part-page">
  153. <el-pagination
  154. background
  155. layout="total, sizes, prev, pager, next, jumper"
  156. :pager-count="5"
  157. :current-page="current"
  158. :total="total"
  159. :page-size="size"
  160. @current-change="toPage"
  161. @size-change="pageSizeChange"
  162. >
  163. </el-pagination>
  164. </div>
  165. </div>
  166. <!-- ModifyPrintPlan -->
  167. <modify-print-plan
  168. v-if="checkPrivilege('link', 'edit') || checkPrivilege('button', 'add')"
  169. ref="ModifyPrintPlan"
  170. :instance="curPrintPlan"
  171. :edit-type="editType"
  172. @modified="getList"
  173. ></modify-print-plan>
  174. <!-- PrintPlanDetail -->
  175. <print-plan-detail
  176. v-if="checkPrivilege('link', 'preview')"
  177. ref="PrintPlanDetail"
  178. :plan="curPrintPlan"
  179. ></print-plan-detail>
  180. </div>
  181. </template>
  182. <script>
  183. import { printPlanListPage, removePrintPlan } from "../api";
  184. import { PRINT_PLAN_STATUS } from "@/constants/enumerate";
  185. import pickerOptions from "@/constants/datePickerOptions";
  186. import ModifyPrintPlan from "../components/ModifyPrintPlan";
  187. import PrintPlanDetail from "../components/PrintPlanDetail.vue";
  188. export default {
  189. name: "print-plan-manage",
  190. components: { ModifyPrintPlan, PrintPlanDetail },
  191. data() {
  192. return {
  193. filter: {
  194. semesterId: "",
  195. examId: "",
  196. printPlanIdList: [],
  197. status: "",
  198. startTime: "",
  199. endTime: ""
  200. },
  201. current: 1,
  202. size: this.GLOBAL.pageSize,
  203. total: 0,
  204. dataList: [],
  205. curPrintPlan: {},
  206. editType: "ADD",
  207. PRINT_PLAN_STATUS,
  208. curUserId: this.$ls.get("user", { id: "" }).id,
  209. // date-picker
  210. createTime: [],
  211. pickerOptions
  212. };
  213. },
  214. mounted() {
  215. this.search();
  216. },
  217. methods: {
  218. async getList() {
  219. if (!this.checkPrivilege("list", "list")) return;
  220. const datas = {
  221. ...this.filter,
  222. pageNumber: this.current,
  223. pageSize: this.size
  224. };
  225. if (this.createTime) {
  226. datas.startTime = this.createTime[0];
  227. datas.endTime = this.createTime[1];
  228. }
  229. const data = await printPlanListPage(datas);
  230. this.dataList = data.records;
  231. this.total = data.total;
  232. },
  233. toPage(page) {
  234. this.current = page;
  235. this.getList();
  236. },
  237. search() {
  238. this.toPage(1);
  239. },
  240. toAdd() {
  241. this.curPrintPlan = {};
  242. this.editType = "ADD";
  243. this.$refs.ModifyPrintPlan.open();
  244. },
  245. toEdit(row) {
  246. this.curPrintPlan = row;
  247. this.editType = "EDIT";
  248. this.$refs.ModifyPrintPlan.open();
  249. },
  250. toPreview(row) {
  251. this.curPrintPlan = row;
  252. this.$refs.PrintPlanDetail.open();
  253. },
  254. toDelete(row) {
  255. this.$confirm(`确定要删除印刷计划【${row.name}】吗?`, "提示", {
  256. type: "warning"
  257. })
  258. .then(async () => {
  259. await removePrintPlan(row.id);
  260. this.$message.success("删除成功!");
  261. this.deletePageLastItem();
  262. })
  263. .catch(() => {});
  264. }
  265. }
  266. };
  267. </script>