index.vue 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334
  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: 'id',
  103. label: 'label'
  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. }
  401. }
  402. }else{
  403. if(list[i].subOrDept == 1){
  404. list.splice(i,1)
  405. i--
  406. }
  407. }
  408. }
  409. },
  410. submitForm(){
  411. let self = this;
  412. this.$refs["upForm"].validate((valid) => {
  413. if (valid) {
  414. if(!this.userCheckList[0]){
  415. this.msgError('请选择值班人员')
  416. return
  417. }
  418. let obj = {
  419. dateList:this.checkList,
  420. subjectList:[],
  421. sysUserList:this.userCheckList,
  422. };
  423. let subList = this.$refs.subCascader.getCheckedNodes()
  424. subList.forEach(item=>{
  425. console.log('item',item);
  426. if(!item.children[0]){
  427. obj.subjectList.push({
  428. id:item.data.subOrDeptId,
  429. deptId:item.data.parentId,
  430. deptName:item.data.parentName,
  431. name:item.label
  432. })
  433. }
  434. })
  435. addXxpDuty(obj).then( response => {
  436. this.msgSuccess(response.msg);
  437. this.addPageType = false;
  438. this.initializationDate();
  439. })
  440. }
  441. })
  442. },
  443. cancel(){
  444. this.addPageType = false;
  445. },
  446. addDataButton(row){
  447. if(!row.userCheckType){
  448. row.userCheckType = true;
  449. this.userCheckList.push(row);
  450. }
  451. },
  452. deleteDataButton(item,index){
  453. let self = this;
  454. for(let i=0;i<self.dataList.length;i++){
  455. if(item.userId == self.dataList[i].userId){
  456. self.dataList[i].userCheckType = false;
  457. }
  458. }
  459. this.userCheckList.splice(index,1);
  460. },
  461. /************************日历页面**************************/
  462. //查询值班列表
  463. getListYmd(){
  464. let self = this;
  465. let obj = {
  466. deptId:this.checkTreeId,
  467. // beginTime:this.yearDate[0].list[0].value,
  468. beginTime:"",
  469. // endTime:this.yearDate[this.yearDate.length-1].list[this.yearDate[this.yearDate.length-1].list.length-1].value,
  470. endTime:"",
  471. };
  472. if(this.yearMonthType == 1){
  473. for(let i=0;i<self.yearDate.length;i++){
  474. if(self.yearDate[i].year == self.yearMonthData.year &&
  475. self.yearDate[i].month == self.yearMonthData.month){
  476. obj.beginTime = self.yearDate[i].list[0].value;
  477. obj.endTime = self.yearDate[i].list[self.yearDate[i].list.length-1].value;
  478. }
  479. }
  480. }else if(this.yearMonthType == 2){
  481. let list = [];
  482. for(let i=0;i<self.yearDate.length;i++){
  483. if(self.yearDate[i].year == self.yearMonthData.year){
  484. list.push(self.yearDate[i]);
  485. }
  486. }
  487. obj.beginTime = list[0].list[0].value;
  488. obj.endTime = list[list.length-1].list[list[list.length-1].list.length-1].value;
  489. }
  490. getListYmd(obj).then(response => {
  491. for(let o=0;o<self.yearDate.length;o++){
  492. for(let x=0;x<self.yearDate[o].list.length;x++){
  493. let subSum = 0;
  494. let userSum = 0;
  495. for(let i=0;i<response.rows.length;i++){
  496. if(self.yearDate[o].list[x].value == response.rows[i].dutyTime){
  497. subSum = response.rows[i].subSum
  498. userSum = response.rows[i].userSum
  499. }
  500. }
  501. self.yearDate[o].list[x].subSum = subSum
  502. self.yearDate[o].list[x].userSum = userSum
  503. }
  504. }
  505. // for(let i=0;i<response.rows.length;i++){
  506. // let year = parseInt(response.rows[i].dutyTime.split('-')[0]);
  507. // let month = parseInt(response.rows[i].dutyTime.split('-')[1]);
  508. // for(let o=0;o<self.yearDate.length;o++){
  509. // if(self.yearDate[o].year == year && self.yearDate[o].month == month){
  510. // for(let x=0;x<self.yearDate[o].list.length;x++){
  511. // if(self.yearDate[o].list[x].value == response.rows[i].dutyTime){
  512. // self.yearDate[o].list[x].subSum = response.rows[i].subSum
  513. // self.yearDate[o].list[x].userSum = response.rows[i].userSum
  514. // }
  515. // }
  516. // }
  517. // }
  518. // }
  519. });
  520. },
  521. //时间初始化
  522. initializationDate(){
  523. let myDate = new Date();
  524. let obj = {
  525. presentYear:myDate.getFullYear(),
  526. presentMonth:myDate.getMonth()+1,
  527. presentDate:parseInt(this.stringify(myDate.getFullYear(),myDate.getMonth(), myDate.getDate()).replace(/-/g,"")),
  528. year:myDate.getFullYear(),
  529. month:myDate.getMonth()+1,
  530. };
  531. this.$set(this,'yearMonthData',obj);
  532. this.$set(this,'yearDate',[]);
  533. this.$set(this,'checkList',[]);
  534. if(this.generateDate()){
  535. //后端数据回填
  536. this.allCheckJudgment();
  537. this.getListYmd();
  538. }
  539. },
  540. /** 查询部门下拉树结构 */
  541. getTreeselect() {
  542. let self = this;
  543. treeselect({}).then(response => {
  544. this.deptOptions = response.data;
  545. this.$nextTick(function(){
  546. if(response.data[0]){
  547. self.$refs.tree.setCurrentKey(response.data[0].id);
  548. self.$set(self,'checkTreeId',response.data[0].id);
  549. self.initializationDate();
  550. }
  551. })
  552. });
  553. },
  554. // 筛选节点
  555. filterNode(value, data) {
  556. if (!value) return true;
  557. return data.label.indexOf(value) !== -1;
  558. },
  559. // 节点单击事件
  560. handleNodeClick(data) {
  561. if(data.id != this.checkTreeId){
  562. this.$set(this,'checkTreeId',data.id);
  563. this.initializationDate();
  564. }
  565. },
  566. //页面切换
  567. goPage(type,item){
  568. if(type == 'get'){
  569. this.getListYmd();
  570. this.$set(this,'pageType',1)
  571. }else if(type=='info'){
  572. if(!this.hasPermiDom(['laboratory:duty:query'])){
  573. this.msgError('您没有相关权限,无法查看.')
  574. return
  575. }
  576. let obj = {
  577. checkTreeId:this.checkTreeId,
  578. time:item.value,
  579. type:item.disable,
  580. }
  581. this.$set(this,'propsData',obj)
  582. this.$set(this,'pageType',2)
  583. }
  584. },
  585. //勾选
  586. monthCheck(item){
  587. let self = this;
  588. if(!item.disable&&!item.expire){
  589. let num = 0;
  590. for(let i=0;i<self.yearDate.length;i++){
  591. for(let o=0;o<self.yearDate[i].list.length;o++){
  592. if(self.yearDate[i].list[o].checkType){
  593. num++
  594. }
  595. }
  596. }
  597. if(num >29){
  598. this.msgError('最多只可选中30天')
  599. return
  600. }
  601. item.checkType = !item.checkType;
  602. this.allCheckJudgment();
  603. }
  604. },
  605. //全选方法
  606. allButton(){
  607. let self = this;
  608. if(this.yearMonthType === 1){
  609. for(let i=0;i<self.yearDate.length;i++){
  610. if(self.yearDate[i].year == self.yearMonthData.year&&
  611. self.yearDate[i].month == self.yearMonthData.month){
  612. for(let o=0;o<self.yearDate[i].list.length;o++){
  613. if (!self.yearDate[i].list[o].disable) {
  614. self.yearDate[i].list[o].checkType = !self.allButtonType;
  615. }
  616. }
  617. }
  618. }
  619. self.allButtonType = !self.allButtonType;
  620. }else{
  621. for(let i=0;i<self.yearDate.length;i++){
  622. if(self.yearDate[i].year == self.yearMonthData.year){
  623. for(let o=0;o<self.yearDate[i].list.length;o++){
  624. if (!self.yearDate[i].list[o].disable) {
  625. self.yearDate[i].list[o].checkType = !self.allButtonType;
  626. }
  627. }
  628. }
  629. }
  630. self.allButtonType = !self.allButtonType;
  631. }
  632. },
  633. //全选状态判定
  634. allCheckJudgment(){
  635. let self = this;
  636. let age = 0;
  637. let num = 0;
  638. if(this.yearMonthType == 1){
  639. for(let i=0;i<self.yearDate.length;i++){
  640. if(self.yearDate[i].year == self.yearMonthData.year&&
  641. self.yearDate[i].month == self.yearMonthData.month){
  642. for(let o=0;o<self.yearDate[i].list.length;o++){
  643. if (!self.yearDate[i].list[o].disable) {
  644. age++
  645. if(self.yearDate[i].list[o].checkType){
  646. num++
  647. }
  648. }
  649. }
  650. }
  651. }
  652. }else{
  653. for(let i=0;i<self.yearDate.length;i++){
  654. if(self.yearDate[i].year == self.yearMonthData.year){
  655. for(let o=0;o<self.yearDate[i].list.length;o++){
  656. if (!self.yearDate[i].list[o].disable) {
  657. age++
  658. if(self.yearDate[i].list[o].checkType){
  659. num++
  660. }
  661. }
  662. }
  663. }
  664. }
  665. }
  666. if(age == num){
  667. this.$set(this,'allButtonType',true)
  668. }else{
  669. this.$set(this,'allButtonType',false)
  670. }
  671. },
  672. //新增方法
  673. addButton(){
  674. let self = this;
  675. let list = [];
  676. for(let i=0;i<self.yearDate.length;i++){
  677. for(let o=0;o<self.yearDate[i].list.length;o++){
  678. if (!self.yearDate[i].list[o].disable&&self.yearDate[i].list[o].checkType) {
  679. list.push(self.yearDate[i].list[o].value)
  680. }
  681. }
  682. }
  683. if(!list[0]){
  684. this.msgError('请选择日期')
  685. }else{
  686. this.$set(this,'total',0);
  687. this.$set(this,'dataList',[]);
  688. this.$set(this,'userCheckList',[]);
  689. this.$set(this,'getSubList',[]);
  690. this.$set(this.formData,'subCheckList',[]);
  691. this.$set(this,'checkList',list);
  692. // this.resetQuery();
  693. this.treeDeptSubSel();
  694. this.$set(this,'addPageType',true);
  695. }
  696. },
  697. //返回当前时间
  698. returnPresent(){
  699. this.$set(this.yearMonthData,'year',this.yearMonthData.presentYear);
  700. this.$set(this.yearMonthData,'month',this.yearMonthData.presentMonth);
  701. this.getListYmd();
  702. },
  703. //年或月增加
  704. addDate(){
  705. if(this.yearMonthType == 1){
  706. if(this.yearMonthData.month<12){
  707. this.yearMonthData.month++
  708. }else{
  709. if(this.yearMonthData.year>=this.yearMonthData.presentYear+1){
  710. return
  711. }
  712. this.yearMonthData.year++
  713. this.$set(this.yearMonthData,'month',1);
  714. }
  715. }else if(this.yearMonthType == 2){
  716. if(this.yearMonthData.year>=this.yearMonthData.presentYear+1){
  717. return
  718. }
  719. this.yearMonthData.year++
  720. }
  721. this.allCheckJudgment();
  722. this.getListYmd();
  723. },
  724. //年或月减少
  725. subtractDate(){
  726. if(this.yearMonthType == 1){
  727. if(this.yearMonthData.month>1){
  728. this.yearMonthData.month--
  729. }else{
  730. if(this.yearMonthData.year==this.yearMonthData.presentYear){
  731. return
  732. }
  733. this.yearMonthData.year--
  734. this.$set(this.yearMonthData,'month',12);
  735. }
  736. }else if(this.yearMonthType == 2){
  737. if(this.yearMonthData.year==this.yearMonthData.presentYear){
  738. return
  739. }
  740. this.yearMonthData.year--
  741. }
  742. this.allCheckJudgment();
  743. this.getListYmd();
  744. },
  745. //年月展示切换按钮
  746. yearMonthSwitchButton(type){
  747. if(this.yearMonthType != type){
  748. this.$set(this,'yearMonthType',type);
  749. this.allCheckJudgment();
  750. this.getListYmd();
  751. }
  752. },
  753. // 生成日历
  754. generateDate() {
  755. let self = this;
  756. let myDate = new Date();
  757. let year = myDate.getFullYear();
  758. let newTimeList = [];
  759. self.newKey = 0;
  760. for(let o=0;o<2;o++){
  761. for(let i=0;i<12;i++){
  762. self.newKey++
  763. newTimeList.push(self.setCurrentYearMonth(year,i))
  764. }
  765. year++
  766. }
  767. this.$set(this,'yearDate',newTimeList);
  768. return true;
  769. },
  770. // 设置日历显示的日期(年-月)
  771. setCurrentYearMonth(year,month) {
  772. let showYearMonth = {
  773. year,
  774. month,
  775. };
  776. return this.createCalendar(showYearMonth);
  777. },
  778. // 创建当前月对应日历的日期数据
  779. createCalendar(showYearMonth) {
  780. const oneDayMS = 24 * 60 * 60 * 1000;
  781. let { year, month } = showYearMonth;
  782. let obj = {
  783. key:this.newKey,
  784. time:year+'-'+(month+1),
  785. year:year,
  786. month:month+1,
  787. list:[],
  788. }
  789. let firstDay = this.getFirstDayByMonths(year, month);
  790. let prefixDaysLen = firstDay === 0 ? 6 : firstDay - 1;
  791. let begin = new Date(year, month, 1).getTime() - oneDayMS * prefixDaysLen;
  792. let lastDay = this.getLastDayByMonth(year, month);
  793. let suffixDaysLen = lastDay === 0 ? 0 : 7 - lastDay;
  794. let end = new Date(year, month + 1, 0).getTime() + oneDayMS * suffixDaysLen;
  795. while (begin <= end) {
  796. this.shareDate.setTime(begin);
  797. let year = this.shareDate.getFullYear();
  798. let curMonth = this.shareDate.getMonth();
  799. let date = this.shareDate.getDate();
  800. let time = this.stringify(year, curMonth, date).replace(/-/g,"");
  801. obj.list.push({
  802. year: year,
  803. month: curMonth + 1,
  804. date: date,
  805. weeks:this.calculationWeeks(year, curMonth, date),
  806. value: this.stringify(year, curMonth, date),
  807. key:this.newKey+''+time,
  808. time:time,
  809. // disable: parseInt(time) < this.yearMonthData.presentDate?true:(curMonth !== month),
  810. disable: curMonth !== month,
  811. expire:parseInt(time) < this.yearMonthData.presentDate ? true : false,
  812. checkType:false,
  813. subSum:0,
  814. userSum:0,
  815. });
  816. begin += oneDayMS;
  817. }
  818. return obj;
  819. },
  820. //计算当前是周几
  821. calculationWeeks(year, curMonth, date){
  822. let now = new Date(this.stringify(year, curMonth, date));
  823. let day = now.getDay();
  824. let weeks = new Array(
  825. "7",
  826. "1",
  827. "2",
  828. "3",
  829. "4",
  830. "5",
  831. "6"
  832. );
  833. return weeks[day];
  834. },
  835. // 格式化时间
  836. stringify(year, month, date) {
  837. return [year, this.pad(month + 1), this.pad(date)].join("-");
  838. },
  839. // 对小于 10 的数字,前面补 0
  840. pad(str) {
  841. return str < 10 ? `0${str}` : str;
  842. },
  843. // 当前月的第一天是星期几
  844. getFirstDayByMonths(year, month) {
  845. return new Date(year, month, 1).getDay();
  846. },
  847. // 当前月的最后一天是星期几
  848. getLastDayByMonth(year, month) {
  849. return new Date(year, month + 1, 0).getDay();
  850. },
  851. }
  852. }
  853. </script>
  854. <style scoped lang="scss">
  855. .onDutyConfiguration{
  856. display: flex;
  857. flex-direction: column;
  858. font-weight:500;
  859. *{
  860. margin:0;
  861. padding:0;
  862. }
  863. .onDutyConfigurationPage{
  864. flex:1;
  865. display: flex;
  866. overflow: hidden;
  867. .left-page-max-big-box{
  868. width:250px;
  869. overflow: hidden;
  870. display: flex;
  871. flex-direction: column;
  872. padding:36px 0 36px 10px;
  873. .tree-box {
  874. flex: 1;
  875. .terr-max-box:nth-child(1){
  876. margin:0;
  877. }
  878. .terr-max-box {
  879. margin-top: 20px;
  880. .max-name-box {
  881. display: flex;
  882. margin-right: 20px;
  883. margin-bottom: 10px;
  884. color: #D8D8D8;
  885. font-size: 20px;
  886. .max-name {
  887. flex: 1;
  888. margin-right: 19px;
  889. color: #333;
  890. font-size: 16px;
  891. line-height: 16px;
  892. margin-top: 3px;
  893. cursor: pointer;
  894. overflow: hidden;
  895. }
  896. }
  897. .terr-big-box {
  898. margin-left: 30px;
  899. .big-name-box {
  900. cursor: pointer;
  901. height: 40px;
  902. line-height: 40px;
  903. display: flex;
  904. font-size: 16px;
  905. color: #333;
  906. img {
  907. width: 16px;
  908. height: 16px;
  909. margin-top: 12px;
  910. margin-right: 4px;
  911. }
  912. .name-p {
  913. flex: 1;
  914. overflow: hidden;
  915. }
  916. }
  917. .terr-min-box {
  918. margin-left: 30px;
  919. .min-name {
  920. cursor: pointer;
  921. height: 40px;
  922. line-height: 40px;
  923. display: flex;
  924. font-size: 16px;
  925. color: #333;
  926. overflow: hidden;
  927. }
  928. }
  929. }
  930. .check-color {
  931. color: #0183FA !important;
  932. }
  933. }
  934. }
  935. .tree-null-p {
  936. text-align: center;
  937. line-height: 100px;
  938. flex: 1;
  939. color: #999;
  940. }
  941. }
  942. .center-border-p{
  943. border-right:1px dashed #A2A2A2;
  944. margin:36px 35px 36px 0;
  945. }
  946. .right-page-max-big-box{
  947. flex:1;
  948. display: flex;
  949. flex-direction: column;
  950. overflow: hidden;
  951. -webkit-user-select: none;
  952. -moz-user-select: none;
  953. -ms-user-select: none;
  954. user-select: none;
  955. .top-button-max-box{
  956. height:87px;
  957. padding:21px 0 26px 0;
  958. display: flex;
  959. border-bottom:1px solid #E0E0E0;
  960. font-size:14px;
  961. .yearMonthButtonBox{
  962. width:200px;
  963. height:40px;
  964. display: flex;
  965. p{
  966. text-align: center;
  967. line-height:38px;
  968. width:100px;
  969. cursor: pointer;
  970. }
  971. p:nth-child(1){
  972. border-top-left-radius: 4px;
  973. border-bottom-left-radius: 4px;
  974. }
  975. p:nth-child(2){
  976. border-top-right-radius: 4px;
  977. border-bottom-right-radius: 4px;
  978. }
  979. .left-button-one{
  980. background: #0183FA;
  981. border:1px solid #0183FA;
  982. color:#fff;
  983. }
  984. .left-button-tow{
  985. color:#333333;
  986. border:1px solid #E0E0E0;
  987. border-right:none;
  988. }
  989. .right-button-one{
  990. background: #0183FA;
  991. border:1px solid #0183FA;
  992. color:#fff;
  993. }
  994. .right-button-tow{
  995. color:#333333;
  996. border:1px solid #E0E0E0;
  997. border-left:none;
  998. }
  999. }
  1000. .year-month-data-button-box{
  1001. display: flex;
  1002. margin:0 33px 0 39px;
  1003. p{
  1004. line-height:38px;
  1005. text-align: center;
  1006. }
  1007. .year-month-subtract-button{
  1008. border:1px solid #E0E0E0;
  1009. border-top-left-radius: 4px;
  1010. border-bottom-left-radius: 4px;
  1011. width:38px;
  1012. cursor: pointer;
  1013. }
  1014. .year-month-text-p{
  1015. border-top:1px solid #E0E0E0;
  1016. border-bottom:1px solid #E0E0E0;
  1017. width:150px;
  1018. }
  1019. .year-month-add-button{
  1020. border:1px solid #E0E0E0;
  1021. border-top-right-radius: 4px;
  1022. border-bottom-right-radius: 4px;
  1023. width:38px;
  1024. cursor: pointer;
  1025. }
  1026. }
  1027. .return-year-month-button{
  1028. width:100px;
  1029. height:40px;
  1030. line-height:38px;
  1031. }
  1032. .flex-p{
  1033. flex:1;
  1034. }
  1035. .all-button{
  1036. width:80px;
  1037. height:40px;
  1038. margin-right:8px;
  1039. line-height:38px;
  1040. }
  1041. .add-button{
  1042. width:80px;
  1043. height:40px;
  1044. margin-right:23px;
  1045. line-height:38px;
  1046. }
  1047. }
  1048. .month-max-big-box{
  1049. -webkit-user-select: none;
  1050. -moz-user-select: none;
  1051. -ms-user-select: none;
  1052. user-select: none;
  1053. flex:1;
  1054. padding:10px 0 30px;
  1055. .month-week-box{
  1056. display: flex;
  1057. overflow: hidden;
  1058. font-size:0;
  1059. .for-week-box{
  1060. font-size:14px;
  1061. width:180px;
  1062. text-align: center;
  1063. line-height:60px;
  1064. border-bottom:1px solid #E0E0E0;
  1065. }
  1066. }
  1067. .month-big-box{
  1068. border-left:1px solid #E0E0E0;
  1069. font-size:0;
  1070. .for-month-max-big-box{
  1071. overflow: hidden;
  1072. font-size:16px;
  1073. width:180px;
  1074. height:110px;
  1075. display: inline-block;
  1076. border-right:1px solid #E0E0E0;
  1077. border-bottom:1px solid #E0E0E0;
  1078. position: relative;
  1079. .for-month-top-big-box{
  1080. width:180px;
  1081. height:50px;
  1082. line-height:50px;
  1083. text-align: center;
  1084. font-size:16px;
  1085. color:#333;
  1086. }
  1087. .for-month-top-big-box-color{
  1088. color:#E0E0E0;
  1089. }
  1090. .for-month-bottom-big-box{
  1091. height:60px;
  1092. background: rgba(1,131,250,0.2);
  1093. color:#0183FA;
  1094. display: flex;
  1095. cursor: pointer;
  1096. .for-month-bottom-left-min-box{
  1097. flex: 1;
  1098. font-size:14px;
  1099. padding:10px 0 0 10px;
  1100. p{
  1101. line-height:20px;
  1102. }
  1103. }
  1104. .for-month-bottom-right-min-box{
  1105. width:24px;
  1106. text-align: center;
  1107. line-height:60px;
  1108. font-size:12px;
  1109. font-weight:900;
  1110. }
  1111. }
  1112. .position-img-box{
  1113. position: absolute;
  1114. left:0;
  1115. top:0;
  1116. width:50px;
  1117. height:50px;
  1118. img{
  1119. width:14px;
  1120. height:14px;
  1121. margin: 18px;
  1122. }
  1123. }
  1124. }
  1125. }
  1126. }
  1127. .year-max-big-box{
  1128. flex:1;
  1129. padding:30px 0;
  1130. .for-year-max-big-box{
  1131. vertical-align:top;
  1132. width:596px;
  1133. display: inline-block;
  1134. margin:0 42px 40px 0;
  1135. overflow: hidden;
  1136. .year-name-p{
  1137. text-align: center;
  1138. font-size:16px;
  1139. background: #CCE6FE;
  1140. color:#0183FA;
  1141. line-height:40px;
  1142. border-top-left-radius:4px;
  1143. border-top-right-radius:4px;
  1144. }
  1145. .year-week-box{
  1146. overflow: hidden;
  1147. font-size:0;
  1148. background: rgba(224,224,224,0.2);
  1149. .for-week-box{
  1150. width:85px;
  1151. line-height:40px;
  1152. text-align: center;
  1153. display: inline-block;
  1154. font-size:12px;
  1155. }
  1156. }
  1157. .year-big-box{
  1158. border-top:1px solid #E0E0E0;
  1159. border-left:1px solid #E0E0E0;
  1160. overflow: hidden;
  1161. font-size:0;
  1162. .for-year-big-box{
  1163. display: inline-block;
  1164. overflow: hidden;
  1165. width:85px;
  1166. height:60px;
  1167. border-right:1px solid #E0E0E0;
  1168. border-bottom:1px solid #E0E0E0;
  1169. position: relative;
  1170. .for-year-top-big-box{
  1171. flex:1;
  1172. font-size:12px;
  1173. color:#333;
  1174. line-height:30px;
  1175. text-align: center;
  1176. }
  1177. .for-year-top-big-box-color{
  1178. color:#E0E0E0;
  1179. }
  1180. .for-year-bottom-big-box{
  1181. line-height:30px;
  1182. font-size:14px;
  1183. text-align: center;
  1184. background: #CCE6FE;
  1185. color:#0183FA;
  1186. cursor: pointer;
  1187. }
  1188. .position-img-box{
  1189. position: absolute;
  1190. top:0;
  1191. left:0;
  1192. width:30px;
  1193. height:30px;
  1194. img{
  1195. width:14px;
  1196. height:14px;
  1197. margin:8px;
  1198. }
  1199. }
  1200. }
  1201. }
  1202. }
  1203. }
  1204. .for-pointer{
  1205. cursor: pointer;
  1206. }
  1207. }
  1208. }
  1209. }
  1210. </style>
  1211. <style lang="scss">
  1212. #onDutyConfiguration-dialog-box{
  1213. .top-title-select-box{
  1214. display: flex;
  1215. border-bottom: 1px dashed #D8D8D8;
  1216. .top-title-num-box{
  1217. display: flex;
  1218. margin-left:30px;
  1219. p{
  1220. font-size:14px;
  1221. line-height: 40px;
  1222. color:#333;
  1223. margin-right:10px;
  1224. }
  1225. p:nth-child(2){
  1226. width:250px;
  1227. height:40px;
  1228. background: #F5F5F5;
  1229. padding-left:22px;
  1230. border-radius:4px;
  1231. }
  1232. }
  1233. }
  1234. .bottom-dialog-max-big-box{
  1235. display: flex;
  1236. width:1460px;
  1237. height:430px;
  1238. .bottom-dialog-left-max-big-box{
  1239. width:920px;
  1240. height:430px;
  1241. overflow: hidden;
  1242. display: flex;
  1243. flex-direction: column;
  1244. padding-right:47px;
  1245. .bottom-dialog-left-title-p{
  1246. line-height:72px;
  1247. color:#043581;
  1248. font-size:18px;
  1249. }
  1250. .bottom-dialog-left-big-box{
  1251. overflow: hidden;
  1252. flex:1;
  1253. display: flex;
  1254. flex-direction: column;
  1255. padding-left:30px;
  1256. }
  1257. .no-check-button{
  1258. color:#666!important;
  1259. }
  1260. }
  1261. .bottom-dialog-right-max-big-box{
  1262. margin-top:30px;
  1263. width:540px;
  1264. height:400px;
  1265. border-left: 1px dashed #D8D8D8;
  1266. display: flex;
  1267. flex-direction: column;
  1268. overflow: hidden;
  1269. .bottom-dialog-right-title-p{
  1270. height:40px;
  1271. line-height:40px;
  1272. margin-left:47px;
  1273. width:445px;
  1274. background: rgba(1,131,250,0.1);
  1275. color: #0183FA;
  1276. font-size:16px;
  1277. padding-left:19px;
  1278. }
  1279. .bottom-dialog-right-for-max-box{
  1280. height:360px;
  1281. .bottom-dialog-right-for-box{
  1282. display: flex;
  1283. width:445px;
  1284. margin-left:47px;
  1285. p:nth-child(1){
  1286. font-size:14px;
  1287. line-height:40px;
  1288. padding-left:19px;
  1289. overflow: hidden;
  1290. flex:1;
  1291. }
  1292. p:nth-child(2){
  1293. width:40px;
  1294. margin-right:20px;
  1295. line-height:40px;
  1296. text-align: center;
  1297. font-size:14px;
  1298. color:#666;
  1299. cursor: pointer;
  1300. }
  1301. }
  1302. }
  1303. }
  1304. }
  1305. }
  1306. .onDutyConfiguration{
  1307. .el-tree-node__label{
  1308. font-size:16px;
  1309. }
  1310. .el-tree-node__content{
  1311. height:30px;
  1312. line-height: 30px;
  1313. }
  1314. .el-tree-node__expand-icon{
  1315. color:#333;
  1316. font-size:16px;
  1317. padding:0;
  1318. margin-right:3px;
  1319. }
  1320. .el-tree-node__expand-icon.is-leaf{
  1321. color: transparent;
  1322. }
  1323. .el-tree--highlight-current .el-tree-node.is-current > .el-tree-node__content{
  1324. background-color:#ffffff;
  1325. color:#0183FA;
  1326. }
  1327. }
  1328. </style>