Commit 4beacc48 authored by 沈翠玲's avatar 沈翠玲

作业分派和用户管理

parent a00f2028
......@@ -134,3 +134,46 @@ export function getBpmUser() {
method: 'post',
})
}
// 查询人工作单元列表
export function listWorkunituser(query) {
return request({
url: '/mes/md/workunitWorker/list',
method: 'get',
params: query
})
}
// 查询人工作单元
export function getWorkunituser(recordId) {
return request({
url: '/mes/md/workunitWorker/' + recordId,
method: 'get'
})
}
// 新增人工作单元
export function addWorkunituser(data) {
return request({
url: '/mes/md/workunitWorker',
method: 'post',
data: data
})
}
// 修改人工作单元
export function updateWorkunituser(data) {
return request({
url: '/mes/md/workunitWorker',
method: 'put',
data: data
})
}
// 删除人工作单元
export function delWorkunituser(recordId) {
return request({
url: '/mes/md/workunitWorker/' + recordId,
method: 'delete'
})
}
......@@ -77,8 +77,10 @@
<script>
import { listTeam } from "@/api/mes/cal/team";
import { listWorkunit } from "@/api/mes/md/workunit";
export default {
name: "TeamSelect",
props: ['apiName'],
data() {
return {
showFlag: false,
......@@ -132,7 +134,8 @@ export default {
/** 查询工作单元列表 */
getList() {
this.loading = true;
listTeam(this.queryParams).then(response => {
const fn = this.apiName ? listWorkunit : listTeam
fn(this.queryParams).then(response => {
this.workunitList = response.rows;
this.total = response.total;
this.loading = false;
......
......@@ -444,77 +444,28 @@
</el-col>
</el-row>
</el-form>
<el-divider content-position="center" v-if="form.workstationId != null"
<!-- <el-divider content-position="center" v-if="form.workstationId != null"
>工作中心资源</el-divider
>
<!-- <MachinerySelectSingle
ref="machinerySelect"
@onSelected="onMachineryAdd"
></MachinerySelectSingle> -->
<div v-if="form.workstationId">
<!-- <el-col :span="24"> -->
<!-- <el-carousel trigger="click" type="card" :autoplay="false"> -->
<!-- <el-carousel-item>
<el-card shadow="always" style="width: 450px">
<div slot="header">
<span>设备资源</span>
<el-button
style="float: right; padding: 3px 0"
@click="handleMachineryAdd"
v-if="optType != 'view'"
type="text"
>新增</el-button
>
</div>
<WorkStationMachine
ref="machineryList"
:optType="optType"
:workstationId="form.workstationId"
style="align: center"
></WorkStationMachine>
</el-card>
</el-carousel-item> -->
<!-- <el-carousel-item> -->
<el-card shadow="always">
<div slot="header">
<span>人力资源</span>
<el-button
style="float: right; padding: 3px 0"
@click="handlePostAdd"
v-if="optType != 'view'"
type="text"
>新增</el-button
>
</div>
<Workstationworker
ref="postList"
:optType="optType"
:workstationId="form.workstationId"
></Workstationworker>
</el-card>
<!-- </el-carousel-item> -->
<!-- <el-carousel-item>
<el-card shadow="always" style="width: 400px">
<div slot="header">
<span>刀模版具</span>
<el-button
style="float: right; padding: 5px 0"
@click="handleToolTypeAdd"
v-if="optType != 'view'"
type="text"
>新增</el-button
>
</div>
<WorkStationTool
ref="toolList"
:optType="optType"
:workstationId="form.workstationId"
></WorkStationTool>
</el-card>
</el-carousel-item> -->
<!-- </el-carousel> -->
<!-- </el-col> -->
</div>
<el-card shadow="always">
<div slot="header">
<span>人力资源</span>
<el-button
style="float: right; padding: 3px 0"
@click="handlePostAdd"
v-if="optType != 'view'"
type="text"
>新增</el-button
>
</div>
<Workstationworker
ref="postList"
:optType="optType"
:workstationId="form.workstationId"
></Workstationworker>
</el-card>
</div> -->
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="cancel" v-if="optType == 'view'"
>返回</el-button
......
......@@ -469,7 +469,7 @@
</div>
</el-dialog>
<!-- 工作单元选择 -->
<jobAssign ref="jobAssign" :taskId="taskId" @onSelected="val => onWorkstationSelect(val)"></jobAssign>
<jobAssign ref="jobAssign" :taskId="taskId" :workstationId="workstationId" @onSelected="val => onWorkstationSelect(val)"></jobAssign>
<!-- 排程 -->
<el-dialog
title="详情"
......@@ -551,7 +551,7 @@ export default {
// 是否显示弹出层
open: false,
selections: [],
workstationId: null,
// 查询参数
queryParams: {
pageNum: 1,
......@@ -633,6 +633,7 @@ export default {
quantity: 1,
workunitName: null
};
this.workstationId = this.selections[0].workstationId
this.taskId = this.selections[0].taskId
this.jobAssignmentVisible = true;
},
......
......@@ -49,8 +49,6 @@ import { listWorkunit} from "@/api/mes/md/workunit";
dicts: ["sys_yes_no"],
data() {
return {
// taskId: this.taskId,
showFlag: false,
// 遮罩层
loading: true,
......@@ -86,6 +84,7 @@ import { listWorkunit} from "@/api/mes/md/workunit";
processName: null,
enableFlag: null,
stdWorkingTime: null,
workstationId: null
},
// 表单参数
form: {},
......@@ -96,6 +95,10 @@ import { listWorkunit} from "@/api/mes/md/workunit";
type: Number | undefined,
default: undefined,
}, //外部传入的工序过滤条件
workstationId: {
type: Number | undefined,
default: undefined,
}
},
created() {
this.getList();
......@@ -108,6 +111,13 @@ import { listWorkunit} from "@/api/mes/md/workunit";
},
immediate: true,
},
workstationId: {
handler(val) {
this.queryParams.workstationId = val;
this.getList();
},
immediate: true,
},
},
methods: {
/** 查询工作中心列表 */
......@@ -135,7 +145,6 @@ import { listWorkunit} from "@/api/mes/md/workunit";
workshopId: null,
workshopCode: null,
workshopName: null,
taskId: null,
processCode: null,
processName: null,
remark: null,
......@@ -144,6 +153,7 @@ import { listWorkunit} from "@/api/mes/md/workunit";
updateBy: null,
updateTime: null,
stdWorkingTime: null,
workstationId: null
};
this.resetForm("form");
},
......@@ -157,7 +167,8 @@ import { listWorkunit} from "@/api/mes/md/workunit";
this.queryParams = {
pageNum: 1,
pageSize: 10,
taskId: this.taskId
taskId: this.taskId,
workstationId: this.workstationId
};
this.resetForm("queryForm");
this.handleQuery();
......
......@@ -311,6 +311,26 @@
</el-col>
</el-row>
</el-form>
<el-divider content-position="center" v-if="title === '修改用户'"
>工作单元资源</el-divider
>
<div v-if="title === '修改用户'">
<el-card shadow="always">
<div slot="header">
<span>工作单元</span>
<el-button
style="float: right; padding: 3px 0"
@click="handlePostAdd"
type="text"
>新增</el-button
>
</div>
<Workstationworker
ref="postList"
:userId="form.userId"
></Workstationworker>
</el-card>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
......@@ -355,11 +375,11 @@ import { getToken } from "@/utils/auth";
import { treeselect } from "@/api/system/dept";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import Workstationworker from "./profile/worker";
export default {
name: "User",
dicts: ['sys_normal_disable', 'sys_user_sex'],
components: { Treeselect },
components: { Treeselect, Workstationworker },
data() {
return {
// 遮罩层
......@@ -478,6 +498,9 @@ export default {
});
},
methods: {
handlePostAdd() {
this.$refs.postList.handleAdd();
},
/** 查询用户列表 */
getList() {
this.loading = true;
......
<template>
<div class="app-container">
<el-table v-loading="loading" :data="workstationworkerList" @selection-change="handleSelectionChange">
<!-- <el-table-column label="岗位名称" align="center" prop="postName" /> -->
<!-- <el-table-column label="数量" align="center" prop="quantity" /> -->
<el-table-column label="工作单元" align="center" prop="workunitName" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['mes:md:workstation:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['mes:md:workstation:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<!-- <el-form-item label="岗位" prop="postId">
<el-select v-model="form.postId" placeholder="请选择岗位">
<el-option
v-for="dict in postOptions"
:key="dict.postId"
:label="dict.postName"
:value="dict.postId"
></el-option>
</el-select>
</el-form-item> -->
<el-form-item label="工作单元" prop="nickName">
<el-input v-model="form.workunitName" placeholder="请选择工作单元" readonly="readonly" >
<el-button
slot="append"
icon="el-icon-search"
@click="$refs.WorkunitSelect.showFlag = true"
></el-button>
</el-input>
<workunitSelect
ref="WorkunitSelect"
@onSelected="onworkunitSelected"
></workunitSelect>
</el-form-item>
<!-- <el-form-item label="数量" prop="quantity">
<el-input-number :min="1" v-model="form.quantity" placeholder="请输入所需人员数量" />
</el-form-item> -->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listWorkunituser, getWorkunituser, delWorkunituser, addWorkunituser, updateWorkunituser } from "@/api/system/user";
import {listAllPost} from "@/api/system/post";
import workunitSelect from "@/components/workunitSelect/single.vue"
// "@/views/mes/cal/team/calTeamSelect/multi.vue"
export default {
name: "Workunitworker",
components: {workunitSelect},
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 工作单元表格数据
workstationworkerList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
userId: this.userId
},
// 表单参数
form: {},
// 表单校验
rules: {
workstationId: [
{ required: true, message: "工作中心ID不能为空", trigger: "blur" }
],
postId: [
{ required: true, message: "岗位ID不能为空", trigger: "blur" }
],
quantity: [
{ required: true, message: "数量不能为空", trigger: "blur" }
],
}
};
},
props: {
userId: undefined,
},
created() {
this.getList();
},
watch: {
userId() {
this.getList()
},
},
methods: {
/** 查询工作单元列表 */
getList() {
this.loading = true;
listWorkunituser(this.queryParams).then(response => {
this.workstationworkerList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
userId: this.userId,
workunitId: null,
workunitName: null,
userName: null,
nickName: null,
postName: null,
quantity: null,
remark: null,
attr1: null,
attr2: null,
attr3: null,
attr4: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
onworkunitSelected(row){
console.log(45456, row);
if (row != undefined && row != null) {
this.form.workunitId = row.workunitId;
this.form.workunitName = row.workunitName;
console.log(111111, this.form);
}
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加工作单元";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getWorkunituser(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改工作单元";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateWorkunituser(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addWorkunituser(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除此岗位资源').then(function() {
return delWorkunituser(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
}
};
</script>
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