index.vue 42 KB

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