department.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  1. <template>
  2. <div>
  3. <div class="simple-container">
  4. <simple-form :form="table_form" @search="handleSearch">
  5. <!-- :handle="table_handle"
  6. @add="handleRulesVisible"
  7. @class="handleDrawer('class')"
  8. @download="handleDownload" -->
  9. </simple-form>
  10. <simple-table
  11. :list="table_list"
  12. :config="table_config"
  13. :loading="table_loading"
  14. :handle-row="table_handle_row"
  15. @check="handleCheck"
  16. @edit="handleEdit"
  17. ></simple-table>
  18. <simple-pagination
  19. :page="page"
  20. :total="total"
  21. @change="handleChange"
  22. ></simple-pagination>
  23. </div>
  24. <simple-dialog
  25. fullscreen
  26. title="文件收集"
  27. :visible="visible"
  28. :reload="reload"
  29. width="1200px"
  30. @cancel="handleCancel('visible')"
  31. >
  32. <template>
  33. <!-- 按钮部分 -->
  34. <div class="flex-justify-between padding-right-20 padding-left-20">
  35. <div>
  36. <template v-if="edit_visible">
  37. <el-button
  38. type="primary"
  39. v-if="edit_form.status === '0'"
  40. @click="handleTransfer"
  41. >转派</el-button
  42. >
  43. <el-button
  44. type="primary"
  45. v-if="edit_form.status === '0'"
  46. @click="handleSubmit"
  47. >提交</el-button
  48. >
  49. <el-button
  50. type="primary"
  51. v-if="edit_form.status === '2'"
  52. @click="handleApprove"
  53. >审批</el-button
  54. >
  55. </template>
  56. <el-button type="primary" @click="handleTrack">流程跟踪</el-button>
  57. <el-button type="primary">导出</el-button>
  58. </div>
  59. <div>
  60. <el-button @click="handleCancel('visible')" type="primary"
  61. >返回</el-button
  62. >
  63. </div>
  64. </div>
  65. <!-- 主体部分 -->
  66. <sheet />
  67. <!-- <analysis
  68. :edit="edit_form.department_status === '待处理' && edit_visible"
  69. /> -->
  70. </template>
  71. <template v-slot:footer><div></div></template>
  72. </simple-dialog>
  73. <simple-dialog
  74. title="审批"
  75. :visible="approve_visible"
  76. :reload="reload"
  77. width="500px"
  78. props="approve_visible"
  79. @cancel="handleCancel('approve_visible')"
  80. >
  81. <el-form :model="approveForm" ref="approveForm"
  82. ><el-form-item label="审批意见" prop="comments" label-width="80px"
  83. ><el-input
  84. type="textarea"
  85. v-model="approveForm.comments"
  86. autosize /></el-form-item
  87. ></el-form>
  88. <template v-slot:footer
  89. ><div>
  90. <div v-if="type === '1'">
  91. <el-button @click="handleCancel('approve_visible')">结束</el-button>
  92. <el-button @click="handleTurn(type)" type="primary"
  93. >转副总审批</el-button
  94. >
  95. </div>
  96. <div v-else-if="type === '2'">
  97. <el-button @click="handleCancel('approve_visible')">结束</el-button>
  98. <el-button @click="handleCancel('approve_visible')">打回</el-button>
  99. <el-button @click="handleTurn(type)" type="primary"
  100. >转总经理审批</el-button
  101. >
  102. </div>
  103. <div v-else>
  104. <el-button @click="handleBack">打回</el-button>
  105. <el-button @click="handleAgree" type="primary">同意</el-button>
  106. </div>
  107. </div>
  108. </template>
  109. </simple-dialog>
  110. <simple-dialog
  111. title="流程跟踪"
  112. :visible="track_visible"
  113. :reload="reload"
  114. width="600px"
  115. props="track_visible"
  116. @confirm="handleConfirm"
  117. @cancel="handleCancel('track_visible')"
  118. >
  119. <el-table :data="trackList" border>
  120. <el-table-column
  121. prop="link"
  122. label="流程环节"
  123. align="center"
  124. width="180"
  125. >
  126. </el-table-column>
  127. <el-table-column
  128. prop="creatperson"
  129. label="处理人"
  130. align="center"
  131. width="180"
  132. >
  133. </el-table-column>
  134. <el-table-column prop="explain" label="审批说明" align="center">
  135. </el-table-column>
  136. </el-table>
  137. </simple-dialog>
  138. </div>
  139. </template>
  140. <script>
  141. import simpleForm from "./components/form.vue";
  142. import simpleTable from "./components/table.vue";
  143. import simplePagination from "./components/pagination.vue";
  144. import simpleDialog from "./components/dialog.vue";
  145. // import analysis from "./analysis.vue";
  146. import sheet from "./components/sheet.vue";
  147. export default {
  148. components: {
  149. simpleForm,
  150. simpleTable,
  151. simplePagination,
  152. simpleDialog,
  153. // analysis,
  154. sheet,
  155. },
  156. data() {
  157. return {
  158. page: 1,
  159. rows: 10,
  160. total: 5,
  161. // 搜索参数
  162. table_search: {},
  163. // dialog 参数
  164. visible: false,
  165. edit_visible: false,
  166. approve_visible: false,
  167. track_visible: false,
  168. edit_form: {},
  169. reload: 0,
  170. // 判断类型
  171. type: "3",
  172. approverules: {
  173. comments: [
  174. {
  175. required: true,
  176. message: "请输入审批意见",
  177. trigger: "blur",
  178. },
  179. ],
  180. },
  181. // 审批意见
  182. approveForm: { comments: "" },
  183. trackList: [],
  184. // 顶部form
  185. table_form: [
  186. {
  187. label: "模板名称",
  188. props: "name",
  189. type: "input",
  190. },
  191. {
  192. label: "下发月份",
  193. props: "issuedDate",
  194. type: "month",
  195. },
  196. {
  197. label: "状态",
  198. props: "status",
  199. type: "select",
  200. // 0.待处理 1.待汇总 2.待审批 3.已完成
  201. dictionary: [
  202. {
  203. label: "待处理",
  204. value: "0",
  205. },
  206. {
  207. label: "待汇总",
  208. value: "1",
  209. },
  210. {
  211. label: "待审批",
  212. value: "2",
  213. },
  214. {
  215. label: "已完成",
  216. value: "3",
  217. },
  218. ],
  219. },
  220. ],
  221. // 列表数据
  222. table_list: [],
  223. table_loading: false,
  224. // 表格里的操作按钮
  225. table_handle_row: [
  226. {
  227. label: "查看",
  228. props: "check",
  229. },
  230. {
  231. label: "处理",
  232. props: "edit",
  233. visible: {
  234. status: ["0", "2"],
  235. },
  236. },
  237. ],
  238. // 表头配置
  239. table_config: [
  240. {
  241. label: "模板名称",
  242. props: "templateName",
  243. },
  244. {
  245. label: "填报事由",
  246. props: "reason",
  247. },
  248. {
  249. label: "填报注意事项",
  250. props: "precautions",
  251. },
  252. {
  253. label: "截止时间",
  254. props: "endTime",
  255. type: "date",
  256. },
  257. {
  258. label: "发起人",
  259. props: "loginNameStr",
  260. },
  261. {
  262. label: "状态",
  263. props: "status",
  264. type: "dictionary",
  265. dictionary: { 0: "待处理", 1: "待汇总", 2: "待审批", 3: "已完成" },
  266. },
  267. ],
  268. };
  269. },
  270. mounted() {
  271. this.handleInit({
  272. ...this.table_search,
  273. page: this.page,
  274. pagesize: this.rows,
  275. });
  276. },
  277. methods: {
  278. // 初始化
  279. handleInit(data) {
  280. this.$http({
  281. url: "/CMKIssued/CMKIssuedListByUser",
  282. method: "post",
  283. headers: {
  284. "Content-Type": "application/json",
  285. },
  286. data: data,
  287. }).then((res) => {
  288. console.log(res);
  289. res.data = this.table_list;
  290. this.table_list.push({
  291. templateName: "模板名称",
  292. status: "0",
  293. reason: "填报事由",
  294. precautions: "填报注意事项",
  295. endTime: new Date(),
  296. loginNameStr: "发起人",
  297. id:23,
  298. templateContent:'templateContent'
  299. });
  300. });
  301. },
  302. handleChange(page) {
  303. this.page = page;
  304. this.handleInit({
  305. ...this.table_search,
  306. page: this.page,
  307. pagesize: this.rows,
  308. });
  309. },
  310. // 搜索事件
  311. handleSearch(data) {
  312. this.table_search = data;
  313. this.page = 1;
  314. this.handleInit({ ...data, page: this.page, pagesize: this.rows });
  315. },
  316. // 编辑按钮
  317. handleEdit(row) {
  318. console.log(row, "row");
  319. this.visible = true;
  320. this.edit_visible = true;
  321. this.edit_form = row;
  322. },
  323. handleCheck(row) {
  324. console.log(row, "row");
  325. this.visible = true;
  326. this.edit_visible = false;
  327. },
  328. handleDelete() {},
  329. // dialog事件
  330. //权限管理事件
  331. handleApprove() {
  332. this.approve_visible = true;
  333. },
  334. handleTrack() {
  335. this.track_visible = true;
  336. },
  337. handleTransfer() {
  338. console.log(this.edit_form, "prams");
  339. // const object = {
  340. // ...JSON.parse(sessionStorage.global_data)[0],
  341. // department_status: "待审批",
  342. // };
  343. // sessionStorage.setItem("global_data", JSON.stringify([object]));
  344. // const process_array = JSON.parse(sessionStorage.global_process);
  345. // process_array.push({
  346. // link: "转派工单",
  347. // creatperson: `ADMIN ${this.$formatDate(new Date(), "YYYY-MM-DD")}`,
  348. // explain: "",
  349. // });
  350. // sessionStorage.setItem("global_process", JSON.stringify(process_array));
  351. // this.handleInit();
  352. // this.handleCancel("visible");
  353. // this.$message.success("转派成功");
  354. },
  355. handleTurn(type) {
  356. this.handleCancel("approve_visible");
  357. console.log(type);
  358. },
  359. handleConfirm(visible) {
  360. console.log(visible);
  361. this.track_visible = visible;
  362. },
  363. // 关闭方法
  364. handleCancel(data) {
  365. switch (data) {
  366. case "visible":
  367. this.visible = false;
  368. break;
  369. case "approve_visible":
  370. this.approveForm.comments = "";
  371. this.approve_visible = false;
  372. break;
  373. case "track_visible":
  374. this.track_visible = false;
  375. break;
  376. }
  377. },
  378. handleBack() {
  379. const object = {
  380. ...JSON.parse(sessionStorage.global_data)[0],
  381. department_status: "待处理",
  382. };
  383. sessionStorage.setItem("global_data", JSON.stringify([object]));
  384. const process_array = JSON.parse(sessionStorage.global_process);
  385. process_array.push({
  386. link: "审批驳回",
  387. creatperson: `ADMIN ${this.$formatDate(new Date(), "YYYY-MM-DD")}`,
  388. explain: this.approveForm.comments,
  389. });
  390. sessionStorage.setItem("global_process", JSON.stringify(process_array));
  391. this.handleInit();
  392. this.$message.success("打回成功");
  393. this.handleCancel("visible");
  394. this.handleCancel("approve_visible");
  395. },
  396. handleAgree() {
  397. const object = {
  398. ...JSON.parse(sessionStorage.global_data)[0],
  399. department_status: "已完成",
  400. };
  401. sessionStorage.setItem("global_data", JSON.stringify([object]));
  402. const process_array = JSON.parse(sessionStorage.global_process);
  403. process_array.push({
  404. link: "审批通过",
  405. creatperson: `ADMIN ${this.$formatDate(new Date(), "YYYY-MM-DD")}`,
  406. explain: this.approveForm.comments,
  407. });
  408. sessionStorage.setItem("global_process", JSON.stringify(process_array));
  409. this.handleInit();
  410. this.$message.success("审批成功");
  411. this.handleCancel("visible");
  412. this.handleCancel("approve_visible");
  413. },
  414. handleSubmit() {
  415. let reqdata = {
  416. id: this.edit_form.id,
  417. templateContent: this.edit_form.templateContent,
  418. };
  419. console.log(reqdata,'reqdata')
  420. // 提交好了
  421. // this.$http({
  422. // url: "/CMKIssued/CMKIssuedSubmit",
  423. // method: "post",
  424. // headers: {
  425. // "Content-Type": "application/json",
  426. // },
  427. // data: reqdata,
  428. // }).then((res) => {
  429. // console.log(res);
  430. // this.$message.success("提交成功");
  431. // this.handleCancel("visible");
  432. // });
  433. },
  434. },
  435. };
  436. </script>
  437. <style></style>