department.vue 31 KB

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