PrintPlanManage.vue 9.2 KB

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