This commit is contained in:
parent
309be71670
commit
54c0409ac7
|
|
@ -113,3 +113,12 @@ export function getGadgetList(query) {
|
||||||
params: query,
|
params: query,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 小工具编码信息列表--新增
|
||||||
|
export function addWsMaInfoData(data) {
|
||||||
|
return request({
|
||||||
|
url: '/material/wsMaInfo/addWsMaInfoData',
|
||||||
|
method: 'post',
|
||||||
|
data: data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查询</el-button>
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查询</el-button>
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
<el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
|
||||||
|
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
|
|
@ -50,11 +52,123 @@
|
||||||
:limit.sync="queryParams.pageSize"
|
:limit.sync="queryParams.pageSize"
|
||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<!-- 新增/编辑弹窗 -->
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="设备类型" prop="deviceTypeId">
|
||||||
|
<el-select
|
||||||
|
v-model="form.deviceTypeId"
|
||||||
|
placeholder="请选择设备类型"
|
||||||
|
filterable
|
||||||
|
@change="handleDeviceTypeChange"
|
||||||
|
style="width: 100%"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in deviceTypeOptions"
|
||||||
|
:key="item.typeId"
|
||||||
|
:label="item.typeName"
|
||||||
|
:value="item.typeId"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="设备型号" prop="deviceModelId">
|
||||||
|
<el-select
|
||||||
|
v-model="form.deviceModelId"
|
||||||
|
placeholder="请选择设备型号"
|
||||||
|
filterable
|
||||||
|
style="width: 100%"
|
||||||
|
:disabled="!form.deviceTypeId"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in deviceModelOptions"
|
||||||
|
:key="item.typeId"
|
||||||
|
:label="item.typeName"
|
||||||
|
:value="item.typeId"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="设备编码" prop="deviceCode">
|
||||||
|
<el-input v-model="form.deviceCode" placeholder="请输入设备编码" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="本次检验" prop="thisCheckDate">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="form.thisCheckDate"
|
||||||
|
type="date"
|
||||||
|
placeholder="选择日期"
|
||||||
|
value-format="yyyy-MM-dd"
|
||||||
|
:picker-options="thisCheckDateOptions"
|
||||||
|
@change="handleThisCheckDateChange"
|
||||||
|
style="width: 100%"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="下次检验">
|
||||||
|
<el-input
|
||||||
|
v-model="form.nextCheckDate"
|
||||||
|
readonly
|
||||||
|
class="next-check-date"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="检验员" prop="checkMan">
|
||||||
|
<el-input v-model="form.checkMan" placeholder="请输入检验员姓名" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="维修员" prop="repairMan">
|
||||||
|
<el-input v-model="form.repairMan" placeholder="请输入维修员姓名" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="联系电话" prop="phone">
|
||||||
|
<el-input v-model="form.phone" placeholder="请输入联系电话" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="检验结论" prop="conclusion">
|
||||||
|
<el-input
|
||||||
|
type="textarea"
|
||||||
|
:rows="3"
|
||||||
|
v-model="form.conclusion"
|
||||||
|
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>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {getGadgetList
|
import {
|
||||||
|
addWsMaInfoData,
|
||||||
|
getDeviceType, getGadgetList
|
||||||
} from '@/api/ma/device'
|
} from '@/api/ma/device'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
@ -90,11 +204,65 @@ export default {
|
||||||
sex: undefined,
|
sex: undefined,
|
||||||
teamId: undefined
|
teamId: undefined
|
||||||
},
|
},
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 表单参数
|
||||||
|
form: {
|
||||||
|
deviceTypeId: null,
|
||||||
|
deviceModelId: null,
|
||||||
|
deviceCode: '',
|
||||||
|
thisCheckDate: '',
|
||||||
|
nextCheckDate: '',
|
||||||
|
checkMan: '',
|
||||||
|
repairMan: '',
|
||||||
|
phone: '',
|
||||||
|
conclusion: ''
|
||||||
|
},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
deviceTypeId: [
|
||||||
|
{ required: true, message: "设备类型不能为空", trigger: "change" }
|
||||||
|
],
|
||||||
|
deviceModelId: [
|
||||||
|
{ required: true, message: "设备型号不能为空", trigger: "change" }
|
||||||
|
],
|
||||||
|
deviceCode: [
|
||||||
|
{ required: true, message: "设备编码不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
thisCheckDate: [
|
||||||
|
{ required: true, message: "本次检验日期不能为空", trigger: "change" }
|
||||||
|
],
|
||||||
|
checkMan: [
|
||||||
|
{ required: true, message: "检验员不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
repairMan: [
|
||||||
|
{ required: true, message: "维修员不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
phone: [
|
||||||
|
{ required: true, message: "联系电话不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
conclusion: [
|
||||||
|
{ required: true, message: "检验结论不能为空", trigger: "blur" }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
// 设备类型选项
|
||||||
|
deviceTypeOptions: [],
|
||||||
|
// 设备型号选项
|
||||||
|
deviceModelOptions: [],
|
||||||
|
// 本次检验日期选项
|
||||||
|
thisCheckDateOptions: {
|
||||||
|
disabledDate(time) {
|
||||||
|
return time.getTime() > Date.now();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList()
|
this.getList()
|
||||||
|
this.getDeviceTypeOptions();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询列表 */
|
/** 查询列表 */
|
||||||
|
|
@ -108,17 +276,49 @@ export default {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
/** 获取设备类型选项 */
|
||||||
|
getDeviceTypeOptions() {
|
||||||
|
// 这里替换为您的实际API调用
|
||||||
|
getDeviceType({ level: 3, skipPermission: 1 }).then(response => {
|
||||||
|
this.deviceTypeOptions = response.data;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 设备类型变化时获取设备型号 */
|
||||||
|
handleDeviceTypeChange(value) {
|
||||||
|
this.form.deviceModelId = null;
|
||||||
|
if (value) {
|
||||||
|
// 这里替换为您的实际API调用
|
||||||
|
getDeviceType({typeId:value}).then(response => {
|
||||||
|
this.deviceModelOptions = response.data;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.deviceModelOptions = [];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/** 本次检验日期变化时计算下次检验日期 */
|
||||||
|
handleThisCheckDateChange(date) {
|
||||||
|
if (date) {
|
||||||
|
const thisDate = new Date(date);
|
||||||
|
const nextDate = new Date(thisDate);
|
||||||
|
nextDate.setFullYear(nextDate.getFullYear() + 1);
|
||||||
|
nextDate.setDate(nextDate.getDate() - 1);
|
||||||
|
|
||||||
|
// 格式化日期为yyyy-MM-dd
|
||||||
|
const year = nextDate.getFullYear();
|
||||||
|
const month = (nextDate.getMonth() + 1).toString().padStart(2, '0');
|
||||||
|
const day = nextDate.getDate().toString().padStart(2, '0');
|
||||||
|
|
||||||
|
this.form.nextCheckDate = `${year}-${month}-${day}`;
|
||||||
|
} else {
|
||||||
|
this.form.nextCheckDate = '';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
this.queryParams.pageNum = 1
|
this.queryParams.pageNum = 1
|
||||||
this.getList()
|
this.getList()
|
||||||
},
|
},
|
||||||
// 表单重置
|
|
||||||
reset() {
|
|
||||||
this.form = {}
|
|
||||||
this.resetForm('form')
|
|
||||||
},
|
|
||||||
|
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
resetQuery() {
|
resetQuery() {
|
||||||
|
|
@ -127,39 +327,146 @@ export default {
|
||||||
this.dateRange=[]
|
this.dateRange=[]
|
||||||
this.handleQuery()
|
this.handleQuery()
|
||||||
},
|
},
|
||||||
|
handleExport() {
|
||||||
|
const formatTime = (date) => {
|
||||||
|
const year = date.getFullYear();
|
||||||
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||||
|
const day = String(date.getDate()).padStart(2, '0');
|
||||||
|
const hours = String(date.getHours()).padStart(2, '0');
|
||||||
|
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||||
|
const seconds = String(date.getSeconds()).padStart(2, '0');
|
||||||
|
return `${year}${month}${day}_${hours}${minutes}${seconds}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const currentTime = formatTime(new Date());
|
||||||
|
this.download(
|
||||||
|
"/material/wsMaInfo/exportGadgetList",
|
||||||
|
{keyWord: this.queryParams.keyWord,startTime: this.dateRange && this.dateRange[0],endTime: this.dateRange && this.dateRange[1]},
|
||||||
|
`领料出库报表_${currentTime}.xlsx`
|
||||||
|
);
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.title = "添加设备检验信息";
|
||||||
|
},
|
||||||
|
/** 编辑按钮操作 */
|
||||||
|
handleEdit(row) {
|
||||||
|
this.reset();
|
||||||
|
// 这里替换为您的实际API调用
|
||||||
|
getDeviceInfo(row.maId).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改设备检验信息";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
this.$confirm('是否确认删除设备检验信息编号为"' + row.maId + '"的数据项?', "警告", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
}).then(function() {
|
||||||
|
// 这里替换为您的实际API调用
|
||||||
|
return deleteDeviceInfo(row.maId);
|
||||||
|
}).then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.$message.success("删除成功");
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/** 提交表单 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.form.maId) {
|
||||||
|
// 这里替换为您的实际API调用
|
||||||
|
updateDeviceInfo(this.form).then(response => {
|
||||||
|
this.$message.success("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
const data = { ...this.form };
|
||||||
|
// 获取设备类型名称
|
||||||
|
const deviceType = this.deviceTypeOptions.find(item => item.typeId === data.deviceTypeId);
|
||||||
|
if (deviceType) {
|
||||||
|
data.maName = deviceType.typeName; // 添加设备类型名称
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取设备型号名称
|
||||||
|
const deviceModel = this.deviceModelOptions.find(item => item.typeId === data.deviceModelId);
|
||||||
|
if (deviceModel) {
|
||||||
|
data.maModel = deviceModel.typeName; // 添加设备型号名称
|
||||||
|
}
|
||||||
|
const params = {
|
||||||
|
maName: data.maName,
|
||||||
|
maModel:data.maModel,
|
||||||
|
modelId:this.form.deviceModelId,
|
||||||
|
maCode:this.form.deviceCode,
|
||||||
|
thisCheckTime:this.form.thisCheckDate,
|
||||||
|
nextCheckTime:this.form.nextCheckDate,
|
||||||
|
repairMan: this.form.repairMan,
|
||||||
|
checkMan: this.form.checkMan,
|
||||||
|
phone: this.form.phone,
|
||||||
|
result:this.form.conclusion,
|
||||||
|
}
|
||||||
|
// 这里替换为您的实际API调用
|
||||||
|
addWsMaInfoData(params).then(response => {
|
||||||
|
this.$message.success("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 取消按钮 */
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
/** 表单重置 */
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
maId: null,
|
||||||
|
deviceTypeId: null,
|
||||||
|
deviceModelId: null,
|
||||||
|
deviceCode: '',
|
||||||
|
thisCheckDate: '',
|
||||||
|
nextCheckDate: '',
|
||||||
|
checkMan: '',
|
||||||
|
repairMan: '',
|
||||||
|
phone: '',
|
||||||
|
conclusion: ''
|
||||||
|
};
|
||||||
|
this.deviceModelOptions = [];
|
||||||
|
this.resetForm("form");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
::v-deep.el-table .fixed-width .el-button--mini {
|
.app-container {
|
||||||
width: 60px !important;
|
padding: 20px;
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
}
|
||||||
|
.el-form-item {
|
||||||
//隐藏图片上传框的css
|
margin-bottom: 22px;
|
||||||
::v-deep.disabled {
|
|
||||||
.el-upload--picture-card {
|
|
||||||
display: none;
|
|
||||||
}
|
}
|
||||||
|
.el-date-editor.el-input, .el-date-editor.el-input__inner {
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
.next-check-date {
|
||||||
.uploadImg {
|
background-color: #f5f7fa;
|
||||||
padding-top: 20px;
|
}
|
||||||
|
.table-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
margin-bottom: 15px;
|
||||||
}
|
}
|
||||||
|
.pagination-container {
|
||||||
.boxCode {
|
margin-top: 20px;
|
||||||
margin-top: 10px;
|
text-align: right;
|
||||||
padding-bottom: 20px;
|
|
||||||
font-size: 33px;
|
|
||||||
font-weight: bold;
|
|
||||||
color: #000;
|
|
||||||
}
|
|
||||||
|
|
||||||
.qrcode-container img {
|
|
||||||
width: 100px; /* 设置二维码的大小,调整为你需要的尺寸 */
|
|
||||||
height: 100px;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue