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,110 +1,125 @@
<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> <el-form-item label="姓名" prop="userName">
<el-form-item label="工种" prop="workType"> <el-input v-model="formData.userName" disabled placeholder="请输入维修工人名称"/>
<el-select v-model="formData.workType" placeholder="请选择工种"> </el-form-item>
<el-option label="请选择字典生成" value="" /> </el-col>
</el-select> <el-col :span="12">
</el-form-item> <el-form-item label="工种" prop="workType">
<el-form-item label="是否为组长0代表不是 1代表是" prop="isLeads"> <el-select v-model="formData.workType" placeholder="请选择工种">
<el-input v-model="formData.isLeads" placeholder="请输入是否为组长0代表不是 1代表是" /> <el-option v-for="dict in this.getDictDatas(DICT_TYPE.REPAIR_WORK_TYPE)" :key="dict.value"
</el-form-item> :label="dict.label" :value="dict.value" />
<el-form-item label="备注" prop="remark"> </el-select>
<el-input v-model="formData.remark" placeholder="请输入备注" /> </el-form-item>
</el-form-item> </el-col>
</el-form> <el-col :span="12">
<div slot="footer" class="dialog-footer"> <el-form-item label="是否班组长" prop="isLeads">
<el-button type="primary" @click="submitForm" :disabled="formLoading"> </el-button> <el-radio-group v-model="formData.isLeads">
<el-button @click="dialogVisible = false"> </el-button> <el-radio label="0"></el-radio>
</div> <el-radio label="1"></el-radio>
</el-dialog> </el-radio-group>
</div> </el-form-item>
</template> </el-col>
<el-col :span="24">
<script> <el-form-item label="备注" prop="remark">
import * as WorkerApi from '@/api/repair/repairworker'; <el-input type="textarea" v-model="formData.remark" placeholder="请输入备注"/>
export default { </el-form-item>
name: "WorkerForm", </el-col>
components: { </el-row>
}, </el-form>
data() { <div slot="footer" class="dialog-footer">
return { <el-button type="primary" @click="submitForm" :disabled="formLoading"> </el-button>
// <el-button @click="dialogVisible = false"> </el-button>
dialogTitle: "", </div>
// </el-dialog>
dialogVisible: false, </div>
// 12 </template>
formLoading: false,
// <script>
formData: { import * as WorkerApi from '@/api/repair/repairworker';
userName: undefined,
workType: undefined, export default {
isLeads: undefined, name: "WorkerForm",
remark: undefined, components: {},
}, data() {
// return {
formRules: { //
isLeads: [{ required: true, message: '是否为组长0代表不是 1代表是不能为空', trigger: 'blur' }], dialogTitle: "",
}, //
}; dialogVisible: false,
}, // 12
methods: { formLoading: false,
/** 打开弹窗 */ //
async open(id) { formData: {
this.dialogVisible = true; userName: undefined,
this.reset(); workType: undefined,
// isLeads: undefined,
if (id) { remark: undefined,
this.formLoading = true; },
try { //
const res = await WorkerApi.getWorker(id); formRules: {
this.formData = res.data; workType: [{required: true, message: '工种不能为空', trigger: 'blur'}],
this.title = "修改维修工人"; isLeads: [{required: true, message: '是否为组长不能为空', trigger: 'blur'}],
} finally { },
this.formLoading = false; };
} },
} methods: {
this.title = "新增维修工人"; /** 打开弹窗 */
}, async open(id) {
/** 提交按钮 */ this.dialogVisible = true;
async submitForm() { this.reset();
// //
await this.$refs["formRef"].validate(); if (id) {
this.formLoading = true; this.formLoading = true;
try { try {
const data = this.formData; const res = await WorkerApi.getWorker(id);
// this.formData = res.data;
if (data.id) { this.title = "修改维修工人";
await WorkerApi.updateWorker(data); } finally {
this.$modal.msgSuccess("修改成功"); this.formLoading = false;
this.dialogVisible = false; }
this.$emit('success'); }
return; this.title = "新增维修工人";
} },
// /** 提交按钮 */
await WorkerApi.createWorker(data); async submitForm() {
this.$modal.msgSuccess("新增成功"); //
this.dialogVisible = false; await this.$refs["formRef"].validate();
this.$emit('success'); this.formLoading = true;
} finally { try {
this.formLoading = false; const data = this.formData;
} //
}, if (data.id) {
/** 表单重置 */ await WorkerApi.updateWorker(data);
reset() { this.$modal.msgSuccess("修改成功");
this.formData = { this.dialogVisible = false;
userName: undefined, this.$emit('success');
workType: undefined, return;
isLeads: undefined, }
remark: undefined, //
}; await WorkerApi.createWorker(data);
this.resetForm("formRef"); this.$modal.msgSuccess("新增成功");
} this.dialogVisible = false;
} this.$emit('success');
}; } finally {
</script> 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> <template>
<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"
</el-select> :label="dict.label" :value="dict.value" />
</el-form-item> </el-select>
<el-form-item label="是否为组长0代表不是 1代表是" prop="isLeads"> </el-form-item>
<el-input v-model="queryParams.isLeads" placeholder="请输入是否为组长0代表不是 1代表是" clearable @keyup.enter.native="handleQuery"/> <el-form-item>
</el-form-item> <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-form-item label="备注" prop="remark"> <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
<el-input v-model="queryParams.remark" placeholder="请输入备注" clearable @keyup.enter.native="handleQuery"/> </el-form-item>
</el-form-item> </el-form>
<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-row :gutter="10" class="mb8">
</el-form-item> <el-col :span="1.5">
</el-form> <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="chooseUser()">选择用户
</el-button>
<!-- 操作工具栏 --> </el-col>
<el-row :gutter="10" class="mb8"> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<el-col :span="1.5"> </el-row>
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="openForm(undefined)"
v-hasPermi="['repair:worker:create']">新增</el-button> <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
</el-col> <el-table-column label="姓名" align="center" prop="userName"/>
<el-col :span="1.5"> <el-table-column label="工种" align="center" prop="workType">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading" <template v-slot="scope">
v-hasPermi="['repair:worker:export']">导出</el-button> <dict-tag :type="DICT_TYPE.REPAIR_WORK_TYPE" :value="scope.row.workType" />
</el-col> </template>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> </el-table-column>
</el-row> <el-table-column label="角色" align="center" prop="isLeads">
<template v-slot="scope">
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true"> <el-tag v-if="scope.row.isLeads == '1'" type="success">班组长</el-tag>
<el-table-column label="维修工人名称" align="center" prop="userName" /> <el-tag v-if="scope.row.isLeads == '0'" type="warning">维修工</el-tag>
<el-table-column label="工种" align="center" prop="workType" /> </template>
<el-table-column label="是否为组长0代表不是 1代表是" align="center" prop="isLeads" /> </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 size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" </el-button>
v-hasPermi="['repair:worker:delete']">删除</el-button> <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
</template> v-hasPermi="['repair:worker:delete']">删除
</el-table-column> </el-button>
</el-table> </template>
<!-- 分页组件 --> </el-table-column>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" </el-table>
@pagination="getList"/> <!-- 分页组件 -->
<!-- 对话框(添加 / 修改) --> <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
<WorkerForm ref="formRef" @success="getList" /> @pagination="getList"/>
</div> <!-- 对话框(添加 / 修改) -->
</template> <WorkerForm ref="formRef" @success="getList"/>
<ChooseUserDraw ref="chooseUserRef" @success="getList"/>
<script> </div>
import * as WorkerApi from '@/api/repair/repairworker'; </template>
import WorkerForm from './WorkerForm.vue';
export default { <script>
name: "Worker", import * as WorkerApi from '@/api/repair/repairworker';
components: { import WorkerForm from './WorkerForm.vue';
WorkerForm, import ChooseUserDraw from './ChooseUserDraw.vue';
},
data() { export default {
return { name: "Worker",
// components: {
loading: true, WorkerForm,ChooseUserDraw
// },
exportLoading: false, data() {
// return {
showSearch: true, //
// loading: true,
total: 0, //
// exportLoading: false,
list: [], //
// showSearch: true,
isExpandAll: true, //
// total: 0,
refreshTable: true, //
// list: [],
currentRow: {}, //
// isExpandAll: true,
queryParams: { //
pageNo: 1, refreshTable: true,
pageSize: 10, //
userName: null, currentRow: {},
workType: null, //
isLeads: null, queryParams: {
remark: null, pageNo: 1,
}, pageSize: 10,
}; userName: null,
}, workType: null,
created() { },
this.getList(); };
}, },
methods: { created() {
/** 查询列表 */ this.getList();
async getList() { },
try { methods: {
this.loading = true; /** 查询列表 */
const res = await WorkerApi.getWorkerPage(this.queryParams); async getList() {
this.list = res.data.list; try {
this.total = res.data.total; this.loading = true;
} finally { const res = await WorkerApi.getWorkerPage(this.queryParams);
this.loading = false; this.list = res.data.records;
} this.total = res.data.total;
}, } finally {
/** 搜索按钮操作 */ this.loading = false;
handleQuery() { }
this.queryParams.pageNo = 1; },
this.getList();
}, /**
/** 重置按钮操作 */ * 选择用户
resetQuery() { **/
this.resetForm("queryForm"); chooseUser(){
this.handleQuery(); this.$refs["chooseUserRef"].open();
}, },
/** 添加/修改操作 */
openForm(id) { /** 搜索按钮操作 */
this.$refs["formRef"].open(id); handleQuery() {
}, this.queryParams.pageNo = 1;
/** 删除按钮操作 */ this.getList();
async handleDelete(row) { },
const id = row.id; /** 重置按钮操作 */
await this.$modal.confirm('是否确认删除维修工人编号为"' + id + '"的数据项?') resetQuery() {
try { this.resetForm("queryForm");
await WorkerApi.deleteWorker(id); this.handleQuery();
await this.getList(); },
this.$modal.msgSuccess("删除成功"); /** 添加/修改操作 */
} catch {} openForm(id) {
}, this.$refs["formRef"].open(id);
/** 导出按钮操作 */ },
async handleExport() { /** 删除按钮操作 */
await this.$modal.confirm('是否确认导出所有维修工人数据项?'); async handleDelete(row) {
try { const id = row.id;
this.exportLoading = true; await this.$modal.confirm('是否确认删除维修工人编号为"' + id + '"的数据项?')
const data = await WorkerApi.exportWorkerExcel(this.queryParams); try {
this.$download.excel(data, '维修工人.xls'); await WorkerApi.deleteWorker(id);
} catch { await this.getList();
} finally { this.$modal.msgSuccess("删除成功");
this.exportLoading = false; } catch {
} }
}, },
} /** 导出按钮操作 */
}; async handleExport() {
</script> 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>