From 5d36d46434a7f4d23844dc94c34e7716eae172a8 Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期三, 24 四月 2024 11:43:02 +0800
Subject: [PATCH] 员工信息 员工编号调整为不可修改

---
 src/api/employeeSalary/salaryPlan.js                                                     |   42 ++++++++++
 src/views/employeeSalary/salaryPlan/index.vue                                            |   94 +++++++++++++++++++----
 src/views/employeeManage/employeeInfo/components/AddEmployee.vue                         |    4 
 src/views/employeeSalary/attendanceStatistics/components/AttendanceStatisticsDetails.vue |   20 +++-
 src/views/employeeSalary/salaryPlan/components/addDialog.vue                             |   52 +++----------
 5 files changed, 147 insertions(+), 65 deletions(-)

diff --git a/src/api/employeeSalary/salaryPlan.js b/src/api/employeeSalary/salaryPlan.js
new file mode 100644
index 0000000..0754228
--- /dev/null
+++ b/src/api/employeeSalary/salaryPlan.js
@@ -0,0 +1,42 @@
+import request from "@/common/untils/request.js"
+
+// 钖祫鏂规鍒楄〃
+export function getSalaryPlanList(data) {
+  return request({
+    url: "/api-jl/v1/salary/getSalaryPlanList",
+    method: "post",
+    data
+  })
+}
+// 鍒犻櫎钖祫鏂规
+export function deleteSalaryPlanInfo(data) {
+  return request({
+    url: "/api-jl/v1/salary/deleteSalaryPlanInfo/"+data.id,
+    method: "delete",
+    data
+  })
+}
+//鑾峰彇钖祫绫诲瀷
+export function getSalaryTypeList(data) {
+  return request({
+    url: "/api-jl/v1/salary/getSalaryTypeList/"+data.number,
+    method: "get",
+    data
+  })
+}
+// 淇濆瓨钖祫绫诲瀷
+export function saveSalaryType(data) {
+  return request({
+    url: "/api-jl/v1/salary/saveSalaryType",
+    method: "post",
+    data
+  })
+}
+// 淇濆瓨钖祫鏂规
+export function saveSalaryPlan(data) {
+  return request({
+    url: "/api-jl/v1/salary/saveSalaryPlan",
+    method: "post",
+    data
+  })
+}
\ No newline at end of file
diff --git a/src/views/employeeManage/employeeInfo/components/AddEmployee.vue b/src/views/employeeManage/employeeInfo/components/AddEmployee.vue
index 7980c3a..4b00518 100644
--- a/src/views/employeeManage/employeeInfo/components/AddEmployee.vue
+++ b/src/views/employeeManage/employeeInfo/components/AddEmployee.vue
@@ -4,8 +4,8 @@
     <div slot="title" class="tac drawerHeader">{{ editRow.title }}浜哄憳</div>
     <div class="dialog-content-box">
       <el-form class="form-box" ref="form" :rules="rules" :model="form" label-width="120px" label-position="right">
-        <el-form-item label="鍛樺伐缂栫爜锛�" prop="id">
-          <el-input v-model="form.id" placeholder="璇疯緭鍏�"></el-input>
+        <el-form-item label="鍛樺伐缂栫爜锛�" prop="id" >
+          <el-input v-model="form.id" placeholder="璇疯緭鍏�" :disabled="editRow.title=='缂栬緫'?true:false"></el-input>
         </el-form-item>
         <el-form-item label="浜哄憳濮撳悕锛�" prop="name">
           <el-input v-model="form.name" placeholder="璇疯緭鍏�"></el-input>
diff --git a/src/views/employeeSalary/attendanceStatistics/components/AttendanceStatisticsDetails.vue b/src/views/employeeSalary/attendanceStatistics/components/AttendanceStatisticsDetails.vue
index 0e4ac96..40e89bd 100644
--- a/src/views/employeeSalary/attendanceStatistics/components/AttendanceStatisticsDetails.vue
+++ b/src/views/employeeSalary/attendanceStatistics/components/AttendanceStatisticsDetails.vue
@@ -29,7 +29,7 @@
             <el-option v-for="item in attendanceStatusList" :key="item.id" :label="item.value" :value="item.id">
             </el-option>
           </el-select>
