ProjectStatistic.vue 26 KB

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