department.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700
  1. <template>
  2. <div>
  3. <div class="simple-container">
  4. <simple-form :form="table_form" @search="handleSearch">
  5. <!-- :handle="table_handle"
  6. @add="handleRulesVisible"
  7. @class="handleDrawer('class')"
  8. @download="handleDownload" -->
  9. </simple-form>
  10. <simple-table
  11. :list="table_list"
  12. :config="table_config"
  13. :loading="table_loading"
  14. :handle-row="table_handle_row"
  15. @check="handleCheck"
  16. @edit="handleEdit"
  17. ></simple-table>
  18. <simple-pagination
  19. :page="page"
  20. :total="total"
  21. @change="handleChange"
  22. ></simple-pagination>
  23. </div>
  24. <simple-dialog
  25. fullscreen
  26. title="文件收集"
  27. :visible="visible"
  28. :reload="reload"
  29. width="1200px"
  30. @cancel="handleCancel('visible')"
  31. >
  32. <template>
  33. <!-- 按钮部分 -->
  34. <div class="flex-justify-between padding-right-20 padding-left-20">
  35. <div>
  36. <template v-if="edit_visible">
  37. <!-- 转派按钮 科室经理 7、分管副总 2、总经理 1可见 -->
  38. <el-button
  39. type="primary"
  40. v-if="
  41. edit_form.status === '0' &&
  42. (duty === '7' || duty === '2' || duty === '1')
  43. "
  44. @click="handleTransfer"
  45. >转派</el-button
  46. >
  47. <!-- 提交按钮 科员可见 9 -->
  48. <el-button
  49. type="primary"
  50. v-if="edit_form.status === '1' && duty === '9'"
  51. @click="handleSubmit"
  52. >提交</el-button
  53. >
  54. <!-- 审批按钮 科室经理、分管副总、总经理可见 -->
  55. <el-button
  56. type="primary"
  57. v-if="
  58. edit_form.status === '2' &&
  59. (duty === '7' || duty === '2' || duty === '1')
  60. "
  61. @click="handleApprove"
  62. >审批</el-button
  63. >
  64. </template>
  65. <!-- <el-button type="primary" @click="handleTrack">流程跟踪</el-button>
  66. <el-button type="primary">导出</el-button> -->
  67. </div>
  68. <!-- <div>
  69. <el-button @click="handleCancel('visible')" type="primary"
  70. >返回</el-button
  71. >
  72. </div> -->
  73. </div>
  74. <!-- 主体部分 -->
  75. <simple-sheet
  76. v-if="visible"
  77. :id="edit_form.id"
  78. :type="edit_visible ? 'edit' : 'view'"
  79. attribute="file"
  80. />
  81. <!-- <analysis
  82. :edit="edit_form.department_status === '待处理' && edit_visible"
  83. /> -->
  84. </template>
  85. <template v-slot:footer><div></div></template>
  86. </simple-dialog>
  87. <simple-dialog
  88. title="审批"
  89. :visible="approve_visible"
  90. :reload="reload"
  91. width="500px"
  92. @cancel="handleCancel('approve_visible')"
  93. >
  94. <el-form :model="approveForm" ref="approveForm"
  95. ><el-form-item label="审批意见" prop="comments" label-width="80px"
  96. ><el-input
  97. type="textarea"
  98. v-model="approveForm.comments"
  99. autosize /></el-form-item
  100. ></el-form>
  101. <template v-slot:footer
  102. ><div>
  103. <div v-if="type === '1'">
  104. <el-button @click="handleTurn('finish')">结束</el-button>
  105. <el-button @click="handleTurn('transfer')" type="primary"
  106. >转副总审批</el-button
  107. >
  108. </div>
  109. <div v-else-if="type === '2'">
  110. <el-button @click="handleTurn('finish')">结束</el-button>
  111. <el-button @click="handleTurn('back')">打回</el-button>
  112. <el-button @click="handleTurn('transfer')" type="primary"
  113. >转总经理审批</el-button
  114. >
  115. </div>
  116. <div v-else>
  117. <el-button @click="handleTurn('back')">打回</el-button>
  118. <el-button @click="handleTurn('agree')" type="primary"
  119. >同意</el-button
  120. >
  121. </div>
  122. </div>
  123. </template>
  124. </simple-dialog>
  125. <simple-dialog
  126. title="转派"
  127. :visible="transfer_visible"
  128. :reload="reload"
  129. width="500px"
  130. @confirm="transferConfirm"
  131. @cancel="handleCancel('transfer_visible')"
  132. >
  133. <el-form
  134. :model="transfer_form"
  135. :rules="transfer_rules"
  136. ref="transfer_form"
  137. >
  138. <el-form-item label="转派人员" prop="personnel">
  139. <el-select
  140. v-model="transfer_form.personnel"
  141. placeholder="请选择转派人员"
  142. >
  143. <el-option
  144. v-for="(item, index) in transfer_list"
  145. :key="index"
  146. :label="item.label"
  147. :value="item.loginNoStr"
  148. >
  149. </el-option>
  150. </el-select>
  151. </el-form-item>
  152. <el-form-item label="可编辑行" prop="rows">
  153. <el-select
  154. v-model="transfer_form.rows"
  155. placeholder="可编辑行"
  156. multiple
  157. >
  158. <el-option
  159. v-for="(item, index) in transfer_rows"
  160. :key="index"
  161. :label="item.label"
  162. :value="item.value"
  163. >
  164. </el-option>
  165. </el-select>
  166. </el-form-item>
  167. </el-form>
  168. </simple-dialog>
  169. <!-- <simple-dialog
  170. title="流程跟踪"
  171. :visible="track_visible"
  172. :reload="reload"
  173. width="600px"
  174. props="track_visible"
  175. @confirm="handleConfirm"
  176. @cancel="handleCancel('track_visible')"
  177. >
  178. <el-table :data="trackList" border>
  179. <el-table-column
  180. prop="link"
  181. label="流程环节"
  182. align="center"
  183. width="180"
  184. >
  185. </el-table-column>
  186. <el-table-column
  187. prop="creatperson"
  188. label="处理人"
  189. align="center"
  190. width="180"
  191. >
  192. </el-table-column>
  193. <el-table-column prop="explain" label="审批说明" align="center">
  194. </el-table-column>
  195. </el-table>
  196. </simple-dialog> -->
  197. </div>
  198. </template>
  199. <script>
  200. import simpleForm from "./components/form.vue";
  201. import simpleTable from "./components/table.vue";
  202. import simplePagination from "./components/pagination.vue";
  203. import simpleDialog from "./components/dialog.vue";
  204. // import analysis from "./analysis.vue";
  205. import simpleSheet from "./components/sheet.vue";
  206. export default {
  207. components: {
  208. simpleForm,
  209. simpleTable,
  210. simplePagination,
  211. simpleDialog,
  212. simpleSheet,
  213. },
  214. data() {
  215. return {
  216. page: 1,
  217. rows: 10,
  218. total: 0,
  219. isCheck: false,
  220. // 职位判断转派用
  221. duty: "",
  222. // 搜索参数
  223. table_search: {},
  224. // dialog 参数
  225. transfer_visible: false,
  226. visible: false,
  227. edit_visible: false,
  228. approve_visible: false,
  229. track_visible: false,
  230. edit_form: {},
  231. transfer_list: [],
  232. transfer_rows: [],
  233. transfer_form: {
  234. personnel: "", // 转派人员
  235. rows: [],
  236. },
  237. reload: 0,
  238. // 判断类型
  239. type: "3",
  240. approverules: {
  241. comments: [
  242. {
  243. required: true,
  244. message: "请输入审批意见",
  245. trigger: "blur",
  246. },
  247. ],
  248. },
  249. // 转派规则
  250. transfer_rules: {
  251. personnel: [
  252. {
  253. required: true,
  254. message: "请选择转派人员",
  255. trigger: "change",
  256. },
  257. ],
  258. rows: [
  259. {
  260. required: true,
  261. message: "请选择行",
  262. trigger: "change",
  263. },
  264. ],
  265. },
  266. // 审批意见
  267. approveForm: { comments: "" },
  268. trackList: [],
  269. // 顶部form
  270. table_form: [
  271. {
  272. label: "模板名称",
  273. props: "name",
  274. type: "input",
  275. },
  276. {
  277. label: "下发月份",
  278. props: "issuedDate",
  279. type: "month",
  280. },
  281. {
  282. label: "状态",
  283. props: "status",
  284. type: "select",
  285. // 0.待处理 1.待汇总 2.待审批 3.已完成
  286. dictionary: [
  287. {
  288. label: "待处理",
  289. value: "0",
  290. },
  291. {
  292. label: "待汇总",
  293. value: "1",
  294. },
  295. {
  296. label: "待审批",
  297. value: "2",
  298. },
  299. {
  300. label: "已完成",
  301. value: "3",
  302. },
  303. ],
  304. },
  305. ],
  306. // 列表数据
  307. table_list: [],
  308. table_loading: false,
  309. // 表格里的操作按钮
  310. table_handle_row: [
  311. {
  312. label: "查看",
  313. props: "check",
  314. },
  315. {
  316. label: "处理",
  317. props: "edit",
  318. visible: {
  319. status: ["0", "1", "2"],
  320. },
  321. },
  322. ],
  323. // 表头配置
  324. table_config: [
  325. {
  326. label: "模板名称",
  327. props: "templateName",
  328. },
  329. {
  330. label: "填报事由",
  331. props: "reason",
  332. },
  333. {
  334. label: "填报注意事项",
  335. props: "precautions",
  336. },
  337. {
  338. label: "截止时间",
  339. props: "endTime",
  340. type: "date",
  341. },
  342. {
  343. label: "发起人",
  344. props: "loginNameStr",
  345. },
  346. {
  347. label: "状态",
  348. props: "status",
  349. type: "dictionary",
  350. dictionary: { 0: "待处理", 1: "待汇总", 2: "待审批", 3: "已完成" },
  351. },
  352. ],
  353. };
  354. },
  355. mounted() {
  356. this.handleInit({
  357. ...this.table_search,
  358. page: this.page,
  359. pageSize: this.rows,
  360. });
  361. // 职位
  362. this.duty = JSON.parse(sessionStorage.userInfo).duty;
  363. // 根据职位判定 科室经理7、分管副总 2 、总经理 1 、职员 9
  364. console.log(this.duty, "duty");
  365. switch (this.duty) {
  366. // 科室经理
  367. case "7":
  368. this.type = "1";
  369. break;
  370. // 分管副总
  371. case "2":
  372. this.type = "2";
  373. break;
  374. // 总经理
  375. case "1":
  376. this.type = "3";
  377. break;
  378. }
  379. },
  380. methods: {
  381. // 初始化
  382. handleInit(data) {
  383. this.$http({
  384. url: "/market/CMKIssued/CMKIssuedListByUser",
  385. method: "post",
  386. headers: {
  387. "Content-Type": "application/json",
  388. },
  389. data: data,
  390. }).then(({ data: { count, data } }) => {
  391. this.total = count;
  392. this.table_list = data;
  393. // this.table_list = [
  394. // {
  395. // id: 10,
  396. // templateName: "模板名称",
  397. // loginNameStr: "发起人",
  398. // status: "0",
  399. // reason: "填报事由",
  400. // precautions: "填报注意事项",
  401. // endTime: new Date(),
  402. // },
  403. // {
  404. // id: 11,
  405. // templateName: "模板名称",
  406. // loginNameStr: "发起人",
  407. // status: "1",
  408. // reason: "填报事由",
  409. // precautions: "填报注意事项",
  410. // endTime: new Date(),
  411. // },
  412. // {
  413. // id: 12,
  414. // templateName: "模板名称",
  415. // loginNameStr: "发起人",
  416. // status: "2",
  417. // reason: "填报事由",
  418. // precautions: "填报注意事项",
  419. // endTime: new Date(),
  420. // },
  421. // {
  422. // id: 13,
  423. // templateName: "模板名称",
  424. // loginNameStr: "发起人",
  425. // status: "3",
  426. // reason: "填报事由",
  427. // precautions: "填报注意事项",
  428. // endTime: new Date(),
  429. // },
  430. // ];
  431. });
  432. },
  433. handleChange(page) {
  434. this.page = page;
  435. this.handleInit({
  436. ...this.table_search,
  437. page: this.page,
  438. pageSize: this.rows,
  439. });
  440. },
  441. // 搜索事件
  442. handleSearch(data) {
  443. this.table_search = data;
  444. this.page = 1;
  445. this.handleInit({ ...data, page: this.page, pageSize: this.rows });
  446. },
  447. // 编辑按钮
  448. handleEdit(row) {
  449. console.log(row, "row");
  450. this.visible = true;
  451. this.edit_visible = true;
  452. this.edit_form = row;
  453. },
  454. // 查看按钮
  455. handleCheck(row) {
  456. console.log(row, "row");
  457. this.visible = true;
  458. this.edit_visible = false;
  459. this.edit_form = row;
  460. },
  461. handleDelete() {},
  462. // dialog事件
  463. //权限管理事件
  464. handleApprove() {
  465. this.approve_visible = true;
  466. },
  467. handleTrack() {
  468. this.track_visible = true;
  469. },
  470. // 转派的同意事件
  471. transferConfirm() {
  472. this.$refs["transfer_form"].validate((valid) => {
  473. if (valid) {
  474. let obj = {};
  475. this.transfer_form.rows.forEach((el) => {
  476. obj = {
  477. ...obj,
  478. [el]: this.transfer_form.personnel,
  479. };
  480. });
  481. let reqdata = {
  482. forward: JSON.stringify(obj),
  483. issuedId: this.edit_form.id,
  484. };
  485. this.$http({
  486. url: "/market/CMKIssued/CMKIssuedTransfer",
  487. method: "post",
  488. headers: {
  489. "Content-Type": "application/json",
  490. },
  491. data: reqdata,
  492. }).then(({ data: { desc } }) => {
  493. if (desc === "转派成功") {
  494. this.$message({
  495. type: "success",
  496. message: desc,
  497. });
  498. this.transfer_visible = false;
  499. this.handleCancel("visible");
  500. }
  501. });
  502. }
  503. });
  504. },
  505. async handleTransfer() {
  506. console.log(this.edit_form, "prams");
  507. let loginNoStr = JSON.parse(sessionStorage.userInfo).loginNoStr;
  508. let groupId = JSON.parse(sessionStorage.userInfo).groupId;
  509. await this.$http({
  510. url: "/sysmgr/sysuserinfo/queryList",
  511. method: "post",
  512. headers: {
  513. "Content-Type": "application/json",
  514. },
  515. data: {
  516. groupId,
  517. },
  518. }).then(({ data }) => {
  519. this.transfer_list = data
  520. .filter((el) => {
  521. return el.loginNoStr !== loginNoStr;
  522. })
  523. .map((el) => ({
  524. ...el,
  525. label: el.loginNameStr,
  526. }));
  527. // 可编辑行
  528. });
  529. await this.$http({
  530. url: "/market/CMKIssued/CMKIssuedRow",
  531. method: "post",
  532. headers: {
  533. "Content-Type": "application/json",
  534. },
  535. data: {
  536. id: this.edit_form.id,
  537. },
  538. }).then(({ data }) => {
  539. console.log(data);
  540. this.transfer_rows = data.map((el) => ({
  541. label: el,
  542. value: el,
  543. }));
  544. });
  545. this.transfer_visible = true;
  546. },
  547. handleTurn(type) {
  548. // finish 结束 transfer 转派 back //打回 // agree 同意
  549. let request = 0;
  550. let reqdata = {
  551. id: this.edit_form.id,
  552. reviewOpinion: this.approveForm.comments,
  553. };
  554. switch (type) {
  555. case "finish":
  556. // status 0.打回 3.结束
  557. reqdata.status = "3";
  558. break;
  559. case "transfer":
  560. // reviewType 2.副总经理 3.经理
  561. if (this.duty === "7") {
  562. reqdata.reviewType = 2;
  563. } else {
  564. reqdata.reviewType = 3;
  565. }
  566. break;
  567. case "back":
  568. reqdata.status = "0";
  569. break;
  570. case "agree":
  571. reqdata.status = "3";
  572. break;
  573. }
  574. console.log(reqdata, "reqdata");
  575. this.handleInit({
  576. ...this.table_search,
  577. page: this.page,
  578. pageSize: this.rows,
  579. });
  580. this.handleCancel("visible");
  581. this.handleCancel("approve_visible");
  582. if (request) {
  583. // 这里调接口
  584. this.$http({
  585. url: "/market/CMKIssued/CMKIssuedCheck",
  586. method: "post",
  587. headers: {
  588. "Content-Type": "application/json",
  589. },
  590. data: reqdata,
  591. }).then((res) => {
  592. console.log(res, "res");
  593. });
  594. }
  595. // this.$http({
  596. // url: "/market/CMKIssued/CMKIssuedCheck",
  597. // method: "post",
  598. // headers: {
  599. // "Content-Type": "application/json",
  600. // },
  601. // data: {
  602. // groupId,
  603. // },
  604. // }).then((res) => {
  605. // console.log(res, "res");
  606. // this.handleInit()
  607. // this.handleCancel("visible");
  608. // this.handleCancel("approve_visible");
  609. // });
  610. },
  611. handleConfirm(visible) {
  612. console.log(visible);
  613. this.track_visible = visible;
  614. },
  615. // 关闭方法
  616. handleCancel(data) {
  617. switch (data) {
  618. case "visible":
  619. this.visible = false;
  620. break;
  621. case "approve_visible":
  622. this.approveForm.comments = "";
  623. this.approve_visible = false;
  624. break;
  625. case "track_visible":
  626. this.track_visible = false;
  627. break;
  628. case "transfer_visible":
  629. this.transfer_visible = false;
  630. break;
  631. }
  632. },
  633. // handleBack() {
  634. // const object = {
  635. // ...JSON.parse(sessionStorage.global_data)[0],
  636. // department_status: "待处理",
  637. // };
  638. // sessionStorage.setItem("global_data", JSON.stringify([object]));
  639. // const process_array = JSON.parse(sessionStorage.global_process);
  640. // process_array.push({
  641. // link: "审批驳回",
  642. // creatperson: `ADMIN ${this.$formatDate(new Date(), "YYYY-MM-DD")}`,
  643. // explain: this.approveForm.comments,
  644. // });
  645. // sessionStorage.setItem("global_process", JSON.stringify(process_array));
  646. // // this.handleInit();
  647. // // this.$message.success("打回成功");
  648. // // this.handleCancel("visible");
  649. // // this.handleCancel("approve_visible");
  650. // },
  651. // handleAgree() {
  652. // const object = {
  653. // ...JSON.parse(sessionStorage.global_data)[0],
  654. // department_status: "已完成",
  655. // };
  656. // sessionStorage.setItem("global_data", JSON.stringify([object]));
  657. // const process_array = JSON.parse(sessionStorage.global_process);
  658. // process_array.push({
  659. // link: "审批通过",
  660. // creatperson: `ADMIN ${this.$formatDate(new Date(), "YYYY-MM-DD")}`,
  661. // explain: this.approveForm.comments,
  662. // });
  663. // sessionStorage.setItem("global_process", JSON.stringify(process_array));
  664. // this.handleInit();
  665. // this.$message.success("审批成功");
  666. // this.handleCancel("visible");
  667. // this.handleCancel("approve_visible");
  668. // },
  669. handleSubmit() {
  670. // 提交好了
  671. let reqdata = {
  672. id: this.edit_form.id,
  673. templateContent: "asdad",
  674. };
  675. this.$http({
  676. url: "/CMKIssued/CMKIssuedSubmit",
  677. method: "post",
  678. headers: {
  679. "Content-Type": "application/json",
  680. },
  681. data: reqdata,
  682. }).then(({ data }) => {
  683. console.log(data, "data");
  684. if (data) {
  685. this.$message.success("提交成功");
  686. this.handleCancel("visible");
  687. } else {
  688. this.$message.error("提交失败");
  689. }
  690. });
  691. },
  692. },
  693. };
  694. </script>
  695. <style></style>