index.vue 42 KB

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