index.vue 42 KB

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