-              <el-button type="text" @click="submitEditOneClick('form')">纭畾</el-button>
+              <el-button type="text" :loading="isAddloadingOne"  @click="submitEditOneClick('form')">纭畾</el-button>
               <el-button type="text" @click="cancelEditClick('isEditOne')">鍙栨秷</el-button>
           </template>
         </el-form-item>
@@ -62,7 +62,7 @@
                 placeholder="璇疯緭鍏�"
                 class="margin_right_15px"
               ></el-input>
-              <el-button type="text" @click="submitEditTwoClick('form')">纭畾</el-button>
+              <el-button type="text" :loading="isAddloadingTwo" @click="submitEditTwoClick('form')">纭畾</el-button>
               <el-button type="text" @click="cancelEditClick('isEditTwo')">鍙栨秷</el-button>
           </template>
         </el-form-item>
@@ -108,6 +108,8 @@
           },
         ],
       },
+      isAddloadingOne:false,
+      isAddloadingTwo:false,
     };
   },
   created() {
@@ -152,13 +154,13 @@
       this.isEditOne=true
     },
     submitEditOneClick(){
-      this.submitForm('form','isEditOne')
+      this.submitForm('form','isEditOne','isAddloadingOne')
     },
     editTwoClick(){
       this.isEditTwo=true
     },
     submitEditTwoClick(){
-      this.submitForm('form','isEditTwo')
+      this.submitForm('form','isEditTwo','isAddloadingTwo')
     },
     formInfo() {
       if (this.islook) {
@@ -198,7 +200,7 @@
       this.islook = false;
       this.$emit('shutdown')
     },
-    submitForm(formName,name) {
+    submitForm(formName,name,loading) {
       this.$refs[formName].validate((valid) => {
         if (valid) {
           let form = JSON.parse(JSON.stringify(this.form));
@@ -216,6 +218,7 @@
             workTypeId:form.workTypeId,
             workerName:form.workerName,
           }
+            this[loading]=true
             updateAttendance(params).then((res) => {
               if (res.code == 200) {
                 this.$message({
@@ -225,7 +228,12 @@
                 this[name]=false
                 this.cancelMethod();
               }
-            });
+              this[loading]=false
+            }).catch(() => {
+             setTimeout(() => {
+              this[loading]=false
+                }, 2000);
+          });
         } else {
           console.log('error submit!!');
           return false;
diff --git a/src/views/employeeSalary/salaryPlan/components/addDialog.vue b/src/views/employeeSalary/salaryPlan/components/addDialog.vue
index 0959c77..45899f7 100644
--- a/src/views/employeeSalary/salaryPlan/components/addDialog.vue
+++ b/src/views/employeeSalary/salaryPlan/components/addDialog.vue
@@ -1,15 +1,15 @@
 <template>
   <div class="add_wordshop">
-    <el-dialog :title="editConfig.dialogTitle + '杞﹂棿绠$悊'" :visible.sync="editConfig.visible" width="30%"
+    <el-dialog :title="form.title + '钖祫鏂规'" :visible.sync="islook" width="30%"
       :before-close="handleClose">
-      <el-form :inline="true" label-width="20%" style="width: 100%;" :model="editConfig.infomitton" :rules="rules"
-        ref="ruleForm">
+      <el-form label-width="120px" style="width: 100%;" :model="form" :rules="rules"
+        ref="form">
         <el-form-item label="鏂规鍚嶇О" style="width: 100%;" prop="groupNumber">
-          <el-input v-model="editConfig.infomitton.workshop" placeholder="璇疯緭鍏ュ唴瀹�"></el-input>
+          <el-input v-model="form.workshop" placeholder="璇疯緭鍏ュ唴瀹�"></el-input>
         </el-form-item>
         <el-form-item prop="workshop"  label="宸ョ" style="width: 100%;" >
           <el-select 
-            :disabled="this.editConfig.dialogTitle==='鏌ョ湅'" v-model="editConfig.infomitton.workshop" value-key="name" placeholder="璇烽�夋嫨杞﹂棿">
+             v-model="form.workshop" value-key="name" placeholder="璇烽�夋嫨杞﹂棿">
             <el-option
               v-for="item in workshopList"
               :key="item.ID"
@@ -20,7 +20,7 @@
         </el-form-item>
         <el-form-item prop="workshop"  label="钖祫绫诲瀷" style="width: 100%;" >
           <el-select 
-            :disabled="this.editConfig.dialogTitle==='鏌ョ湅'" v-model="editConfig.infomitton.groupNumber" value-key="name" placeholder="璇烽�夋嫨杞﹂棿">
+            v-model="form.groupNumber" value-key="name" placeholder="璇烽�夋嫨杞﹂棿">
             <el-option
               v-for="item in workshopList"
               :key="item.ID"
@@ -34,13 +34,13 @@
             type="textarea"
             :autosize="{ minRows: 2, maxRows: 4}"
             placeholder="璇疯緭鍏ュ唴瀹�"
-            v-model="editConfig.infomitton.workshop">
+            v-model="form.workshop">
           </el-input>
         </el-form-item>
       </el-form>
       <span slot="footer" class="dialog-footer">
-        <el-button @click="editConfig.visible = false">鍙� 娑�</el-button>
-        <el-button type="primary" @click="commitForm('ruleForm')">纭� 瀹�</el-button>
+        <el-button type="cancel" @click="cancelMethod()">鍙栨秷</el-button>
+        <el-button type="primary" @click="commitForm('form')">纭� 瀹�</el-button>
       </span>
     </el-dialog>
   </div>
@@ -50,25 +50,14 @@
 // import {} from "@/api/systemSetting/workshopManage"
 export default {
   props: {
-    editDiaConfig: {
+    editRow: {
       type: Object,
-      default: () => {
-        return {
-          visible: false,
-          dialogTitle: "娣诲姞",
-          isReadonly: true,
-          infomitton: {
-          },
-        }
-      }
     }
   },
   data() {
     return {
-      editConfig: this.editDiaConfig,
+      form: {},
       workshopList: [],
-      carFlagList: [
-      ],
       rules: {
         workshopNumber: [
           { required: true, message: '璇烽�夋嫨杞﹂棿', trigger: 'change' }
@@ -90,21 +79,7 @@
 
   },
   methods: {
-    handleClose(done) {
-      done();
-    },
-    setParams() {
-      let params = {
-        workshopNumber: this.editConfig.infomitton.workshopNumber + '',
-        groupNumber: Number(this.editConfig.infomitton.groupNumber),
-        startCarNumber: Number(this.editConfig.infomitton.startCarNumber),
-        endCarNumber: Number(this.editConfig.infomitton.endCarNumber),
-        carFlag: Number(this.editConfig.infomitton.carFlag),
-        notes: this.editConfig.infomitton.notes,
-        // id:Number(this.editConfig.infomitton.workshopId),
-      }
-      return params
-    },
+    
     async commitForm(formName) {
       this.$refs[formName].validate((valid) => {
         if (valid) {
@@ -117,9 +92,6 @@
 
 
     }
-  },
-  components: {
-
   },
 };
 </script>
diff --git a/src/views/employeeSalary/salaryPlan/index.vue b/src/views/employeeSalary/salaryPlan/index.vue
index 3dbae58..df91ded 100644
--- a/src/views/employeeSalary/salaryPlan/index.vue
+++ b/src/views/employeeSalary/salaryPlan/index.vue
@@ -17,9 +17,8 @@
           <template slot="tableButton">
             <el-table-column label="鎿嶄綔" width="180">
               <template slot-scope="scope">
-                <el-button @click.stop="handleClick(scope.row, '鏌ョ湅')" type="text" size="small">鏌ョ湅</el-button>
-                <el-button @click.stop="handleClick(scope.row, '淇敼')" type="text" size="small">淇敼</el-button>
-                <el-button @click.stop="handleClick(scope.row, '鍒犻櫎')" type="text" size="small">鍒犻櫎</el-button>
+                <el-button @click.stop="handleClick(scope.row)" type="text" size="small">淇敼</el-button>
+                <el-button @click.stop="delClick(scope.row)" type="text" size="small">鍒犻櫎</el-button>
                 
               </template>
             </el-table-column>
@@ -27,7 +26,7 @@
         </TableCommonView>
       </div>
       <AddDialog 
-        :editDiaConfig="editConfig"
+      ref="add" :editRow="editRow"  @refresh="refresh" 
       />
       <div class="btn-pager">
         <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
@@ -39,6 +38,7 @@
 <script>
 import AddDialog from "@/views/employeeSalary/salaryPlan/components/addDialog.vue"
 import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
+import { getSalaryPlanList, deleteSalaryPlanInfo } from  "@/api/employeeSalary/salaryPlan.js"
 export default {
   name: "salaryPlan",
   props: {},
@@ -55,24 +55,17 @@
         { label: "宸ョ", prop: "groupNumber",min:100 },
         { label: "钖祫绫诲瀷", prop: "startCarNumber",min:110 },
         { label: "璁¤垂鍛ㄦ湡", prop: "endCarNumber",min:110 },
-        { label: "璁¤垂鍏紡瀹氫箟", prop: "carFlag", },
+        { label: "璁¤垂鍏紡瀹氫箟", prop: "carFlag",min:140  },
         { label: "娣诲姞鏃堕棿", prop: "notes",min:130 },
         { label: "娣诲姞浜�", prop: "notes",min:110 },
       ],
-      editConfig:{
-        visible:false,
-        infomitton:{
-          TabsIndex:0,
-          workshopId:null,
-        }
-      },
-      getDataParams: {
-        keyWord: '',
-      },
+      keyword: '',
+      editRow:{},
     }
   },
   created() {
     this.setTable()
+    this.getData(this.keyword)
   },
   methods: {
     setTable() {
@@ -107,6 +100,34 @@
       this.showcol = val
       this.tableList.tableColumn = this.setColumnVisible(val, this.tableColumn)
     },
+    // 璇锋眰鏁版嵁
+    async getData() {
+      this.loading = true
+      await getSalaryPlanList({
+        keyword: this.keyword,
+        page: this.pagerOptions.currPage,
+        pageSize: this.pagerOptions.pageSize
+      })
+        .then((res) => {
+          if (res.code === 200) {
+            if (res.data) {
+              const list = res.data
+              this.tableList.tableInfomation = list || []
+              this.pagerOptions.totalCount = res.total
+            } else {
+              this.tableList.tableInfomation = []
+            }
+          } else {
+            this.tableList.tableInfomation = []
+          }
+          this.loading = false
+        })
+        .catch((err) => {
+          console.log(err)
+          this.tableList.tableInfomation = []
+          this.loading = false
+        })
+    },
     // 鏂板
     addBtnClick() {
       this.editConfig.infomitton={}
@@ -115,13 +136,52 @@
     },
     // 鎼滅储
     onFilterSearch(searchText) {
-      this.getDataParams.keyWord = searchText,
-        this.getData()
+      this.keyword= searchText,
+      this.pagerOptions.currPage = 1
+      this.getData()
+    },
+    refresh(){
+      this.getData()
     },
     // 琛ㄦ牸琛岀偣鍑�
     tableRowClick(row) {
       console.log(row, "row")
     },
+    // 缂栬緫
+    handleClick(row) {
+      let config=JSON.parse(JSON.stringify(row));
+      this.editRow = { ...config, 
+        title:'缂栬緫',
+        type:'edit',
+        shopNameObj:{
+          value:config.shopId,
+          label:config.shopName,
+        },
+        workTypeObj:{
+          value:config.workTypeId,
+          label:config.workType,
+        } 
+      }
+      this.$refs.add.islook = true;
+    },
+    // 鍒犻櫎
+    delClick(row) {
+      this.$confirm("鏄惁纭鍒犻櫎?", "璀﹀憡", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning"
+      })
+        .then(() => {
+          deleteSalaryPlanInfo({ id: row.id }).then((response) => {
+            if (response.code === 200) {
+              this.$message.success("鍒犻櫎鎴愬姛")
+              this.getData()
+            }
+          })
+        })
+        .catch(() => {})
+    },
+
   }
 }
 </script>

--
Gitblit v1.8.0