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_NOTICE_SERVER: 'weixiu',
//工种(维修项目类型)
REPAIR_WORK_TYPE: 'repair_work_type',
// ---------会员相关---------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="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>

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

View File

@ -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>