CardManage.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <div class="card-check">
  3. <div class="part-box part-box-filter">
  4. <el-form ref="FilterForm" label-position="left" label-width="85px" inline>
  5. <el-form-item label="审核状态:">
  6. <el-select
  7. v-model="filter.auditingStatus"
  8. style="width: 142px;"
  9. placeholder="请选择"
  10. clearable
  11. >
  12. <el-option
  13. v-for="(val, key) in AUDITING_STATUS"
  14. :key="key"
  15. :value="key"
  16. :label="val"
  17. ></el-option>
  18. </el-select>
  19. </el-form-item>
  20. <el-form-item label="印刷时间:">
  21. <el-date-picker
  22. v-model="filter.printTime"
  23. type="date"
  24. placeholder="请选择日期"
  25. >
  26. </el-date-picker>
  27. </el-form-item>
  28. <el-form-item label="标题:" label-width="55px">
  29. <el-input
  30. style="width: 210px;"
  31. v-model.trim="filter.title"
  32. placeholder="请输入内容"
  33. clearable
  34. ></el-input>
  35. </el-form-item>
  36. <el-form-item label-width="0px">
  37. <el-button type="primary" icon="icon icon-search" @click="toPage(1)"
  38. >查询</el-button
  39. >
  40. <el-button type="warning" icon="icon icon-plus" @click="toAdd"
  41. >创建题卡</el-button
  42. >
  43. </el-form-item>
  44. </el-form>
  45. </div>
  46. <div class="part-box">
  47. <el-table ref="TableList" :data="cards" border stripe>
  48. <el-table-column prop="id" label="题卡ID"></el-table-column>
  49. <el-table-column label="科目(代码)">
  50. <template slot-scope="scope">
  51. <span
  52. >{{ scope.row.courseName
  53. }}<i v-if="scope.row.courseCode"
  54. >({{ scope.row.courseCode }})</i
  55. ></span
  56. >
  57. </template>
  58. </el-table-column>
  59. <el-table-column prop="title" label="标题"></el-table-column>
  60. <el-table-column prop="printTime" label="打印时间"></el-table-column>
  61. <el-table-column
  62. prop="cardStatusName"
  63. label="处理节点"
  64. ></el-table-column>
  65. <el-table-column prop="overtime" label="剩余时间"></el-table-column>
  66. <el-table-column
  67. prop="auditingTime"
  68. label="提交审核时间"
  69. ></el-table-column>
  70. <el-table-column
  71. prop="auditingStatusName"
  72. label="审核状态"
  73. ></el-table-column>
  74. <el-table-column label="操作" align="center" width="120">
  75. <template slot-scope="scope">
  76. <div v-if="scope.row.cardStatus !== 0">
  77. <!-- <el-button
  78. class="btn-table-icon"
  79. type="text"
  80. icon="icon icon-download"
  81. @click="toExport(scope.row)"
  82. title="导出"
  83. ></el-button> -->
  84. <el-button
  85. class="btn-table-icon"
  86. type="text"
  87. icon="icon icon-copy"
  88. @click="toCopy(scope.row)"
  89. title="复制"
  90. ></el-button>
  91. </div>
  92. <div v-else>
  93. <el-button
  94. class="btn-table-icon"
  95. type="text"
  96. icon="icon icon-edit"
  97. @click="toEdit(scope.row)"
  98. title="编辑"
  99. ></el-button>
  100. <el-button
  101. class="btn-table-icon"
  102. type="text"
  103. icon="icon icon-delete"
  104. @click="toDelete(scope.row)"
  105. title="删除"
  106. ></el-button>
  107. <el-button
  108. class="btn-table-icon"
  109. type="text"
  110. icon="icon icon-circle-share"
  111. @click="toPrint(scope.row)"
  112. title="印刷"
  113. v-if="scope.row.auditingStatus !== 0"
  114. ></el-button>
  115. </div>
  116. </template>
  117. </el-table-column>
  118. </el-table>
  119. <div class="part-page">
  120. <el-pagination
  121. background
  122. layout="prev, pager, next"
  123. :current-page="current"
  124. :total="total"
  125. :page-size="size"
  126. @current-change="toPage"
  127. >
  128. </el-pagination>
  129. </div>
  130. </div>
  131. <!-- card-option-dialog -->
  132. <card-option-dialog
  133. ref="CardOptionDialog"
  134. @upload-sample-over="getList"
  135. @confirm="cardConfirm"
  136. ></card-option-dialog>
  137. </div>
  138. </template>
  139. <script>
  140. import { AUDITING_STATUS } from "@/constants/enumerate";
  141. import { cardListPage, copyCard, deleteCard, changeCardStatus } from "../api";
  142. import CardOptionDialog from "../components/CardOptionDialog";
  143. export default {
  144. name: "card-check",
  145. components: {
  146. CardOptionDialog
  147. },
  148. data() {
  149. return {
  150. filter: {
  151. title: "",
  152. auditingStatus: "",
  153. printTime: ""
  154. },
  155. current: 1,
  156. size: this.GLOBAL.pageSize,
  157. total: 0,
  158. visible: false,
  159. AUDITING_STATUS,
  160. cards: []
  161. };
  162. },
  163. created() {
  164. this.getList();
  165. },
  166. methods: {
  167. async getList() {
  168. const datas = {
  169. ...this.filter,
  170. pageNumber: this.current,
  171. pageSize: this.size
  172. };
  173. const data = await cardListPage(datas);
  174. this.cards = data.records;
  175. this.total = data.total;
  176. // cardStatus '处理节点,0:设计题卡,1:提交印刷,2:已完成
  177. },
  178. toPage(page) {
  179. this.current = page;
  180. this.getList();
  181. },
  182. toAdd() {
  183. this.$refs.CardOptionDialog.open();
  184. },
  185. cardConfirm() {
  186. this.$router.push({
  187. name: "CardDesign"
  188. });
  189. },
  190. toEdit(row) {
  191. this.$router.push({
  192. name: "CardDesign",
  193. params: {
  194. cardId: row.id
  195. }
  196. });
  197. },
  198. toExport() {
  199. // 暂时不做了
  200. },
  201. async toCopy(row) {
  202. await copyCard(row.id);
  203. this.$message.success("复制成功!");
  204. this.getList();
  205. },
  206. toPrint(row) {
  207. this.$confirm(
  208. "一旦准备印刷,题卡将不可再编辑,确定要提交印刷吗?",
  209. "警告",
  210. {
  211. cancelButtonClass: "el-button--primary",
  212. confirmButtonClass: "el-button--default-act",
  213. type: "warning"
  214. }
  215. )
  216. .then(async () => {
  217. await changeCardStatus({
  218. cardId: row.id,
  219. cardStatus: 1
  220. });
  221. this.getList();
  222. this.$message.success("提交成功!");
  223. })
  224. .catch(() => {});
  225. },
  226. toDelete(row) {
  227. this.$confirm("确定要删除当前题卡吗?", "删除警告", {
  228. cancelButtonClass: "el-button--primary",
  229. confirmButtonClass: "el-button--default-act",
  230. type: "warning"
  231. })
  232. .then(async () => {
  233. await deleteCard(row.id);
  234. this.$message.success("删除成功!");
  235. // 解决最后一项删除后的问题
  236. this.deletePageLastItem();
  237. })
  238. .catch(() => {});
  239. }
  240. }
  241. };
  242. </script>