ProjectStatistic.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917
  1. <template>
  2. <section class="content" style="margin-top: 20px;">
  3. <div class="box box-info">
  4. <!-- 正文信息 -->
  5. <div class="box-body">
  6. <el-form
  7. :model="formSearch"
  8. :inline="true"
  9. label-position="right"
  10. label-width="100px"
  11. >
  12. <el-form-item label="学校">
  13. <el-select
  14. :disabled="showGoBack"
  15. v-model="formSearch.orgId"
  16. placeholder="请选择"
  17. clearable
  18. @change="loadExamList(formSearch.orgId)"
  19. >
  20. <el-option
  21. v-for="item in orgList"
  22. :label="item.orgName"
  23. :value="item.orgId"
  24. :key="item.orgId"
  25. ></el-option>
  26. </el-select>
  27. </el-form-item>
  28. <el-form-item label="考试">
  29. <el-select
  30. :disabled="showGoBack"
  31. v-model="formSearch.examId"
  32. @change="searchRecords"
  33. placeholder="请选择"
  34. >
  35. <el-option
  36. v-for="item in examList"
  37. :label="item.examName"
  38. :value="item.examId"
  39. :key="item.examId"
  40. ></el-option>
  41. </el-select>
  42. </el-form-item>
  43. <el-form-item>
  44. <el-button
  45. size="small"
  46. type="primary"
  47. icon="el-icon-search"
  48. @click="searchRecords"
  49. >查询
  50. </el-button>
  51. <el-button
  52. size="small"
  53. type="primary"
  54. icon="el-icon-plus"
  55. :disabled="!hasPermit"
  56. v-show="!checkEmptyNumber(formSearch.examId) && hasPermit"
  57. @click="openOtherSettingDialog"
  58. >新增其它事项
  59. </el-button>
  60. <el-button
  61. size="small"
  62. type="primary"
  63. icon="el-icon-refresh"
  64. v-show="!checkEmptyNumber(formSearch.examId)"
  65. @click="refreshStatistic"
  66. >刷新
  67. </el-button>
  68. <el-button
  69. size="small"
  70. type="primary"
  71. icon="el-icon-arrow-left"
  72. v-show="showGoBack"
  73. @click="goBack"
  74. >返回
  75. </el-button>
  76. </el-form-item>
  77. </el-form>
  78. <!-- 数据列表 -->
  79. <el-table
  80. v-loading="loading"
  81. :data="tableData"
  82. element-loading-text="数据加载中"
  83. style="width:100%;"
  84. border
  85. stripe
  86. >
  87. <el-table-column width="60" label="类型" prop="type" />
  88. <el-table-column width="80" label="人科次" prop="totalStudent" />
  89. <el-table-column width="100" label="课程数量" prop="totalCourse" />
  90. <el-table-column width="100" label="试卷数量" prop="totalPaper" />
  91. <el-table-column width="100" label="印刷数量A3" prop="A3" />
  92. <el-table-column width="100" label="印刷数量A4" prop="A4" />
  93. <el-table-column width="100" label="总数(A3)" prop="sumA3" />
  94. <el-table-column width="80" label="试卷袋数" prop="totalPkg" />
  95. <el-table-column label="事项说明" prop="remark" />
  96. <el-table-column width="120" label="印刷供应商" prop="supplierName" />
  97. <el-table-column width="120" label="项目经理" prop="pmName" />
  98. <el-table-column
  99. width="180"
  100. label="操作"
  101. :context="_self"
  102. fixed="right"
  103. >
  104. <template slot-scope="scope">
  105. <el-button
  106. size="mini"
  107. type="primary"
  108. icon="el-icon-menu"
  109. v-if="scope.row.btnType == 'BACKUP'"
  110. @click="openBackupSettingDialog"
  111. :disabled="!hasPermit"
  112. plain
  113. >备份设置
  114. </el-button>
  115. <el-button
  116. size="mini"
  117. type="primary"
  118. icon="el-icon-edit"
  119. v-if="scope.row.btnType == 'OTHER'"
  120. @click="openOtherSettingDialog(scope.row)"
  121. :disabled="!hasPermit"
  122. plain
  123. >修改
  124. </el-button>
  125. <el-button
  126. size="mini"
  127. type="danger"
  128. icon="el-icon-delete"
  129. v-if="scope.row.btnType == 'OTHER'"
  130. @click="removeOtherSetting(scope.row)"
  131. :disabled="!hasPermit"
  132. plain
  133. >删除
  134. </el-button>
  135. </template>
  136. </el-table-column>
  137. </el-table>
  138. </div>
  139. <!-- 备份设置弹窗 -->
  140. <el-dialog
  141. title="备份设置"
  142. width="500px"
  143. :visible.sync="backupSettingDialog"
  144. @close="closeBackupSettingDialog"
  145. >
  146. <el-form
  147. :model="backupSettingForm"
  148. ref="backupSettingForm"
  149. :rules="rules"
  150. label-position="right"
  151. label-width="90px"
  152. inline-message
  153. >
  154. <el-tabs v-model="eachPkgTab">
  155. <el-tab-pane name="first">
  156. <span slot="label"
  157. >每袋冗余设置
  158. <el-switch v-model="backupSettingForm.needEachPkg"></el-switch
  159. ></span>
  160. <el-form-item label="比例" prop="eachPkgPercent">
  161. <el-input
  162. v-model="backupSettingForm.eachPkgPercent"
  163. :disabled="!backupSettingForm.needEachPkg"
  164. class="w300"
  165. ><template slot="append"
  166. >%</template
  167. ></el-input
  168. >
  169. </el-form-item>
  170. <el-form-item label="最大" prop="eachPkgMax">
  171. <el-input
  172. v-model="backupSettingForm.eachPkgMax"
  173. :disabled="!backupSettingForm.needEachPkg"
  174. class="w300"
  175. ><template slot="append"
  176. >%</template
  177. ></el-input
  178. >
  179. </el-form-item>
  180. <el-form-item label="最小" prop="eachPkgMin">
  181. <el-input
  182. v-model="backupSettingForm.eachPkgMin"
  183. :disabled="!backupSettingForm.needEachPkg"
  184. class="w300"
  185. ><template slot="append"
  186. >%</template
  187. ></el-input
  188. >
  189. </el-form-item>
  190. </el-tab-pane>
  191. </el-tabs>
  192. <el-tabs v-model="alonePkgTab">
  193. <el-tab-pane name="first">
  194. <span slot="label"
  195. >单独备份袋设置
  196. <el-switch v-model="backupSettingForm.needAlonePkg"></el-switch
  197. ></span>
  198. <el-form-item label="归集参数" prop="groupType">
  199. <el-select
  200. v-model="backupSettingForm.groupType"
  201. :disabled="!backupSettingForm.needAlonePkg"
  202. placeholder="请选择"
  203. class="w300"
  204. >
  205. <el-option
  206. v-for="item in groupTypeList"
  207. :label="item.label"
  208. :value="item.value"
  209. :key="item.value"
  210. ></el-option>
  211. </el-select>
  212. </el-form-item>
  213. <el-form-item label="比例" prop="alonePkgPercent">
  214. <el-input
  215. v-model="backupSettingForm.alonePkgPercent"
  216. :disabled="!backupSettingForm.needAlonePkg"
  217. class="w300"
  218. ><template slot="append"
  219. >%</template
  220. >
  221. </el-input>
  222. </el-form-item>
  223. <el-form-item label="最大" prop="alonePkgMax">
  224. <el-input
  225. v-model="backupSettingForm.alonePkgMax"
  226. :disabled="!backupSettingForm.needAlonePkg"
  227. class="w300"
  228. ><template slot="append"
  229. >%</template
  230. ></el-input
  231. >
  232. </el-form-item>
  233. <el-form-item label="最小" prop="alonePkgMin">
  234. <el-input
  235. v-model="backupSettingForm.alonePkgMin"
  236. :disabled="!backupSettingForm.needAlonePkg"
  237. class="w300"
  238. ><template slot="append"
  239. >%</template
  240. ></el-input
  241. >
  242. </el-form-item>
  243. </el-tab-pane>
  244. </el-tabs>
  245. </el-form>
  246. <div style="text-align: center;">
  247. <el-button type="primary" @click="editBackupSetting"
  248. >确 定
  249. </el-button>
  250. <el-button @click="closeBackupSettingDialog">取 消</el-button>
  251. </div>
  252. </el-dialog>
  253. <!-- 其它事项弹窗 -->
  254. <el-dialog
  255. title="其它事项"
  256. width="500px"
  257. :visible.sync="otherSettingDialog"
  258. @close="closeOtherSettingDialog"
  259. >
  260. <el-form
  261. :model="otherSettingForm"
  262. ref="otherSettingForm"
  263. :rules="rules"
  264. label-position="right"
  265. label-width="90px"
  266. inline-message
  267. >
  268. <el-form-item label="事项内容" prop="remark">
  269. <el-input
  270. type="textarea"
  271. :rows="8"
  272. v-model="otherSettingForm.remark"
  273. class="w300"
  274. ></el-input>
  275. </el-form-item>
  276. </el-form>
  277. <div style="text-align: center;margin-top: 10px">
  278. <el-button type="primary" @click="editOtherSetting">确 定 </el-button>
  279. <el-button @click="closeOtherSettingDialog">取 消</el-button>
  280. </div>
  281. </el-dialog>
  282. </div>
  283. </section>
  284. </template>
  285. <script>
  286. import { PRINT_API } from "@/constants/constants";
  287. import { groupTypeList } from "../constants/constants.js";
  288. import { mapState } from "vuex";
  289. import { checkEmptyStr, checkEmptyNumber } from "../utils/common.js";
  290. export default {
  291. data() {
  292. let validateEachPkgPercent = (rule, value, callback) => {
  293. if (this.backupSettingForm.needEachPkg) {
  294. if (checkEmptyNumber(this.backupSettingForm.eachPkgPercent)) {
  295. callback(new Error("请输入正确的数值!"));
  296. return;
  297. }
  298. if (this.backupSettingForm.eachPkgPercent > 100) {
  299. callback(new Error("请输入100以内的数值!"));
  300. return;
  301. }
  302. }
  303. callback();
  304. };
  305. let validateEachPkgMax = (rule, value, callback) => {
  306. if (this.backupSettingForm.needEachPkg) {
  307. if (checkEmptyNumber(this.backupSettingForm.eachPkgMax)) {
  308. callback(new Error("请输入正确的数值!"));
  309. return;
  310. }
  311. if (this.backupSettingForm.eachPkgMax > 100) {
  312. callback(new Error("请输入100以内的数值!"));
  313. return;
  314. }
  315. }
  316. callback();
  317. };
  318. let validateEachPkgMin = (rule, value, callback) => {
  319. if (this.backupSettingForm.needEachPkg) {
  320. if (checkEmptyNumber(this.backupSettingForm.eachPkgMin)) {
  321. callback(new Error("请输入正确的数值!"));
  322. return;
  323. }
  324. if (this.backupSettingForm.eachPkgMin > 100) {
  325. callback(new Error("请输入100以内的数值!"));
  326. return;
  327. }
  328. }
  329. callback();
  330. };
  331. let validateAlonePkgPercent = (rule, value, callback) => {
  332. if (this.backupSettingForm.needAlonePkg) {
  333. if (checkEmptyNumber(this.backupSettingForm.alonePkgPercent)) {
  334. callback(new Error("请输入正确的数值!"));
  335. return;
  336. }
  337. if (this.backupSettingForm.alonePkgPercent > 100) {
  338. callback(new Error("请输入100以内的数值!"));
  339. return;
  340. }
  341. }
  342. callback();
  343. };
  344. let validateAlonePkgMax = (rule, value, callback) => {
  345. if (this.backupSettingForm.needAlonePkg) {
  346. if (checkEmptyNumber(this.backupSettingForm.alonePkgMax)) {
  347. callback(new Error("请输入正确的数值!"));
  348. return;
  349. }
  350. if (this.backupSettingForm.alonePkgMax > 100) {
  351. callback(new Error("请输入100以内的数值!"));
  352. return;
  353. }
  354. }
  355. callback();
  356. };
  357. let validateAlonePkgMin = (rule, value, callback) => {
  358. if (this.backupSettingForm.needAlonePkg) {
  359. if (checkEmptyNumber(this.backupSettingForm.alonePkgMin)) {
  360. callback(new Error("请输入正确的数值!"));
  361. return;
  362. }
  363. if (this.backupSettingForm.alonePkgMin > 100) {
  364. callback(new Error("请输入100以内的数值!"));
  365. return;
  366. }
  367. }
  368. callback();
  369. };
  370. let validateGroupType = (rule, value, callback) => {
  371. if (this.backupSettingForm.needAlonePkg) {
  372. if (checkEmptyStr(this.backupSettingForm.groupType)) {
  373. callback(new Error("请选择归集参数!"));
  374. return;
  375. }
  376. }
  377. callback();
  378. };
  379. return {
  380. formSearch: {
  381. orgId: "",
  382. examId: ""
  383. },
  384. curUserRole: {},
  385. groupTypeList: groupTypeList,
  386. loaded: false,
  387. hasPermit: false,
  388. loading: false,
  389. showGoBack: false,
  390. tableData: [],
  391. projectId: "",
  392. eachPkgTab: "first",
  393. alonePkgTab: "first",
  394. orgList: [],
  395. examList: [],
  396. backupSettingDialog: false,
  397. backupSettingForm: {
  398. projectId: "",
  399. needAlonePkg: true,
  400. needEachPkg: true,
  401. eachPkgPercent: "",
  402. eachPkgMax: "",
  403. eachPkgMin: "",
  404. alonePkgPercent: "",
  405. alonePkgMax: "",
  406. alonePkgMin: "",
  407. groupType: null
  408. },
  409. otherSettingDialog: false,
  410. otherSettingForm: {
  411. id: "",
  412. projectId: "",
  413. remark: ""
  414. },
  415. rules: {
  416. eachPkgPercent: [
  417. {
  418. type: "number",
  419. required: true,
  420. validator: validateEachPkgPercent,
  421. trigger: "change"
  422. }
  423. ],
  424. eachPkgMax: [
  425. {
  426. type: "number",
  427. required: true,
  428. validator: validateEachPkgMax,
  429. trigger: "change"
  430. }
  431. ],
  432. eachPkgMin: [
  433. {
  434. type: "number",
  435. required: true,
  436. validator: validateEachPkgMin,
  437. trigger: "change"
  438. }
  439. ],
  440. alonePkgPercent: [
  441. {
  442. type: "number",
  443. required: true,
  444. validator: validateAlonePkgPercent,
  445. trigger: "change"
  446. }
  447. ],
  448. alonePkgMax: [
  449. {
  450. type: "number",
  451. required: true,
  452. validator: validateAlonePkgMax,
  453. trigger: "change"
  454. }
  455. ],
  456. alonePkgMin: [
  457. {
  458. type: "number",
  459. required: true,
  460. validator: validateAlonePkgMin,
  461. trigger: "change"
  462. }
  463. ],
  464. groupType: [
  465. { required: true, validator: validateGroupType, trigger: "change" }
  466. ],
  467. remark: [
  468. { required: true, message: "请输入事项内容!", trigger: "change" }
  469. ]
  470. }
  471. };
  472. },
  473. methods: {
  474. searchRecords() {
  475. /* 查询记录列表 */
  476. let orgId = this.formSearch.orgId;
  477. if (checkEmptyNumber(orgId)) {
  478. this.$notify({
  479. title: "提示",
  480. message: "请选择学校!",
  481. type: "warning"
  482. });
  483. return;
  484. }
  485. let examId = this.formSearch.examId;
  486. if (checkEmptyNumber(examId)) {
  487. this.$notify({
  488. title: "提示",
  489. message: "请选择考试!",
  490. type: "warning"
  491. });
  492. return;
  493. }
  494. this.loading = true;
  495. let url =
  496. PRINT_API + "/printing/project/statistic/" + orgId + "/" + examId;
  497. this.$http.post(url, this.formSearch).then(
  498. response => {
  499. this.tableData = [];
  500. this.projectId = response.data.projectId;
  501. this.renderTableColumns(response.data);
  502. this.loadOtherSetting(this.projectId);
  503. this.loading = false;
  504. },
  505. error => {
  506. this.loading = false;
  507. console.log(error.response);
  508. this.$notify({
  509. title: "错误",
  510. type: "error",
  511. message: error.response.data.desc
  512. });
  513. }
  514. );
  515. },
  516. renderTableColumns(data) {
  517. let normalColumn = {
  518. type: "常规",
  519. A3: data.normalA3,
  520. A4: data.normalA4,
  521. sumA3: data.summary,
  522. totalStudent: data.totalStudent,
  523. totalCourse: data.totalCourse,
  524. totalPaper: data.totalPaper,
  525. totalPkg: data.totalPkg,
  526. supplierName: data.supplierName,
  527. pmName: data.pmName
  528. };
  529. this.tableData.push(normalColumn);
  530. let backupColumn = {
  531. type: "备份",
  532. A3: data.backupA3,
  533. A4: data.backupA4,
  534. sumA3: data.backupSummary,
  535. btnType: "BACKUP"
  536. };
  537. this.tableData.push(backupColumn);
  538. let totalColumn = {
  539. type: "合计",
  540. A3: data.totalA3,
  541. A4: data.totalA4,
  542. sumA3: data.totalSummary
  543. };
  544. this.tableData.push(totalColumn);
  545. },
  546. selectDefault() {
  547. if (this.loaded) {
  548. return;
  549. }
  550. if (this.orgList.length > 0) {
  551. let firstOrgId = this.orgList[0].orgId;
  552. this.formSearch.orgId = firstOrgId;
  553. this.loadExamList(firstOrgId);
  554. }
  555. },
  556. loadOrgList() {
  557. /* 查询学校列表 */
  558. let url = PRINT_API + "/printing/project/org/list";
  559. this.$http.post(url).then(
  560. response => {
  561. this.orgList = response.data;
  562. this.selectDefault();
  563. },
  564. error => {
  565. console.log(error.response);
  566. // ignore
  567. }
  568. );
  569. },
  570. loadExamList(orgId) {
  571. /* 查询考试列表 */
  572. this.formSearch.examId = "";
  573. this.examList = [];
  574. this.tableData = [];
  575. this.projectId = "";
  576. if (checkEmptyNumber(orgId)) {
  577. return;
  578. }
  579. let url = PRINT_API + "/printing/project/exam/list?orgId=" + orgId;
  580. this.$http.post(url).then(response => {
  581. this.examList = response.data;
  582. if (this.loaded) {
  583. return;
  584. }
  585. if (this.examList.length > 0) {
  586. this.formSearch.examId = this.examList[0].examId;
  587. this.searchRecords();
  588. }
  589. });
  590. },
  591. refreshStatistic() {
  592. let checkUrl = PRINT_API + "/printing/project/statistic/refresh/check";
  593. this.$http.get(checkUrl).then(response => {
  594. if (response.data.data) {
  595. this.$notify({
  596. title: "提示",
  597. message: "尚有项目统计任务正在刷新中,请稍后再刷新!",
  598. type: "warning"
  599. });
  600. } else {
  601. /* 刷新当前统计信息 */
  602. let orgId = this.formSearch.orgId;
  603. if (checkEmptyNumber(orgId)) {
  604. this.$notify({
  605. title: "提示",
  606. message: "请选择学校!",
  607. type: "warning"
  608. });
  609. return;
  610. }
  611. let examId = this.formSearch.examId;
  612. if (checkEmptyNumber(examId)) {
  613. this.$notify({
  614. title: "提示",
  615. message: "请选择考试!",
  616. type: "warning"
  617. });
  618. return;
  619. }
  620. this.$confirm("刷新当前统计信息?", "提示", {
  621. confirmButtonText: "确定",
  622. cancelButtonText: "取消",
  623. type: "warning"
  624. })
  625. .then(() => {
  626. let url =
  627. PRINT_API +
  628. "/printing/project/statistic/refresh/" +
  629. orgId +
  630. "/" +
  631. examId;
  632. this.$http.post(url).then(
  633. () => {
  634. this.$notify({
  635. title: "提示",
  636. message: "刷新成功!",
  637. type: "success"
  638. });
  639. this.searchRecords();
  640. },
  641. error => {
  642. console.log(error.response);
  643. this.$notify({
  644. title: "错误",
  645. type: "error",
  646. message: error.response.data.desc
  647. });
  648. }
  649. );
  650. })
  651. .catch(() => {
  652. // ignore
  653. });
  654. }
  655. });
  656. },
  657. editBackupSetting() {
  658. /* 保存备份设置 */
  659. this.$refs.backupSettingForm.validate(valid => {
  660. if (!valid) {
  661. return false;
  662. }
  663. let curLoading = this.$loading({
  664. lock: true,
  665. text: "数据保存中!"
  666. });
  667. let url = PRINT_API + "/project/backup/setting/save";
  668. this.$http.post(url, this.backupSettingForm).then(
  669. () => {
  670. curLoading.close();
  671. this.$notify({
  672. title: "提示",
  673. type: "success",
  674. message: "保存备份设置成功!"
  675. });
  676. this.backupSettingDialog = false;
  677. },
  678. error => {
  679. console.log(error.response);
  680. curLoading.close();
  681. this.$notify({
  682. title: "错误",
  683. type: "error",
  684. message: error.response.data.desc
  685. });
  686. }
  687. );
  688. });
  689. },
  690. openBackupSettingDialog() {
  691. /* 打开备份设置弹窗 */
  692. let url = PRINT_API + "/project/backup/setting/" + this.projectId;
  693. this.$http.post(url).then(
  694. response => {
  695. this.backupSettingForm = response.data;
  696. },
  697. () => {
  698. this.backupSettingForm = {
  699. projectId: this.projectId,
  700. needAlonePkg: true,
  701. needEachPkg: true,
  702. eachPkgPercent: "",
  703. eachPkgMax: "",
  704. eachPkgMin: "",
  705. alonePkgPercent: "",
  706. alonePkgMax: "",
  707. alonePkgMin: "",
  708. groupType: null
  709. };
  710. }
  711. );
  712. this.backupSettingDialog = true;
  713. },
  714. closeBackupSettingDialog() {
  715. /* 关闭备份设置弹窗 */
  716. this.backupSettingDialog = false;
  717. },
  718. loadOtherSetting(projectId) {
  719. /* 查询其它事项列表 */
  720. let url =
  721. PRINT_API + "/project/other/setting/list?projectId=" + projectId;
  722. this.$http.post(url).then(
  723. response => {
  724. let list = response.data;
  725. if (!list || list.length < 1) {
  726. return;
  727. }
  728. for (let obj of list) {
  729. obj.type = "其它";
  730. obj.btnType = "OTHER";
  731. this.tableData.push(obj);
  732. }
  733. },
  734. error => {
  735. console.log(error.response);
  736. // ignore
  737. }
  738. );
  739. },
  740. editOtherSetting() {
  741. /* 保存其它事项 */
  742. this.$refs.otherSettingForm.validate(valid => {
  743. if (!valid) {
  744. return false;
  745. }
  746. let curLoading = this.$loading({
  747. lock: true,
  748. text: "数据保存中!"
  749. });
  750. let url = PRINT_API + "/project/other/setting/save";
  751. this.$http.post(url, this.otherSettingForm).then(
  752. () => {
  753. curLoading.close();
  754. this.$notify({
  755. title: "提示",
  756. type: "success",
  757. message: "保存其它事项成功!"
  758. });
  759. this.otherSettingDialog = false;
  760. this.searchRecords();
  761. },
  762. error => {
  763. console.log(error.response);
  764. curLoading.close();
  765. this.$notify({
  766. title: "错误",
  767. type: "error",
  768. message: error.response.data.desc
  769. });
  770. }
  771. );
  772. });
  773. },
  774. removeOtherSetting(row) {
  775. /* 删除某个其它事项 */
  776. this.$confirm("确定删除当前事项吗?", "提示", {
  777. confirmButtonText: "确定",
  778. cancelButtonText: "取消",
  779. type: "warning"
  780. })
  781. .then(() => {
  782. let url = PRINT_API + "/project/other/setting/delete/" + row.id;
  783. this.$http.post(url).then(
  784. () => {
  785. this.$notify({
  786. title: "提示",
  787. type: "success",
  788. message: "删除当前事项成功!"
  789. });
  790. this.searchRecords();
  791. },
  792. error => {
  793. console.log(error.response);
  794. this.$notify({
  795. title: "错误",
  796. type: "error",
  797. message: error.response.data.desc
  798. });
  799. }
  800. );
  801. })
  802. .catch(() => {
  803. /*ignore*/
  804. });
  805. },
  806. openOtherSettingDialog(row) {
  807. /* 打开其它事项弹窗 */
  808. if (checkEmptyNumber(this.projectId)) {
  809. this.$notify({
  810. title: "提示",
  811. message: "请选择学校和考试!",
  812. type: "warning"
  813. });
  814. return;
  815. }
  816. this.otherSettingDialog = true;
  817. this.otherSettingForm.projectId = this.projectId;
  818. if (row.id) {
  819. this.otherSettingForm.id = row.id;
  820. } else {
  821. this.otherSettingForm.id = "";
  822. }
  823. if (row.remark) {
  824. this.otherSettingForm.remark = row.remark;
  825. } else {
  826. this.otherSettingForm.remark = "";
  827. }
  828. },
  829. closeOtherSettingDialog() {
  830. /* 关闭其它事项弹窗 */
  831. this.otherSettingDialog = false;
  832. },
  833. goBack() {
  834. /* 返回上级界面 */
  835. this.$router.push({ path: "/print/project/list" });
  836. },
  837. checkEmptyNumber: checkEmptyNumber
  838. },
  839. computed: {
  840. ...mapState({ user: state => state.user })
  841. },
  842. created() {
  843. this.loadUserRole(this.user);
  844. if (this.curUserRole.isSuperLeader || this.curUserRole.isPM) {
  845. this.hasPermit = true;
  846. } else {
  847. this.hasPermit = false;
  848. }
  849. /* 加载默认数据 */
  850. let orgId = this.$route.params.orgId;
  851. let examId = this.$route.params.examId;
  852. if (orgId != "0" || examId != "0") {
  853. this.loaded = true;
  854. this.loadOrgList();
  855. this.loadExamList(orgId);
  856. this.showGoBack = true;
  857. this.formSearch.orgId = parseInt(orgId);
  858. this.formSearch.examId = parseInt(examId);
  859. this.searchRecords();
  860. } else {
  861. this.loaded = false;
  862. this.loadOrgList();
  863. }
  864. }
  865. };
  866. </script>
  867. <style scoped>
  868. .page {
  869. margin-top: 10px;
  870. }
  871. .pull-right {
  872. float: right;
  873. }
  874. .pull-left {
  875. float: left;
  876. }
  877. .w300 {
  878. width: 300px;
  879. }
  880. </style>