Prechádzať zdrojové kódy

休息时间段设置部门

cs 2 rokov pred
rodič
commit
6459fe1956

+ 56 - 3
fhKeeper/formulahousekeeper/timesheet/src/views/settings/timetype.vue

@@ -430,18 +430,28 @@
         </el-dialog>
 
         <!-- 设置休息时间段 -->
-        <el-dialog :title="$t('settingrestPeriod')" v-if="setupRestDialog" :visible.sync="setupRestDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
+        <el-dialog :title="$t('settingrestPeriod')" v-if="setupRestDialog" :visible.sync="setupRestDialog" :close-on-click-modal="false" customClass="customWidth" width="600px">
             <el-table :data="restList" highlight-current-row height="400" style="width: 100%;">
                 <el-table-column prop="id" width="60" :label="$t('headerTop.serialNumber')">
                     <template slot-scope="scope" >
                         {{scope.$index + 1}}
                     </template>
                 </el-table-column>
-                <el-table-column :label="$t('message.period')">
+                <el-table-column :label="$t('message.period')"  width="100" >
                     <template slot-scope="scope">
                         <span>{{scope.row.startTime + '-' + scope.row.endTime}}</span>
                     </template>
                 </el-table-column>
+                <el-table-column label="部门">
+                    <template slot-scope="scope">
+                        <div>
+                            <div v-if="user.userNameNeedTranslate == 1">
+                                <ww-open-data type='departmentName' :openid='scope.row.dname'></ww-open-data>
+                            </div>
+                            <div v-else>{{scope.row.dname}}</div>
+                        </div>
+                    </template>
+                </el-table-column>
                 <el-table-column :label="$t('operation')" width="150">
                     <template slot-scope="scope" >
                         <el-button size="small" type="primary" @click="setupRestEdit(scope.row)">{{ $t('bian-ji') }}</el-button>
@@ -455,6 +465,15 @@
             </div>
             <el-dialog :title="setupItemId == null ? $t('add') : $t('xiu-gai')" v-if="setupRestAppendDialog" :visible.sync="setupRestAppendDialog" :close-on-click-modal="false" customClass="customWidth" width="400px" append-to-body>
                 <el-form label-width="100px">
+                    <el-form-item label="部门" v-if="setupItemId == null">
+                        <!-- 部门筛选 -->
+                        <el-cascader v-if="user.userNameNeedTranslate != 1 && setupItemId == null" ref="deptList" :options="options" :placeholder="$t('qing-xuan-ze-bu-men')"
+                            :props="{value:'id',expandTrigger: 'hover',multiple: true }" collapse-tags :show-all-levels="false" clearable
+                            @change="changeDept()"
+                        >
+                        </el-cascader>
+                        <vueCascader :widthStr="'125'" :clearable="true" :subject="options" :radios="true" :distinction="'1'" @vueCasader="vueCasader" v-if="user.userNameNeedTranslate == 1 && setupItemId == null" :selectNameChuan="$t('qing-xuan-ze-bu-men')"></vueCascader>
+                    </el-form-item>
                     <el-form-item :label="$t('starttimes')">
                         <el-time-picker v-model="restTime.startTime" :placeholder="$t('message.Pleaseselectatime')" format="HH:mm" value-format="HH:mm" @change="timeRule(0)"></el-time-picker>
                     </el-form-item>
@@ -600,6 +619,7 @@
                 setupRestDialog: false,
                 setupRestAppendDialog: false,
                 restTime: {
+                    departmentId:[],
                     startTime: null,
                     endTime: null
                 },
@@ -622,6 +642,7 @@
 
                 searchPersonnelFlg: false,
                 searchPersonnelFlgnum: 1,
+                options: [],
             };
         },
         watch: {
@@ -645,13 +666,32 @@
             this.initTime();
             this.getCompanyTimeSetting();
             this.getRestList()
-
+            this.getDept()
             var thats = this
             setTimeout(() => {
                 // thats.$tours['myTour'].start()
             }, 1000)
         },
          methods: {
+            getDept(){
+                this.http.post('/department/list',{
+                },res => {
+                    if(res.code == 'ok'){
+                        this.options = res.data;
+                        //this.options.unshift({ label: '全选', id: 0 })
+                    }else {
+                        this.$message({
+                            message: res.msg,
+                            type: 'error'
+                        })
+                    }
+                },err => {
+                    this.$message({
+                        message: err,
+                        type: 'error'
+                    })
+                })
+            },
              myCustomNextStepCallback(currentStep) {
                 console.log(currentStep, '看看')
                 if(currentStep == '0') {    
@@ -739,6 +779,7 @@
                 this.setupRestAppendDialog = true
                 let Jitem = JSON.parse(JSON.stringify(item))
                 this.restTime = {
+                    departmentId:Jitem.departmentId,
                     startTime: Jitem.startTime,
                     endTime: Jitem.endTime
                 }
@@ -770,6 +811,10 @@
                     if(this.setupItemId != null){
                         this.restTime.id = this.setupItemId
                     }
+                    if(this.setupItemId == null && this.restTime.departmentId == null){
+                        this.$message("请选择部门")
+                        return
+                    }
                     if(this.restTime.startTime == null || this.restTime.endTime == null){
                         this.$message(this.$t('qing-xuan-ze-shi-jian-duan'))
                         return
@@ -1332,6 +1377,14 @@
                     this.getWhiteListAll()
                 }
             },
+            changeDept(value){
+                var deptIdList = this.$refs["deptList"].getCheckedNodes();
+                var deptId = [];
+                for (var i=0; i<deptIdList.length; i++) {
+                    deptId.push(deptIdList[i].data.id);
+                }
+                this.restTime.departmentId = deptId;
+            },
             clearEchartDepartment() {
                 this.searchPersonnelFlgnum = +this.searchPersonnelFlgnum +1
                 this.searchPersonnelFlg = false