CourseStatistic.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. <template>
  2. <section class="content" style="margin-top: -18px;">
  3. <div class="box box-info">
  4. <!-- 头信息 -->
  5. <div
  6. class="box-header with-border"
  7. style="background-color:#d3dce6;margin-bottom:20px;"
  8. >
  9. <h3 class="box-title">课程统计</h3>
  10. <div class="box-tools pull-right">
  11. <button type="button" class="btn btn-box-tool" data-widget="collapse">
  12. <i class="fa fa-minus"></i>
  13. </button>
  14. </div>
  15. </div>
  16. <!-- 正文信息 -->
  17. <div class="box-body">
  18. <el-form
  19. :model="formSearch"
  20. :inline="true"
  21. label-position="right"
  22. label-width="100px"
  23. >
  24. <el-form-item label="学校" class="pull-left">
  25. <el-select
  26. v-model="formSearch.orgId"
  27. placeholder="请选择"
  28. filterable
  29. clearable
  30. @change="searchExamList(formSearch.orgId);"
  31. >
  32. <el-option
  33. v-for="item in orgList"
  34. :label="item.orgName"
  35. :value="item.orgId"
  36. :key="item.orgId"
  37. ></el-option>
  38. </el-select>
  39. </el-form-item>
  40. <el-form-item label="考试" class="pull-left">
  41. <el-select v-model="formSearch.examId" placeholder="请选择">
  42. <el-option
  43. v-for="item in examList"
  44. :label="item.examName"
  45. :value="item.examId"
  46. :key="item.examId"
  47. ></el-option>
  48. </el-select>
  49. </el-form-item>
  50. <el-form-item label="项目经理" class="pull-left">
  51. <el-select
  52. v-model="formSearch.pmId"
  53. placeholder="请选择"
  54. filterable
  55. clearable
  56. remote
  57. :remote-method="searchPmList"
  58. >
  59. <el-option label="请选择" value=""></el-option>
  60. <el-option
  61. v-for="item in pmList"
  62. :label="item.name"
  63. :value="item.id"
  64. :key="item.id"
  65. ></el-option>
  66. </el-select>
  67. </el-form-item>
  68. <el-form-item label="印刷供应商" class="pull-left">
  69. <el-select
  70. v-model="formSearch.supplierId"
  71. placeholder="请选择"
  72. filterable
  73. clearable
  74. remote
  75. :remote-method="searchSupplierList"
  76. >
  77. <el-option label="请选择" value=""></el-option>
  78. <el-option
  79. v-for="item in supplierList"
  80. :label="item.name"
  81. :value="item.id"
  82. :key="item.id"
  83. ></el-option>
  84. </el-select>
  85. </el-form-item>
  86. <el-form-item class="pull-right">
  87. <el-button
  88. size="small"
  89. type="primary"
  90. icon="search"
  91. @click="searchRecords"
  92. >查询
  93. </el-button>
  94. </el-form-item>
  95. </el-form>
  96. <!-- 数据列表 -->
  97. <el-table
  98. v-loading="loading"
  99. :data="tableData"
  100. element-loading-text="数据加载中"
  101. style="width:100%;"
  102. border
  103. >
  104. <el-table-column width="200" label="学校名称" prop="orgName" />
  105. <el-table-column label="考试名称" prop="examName" />
  106. <el-table-column width="200" label="印刷供应商" prop="supplierName" />
  107. <el-table-column width="150" label="项目经理" prop="pmName" />
  108. <el-table-column width="100" label="项目统计">
  109. <template slot-scope="scope">
  110. <a
  111. href="javascript:void(0)"
  112. @click="gotoProjectStatistic(scope.row);"
  113. >查看
  114. </a>
  115. </template>
  116. </el-table-column>
  117. <el-table-column width="100" label="操作" :context="_self">
  118. <template slot-scope="scope">
  119. <el-button
  120. size="mini"
  121. type="primary"
  122. @click="editProjectSetting(scope.row);"
  123. :disabled="!hasPermit"
  124. >
  125. <i class="el-icon-edit"></i> 项目设置
  126. </el-button>
  127. </template>
  128. </el-table-column>
  129. </el-table>
  130. <!-- 分页 -->
  131. <div class="page pull-left">
  132. <el-pagination
  133. @current-change="handlePager"
  134. :current-page="formSearch.pageNo"
  135. :page-size="formSearch.pageSize"
  136. :total="totalElements"
  137. layout="total, prev, pager, next, jumper"
  138. ></el-pagination>
  139. </div>
  140. </div>
  141. </div>
  142. </section>
  143. </template>
  144. <script>
  145. import { core_api, print_api, userRole } from "../constants/constants.js";
  146. import { mapState } from "vuex";
  147. export default {
  148. data() {
  149. return {
  150. formSearch: {
  151. orgId: "",
  152. examId: "",
  153. pmId: "",
  154. supplierId: "",
  155. pageNo: 1,
  156. pageSize: 10
  157. },
  158. curUserRole: userRole,
  159. hasPermit: false,
  160. totalElements: 0,
  161. loading: false,
  162. tableData: [],
  163. orgList: [],
  164. examList: [],
  165. pmList: [],
  166. supplierList: [],
  167. rules: {}
  168. };
  169. },
  170. methods: {
  171. handlePager(current) {
  172. /* 处理分页 */
  173. this.formSearch.pageNo = current;
  174. this.searchRecords();
  175. },
  176. searchRecords() {
  177. /* 查询记录列表 */
  178. let orgId = this.formSearch.orgId;
  179. if (!orgId || orgId == "") {
  180. this.$notify({
  181. message: "请选择学校!",
  182. type: "warning"
  183. });
  184. return;
  185. }
  186. let examId = this.formSearch.examId;
  187. if (!examId || examId == "") {
  188. this.$notify({
  189. message: "请选择考试!",
  190. type: "warning"
  191. });
  192. return;
  193. }
  194. this.loading = true;
  195. let url = print_api + "/printing/project/list";
  196. this.$http.post(url, this.formSearch).then(
  197. response => {
  198. this.tableData = response.data.content;
  199. this.totalElements = response.data.totalElements;
  200. this.loading = false;
  201. },
  202. error => {
  203. console.log(error);
  204. this.loading = false;
  205. }
  206. );
  207. },
  208. searchExamList(orgId) {
  209. /* 查询考试列表 */
  210. this.formSearch.examId = "";
  211. this.examList = [];
  212. if (orgId && orgId != "") {
  213. let url = print_api + "/printing/project/exam/list?orgId=" + orgId;
  214. this.$http.post(url).then(response => {
  215. this.examList = response.data;
  216. });
  217. }
  218. },
  219. searchPmList(query) {
  220. /* 查询项目经理列表 */
  221. this.pmList = [];
  222. let url =
  223. core_api +
  224. "/user/query?rootOrgIdNull=true&roleCode=PRINT_PROJECT_LEADER";
  225. if (query && query != "") {
  226. url += "&name=" + query;
  227. }
  228. this.$http.get(url).then(response => {
  229. this.pmList = response.data;
  230. });
  231. },
  232. searchSupplierList(query) {
  233. /* 查询印刷供应商列表 */
  234. this.supplierList = [];
  235. let url =
  236. core_api + "/user/query?rootOrgIdNull=true&roleCode=PRINT_SUPPLIER";
  237. if (query && query != "") {
  238. url += "&name=" + query;
  239. }
  240. this.$http.get(url).then(response => {
  241. this.supplierList = response.data;
  242. });
  243. },
  244. gotoProjectStatistic(row) {
  245. /* 查看项目统计 */
  246. let url = "/print/project/statistic/" + row.orgId + "/" + row.examId;
  247. this.$router.push({ path: url });
  248. },
  249. editProjectSetting(row) {
  250. console.log(row);
  251. }
  252. },
  253. computed: {
  254. ...mapState({ user: state => state.user })
  255. },
  256. created() {
  257. this.searchOrgList();
  258. this.checkUserRole(this.user);
  259. if (this.curUserRole.isSuperLeader) {
  260. this.hasPermit = true;
  261. this.searchPmList();
  262. this.searchSupplierList();
  263. } else if (this.curUserRole.isPM) {
  264. this.hasPermit = true;
  265. this.loadPmInfo(this.user);
  266. } else if (this.curUserRole.isSupplier) {
  267. this.hasPermit = false;
  268. this.loadSupplierInfo(this.user);
  269. } else {
  270. this.hasPermit = false;
  271. }
  272. }
  273. };
  274. </script>
  275. <style scoped>
  276. .page {
  277. margin-top: 10px;
  278. }
  279. .el-table th > .cell {
  280. text-align: center;
  281. }
  282. </style>