From 62729d3d72ecf7d70ba8a7437a43908b73df5870 Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期一, 22 四月 2024 18:15:14 +0800
Subject: [PATCH] 带徒管理模块 列表的接口联调,字段调试+删除的接口联调+添加的接口联调+编辑的接口联调
---
src/views/employeeSalary/apprenticeshipManage/components/addDialog.vue | 202 ++++++---
src/components/common/UserSimpleSearchInput.vue | 758 +++++++++++++++++++++++++++++++++++++++
src/api/employeeSalary/apprenticeshipManage.js | 34 +
src/views/employeeSalary/apprenticeshipManage/index.vue | 116 ++++-
4 files changed, 1,001 insertions(+), 109 deletions(-)
diff --git a/src/api/employeeSalary/apprenticeshipManage.js b/src/api/employeeSalary/apprenticeshipManage.js
new file mode 100644
index 0000000..546d417
--- /dev/null
+++ b/src/api/employeeSalary/apprenticeshipManage.js
@@ -0,0 +1,34 @@
+import request from "@/common/untils/request.js"
+
+// 甯﹀緬鍒楄〃
+export function getMentorList(data) {
+ return request({
+ url: "/api-jl/v1/mentor/getMentorList",
+ method: "post",
+ data
+ })
+}
+// 鍒犻櫎甯﹀緬
+export function deleteMentorInfo(data) {
+ return request({
+ url: "/api-jl/v1/mentor/deleteMentorInfo/"+data.id,
+ method: "delete",
+ data
+ })
+}
+// 娣诲姞甯﹀緬
+export function createMentorInfo(data) {
+ return request({
+ url: "/api-jl/v1/mentor/createMentorInfo",
+ method: "post",
+ data
+ })
+}
+// 鏇存柊甯﹀緬
+export function updateMentorInfo(data) {
+ return request({
+ url: "/api-jl/v1/mentor/updateMentorInfo",
+ method: "post",
+ data
+ })
+}
\ No newline at end of file
diff --git a/src/components/common/UserSimpleSearchInput.vue b/src/components/common/UserSimpleSearchInput.vue
new file mode 100644
index 0000000..df6dc6e
--- /dev/null
+++ b/src/components/common/UserSimpleSearchInput.vue
@@ -0,0 +1,758 @@
+<!--
+ 鏂囦欢鍚嶏細UserSimpleSearchInput.vue
+ 浣滆�咃細銆堢増鏉冦��
+ 鎻忚堪锛氥�堢敤鎴风畝鏄撴悳绱nput妗嗐��
+ 淇敼浜猴細鐔婃枃
+ 淇敼鏃堕棿锛�2023/6/20 9:49
+ 淇敼鍐呭锛氥�堜慨鏀瑰唴瀹广��
+-->
+
+<template>
+ <el-select
+ v-model="selectValue"
+ ref="search-select"
+ popper-class="user-simple-search-input-popper"
+ :popper-append-to-body="true"
+ :disabled="disabled"
+ :placeholder="placeholder"
+ style="width: 100%"
+ class="user-simple-search-input"
+ @visible-change="changeSelectStatus"
+ :clearable="clearable"
+ filterable
+ :size="size"
+ @clear="selectClear"
+ >
+ <el-option :label="selectLabel" :value="selectValue">
+ <div class="container" @click="endSelect" v-loading="loading">
+ <div class="search">
+ <div :class="checkedType ? 'search-left-two' : 'search-left'">
+ <el-input
+ placeholder="鎼滅储浜у搧鍚嶇О锛岀紪鐮佺瓑鍏抽敭璇�"
+ v-model.trim="keyword"
+ maxlength="20"
+ @keyup.enter.native="updateSearchList(true)"
+ >
+ <i
+ slot="suffix"
+ class="el-input__icon el-icon-search"
+ v-prevent-re-click
+ @click="updateSearchList(true)"
+ ></i>
+ </el-input>
+ </div>
+ <div class="icon-box" v-if="checkedType">
+ <div
+ v-for="item in materialTypeList"
+ :key="item.name"
+ :class="item.isChecked ? 'icon-active icon-item' : 'icon-item'"
+ v-prevent-re-click
+ @click="imgClick(item)"
+ >
+ {{ item.name }}
+ </div>
+ </div>
+ </div>
+ <div v-if="checkedNum > 1">
+ <div class="selected-text">
+ 宸查��({{ selectedUser.length }})锛�
+ <span
+ class="user-text"
+ v-for="(user, index) in selectedUser"
+ :key="index"
+ >
+ {{ user[obj.name] }}
+ <span
+ class="iconfont ico-delete-user"
+ @click="deleteUser(user.id)"
+ ></span
+ >
+ {{ selectedUser.length > index + 1 ? "," : "" }}
+ </span>
+ </div>
+ <p class="fs12-tip" v-show="selectedUser.length == checkedNum">
+ 鎻愮ず锛氭渶澶氶�夋嫨{{ checkedNum }}浜猴紒
+ </p>
+ </div>
+ <!-- <div class="bar">
+ <span class="desc">璇烽�夋嫨浜у搧锛坽{ listData.length }}锛�</span>
+ </div> -->
+ <div class="list" element-loading-text="鎷煎懡鍔犺浇涓�">
+ <ul class="infinite-list" @scroll="loadList">
+ <div class="background_color_eee">
+ <el-row :gutter="0">
+ <el-col :span="9">
+ <div class="grid-content bg-purple">
+ <span class="name">鍛樺伐缂栫爜</span>
+ </div>
+ </el-col>
+ <el-col :span="9">
+ <div class="grid-content bg-purple">鍛樺伐鍚嶇О</div>
+ </el-col>
+ <el-col :span="6">
+ <div class="grid-content bg-purple">鎵嬫満鍙�</div>
+ </el-col>
+ </el-row>
+ </div>
+ <li class="empty" v-if="listData.length === 0">鏆傛棤鏁版嵁</li>
+ <template v-else>
+ <li
+ v-for="(user, index) in listData"
+ :key="index"
+ @click="selectUser(user)"
+ :class="selectValue == user.id ? 'highlight-color' : ''"
+ >
+ <el-row :gutter="0">
+ <el-col :span="9">
+ <div
+ class="grid-content bg-purple"
+ :title="user.id"
+ >
+ <span class="name">{{
+ user.id || "--"
+ }}</span>
+ </div>
+ </el-col>
+ <el-col :span="9">
+ <div
+ class="grid-content bg-purple"
+ :title="user[obj.name]"
+ >
+ {{
+ user[obj.name] || "--"
+ }}
+ </div>
+ </el-col>
+ <el-col :span="6">
+ <div
+ class="grid-content bg-purple"
+ :title="user.phoneNum"
+ >
+ {{ user.phoneNum || "--" }}
+ </div>
+ </el-col>
+ </el-row>
+ </li>
+ <li class="loading">{{ loading ? "鍔犺浇涓�" : "宸茬粡鍒板簳" }}</li>
+ </template>
+ </ul>
+ </div>
+ </div>
+ </el-option>
+ </el-select>
+</template>
+
+<script>
+import { getWorkerList } from "@/api/employeeManage/employeeInfo.js"
+export default {
+ name: "UserSimpleSearchInput",
+ components: {
+ },
+ props: {
+ placeholder: {
+ type: [String],
+ default: "璇烽�夋嫨",
+ },
+ disabled: {
+ type: [Boolean],
+ default: false,
+ },
+ // 鍥炴樉鍊糲ode
+ echoName: {
+ type: [String],
+ default: "",
+ },
+ // 鍥炴樉鍚嶇Оname
+ echoValue: {
+ type: [String],
+ default: "",
+ },
+ // 鍙�夋暟閲�
+ checkedNum: {
+ type: [String, Number],
+ default: 1,
+ },
+ //鍛樺伐绫诲埆 鏄惁鍦ㄨ亴
+ isWorking: {
+ type: [Boolean],
+ default: false,
+ },
+ //鍙惁娓呯┖
+ clearable: {
+ type: [Boolean],
+ default: false,
+ },
+ // 璇锋眰鎺ュ彛鐨勫弬鏁�
+ types: {
+ type: [Array],
+ default: () => ["鍗婃垚鍝�", "鎴愬搧"],
+ },
+ // 鏄惁鍙�夋嫨鎺ュ彛鍙傛暟
+ checkedType: {
+ type: [Boolean],
+ default: false,
+ },
+ // 閭d釜椤甸潰瑕佷繚瀛樼敤鎴蜂笌浜у搧绫诲瀷鍏崇郴 1=璁㈠崟绠$悊 2=璁″垝鐢熶骇 3=浜у搧Bom
+ pageType: {
+ type: [String, Number],
+ defalut: "",
+ },
+ request: {
+ type: [String, Number],
+ defalut: "",
+ },
+ size: {
+ type: [String],
+ defalut: "medium",
+ },
+ },
+ data() {
+ return {
+ // e-select缁勪欢model缁戝畾鍙橀噺锛屽崰浣嶄娇鐢�
+ selectValue: this.echoValue
+ ? this.echoValue
+ : this.echoName
+ ? this.echoName
+ : "",
+ selectLabel: "",
+ // 鎼滅储妗嗘悳绱㈣瘝
+ keyword: "",
+ // 鏌ヨ椤�
+ page: 1,
+ // 姣忛〉灞曠ず鏁伴噺
+ pageSize: 10,
+ // 鏁版嵁鎬婚噺
+ count: 0,
+ // 鎼滅储鐢ㄦ埛缁撴灉鏁扮粍
+ listData: [],
+ // 鏄惁缁撴潫閫夋嫨
+ isEndSelect: false,
+ selectedUser: [],
+ loading: true,
+ num: 0,
+ obj: {
+ name: "name",
+ id: "id",
+ },
+ materialTypeList:[],
+ arrMaterialType: [],
+ };
+ },
+ computed: {},
+ watch: {
+ echoName() {
+ this.selectValue = this.echoValue
+ ? this.echoValue
+ : this.echoName
+ ? this.echoName
+ : "";
+ this.checkMoreInit();
+ },
+ request(val) {
+ this.getName(val);
+ },
+ checkedType() {
+ this.getUserProductTypeData();
+ },
+ },
+ beforeMount() {
+ this.checkMoreInit();
+ this.getName(this.request);
+ this.num = 0;
+ this.getUserProductTypeData();
+ },
+ methods: {
+ async getUserProductTypeData() {
+ if (this.checkedType) {
+ // const res = await getUserProductType({ pageType: this.pageType });
+ // if (res.code == 200) {
+ // let string = res.data.typeName.split(",");
+ // for (let i in this.materialTypeList) {
+ // for (const item of string) {
+ // if (item == this.materialTypeList[i].name) {
+ // this.materialTypeList[i].isChecked = true;
+ // this.arrMaterialType.push(this.materialTypeList[i].name);
+ // break;
+ // } else {
+ // this.materialTypeList[i].isChecked = false;
+ // }
+ // }
+ // }
+ // }
+ }
+ },
+ getName(val) {
+ if (val == 1) {
+ this.obj = {
+ name: "name",
+ id: "id",
+ };
+ } else if (val == 2) {
+ this.obj = {
+ name: "moldName",
+ id: "id",
+ };
+ } else if (val == 3) {
+ this.obj = {
+ name: "frockName",
+ id: "id",
+ };
+ } else if (val == 4) {
+ this.obj = {
+ name: "referenceName",
+ id: "id",
+ };
+ }
+ },
+ imgClick(item) {
+ item.isChecked = !item.isChecked;
+ this.arrMaterialType = [];
+ for (const list of this.materialTypeList) {
+ if (list.isChecked) {
+ this.arrMaterialType.push(list.name);
+ }
+ }
+ this.getSaveUserData();
+ this.updateSearchList(true);
+ },
+ async getSaveUserData() {
+ // const res = await saveUserProductType({
+ // typeName: this.arrMaterialType.join(","),
+ // pageType: this.pageType,
+ // });
+ // if (res.code == 200) {
+ // this.$message.success("淇濆瓨鎴愬姛锛�");
+ // }
+ },
+ // 鏇存柊鎼滅储鍒楄〃
+ async updateSearchList(needInit = false, param = {}) {
+ let listParams;
+ // 鍒濆鍖栫敤鎴蜂俊鎭垪琛ㄥ叆鍙�
+ if (needInit) {
+ this.page = 1;
+ this.count = 0;
+ this.listData = [];
+ }
+ listParams = {
+ keyWord: this.keyword,
+ page: this.page,
+ pageSize: this.pageSize,
+ types: this.types,
+ ...param,
+ };
+ if (this.checkedType) {
+ listParams.types = this.arrMaterialType;
+ }
+
+ this.loading = true;
+ if (this.checkedType) {
+ if(listParams.types.length == 0 ){
+ // 3涓兘涓嶉�夌殑鏃跺�欐暟鎹负绌猴紝涓嶈姹傛帴鍙�
+ this.loading = false;
+ return true;
+ }
+ }
+ // 鐗╂枡
+ const res = await getWorkerList(listParams);
+ if (res && res.code == "200" && res.data) {
+ this.loading = false;
+ this.page = res.page + 1;
+ this.count = res.total;
+ if (res.data && Array.isArray(res.data)) {
+ let arr = JSON.parse(JSON.stringify(res.data));
+ this.listData = this.listData.concat(arr);
+ }
+ this.num += 1;
+ }
+
+ setTimeout(() => {
+ this.loading = false;
+ }, 10000);
+ },
+ // 鍔ㄦ�佸姞杞藉垪琛�
+ loadList(event) {
+ const { clientHeight, scrollTop, scrollHeight } = event.currentTarget;
+ // 褰撴粴鍔╰op璺濈澶т簬涓�灞忕殑璺濈锛屽姞杞戒笅涓�椤垫暟鎹�
+ if (scrollTop > scrollHeight - clientHeight * 2) {
+ // 褰搇oading鍔ㄧ敾鏈粨鏉熸椂銆佹垨鑰呭垪琛ㄦ暟鎹潯鏁板ぇ浜庢帴鍙h繑鍥炴�绘潯鏁版椂涓嶅啀璇锋眰鏁版嵁
+ if (!this.loading && this.listData.length <= this.count) {
+ this.updateSearchList();
+ }
+ }
+ },
+ // 閫夋嫨鐢ㄦ埛
+ selectUser(user) {
+ if (this.checkedNum > 1) {
+ if (this.selectedUser.length < this.checkedNum) {
+ if (this.selectValue.indexOf(user.id) == -1) {
+ this.selectedUser.push(user);
+ this.selectValue = this.selectedUser
+ .map((item) => {
+ return item.id;
+ })
+ .join(",");
+ this.selectLabel = this.selectedUser
+ .map((item) => {
+ return item[this.obj.name];
+ })
+ .join(",");
+ }
+ }
+
+ this.$emit(
+ "select-user",
+ this.selectValue,
+ this.selectLabel,
+ this.selectedUser
+ );
+ } else {
+ // 鍙樻洿閫夋嫨寮�鍏�
+ this.isEndSelect = false;
+ // 璧嬪�糴l-select缁勪欢鍊�
+ this.selectValue = user.id;
+ this.selectLabel =user[this.obj.name];
+ // 鍛婄煡鐖剁粍浠舵墍閫夌敤鎴锋暟鎹�
+ this.selectedUser = user;
+ this.$emit("select-user", { id: user.id, name: user[this.obj.name],...user });
+ }
+ },
+ deleteUser(id) {
+ for (let i = 0; i < this.selectedUser.length; i++) {
+ if (this.selectedUser[i].id == id) {
+ this.selectedUser.splice(i, 1);
+ }
+ }
+ this.selectValue = this.selectedUser
+ .map((item) => {
+ return item.id;
+ })
+ .join(",");
+ this.selectLabel = this.selectedUser
+ .map((item) => {
+ return item[this.obj.name];
+ })
+ .join(",");
+ this.$emit(
+ "select-user",
+ this.selectValue,
+ this.selectLabel,
+ this.selectedUser
+ );
+ },
+ // 澶氶�夋椂鍊�
+ checkMoreInit() {
+ if (this.checkedNum > 1 && this.echoName) {
+ this.selectedUser = [];
+ this.selectLabel = this.echoName;
+ let arr = this.echoName.split(",");
+ let arr2 = this.echoValue.split(",");
+ for (let i = 0; i < arr.length; i++) {
+ let item = { id: arr2[i] };
+ item[this.obj.name] = arr[i];
+ this.selectedUser.push(item);
+ }
+ } else {
+ if (this.echoName) {
+ this.selectedUser = [];
+ this.selectLabel = this.echoName ? this.echoName : "";
+ let item = { id: this.echoValue };
+ item[this.obj.name] = this.echoName;
+ this.selectedUser.push(item);
+ this.selectValue = this.echoValue
+ ? this.echoValue
+ : this.echoName
+ ? this.echoName
+ : "";
+ } else {
+ this.selectedUser = [];
+ this.selectLabel = "";
+ this.selectValue = "";
+ }
+ }
+ },
+ // 缁撴潫閫夋嫨銆佸叧闂脊绐�
+ endSelect(event) {
+ this.isEndSelect && event.stopPropagation();
+ },
+ // 鍙樻洿閫夋嫨鐘舵��
+ changeSelectStatus(status, value) {
+ this.isEndSelect = status;
+ // 褰搒tatus涓簍rue鏃讹紝dialog鎵撳紑锛屽垵濮嬪寲page
+ if (status) {
+ this.keyword = "";
+ if (value != "clear") {
+ this.updateSearchList(true);
+ }
+ }
+ },
+ selectClear() {
+ if (this.checkedNum > 1) {
+ this.selectValue = [];
+ this.selectLabel = [];
+ this.selectedUser = [];
+ this.$emit("select-user", this.selectValue);
+ } else {
+ this.isEndSelect = true;
+ // 璧嬪�糴l-select缁勪欢鍊�
+ this.selectValue = "";
+ this.selectLabel = "";
+ // 鍛婄煡鐖剁粍浠舵墍閫夌敤鎴锋暟鎹�
+ this.selectedUser = "";
+ this.$emit("select-user", this.selectedUser);
+ }
+ this.changeSelectStatus(true, "clear");
+ },
+ commonSelectClear() {
+ if (this.checkedNum > 1) {
+ this.selectValue = [];
+ this.selectLabel = [];
+ this.selectedUser = [];
+ this.$emit("select-user", this.selectValue);
+ } else {
+ this.isEndSelect = true;
+ // 璧嬪�糴l-select缁勪欢鍊�
+ this.selectValue = "";
+ this.selectLabel = "";
+ // 鍛婄煡鐖剁粍浠舵墍閫夌敤鎴锋暟鎹�
+ this.selectedUser = "";
+ this.$emit("select-user", this.selectedUser);
+ }
+ this.changeSelectStatus(true, "clear");
+ },
+ },
+};
+</script>
+
+<style lang="scss">
+.user-simple-search-input-popper {
+ max-width: 660px;
+ .el-scrollbar__wrap {
+ overflow-y: hidden;
+ }
+ .el-select-dropdown__wrap {
+ min-width: 660px;
+ width: 100%;
+ min-height: 370px;
+
+ .el-select-dropdown__list {
+ width: 100%;
+ height: 350px;
+ padding: 0;
+
+ & > .el-select-dropdown__item {
+ width: 100%;
+ height: 350px;
+ background-color: rgba(255, 255, 255, 1);
+ padding: 0;
+
+ & > .container {
+ width: 96%;
+ height: 100%;
+ padding: 2%;
+
+ .search {
+ margin-bottom: 5px;
+ overflow: hidden;
+ .search-left-two {
+ width: calc(100% - 175px);
+ float: left;
+ }
+ .search-left {
+ width: 100%;
+ }
+ & > .el-input {
+ & > input {
+ width: 100%;
+ height: 40px;
+ background: rgba(255, 255, 255, 1);
+ border-radius: 4px;
+ font-size: 14px;
+
+ font-weight: 400;
+ color: rgba(175, 179, 190, 1);
+ }
+
+ & > .el-input__suffix {
+ & > .el-input__suffix-inner {
+ font-size: 19px;
+ }
+
+ & > .el-icon-circle-close {
+ display: none;
+ }
+
+ &
+ > i.el-input__icon.el-input__validateIcon.el-icon-circle-check {
+ display: none;
+ }
+ }
+ }
+ }
+
+ .bar {
+ width: 100%;
+ height: 40px;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+
+ & > .desc {
+ font-size: 14px;
+
+ font-weight: 400;
+ color: rgba(102, 102, 102, 1);
+ }
+ }
+
+ .list {
+ width: 100%;
+ height: calc(100% - 50px);
+ background: rgba(250, 250, 252, 1);
+ border: 1px solid rgba(250, 250, 252, 1);
+
+ & > ul {
+ width: 100%;
+ overflow-y: auto;
+ overflow-x: hidden;
+ height: 100%;
+ div {
+ height: 40px;
+ font-size: 14px;
+ line-height: 40px;
+ font-weight: 600;
+ color: rgba(51, 51, 51, 1);
+ padding: 0 4px;
+ // background:#eee;
+ }
+ .highlight-color {
+ background: #eee;
+ }
+ }
+
+ & > ul > li {
+ width: 100%;
+ height: 40px;
+ font-size: 14px;
+ line-height: 40px;
+ font-weight: 400;
+ color: rgba(51, 51, 51, 1);
+ padding: 0 4px;
+ display: inline-block;
+ float: left;
+ &:hover {
+ background: rgba(255, 255, 255, 1);
+ }
+
+ &.empty {
+ width: 100%;
+ height: calc(100% - 80px);
+ display: flex;
+ justify-content: center;
+ align-items: center;
+
+ &:hover {
+ background-color: transparent;
+ }
+ }
+
+ &.loading {
+ width: 100%;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ }
+
+ & > .el-row > .el-col {
+ & > .grid-content {
+ line-height: 48px;
+ padding: 0 7px;
+ text-overflow: ellipsis;
+ overflow: hidden;
+ white-space: nowrap;
+ }
+
+ &:nth-of-type(1) > .grid-content {
+ display: flex;
+ align-items: center;
+ justify-content: flex-start;
+
+ & > span.name {
+ width: calc(100% - 26px - 10px);
+ margin-left: 10px;
+ text-overflow: ellipsis;
+ overflow: hidden;
+ white-space: nowrap;
+ }
+ }
+ }
+ }
+ }
+ .user-text {
+ display: inline-block;
+ line-height: 24px;
+ }
+ .ico-delete-user {
+ color: #aaa;
+ font-weight: normal;
+ font-size: 16px;
+ display: none;
+ line-height: 24px;
+ padding: 0 4px 0 2px;
+ vertical-align: middle;
+ margin-top: -2px;
+ }
+ .user-text:hover .ico-delete-user {
+ display: inline-block;
+ }
+ .fs12-tip {
+ font-size: 12px;
+ font-weight: normal;
+ line-height: 16px;
+ }
+ .selected-text {
+ white-space: normal;
+ line-height: 24px;
+ }
+ }
+ }
+ }
+ }
+}
+.icon-box {
+ float: left;
+ width: 170px;
+ margin-left: 5px;
+ height: auto;
+ overflow: hidden;
+ box-sizing: border-box;
+ margin-top: 4px;
+ .icon-item {
+ width: auto;
+ height: 32px;
+ padding: 0 5px;
+ line-height: 35px;
+ border-radius: 6px;
+ float: left;
+ margin-right: 10px;
+ margin-bottom: 5px;
+ text-align: center;
+ box-sizing: border-box;
+ cursor: pointer;
+ color: #333;
+
+ // &:hover {
+ // background: rgba(30, 120, 235, 1);
+ // color: #fff;
+ // box-sizing: border-box;
+ // }
+ &:nth-last-child(1) {
+ margin-right: 0;
+ }
+ }
+ .icon-active {
+ background: rgba(30, 120, 235, 1);
+ color: #fff;
+ box-sizing: border-box;
+ }
+}
+</style>
diff --git a/src/views/employeeSalary/apprenticeshipManage/components/addDialog.vue b/src/views/employeeSalary/apprenticeshipManage/components/addDialog.vue
index 3c65114..0cdae53 100644
--- a/src/views/employeeSalary/apprenticeshipManage/components/addDialog.vue
+++ b/src/views/employeeSalary/apprenticeshipManage/components/addDialog.vue
@@ -1,90 +1,92 @@
<template>
<div class="add_wordshop">
<el-dialog
- :title="editConfig.dialogTitle+'杞﹂棿绠$悊'"
- :visible.sync="editConfig.visible"
- width="30%"
- :before-close="handleClose">
- <el-form :inline="true" label-width="20%" style="width: 100%;" :model="editConfig.infomitton" :rules="rules" ref="ruleForm" >
- <el-form-item label="鍛樺伐缂栫爜" style="width: 100%;"
- prop="groupNumber" >
+ :visible.sync="islook"
+ width="40rem"
+ @close="cancelMethod">
+ <div slot="title" class="tac drawerHeader">{{ editRow.title }}浜哄憳</div>
+ <el-form label-position="right" label-width="120px" style="width: 100%;" :model="form" :rules="rules" ref="form" >
+ <el-form-item label="鍛樺伐濮撳悕" style="width: 100%;"
+ prop="name" >
+ <UserSimpleSearchInput
+ :echoValue="form.workerId"
+ :echoName="form.name"
+ checkedNum="1"
+ request="1"
+ :clearable="true"
+ @select-user="setFormItem($event, 'workerId', 'name')"
+ >
+ </UserSimpleSearchInput>
+ </el-form-item>
+ <el-form-item label="鍛樺伐缂栧彿" style="width: 100%;" prop="workerId" >
<el-input
- :disabled="this.editConfig.dialogTitle==='鏌ョ湅'"
- v-model="editConfig.infomitton.groupNumber"
- :rows="4"
- style="resize: none !important;"
- placeholder="璇疯緭鍏ュ憳宸ョ紪鐮�"
+ v-model="form.workerId"
+ disabled
+ placeholder="璇疯緭鍏ュ憳宸ョ紪鍙�"
>
</el-input>
</el-form-item>
- <el-form-item label="鍛樺伐濮撳悕" style="width: 100%;" >
- <el-input
- :disabled="this.editConfig.dialogTitle==='鏌ョ湅'"
- v-model="editConfig.infomitton.groupNumber"
- :rows="4"
- style="resize: none !important;"
- placeholder="璇疯緭鍏ュ憳宸ュ鍚�"
- >
- </el-input>
- </el-form-item>
- <el-form-item label="甯﹀緬澶╂暟" style="width: 100%;"
- prop="groupNumber">
+ <el-form-item label="甯﹀緬鏈堜唤" style="width: 100%;"
+ prop="month">
<el-date-picker
style="width:100%"
- v-model="editConfig.infomitton.groupNumber"
+ v-model="form.month"
type="month"
- placeholder="閫夋嫨鏈�">
+ placeholder="閫夋嫨鏈�"
+ value-format="yyyy-MM">
</el-date-picker>
</el-form-item>
<el-form-item label="甯﹀緬澶╂暟" style="width: 100%;"
- prop="groupNumber" >
+ prop="days" >
<el-input
- :disabled="this.editConfig.dialogTitle==='鏌ョ湅'"
- v-model="editConfig.infomitton.groupNumber"
- :rows="4"
- style="resize: none !important;"
- placeholder="璇疯緭鍏ュ憳宸ョ紪鐮�"
+ v-model="form.days"
+ placeholder="璇疯緭鍏�"
>
</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 @click="cancelMethod()">鍙� 娑�</el-button>
+ <el-button type="primary" @click="submitForm('form')">纭� 瀹�</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
-// import {} from "@/api/systemSetting/workshopManage"
+import { createMentorInfo, updateMentorInfo } from "@/api/employeeSalary/apprenticeshipManage.js"
+import UserSimpleSearchInput from "@/components/common/UserSimpleSearchInput"
export default {
+ components: {
+ UserSimpleSearchInput
+ },
props: {
- editDiaConfig:{
+ editRow: {
type: Object,
- default: () => {
- return {
- visible: false,
- dialogTitle:"娣诲姞",
- isReadonly:true,
- infomitton: {
- },
- }
- }
}
},
data() {
return {
- editConfig:this.editDiaConfig,
- workshopList:[],
- carFlagList:[
- ],
+ islook:false,
+ form:{
+ workerId:'',
+ days:null,
+ month:'',
+ name:'',
+ },
rules: {
- workshopNumber: [
- { required: true, message: '璇烽�夋嫨杞﹂棿', trigger: 'change' }
+ name: [
+ { required: true, message: '璇烽�夋嫨', trigger: ['change','blur'] }
],
- groupNumber: [
- { required: true, message: '璇峰~鍐欑粍鍒�', trigger: 'change' }
+ month: [
+ { required: true, message: '璇烽�夋嫨', trigger: ['change','blur'] }
+ ],
+ days: [
+ { required: true, message: '璇峰~鍐�', trigger: ['change','blur'] },
+ {
+ validator: this.validatorNum,
+ trigger: ["blur", "change"],
+ },
]
},
};
@@ -97,39 +99,89 @@
},
watch: {
-
+ islook(newVal) {
+ if (newVal) {
+ this.formInfo()
+ }
+ },
+ editRow() {
+ this.formInfo()
+ },
},
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),
+ formInfo() {
+ if (this.islook) {
+ this.form = {
+ workerId:'',
+ days:null,
+ month:'',
+ name:'',
+ };
+ this.$nextTick(()=>{
+ this.$refs["form"].resetFields();
+ if (this.editRow.id) {
+ this.form = JSON.parse(JSON.stringify(this.editRow));
+ }
+ })
}
- return params
},
- async commitForm(formName){
+ setFormItem(val, itemMark, itemName) {
+ this.$set(this.form, itemMark, val.id);
+ this.$set(this.form, itemName, val.name);
+ },
+ validatorNum(rule, value, callback) {
+ if (value == undefined || value == null) {
+ callback(new Error("璇疯緭鍏ユ湁鏁堟暟瀛�"));
+ } else {
+ let reg2 =
+ /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/;
+ if (!reg2.test(value) || value == 0) {
+ callback(new Error("璇峰~鍐欏ぇ浜庨浂鐨�2浣嶅皬鏁扮殑鏁板瓧"));
+ } else {
+ callback();
+ }
+ }
+ },
+ cancelMethod(val) {
+ this.$refs["form"].resetFields();
+ this.islook = false;
+ if(val){
+ this.$emit('refresh')
+ }
+
+ },
+ submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
- console.log("鏍¢獙閫氳繃")
+ let form = JSON.parse(JSON.stringify(this.form));
+ form.days=Number(form.days)
+ if (this.editRow.type == "add") {
+ createMentorInfo(form).then((res) => {
+ if (res.code == 200) {
+ this.$message({
+ message: "娣诲姞鎴愬姛锛�",
+ type: "success",
+ });
+ this.cancelMethod(true);
+ }
+ });
+ } else {
+ updateMentorInfo(form).then((res) => {
+ if (res.code == 200) {
+ this.$message({
+ message: "缂栬緫鎴愬姛锛�",
+ type: "success",
+ });
+ this.cancelMethod(true);
+ }
+ });
+ }
} else {
console.log('error submit!!');
return false;
}
});
-
-
- }
- },
- components: {
-
+ },
},
};
</script>
diff --git a/src/views/employeeSalary/apprenticeshipManage/index.vue b/src/views/employeeSalary/apprenticeshipManage/index.vue
index 395aae8..82635ec 100644
--- a/src/views/employeeSalary/apprenticeshipManage/index.vue
+++ b/src/views/employeeSalary/apprenticeshipManage/index.vue
@@ -4,8 +4,7 @@
<CommonSearch ref="searchRef" :show-add="false" :amount-view="false" placeholder="璇疯緭鍏ュ叧閿瘝" @searchClick="onFilterSearch">
<template slot="leftButton">
<el-button size="small" type="primary" @click="addBtnClick" >鏂板</el-button>
- <el-button size="small" type="primary" @click="refreshClick">鍒锋柊</el-button>
- <el-button size="small" type="primary" @click="printClick">鎵撳嵃</el-button>
+ <el-button size="small" type="primary" @click="exportClick">瀵煎叆</el-button>
</template>
</CommonSearch>
</div>
@@ -14,15 +13,14 @@
<TableCommonView
:table-list="tableList"
@selTableCol="selTableCol"
- @handleShow="handleShow"
@tableRowClick="tableRowClick"
+ v-loading="loading"
>
<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="delClick(scope.row)" type="text" size="small">鍒犻櫎</el-button>
</template>
</el-table-column>
@@ -30,7 +28,8 @@
</TableCommonView>
</div>
<AddDialog
- :editDiaConfig="editConfig"
+ ref="add"
+ :editRow="editRow" @refresh="refreshClick"
/>
<div class="btn-pager">
<PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
@@ -40,6 +39,7 @@
</template>
<script>
+import { getMentorList, deleteMentorInfo } from "@/api/employeeSalary/apprenticeshipManage.js"
import AddDialog from "@/views/employeeSalary/apprenticeshipManage/components/addDialog.vue"
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
export default {
@@ -51,23 +51,17 @@
data() {
return {
tableList: {},
- showCol: ["杞﹂棿", "缁勫埆", "寮�濮嬭溅鍙�", "缁撴潫杞﹀彿", "鍗婅溅鏍囧織", "澶囨敞"],
+ showCol: ["鏈堜唤", "鍛樺伐缂栫爜", "鍛樺伐濮撳悕", "甯﹀緬澶╂暟", "娣诲姞鏃堕棿", "娣诲姞浜�"],
tableColumn: [
- // { label: "杞﹂棿", prop: "workshopNumber",iconRight:"el-icon-setting"},
- { label: "杞﹂棿", prop: "workshopNumber",},
- { label: "缁勫埆", prop: "groupNumber", },
- { label: "寮�濮嬭溅鍙�", prop: "startCarNumber" },
- { label: "缁撴潫杞﹀彿", prop: "endCarNumber" },
- { label: "鍗婅溅鏍囧織", prop: "carFlag",isCallMethod: true, getCallMethod: this.getStatusCarFlag },
- { label: "澶囨敞", prop: "notes", },
+ { label: "鏈堜唤", prop: "month",min:90,},
+ { label: "鍛樺伐缂栫爜", prop: "workerId", min:120,},
+ { label: "鍛樺伐濮撳悕", prop: "name" },
+ { label: "甯﹀緬澶╂暟", prop: "days" , min:110,},
+ { label: "娣诲姞鏃堕棿", prop: "carFlag", min:120, },
+ { label: "娣诲姞浜�", prop: "creator", },
],
- editConfig:{
- visible:false,
- infomitton:{
- TabsIndex:0,
- workshopId:null,
- }
- },
+ editRow:{},
+ loading: false,
getDataParams: {
keyWord: '',
},
@@ -75,6 +69,7 @@
},
created() {
this.setTable()
+ this.getData(this.getDataParams.keyWord)
},
methods: {
setTable() {
@@ -109,35 +104,88 @@
this.showcol = val
this.tableList.tableColumn = this.setColumnVisible(val, this.tableColumn)
},
+ // 璇锋眰鏁版嵁
+ async getData() {
+ this.loading = true
+ await getMentorList({
+ keyWord:this.getDataParams.keyWord,
+ page: this.pagerOptions.currPage,
+ pageSize: this.pagerOptions.pageSize
+ })
+ .then((res) => {
+ if (res.code === 200) {
+ if (res.data) {
+ const list = res.data.map(item=>{
+ return {
+ ...item,
+ name:item.worker?item.worker.name:''
+ }
+ })
+ 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={}
- this.editConfig.dialogTitle="鏂板"
- this.editConfig.visible=true
+ this.editRow = { title:'鏂板缓',type:'add' }
+ this.$refs.add.islook = true;
},
// 鎼滅储
onFilterSearch(searchText) {
this.getDataParams.keyWord = searchText,
- this.getData()
+ this.pagerOptions.currPage = 1
+ this.getData()
},
// 鍒锋柊
refreshClick() {
- this.getDataParams.keyWord = ""
- this.pagerOptions.currPage = 1
- this.pagerOptions.pageSize = 15
- // this.$refs.searchRef.searchInput = ""
this.getData()
},
// 鎵撳嵃
- printClick() { },
- // 缁勫埆
- handleShow() {
-
- },
+ exportClick() { },
// 琛ㄦ牸琛岀偣鍑�
tableRowClick(row) {
console.log(row, "row")
},
+ // 缂栬緫
+ handleClick(row) {
+ let config=JSON.parse(JSON.stringify(row));
+ this.editRow = {
+ ...config,
+ title:'缂栬緫',
+ type:'edit',
+ id:config.ID
+ }
+ this.$refs.add.islook = true;
+ },
+ // 鍒犻櫎
+ delClick(row) {
+ this.$confirm("鏄惁纭鍒犻櫎?", "璀﹀憡", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning"
+ })
+ .then(() => {
+ deleteMentorInfo({ id: row.ID }).then((response) => {
+ if (response.code === 200) {
+ this.$message.success("鍒犻櫎鎴愬姛")
+ this.getData()
+ }
+ })
+ })
+ .catch(() => {})
+ },
}
}
</script>
--
Gitblit v1.8.0