department.vue 32 KB

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