department.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062
  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 === '2' || duty === '1')
  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 === '2' || duty === '1') &&
  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. },
  480. {
  481. label: "状态",
  482. props: "status",
  483. type: "dictionary",
  484. dictionary: { 0: "待处理", 1: "待汇总", 2: "待审批", 3: "已完成" },
  485. },
  486. ],
  487. };
  488. },
  489. watch:{
  490. duty(){
  491. if(this.duty==='9'){
  492. this.table_config = this.table_config.filter(el=>el.props!=='receiverName')
  493. }
  494. }
  495. },
  496. mounted() {
  497. this.handleInit({
  498. ...this.table_search,
  499. page: this.page,
  500. pageSize: this.rows,
  501. });
  502. // 职位
  503. this.duty = JSON.parse(sessionStorage.userInfo).duty;
  504. // 根据职位判定 科室经理7、分管副总 2 、总经理 1 、职员 9
  505. console.log(this.duty, "duty");
  506. switch (this.duty) {
  507. // 科室经理
  508. case "7":
  509. this.type = "1";
  510. break;
  511. // 分管副总
  512. case "2":
  513. this.type = "2";
  514. break;
  515. // 总经理
  516. case "1":
  517. this.type = "3";
  518. break;
  519. }
  520. },
  521. methods: {
  522. // 初始化
  523. handleInit(data) {
  524. this.table_loading = true;
  525. this.$http({
  526. url: "/market/CMKIssued/CMKIssuedListByUser",
  527. method: "post",
  528. headers: {
  529. "Content-Type": "application/json",
  530. },
  531. data: data,
  532. }).then(({ data: { count, data } }) => {
  533. this.table_loading = false;
  534. this.total = count;
  535. this.table_list = data || [];
  536. });
  537. },
  538. handleChange(page) {
  539. this.page = page;
  540. this.handleInit({
  541. ...this.table_search,
  542. page: this.page,
  543. pageSize: this.rows,
  544. });
  545. },
  546. // 搜索事件
  547. handleSearch(data) {
  548. this.table_search = {
  549. ...data,
  550. issuedDate: data.issuedDate
  551. ? this.$formatDate(data.issuedDate, "YYYY-MM-DD HH:00:00")
  552. : data.issuedDate,
  553. };
  554. this.page = 1;
  555. this.handleInit({
  556. ...this.table_search,
  557. page: this.page,
  558. pageSize: this.rows,
  559. });
  560. },
  561. // 编辑按钮
  562. handleEdit(row) {
  563. this.visible = true;
  564. this.edit_visible = true;
  565. this.edit_form = row;
  566. this.reviewType = "";
  567. // 暂时的处理先调接口
  568. this.$http({
  569. url: "/market/CMKIssued/CMKIssuedProcessByUser",
  570. method: "post",
  571. headers: {
  572. "Content-Type": "application/json",
  573. },
  574. data: { id: this.edit_form.id },
  575. }).then(({ data: { reviewType, list } }) => {
  576. // 判断审批按钮是否还存在
  577. this.permission_type = Number(list[0].type);
  578. console.log(reviewType, "res");
  579. this.reviewType = reviewType;
  580. switch (reviewType) {
  581. case null:
  582. this.reviewType = "";
  583. break;
  584. case "1":
  585. this.reviewType = "7";
  586. break;
  587. case "2":
  588. this.reviewType = "2";
  589. break;
  590. case "3":
  591. this.reviewType = "1";
  592. break;
  593. }
  594. // if (reviewType) {
  595. // this.type = reviewType;
  596. // }
  597. });
  598. },
  599. // 查看按钮
  600. handleCheck(row) {
  601. console.log(row, "row");
  602. this.visible = true;
  603. this.edit_visible = false;
  604. this.edit_form = row;
  605. },
  606. // 原下发管理的撤回
  607. handleDelete({ id }) {
  608. console.log(id, "id");
  609. this.$http({
  610. url: "/market/CMKIssued/CMKDelIssuedById",
  611. method: "post",
  612. headers: {
  613. "Content-Type": "application/json",
  614. },
  615. data: {
  616. id,
  617. },
  618. }).then(() => {
  619. this.$message.success("撤回成功");
  620. this.handleInit({
  621. ...this.table_search,
  622. page: this.page,
  623. pageSize: this.rows,
  624. });
  625. });
  626. },
  627. // dialog事件
  628. //权限管理事件
  629. handleApprove() {
  630. this.approve_visible = true;
  631. },
  632. handleTrack() {
  633. this.track_visible = true;
  634. },
  635. // 转派的增加或删除
  636. handleCharge(type) {
  637. switch (type) {
  638. case "add":
  639. this.transfer_form.charge.push({
  640. person: "",
  641. allowEditingColumns: [],
  642. rowNum: [],
  643. });
  644. break;
  645. case "delete":
  646. this.transfer_form.charge.pop();
  647. break;
  648. }
  649. },
  650. // 三个change事件控制行列人员变动
  651. personChange(val) {
  652. console.log(val, this.transfer_list);
  653. this.transfer_list = this.transfer_list.filter((el) => el.value !== val);
  654. console.log(this.transfer_list, "this.transfer_list");
  655. },
  656. rowsChange(val) {
  657. console.log(val, "rowsChange");
  658. },
  659. colsChange(val) {
  660. console.log(val, "colsChange");
  661. },
  662. handleForbid() {
  663. const permission_type = this.permission_type;
  664. const { charge } = this.transfer_form;
  665. let flag = 1;
  666. console.log(permission_type, "permission_type");
  667. if (permission_type === 1) {
  668. // 公共权限 暂时不用可编辑行和列
  669. charge.forEach((el) => {
  670. if (el.person) {
  671. flag = flag * 1;
  672. } else {
  673. flag = flag * 0;
  674. }
  675. });
  676. } else if (permission_type === 2) {
  677. // 特殊权限
  678. console.log(permission_type, "permission_type");
  679. charge.forEach((el) => {
  680. if (el.person && el.allowEditingColumns.length && el.rowNum.length) {
  681. flag = flag * 1;
  682. } else {
  683. flag = flag * 0;
  684. }
  685. });
  686. }
  687. return flag;
  688. },
  689. // 转派的同意事件
  690. async transferConfirm() {
  691. this.$refs["transfer_form"].validate((valid) => {
  692. if (valid) {
  693. if (this.handleForbid()) {
  694. const { charge } = this.transfer_form;
  695. let params = {
  696. issuedId: this.edit_form.id,
  697. };
  698. if (this.permission_type === 1) {
  699. params.transferCommonAuthority = charge
  700. .map((el) => {
  701. el = el.person.split(",")[0];
  702. return el;
  703. })
  704. .join(",");
  705. } else if (this.permission_type === 2) {
  706. params.transferAuthority = charge.map((el) =>
  707. JSON.stringify({
  708. allowEditingColumns: el.allowEditingColumns.join(","),
  709. rowNum: el.rowNum.join(","),
  710. principalId: el.person.split(",")[0],
  711. principalName: el.person.split(",")[1],
  712. })
  713. );
  714. }
  715. this.$http({
  716. url: "/market/CMKIssued/CMKIssuedTransfer",
  717. method: "post",
  718. headers: {
  719. "Content-Type": "application/json",
  720. },
  721. data: params,
  722. }).then(({ data: { desc } }) => {
  723. if (desc === "转派成功") {
  724. this.$message({
  725. type: "success",
  726. message: desc,
  727. });
  728. this.transfer_visible = false;
  729. this.handleInit({
  730. ...this.table_search,
  731. page: this.page,
  732. pageSize: this.rows,
  733. });
  734. this.handleCancel("visible");
  735. }
  736. });
  737. console.log(params, "this.transfer_form");
  738. } else {
  739. this.$message.error("请填写必要的信息");
  740. }
  741. }
  742. });
  743. },
  744. async handleTransfer() {
  745. let loginNoStr = JSON.parse(sessionStorage.userInfo).loginNoStr;
  746. let groupId = JSON.parse(sessionStorage.userInfo).groupId;
  747. await this.$http({
  748. url: "/sysmgr/sysuserinfo/queryList",
  749. method: "post",
  750. headers: {
  751. "Content-Type": "application/json",
  752. },
  753. data: {
  754. groupId,
  755. },
  756. }).then(({ data }) => {
  757. this.transfer_list_orgin = data
  758. .filter((el) => {
  759. return el.loginNoStr !== loginNoStr;
  760. })
  761. .map((el) => ({
  762. ...el,
  763. label: `${el.loginNameStr}`,
  764. value: `${el.loginNoStr},${el.loginNameStr}`,
  765. }));
  766. this.transfer_list = this.transfer_list_orgin;
  767. // 可编辑行
  768. });
  769. await this.$http({
  770. url: "/market/CMKIssued/CMKIssuedRow",
  771. method: "post",
  772. headers: {
  773. "Content-Type": "application/json",
  774. },
  775. data: {
  776. id: this.edit_form.id,
  777. },
  778. }).then(({ data: { column, row } }) => {
  779. this.transfer_cols_orgin = column.split(",");
  780. this.transfer_rows_orgin = row.split(",");
  781. });
  782. this.transfer_visible = true;
  783. },
  784. handleTurn(type) {
  785. // finish 结束 transfer 转派 back //打回 // agree 同意 // transfermanger 转总经理审批
  786. let request = 0;
  787. let reqdata = {
  788. id: this.edit_form.id,
  789. reviewOpinion: this.approveForm.comments,
  790. };
  791. switch (type) {
  792. case "finish":
  793. // status 0.打回 3.结束
  794. reqdata.status = "3";
  795. reqdata.operateName = "结束";
  796. request = 1;
  797. break;
  798. case "transfer":
  799. // reviewType 2.副总经理 3总经理
  800. if (this.duty === "7") {
  801. reqdata.reviewType = 2;
  802. reqdata.operateName = "转副总审批";
  803. request = 1;
  804. } else if (this.duty === "2") {
  805. reqdata.reviewType = 3;
  806. request = 1;
  807. reqdata.operateName = "转总经理审批";
  808. }
  809. break;
  810. case "transfermanger":
  811. // transfermanger 这首直接转给总经理的流程
  812. reqdata.reviewType = 3;
  813. reqdata.operateName = "转总经理审批";
  814. request = 1;
  815. break;
  816. case "back":
  817. reqdata.status = "0";
  818. reqdata.reviewType = 1;
  819. request = 1;
  820. reqdata.operateName = "打回";
  821. break;
  822. case "return":
  823. reqdata.status = "0";
  824. reqdata.operateName = "退回";
  825. if (this.duty === "2") {
  826. reqdata.reviewType = 1;
  827. } else if (this.duty === "1") {
  828. reqdata.reviewType = 2;
  829. }
  830. console.log(reqdata, "reqdata");
  831. request = 1;
  832. break;
  833. case "agree":
  834. reqdata.operateName = "同意";
  835. reqdata.status = "3";
  836. request = 1;
  837. break;
  838. }
  839. if (request) {
  840. // 这里调接口
  841. this.$http({
  842. url: "/market/CMKIssued/CMKIssuedCheck",
  843. method: "post",
  844. headers: {
  845. "Content-Type": "application/json",
  846. },
  847. data: reqdata,
  848. }).then(({ data: { desc } }) => {
  849. if (desc === "审批成功") {
  850. this.$message({
  851. type: "success",
  852. message: desc,
  853. });
  854. // this.page = 1;
  855. this.handleCancel("visible");
  856. this.handleCancel("approve_visible");
  857. this.handleInit({
  858. ...this.table_search,
  859. page: this.page,
  860. pageSize: this.rows,
  861. });
  862. } else if (desc === "存在未提交,是否还要审核") {
  863. this.$confirm(desc, {
  864. distinguishCancelAndClose: false,
  865. confirmButtonText: "确定",
  866. cancelButtonText: "取消",
  867. type: "warning",
  868. })
  869. .then((res) => {
  870. this.$http({
  871. url: "/market/CMKIssued/CMKIssuedCheck",
  872. method: "post",
  873. headers: {
  874. "Content-Type": "application/json",
  875. },
  876. data: { ...reqdata, submitFlag: 1 },
  877. }).then(({ data: { desc } }) => {
  878. if (desc === "审批成功") {
  879. this.$message({
  880. type: "success",
  881. message: desc,
  882. });
  883. this.handleCancel("visible");
  884. this.handleCancel("approve_visible");
  885. this.handleInit({
  886. ...this.table_search,
  887. page: this.page,
  888. pageSize: this.rows,
  889. });
  890. } else {
  891. this.$message({
  892. type: "error",
  893. message: desc,
  894. });
  895. this.handleCancel("visible");
  896. this.handleCancel("approve_visible");
  897. this.handleInit({
  898. ...this.table_search,
  899. page: this.page,
  900. pageSize: this.rows,
  901. });
  902. }
  903. });
  904. })
  905. .catch((error) => {
  906. this.handleCancel("visible");
  907. this.handleCancel("approve_visible");
  908. this.handleInit({
  909. ...this.table_search,
  910. page: this.page,
  911. pageSize: this.rows,
  912. });
  913. });
  914. }
  915. });
  916. }
  917. // this.$http({
  918. // url: "/market/CMKIssued/CMKIssuedCheck",
  919. // method: "post",
  920. // headers: {
  921. // "Content-Type": "application/json",
  922. // },
  923. // data: {
  924. // groupId,
  925. // },
  926. // }).then((res) => {
  927. // console.log(res, "res");
  928. // this.handleInit()
  929. // this.handleCancel("visible");
  930. // this.handleCancel("approve_visible");
  931. // });
  932. },
  933. // 通用方法用于转化全局
  934. paramsArr(start, end) {
  935. const arr = [];
  936. console.log(start, end);
  937. for (let i = Number(start); i <= Number(end); i++) {
  938. arr.push(i);
  939. }
  940. return arr.join(",");
  941. },
  942. handleConfirm(visible) {
  943. console.log(visible);
  944. this.track_visible = visible;
  945. },
  946. handleSave() {
  947. this.handleInit({
  948. ...this.table_search,
  949. page: this.page,
  950. pageSize: this.rows,
  951. });
  952. this.handleCancel("visible");
  953. },
  954. handleReceiver({ id }) {
  955. // 回复详情
  956. console.log(id);
  957. this.principal_visible = true;
  958. this.$http({
  959. url: "/market/CMKIssued/replyDetails",
  960. method: "post",
  961. headers: {
  962. "Content-Type": "application/json",
  963. },
  964. data: { issuedId: id },
  965. }).then(({ data }) => {
  966. this.receiver_table_list = data;
  967. });
  968. },
  969. // 关闭方法
  970. handleCancel(data) {
  971. switch (data) {
  972. case "visible":
  973. this.visible = false;
  974. break;
  975. case "approve_visible":
  976. this.approveForm.comments = "";
  977. this.approve_visible = false;
  978. break;
  979. case "track_visible":
  980. this.track_visible = false;
  981. break;
  982. case "transfer_visible":
  983. this.transfer_visible = false;
  984. break;
  985. case "principal_visible":
  986. this.principal_visible = false;
  987. break;
  988. }
  989. },
  990. // handleBack() {
  991. // const object = {
  992. // ...JSON.parse(sessionStorage.global_data)[0],
  993. // department_status: "待处理",
  994. // };
  995. // sessionStorage.setItem("global_data", JSON.stringify([object]));
  996. // const process_array = JSON.parse(sessionStorage.global_process);
  997. // process_array.push({
  998. // link: "审批驳回",
  999. // creatperson: `ADMIN ${this.$formatDate(new Date(), "YYYY-MM-DD")}`,
  1000. // explain: this.approveForm.comments,
  1001. // });
  1002. // sessionStorage.setItem("global_process", JSON.stringify(process_array));
  1003. // // this.handleInit();
  1004. // // this.$message.success("打回成功");
  1005. // // this.handleCancel("visible");
  1006. // // this.handleCancel("approve_visible");
  1007. // },
  1008. // handleAgree() {
  1009. // const object = {
  1010. // ...JSON.parse(sessionStorage.global_data)[0],
  1011. // department_status: "已完成",
  1012. // };
  1013. // sessionStorage.setItem("global_data", JSON.stringify([object]));
  1014. // const process_array = JSON.parse(sessionStorage.global_process);
  1015. // process_array.push({
  1016. // link: "审批通过",
  1017. // creatperson: `ADMIN ${this.$formatDate(new Date(), "YYYY-MM-DD")}`,
  1018. // explain: this.approveForm.comments,
  1019. // });
  1020. // sessionStorage.setItem("global_process", JSON.stringify(process_array));
  1021. // this.handleInit();
  1022. // this.$message.success("审批成功");
  1023. // this.handleCancel("visible");
  1024. // this.handleCancel("approve_visible");
  1025. // },
  1026. // handleSubmit() {
  1027. // // 提交好了
  1028. // let reqdata = {
  1029. // id: this.edit_form.id,
  1030. // templateContent: "asdad",
  1031. // };
  1032. // this.$http({
  1033. // url: "/CMKIssued/CMKIssuedSubmit",
  1034. // method: "post",
  1035. // headers: {
  1036. // "Content-Type": "application/json",
  1037. // },
  1038. // data: reqdata,
  1039. // }).then(({ data }) => {
  1040. // console.log(data, "data");
  1041. // if (data) {
  1042. // this.$message.success("提交成功");
  1043. // this.handleCancel("visible");
  1044. // } else {
  1045. // this.$message.error("提交失败");
  1046. // }
  1047. // });
  1048. // },
  1049. },
  1050. };
  1051. </script>
  1052. <style lang="scss" scope>
  1053. .approve {
  1054. .v-modal {
  1055. display: none !important;
  1056. }
  1057. }
  1058. </style>