index.vue 15 KB

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