Merge branch 'master' of http://192.168.5.5:10010/r/silk/silk-web
New file |
| | |
| | | <template> |
| | | <el-dialog :close-on-click-modal="false" :visible.sync="islook" width="40rem" class="add-event-dialog" |
| | | @close="cancelMethod"> |
| | | <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> |
| | | <el-form-item label="不达标保底:" prop="isCore"> |
| | | <el-switch |
| | | v-model="form.isCore" |
| | | active-color="#409EFF" |
| | | inactive-color="#C0CCDA" |
| | | > |
| | | </el-switch> |
| | | </el-form-item> |
| | | <el-form-item label="保底工资:" prop="produceAheadDay"> |
| | | <el-input |
| | | v-model.number="form.produceAheadDay" |
| | | maxlength="20" |
| | | style="width: calc(100% - 40px)" |
| | | clearable |
| | | placeholder="请输入" |
| | | ></el-input> |
| | | <span class="float_right">元/天</span> |
| | | </el-form-item> |
| | | <el-form-item label="薪资方案:" prop="name"> |
| | | 挡车工生产工资方案+满勤方案+工龄补贴方案 |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <div slot="footer" class="dialog-footer tac"> |
| | | <el-button type="cancel" @click="cancelMethod()">取消</el-button> |
| | | <el-button type="primary" @click="submitForm('form')">确定</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | <script> |
| | | import { getDeleteFollowRecord } from "@/api/employeeManage/employeeInfo.js" |
| | | export default { |
| | | props: { |
| | | editRow: { |
| | | type: Object, |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | islook: false, |
| | | form: { |
| | | id: '', |
| | | isCore: '', |
| | | phoneNum: '', |
| | | }, |
| | | rules: { |
| | | id: [ |
| | | { |
| | | required: true, |
| | | message: "请输入人员姓名", |
| | | trigger: ["blur", "change"], |
| | | }, |
| | | ], |
| | | name: [ |
| | | { |
| | | required: true, |
| | | message: "请输入员工编码", |
| | | trigger: ["blur", "change"], |
| | | }, |
| | | ], |
| | | produceAheadDay: [ |
| | | { |
| | | required: false, |
| | | message: "请输入", |
| | | trigger: "blur", |
| | | }, |
| | | { |
| | | validator: this.validatorNum, |
| | | trigger: "blur", |
| | | }, |
| | | ], |
| | | }, |
| | | DeviceList: [], |
| | | }; |
| | | }, |
| | | created() { |
| | | }, |
| | | watch: { |
| | | islook(newVal) { |
| | | if (newVal) { |
| | | this.formInfo() |
| | | } |
| | | }, |
| | | editRow() { |
| | | this.formInfo() |
| | | }, |
| | | }, |
| | | methods: { |
| | | formInfo() { |
| | | if (this.islook) { |
| | | this.form = { |
| | | isCore: "", |
| | | id: "", |
| | | }; |
| | | this.$nextTick(()=>{ |
| | | this.$refs["form"].resetFields(); |
| | | if (this.editRow.id) { |
| | | this.form = JSON.parse(JSON.stringify(this.editRow)); |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | validatorNum(rule, value, callback) { |
| | | if (value) { |
| | | if (value == undefined || value == null) { |
| | | callback(new Error("请输入有效数字")); |
| | | } else { |
| | | var reg = /^\+?[0-9]\d*$/; |
| | | if (!reg.test(value)) { |
| | | callback(new Error("请填写不小于0的数字")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | } |
| | | } else { |
| | | callback(); |
| | | } |
| | | }, |
| | | cancelMethod() { |
| | | this.$refs["form"].resetFields(); |
| | | this.islook = false; |
| | | }, |
| | | submitForm(formName) { |
| | | this.$refs[formName].validate((valid) => { |
| | | if (valid) { |
| | | let form = JSON.parse(JSON.stringify(this.form)); |
| | | if (this.editRow.type == "add") { |
| | | getDeleteFollowRecord(form).then((res) => { |
| | | if (res.code == 200) { |
| | | this.$message({ |
| | | message: "添加成功!", |
| | | type: "success", |
| | | }); |
| | | this.cancelMethod(); |
| | | } |
| | | }); |
| | | } else { |
| | | getDeleteFollowRecord(form).then((res) => { |
| | | if (res.code == 200) { |
| | | this.$message({ |
| | | message: "编辑成功!", |
| | | type: "success", |
| | | }); |
| | | this.cancelMethod(); |
| | | } |
| | | }); |
| | | } |
| | | } else { |
| | | console.log('error submit!!'); |
| | | return false; |
| | | } |
| | | }); |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .dialog-content-box { |
| | | height: 28rem; |
| | | |
| | | .form-box { |
| | | width: 90%; |
| | | padding: 0 5%; |
| | | height: 100%; |
| | | overflow-y: auto; |
| | | |
| | | } |
| | | } |
| | | </style> |
| | |
| | | <template> |
| | | <div class="container"></div> |
| | | <div class="silkRegister-form"> |
| | | <div class="filter"> |
| | | <div class="filter-card"> |
| | | <CommonSearch |
| | | :show-add="false" |
| | | :show-download="false" |
| | | :amount-view="false" |
| | | :show-action-btn="false" |
| | | placeholder="请输入关键词" |
| | | @searchClick="onFilterSearch" |
| | | > |
| | | <template slot="leftButton"> |
| | | <el-button size="small" type="primary" @click="addBtnClick">新增</el-button> |
| | | </template> |
| | | </CommonSearch> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="body"> |
| | | <div class="body-card"> |
| | | <div class="list-view"> |
| | | <TableCommonView |
| | | ref="tableListRef" |
| | | v-loading="loading" |
| | | :table-list="tableList" |
| | | @selTableCol="selTableCol" |
| | | > |
| | | <template slot="tableButton"> |
| | | <el-table-column label="操作" width="90" fixed="right"> |
| | | <template slot-scope="scope"> |
| | | <el-button @click="handleClick(scope.row)" type="text" size="small">编辑</el-button> |
| | | <el-button @click="delClick(scope.row.id)" type="text" size="small">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </template> |
| | | </TableCommonView> |
| | | </div> |
| | | <div class="btn-pager"> |
| | | <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <AddWorkKind ref="addWorkKind" :editRow="editRow" @shutdown="shutdown" /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { getFollowRecordList, getDeleteFollowRecord } from "@/api/employeeManage/employeeInfo.js" |
| | | import pageMixin from "@/components/makepager/pager/mixin/pageMixin" |
| | | import AddWorkKind from "@/views/employeeManage/workKindManage/components/AddWorkKind" |
| | | export default { |
| | | name: "workKindManage", |
| | | props: {}, |
| | | components: {}, |
| | | mixins: [], |
| | | computed: {}, |
| | | data() { |
| | | return {} |
| | | props: { |
| | | }, |
| | | created() {}, |
| | | methods: {} |
| | | mixins: [pageMixin], |
| | | components: { |
| | | AddWorkKind, |
| | | }, |
| | | data() { |
| | | return { |
| | | tableList: {}, |
| | | loading: false, |
| | | searchOptions: [], |
| | | editRow: { |
| | | title: "新建", |
| | | }, |
| | | search_map: {}, |
| | | tableColumn: [ |
| | | { label: "工种名称", prop: "topic", min: 120, default: true }, // 主题 |
| | | { label: "保底工资(元/天)", prop: "client_name", min: 180, }, // 客户名称 |
| | | { label: "薪资方案", prop: "contact_name", min: 130, }, // 联系人姓名 |
| | | { label: "添加时间", prop: "client_status", width: 130 }, // 客户状态 |
| | | { label: "添加人", prop: "contact_information_name", min: 100 }, // 联系方式 |
| | | ], |
| | | showCol: [ |
| | | "工种名称", |
| | | "保底工资(元/天)", |
| | | "薪资方案", |
| | | "添加时间", |
| | | "添加人", |
| | | ] |
| | | } |
| | | }, |
| | | created() { |
| | | this.setTable() |
| | | this.getData(this.search_map) |
| | | }, |
| | | computed: { |
| | | }, |
| | | methods: { |
| | | setTable() { |
| | | this.tableList = { |
| | | selectIndex: true, |
| | | tableInfomation: [], |
| | | allcol: [], |
| | | showcol: this.showCol, |
| | | tableColumn: this.setColumnVisible(this.showCol) |
| | | } |
| | | this.tableList.allcol = this.tableList.tableColumn.filter((ele) => !ele.default).map((ele) => ele.label) |
| | | this.searchOptions = [] |
| | | for (let i = 0; i < this.tableList.tableColumn.length; i++) { |
| | | const label = this.tableList.tableColumn[i].label |
| | | const value = this.tableList.tableColumn[i].prop |
| | | this.searchOptions.push({ value: value, label: label }) |
| | | } |
| | | }, |
| | | setColumnVisible(showCol) { |
| | | return this.tableColumn.map((ele) => { |
| | | return { |
| | | ...ele, |
| | | isShowColumn: showCol.includes(ele.label) |
| | | } |
| | | }) |
| | | }, |
| | | selTableCol(val) { |
| | | this.showcol = val |
| | | this.tableList.tableColumn = this.setColumnVisible(val) |
| | | }, |
| | | // 请求数据 |
| | | async getData() { |
| | | this.loading = true |
| | | await getFollowRecordList({ |
| | | search_map: this.search_map, |
| | | page: this.pagerOptions.currPage, |
| | | pageSize: this.pagerOptions.pageSize |
| | | }) |
| | | .then((res) => { |
| | | console.log(res) |
| | | if (res.code === 200) { |
| | | if (res.data.list && res.data.list.length > 0) { |
| | | const list = res.data.list.map((item) => { |
| | | return { |
| | | ...item, |
| | | client_name: item.client.name, |
| | | contact_name: item.contact.name, |
| | | client_status: item.client_status.name, |
| | | phone: item.contact.phone, |
| | | member_name: item.member.username, |
| | | contact_information_name: item.contact_information.name |
| | | } |
| | | }) |
| | | this.tableList.tableInfomation = list || [] |
| | | this.pagerOptions.totalCount = res.data.count |
| | | } else { |
| | | this.tableList.tableInfomation = [] |
| | | } |
| | | } else { |
| | | this.tableList.tableInfomation = [] |
| | | } |
| | | this.loading = false |
| | | }) |
| | | .catch((err) => { |
| | | console.log(err) |
| | | this.tableList.tableInfomation = [] |
| | | this.loading = false |
| | | }) |
| | | }, |
| | | // 搜索 |
| | | onFilterSearch(searchText) { |
| | | this.search_map.client_name = searchText ?? "" |
| | | this.pagerOptions.currPage = 1 |
| | | this.getData() |
| | | }, |
| | | shutdown() { |
| | | this.getData(); |
| | | }, |
| | | // 新建 |
| | | addBtnClick() { |
| | | this.editRow = { title:'新建',type:'add' } |
| | | this.$refs.addWorkKind.islook = true; |
| | | }, |
| | | // 编辑 |
| | | handleClick(row) { |
| | | let config=JSON.parse(JSON.stringify(row)); |
| | | this.editRow = { ...config, title:'编辑',type:'add' } |
| | | this.$refs.addWorkKind.islook = true; |
| | | }, |
| | | // 删除 |
| | | delClick(id) { |
| | | this.$confirm("是否确认删除?", "警告", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | getDeleteFollowRecord({ ids: [id] }).then((response) => { |
| | | if (response.code === 200) { |
| | | this.$message.success("删除成功") |
| | | this.getData() |
| | | } else { |
| | | this.$message.warning("删除失败") |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => {}) |
| | | }, |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <!-- Add "scoped" attribute to limit CSS to this component only --> |
| | | <style lang="scss" scoped></style> |
| | | <style lang="scss" scoped> |
| | | .silkRegister-form { |
| | | height: 100%; |
| | | overflow: hidden; |
| | | .filter { |
| | | height: 80px; |
| | | display: flex; |
| | | align-items: center; |
| | | padding: 12px 20px 0 20px; |
| | | &-card { |
| | | height: 80px; |
| | | display: flex; |
| | | align-items: center; |
| | | box-sizing: border-box; |
| | | padding: 10px 20px; |
| | | flex: 1; |
| | | border-radius: 12px; |
| | | background-color: #fff; |
| | | } |
| | | } |
| | | .body { |
| | | box-sizing: border-box; |
| | | padding: 10px 20px; |
| | | border-radius: 12px; |
| | | height: calc(100% - 92px); |
| | | .body-card { |
| | | background-color: #fff; |
| | | border-radius: 12px; |
| | | height: 100%; |
| | | overflow: hidden; |
| | | } |
| | | .list-view { |
| | | height: calc(100% - 60px); |
| | | overflow: hidden; |
| | | } |
| | | .btn-pager { |
| | | display: flex; |
| | | margin-top: 10px; |
| | | .page { |
| | | margin-left: auto; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </style> |