zhuzhuanzhuan
2023-09-01 75a67621878b019bff8743a325da1c00f3e1a2c7
加班管理
已修改3个文件
185 ■■■■ 文件已修改
src/views/mdc/base/modules/OvertimeManagement/OvertimeManagementList.vue 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/modules/OvertimeManagement/OvertimeManagementModal.vue 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/modules/OvertimeManagement/OvertimeManagementModalEdit.vue 157 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/modules/OvertimeManagement/OvertimeManagementList.vue
@@ -35,11 +35,11 @@
    <div class="table-operator" style="display: inline;">
      <a-button @click="handleAdd" type="primary" icon="plus">新增
      </a-button>
      <a-button type="primary" icon="download" @click="importTemplate('加班管理模板')">导入模板</a-button>
      <!--<a-button type="primary" icon="download" @click="importTemplate('加班管理模板')">导入模板</a-button>-->
      <a-button type="primary" icon="download" @click="handleExportXls('加班管理')">导出</a-button>
      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
      <!--<a-button type="primary" icon="import">导入</a-button>-->
      </a-upload>
      <!--<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">-->
      <!--&lt;!&ndash;<a-button type="primary" icon="import">导入</a-button>&ndash;&gt;-->
      <!--</a-upload>-->
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
          <a-menu-item key="1" @click="batchDel">
