|
@@ -3,72 +3,29 @@
|
|
<!-- 左侧区域 -->
|
|
<!-- 左侧区域 -->
|
|
<section class="list-part-container" style="flex: 2">
|
|
<section class="list-part-container" style="flex: 2">
|
|
<!-- 搜索区 -->
|
|
<!-- 搜索区 -->
|
|
- <el-form
|
|
|
|
- class="list-search-container"
|
|
|
|
- :model="queryDeptParams"
|
|
|
|
- ref="queryRef"
|
|
|
|
- :inline="true"
|
|
|
|
- >
|
|
|
|
|
|
+ <el-form class="list-search-container" :model="queryDeptParams" ref="queryRef" :inline="true">
|
|
<el-form-item class="section-title" label="车间管理" />
|
|
<el-form-item class="section-title" label="车间管理" />
|
|
<el-form-item>
|
|
<el-form-item>
|
|
- <el-button type="primary" icon="Plus" @click="handleAdd"
|
|
|
|
- >新增</el-button
|
|
|
|
- >
|
|
|
|
|
|
+ <el-button type="primary" icon="Plus" @click="handleAdd">新增</el-button>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="车间名称:" prop="name">
|
|
<el-form-item label="车间名称:" prop="name">
|
|
- <el-input
|
|
|
|
- v-model.trim="queryParams.name"
|
|
|
|
- placeholder="请输入车间名称"
|
|
|
|
- @keydown.enter.prevent
|
|
|
|
- @keyup.enter="handleSearch"
|
|
|
|
- clearable
|
|
|
|
- style="width: 155px"
|
|
|
|
- />
|
|
|
|
|
|
+ <el-input v-model.trim="queryParams.name" placeholder="请输入车间名称" @keydown.enter.prevent @keyup.enter="handleSearch" clearable style="width: 155px" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-form-item>
|
|
- <el-button type="info" icon="Search" @click="handleSearch"
|
|
|
|
- >搜索</el-button
|
|
|
|
- >
|
|
|
|
|
|
+ <el-button type="info" icon="Search" @click="handleSearch">搜索</el-button>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
<!-- 列表区 -->
|
|
<!-- 列表区 -->
|
|
<div class="el-table-container">
|
|
<div class="el-table-container">
|
|
<div class="el-table-inner-container">
|
|
<div class="el-table-inner-container">
|
|
<!-- 列表区 -->
|
|
<!-- 列表区 -->
|
|
- <el-table
|
|
|
|
- ref="workshopTable"
|
|
|
|
- v-loading="loading"
|
|
|
|
- :data="workshopList"
|
|
|
|
- row-key="id"
|
|
|
|
- height="100%"
|
|
|
|
- :indent="20"
|
|
|
|
- default-expand-all
|
|
|
|
- highlight-current-row
|
|
|
|
- @current-change="handleGetDept"
|
|
|
|
- >
|
|
|
|
- <el-table-column
|
|
|
|
- label="行号"
|
|
|
|
- type="index"
|
|
|
|
- width="50"
|
|
|
|
- align="center"
|
|
|
|
- />
|
|
|
|
|
|
+ <el-table ref="workshopTable" v-loading="loading" :data="workshopList" row-key="id" height="100%" :indent="20" default-expand-all highlight-current-row @current-change="handleGetDept">
|
|
|
|
+ <el-table-column label="行号" type="index" width="50" align="center" />
|
|
<el-table-column label="车间名称" prop="name" align="center" />
|
|
<el-table-column label="车间名称" prop="name" align="center" />
|
|
<el-table-column label="操作" width="150" align="center">
|
|
<el-table-column label="操作" width="150" align="center">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
- <el-button
|
|
|
|
- link
|
|
|
|
- type="warning"
|
|
|
|
- icon="Edit"
|
|
|
|
- @click="handleUpdateWorkshop(scope.row)"
|
|
|
|
- >编辑</el-button
|
|
|
|
- >
|
|
|
|
- <el-button
|
|
|
|
- link
|
|
|
|
- type="danger"
|
|
|
|
- icon="Delete"
|
|
|
|
- @click="handleDeleteWorkshop(scope.row)"
|
|
|
|
- >删除</el-button
|
|
|
|
- >
|
|
|
|
|
|
+ <el-button link type="warning" icon="Edit" @click="handleUpdateWorkshop(scope.row)">编辑</el-button>
|
|
|
|
+ <el-button link type="danger" icon="Delete" @click="handleDeleteWorkshop(scope.row)">删除</el-button>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
@@ -79,53 +36,28 @@
|
|
<!-- 右侧区域 -->
|
|
<!-- 右侧区域 -->
|
|
<section class="list-part-container" style="flex: 3">
|
|
<section class="list-part-container" style="flex: 3">
|
|
<!-- 搜索区 -->
|
|
<!-- 搜索区 -->
|
|
- <el-form
|
|
|
|
- class="list-search-container"
|
|
|
|
- :model="queryDeptParams"
|
|
|
|
- ref="queryRef"
|
|
|
|
- :inline="true"
|
|
|
|
- >
|
|
|
|
|
|
+ <el-form class="list-search-container" :model="queryDeptParams" ref="queryRef" :inline="true">
|
|
<el-form-item class="section-title" label="工段" />
|
|
<el-form-item class="section-title" label="工段" />
|
|
<el-form-item>
|
|
<el-form-item>
|
|
- <el-button type="primary" icon="Plus" @click="handleAddDept"
|
|
|
|
- >新增</el-button
|
|
|
|
- >
|
|
|
|
|
|
+ <el-button type="primary" icon="Plus" @click="handleAddDept">新增</el-button>
|
|
<el-button type="danger" icon="Delete" @click="handleDeptDelete">
|
|
<el-button type="danger" icon="Delete" @click="handleDeptDelete">
|
|
- 删除</el-button
|
|
|
|
- >
|
|
|
|
|
|
+ 删除</el-button>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
|
|
|
|
<!-- 列表区 -->
|
|
<!-- 列表区 -->
|
|
<div class="el-table-container">
|
|
<div class="el-table-container">
|
|
<div class="el-table-inner-container">
|
|
<div class="el-table-inner-container">
|
|
- <el-table
|
|
|
|
- v-loading="deptLoading"
|
|
|
|
- :data="deptList"
|
|
|
|
- :row-key="getRowKey"
|
|
|
|
- height="100%"
|
|
|
|
- @selection-change="handleSelectionChange"
|
|
|
|
- >
|
|
|
|
|
|
+ <el-table v-loading="deptLoading" :data="deptList" :row-key="getRowKey" height="100%" @selection-change="handleSelectionChange">
|
|
<el-table-column type="selection" width="40" align="center" />
|
|
<el-table-column type="selection" width="40" align="center" />
|
|
- <el-table-column
|
|
|
|
- type="index"
|
|
|
|
- label="行号"
|
|
|
|
- width="50"
|
|
|
|
- align="center"
|
|
|
|
- />
|
|
|
|
|
|
+ <el-table-column type="index" label="行号" width="50" align="center" />
|
|
<el-table-column label="工段名称" prop="deptName" align="center" />
|
|
<el-table-column label="工段名称" prop="deptName" align="center" />
|
|
<el-table-column label="工段编码" prop="deptCode" align="center" />
|
|
<el-table-column label="工段编码" prop="deptCode" align="center" />
|
|
</el-table>
|
|
</el-table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- 分页 -->
|
|
<!-- 分页 -->
|
|
- <pagination
|
|
|
|
- v-show="total > 0"
|
|
|
|
- :total="total"
|
|
|
|
- v-model:page="queryDeptParams.pageNum"
|
|
|
|
- v-model:limit="queryDeptParams.pageSize"
|
|
|
|
- @pagination="getdeptList"
|
|
|
|
- />
|
|
|
|
|
|
+ <pagination v-show="total > 0" :total="total" v-model:page="queryDeptParams.pageNum" v-model:limit="queryDeptParams.pageSize" @pagination="getdeptList" />
|
|
</section>
|
|
</section>
|
|
|
|
|
|
<!-- 表单 -->
|
|
<!-- 表单 -->
|
|
@@ -134,152 +66,149 @@
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<script setup >
|
|
<script setup >
|
|
-import { listWorkshop,delWorkshop } from "@/api/business/workshop";
|
|
|
|
-import { listDept,updateDeptWorkshop,updateDeptWorkshopByDeptId } from "@/api/system/dept";
|
|
|
|
|
|
+import { listWorkshop, delWorkshop } from '@/api/business/workshop'
|
|
|
|
+import { listDept, updateDeptWorkshop, updateDeptWorkshopByDeptId } from '@/api/system/dept'
|
|
import deptForm from '@/views/business/workshop/DialogDept'
|
|
import deptForm from '@/views/business/workshop/DialogDept'
|
|
import workshopForm from './form'
|
|
import workshopForm from './form'
|
|
-const { proxy } = getCurrentInstance();
|
|
|
|
|
|
+const { proxy } = getCurrentInstance()
|
|
|
|
|
|
-const workshopList = ref([]);
|
|
|
|
-const deptList = ref([]);
|
|
|
|
-const loading = ref(false);
|
|
|
|
-const deptLoading = ref(false);
|
|
|
|
-const currentWorkshop = ref({});
|
|
|
|
-const total = ref(0);
|
|
|
|
|
|
+const workshopList = ref([])
|
|
|
|
+const deptList = ref([])
|
|
|
|
+const loading = ref(false)
|
|
|
|
+const deptLoading = ref(false)
|
|
|
|
+const currentWorkshop = ref({})
|
|
|
|
+const total = ref(0)
|
|
const ids = ref([])
|
|
const ids = ref([])
|
|
const workshopIds = ref([])
|
|
const workshopIds = ref([])
|
|
/** 查询对象 */
|
|
/** 查询对象 */
|
|
const queryParams = ref({
|
|
const queryParams = ref({
|
|
- name: "",
|
|
|
|
-});
|
|
|
|
|
|
+ name: ''
|
|
|
|
+})
|
|
const queryDeptParams = ref({
|
|
const queryDeptParams = ref({
|
|
- deptCode: "",
|
|
|
|
-});
|
|
|
|
|
|
+ deptCode: ''
|
|
|
|
+})
|
|
|
|
|
|
/*********************** 方法区 ****************************/
|
|
/*********************** 方法区 ****************************/
|
|
|
|
|
|
/** 查询车间管理列表 */
|
|
/** 查询车间管理列表 */
|
|
function getList() {
|
|
function getList() {
|
|
- loading.value = true;
|
|
|
|
|
|
+ loading.value = true
|
|
listWorkshop(queryParams.value).then((res) => {
|
|
listWorkshop(queryParams.value).then((res) => {
|
|
if (res.code == 200) {
|
|
if (res.code == 200) {
|
|
- workshopList.value = res.rows;
|
|
|
|
|
|
+ workshopList.value = res.rows
|
|
if (workshopList.value.length > 0) {
|
|
if (workshopList.value.length > 0) {
|
|
- proxy.$refs.workshopTable.setCurrentRow(workshopList.value[0]);
|
|
|
|
|
|
+ proxy.$refs.workshopTable.setCurrentRow(workshopList.value[0])
|
|
} else {
|
|
} else {
|
|
- deptList.value = [];
|
|
|
|
|
|
+ deptList.value = []
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- });
|
|
|
|
- loading.value = false;
|
|
|
|
|
|
+ })
|
|
|
|
+ loading.value = false
|
|
}
|
|
}
|
|
function handleSearch() {
|
|
function handleSearch() {
|
|
- getList();
|
|
|
|
|
|
+ getList()
|
|
}
|
|
}
|
|
|
|
|
|
//打开添加工段
|
|
//打开添加工段
|
|
const handleAddDept = () => {
|
|
const handleAddDept = () => {
|
|
- handleAddBatchDept();
|
|
|
|
-};
|
|
|
|
|
|
+ handleAddBatchDept()
|
|
|
|
+}
|
|
/** 多选添加 */
|
|
/** 多选添加 */
|
|
function handleAddBatchDept() {
|
|
function handleAddBatchDept() {
|
|
- let deptIds = [];
|
|
|
|
|
|
+ let deptIds = []
|
|
deptIds = deptList.value.map((item) => {
|
|
deptIds = deptList.value.map((item) => {
|
|
- return item.deptId;
|
|
|
|
- });
|
|
|
|
- proxy.$refs.deptChoiceRef.open(deptIds);
|
|
|
|
|
|
+ return item.deptId
|
|
|
|
+ })
|
|
|
|
+ proxy.$refs.deptChoiceRef.open(deptIds)
|
|
}
|
|
}
|
|
|
|
|
|
// 多选框选中数据
|
|
// 多选框选中数据
|
|
function handleSelectionChange(selection) {
|
|
function handleSelectionChange(selection) {
|
|
ids.value = selection.map((item) => {
|
|
ids.value = selection.map((item) => {
|
|
- return item.deptId;
|
|
|
|
- });
|
|
|
|
- console.log(ids.value);
|
|
|
|
-
|
|
|
|
|
|
+ return item.deptId
|
|
|
|
+ })
|
|
|
|
+ console.log(ids.value)
|
|
}
|
|
}
|
|
/** 获取行 id */
|
|
/** 获取行 id */
|
|
function getRowKey(row) {
|
|
function getRowKey(row) {
|
|
- return row.deptId;
|
|
|
|
|
|
+ return row.deptId
|
|
}
|
|
}
|
|
/** 新增按钮操作 */
|
|
/** 新增按钮操作 */
|
|
function handleAdd() {
|
|
function handleAdd() {
|
|
- proxy.$refs.workshopRef.open();
|
|
|
|
|
|
+ proxy.$refs.workshopRef.open()
|
|
}
|
|
}
|
|
|
|
|
|
/** 修改按钮操作 */
|
|
/** 修改按钮操作 */
|
|
function handleUpdateWorkshop(row) {
|
|
function handleUpdateWorkshop(row) {
|
|
- proxy.$refs.workshopRef.open(row);
|
|
|
|
|
|
+ proxy.$refs.workshopRef.open(row)
|
|
}
|
|
}
|
|
|
|
|
|
/**车间表点击事件 */
|
|
/**车间表点击事件 */
|
|
function handleGetDept(row) {
|
|
function handleGetDept(row) {
|
|
if (row) {
|
|
if (row) {
|
|
- currentWorkshop.value = row;
|
|
|
|
|
|
+ currentWorkshop.value = row
|
|
}
|
|
}
|
|
- getdeptList();
|
|
|
|
|
|
+ getdeptList()
|
|
}
|
|
}
|
|
//工段多选带回
|
|
//工段多选带回
|
|
function handleDeptSelected(selection) {
|
|
function handleDeptSelected(selection) {
|
|
- let deptInfo = {}
|
|
|
|
- let deptIds = []
|
|
|
|
- deptIds = selection.map((item) => {
|
|
|
|
- return item.deptId;
|
|
|
|
- });
|
|
|
|
|
|
+ let deptInfo = {}
|
|
|
|
+ let deptIds = []
|
|
|
|
+ deptIds = selection.map((item) => {
|
|
|
|
+ return item.deptId
|
|
|
|
+ })
|
|
deptInfo.workshopId = currentWorkshop.value.id
|
|
deptInfo.workshopId = currentWorkshop.value.id
|
|
deptInfo.ids = deptIds
|
|
deptInfo.ids = deptIds
|
|
console.log(deptInfo)
|
|
console.log(deptInfo)
|
|
- updateDeptWorkshop(deptInfo).then((res)=>{
|
|
|
|
|
|
+ updateDeptWorkshop(deptInfo).then((res) => {
|
|
if (res.code == 200) {
|
|
if (res.code == 200) {
|
|
- handleGetDept(currentWorkshop.value)
|
|
|
|
- proxy.$modal.msgSuccess("添加成功!");
|
|
|
|
|
|
+ handleGetDept(currentWorkshop.value)
|
|
|
|
+ proxy.$modal.msgSuccess('添加成功!')
|
|
}
|
|
}
|
|
})
|
|
})
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
function getdeptList() {
|
|
function getdeptList() {
|
|
- queryDeptParams.value.workshopId = currentWorkshop.value.id;
|
|
|
|
|
|
+ queryDeptParams.value.workshopId = currentWorkshop.value.id
|
|
listDept(queryDeptParams.value).then((res) => {
|
|
listDept(queryDeptParams.value).then((res) => {
|
|
|
|
+ console.log(res)
|
|
if (res.code == 200) {
|
|
if (res.code == 200) {
|
|
- deptList.value = res.rows;
|
|
|
|
- total.value = res.total;
|
|
|
|
- deptLoading.value = false;
|
|
|
|
|
|
+ deptList.value = res.rows
|
|
|
|
+ total.value = res.total
|
|
|
|
+ deptLoading.value = false
|
|
}
|
|
}
|
|
- });
|
|
|
|
|
|
+ })
|
|
}
|
|
}
|
|
|
|
|
|
/** 删除按钮操作 */
|
|
/** 删除按钮操作 */
|
|
function handleDeleteWorkshop(row) {
|
|
function handleDeleteWorkshop(row) {
|
|
- const _ids = row.id
|
|
|
|
|
|
+ const _ids = row.id
|
|
proxy.$modal
|
|
proxy.$modal
|
|
- .confirm("是否确认删除选中的车间?")
|
|
|
|
|
|
+ .confirm('是否确认删除选中的车间?')
|
|
.then(function () {
|
|
.then(function () {
|
|
- return delWorkshop(_ids);
|
|
|
|
|
|
+ return delWorkshop(_ids)
|
|
})
|
|
})
|
|
//删除车间的同时删除工段上workId
|
|
//删除车间的同时删除工段上workId
|
|
.then(function () {
|
|
.then(function () {
|
|
-
|
|
|
|
- return updateDeptWorkshopByDeptId({workshopId:_ids})
|
|
|
|
|
|
+ return updateDeptWorkshopByDeptId({ workshopId: _ids })
|
|
})
|
|
})
|
|
.then(() => {
|
|
.then(() => {
|
|
- getList();
|
|
|
|
- proxy.$modal.msgSuccess("删除成功!");
|
|
|
|
|
|
+ getList()
|
|
|
|
+ proxy.$modal.msgSuccess('删除成功!')
|
|
})
|
|
})
|
|
- .catch(() => {});
|
|
|
|
|
|
+ .catch(() => {})
|
|
}
|
|
}
|
|
/** 车间工段删除按钮操作 */
|
|
/** 车间工段删除按钮操作 */
|
|
function handleDeptDelete(row) {
|
|
function handleDeptDelete(row) {
|
|
- updateDeptWorkshop({ids:ids.value}).then((res)=>{
|
|
|
|
|
|
+ updateDeptWorkshop({ ids: ids.value }).then((res) => {
|
|
if (res.code == 200) {
|
|
if (res.code == 200) {
|
|
- handleGetDept(currentWorkshop.value)
|
|
|
|
- proxy.$modal.msgSuccess("删除成功!");
|
|
|
|
|
|
+ handleGetDept(currentWorkshop.value)
|
|
|
|
+ proxy.$modal.msgSuccess('删除成功!')
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
- getList();
|
|
|
|
-});
|
|
|
|
|
|
+ getList()
|
|
|
|
+})
|
|
</script>
|
|
</script>
|
|
|
|
|