incomeExcelInfo.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581
  1. <template>
  2. <div class="container" id="container" v-loading="loading">
  3. <iframe height="100%" width="100%" src="/static/views/incomeTemplateExcel.html" frameborder="0"
  4. ref="iframe" name="excelIframe" id="excelIframe"></iframe>
  5. <el-dialog :title="'权限设置'" :visible.sync="authSettingStatus" width="50%" :destroy-on-close="true"
  6. :modal-append-to-body="false" :close-on-click-modal="false">
  7. <el-form :model="testModel" ref="addInfoList">
  8. <div>
  9. <div class="info-line">
  10. <el-radio v-model="authType" label="1" style="margin: 10px">无特殊权限</el-radio>
  11. <div id="noLimit" class="info-line">
  12. <span style="margin-right: 20px;margin-left: 40px">负责人:</span>
  13. <el-button type="primary" @click="noLimitUserAdd()">组织机构</el-button>
  14. <span style="width: 80px;margin-right: 20px;margin-left: 20px">{{ noLimitUserName }}</span>
  15. </div>
  16. </div>
  17. <div class="info-line">
  18. <el-radio v-model="authType" label="2" style="margin: 10px">特殊权限</el-radio>
  19. <div id="limit">
  20. <div v-for="(item,index) in limitList">
  21. <span style="margin-right: 20px;margin-left: 40px">负责人:</span>
  22. <el-button type="primary" @click="limitUserAdd(index)">组织机构</el-button>
  23. <span style="margin-right: 20px;margin-left: 20px">{{ item.userName }}</span>
  24. <span style="margin-right: 10px;margin-left: 10px">可编辑行:从</span>
  25. <el-input v-model="item.editStart" style="width: 60px;"></el-input>
  26. <span style="margin-right: 10px;margin-left: 10px">到</span>
  27. <el-input v-model="item.editEnd" style="width: 60px;"></el-input>
  28. <br/><br/>
  29. </div>
  30. <el-button style="width: 80px;margin-right: 20px;margin-left: 40px"
  31. @click="addNewLimitAuth()">添加
  32. </el-button>
  33. </div>
  34. </div>
  35. <div slot="footer" style="text-align: right;padding-bottom: 20px;padding-top: 20px">
  36. <el-button @click="authSettingStatus = false">取 消</el-button>
  37. <el-button type="primary" @click="processAuth()">确 定</el-button>
  38. </div>
  39. </div>
  40. </el-form>
  41. </el-dialog>
  42. <el-dialog title="选择填报人" :visible.sync="noLimitDialog" width="50%" :destroy-on-close="true"
  43. :modal-append-to-body="false" :close-on-click-modal="false">
  44. <div>
  45. <el-form :model="exaList" ref="addInfoList">
  46. <el-form-item prop="processUserId" class="info-line online">
  47. <span style="width: 80px;margin-right: 20px">审批人员</span>
  48. <deptTreeUserNew class="tree" @treeCheck="treeCheckonly" :defaultList="defaultList"
  49. :type="depttype" :closeList="closeList"></deptTreeUserNew>
  50. <div class="tree treeUser">
  51. <p v-for="(item,index) in treeList" :key="index">{{ item.receiveName }}
  52. <i @click="deletes(item,index)" class="el-icon-error"></i>
  53. </p>
  54. </div>
  55. </el-form-item>
  56. </el-form>
  57. <div slot="footer" style="text-align: right;padding-bottom: 20px">
  58. <el-button @click="noLimitDialog = false">取 消</el-button>
  59. <el-button type="primary" @click="processNoLimitUsers()">确 定</el-button>
  60. </div>
  61. </div>
  62. </el-dialog>
  63. <el-dialog :title="'收入信息处理'" :visible.sync="authDialog" width="50%" :destroy-on-close="true"
  64. :modal-append-to-body="false" :close-on-click-modal="false">
  65. <el-form :model="testModel" ref="addInfoList">
  66. <div>
  67. <div class="info-line">
  68. <span style="margin-right: 20px;margin-left: 40px">选择路径:</span>
  69. <el-select v-model="auditForm.authType" placeholder="选择路径">
  70. <el-option v-for="(item,index) in auditBoxList" :key="index" :label="item.name"
  71. :value="item.value"></el-option>
  72. </el-select>
  73. </div>
  74. <br/>
  75. <div class="info-line" v-if="auditForm.authType == 1">
  76. <span style="margin-right: 20px;margin-left: 40px">下一步处理人:</span>
  77. <el-button type="primary" @click="auditUserAdd()">选择处理人</el-button>
  78. <span style="width: 80px;margin-right: 20px;margin-left: 20px">{{ auditUserName }}</span>
  79. </div>
  80. <br/>
  81. <div class="info-line">
  82. <span style="margin-right: 20px;margin-left: 40px;">意见内容:</span>
  83. <el-input type="textarea" v-model="auditForm.auditRemark" style="width: 400px"></el-input>
  84. </div>
  85. <br/>
  86. <div slot="footer" style="text-align: right;padding-bottom: 20px;padding-top: 20px">
  87. <el-button @click="authDialog = false">取 消</el-button>
  88. <el-button type="primary" @click="processAudit()">确 定</el-button>
  89. </div>
  90. </div>
  91. </el-form>
  92. </el-dialog>
  93. <el-dialog title="选择审批人" :visible.sync="checkexa" width="50%" :destroy-on-close="true"
  94. :modal-append-to-body="false" :close-on-click-modal="false">
  95. <div>
  96. <el-form :model="addInfoList" ref="addInfoList">
  97. <el-form-item prop="processUserId" class="info-line online">
  98. <span style="width: 80px">审批人员&nbsp;</span>
  99. <deptTreeOnly class="tree" @treeCheck="treeCheckonly" :defaultList="defaultList"
  100. :type="depttype" :closeList="closeList"></deptTreeOnly>
  101. <div class="tree treeUser">
  102. <p>{{ treeListonly.leaderAuditName }}
  103. <i v-if="treeListonly.leaderAuditName" @click="treeDelete()"
  104. class="el-icon-error"></i>
  105. </p>
  106. </div>
  107. </el-form-item>
  108. </el-form>
  109. <div slot="footer" style="text-align: right;padding-bottom: 20px">
  110. <el-button type="primary" @click="processAuditUser()">确 定</el-button>
  111. <el-button @click="checkexa = false">取 消</el-button>
  112. </div>
  113. </div>
  114. </el-dialog>
  115. </div>
  116. </template>
  117. <script>
  118. import myMessage from "../../../components/myMessage.vue"
  119. import deptTreeUserNew from "../../../components/deptTreeUserNew";
  120. import deptTreeOnly from "../../../components/deptTreeOnly.vue"
  121. export default {
  122. components: {
  123. myMessage,
  124. deptTreeUserNew,
  125. deptTreeOnly,
  126. },
  127. data() {
  128. return {
  129. testModel: {},
  130. authSettingStatus: false,
  131. authType: '1',
  132. noLimitUserName: '',
  133. noLimitUsers: [],
  134. noLimitDialog: false,
  135. exaList: {},
  136. defaultList: [],
  137. treeList: [],
  138. closeList: false,
  139. depttype: 0,
  140. limitUserIndex: -1,
  141. limitList: [{}],
  142. type: '',
  143. loading: false,
  144. auditBoxList: [{}],
  145. authDialog: false,
  146. auditForm: {},
  147. auditUserName: '',
  148. auditUserId: '',
  149. //选择审批人
  150. checkexa: false,
  151. //审批人用到的
  152. treeListonly: {},
  153. excelData: {},
  154. }
  155. },
  156. methods: {
  157. auditUserAdd() {
  158. this.checkexa = true;
  159. },
  160. processAuditUser() {
  161. console.log(this.treeListonly);
  162. this.auditUserId = this.treeListonly.leaderAuditNo;
  163. this.auditUserName = this.treeListonly.leaderAuditName;
  164. this.checkexa = false;
  165. },
  166. openAuditWindow(sheetName, excelData) {
  167. this.auditBoxList = [{
  168. name: '提交审核',
  169. value: '1'
  170. }, {
  171. name: '结束',
  172. value: '2'
  173. }];
  174. this.authDialog = true;
  175. this.excelData = excelData;
  176. },
  177. processAudit() {
  178. //检查选项
  179. if (this.auditForm.authType == null) {
  180. this.$message({
  181. message: '请选择路径',
  182. type: 'error'
  183. });
  184. return;
  185. }
  186. if (this.auditForm.authType == '1') {
  187. if (this.auditUserId == '') {
  188. this.$message({
  189. message: '请选择下一步处理人',
  190. type: 'error'
  191. });
  192. return;
  193. }
  194. }
  195. //提交
  196. var _this = this;
  197. var url = '/market/cIncomeExcelIssued/excelDataProcessAuth';
  198. this.loading = true;
  199. this.$http({
  200. url: url,
  201. method: "post",
  202. headers: {
  203. "Content-Type": "application/json",
  204. },
  205. data: {
  206. type: this.auditForm.authType,
  207. excelData: this.excelData,
  208. issuedUserId: this.getUrlKey("id"),
  209. nextUserId: this.auditUserId,
  210. auditRemark:this.auditForm.auditRemark
  211. },
  212. }).then((res) => {
  213. this.loading = false;
  214. if (res.data.result === 1) {
  215. _this.$message({
  216. message: res.data.desc,
  217. type: 'error'
  218. });
  219. } else {
  220. this.authDialog = false;
  221. _this.$message({
  222. message: '处理成功',
  223. type: 'success'
  224. });
  225. //关闭这个窗口,得找找怎么关闭
  226. }
  227. });
  228. },
  229. addNewTemplate(sheetName, excelData, templateType) {
  230. //console.log(sheetName);
  231. //console.log(excelData);
  232. //console.log(templateType);
  233. //处理一下数据,提交给后端
  234. var authUser = [];
  235. if (this.authType == '1') {
  236. this.noLimitUsers.map((o) => {
  237. authUser.push({
  238. userId: o,
  239. type: 0
  240. })
  241. });
  242. } else {
  243. //外层是权限组
  244. this.limitList.map((o) => {
  245. //内层是权限用户
  246. o.userIds.map((o1) => {
  247. authUser.push({
  248. userId: o1,
  249. type: 1,
  250. editStart: o.editStart,
  251. editEnd: o.editEnd
  252. })
  253. })
  254. });
  255. }
  256. //console.log(authUser);
  257. //提交
  258. var _this = this;
  259. var url = '/market/cIncomeExcelTemplate/addNewTemplate';
  260. if (this.type == '2') {
  261. url = '/market/cIncomeExcelTemplate/updateTemplate';
  262. }
  263. this.loading = true;
  264. this.$http({
  265. url: url,
  266. method: "post",
  267. headers: {
  268. "Content-Type": "application/json",
  269. },
  270. data: {
  271. excelData: excelData,
  272. excelName: sheetName,
  273. userList: authUser,
  274. templateType: templateType,
  275. excelId: this.getUrlKey('id'),
  276. },
  277. }).then((res) => {
  278. this.loading = false;
  279. if (res.data.result === 1) {
  280. _this.$message({
  281. message: res.data.desc,
  282. type: 'error'
  283. });
  284. } else {
  285. var msgText = '新增成功';
  286. if (this.type == '2') {
  287. msgText = '修改成功';
  288. }
  289. _this.$message({
  290. message: msgText,
  291. type: 'success'
  292. });
  293. const newUrl = '#' + this.$route.path + '?type=2&id=' + res.data.desc;
  294. console.log(newUrl);
  295. window.history.replaceState('', '', newUrl);
  296. if (this.type == '1') {
  297. this.type = '2';
  298. document.getElementById('excelIframe').contentWindow.location.reload();
  299. }
  300. }
  301. });
  302. },
  303. showAuthDialog() {
  304. this.authSettingStatus = true;
  305. },
  306. processAuth() {
  307. console.log(this.limitList);
  308. //判断一下
  309. var success = true;
  310. if (this.authType == '1') {
  311. if (this.noLimitUsers.length == 0) {
  312. this.$message({
  313. message: '请选择无特殊权限的负责人',
  314. type: 'error'
  315. });
  316. success = false;
  317. return;
  318. }
  319. } else if (this.authType == '2') {
  320. this.limitList.map((o) => {
  321. if (o.userIds == null) {
  322. this.$message({
  323. message: '请选择特殊权限的负责人',
  324. type: 'error'
  325. });
  326. success = false;
  327. return;
  328. }
  329. if (o.editStart == null || o.editEnd == null) {
  330. this.$message({
  331. message: '请填写可编辑行',
  332. type: 'error'
  333. });
  334. success = false;
  335. return;
  336. }
  337. })
  338. }
  339. if (success) {
  340. if (this.type == '1') {
  341. this.$refs.iframe.contentWindow.enableUpload('abc');
  342. } else if (this.type == '2') {
  343. this.$refs.iframe.contentWindow.enableSave('def');
  344. }
  345. this.authSettingStatus = false;
  346. }
  347. },
  348. addNewLimitAuth() {
  349. var _this = this;
  350. var lastLimitUserList = _this.limitList[_this.limitList.length - 1].userIds;
  351. if (lastLimitUserList == null) {
  352. _this.$message({
  353. message: '请先选择上一条记录的负责人',
  354. type: 'error'
  355. });
  356. } else {
  357. _this.limitList.push({
  358. index: 1
  359. });
  360. }
  361. },
  362. processNoLimitUsers() {
  363. var userNameString = '';
  364. if (this.authType == '1') {
  365. this.noLimitUsers = [];
  366. this.treeList.map((o) => {
  367. this.noLimitUsers.push(o.receiveNo);
  368. userNameString += o.receiveName += ' ';
  369. });
  370. this.noLimitUserName = userNameString;
  371. } else {
  372. this.limitList[this.limitUserIndex].userIds = [];
  373. this.treeList.map((o) => {
  374. this.limitList[this.limitUserIndex].userIds.push(o.receiveNo);
  375. userNameString += o.receiveName += ' ';
  376. });
  377. this.limitList[this.limitUserIndex].userName = userNameString;
  378. }
  379. this.exaList = {};
  380. this.defaultList = [];
  381. this.treeList = [];
  382. this.noLimitDialog = false;
  383. },
  384. noLimitUserAdd() {
  385. if (this.authType == '1') {
  386. this.noLimitDialog = true;
  387. } else {
  388. this.$message({
  389. message: '请先选择无特殊权限,再添加负责人',
  390. type: 'error'
  391. });
  392. }
  393. },
  394. limitUserAdd(index) {
  395. if (this.authType == '2') {
  396. this.limitUserIndex = index;
  397. this.noLimitDialog = true;
  398. } else {
  399. this.$message({
  400. message: '请先选择特殊权限,再添加负责人',
  401. type: 'error'
  402. });
  403. }
  404. },
  405. setAuth(id) {
  406. var _this = this;
  407. this.$http({
  408. url: '/market/cIncomeExcelTemplate/getAuthInfo',
  409. method: "post",
  410. headers: {
  411. "Content-Type": "application/json",
  412. },
  413. data: {
  414. excelId: id
  415. },
  416. }).then((res) => {
  417. if (res.data.result === 1) {
  418. _this.$message({
  419. message: '获取负责人信息失败',
  420. type: 'error'
  421. });
  422. } else {
  423. console.log(res.data);
  424. var authUsers = res.data.body;
  425. var i = -1;
  426. var nowStart = '';
  427. var nowEnd = '';
  428. this.limitList = [];
  429. this.noLimitUsers = [];
  430. this.noLimitUserName = '';
  431. authUsers.map((o) => {
  432. console.log(o);
  433. //无特殊权限的简单一点,有特殊权限的,需要把相同可编辑行的放在一起
  434. if (o.type == '0') {
  435. this.authType = '1';
  436. this.noLimitUsers.push(o.userId);
  437. this.noLimitUserName += o.userName += ' ';
  438. } else {
  439. this.authType = '2';
  440. if (o.editStart == nowStart && o.editEnd == nowEnd) {
  441. var processLimitUser = this.limitList[i];
  442. processLimitUser.userIds.push(o.userId);
  443. processLimitUser.userName += o.userName += ' ';
  444. } else {
  445. var userIds = [o.userId];
  446. var userName = o.userName += ' ';
  447. this.limitList.push({
  448. userIds: userIds,
  449. userName: userName,
  450. editStart: o.editStart,
  451. editEnd: o.editEnd
  452. })
  453. nowStart = o.editStart;
  454. nowEnd = o.editEnd;
  455. i++;
  456. }
  457. }
  458. });
  459. }
  460. });
  461. },
  462. //填报人相关
  463. deletes(val, index) {
  464. this.treeList.splice(index, 1);
  465. this.closeList = this.treeList;
  466. },
  467. treeCheckonly(v) {
  468. this.treeList = v;
  469. this.treeListonly = v;
  470. },
  471. treeDelete() {
  472. this.treeListonly = {};
  473. this.closeList = !this.closeList;
  474. },
  475. getUrlKey(name) {
  476. return (
  477. decodeURIComponent(
  478. (new RegExp("[?|&]" + name + "=" + "([^&;]+?)(&|#|;|$)").exec(
  479. location.href
  480. ) || [, ""])[1].replace(/\+/g, "%20")
  481. ) || null
  482. );
  483. },
  484. },
  485. mounted() {
  486. this.type = this.getUrlKey("type")
  487. },
  488. created() {
  489. window['showAuthDialog'] = (rp) => {
  490. this.showAuthDialog(rp);
  491. }
  492. window['addNewTemplate'] = (sheetName, excelData, templateType) => {
  493. this.addNewTemplate(sheetName, excelData, templateType);
  494. };
  495. window['setAuth'] = (id) => {
  496. this.setAuth(id);
  497. };
  498. window['openAuditWindow'] = (sheetName, excelData) => {
  499. this.openAuditWindow(sheetName, excelData);
  500. };
  501. }
  502. }
  503. </script>
  504. <style lang="scss" scoped>
  505. .online {
  506. width: 100%;
  507. .el-select {
  508. width: calc(100% - 100px);
  509. }
  510. span {
  511. vertical-align: top;
  512. }
  513. .el-textarea {
  514. width: calc(100% - 100px);
  515. }
  516. .tree {
  517. width: calc(50% - 60px);
  518. display: inline-block;
  519. margin-right: 20px;
  520. height: 300px;
  521. overflow-y: scroll;
  522. .el-icon-error {
  523. float: right;
  524. font-size: 20px;
  525. margin-top: 9px;
  526. cursor: pointer;
  527. }
  528. }
  529. .treeUser {
  530. margin: 0;
  531. border: 1px solid #ddd;
  532. p {
  533. background: #f4f4f4;
  534. padding: 0 20px;
  535. margin-bottom: 5px;
  536. }
  537. }
  538. .treeUserb {
  539. width: calc(100% - 100px);
  540. border: 1px solid #ddd;
  541. background: #f4f4f4;
  542. border-radius: 3px;
  543. height: auto;
  544. overflow: hidden;
  545. p {
  546. display: inline-block;
  547. padding: 0 20px;
  548. margin-bottom: 5px;
  549. }
  550. }
  551. }
  552. </style>
  553. <style scoped>
  554. .containerr {
  555. background: #fff;
  556. height: calc(100vh);
  557. width: calc(100vw);
  558. position: fixed;
  559. left: 0;
  560. top: 0;
  561. overflow: hidden;
  562. }
  563. span {
  564. width: 80px;
  565. }
  566. </style>