department.vue 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220
  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. </template>
  87. <template v-slot:footer><div></div></template>
  88. </simple-dialog>
  89. <simple-dialog
  90. title="审批"
  91. :visible="approve_visible"
  92. :reload="reload"
  93. width="500px"
  94. class="approve"
  95. @cancel="handleCancel('approve_visible')"
  96. >
  97. <el-form :model="approveForm" ref="approveForm" label-width="120px">
  98. <el-form-item
  99. label="审批意见:"
  100. :rules="{
  101. required: true,
  102. message: '请选择审批意见',
  103. trigger: 'change',
  104. }"
  105. >
  106. <el-select v-model="approveForm.type">
  107. <el-option
  108. v-for="item in approveForm.list"
  109. :key="item.value"
  110. :label="item.label"
  111. :value="item.value"
  112. >
  113. </el-option>
  114. </el-select>
  115. </el-form-item>
  116. <el-form-item
  117. v-if="approveForm.type === '3'"
  118. label="其它审批意见:"
  119. :rules="{
  120. required: true,
  121. message: '请输入审批意见',
  122. trigger: 'blur',
  123. }"
  124. ><el-input v-model="approveForm.comments" /></el-form-item
  125. ></el-form>
  126. <template v-slot:footer
  127. ><div>
  128. <div v-if="type === '1'">
  129. <el-button @click="handleTurn('finish')" type="primary">结束</el-button>
  130. <el-button @click="handleTurn('transfer')"
  131. >转副总审批</el-button
  132. >
  133. <el-button @click="handleTurn('transfermanger')"
  134. >转总经理审批</el-button
  135. >
  136. </div>
  137. <div v-else-if="type === '2'">
  138. <el-button @click="handleTurn('finish')" type="primary">结束</el-button>
  139. <el-button @click="handleTurn('return')" type="primary">退回</el-button>
  140. <el-button @click="handleTurn('back')" type="primary">打回</el-button>
  141. <el-button @click="handleTurn('transfer')"
  142. >转总经理审批</el-button
  143. >
  144. </div>
  145. <div v-else>
  146. <el-button @click="handleTurn('back')">打回</el-button>
  147. <el-button @click="handleTurn('return')">退回</el-button>
  148. <el-button @click="handleTurn('agree')" type="primary"
  149. >同意</el-button
  150. >
  151. </div>
  152. </div>
  153. </template>
  154. </simple-dialog>
  155. <simple-dialog
  156. title="转派"
  157. :visible="transfer_visible"
  158. :reload="reload"
  159. width="1200px"
  160. @confirm="transferConfirm"
  161. @cancel="handleCancel('transfer_visible')"
  162. >
  163. <el-form
  164. :model="transfer_form"
  165. :rules="transfer_rules"
  166. ref="transfer_form"
  167. label-width="80px"
  168. >
  169. <el-form-item
  170. label="转派人员"
  171. v-for="(item, index) in transfer_form.charge"
  172. :key="index"
  173. :rules="{
  174. required: true,
  175. message: '负责人不能为空',
  176. trigger: 'blur',
  177. }"
  178. >
  179. <div class="flex">
  180. <el-select
  181. class="margin-bottom-20 margin-right-10"
  182. placeholder="请选择负责人"
  183. v-model="item.person"
  184. @change="personChange"
  185. filterable
  186. >
  187. <el-option
  188. v-for="({ label, value }, index) in transfer_list_orgin"
  189. :key="index"
  190. :label="label"
  191. :value="value"
  192. ></el-option>
  193. </el-select>
  194. <div v-if="permission_type === 2">
  195. <span class="form-content">可编辑行:</span>
  196. <el-select
  197. class="margin-bottom-20 margin-right-10"
  198. placeholder="请选择可编辑行"
  199. multiple
  200. v-model="item.rowNum"
  201. @change="colsChange"
  202. >
  203. <el-option
  204. v-for="(item, index) in transfer_rows_orgin"
  205. :key="index"
  206. :label="item"
  207. :value="item"
  208. ></el-option>
  209. </el-select>
  210. </div>
  211. <!-- <div v-if="permission_type === 2">
  212. <span class="form-content">可编辑列:</span>
  213. <el-select
  214. class="margin-bottom-20 margin-right-10"
  215. placeholder="请选择可编辑列"
  216. multiple
  217. v-model="item.allowEditingColumns"
  218. @change="rowsChange"
  219. >
  220. <el-option
  221. v-for="(item, index) in transfer_cols_orgin"
  222. :key="index"
  223. :label="item"
  224. :value="item"
  225. ></el-option>
  226. </el-select>
  227. </div> -->
  228. </div>
  229. </el-form-item>
  230. <div>
  231. <el-button
  232. class="margin-right-10"
  233. @click.prevent="handleCharge('add')"
  234. type="primary"
  235. >添加</el-button
  236. >
  237. <el-button
  238. v-if="transfer_form.charge.length - 1"
  239. @click.prevent="handleCharge('delete')"
  240. >删除</el-button
  241. >
  242. </div>
  243. </el-form>
  244. </simple-dialog>
  245. <simple-dialog
  246. title="回复详情"
  247. width="1000px"
  248. @cancel="handleCancel('principal_visible')"
  249. @confirm="handleCancel('principal_visible')"
  250. :visible="principal_visible"
  251. >
  252. <simple-table
  253. :list="receiver_table_list"
  254. :config="receiver_table_config"
  255. ></simple-table>
  256. <template v-slot:footer><div></div></template>
  257. </simple-dialog>
  258. <simple-dialog
  259. title="选择科室经理"
  260. :visible="menager_visible"
  261. @confirm="confirmManger"
  262. @cancel="handleCancel('menager_visible')"
  263. >
  264. <el-form>
  265. <el-form-item label="科室经理">
  266. <el-select v-model="receiverId">
  267. <el-option
  268. v-for="(item, index) in receiverList"
  269. :key="index"
  270. :label="item.label"
  271. :value="item.value"
  272. >
  273. </el-option>
  274. </el-select>
  275. </el-form-item>
  276. </el-form>
  277. </simple-dialog>
  278. </div>
  279. </template>
  280. <script>
  281. import simpleForm from "./components/form.vue";
  282. import simpleTable from "./components/table.vue";
  283. import simplePagination from "./components/pagination.vue";
  284. import simpleDialog from "./components/dialog.vue";
  285. // import analysis from "./analysis.vue";
  286. import simpleSheet from "./components/sheet.vue";
  287. export default {
  288. components: {
  289. simpleForm,
  290. simpleTable,
  291. simplePagination,
  292. simpleDialog,
  293. simpleSheet,
  294. },
  295. data() {
  296. return {
  297. page: 1,
  298. idx: "",
  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. id : this.getUrlKey("id")//获取地址栏参数
  609. });
  610. // 职位
  611. this.duty = JSON.parse(sessionStorage.userInfo).duty;
  612. // 根据职位判定 科室经理7、分管副总 4 、总经理 3 、职员 9
  613. console.log(this.duty, "duty");
  614. switch (this.duty) {
  615. // 科室经理
  616. case "7":
  617. this.type = "1";
  618. break;
  619. // 分管副总
  620. case "4":
  621. this.type = "2";
  622. break;
  623. // 总经理
  624. case "3":
  625. this.type = "3";
  626. break;
  627. }
  628. },
  629. methods: {
  630. getUrlKey(name) {
  631. return (
  632. decodeURIComponent(
  633. (new RegExp("[?|&]" + name + "=" + "([^&;]+?)(&|#|;|$)").exec(
  634. location.href
  635. ) || [, ""])[1].replace(/\+/g, "%20")
  636. ) || null
  637. );
  638. },
  639. // 初始化
  640. handleInit(data) {
  641. this.table_loading = true;
  642. this.$http({
  643. url: "/market/CMKIssued/CMKIssuedListByUser",
  644. method: "post",
  645. headers: {
  646. "Content-Type": "application/json",
  647. },
  648. data: data,
  649. }).then(({ data: { count, data } }) => {
  650. // if (this.idx) {
  651. // var data1;
  652. // for (var i = 0; i < data.length; i++) {
  653. // if (data[i].id != this.idx) {
  654. // } else {
  655. // data1 = data[i];
  656. // data.length = 0;
  657. // data.push(data1);
  658. // this.table_loading = false;
  659. // this.total = count;
  660. // this.table_list = data || [];
  661. // }
  662. // }
  663. // }
  664. this.table_loading = false;
  665. this.total = count;
  666. this.table_list = data || [];
  667. });
  668. },
  669. handleChange(page) {
  670. this.page = page;
  671. this.handleInit({
  672. ...this.table_search,
  673. page: this.page,
  674. pageSize: this.rows,
  675. });
  676. },
  677. // 搜索事件
  678. handleSearch(data) {
  679. this.table_search = {
  680. ...data,
  681. issuedDate: data.issuedDate
  682. ? this.$formatDate(data.issuedDate, "YYYY-MM-DD HH:mm:ss")
  683. : data.issuedDate,
  684. };
  685. console.log(this.table_search, "daaad");
  686. this.page = 1;
  687. this.handleInit({
  688. ...this.table_search,
  689. page: this.page,
  690. pageSize: this.rows,
  691. });
  692. },
  693. // 编辑按钮
  694. handleEdit(row) {
  695. this.visible = true;
  696. this.edit_visible = true;
  697. this.edit_form = row;
  698. this.reviewType = "";
  699. // 暂时的处理先调接口
  700. this.$http({
  701. url: "/market/CMKIssued/CMKIssuedProcessByUser",
  702. method: "post",
  703. headers: {
  704. "Content-Type": "application/json",
  705. },
  706. data: { id: this.edit_form.id },
  707. }).then(({ data: { reviewType, list } }) => {
  708. // 判断审批按钮是否还存在
  709. this.permission_type = Number(list[0].type);
  710. console.log(reviewType, "res");
  711. this.reviewType = reviewType;
  712. switch (reviewType) {
  713. case null:
  714. this.reviewType = "";
  715. break;
  716. case "1":
  717. this.reviewType = "7";
  718. break;
  719. case "2":
  720. this.reviewType = "4";
  721. break;
  722. case "3":
  723. this.reviewType = "3";
  724. break;
  725. }
  726. // if (reviewType) {
  727. // this.type = reviewType;
  728. // }
  729. });
  730. },
  731. // 查看按钮
  732. handleCheck(row) {
  733. this.edit_form = row;
  734. this.edit_visible = false;
  735. this.id = row.id;
  736. this.visible = true;
  737. // if (row.receiverId && row.receiverId.split(",").length > 1) {
  738. // this.menager_visible = true;
  739. // this.receiverList = row.receiverName
  740. // ? row.receiverId.split(",").map((el, index) => ({
  741. // label: row.receiverName.split(",")[index],
  742. // value: el,
  743. // }))
  744. // : [];
  745. // } else {
  746. // this.id = row.id;
  747. // this.visible = true;
  748. // }
  749. },
  750. confirmManger() {
  751. this.visible = true;
  752. this.edit_visible = false;
  753. this.menager_visible = false;
  754. },
  755. // 原下发管理的撤回
  756. handleDelete({ id }) {
  757. console.log(id, "id");
  758. this.$http({
  759. url: "/market/CMKIssued/CMKDelIssuedById",
  760. method: "post",
  761. headers: {
  762. "Content-Type": "application/json",
  763. },
  764. data: {
  765. id,
  766. },
  767. }).then(() => {
  768. this.$message.success("撤回成功, 请重新创建模版");
  769. this.handleInit({
  770. ...this.table_search,
  771. page: this.page,
  772. pageSize: this.rows,
  773. });
  774. });
  775. },
  776. handleRemove({ id }) {
  777. console.log(id, "id");
  778. this.$http({
  779. url: "/market/CMKIssued/CMKRemoveIssuedById",
  780. method: "post",
  781. headers: {
  782. "Content-Type": "application/json",
  783. },
  784. data: {
  785. id,
  786. },
  787. }).then(() => {
  788. this.$message.success("删除成功, 请重新创建模版");
  789. this.handleInit({
  790. ...this.table_search,
  791. page: this.page,
  792. pageSize: this.rows,
  793. });
  794. });
  795. },
  796. // dialog事件
  797. //权限管理事件
  798. handleApprove() {
  799. this.approve_visible = true;
  800. },
  801. handleTrack() {
  802. this.track_visible = true;
  803. },
  804. // 转派的增加或删除
  805. handleCharge(type) {
  806. switch (type) {
  807. case "add":
  808. if (
  809. this.transfer_form.charge[this.transfer_form.charge.length - 1]
  810. .rowNum.length
  811. ) {
  812. this.transfer_form.charge.push({
  813. person: "",
  814. allowEditingColumns: [],
  815. rowNum: [],
  816. });
  817. } else {
  818. this.$message.error("请先选择需要转派的列");
  819. }
  820. break;
  821. case "delete":
  822. this.transfer_form.charge.pop();
  823. break;
  824. }
  825. },
  826. // 三个change事件控制行列人员变动
  827. personChange(val) {
  828. console.log(val, this.transfer_list);
  829. this.transfer_list = this.transfer_list.filter((el) => el.value !== val);
  830. console.log(this.transfer_list, "this.transfer_list");
  831. },
  832. rowsChange(val) {
  833. console.log(val, "rowsChange");
  834. },
  835. colsChange(val) {
  836. console.log(val, "colsChange");
  837. },
  838. handleForbid() {
  839. const permission_type = this.permission_type;
  840. const { charge } = this.transfer_form;
  841. let flag = 1;
  842. console.log(permission_type, "permission_type");
  843. if (permission_type === 1) {
  844. // 公共权限 暂时不用可编辑行和列
  845. charge.forEach((el) => {
  846. if (el.person) {
  847. flag = flag * 1;
  848. } else {
  849. flag = flag * 0;
  850. }
  851. });
  852. } else if (permission_type === 2) {
  853. // 特殊权限
  854. console.log(permission_type, "permission_type");
  855. if (this.transfer_form.charge.length === 1) {
  856. charge.forEach((el) => {
  857. if (el.person) {
  858. flag = flag * 1;
  859. } else {
  860. flag = flag * 0;
  861. }
  862. });
  863. } else if (this.transfer_form.charge.length > 1) {
  864. if (
  865. this.transfer_form.charge[this.transfer_form.charge.length - 1]
  866. .rowNum.length
  867. ) {
  868. flag = flag * 1;
  869. } else {
  870. flag = flag * 0;
  871. }
  872. }
  873. }
  874. return flag;
  875. },
  876. // 转派的同意事件
  877. async transferConfirm() {
  878. this.$refs["transfer_form"].validate((valid) => {
  879. if (valid) {
  880. if (this.handleForbid()) {
  881. const { charge } = this.transfer_form;
  882. let params = {
  883. issuedId: this.edit_form.id,
  884. };
  885. if (this.permission_type === 1) {
  886. params.transferCommonAuthority = charge
  887. .map((el) => {
  888. el = el.person.split(",")[0];
  889. return el;
  890. })
  891. .join(",");
  892. } else if (this.permission_type === 2) {
  893. params.transferAuthority = charge.map((el) =>
  894. JSON.stringify({
  895. allowEditingColumns: this.transfer_cols_orgin.join(","),
  896. rowNum: el.rowNum.length
  897. ? el.rowNum
  898. .sort(function (a, b) {
  899. return a - b;
  900. })
  901. .join(",")
  902. : this.transfer_rows_orgin.join(","),
  903. principalId: el.person.split(",")[0],
  904. principalName: el.person.split(",")[1],
  905. })
  906. );
  907. }
  908. this.$http({
  909. url: "/market/CMKIssued/CMKIssuedTransfer",
  910. method: "post",
  911. headers: {
  912. "Content-Type": "application/json",
  913. },
  914. data: params,
  915. }).then(({ data: { desc } }) => {
  916. if (desc === "转派成功") {
  917. this.$message({
  918. type: "success",
  919. message: desc,
  920. });
  921. this.transfer_visible = false;
  922. this.handleInit({
  923. ...this.table_search,
  924. page: this.page,
  925. pageSize: this.rows,
  926. });
  927. this.transfer_form.charge = [
  928. {
  929. person: "",
  930. allowEditingColumns: [],
  931. rowNum: [],
  932. },
  933. ];
  934. this.handleCancel("visible");
  935. }
  936. });
  937. console.log(params, "this.transfer_form");
  938. } else {
  939. if (
  940. !this.transfer_form.charge[this.transfer_form.charge.length - 1]
  941. .rowNum.length
  942. ) {
  943. this.$message.error("请填写完整可编辑行");
  944. } else {
  945. this.$message.error("请填写必要的信息");
  946. }
  947. }
  948. }
  949. });
  950. },
  951. async handleTransfer() {
  952. let loginNoStr = JSON.parse(sessionStorage.userInfo).loginNoStr;
  953. let logNo = JSON.parse(sessionStorage.userInfo).loginNo;
  954. await this.$http({
  955. url: "/market/CMKIssued/queryUserList",
  956. method: "post",
  957. headers: {
  958. "Content-Type": "application/json",
  959. },
  960. data: {
  961. logNo,
  962. },
  963. }).then(({ data }) => {
  964. this.transfer_list_orgin = data
  965. .filter((el) => {
  966. return el.loginNoStr !== loginNoStr;
  967. })
  968. .map((el) => ({
  969. ...el,
  970. label: `${el.loginNameStr}`,
  971. value: `${el.loginNoStr},${el.loginNameStr}`,
  972. }));
  973. this.transfer_list = this.transfer_list_orgin;
  974. // 可编辑行
  975. });
  976. await this.$http({
  977. url: "/market/CMKIssued/CMKIssuedRow",
  978. method: "post",
  979. headers: {
  980. "Content-Type": "application/json",
  981. },
  982. data: {
  983. id: this.edit_form.id,
  984. },
  985. }).then(({ data: { column, row } }) => {
  986. this.transfer_cols_orgin = column.split(",");
  987. this.transfer_rows_orgin = row.split(",");
  988. });
  989. this.transfer_visible = true;
  990. },
  991. handleTurn(type) {
  992. if (this.approveForm.type) {
  993. if (this.approveForm.type === "3" && !this.approveForm.comments) {
  994. this.$message.error("请输入其他审批意见");
  995. return;
  996. }
  997. } else {
  998. this.$message.error("请选择审批意见");
  999. return;
  1000. }
  1001. // finish 结束 transfer 转派 back //打回 // agree 同意 // transfermanger 转总经理审批
  1002. let request = 0;
  1003. let reqdata = {
  1004. id: this.edit_form.id,
  1005. reviewOpinion:
  1006. this.approveForm.type === "3"
  1007. ? this.approveForm.comments
  1008. : this.approveForm.type,
  1009. };
  1010. switch (type) {
  1011. case "finish":
  1012. // status 0.打回 3.结束
  1013. reqdata.status = "3";
  1014. reqdata.operateName = "结束";
  1015. request = 1;
  1016. break;
  1017. case "transfer":
  1018. // reviewType 2.副总经理 3总经理
  1019. if (this.duty === "7") {
  1020. reqdata.reviewType = 2;
  1021. reqdata.operateName = "转副总审批";
  1022. request = 1;
  1023. } else if (this.duty === "4") {
  1024. reqdata.reviewType = 3;
  1025. request = 1;
  1026. reqdata.operateName = "转总经理审批";
  1027. }
  1028. break;
  1029. case "transfermanger":
  1030. // transfermanger 这首直接转给总经理的流程
  1031. reqdata.reviewType = 3;
  1032. reqdata.operateName = "转总经理审批";
  1033. request = 1;
  1034. break;
  1035. case "back":
  1036. reqdata.status = "0";
  1037. reqdata.reviewType = 1;
  1038. request = 1;
  1039. reqdata.operateName = "打回";
  1040. break;
  1041. case "return":
  1042. reqdata.status = "0";
  1043. reqdata.operateName = "退回";
  1044. if (this.duty === "4") {
  1045. reqdata.reviewType = 1;
  1046. } else if (this.duty === "3") {
  1047. reqdata.reviewType = 2;
  1048. }
  1049. console.log(reqdata, "reqdata");
  1050. request = 1;
  1051. break;
  1052. case "agree":
  1053. reqdata.operateName = "同意";
  1054. reqdata.status = "3";
  1055. request = 1;
  1056. break;
  1057. }
  1058. if (request) {
  1059. // 这里调接口
  1060. this.$http({
  1061. url: "/market/CMKIssued/CMKIssuedCheck",
  1062. method: "post",
  1063. headers: {
  1064. "Content-Type": "application/json",
  1065. },
  1066. data: reqdata,
  1067. }).then(({ data: { desc } }) => {
  1068. if (desc === "审批成功") {
  1069. this.$message({
  1070. type: "success",
  1071. message: desc,
  1072. });
  1073. // this.page = 1;
  1074. this.handleCancel("visible");
  1075. this.handleCancel("approve_visible");
  1076. this.handleInit({
  1077. ...this.table_search,
  1078. page: this.page,
  1079. pageSize: this.rows,
  1080. });
  1081. } else if (desc === "存在未提交,是否还要审核") {
  1082. this.$confirm(desc, {
  1083. distinguishCancelAndClose: false,
  1084. confirmButtonText: "确定",
  1085. cancelButtonText: "取消",
  1086. type: "warning",
  1087. })
  1088. .then((res) => {
  1089. this.$http({
  1090. url: "/market/CMKIssued/CMKIssuedCheck",
  1091. method: "post",
  1092. headers: {
  1093. "Content-Type": "application/json",
  1094. },
  1095. data: { ...reqdata, submitFlag: 1 },
  1096. }).then(({ data: { desc } }) => {
  1097. if (desc === "审批成功") {
  1098. this.$message({
  1099. type: "success",
  1100. message: desc,
  1101. });
  1102. this.handleCancel("visible");
  1103. this.handleCancel("approve_visible");
  1104. this.handleInit({
  1105. ...this.table_search,
  1106. page: this.page,
  1107. pageSize: this.rows,
  1108. });
  1109. } else {
  1110. this.$message({
  1111. type: "error",
  1112. message: desc,
  1113. });
  1114. this.handleCancel("visible");
  1115. this.handleCancel("approve_visible");
  1116. this.handleInit({
  1117. ...this.table_search,
  1118. page: this.page,
  1119. pageSize: this.rows,
  1120. });
  1121. }
  1122. });
  1123. })
  1124. .catch((error) => {
  1125. this.handleCancel("visible");
  1126. this.handleCancel("approve_visible");
  1127. this.handleInit({
  1128. ...this.table_search,
  1129. page: this.page,
  1130. pageSize: this.rows,
  1131. });
  1132. });
  1133. }
  1134. });
  1135. }
  1136. },
  1137. // 通用方法用于转化全局
  1138. paramsArr(start, end) {
  1139. const arr = [];
  1140. console.log(start, end);
  1141. for (let i = Number(start); i <= Number(end); i++) {
  1142. arr.push(i);
  1143. }
  1144. return arr.join(",");
  1145. },
  1146. handleUrge() {
  1147. console.log("这里是催办的方法");
  1148. },
  1149. handleConfirm(visible) {
  1150. console.log(visible);
  1151. this.track_visible = visible;
  1152. },
  1153. handleSave() {
  1154. this.handleInit({
  1155. ...this.table_search,
  1156. page: this.page,
  1157. pageSize: this.rows,
  1158. });
  1159. this.handleCancel("visible");
  1160. },
  1161. handleReceiver({ index, receiverId, id }) {
  1162. // 回复详情
  1163. this.$http({
  1164. url: "/market/CMKIssued/replyDetails",
  1165. method: "post",
  1166. headers: {
  1167. "Content-Type": "application/json",
  1168. },
  1169. data: { issuedId: id, receiverId: receiverId.split(",")[index] },
  1170. }).then(({ data }) => {
  1171. this.principal_visible = true;
  1172. this.receiver_table_list = data;
  1173. });
  1174. },
  1175. // 关闭方法
  1176. handleCancel(data) {
  1177. switch (data) {
  1178. case "visible":
  1179. this.visible = false;
  1180. this.receiverId = "";
  1181. break;
  1182. case "approve_visible":
  1183. this.approveForm.comments = "";
  1184. this.approve_visible = false;
  1185. break;
  1186. case "track_visible":
  1187. this.track_visible = false;
  1188. break;
  1189. case "transfer_visible":
  1190. this.transfer_visible = false;
  1191. break;
  1192. case "principal_visible":
  1193. this.principal_visible = false;
  1194. break;
  1195. case "menager_visible":
  1196. this.menager_visible = false;
  1197. break;
  1198. }
  1199. },
  1200. },
  1201. };
  1202. </script>
  1203. <style lang="scss" scope>
  1204. .approve {
  1205. .v-modal {
  1206. display: none !important;
  1207. }
  1208. }
  1209. .department-form {
  1210. .el-form-item .el-input {
  1211. width: 220px;
  1212. }
  1213. }
  1214. </style>