department.vue 29 KB

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