index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696
  1. <template>
  2. <div>
  3. <div class="container">
  4. <div class="container-box">
  5. <div class="adv-type">
  6. <!-- <div v-for="item in typeList" :key="item.dataCode" @click="advmaterial(item)" >
  7. <div v-if="(roleStatus <= 1 && item.dataName=='信息汇总') || (roleStatus < 4 && item.dataName=='信息填报')">
  8. <span><i class="el-icon-folder-opened"></i></span>
  9. <span>{{item.dataName}}</span>
  10. </div>
  11. </div> -->
  12. <div @click="advmaterial(typeList[0])" v-if="roleStatus < 4">
  13. <span><i class="el-icon-folder-opened"></i></span>
  14. <span>信息填报</span>
  15. </div>
  16. <!-- <div @click="advmaterial(typeList[1])" v-if="roleStatus <= 1"> -->
  17. <div @click="advmaterial(typeList[1])" v-if="roleStatus <= 2">
  18. <span><i class="el-icon-folder-opened"></i></span>
  19. <span>信息汇总</span>
  20. </div>
  21. </div>
  22. <div class="adv-box">
  23. <div class="adv-tit" @click="jumpadv('1')" v-if="roleStatus < 3">
  24. <i class="el-icon-loading"></i>
  25. <span>进行中 </span>
  26. </div>
  27. <div class="adv-tit" @click="jumpadv('2')" v-if="roleStatus < 3">
  28. <i class="el-icon-notebook-1"></i>
  29. <span>已结束 </span>
  30. </div>
  31. <div class="adv-tit adv-add" @click="advadd" v-if="roleStatus == 0">
  32. <i class="el-icon-plus"></i>
  33. <span>申请</span>
  34. </div>
  35. </div>
  36. </div>
  37. </div>
  38. <el-dialog title="添加" :visible.sync="dialogStatus" width="50%" :destroy-on-close="true"
  39. :modal-append-to-body="false" :close-on-click-modal="false" :fullscreen="true">
  40. <el-form :model="infolist" ref="infolist" :rules="rules"
  41. style="height: calc(100vh - 180px);overflow-y: scroll;">
  42. <el-form-item prop="woName" class="info-line online">
  43. <span>统计名称</span>
  44. <el-input v-model="infolist.woName" placeholder="统计名称"></el-input>
  45. </el-form-item>
  46. <el-form-item prop="time" class="info-line online">
  47. <span>统计周期</span>
  48. <el-date-picker v-model="infolist.time" type="daterange"></el-date-picker>
  49. </el-form-item>
  50. <el-form-item class="info-line online">
  51. <span>填报人</span>
  52. <deptTree v-if="!disableStatus" :closeList="closeList" class="tree" @treeCheck="treeCheck">
  53. </deptTree>
  54. <div :class="!disableStatus?'tree treeUser':'tree treeUserb'">
  55. <p v-for="(item,index) in treeList" :key="index">{{item.receiveName}}
  56. <i @click="deletess(item,index)" class="el-icon-error"></i>
  57. </p>
  58. </div>
  59. </el-form-item>
  60. <el-form-item class="info-line online">
  61. <span>负责人</span>
  62. <div class="tree treeUser" style="width: 30%;margin-right: 1%;">
  63. <p v-for="(item,index) in deptList" :key="index" @click="choseDepta(item)">{{item.ou}}</p>
  64. </div>
  65. <div :class="!disableStatus?'tree treeUser':'tree treeUserb'" style="width: 30%;margin-right: 1%;">
  66. <p v-for="(item,index) in treeListp" :key="index">
  67. <span>{{item.ou}}</span>
  68. <span class="p-btn" @click="fzperson(item)">负责人</span>
  69. <i @click="deletes(item,index)" class="el-icon-error"></i>
  70. </p>
  71. </div>
  72. <div :class="!disableStatus?'tree treeUser':'tree treeUserb'" style="width: 30%;">
  73. <p v-for="(item,index) in treeListp" :key="index">{{item.loginNameStr}}</p>
  74. </div>
  75. </el-form-item>
  76. </el-form>
  77. <div style="text-align: right;margin-top: 20px">
  78. <el-button @click="dialogCli(1)" type="primary">确 定</el-button>
  79. <el-button @click="dialogCli(2)">取 消</el-button>
  80. </div>
  81. </el-dialog>
  82. <el-dialog title="选择负责人" :visible.sync="dialogStatusp" width="50%" :destroy-on-close="true"
  83. :modal-append-to-body="false" :close-on-click-modal="false">
  84. <el-form :model="infolist" ref="infolist" style="height: 50vh;overflow-y: scroll;">
  85. <div class="treeUserp">
  86. <p v-for="(item,index) in treeListponly" :key="index" @click="chofz(item)" v-if="item.loginNameStr">
  87. {{item.groupName}} -
  88. {{item.loginNameStr}}
  89. </p>
  90. </div>
  91. </el-form>
  92. </el-dialog>
  93. </div>
  94. </template>
  95. <script>
  96. import deptTree from "../../../components/deptTreeUser.vue"
  97. import deptTreep from "../../../components/deptTreeP.vue"
  98. export default {
  99. components: {
  100. deptTree,
  101. deptTreep
  102. },
  103. data() {
  104. const woName = (rule, value, callback) => {
  105. if (!this.infolist.woName) {
  106. callback(new Error('不能为空'))
  107. } else {
  108. callback()
  109. }
  110. }
  111. const time = (rule, value, callback) => {
  112. if (!this.infolist.time) {
  113. callback(new Error('不能为空'))
  114. } else {
  115. callback()
  116. }
  117. }
  118. return {
  119. rules: {
  120. woName: [{
  121. required: true,
  122. trigger: 'blur',
  123. validator: woName
  124. }],
  125. time: [{
  126. required: true,
  127. trigger: 'change',
  128. validator: time
  129. }]
  130. },
  131. typeList: [{
  132. dataCode: '1',
  133. dataName: '信息填报'
  134. },
  135. {
  136. dataCode: '2',
  137. dataName: '信息汇总'
  138. },
  139. ],
  140. dialogStatus: false,
  141. disableStatus: false,
  142. dialogStatusp: false,
  143. infolist: {},
  144. treeList:[],
  145. treeListp:[],
  146. treeListponly:[],
  147. closeList:[],
  148. defaultList:[],
  149. depttype:0,
  150. fadept:{},
  151. deptList:[],
  152. // roleList: {
  153. // isProvinceRole: false,
  154. // isCityRole: false,
  155. // isCountyRole: false,
  156. // isOtherRole: false,
  157. // }
  158. roleStatus: '', //0 省 1地市 2区县 3其他
  159. roleList:[]
  160. }
  161. },
  162. methods: {
  163. dialogCli(v) {
  164. let _this = this;
  165. if (v === 1) {
  166. let param = {};
  167. param.woName = this.infolist.woName;
  168. this.infolist.time?param.startTime = this.$formatDate(this.infolist.time[0], "YYYY-MM-DD"):'';
  169. this.infolist.time?param.endTime = this.$formatDate(this.infolist.time[1], "YYYY-MM-DD"):'';
  170. param.dutyList = [];
  171. for (let i = 0; i < this.treeListp.length; i++) {
  172. param.dutyList.push({
  173. dutyNo:this.treeListp[i].loginNoStr,
  174. dutyName:this.treeListp[i].loginNameStr,
  175. groupId:this.treeListp[i].o,
  176. groupName:this.treeListp[i].ou,
  177. })
  178. }
  179. param.fillList = [];
  180. // console.log(this.treeList)
  181. for (let i = 0; i < this.treeList.length; i++) {
  182. param.fillList.push({
  183. fillNo:this.treeList[i].receiveNo,
  184. fillName:this.treeList[i].label,
  185. })
  186. }
  187. for (let i = 0; i < this.treeList.length; i++) {
  188. for (let ii = 0; ii < this.treeListp.length; ii++) {
  189. if(this.treeListp[ii].loginNoStr == this.treeList[i].receiveNo){
  190. this.$message({
  191. message: '负责人和填报人重复!',
  192. type: 'error'
  193. });
  194. return
  195. }
  196. }
  197. }
  198. this.$refs.infolist.validate(valid => {
  199. if (valid) {
  200. this.$http({
  201. url: "/market/cMemberWo/add",
  202. method: "post",
  203. headers: {
  204. "Content-Type": "application/json",
  205. },
  206. data: param,
  207. }).then((res) => {
  208. if (res.data.result === 1) {
  209. _this.$message({
  210. message: res.data.desc,
  211. type: 'error'
  212. });
  213. } else {
  214. _this.$message({
  215. message: '成功',
  216. type: 'success'
  217. });
  218. _this.infolist = {};
  219. _this.treeList = [];
  220. _this.treeListp = [];
  221. _this.dialogStatus = false;
  222. }
  223. });
  224. }
  225. })
  226. } else if (v === 2) {
  227. this.infolist = {};
  228. this.treeList = [];
  229. this.treeListp = [];
  230. this.dialogStatus = false;
  231. }
  232. },
  233. chofz(v){
  234. this.dialogStatusp = false;
  235. for (let i = 0; i < this.treeListp.length; i++) {
  236. if(this.treeListp[i].o == this.fadept.o){
  237. this.treeListp[i].loginNameStr = v.loginNameStr;
  238. this.treeListp[i].loginNoStr = v.loginNoStr;
  239. }
  240. }
  241. },
  242. fzperson(v){
  243. this.fadept= v;
  244. this.dialogStatusp = true;
  245. this.$http({
  246. url: "/sysmgr/sysuserinfo/queryList",
  247. method: "post",
  248. headers: {
  249. "Content-Type": "application/json",
  250. },
  251. data: {
  252. groupId: v.o,
  253. },
  254. }).then((res) => {
  255. this.treeListponly = res.data;
  256. });
  257. this.$http({
  258. url: "/sysmgr/csysdept/queryRegionDeptList",
  259. method: "post",
  260. headers: {
  261. "Content-Type": "application/json",
  262. },
  263. data: {
  264. parentorgid: v.o,
  265. },
  266. }).then((res) => {
  267. res.data.forEach(item=>{
  268. this.$http({
  269. url: "/sysmgr/sysuserinfo/queryList",
  270. method: "post",
  271. headers: {
  272. "Content-Type": "application/json",
  273. },
  274. data: {
  275. groupId: item.o,
  276. },
  277. }).then((ress) => {
  278. this.treeListponly.push({bumen:item.ou})
  279. this.treeListponly=this.treeListponly.concat(ress.data);
  280. });
  281. })
  282. });
  283. },
  284. deletess(val, index) {
  285. this.closeList = [];
  286. for (var i = 0; i < this.treeList.length; i++) {
  287. if (this.treeList[i] == val) {
  288. // this.treeList.splice(i, 1);
  289. } else {
  290. this.closeList.push(this.treeList[i]);
  291. }
  292. }
  293. },
  294. deletes(val, index) {
  295. this.treeListp.splice(index, 1);
  296. },
  297. treeCheck(v){
  298. this.treeList = v;
  299. },
  300. choseDepta(v){
  301. let x = 'no';
  302. for (let i = 0; i < this.treeListp.length; i++) {
  303. if(this.treeListp[i].o == v.o){
  304. x = i;
  305. }
  306. }
  307. if(x != 'no'){
  308. this.treeListp.splice(x, 1)
  309. }else{
  310. this.treeListp.push(v);
  311. }
  312. },
  313. advadd() {
  314. this.dialogStatus = true;
  315. this.$http({
  316. url: "/sysmgr/csysdept/queryRegionDeptList",
  317. method: "post",
  318. headers: {
  319. "Content-Type": "application/json",
  320. },
  321. data: {},
  322. }).then((res) => {
  323. this.deptList = res.data[0].children;
  324. });
  325. },
  326. jumpadv(v) {
  327. if(v == 1){
  328. this.$router.push({
  329. path: "/haveInHand",
  330. });
  331. this.setabList("进行中任务", "/haveInHand");
  332. }else{
  333. this.$router.push({
  334. path: "/Completed",
  335. });
  336. this.setabList("已完成", "/Completed");
  337. }
  338. },
  339. advmaterial(v) {
  340. if(v.dataCode == 1){
  341. this.$router.push({
  342. path: "/empInfoFilling",
  343. });
  344. this.setabList("信息填报", "/empInfoFilling");
  345. this.$http({
  346. url: "/market/cMemberFill/queryMkMemberFillInfo",
  347. method: "post",
  348. headers: {
  349. "Content-Type": "application/json",
  350. },
  351. data: {},
  352. }).then((res) => {
  353. if(res.data){
  354. this.$router.push({
  355. path: "/empInfoFilling",
  356. });
  357. this.setabList("信息填报", "/empInfoFilling");
  358. }
  359. });
  360. }else{
  361. this.$router.push({
  362. path: "/dataStatistics",
  363. });
  364. this.setabList("数据统计", "/dataStatistics");
  365. }
  366. },
  367. setabList(n, p) {
  368. let params = {
  369. children: "",
  370. name: n,
  371. rountPath: p,
  372. target: "_self",
  373. };
  374. for (let i = 0; i < this.$store.state.tabList.length; i++) {
  375. if (this.$store.state.tabList[i].name === params.name) {
  376. this.$store.state.tabList[i] = params;
  377. }
  378. }
  379. let set = new Set([...this.$store.state.tabList, params]);
  380. set.add(params);
  381. this.$store.commit("setDefaultActive", params.rountPath);
  382. this.$store.commit("setTabList", Array.from(set));
  383. },
  384. getlist() {
  385. // this.$http({
  386. // url: "/market/cadv/queryMkAdvStsNum",
  387. // method: "post",
  388. // headers: {
  389. // "Content-Type": "application/json",
  390. // },
  391. // data: {},
  392. // }).then((res) => {
  393. // this.info = res.data
  394. // });
  395. },
  396. getUser() {
  397. this.userInfo = JSON.parse(window.sessionStorage.userInfo);
  398. // console.log(this.userInfo);
  399. let newArr = [];
  400. if(this.userInfo.cityName == null && this.userInfo.countyName == null){
  401. this.roleStatus = 0;
  402. return;
  403. }else if(this.userInfo.cityName != null && this.userInfo.countyName == null){
  404. this.$http({
  405. url: "/market/cMemberWo/queryProvTraceBase",
  406. method: "post",
  407. headers: {
  408. "Content-Type": "application/json",
  409. },
  410. data: {
  411. sts: 0
  412. },
  413. }).then((res) => {
  414. // console.log(res.data.body);
  415. res.data.body.forEach(item=>{
  416. newArr.push(...item.dutyNo.split(","));
  417. })
  418. let n = newArr.filter(item=>{
  419. return item == this.userInfo.loginNoStr
  420. })
  421. // console.log(n);
  422. if(n.length != 0){
  423. this.roleStatus = 1;
  424. }else{
  425. this.roleStatus = 3;
  426. }
  427. });
  428. return;
  429. }else if(this.userInfo.cityName != null && this.userInfo.countyName != null){
  430. this.$http({
  431. url: "/market/cMemberWo/queryProvTraceBase",
  432. method: "post",
  433. headers: {
  434. "Content-Type": "application/json",
  435. },
  436. data: {
  437. sts: 0
  438. },
  439. }).then((res) => {
  440. res.data.body.forEach(item=>{
  441. newArr.push(...item.dutyNo.split(","));
  442. })
  443. let n = newArr.filter(item=>{
  444. return item == this.userInfo.loginNoStr
  445. })
  446. // console.log(n);
  447. if(n.length != 0){
  448. this.roleStatus = 2;
  449. }else{
  450. this.roleStatus = 3;
  451. }
  452. });
  453. // this.roleStatus = 2;
  454. return;
  455. }else{
  456. this.roleStatus = 3;
  457. return;
  458. }
  459. },
  460. },
  461. mounted() {
  462. this.getUser();
  463. this.getlist();
  464. },
  465. created() {
  466. }
  467. }
  468. </script>
  469. <style scoped lang="scss">
  470. .container-box {
  471. padding: 0 30px;
  472. height: calc(100% - 40px);
  473. overflow-y: scroll;
  474. padding-bottom: 20px;
  475. }
  476. .adv-box {
  477. margin-top: 20px;
  478. display: flex;
  479. flex-wrap: nowrap;
  480. // justify-content: space-between;
  481. div {
  482. display: inline-block;
  483. cursor: pointer;
  484. .el-card {
  485. width: 100%;
  486. }
  487. i {
  488. margin-right: 10px;
  489. }
  490. }
  491. .adv-tit {
  492. width: 28%;
  493. border: 1px solid transparent;
  494. border-radius: 5px;
  495. height: 60px;
  496. line-height: 60px;
  497. padding-left: 20px;
  498. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
  499. overflow: hidden;
  500. margin-right: 2%;
  501. em {
  502. float: right;
  503. margin-right: 20px;
  504. font-style: normal;
  505. color: #0074D9;
  506. }
  507. }
  508. .adv-tit:hover {
  509. border: 1px solid #CFE8FC;
  510. background: #CFE8FC;
  511. }
  512. .adv-add {
  513. width: 100px;
  514. }
  515. }
  516. .adv-type {
  517. margin-top: 20px;
  518. display: flex;
  519. // justify-content: space-between;
  520. flex-wrap: wrap;
  521. // border: 1px solid #ddd;
  522. border-radius: 5px;
  523. padding: 20px;
  524. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
  525. div {
  526. width: 24%;
  527. text-align: center;
  528. height: 80px;
  529. overflow: hidden;
  530. min-width: 100px;
  531. cursor: pointer;
  532. padding-top: 10px;
  533. margin: 10px 0;
  534. div{
  535. width: 100%;
  536. padding-top: 0;
  537. margin: 0;
  538. }
  539. }
  540. div:hover {
  541. background: #CFE8FC;
  542. border-radius: 5px;
  543. }
  544. span {
  545. width: 100%;
  546. display: inline-block;
  547. height: 40px;
  548. // line-height: 40px;
  549. i {
  550. color: #0074D9;
  551. font-size: 36px;
  552. }
  553. }
  554. }
  555. .info-line {
  556. width: 100%;
  557. display: block;
  558. padding-left: 20px;
  559. div {
  560. width: 50%;
  561. display: inline-block;
  562. }
  563. span {
  564. width: 80px;
  565. display: inline-block;
  566. text-align: left;
  567. i {
  568. color: red;
  569. display: inline-block;
  570. padding-right: 5px;
  571. }
  572. }
  573. .el-select,
  574. .el-input {
  575. width: calc(100% - 100px);
  576. }
  577. .tree {
  578. width: calc(50% - 60px);
  579. display: inline-block;
  580. margin-right: 20px;
  581. height: 300px;
  582. overflow-y: scroll;
  583. p{
  584. overflow: hidden;
  585. display: flex;
  586. justify-content: space-between;
  587. }
  588. .p-btn{
  589. width: 50px!important;
  590. cursor: pointer;
  591. color: #0074DA;
  592. }
  593. span{
  594. display: inline-block;
  595. width: calc(100% - 100px);
  596. }
  597. .el-icon-error {
  598. float: right;
  599. font-size: 20px;
  600. margin-top: 9px;
  601. cursor: pointer;
  602. }
  603. }
  604. .treeUser {
  605. margin: 0;
  606. border: 1px solid #ddd;
  607. p {
  608. background: #f4f4f4;
  609. padding: 0 20px;
  610. margin-bottom: 5px;
  611. }
  612. }
  613. .treeUserb {
  614. width: calc(100% - 100px);
  615. border: 1px solid #ddd;
  616. background: #f4f4f4;
  617. border-radius: 3px;
  618. height: auto;
  619. overflow: hidden;
  620. p {
  621. display: inline-block;
  622. padding: 0 20px;
  623. margin-bottom: 5px;
  624. }
  625. }
  626. }
  627. .treeUserp{
  628. p{
  629. padding: 5px;
  630. }
  631. p:hover{
  632. background: #01BEF0;
  633. color: #fff;
  634. cursor: pointer;
  635. }
  636. }
  637. .online {
  638. width: 100%;
  639. .el-select {
  640. width: calc(100% - 120px);
  641. }
  642. span {
  643. vertical-align: top;
  644. }
  645. .el-textarea,
  646. .el-date-editor {
  647. width: calc(100% - 100px);
  648. display: inline-flex;
  649. }
  650. }
  651. </style>