PrintPlanManage.vue 7.2 KB

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