index.vue 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267
  1. <template>
  2. <div class="app-container onDutyConfiguration">
  3. <div class="onDutyConfigurationPage" v-show="pageType === 1">
  4. <div class="left-page-max-big-box">
  5. <el-tree
  6. style="margin-right:10px;"
  7. :data="deptOptions"
  8. :props="defaultProps"
  9. icon-class=""
  10. node-key="id"
  11. :highlight-current="true"
  12. default-expand-all
  13. :expand-on-click-node="false"
  14. :filter-node-method="filterNode"
  15. ref="tree"
  16. @node-click="handleNodeClick"
  17. />
  18. </div>
  19. <p class="center-border-p"></p>
  20. <div class="right-page-max-big-box">
  21. <div class="top-button-max-box">
  22. <div class="yearMonthButtonBox">
  23. <p @click="yearMonthSwitchButton(1)" :class="yearMonthType===1?'left-button-one':'left-button-tow'">月度</p>
  24. <p @click="yearMonthSwitchButton(2)" :class="yearMonthType===2?'right-button-one':'right-button-tow'">年度</p>
  25. </div>
  26. <div class="year-month-data-button-box">
  27. <p class="year-month-subtract-button" @click="subtractDate"><</p>
  28. <p class="year-month-text-p" v-show="yearMonthType===1">{{yearMonthData.year}}-{{yearMonthData.month}}</p>
  29. <p class="year-month-text-p" v-show="yearMonthType===2">{{yearMonthData.year}}</p>
  30. <p class="year-month-add-button" @click="addDate">></p>
  31. </div>
  32. <p class="return-year-month-button inquire-button-one" v-show="yearMonthType===1" @click="returnPresent">回到本月</p>
  33. <p class="flex-p"></p>
  34. <p class="all-button add-button-one-90" @click="allButton">{{allButtonType?'取消全选':'全选'}}</p>
  35. <p class="add-button inquire-button-one" @click="addButton"
  36. v-hasPermi="['laboratory:duty:add']">+ 新增</p>
  37. </div>
  38. <div class="month-max-big-box scrollbar-box" v-if="yearMonthType === 1">
  39. <div class="month-week-box">
  40. <p class="for-week-box" v-for="item of weekList" :key="item.key">{{ item.value }}</p>
  41. </div>
  42. <div class="month-big-box">
  43. <div v-for="(year,index) in yearDate" v-if="year.year == yearMonthData.year && year.month == yearMonthData.month">
  44. <div class="for-month-max-big-box" v-for="(item,index) in year.list" :key="item.key"
  45. :class="!item.disable&&!item.expire?'for-pointer':''" @click.stop="monthCheck(item)">
  46. <p class="for-month-top-big-box" :class="item.disable?'for-month-top-big-box-color':''">{{item.date}}</p>
  47. <div class="for-month-bottom-big-box" v-if="item.subSum>0&&!item.disable" @click.stop="goPage('info',item)">
  48. <div class="for-month-bottom-left-min-box">
  49. <p>已配置实验室:{{item.subSum}}</p>
  50. <p>已配置人员:{{item.userSum}}</p>
  51. </div>
  52. <div class="for-month-bottom-right-min-box el-icon-arrow-right"></div>
  53. </div>
  54. <div class="position-img-box" v-if="!item.disable&&!item.expire">
  55. <img src="@/assets/ZDimages/personnelManagement/icon_xzqx_xz.png" v-if="item.checkType">
  56. <img src="@/assets/ZDimages/personnelManagement/icon_xzqx_zc.png" v-else>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. <div class="year-max-big-box scrollbar-box" v-if="yearMonthType === 2">
  63. <div class="for-year-max-big-box" v-for="(year,index) in yearDate" :key="year.key" v-if="year.year == yearMonthData.year">
  64. <p class="year-name-p">{{year.month==1?'一月':(year.month===2?'二月':(year.month===3?'三月':(year.month===4?'四月':(
  65. year.month===5?'五月':(year.month===6?'六月':(year.month===7?'七月':(year.month===8?'八月':(year.month===9?'九月':(
  66. year.month===10?'十月':(year.month===11?'十一月':(year.month===12?'十二月':'')))))))))))}}</p>
  67. <div class="year-week-box">
  68. <p class="for-week-box" v-for="item of weekList" :key="item.key">{{ item.value }}</p>
  69. </div>
  70. <div class="year-big-box">
  71. <div class="for-year-big-box" v-for="(item,index) in year.list" :key="item.key"
  72. :class="!item.disable&&!item.expire?'for-pointer':''" @click.stop="monthCheck(item)">
  73. <p class="for-year-top-big-box" :class="item.disable?'for-year-top-big-box-color':''">{{item.date}}</p>
  74. <div class="for-year-bottom-big-box" v-if="item.subSum>0&&!item.disable" @click.stop="goPage('info',item)">{{item.userSum}}人</div>
  75. <div class="position-img-box">
  76. <img src="@/assets/ZDimages/personnelManagement/icon_xzqx_xz.png" v-if="!item.disable&&!item.expire&&item.checkType">
  77. <img src="@/assets/ZDimages/personnelManagement/icon_xzqx_zc.png" v-if="!item.disable&&!item.expire&&!item.checkType">
  78. </div>
  79. </div>
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  84. </div>
  85. <info-page v-if="pageType === 2" :propsData="propsData"></info-page>
  86. <el-dialog title="值班配置" :visible.sync="addPageType" v-if="addPageType"
  87. width="1500px" append-to-body id="onDutyConfiguration-dialog-box">
  88. <div class="top-title-select-box">
  89. <div class="top-title-num-box">
  90. <p>日期:</p>
  91. <p>已选择{{checkList.length}}天</p>
  92. </div>
  93. <el-form :model="formData" ref="upForm" :rules="rules">
  94. <el-form-item label="实验室:" prop="subCheckList" class="form-item" label-width="80px">
  95. <el-cascader
  96. ref="subCascader"
  97. v-model="formData.subCheckList"
  98. :options="options"
  99. :props="{ multiple: true,
  100. expandTrigger: 'hover',
  101. value: 'id',
  102. label: 'label'
  103. }"
  104. collapse-tags
  105. clearable></el-cascader>
  106. </el-form-item>
  107. </el-form>
  108. </div>
  109. <div class="bottom-dialog-max-big-box">
  110. <div class="bottom-dialog-left-max-big-box">
  111. <p class="bottom-dialog-left-title-p">值班人员配置</p>
  112. <div class="bottom-dialog-left-big-box">
  113. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch">
  114. <el-form-item label="关键字" prop="nickName" >
  115. <el-input
  116. maxlength="10"
  117. v-model="queryParams.nickName"
  118. placeholder="姓名"
  119. clearable
  120. />
  121. </el-form-item>
  122. <el-form-item label="类别" prop="userType">
  123. <el-select v-model="queryParams.userType" placeholder="请选择" clearable >
  124. <el-option
  125. v-for="dict in classOptions"
  126. :key="dict.key"
  127. :label="dict.value"
  128. :value="dict.key"
  129. ></el-option>
  130. </el-select>
  131. </el-form-item>
  132. <el-form-item>
  133. <p class="inquire-button-one" @click="handleQuery">查询</p>
  134. <p class="reset-button-one" @click="resetQuery">重置</p>
  135. </el-form-item>
  136. </el-form>
  137. <el-table v-loading="loading" border :data="dataList">
  138. <el-table-column label="姓名" align="left" prop="nickName" show-overflow-tooltip/>
  139. <el-table-column label="类别" align="left" prop="userType" width="124" show-overflow-tooltip>
  140. <template slot-scope="scope">
  141. <span>{{scope.row.userType ==11?'教职工':(scope.row.userType ==22?'学生':'未定义')}}</span>
  142. </template>
  143. </el-table-column>
  144. <el-table-column label="电话" align="left" prop="phonenumber" width="227" show-overflow-tooltip/>
  145. <el-table-column label="部门" align="left" prop="deptName" width="200" show-overflow-tooltip/>
  146. <el-table-column label="" align="left" prop="createTime" width="130" show-overflow-tooltip>
  147. <template slot-scope="scope">
  148. <div class="button-box">
  149. <p class="table-min-button" @click="addDataButton(scope.row)"
  150. :class="scope.row.userCheckType?'no-check-button':''" style="margin-left:0!important;">{{scope.row.userCheckType?'已添加':'添加'}}</p>
  151. </div>
  152. </template>
  153. </el-table-column>
  154. </el-table>
  155. <pagination
  156. v-show="total>0"
  157. :total="total"
  158. :page.sync="queryParams.pageNum"
  159. :limit.sync="queryParams.pageSize"
  160. @pagination="getList"
  161. />
  162. </div>
  163. </div>
  164. <div class="bottom-dialog-right-max-big-box">
  165. <p class="bottom-dialog-right-title-p">已选择人员({{userCheckList.length}}人)</p>
  166. <div class="bottom-dialog-right-for-max-box scrollbar-box">
  167. <div class="bottom-dialog-right-for-box" v-for="(item,index) in userCheckList" :key="index">
  168. <p>{{item.nickName}}({{item.userType==11?'教职工':(item.userType==22?'学生':'未定义')}})</p>
  169. <p class="el-icon-delete" @click="deleteDataButton(item,index)"></p>
  170. </div>
  171. </div>
  172. </div>
  173. </div>
  174. <div slot="footer" style="text-align: center;">
  175. <el-button @click="cancel">取 消</el-button>
  176. <el-button type="primary" @click="submitForm">确 定</el-button>
  177. </div>
  178. </el-dialog>
  179. </div>
  180. </template>
  181. <script>
  182. import { getListYmd,addXxpDuty,treeDeptSubSel,getUserDutyList } from '@/api/laboratory/onDutyConfiguration'
  183. import { treeselect } from "@/api/system/user_teacher";
  184. import infoPage from "./infoPage.vue";
  185. export default {
  186. name: 'index',
  187. components: {
  188. infoPage
  189. },
  190. data() {
  191. return {
  192. //页面状态切换
  193. pageType:1,
  194. //树状结构
  195. treeList:[],
  196. deptOptions:[],
  197. defaultProps: {
  198. children: "children",
  199. label: "label"
  200. },
  201. checkTreeId:null,
  202. //年月状态切换 1.月度 2.年度
  203. yearMonthType:1,
  204. //全选按钮状态
  205. allButtonType:false,
  206. //年月数据切换
  207. yearMonthData:{
  208. presentYear:null,
  209. presentMonth:null,
  210. presentDate:null,
  211. year:null,
  212. month:null,
  213. },
  214. //计算用日期
  215. shareDate: new Date(),
  216. newKey:0,
  217. weekList: [
  218. {
  219. key:"1",
  220. value:"周一",
  221. },
  222. {
  223. key:"2",
  224. value:"周二",
  225. },
  226. {
  227. key:"3",
  228. value:"周三",
  229. },
  230. {
  231. key:"4",
  232. value:"周四",
  233. },
  234. {
  235. key:"5",
  236. value:"周五",
  237. },
  238. {
  239. key:"6",
  240. value:"周六",
  241. },
  242. {
  243. key:"7",
  244. value:"周日",
  245. },
  246. ],
  247. //年日历
  248. yearDate:[],
  249. //已勾选数据
  250. checkList:[],
  251. //子页面传参数据
  252. propsData:{},
  253. //新增页面状态
  254. addPageType:false,
  255. //******************************选择实验室数据
  256. //新增数据
  257. formData:{
  258. subCheckList:[],
  259. },
  260. rules:{
  261. subCheckList: [
  262. { required: true, message: "请选择实验室", trigger: "change" },
  263. { required: true, message: "请选择实验室", validator: this.spaceJudgment, trigger: "change" },
  264. ],
  265. },
  266. props: { multiple: true },
  267. options: [],
  268. //已选择人员数据
  269. userCheckList:[],
  270. showSearch:true,
  271. loading:false,
  272. total:0,
  273. classOptions:[
  274. {key:'22',value:'学生'},
  275. {key:'11',value:'教职工'},
  276. ],
  277. queryParams:{
  278. pageNum: 1,
  279. pageSize:10,
  280. nickName:"",
  281. userType:"",
  282. },
  283. //列表数据
  284. dataList:[],
  285. }
  286. },
  287. created() {
  288. this.getTreeselect();
  289. },
  290. mounted() {
  291. },
  292. methods: {
  293. //查询
  294. handleQuery(){
  295. this.queryParams.pageNum = 1;
  296. this.getList();
  297. },
  298. //重置
  299. resetQuery(){
  300. this.$set(this,'queryParams',{
  301. pageNum:1,
  302. pageSize:20,
  303. nickName:"",
  304. userType:"",
  305. });
  306. this.handleQuery();
  307. },
  308. getList(){
  309. let self = this;
  310. this.loading = true;
  311. getUserDutyList(this.queryParams).then( response => {
  312. for(let i=0;i<response.rows.length;i++){
  313. let num = 0;
  314. for(let o=0;o<self.userCheckList.length;o++){
  315. if(response.rows[i].userId == self.userCheckList[o].userId){
  316. num++
  317. }
  318. }
  319. response.rows[i].userCheckType = num != 0;
  320. }
  321. this.$set(this,'dataList',response.rows);
  322. this.total = response.total;
  323. this.loading = false;
  324. });
  325. },
  326. //获取树状实验室列表
  327. treeDeptSubSel(){
  328. treeDeptSubSel().then( response => {
  329. this.options = response.data;
  330. this.listForDel(this.options);
  331. })
  332. },
  333. listForDel(list){
  334. let self = this;
  335. for(let i=0;i<list.length;i++){
  336. if(list[i].children){
  337. if(list[i].children[0]){
  338. if(list[i].subOrDept == 1){
  339. self.listForDel(list[i].children);
  340. if(!list[i].children[0]){
  341. list.splice(i,1)
  342. i--
  343. }
  344. }
  345. }else{
  346. if(list[i].subOrDept == 1){
  347. list.splice(i,1)
  348. i--
  349. }
  350. }
  351. }else{
  352. if(list[i].subOrDept == 1){
  353. list.splice(i,1)
  354. i--
  355. }
  356. }
  357. }
  358. },
  359. submitForm(){
  360. let self = this;
  361. this.$refs["upForm"].validate((valid) => {
  362. if (valid) {
  363. if(!this.userCheckList[0]){
  364. this.msgError('请选择值班人员')
  365. return
  366. }
  367. let obj = {
  368. dateList:this.checkList,
  369. subjectList:[],
  370. sysUserList:this.userCheckList,
  371. };
  372. let subList = this.$refs.subCascader.getCheckedNodes()
  373. subList.forEach(item=>{
  374. console.log('item',item);
  375. if(!item.children[0]){
  376. obj.subjectList.push({
  377. id:item.data.subOrDeptId,
  378. deptId:item.data.parentId,
  379. deptName:item.data.parentName,
  380. name:item.label
  381. })
  382. }
  383. })
  384. addXxpDuty(obj).then( response => {
  385. this.msgSuccess(response.msg);
  386. this.addPageType = false;
  387. this.initializationDate();
  388. })
  389. }
  390. })
  391. },
  392. cancel(){
  393. this.addPageType = false;
  394. },
  395. addDataButton(row){
  396. if(!row.userCheckType){
  397. row.userCheckType = true;
  398. this.userCheckList.push(row);
  399. }
  400. },
  401. deleteDataButton(item,index){
  402. let self = this;
  403. for(let i=0;i<self.dataList.length;i++){
  404. if(item.userId == self.dataList[i].userId){
  405. self.dataList[i].userCheckType = false;
  406. }
  407. }
  408. this.userCheckList.splice(index,1);
  409. },
  410. /************************日历页面**************************/
  411. //查询值班列表
  412. getListYmd(){
  413. let self = this;
  414. let obj = {
  415. deptId:this.checkTreeId,
  416. // beginTime:this.yearDate[0].list[0].value,
  417. beginTime:"",
  418. // endTime:this.yearDate[this.yearDate.length-1].list[this.yearDate[this.yearDate.length-1].list.length-1].value,
  419. endTime:"",
  420. };
  421. if(this.yearMonthType == 1){
  422. for(let i=0;i<self.yearDate.length;i++){
  423. if(self.yearDate[i].year == self.yearMonthData.year &&
  424. self.yearDate[i].month == self.yearMonthData.month){
  425. obj.beginTime = self.yearDate[i].list[0].value;
  426. obj.endTime = self.yearDate[i].list[self.yearDate[i].list.length-1].value;
  427. }
  428. }
  429. }else if(this.yearMonthType == 2){
  430. let list = [];
  431. for(let i=0;i<self.yearDate.length;i++){
  432. if(self.yearDate[i].year == self.yearMonthData.year){
  433. list.push(self.yearDate[i]);
  434. }
  435. }
  436. obj.beginTime = list[0].list[0].value;
  437. obj.endTime = list[list.length-1].list[list[list.length-1].list.length-1].value;
  438. }
  439. getListYmd(obj).then(response => {
  440. for(let o=0;o<self.yearDate.length;o++){
  441. for(let x=0;x<self.yearDate[o].list.length;x++){
  442. let subSum = 0;
  443. let userSum = 0;
  444. for(let i=0;i<response.rows.length;i++){
  445. if(self.yearDate[o].list[x].value == response.rows[i].dutyTime){
  446. subSum = response.rows[i].subSum
  447. userSum = response.rows[i].userSum
  448. }
  449. }
  450. self.yearDate[o].list[x].subSum = subSum
  451. self.yearDate[o].list[x].userSum = userSum
  452. }
  453. }
  454. // for(let i=0;i<response.rows.length;i++){
  455. // let year = parseInt(response.rows[i].dutyTime.split('-')[0]);
  456. // let month = parseInt(response.rows[i].dutyTime.split('-')[1]);
  457. // for(let o=0;o<self.yearDate.length;o++){
  458. // if(self.yearDate[o].year == year && self.yearDate[o].month == month){
  459. // for(let x=0;x<self.yearDate[o].list.length;x++){
  460. // if(self.yearDate[o].list[x].value == response.rows[i].dutyTime){
  461. // self.yearDate[o].list[x].subSum = response.rows[i].subSum
  462. // self.yearDate[o].list[x].userSum = response.rows[i].userSum
  463. // }
  464. // }
  465. // }
  466. // }
  467. // }
  468. });
  469. },
  470. //时间初始化
  471. initializationDate(){
  472. let myDate = new Date();
  473. let obj = {
  474. presentYear:myDate.getFullYear(),
  475. presentMonth:myDate.getMonth()+1,
  476. presentDate:parseInt(this.stringify(myDate.getFullYear(),myDate.getMonth(), myDate.getDate()).replace(/-/g,"")),
  477. year:myDate.getFullYear(),
  478. month:myDate.getMonth()+1,
  479. };
  480. this.$set(this,'yearMonthData',obj);
  481. this.$set(this,'yearDate',[]);
  482. this.$set(this,'checkList',[]);
  483. if(this.generateDate()){
  484. //后端数据回填
  485. this.allCheckJudgment();
  486. this.getListYmd();
  487. }
  488. },
  489. /** 查询部门下拉树结构 */
  490. getTreeselect() {
  491. let self = this;
  492. treeselect({}).then(response => {
  493. this.deptOptions = response.data;
  494. this.$nextTick(function(){
  495. if(response.data[0]){
  496. self.$refs.tree.setCurrentKey(response.data[0].id);
  497. self.$set(self,'checkTreeId',response.data[0].id);
  498. self.initializationDate();
  499. }
  500. })
  501. });
  502. },
  503. // 筛选节点
  504. filterNode(value, data) {
  505. if (!value) return true;
  506. return data.label.indexOf(value) !== -1;
  507. },
  508. // 节点单击事件
  509. handleNodeClick(data) {
  510. if(data.id != this.checkTreeId){
  511. this.$set(this,'checkTreeId',data.id);
  512. this.initializationDate();
  513. }
  514. },
  515. //页面切换
  516. goPage(type,item){
  517. if(type == 'get'){
  518. this.getListYmd();
  519. this.$set(this,'pageType',1)
  520. }else if(type=='info'){
  521. if(!this.hasPermiDom(['laboratory:duty:query'])){
  522. this.msgError('您没有相关权限,无法查看.')
  523. return
  524. }
  525. let obj = {
  526. checkTreeId:this.checkTreeId,
  527. time:item.value,
  528. type:item.disable,
  529. }
  530. this.$set(this,'propsData',obj)
  531. this.$set(this,'pageType',2)
  532. }
  533. },
  534. //勾选
  535. monthCheck(item){
  536. if(!item.disable&&!item.expire){
  537. item.checkType = !item.checkType;
  538. this.allCheckJudgment();
  539. }
  540. },
  541. //全选方法
  542. allButton(){
  543. let self = this;
  544. if(this.yearMonthType === 1){
  545. for(let i=0;i<self.yearDate.length;i++){
  546. if(self.yearDate[i].year == self.yearMonthData.year&&
  547. self.yearDate[i].month == self.yearMonthData.month){
  548. for(let o=0;o<self.yearDate[i].list.length;o++){
  549. if (!self.yearDate[i].list[o].disable) {
  550. self.yearDate[i].list[o].checkType = !self.allButtonType;
  551. }
  552. }
  553. }
  554. }
  555. self.allButtonType = !self.allButtonType;
  556. }else{
  557. for(let i=0;i<self.yearDate.length;i++){
  558. if(self.yearDate[i].year == self.yearMonthData.year){
  559. for(let o=0;o<self.yearDate[i].list.length;o++){
  560. if (!self.yearDate[i].list[o].disable) {
  561. self.yearDate[i].list[o].checkType = !self.allButtonType;
  562. }
  563. }
  564. }
  565. }
  566. self.allButtonType = !self.allButtonType;
  567. }
  568. },
  569. //全选状态判定
  570. allCheckJudgment(){
  571. let self = this;
  572. let age = 0;
  573. let num = 0;
  574. if(this.yearMonthType == 1){
  575. for(let i=0;i<self.yearDate.length;i++){
  576. if(self.yearDate[i].year == self.yearMonthData.year&&
  577. self.yearDate[i].month == self.yearMonthData.month){
  578. for(let o=0;o<self.yearDate[i].list.length;o++){
  579. if (!self.yearDate[i].list[o].disable) {
  580. age++
  581. if(self.yearDate[i].list[o].checkType){
  582. num++
  583. }
  584. }
  585. }
  586. }
  587. }
  588. }else{
  589. for(let i=0;i<self.yearDate.length;i++){
  590. if(self.yearDate[i].year == self.yearMonthData.year){
  591. for(let o=0;o<self.yearDate[i].list.length;o++){
  592. if (!self.yearDate[i].list[o].disable) {
  593. age++
  594. if(self.yearDate[i].list[o].checkType){
  595. num++
  596. }
  597. }
  598. }
  599. }
  600. }
  601. }
  602. if(age == num){
  603. this.$set(this,'allButtonType',true)
  604. }else{
  605. this.$set(this,'allButtonType',false)
  606. }
  607. },
  608. //新增方法
  609. addButton(){
  610. let self = this;
  611. let list = [];
  612. for(let i=0;i<self.yearDate.length;i++){
  613. for(let o=0;o<self.yearDate[i].list.length;o++){
  614. if (!self.yearDate[i].list[o].disable&&self.yearDate[i].list[o].checkType) {
  615. list.push(self.yearDate[i].list[o].value)
  616. }
  617. }
  618. }
  619. if(!list[0]){
  620. this.msgError('请选择日期')
  621. }else{
  622. this.$set(this,'checkList',list);
  623. this.$set(this,'userCheckList',[]);
  624. this.$set(this.formData,'subCheckList',[]);
  625. this.resetQuery();
  626. this.treeDeptSubSel();
  627. this.$set(this,'addPageType',true);
  628. }
  629. },
  630. //返回当前时间
  631. returnPresent(){
  632. this.$set(this.yearMonthData,'year',this.yearMonthData.presentYear);
  633. this.$set(this.yearMonthData,'month',this.yearMonthData.presentMonth);
  634. this.getListYmd();
  635. },
  636. //年或月增加
  637. addDate(){
  638. if(this.yearMonthType == 1){
  639. if(this.yearMonthData.month<12){
  640. this.yearMonthData.month++
  641. }else{
  642. if(this.yearMonthData.year>=this.yearMonthData.presentYear+1){
  643. return
  644. }
  645. this.yearMonthData.year++
  646. this.$set(this.yearMonthData,'month',1);
  647. }
  648. }else if(this.yearMonthType == 2){
  649. if(this.yearMonthData.year>=this.yearMonthData.presentYear+1){
  650. return
  651. }
  652. this.yearMonthData.year++
  653. }
  654. this.allCheckJudgment();
  655. this.getListYmd();
  656. },
  657. //年或月减少
  658. subtractDate(){
  659. if(this.yearMonthType == 1){
  660. if(this.yearMonthData.month>1){
  661. this.yearMonthData.month--
  662. }else{
  663. if(this.yearMonthData.year==this.yearMonthData.presentYear){
  664. return
  665. }
  666. this.yearMonthData.year--
  667. this.$set(this.yearMonthData,'month',12);
  668. }
  669. }else if(this.yearMonthType == 2){
  670. if(this.yearMonthData.year==this.yearMonthData.presentYear){
  671. return
  672. }
  673. this.yearMonthData.year--
  674. }
  675. this.allCheckJudgment();
  676. this.getListYmd();
  677. },
  678. //年月展示切换按钮
  679. yearMonthSwitchButton(type){
  680. if(this.yearMonthType != type){
  681. this.$set(this,'yearMonthType',type);
  682. this.allCheckJudgment();
  683. this.getListYmd();
  684. }
  685. },
  686. // 生成日历
  687. generateDate() {
  688. let self = this;
  689. let myDate = new Date();
  690. let year = myDate.getFullYear();
  691. let newTimeList = [];
  692. self.newKey = 0;
  693. for(let o=0;o<2;o++){
  694. for(let i=0;i<12;i++){
  695. self.newKey++
  696. newTimeList.push(self.setCurrentYearMonth(year,i))
  697. }
  698. year++
  699. }
  700. this.$set(this,'yearDate',newTimeList);
  701. return true;
  702. },
  703. // 设置日历显示的日期(年-月)
  704. setCurrentYearMonth(year,month) {
  705. let showYearMonth = {
  706. year,
  707. month,
  708. };
  709. return this.createCalendar(showYearMonth);
  710. },
  711. // 创建当前月对应日历的日期数据
  712. createCalendar(showYearMonth) {
  713. const oneDayMS = 24 * 60 * 60 * 1000;
  714. let { year, month } = showYearMonth;
  715. let obj = {
  716. key:this.newKey,
  717. time:year+'-'+(month+1),
  718. year:year,
  719. month:month+1,
  720. list:[],
  721. }
  722. let firstDay = this.getFirstDayByMonths(year, month);
  723. let prefixDaysLen = firstDay === 0 ? 6 : firstDay - 1;
  724. let begin = new Date(year, month, 1).getTime() - oneDayMS * prefixDaysLen;
  725. let lastDay = this.getLastDayByMonth(year, month);
  726. let suffixDaysLen = lastDay === 0 ? 0 : 7 - lastDay;
  727. let end = new Date(year, month + 1, 0).getTime() + oneDayMS * suffixDaysLen;
  728. while (begin <= end) {
  729. this.shareDate.setTime(begin);
  730. let year = this.shareDate.getFullYear();
  731. let curMonth = this.shareDate.getMonth();
  732. let date = this.shareDate.getDate();
  733. let time = this.stringify(year, curMonth, date).replace(/-/g,"");
  734. obj.list.push({
  735. year: year,
  736. month: curMonth + 1,
  737. date: date,
  738. weeks:this.calculationWeeks(year, curMonth, date),
  739. value: this.stringify(year, curMonth, date),
  740. key:this.newKey+''+time,
  741. time:time,
  742. // disable: parseInt(time) < this.yearMonthData.presentDate?true:(curMonth !== month),
  743. disable: curMonth !== month,
  744. expire:parseInt(time) < this.yearMonthData.presentDate ? true : false,
  745. checkType:false,
  746. subSum:0,
  747. userSum:0,
  748. });
  749. begin += oneDayMS;
  750. }
  751. return obj;
  752. },
  753. //计算当前是周几
  754. calculationWeeks(year, curMonth, date){
  755. let now = new Date(this.stringify(year, curMonth, date));
  756. let day = now.getDay();
  757. let weeks = new Array(
  758. "7",
  759. "1",
  760. "2",
  761. "3",
  762. "4",
  763. "5",
  764. "6"
  765. );
  766. return weeks[day];
  767. },
  768. // 格式化时间
  769. stringify(year, month, date) {
  770. return [year, this.pad(month + 1), this.pad(date)].join("-");
  771. },
  772. // 对小于 10 的数字,前面补 0
  773. pad(str) {
  774. return str < 10 ? `0${str}` : str;
  775. },
  776. // 当前月的第一天是星期几
  777. getFirstDayByMonths(year, month) {
  778. return new Date(year, month, 1).getDay();
  779. },
  780. // 当前月的最后一天是星期几
  781. getLastDayByMonth(year, month) {
  782. return new Date(year, month + 1, 0).getDay();
  783. },
  784. }
  785. }
  786. </script>
  787. <style scoped lang="scss">
  788. .onDutyConfiguration{
  789. display: flex;
  790. flex-direction: column;
  791. font-weight:500;
  792. *{
  793. margin:0;
  794. padding:0;
  795. }
  796. .onDutyConfigurationPage{
  797. flex:1;
  798. display: flex;
  799. overflow: hidden;
  800. .left-page-max-big-box{
  801. width:250px;
  802. overflow: hidden;
  803. display: flex;
  804. flex-direction: column;
  805. padding:36px 0 36px 10px;
  806. .tree-box {
  807. flex: 1;
  808. .terr-max-box:nth-child(1){
  809. margin:0;
  810. }
  811. .terr-max-box {
  812. margin-top: 20px;
  813. .max-name-box {
  814. display: flex;
  815. margin-right: 20px;
  816. margin-bottom: 10px;
  817. color: #D8D8D8;
  818. font-size: 20px;
  819. .max-name {
  820. flex: 1;
  821. margin-right: 19px;
  822. color: #333;
  823. font-size: 16px;
  824. line-height: 16px;
  825. margin-top: 3px;
  826. cursor: pointer;
  827. overflow: hidden;
  828. }
  829. }
  830. .terr-big-box {
  831. margin-left: 30px;
  832. .big-name-box {
  833. cursor: pointer;
  834. height: 40px;
  835. line-height: 40px;
  836. display: flex;
  837. font-size: 16px;
  838. color: #333;
  839. img {
  840. width: 16px;
  841. height: 16px;
  842. margin-top: 12px;
  843. margin-right: 4px;
  844. }
  845. .name-p {
  846. flex: 1;
  847. overflow: hidden;
  848. }
  849. }
  850. .terr-min-box {
  851. margin-left: 30px;
  852. .min-name {
  853. cursor: pointer;
  854. height: 40px;
  855. line-height: 40px;
  856. display: flex;
  857. font-size: 16px;
  858. color: #333;
  859. overflow: hidden;
  860. }
  861. }
  862. }
  863. .check-color {
  864. color: #0183FA !important;
  865. }
  866. }
  867. }
  868. .tree-null-p {
  869. text-align: center;
  870. line-height: 100px;
  871. flex: 1;
  872. color: #999;
  873. }
  874. }
  875. .center-border-p{
  876. border-right:1px dashed #A2A2A2;
  877. margin:36px 35px 36px 0;
  878. }
  879. .right-page-max-big-box{
  880. flex:1;
  881. display: flex;
  882. flex-direction: column;
  883. overflow: hidden;
  884. -webkit-user-select: none;
  885. -moz-user-select: none;
  886. -ms-user-select: none;
  887. user-select: none;
  888. .top-button-max-box{
  889. height:87px;
  890. padding:21px 0 26px 0;
  891. display: flex;
  892. border-bottom:1px solid #E0E0E0;
  893. font-size:14px;
  894. .yearMonthButtonBox{
  895. width:200px;
  896. height:40px;
  897. display: flex;
  898. p{
  899. text-align: center;
  900. line-height:38px;
  901. width:100px;
  902. cursor: pointer;
  903. }
  904. p:nth-child(1){
  905. border-top-left-radius: 4px;
  906. border-bottom-left-radius: 4px;
  907. }
  908. p:nth-child(2){
  909. border-top-right-radius: 4px;
  910. border-bottom-right-radius: 4px;
  911. }
  912. .left-button-one{
  913. background: #0183FA;
  914. border:1px solid #0183FA;
  915. color:#fff;
  916. }
  917. .left-button-tow{
  918. color:#333333;
  919. border:1px solid #E0E0E0;
  920. border-right:none;
  921. }
  922. .right-button-one{
  923. background: #0183FA;
  924. border:1px solid #0183FA;
  925. color:#fff;
  926. }
  927. .right-button-tow{
  928. color:#333333;
  929. border:1px solid #E0E0E0;
  930. border-left:none;
  931. }
  932. }
  933. .year-month-data-button-box{
  934. display: flex;
  935. margin:0 33px 0 39px;
  936. p{
  937. line-height:38px;
  938. text-align: center;
  939. }
  940. .year-month-subtract-button{
  941. border:1px solid #E0E0E0;
  942. border-top-left-radius: 4px;
  943. border-bottom-left-radius: 4px;
  944. width:38px;
  945. cursor: pointer;
  946. }
  947. .year-month-text-p{
  948. border-top:1px solid #E0E0E0;
  949. border-bottom:1px solid #E0E0E0;
  950. width:150px;
  951. }
  952. .year-month-add-button{
  953. border:1px solid #E0E0E0;
  954. border-top-right-radius: 4px;
  955. border-bottom-right-radius: 4px;
  956. width:38px;
  957. cursor: pointer;
  958. }
  959. }
  960. .return-year-month-button{
  961. width:100px;
  962. height:40px;
  963. line-height:38px;
  964. }
  965. .flex-p{
  966. flex:1;
  967. }
  968. .all-button{
  969. width:80px;
  970. height:40px;
  971. margin-right:8px;
  972. line-height:38px;
  973. }
  974. .add-button{
  975. width:80px;
  976. height:40px;
  977. margin-right:23px;
  978. line-height:38px;
  979. }
  980. }
  981. .month-max-big-box{
  982. -webkit-user-select: none;
  983. -moz-user-select: none;
  984. -ms-user-select: none;
  985. user-select: none;
  986. flex:1;
  987. padding:10px 0 30px;
  988. .month-week-box{
  989. display: flex;
  990. overflow: hidden;
  991. font-size:0;
  992. .for-week-box{
  993. font-size:14px;
  994. width:180px;
  995. text-align: center;
  996. line-height:60px;
  997. border-bottom:1px solid #E0E0E0;
  998. }
  999. }
  1000. .month-big-box{
  1001. border-left:1px solid #E0E0E0;
  1002. font-size:0;
  1003. .for-month-max-big-box{
  1004. overflow: hidden;
  1005. font-size:16px;
  1006. width:180px;
  1007. height:110px;
  1008. display: inline-block;
  1009. border-right:1px solid #E0E0E0;
  1010. border-bottom:1px solid #E0E0E0;
  1011. position: relative;
  1012. .for-month-top-big-box{
  1013. width:180px;
  1014. height:50px;
  1015. line-height:50px;
  1016. text-align: center;
  1017. font-size:16px;
  1018. color:#333;
  1019. }
  1020. .for-month-top-big-box-color{
  1021. color:#E0E0E0;
  1022. }
  1023. .for-month-bottom-big-box{
  1024. height:60px;
  1025. background: rgba(1,131,250,0.2);
  1026. color:#0183FA;
  1027. display: flex;
  1028. cursor: pointer;
  1029. .for-month-bottom-left-min-box{
  1030. flex: 1;
  1031. font-size:14px;
  1032. padding:10px 0 0 10px;
  1033. p{
  1034. line-height:20px;
  1035. }
  1036. }
  1037. .for-month-bottom-right-min-box{
  1038. width:24px;
  1039. text-align: center;
  1040. line-height:60px;
  1041. font-size:12px;
  1042. font-weight:900;
  1043. }
  1044. }
  1045. .position-img-box{
  1046. position: absolute;
  1047. left:0;
  1048. top:0;
  1049. width:50px;
  1050. height:50px;
  1051. img{
  1052. width:14px;
  1053. height:14px;
  1054. margin: 18px;
  1055. }
  1056. }
  1057. }
  1058. }
  1059. }
  1060. .year-max-big-box{
  1061. flex:1;
  1062. padding:30px 0;
  1063. .for-year-max-big-box{
  1064. vertical-align:top;
  1065. width:596px;
  1066. display: inline-block;
  1067. margin:0 42px 40px 0;
  1068. overflow: hidden;
  1069. .year-name-p{
  1070. text-align: center;
  1071. font-size:16px;
  1072. background: #CCE6FE;
  1073. color:#0183FA;
  1074. line-height:40px;
  1075. border-top-left-radius:4px;
  1076. border-top-right-radius:4px;
  1077. }
  1078. .year-week-box{
  1079. overflow: hidden;
  1080. font-size:0;
  1081. background: rgba(224,224,224,0.2);
  1082. .for-week-box{
  1083. width:85px;
  1084. line-height:40px;
  1085. text-align: center;
  1086. display: inline-block;
  1087. font-size:12px;
  1088. }
  1089. }
  1090. .year-big-box{
  1091. border-top:1px solid #E0E0E0;
  1092. border-left:1px solid #E0E0E0;
  1093. overflow: hidden;
  1094. font-size:0;
  1095. .for-year-big-box{
  1096. display: inline-block;
  1097. overflow: hidden;
  1098. width:85px;
  1099. height:60px;
  1100. border-right:1px solid #E0E0E0;
  1101. border-bottom:1px solid #E0E0E0;
  1102. position: relative;
  1103. .for-year-top-big-box{
  1104. flex:1;
  1105. font-size:12px;
  1106. color:#333;
  1107. line-height:30px;
  1108. text-align: center;
  1109. }
  1110. .for-year-top-big-box-color{
  1111. color:#E0E0E0;
  1112. }
  1113. .for-year-bottom-big-box{
  1114. line-height:30px;
  1115. font-size:14px;
  1116. text-align: center;
  1117. background: #CCE6FE;
  1118. color:#0183FA;
  1119. cursor: pointer;
  1120. }
  1121. .position-img-box{
  1122. position: absolute;
  1123. top:0;
  1124. left:0;
  1125. width:30px;
  1126. height:30px;
  1127. img{
  1128. width:14px;
  1129. height:14px;
  1130. margin:8px;
  1131. }
  1132. }
  1133. }
  1134. }
  1135. }
  1136. }
  1137. .for-pointer{
  1138. cursor: pointer;
  1139. }
  1140. }
  1141. }
  1142. }
  1143. </style>
  1144. <style lang="scss">
  1145. #onDutyConfiguration-dialog-box{
  1146. .top-title-select-box{
  1147. display: flex;
  1148. border-bottom: 1px dashed #D8D8D8;
  1149. .top-title-num-box{
  1150. display: flex;
  1151. margin-left:30px;
  1152. p{
  1153. font-size:14px;
  1154. line-height: 40px;
  1155. color:#333;
  1156. margin-right:10px;
  1157. }
  1158. p:nth-child(2){
  1159. width:250px;
  1160. height:40px;
  1161. background: #F5F5F5;
  1162. padding-left:22px;
  1163. border-radius:4px;
  1164. }
  1165. }
  1166. }
  1167. .bottom-dialog-max-big-box{
  1168. display: flex;
  1169. width:1460px;
  1170. height:430px;
  1171. .bottom-dialog-left-max-big-box{
  1172. width:920px;
  1173. height:430px;
  1174. overflow: hidden;
  1175. display: flex;
  1176. flex-direction: column;
  1177. padding-right:47px;
  1178. .bottom-dialog-left-title-p{
  1179. line-height:72px;
  1180. color:#043581;
  1181. font-size:18px;
  1182. }
  1183. .bottom-dialog-left-big-box{
  1184. overflow: hidden;
  1185. flex:1;
  1186. display: flex;
  1187. flex-direction: column;
  1188. padding-left:30px;
  1189. }
  1190. .no-check-button{
  1191. color:#666!important;
  1192. }
  1193. }
  1194. .bottom-dialog-right-max-big-box{
  1195. margin-top:30px;
  1196. width:540px;
  1197. height:400px;
  1198. border-left: 1px dashed #D8D8D8;
  1199. display: flex;
  1200. flex-direction: column;
  1201. overflow: hidden;
  1202. .bottom-dialog-right-title-p{
  1203. height:40px;
  1204. line-height:40px;
  1205. margin-left:47px;
  1206. width:445px;
  1207. background: rgba(1,131,250,0.1);
  1208. color: #0183FA;
  1209. font-size:16px;
  1210. padding-left:19px;
  1211. }
  1212. .bottom-dialog-right-for-max-box{
  1213. height:360px;
  1214. .bottom-dialog-right-for-box{
  1215. display: flex;
  1216. width:445px;
  1217. margin-left:47px;
  1218. p:nth-child(1){
  1219. font-size:14px;
  1220. line-height:40px;
  1221. padding-left:19px;
  1222. overflow: hidden;
  1223. flex:1;
  1224. }
  1225. p:nth-child(2){
  1226. width:40px;
  1227. margin-right:20px;
  1228. line-height:40px;
  1229. text-align: center;
  1230. font-size:14px;
  1231. color:#666;
  1232. cursor: pointer;
  1233. }
  1234. }
  1235. }
  1236. }
  1237. }
  1238. }
  1239. .onDutyConfiguration{
  1240. .el-tree-node__label{
  1241. font-size:16px;
  1242. }
  1243. .el-tree-node__content{
  1244. height:30px;
  1245. line-height: 30px;
  1246. }
  1247. .el-tree-node__expand-icon{
  1248. color:#333;
  1249. font-size:16px;
  1250. padding:0;
  1251. margin-right:3px;
  1252. }
  1253. .el-tree-node__expand-icon.is-leaf{
  1254. color: transparent;
  1255. }
  1256. .el-tree--highlight-current .el-tree-node.is-current > .el-tree-node__content{
  1257. background-color:#ffffff;
  1258. color:#0183FA;
  1259. }
  1260. }
  1261. </style>