This commit is contained in:
PQZ 2024-10-09 19:05:35 +08:00
parent e124a1c539
commit 905ec22a77
5 changed files with 533 additions and 262 deletions

View File

@ -210,6 +210,8 @@ export const DICT_TYPE = {
REPAIR_PART_STATUS: 'repair_part_status', REPAIR_PART_STATUS: 'repair_part_status',
// 维修通知公告 // 维修通知公告
REPAIR_NOTICE_SERVER: 'weixiu', REPAIR_NOTICE_SERVER: 'weixiu',
//工种(维修项目类型)
REPAIR_WORK_TYPE: 'repair_work_type',
// ---------会员相关---------member_coupon_typemember_coupon_out_rulemember_carmember_active // ---------会员相关---------member_coupon_typemember_coupon_out_rulemember_carmember_active
//卡券类型 //卡券类型

View File

@ -81,8 +81,7 @@
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/> @pagination="getList"/>
</div> </div>
<div <div style="position: absolute;bottom: 0;width: 100%;right: 0;padding: 5px 20px 0;z-index: 999;background: white;text-align: right">
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"> <div class="demo-drawer__footer">
<el-button @click="cancelForm"> </el-button> <el-button @click="cancelForm"> </el-button>
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>

View 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,
// 12
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>

View File

@ -1,22 +1,36 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- 对话框(添加 / 修改) --> <!-- 对话框(添加 / 修改) -->
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="45%" v-dialogDrag append-to-body> <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-form ref="formRef" :model="formData" :rules="formRules" v-loading="formLoading" label-width="100px">
<el-form-item label="维修工人名称" prop="userName"> <el-row>
<el-input v-model="formData.userName" placeholder="请输入维修工人名称" /> <el-col :span="24">
<el-form-item label="姓名" prop="userName">
<el-input v-model="formData.userName" disabled placeholder="请输入维修工人名称"/>
</el-form-item> </el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工种" prop="workType"> <el-form-item label="工种" prop="workType">
<el-select v-model="formData.workType" placeholder="请选择工种"> <el-select v-model="formData.workType" placeholder="请选择工种">
<el-option label="请选择字典生成" value="" /> <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-select>
</el-form-item> </el-form-item>
<el-form-item label="是否为组长0代表不是 1代表是" prop="isLeads"> </el-col>
<el-input v-model="formData.isLeads" placeholder="请输入是否为组长0代表不是 1代表是" /> <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-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="formData.remark" placeholder="请输入备注" /> <el-input type="textarea" v-model="formData.remark" placeholder="请输入备注"/>
</el-form-item> </el-form-item>
</el-col>
</el-row>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm" :disabled="formLoading"> </el-button> <el-button type="primary" @click="submitForm" :disabled="formLoading"> </el-button>
@ -28,10 +42,10 @@
<script> <script>
import * as WorkerApi from '@/api/repair/repairworker'; import * as WorkerApi from '@/api/repair/repairworker';
export default { export default {
name: "WorkerForm", name: "WorkerForm",
components: { components: {},
},
data() { data() {
return { return {
// //
@ -49,7 +63,8 @@
}, },
// //
formRules: { formRules: {
isLeads: [{ required: true, message: '是否为组长0代表不是 1代表是不能为空', trigger: 'blur' }], workType: [{required: true, message: '工种不能为空', trigger: 'blur'}],
isLeads: [{required: true, message: '是否为组长不能为空', trigger: 'blur'}],
}, },
}; };
}, },

View File

@ -2,20 +2,15 @@
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="维修工人名称" prop="userName"> <el-form-item label="姓名" prop="userName">
<el-input v-model="queryParams.userName" placeholder="请输入维修工人名称" clearable @keyup.enter.native="handleQuery"/> <el-input v-model="queryParams.userName" placeholder="请输入维修工人名称" clearable @keyup.enter.native="handleQuery"/>
</el-form-item> </el-form-item>
<el-form-item label="工种" prop="workType"> <el-form-item label="工种" prop="workType">
<el-select v-model="queryParams.workType" placeholder="请选择工种" clearable size="small"> <el-select v-model="queryParams.workType" placeholder="请选择客户类型">
<el-option label="请选择字典生成" value="" /> <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-select>
</el-form-item> </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-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
@ -25,27 +20,34 @@
<!-- 操作工具栏 --> <!-- 操作工具栏 -->
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="openForm(undefined)" <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="chooseUser()">选择用户
v-hasPermi="['repair:worker:create']">新增</el-button> </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> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true"> <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="userName"/>
<el-table-column label="工种" align="center" prop="workType" /> <el-table-column label="工种" align="center" prop="workType">
<el-table-column label="是否为组长0代表不是 1代表是" align="center" prop="isLeads" /> <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" prop="remark"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot="scope"> <template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.id)" <el-button size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.id)"
v-hasPermi="['repair:worker:update']">修改</el-button> v-hasPermi="['repair:worker:update']">修改
</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['repair:worker:delete']">删除</el-button> v-hasPermi="['repair:worker:delete']">删除
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -54,16 +56,19 @@
@pagination="getList"/> @pagination="getList"/>
<!-- 对话框(添加 / 修改) --> <!-- 对话框(添加 / 修改) -->
<WorkerForm ref="formRef" @success="getList"/> <WorkerForm ref="formRef" @success="getList"/>
<ChooseUserDraw ref="chooseUserRef" @success="getList"/>
</div> </div>
</template> </template>
<script> <script>
import * as WorkerApi from '@/api/repair/repairworker'; import * as WorkerApi from '@/api/repair/repairworker';
import WorkerForm from './WorkerForm.vue'; import WorkerForm from './WorkerForm.vue';
import ChooseUserDraw from './ChooseUserDraw.vue';
export default { export default {
name: "Worker", name: "Worker",
components: { components: {
WorkerForm, WorkerForm,ChooseUserDraw
}, },
data() { data() {
return { return {
@ -89,8 +94,6 @@ export default {
pageSize: 10, pageSize: 10,
userName: null, userName: null,
workType: null, workType: null,
isLeads: null,
remark: null,
}, },
}; };
}, },
@ -103,12 +106,20 @@ export default {
try { try {
this.loading = true; this.loading = true;
const res = await WorkerApi.getWorkerPage(this.queryParams); const res = await WorkerApi.getWorkerPage(this.queryParams);
this.list = res.data.list; this.list = res.data.records;
this.total = res.data.total; this.total = res.data.total;
} finally { } finally {
this.loading = false; this.loading = false;
} }
}, },
/**
* 选择用户
**/
chooseUser(){
this.$refs["chooseUserRef"].open();
},
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNo = 1; this.queryParams.pageNo = 1;
@ -131,7 +142,8 @@ export default {
await WorkerApi.deleteWorker(id); await WorkerApi.deleteWorker(id);
await this.getList(); await this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
} catch {} } catch {
}
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
async handleExport() { async handleExport() {