index.vue 41 KB

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