Commit ad1fa9f9 authored by IvyXia123's avatar IvyXia123

Merge branch 'dev' into pre

parents 71f7e742 088df43a
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
</div> </div>
<div class="" v-if="subcompanyList.length === 0" style="color: #000; font-size: 13px;text-align: center;padding-top: 20px;">暂无数据</div> <div class="" v-if="subcompanyList.length === 0" style="color: #000; font-size: 13px;text-align: center;padding-top: 20px;">暂无数据</div>
<div style="text-align: right;padding-top: 30px; padding-right: 30px;"> <div style="text-align: right;padding-top: 30px; padding-right: 30px;">
<el-button type="primary" size="small" @click="changeRecord(1, 10)">变更记录</el-button> <el-button type="primary" size="small" @click="staffCountClick('', 1, 10)">变更记录</el-button>
<el-button type="primary" size="small" @click="newAdd">新增</el-button> <el-button type="primary" size="small" @click="newAdd">新增</el-button>
<el-button type="primary" size="small" @click="preservation">保存</el-button> <el-button type="primary" size="small" @click="preservation">保存</el-button>
</div> </div>
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
<td>{{ item.in_at }}</td> <td>{{ item.in_at }}</td>
<td>{{ item.base_salary }}</td> <td>{{ item.base_salary }}</td>
<td> <td>
<router-link :to="{path:'/staff', query:{}}" target="_blank"> <router-link :to="{name: 'staff', params:{ model: item.mobile }}">
<el-button size="mini" type="primary">修改</el-button> <el-button size="mini" type="primary">修改</el-button>
</router-link> </router-link>
</td> </td>
...@@ -70,9 +70,7 @@ ...@@ -70,9 +70,7 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<div style="padding-top: 20px;">
<!--<page v-if="staffContent.length != 0" :total="total" :limit="limit" @pageChange="onPageChange" @sizeChange="onSizeChange"/>-->
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
:page-sizes="[5, 10, 20, 30, 40, 50, 60, 80, 100]" :page-sizes="[5, 10, 20, 30, 40, 50, 60, 80, 100]"
:page-size="limit" :page-size="limit"
...@@ -80,6 +78,8 @@ ...@@ -80,6 +78,8 @@
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
:total="total" style="text-align: center;"> :total="total" style="text-align: center;">
</el-pagination> </el-pagination>
</div>
</el-dialog> </el-dialog>
</el-card> </el-card>
</div> </div>
...@@ -157,10 +157,11 @@ ...@@ -157,10 +157,11 @@
// 获取新增的数据 // 获取新增的数据
let subcompanyListArr = this.subcompanyList.slice(-this.saleLevelNum); let subcompanyListArr = this.subcompanyList.slice(-this.saleLevelNum);
if(JSON.stringify(subcompanyListArr).indexOf('""') !== -1){ if(JSON.stringify(subcompanyListArr).indexOf('""') !== -1){
this.$message({ message: '保存数据不能为空', type: 'warning' }); this.$message({ message: '没有新增的信息', type: 'warning' });
}else { }else {
addConfigApi({ params: JSON.stringify(subcompanyListArr) }).then((res) => { addConfigApi({ params: JSON.stringify(subcompanyListArr) }).then((res) => {
this.getLevelListFn() this.getLevelListFn()
this.$message({ message: '数据保存成功', type: 'warning' });
}); });
} }
}, },
...@@ -195,7 +196,7 @@ ...@@ -195,7 +196,7 @@
} }
}, },
/** /**
* 级别渲染 * 级别渲染 + 变更记录
* @param id {String} * @param id {String}
* @param page {Number} * @param page {Number}
* @param limit {Number} * @param limit {Number}
...@@ -204,11 +205,14 @@ ...@@ -204,11 +205,14 @@
this.staffId = id; // 获取id this.staffId = id; // 获取id
this.infoLoadingDialog = true this.infoLoadingDialog = true
this.pageIndex = page this.pageIndex = page
getStaffApi(id, { page: page, limit: limit }).then(res => { this.limit = limit
if(res.list.length > 0) { let api = id ? getStaffApi : getRecordApi
this.staffTitle = STAFF; api({ page: page, limit: limit }, id).then(res => {
let listDdata = id ? res.list : res.page_data
if(listDdata.length > 0) {
this.staffTitle = id ? STAFF : recordList;
this.total = res.total; this.total = res.total;
this.staffContent = res.list; this.staffContent = listDdata;
this.salesLevelDialog = true this.salesLevelDialog = true
}else { }else {
this.$message({ message: '暂无数据', type: 'warning' }); this.$message({ message: '暂无数据', type: 'warning' });
...@@ -216,43 +220,18 @@ ...@@ -216,43 +220,18 @@
this.infoLoadingDialog = false this.infoLoadingDialog = false
}) })
}, },
/**
* 变更记录
* @param page {Number}
* @param limit {Number}
*/
changeRecord(page, limit) {
this.pageIndex = page
this.infoLoadingDialog = true
this.staffId = ''; // id 变为空
getRecordApi({ page: page, limit: limit }).then(res => {
this.infoLoadingDialog = false
this.staffTitle = recordList;
this.total = res.total;
this.staffContent = res.page_data;
this.salesLevelDialog = true
});
},
/** /**
* 分页 * 分页
* @param val * @param val
*/ */
handleCurrentChange(val) { handleCurrentChange(val) {
this.pageIndex = val this.pageIndex = val
if(this.staffId) {
this.staffCountClick(this.staffId , val, this.limit) this.staffCountClick(this.staffId , val, this.limit)
}else {
this.changeRecord(val, this.limit)
}
}, },
handleSizeChange(val) { handleSizeChange(val) {
this.pageIndex = 1 this.pageIndex = 1
this.limit = val this.limit = val
if(this.staffId) {
this.staffCountClick(this.staffId , 1, val) this.staffCountClick(this.staffId , 1, val)
}else {
this.changeRecord(val, this.limit)
}
} }
}, },
mounted() { mounted() {
......
...@@ -114,7 +114,16 @@ ...@@ -114,7 +114,16 @@
v-model="dialog.form.over_at" type="date" value-format="yyyy-MM-dd" :clearable="true" placeholder="选择日期"> v-model="dialog.form.over_at" type="date" value-format="yyyy-MM-dd" :clearable="true" placeholder="选择日期">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="级别名称:" prop="sale_level_id">
<el-select v-model="dialog.form.sale_level_id" placeholder="请选择">
<el-option
v-for="item in levelNameArr"
:key="item.id"
:label="item.level_name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
...@@ -126,7 +135,7 @@ ...@@ -126,7 +135,7 @@
</template> </template>
<script> <script>
import {getStaffListApi, postStaffListApi, putStaffListApi} from "../../service/api"; import {getStaffListApi, postStaffListApi, putStaffListApi, getLevelListApi} from "../../service/api";
import page from '../framework/page' import page from '../framework/page'
import {STAFF_TYPE} from '@/util/wordbook' import {STAFF_TYPE} from '@/util/wordbook'
...@@ -142,10 +151,11 @@ ...@@ -142,10 +151,11 @@
type: '', type: '',
status: '', status: '',
start_in: '', start_in: '',
over_in: '' over_in: '',
}, },
startTime: [], startTime: [],
tableData: [], tableData: [],
levelNameArr: [],
dialog: { dialog: {
title: '', title: '',
show: false, show: false,
...@@ -157,12 +167,14 @@ ...@@ -157,12 +167,14 @@
type: '', type: '',
in_at: '', in_at: '',
over_at: '', over_at: '',
sale_level_id: '',
rules: { rules: {
name: [{required: true, message: '请输入', trigger: 'blur'}], name: [{required: true, message: '请输入', trigger: 'blur'}],
mobile: [{required: true, message: '请输入', trigger: 'blur'}], mobile: [{required: true, message: '请输入', trigger: 'blur'}],
id_card: [{required: true, message: '请输入', trigger: 'blur'}], id_card: [{required: true, message: '请输入', trigger: 'blur'}],
type: [{required: true, message: '请选择', trigger: 'change'}], type: [{required: true, message: '请选择', trigger: 'change'}],
in_at: [{required: true, message: '请选择', trigger: 'change'}], in_at: [{required: true, message: '请选择', trigger: 'change'}],
sale_level_id: [{required: true, message: '请选择', trigger: 'change'}],
}, },
} }
}, },
...@@ -192,6 +204,7 @@ ...@@ -192,6 +204,7 @@
}, },
components: { page }, components: { page },
mounted() { mounted() {
console.log(this.dialog);
this.getData() this.getData()
}, },
methods: { methods: {
...@@ -225,7 +238,8 @@ ...@@ -225,7 +238,8 @@
mobile: this.dialog.form.mobile, mobile: this.dialog.form.mobile,
id_card: this.dialog.form.id_card, id_card: this.dialog.form.id_card,
type: this.dialog.form.type, type: this.dialog.form.type,
in_at: this.dialog.form.in_at in_at: this.dialog.form.in_at,
sale_level_id: this.dialog.form.sale_level_id
}; };
if (this.dialog.form.id) { // 编辑 if (this.dialog.form.id) { // 编辑
json.id = this.dialog.form.id; json.id = this.dialog.form.id;
...@@ -267,11 +281,19 @@ ...@@ -267,11 +281,19 @@
this.searchFrom.id_card?json.id_card = this.searchFrom.id_card:''; this.searchFrom.id_card?json.id_card = this.searchFrom.id_card:'';
this.searchFrom.type?json.type = this.searchFrom.type:''; this.searchFrom.type?json.type = this.searchFrom.type:'';
this.searchFrom.status?json.status = this.searchFrom.status:''; this.searchFrom.status?json.status = this.searchFrom.status:'';
if(this.$route.params.model) {
json = Object.assign({}, json, { mobile: this.$route.params.model })
this.searchFrom.mobile = this.$route.params.model
}
getStaffListApi(json).then(res => { getStaffListApi(json).then(res => {
this.tableData = res.list; this.tableData = res.list;
this.total = res.total this.total = res.total
this.$route.query.model = ''
}); });
let data = { page: 1, limit: 100 }
getLevelListApi(data).then(res => {
this.levelNameArr = res.list
})
}, },
onAdd() { onAdd() {
...@@ -293,6 +315,7 @@ ...@@ -293,6 +315,7 @@
this.dialog.form.id_card = item.id_card; this.dialog.form.id_card = item.id_card;
this.dialog.form.type = item.type; this.dialog.form.type = item.type;
this.dialog.form.in_at = item.in_at; this.dialog.form.in_at = item.in_at;
this.dialog.form.sale_level_id = item.sale_level_id
if (item.status == 1) { // 离职 if (item.status == 1) { // 离职
this.dialog.form.over_at = item.over_at; this.dialog.form.over_at = item.over_at;
} else { } else {
......
...@@ -162,7 +162,7 @@ export const getLevelListApi = function (json) { ...@@ -162,7 +162,7 @@ export const getLevelListApi = function (json) {
}; };
//所属级别员工列表 //所属级别员工列表
export const getStaffApi = function (data, json) { export const getStaffApi = function (json, data) {
return Vue.prototype.$fetch(`${_baseUrl}api/admin/sale/level/staff/${data}`, json) return Vue.prototype.$fetch(`${_baseUrl}api/admin/sale/level/staff/${data}`, json)
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment