Compare commits

..

No commits in common. "87bca23d967f35bf1a1dd91dc45db02c7d7311cf" and "86f246eb9409957975a9d31e8f3fa3f4b0818e5e" have entirely different histories.

46 changed files with 2144 additions and 3569 deletions

View File

@ -1,9 +1,9 @@
/* /*
* @Author: Do not edit * @Author: Do not edit
* @Date: 2023-10-21 11:50:46 * @Date: 2023-10-21 11:50:46
* @LastEditTime: 2024-07-08 14:35:17 * @LastEditTime: 2023-11-04 10:42:50
* @LastEditors: zwq * @LastEditors: DY
* @Description: * @Description:
*/ */
import request from '@/utils/request' import request from '@/utils/request'
@ -61,7 +61,7 @@ export function getCoreProductPage(query) {
// 获得所有列表 // 获得所有列表
export function getCoreProductList(query) { export function getCoreProductList(query) {
return request({ return request({
url: '/base/core-product-material/listAll', url: '/base/core-product/listAll',
method: 'get', method: 'get',
params: query params: query
}) })
@ -108,4 +108,4 @@ export function getCoreProductAttrPage(query) {
method: 'get', method: 'get',
params: query params: query
}) })
} }

View File

@ -51,13 +51,6 @@ export function getCode() {
}) })
} }
// 获得可用的班次列表
export function listClassesEnabled() {
return request({
url: '/base/group-classes/listEnable',
method: 'get'
})
}
// 导出班次基础信息 Excel // 导出班次基础信息 Excel
export function exportGroupClassesExcel(query) { export function exportGroupClassesExcel(query) {
return request({ return request({

View File

@ -1,125 +0,0 @@
import request from '@/utils/request'
// 创建排班计划配置基础信息
export function createGroupPlan(data) {
return request({
url: '/base/group-scheduling-plan/create',
method: 'post',
data: data
})
}
// 更新排班计划配置基础信息
export function updateGroupPlan(data) {
return request({
url: '/base/group-scheduling-plan/update',
method: 'put',
data: data
})
}
// 删除排班计划配置基础信息
export function deleteGroupPlan(id) {
return request({
url: '/base/group-scheduling-plan/delete?id=' + id,
method: 'delete'
})
}
// 获得排班计划配置基础信息
export function getGroupPlan(id) {
return request({
url: '/base/group-scheduling-plan/get?id=' + id,
method: 'get'
})
}
// 获得排班计划配置基础信息分页
export function getGroupPlanPage(query) {
return request({
url: '/base/group-scheduling-plan/page',
method: 'get',
params: query
})
}
// 获得所有排班计划列表
export function groupPlanList() {
return request({
url: '/base/group-scheduling-plan/listAll',
method: 'get'
})
}
// 获得排班计划相关班组列表
export function groupPlanTeamList(id) {
return request({
url: '/base/group-scheduling-plan-team/teamListByPlanId?planId=' + id,
method: 'get'
})
}
// 获得排班计划相关班次列表
export function groupPlanClassesList(id) {
return request({
url: '/base/group-scheduling-plan-classes/classesListByPlanId?planId=' + id,
method: 'get'
})
}
// 获取code
export function getCode() {
return request({
url: '/base/group-scheduling-plan/getCode',
method: 'get'
})
}
// 导出排班计划配置基础信息 Excel
export function exportGroupPlanExcel(query) {
return request({
url: '/base/group-scheduling-plan/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 获得产线工段树形结构
export function getGroupPlanTree() {
return request({
url: '/base/group-scheduling-plan/getLineSectionTree',
method: 'get'
})
}
// 创建排班计划产线工段
export function createGroupPlanLine(data) {
return request({
url: '/base/group-scheduling-plan-line-section/createPlanLineSection',
method: 'post',
data: data
})
}
// 更新排班计划产线工段
export function updateGroupPlanLine(data) {
return request({
url: '/base/group-scheduling-plan-line-section/updatePlanLineSection',
method: 'put',
data: data
})
}
// 获得排班计划配置基础信息
export function getGroupPlanLine(id) {
return request({
url: '/base/group-scheduling-plan-line-section/getLineSectionByPlanId?planId=' + id,
method: 'get'
})
}
// 获得当前登录用户所在部门id
export function getLoginUserDeptId() {
return request({
url: '/base/group-scheduling-plan-line-section/getLoginUserDeptId',
method: 'get'
})
}

View File

@ -1,54 +0,0 @@
import request from '@/utils/request'
// 创建排班规则基础信息
export function createGroupRule(data) {
return request({
url: '/base/group-scheduling-rule/create',
method: 'post',
data: data
})
}
// 更新排班规则基础信息
export function updateGroupRule(data) {
return request({
url: '/base/group-scheduling-rule/update',
method: 'put',
data: data
})
}
// 删除排班规则基础信息
export function deleteGroupRule(id) {
return request({
url: '/base/group-scheduling-rule/delete?id=' + id,
method: 'delete'
})
}
// 获得排班规则基础信息
export function getGroupRule(id) {
return request({
url: '/base/group-scheduling-rule/get?id=' + id,
method: 'get'
})
}
// 获得排班规则基础信息分页
export function getGroupRulePage(query) {
return request({
url: '/base/group-scheduling-rule/page',
method: 'get',
params: query
})
}
// 导出排班规则基础信息 Excel
export function exportGroupRuleExcel(query) {
return request({
url: '/base/group-scheduling-rule/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -8,14 +8,7 @@ export function getPreset(query) {
params: query params: query
}) })
} }
// 获取某月预排班
export function getScheduling(query) {
return request({
url: '/base/group-team-scheduling/getScheduling',
method: 'get',
params: query
})
}
// 批量创建-更新排班信息 // 批量创建-更新排班信息
export function createOrUpdateList(data) { export function createOrUpdateList(data) {
return request({ return request({

View File

@ -1,9 +1,9 @@
/* /*
* @Author: Do not edit * @Author: Do not edit
* @Date: 2023-10-21 11:50:46 * @Date: 2023-10-21 11:50:46
* @LastEditTime: 2024-07-05 10:09:18 * @LastEditTime: 2023-10-24 11:22:28
* @LastEditors: zwq * @LastEditors: DY
* @Description: * @Description:
*/ */
import request from '@/utils/request' import request from '@/utils/request'
@ -61,7 +61,7 @@ export function getMaterialPage(query) {
// 获得物料列表 // 获得物料列表
export function getMaterialList(query) { export function getMaterialList(query) {
return request({ return request({
url: '/base/core-product-material/listAll', url: '/base/material/listbyfilter',
method: 'get', method: 'get',
params: query params: query
}) })
@ -118,85 +118,4 @@ export function getMaterialAttr(query) {
method: 'get', method: 'get',
params: query params: query
}) })
} }
// 获得物料树结构
export function getMaterialTree() {
return request({
url: '/base/core-product-material-type/listTree',
method: 'get'
})
}
// 创建物料树
export function createMaterialTree(data) {
return request({
url: '/base/core-product-material-type/create',
method: 'post',
data: data
})
}
// 更新物料树
export function updateMaterialTree(data) {
return request({
url: '/base/core-product-material-type/update',
method: 'put',
data: data
})
}
// 删除物料树
export function deleteMaterialTree(id) {
return request({
url: '/base/core-product-material-type/delete?id=' + id,
method: 'delete'
})
}
// 获得产品物料分页
export function getProductMaterialPage(query) {
return request({
url: '/base/core-product-material/page',
method: 'get',
params: query
})
}
// 删除产品物料
export function deleteProductMaterial(id) {
return request({
url: '/base/core-product-material/delete?id=' + id,
method: 'delete'
})
}
// 创建产品物料
export function createProductMaterial(data) {
return request({
url: '/base/core-product-material/create',
method: 'post',
data: data
})
}
// 更新产品物料
export function updateProductMaterial(data) {
return request({
url: '/base/core-product-material/update',
method: 'put',
data: data
})
}
// 获得产品物料
export function getProductMaterial(id) {
return request({
url: '/base/core-product-material/get?id=' + id,
method: 'get'
})
}
// 获得产品物料code
export function getProductMaterialCode() {
return request({
url: '/base/core-product-material/getCode',
method: 'POST'
})
}

View File

@ -3,7 +3,7 @@
* @Date: 2023-10-21 11:50:46 * @Date: 2023-10-21 11:50:46
* @LastEditTime: 2023-11-27 17:54:28 * @LastEditTime: 2023-11-27 17:54:28
* @LastEditors: DY * @LastEditors: DY
* @Description: * @Description:
*/ */
import request from '@/utils/request' import request from '@/utils/request'
@ -70,7 +70,7 @@ export function getMaterialPBList(query) {
// 获得产品列表 // 获得产品列表
export function getProList(query) { export function getProList(query) {
return request({ return request({
url: '/base/core-product-material/listAll', url: '/base/core-product/listAll',
method: 'get', method: 'get',
params: query params: query
}) })

View File

@ -2,7 +2,7 @@ import request from '@/utils/request'
// 获得产品列表 // 获得产品列表
export function getProductAll() { export function getProductAll() {
return request({ return request({
url: '/base/core-product-material/listAll', url: '/base/core-product/listAll',
method: 'get' method: 'get'
}) })
} }

View File

@ -1,8 +1,8 @@
/* /*
* @Author: zhp * @Author: zhp
* @Date: 2023-11-07 19:47:48 * @Date: 2023-11-07 19:47:48
* @LastEditTime: 2024-07-08 14:33:12 * @LastEditTime: 2023-11-23 13:57:41
* @LastEditors: zwq * @LastEditors: zhp
* @Description: * @Description:
*/ */
import request from '@/utils/request' import request from '@/utils/request'
@ -99,7 +99,7 @@ export function getProcessEquMaterialBomDet(data) {
export function getMaterialList(data) { export function getMaterialList(data) {
return request({ return request({
url: '/base/core-product-material/listAll', url: '/base/material/listbyfilter',
method: 'get', method: 'get',
data: data data: data
}) })

View File

@ -25,7 +25,7 @@ export function getWorkOrderList(query) {
} }
export function getProductList(query) { export function getProductList(query) {
return request({ return request({
url: '/base/core-product-material/listAll', url: '/base/core-product/listAll',
method: 'get', method: 'get',
params: query, params: query,
}) })

View File

@ -1,8 +1,8 @@
<!-- <!--
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: zwq * @LastEditors: DY
* @LastEditTime: 2024-07-03 14:19:01 * @LastEditTime: 2023-11-16 09:14:35
* @Description: * @Description:
--> -->
<template> <template>
@ -62,7 +62,7 @@
<svg-icon style="width: 18px; height: 18px" class="item-icon" icon-class="edit" /> <svg-icon style="width: 18px; height: 18px" class="item-icon" icon-class="edit" />
</el-button> </el-button>
</el-tooltip> --> </el-tooltip> -->
<!-- <el-tooltip placement="top" content="删除"> <!-- <el-tooltip placement="top" content="删除">
<el-button <el-button
type="text" type="text"
@ -105,7 +105,7 @@
<script> <script>
import basicAdd from '../../core/mixins/basic-add'; import basicAdd from '../../core/mixins/basic-add';
import { getConOrderList, createConCoreWOr, getCoreWO } from '@/api/base/coreWorkOrder'; import { getConOrderList, createConCoreWOr, getCoreWO } from '@/api/base/coreWorkOrder';
import SmallTitle from '../coreWorkOrder/SmallTitle'; import SmallTitle from '../material/SmallTitle';
// import { parseTime } from '../../core/mixins/code-filter'; // import { parseTime } from '../../core/mixins/code-filter';
// import attrAdd from './attr-add'; // import attrAdd from './attr-add';

View File

@ -0,0 +1,65 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 15:27:31
* @LastEditors: zwq
* @LastEditTime: 2023-08-01 16:25:54
* @Description:
-->
<template>
<div :class="[className, { 'p-0': noPadding }]">
<slot />
</div>
</template>
<script>
export default {
props: {
size: {
// : xl lg md sm
type: String,
default: 'de',
validator: function (val) {
return ['xl', 'lg', 'de', 'md', 'sm'].indexOf(val) !== -1;
},
},
noPadding: {
type: Boolean,
default: false,
},
},
computed: {
className: function () {
return `${this.size}-title`;
},
},
};
</script>
<style lang="scss" scoped>
$pxls: (xl, 28px) (lg, 24px) (de, 20px) (md, 18px) (sm, 16px);
$mgr: 8px;
@each $size, $height in $pxls {
.#{$size}-title {
font-size: 18px;
line-height: $height;
color: #000;
font-weight: 500;
font-family: '微软雅黑', 'Microsoft YaHei', Arial, Helvetica, sans-serif;
&::before {
content: '';
display: inline-block;
vertical-align: top;
width: 4px;
height: $height + 2px;
border-radius: 1px;
margin-right: $mgr;
background-color: #0b58ff;
}
}
}
.p-0 {
padding: 0;
}
</style>

View File

@ -1,223 +1,459 @@
<!-- <!--
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: zwq * @LastEditors: DY
* @LastEditTime: 2024-07-08 16:52:34 * @LastEditTime: 2023-11-27 15:26:12
* @Description: * @Description:
--> -->
<template> <template>
<el-form <el-drawer
:model="dataForm" :visible.sync="visible"
:rules="dataRule" :show-close="false"
ref="dataForm" :wrapper-closable="isdetail"
@keyup.enter.native="dataFormSubmit()" class="drawer"
label-width="100px" size="60%">
label-position="top"> <small-title slot="title" :no-padding="true">
<el-row :gutter="20"> {{ isdetail ? '详情' : !dataForm.id ? '新增' : '编辑' }}
<el-col :span="8"> </small-title>
<el-form-item label="物料产品名称" prop="name"> <div class="content">
<el-input <div class="visual-part">
v-model="dataForm.name" <el-form
clearable :model="dataForm"
placeholder="请输入物料产品名称" /> :rules="dataRule"
</el-form-item> ref="dataForm"
</el-col> @keyup.enter.native="dataFormSubmit()"
<el-col :span="8"> label-width="100px"
<el-form-item label="物料产品编码" prop="code"> label-position="top">
<el-input <el-row :gutter="20">
v-model="dataForm.code" <el-col :span="12">
clearable <el-form-item label="物料编码" prop="code">
placeholder="请输入物料产品编码" /> <el-input
</el-form-item> v-model="dataForm.code"
</el-col> clearable
<el-col :span="8"> :disabled="isdetail"
<el-form-item label="物料产品类型" prop="typeId"> placeholder="请输入物料编码" />
<treeselect </el-form-item>
v-model="dataForm.typeId" </el-col>
:options="deptOptions" <el-col :span="12">
:normalizer="normalizer" <el-form-item label="物料名称" prop="name">
@select="setShowTime" <el-input v-model="dataForm.name" :disabled="isdetail" clearable placeholder="请输入物料名称" />
:show-count="true" </el-form-item>
:appendToBody="true" </el-col>
z-index="99999" </el-row>
placeholder="选择物料产品类型" /> <el-row :gutter="20">
</el-form-item> <el-col :span="12">
</el-col> <el-form-item label="英文名称" prop="engName">
<el-col :span="8"> <el-input
<el-form-item label="单位" prop="unit"> v-model="dataForm.engName"
<el-select clearable
v-model="dataForm.unit" :disabled="isdetail"
filterable placeholder="请输入英文名称" />
style="width: 100%" </el-form-item>
placeholder="请选择单位"> </el-col>
<el-option <el-col :span="12">
v-for="dict in getDictDatas(DICT_TYPE.UNIT_DICT)" <el-form-item label="物料类型" prop="type">
:key="dict.value" <el-select
:label="dict.label" v-model="dataForm.type"
:value="dict.value" /> filterable
</el-select> :disabled="isdetail"
</el-form-item> style="width: 100%"
</el-col> placeholder="请选择物料类型">
<el-col :span="8"> <el-option
<el-form-item label="规格" prop="specifications"> v-for="dict in materialList"
<el-input :key="dict.value"
v-model="dataForm.specifications" :label="dict.label"
clearable :value="dict.value" />
placeholder="请输入规格" /> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> </el-row>
<el-form-item label="供应商" prop="supplierId"> <el-row :gutter="20">
<el-select <el-col :span="12">
v-model="dataForm.supplierId" <el-form-item label="规格" prop="spec">
filterable <el-input
clearable v-model="dataForm.spec"
:style="{ width: '100%' }" clearable
placeholder="请选择供应商"> :disabled="isdetail"
<el-option placeholder="请输入规格" />
v-for="item in supplierArr" </el-form-item>
:key="item.id" </el-col>
:label="item.name" <el-col :span="12">
:value="item.id"></el-option> <el-form-item label="供应商" prop="supplierId">
</el-select> <el-select
</el-form-item> v-model="dataForm.supplierId"
</el-col> filterable
<el-col :span="8" v-if="showTime"> clearable
<el-form-item label="生产单位用时" prop="processTime"> :disabled="isdetail"
<el-input style="width: 100%"
v-model.number="dataForm.processTime" placeholder="请选择供应商">
type="number" <el-option
clearable v-for="dict in supplierList"
placeholder="请输入产线生产单位用时" /> :key="dict.id"
</el-form-item> :label="dict.name"
</el-col> :value="dict.id" />
<el-col :span="8"> </el-select>
<el-form-item label="备注" prop="remark"> </el-form-item>
<el-input </el-col>
v-model="dataForm.remark" </el-row>
clearable <el-row :gutter="20">
placeholder="请输入备注" /> <el-col :span="12">
</el-form-item> <el-form-item label="单位" prop="unit">
</el-col> <el-select
</el-row> v-model="dataForm.unit"
</el-form> filterable
:disabled="isdetail"
style="width: 100%"
placeholder="请选择物料单位">
<el-option
v-for="dict in getDictDatas('unit_dict')"
: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="remark">
<el-input v-model="dataForm.remark" :disabled="isdetail" clearable placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<div class="attr-list" v-if="idAttrShow">
<small-title
style="margin: 16px 0; padding-left: 8px"
:no-padding="true">
物料属性
</small-title>
<div v-if="!isdetail" class="action_btn">
<template>
<span style="display: inline-block;">
<el-button type="text" @click="addNew()" icon="el-icon-plus">新增</el-button>
</span>
</template>
</div>
<base-table
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="materialAttrList">
<method-btn
v-if="!isdetail"
slot="handleBtn"
:width="120"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
v-show="listQuery.total > 0"
:total="listQuery.total"
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:page-sizes="[5, 10, 15]"
@pagination="getList" />
</div>
<div v-if="!isdetail" class="drawer-body__footer">
<el-button style="" @click="goback()">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</div>
</div>
<attr-add
v-if="addOrUpdateVisible"
ref="addOrUpdate"
:material-id="dataForm.id"
@refreshDataList="getList" />
</el-drawer>
</template> </template>
<script> <script>
import basicAdd from '../../core/mixins/basic-add'; import basicAdd from '../../core/mixins/basic-add';
import { getTreeArr } from '../mixins/code-filter'; import { createMaterial, updateMaterial, getMaterial, getCode, getSupplierList, getMaterialAttrList, deleteMaterialAttr } from "@/api/base/material";
import { import { listData } from "@/api/system/dict/data";
createProductMaterial, import SmallTitle from './SmallTitle';
updateProductMaterial, import { parseTime } from '../../core/mixins/code-filter';
getProductMaterial, import attrAdd from './attr-add';
getProductMaterialCode, import { getDictDatas } from "@/utils/dict";
getSupplierList,
getMaterialTree, const tableBtn = [
} from '@/api/base/material'; {
import Treeselect from '@riophae/vue-treeselect'; type: 'edit',
import '@riophae/vue-treeselect/dist/vue-treeselect.css'; btnName: '编辑',
},
{
type: 'delete',
btnName: '删除',
},
];
const tableProps = [
{
prop: 'createTime',
label: '添加时间',
filter: parseTime,
},
{
prop: 'attrName',
label: '属性名',
},
{
prop: 'attrValue',
label: '属性值',
},
];
export default { export default {
mixins: [basicAdd], mixins: [basicAdd],
components: { components: { SmallTitle, attrAdd },
Treeselect,
},
data() { data() {
return { return {
tableBtn,
tableProps,
addOrUpdateVisible: false,
urlOptions: { urlOptions: {
isGetCode: true, isGetCode: true,
codeURL: getProductMaterialCode, codeURL: getCode,
createURL: createProductMaterial, createURL: createMaterial,
updateURL: updateProductMaterial, updateURL: updateMaterial,
infoURL: getProductMaterial, infoURL: getMaterial,
},
listQuery: {
pageSize: 10,
pageNo: 1,
total: 0,
}, },
deptOptions: undefined,
showTime: false,
dataForm: { dataForm: {
id: undefined, id: undefined,
code: undefined, code: undefined,
name: '', name: '',
typeId: undefined, engName: '',
unit: undefined, type: '',
specifications: undefined, spec: undefined,
supplierId: undefined, supplierId: undefined,
processTime: 0, remark: undefined,
remark: undefined, unit: ''
}, },
supplierArr: [], materialList: [],
treeArr: [], supplierList: [],
materialAttrList: [],
unitList: [],
visible: false,
isdetail: false,
idAttrShow: false,
dataRule: { dataRule: {
code: [{ required: true, message: '编号不能为空', trigger: 'blur' }], code: [{ required: true, message: "物料编码不能为空", trigger: "blur" }],
name: [{ required: true, message: '名称不能为空', trigger: 'blur' }], name: [{ required: true, message: "物料名称不能为空", trigger: "blur" }],
typeId: [ type: [{ required: true, message: "物料类型不能为空", trigger: "blur" }]
{ }
required: true,
message: '物料产品类型不能为空',
trigger: 'blur',
},
],
},
}; };
}, },
mounted() {}, mounted() {
this.getDict()
},
methods: { methods: {
init(id) { async getDict() {
this.dataForm.id = id || ''; //
const res = await listData({
pageNo: 1,
pageSize: 99,
dictType: 'material_type',
});
this.materialList = res.data.list.map(item => {
return {
label: item.label,
value: Number(item.value)
}
});
//
const supplierRes = await getSupplierList();
this.supplierList = supplierRes.data;
//
// const unitRes = await listData({
// pageNo: 1,
// pageSize: 99,
// dictType: 'goods_unit',
// });
// this.unitList = unitRes.data.list.map(item => {
// return {
// label: item.label,
// value: Number(item.value)
// }
// });
},
initData() {
this.materialAttrList.splice(0);
this.listQuery.total = 0;
},
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(
`是否确认删除属性名为"${raw.data.attrName}"的数据项?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
deleteMaterialAttr(raw.data.id).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getList();
},
});
});
})
.catch(() => {});
} else {
this.addNew(raw.data.id);
}
},
getList() {
//
getMaterialAttrList({
...this.listQuery,
materialId: this.dataForm.id,
}).then((response) => {
this.materialAttrList = response.data.list;
this.listQuery.total = response.data.total;
});
},
init(id, isdetail) {
this.initData();
this.isdetail = isdetail || false;
this.dataForm.id = id || undefined;
this.visible = true; this.visible = true;
if (id) {
this.idAttrShow = true
} else {
this.idAttrShow = false
}
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['dataForm'].resetFields(); this.$refs['dataForm'].resetFields();
if (this.dataForm.id) { if (this.dataForm.id) {
this.urlOptions.infoURL(id).then((response) => { //
this.dataForm = response.data; this.urlOptions.infoURL(id).then(response => {
this.setDataForm(); this.dataForm = response.data;
}); if (this.dataForm.unit) {
this.dataForm.unit = String(this.dataForm.unit)
}
});
//
this.getList();
} else { } else {
if (this.urlOptions.isGetCode) { if (this.urlOptions.isGetCode) {
this.getCode(); this.getCode()
this.setDataForm(); }
}
} }
}); });
}, },
typeId(typeId, product) { //
dataFormSubmit() {
this.$refs["dataForm"].validate((valid) => {
if (!valid) {
return false;
}
//
if (this.dataForm.id) {
this.urlOptions.updateURL(this.dataForm).then(response => {
this.$modal.msgSuccess("修改成功");
this.visible = false
this.$emit("refreshDataList");
});
return;
}
//
this.urlOptions.createURL(this.dataForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.idAttrShow = true
this.$emit("refreshDataList");
});
});
},
goback() {
this.$emit('refreshDataList');
this.visible = false;
// this.initData();
},
goEdit() {
this.isdetail = false;
},
// /
addNew(id) {
this.addOrUpdateVisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.dataForm.typeId = typeId || undefined; this.$refs.addOrUpdate.init(id);
this.showTime = product || false;
}); });
}, }
setDataForm() { }
getSupplierList().then((res) => {
this.supplierArr = res.data;
});
//
getMaterialTree().then((response) => {
this.deptOptions = [];
this.deptOptions.push(...this.handleTree(response.data, 'id'));
this.$nextTick(() => {
if (this.dataForm.id) {
this.treeArr = [];
this.treeArr = getTreeArr(response.data);//
this.showTime = this.treeArr.find(
(item) => item.id == this.dataForm.typeId
).product;
}
});
});
},
/** 转换菜单数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.id,
label: node.name,
children: node.children,
};
},
setShowTime(node) {
this.showTime = node.product || false;
},
},
}; };
</script> </script>
<style scoped>
.drawer >>> .el-drawer {
border-radius: 8px 0 0 8px;
display: flex;
flex-direction: column;
}
.drawer >>> .el-form-item__label {
padding: 0;
}
.drawer >>> .el-drawer__header {
margin: 0;
padding: 32px 32px 24px;
border-bottom: 1px solid #dcdfe6;
}
.drawer >>> .el-drawer__body {
flex: 1;
height: 1px;
display: flex;
flex-direction: column;
}
.drawer >>> .content {
padding: 30px 24px;
flex: 1;
display: flex;
flex-direction: column;
/* height: 100%; */
}
.drawer >>> .visual-part {
flex: 1 auto;
max-height: 76vh;
overflow: hidden;
overflow-y: scroll;
padding-right: 10px; /* 调整滚动条样式 */
}
.drawer >>> .el-form,
.drawer >>> .attr-list {
padding: 0 16px;
}
.drawer-body__footer {
display: flex;
justify-content: flex-end;
padding: 18px;
}
.action_btn {
float: right;
margin: -40px 15px;
font-size: 14px;
}
.add {
color: #0b58ff;
}
</style>

View File

@ -0,0 +1,141 @@
<template>
<el-dialog
:visible.sync="visible"
:width="'30%'"
:append-to-body="true"
:close-on-click-modal="false"
class="dialog">
<template #title>
<slot name="title">
<div class="titleStyle">
{{ !dataForm.id ? '新增' : '编辑' }}
</div>
</slot>
</template>
<el-form
ref="dataForm"
:model="dataForm"
:rules="dataRule"
label-width="70px"
@keyup.enter.native="dataFormSubmit()">
<el-form-item label="属性名" prop="attrName">
<el-input
v-model="dataForm.attrName"
placeholder="请输入属性名"
clearable />
</el-form-item>
<el-form-item label="属性值" prop="attrValue">
<el-input
v-model="dataForm.attrValue"
placeholder="请输入属性值"
clearable />
</el-form-item>
</el-form>
<el-row style="text-align: right">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</el-row>
</el-dialog>
</template>
<script>
import {
createMaterialAttr,
updateMaterialAttr,
getMaterialAttr
} from '@/api/base/material';
export default {
props: {
materialId: {
type: String,
default: '',
},
},
data() {
return {
visible: false,
dataForm: {
id: undefined,
attrName: '',
attrValue: '',
},
dataRule: {
attrName: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
},
};
},
methods: {
init(id) {
this.dataForm.id = id || '';
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
if (this.dataForm.id) {
getMaterialAttr({
id: this.dataForm.id
}).then((res) => {
const { attrName, attrValue } = res.data;
this.dataForm.attrName = attrName;
this.dataForm.attrValue = attrValue;
});
}
});
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
//
if (this.dataForm.id) {
updateMaterialAttr({
...this.dataForm,
materialId: this.materialId,
}).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
return;
}
//
createMaterialAttr({
...this.dataForm,
materialId: this.materialId,
}).then((response) => {
this.$modal.msgSuccess('新增成功');
this.visible = false;
this.$emit('refreshDataList');
});
}
});
},
},
};
</script>
<style scoped>
.dialog >>> .el-dialog__body {
padding: 30px 24px;
}
.dialog >>> .el-dialog__header {
font-size: 16px;
color: rgba(0, 0, 0, 0.85);
font-weight: 500;
padding: 13px 24px;
border-bottom: 1px solid #e9e9e9;
}
.dialog >>> .el-dialog__header .titleStyle::before {
content: '';
display: inline-block;
width: 4px;
height: 16px;
background-color: #0b58ff;
border-radius: 1px;
margin-right: 8px;
position: relative;
top: 2px;
}
</style>

View File

@ -1,135 +1,32 @@
<!--
* @Author: zwq
* @Date: 2024-07-01 14:54:06
* @LastEditors: zwq
* @LastEditTime: 2024-07-08 15:12:18
* @Description:
-->
<template> <template>
<div style="display: flex; gap: 16px; flex: 1; background: #eff1f6"> <div class="app-container">
<div <search-bar
class="app-container" :formConfigs="formConfig"
style="background: white; width: 280px; border-radius: 8px"> ref="searchBarForm"
<div class="head-container"> @headBtnClick="buttonClick" />
<el-input <base-table
v-model="treeName" v-loading="dataListLoading"
placeholder="请输入名称" :table-props="tableProps"
clearable :page="listQuery.pageNo"
size="small" :limit="listQuery.pageSize"
prefix-icon="el-icon-search" :table-data="tableData">
style="margin-bottom: 20px" /> <method-btn
</div> v-if="tableBtn.length"
<div class="head-container"> slot="handleBtn"
<el-tree :width="120"
v-loading="treeLoading" label="操作"
element-loading-text="拼命加载中" :method-list="tableBtn"
element-loading-spinner="el-icon-loading" @clickBtn="handleClick" />
element-loading-background="rgba(0, 0, 0, 0.8)" </base-table>
:data="deptOptions1" <pagination
:props="defaultProps" :limit.sync="listQuery.pageSize"
node-key="id" :page.sync="listQuery.pageNo"
:expand-on-click-node="false" :total="listQuery.total"
:filter-node-method="filterNode" @pagination="getDataList" />
ref="tree" <add-or-update
default-expand-all v-if="addOrUpdateVisible"
highlight-current ref="addOrUpdate"
@node-click="handleNodeClick"> @refreshDataList="getDataList" />
<span class="custom-tree-node" slot-scope="{ node, data }">
<span>{{ node.label }}</span>
<span style="float: right" v-if="data.parentId !== -1">
<el-button
class="btnHover"
type="text"
icon="el-icon-edit"
size="mini"
v-if="data.parentId !== 0"
@click="() => edit(node, data)" />
<el-button
class="btnHover"
type="text"
icon="el-icon-circle-plus-outline"
size="mini"
@click="() => append(data)" />
<el-button
class="btnHover"
type="text"
icon="el-icon-remove-outline"
size="mini"
v-if="data.parentId !== 0"
@click="() => remove(node, data)" />
</span>
</span>
</el-tree>
</div>
</div>
<div
class="app-container"
style="background: #fff; border-radius: 8px; width: 1px; flex: 1">
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
<!-- 添加或修改菜单对话框 -->
<el-dialog :title="title" :visible.sync="open" width="700px">
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-row>
<el-col :span="12">
<el-form-item label="父类型">
<treeselect
v-model="form.parentId"
:options="deptOptions"
:normalizer="normalizer"
:show-count="true"
:appendToBody="true"
z-index="99999"
placeholder="选择父类型" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="名称" prop="name">
<el-input v-model="form.name" placeholder="请输入名称" />
</el-form-item>
</el-col>
</el-row>
</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> </div>
</template> </template>
@ -137,129 +34,97 @@
import AddOrUpdate from './add-or-updata'; import AddOrUpdate from './add-or-updata';
import basicPage from '../../core/mixins/basic-page'; import basicPage from '../../core/mixins/basic-page';
import { parseTime } from '../../core/mixins/code-filter'; import { parseTime } from '../../core/mixins/code-filter';
import { publicFormatter } from '@/utils/dict';
import { import {
getProductMaterialPage, getMaterialPage,
deleteProductMaterial, deleteMaterial
getMaterialTree,
createMaterialTree,
updateMaterialTree,
deleteMaterialTree,
} from '@/api/base/material'; } from '@/api/base/material';
import Treeselect from '@riophae/vue-treeselect'; import { listData } from "@/api/system/dict/data";
import '@riophae/vue-treeselect/dist/vue-treeselect.css'; import { publicFormatter } from '@/utils/dict';
const tableProps = [ const tableProps = [
{ {
prop: 'createTime', prop: 'createTime',
label: '添加时间', label: '添加时间',
filter: parseTime, filter: parseTime
width: 150,
},
{
prop: 'name',
label: '物料产品名称',
}, },
{ {
prop: 'code', prop: 'code',
label: '物料产品编码', label: '物料编码'
}, },
{ {
prop: 'typeNameChain', prop: 'name',
label: '物料产品类型', label: '物料名称'
}, },
{ {
prop: 'unit', prop: 'engName',
label: '单位', label: '英文名称'
filter: publicFormatter('unit_dict'),
width: 60,
}, },
{ {
prop: 'specifications', prop: 'type',
label: '规格', label: '物料类型',
filter: publicFormatter('material_type')
}, },
{ {
prop: 'supplierName', prop: 'supplierName',
label: '供应商', label: '供应商'
}, },
{ {
prop: 'remark', prop: 'remark',
label: '备注', label: '备注'
}, }
]; ];
export default { export default {
mixins: [basicPage], mixins: [basicPage],
name: '',
components: {
AddOrUpdate,
Treeselect,
},
data() { data() {
return { return {
//
treeName: undefined,
deptOptions: undefined,
deptOptions1: undefined,
treeLoading: false,
defaultProps: {
children: 'children',
label: 'name',
},
//
title: '',
//
open: false,
//
form: {
id: undefined,
parentId: undefined,
name: undefined,
defaultType: false,
},
//
rules: {
name: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
},
urlOptions: { urlOptions: {
getDataListURL: getProductMaterialPage, getDataListURL: getMaterialPage,
deleteURL: deleteProductMaterial, deleteURL: deleteMaterial
// exportURL: exportFactoryExcel,
}, },
tableProps, tableProps,
tableBtn: [ tableBtn: [
this.$auth.hasPermi(`base:core-product:update`) this.$auth.hasPermi(`base:material:queryAttr`)
? {
type: 'detail',
btnName: '查看属性',
}
: undefined,
this.$auth.hasPermi(`base:material:update`)
? { ? {
type: 'edit', type: 'edit',
btnName: '编辑', btnName: '编辑',
} }
: undefined, : undefined,
this.$auth.hasPermi(`base:core-product:delete`) // this.$auth.hasPermi(`base:material:editAttr`)
// ? {
// type: 'editAttr',
// btnName: '',
// }
// : undefined,
this.$auth.hasPermi(`base:material:delete`)
? { ? {
type: 'delete', type: 'delete',
btnName: '删除', btnName: '删除',
} }
: undefined, : undefined,
].filter((v) => v), ].filter((v)=>v),
tableData: [], tableData: [],
typeList: [],
formConfig: [ formConfig: [
{ {
type: 'input', type: 'input',
label: '物料产品名称', label: '物料名称',
placeholder: '物料产品名称', placeholder: '物料名称',
param: 'name', param: 'name',
}, },
{ {
type: 'input', type: 'input',
label: '物料产品编号', label: '物料编码',
placeholder: '物料产品编号', placeholder: '物料编码',
param: 'code', param: 'code',
}, },
{
type: 'input',
label: '物料产品类型',
param: 'type',
disabled: true,
},
{ {
type: 'button', type: 'button',
btnName: '查询', btnName: '查询',
@ -274,43 +139,63 @@ export default {
btnName: '新增', btnName: '新增',
name: 'add', name: 'add',
color: 'success', color: 'success',
plain: true, plain: true
}, },
], ],
}; };
}, },
watch: { components: {
// AddOrUpdate,
treeName(val) {
this.$refs.tree.filter(val);
},
}, },
created() { created() {
this.getDataList(); this.getDict()
this.getTreeselect();
}, },
methods: { methods: {
// async getDict() {
deleteHandle(id, name, index) { //
this.$confirm(`是否确认删除物料产品名称为"${name}"的数据项`, '提示', { const res = await listData({
confirmButtonText: '确定', pageNo: 1,
cancelButtonText: '取消', pageSize: 99,
type: 'warning', dictType: 'material_type',
}) });
.then(() => { this.typeList = res.data.list.map(item => {
this.urlOptions.deleteURL(id).then(({ data }) => { return {
this.$message({ label: item.label,
message: '操作成功', value: Number(item.value)
type: 'success', }
duration: 1500, });
onClose: () => {
this.getDataList();
},
});
});
})
.catch(() => {});
}, },
otherMethods(val) {
if (val.type === 'detail') {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '详情';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id, true);
});
} else {
this.addOrEditTitle = '编辑';
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id);
});
}
},
//
getDataList() {
this.dataListLoading = true;
this.urlOptions.getDataListURL(this.listQuery).then(response => {
this.tableData = response.data.records.map(item => {
this.typeList.filter(t => {
if (item.type === t.value) {
item.materialType = t.label
}
})
return item
});
this.listQuery.total = response.data.total;
this.dataListLoading = false;
});
},
buttonClick(val) { buttonClick(val) {
switch (val.btnName) { switch (val.btnName) {
case 'search': case 'search':
@ -320,13 +205,19 @@ export default {
this.listQuery.code = val.code ? val.code : undefined; this.listQuery.code = val.code ? val.code : undefined;
this.getDataList(); this.getDataList();
break; break;
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 10,
pageNo: 1,
total: 1,
};
this.getDataList();
break;
case 'add': case 'add':
this.addOrEditTitle = '新增'; this.addOrEditTitle = '新增';
this.addOrUpdateVisible = true; this.addOrUpdateVisible = true;
this.$nextTick(() => { this.addOrUpdateHandle();
this.$refs.addOrUpdate.init();
this.$refs.addOrUpdate.typeId(this.listQuery.typeId,this.listQuery.product);
});
break; break;
case 'export': case 'export':
this.handleExport(); this.handleExport();
@ -335,126 +226,27 @@ export default {
console.log(val); console.log(val);
} }
}, },
//
/** 树操作 */ deleteHandle(id, name, index) {
this.$confirm(`是否删除物料名称为"${name}"的数据项?`, "提示", {
// confirmButtonText: "确定",
getTreeselect() { cancelButtonText: "取消",
this.treeLoading = true; type: "warning",
getMaterialTree().then((response) => { })
// treeArr[0].push(...this.handleTree(response.data, 'id')); .then(() => {
// deptOptions this.urlOptions.deleteURL(id).then(({ data }) => {
this.deptOptions = []; this.$message({
this.treeLoading = false; message: "操作成功",
this.deptOptions.push(...this.handleTree(response.data, 'id')); type: "success",
const arr = [{ name: '全部', parentId: -1 }]; duration: 1500,
this.deptOptions1 = arr.concat(this.deptOptions); onClose: () => {
}); this.getDataList();
}, },
// });
filterNode(value, data) { });
if (!value) return true; })
return data.name.indexOf(value) !== -1; .catch(() => { });
}, }
//
handleNodeClick(data) {
this.listQuery.typeId = data.id || undefined;
this.listQuery.product = data.product;
this.$refs.searchBarForm.formInline.type = data.name || undefined;
},
//
append(data) {
this.open = true;
this.title = '新增物料产品类型';
this.form.id = undefined;
this.form.parentId = data.id;
},
//
remove(node, data) {
this.$confirm(`是否确认删除名称为"${data.name}"的数据项`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
deleteMaterialTree(data.id).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getTreeselect();
},
});
});
})
.catch(() => {});
},
//
edit(node, data) {
this.open = true;
this.title = '编辑物料产品类型';
this.form.id = data.id;
this.form.name = data.name;
this.form.parentId = data.parentId;
},
/** 转换菜单数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.id,
label: node.name,
children: node.children,
};
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: undefined,
parentId: 0,
name: undefined,
defaultType: false,
};
this.resetForm('form');
},
//
submitForm() {
this.$refs['form'].validate((valid) => {
if (!valid) {
return false;
}
//
if (this.form.id) {
updateMaterialTree(this.form).then((response) => {
this.$modal.msgSuccess('修改成功');
this.cancel();
this.getTreeselect();
});
return;
}
//
createMaterialTree(this.form).then((response) => {
this.$modal.msgSuccess('新增成功');
this.cancel();
this.getTreeselect();
});
});
},
}, },
}; };
</script> </script>
<style scoped>
.btnHover:hover {
color: #67c23a;
transform: scale(1.5);
}
</style>

View File

@ -1,8 +1,8 @@
<!-- <!--
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: zwq * @LastEditors: DY
* @LastEditTime: 2024-07-09 09:59:11 * @LastEditTime: 2023-11-27 19:50:36
* @Description: * @Description:
--> -->
<template> <template>
@ -107,9 +107,10 @@
<script> <script>
import basicAdd from '../../core/mixins/basic-add'; import basicAdd from '../../core/mixins/basic-add';
import { createMaterialPB, updateMaterialPB, getMaterialPB, getCode, getProBomList, createMaterialPBDet, updateMaterialPBDet, deleteMaterialPBDet } from "@/api/base/materialProductBom"; import { createMaterialPB, updateMaterialPB, getMaterialPB, getCode, getProList, getProBomList, createMaterialPBDet, updateMaterialPBDet, deleteMaterialPBDet } from "@/api/base/materialProductBom";
import { getMaterialTree,getMaterialList } from '@/api/base/material'; import { getMaterialList } from "@/api/base/material";
import SmallTitle from '../coreWorkOrder/SmallTitle'; import { listData } from "@/api/system/dict/data";
import SmallTitle from '../material/SmallTitle';
import { parseTime } from '../../core/mixins/code-filter'; import { parseTime } from '../../core/mixins/code-filter';
import attrAdd from './attr-add'; import attrAdd from './attr-add';
import { publicFormatter } from '@/utils/dict'; import { publicFormatter } from '@/utils/dict';
@ -182,6 +183,7 @@ export default {
productList: [], productList: [],
materialAttrList: [], materialAttrList: [],
tableData: [], tableData: [],
unitList: [],
visible: false, visible: false,
isdetail: false, isdetail: false,
idAttrShow: false, idAttrShow: false,
@ -211,7 +213,7 @@ export default {
if (this.dataForm.id) { if (this.dataForm.id) {
this.urlOptions.updateURL(this.dataForm).then(response => { this.urlOptions.updateURL(this.dataForm).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.visible = false; this.visible = false;
this.$emit("refreshDataList"); this.$emit("refreshDataList");
}); });
return; return;
@ -227,14 +229,21 @@ export default {
}); });
}, },
async getDict() { async getDict() {
const materRes = await getMaterialTree(); //
let typeId = materRes.data[0].product?materRes.data[0].id:materRes.data[1].id const proRes = await getProList();
const listQuery= { this.productList = proRes.data;
typeId:typeId //
} const unitRes = await listData({
const materData = await getMaterialList(listQuery); pageNo: 1,
this.productList = []; pageSize: 99,
this.productList = materData.data; dictType: 'unit_dict',
});
this.unitList = unitRes.data.list.map(item => {
return {
label: item.label,
value: Number(item.value)
}
});
}, },
initData() { initData() {
// this.materialAttrList.splice(0); // this.materialAttrList.splice(0);

View File

@ -83,7 +83,7 @@
</template> </template>
<script> <script>
import { getMaterialTree,getMaterialList } from '@/api/base/material'; import { getMaterialList } from '@/api/base/material';
import { createMaterialPBDet, updateMaterialPBDet, getMaterialPBDet } from "@/api/base/materialProductBom"; import { createMaterialPBDet, updateMaterialPBDet, getMaterialPBDet } from "@/api/base/materialProductBom";
export default { export default {
@ -117,14 +117,8 @@ export default {
methods: { methods: {
async getDict() { async getDict() {
// //
const materRes = await getMaterialTree(); const res = await getMaterialList();
let typeId = materRes.data[0].product?materRes.data[1].id:materRes.data[0].id this.materialList = res.data;
const listQuery= {
typeId:typeId
}
const materData = await getMaterialList(listQuery);
this.materialList = [];
this.materialList = materData.data;
}, },
init(id) { init(id) {
this.dataForm.id = id || ''; this.dataForm.id = id || '';

View File

@ -1,8 +1,8 @@
<!-- <!--
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: zwq * @LastEditors: DY
* @LastEditTime: 2024-07-09 09:58:24 * @LastEditTime: 2023-11-27 19:57:23
* @Description: * @Description:
--> -->
<template> <template>
@ -22,7 +22,8 @@
clearable clearable
filterable filterable
@change="setCode" @change="setCode"
style="width: 100%"> style="width: 100%"
>
<el-option <el-option
v-for="dict in materialList" v-for="dict in materialList"
:key="dict.id" :key="dict.id"
@ -41,13 +42,14 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="物料批次" prop="materialDateId"> <el-form-item label="批次" prop="materialDateId">
<el-select <el-select
v-model="dataForm.materialDateId" v-model="dataForm.materialDateId"
clearable clearable
filterable filterable
placeholder="请选择物料批次" placeholder="请选择物料批次"
style="width: 100%"> style="width: 100%"
>
<el-option <el-option
v-for="dict in materialDateList" v-for="dict in materialDateList"
:key="dict.id" :key="dict.id"
@ -79,8 +81,8 @@
<el-date-picker <el-date-picker
v-model="dataForm.useTime" v-model="dataForm.useTime"
type="datetime" type="datetime"
format="yyyy-MM-dd HH:mm:ss" format='yyyy-MM-dd HH:mm:ss'
value-format="timestamp" value-format='timestamp'
placeholder="选择日期时间" /> placeholder="选择日期时间" />
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -96,8 +98,8 @@
<el-option <el-option
v-for="dict in workersList" v-for="dict in workersList"
:key="dict.id" :key="dict.id"
:label="dict.nickname" :label="dict.name"
:value="dict.nickname" /> :value="dict.name" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -105,12 +107,7 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<el-form-item label="使用数量" prop="num"> <el-form-item label="使用数量" prop="num">
<el-input-number <el-input-number v-model="dataForm.num" clearable controls-position="right" placeholder="请输入使用数量" style="width: 100%" />
v-model="dataForm.num"
clearable
controls-position="right"
placeholder="请输入使用数量"
style="width: 100%" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
@ -129,10 +126,7 @@
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input <el-input v-model="dataForm.remark" clearable placeholder="请输入备注" />
v-model="dataForm.remark"
clearable
placeholder="请输入备注" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -141,15 +135,9 @@
<script> <script>
import basicAdd from '../../core/mixins/basic-add'; import basicAdd from '../../core/mixins/basic-add';
import { import { createMaterialLog, updateMaterialLog, getMaterialLog, getEqListAll, getworkerAll } from "@/api/base/materialUseLog";
createMaterialLog, import { getMaterialList } from "@/api/base/material"
updateMaterialLog, import { getMaterDateList } from "@/api/base/materialDate"
getMaterialLog,
getEqListAll,
} from '@/api/base/materialUseLog';
import { getMaterialTree,getMaterialList } from '@/api/base/material';
import { getMaterDateList } from '@/api/base/materialDate';
import { listSimpleUsers } from '@/api/system/user';
export default { export default {
mixins: [basicAdd], mixins: [basicAdd],
@ -158,127 +146,115 @@ export default {
urlOptions: { urlOptions: {
createURL: createMaterialLog, createURL: createMaterialLog,
updateURL: updateMaterialLog, updateURL: updateMaterialLog,
infoURL: getMaterialLog, infoURL: getMaterialLog
}, },
dataForm: { dataForm: {
id: undefined, id: undefined,
materialId: undefined, materialId: undefined,
materialCode: undefined, materialCode: undefined,
materialDateId: undefined, materialDateId: undefined,
equipmentId: undefined, equipmentId: undefined,
userName: undefined, userName: undefined,
userNames: [], userNames: [],
useTime: new Date().getTime(), useTime: new Date().getTime(),
address: undefined, address: undefined,
num: 0, num: 0,
source: undefined, source: undefined,
remark: undefined, remark: undefined
}, },
dataSourceList: [ dataSourceList: [
{ {
id: 1, id: 1,
name: '手动', name: '手动'
}, },
{ {
id: 2, id: 2,
name: 'PDA', name: 'PDA'
}, }
], ],
materialList: [], materialList: [],
materialDateList: [], materialDateList: [],
eqList: [], eqList: [],
workersList: [], workersList: [],
dataRule: { dataRule: {
materialId: [ materialId: [{ required: true, message: "物料不能为空", trigger: "blur" }],
{ required: true, message: '物料不能为空', trigger: 'blur' }, materialDateId: [{ required: true, message: "批次号不能为空", trigger: "blur" }],
], useTime: [{ required: true, message: "使用时间不能为空", trigger: "blur" }],
useTime: [ userNames: [{ required: true, message: "操作员不能为空", trigger: "blur" }],
{ required: true, message: '使用时间不能为空', trigger: 'blur' }, num: [{ required: true, message: "使用数量不能为空", trigger: "blur" }]
], }
userNames: [
{ required: true, message: '操作员不能为空', trigger: 'blur' },
],
num: [{ required: true, message: '使用数量不能为空', trigger: 'blur' }],
},
}; };
}, },
mounted() { mounted() {
this.getDictData(); this.getDictData()
}, },
methods: { methods: {
async getDictData() { async getDictData() {
const materRes = await getMaterialTree(); const materRes = await getMaterialList()
let typeId = materRes.data[0].product?materRes.data[1].id:materRes.data[0].id this.materialList = materRes.data
const listQuery= { const dateRes = await getMaterDateList()
typeId:typeId this.materialDateList = dateRes.data
} const eqRes = await getEqListAll()
const materData = await getMaterialList(listQuery); this.eqList = eqRes.data
this.materialList = []; const workerRes = await getworkerAll()
this.materialList = materData.data; this.workersList = workerRes.data
const dateRes = await getMaterDateList();
this.materialDateList = dateRes.data;
const eqRes = await getEqListAll();
this.eqList = eqRes.data;
const workerRes = await listSimpleUsers();
this.workersList = workerRes.data;
}, },
// //
dataFormSubmit() { dataFormSubmit() {
this.dataForm.userName = this.dataForm.userNames.join(','); this.dataForm.userName = this.dataForm.userNames.join(',')
this.$refs['dataForm'].validate((valid) => { this.$refs["dataForm"].validate((valid) => {
if (!valid) { if (!valid) {
return false; return false;
} }
// //
if (this.dataForm.id) { if (this.dataForm.id) {
this.urlOptions.updateURL(this.dataForm).then((response) => { this.urlOptions.updateURL(this.dataForm).then(response => {
this.$modal.msgSuccess('修改成功'); this.$modal.msgSuccess("修改成功");
this.visible = false; this.visible = false;
this.$emit('refreshDataList'); this.$emit("refreshDataList");
}); });
return; return;
} }
// //
this.urlOptions.createURL(this.dataForm).then((response) => { this.urlOptions.createURL(this.dataForm).then(response => {
this.$modal.msgSuccess('新增成功'); this.$modal.msgSuccess("新增成功");
this.visible = false; this.visible = false;
this.$emit('refreshDataList'); this.$emit("refreshDataList");
}); });
}); });
}, },
init(id) { init(id) {
this.dataForm.id = id || undefined; this.dataForm.id = id || undefined;
this.visible = true; this.visible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['dataForm'].resetFields(); this.$refs["dataForm"].resetFields();
if (this.dataForm.id) { if (this.dataForm.id) {
this.urlOptions.infoURL(id).then((response) => { this.urlOptions.infoURL(id).then(response => {
this.dataForm.id = response.data.id; this.dataForm.id = response.data.id
this.dataForm.materialCode = response.data.materialCode; this.dataForm.materialCode = response.data.materialCode
this.dataForm.materialId = response.data.materialId; this.dataForm.materialId = response.data.materialId
this.dataForm.materialDateId = response.data.materialDateId; this.dataForm.materialDateId = response.data.materialDateId
this.dataForm.equipmentId = response.data.equipmentId; this.dataForm.equipmentId = response.data.equipmentId
this.dataForm.useTime = response.data.useTime; this.dataForm.useTime = response.data.useTime
// this.dataForm.userName = response.data.userName // this.dataForm.userName = response.data.userName
this.dataForm.num = response.data.num; this.dataForm.num = response.data.num
this.dataForm.source = response.data.source; this.dataForm.source = response.data.source
this.dataForm.remark = response.data.remark; this.dataForm.remark = response.data.remark
this.dataForm.userNames = response.data.userName.split(','); this.dataForm.userNames = response.data.userName.split(',')
}); });
} else { } else {}
} });
}); },
},
setCode() { setCode() {
const tempMaterial = this.materialList.filter((item) => { const tempMaterial = this.materialList.filter(item =>{
return item.id === this.dataForm.materialId; return item.id === this.dataForm.materialId
}); })
this.dataForm.materialCode = tempMaterial[0].code; this.dataForm.materialCode = tempMaterial[0].code
getMaterDateList({ materialId: this.dataForm.materialId }).then((res) => { getMaterDateList({materialId: this.dataForm.materialId}).then(res =>{
this.materialDateList = res.data; this.materialDateList = res.data
}); })
}, }
}, },
}; };
</script> </script>

View File

@ -1,8 +1,8 @@
/* /*
* @Author: zwq * @Author: zwq
* @Date: 2022-08-24 11:19:43 * @Date: 2022-08-24 11:19:43
* @LastEditors: zwq * @LastEditors: zhp
* @LastEditTime: 2024-07-05 10:10:12 * @LastEditTime: 2023-11-24 09:29:36
* @Description: * @Description:
*/ */
export default { export default {
@ -53,12 +53,11 @@ export default {
this.listQuery.pageNo = val; this.listQuery.pageNo = val;
this.getDataList(); this.getDataList();
}, },
// 新增 // 新增 / 修改
addOrUpdateHandle() { addOrUpdateHandle(id) {
this.addOrEditTitle = '新增';
this.addOrUpdateVisible = true; this.addOrUpdateVisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.addOrUpdate.init(); this.$refs.addOrUpdate.init(id);
}); });
}, },
cancel(id) { cancel(id) {

View File

@ -1,8 +1,8 @@
/* /*
* @Date: 2020-12-29 16:49:28 * @Date: 2020-12-29 16:49:28
* @LastEditors: zwq * @LastEditors: DY
* @LastEditTime: 2024-07-08 16:27:39 * @LastEditTime: 2023-09-12 11:13:34
* @FilePath: \basic-admin\src\filters\basicData\index.js * @FilePath: \basic-admin\src\filters\basicData\index.js
* @Description: * @Description:
*/ */
@ -33,7 +33,7 @@ export function parseTime(time, pattern) {
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) { if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
time = parseInt(time) time = parseInt(time)
} else if (typeof time === 'string') { } else if (typeof time === 'string') {
time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.\d{3}/gm), ''); time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.\d{3}/gm),'');
} }
if ((typeof time === 'number') && (time.toString().length === 10)) { if ((typeof time === 'number') && (time.toString().length === 10)) {
time = time * 1000 time = time * 1000
@ -62,22 +62,6 @@ export function parseTime(time, pattern) {
}) })
return time_str return time_str
} }
// 遍历树结构返回数组
export function getTreeArr(arr) {
let result =[]
arr.forEach(item => {
if(item.children && item.children.length>0){
let {children,...obj} = item
result.push(obj)
result = result.concat(getTreeArr(children))
}else{
let {children,...obj} = item
result.push(obj)
}
});
return result
}
export default function (dictTable) { export default function (dictTable) {
return function (val) { return function (val) {
return table?.[dictTable]?.[val] return table?.[dictTable]?.[val]

View File

@ -1,4 +1,4 @@
<!-- <!--
filename: index.vue filename: index.vue
author: liubin author: liubin
date: 2023-09-04 09:34:52 date: 2023-09-04 09:34:52
@ -280,7 +280,7 @@ export default {
async fillProductOptions() { async fillProductOptions() {
const { data } = await this.$axios({ const { data } = await this.$axios({
url: '/base/core-product-material/listAll', url: '/base/core-product/listAll',
method: 'get', method: 'get',
}); });
const cfg = this.searchBarFormConfig.find( const cfg = this.searchBarFormConfig.find(

View File

@ -1,8 +1,8 @@
<!-- <!--
filename: EquipmentDrawer.vue filename: EquipmentDrawer.vue
author: liubin author: liubin
date: 2023-08-22 14:38:56 date: 2023-08-22 14:38:56
description: description:
--> -->
<template> <template>
@ -383,7 +383,7 @@ export default {
// //
handleAddAttr() { handleAddAttr() {
if (!this.dataId) return this.$message.warning('请先创建设备分组信息'); if (!this.dataId) return this.$message.error('请先创建设备分组信息');
this.attrForm = { this.attrForm = {
id: null, id: null,
equipmentGroupId: this.dataId, equipmentGroupId: this.dataId,

View File

@ -1,8 +1,8 @@
<!-- <!--
filename: EquipmentDrawer.vue filename: EquipmentDrawer.vue
author: liubin author: liubin
date: 2023-08-22 14:38:56 date: 2023-08-22 14:38:56
description: description:
--> -->
<template> <template>
@ -382,7 +382,7 @@ export default {
// //
handleAddAttr() { handleAddAttr() {
if (!this.dataId) return this.$message.warning('请先创建设备分组信息'); if (!this.dataId) return this.$message.error('请先创建设备分组信息');
this.attrForm = { this.attrForm = {
id: null, id: null,
equipmentGroupId: this.dataId, equipmentGroupId: this.dataId,

View File

@ -1,4 +1,4 @@
<!-- <!--
filename: index.vue filename: index.vue
author: liubin author: liubin
date: 2023-09-04 09:34:52 date: 2023-09-04 09:34:52
@ -270,7 +270,7 @@ export default {
switch (btnName) { switch (btnName) {
case 'search': case 'search':
if (!payload.recordTime || payload.recordTime.length <= 0) { if (!payload.recordTime || payload.recordTime.length <= 0) {
this.$message.warning('请选择时间段'); this.$message.error('请选择时间段');
return; return;
} }
this.startTime = new Date(payload.recordTime).getTime(); this.startTime = new Date(payload.recordTime).getTime();
@ -493,7 +493,7 @@ export default {
if (code == 0) { if (code == 0) {
const newEqlist = this.objectToArray(data); const newEqlist = this.objectToArray(data);
if (!newEqlist || newEqlist.length == 0) { if (!newEqlist || newEqlist.length == 0) {
this.$message.warning('该设备没有产量数据'); this.$message.error('该设备没有产量数据');
return; return;
} }
this.graphList.push(...newEqlist); this.graphList.push(...newEqlist);

View File

@ -1,4 +1,4 @@
<!-- <!--
filename: index.vue filename: index.vue
author: liubin author: liubin
date: 2023-09-04 09:34:52 date: 2023-09-04 09:34:52
@ -338,7 +338,7 @@ export default {
switch (btnName) { switch (btnName) {
case 'search': case 'search':
if (!payload.recordTime || payload.recordTime.length <= 0) { if (!payload.recordTime || payload.recordTime.length <= 0) {
this.$message.warning('请选择时间段'); this.$message.error('请选择时间段');
return; return;
} }
@ -373,7 +373,7 @@ export default {
async submitForm() { async submitForm() {
if (this.existingEquipments.indexOf(this.queryParams.equipmentId) >= 0) { if (this.existingEquipments.indexOf(this.queryParams.equipmentId) >= 0) {
this.$message.warning('该设备已存在'); this.$message.error('该设备已存在');
return; return;
} }
const { code, data } = await this.$axios({ const { code, data } = await this.$axios({
@ -387,7 +387,7 @@ export default {
if (code == 0) { if (code == 0) {
const newEqlist = this.objectToArray(data); const newEqlist = this.objectToArray(data);
if (!newEqlist || newEqlist.length == 0) { if (!newEqlist || newEqlist.length == 0) {
this.$message.warning('该设备没有状态数据'); this.$message.error('该设备没有状态数据');
return; return;
} }
this.graphList.push(newEqlist[0]); this.graphList.push(newEqlist[0]);

View File

@ -1,8 +1,8 @@
<!-- <!--
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: zwq * @LastEditors: zhp
* @LastEditTime: 2024-07-09 13:40:03 * @LastEditTime: 2023-11-28 10:03:20
* @Description: * @Description:
--> -->
<template> <template>

View File

@ -1,8 +1,8 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2023-11-08 15:30:27 * @Date: 2023-11-08 15:30:27
* @LastEditTime: 2024-07-09 13:29:06 * @LastEditTime: 2023-11-23 14:27:59
* @LastEditors: zwq * @LastEditors: zhp
* @Description: * @Description:
--> -->
<template> <template>
@ -42,8 +42,8 @@ import {
getProcessEquMaterialBomDet, getProcessEquMaterialBomDet,
createProcessEquMaterialBomDetList, createProcessEquMaterialBomDetList,
updateProcessEquMaterialBomDet, updateProcessEquMaterialBomDet,
getMaterialList
} from '@/api/extend/processEquMaterialBom'; } from '@/api/extend/processEquMaterialBom';
import { getMaterialTree,getMaterialList } from '@/api/base/material';
export default { export default {
props: { props: {
@ -94,16 +94,12 @@ export default {
} }
}); });
}, },
async getDict() { getDict() {
const materRes = await getMaterialTree(); getMaterialList().then((res) => [
let typeId = materRes.data[0].product?materRes.data[1].id:materRes.data[0].id this.materialList = res.data,
const listQuery= { console.log(res)
typeId:typeId ])
} },
const materData = await getMaterialList(listQuery);
this.materialList = [];
this.materialList = materData.data;
},
// //
dataFormSubmit() { dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => { this.$refs['dataForm'].validate((valid) => {

View File

@ -12,6 +12,32 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row>
<el-col :span="12">
<el-form-item label="生效时间" prop="enableTime">
<el-date-picker
v-model="form.enableTime"
type="datetime"
placeholder="选择日期时间"
label-format="yyyy-MM-dd HH:mm:ss"
value-format="timestamp"
style="width: 100%;">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="失效时间" prop="disableTime">
<el-date-picker
v-model="form.disableTime"
type="datetime"
placeholder="选择日期时间"
label-format="yyyy-MM-dd HH:mm:ss"
value-format="timestamp"
style="width: 100%;">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="班次开始时间" prop="startTime"> <el-form-item label="班次开始时间" prop="startTime">
@ -65,6 +91,8 @@ export default {
id: '', id: '',
name: '', name: '',
code: '', code: '',
enableTime: '',
disableTime: '',
startTime: '', startTime: '',
endTime: '', endTime: '',
daySpan: '', daySpan: '',
@ -73,6 +101,7 @@ export default {
isEdit: false, // isEdit: false, //
rules: { rules: {
name: [{ required: true, message: '请输入班组名称', trigger: 'blur' }], name: [{ required: true, message: '请输入班组名称', trigger: 'blur' }],
enableTime: [{ required: true, message: '请选择班次开始时间', trigger: 'change' }],
code: [{ required: true, message: '请输入编码', trigger: 'blur' }], code: [{ required: true, message: '请输入编码', trigger: 'blur' }],
startTime: [{ required: true, message: '请输入生效时间', trigger: 'change' }], startTime: [{ required: true, message: '请输入生效时间', trigger: 'change' }],
endTime: [{ required: true, message: '请选择班次结束时间', trigger: 'change' }] endTime: [{ required: true, message: '请选择班次结束时间', trigger: 'change' }]
@ -87,6 +116,7 @@ export default {
getGroupClasses(id).then((res) => { getGroupClasses(id).then((res) => {
if (res.code === 0) { if (res.code === 0) {
this.form = res.data this.form = res.data
this.form.disableTime = res.data.disableTime || ''
} }
}) })
} else { } else {
@ -116,6 +146,7 @@ export default {
submitForm() { submitForm() {
this.$refs['form'].validate((valid) => { this.$refs['form'].validate((valid) => {
if (valid) { if (valid) {
this.form.disableTime = this.form.disableTime || ''
if (this.isEdit) { if (this.isEdit) {
// //
updateGroupClasses({ ...this.form }).then((res) => { updateGroupClasses({ ...this.form }).then((res) => {

View File

@ -1,52 +0,0 @@
<!--
* @Author: zwq
* @Date: 2024-07-01 14:53:55
* @LastEditors: zwq
* @LastEditTime: 2024-07-10 10:28:05
* @Description:
-->
<template>
<el-switch v-model="state" type="text" size="small" :disabled="readonly" @change="changeHandler" />
</template>
<script>
export default {
props: {
injectData: {
type: Object,
default: () => ({})
}
},
data() {
return {
state: false
}
},
computed: {
readonly() {
return !!this.injectData.readonly
}
},
mounted() {
this.mapToState()
},
methods: {
mapToState() {
if (this.injectData.prop === 'enabled') {
this.state = this.injectData.enabled === 1 ? true : false
}
},
changeHandler() {
let params = {}
let payload = {}
params.name = 'state'
payload.id = this.injectData.id
payload.enabled = this.state ? '1' : '0'
payload.startTime = this.injectData.startTime
payload.endTime = this.injectData.endTime
params.payload = payload
this.$emit('emitData', params)
}
}
}
</script>

View File

@ -1,263 +1,262 @@
<!--
* @Author: zwq
* @Date: 2024-07-01 14:53:55
* @LastEditors: zwq
* @LastEditTime: 2024-07-12 16:19:13
* @Description:
-->
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 -->
<search-bar <!-- 搜索工作栏 -->
:formConfigs="formConfig" <search-bar
ref="searchBarForm" :formConfigs="formConfig"
@headBtnClick="buttonClick" /> ref="searchBarForm"
<!-- 列表 --> @headBtnClick="buttonClick"
<base-table />
:page="queryParams.pageNo" <!-- 列表 -->
:limit="queryParams.pageSize" <base-table
:table-props="tableProps" :page="queryParams.pageNo"
:table-data="list" :limit="queryParams.pageSize"
:max-height="tableH" :table-props="tableProps"
@emitFun="handleTableEvents"> :table-data="list"
<method-btn :max-height="tableH"
v-if="tableBtn.length" >
slot="handleBtn" <method-btn
:width="120" v-if="tableBtn.length"
label="操作" slot="handleBtn"
:method-list="tableBtn" :width="120"
@clickBtn="handleClick" /> label="操作"
</base-table> :method-list="tableBtn"
<pagination @clickBtn="handleClick"
:page.sync="queryParams.pageNo" />
:limit.sync="queryParams.pageSize" </base-table>
:total="total" <pagination
@pagination="getList" /> :page.sync="queryParams.pageNo"
<!-- 新增 --> :limit.sync="queryParams.pageSize"
<base-dialog :total="total"
:dialogTitle="addOrEditTitle" @pagination="getList"
:dialogVisible="centervisible" />
@cancel="handleCancel" <!-- 新增 -->
@confirm="handleConfirm" <base-dialog
:before-close="handleCancel" :dialogTitle="addOrEditTitle"
width="50%"> :dialogVisible="centervisible"
<group-class-add ref="classList" @successSubmit="successSubmit" /> @cancel="handleCancel"
</base-dialog> @confirm="handleConfirm"
</div> :before-close="handleCancel"
width='50%'
>
<group-class-add ref="classList" @successSubmit="successSubmit" />
</base-dialog>
</div>
</template> </template>
<script> <script>
import { import { getGroupClassesPage, deleteGroupClasses, updateGroupClasses } from "@/api/base/groupClasses";
getGroupClassesPage, import GroupClassAdd from './components/groupClassAdd.vue'
deleteGroupClasses, import { formatDate } from '@/utils'
updateGroupClasses,
} from '@/api/base/groupClasses';
import GroupClassAdd from './components/groupClassAdd.vue';
import StatusBtn from './components/statusBtn';
const tableProps = [ const tableProps = [
{ {
prop: 'name', prop: 'enableTimeStr',
label: '班次名称', label: '生效时段',
}, minWidth: 300
{ },
prop: 'timeStr', {
label: '班次时间', prop: 'name',
minWidth: 100, label: '班次名称'
}, },
{ {
prop: 'code', prop: 'timeStr',
label: '班次编码', label: '班次时间',
minWidth: 200, minWidth: 100
}, },
{ {
prop: 'enabled', prop: 'code',
label: '班次状态', label: '班次编码',
subcomponent: StatusBtn, minWidth: 200
}, },
{ {
prop: 'remark', prop: 'status',
label: '备注', label: '班次状态'
}, },
]; {
prop: 'remark',
label: '备注'
}
]
export default { export default {
name: 'GroupClass', name: "GroupClass",
components: { GroupClassAdd }, components: { GroupClassAdd },
data() { data() {
return { return {
formConfig: [ formConfig: [
{ {
type: 'input', type: 'input',
label: '班次名称', label: '班次名称',
placeholder: '班次名称', placeholder: '班次名称',
param: 'name', param: 'name'
}, },
{ {
type: 'button', type: 'button',
btnName: '查询', btnName: '查询',
name: 'search', name: 'search',
color: 'primary', color: 'primary'
}, },
{ {
type: 'separate', type: 'separate'
}, },
{ {
type: this.$auth.hasPermi('base:group-classes:create') type: this.$auth.hasPermi('base:group-classes:create') ? 'button' : '',
? 'button' btnName: '新增',
: '', name: 'add',
btnName: '新增', color: 'success',
name: 'add', plain: true
color: 'success', }
plain: true, ],
}, tableProps,
], tableBtn: [
tableProps, this.$auth.hasPermi('base:group-classes:cancel')
tableBtn: [ ? {
this.$auth.hasPermi('base:group-classes:update') type: 'cancel',
? { btnName: '作废',
type: 'edit', showParam: {
btnName: '编辑', type: '&',
} data: [
: undefined, {
this.$auth.hasPermi('base:group-classes:delete') type: 'unequal',
? { name: 'status',
type: 'delete', value: '不可用'
btnName: '删除', }
} ]
: undefined, }
].filter((v) => v), }
tableH: this.tableHeight(260), : undefined,
// this.$auth.hasPermi('base:group-classes:update')
total: 0, ? {
// type: 'edit',
list: [], btnName: '编辑'
// }
addOrEditTitle: '', : undefined,
// this.$auth.hasPermi('base:group-classes:delete')
centervisible: false, ? {
// type: 'delete',
queryParams: { btnName: '删除'
pageNo: 1, }
pageSize: 20, : undefined
name: null, ].filter((v) => v),
}, tableH: this.tableHeight(260),
}; //
}, total: 0,
created() { //
window.addEventListener('resize', () => { list: [],
this.tableH = this.tableHeight(260); //
}); addOrEditTitle: "",
this.getList(); //
}, centervisible: false,
methods: { //
buttonClick(val) { queryParams: {
switch (val.btnName) { pageNo: 1,
case 'search': pageSize: 20,
this.queryParams.pageNo = 1; name: null
this.queryParams.name = val.name; }
this.getList(); };
break; },
default: created() {
this.addOrEditTitle = '新增'; window.addEventListener('resize', () => {
this.centervisible = true; this.tableH = this.tableHeight(260)
this.$nextTick(() => { })
this.$refs.classList.init(); this.getList()
}); },
} methods: {
}, buttonClick(val) {
// switch (val.btnName) {
handleTableEvents(params) { case 'search':
if (params.name === 'state') { this.queryParams.pageNo = 1;
// this.queryParams.name = val.name
updateGroupClasses({ ...params.payload }) this.getList()
.then((res) => { break
if (res.code === 0) { default:
this.$modal.msgSuccess('操作成功'); this.addOrEditTitle = '新增'
this.getList(); this.centervisible = true
} this.$nextTick(() => {
}) this.$refs.classList.init()
.catch((res) => { })
this.getList(); }
}); },
} /** 查询列表 */
}, getList() {
/** 查询列表 */ getGroupClassesPage(this.queryParams).then(res => {
getList() { if (res.code === 0 && res.data.list.length > 0) {
getGroupClassesPage(this.queryParams).then((res) => { res.data.list.map(item => {
if (res.code === 0 && res.data.list && res.data.list.length > 0) { item.enableTimeStr = formatDate(item.enableTime) + '至' + (item.disableTime ? formatDate(item.disableTime) : '永久')
res.data.list.map((item) => { item.timeStr = item.startTime.slice(0, 5) + '-' + item.endTime.slice(0, 5)
item.timeStr = item.status = item.status === true ? '可用' : '不可用'
item.startTime.slice(0, 5) + '-' + item.endTime.slice(0, 5); })
}); this.list = res.data.list;
this.list = res.data.list; this.total = res.data.total;
this.total = res.data.total; } else {
} else { this.list = []
this.list = []; this.total = 0
this.total = 0; }
} });
}); },
}, handleClick(val) {
handleClick(val) { switch (val.type) {
switch (val.type) { case 'edit':
case 'edit': this.addOrEditTitle = '编辑'
this.addOrEditTitle = '编辑'; this.$nextTick(() => {
this.$nextTick(() => { this.$refs.classList.init(val.data.id)
this.$refs.classList.init(val.data.id); })
}); this.centervisible = true
this.centervisible = true; break
break; case 'cancel':
default: this.discard(val.data)
this.handleDelete(val.data); break
} default:
}, this.handleDelete(val.data)
handleCancel() { }
this.$refs.classList.formClear(); },
this.centervisible = false; handleCancel() {
this.addOrEditTitle = ''; this.$refs.classList.formClear()
}, this.centervisible = false
handleConfirm() { this.addOrEditTitle = ''
this.$refs.classList.submitForm(); },
}, handleConfirm() {
successSubmit() { this.$refs.classList.submitForm()
this.handleCancel(); },
this.getList(); successSubmit() {
}, this.handleCancel()
/** 删除按钮操作 */ this.getList()
handleDelete(row) { },
console.log(row); discard(row) {
let _this = this; let obj = {}
if (row.enabled) { obj.id = row.id
// obj.startTime = row.startTime
_this.$modal obj.endTime = row.endTime
.confirm( obj.enableTime = row.enableTime
'删除的班次"' + obj.disableTime = Date.parse(new Date())
row.name + this.$modal.confirm('是否确认作废班次名称为"' + row.name + '"的数据项?').then(function() {
'"可能会影响交接班计划,请点取消再次确认!' return updateGroupClasses({ ...obj })
) }).then(() => {
.then(function () { this.getList();
return _this.$modal this.$modal.msgSuccess("操作成功");
.confirm('是否确认删除班次名称为"' + row.name + '"的数据项?') }).catch(() => {});
.then(function () { },
return deleteGroupClasses(row.id); /** 删除按钮操作 */
}) handleDelete(row) {
.then(() => { console.log(row)
_this.getList(); let _this = this
_this.$modal.msgSuccess('删除成功'); if (row.status === '可用') {//
}) _this.$modal.confirm('删除的班次"' + row.name + '"可能会影响交接班计划,请点取消再次确认!').then(function() {
.catch(() => {}); return _this.$modal.confirm('是否确认删除班次名称为"' + row.name + '"的数据项?').then(function() {
}); return deleteGroupClasses(row.id);
} else { }).then(() => {
_this.$modal _this.getList();
.confirm('是否确认删除班次名称为"' + row.name + '"的数据项?') _this.$modal.msgSuccess("删除成功");
.then(function () { }).catch(() => {});
return deleteGroupClasses(row.id); })
}) } else {
.then(() => { _this.$modal.confirm('是否确认删除班次名称为"' + row.name + '"的数据项?').then(function() {
_this.getList(); return deleteGroupClasses(row.id);
_this.$modal.msgSuccess('删除成功'); }).then(() => {
}) _this.getList();
.catch(() => {}); _this.$modal.msgSuccess("删除成功");
} }).catch(() => {});
}, }
}, }
}
}; };
</script> </script>

View File

@ -14,18 +14,20 @@
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="班组组长" prop="leaderName"> <el-form-item label="班组组长" prop="leaderId">
<el-input v-model="form.leaderName" clearable></el-input> <el-select v-model="form.leaderId" placeholder="请选择" style="width: 100%;" filterable @change="selectLeader">
<el-option
v-for="item in workerList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="手机号" prop="leaderPhone"> <el-form-item label="手机号" prop="telephone">
<el-input v-model="form.leaderPhone" clearable></el-input> <el-input v-model="form.telephone" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="班组人数" prop="num">
<el-input-number style="width: 100%;" v-model="form.num" :step="1" step-strictly></el-input-number>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -33,6 +35,7 @@
</template> </template>
<script> <script>
import { getGroupTeam, updateGroupTeam, createGroupTeam, getCode } from '@/api/base/groupTeam' import { getGroupTeam, updateGroupTeam, createGroupTeam, getCode } from '@/api/base/groupTeam'
import { getWorkerList } from '@/api/base/worker'
export default { export default {
name: 'groupTeamAdd', name: 'groupTeamAdd',
data() { data() {
@ -41,26 +44,28 @@ export default {
id: '', id: '',
name: '', name: '',
code: '', code: '',
leaderName: '', leaderId: '',
leaderPhone: '', telephone: ''
num: ''
}, },
isEdit: false, // isEdit: false, //
rules: { rules: {
name: [{ required: true, message: '请输入班组名称', trigger: 'blur' }], name: [{ required: true, message: '请输入班组名称', trigger: 'blur' }],
code: [{ required: true, message: '请输入班组编码', trigger: 'blur' }], code: [{ required: true, message: '请输入班组编码', trigger: 'blur' }],
leaderName: [{ required: true, message: '请输入组长', trigger: 'blur' }] leaderId: [{ required: true, message: '请选择组长', trigger: 'select' }]
}, },
workerList: []
} }
}, },
methods: { methods: {
init(id) { init(id) {
this.getWorkerList()
if (id) { if (id) {
this.isEdit = true this.isEdit = true
this.form.id = id this.form.id = id
getGroupTeam( id ).then((res) => { getGroupTeam( id ).then((res) => {
if (res.code === 0) { if (res.code === 0) {
this.form = res.data this.form = res.data
this.selectLeader()
} }
}) })
} else { } else {
@ -71,6 +76,24 @@ export default {
}) })
} }
}, },
// list
getWorkerList() {
getWorkerList().then(res => {
this.workerList = res.data
})
},
//
selectLeader() {
if (this.form.leaderId) {
this.workerList.map(item => {
if (item.id === this.form.leaderId) {
this.form.telephone = item.telephone || ''
}
})
} else {
this.form.telephone = ''
}
},
submitForm() { submitForm() {
this.$refs['form'].validate((valid) => { this.$refs['form'].validate((valid) => {
if (valid) { if (valid) {

View File

@ -1,10 +1,3 @@
<!--
* @Author: zwq
* @Date: 2024-07-01 14:53:55
* @LastEditors: zwq
* @LastEditTime: 2024-07-10 10:00:03
* @Description:
-->
<template> <template>
<el-switch v-model="state" type="text" size="small" :disabled="readonly" @change="changeHandler" /> <el-switch v-model="state" type="text" size="small" :disabled="readonly" @change="changeHandler" />
</template> </template>
@ -44,7 +37,7 @@ export default {
payload.enabled = this.state ? '1' : '0' payload.enabled = this.state ? '1' : '0'
payload.code = this.injectData.code payload.code = this.injectData.code
payload.name = this.injectData.name payload.name = this.injectData.name
payload.leaderName = this.injectData.leaderName payload.leaderId = this.injectData.leaderId
params.payload = payload params.payload = payload
this.$emit('emitData', params) this.$emit('emitData', params)
} }

View File

@ -193,7 +193,7 @@ export default {
}, },
getList() { getList() {
groupTeamPage({ ...this.queryParams }).then(res => { groupTeamPage({ ...this.queryParams }).then(res => {
if (res.code === 0 && res.data.list && res.data.list.length > 0) { if (res.code === 0 && res.data.list.length > 0) {
let arr = [] let arr = []
res.data.list.map(item => { res.data.list.map(item => {
let obj = {} let obj = {}
@ -307,4 +307,4 @@ export default {
padding-top: 30px; padding-top: 30px;
} }
} }
</style> </style>

View File

@ -42,6 +42,8 @@
> >
<group-team-add ref="groupList" @successSubmit="successSubmit" /> <group-team-add ref="groupList" @successSubmit="successSubmit" />
</base-dialog> </base-dialog>
<!-- 组员编辑 -->
<worker-edit v-if='paramVisible' ref='workerEditParam' @closeDrawer="closeDrawer"></worker-edit>
</div> </div>
</template> </template>
@ -50,6 +52,8 @@ import { getGroupTeamPage, deleteGroupTeam, updateGroupTeam } from "@/api/base/g
import { parseTime } from '@/utils/ruoyi' import { parseTime } from '@/utils/ruoyi'
import GroupTeamAdd from './components/groupTeamAdd' import GroupTeamAdd from './components/groupTeamAdd'
import StatusBtn from './components/statusBtn' import StatusBtn from './components/statusBtn'
import WorkerOperate from './components/workerOperate'
import WorkerEdit from './components/workerEdit'
const tableProps = [ const tableProps = [
{ {
prop: 'createTime', prop: 'createTime',
@ -79,10 +83,15 @@ const tableProps = [
label: '班组状态', label: '班组状态',
subcomponent: StatusBtn subcomponent: StatusBtn
}, },
{
prop: 'workerName',
label: '组员',
subcomponent: WorkerOperate
},
] ]
export default { export default {
name: "GroupTeam", name: "GroupTeam",
components: { GroupTeamAdd }, components: { GroupTeamAdd, WorkerEdit },
data() { data() {
return { return {
formConfig: [ formConfig: [
@ -146,6 +155,7 @@ export default {
name: null, name: null,
code: null code: null
}, },
paramVisible: false
}; };
}, },
created() { created() {
@ -193,14 +203,17 @@ export default {
}, },
// //
handleTableEvents(params) { handleTableEvents(params) {
console.log(params)
if (params.name === 'state') {// if (params.name === 'state') {//
updateGroupTeam({ ...params.payload }).then((res) => { updateGroupTeam({ ...params.payload }).then((res) => {
if (res.code === 0) { if (res.code === 0) {
this.$modal.msgSuccess("操作成功"); this.$modal.msgSuccess("操作成功");
this.getList()
} }
}).catch((res)=>{ })
this.getList() }else {// &
this.paramVisible = true
this.$nextTick(() => {
this.$refs.workerEditParam.init(params)
}) })
} }
}, },

View File

@ -1,520 +1,478 @@
<!--
* @Author: zwq
* @Date: 2024-07-01 14:54:06
* @LastEditors: zwq
* @LastEditTime: 2024-07-15 14:55:35
* @Description:
-->
<template> <template>
<div class="groupTeamScheduling"> <div class="groupTeamScheduling">
<div class="operationArea"> <div class="operationArea">
<el-tabs v-model="planId" @tab-click="setPlan"> <el-form :inline="true" class="demo-form-inline">
<el-tab-pane <span class="blue-block"></span>
v-for="item in planArr" <el-form-item label="月份选择">
:key="item.id" <el-date-picker
:label="item.name" v-model="startDay"
:name="item.id" /> type="month"
</el-tabs> placeholder="选择月"
<el-form :inline="true" class="demo-form-inline"> size="small"
<span class="blue-block"></span> :disabled="showSetting"
<el-form-item label="月份选择"> @change="selectMonth"
<el-date-picker :clearable="false"
v-model="startDay" style="width: 120px">
type="month" </el-date-picker>
placeholder="选择月" </el-form-item>
size="small" <el-form-item>
:disabled="showSetting" <span class="separateStyle" v-if="this.$auth.hasPermi('base:group-team-scheduling:set')"></span>
@change="selectMonth" </el-form-item>
:clearable="false" <el-form-item>
style="width: 120px"></el-date-picker> <el-button type="primary" size="small" v-if="this.$auth.hasPermi('base:group-team-scheduling:set')" :disabled="showSetting || settingBtnDis" @click="settingMsg">设置</el-button>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<span <el-button type="primary" size="small" v-show="showSetting && autoScheduling" @click="schedulingBtn">自动排班</el-button>
class="separateStyle" </el-form-item>
v-if="this.$auth.hasPermi('base:group-team-scheduling:set')"></span> <el-form-item>
</el-form-item> <span class="separateStyle" v-show="showSetting"></span>
<el-form-item> </el-form-item>
<el-button <el-form-item>
type="primary" <el-button type="primary" size="small" v-show="showSetting" @click="confirmSetting">确认</el-button>
size="small" </el-form-item>
v-if="this.$auth.hasPermi('base:group-team-scheduling:set')" <el-form-item>
:disabled="showSetting || settingBtnDis" <el-button type="primary" size="small" plain v-show="showSetting" @click="cancelSetting">取消</el-button>
@click="settingMsg"> </el-form-item>
设置 <el-form-item label="请先选择查询的班组" class="rightItem">
</el-button> <!-- <el-button type="primary" size="small" :disabled="jumpDisabled" @click="toOtherPage('1')">班组上下片查询</el-button> -->
</el-form-item> <el-button type="primary" size="small" :disabled="jumpDisabled" @click="toOtherPage('2')">班组能源查询</el-button>
<el-form-item> <el-button type="primary" size="small" :disabled="jumpDisabled" @click="toOtherPage('3')">班组检测查询</el-button>
<span class="separateStyle" v-show="showSetting"></span> </el-form-item>
</el-form-item> </el-form>
<el-form-item> </div>
<el-button <!-- 日历区域 -->
type="primary" <div class="calenderArea">
size="small" <div style="font-size: 24px;font-weight: 500">{{ this.month }} {{ this.year }}</div>
v-show="showSetting" <el-calendar v-model="startDay">
@click="confirmSetting"> <!-- 这里使用的是 2.5 slot 语法对于新项目请使用 2.6 slot 语法-->
确认 <template
</el-button> slot="dateCell"
</el-form-item> slot-scope="{date, data}">
<el-form-item> <div v-if="data.type === 'current-month'">
<el-button <!-- 日期 -->
type="primary" <div class="dateStyle">
size="small" {{ Number(data.day.split('-')[2]) }}
plain </div>
v-show="showSetting" <!-- 班次班组 -->
@click="cancelSetting"> <!-- class有两个样式一个是类似class1还有个是选中红框显示 -->
取消 <el-row :gutter="2" :class="'class' + (index+1) + (chooseTip === (item.startDay+item.classesId) ? ' team-active' : '')" v-for="(item, index) in list[Number(data.day.split('-')[2])]" :key='index'>
</el-button> <el-col :span="12">
</el-form-item> <div class="selectDiv">
</el-form> <!-- 选择班组图标 -->
</div> <div class="toggle-icon" v-show="showSetting && (new Date(data.day).valueOf() < new Date().valueOf() ? false: true)">
<!-- 日历区域 --> <svg-icon icon-class="toggle"/>
<div class="calenderArea"> </div>
<div style="font-size: 24px; font-weight: 500"> <!-- 不能选择班组 -->
{{ this.month }} {{ this.year }} <div class="toggle-icon-hide" v-show="!(showSetting && (new Date(data.day).valueOf() < new Date().valueOf() ? false: true))"></div>
</div> <el-select v-model="item.teamId" size='small' :disabled="!showSetting || (new Date(data.day).valueOf() > new Date().valueOf() ? false: true)">
<el-calendar v-model="startDay"> <el-option
<!-- 这里使用的是 2.5 slot 语法对于新项目请使用 2.6 slot 语法--> v-for="i in teamList"
<template slot="dateCell" slot-scope="{ date, data }"> :key="i.id"
<div v-if="data.type === 'current-month'"> :label="i.name"
<!-- 日期 --> :value="i.id">
<div class="dateStyle"> </el-option>
{{ Number(data.day.split('-')[2]) }} </el-select>
</div> </div>
<!-- 班次班组 --> </el-col>
<!-- class有两个样式一个是类似class1还有个是选中红框显示 --> <el-col :span="12">
<el-row <el-button class="labelClass" @click="chooseTeam(item)">{{ item.classesName }}</el-button>
:gutter="2" </el-col>
:class=" </el-row>
'class' + </div>
(index + 1) + </template>
(chooseTip === item.startDay + item.classesId </el-calendar>
? ' team-active' </div>
: '') </div>
"
v-for="(item, index) in list[Number(data.day.split('-')[2])]"
:key="index">
<el-col :span="12">
<div class="selectDiv">
<!-- 选择班组图标 -->
<div
class="toggle-icon"
v-show="
showSetting &&
(new Date(data.day).valueOf() < new Date().valueOf()
? false
: true)
">
<svg-icon icon-class="toggle" />
</div>
<!-- 不能选择班组 -->
<div
class="toggle-icon-hide"
v-show="
!(
showSetting &&
(new Date(data.day).valueOf() < new Date().valueOf()
? false
: true)
)
"></div>
<el-select
v-model="item.teamId"
size="small"
:disabled="
!showSetting ||
(new Date(data.day).valueOf() > new Date().valueOf()
? false
: true)
">
<el-option
v-for="i in teamList"
:key="i.id"
:label="i.name"
:value="i.id"></el-option>
</el-select>
</div>
</el-col>
<el-col :span="12">
<el-button class="labelClass" @click="chooseTeam(item)">
{{ item.classesName }}
</el-button>
</el-col>
</el-row>
</div>
</template>
</el-calendar>
</div>
</div>
</template> </template>
<script> <script>
import { import { getPreset, createOrUpdateList, autoSet } from "@/api/base/groupTeamScheduling";
getScheduling, import { listEnabled } from "@/api/base/groupTeam";
createOrUpdateList,
} from '@/api/base/groupTeamScheduling';
import {
groupPlanList,
groupPlanTeamList,
} from '@/api/base/groupSchedulingPlan';
import { listEnabled } from '@/api/base/groupTeam';
import moment from 'moment'; import moment from 'moment';
export default { export default {
name: 'GroupTeamScheduling', name: "GroupTeamScheduling",
data() { data() {
return { return {
startDay: '', // startDay: '',//
year: '', // 2023 year: '',// 2023
month: '', // month: '',//
monthList: [ monthList: ["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],
'一月', list: {},
'二月', teamList: [],//
'三月', showSetting: false,//
'四月', settingBtnDis: false,
'五月', jumpDisabled: true,//
'六月', chooseObj: {}, //
'七月', chooseTip: '',//
'八月', autoScheduling: false //
'九月', };
'十月', },
'十一月', created() {
'十二月', this.startDay = new Date()
], //
planId: undefined, //id this.settingBtn()
list: {}, this.getTeamList()
planArr: [], // this.toggleMonth()
teamList: [], // this.getList()
showSetting: false, // },
settingBtnDis: false, methods: {
jumpDisabled: true, // //
chooseObj: {}, // selectMonth() {
chooseTip: '', // if (this.startDay) {
autoScheduling: false, // this.settingBtn() // ,getlist
}; this.toggleMonth()
}, this.getList()
created() { this.clearChoose()
this.startDay = new Date(); if ( moment(this.startDay).valueOf() > moment().endOf('month').valueOf()) {
groupPlanList().then((res) => { this.autoScheduling = true
this.planArr = res.data || []; } else {
this.planId = this.planArr[0] ? this.planArr[0].id : undefined; this.autoScheduling = false
if (this.planId) { }
this.getList(); }
this.getTeamList(); },
} //
}); getTeamList() {
// listEnabled().then(res => {
this.settingBtn(); this.teamList = res.data || []
this.toggleMonth(); })
}, },
methods: { //
setPlan() { getList() {
this.getList(); let year = moment(this.startDay).format('YYYY')
this.getTeamList(); let month = moment(this.startDay).format('M')
}, getPreset({
// year: year,
selectMonth() { month: month
if (this.startDay) { }).then(res => {
this.settingBtn(); // ,getlist let obj = res.data || {}
this.toggleMonth(); if (obj) {
this.getList(); for (let item in obj) {
this.clearChoose(); for (let i = 0; i < obj[item].length; i++) {
if ( if (!obj[item][i].teamId) {
moment(this.startDay).valueOf() > moment().endOf('month').valueOf() obj[item][i].teamId = ''
) { }
this.autoScheduling = true; }
} else { }
this.autoScheduling = false; }
} this.list = obj
} }).catch(() => {
}, this.list = {}
// this.settingBtnDis = true //
getTeamList() { })
groupPlanTeamList(this.planId).then((res) => { },
this.teamList = res.data || []; //
}); settingMsg() {
}, this.showSetting = !this.showSetting
// this.clearChoose()
getList() { },
let year = moment(this.startDay).format('YYYY'); //
let month = moment(this.startDay).format('M'); cancelSetting() {
getScheduling({ this.showSetting = !this.showSetting
year: year, this.getList() //
month: month, },
planId: this.planId, //
}) confirmSetting() {
.then((res) => { let num = 0
let obj = res.data || {}; //
if (obj) { if (moment(this.startDay).format('YYYY-MM') === moment().format('YYYY-MM')) {
for (let item in obj) { num = Number(moment().format('DD'))
for (let i = 0; i < obj[item].length; i++) { } else {
if (!obj[item][i].teamId) { num = 0
obj[item][i].teamId = ''; }
} //
} //
} let tempArr = Object.values(this.list)
} let arr = []
this.list = obj; for (let i = num; i < tempArr.length; i++) {
}) for (let j = 0; j < tempArr[i].length; j++) {
.catch(() => { arr.push(tempArr[i][j])
this.list = {}; }
this.settingBtnDis = true; // }
}); createOrUpdateList(arr).then(res => {
}, if (res.code === 0) {
// this.showSetting = !this.showSetting
settingMsg() { this.$modal.msgSuccess("操作成功")
this.showSetting = !this.showSetting; this.getList() //
this.clearChoose(); }
}, })
// },
cancelSetting() { //
this.showSetting = !this.showSetting; chooseTeam(value) {
this.getList(); // if (this.showSetting) {
}, this.$modal.msgWarning("当前处于设置模式")
// return false
confirmSetting() { }
let num = 0; this.chooseObj = value
// this.chooseTip = value.startDay + value.classesId //
if ( this.jumpDisabled = false //
moment(this.startDay).format('YYYY-MM') === moment().format('YYYY-MM') },
) { //
num = Number(moment().format('DD')); schedulingBtn() {
} else { let tempData = this.list
num = 0; // 1
} if (this.list[1][0].teamId) {
// let tempArr = Object.values(this.list)
// let arr = []
let tempArr = Object.values(this.list); let n = 0
let arr = []; for (let i = 0; i < tempArr.length; i++) {
for (let i = num; i < tempArr.length; i++) { if (n > 0) {
for (let j = 0; j < tempArr[i].length; j++) { break;
arr.push(tempArr[i][j]); }
} for (let j = 0; j < tempArr[i].length; j++) {
} if (tempArr[i][j].teamId) {
createOrUpdateList(arr).then((res) => { arr.push(tempArr[i][j].teamId)
if (res.code === 0) { } else {
this.showSetting = !this.showSetting; n++
this.$modal.msgSuccess('操作成功'); }
this.getList(); // }
} }
}); let tempNum = 0
}, for (let k = 0; k < tempArr.length; k++) {
// for (let v = 0; v < tempArr[k].length; v++) {
chooseTeam(value) { let t = tempNum % arr.length
// if (this.showSetting) { if (arr.length === 1) {
// this.$modal.msgWarning(''); tempData[k+1][v].teamId = arr[0]
// return false; } else {
// } tempData[k+1][v].teamId = arr[t]
this.chooseObj = value; }
this.chooseTip = value.startDay + value.classesId; // tempNum++
this.jumpDisabled = false; // }
}, }
// this.list = []
settingBtn() { this.list = tempData
let nowMonth = moment().startOf('month').valueOf(); } else {
let startMonth = moment(this.startDay).valueOf(); // 1,
let nowDate = moment(new Date()).date(); // console.log(moment(this.startDay).format("YYYY-MM-DD"))
let sumDate = moment().daysInMonth(); autoSet({
if (nowMonth > startMonth) { year: this.year,
// month: moment(this.startDay).month() + 1
this.settingBtnDis = true; }).then(res => {
} else { this.list = res.data || {}
if (nowDate < sumDate) { })
this.settingBtnDis = false; }
} else { },
this.settingBtnDis = true; //
} settingBtn() {
} let nowMonth = moment().startOf('month').valueOf()
}, let startMonth = moment(this.startDay).valueOf()
// let nowDate = moment(new Date()).date()
clearChoose() { let sumDate = moment().daysInMonth()
this.chooseObj = {}; if (nowMonth > startMonth) { //
this.chooseTip = ''; this.settingBtnDis = true
this.jumpDisabled = true; } else {
}, if (nowDate < sumDate) {
// this.settingBtnDis = false
toggleMonth() { } else {
this.year = moment(this.startDay).format('YYYY'); this.settingBtnDis = true
let month = Number(moment(this.startDay).format('MM')); }
this.month = this.monthList[month - 1]; }
}, },
}, //
}; clearChoose() {
this.chooseObj = {}
this.chooseTip = ""
this.jumpDisabled = true
},
//
toggleMonth() {
this.year = moment(this.startDay).format("YYYY")
let month = Number(moment(this.startDay).format("MM"))
this.month = this.monthList[month - 1]
},
// 3
toOtherPage(val) {
switch (val) {
case '1':
this.$router.push({
path: '/core/enhance/product-line-24h?startTime='+this.chooseObj.startTime+'&endTime='+this.chooseObj.endTime,
})
break;
case '2': //
this.$router.push({
// path: '/energy/monitoring/energy-report-search?startTime='+this.chooseObj.startTime+'&endTime='+this.chooseObj.endTime
path: '/energy/base/energy-quantity-realtime?startTime='+this.chooseObj.startTime+'&endTime='+this.chooseObj.endTime
})
break;
default:
this.$router.push({
path: '/quality/base/quality-inspection-data/detection-information/statistical-data?startTime='+this.chooseObj.startTime+'&endTime='+this.chooseObj.endTime,
// name: 'QualityStatistics',
// params: { startTime: this.chooseObj.startTime, endTime: this.chooseObj.endTime }
})
}
}
}
}
</script> </script>
<style lang="scss"> <style lang='scss'>
.demo-form-inline { .demo-form-inline {
.el-date-editor .el-range__icon { .el-date-editor .el-range__icon {
font-size: 16px; font-size: 16px;
color: #0b58ff; color: #0B58FF;
} }
.el-input__prefix .el-icon-date { .el-input__prefix .el-icon-date {
font-size: 16px; font-size: 16px;
color: #0b58ff; color: #0B58FF;
} }
} }
.groupTeamScheduling { .groupTeamScheduling {
background-color: #f2f4f9; background-color: #F2F4F9;
.operationArea { .operationArea {
padding: 14px 10px 0 16px; padding: 14px 10px 0 16px;
margin-bottom: 8px; margin-bottom: 8px;
background-color: #fff; background-color: #fff;
border-radius: 8px; border-radius: 8px;
.blue-block { .blue-block {
display: inline-block; display: inline-block;
width: 4px; width: 4px;
height: 16px; height: 16px;
background-color: #0b58ff; background-color: #0B58FF;
border-radius: 1px; border-radius: 1px;
margin-right: 8px; margin-right: 8px;
margin-top: 10px; margin-top: 10px;
} }
.separateStyle { .separateStyle {
display: inline-block; display: inline-block;
width: 1px; width: 1px;
height: 24px; height: 24px;
background: #e8e8e8; background: #E8E8E8;
vertical-align: middle; vertical-align: middle;
} }
.el-form-item { .el-form-item {
margin-bottom: 10px; margin-bottom: 10px;
} }
.rightItem { .rightItem {
float: right; float: right;
} }
} }
// //
.calenderArea { .calenderArea {
padding: 14px 10px 0 20px; padding: 14px 10px 0 20px;
background-color: #fff; background-color: #fff;
border-radius: 8px; border-radius: 8px;
.el-calendar__body { .el-calendar__body {
padding: 10px 16px 16px 0; padding: 10px 16px 16px 0;
} }
.el-calendar__header { .el-calendar__header {
display: none; display: none;
} }
.el-calendar-table > thead { .el-calendar-table > thead {
height: 48px; height: 48px;
font-size: 20px; font-size: 20px;
font-weight: 500; font-weight: 500;
color: #000000; color: #000000;
background-color: rgba(242, 244, 249, 1); background-color: rgba(242, 244, 249, 1);
} }
.el-calendar-table__row { .el-calendar-table__row {
height: 133px; height: 133px;
.prev, .prev, .next {
.next { pointer-events: none;
pointer-events: none; }
} .el-calendar-day {
.el-calendar-day { padding: 0 10px;
padding: 0 10px; height: 100%;
height: 100%; .dateStyle {
.dateStyle { font-size: 20px;
font-size: 20px; font-weight: 500;
font-weight: 500; color: #000000;
color: #000000; text-align: right;
text-align: right; height: 32px;
height: 32px; line-height: 28px;
line-height: 28px; padding-right: 10px;
padding-right: 10px; }
} }
} }
} .team-active {//
.team-active { border:2px solid red
// }
border: 2px solid #409eff; .class1, .class2, .class3 {
} padding: 0;
.class1, font-weight: 600;
.class2, margin-bottom: 2px;
.class3 { .selectDiv {
padding: 0; position: relative;
font-weight: 600; .toggle-icon {
margin-bottom: 2px; position: absolute;
.selectDiv { width: 26px;
position: relative; height: 26px;
.toggle-icon { line-height: 26px;
position: absolute; font-size: 14px;
width: 26px; z-index: 1;
height: 26px; text-align: center;
line-height: 26px; }
font-size: 14px; .toggle-icon-hide {
z-index: 1; position: absolute;
text-align: center; width: 2px;
} height: 28px;
.toggle-icon-hide { z-index: 1;
position: absolute; }
width: 2px; .el-input__suffix {
height: 28px; display: none;
z-index: 1; }
} .el-input--suffix .el-input__inner {
.el-input__suffix { padding: 0 4px 0 28px;
display: none; }
} .el-input--small .el-input__inner {
.el-input--suffix .el-input__inner { height: 28px;
padding: 0 4px 0 28px; border: none;
} font-weight: 600;
.el-input--small .el-input__inner { }
height: 28px; }
border: none; .labelClass {
font-weight: 600; width: 100%;
} height: 28px;
} border: none;
.labelClass { padding: 0;
width: 100%; font-weight: 600;
height: 28px; text-align: center;
border: none; }
padding: 0; }
font-weight: 600; .class1 {
text-align: center; .selectDiv {
} .toggle-icon, .toggle-icon-hide {
} background-color: #FACE00;
.class1 { }
.selectDiv { .el-input--small .el-input__inner {
.toggle-icon, color: #E7A200;
.toggle-icon-hide { background-color: #FFEFC0;
background-color: #face00; }
} }
.el-input--small .el-input__inner { .labelClass {
color: #e7a200; color: #E7A200;
background-color: #ffefc0; background-color: #FFEFC0;
} }
} }
.labelClass { .class2 {
color: #e7a200; .selectDiv {
background-color: #ffefc0; .toggle-icon, .toggle-icon-hide {
} background-color: #3984FF;
} }
.class2 { .el-input--small .el-input__inner {
.selectDiv { color: #2D7BFF;
.toggle-icon, background-color: #BEEAFF;
.toggle-icon-hide { }
background-color: #3984ff; }
} .labelClass {
.el-input--small .el-input__inner { color: #2D7BFF;
color: #2d7bff; background-color: #BEEAFF;
background-color: #beeaff; }
} }
} .class3 {
.labelClass { .selectDiv {
color: #2d7bff; .toggle-icon, .toggle-icon-hide {
background-color: #beeaff; background-color: #37D97F;
} }
} .el-input--small .el-input__inner {
.class3 { color: #129F51;
.selectDiv { background-color: #E0FFEE;
.toggle-icon, }
.toggle-icon-hide { }
background-color: #37d97f; .labelClass {
} color: #129F51;
.el-input--small .el-input__inner { background-color: #E0FFEE;
color: #129f51; }
background-color: #e0ffee; }
} }
}
.labelClass {
color: #129f51;
background-color: #e0ffee;
}
}
}
} }
</style> </style>

View File

@ -1,260 +0,0 @@
<!--
* @Author: zwq
* @Date: 2024-07-10 13:43:41
* @LastEditors: zwq
* @LastEditTime: 2024-07-15 16:00:36
* @Description:
-->
<template>
<el-form ref="form" :rules="rules" label-width="110px" :model="form">
<el-row>
<el-col :span="12">
<el-form-item label="部门名称" prop="deptId">
<el-select
v-model="form.deptId"
filterable
clearable
style="width: 100%"
placeholder="请选择部门">
<el-option
v-for="item in deptArr"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="计划名称" prop="name">
<el-input v-model="form.name" clearable />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="相关班组" prop="teamIdList">
<el-select
v-model="form.teamIdList"
filterable
clearable
multiple
style="width: 100%"
placeholder="请选择班组">
<el-option
v-for="item in teamList"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="相关班次" prop="classesIdList">
<el-select
v-model="form.classesIdList"
filterable
clearable
multiple
style="width: 100%"
placeholder="请选择班次">
<el-option
v-for="item in classList"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否生产班组" prop="isProduction">
<el-radio-group v-model="form.isProduction">
<el-radio :label="true"></el-radio>
<el-radio :label="false"></el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="24" v-show="form.isProduction">
<tree-transfer
:title="title"
:from_data="fromData"
:to_data="toData"
@add-btn="add"
@remove-btn="remove"
pid="productionLineId"
:defaultProps="{ label: 'name' }"
height="450px"
:mode="mode"
filter
openAll></tree-transfer>
</el-col>
</el-row>
</el-form>
</template>
<script>
import {
getGroupPlan,
updateGroupPlan,
createGroupPlan,
getGroupPlanTree,
createGroupPlanLine,
updateGroupPlanLine,
getGroupPlanLine,
getLoginUserDeptId,
} from '@/api/base/groupSchedulingPlan';
import { listDept } from '@/api/system/dept';
import { listEnabled } from '@/api/base/groupTeam';
import { listClassesEnabled } from '@/api/base/groupClasses';
import treeTransfer from 'el-tree-transfer';
export default {
components: { treeTransfer },
name: '',
data() {
return {
form: {
id: '',
name: '',
deptId: '',
teamIdList: [],
classesIdList: [],
remark: '',
isProduction: false,
},
deptArr: [], //
teamList: [], //
classList: [], //
rules: {
name: [{ required: true, message: '请输入计划名称', trigger: 'blur' }],
deptId: [{ required: true, message: '请选择部门', trigger: 'change' }],
teamIdList: [
{ required: true, message: '请选择相关班组', trigger: 'change' },
],
classesIdList: [
{ required: true, message: '请选择相关班次', trigger: 'change' },
],
},
title: ['待选', '已选'], // Array false ["", ""]
mode: 'transfer',
fromData: [], //
toData: [], //
};
},
methods: {
init(id) {
this.form.id = id || undefined;
this.fromData = [];
this.toData = [];
this.getArr();
this.$nextTick(() => {
this.$refs['form'].resetFields();
if (this.form.id) {
getGroupPlan(id).then((response) => {
this.form = response.data;
if (this.form.isProduction) {
getGroupPlanLine(id).then((res) => {
this.toData = res.data ? res.data.datas : [];
this.getFilterLeftData(this.fromData, this.toData); //bug
});
}
});
} else {
getLoginUserDeptId().then((res) => {
this.form.deptId = res.data;
});
}
});
},
getArr() {
listDept().then((response) => {
this.deptArr = response.data;
});
listEnabled().then((res) => {
this.teamList = res.data || [];
});
listClassesEnabled().then((res) => {
this.classList = res.data || [];
});
getGroupPlanTree().then((res) => {
this.fromData = res.data;
this.fromData.forEach((item) => {
item.productionLineId = 0;
});
});
},
// 穿
add(fromData, toData, obj) {
console.log('fromData:', fromData);
console.log('toData:', toData);
},
// 穿
remove(fromData, toData, obj) {
console.log('fromData:', fromData);
console.log('toData:', toData);
},
submitForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
if (this.form.id) {
//
updateGroupPlan({ ...this.form }).then((res) => {
if (res.code === 0) {
if (this.form.isProduction) {
const params = {
planId: this.form.id,
list: this.toData,
};
updateGroupPlanLine(params).then((res) => {
this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit');
});
}
}
});
} else {
createGroupPlan({ ...this.form }).then((res) => {
if (res.code === 0) {
if (this.form.isProduction) {
const params = {
planId: res.data,
list: this.toData,
};
createGroupPlanLine(params).then((res) => {
this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit');
});
}
}
});
}
} else {
return false;
}
});
},
formClear() {
this.$refs.form.resetFields();
},
/** 消除组件左边与右边选中数据相同项 */
//
getFilterLeftData(data, selData) {
for (let i = data.length - 1; i >= 0; i--) {
for (let j = selData.length - 1; j >= 0; j--) {
if (data[i] && data[i].id === selData[j].id) {
// id
if (!data[i].children) {
data.splice(i, 1);
} else {
this.getFilterLeftData(data[i].children, selData[j].children);
}
}
}
}
},
},
};
</script>

View File

@ -1,233 +0,0 @@
<!--
* @Author: zwq
* @Date: 2024-07-10 11:08:48
* @LastEditors: zwq
* @LastEditTime: 2024-07-12 16:19:28
* @Description:
-->
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps"
:table-data="list"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="120"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList" />
<!-- 新增 -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="centervisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<schedulingPlanConfigAdd ref="classList" @successSubmit="successSubmit" />
</base-dialog>
</div>
</template>
<script>
import {
getGroupPlanPage,
deleteGroupPlan,
} from '@/api/base/groupSchedulingPlan';
import { listDept } from '@/api/system/dept';
import schedulingPlanConfigAdd from './components/schedulingPlanConfigAdd.vue';
const tableProps = [
{
prop: 'deptName',
label: '部门名称',
},
{
prop: 'name',
label: '计划名称',
},
{
prop: 'str',
label: '产线及工段',
minWidth: 200,
},
{
prop: 'teamName',
label: '班组名称',
},
{
prop: 'classesName',
label: '班次名称',
},
];
export default {
name: 'schedulingPlanConfig',
components: { schedulingPlanConfigAdd },
data() {
return {
formConfig: [
{
type: 'select',
label: '部门名称',
selectOptions: [],
param: 'deptId',
defaultSelect: '',
filterable: true,
},
{
type: 'input',
label: '计划名称',
placeholder: '计划名称',
param: 'name',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('base:group-scheduling-plan:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
],
tableProps,
tableBtn: [
this.$auth.hasPermi('base:group-scheduling-plan:update')
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi('base:group-scheduling-plan:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
tableH: this.tableHeight(260),
//
total: 0,
//
list: [],
//
addOrEditTitle: '',
//
centervisible: false,
//
queryParams: {
pageNo: 1,
pageSize: 20,
name: null,
},
};
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260);
});
listDept().then((response) => {
this.formConfig[0].selectOptions = response.data;
});
this.getList();
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.queryParams.pageNo = 1;
this.queryParams.name = val.name || undefined;
this.queryParams.deptId = val.deptId || undefined;
this.getList();
break;
default:
this.addOrEditTitle = '新增';
this.centervisible = true;
this.$nextTick(() => {
this.$refs.classList.init();
});
}
},
/** 查询列表 */
getList() {
getGroupPlanPage(this.queryParams).then((res) => {
if (res.code === 0 && res.data.list && res.data.list.length > 0) {
res.data.list.forEach(item => {
if(item.isProduction){
item.str = item.strList?item.strList.join(','):'-'
}
});
this.list = res.data.list;
this.total = res.data.total;
} else {
this.list = [];
this.total = 0;
}
});
},
handleClick(val) {
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.$refs.classList.init(val.data.id);
});
this.centervisible = true;
break;
default:
this.handleDelete(val.data);
}
},
handleCancel() {
this.$refs.classList.formClear();
this.centervisible = false;
this.addOrEditTitle = '';
},
handleConfirm() {
this.$refs.classList.submitForm();
},
successSubmit() {
this.handleCancel();
this.getList();
},
/** 删除按钮操作 */
handleDelete(row) {
let _this = this;
_this.$modal
.confirm('是否确认删除名称为"' + row.name + '"的数据项?')
.then(function () {
return deleteGroupPlan(row.id);
})
.then(() => {
_this.getList();
_this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
},
};
</script>

View File

@ -1,280 +0,0 @@
<!--
* @Author: zwq
* @Date: 2024-07-11 09:30:21
* @LastEditors: zwq
* @LastEditTime: 2024-07-12 16:09:46
* @Description:
-->
<template>
<el-form ref="form" :rules="rules" label-width="110px" :model="form">
<el-row>
<el-col :span="12">
<el-form-item label="排班开始日期" prop="startDay">
<el-date-picker
v-model="form.startDay"
type="datetime"
placeholder="选择日期时间"
label-format="yyyy-MM-dd HH:mm:ss"
value-format="timestamp"
style="width: 100%"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="排班结束日期" prop="endDay">
<el-date-picker
v-model="form.endDay"
type="datetime"
placeholder="选择日期时间"
label-format="yyyy-MM-dd HH:mm:ss"
value-format="timestamp"
style="width: 100%"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="排班计划" prop="planId">
<el-select
v-model="form.planId"
filterable
clearable
@change="setTableArr"
style="width: 100%"
placeholder="请选择排班计划">
<el-option
v-for="item in planArr"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<div class="min-title">班组上班顺序</div>
<base-table
border
:table-props="tableProps"
:table-data="tableData"
:page="1"
:limit="100"
:height="300"
@emitButtonClick="addNew"
@emitFun="inputChange"
:add-button-show="addButtonShow">
<method-btn
slot="handleBtn"
:width="60"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
</el-col>
</el-row>
</el-form>
</template>
<script>
import {
getGroupRule,
updateGroupRule,
createGroupRule,
} from '@/api/base/groupSchedulingRule';
import {
groupPlanList,
groupPlanTeamList,
groupPlanClassesList,
} from '@/api/base/groupSchedulingPlan';
import tableSelect from './tableSelect';
const tableBtn = [
{
type: 'delete',
btnName: '删除',
},
];
const tableProps = [
{
prop: 'classesId',
label: '班次',
classesArr: [],
subcomponent: tableSelect,
},
{
prop: 'teamId',
label: '班组',
teamArr: [],
subcomponent: tableSelect,
},
];
export default {
name: 'schedulingRuleConfigAdd',
data() {
return {
form: {
id: '',
startDay: '',
endDay: '',
planId: '',
remark: '',
},
tableBtn,
tableProps,
tableData: [],
addButtonShow: '',
planArr: [], //
rules: {
name: [{ required: true, message: '请输入班组名称', trigger: 'blur' }],
startDay: [
{ required: true, message: '请选择排班开始时间', trigger: 'change' },
],
endDay: [
{ required: true, message: '请选择排班结束时间', trigger: 'change' },
],
},
};
},
methods: {
init(id) {
this.form = {
id: id || undefined,
startDay: '',
endDay: '',
planId: '',
remark: '',
};
this.getArr();
this.tableData = [];
this.$nextTick(() => {
this.$refs['form'].resetFields();
if (this.form.id) {
getGroupRule(id).then((response) => {
this.form = response.data;
this.getTableArr(response.data.planId);
this.tableData = [];
});
}
});
},
getArr() {
groupPlanList().then((res) => {
this.planArr = res.data || [];
});
},
setTableArr() {
if (this.form.planId) {
this.tableData = [];
this.getTableArr(this.form.planId);
} else {
this.tableData = [];
this.addButtonShow = '';
}
},
async getTableArr(id) {
//
this.addButtonShow = '新增';
const res0 = await groupPlanClassesList(id);
this.tableProps[0].classesArr = res0.data || [];
const res1 = await groupPlanTeamList(id);
this.tableProps[1].teamArr = res1.data || [];
if (this.form.id) {
//
this.form.sequenceList.forEach((item) => {
this.tableData.push(item);
});
}
},
inputChange(data) {
this.tableData[data._pageIndex - 1][data.prop] = data[data.prop];
},
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(
`确定对${
raw.data.name
? '[名称=' + raw.data.name + ']'
: '[序号=' + raw.data._pageIndex + ']'
}进行删除操作?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
this.tableData.splice(raw.data._pageIndex - 1, 1);
this.tableData.forEach((item, index) => {
item.sequence = index;
});
console.log(this.tableData);
})
.catch(() => {});
}
},
//
addNew() {
this.tableData.push({ sequence: this.tableData.length });
},
submitForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
if (this.form.id) {
//
let list = [];
this.tableData.forEach((item) => {
const obj = {
classesId: item.classesId,
sequence: item.sequence,
teamId: item.teamId,
};
list.push(obj);
});
this.form.list = list;
updateGroupRule({ ...this.form }).then((res) => {
this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit');
});
} else {
let list = [];
this.tableData.forEach((item) => {
const obj = {
classesId: item.classesId,
sequence: item.sequence,
teamId: item.teamId,
};
list.push(obj);
});
this.form.list = list;
createGroupRule({ ...this.form }).then((res) => {
this.$modal.msgSuccess('操作成功');
this.$emit('successSubmit');
});
}
} else {
return false;
}
});
},
formClear() {
this.$refs.form.resetFields();
},
},
};
</script>
<style scoped>
.min-title {
margin-bottom: 5px;
}
.min-title::before {
content: '';
display: inline-block;
vertical-align: middle;
width: 6px;
height: 6px;
border-radius: 50%;
margin: auto 5px;
background-color: #0b58ff;
}
</style>

View File

@ -1,44 +0,0 @@
<template>
<div class="tableInner">
<el-select :key="itemProp+list._pageIndex" v-model="list[itemProp]" @change="changeInput">
<el-option
v-for="item in itemProp==='classesId'?list.classesArr:list.teamArr"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</div>
</template>
<script>
export default {
name: 'tableSelect',
props: {
injectData: {
type: Object,
default: () => ({}),
},
itemProp: {
type: String,
},
},
data() {
return {
list: this.injectData,
};
},
methods: {
changeInput() {
this.$emit('emitData', this.list);
},
},
};
</script>
<style scoped>
.tableInner >>> .el-input__inner {
color: #409EFF;
border: 1px rgb(232, 231, 231) solid;
padding: 0;
text-align: center;
height: 30px;
}
</style>

View File

@ -1,261 +0,0 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps"
:table-data="list"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="120"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList" />
<!-- 新增 -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="centervisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<schedulingRuleConfigAdd ref="classList" @successSubmit="successSubmit" />
</base-dialog>
</div>
</template>
<script>
import {
getGroupRulePage,
deleteGroupRule,
updateGroupRule,
getGroupRule,
} from '@/api/base/groupSchedulingRule';
import schedulingRuleConfigAdd from './components/schedulingRuleConfigAdd.vue';
import { formatDate } from '@/utils';
const tableProps = [
{
prop: 'enableTimeStr',
label: '排班日期',
minWidth: 200,
},
{
prop: 'planName',
label: '排班计划',
},
{
prop: 'str',
label: '排班规则',
minWidth: 100,
},
{
prop: 'enabled',
label: '状态',
filter: (val) => (val ? '正常' : '作废'),
},
];
export default {
name: 'schedulingRuleConfig',
components: { schedulingRuleConfigAdd },
data() {
return {
formConfig: [
{
type: 'input',
label: '班次',
placeholder: '班次',
param: 'name',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('base:group-scheduling-rule:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
],
tableProps,
tableBtn: [
this.$auth.hasPermi('base:group-scheduling-rule:cancel')
? {
type: 'cancel',
btnName: '作废',
showParam: {
type: '&',
data: [
{
type: 'unequal',
name: 'enabled',
value: 0,
},
],
},
}
: undefined,
this.$auth.hasPermi('base:group-scheduling-rule:update')
? {
type: 'edit',
btnName: '编辑',
showParam: {
type: '&',
data: [
{
type: 'unequal',
name: 'enabled',
value: 0,
},
],
},
}
: undefined,
this.$auth.hasPermi('base:group-scheduling-rule:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
tableH: this.tableHeight(260),
//
total: 0,
//
list: [],
//
addOrEditTitle: '',
//
centervisible: false,
//
queryParams: {
pageNo: 1,
pageSize: 20,
name: null,
},
};
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260);
});
this.getList();
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.queryParams.pageNo = 1;
this.queryParams.classesName = val.name || undefined;
this.getList();
break;
default:
this.addOrEditTitle = '新增';
this.centervisible = true;
this.$nextTick(() => {
this.$refs.classList.init();
});
}
},
/** 查询列表 */
getList() {
getGroupRulePage(this.queryParams).then((res) => {
if (res.code === 0 && res.data.list && res.data.list.length > 0) {
res.data.list.map((item) => {
item.enableTimeStr =
formatDate(item.startDay) +
'至' +
(item.endDay ? formatDate(item.endDay) : '永久');
item.str = item.strList.join(',');
});
this.list = res.data.list;
this.total = res.data.total;
} else {
this.list = [];
this.total = 0;
}
});
},
handleClick(val) {
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.$refs.classList.init(val.data.id);
});
this.centervisible = true;
break;
case 'cancel':
this.discard(val.data);
break;
default:
this.handleDelete(val.data);
}
},
handleCancel() {
this.$refs.classList.formClear();
this.centervisible = false;
this.addOrEditTitle = '';
},
handleConfirm() {
this.$refs.classList.submitForm();
},
successSubmit() {
this.handleCancel();
this.getList();
},
discard(row) {
let _this = this
this.$modal
.confirm('是否确认作废序号为"' + row._pageIndex + '"的数据项?')
.then(() => {
getGroupRule(row.id).then((response) => {
let datas = response.data;
datas.list = datas.sequenceList;
datas.enabled = 0;
updateGroupRule(datas).then(() => {
_this.getList();
_this.$modal.msgSuccess('操作成功');
});
});
})
.catch(() => {});
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal
.confirm('是否确认删除序号为"' + row._pageIndex + '"的数据项?')
.then(function () {
return deleteGroupRule(row.id);
})
.then(() => {
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
},
};
</script>

View File

@ -36,8 +36,8 @@ export default {
minWidth: 150 minWidth: 150
}, },
{ {
prop: 'specifications', prop: 'workOrderList',
label: '产品规格' label: '生产工单'
} }
], ],
tableData: [], tableData: [],
@ -147,8 +147,8 @@ export default {
minWidth: 150 minWidth: 150
}, },
{ {
prop: 'specifications', prop: 'workOrderList',
label: '产品规格' label: '生产工单'
} }
] ]
} }
@ -159,4 +159,4 @@ export default {
.box { .box {
padding: 0 32px; padding: 0 32px;
} }
</style> </style>

View File

@ -1,131 +0,0 @@
<template>
<div
:class="className"
:style="{ height: height, width: width, marginLeft: '10px' }" />
</template>
<script>
import * as echarts from 'echarts';
require('echarts/theme/macarons'); // echarts theme
import resize from '@/utils/chartMixins/resize';
const animationDuration = 1000;
export default {
mixins: [resize],
props: {
className: {
type: String,
default: 'chart',
},
title: {
type: String,
default: '',
},
width: {
type: String,
default: '100%',
},
height: {
type: String,
default: '300px',
},
barData: {
type: Array,
default: () => [],
},
},
data() {
return {
chart: null,
};
},
beforeDestroy() {
if (!this.chart) {
return;
}
this.chart.dispose();
this.chart = null;
},
methods: {
initChart() {
this.chart = echarts.init(this.$el, 'macarons');
this.chart.setOption({
title: {
text: this.title
? '{space|}{tip|}{space|}{value|' + this.title + '}'
: '',
textStyle: {
rich: {
tip: {
width: 6,
height: 6,
borderRadius: 50,
backgroundColor: '#288AFF',
},
space: {
width: 8,
},
value: {
fontSize: 14,
color: 'black',
},
},
},
},
color: ['#288AFF', '#8EF0AB', '#FFDC94'],
tooltip: {
trigger: 'axis',
axisPointer: {
//
type: 'shadow', // 线'line' | 'shadow'
},
},
grid: {
containLabel: true,
},
xAxis: {
type: 'category',
data: this.barData.map((item) => {
return item.name;
}),
axisTick: {
alignWithLabel: true,
},
axisLabel: {
color: '#979797',
},
axisLine: {
lineStyle: {
color: '#979797',
},
},
},
yAxis: {
axisTick: {
show: false,
},
splitArea: {
show: false,
},
axisLabel: {
color: '#979797',
},
},
series: [
{
name: '数量',
type: 'bar',
barWidth: '20',
data: this.barData.map((item) => {
return item.value;
}),
animationDuration,
},
],
});
},
},
};
</script>

View File

@ -1,99 +1,413 @@
<!--
* @Author: zwq
* @Date: 2024-07-02 15:56:48
* @LastEditors: zwq
* @LastEditTime: 2024-07-02 16:55:43
* @Description:
-->
<template> <template>
<div class="app-container"> <div class="app-container">
<div class="flexDiv"> <el-row :gutter="20">
<div v-for="i in wareName" :key="i + 'a'" class="divClass up"> <el-col :span="4">
{{ i }} <el-button
</div> type="primary"
</div> v-hasPermi="['warehouse:warehouse-info:create']"
<div class="flexDiv"> plain
<div v-for="i in stockNum" :key="i + 'b'" class="divClass down"> size="mini"
<span v-if="i === '库存数量'">{{ i }}</span> @click="addWare">
<el-link v-else :underline="false" type="primary" @click="toPage(i)"> 新增仓库
{{ i }} </el-button>
</el-link> <el-divider content-position="left">仓库列表</el-divider>
</div> <el-card
</div> v-for="item in wareArr"
<barChart :key="item.id"
style="margin-top: 50px" shadow="hover"
ref="barChart" @click.native="setWareInfo(item)"
height="600px" :style="{
:title="'库存数量'" background: item.id === wareInfo.warehouseId ? '#37D97F' : '',
v-if="barData.length" color: item.id === wareInfo.warehouseId ? 'white' : '',
:bar-data="barData" /> }"
<!-- 没有数据 --> class="ware-card">
<div class="no-data-bg" v-else></div> {{ item.name }}
<el-dropdown class="el-dropdown-div">
<span class="el-dropdown-link">
<i
class="el-icon-s-tools"
style="color: #409eff; cursor: pointer; font-size: 25px" />
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item
v-hasPermi="['warehouse:warehouse-info:update']"
@click.native="dropdown(1, item.id)">
编辑
</el-dropdown-item>
<el-dropdown-item @click.native="dropdown(2, item.id)">
详情
</el-dropdown-item>
<el-dropdown-item
v-hasPermi="['warehouse:warehouse-info:delete']"
@click.native="dropdown(3, item.id, item.name)">
删除
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-card>
</el-col>
<el-col :span="20">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
</el-col>
</el-row>
<!-- 对话框(添加 / 修改) -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
:destroy-on-close="true"
width="40%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
<add-or-update1
ref="addOrUpdate1"
@refreshDataList="successSubmit1"></add-or-update1>
</base-dialog>
</div> </div>
</template> </template>
<script> <script>
import barChart from './BarChart.vue'; import AddOrUpdate from './add-or-updata';
import AddOrUpdate1 from './add-or-updata1';
import basicPage from '../mixins/basic-page';
import { parseTime } from '../mixins/code-filter';
import codeFilter from '../mixins/code-filter';
import {
deleteWarehouse,
getWarehouseList,
} from '@/api/warehouse/warehouse-info';
import {
deleteWarehouseLocation,
getWarehouseLocationPage,
} from '@/api/warehouse/warehouseLocation';
import { BackgroundClass } from 'quill';
const tableProps = [
{
prop: 'warehouseCode',
label: '仓库编码',
},
{
prop: 'warehouseName',
label: '仓库名称',
},
{
prop: 'code',
label: '库位编码',
width: 180
},
{
prop: 'name',
label: '库位名称',
},
{
prop: 'arrange',
label: '排',
width: 50
},
{
prop: 'col',
label: '列',
width: 50
},
{
prop: 'layer',
label: '层',
width: 50
},
{
prop: 'type',
label: '库位类型',
filter: codeFilter('wareType'),
width: 80
},
{
prop: 'enabled',
label: '是否可用',
filter: codeFilter('deactivate'),
width: 80
},
{
prop: 'remark',
label: '备注',
},
];
export default { export default {
mixins: [basicPage],
data() { data() {
return { return {
wareName: ['仓库名称'], urlOptions: {
stockNum: ['库存数量'], getDataListURL: getWarehouseLocationPage,
barData: [], deleteURL: deleteWarehouseLocation,
getWareListURL: getWarehouseList,
deleteWareURL: deleteWarehouse,
},
tableProps,
tableBtn: [
this.$auth.hasPermi(`extend:warehouse-location:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi(`extend:warehouse-location:delete`)
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
tableData: [],
formConfig: [
{
type: 'input',
label: '库位名称',
placeholder: '库位名称',
param: 'name',
},
{
type: 'input',
label: '库位编码',
placeholder: '库位编码',
param: 'code',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('extend:warehouse-location:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
// {
// type: 'button',
// btnName: '',
// name: 'reset',
// },
// {
// type: this.$auth.hasPermi('extend:warehouse-location:create') ? 'separate' : '',
// },
// {
// type: this.$auth.hasPermi('extend:warehouse-location:export') ? 'button' : '',
// btnName: '',
// name: 'export',
// color: 'warning',
// },
],
wareArr: [],
listQuery: {
pageSize: 10,
pageNo: 1,
total: 1,
warehouseId: '',
},
wareInfo: {},
}; };
}, },
components: { components: {
barChart, AddOrUpdate,
AddOrUpdate1,
}, },
created() { created() {
for (let i = 0; i < 5; i++) { this.urlOptions.getWareListURL().then((response) => {
this.wareName.push('仓库' + i); this.wareArr = response.data;
this.stockNum.push(i * 100 + i); if (this.wareArr) {
} this.wareInfo.warehouseId = this.wareArr[0].id;
this.wareInfo.warehouseName = this.wareArr[0].name;
this.wareInfo.warehouseCode = this.wareArr[0].code;
this.getDataList();
}
});
}, },
methods: { methods: {
toPage(i) { //
console.log(i); getDataList() {
for (let i = 1; i < 6; i++) { if (!this.wareInfo.warehouseId) {
const obj = { return;
name: this.wareName[i],
value: this.stockNum[i],
};
this.barData.push(obj);
} }
console.log(this.barData); this.listQuery.warehouseId = this.wareInfo.warehouseId;
this.$nextTick(() => { this.dataListLoading = true;
this.$refs.barChart.initChart(); this.urlOptions.getDataListURL(this.listQuery).then((response) => {
this.tableData = response.data.list;
this.listQuery.total = response.data.total;
this.dataListLoading = false;
}); });
}, },
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name;
this.listQuery.code = val.code;
this.getDataList();
break;
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 10,
pageNo: 1,
total: 1,
};
this.getDataList();
break;
case 'add':
this.addOrEditTitle = '新增库位';
this.addOrUpdateVisible = true;
this.addOrUpdateHandle();
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
getWareArr() {
this.urlOptions.getWareListURL().then((response) => {
this.wareArr = response.data;
});
},
addWare() {
this.addOrEditTitle = '新增仓库';
this.addOrUpdateVisible = true;
this.addOrUpdate = 'addOrUpdate1';
this.$nextTick(() => {
this.$refs.addOrUpdate1.init();
});
},
//dropdown
dropdown(val, id, name) {
if (val === 1) {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '编辑仓库';
this.addOrUpdate = 'addOrUpdate1';
this.$nextTick(() => {
this.$refs.addOrUpdate1.init(id);
});
} else if (val === 2) {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '仓库详情';
this.addOrUpdate = 'addOrUpdate1';
this.$nextTick(() => {
this.$refs.addOrUpdate1.init(id, true);
});
} else if (val === 3) {
this.deleteWare(id, name);
} else {
console.log(val);
}
},
//
deleteWare(id, name) {
this.$confirm(`确定对仓库[${name}]进行删除操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
this.urlOptions.deleteWareURL(id).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getWareArr();
},
});
});
})
.catch(() => {});
},
//tableBtn
handleClick(val) {
if (val.type === 'edit') {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id, this.wareInfo);
});
} else if (val.type === 'delete') {
this.deleteHandle(val.data.id, val.data.name, val.data._pageIndex);
} else if (val.type === 'change') {
this.changeStatus(val.data.id);
} else {
this.otherMethods(val);
}
},
// /
addOrUpdateHandle(id) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id, this.wareInfo);
});
},
successSubmit1() {
this.handleCancel();
this.getWareArr();
},
setWareInfo(info) {
this.wareInfo.warehouseName = info.name;
this.wareInfo.warehouseCode = info.code;
this.wareInfo.warehouseId = info.id;
this.getDataList();
},
}, },
}; };
</script> </script>
<style scoped> <style scoped>
.flexDiv { .ware-card {
display: flex; margin-bottom: 10px;
cursor: pointer;
} }
.divClass { .ware-card >>> .el-card__body {
width: 120px; padding: 10px;
height: 50px; font-size: 16px;
line-height: 50px; line-height: 30px;
text-align: center;
border: 1px solid #ededed;
font-size: 14px;
color: #606266;
} }
.up:nth-child(n) { .el-dropdown-div {
border-bottom: none; float: right;
border-right: none; padding-top: 3px;
}
.up:last-child {
border-right: 1px solid #ededed;
}
.down:nth-child(n) {
border-right: none;
}
.down:last-child {
border-right: 1px solid #ededed;
} }
</style> </style>

View File

@ -1,413 +0,0 @@
<template>
<div class="app-container">
<el-row :gutter="20">
<el-col :span="4">
<el-button
type="primary"
v-hasPermi="['warehouse:warehouse-info:create']"
plain
size="mini"
@click="addWare">
新增仓库
</el-button>
<el-divider content-position="left">仓库列表</el-divider>
<el-card
v-for="item in wareArr"
:key="item.id"
shadow="hover"
@click.native="setWareInfo(item)"
:style="{
background: item.id === wareInfo.warehouseId ? '#37D97F' : '',
color: item.id === wareInfo.warehouseId ? 'white' : '',
}"
class="ware-card">
{{ item.name }}
<el-dropdown class="el-dropdown-div">
<span class="el-dropdown-link">
<i
class="el-icon-s-tools"
style="color: #409eff; cursor: pointer; font-size: 25px" />
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item
v-hasPermi="['warehouse:warehouse-info:update']"
@click.native="dropdown(1, item.id)">
编辑
</el-dropdown-item>
<el-dropdown-item @click.native="dropdown(2, item.id)">
详情
</el-dropdown-item>
<el-dropdown-item
v-hasPermi="['warehouse:warehouse-info:delete']"
@click.native="dropdown(3, item.id, item.name)">
删除
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-card>
</el-col>
<el-col :span="20">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
</el-col>
</el-row>
<!-- 对话框(添加 / 修改) -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
:destroy-on-close="true"
width="40%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
<add-or-update1
ref="addOrUpdate1"
@refreshDataList="successSubmit1"></add-or-update1>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import AddOrUpdate1 from './add-or-updata1';
import basicPage from '../mixins/basic-page';
import { parseTime } from '../mixins/code-filter';
import codeFilter from '../mixins/code-filter';
import {
deleteWarehouse,
getWarehouseList,
} from '@/api/warehouse/warehouse-info';
import {
deleteWarehouseLocation,
getWarehouseLocationPage,
} from '@/api/warehouse/warehouseLocation';
import { BackgroundClass } from 'quill';
const tableProps = [
{
prop: 'warehouseCode',
label: '仓库编码',
},
{
prop: 'warehouseName',
label: '仓库名称',
},
{
prop: 'code',
label: '库位编码',
width: 180
},
{
prop: 'name',
label: '库位名称',
},
{
prop: 'arrange',
label: '排',
width: 50
},
{
prop: 'col',
label: '列',
width: 50
},
{
prop: 'layer',
label: '层',
width: 50
},
{
prop: 'type',
label: '库位类型',
filter: codeFilter('wareType'),
width: 80
},
{
prop: 'enabled',
label: '是否可用',
filter: codeFilter('deactivate'),
width: 80
},
{
prop: 'remark',
label: '备注',
},
];
export default {
mixins: [basicPage],
data() {
return {
urlOptions: {
getDataListURL: getWarehouseLocationPage,
deleteURL: deleteWarehouseLocation,
getWareListURL: getWarehouseList,
deleteWareURL: deleteWarehouse,
},
tableProps,
tableBtn: [
this.$auth.hasPermi(`extend:warehouse-location:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi(`extend:warehouse-location:delete`)
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
tableData: [],
formConfig: [
{
type: 'input',
label: '库位名称',
placeholder: '库位名称',
param: 'name',
},
{
type: 'input',
label: '库位编码',
placeholder: '库位编码',
param: 'code',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('extend:warehouse-location:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
// {
// type: 'button',
// btnName: '',
// name: 'reset',
// },
// {
// type: this.$auth.hasPermi('extend:warehouse-location:create') ? 'separate' : '',
// },
// {
// type: this.$auth.hasPermi('extend:warehouse-location:export') ? 'button' : '',
// btnName: '',
// name: 'export',
// color: 'warning',
// },
],
wareArr: [],
listQuery: {
pageSize: 10,
pageNo: 1,
total: 1,
warehouseId: '',
},
wareInfo: {},
};
},
components: {
AddOrUpdate,
AddOrUpdate1,
},
created() {
this.urlOptions.getWareListURL().then((response) => {
this.wareArr = response.data;
if (this.wareArr) {
this.wareInfo.warehouseId = this.wareArr[0].id;
this.wareInfo.warehouseName = this.wareArr[0].name;
this.wareInfo.warehouseCode = this.wareArr[0].code;
this.getDataList();
}
});
},
methods: {
//
getDataList() {
if (!this.wareInfo.warehouseId) {
return;
}
this.listQuery.warehouseId = this.wareInfo.warehouseId;
this.dataListLoading = true;
this.urlOptions.getDataListURL(this.listQuery).then((response) => {
this.tableData = response.data.list;
this.listQuery.total = response.data.total;
this.dataListLoading = false;
});
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name;
this.listQuery.code = val.code;
this.getDataList();
break;
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 10,
pageNo: 1,
total: 1,
};
this.getDataList();
break;
case 'add':
this.addOrEditTitle = '新增库位';
this.addOrUpdateVisible = true;
this.addOrUpdateHandle();
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
getWareArr() {
this.urlOptions.getWareListURL().then((response) => {
this.wareArr = response.data;
});
},
addWare() {
this.addOrEditTitle = '新增仓库';
this.addOrUpdateVisible = true;
this.addOrUpdate = 'addOrUpdate1';
this.$nextTick(() => {
this.$refs.addOrUpdate1.init();
});
},
//dropdown
dropdown(val, id, name) {
if (val === 1) {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '编辑仓库';
this.addOrUpdate = 'addOrUpdate1';
this.$nextTick(() => {
this.$refs.addOrUpdate1.init(id);
});
} else if (val === 2) {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '仓库详情';
this.addOrUpdate = 'addOrUpdate1';
this.$nextTick(() => {
this.$refs.addOrUpdate1.init(id, true);
});
} else if (val === 3) {
this.deleteWare(id, name);
} else {
console.log(val);
}
},
//
deleteWare(id, name) {
this.$confirm(`确定对仓库[${name}]进行删除操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
this.urlOptions.deleteWareURL(id).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getWareArr();
},
});
});
})
.catch(() => {});
},
//tableBtn
handleClick(val) {
if (val.type === 'edit') {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id, this.wareInfo);
});
} else if (val.type === 'delete') {
this.deleteHandle(val.data.id, val.data.name, val.data._pageIndex);
} else if (val.type === 'change') {
this.changeStatus(val.data.id);
} else {
this.otherMethods(val);
}
},
// /
addOrUpdateHandle(id) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id, this.wareInfo);
});
},
successSubmit1() {
this.handleCancel();
this.getWareArr();
},
setWareInfo(info) {
this.wareInfo.warehouseName = info.name;
this.wareInfo.warehouseCode = info.code;
this.wareInfo.warehouseId = info.id;
this.getDataList();
},
},
};
</script>
<style scoped>
.ware-card {
margin-bottom: 10px;
cursor: pointer;
}
.ware-card >>> .el-card__body {
padding: 10px;
font-size: 16px;
line-height: 30px;
}
.el-dropdown-div {
float: right;
padding-top: 3px;
}
</style>