department.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065
  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. @delete="handleDelete"
  18. @receiverName="handleReceiver"
  19. ></simple-table>
  20. <simple-pagination
  21. :page="page"
  22. :total="total"
  23. @change="handleChange"
  24. ></simple-pagination>
  25. </div>
  26. <simple-dialog
  27. fullscreen
  28. title="文件收集"
  29. :visible="visible"
  30. :reload="reload"
  31. width="1200px"
  32. @cancel="handleCancel('visible')"
  33. >
  34. <template>
  35. <!-- 按钮部分 -->
  36. <div class="flex-justify-between padding-right-20 padding-left-20">
  37. <div>
  38. <template v-if="edit_visible">
  39. <!-- 转派按钮 科室经理 7、分管副总 2、总经理 1可见 -->
  40. <el-button
  41. type="primary"
  42. v-if="
  43. edit_form.status === '0' &&
  44. (duty === '7' || duty === '3' || duty === '4')
  45. "
  46. @click="handleTransfer"
  47. >转派</el-button
  48. >
  49. <!-- 提交按钮 科员可见 9 -->
  50. <!-- <el-button
  51. type="primary"
  52. v-if="edit_form.status === '1' && duty === '9'"
  53. @click="handleSubmit"
  54. >提交</el-button
  55. > -->
  56. <!-- 审批按钮 科室经理、分管副总、总经理可见 -->
  57. <el-button
  58. type="primary"
  59. v-if="
  60. edit_form.status === '2' &&
  61. (duty === '7' || duty === '3' || duty === '4') &&
  62. reviewType === duty
  63. "
  64. @click="handleApprove"
  65. >审批</el-button
  66. >
  67. </template>
  68. <!-- <el-button type="primary" @click="handleTrack">流程跟踪</el-button>
  69. <el-button type="primary">导出</el-button> -->
  70. </div>
  71. <!-- <div>
  72. <el-button @click="handleCancel('visible')" type="primary"
  73. >返回</el-button
  74. >
  75. </div> -->
  76. </div>
  77. <!-- 主体部分 -->
  78. <simple-sheet
  79. v-if="visible"
  80. :id="edit_form.id"
  81. :type="
  82. edit_visible &&
  83. (((edit_form.status === '1' || edit_form.status === '2') &&
  84. duty === '9') ||
  85. edit_form.status === '0')
  86. ? 'edit'
  87. : 'view'
  88. "
  89. attribute="file"
  90. @save="handleSave"
  91. />
  92. <!-- <analysis
  93. :edit="edit_form.department_status === '待处理' && edit_visible"
  94. /> -->
  95. </template>
  96. <template v-slot:footer><div></div></template>
  97. </simple-dialog>
  98. <simple-dialog
  99. title="审批"
  100. :visible="approve_visible"
  101. :reload="reload"
  102. width="500px"
  103. class="approve"
  104. @cancel="handleCancel('approve_visible')"
  105. >
  106. <el-form :model="approveForm" ref="approveForm"
  107. ><el-form-item label="审批意见" prop="comments" label-width="80px"
  108. ><el-input
  109. type="textarea"
  110. v-model="approveForm.comments"
  111. autosize /></el-form-item
  112. ></el-form>
  113. <template v-slot:footer
  114. ><div>
  115. <div v-if="type === '1'">
  116. <el-button @click="handleTurn('finish')">结束</el-button>
  117. <el-button @click="handleTurn('transfer')" type="primary"
  118. >转副总审批</el-button
  119. >
  120. <el-button @click="handleTurn('transfermanger')" type="primary"
  121. >转总经理审批</el-button
  122. >
  123. </div>
  124. <div v-else-if="type === '2'">
  125. <el-button @click="handleTurn('finish')">结束</el-button>
  126. <el-button @click="handleTurn('return')">退回</el-button>
  127. <el-button @click="handleTurn('back')">打回</el-button>
  128. <el-button @click="handleTurn('transfer')" type="primary"
  129. >转总经理审批</el-button
  130. >
  131. </div>
  132. <div v-else>
  133. <el-button @click="handleTurn('back')">打回</el-button>
  134. <el-button @click="handleTurn('return')">退回</el-button>
  135. <el-button @click="handleTurn('agree')" type="primary"
  136. >同意</el-button
  137. >
  138. </div>
  139. </div>
  140. </template>
  141. </simple-dialog>
  142. <simple-dialog
  143. title="转派"
  144. :visible="transfer_visible"
  145. :reload="reload"
  146. width="1000px"
  147. @confirm="transferConfirm"
  148. @cancel="handleCancel('transfer_visible')"
  149. >
  150. <el-form
  151. :model="transfer_form"
  152. :rules="transfer_rules"
  153. ref="transfer_form"
  154. label-width="80px"
  155. >
  156. <el-form-item
  157. label="转派人员"
  158. v-for="(item, index) in transfer_form.charge"
  159. :key="index"
  160. :rules="{
  161. required: true,
  162. message: '负责人不能为空',
  163. trigger: 'blur',
  164. }"
  165. >
  166. <div class="flex">
  167. <el-select
  168. class="margin-bottom-20 margin-right-10"
  169. placeholder="请选择负责人"
  170. v-model="item.person"
  171. @change="personChange"
  172. filterable
  173. >
  174. <el-option
  175. v-for="({ label, value }, index) in transfer_list_orgin"
  176. :key="index"
  177. :label="label"
  178. :value="value"
  179. ></el-option>
  180. </el-select>
  181. <div v-if="permission_type === 2">
  182. <span class="form-content">可编辑行:</span>
  183. <el-select
  184. class="margin-bottom-20 margin-right-10"
  185. placeholder="请选择可编辑行"
  186. multiple
  187. v-model="item.allowEditingColumns"
  188. @change="colsChange"
  189. >
  190. <el-option
  191. v-for="(item, index) in transfer_cols_orgin"
  192. :key="index"
  193. :label="item"
  194. :value="item"
  195. ></el-option>
  196. </el-select>
  197. </div>
  198. <div v-if="permission_type === 2">
  199. <span class="form-content">可编辑列:</span>
  200. <el-select
  201. class="margin-bottom-20 margin-right-10"
  202. placeholder="请选择可编辑列"
  203. multiple
  204. v-model="item.rowNum"
  205. @change="rowsChange"
  206. >
  207. <el-option
  208. v-for="(item, index) in transfer_rows_orgin"
  209. :key="index"
  210. :label="item"
  211. :value="item"
  212. ></el-option>
  213. </el-select>
  214. </div>
  215. </div>
  216. </el-form-item>
  217. <div>
  218. <el-button
  219. class="margin-right-10"
  220. @click.prevent="handleCharge('add')"
  221. type="primary"
  222. >添加</el-button
  223. >
  224. <el-button
  225. v-if="transfer_form.charge.length - 1"
  226. @click.prevent="handleCharge('delete')"
  227. >删除</el-button
  228. >
  229. </div>
  230. </el-form>
  231. </simple-dialog>
  232. <simple-dialog
  233. title="回复详情"
  234. width="1000px"
  235. @cancel="handleCancel('principal_visible')"
  236. @confirm="handleCancel('principal_visible')"
  237. :visible="principal_visible"
  238. >
  239. <simple-table
  240. :list="receiver_table_list"
  241. :config="receiver_table_config"
  242. ></simple-table>
  243. </simple-dialog>
  244. <!-- <simple-dialog
  245. title="流程跟踪"
  246. :visible="track_visible"
  247. :reload="reload"
  248. width="600px"
  249. props="track_visible"
  250. @confirm="handleConfirm"
  251. @cancel="handleCancel('track_visible')"
  252. >
  253. <el-table :data="trackList" border>
  254. <el-table-column
  255. prop="link"
  256. label="流程环节"
  257. align="center"
  258. width="180"
  259. >
  260. </el-table-column>
  261. <el-table-column
  262. prop="creatperson"
  263. label="处理人"
  264. align="center"
  265. width="180"
  266. >
  267. </el-table-column>
  268. <el-table-column prop="explain" label="审批说明" align="center">
  269. </el-table-column>
  270. </el-table>
  271. </simple-dialog> -->
  272. </div>
  273. </template>
  274. <script>
  275. import simpleForm from "./components/form.vue";
  276. import simpleTable from "./components/table.vue";
  277. import simplePagination from "./components/pagination.vue";
  278. import simpleDialog from "./components/dialog.vue";
  279. // import analysis from "./analysis.vue";
  280. import simpleSheet from "./components/sheet.vue";
  281. export default {
  282. components: {
  283. simpleForm,
  284. simpleTable,
  285. simplePagination,
  286. simpleDialog,
  287. simpleSheet,
  288. },
  289. data() {
  290. return {
  291. page: 1,
  292. rows: 10,
  293. total: 0,
  294. reviewType: "",
  295. isCheck: false,
  296. // 判断是否为2---特殊权限或者为1---公共权限
  297. permission_type: 2,
  298. // 职位判断转派用
  299. duty: "",
  300. // 搜索参数
  301. table_search: {},
  302. // dialog 参数
  303. transfer_visible: false,
  304. visible: false,
  305. edit_visible: false,
  306. // 审批
  307. approve_visible: false,
  308. // 转派
  309. track_visible: false,
  310. // 回复详情
  311. principal_visible: false,
  312. edit_form: {},
  313. // 回复详情
  314. receiver_table_list: [],
  315. receiver_table_config: [
  316. {
  317. label: "接收人",
  318. props: "receiveName",
  319. },
  320. {
  321. label: "科室",
  322. props: "dept",
  323. },
  324. {
  325. label: "回复时间",
  326. props: "createTime",
  327. },
  328. {
  329. label: "审批记录",
  330. props: "result",
  331. type: "textarea",
  332. },
  333. {
  334. label: "审批意见",
  335. props: "opinion",
  336. type: "textarea",
  337. },
  338. ],
  339. transfer_list_orgin: [],
  340. transfer_cols_orgin: [],
  341. transfer_rows_orgin: [],
  342. transfer_list: [],
  343. transfer_form: {
  344. // personnel: "", // 转派人员
  345. charge: [{ person: "", allowEditingColumns: [], rowNum: [] }],
  346. },
  347. reload: 0,
  348. // 判断类型
  349. type: "3",
  350. approverules: {
  351. comments: [
  352. {
  353. required: true,
  354. message: "请输入审批意见",
  355. trigger: "blur",
  356. },
  357. ],
  358. },
  359. // 转派规则
  360. transfer_rules: {
  361. personnel: [
  362. {
  363. required: true,
  364. message: "请选择转派人员",
  365. trigger: "change",
  366. },
  367. ],
  368. col_start: [
  369. {
  370. required: true,
  371. message: "请选择行",
  372. trigger: "change",
  373. },
  374. ],
  375. row_start: [
  376. {
  377. required: true,
  378. message: "请选择列",
  379. trigger: "change",
  380. },
  381. ],
  382. },
  383. // 审批意见
  384. approveForm: { comments: "" },
  385. trackList: [],
  386. // 顶部form
  387. table_form: [
  388. {
  389. label: "模板名称",
  390. props: "name",
  391. type: "input",
  392. },
  393. {
  394. label: "截止时间",
  395. props: "issuedDate",
  396. type: "datetime",
  397. },
  398. {
  399. label: "状态",
  400. props: "status",
  401. type: "select",
  402. // 0.待处理 1.待汇总 2.待审批 3.已完成
  403. dictionary: [
  404. {
  405. label: "待处理",
  406. value: "0",
  407. },
  408. {
  409. label: "待汇总",
  410. value: "1",
  411. },
  412. {
  413. label: "待审批",
  414. value: "2",
  415. },
  416. {
  417. label: "已完成",
  418. value: "3",
  419. },
  420. ],
  421. },
  422. ],
  423. // 列表数据
  424. table_list: [],
  425. table_loading: false,
  426. // 表格里的操作按钮delete
  427. table_handle_row: [
  428. {
  429. label: "查看",
  430. props: "check",
  431. },
  432. {
  433. label: "处理",
  434. props: "edit",
  435. visible: {
  436. processFlag: ["0"],
  437. },
  438. },
  439. {
  440. label: "撤回",
  441. props: "delete",
  442. popconfirm: true,
  443. visible: {
  444. withdrawFlag: ["0"],
  445. },
  446. },
  447. ],
  448. // 表头配置
  449. table_config: [
  450. {
  451. label: "序号",
  452. type: "number",
  453. },
  454. {
  455. label: "模板名称",
  456. props: "templateName",
  457. },
  458. {
  459. label: "填报事由",
  460. props: "reason",
  461. },
  462. {
  463. label: "填报注意事项",
  464. props: "precautions",
  465. },
  466. {
  467. label: "截止时间",
  468. props: "endTime",
  469. // type: "time",
  470. },
  471. {
  472. label: "发起人",
  473. props: "loginNameStr",
  474. },
  475. {
  476. label: "接收人",
  477. props: "receiverName",
  478. type: "click",
  479. control: "viewFlag",
  480. },
  481. {
  482. label: "状态",
  483. props: "status",
  484. type: "dictionary",
  485. dictionary: { 0: "待处理", 1: "待汇总", 2: "待审批", 3: "已完成" },
  486. },
  487. ],
  488. };
  489. },
  490. // watch: {
  491. // duty() {
  492. // if (this.duty === "9") {
  493. // this.table_config = this.table_config.filter(
  494. // (el) => el.props !== "receiverName"
  495. // );
  496. // }
  497. // },
  498. // },
  499. mounted() {
  500. this.handleInit({
  501. ...this.table_search,
  502. page: this.page,
  503. pageSize: this.rows,
  504. });
  505. // 职位
  506. this.duty = JSON.parse(sessionStorage.userInfo).duty;
  507. // 根据职位判定 科室经理7、分管副总 4 、总经理 3 、职员 9
  508. console.log(this.duty, "duty");
  509. switch (this.duty) {
  510. // 科室经理
  511. case "7":
  512. this.type = "1";
  513. break;
  514. // 分管副总
  515. case "4":
  516. this.type = "2";
  517. break;
  518. // 总经理
  519. case "3":
  520. this.type = "3";
  521. break;
  522. }
  523. },
  524. methods: {
  525. // 初始化
  526. handleInit(data) {
  527. this.table_loading = true;
  528. this.$http({
  529. url: "/market/CMKIssued/CMKIssuedListByUser",
  530. method: "post",
  531. headers: {
  532. "Content-Type": "application/json",
  533. },
  534. data: data,
  535. }).then(({ data: { count, data } }) => {
  536. this.table_loading = false;
  537. this.total = count;
  538. this.table_list = data || [];
  539. });
  540. },
  541. handleChange(page) {
  542. this.page = page;
  543. this.handleInit({
  544. ...this.table_search,
  545. page: this.page,
  546. pageSize: this.rows,
  547. });
  548. },
  549. // 搜索事件
  550. handleSearch(data) {
  551. this.table_search = {
  552. ...data,
  553. issuedDate: data.issuedDate
  554. ? this.$formatDate(data.issuedDate, "YYYY-MM-DD HH:00:00")
  555. : data.issuedDate,
  556. };
  557. this.page = 1;
  558. this.handleInit({
  559. ...this.table_search,
  560. page: this.page,
  561. pageSize: this.rows,
  562. });
  563. },
  564. // 编辑按钮
  565. handleEdit(row) {
  566. this.visible = true;
  567. this.edit_visible = true;
  568. this.edit_form = row;
  569. this.reviewType = "";
  570. // 暂时的处理先调接口
  571. this.$http({
  572. url: "/market/CMKIssued/CMKIssuedProcessByUser",
  573. method: "post",
  574. headers: {
  575. "Content-Type": "application/json",
  576. },
  577. data: { id: this.edit_form.id },
  578. }).then(({ data: { reviewType, list } }) => {
  579. // 判断审批按钮是否还存在
  580. this.permission_type = Number(list[0].type);
  581. console.log(reviewType, "res");
  582. this.reviewType = reviewType;
  583. switch (reviewType) {
  584. case null:
  585. this.reviewType = "";
  586. break;
  587. case "1":
  588. this.reviewType = "7";
  589. break;
  590. case "2":
  591. this.reviewType = "4";
  592. break;
  593. case "3":
  594. this.reviewType = "3";
  595. break;
  596. }
  597. // if (reviewType) {
  598. // this.type = reviewType;
  599. // }
  600. });
  601. },
  602. // 查看按钮
  603. handleCheck(row) {
  604. console.log(row, "row");
  605. this.visible = true;
  606. this.edit_visible = false;
  607. this.edit_form = row;
  608. },
  609. // 原下发管理的撤回
  610. handleDelete({ id }) {
  611. console.log(id, "id");
  612. this.$http({
  613. url: "/market/CMKIssued/CMKDelIssuedById",
  614. method: "post",
  615. headers: {
  616. "Content-Type": "application/json",
  617. },
  618. data: {
  619. id,
  620. },
  621. }).then(() => {
  622. this.$message.success("撤回成功");
  623. this.handleInit({
  624. ...this.table_search,
  625. page: this.page,
  626. pageSize: this.rows,
  627. });
  628. });
  629. },
  630. // dialog事件
  631. //权限管理事件
  632. handleApprove() {
  633. this.approve_visible = true;
  634. },
  635. handleTrack() {
  636. this.track_visible = true;
  637. },
  638. // 转派的增加或删除
  639. handleCharge(type) {
  640. switch (type) {
  641. case "add":
  642. this.transfer_form.charge.push({
  643. person: "",
  644. allowEditingColumns: [],
  645. rowNum: [],
  646. });
  647. break;
  648. case "delete":
  649. this.transfer_form.charge.pop();
  650. break;
  651. }
  652. },
  653. // 三个change事件控制行列人员变动
  654. personChange(val) {
  655. console.log(val, this.transfer_list);
  656. this.transfer_list = this.transfer_list.filter((el) => el.value !== val);
  657. console.log(this.transfer_list, "this.transfer_list");
  658. },
  659. rowsChange(val) {
  660. console.log(val, "rowsChange");
  661. },
  662. colsChange(val) {
  663. console.log(val, "colsChange");
  664. },
  665. handleForbid() {
  666. const permission_type = this.permission_type;
  667. const { charge } = this.transfer_form;
  668. let flag = 1;
  669. console.log(permission_type, "permission_type");
  670. if (permission_type === 1) {
  671. // 公共权限 暂时不用可编辑行和列
  672. charge.forEach((el) => {
  673. if (el.person) {
  674. flag = flag * 1;
  675. } else {
  676. flag = flag * 0;
  677. }
  678. });
  679. } else if (permission_type === 2) {
  680. // 特殊权限
  681. console.log(permission_type, "permission_type");
  682. charge.forEach((el) => {
  683. if (el.person && el.allowEditingColumns.length && el.rowNum.length) {
  684. flag = flag * 1;
  685. } else {
  686. flag = flag * 0;
  687. }
  688. });
  689. }
  690. return flag;
  691. },
  692. // 转派的同意事件
  693. async transferConfirm() {
  694. this.$refs["transfer_form"].validate((valid) => {
  695. if (valid) {
  696. if (this.handleForbid()) {
  697. const { charge } = this.transfer_form;
  698. let params = {
  699. issuedId: this.edit_form.id,
  700. };
  701. if (this.permission_type === 1) {
  702. params.transferCommonAuthority = charge
  703. .map((el) => {
  704. el = el.person.split(",")[0];
  705. return el;
  706. })
  707. .join(",");
  708. } else if (this.permission_type === 2) {
  709. params.transferAuthority = charge.map((el) =>
  710. JSON.stringify({
  711. allowEditingColumns: el.allowEditingColumns.join(","),
  712. rowNum: el.rowNum.join(","),
  713. principalId: el.person.split(",")[0],
  714. principalName: el.person.split(",")[1],
  715. })
  716. );
  717. }
  718. this.$http({
  719. url: "/market/CMKIssued/CMKIssuedTransfer",
  720. method: "post",
  721. headers: {
  722. "Content-Type": "application/json",
  723. },
  724. data: params,
  725. }).then(({ data: { desc } }) => {
  726. if (desc === "转派成功") {
  727. this.$message({
  728. type: "success",
  729. message: desc,
  730. });
  731. this.transfer_visible = false;
  732. this.handleInit({
  733. ...this.table_search,
  734. page: this.page,
  735. pageSize: this.rows,
  736. });
  737. this.handleCancel("visible");
  738. }
  739. });
  740. console.log(params, "this.transfer_form");
  741. } else {
  742. this.$message.error("请填写必要的信息");
  743. }
  744. }
  745. });
  746. },
  747. async handleTransfer() {
  748. let loginNoStr = JSON.parse(sessionStorage.userInfo).loginNoStr;
  749. let groupId = JSON.parse(sessionStorage.userInfo).groupId;
  750. await this.$http({
  751. url: "/sysmgr/sysuserinfo/queryList",
  752. method: "post",
  753. headers: {
  754. "Content-Type": "application/json",
  755. },
  756. data: {
  757. groupId,
  758. },
  759. }).then(({ data }) => {
  760. this.transfer_list_orgin = data
  761. .filter((el) => {
  762. return el.loginNoStr !== loginNoStr;
  763. })
  764. .map((el) => ({
  765. ...el,
  766. label: `${el.loginNameStr}`,
  767. value: `${el.loginNoStr},${el.loginNameStr}`,
  768. }));
  769. this.transfer_list = this.transfer_list_orgin;
  770. // 可编辑行
  771. });
  772. await this.$http({
  773. url: "/market/CMKIssued/CMKIssuedRow",
  774. method: "post",
  775. headers: {
  776. "Content-Type": "application/json",
  777. },
  778. data: {
  779. id: this.edit_form.id,
  780. },
  781. }).then(({ data: { column, row } }) => {
  782. this.transfer_cols_orgin = column.split(",");
  783. this.transfer_rows_orgin = row.split(",");
  784. });
  785. this.transfer_visible = true;
  786. },
  787. handleTurn(type) {
  788. // finish 结束 transfer 转派 back //打回 // agree 同意 // transfermanger 转总经理审批
  789. let request = 0;
  790. let reqdata = {
  791. id: this.edit_form.id,
  792. reviewOpinion: this.approveForm.comments,
  793. };
  794. switch (type) {
  795. case "finish":
  796. // status 0.打回 3.结束
  797. reqdata.status = "3";
  798. reqdata.operateName = "结束";
  799. request = 1;
  800. break;
  801. case "transfer":
  802. // reviewType 2.副总经理 3总经理
  803. if (this.duty === "7") {
  804. reqdata.reviewType = 2;
  805. reqdata.operateName = "转副总审批";
  806. request = 1;
  807. } else if (this.duty === "4") {
  808. reqdata.reviewType = 3;
  809. request = 1;
  810. reqdata.operateName = "转总经理审批";
  811. }
  812. break;
  813. case "transfermanger":
  814. // transfermanger 这首直接转给总经理的流程
  815. reqdata.reviewType = 3;
  816. reqdata.operateName = "转总经理审批";
  817. request = 1;
  818. break;
  819. case "back":
  820. reqdata.status = "0";
  821. reqdata.reviewType = 1;
  822. request = 1;
  823. reqdata.operateName = "打回";
  824. break;
  825. case "return":
  826. reqdata.status = "0";
  827. reqdata.operateName = "退回";
  828. if (this.duty === "4") {
  829. reqdata.reviewType = 1;
  830. } else if (this.duty === "3") {
  831. reqdata.reviewType = 2;
  832. }
  833. console.log(reqdata, "reqdata");
  834. request = 1;
  835. break;
  836. case "agree":
  837. reqdata.operateName = "同意";
  838. reqdata.status = "3";
  839. request = 1;
  840. break;
  841. }
  842. if (request) {
  843. // 这里调接口
  844. this.$http({
  845. url: "/market/CMKIssued/CMKIssuedCheck",
  846. method: "post",
  847. headers: {
  848. "Content-Type": "application/json",
  849. },
  850. data: reqdata,
  851. }).then(({ data: { desc } }) => {
  852. if (desc === "审批成功") {
  853. this.$message({
  854. type: "success",
  855. message: desc,
  856. });
  857. // this.page = 1;
  858. this.handleCancel("visible");
  859. this.handleCancel("approve_visible");
  860. this.handleInit({
  861. ...this.table_search,
  862. page: this.page,
  863. pageSize: this.rows,
  864. });
  865. } else if (desc === "存在未提交,是否还要审核") {
  866. this.$confirm(desc, {
  867. distinguishCancelAndClose: false,
  868. confirmButtonText: "确定",
  869. cancelButtonText: "取消",
  870. type: "warning",
  871. })
  872. .then((res) => {
  873. this.$http({
  874. url: "/market/CMKIssued/CMKIssuedCheck",
  875. method: "post",
  876. headers: {
  877. "Content-Type": "application/json",
  878. },
  879. data: { ...reqdata, submitFlag: 1 },
  880. }).then(({ data: { desc } }) => {
  881. if (desc === "审批成功") {
  882. this.$message({
  883. type: "success",
  884. message: desc,
  885. });
  886. this.handleCancel("visible");
  887. this.handleCancel("approve_visible");
  888. this.handleInit({
  889. ...this.table_search,
  890. page: this.page,
  891. pageSize: this.rows,
  892. });
  893. } else {
  894. this.$message({
  895. type: "error",
  896. message: desc,
  897. });
  898. this.handleCancel("visible");
  899. this.handleCancel("approve_visible");
  900. this.handleInit({
  901. ...this.table_search,
  902. page: this.page,
  903. pageSize: this.rows,
  904. });
  905. }
  906. });
  907. })
  908. .catch((error) => {
  909. this.handleCancel("visible");
  910. this.handleCancel("approve_visible");
  911. this.handleInit({
  912. ...this.table_search,
  913. page: this.page,
  914. pageSize: this.rows,
  915. });
  916. });
  917. }
  918. });
  919. }
  920. // this.$http({
  921. // url: "/market/CMKIssued/CMKIssuedCheck",
  922. // method: "post",
  923. // headers: {
  924. // "Content-Type": "application/json",
  925. // },
  926. // data: {
  927. // groupId,
  928. // },
  929. // }).then((res) => {
  930. // console.log(res, "res");
  931. // this.handleInit()
  932. // this.handleCancel("visible");
  933. // this.handleCancel("approve_visible");
  934. // });
  935. },
  936. // 通用方法用于转化全局
  937. paramsArr(start, end) {
  938. const arr = [];
  939. console.log(start, end);
  940. for (let i = Number(start); i <= Number(end); i++) {
  941. arr.push(i);
  942. }
  943. return arr.join(",");
  944. },
  945. handleConfirm(visible) {
  946. console.log(visible);
  947. this.track_visible = visible;
  948. },
  949. handleSave() {
  950. this.handleInit({
  951. ...this.table_search,
  952. page: this.page,
  953. pageSize: this.rows,
  954. });
  955. this.handleCancel("visible");
  956. },
  957. handleReceiver({ id }) {
  958. // 回复详情
  959. console.log(id);
  960. this.principal_visible = true;
  961. this.$http({
  962. url: "/market/CMKIssued/replyDetails",
  963. method: "post",
  964. headers: {
  965. "Content-Type": "application/json",
  966. },
  967. data: { issuedId: id },
  968. }).then(({ data }) => {
  969. this.receiver_table_list = data;
  970. });
  971. },
  972. // 关闭方法
  973. handleCancel(data) {
  974. switch (data) {
  975. case "visible":
  976. this.visible = false;
  977. break;
  978. case "approve_visible":
  979. this.approveForm.comments = "";
  980. this.approve_visible = false;
  981. break;
  982. case "track_visible":
  983. this.track_visible = false;
  984. break;
  985. case "transfer_visible":
  986. this.transfer_visible = false;
  987. break;
  988. case "principal_visible":
  989. this.principal_visible = false;
  990. break;
  991. }
  992. },
  993. // handleBack() {
  994. // const object = {
  995. // ...JSON.parse(sessionStorage.global_data)[0],
  996. // department_status: "待处理",
  997. // };
  998. // sessionStorage.setItem("global_data", JSON.stringify([object]));
  999. // const process_array = JSON.parse(sessionStorage.global_process);
  1000. // process_array.push({
  1001. // link: "审批驳回",
  1002. // creatperson: `ADMIN ${this.$formatDate(new Date(), "YYYY-MM-DD")}`,
  1003. // explain: this.approveForm.comments,
  1004. // });
  1005. // sessionStorage.setItem("global_process", JSON.stringify(process_array));
  1006. // // this.handleInit();
  1007. // // this.$message.success("打回成功");
  1008. // // this.handleCancel("visible");
  1009. // // this.handleCancel("approve_visible");
  1010. // },
  1011. // handleAgree() {
  1012. // const object = {
  1013. // ...JSON.parse(sessionStorage.global_data)[0],
  1014. // department_status: "已完成",
  1015. // };
  1016. // sessionStorage.setItem("global_data", JSON.stringify([object]));
  1017. // const process_array = JSON.parse(sessionStorage.global_process);
  1018. // process_array.push({
  1019. // link: "审批通过",
  1020. // creatperson: `ADMIN ${this.$formatDate(new Date(), "YYYY-MM-DD")}`,
  1021. // explain: this.approveForm.comments,
  1022. // });
  1023. // sessionStorage.setItem("global_process", JSON.stringify(process_array));
  1024. // this.handleInit();
  1025. // this.$message.success("审批成功");
  1026. // this.handleCancel("visible");
  1027. // this.handleCancel("approve_visible");
  1028. // },
  1029. // handleSubmit() {
  1030. // // 提交好了
  1031. // let reqdata = {
  1032. // id: this.edit_form.id,
  1033. // templateContent: "asdad",
  1034. // };
  1035. // this.$http({
  1036. // url: "/CMKIssued/CMKIssuedSubmit",
  1037. // method: "post",
  1038. // headers: {
  1039. // "Content-Type": "application/json",
  1040. // },
  1041. // data: reqdata,
  1042. // }).then(({ data }) => {
  1043. // console.log(data, "data");
  1044. // if (data) {
  1045. // this.$message.success("提交成功");
  1046. // this.handleCancel("visible");
  1047. // } else {
  1048. // this.$message.error("提交失败");
  1049. // }
  1050. // });
  1051. // },
  1052. },
  1053. };
  1054. </script>
  1055. <style lang="scss" scope>
  1056. .approve {
  1057. .v-modal {
  1058. display: none !important;
  1059. }
  1060. }
  1061. </style>