@@ -569,7 +569,7 @@
            //重新计算分页问题
            that.reCalculatePage(1)
            // that.$message.success(res.message);
            that.$notification.warning({
            that.$notification.success({
              message:'消息',
              description:res.message
            });
@@ -611,7 +611,7 @@
                  //重新计算分页问题
                  that.reCalculatePage(that.selectedRowKeys.length)
                  // that.$message.success(res.message);
                  that.$notification.warning({
                  that.$notification.success({
                    message:'消息',
                    description:res.message
                  });
src/views/mdc/base/modules/OvertimeManagement/OvertimeManagementModal.vue
@@ -212,6 +212,19 @@
        this.visible = false
        this.show = false
      },
      fun(obj) {
    if(obj){
      if (obj = obj.split("T")) {
        var tim = obj[1];
        if(tim = tim.split(".")){
          var tim0 = tim[0];
        }
        var dd = tim0
        return dd;
      }
    }
  },
      handleOk() {
        const that = this
        // 触发表单验证
@@ -237,7 +250,10 @@
                that.confirmLoading = false
              }else{
                let obj
                if (!this.model.id) {
                  formData.startTime = this.fun(JSON.stringify(formData.startTime));
                  formData.endTime = this.fun(JSON.stringify(formData.endTime))
                  obj = postAction(this.url.add, formData)
                } else {
                  obj = requestPut(this.url.edit, formData, {
src/views/mdc/base/modules/OvertimeManagement/OvertimeManagementModalEdit.vue
@@ -5,9 +5,9 @@
      <a-form :form="form">
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择时间"
                      class="query-group-cust" v-decorator="['torqueDate', validatorRules.torqueDate]"></j-date>
            <a-form-item label="设备编号" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :disabled="disableSubmit" :readOnly="readOnly" allow-clear placeholder="请输入设备编号"
                       v-decorator="['equipmentId',validatorRules.equipmentId]"/>
            </a-form-item>
          </a-col>
@@ -20,22 +20,21 @@
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item label="扭矩值" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input-number :min="0" :disabled="disableSubmit" placeholder="请输入扭矩值"
                       v-decorator="['torqueValue', validatorRules.torqueValue]"/>
            <a-form-item label="加班开始时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-time-picker :disabled="disableSubmit" :readOnly="disableSubmit"  @change="changeStartTime"
                            v-decorator="['startTime',validatorRules.startTime]"/>
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item label="设备编号" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-input :disabled="disableSubmit" :readOnly="readOnly" allow-clear placeholder="请输入设备编号"
                       v-decorator="['equipmentId',validatorRules.equipmentId]"/>
            <a-form-item label="加班结束时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <a-time-picker :disabled="disableSubmit" :readOnly="disableSubmit" @change="changeEndTime"
                             v-decorator="['endTime',validatorRules.endTime]"/>
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-form-item label="备注" :labelCol="labelColLong" :wrapperCol="wrapperColLong">
            <a-textarea :maxLength="20" :disabled="disableSubmit"  v-decorator="['notes', validatorRules.notes]" placeholder="请输入备注"  ></a-textarea>
            <a-textarea :maxLength="20" :disabled="disableSubmit"  v-decorator="['remark', validatorRules.remark]" placeholder="请输入备注"  ></a-textarea>
          </a-form-item>
        </a-row>
      </a-form>
@@ -144,13 +143,28 @@
        disableSubmit: true,
        partCategoryCascade: [],
        cascadeDefaultValue: [],
        editStart:''
        editStart:'',
        endTimeSHI:'',
        startTimeSHI:'',
        startEdit:'',
        endEdit:''
      }
    },
    created() {
    },
    methods: {
      changeStartTime(data,dataStrings){
        console.log(data);
        console.log(dataStrings)
        this.startTimeSHI = dataStrings
      },
      changeEndTime(data,dataStrings){
        console.log(data);
        console.log(dataStrings)
        this.endTimeSHI = dataStrings
      },
      disabledDate(current){
        //Can not slect days before today and today
        // return current && current < moment().endOf("day");
@@ -223,19 +237,42 @@
        })
      },
      edit(record) {
        console.log(record)
        // record.endTime = moment(record.endTime).format("HH:mm:ss")
        this.startEdit = record.startTime;
        this.endEdit = record.endTime
        this.form.resetFields()
        this.model = Object.assign({}, record)
        // this.editStart  = (this.model.startTime).replace(/:/g,'');
        this.visible = true
        this.$nextTick(() => {
          this.form.setFieldsValue(pick(this.model,'equipmentId', 'equipmentName','torqueDate', 'torqueValue','notes'
          this.form.setFieldsValue(pick(this.model,'equipmentId', 'equipmentName','startTime', 'endTime','remark'
          ))
          this.form.setFieldsValue({
            startTime: moment(this.model.startTime, 'HH:mm:ss'),
            endTime: moment(this.model.endTime, 'HH:mm:ss')
          })
          // console.log(this.model)
        })
      },
      close() {
        this.$emit('close')
        this.visible = false
        this.show = false
      },
      fun(obj) {
        if(obj){
          if (obj = obj.split("T")) {
            var tim = obj[1];
            if(tim = tim.split(".")){
              var tim0 = tim[0];
            }
            var dd = tim0
            return dd;
          }
        }
      },
      handleOk() {
        const that = this
@@ -244,35 +281,75 @@
          if (!err) {
            that.confirmLoading = true
            let formData = Object.assign(this.model, values)
            let obj
            if (!this.model.id) {
              obj = postAction(this.url.add, formData)
            } else {
              obj = requestPut(this.url.edit, formData, {
                id: this.model.id
            if(this.startTimeSHI != ''){
              formData.startTime = this.startTimeSHI
            }else{
              formData.startTime = this.startEdit
            }
            if(this.endTimeSHI != ''){
              formData.endTime = this.endTimeSHI
            }else{
              formData.endTime = this.endEdit
            }
            console.log(formData)
            // let start = moment(formData.startTime).format('HH:mm:ss');
            // let end = moment(formData.endTime).format('HH:mm:ss');
            let startOne = formData.startTime.replace(/:/g,'');
            let endOne = formData.endTime.replace(/:/g,'');
            // var data = new Date();
            // let stertDate = moment(data).format("HH:mm:ss");
            // let dataStart = stertDate.replace(/:/g,'');
            // if(startOne < dataStart){
            //   that.$message.warning("开始时间不能小于当前时间")
            //   that.confirmLoading = false
            // }else{
            // if(startOne>=endOne){
            //   that.$message.warning("结束时间不能小于开始时间");
            //   // console.log(this.model)
            //   // this.endTime = ''
            //   that.confirmLoading = false
            // }
            // else{
              let obj
              if (!this.model.id) {
                formData.startTime = this.fun(JSON.stringify(formData.startTime));
                formData.endTime = this.fun(JSON.stringify(formData.endTime))
                obj = postAction(this.url.add, formData)
              } else {
                console.log(1111)
                // formData.startTime = this.fun(JSON.stringify(formData.startTime));
                // formData.endTime = this.fun(JSON.stringify(formData.endTime))
                obj = requestPut(this.url.edit, formData, {
                  id: this.model.id
                })
              }
              obj.then((res) => {
                if (res.success) {
                  // that.$message.success("添加成功")
                  that.$notification.success({
                    message:'消息',
                    description:"添加成功"
                  });
                  // that.$message.success(res.message)
                  that.$emit('ok', res.result)
                } else {
                  // that.$message.warning(res.message)
                  that.$notification.warning({
                    message:'消息',
                    description:res.message
                  });
                }
              }).finally(() => {
                that.confirmLoading = false
                that.close()
              })
            }
            obj.then((res) => {
              if (res.success) {
                // that.$message.success("修改成功")
                that.$notification.success({
                  message:'消息',
                  description:"修改成功"
                });
                // that.$message.success(res.message)
                that.$emit('ok', res.result)
              } else {
                // that.$message.warning(res.message)
                that.$notification.warning({
                  message:'消息',
                  description:res.message
                });
              }
            }).finally(() => {
              that.confirmLoading = false
              that.close()
            })
          }
          // }
          // }
        })
      },
      handleCancel() {