定制化报表,基础核心

This commit is contained in:
helloDy
2023-12-14 14:01:19 +08:00
parent 8399081a6f
commit 79274aa8c8
23 changed files with 1264 additions and 63 deletions

View File

@@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2023-11-22 10:27:50
* @LastEditTime: 2023-12-12 16:04:44
* @Description:
-->
<template>
@@ -15,25 +15,26 @@
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="客户编号" prop="code">
<el-input v-model="dataForm.code" clearable placeholder="请输入客户编号" />
<el-input v-model="dataForm.code" :disabled="isdetail" clearable placeholder="请输入客户编号" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="客户名称" prop="name">
<el-input v-model="dataForm.name" clearable placeholder="请输入客户名称" />
<el-input v-model="dataForm.name" :disabled="isdetail" clearable placeholder="请输入客户名称" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="联系人" prop="contact">
<el-input v-model="dataForm.contact" clearable placeholder="请输入联系人" />
<el-input v-model="dataForm.contact" :disabled="isdetail" clearable placeholder="请输入联系人" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系电话" prop="telephone">
<el-input
v-model="dataForm.telephone"
:disabled="isdetail"
maxlength="11"
placeholder="请输入联系电话" />
</el-form-item>
@@ -42,22 +43,34 @@
<el-form-item label="地址" prop="address">
<el-input
v-model="dataForm.address"
:disabled="isdetail"
placeholder="请输入地址" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input
v-model="dataForm.remark"
:disabled="isdetail"
placeholder="请输入备注" />
</el-form-item>
<el-form-item label="特殊要求" prop="specialRequirements">
<el-input
type="textarea"
v-model="dataForm.specialRequirements"
:disabled="isdetail"
placeholder="请输入备注" />
<imageUpload v-model="files" :disabled="isdetail" :limit="5"/>
</el-form-item>
</el-form>
</template>
<script>
import basicAdd from '../../core/mixins/basic-add';
import { createCustomer, updateCustomer, getCustomer, getCode } from "@/api/base/coreCustomer";
import ImageUpload from '@/components/ImageUpload';
export default {
mixins: [basicAdd],
components: { ImageUpload },
data() {
return {
urlOptions: {
@@ -67,6 +80,8 @@ export default {
updateURL: updateCustomer,
infoURL: getCustomer
},
files: [],
isdetail: false,
dataForm: {
id: undefined,
code: undefined,
@@ -74,7 +89,9 @@ export default {
telephone: undefined,
contact: undefined,
address: undefined,
remark: undefined
remark: undefined,
specialRequirements: undefined,
files: []
},
dataRule: {
code: [{ required: true, message: "客户编号不能为空", trigger: "blur" }],
@@ -100,6 +117,66 @@ export default {
};
},
mounted() {},
methods: {}
methods: {
init(id, isdetail) {
this.dataForm.id = id || "";
this.isdetail = isdetail || false;
this.visible = true;
if (this.urlOptions.getOption) {
this.getArr()
}
this.$nextTick(() => {
this.$refs["dataForm"].resetFields();
if (this.dataForm.id) {
this.urlOptions.infoURL(id).then(response => {
this.dataForm = response.data;
if (this.setData) {
this.setDataForm()
}
});
} else {
if (this.urlOptions.isGetCode) {
this.getCode()
}
}
});
},
// 表单提交
dataFormSubmit() {
console.log('122', this.files)
this.$refs["dataForm"].validate((valid) => {
if (!valid) {
return false;
}
this.dataForm.files = []
if (this.files.length > 0) {
this.files.forEach(item => {
const temp = {
fileType: 1,
fileUrl: item
}
this.dataForm.files.push(temp)
})
}
// 修改的提交
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.visible = false;
this.$emit("refreshDataList");
});
});
},
}
};
</script>

View File

@@ -88,13 +88,19 @@ export default {
},
tableProps,
tableBtn: [
this.$auth.hasPermi(`base:core-customer:detail`)
? {
type: 'detail',
btnName: '详情',
}
: undefined,
this.$auth.hasPermi(`base:core-customer:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi(`base:core-customer:delete`)
this.$auth.hasPermi(`base:core-customer:delete`)
? {
type: 'delete',
btnName: '删除',
@@ -171,6 +177,13 @@ export default {
console.log(val);
}
},
otherMethods(val) {
this.addOrUpdateVisible = true;
this.addOrEditTitle = "详情";
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id, true);
});
}
},
};
</script>

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

@@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2023-11-27 20:12:00
* @LastEditTime: 2023-12-14 13:52:42
* @Description:
-->
<template>
@@ -15,19 +15,19 @@
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="原料名称" prop="name">
<el-input v-model="dataForm.name" clearable placeholder="请输入原料名称" />
<el-input v-model="dataForm.name" :disabled="isdetail" clearable placeholder="请输入原料名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="原料编号" prop="code">
<el-input v-model="dataForm.code" clearable placeholder="请输入原料编号" />
<el-input v-model="dataForm.code" :disabled="isdetail" clearable placeholder="请输入原料编号" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="每日消耗量" prop="dailyCost">
<el-input-number v-model="dataForm.dailyCost" controls-position="right" clearable placeholder="请输入每日消耗量" style="width: 100%" />
<el-input-number v-model="dataForm.dailyCost" :disabled="isdetail" :min="0" controls-position="right" clearable placeholder="请输入每日消耗量" style="width: 100%" />
</el-form-item>
</el-col>
<el-col :span="12">
@@ -35,6 +35,7 @@
<el-select
v-model="dataForm.unit"
filterable
:disabled="isdetail"
style="width: 100%"
placeholder="请选择单位">
<el-option
@@ -47,17 +48,58 @@
</el-col>
</el-row>
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" clearable placeholder="请输入备注" />
<el-input v-model="dataForm.remark" :disabled="isdetail" clearable placeholder="请输入备注" />
</el-form-item>
<small-title
:size="'sm'"
style="margin: 16px 0; padding-left: 8px; font-size: 14px"
: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>
<el-row :gutter="20" v-for="(item, index) in test" :key="index">
<el-col :span="9">
<el-form-item label="成分" label-width="50px" prop="name1">
<el-input v-model="item.name" :disabled="isdetail" :min="0" controls-position="right" clearable placeholder="请输入成分" style="width: 100%" />
</el-form-item>
</el-col>
<el-col :span="15">
<el-form-item label="标准含量" prop="unit1">
<el-row :gutter="5">
<el-col :span="1">
<el-tooltip content="如果标准含量不是一个范围,而是一个值,在最大值、最小值中填入相同数字即可。" placement="top">
<span style="margin-left: -15px"><i class="el-icon-question"></i></span>
</el-tooltip>
</el-col>
<el-col :span="11">
<el-input-number v-model="item.minValue" :disabled="isdetail" :min="0" controls-position="right" clearable placeholder="最小值" style="width: 100%" />
</el-col>
<el-col :span="11">
<el-input-number v-model="item.maxValue" :disabled="isdetail" :min="0" controls-position="right" clearable placeholder="最大值" style="width: 100%" />
</el-col>
</el-row>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '../../core/mixins/basic-add';
import { createHotMaterial, updateHotMaterial, getHotMaterial, getCode } from "@/api/base/coreHotMaterial";
import { createHotMaterial, updateHotMaterial, getHotMaterial, getCode, createHotMaterialCheck, updateHotMaterialCheck, getHotCheckList } from "@/api/base/coreHotMaterial";
import { getDictDatas} from "@/utils/dict";
import SmallTitle from './SmallTitle';
export default {
components: { SmallTitle },
mixins: [basicAdd],
data() {
return {
@@ -76,8 +118,10 @@ export default {
dailyCost: undefined,
remark: undefined
},
test: [],
departmentlList: [],
menuOptions: [],
isdetail: false,
dataRule: {
code: [{ required: true, message: "原料编码不能为空", trigger: "blur" }],
name: [{ required: true, message: "原料名称不能为空", trigger: "blur" }]
@@ -85,6 +129,100 @@ export default {
};
},
mounted() {},
methods: {}
methods: {
init(id, isdetail) {
this.test = []
this.dataForm.id = id || "";
this.isdetail = isdetail || false;
this.visible = true;
this.$nextTick(() => {
this.$refs["dataForm"].resetFields();
if (this.dataForm.id) {
this.urlOptions.infoURL(id).then(response => {
this.dataForm = response.data;
});
getHotCheckList({
materialId: this.dataForm.id
}).then(res => {
this.test = res.data
})
} else {
this.test = [
{
name: null,
minValue: undefined,
maxValue: undefined
}
]
if (this.urlOptions.isGetCode) {
this.getCode()
}
}
});
},
// 表单提交
dataFormSubmit() {
this.$refs["dataForm"].validate((valid) => {
if (!valid) {
return false;
}
// 修改的提交
if (this.dataForm.id) {
this.urlOptions.updateURL(this.dataForm).then(response => {
if (this.test.length > 1 || this.test[0].name) {
this.test.forEach(check => {
check.hotMaterialId = this.dataForm.id
if (check.id) {
updateHotMaterialCheck(check).then(res => {
console.log(res)
})
} else {
createHotMaterialCheck(check).then(res1 => {
console.log(res1)
})
}
})
}
this.$modal.msgSuccess("修改成功");
this.visible = false;
this.$emit("refreshDataList");
});
return;
}
// 添加的提交
this.urlOptions.createURL(this.dataForm).then(response => {
if (this.test.length > 1 || this.test[0].name) {
this.test.forEach(check => {
check.hotMaterialId = response.data
createHotMaterialCheck(check).then(res => {
console.log(res)
})
})
}
this.$modal.msgSuccess("新增成功");
this.visible = false;
this.$emit("refreshDataList");
});
});
},
addNew() {
this.test.push({
name: null,
minValue: undefined,
maxValue: undefined
})
}
}
};
</script>
<style scoped>
.action_btn {
float: right;
margin: -40px 15px;
font-size: 14px;
}
.add {
color: #0b58ff;
}
</style>

View File

@@ -83,13 +83,19 @@ export default {
},
tableProps,
tableBtn: [
this.$auth.hasPermi(`base:core-hot-material:update`)
this.$auth.hasPermi(`base:core-hot-material-check:detail`)
? {
type: 'detail',
btnName: '详情',
}
: undefined,
this.$auth.hasPermi(`base:core-hot-material-check:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi(`base:core-hot-material:delete`)
this.$auth.hasPermi(`base:core-hot-material-check:delete`)
? {
type: 'delete',
btnName: '删除',
@@ -120,7 +126,7 @@ export default {
type: 'separate',
},
{
type: this.$auth.hasPermi('base:core-hot-material:create') ? 'button' : '',
type: this.$auth.hasPermi('base:core-hot-material-check:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
@@ -143,6 +149,14 @@ export default {
// this.dataListLoading = false;
// });
// },
otherMethods(val) {
// 详情
this.addOrUpdateVisible = true;
this.addOrEditTitle = "详情";
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id, true);
});
},
buttonClick(val) {
switch (val.btnName) {
case 'search':

View File

@@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2023-11-27 20:07:09
* @LastEditTime: 2023-12-06 10:36:56
* @Description:
-->
<template>
@@ -91,27 +91,30 @@
</el-col>
<el-col :span="8">
<el-form-item label="单位平方数" prop="area">
<el-input-number v-model="dataForm.area" :precision="2" style="width: 100%" :disabled="isdetail" clearable placeholder="请输入单位平方数" />
<el-input-number v-model="dataForm.area" :precision="6" :min="0" style="width: 100%" :disabled="isdetail" clearable placeholder="请输入单位平方数" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="规格" prop="specifications">
<el-input v-model="dataForm.specifications" :disabled="isdetail" clearable placeholder="请输入规格" />
<el-input v-model="dataForm.specifications" :disabled="isdetail" @blur="setArea" @clear="clearArea" clearable placeholder="请输入规格" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="产线生产单位用时(S)" prop="processTime">
<el-input v-model.number="dataForm.processTime" type="number" :disabled="isdetail" clearable placeholder="请输入产线生产单位用时" />
<el-input v-model.number="dataForm.processTime" :precision="4" :min="0" type="number" :disabled="isdetail" clearable placeholder="请输入产线生产单位用时" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" :disabled="isdetail" clearable placeholder="请输入备注" />
<el-form-item label="重量" prop="weight">
<el-input-number v-model="dataForm.weight" :precision="6" :min="0" style="width: 100%" :disabled="isdetail" clearable placeholder="请输入重量" />
</el-form-item>
</el-col>
</el-row>
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" :disabled="isdetail" clearable placeholder="请输入备注" />
</el-form-item>
</el-form>
</div>
@@ -240,7 +243,8 @@ export default {
specifications: undefined,
processTime: 0,
remark: undefined,
unit: undefined
unit: undefined,
weight: undefined
},
productAttrList: [],
visible: false,
@@ -257,6 +261,24 @@ export default {
},
mounted() {},
methods: {
clearArea() {
this.$set(this.dataForm, 'area', 0)
this.$set(this.dataForm, 'weight', 0)
},
setArea() {
if (this.dataForm.specifications) {
const height = Number(this.dataForm.specifications.slice(2,4))
const length = Number(this.dataForm.specifications.slice(4,8))
const width = Number(this.dataForm.specifications.slice(8))
// this.dataForm.area = length * width
// this.dataForm.weight = 2.5 * height * length * width
this.$set(this.dataForm, 'area', length * width)
this.$set(this.dataForm, 'weight', 2.5 * height * length * width)
} else {
this.dataForm.area = 0
this.dataForm.weight = 0
}
},
initData() {
this.productAttrList.splice(0);
this.listQuery.total = 0;
@@ -317,6 +339,10 @@ export default {
// 获取产品详情
this.urlOptions.infoURL(id).then(response => {
this.dataForm = response.data
// this.dataForm.area = response.data.area || 0
// this.dataForm.weight = response.data.weight || 0
// this.dataForm.specifications = response.data.specifications || undefined
console.log('11res112', this.dataForm.specifications, this.dataForm.weight, this.dataForm.area)
if (this.dataForm.unit !== undefined) {
this.dataForm.unit = String(this.dataForm.unit)
}
@@ -339,7 +365,7 @@ export default {
goback() {
this.$emit('refreshDataList');
this.visible = false;
// this.initData();
this.initData();
},
goEdit() {
this.isdetail = false;
@@ -370,6 +396,7 @@ export default {
this.urlOptions.createURL(this.dataForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.idAttrShow = true
this.dataForm.id = response.data
// this.visible = false;
this.$emit("refreshDataList");
});

View File

@@ -140,12 +140,13 @@ export default {
allocationVisible: false,
tableProps,
tableBtn: [
this.$auth.hasPermi(`base:core-work-order:material`)
? {
type: 'material',
btnName: '原料信息',
}
: undefined,
// this.$auth.hasPermi(`base:core-work-order:material`)
// ? {
// type: 'material',
// btnName: '原料信息',
// showTip: '预使用原料信息'
// }
// : undefined,
{
type: 'active',
btnName: '激活',

View File

@@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2023-11-27 15:26:12
* @LastEditTime: 2023-12-04 15:10:11
* @Description:
-->
<template>
@@ -377,6 +377,7 @@ export default {
this.urlOptions.createURL(this.dataForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.idAttrShow = true
this.dataForm.id = response.data
this.$emit("refreshDataList");
});
});