Compare commits
9 Commits
2cf0e718f7
...
a4c1438e59
Author | SHA1 | Date | |
---|---|---|---|
a4c1438e59 | |||
577fcb53d2 | |||
56191453af | |||
84a055e605 | |||
c466cbb378 | |||
18a9a4f51b | |||
cee4ebfd43 | |||
9831026c5a | |||
1e538579a8 |
4
.env.dev
@ -5,7 +5,9 @@ ENV = 'development'
|
|||||||
VUE_APP_TITLE = 芋道管理系统
|
VUE_APP_TITLE = 芋道管理系统
|
||||||
|
|
||||||
# 芋道管理系统/开发环境
|
# 芋道管理系统/开发环境
|
||||||
VUE_APP_BASE_API = 'http://192.168.0.33:48080'
|
VUE_APP_BASE_API = 'http://192.168.1.49:48080'
|
||||||
|
# VUE_APP_BASE_API = 'http://192.168.0.33:48080'
|
||||||
|
# VUE_APP_BASE_API = 'http://192.168.1.188:48080'
|
||||||
|
|
||||||
# 路由懒加载
|
# 路由懒加载
|
||||||
VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
||||||
|
62
src/api/base/energyType.js
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 创建能源类型
|
||||||
|
export function createEnergyType(data) {
|
||||||
|
return request({
|
||||||
|
url: '/base/energy-type/create',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新能源类型
|
||||||
|
export function updateEnergyType(data) {
|
||||||
|
return request({
|
||||||
|
url: '/base/energy-type/update',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除能源类型
|
||||||
|
export function deleteEnergyType(id) {
|
||||||
|
return request({
|
||||||
|
url: '/base/energy-type/delete?id=' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获得能源类型
|
||||||
|
export function getEnergyType(id) {
|
||||||
|
return request({
|
||||||
|
url: '/base/energy-type/get?id=' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获得能源类型分页
|
||||||
|
export function getEnergyTypePage(data) {
|
||||||
|
return request({
|
||||||
|
url: '/base/energy-type/page',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获得能源类型编码
|
||||||
|
export function getEnergyTypeCode() {
|
||||||
|
return request({
|
||||||
|
url: '/base/energy-type/getCode',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出能源类型 Excel
|
||||||
|
export function exportEnergyTypeExcel(query) {
|
||||||
|
return request({
|
||||||
|
url: '/base/energy-type/export-excel',
|
||||||
|
method: 'get',
|
||||||
|
params: query,
|
||||||
|
responseType: 'blob'
|
||||||
|
})
|
||||||
|
}
|
@ -1,3 +1,10 @@
|
|||||||
|
/*
|
||||||
|
* @Author: zwq
|
||||||
|
* @Date: 2023-07-26 09:56:38
|
||||||
|
* @LastEditors: zwq
|
||||||
|
* @LastEditTime: 2023-08-04 13:59:23
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
// 创建工厂产线
|
// 创建工厂产线
|
||||||
@ -15,7 +22,13 @@ export function getCode() {
|
|||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 获得产线status
|
||||||
|
export function getStatus(ids) {
|
||||||
|
return request({
|
||||||
|
url: '/base/equipment-status-realtime/lineStatus?ids=' + ids,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
// 更新工厂产线
|
// 更新工厂产线
|
||||||
export function updateProductionLine(data) {
|
export function updateProductionLine(data) {
|
||||||
return request({
|
return request({
|
||||||
|
@ -57,6 +57,11 @@
|
|||||||
{{ col.uploadTips || '只能上传jpg/png文件,大小不超过2MB' }}
|
{{ col.uploadTips || '只能上传jpg/png文件,大小不超过2MB' }}
|
||||||
</div>
|
</div>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
|
<component
|
||||||
|
v-if="col.subcomponent"
|
||||||
|
:key="col.key"
|
||||||
|
:is="col.subcomponent"
|
||||||
|
:style="col.style"></component>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -222,7 +227,7 @@ export default {
|
|||||||
|
|
||||||
getFileName(fileUrl) {
|
getFileName(fileUrl) {
|
||||||
return fileUrl.split('/').pop();
|
return fileUrl.split('/').pop();
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
@ -1,4 +1,4 @@
|
|||||||
import DialogForm from '../components/dialogForm.vue';
|
import DialogForm from '@/components/DialogForm/index.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { DialogForm },
|
components: { DialogForm },
|
@ -86,6 +86,9 @@ export const DICT_TYPE = {
|
|||||||
// ============== PRODUCT - 产品模块 =============
|
// ============== PRODUCT - 产品模块 =============
|
||||||
UNIT_DICT: 'unit_dict',
|
UNIT_DICT: 'unit_dict',
|
||||||
PRODUCT_TYPE: 'product_type',
|
PRODUCT_TYPE: 'product_type',
|
||||||
|
|
||||||
|
// ============== ENERGY - 能源模块 =============
|
||||||
|
ENERGY_UNIT: 'energy_unit'
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -95,7 +98,7 @@ export const DICT_TYPE = {
|
|||||||
* @returns {*|Array} 数据字典数组
|
* @returns {*|Array} 数据字典数组
|
||||||
*/
|
*/
|
||||||
export function getDictDatas(dictType) {
|
export function getDictDatas(dictType) {
|
||||||
console.log('---> ', dictType, store.getters.dict_datas)
|
// console.log('---> ', dictType, store.getters.dict_datas)
|
||||||
return store.getters.dict_datas[dictType] || []
|
return store.getters.dict_datas[dictType] || []
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,3 +148,15 @@ export function getDictDataLabel(dictType, value) {
|
|||||||
const dict = getDictData(dictType, value);
|
const dict = getDictData(dictType, value);
|
||||||
return dict ? dict.label : '';
|
return dict ? dict.label : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// table中用来过滤字典
|
||||||
|
export function publicFormatter(dictTable) {
|
||||||
|
const dictDatas = getDictDatas(dictTable)
|
||||||
|
return function (val) {
|
||||||
|
const arr = {}
|
||||||
|
dictDatas.map((item) => {
|
||||||
|
arr[item.value] = item.label
|
||||||
|
})
|
||||||
|
return arr?.[val]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -53,7 +53,7 @@ import {
|
|||||||
exportEquipmentGroupExcel,
|
exportEquipmentGroupExcel,
|
||||||
} from '@/api/base/equipmentGroup';
|
} from '@/api/base/equipmentGroup';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import basicPageMixin from '../mixin/basicPageMixin';
|
import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
||||||
import { getAccessToken } from '@/utils/auth';
|
import { getAccessToken } from '@/utils/auth';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -1,115 +0,0 @@
|
|||||||
import DialogForm from '../components/dialogForm.vue';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
components: { DialogForm },
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
// 遮罩层
|
|
||||||
loading: true,
|
|
||||||
// 导出遮罩层
|
|
||||||
exportLoading: false,
|
|
||||||
// 显示搜索条件
|
|
||||||
showSearch: true,
|
|
||||||
// 总条数
|
|
||||||
total: 0,
|
|
||||||
// 质量检测信息基础列表
|
|
||||||
list: [],
|
|
||||||
// 弹出层标题
|
|
||||||
title: '',
|
|
||||||
// 是否显示弹出层
|
|
||||||
open: false,
|
|
||||||
// 列表数据
|
|
||||||
tableData: [],
|
|
||||||
// 弹窗的表单
|
|
||||||
// form: {}, // 占位
|
|
||||||
// 搜索框需要的 keys
|
|
||||||
// searchBarKeys: [], // 占位
|
|
||||||
// tableProps: [], // 占位
|
|
||||||
// tableBtn: [], // 占位
|
|
||||||
// searchBarFormConfig: [], // 占位
|
|
||||||
// // 弹窗表单配置
|
|
||||||
// dialogFormConfig: [], // 占位
|
|
||||||
};
|
|
||||||
},
|
|
||||||
mounted() {},
|
|
||||||
methods: {
|
|
||||||
// 过滤后端传回的详情数据
|
|
||||||
filterData(data, keys) {
|
|
||||||
const obj = {};
|
|
||||||
keys.forEach((key) => {
|
|
||||||
if (/time/i.test(key)) {
|
|
||||||
obj[key] = new Date(data[key]);
|
|
||||||
} else {
|
|
||||||
obj[key] = data[key];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return obj;
|
|
||||||
},
|
|
||||||
// 处理搜索条件
|
|
||||||
handleSearchBarBtnClick() {},
|
|
||||||
// 处理表格按钮
|
|
||||||
handleTableBtnClick({ data, type }) {
|
|
||||||
switch (type) {
|
|
||||||
case 'edit':
|
|
||||||
this.handleUpdate(data);
|
|
||||||
break;
|
|
||||||
case 'delete':
|
|
||||||
this.handleDelete(data);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 处理搜索栏按钮
|
|
||||||
handleSearchBarBtnClick(btn) {
|
|
||||||
// const keys = ['name', 'createTime']; // timeVal // 已被 searchBarKeys 替代
|
|
||||||
switch (btn.btnName) {
|
|
||||||
case 'search':
|
|
||||||
this.searchBarKeys.forEach((key) => {
|
|
||||||
if (key == 'timeVal') {
|
|
||||||
this.queryParams['startTime'] = btn.timeVal[0];
|
|
||||||
this.queryParams['endTime'] = btn.timeVal[1];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.queryParams[key] = btn[key] || null;
|
|
||||||
});
|
|
||||||
this.handleQuery();
|
|
||||||
break;
|
|
||||||
case 'add':
|
|
||||||
this.handleAdd();
|
|
||||||
break;
|
|
||||||
case 'export':
|
|
||||||
this.handleExport();
|
|
||||||
break;
|
|
||||||
case 'reset':
|
|
||||||
this.$refs['search-bar'].resetForm();
|
|
||||||
this.resetQuery();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
handleEmitFun({ action, value }) {
|
|
||||||
console.log('[Emit Fun]', action, value);
|
|
||||||
switch (action) {
|
|
||||||
// 查看详情
|
|
||||||
case 'show-detail':
|
|
||||||
this.$modal.msgSuccess('查看详情')
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 获取列表数据
|
|
||||||
getList() {},
|
|
||||||
/** 搜索按钮操作 */
|
|
||||||
handleQuery() {
|
|
||||||
this.queryParams.pageNo = 1;
|
|
||||||
this.getList();
|
|
||||||
},
|
|
||||||
/** 重置按钮操作 */
|
|
||||||
resetQuery() {
|
|
||||||
this.resetForm('queryForm');
|
|
||||||
this.handleQuery();
|
|
||||||
},
|
|
||||||
/** 取消按钮 */
|
|
||||||
cancel() {
|
|
||||||
this.open = false;
|
|
||||||
this.reset();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
BIN
src/views/core/base/equipment/assets/eq1.jpg
Normal file
After Width: | Height: | Size: 42 KiB |
BIN
src/views/core/base/equipment/assets/eq10.jpg
Normal file
After Width: | Height: | Size: 50 KiB |
BIN
src/views/core/base/equipment/assets/eq2.jpg
Normal file
After Width: | Height: | Size: 78 KiB |
BIN
src/views/core/base/equipment/assets/eq3.jpg
Normal file
After Width: | Height: | Size: 71 KiB |
BIN
src/views/core/base/equipment/assets/eq4.jpg
Normal file
After Width: | Height: | Size: 41 KiB |
BIN
src/views/core/base/equipment/assets/eq5.jpg
Normal file
After Width: | Height: | Size: 61 KiB |
BIN
src/views/core/base/equipment/assets/eq6.jpg
Normal file
After Width: | Height: | Size: 37 KiB |
BIN
src/views/core/base/equipment/assets/eq7.jpg
Normal file
After Width: | Height: | Size: 69 KiB |
BIN
src/views/core/base/equipment/assets/eq8.jpg
Normal file
After Width: | Height: | Size: 54 KiB |
BIN
src/views/core/base/equipment/assets/eq9.jpg
Normal file
After Width: | Height: | Size: 45 KiB |
37
src/views/core/base/equipment/components/EquipmentPics.vue
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<!--
|
||||||
|
filename: EquipmentPics.vue
|
||||||
|
author: liubin
|
||||||
|
date: 2023-08-18 16:29:39
|
||||||
|
description:
|
||||||
|
-->
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="equipment-pics">
|
||||||
|
<img v-for="url,idx in images" :key="url" :src="url" alt="" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'EquipmentPics',
|
||||||
|
components: {},
|
||||||
|
props: {},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
images: Array(10)
|
||||||
|
.fill(1)
|
||||||
|
.map((_, index) => `../assets/eq${index + 1}.jpg`),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
methods: {},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.equipment-pics {
|
||||||
|
background: #fcfcfc;
|
||||||
|
padding: 12px;
|
||||||
|
margin: 8px;
|
||||||
|
}
|
||||||
|
</style>
|
@ -38,92 +38,14 @@
|
|||||||
@confirm="submitForm">
|
@confirm="submitForm">
|
||||||
<DialogForm v-if="open" ref="form" :dataForm="form" :rows="rows" />
|
<DialogForm v-if="open" ref="form" :dataForm="form" :rows="rows" />
|
||||||
</base-dialog>
|
</base-dialog>
|
||||||
|
|
||||||
<!-- 对话框(添加 / 修改) -->
|
|
||||||
<el-dialog
|
|
||||||
:title="title"
|
|
||||||
:visible.sync="open"
|
|
||||||
width="500px"
|
|
||||||
v-dialogDrag
|
|
||||||
append-to-body>
|
|
||||||
<el-form ref="form" :model="form" label-width="80px">
|
|
||||||
<el-form-item label="编码" prop="code">
|
|
||||||
<el-input v-model="form.code" placeholder="请输入编码" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="设备名称" prop="name">
|
|
||||||
<el-input v-model="form.name" placeholder="请输入设备名称" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="英文名称" prop="enName">
|
|
||||||
<el-input v-model="form.enName" placeholder="请输入英文名称" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="缩写" prop="abbr">
|
|
||||||
<el-input v-model="form.abbr" placeholder="请输入缩写" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="进厂日期" prop="enterTime">
|
|
||||||
<el-date-picker
|
|
||||||
clearable
|
|
||||||
v-model="form.enterTime"
|
|
||||||
type="date"
|
|
||||||
value-format="timestamp"
|
|
||||||
placeholder="选择进厂日期" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="生产日期" prop="productionTime">
|
|
||||||
<el-date-picker
|
|
||||||
clearable
|
|
||||||
v-model="form.productionTime"
|
|
||||||
type="date"
|
|
||||||
value-format="timestamp"
|
|
||||||
placeholder="选择生产日期" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="设备类型,关联设备类型表" prop="equipmentTypeId">
|
|
||||||
<el-select
|
|
||||||
v-model="form.equipmentTypeId"
|
|
||||||
placeholder="请选择设备类型,关联设备类型表">
|
|
||||||
<el-option label="请选择字典生成" value="" />
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item
|
|
||||||
label="分组id (关联 base_equipment_GROUP)"
|
|
||||||
prop="groupId">
|
|
||||||
<el-select
|
|
||||||
v-model="form.groupId"
|
|
||||||
placeholder="请选择分组id (关联 base_equipment_GROUP)">
|
|
||||||
<el-option label="请选择字典生成" value="" />
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="每小时生产数量" prop="tvalue">
|
|
||||||
<el-input v-model="form.tvalue" placeholder="请输入每小时生产数量" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="单件加工时间 s/件" prop="processingTime">
|
|
||||||
<el-input
|
|
||||||
v-model="form.processingTime"
|
|
||||||
placeholder="请输入单件加工时间 s/件" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="制造商" prop="manufacturer">
|
|
||||||
<el-input v-model="form.manufacturer" placeholder="请输入制造商" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="规格" prop="spec">
|
|
||||||
<el-input v-model="form.spec" placeholder="请输入规格" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="功能描述">
|
|
||||||
<editor v-model="form.description" :min-height="192" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="备注" prop="remark">
|
|
||||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<div slot="footer" class="dialog-footer">
|
|
||||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
||||||
<el-button @click="cancel">取 消</el-button>
|
|
||||||
</div>
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import basicPageMixin from '../mixin/basicPageMixin';
|
import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
||||||
import { getAccessToken } from '@/utils/auth';
|
import { getAccessToken } from '@/utils/auth';
|
||||||
|
import EquipmentPics from './components/EquipmentPics';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
createEquipment,
|
createEquipment,
|
||||||
@ -281,12 +203,13 @@ export default {
|
|||||||
prop: 'equipmentTypeId',
|
prop: 'equipmentTypeId',
|
||||||
url: '/base/equipment-type/page?pageNo=1&pageSize=100',
|
url: '/base/equipment-type/page?pageNo=1&pageSize=100',
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
select: true,
|
// select: true,
|
||||||
label: '设备分组',
|
// label: '设备分组',
|
||||||
prop: 'groupId',
|
// prop: 'groupId',
|
||||||
url: '/base/equipment-group/page?pageNo=1&pageSize=100',
|
// url: '/base/equipment-group/page?pageNo=1&pageSize=100',
|
||||||
},
|
// },
|
||||||
|
{ input: true, label: '备注', prop: 'remark' },
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
@ -303,6 +226,7 @@ export default {
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
select: true,
|
select: true,
|
||||||
|
prop: 'tvalue',
|
||||||
label: '设备TT值',
|
label: '设备TT值',
|
||||||
rules: [
|
rules: [
|
||||||
{ required: true, message: '不能为空', trigger: 'blur' },
|
{ required: true, message: '不能为空', trigger: 'blur' },
|
||||||
@ -313,11 +237,10 @@ export default {
|
|||||||
transform: (val) => Number(val),
|
transform: (val) => Number(val),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
prop: 'tvalue',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
select: true,
|
select: true,
|
||||||
label: '单件产品加工时间',
|
label: '产品加工时间',
|
||||||
prop: 'processingTime',
|
prop: 'processingTime',
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
@ -365,16 +288,19 @@ export default {
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
diy: true,
|
diy: true,
|
||||||
|
key: 'eq-assets',
|
||||||
label: '设备资料',
|
label: '设备资料',
|
||||||
prop: 'fileNames',
|
prop: 'fileNames',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[{ input: true, label: '备注', prop: 'remark' }],
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
diy: true,
|
diy: true,
|
||||||
|
key: 'eq-pics',
|
||||||
label: '设备图片',
|
label: '设备图片',
|
||||||
prop: 'fileUrls',
|
prop: 'fileUrls',
|
||||||
|
subcomponent: EquipmentPics,
|
||||||
|
style: 'overflow-x: auto;'
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
@ -384,9 +310,8 @@ export default {
|
|||||||
queryParams: {
|
queryParams: {
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
code: null,
|
code: '',
|
||||||
name: null,
|
name: '',
|
||||||
createTime: [],
|
|
||||||
},
|
},
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {},
|
form: {},
|
@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import basicPageMixin from '../mixin/basicPageMixin';
|
import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
createEquipmentType,
|
createEquipmentType,
|
||||||
@ -167,7 +167,7 @@ export default {
|
|||||||
queryParams: {
|
queryParams: {
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
name: null,
|
name: '',
|
||||||
},
|
},
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {},
|
form: {},
|
@ -114,17 +114,6 @@ export default {
|
|||||||
placeholder: '工厂名称',
|
placeholder: '工厂名称',
|
||||||
param: 'name',
|
param: 'name',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
type: 'datePicker',
|
|
||||||
label: '创建时间',
|
|
||||||
dateType: 'daterange',
|
|
||||||
format: 'yyyy-MM-dd',
|
|
||||||
valueFormat: 'yyyy-MM-dd HH:mm:ss',
|
|
||||||
rangeSeparator: '-',
|
|
||||||
startPlaceholder: '开始时间',
|
|
||||||
endPlaceholder: '结束时间',
|
|
||||||
param: 'createTime',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
type: 'button',
|
type: 'button',
|
||||||
btnName: '搜索',
|
btnName: '搜索',
|
||||||
@ -173,7 +162,6 @@ export default {
|
|||||||
this.listQuery.pageSize = 10;
|
this.listQuery.pageSize = 10;
|
||||||
this.listQuery.name = val.name;
|
this.listQuery.name = val.name;
|
||||||
this.listQuery.code = val.code;
|
this.listQuery.code = val.code;
|
||||||
this.listQuery.createTime = val.createTime;
|
|
||||||
this.getDataList();
|
this.getDataList();
|
||||||
break;
|
break;
|
||||||
case 'reset':
|
case 'reset':
|
||||||
|
@ -318,9 +318,9 @@ export default {
|
|||||||
if (raw.type === 'delete') {
|
if (raw.type === 'delete') {
|
||||||
this.$confirm(
|
this.$confirm(
|
||||||
`确定对${
|
`确定对${
|
||||||
val.data.name
|
raw.data.name
|
||||||
? '[名称=' + val.data.name + ']'
|
? '[名称=' + raw.data.name + ']'
|
||||||
: '[序号=' + val.data._pageIndex + ']'
|
: '[序号=' + raw.data._pageIndex + ']'
|
||||||
}进行删除操作?`,
|
}进行删除操作?`,
|
||||||
'提示',
|
'提示',
|
||||||
{
|
{
|
||||||
@ -330,7 +330,7 @@ export default {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
deleteProductAttr(val.data.id).then(({ data }) => {
|
deleteProductAttr(raw.data.id).then(({ data }) => {
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '操作成功',
|
message: '操作成功',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
ref="searchBarForm"
|
ref="searchBarForm"
|
||||||
@headBtnClick="buttonClick" />
|
@headBtnClick="buttonClick" />
|
||||||
<base-table
|
<base-table
|
||||||
v-loading="dataListLoading"
|
v-loading="dataListLoading"
|
||||||
:table-props="tableProps"
|
:table-props="tableProps"
|
||||||
:page="listQuery.pageNo"
|
:page="listQuery.pageNo"
|
||||||
:limit="listQuery.pageSize"
|
:limit="listQuery.pageSize"
|
||||||
@ -40,12 +40,14 @@
|
|||||||
<script>
|
<script>
|
||||||
import AddOrUpdate from './add-or-updata';
|
import AddOrUpdate from './add-or-updata';
|
||||||
import basicPage from '../../mixins/basic-page';
|
import basicPage from '../../mixins/basic-page';
|
||||||
|
import codeFilter from '../../mixins/code-filter';
|
||||||
import { parseTime } from '../../mixins/code-filter';
|
import { parseTime } from '../../mixins/code-filter';
|
||||||
import {
|
import {
|
||||||
deleteProductionLine,
|
deleteProductionLine,
|
||||||
getProductionLinePage,
|
getProductionLinePage,
|
||||||
exportProductionLineExcel
|
exportProductionLineExcel,
|
||||||
} from "@/api/core/base/productionLine";
|
getStatus,
|
||||||
|
} from '@/api/core/base/productionLine';
|
||||||
|
|
||||||
const tableProps = [
|
const tableProps = [
|
||||||
{
|
{
|
||||||
@ -63,6 +65,17 @@ const tableProps = [
|
|||||||
label: '工厂',
|
label: '工厂',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
prop: 'externalCode',
|
||||||
|
label: '额外编码',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'status',
|
||||||
|
label: '当前状态',
|
||||||
|
align: 'center',
|
||||||
|
filter: codeFilter('lineStatus'),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
prop: 'description',
|
prop: 'description',
|
||||||
label: '描述',
|
label: '描述',
|
||||||
@ -98,13 +111,13 @@ export default {
|
|||||||
btnName: '编辑',
|
btnName: '编辑',
|
||||||
}
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
this.$auth.hasPermi(`base:production-line:delete`)
|
this.$auth.hasPermi(`base:production-line:delete`)
|
||||||
? {
|
? {
|
||||||
type: 'delete',
|
type: 'delete',
|
||||||
btnName: '删除',
|
btnName: '删除',
|
||||||
}
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
].filter((v)=>v),
|
].filter((v) => v),
|
||||||
tableData: [],
|
tableData: [],
|
||||||
formConfig: [
|
formConfig: [
|
||||||
{
|
{
|
||||||
@ -131,7 +144,9 @@ export default {
|
|||||||
type: 'separate',
|
type: 'separate',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: this.$auth.hasPermi('base:production-line:create') ? 'button' : '',
|
type: this.$auth.hasPermi('base:production-line:create')
|
||||||
|
? 'button'
|
||||||
|
: '',
|
||||||
btnName: '新增',
|
btnName: '新增',
|
||||||
name: 'add',
|
name: 'add',
|
||||||
color: 'success',
|
color: 'success',
|
||||||
@ -154,6 +169,28 @@ export default {
|
|||||||
},
|
},
|
||||||
created() {},
|
created() {},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 获取数据列表
|
||||||
|
getDataList() {
|
||||||
|
this.dataListLoading = true;
|
||||||
|
this.urlOptions.getDataListURL(this.listQuery).then((response) => {
|
||||||
|
this.total = response.data.total;
|
||||||
|
this.getStatus(response.data.list);
|
||||||
|
this.dataListLoading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getStatus(list) {
|
||||||
|
const ids = list.map((i) => {
|
||||||
|
return i.id;
|
||||||
|
});
|
||||||
|
getStatus(ids).then((response) => {
|
||||||
|
response.forEach((a) => {
|
||||||
|
list.forEach((b) => {
|
||||||
|
if (b.id === a.id) b.status = a.status;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
this.tableData = list;
|
||||||
|
});
|
||||||
|
},
|
||||||
buttonClick(val) {
|
buttonClick(val) {
|
||||||
switch (val.btnName) {
|
switch (val.btnName) {
|
||||||
case 'search':
|
case 'search':
|
||||||
|
@ -8,45 +8,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
const table = {
|
const table = {
|
||||||
eightDisciplineType: {
|
lineStatus: {
|
||||||
1: '客诉问题',
|
1: '生产中',
|
||||||
2: '重大质量问题',
|
2: '停止',
|
||||||
0: '重复发生问题',
|
3: '未知',
|
||||||
},
|
|
||||||
examineStatus: {
|
|
||||||
1: '需要审批',
|
|
||||||
0: '不需要审批',
|
|
||||||
},
|
|
||||||
gradeFinish: {
|
|
||||||
1: '已打分',
|
|
||||||
0: '未打分',
|
|
||||||
},
|
|
||||||
step: {
|
|
||||||
0: 'D0',
|
|
||||||
1: 'D1',
|
|
||||||
2: 'D2',
|
|
||||||
3: 'D3',
|
|
||||||
4: 'D4',
|
|
||||||
5: 'D5',
|
|
||||||
6: 'D6',
|
|
||||||
7: 'D7',
|
|
||||||
8: 'D8',
|
|
||||||
},
|
|
||||||
containmentLocaleName:
|
|
||||||
{
|
|
||||||
1: "装配线",
|
|
||||||
2: "生产线",
|
|
||||||
3: "实验室",
|
|
||||||
4: "成品在途",
|
|
||||||
5: "第三方中间商",
|
|
||||||
},
|
|
||||||
developCountermeasuresName:
|
|
||||||
{
|
|
||||||
1: "让步接收",
|
|
||||||
2: "分选返工",
|
|
||||||
3: "隔离",
|
|
||||||
4: "退换货",
|
|
||||||
5: "通知供应商",
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
107
src/views/energy/base/energyType/components/InnerTable.vue
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
<template>
|
||||||
|
<el-popover placement="right" width="400" trigger="click">
|
||||||
|
<el-table :data="tableData" v-if='tableProps.length'>
|
||||||
|
<el-table-column
|
||||||
|
v-for='item in tableProps'
|
||||||
|
:key="item.prop"
|
||||||
|
:prop="item.prop"
|
||||||
|
:label="item.label"
|
||||||
|
width="120">
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<span v-if='singlePrice'><span class='priceTitle'>单价(元): </span>{{ singlePrice }}</span>
|
||||||
|
<el-button
|
||||||
|
slot="reference"
|
||||||
|
type="text"
|
||||||
|
class="tableInnerButton"
|
||||||
|
@click="showInnerTable(injectData)"
|
||||||
|
>详情</el-button
|
||||||
|
>
|
||||||
|
</el-popover>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { getEnergyType } from '@/api/base/energyType'
|
||||||
|
const temp1 = [
|
||||||
|
{
|
||||||
|
prop: 'startTime',
|
||||||
|
label: '开始时间'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'endTime',
|
||||||
|
label: '结束时间'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'price',
|
||||||
|
label: '单价(元)'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
const temp2 = [
|
||||||
|
{
|
||||||
|
prop: 'startUsed',
|
||||||
|
label: '下限值'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'endUsed',
|
||||||
|
label: '上限值'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'price',
|
||||||
|
label: '单价(元)'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
export default {
|
||||||
|
name: 'InnerTable',
|
||||||
|
props: {
|
||||||
|
injectData: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({})
|
||||||
|
},
|
||||||
|
itemProp: {
|
||||||
|
type: String
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
list: this.injectData,
|
||||||
|
tableData: [],
|
||||||
|
tableProps: [],
|
||||||
|
singlePrice:'',
|
||||||
|
temp1,
|
||||||
|
temp2
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
showInnerTable(data) {
|
||||||
|
let id = data.id
|
||||||
|
getEnergyType(id).then((res) => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
console.log(res)
|
||||||
|
if (res.data.pricingMethod === 0) {
|
||||||
|
this.tableProps = this.temp1
|
||||||
|
this.tableData = res.data.segPriceList
|
||||||
|
this.singlePrice = ''
|
||||||
|
} else if (res.data.pricingMethod === 1) {
|
||||||
|
this.tableProps = this.temp2
|
||||||
|
this.tableData = res.data.usedPriceList
|
||||||
|
this.singlePrice = ''
|
||||||
|
} else {
|
||||||
|
this.tableProps = []
|
||||||
|
this.tableData = []
|
||||||
|
this.singlePrice = res.data.singlePrice
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.tableInnerButton {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.priceTitle {
|
||||||
|
color: #515A5E;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
37
src/views/energy/base/energyType/components/InputArea.vue
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<template>
|
||||||
|
<div class="tableInner">
|
||||||
|
<el-input-number v-model="list[itemProp]" @blur="changeInput" :min="0" :max="100000000" style="width: 100%" :controls='false'></el-input-number>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'InputArea',
|
||||||
|
props: {
|
||||||
|
injectData: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({})
|
||||||
|
},
|
||||||
|
itemProp: {
|
||||||
|
type: String
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
list: this.injectData
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
changeInput() {
|
||||||
|
console.log(this.list)
|
||||||
|
this.$emit('emitData', this.list)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss">
|
||||||
|
.tableInner .el-input__inner {
|
||||||
|
border: none;
|
||||||
|
padding: 0;
|
||||||
|
height: 33px;
|
||||||
|
}
|
||||||
|
</style>
|
@ -0,0 +1,43 @@
|
|||||||
|
<template>
|
||||||
|
<div class="tableInner">
|
||||||
|
<el-time-picker
|
||||||
|
v-model="list[itemProp]"
|
||||||
|
@blur="changeInput"
|
||||||
|
style="width: 100%"
|
||||||
|
format='HH:mm:ss'
|
||||||
|
value-format='HH:mm:ss'
|
||||||
|
></el-time-picker>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'TimePickerArea',
|
||||||
|
props: {
|
||||||
|
injectData: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({})
|
||||||
|
},
|
||||||
|
itemProp: {
|
||||||
|
type: String
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
list: this.injectData
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
changeInput() {
|
||||||
|
console.log(this.list)
|
||||||
|
this.$emit('emitData', this.list)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss">
|
||||||
|
.tableInner .el-input--prefix .el-input__inner {
|
||||||
|
border: none;
|
||||||
|
padding-left: 30px;
|
||||||
|
height: 33px;
|
||||||
|
}
|
||||||
|
</style>
|
332
src/views/energy/base/energyType/components/energyTypeAdd.vue
Normal file
@ -0,0 +1,332 @@
|
|||||||
|
<template>
|
||||||
|
<el-form ref="form" :rules="rules" label-width="80px" :model="form">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="能源类型" prop="name">
|
||||||
|
<el-input v-model="form.name"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="类型编码" prop="code">
|
||||||
|
<el-input v-model="form.code" disabled></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="单位" prop="unit">
|
||||||
|
<el-select v-model="form.unit" placeholder="请选择" style="width: 100%;">
|
||||||
|
<el-option
|
||||||
|
v-for="item in getDictDatas(DICT_TYPE.ENERGY_UNIT)"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="计价方式" prop="pricingMethod">
|
||||||
|
<el-select v-model="form.pricingMethod" placeholder="请选择" style="width: 100%;">
|
||||||
|
<el-option label="时间段" :value= '0' ></el-option>
|
||||||
|
<el-option label="使用量" :value= '1' ></el-option>
|
||||||
|
<el-option label="固定价位" :value= '2' ></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12" v-show="form.pricingMethod === 2">
|
||||||
|
<el-form-item label="单价(元)" prop="singlePrice">
|
||||||
|
<el-input v-model="form.singlePrice"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" v-show="form.pricingMethod === 0">
|
||||||
|
<el-form-item label="时间段">
|
||||||
|
<base-table
|
||||||
|
:key='timeKye'
|
||||||
|
:table-props="tableProps1"
|
||||||
|
:table-data="tableData1"
|
||||||
|
:add-button-show="addButtonShow"
|
||||||
|
@emitButtonClick="emitButtonClick1"
|
||||||
|
@emitFun="inputChange1"
|
||||||
|
>
|
||||||
|
<method-btn
|
||||||
|
v-if="tableBtn.length"
|
||||||
|
slot="handleBtn"
|
||||||
|
:width="80"
|
||||||
|
label="操作"
|
||||||
|
:method-list="tableBtn"
|
||||||
|
@clickBtn="handleClick1"
|
||||||
|
/>
|
||||||
|
</base-table>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" v-show="form.pricingMethod === 1">
|
||||||
|
<el-form-item label="使用量">
|
||||||
|
<base-table
|
||||||
|
:key='usedKye'
|
||||||
|
:table-props="tableProps2"
|
||||||
|
:table-data="tableData2"
|
||||||
|
:add-button-show="addButtonShow"
|
||||||
|
@emitButtonClick="emitButtonClick2"
|
||||||
|
@emitFun="inputChange2"
|
||||||
|
>
|
||||||
|
<method-btn
|
||||||
|
v-if="tableBtn.length"
|
||||||
|
slot="handleBtn"
|
||||||
|
:width="80"
|
||||||
|
label="操作"
|
||||||
|
:method-list="tableBtn"
|
||||||
|
@clickBtn="handleClick2"
|
||||||
|
/>
|
||||||
|
</base-table>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="描述" prop="description">
|
||||||
|
<el-input v-model="form.description"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { getEnergyType, updateEnergyType, createEnergyType, getEnergyTypeCode } from '@/api/base/energyType'
|
||||||
|
import inputArea from './InputArea.vue'
|
||||||
|
import timePickerArea from './TimePickerArea.vue'
|
||||||
|
const tableProps1 = [
|
||||||
|
{
|
||||||
|
prop: 'startTime',
|
||||||
|
label: '开始时间',
|
||||||
|
subcomponent: timePickerArea
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'endTime',
|
||||||
|
label: '结束时间',
|
||||||
|
subcomponent: timePickerArea
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'price',
|
||||||
|
label: '单价(元)',
|
||||||
|
subcomponent: inputArea
|
||||||
|
}
|
||||||
|
]
|
||||||
|
const tableProps2 = [
|
||||||
|
{
|
||||||
|
prop: 'startUsed',
|
||||||
|
label: '下限值',
|
||||||
|
// subcomponent: inputArea
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'endUsed',
|
||||||
|
label: '上限量',
|
||||||
|
subcomponent: inputArea
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'price',
|
||||||
|
label: '单价(元)',
|
||||||
|
subcomponent: inputArea
|
||||||
|
}
|
||||||
|
]
|
||||||
|
export default {
|
||||||
|
name: 'energyTypeAdd',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
form: {
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
code: '',
|
||||||
|
nuit: '',
|
||||||
|
pricingMethod: 1,
|
||||||
|
leaderName: ''
|
||||||
|
},
|
||||||
|
isEdit: false, //是否是编辑
|
||||||
|
rules: {
|
||||||
|
name: [{ required: true, message: '能源类型不能为空', trigger: 'blur' }]
|
||||||
|
},
|
||||||
|
timeKye: 0,
|
||||||
|
usedKye: 0,
|
||||||
|
tableProps1,
|
||||||
|
tableProps2,
|
||||||
|
tableData1: [],
|
||||||
|
tableData2: [],
|
||||||
|
tableBtn: [
|
||||||
|
{
|
||||||
|
type: 'delete',
|
||||||
|
name: '删除'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
addButtonShow: '新增'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
init(id) {
|
||||||
|
if (id) {
|
||||||
|
this.isEdit = true
|
||||||
|
this.form.id = id
|
||||||
|
getEnergyType( id ).then((res) => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.form = res.data
|
||||||
|
switch(this.form.pricingMethod) {
|
||||||
|
case 0:
|
||||||
|
this.tableData1 = this.form.segPriceList
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
this.tableData2 = this.form.usedPriceList
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.isEdit = false
|
||||||
|
this.form.id = ''
|
||||||
|
getEnergyTypeCode().then((res) => {
|
||||||
|
this.form.code = res.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 输入框失去焦点
|
||||||
|
inputChange1(val) {
|
||||||
|
this.tableData1[val._pageIndex - 1][val.prop] = val[val.prop]
|
||||||
|
if ((this.tableData1.length > val._pageIndex) && val.prop === 'endTime') {
|
||||||
|
this.tableData1[val._pageIndex].startTime = val[val.prop]
|
||||||
|
}
|
||||||
|
this.timeKye++
|
||||||
|
},
|
||||||
|
inputChange2(val) {
|
||||||
|
// 上限值必须大于下限值
|
||||||
|
if (!!val.endUsed && (val.endUsed <= val.startUsed)) {
|
||||||
|
this.$modal.msgError('上限值不能等于或者小于下限值')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
this.tableData2[val._pageIndex - 1][val.prop] = val[val.prop]
|
||||||
|
if ((this.tableData2.length > val._pageIndex) && val.prop === 'endUsed') {
|
||||||
|
this.tableData2[val._pageIndex].startUsed = val[val.prop]
|
||||||
|
}
|
||||||
|
this.usedKye++
|
||||||
|
},
|
||||||
|
// 增加
|
||||||
|
emitButtonClick1() {
|
||||||
|
let n = this.tableData1.length
|
||||||
|
if (n >=3) {
|
||||||
|
this.$modal.msgWarning('最多可添加3档计价')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
let obj = {}
|
||||||
|
obj.startTime = n === 0 ? '' : this.tableData1[n-1].endTime
|
||||||
|
obj.endTime = ''
|
||||||
|
obj.price = 0
|
||||||
|
this.tableData1.push(obj)
|
||||||
|
},
|
||||||
|
emitButtonClick2() {
|
||||||
|
let n = this.tableData2.length
|
||||||
|
if (n >=3) {
|
||||||
|
this.$modal.msgWarning('最多可添加3档计价')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
let obj = {}
|
||||||
|
obj.startUsed = n === 0 ? 0 : this.tableData2[n-1].endUsed
|
||||||
|
obj.endUsed = 0
|
||||||
|
obj.price = 0
|
||||||
|
this.tableData2.push(obj)
|
||||||
|
},
|
||||||
|
// 删除
|
||||||
|
handleClick1(val) {
|
||||||
|
this.tableData1.splice(val.data._pageIndex - 1, 1)
|
||||||
|
this.timeKye++
|
||||||
|
},
|
||||||
|
handleClick2(val) {
|
||||||
|
this.tableData2.splice(val.data._pageIndex - 1, 1)
|
||||||
|
this.usedKye++
|
||||||
|
},
|
||||||
|
submitForm() {
|
||||||
|
this.$refs['form'].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
switch(this.form.pricingMethod) {
|
||||||
|
case 0:// 时间段
|
||||||
|
if (this.tableData1.length === 0) {
|
||||||
|
this.$modal.msgError('时间段表格数据不能为空')
|
||||||
|
return false
|
||||||
|
} else {
|
||||||
|
this.tableData1.map(item => {
|
||||||
|
if (item.price <= 0) {
|
||||||
|
this.$modal.msgError('单价有误请检查,请检查')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:// 使用量
|
||||||
|
if (this.tableData2.length === 0) {
|
||||||
|
this.$modal.msgError('使用量表格数据不能为空')
|
||||||
|
return false
|
||||||
|
} else {
|
||||||
|
this.tableData1.map(item => {
|
||||||
|
if (item.price <= 0) {
|
||||||
|
this.$modal.msgError('单价有误请检查,请检查')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:// 固定单价
|
||||||
|
if (!this.form.singlePrice) {
|
||||||
|
this.$modal.msgError('单价有误请检查1,请检查')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.isEdit) {
|
||||||
|
// 编辑
|
||||||
|
updateEnergyType({
|
||||||
|
id: this.form.id,
|
||||||
|
code: this.form.code,
|
||||||
|
name: this.form.name,
|
||||||
|
unit: this.form.unit,
|
||||||
|
pricingMethod: this.form.pricingMethod,
|
||||||
|
description: this.form.description,
|
||||||
|
singlePrice: this.form.pricingMethod === 2 ? this.form.singlePrice : '',
|
||||||
|
segPriceList: this.form.pricingMethod === 0 ? this.tableData1: [],
|
||||||
|
usedPriceList: this.form.pricingMethod === 1 ? this.tableData2: []
|
||||||
|
}).then((res) => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.$modal.msgSuccess("操作成功");
|
||||||
|
this.$emit('successSubmit')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
createEnergyType({
|
||||||
|
code: this.form.code,
|
||||||
|
name: this.form.name,
|
||||||
|
unit: this.form.unit,
|
||||||
|
pricingMethod: this.form.pricingMethod,
|
||||||
|
description: this.form.description,
|
||||||
|
singlePrice: this.form.pricingMethod === 2 ? this.form.singlePrice : '',
|
||||||
|
segPriceList: this.form.pricingMethod === 0 ? this.tableData1: [],
|
||||||
|
usedPriceList: this.form.pricingMethod === 1 ? this.tableData2: []
|
||||||
|
}).then((res) => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.$modal.msgSuccess("操作成功");
|
||||||
|
this.$emit('successSubmit')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
formClear() {
|
||||||
|
this.$refs.form.resetFields()
|
||||||
|
this.isEdit = false
|
||||||
|
this.timeKye = 0
|
||||||
|
this.usedKye = 0
|
||||||
|
this.tableData1 = []
|
||||||
|
this.tableData2 = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
217
src/views/energy/base/energyType/index.vue
Normal file
@ -0,0 +1,217 @@
|
|||||||
|
<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="80"
|
||||||
|
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"
|
||||||
|
>
|
||||||
|
<energy-type-add ref="energyType" @successSubmit="successSubmit" />
|
||||||
|
</base-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getEnergyTypePage, deleteEnergyType, updateGroupTeam } from "@/api/base/energyType";
|
||||||
|
import { publicFormatter } from '@/utils/dict'
|
||||||
|
import InnerTable from './components/InnerTable'
|
||||||
|
import EnergyTypeAdd from './components/energyTypeAdd.vue'
|
||||||
|
const tableProps = [
|
||||||
|
{
|
||||||
|
prop: 'code',
|
||||||
|
label: '类型编码'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'name',
|
||||||
|
label: '能源类型'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'unit',
|
||||||
|
label: '单位',
|
||||||
|
filter: publicFormatter('energy_unit')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'pricingMethod',
|
||||||
|
label: '计价方式'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: 'price',
|
||||||
|
label: '价格(元)',
|
||||||
|
subcomponent: InnerTable
|
||||||
|
}
|
||||||
|
]
|
||||||
|
export default {
|
||||||
|
name: "GroupTeam",
|
||||||
|
components: { EnergyTypeAdd },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
formConfig: [
|
||||||
|
{
|
||||||
|
type: 'input',
|
||||||
|
label: '能源类型',
|
||||||
|
placeholder: '能源类型',
|
||||||
|
param: 'name'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'button',
|
||||||
|
btnName: '查询',
|
||||||
|
name: 'search',
|
||||||
|
color: 'primary'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'separate'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: this.$auth.hasPermi('base:energy-type:create') ? 'button' : '',
|
||||||
|
btnName: '新增',
|
||||||
|
name: 'add',
|
||||||
|
color: 'success',
|
||||||
|
plain: true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
tableProps,
|
||||||
|
tableBtn: [
|
||||||
|
this.$auth.hasPermi('base:energy-type:update')
|
||||||
|
? {
|
||||||
|
type: 'edit',
|
||||||
|
btnName: '编辑'
|
||||||
|
}
|
||||||
|
: undefined,
|
||||||
|
this.$auth.hasPermi('base:energy-type:delete')
|
||||||
|
? {
|
||||||
|
type: 'delete',
|
||||||
|
btnName: '删除'
|
||||||
|
}
|
||||||
|
: undefined
|
||||||
|
].filter((v) => v),
|
||||||
|
tableH: this.tableHeight(260),
|
||||||
|
pricingMethodList: [
|
||||||
|
{value: 0,label: '分时间段计价'},
|
||||||
|
{value: 1,label: '分使用量计价'},
|
||||||
|
{value: 2,label: '单一计价'}
|
||||||
|
],
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 班次基础信息列表
|
||||||
|
list: [],
|
||||||
|
// 弹出层标题
|
||||||
|
addOrEditTitle: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
centervisible: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
name: null,
|
||||||
|
code: 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.name = val.name
|
||||||
|
this.queryParams.code = val.code
|
||||||
|
this.getList()
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
this.addOrEditTitle = '新增'
|
||||||
|
this.centervisible = true
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.energyType.init()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/** 查询列表 */
|
||||||
|
getList() {
|
||||||
|
getEnergyTypePage(this.queryParams).then(response => {
|
||||||
|
let arr = response.data.list || [];
|
||||||
|
arr&&arr.map(item => {
|
||||||
|
this.pricingMethodList.map(i => {
|
||||||
|
if (item.pricingMethod === i.value) {
|
||||||
|
item.pricingMethod = i.label
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
this.list = arr
|
||||||
|
this.total = response.data.total;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleClick(val) {
|
||||||
|
switch (val.type) {
|
||||||
|
case 'edit':
|
||||||
|
this.addOrEditTitle = '编辑'
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.energyType.init(val.data.id)
|
||||||
|
})
|
||||||
|
this.centervisible = true
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
this.handleDelete(val.data)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleCancel() {
|
||||||
|
this.$refs.energyType.formClear()
|
||||||
|
this.centervisible = false
|
||||||
|
this.addOrEditTitle = ''
|
||||||
|
},
|
||||||
|
handleConfirm() {
|
||||||
|
this.$refs.energyType.submitForm()
|
||||||
|
},
|
||||||
|
successSubmit() {
|
||||||
|
this.handleCancel()
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
this.$modal.confirm('是否确认删除能源类型为"' + row.name + '"的数据项?').then(function() {
|
||||||
|
return deleteEnergyType(row.id);
|
||||||
|
}).then(() => {
|
||||||
|
this.queryParams.pageNo = 1;
|
||||||
|
this.getList();
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
}).catch(() => {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
@ -87,14 +87,14 @@ export default {
|
|||||||
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'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -52,7 +52,7 @@ import {
|
|||||||
getQualityInspectionBoxBtnPage,
|
getQualityInspectionBoxBtnPage,
|
||||||
exportQualityInspectionBoxBtnExcel,
|
exportQualityInspectionBoxBtnExcel,
|
||||||
} from '@/api/base/qualityInspectionBoxBtn';
|
} from '@/api/base/qualityInspectionBoxBtn';
|
||||||
import basicPageMixin from '../../mixin/basicPageMixin';
|
import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -89,7 +89,7 @@ import {
|
|||||||
|
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
import basicPageMixin from '../../mixin/basicPageMixin';
|
import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'QualityInspectionDet',
|
name: 'QualityInspectionDet',
|
||||||
|
@ -77,7 +77,7 @@ import {
|
|||||||
getQualityInspectionTypePage,
|
getQualityInspectionTypePage,
|
||||||
exportQualityInspectionTypeExcel,
|
exportQualityInspectionTypeExcel,
|
||||||
} from '@/api/base/qualityInspectionType';
|
} from '@/api/base/qualityInspectionType';
|
||||||
import basicPageMixin from '../../mixin/basicPageMixin';
|
import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'QualityInspectionType',
|
name: 'QualityInspectionType',
|
||||||
|
@ -1,208 +0,0 @@
|
|||||||
<!--
|
|
||||||
filename: dialogForm.vue
|
|
||||||
author: liubin
|
|
||||||
date: 2023-08-02 10:32:36
|
|
||||||
description: 弹窗的表单组件
|
|
||||||
-->
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<el-form
|
|
||||||
ref="form"
|
|
||||||
:model="form"
|
|
||||||
:label-width="`${labelWidth}px`"
|
|
||||||
v-loading="formLoading">
|
|
||||||
<el-row :gutter="20" v-for="(row, rindex) in rows" :key="rindex">
|
|
||||||
<el-col v-for="col in row" :key="col.label" :span="24 / row.length">
|
|
||||||
<el-form-item :label="col.label" :prop="col.prop" :rules="col.rules">
|
|
||||||
<el-input
|
|
||||||
v-if="col.input"
|
|
||||||
v-model="form[col.prop]"
|
|
||||||
@change="$emit('update', form)"
|
|
||||||
:placeholder="`请输入${col.label}`"
|
|
||||||
v-bind="col.bind" />
|
|
||||||
<el-input
|
|
||||||
v-if="col.textarea"
|
|
||||||
type="textarea"
|
|
||||||
v-model="form[col.prop]"
|
|
||||||
@change="$emit('update', form)"
|
|
||||||
:placeholder="`请输入${col.label}`"
|
|
||||||
v-bind="col.bind" />
|
|
||||||
<el-select
|
|
||||||
v-if="col.select"
|
|
||||||
v-model="form[col.prop]"
|
|
||||||
:placeholder="`请选择${col.label}`"
|
|
||||||
@change="$emit('update', form)"
|
|
||||||
v-bind="col.bind">
|
|
||||||
<el-option
|
|
||||||
v-for="opt in optionListOf[col.prop]"
|
|
||||||
:key="opt.value"
|
|
||||||
:label="opt.label"
|
|
||||||
:value="opt.value" />
|
|
||||||
</el-select>
|
|
||||||
<el-date-picker
|
|
||||||
v-if="col.datetime"
|
|
||||||
v-model="form[col.prop]"
|
|
||||||
type="datetime"
|
|
||||||
:placeholder="`请选择${col.label}`"
|
|
||||||
v-bind="col.bind"></el-date-picker>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</el-form>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
/**
|
|
||||||
* 找到最长的label
|
|
||||||
* @param {*} options
|
|
||||||
*/
|
|
||||||
function findMaxLabelWidth(rows) {
|
|
||||||
let max = 0;
|
|
||||||
rows.forEach((row) => {
|
|
||||||
row.forEach((opt) => {
|
|
||||||
if (opt.label.length > max) {
|
|
||||||
max = opt.label.length;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return max;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'DialogForm',
|
|
||||||
model: {
|
|
||||||
prop: 'dataForm',
|
|
||||||
event: 'update',
|
|
||||||
},
|
|
||||||
emits: ['update'],
|
|
||||||
components: {},
|
|
||||||
props: {
|
|
||||||
rows: {
|
|
||||||
type: Array,
|
|
||||||
default: () => [],
|
|
||||||
},
|
|
||||||
dataForm: {
|
|
||||||
type: Object,
|
|
||||||
default: () => ({}),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
formLoading: true,
|
|
||||||
optionListOf: {},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
labelWidth() {
|
|
||||||
let max = findMaxLabelWidth(this.rows);
|
|
||||||
// 每个汉字占20px
|
|
||||||
return max * 20;
|
|
||||||
// return max * 20 + 'px';
|
|
||||||
},
|
|
||||||
form: {
|
|
||||||
get() {
|
|
||||||
return this.dataForm;
|
|
||||||
},
|
|
||||||
set(val) {
|
|
||||||
console.log('set form', val);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
rows: {
|
|
||||||
handler() {
|
|
||||||
console.log('watch triggered!');
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.handleOptions('watch');
|
|
||||||
});
|
|
||||||
},
|
|
||||||
deep: true,
|
|
||||||
immediate: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
// 处理 options
|
|
||||||
this.handleOptions();
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
/** 模拟透传 ref */
|
|
||||||
validate(cb) {
|
|
||||||
return this.$refs.form.validate(cb);
|
|
||||||
},
|
|
||||||
resetFields(args) {
|
|
||||||
return this.$refs.form.resetFields(args);
|
|
||||||
},
|
|
||||||
// getCode
|
|
||||||
async getCode(url) {
|
|
||||||
const response = await this.$axios(url);
|
|
||||||
return response.data;
|
|
||||||
},
|
|
||||||
async handleOptions(trigger = 'monuted') {
|
|
||||||
// console.log("[dialogForm:handleOptions]")
|
|
||||||
const promiseList = [];
|
|
||||||
this.rows.forEach((cols) => {
|
|
||||||
cols.forEach((opt) => {
|
|
||||||
if (opt.value && !this.form[opt.prop]) {
|
|
||||||
// 默认值
|
|
||||||
this.form[opt.prop] = opt.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (opt.options) {
|
|
||||||
this.$set(this.optionListOf, opt.prop, opt.options);
|
|
||||||
} else if (opt.url) {
|
|
||||||
// 如果是下拉框,或者新增模式下的输入框,才去请求
|
|
||||||
if (opt.select || (opt.input && !this.form?.id)) {
|
|
||||||
promiseList.push(async () => {
|
|
||||||
const response = await this.$axios(opt.url, {
|
|
||||||
method: opt.method ?? 'get',
|
|
||||||
});
|
|
||||||
console.log('[dialogForm:handleOptions:response]', response);
|
|
||||||
if (opt.select) {
|
|
||||||
// 处理下拉框选项
|
|
||||||
const list =
|
|
||||||
'list' in response.data
|
|
||||||
? response.data.list
|
|
||||||
: response.data;
|
|
||||||
this.$set(
|
|
||||||
this.optionListOf,
|
|
||||||
opt.prop,
|
|
||||||
list.map((item) => ({
|
|
||||||
label: item[opt.labelKey ?? 'name'],
|
|
||||||
value: item[opt.valueKey ?? 'id'],
|
|
||||||
}))
|
|
||||||
);
|
|
||||||
} else if (opt.input) {
|
|
||||||
// 处理输入框数据
|
|
||||||
this.form[opt.prop] = response.data;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// 如果是 watch 触发的,不需要执行进一步的请求
|
|
||||||
if (trigger == 'watch') {
|
|
||||||
this.formLoading = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
await Promise.all(promiseList.map((fn) => fn()));
|
|
||||||
this.formLoading = false;
|
|
||||||
// console.log("[dialogForm:handleOptions:optionListOf]", this.optionListOf)
|
|
||||||
} catch (error) {
|
|
||||||
console.log('[dialogForm:handleOptions:error]', error);
|
|
||||||
this.formLoading = false;
|
|
||||||
}
|
|
||||||
if (!promiseList.length) this.formLoading = false;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
.el-date-editor,
|
|
||||||
.el-select {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
</style>
|
|
@ -55,7 +55,7 @@ import {
|
|||||||
import Editor from '@/components/Editor';
|
import Editor from '@/components/Editor';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
import basicPageMixin from '../../mixin/basicPageMixin';
|
import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
||||||
export default {
|
export default {
|
||||||
name: 'QualityInspectionRecord',
|
name: 'QualityInspectionRecord',
|
||||||
components: {
|
components: {
|
||||||
|
@ -13,14 +13,6 @@
|
|||||||
:page="queryParams.pageNo"
|
:page="queryParams.pageNo"
|
||||||
:limit="queryParams.pageSize"
|
:limit="queryParams.pageSize"
|
||||||
:table-data="list"></base-table>
|
:table-data="list"></base-table>
|
||||||
<!-- @emitFun="handleEmitFun"> -->
|
|
||||||
<!-- <method-btn
|
|
||||||
v-if="tableBtn.length"
|
|
||||||
slot="handleBtn"
|
|
||||||
label="操作"
|
|
||||||
fixed="right"
|
|
||||||
:method-list="tableBtn"
|
|
||||||
@clickBtn="handleTableBtnClick" /> -->
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -22,15 +22,7 @@
|
|||||||
:page="queryParams.pageNo"
|
:page="queryParams.pageNo"
|
||||||
:limit="queryParams.pageSize"
|
:limit="queryParams.pageSize"
|
||||||
:table-data="list"
|
:table-data="list"
|
||||||
@emitFun="handleEmitFun">
|
@emitFun="handleEmitFun"></base-table>
|
||||||
<!-- <method-btn
|
|
||||||
v-if="tableBtn.length"
|
|
||||||
slot="handleBtn"
|
|
||||||
label="操作"
|
|
||||||
fixed="right"
|
|
||||||
:method-list="tableBtn"
|
|
||||||
@clickBtn="handleTableBtnClick" /> -->
|
|
||||||
</base-table>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<GraphPage
|
<GraphPage
|
||||||
|