Compare commits

...

13 Commits

17 changed files with 1207 additions and 284 deletions

View File

@ -1,12 +1,13 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2023-10-17 16:50:19 * @Date: 2023-10-17 16:50:19
* @LastEditTime: 2023-12-01 16:48:53 * @LastEditTime: 2024-02-28 10:07:29
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->
<template> <template>
<el-dialog class="baseDialog" :visible.sync="visible" :show-close="false" :wrapper-closable="false" width="40%" show-close="true"> <el-dialog class="baseDialog" :visible.sync="visible" :show-close="false" :wrapper-closable="false" width="40%"
show-close="true">
<small-title slot="title" :no-padding="true"> <small-title slot="title" :no-padding="true">
{{ !dataForm.id ? '新增' : '编辑' }} {{ !dataForm.id ? '新增' : '编辑' }}
</small-title> </small-title>
@ -44,6 +45,12 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12">
<el-form-item label="包装条码" prop="packagingBarCode">
<el-input v-model="dataForm.packagingBarCode" clearable placeholder="请输入包装条码" />
</el-form-item>
</el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="标签模板" prop="modelId"> <el-form-item label="标签模板" prop="modelId">
<el-select v-model="dataForm.modelId" style="width: 100%;" placeholder="请选择标签模板" clearable> <el-select v-model="dataForm.modelId" style="width: 100%;" placeholder="请选择标签模板" clearable>
@ -186,6 +193,7 @@ export default {
workOrderId: null, // (s) workOrderId: null, // (s)
customerId: '', // customerId: '', //
content: '', // id content: '', // id
packagingBarCode: null
}, },
listQuery: { listQuery: {
pageSize: 10, pageSize: 10,

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2023-08-01 14:55:51 * @Date: 2023-08-01 14:55:51
* @LastEditors: zhp * @LastEditors: zhp
* @LastEditTime: 2023-11-24 09:13:50 * @LastEditTime: 2024-02-28 10:38:34
* @Description: * @Description:
--> -->
<template> <template>
@ -55,6 +55,10 @@ const tableProps = [
{ {
prop: 'packagingCode', prop: 'packagingCode',
label: '包装流水号' label: '包装流水号'
},
{
prop: 'packagingBarCode',
label: '包装条码'
}, },
{ {
prop: 'workOrderName', prop: 'workOrderName',

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: DY * @LastEditors: DY
* @LastEditTime: 2024-02-27 09:41:00 * @LastEditTime: 2024-02-28 14:45:58
* @Description: * @Description:
--> -->
<template> <template>
@ -27,13 +27,14 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<el-form-item label="巡检单名称" prop="name"> <el-form-item label="巡检单名称" prop="name">
<el-input v-model="dataForm.name" placeholder="请输入巡检单名称" /> <el-input v-model="dataForm.name" :disabled="isdetail" placeholder="请输入巡检单名称" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="部门" prop="departmentId"> <el-form-item label="部门" prop="departmentId">
<el-select <el-select
v-model="dataForm.departmentId" v-model="dataForm.departmentId"
:disabled="isdetail"
:placeholder="`请选择部门`"> :placeholder="`请选择部门`">
<el-option <el-option
v-for="opt in departmentOptions" v-for="opt in departmentOptions"
@ -50,7 +51,7 @@
filterable filterable
clearable clearable
multiple multiple
:disabled="isedit" :disabled="isdetail"
style="width: 100%" style="width: 100%"
placeholder="请选择班次"> placeholder="请选择班次">
<el-option <el-option
@ -70,7 +71,7 @@
:placeholder="`请选择巡检人`" :placeholder="`请选择巡检人`"
multiple multiple
clearable clearable
:disabled="isedit" :disabled="isdetail"
filterable> filterable>
<el-option <el-option
v-for="opt in inspectorOptions" v-for="opt in inspectorOptions"
@ -85,7 +86,7 @@
<el-date-picker <el-date-picker
v-model="dataForm.planCheckTime" v-model="dataForm.planCheckTime"
type="datetime" type="datetime"
:disabled="isedit" :disabled="isdetail"
placeholder="请选择巡检时间" placeholder="请选择巡检时间"
value-format="timestamp"></el-date-picker> value-format="timestamp"></el-date-picker>
</el-form-item> </el-form-item>
@ -142,7 +143,8 @@
<div v-if="!isdetail" class="drawer-body__footer"> <div v-if="!isdetail" class="drawer-body__footer">
<el-button @click="goback()">取消</el-button> <el-button @click="goback()">取消</el-button>
<!-- <el-button :disabled="isdetail" @click="init(dataForm.id)">重置</el-button> --> <!-- <el-button :disabled="isdetail" @click="init(dataForm.id)">重置</el-button> -->
<el-button type="primary" @click="dataFormSubmit()">确定</el-button> <el-button v-if="isshowConfirm" type="primary" @click="confirmIns()">保存</el-button>
<el-button v-else type="primary" @click="dataFormSubmit()">保存</el-button>
</div> </div>
<attr-add <attr-add
@ -205,6 +207,7 @@ export default {
tableProps, tableProps,
topBtnConfig, topBtnConfig,
addOrUpdateVisible: false, addOrUpdateVisible: false,
isshowConfirm: false,
urlOptions: { urlOptions: {
isGetCode: false, isGetCode: false,
createURL: createCheckOrder, createURL: createCheckOrder,
@ -398,6 +401,34 @@ export default {
this.$refs.addOrUpdate.init(id); this.$refs.addOrUpdate.init(id);
}); });
}, },
getConfirmed() {
return this.$confirm('是否直接确认巡检记录', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
},
async confirmIns() {
await this.getConfirmed().then(confirm => {
this.$axios({
url:
'/base/equipment-check-order/confirm?confirmPerson=' +
this.$store.getters.userId,
method: 'put',
data: [this.dataForm.id],
}).then(res =>{
if (res.code == 0) {
this.visible = false;
this.$emit("refreshDataList");
this.$message.success('已确认');
}
}).catch(() => {
this.visible = false;
this.$emit("refreshDataList");
this.$message.success('取消确认');
})
})
},
// //
dataFormSubmit() { dataFormSubmit() {
this.$refs["dataForm"].validate((valid) => { this.$refs["dataForm"].validate((valid) => {
@ -429,6 +460,7 @@ export default {
}).then(response => { }).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.idAttrShow = true this.idAttrShow = true
this.isshowConfirm = true
this.dataForm.id = response.data this.dataForm.id = response.data
// this.visible = false; // this.visible = false;
this.$emit("refreshDataList"); this.$emit("refreshDataList");

View File

@ -172,24 +172,27 @@ export default {
async searchBarClicked(btn) { async searchBarClicked(btn) {
switch (btn.btnName) { switch (btn.btnName) {
case 'batchConfirm': case 'batchConfirm':
const ids = this.$refs['waiting-list-table'].selectedPlan.map(
(item) => item.id
)
if (this.$refs['waiting-list-table'].selectedPlan.length == 0) { if (this.$refs['waiting-list-table'].selectedPlan.length == 0) {
this.$message.warning('请选择待确认的设备巡检单'); this.$message.warning('请选择待确认的设备巡检单');
return; return;
} }
const res = await this.$axios({ this.$modal
url: '/base/equipment-check-order/confirm?confirmPerson=' + this.$store.getters.userId + '&ids=' + ids, .confirm('是否确认所有选中保养单"?')
.then(() => {
return this.$axios({
url: '/base/equipment-check-order/confirm?confirmPerson=' + this.$store.getters.userId,
method: 'put', method: 'put',
// data: this.$refs['waiting-list-table'].selectedPlan.map( data: this.$refs['waiting-list-table'].selectedPlan.map(
// (item) => item.id (item) => item.id
// ), ),
}); });
if (res.code == 0) { })
this.$message.success('确认成功'); .then((res) => {
this.getList(); this.getList();
} res.code == 0 && this.$modal.msgSuccess('确认成功');
res.code != 0 && this.$modal.msgError('确认失败');
})
.catch(() => {});
break; break;
} }
}, },
@ -328,7 +331,7 @@ export default {
// }, // },
getConfirmed() { getConfirmed() {
return this.$confirm('是否直接确认保养记录', '提示', { return this.$confirm('是否直接确认巡检记录', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',
@ -388,17 +391,16 @@ export default {
}, },
/** 确认 */ /** 确认 */
async handleConfirm(row) { async handleConfirm(row) {
console.log('111', this.$store.getters.userId)
this.$modal this.$modal
.confirm('是否确认巡检单"' + row.name + '"?') .confirm('是否确认巡检单"' + row.name + '"?')
.then(() => { .then(() => {
return this.$axios({ return this.$axios({
url: url:
'/base/equipment-check-order/confirm?confirmPerson=' + '/base/equipment-check-order/confirm?confirmPerson=' +
this.$store.getters.userId + '&ids=' + [row.id], this.$store.getters.userId,
// '/base/equipment-check-order/confirm?ids=' + JSON.stringify([id]).replaceAll("\"", ''), // '/base/equipment-check-order/confirm?ids=' + JSON.stringify([id]).replaceAll("\"", ''),
method: 'put', method: 'put',
// data: [row.id], data: [row.id],
}); });
}) })
.then((res) => { .then((res) => {

View File

@ -14,7 +14,7 @@
custom-class="mes-drawer" custom-class="mes-drawer"
size="60%" size="60%"
@closed="$emit('destroy')"> @closed="$emit('destroy')">
<SmallTitle slot="title">编辑</SmallTitle> <SmallTitle slot="title">{{ showTable ? '编辑' : '新增' }}</SmallTitle>
<div class="drawer-body flex"> <div class="drawer-body flex">
<div class="drawer-body__content"> <div class="drawer-body__content">
@ -184,6 +184,7 @@
</el-form> </el-form>
</div> </div>
<div v-if="showTable">
<SmallTitle>保养内容</SmallTitle> <SmallTitle>保养内容</SmallTitle>
<div style="margin-top: 12px; position: relative"> <div style="margin-top: 12px; position: relative">
@ -223,10 +224,13 @@
@pagination="getAttrList" /> @pagination="getAttrList" />
</div> </div>
</div> </div>
</div>
<div class="drawer-body__footer"> <div class="drawer-body__footer">
<el-button style="" @click="handleCancel">取消</el-button> <el-button style="" @click="handleCancel">取消</el-button>
<el-button type="primary" @click="handleConfirm">保存</el-button> <!-- 新增可确认 -->
<el-button v-if="isAdd" type="primary" @click="addConfirm">保存</el-button>
<el-button v-else type="primary" @click="handleConfirm">保存</el-button>
<!-- sections的第二项必须是 属性列表 --> <!-- sections的第二项必须是 属性列表 -->
<!-- <el-button <!-- <el-button
v-if="sections[1].allowAdd" v-if="sections[1].allowAdd"
@ -292,6 +296,8 @@ export default {
return { return {
visible: false, visible: false,
btnLoading: false, btnLoading: false,
showTable: false,
isAdd: false,
form: {}, form: {},
formLoading: false, formLoading: false,
lineList: [], lineList: [],
@ -387,7 +393,7 @@ export default {
attrListLoading: false, attrListLoading: false,
// syncFileListFlag: null, // syncFileListFlag: null,
tableBtn: [], tableBtn: [],
row: null, row: {},
}; };
}, },
computed: { computed: {
@ -438,24 +444,107 @@ export default {
break; break;
} }
}, },
async addConfirm() {
console.log('11', this.showTable)
this.$refs['form'].validate((valid) => {
if (!valid) {
return;
}
this.$nextTick(() => {
this.getConfirmed().then(confirm => {
console.log('111', confirm)
this.$axios({
url:
'/base/equipment-maintain-log/confirm?confirmPerson=' +
this.$store.getters.userId,
method: 'put',
data: [this.form.id],
}).then(res =>{
if (res.code == 0) {
this.visible = false;
this.$emit("refreshDataList");
this.$message.success('已确认');
}
})
}).catch(() => {
this.visible = false;
this.$emit("refreshDataList");
this.$message.success('取消确认');
})
})
});
},
getConfirmed() {
return this.$confirm('是否直接确认保养记录', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
},
async handleConfirm() { async handleConfirm() {
this.btnLoading = true; this.btnLoading = true;
this.$nextTick(async () => { // this.$nextTick(async () => {
const { code, data } = await this.$axios({ // const { code, data } = await this.$axios({
// url: '/base/equipment-maintain-log/update',
// method: 'put',
// data: {
// ...this.form,
// maintainWorker: this.form.maintainWorker.join(',')
// },
// });
// if (code == 0) {
// this.$modal.msgSuccess('');
// }
// this.btnLoading = false;
// this.$emit('refreshDataList');
// this.handleCancel();
// });
this.$refs['form'].validate((valid) => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
this.$axios({
url: '/base/equipment-maintain-log/update', url: '/base/equipment-maintain-log/update',
method: 'put', method: 'put',
data: { data: {
...this.form, ...this.form,
maintainWorker: this.form.maintainWorker.join(',') maintainWorker: this.form.maintainWorker.join(','),
}, special: false,
}); relatePlan: 2
if (code == 0) {
this.$modal.msgSuccess('更新成功');
} }
}).then((response) => {
this.$modal.msgSuccess('修改成功');
this.btnLoading = false; this.btnLoading = false;
this.$emit('refreshDataList'); this.$emit('refreshDataList');
this.handleCancel(); this.handleCancel();
}); });
return;
}
//
this.$axios({
url: '/base/equipment-maintain-log/create',
method: 'post',
data: {
...this.form,
maintainWorker: this.form.maintainWorker.join(','),
special: false,
relatePlan: 2,
confirmed: false,
}
}).then((response) => {
this.$modal.msgSuccess('新增成功');
this.btnLoading = false;
this.form.id = response.data
this.row.id = response.data
this.showTable = true
this.isAdd = true
this.$emit('refreshDataList');
// this.handleCancel();
});
});
}, },
handleEmitFun(val) { handleEmitFun(val) {
@ -464,15 +553,22 @@ export default {
init(row) { init(row) {
this.visible = true; this.visible = true;
if (row) {
this.row = row; this.row = row;
this.getInfo(row); this.showTable = row ? true : false;
this.getAttrList(row); this.$nextTick(() => {
if (row.id) {
this.getInfo(row.id);
this.getAttrList(row.id);
}
})
}
}, },
async getInfo(row) { async getInfo(id) {
this.formLoading = true; this.formLoading = true;
const res = await this.$axios( const res = await this.$axios(
'/base/equipment-maintain-log/get?id=' + row.id '/base/equipment-maintain-log/get?id=' + id
); );
if (res.code == 0) { if (res.code == 0) {
this.form = res.data; this.form = res.data;
@ -482,15 +578,15 @@ export default {
this.formLoading = false; this.formLoading = false;
}, },
async getAttrList(row, condition = {}) { async getAttrList(id, condition = {}) {
if (!row) row = this.row; if (!id) id = this.row.id;
this.attrListLoading = true; this.attrListLoading = true;
const res = await this.$axios({ const res = await this.$axios({
url: '/base/equipment-maintain-log-det/page', url: '/base/equipment-maintain-log-det/page',
method: 'get', method: 'get',
params: { params: {
...this.attrQuery.params, ...this.attrQuery.params,
logId: row.id, logId: id,
...condition, ...condition,
}, },
}); });

View File

@ -258,17 +258,27 @@ export default {
this.$message.warning('请选择待确认的设备保养记录'); this.$message.warning('请选择待确认的设备保养记录');
return; return;
} }
const res = await this.$axios({ this.$modal
.confirm('是否确认所有选中保养单"?')
.then(() => {
return this.$axios({
url: '/base/equipment-maintain-log/confirm', url: '/base/equipment-maintain-log/confirm',
method: 'put', method: 'put',
data: this.$refs['waiting-list-table'].selectedPlan.map( data: this.$refs['waiting-list-table'].selectedPlan.map(
(item) => item.id (item) => item.id
), ),
}); });
if (res.code == 0) { // if (res.code == 0) {
this.$message.success('确认成功'); // this.$message.success('');
// this.getList();
// }
})
.then((res) => {
this.getList(); this.getList();
} res.code == 0 && this.$modal.msgSuccess('确认成功');
res.code != 0 && this.$modal.msgError('确认失败');
})
.catch(() => {});
break; break;
} }
}, },
@ -412,9 +422,13 @@ export default {
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); // this.reset();
this.open = true; // this.open = true;
this.title = '添加待确认保养记录'; // this.title = '';
this.openUnplannedDrawer = true;
this.$nextTick(() => {
this.$refs.unplanned.init();
});
}, },
getConfirmed() { getConfirmed() {
@ -478,15 +492,25 @@ export default {
}, },
/** 确认 */ /** 确认 */
async handleConfirm(row) { async handleConfirm(row) {
const res = await this.$axios({ this.$modal
.confirm('是否确认保养单"' + row.maintainOrderNumber + '"?')
.then(() => {
return this.$axios({
url: '/base/equipment-maintain-log/confirm', url: '/base/equipment-maintain-log/confirm',
method: 'put', method: 'put',
data: [row.id], data: [row.id],
}); });
if (res.code == 0) { // if (res.code == 0) {
this.$message.success('确认成功'); // this.$message.success('');
// this.getList();
// }
})
.then((res) => {
this.getList(); this.getList();
} res.code == 0 && this.$modal.msgSuccess('确认成功');
res.code != 0 && this.$modal.msgError('确认失败');
})
.catch(() => {});
}, },
/** 编辑 */ /** 编辑 */
async handleEdit(row) { async handleEdit(row) {

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2023-11-06 15:15:30 * @Date: 2023-11-06 15:15:30
* @LastEditTime: 2024-02-18 14:07:08 * @LastEditTime: 2024-02-28 09:58:34
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->
@ -15,35 +15,11 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8">
<el-form-item label="班组" prop="teamId">
<el-select v-model="dataForm.teamId" placeholder="请选择班组">
<el-option v-for="dict in teamList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="数量" prop="num"> <el-form-item label="数量" prop="num">
<el-input v-model="dataForm.num" placeholder="请输入数量" /> <el-input v-model="dataForm.num" placeholder="请输入数量" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="产线" prop="lineId">
<el-select v-model="dataForm.lineId" placeholder="请选择产线">
<el-option v-for="dict in lineList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="报废原因" prop="detId">
<el-select v-model="dataForm.detId" placeholder="请选择报废原因">
<el-option v-for="dict in detList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="报废时间" prop="logTime"> <el-form-item label="报废时间" prop="logTime">
<el-date-picker v-model="dataForm.logTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" <el-date-picker v-model="dataForm.logTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
@ -54,12 +30,28 @@
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<el-form-item label="来源" prop="source"> <el-form-item label="产线" prop="lineId">
<el-select v-model="dataForm.source" placeholder="请选择来源"> <el-select v-model="dataForm.lineId" placeholder="请选择产线" @change="getWorksectionById">
<el-option v-for="dict in sourceList" :key="dict.id" :label="dict.name" :value="dict.id" /> <el-option v-for="dict in lineList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8">
<el-form-item label="工段" prop="sectionId">
<el-select v-model="dataForm.sectionId" placeholder="请选择工段">
<el-option v-for="dict in sectionList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="报废原因" prop="detId">
<el-select v-model="dataForm.detId" placeholder="请选择报废原因" multiple>
<el-option v-for="dict in detList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<el-form-item label="描述" prop="description"> <el-form-item label="描述" prop="description">
<el-input v-model="dataForm.description" placeholder="请输入描述" /> <el-input v-model="dataForm.description" placeholder="请输入描述" />
@ -76,7 +68,7 @@
</template> </template>
<script> <script>
import basicAdd from '../../../core/mixins/basic-add'; import basicAdd from './basic-add';
import { import {
createQualityScrapLog, updateQualityScrapLog, getQualityScrapLog, getWorkOrderList, createQualityScrapLog, updateQualityScrapLog, getQualityScrapLog, getWorkOrderList,
getTeamList, getDetList,getLineList } from "@/api/base/qualityScrapLog"; getTeamList, getDetList,getLineList } from "@/api/base/qualityScrapLog";
@ -99,6 +91,7 @@ export default {
workOrderList: [], workOrderList: [],
detList:[], detList:[],
teamList: [], teamList: [],
sectionList:[],
sourceList: [ sourceList: [
{ {
id: 1, id: 1,
@ -117,6 +110,7 @@ export default {
workOrderId: null, workOrderId: null,
teamId: undefined, teamId: undefined,
num: undefined, num: undefined,
sectionId:undefined,
lineId:undefined, lineId:undefined,
description:undefined, description:undefined,
// description: undefined, // description: undefined,
@ -137,6 +131,7 @@ export default {
this.getDict() this.getDict()
console.log('我看看', this.dataForm) console.log('我看看', this.dataForm)
this.getCurrentTime() this.getCurrentTime()
this.getWorksectionById()
}, },
methods: { methods: {
getCurrentTime() { getCurrentTime() {
@ -197,6 +192,42 @@ export default {
// console.log(this.formConfig[0].selectOptions); // console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total; // this.listQuery.total = response.data.total;
}) })
},
async getWorksectionById(lineId) {
if (lineId) {
const { code, data } = await this.$axios({
url: '/base/core-workshop-section/listByParentId',
method: 'get',
params: {
id: lineId,
},
});
if (code == 0) {
console.log(data)
this.sectionList = data.map((item) => {
return {
name: item.name,
id: item.id,
};
});
}
} else {
this.$axios({
url: '/base/core-workshop-section/listAll',
method: 'get',
// params: {
// id: lineId,
// },
}).then((res) => {
// console.log(data)
this.sectionList = res.data.map((item) => {
return {
name: item.name,
id: item.id,
};
});
})
}
}, },
// setMaterialCode() { // setMaterialCode() {
// const chooseM = this.materialList.filter(item => { // const chooseM = this.materialList.filter(item => {

View File

@ -0,0 +1,106 @@
/*
* @Author: zhp
* @Date: 2024-02-28 09:51:25
* @LastEditTime: 2024-02-28 10:05:00
* @LastEditors: zhp
* @Description:
*/
export default {
data() {
/* eslint-disable */
return {
urlOptions: {
createURL: '',
updateURL: '',
infoURL: '',
codeURL: '',
getOption: false,
isGetCode: false,
optionArrUrl: [],
optionArr: {}
},
visible: false,
setData: false
}
},
created() {
},
activated() {
},
methods: {
init(id) {
this.dataForm.id = id || "";
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 => {
console.log(response)
this.dataForm = response.data
this.dataForm.detId = response.data.detIdList
this.dataForm.logTime = new Date(response.data.createTime)
// if (this.setData) {
// this.setDataForm()
// }
});
} else {
if (this.urlOptions.isGetCode) {
this.getCode()
}
}
});
},
getCode() {
this.urlOptions.codeURL()
.then(({ data: res }) => {
this.dataForm.code = res;
})
.catch(() => {});
},
getArr() {
const params = {
pageSize: 100,
pageNo: 1,
}
this.urlOptions.optionArrUrl.forEach((item, index) => {
item(params).then(({ data: res }) => {
this.$set(this.urlOptions.optionArr, `arr${index}`, res.list)
})
.catch(() => {
});
});
},
// 表单提交
dataFormSubmit() {
this.$refs["dataForm"].validate((valid) => {
if (!valid) {
return false;
}
// 修改的提交
let str = this.dataForm.detId.join(',')
this.dataForm.detId = str
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");
});
});
},
formClear() {
this.$refs.dataForm.resetFields()
}
}
}

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2023-11-06 15:15:30 * @Date: 2023-11-06 15:15:30
* @LastEditTime: 2023-12-01 10:58:25 * @LastEditTime: 2024-02-28 10:13:10
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->
@ -15,43 +15,19 @@
<el-row :gutter="24"> <el-row :gutter="24">
<el-col :span="8"> <el-col :span="8">
<el-form-item label="工单号" prop="workOrderId"> <el-form-item label="工单号" prop="workOrderId">
<el-select v-model="dataForm.workOrderId" placeholder="请选择工单号" disabled> <el-select disabled v-model="dataForm.workOrderId" placeholder="请选择工单号">
<el-option v-for="dict in workOrderList" :key="dict.id" :label="dict.name" :value="dict.id" /> <el-option v-for="dict in workOrderList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="班组" prop="teamId"> <el-form-item label="数量" prop="num">
<el-select v-model="dataForm.teamId" placeholder="请选择班组" disabled> <el-input disabled v-model="dataForm.num" placeholder="请输入数量" />
<el-option v-for="dict in teamList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8">
<el-form-item label="数量" prop="sum">
<el-input v-model="dataForm.sum" placeholder="请输入数量" disabled />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="产线" prop="lineId">
<el-select v-model="dataForm.lineId" placeholder="请选择产线" disabled>
<el-option v-for="dict in lineList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="报废原因" prop="detId">
<el-select v-model="dataForm.detId" placeholder="请选择报废原因" disabled>
<el-option v-for="dict in detList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="报废时间" prop="logTime"> <el-form-item label="报废时间" prop="logTime">
<el-date-picker v-model="dataForm.logTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" disabled <el-date-picker disabled v-model="dataForm.logTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择日期"> placeholder="选择日期">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
@ -59,12 +35,28 @@
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<el-form-item label="来源" prop="source"> <el-form-item label="产线" prop="lineId">
<el-select v-model="dataForm.source" placeholder="请选择来源" disabled> <el-select disabled v-model="dataForm.lineId" placeholder="请选择产线" @change="getWorksectionById">
<el-option v-for="dict in sourceList" :key="dict.id" :label="dict.name" :value="dict.id" /> <el-option v-for="dict in lineList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8">
<el-form-item label="工段" prop="sectionId">
<el-select v-model="dataForm.sectionId" placeholder="请选择工段" disabled>
<el-option v-for="dict in sectionList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="报废原因" prop="detId">
<el-select v-model="dataForm.detId" placeholder="请选择报废原因" multiple disabled>
<el-option v-for="dict in detList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<el-form-item label="描述" prop="description"> <el-form-item label="描述" prop="description">
<el-input v-model="dataForm.description" placeholder="请输入描述" disabled /> <el-input v-model="dataForm.description" placeholder="请输入描述" disabled />
@ -147,6 +139,7 @@ export default {
this.getDict() this.getDict()
console.log('我看看', this.dataForm) console.log('我看看', this.dataForm)
this.getCurrentTime() this.getCurrentTime()
// this.getWorksectionById()
}, },
methods: { methods: {
// init() { // init() {
@ -198,6 +191,7 @@ export default {
// console.log(this.formConfig[0].selectOptions); // console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total; // this.listQuery.total = response.data.total;
}) })
getTeamList().then((res) => { getTeamList().then((res) => {
console.log(res); console.log(res);
// console.log(response); // console.log(response);
@ -207,15 +201,45 @@ export default {
id: item.id id: item.id
} }
}) })
this.$axios({
url: '/base/core-workshop-section/listAll',
method: 'get',
// params: {
// id: lineId,
// },
}).then((res) => {
// console.log(data)
this.sectionList = res.data.map((item) => {
return {
name: item.name,
id: item.id,
};
});
})
// if (code == 0) {
// }
// console.log(this.formConfig[0].selectOptions); // console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total; // this.listQuery.total = response.data.total;
}) })
}, },
setMaterialCode() { async getWorksectionById(lineId) {
const chooseM = this.materialList.filter(item => { const { code, data } = await this.$axios({
return item.id === this.dataForm.materialId url: '/base/core-workshop-section/listByParentId',
}) method: 'get',
this.dataForm.materialCode = chooseM[0].code params: {
id: lineId,
},
});
if (code == 0) {
console.log(data)
this.sectionList = data.map((item) => {
return {
name: item.name,
id: item.id,
};
});
}
} }
}, },
}; };

View File

@ -30,31 +30,40 @@ import {
} from '@/api/base/qualityScrapLog'; } from '@/api/base/qualityScrapLog';
const tableProps = [ const tableProps = [
{ // {
prop: 'createTime', // prop: 'createTime',
label: '添加时间', // label: '',
filter: parseTime // filter: parseTime
}, // },
{
prop: 'workOrderName',
label: '工单'
},
{
prop: 'teamName',
label: '班组'
},
{
prop: 'detContent',
label: '报废原因'
},
{ {
prop: 'logTime', prop: 'logTime',
label: '报废时间', label: '报废时间',
filter: parseTime filter: parseTime
}, },
{
prop: 'lineName',
label: '产线名称'
},
{
prop: 'sectionName',
label: '工段'
},
{
prop: 'workOrderName',
label: '工单名称'
},
{ {
prop: 'num', prop: 'num',
label: '数量' label: '数量'
},
{
prop: 'detContent',
label: '报废原因'
},
{
prop: 'source',
label: '来源',
filter: (val) => val == 1 ? '平板端' : '网页端'
}, },
]; ];

View File

@ -286,6 +286,7 @@ export default {
// this.searchBarFormConfig[0].defaultSelect = []; // this.searchBarFormConfig[0].defaultSelect = [];
// } // }
this.getList() this.getList()
this.getDict()
}, },
methods: { methods: {
/** 获取搜索栏的产线列表 */ /** 获取搜索栏的产线列表 */
@ -320,7 +321,7 @@ export default {
// }, // },
getList() { getList() {
this.getDataList() this.getDataList()
this.getDict() // this.getDict()
}, },
/** 查询列表 */ /** 查询列表 */
async getDataList() { async getDataList() {
@ -330,7 +331,7 @@ export default {
const { const {
data: { data, otherList, otherMap, nameData }, data: { data, otherList, otherMap, nameData },
} = await getStatisticalDataPage(this.queryParams) } = await getStatisticalDataPage(this.queryParams)
console.log(this.queryParams); // console.log(this.queryParams);
this.dynamicProps = this.filterNameData(nameData) this.dynamicProps = this.filterNameData(nameData)
this.list = this.filterData(data); this.list = this.filterData(data);
}, },
@ -373,7 +374,7 @@ export default {
this.getList() this.getList()
} }
console.log(val); // console.log(val);
} }
/** 搜索按钮操作 */ /** 搜索按钮操作 */
// handleQuery() { // handleQuery() {

View File

@ -269,7 +269,7 @@ export default {
}, },
getConfirmed() { getConfirmed() {
return this.$confirm('是否直接确认保养记录', '提示', { return this.$confirm('是否直接确认巡检记录', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',

View File

@ -281,7 +281,7 @@ export default {
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.open = true; this.open = true;
this.title = '新巡检单'; this.title = '新巡检单';
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.add.init(); this.$refs.add.init();
}); });

View File

@ -76,6 +76,7 @@
v-if="openUnplannedDrawer" v-if="openUnplannedDrawer"
@refreshDataList="getList" @refreshDataList="getList"
@destroy="openUnplannedDrawer = false" /> @destroy="openUnplannedDrawer = false" />
<PlannedEditDrawer <PlannedEditDrawer
ref="planned" ref="planned"
v-if="openPlannedDrawer" v-if="openPlannedDrawer"
@ -86,6 +87,12 @@
v-if="recordDetailVisible" v-if="recordDetailVisible"
ref="recordDetailDrawer" ref="recordDetailDrawer"
@closed="recordDetailVisible = false" /> @closed="recordDetailVisible = false" />
<UnplannedAddDet
ref="unplanned-det"
v-if="openUnplannedDetDrawer"
@refreshDataList="getList"
@destroy="openUnplannedDetDrawer = false" />
</div> </div>
</template> </template>
@ -95,8 +102,8 @@ import basicPageMixin from '@/mixins/lb/basicPageMixin';
import DialogFormUnplanned from './WaitingList--add--unplanned.vue'; import DialogFormUnplanned from './WaitingList--add--unplanned.vue';
import UnplannedEditDrawer from './WaitingListUnplanned--edit.vue'; import UnplannedEditDrawer from './WaitingListUnplanned--edit.vue';
import PlannedEditDrawer from './WaitingListPlanned--edit.vue'; import PlannedEditDrawer from './WaitingListPlanned--edit.vue';
import UnplannedAddDet from './WaitingListUnplanned--add_detail.vue';
import { import {
deleteEqMaintainLog,
exportMaintainLogExcel, exportMaintainLogExcel,
} from '@/api/equipment/base/maintain/record'; } from '@/api/equipment/base/maintain/record';
import WaitingListTable from './WaitingListTable.vue'; import WaitingListTable from './WaitingListTable.vue';
@ -134,7 +141,8 @@ export default {
WaitingListTable, WaitingListTable,
RecordDetail, RecordDetail,
UnplannedEditDrawer, UnplannedEditDrawer,
PlannedEditDrawer UnplannedAddDet,
PlannedEditDrawer,
}, },
mixins: [basicPageMixin], mixins: [basicPageMixin],
data() { data() {
@ -461,7 +469,7 @@ export default {
allSpecialEquipments: [], allSpecialEquipments: [],
openPlannedDrawer: false, openPlannedDrawer: false,
openUnplannedDrawer: false, openUnplannedDrawer: false,
openPlannedDrawer: false, openUnplannedDetDrawer: false,
}; };
}, },
watch: { watch: {
@ -681,7 +689,6 @@ export default {
if (!valid) { if (!valid) {
return; return;
} }
//
if (this.form.id != null) { if (this.form.id != null) {
this.put({ this.put({
...this.form, ...this.form,
@ -694,24 +701,7 @@ export default {
this.getList(); this.getList();
}); });
return; return;
} } else {
//
this.getConfirmed()
.then((confirmed) => {
this.post({
...this.form,
maintainWorker: this.form.maintainWorker.join(','),
special: true,
relatePlan: 2,
confirmed: true,
}).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
})
.catch((err) => {
this.post({ this.post({
...this.form, ...this.form,
maintainWorker: this.form.maintainWorker.join(','), maintainWorker: this.form.maintainWorker.join(','),
@ -722,8 +712,40 @@ export default {
this.$modal.msgSuccess('新增成功'); this.$modal.msgSuccess('新增成功');
this.open = false; this.open = false;
this.getList(); this.getList();
setTimeout(() => {
this.handleAddDet(response.data);
}, 450);
}); });
}); }
//
// this.getConfirmed()
// .then((confirmed) => {
// this.post({
// ...this.form,
// maintainWorker: this.form.maintainWorker.join(','),
// special: true,
// relatePlan: 2,
// confirmed: true,
// }).then((response) => {
// this.$modal.msgSuccess('');
// this.open = false;
// this.getList();
// });
// })
// .catch((err) => {
// this.post({
// ...this.form,
// maintainWorker: this.form.maintainWorker.join(','),
// special: true,
// relatePlan: 2,
// confirmed: false,
// }).then((response) => {
// this.$modal.msgSuccess('');
// this.open = false;
// this.getList();
// });
// });
}); });
}, },
/** 确认 */ /** 确认 */
@ -757,6 +779,15 @@ export default {
}); });
} }
}, },
/** 新增后添加内容 */
handleAddDet(id) {
this.openUnplannedDetDrawer = true;
this.$nextTick(() => {
this.$refs['unplanned-det'].init({ id });
});
},
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
this.$modal this.$modal

View File

@ -209,12 +209,12 @@
</div> </div>
<div style="margin-top: 12px; position: relative"> <div style="margin-top: 12px; position: relative">
<div style="position: absolute; top: -40px; right: 0"> <!-- <div style="position: absolute; top: -40px; right: 0">
<el-button @click="handleAddAttr" type="text"> <el-button @click="handleAddAttr" type="text">
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
添加属性 添加属性
</el-button> </el-button>
</div> </div> -->
<base-table <base-table
v-loading="attrListLoading" v-loading="attrListLoading"
:table-props="attrTableProps" :table-props="attrTableProps"
@ -222,11 +222,11 @@
:limit="attrQuery?.params.pageSize || 10" :limit="attrQuery?.params.pageSize || 10"
:table-data="attrList" :table-data="attrList"
@emitFun="handleEmitFun"> @emitFun="handleEmitFun">
<method-btn <!-- <method-btn
slot="handleBtn" slot="handleBtn"
label="操作" label="操作"
:method-list="tableBtn" :method-list="tableBtn"
@clickBtn="handleTableBtnClick" /> @clickBtn="handleTableBtnClick" /> -->
</base-table> </base-table>
<!-- 分页组件 --> <!-- 分页组件 -->
@ -324,6 +324,45 @@ export default {
{ {
prop: 'maintenanceDes', prop: 'maintenanceDes',
label: '保养描述', label: '保养描述',
subcomponent: {
name: 'TableCellInput',
props: ['injectData'],
data() {
return {
inputvalue: null,
};
},
mounted() {
this.inputvalue = this.injectData.maintenanceDes;
},
methods: {
async handleValueChange(maintenanceDes) {
document.body.style.cursor = 'wait';
await this.$axios({
url: '/base/equipment-maintain-log-det/update',
method: 'put',
data: {
logId: this.injectData.logId,
remark: this.injectData.remark,
program: this.injectData.program,
id: this.injectData.id,
maintenanceDes: maintenanceDes,
},
});
document.body.style.cursor = 'default';
},
},
render: function (h) {
return (
<el-input
size="small"
key={this.injectData.id}
v-model={this.inputvalue}
onChange={this.handleValueChange}
/>
);
},
},
}, },
], ],
attrList: [], attrList: [],
@ -584,7 +623,7 @@ export default {
handleAddAttr() { handleAddAttr() {
if (!this.row.id) return this.$message.error('请先选中保养记录'); if (!this.row.id) return this.$message.error('请先选中保养记录');
this.resetAttrform(); this.resetAttrform();
this.attrTitle = '添加设备属性'; this.attrTitle = '添加保养项目';
this.attrFormVisible = true; this.attrFormVisible = true;
}, },
@ -597,14 +636,14 @@ export default {
}); });
if (res.code == 0) { if (res.code == 0) {
this.attrForm = res.data; this.attrForm = res.data;
this.attrTitle = '编辑设备属性'; this.attrTitle = '编辑保养项目';
this.attrFormVisible = true; this.attrFormVisible = true;
} }
}, },
// //
handleDeleteAttr(attrId) { handleDeleteAttr(attrId) {
this.$confirm('确定删除该保养内容?', '提示', { this.$confirm('确定删除该保养项目?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',

View File

@ -0,0 +1,516 @@
<!--
filename: WaitingListUnplanned--edit.vue
author: liubin
date: 2023-08-22 14:38:56
description:
-->
<template>
<el-drawer
:visible="visible"
:show-close="false"
:wrapper-closable="false"
class="drawer"
custom-class="mes-drawer"
size="60%"
@closed="$emit('destroy')">
<SmallTitle slot="title">添加保养项目</SmallTitle>
<div class="drawer-body flex">
<div class="drawer-body__content">
<SmallTitle>保养内容</SmallTitle>
<div style="margin-top: 12px; position: relative">
<SearchBar
:formConfigs="searchBarFormConfig"
ref="attr-search-bar"
@headBtnClick="handleSearchBarBtnClick" />
</div>
<div style="margin-top: 12px; position: relative">
<div style="position: absolute; top: -40px; right: 0">
<el-button @click="handleAddAttr" type="text">
<i class="el-icon-plus"></i>
添加项目
</el-button>
</div>
<base-table
v-loading="attrListLoading"
:table-props="attrTableProps"
:page="attrQuery?.params.pageNo || 1"
:limit="attrQuery?.params.pageSize || 10"
:table-data="attrList"
@emitFun="handleEmitFun">
<method-btn
slot="handleBtn"
label="操作"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
<!-- 分页组件 -->
<pagination
v-show="attrTotal > 0"
:total="attrTotal"
:page.sync="attrQuery.params.pageNo"
:limit.sync="attrQuery.params.pageSize"
@pagination="getAttrList" />
</div>
</div>
<div class="drawer-body__footer">
<el-button style="" @click="handleCancel">取消</el-button>
<el-button type="primary" @click="handleConfirm">保存</el-button>
<!-- sections的第二项必须是 属性列表 -->
<!-- <el-button
v-if="sections[1].allowAdd"
type="primary"
@click="handleAddAttr">
添加属性
</el-button> -->
</div>
</div>
<!-- 属性对话框 -->
<base-dialog
:dialogTitle="attrTitle"
:dialogVisible="attrFormVisible"
width="35%"
:append-to-body="true"
custom-class="baseDialog"
@close="closeAttrForm"
@cancel="closeAttrForm"
@confirm="submitAttrForm">
<DialogForm
v-if="attrFormVisible"
ref="attrForm"
v-model="attrForm"
:rows="attrRows" />
</base-dialog>
</el-drawer>
</template>
<script>
import DialogForm from '../../../components/DialogForm/index.vue';
const SmallTitle = {
name: 'SmallTitle',
props: ['size'],
components: {},
data() {
return {};
},
methods: {},
render: function (h) {
return h(
'span',
{
class: 'small-title',
style: {
fontSize: '18px',
lineHeight:
this.size == 'lg' ? '24px' : this.size == 'sm' ? '18px' : '20px',
fontWeight: 500,
fontFamily: '微软雅黑, Microsoft YaHei, Arial, Helvetica, sans-serif',
},
},
this.$slots.default
);
},
};
export default {
components: { SmallTitle, DialogForm },
props: ['dataId'], // dataId id
data() {
return {
visible: false,
btnLoading: false,
form: {},
formLoading: false,
lineList: [],
maintainerList: [],
departmentList: [],
attrTableProps: [
{
prop: 'equipmentName',
label: '设备名称',
},
{
prop: 'program',
label: '保养项目',
},
{
prop: 'maintenanceDes',
label: '保养描述',
},
],
attrList: [],
attrTotal: 0,
attrTitle: '',
attrForm: {
id: null,
logId: null,
program: null,
maintenanceDes: null,
remark: null,
},
attrFormVisible: false,
attrRows: [
[
{
select: true,
label: '设备名称',
prop: 'equipmentId',
url: '/base/core-equipment/page?pageNo=1&pageSize=100&special=true',
// method: 'post',
// queryParams: {
// pageNo: 1,
// pageSize: 100,
// special: true,
// },
rules: [
{ required: true, message: '设备不能为空', trigger: 'blur' },
],
},
],
[
{
input: true,
label: '保养项目',
prop: 'program',
},
],
[
{
input: true,
label: '保养描述',
prop: 'maintenanceDes',
},
],
[
{
input: true,
label: '备注',
prop: 'remark',
},
],
],
attrQuery: {
params: {
pageNo: 1,
pageSize: 10,
equipmentName: null,
},
}, //
searchBarFormConfig: [
{
type: 'input',
label: '设备',
placeholder: '请输入设备名称',
param: 'equipmentName',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
],
attrFormSubmitting: false,
attrListLoading: false,
// syncFileListFlag: null,
tableBtn: [],
row: null,
};
},
computed: {
departmentOptions() {
return (this.departmentList || []).map((item) => ({
id: item.id,
label: item.name,
value: item.id,
}));
},
lineOptions() {
return (this.lineList || []).map((item) => ({
id: item.id,
label: item.name,
value: item.id,
}));
},
maintainerOptions() {
return (this.maintainerList || []).map((item) => ({
id: item.id,
label: item.name,
value: item.name,
}));
},
},
mounted() {
// this.getList('maintainer');
// this.getList('department');
// this.getList('line');
},
methods: {
handleSearchBarBtnClick(btn) {
switch (btn.btnName) {
case 'search':
this.attrQuery.params.equipmentName = btn.equipmentName;
this.getAttrList();
break;
}
},
handleTableBtnClick({ type, data }) {
switch (type) {
case 'edit':
this.handleEditAttr(data.id);
break;
case 'delete':
this.handleDeleteAttr(data.id);
break;
}
},
getConfirmed() {
return this.$confirm('是否直接确认保养记录', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
},
async handleConfirm() {
if (this.attrList.length == 0) {
return this.$message.error('请添加保养项目');
}
let confirmed = false;
try {
confirmed = await this.getConfirmed();
} catch (err) {
confirmed = false;
}
if (confirmed) {
const res = await this.$axios({
url: '/base/equipment-maintain-log/confirm',
method: 'put',
data: [this.row.id],
});
if (res.code == 0) {
this.$message.success('已确认');
}
}
// this.btnLoading = true;
// this.$nextTick(async () => {
// const { code, data } = await this.$axios({
// url: '/base/equipment-maintain-log/update',
// method: 'put',
// data: {
// ...this.form,
// maintainWorker: this.form.maintainWorker.join(','),
// },
// });
// if (code == 0) {
// this.$modal.msgSuccess('');
// }
// this.btnLoading = false;
// this.$emit('refreshDataList');
// this.handleCancel();
// });
this.$emit('refreshDataList');
this.handleCancel();
},
handleEmitFun(val) {
console.log('handleEmitFun', val);
},
init(row) {
this.visible = true;
this.row = row;
this.getAttrList(row);
},
async getAttrList(row, condition = {}) {
if (!row) row = this.row;
this.attrListLoading = true;
const res = await this.$axios({
url: '/base/equipment-maintain-log-det/page',
method: 'get',
params: {
...this.attrQuery.params,
logId: row.id,
...condition,
},
});
if (res.code == 0) {
this.attrList = res.data.list;
this.attrTotal = res.data.total;
}
this.attrListLoading = false;
},
handleCancel() {
if (!this.attrList.length) {
return this.$message.error('请添加保养项目');
}
this.visible = false;
},
resetAttrform() {
this.attrForm = {
id: null,
logId: this.row.id,
maintenanceDes: '',
program: null,
remark: null,
};
},
//
handleAddAttr() {
if (!this.row.id) return this.$message.error('请先选中保养记录');
this.resetAttrform();
this.attrTitle = '添加保养项目';
this.attrFormVisible = true;
},
//
async handleEditAttr(attrId) {
const res = await this.$axios({
url: '/base/equipment-maintain-log-det/get',
method: 'get',
params: { id: attrId },
});
if (res.code == 0) {
this.attrForm = res.data;
this.attrTitle = '编辑保养项目';
this.attrFormVisible = true;
}
},
//
handleDeleteAttr(attrId) {
this.$confirm('确定删除该保养项目?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(async () => {
const res = await this.$axios({
url: 'url delete', // this.sections[1].urlDelete,
method: 'delete',
params: { id: attrId },
});
if (res.code == 0) {
this.$message({
message: '删除成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getAttrList();
},
});
}
})
.catch(() => {});
},
//
submitAttrForm() {
this.$refs['attrForm'].validate(async (valid) => {
if (!valid) {
return;
}
try {
const isEdit = this.attrForm.id != null;
this.attrFormSubmitting = true;
const res = await this.$axios({
url: isEdit
? '/base/equipment-maintain-log-det/update'
: '/base/equipment-maintain-log-det/create',
method: isEdit ? 'put' : 'post',
data: this.attrForm,
});
if (res.code == 0) {
this.closeAttrForm();
this.$message({
message: `${isEdit ? '更新' : '创建'}成功`,
type: 'success',
duration: 1500,
onClose: () => {
this.getAttrList();
},
});
}
this.attrFormSubmitting = false;
} catch (err) {
this.$message({
message: err,
type: 'error',
duration: 1500,
});
this.attrFormSubmitting = false;
}
});
},
closeAttrForm() {
this.attrFormVisible = false;
},
},
};
</script>
<style scoped>
.drawer >>> .el-drawer {
border-radius: 8px 0 0 8px;
}
.drawer >>> .el-date-editor,
.drawer >>> .el-select {
width: 100%;
}
.drawer >>> .el-drawer__header {
margin: 0;
padding: 32px 32px 24px;
border-bottom: 1px solid #dcdfe6;
margin-bottom: 0px;
}
.small-title::before {
content: '';
display: inline-block;
vertical-align: top;
width: 4px;
height: 22px;
border-radius: 1px;
margin-right: 8px;
background-color: #0b58ff;
}
.drawer-body {
display: flex;
flex-direction: column;
height: 100%;
}
.drawer-body__content {
flex: 1;
/* background: #eee; */
padding: 20px 30px;
overflow-y: auto;
}
.drawer-body__footer {
display: flex;
justify-content: flex-end;
padding: 18px;
}
</style>

View File

@ -559,7 +559,7 @@ export default {
handleAddAttr() { handleAddAttr() {
if (!this.row.id) return this.$message.error('请先选中保养记录'); if (!this.row.id) return this.$message.error('请先选中保养记录');
this.resetAttrform(); this.resetAttrform();
this.attrTitle = '添加设备属性'; this.attrTitle = '添加保养项目';
this.attrFormVisible = true; this.attrFormVisible = true;
}, },
@ -572,14 +572,14 @@ export default {
}); });
if (res.code == 0) { if (res.code == 0) {
this.attrForm = res.data; this.attrForm = res.data;
this.attrTitle = '编辑设备属性'; this.attrTitle = '编辑保养项目';
this.attrFormVisible = true; this.attrFormVisible = true;
} }
}, },
// //
handleDeleteAttr(attrId) { handleDeleteAttr(attrId) {
this.$confirm('确定删除该属性?', '提示', { this.$confirm('确定删除该保养项目?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',