index.vue 41 KB

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