1
This commit is contained in:
parent
e124a1c539
commit
905ec22a77
@ -210,6 +210,8 @@ export const DICT_TYPE = {
|
||||
REPAIR_PART_STATUS: 'repair_part_status',
|
||||
// 维修通知公告
|
||||
REPAIR_NOTICE_SERVER: 'weixiu',
|
||||
//工种(维修项目类型)
|
||||
REPAIR_WORK_TYPE: 'repair_work_type',
|
||||
|
||||
// ---------会员相关---------member_coupon_type,member_coupon_out_rule,member_car,member_active
|
||||
//卡券类型
|
||||
|
@ -81,8 +81,7 @@
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"/>
|
||||
</div>
|
||||
<div
|
||||
style="position: absolute;bottom: 0;width: 100%;right: 0;padding: 5px 20px 0;z-index: 999;background: white;text-align: right">
|
||||
<div style="position: absolute;bottom: 0;width: 100%;right: 0;padding: 5px 20px 0;z-index: 999;background: white;text-align: right">
|
||||
<div class="demo-drawer__footer">
|
||||
<el-button @click="cancelForm">取 消</el-button>
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
|
243
src/views/repair/repairworker/ChooseUserDraw.vue
Normal file
243
src/views/repair/repairworker/ChooseUserDraw.vue
Normal file
@ -0,0 +1,243 @@
|
||||
<template>
|
||||
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<el-drawer
|
||||
title="选择用户"
|
||||
size="60%"
|
||||
:visible.sync="drawVisible"
|
||||
@close="cancelForm"
|
||||
>
|
||||
<div style="padding: 0 10px;margin-bottom: 70px">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="用户名称" prop="username">
|
||||
<el-input v-model="queryParams.username" placeholder="请输入用户名称" clearable style="width: 240px"
|
||||
@keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号码" prop="mobile">
|
||||
<el-input v-model="queryParams.mobile" placeholder="请输入手机号码" clearable style="width: 240px"
|
||||
@keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
|
||||
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table
|
||||
v-loading="formLoading"
|
||||
:data="list"
|
||||
:stripe="true"
|
||||
@select="selectRow"
|
||||
@select-all="handleSelectAll">
|
||||
<el-table-column
|
||||
type="selection"
|
||||
width="55">
|
||||
</el-table-column>
|
||||
<el-table-column label="用户编号" align="center" key="id" prop="id" v-if="columns[0].visible" />
|
||||
<el-table-column label="用户名称" align="center" key="username" prop="username" v-if="columns[1].visible" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="用户昵称" align="center" key="nickname" prop="nickname" v-if="columns[2].visible" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="联系方式" align="center" key="mobile" prop="mobile" v-if="columns[4].visible" width="120" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[6].visible" width="160">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"/>
|
||||
</div>
|
||||
|
||||
<div style="position: absolute;bottom: 0;width: 100%;right: 0;padding: 5px 20px 0;z-index: 999;background: white;text-align: right">
|
||||
<div class="demo-drawer__footer">
|
||||
<el-button @click="cancelForm">取 消</el-button>
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-drawer>
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import {
|
||||
listUser
|
||||
} from "@/api/system/user";
|
||||
import {DICT_TYPE, getDictDatas} from "@/utils/dict";
|
||||
import * as WorkerApi from '@/api/repair/repairworker';
|
||||
export default {
|
||||
name: "ChooseCouponDraw",
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
// 弹出层标题
|
||||
// 是否显示弹出层
|
||||
drawVisible: false,
|
||||
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
formLoading: false,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
//回参
|
||||
formData: {},
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 卡券列表
|
||||
list: [],
|
||||
multipleSelection: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
username: undefined,
|
||||
mobile: undefined,
|
||||
status: undefined,
|
||||
deptId: undefined,
|
||||
createTime: []
|
||||
},
|
||||
// 列信息
|
||||
columns: [
|
||||
{ key: 0, label: `用户编号`, visible: true },
|
||||
{ key: 1, label: `用户名称`, visible: true },
|
||||
{ key: 2, label: `用户昵称`, visible: true },
|
||||
{ key: 3, label: `部门`, visible: true },
|
||||
{ key: 4, label: `手机号码`, visible: true },
|
||||
{ key: 5, label: `状态`, visible: true },
|
||||
{ key: 6, label: `创建时间`, visible: true }
|
||||
],
|
||||
// 数据字典
|
||||
statusDictDatas: getDictDatas(DICT_TYPE.COMMON_STATUS),
|
||||
sexDictDatas: getDictDatas(DICT_TYPE.SYSTEM_USER_SEX),
|
||||
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
|
||||
/** 打开弹窗 */
|
||||
async open(multipleSelection) {
|
||||
this.drawVisible = true;
|
||||
this.formLoading = true;
|
||||
this.reset();
|
||||
try {
|
||||
const res = await listUser(this.queryParams);
|
||||
this.list = res.data.list;
|
||||
this.total = res.data.total;
|
||||
if (multipleSelection){
|
||||
this.multipleSelection = JSON.parse(JSON.stringify(multipleSelection))
|
||||
this.defaultChecked(multipleSelection)
|
||||
}
|
||||
} finally {
|
||||
this.formLoading = false;
|
||||
}
|
||||
},
|
||||
|
||||
/**选中*/
|
||||
selectRow(val, row) {
|
||||
//当前点击是否勾选
|
||||
let selectBool = val.length && val.indexOf(row) !== -1
|
||||
if (!selectBool) {
|
||||
//取消勾选
|
||||
this.multipleSelection.forEach((item, i) => {
|
||||
if (item.id == row.id) {
|
||||
this.multipleSelection.splice(i, 1)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
//选中
|
||||
this.multipleSelection.push(row)
|
||||
}
|
||||
},
|
||||
|
||||
/**全选*/
|
||||
handleSelectAll(val) {
|
||||
if (val.length == this.list.length) { //全选
|
||||
this.multipleSelection = this.multipleSelection.concat(val)
|
||||
//去重
|
||||
let obj = {}
|
||||
let result = []
|
||||
this.multipleSelection.forEach(item => {
|
||||
if (!obj[item.id]) {
|
||||
result.push(item)
|
||||
obj[item.id] = true
|
||||
}
|
||||
})
|
||||
this.multipleSelection = result
|
||||
} else { //取消全选
|
||||
this.list.forEach(item => {
|
||||
this.multipleSelection.forEach((multItem, i) => {
|
||||
if (item.id == multItem.id) {
|
||||
this.multipleSelection.splice(i, 1)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
/**设置默认选中*/
|
||||
defaultChecked(multipleSelection) {
|
||||
const that = this;
|
||||
this.$nextTick(() => {
|
||||
that.list.forEach((v, i) => {
|
||||
multipleSelection.map(item => {
|
||||
if (item.id === v.id) {
|
||||
that.$refs.multipleTable.toggleRowSelection(v, true);
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
cancelForm() {
|
||||
this.drawVisible = false
|
||||
},
|
||||
|
||||
/** 查询列表 */
|
||||
async getList() {
|
||||
try {
|
||||
this.formLoading = true
|
||||
const res = await listUser(this.queryParams);
|
||||
this.list = res.data.list;
|
||||
this.total = res.data.total;
|
||||
// this.defaultChecked(this.multipleSelection)
|
||||
} finally {
|
||||
this.formLoading = false
|
||||
}
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/**重置参数*/
|
||||
reset() {
|
||||
this.queryParams = {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
name: null,
|
||||
type: null,
|
||||
carModel: null,
|
||||
outRule: null,
|
||||
}
|
||||
},
|
||||
/** 提交按钮 */
|
||||
async submitForm() {
|
||||
this.drawVisible = false
|
||||
await WorkerApi.createWorker(this.multipleSelection);
|
||||
this.$modal.msgSuccess("保存成功");
|
||||
this.$emit('success', this.multipleSelection)
|
||||
},
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
@ -1,110 +1,125 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="45%" v-dialogDrag append-to-body>
|
||||
<el-form ref="formRef" :model="formData" :rules="formRules" v-loading="formLoading" label-width="100px">
|
||||
<el-form-item label="维修工人名称" prop="userName">
|
||||
<el-input v-model="formData.userName" placeholder="请输入维修工人名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="工种" prop="workType">
|
||||
<el-select v-model="formData.workType" placeholder="请选择工种">
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否为组长(0代表不是 1代表是)" prop="isLeads">
|
||||
<el-input v-model="formData.isLeads" placeholder="请输入是否为组长(0代表不是 1代表是)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="formData.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as WorkerApi from '@/api/repair/repairworker';
|
||||
export default {
|
||||
name: "WorkerForm",
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 弹出层标题
|
||||
dialogTitle: "",
|
||||
// 是否显示弹出层
|
||||
dialogVisible: false,
|
||||
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
formLoading: false,
|
||||
// 表单参数
|
||||
formData: {
|
||||
userName: undefined,
|
||||
workType: undefined,
|
||||
isLeads: undefined,
|
||||
remark: undefined,
|
||||
},
|
||||
// 表单校验
|
||||
formRules: {
|
||||
isLeads: [{ required: true, message: '是否为组长(0代表不是 1代表是)不能为空', trigger: 'blur' }],
|
||||
},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
/** 打开弹窗 */
|
||||
async open(id) {
|
||||
this.dialogVisible = true;
|
||||
this.reset();
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
this.formLoading = true;
|
||||
try {
|
||||
const res = await WorkerApi.getWorker(id);
|
||||
this.formData = res.data;
|
||||
this.title = "修改维修工人";
|
||||
} finally {
|
||||
this.formLoading = false;
|
||||
}
|
||||
}
|
||||
this.title = "新增维修工人";
|
||||
},
|
||||
/** 提交按钮 */
|
||||
async submitForm() {
|
||||
// 校验主表
|
||||
await this.$refs["formRef"].validate();
|
||||
this.formLoading = true;
|
||||
try {
|
||||
const data = this.formData;
|
||||
// 修改的提交
|
||||
if (data.id) {
|
||||
await WorkerApi.updateWorker(data);
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.dialogVisible = false;
|
||||
this.$emit('success');
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
await WorkerApi.createWorker(data);
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.dialogVisible = false;
|
||||
this.$emit('success');
|
||||
} finally {
|
||||
this.formLoading = false;
|
||||
}
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.formData = {
|
||||
userName: undefined,
|
||||
workType: undefined,
|
||||
isLeads: undefined,
|
||||
remark: undefined,
|
||||
};
|
||||
this.resetForm("formRef");
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="35%" v-dialogDrag append-to-body>
|
||||
<el-form ref="formRef" :model="formData" :rules="formRules" v-loading="formLoading" label-width="100px">
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="姓名" prop="userName">
|
||||
<el-input v-model="formData.userName" disabled placeholder="请输入维修工人名称"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="工种" prop="workType">
|
||||
<el-select v-model="formData.workType" placeholder="请选择工种">
|
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.REPAIR_WORK_TYPE)" :key="dict.value"
|
||||
:label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="是否班组长" prop="isLeads">
|
||||
<el-radio-group v-model="formData.isLeads">
|
||||
<el-radio label="0">否</el-radio>
|
||||
<el-radio label="1">是</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input type="textarea" v-model="formData.remark" placeholder="请输入备注"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as WorkerApi from '@/api/repair/repairworker';
|
||||
|
||||
export default {
|
||||
name: "WorkerForm",
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
// 弹出层标题
|
||||
dialogTitle: "",
|
||||
// 是否显示弹出层
|
||||
dialogVisible: false,
|
||||
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
formLoading: false,
|
||||
// 表单参数
|
||||
formData: {
|
||||
userName: undefined,
|
||||
workType: undefined,
|
||||
isLeads: undefined,
|
||||
remark: undefined,
|
||||
},
|
||||
// 表单校验
|
||||
formRules: {
|
||||
workType: [{required: true, message: '工种不能为空', trigger: 'blur'}],
|
||||
isLeads: [{required: true, message: '是否为组长不能为空', trigger: 'blur'}],
|
||||
},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
/** 打开弹窗 */
|
||||
async open(id) {
|
||||
this.dialogVisible = true;
|
||||
this.reset();
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
this.formLoading = true;
|
||||
try {
|
||||
const res = await WorkerApi.getWorker(id);
|
||||
this.formData = res.data;
|
||||
this.title = "修改维修工人";
|
||||
} finally {
|
||||
this.formLoading = false;
|
||||
}
|
||||
}
|
||||
this.title = "新增维修工人";
|
||||
},
|
||||
/** 提交按钮 */
|
||||
async submitForm() {
|
||||
// 校验主表
|
||||
await this.$refs["formRef"].validate();
|
||||
this.formLoading = true;
|
||||
try {
|
||||
const data = this.formData;
|
||||
// 修改的提交
|
||||
if (data.id) {
|
||||
await WorkerApi.updateWorker(data);
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.dialogVisible = false;
|
||||
this.$emit('success');
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
await WorkerApi.createWorker(data);
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.dialogVisible = false;
|
||||
this.$emit('success');
|
||||
} finally {
|
||||
this.formLoading = false;
|
||||
}
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.formData = {
|
||||
userName: undefined,
|
||||
workType: undefined,
|
||||
isLeads: undefined,
|
||||
remark: undefined,
|
||||
};
|
||||
this.resetForm("formRef");
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -1,150 +1,162 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="维修工人名称" prop="userName">
|
||||
<el-input v-model="queryParams.userName" placeholder="请输入维修工人名称" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="工种" prop="workType">
|
||||
<el-select v-model="queryParams.workType" placeholder="请选择工种" clearable size="small">
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否为组长(0代表不是 1代表是)" prop="isLeads">
|
||||
<el-input v-model="queryParams.isLeads" placeholder="请输入是否为组长(0代表不是 1代表是)" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="queryParams.remark" placeholder="请输入备注" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 操作工具栏 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="openForm(undefined)"
|
||||
v-hasPermi="['repair:worker:create']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
|
||||
v-hasPermi="['repair:worker:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="维修工人名称" align="center" prop="userName" />
|
||||
<el-table-column label="工种" align="center" prop="workType" />
|
||||
<el-table-column label="是否为组长(0代表不是 1代表是)" align="center" prop="isLeads" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template v-slot="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.id)"
|
||||
v-hasPermi="['repair:worker:update']">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['repair:worker:delete']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"/>
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<WorkerForm ref="formRef" @success="getList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as WorkerApi from '@/api/repair/repairworker';
|
||||
import WorkerForm from './WorkerForm.vue';
|
||||
export default {
|
||||
name: "Worker",
|
||||
components: {
|
||||
WorkerForm,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 维修工人列表
|
||||
list: [],
|
||||
// 是否展开,默认全部展开
|
||||
isExpandAll: true,
|
||||
// 重新渲染表格状态
|
||||
refreshTable: true,
|
||||
// 选中行
|
||||
currentRow: {},
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
userName: null,
|
||||
workType: null,
|
||||
isLeads: null,
|
||||
remark: null,
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
async getList() {
|
||||
try {
|
||||
this.loading = true;
|
||||
const res = await WorkerApi.getWorkerPage(this.queryParams);
|
||||
this.list = res.data.list;
|
||||
this.total = res.data.total;
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 添加/修改操作 */
|
||||
openForm(id) {
|
||||
this.$refs["formRef"].open(id);
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
async handleDelete(row) {
|
||||
const id = row.id;
|
||||
await this.$modal.confirm('是否确认删除维修工人编号为"' + id + '"的数据项?')
|
||||
try {
|
||||
await WorkerApi.deleteWorker(id);
|
||||
await this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
} catch {}
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
async handleExport() {
|
||||
await this.$modal.confirm('是否确认导出所有维修工人数据项?');
|
||||
try {
|
||||
this.exportLoading = true;
|
||||
const data = await WorkerApi.exportWorkerExcel(this.queryParams);
|
||||
this.$download.excel(data, '维修工人.xls');
|
||||
} catch {
|
||||
} finally {
|
||||
this.exportLoading = false;
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="姓名" prop="userName">
|
||||
<el-input v-model="queryParams.userName" placeholder="请输入维修工人名称" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="工种" prop="workType">
|
||||
<el-select v-model="queryParams.workType" placeholder="请选择客户类型">
|
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.REPAIR_WORK_TYPE)" :key="dict.value"
|
||||
:label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 操作工具栏 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="chooseUser()">选择用户
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="姓名" align="center" prop="userName"/>
|
||||
<el-table-column label="工种" align="center" prop="workType">
|
||||
<template v-slot="scope">
|
||||
<dict-tag :type="DICT_TYPE.REPAIR_WORK_TYPE" :value="scope.row.workType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="角色" align="center" prop="isLeads">
|
||||
<template v-slot="scope">
|
||||
<el-tag v-if="scope.row.isLeads == '1'" type="success">班组长</el-tag>
|
||||
<el-tag v-if="scope.row.isLeads == '0'" type="warning">维修工</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark"/>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template v-slot="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.id)"
|
||||
v-hasPermi="['repair:worker:update']">修改
|
||||
</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['repair:worker:delete']">删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"/>
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<WorkerForm ref="formRef" @success="getList"/>
|
||||
<ChooseUserDraw ref="chooseUserRef" @success="getList"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as WorkerApi from '@/api/repair/repairworker';
|
||||
import WorkerForm from './WorkerForm.vue';
|
||||
import ChooseUserDraw from './ChooseUserDraw.vue';
|
||||
|
||||
export default {
|
||||
name: "Worker",
|
||||
components: {
|
||||
WorkerForm,ChooseUserDraw
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 维修工人列表
|
||||
list: [],
|
||||
// 是否展开,默认全部展开
|
||||
isExpandAll: true,
|
||||
// 重新渲染表格状态
|
||||
refreshTable: true,
|
||||
// 选中行
|
||||
currentRow: {},
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
userName: null,
|
||||
workType: null,
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
async getList() {
|
||||
try {
|
||||
this.loading = true;
|
||||
const res = await WorkerApi.getWorkerPage(this.queryParams);
|
||||
this.list = res.data.records;
|
||||
this.total = res.data.total;
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 选择用户
|
||||
**/
|
||||
chooseUser(){
|
||||
this.$refs["chooseUserRef"].open();
|
||||
},
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 添加/修改操作 */
|
||||
openForm(id) {
|
||||
this.$refs["formRef"].open(id);
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
async handleDelete(row) {
|
||||
const id = row.id;
|
||||
await this.$modal.confirm('是否确认删除维修工人编号为"' + id + '"的数据项?')
|
||||
try {
|
||||
await WorkerApi.deleteWorker(id);
|
||||
await this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
} catch {
|
||||
}
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
async handleExport() {
|
||||
await this.$modal.confirm('是否确认导出所有维修工人数据项?');
|
||||
try {
|
||||
this.exportLoading = true;
|
||||
const data = await WorkerApi.exportWorkerExcel(this.queryParams);
|
||||
this.$download.excel(data, '维修工人.xls');
|
||||
} catch {
|
||||
} finally {
|
||||
this.exportLoading = false;
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user