Commit 985533a1 by zhaopanyu

zpy 8.16

parent 87ed926a
......@@ -81,9 +81,13 @@
</el-form-item>
</el-col>
<el-col :span="16">
<el-form-item label="管理员" prop="admin">
<el-input v-model="selectedAdmin.admin" placeholder="请选择管理员" @focus="selectChange"
style="width: 100%"></el-input>
<el-form-item label="管理员" prop="adminId">
<el-select v-model="postForm.adminId" filterable placeholder="请选择管理员" clearable
style="width: 100%;">
<el-option v-for="(item, index) in adminUser" :key="index" :label="item.admin"
:value="item.adminId">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
......@@ -93,32 +97,7 @@
<el-button @click="cancel"> 取 消 </el-button>
</div>
</el-dialog>
<!-- 选择管理员弹出框 -->
<el-dialog :title="title" :visible.sync="workableVehicle" width="500px" append-to-body>
<el-form :model="queryVehicleForm" inline @submit.native.prevent>
<el-form-item label="管理员" prop="admin">
<el-input v-model="queryVehicleForm.adminId" placeholder="请输入管理员"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" icon="el-icon-search" @click="handleQueryVehicle">搜索
</el-button>
<el-button plain size="small" icon="el-icon-refresh" @click="resetQueryVehicle">重置
</el-button>
</el-form-item>
</el-form>
<el-table :data="vehicleList" max-height="350" ref="vehicleSelectTable" @row-click="rowClick"
@selection-change="selectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="管理员" align="center" prop="admin">
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="abolish" :disabled="!multi">确 定</el-button>
<el-button @click="abolish">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
......@@ -142,19 +121,6 @@ export default {
dicts: ["vehicle_type", "vehicle_state"],
data() {
return {
// 管理员列表总数
NaN: 0,
// 可选管理员列表
vehicleList: [],
// 管理员列表
queryVehicleForm: {
admin: '',
adminId: '',
},
//父设备分类下拉框
deptOptions: [],
// 是否显示选择管理员弹出层
workableVehicle: false,
// 是否禁用输入框
isDisabled: false,
queryForm: {
......@@ -175,6 +141,7 @@ export default {
parentId: undefined,
equipmentType: '',
model: '',
admin: '',
adminId: '',
orderNum: '',
},
......@@ -194,12 +161,11 @@ export default {
classificationCode: [{ required: true, message: '分类编码不能为空', trigger: 'blur' }],
equipmentType: [{ required: true, message: '设备分类不能为空', trigger: 'blur' }],
orderNum: [{ required: true, message: '显示排序不能为空', trigger: 'blur' }],
adminId: [{ required: true, message: '管理员不能为空', trigger: 'blur' }],
},
//管理员
selectedAdmin: {
admin: '',
adminId: '',
}
adminUser: [],
}
},
......@@ -207,6 +173,8 @@ export default {
created() {
this.getList();
this.enuqLeader();
this.getAdminUserList();
},
methods: {
......@@ -219,62 +187,7 @@ export default {
this.loading = false;
})
},
// 选择管理员对话框选中数据
selectionChange(selection) {
this.selectedAdmin = selection[0];
console.log('this.selectedAdmin', this.selectedAdmin);
this.multi = selection.length === 1;
},
// 可选管理员取消按钮
abolish() {
this.workableVehicle = false;
this.$nextTick(() => {
this.$refs.postForm.validateField('admin');
})
},
// 列表查询管理员列表
getVehicleList() {
this.vehicleLoading = true;
console.log('this.queryVehicleForm', this.queryVehicleForm)
getAdmin(this.queryVehicleForm).then(response => {
this.vehicleLoading = false;
this.vehicleList = response.data;
console.log('this.vehicleList', this.vehicleList);
this.NaN = response.NaN;
}).catch(err => {
this.vehicleLoading = false;
})
},
rowClick(row) {
this.$refs.vehicleSelectTable.clearSelection();
this.$refs.vehicleSelectTable.toggleRowSelection(row, true);
},
// 查询管理员列表
handleQueryVehicle() {
this.throttle(() => {
this.getVehicleList();
})
},
// 重置管理员列表查询
resetQueryVehicle() {
this.queryVehicleForm = {
pageNum: 1,
pageSize: 8,
admin: ''
};
this.handleQueryVehicle();
},
// 弹出选择管理员对话框
selectChange() {
this.workableVehicle = true;
this.handleQueryVehicle();
},
// 展开/折叠
toggleExpandAll() {
......@@ -284,14 +197,19 @@ export default {
this.refreshTable = true;
});
},
//获取管理员人列表
getAdminUserList() {
getAdmin().then(res => {
if (res.code == 200) {
this.adminUser = res.data
console.log(this.adminUser);
}
})
},
// 新增
handleAdd(row) {
this.reset();
this.selectedAdmin.admin = null;
this.queryVehicleForm.adminId = null;
this.open = true;
this.getList();
if (row != null && row.id) {
......@@ -319,7 +237,7 @@ export default {
getProductCategory().then(((res) => {
if (res.code == 200) {
this.sbflOptions = res.data;
console.log('this.sbflOptions', this.sbflOptions);
// console.log('this.sbflOptions', this.sbflOptions);
}
}))
......@@ -329,7 +247,8 @@ export default {
this.reset();
queryProduct(row.id).then(response => {
this.postForm = response.data;
this.selectedAdmin.admin = response.data.admin;
this.getAdminUserList();
console.log('this.postForm修改', this.postForm);
this.open = true;
this.title = "修改资产信息";
});
......@@ -343,6 +262,7 @@ export default {
return deleteProduct(row.id);
}).then(() => {
this.getList();
this.enuqLeader();
this.loading = false;
this.$modal.msgSuccess("删除成功");
}).catch(() => {
......@@ -351,22 +271,31 @@ export default {
},
// 确定
submitForm() {
this.postForm.adminId = this.selectedAdmin.adminId;
console.log('this.postForm', this.postForm);
const adminId = this.postForm.adminId
this.postForm.admin = adminId == '' ? '' : this.adminUser.find(item => item.adminId == adminId).admin
this.$refs["postForm"].validate(valid => {
if (valid) {
if (this.postForm.id != null) {
editProduct(this.postForm).then(response => {
console.log('this.postForm', this.postForm);
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
this.enuqLeader();
});
} else {
addProduct(this.postForm).then(response => {
console.log('this.postForm', this.postForm);
// if (this.postForm.parentId === 0) {
// console.log(1111, this.postForm.parentId);
// }
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
this.enuqLeader();
});
}
}
......
......@@ -5,8 +5,12 @@
<el-input v-model="queryParams.equipmentName" placeholder="请输入设备名称" clearable />
</el-form-item>
<el-form-item label="领用人" prop="recipientBy">
<el-input v-model="queryParams.recipientBy" placeholder="请输入领用人" clearable />
<el-select v-model="queryParams.recipientBy" filterable placeholder="请选择领用人" clearable>
<el-option v-for="(item, index) in userListly" :key="index" :label="item.userName" :value="item.userId">
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="getList">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
......@@ -14,27 +18,29 @@
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleOption(0)">新增</el-button>
</el-col>
</el-row>
<!-- 表格 -->
<el-table v-loading="loading" :data="collectionData" stripe>
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column label="序号" type="index" width="55" align="center" />
<el-table-column label="自编码" align="center" prop="encode" />
<el-table-column label="序号" type="index" width="50" align="center" />
<el-table-column label="自编码" align="center" prop="encode" width="180" />
<el-table-column label="设备名称" align="center" prop="equipmentName" />
<el-table-column label="型号" align="center" prop="model" />
<el-table-column label="领用日期" align="center" prop="recipientTime" />
<el-table-column label="领用日期" align="center" prop="recipientTime" width="200" />
<el-table-column label="领用人" align="center" prop="recipientBy" />
<el-table-column label="退还日期" align="center" prop="returnTime" />
<el-table-column label="退还日期" align="center" prop="returnTime" width="200" />
<el-table-column label="退还时设备情况" align="center" prop="returnEquipmentCondition" />
<el-table-column label="接收人" align="center" prop="receivedBy" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" prop="orgname" width="150">
<el-table-column label="操作" align="center" prop="orgname" width="150" fixed="right">
<template slot-scope="{ row }">
<el-button type="text" size="small" @click="handleUpdate(row)">编辑</el-button>
<el-button type="text" size="small" @click="handleLook(row)">查看</el-button>
<el-button type="text" size="small" @click="handleDelete(row)">删除</el-button>
<div>
<el-button type="text" size="small" @click="handleOption(2, row)">查看</el-button>
<el-button type="text" size="small" @click="handleOption(1, row)">编辑</el-button>
<el-button type="text" size="small" @click="handleDelete(row)">删除</el-button>
</div>
</template>
</el-table-column>
</el-table>
......@@ -42,57 +48,71 @@
:limit.sync="queryParams.pageSize" @pagination="getList" />
<!-- 新增、编辑、查看页面 -->
<el-dialog title="详细信息" :visible.sync="dialogVisible" width="50%">
<el-form :model="collectionForm" :rules="collectionRules" ref="achievementForm" label-width="110px"
<el-form :model="collectionForm" :rules="collectionRules" ref="achievementForm" label-width="120px"
label-position="right">
<el-row :gutter="30">
<el-col :span="12">
<el-form-item label="自编码" prop="encode">
<el-input v-model="collectionForm.encode" placeholder="请输入自编码" @change="getRencode"></el-input>
<el-input v-model="collectionForm.encode" placeholder="请输入自编码" @change="getRencode"
:disabled="nowType != 0 ? true : false"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备名称" prop="equipmentName">
<el-input v-model="collectionForm.equipmentName" placeholder="请输入设备名称"></el-input>
<el-input v-model="collectionForm.equipmentName" placeholder="请输入设备名称"
:disabled="nowType == 2 ? true : false"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
<el-form-item label="型号" prop="model">
<el-input v-model="collectionForm.model" placeholder="请输入型号"></el-input>
<el-input v-model="collectionForm.model" placeholder="请输入型号"
:disabled="nowType == 2 ? true : false"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="领用人" prop="recipientBy">
<el-input v-model="collectionForm.recipientBy" placeholder="请输入领用人"></el-input>
<el-form-item label="领用人" prop="recipientById">
<el-select v-model="collectionForm.recipientById" filterable placeholder="请选择领用人" clearable
style="width: 100%;" :disabled="nowType == 2 ? true : false">
<el-option v-for="(item, index) in userListly" :key="index" :label="item.userName" :value="item.userId">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
<el-form-item label="领用日期" prop="recipientTime">
<el-date-picker v-model="collectionForm.recipientTime" type="datetime" clearable class="selectWidth"
placeholder="请选择领用日期" value-format="yyyy-MM-dd HH:mm:ss">
placeholder="请选择领用日期" value-format="yyyy-MM-dd HH:mm:ss" :disabled="nowType == 2 ? true : false">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="退还日期" prop="returnTime">
<el-date-picker v-model="collectionForm.returnTime" type="datetime" clearable class="selectWidth"
placeholder="请选择退还日期" value-format="yyyy-MM-dd HH:mm:ss">
placeholder="请选择退还日期" value-format="yyyy-MM-dd HH:mm:ss" :disabled="nowType == 2 ? true : false">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
<el-form-item label="接收人" prop="receivedBy">
<el-input v-model="collectionForm.receivedBy" placeholder="请输入接收人"></el-input>
<el-form-item label="接收人" prop="receivedById">
<el-select v-model="collectionForm.receivedById" filterable placeholder="请选择接收人" clearable
style="width: 100%;" :disabled="nowType == 2 ? true : false">
<el-option v-for="(item, index) in adminUserListjs" :key="index" :label="item.admin"
:value="item.adminId">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="退还时设备情况" prop="returnEquipmentCondition">
<el-input v-model="collectionForm.returnEquipmentCondition" placeholder="请输入退还时设备情况"></el-input>
<el-input v-model="collectionForm.returnEquipmentCondition" placeholder="请输入退还时设备情况"
:disabled="nowType == 2 ? true : false"></el-input>
</el-form-item>
</el-col>
</el-row>
......@@ -100,14 +120,14 @@
<el-col :span="12">
<el-form-item label="预计使用时间" prop="yjuseTime">
<el-date-picker v-model="collectionForm.yjuseTime" type="datetime" clearable class="selectWidth"
placeholder="请选择预计使用时间" value-format="yyyy-MM-dd HH:mm:ss">
placeholder="请选择预计使用时间" value-format="yyyy-MM-dd HH:mm:ss" :disabled="nowType == 2 ? true : false">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="实际使用时间" prop="sjuseTime">
<el-date-picker v-model="collectionForm.sjuseTime" type="datetime" clearable class="selectWidth"
placeholder="请选择实际使用时间" value-format="yyyy-MM-dd HH:mm:ss">
placeholder="请选择实际使用时间" value-format="yyyy-MM-dd HH:mm:ss" :disabled="nowType == 2 ? true : false">
</el-date-picker>
</el-form-item>
</el-col>
......@@ -115,15 +135,16 @@
<el-row :gutter="30">
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input type="textarea" v-model="collectionForm.remark" placeholder="请输入备注"></el-input>
<el-input type="textarea" v-model="collectionForm.remark" placeholder="请输入备注"
:disabled="nowType == 2 ? true : false"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div style="text-align: center">
<el-button type="primary" v-show="isEditable" @click="submitForm">确 定</el-button>
<el-button @click="cancel">{{ isEditable ? '取 消' : '退 出' }}</el-button>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" v-if="nowType != 2" @click="submitForm">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
......@@ -137,11 +158,12 @@ import {
deleteReceive,
} from '@/api/smartSchool/schoolProperty/collectionLedger.js'
import { getUserList } from "../../../../api/smartSchool/schoolProperty/equipmenTledger";
import { getAdmin } from '@/api/smartSchool/schoolProperty/classiFication.js'
import {
getRepairencode,//根据自编码获取设备信息
} from '@/api/smartSchool/schoolProperty/repairApplicant.js'
export default {
// dicts: [''],
data() {
return {
queryParams: {
......@@ -153,15 +175,20 @@ export default {
loading: false,
total: 0,
collectionData: [],
//领用人
userListly: [],
//接受人
adminUserListjs: [],
//新增
collectionForm: {
encode: '',
equipmentName: '',
model: '',
recipientById: '',
recipientBy: '',
recipientTime: '',
returnTime: '',
receivedById: '',
receivedBy: '',
returnEquipmentCondition: '',
yjuseTime: '',
......@@ -170,9 +197,33 @@ export default {
},
dialogVisible: false,
nowType: 0, // 0新增、1编辑、2查看
collectionRules: {
encode: [
{ required: true, message: "自编码不能为空", trigger: "blur" }
],
recipientTime: [
{ required: true, message: "领用日期不能为空", trigger: "blur" }
],
recipientById: [
{ required: true, message: "领用人不能为空", trigger: "blur" }
],
returnTime: [
{ required: true, message: "退还日期不能为空", trigger: "blur" }
],
returnEquipmentCondition: [
{ required: true, message: "退还时设备情况不能为空", trigger: "blur" }
],
receivedById: [
{ required: true, message: "接收人不能为空", trigger: "blur" }
],
yjuseTime: [
{ required: true, message: "预计使用时间不能为空", trigger: "blur" }
],
sjuseTime: [
{ required: true, message: "实际使用时间不能为空", trigger: "blur" }
]
},
dialogVisible: false,
isEditable: true,
......@@ -182,6 +233,8 @@ export default {
},
created() {
this.getList();
this.getSelectUser();
this.getAdminUserList();
},
methods: {
......@@ -196,41 +249,77 @@ export default {
this.loading = false;
})
},
/** 查看 */
handleLook(row) {
this.collectionForm = row;
const id = row.id || this.ids;
queryReceive(id).then(response => {
this.collectionForm = response.data;
this.dialogVisible = true;
this.isEditable = false;
}).catch(err => {
handleOption(type, item) {
this.collectionForm = {
id: '',
encode: '',
equipmentName: '',
model: '',
recipientById: '',
recipientBy: '',
recipientTime: '',
returnTime: '',
receivedById: '',
receivedBy: '',
returnEquipmentCondition: '',
yjuseTime: '',
sjuseTime: '',
remark: '',
}
this.nowType = type;
this.getSelectUser();
this.getAdminUserList();
if (type != 0) {
const id = item.id;
queryReceive(id).then(res => {
if (res.code == 200) {
console.log(res.data);
Object.keys(this.collectionForm).forEach(key => {
if (res.data[key]) {
this.$set(this.collectionForm, key, res.data[key]);
}
});
}
})
}
this.dialogVisible = true
},
//获取领用人数据
getSelectUser() {
getUserList().then(res => {
if (res.code == 200) {
this.userListly = res.rows
}
})
},
//获取接受人列表
getAdminUserList() {
getAdmin().then(res => {
if (res.code == 200) {
this.adminUserListjs = res.data
}
})
this.title = "查看";
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除"' + ids + '"的数据项?').then(function () {
return deleteReceive(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => { });
const { id, equipmentName, model } = row;
const equipmentNames = equipmentName || this.equipmentNames;
const models = model || this.models;
this.$modal
.confirm(`是否确认删除"${equipmentNames} ${models}"的数据项?`)
.then(() => {
return deleteReceive(id, equipmentNames, models);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => { });
},
// 修改按钮操作
handleUpdate(row) {
const id = row.id || this.ids;
this.title = "修改申请";
queryReceive(id).then(response => {
this.collectionForm = response.data;
this.dialogVisible = true;
this.isEditable = true;
}).catch(err => {
})
},
// 重置搜索
resetQuery() {
this.queryParams = {
......@@ -261,13 +350,7 @@ export default {
}
},
// 新增按钮操作
handleAdd() {
this.reset();
this.dialogVisible = true;
this.title = "添加申请";
},
reset() {
// 这里需要重置对话框表单
this.collectionForm = {
......@@ -289,16 +372,27 @@ export default {
//表单提交
submitForm() {
const recipientById = this.collectionForm.recipientById;
this.collectionForm.recipientBy = recipientById == '' ? '' : this.userListly.find(item => item.userId == recipientById).userName
const receivedById = this.collectionForm.receivedById;
this.collectionForm.receivedBy = receivedById == '' ? '' : this.adminUserListjs.find(item => item.adminId == receivedById).admin
this.$refs["achievementForm"].validate(valid => {
if (valid) {
if (this.collectionForm.id != null) {
editReceive(this.collectionForm).then(response => {
this.$modal.msgSuccess("修改成功");
this.dialogVisible = false;
this.getList();
});
} else {
if (this.nowType == 1) {
if (this.collectionForm.id != null) {
editReceive(this.collectionForm).then(response => {
console.log('this.collectionForm', this.collectionForm)
this.$modal.msgSuccess("修改成功");
this.dialogVisible = false;
this.getList();
});
}
} else if (this.nowType == 0) { // 新增操作
addReceive(this.collectionForm).then(response => {
console.log('this.collectionForm', this.collectionForm)
console.log(response)
this.$modal.msgSuccess("新增成功");
this.dialogVisible = false;
this.getList();
......@@ -306,7 +400,9 @@ export default {
}
}
});
},
}
}
}
</script>
......
......@@ -26,22 +26,21 @@
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增
</el-button>
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleOption(0)">新增</el-button>
</el-col>
</el-row>
<!-- 表格数据 -->
<el-table :data="applyTable" style="width: 100%">
<el-table-column align="center" type="index" label="序号" />
<el-table-column align="center" prop="encode" label="自编码" width="150px" />
<el-table-column align="center" prop="equipmentName" label="设备名称" />
<el-table-column align="center" prop="model" label="型号" />
<el-table-column align="center" prop="classificationCode" label="型号" />
<el-table-column align="center" type="index" label="序号" fixed="left" />
<el-table-column align="center" prop="encode" label="自编码" width="150px" fixed="left" />
<el-table-column align="center" prop="equipmentName" label="设备名称" fixed="left" />
<el-table-column align="center" prop="model" label="型号" fixed="left" />
<el-table-column align="center" prop="classificationCode" label="分类编码" fixed="left" />
<el-table-column align="center" prop="dateOfProduction" label="投产日期" />
<el-table-column align="center" prop="place" label="地点" />
<el-table-column align="center" prop="problem" label="问题" />
<el-table-column align="center" prop="repairName" label="修理人" />
<el-table-column align="center" prop="repairTime" label="修理时间" />
<el-table-column align="center" prop="repairTime" label="修理时间" width="160px" />
<el-table-column align="center" prop="repairState" label="修理结果">
<template slot-scope="{ row }">
<div>{{ selectDictLabel(dict.type.dispose_state, row.repairState) }}</div>
......@@ -57,59 +56,63 @@
<el-rate v-model="scope.row.evaluate" :max="5" :disabled="!scope.row.editable"></el-rate>
</template>
</el-table-column>
<el-table-column label="操作" width="180px" class-name="small-padding fixed-width">
<el-table-column label="操作" align="center" prop="orgname" width="180" fixed="right">
<template slot-scope="{ row }">
<div>
<el-button size="mini" type="text" icon="el-icon-search" @click="handleLook(row)">
查看
</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(row)">
修改
</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(row)">
删除
</el-button>
<el-button type="text" size="small" @click="handleOption(2, row)">查看</el-button>
<el-button type="text" size="small" @click="handleOption(1, row)">编辑</el-button>
<el-button type="text" size="small" @click="handleDelete(row)">删除</el-button>
</div>
</template>
</el-table-column>
</el-table>
<!-- 新增/修改/查看对话框 -->
<el-dialog :title="title" :visible.sync="open" width="1200px" append-to-body @close="cancel">
<el-dialog title="详细信息" :visible.sync="dialogVisible" width="1200px" append-to-body>
<el-form ref="postForm" :model="postForm" :rules="rules" label-width="110px">
<el-row>
<el-col :span="12">
<el-form-item label="自编码" prop="encode">
<el-input v-model.lazy="postForm.encode" placeholder="自编码" @change="getRencode"></el-input>
<el-input v-model="postForm.encode" placeholder="自编码" :disabled="nowType != 0 ? true : false"
@change="getRencode"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="报修人" prop="reportRepair">
<el-input v-model="postForm.reportRepair" placeholder="报修人"></el-input>
<el-form-item label="报修人" prop="reportRepairId">
<el-select v-model="postForm.reportRepairId" placeholder="请选择维修人" clearable style="width: 100%;"
:disabled="nowType == 2 ? true : false">
<el-option v-for="(item, index) in userList" :key="index" :label="item.userName"
:value="item.userId">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="设备名称" prop="equipmentName">
<el-input v-model="postForm.equipmentName" placeholder="设备名称"></el-input>
<el-input v-model="postForm.equipmentName" placeholder="设备名称"
:disabled="nowType == 2 ? true : false"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="问题" prop="problem">
<el-input v-model="postForm.problem" placeholder="问题"></el-input>
<el-input v-model="postForm.problem" placeholder="问题"
:disabled="nowType == 2 ? true : false"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="型号" prop="model">
<el-input v-model="postForm.model" placeholder="型号"></el-input>
<el-input v-model="postForm.model" placeholder="型号"
:disabled="nowType == 2 ? true : false"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="维修人" prop="repairName">
<el-select v-model="postForm.repairName" placeholder="请选择维修人" clearable style="width: 100%;">
<el-form-item label="维修人" prop="repairId">
<el-select v-model="postForm.repairId" placeholder="请选择维修人" clearable style="width: 100%;"
:disabled="nowType == 2 ? true : false">
<el-option v-for="item in sbflOptions" :key="item.repairId" :label="item.repairName"
:value="item.repairId" />
</el-select>
......@@ -120,26 +123,28 @@
<el-col :span="12">
<el-form-item label="投产日期:" prop="dateOfProduction">
<el-date-picker v-model="postForm.dateOfProduction" type="date" placeholder="选择日期"
style="width: 100%;" value-format="yyyy-MM-dd" clearable
:readonly="isReadOnly"></el-date-picker>
style="width: 100%;" value-format="yyyy-MM-dd" clearable :readonly="isReadOnly"
:disabled="nowType == 2 ? true : false"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="维修时间:" prop="repairTime">
<el-date-picker v-model="postForm.repairTime" type="datetime" placeholder="选择日期"
style="width: 100%;" value-format="yyyy-MM-dd HH:mm:ss" clearable></el-date-picker>
style="width: 100%;" value-format="yyyy-MM-dd HH:mm:ss" clearable
:disabled="nowType == 2 ? true : false"></el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="地点" prop="place">
<el-input v-model="postForm.place" placeholder="地点" />
<el-input v-model="postForm.place" placeholder="地点" :disabled="nowType == 2 ? true : false" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="处理状态" prop="disposeState">
<el-select v-model="postForm.disposeState" placeholder="处理状态" clearable style="width: 100%;">
<el-select v-model="postForm.disposeState" placeholder="处理状态" clearable style="width: 100%;"
:disabled="nowType == 2 ? true : false">
<el-option v-for="(item, index) in dict.type.repair_state" :key="index" :label="item.label"
:value="item.value"></el-option>
</el-select>
......@@ -150,12 +155,13 @@
<el-col :span="12">
<el-form-item label="报修时间:" prop="reportRepairTime">
<el-date-picker v-model="postForm.reportRepairTime" type="datetime" placeholder="选择日期"
style="width: 100%;" value-format="yyyy-MM-dd HH:mm:ss" clearable></el-date-picker>
style="width: 100%;" value-format="yyyy-MM-dd HH:mm:ss" clearable
:disabled="nowType == 2 ? true : false"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="评价" prop="evaluate">
<el-rate v-model="postForm.evaluate" :max="5"></el-rate>
<el-rate v-model="postForm.evaluate" :max="5" :disabled="nowType == 2 ? true : false"></el-rate>
</el-form-item>
</el-col>
</el-row>
......@@ -163,15 +169,16 @@
<el-row>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input type="textarea" v-model="postForm.remark" placeholder="请输入内容" />
<el-input type="textarea" v-model="postForm.remark" placeholder="请输入内容"
:disabled="nowType == 2 ? true : false" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div style="text-align: center">
<el-button type="primary" v-show="isEditable" @click="submitForm">确 定</el-button>
<el-button @click="cancel">{{ isEditable ? '取 消' : '退 出' }}</el-button>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" v-if="nowType != 2" @click="submitForm">确 定</el-button>
</span>
</el-dialog>
......@@ -192,6 +199,7 @@ import {
getRepairencode,//根据自编码获取设备信息
getRepairname
} from '@/api/smartSchool/schoolProperty/repairApplicant.js'
import { getUserList } from "../../../../api/smartSchool/schoolProperty/equipmenTledger";
export default {
name: 'repairApplicant',
......@@ -213,16 +221,6 @@ export default {
},
// 表格数据
applyTable: [],
// 查询表单
queryForm: {
pageNum: 1,
pageSize: 10,
},
// 遮罩层
loading: false,
// 选中数组
......@@ -237,19 +235,14 @@ export default {
multi: false,
// 显示搜索条件
showSearch: true,
// 信息列表
infoList: [],
// 数据总数
total: 0,
disabledFields: {
encode: false,
equipmentName: false,
model: false,
dateOfProduction: false,
},
dialogVisible: false,
nowType: 0, // 0新增、1编辑、2查看
// 新增/修改表单
postForm: {
id: '',
encode: '',
equipmentId: null,
classificationCode: "",
reportRepairId: "",
......@@ -264,44 +257,46 @@ export default {
evaluate: null,
remark: "",
equipmentName: null,
reportRepairTime: "",
model: null,
place: null,
dateOfProduction: null
},
// 是否显示新增弹出层
open: false,
isEditable: true,
// 查看对话框
openLook: false,
//报修人列表
userList: [],
// // 表单校验
rules: {
encode: [
{ required: true, message: "自编码不能为空", trigger: "blur" }
],
reportRepair: [
reportRepairId: [
{ required: true, message: "报修人不能为空", trigger: "blur" }
]
],
repairName: [
{ required: true, message: "修理人不能为空", trigger: "blur" }
],
problem: [
{ required: true, message: "问题不能为空", trigger: "blur" }
],
repairTime: [
{ required: true, message: "修理时间不能为空", trigger: "blur" }
],
},
// 弹出层标题
title: '',
form: {
id: "",
maintainResult: "",
evaluate: 0,
}
}
},
created() {
this.postForm.evaluate = 5;
this.getList();
this.getRepairname();
this.getSelectUser();
},
methods: {
......@@ -317,18 +312,14 @@ export default {
})
},
/** 查看 */
handleLook(row) {
this.form = row;
const id = row.id || this.ids;
queryRepair(id).then(response => {
this.postForm = response.data;
this.open = true;
this.isEditable = false
}).catch(err => {
//获取报修人数据
getSelectUser() {
getUserList().then(res => {
if (res.code == 200) {
this.userList = res.rows
}
})
this.title = "查看";
},
// 重置按钮
resetQuery() {
......@@ -341,14 +332,6 @@ export default {
this.getList(); // 重新发一次请求
},
// 新增按钮操作
handleAdd() {
this.isShow = true;
this.isDisabled = false;
this.open = true;
this.title = "添加申请";
this.reset();
},
// 根据自编码获取设备信息
async getRencode() {
......@@ -378,56 +361,77 @@ export default {
})
},
// 修改按钮操作
handleUpdate(row) {
const id = row.id || this.ids;
this.title = "修改申请";
queryRepair(id).then(response => {
this.postForm = response.data;
this.open = true;
this.isEditable = true;
}).catch(err => {
})
// 0新增、1编辑、2查看
handleOption(type, item) {
this.postForm = {
id: '',
encode: null,
equipmentId: null,
classificationCode: "",
reportRepairId: "",
reportRepair: "",
problem: "",
repairId: "",
repairName: "",
repairPhone: "",
repairTime: "",
repairState: "",
disposeState: "",
evaluate: null,
remark: "",
equipmentName: null,
model: null,
place: null,
dateOfProduction: null,
reportRepairTime: ""
}
this.nowType = type;
this.getRepairname();
this.getSelectUser();
if (type != 0) {
const id = item.id;
queryRepair(id).then(res => {
if (res.code == 200) {
console.log(res.data);
Object.keys(this.postForm).forEach(key => {
if (res.data[key]) {
this.$set(this.postForm, key, res.data[key]);
}
});
}
})
}
this.dialogVisible = true
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除"' + ids + '"的数据项?').then(function () {
return deleteRepair(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => { });
const { id, equipmentName, model } = row;
const equipmentNames = equipmentName || this.equipmentNames;
const models = model || this.models;
this.$modal
.confirm(`是否确认删除"${equipmentNames} ${models}"的数据项?`)
.then(() => {
return deleteRepair(id, equipmentNames, models);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => { });
},
// 提交表单
submitForm() {
const reportRepairId = this.postForm.reportRepairId;
this.postForm.reportRepair = reportRepairId == '' ? '' : this.userList.find(item => item.userId == reportRepairId).userName;
console.log('this.postForm', this.postForm);
this.$refs["postForm"].validate(valid => {
if (valid) {
this.$modal.loading('正在上传数据,请稍等...');
if (this.postForm.disposeState === "1" || this.postForm.disposeState === "0") {
this.postForm.repairState = "1";
} else if (this.postForm.disposeState === null) {
this.postForm.repairState = "0";
} else {
this.postForm.repairState = "0"; // 当 disposeState 不满足上述条件时,默认设置为 0
}
if (this.postForm.id != null) {
editRepair(this.postForm).then(response => {
console.log('this.postForm',);
this.$modal.closeLoading();
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
}).catch(err => {
this.$modal.closeLoading();
});
} else {
if (this.nowType == 1) { // 修改操作
if (this.postForm.disposeState === "1" || this.postForm.disposeState === "0") {
this.postForm.repairState = "1";
} else if (this.postForm.disposeState === null) {
......@@ -436,23 +440,46 @@ export default {
this.postForm.repairState = "0"; // 当 disposeState 不满足上述条件时,默认设置为 0
}
if (this.postForm.id != null) {
editRepair(this.postForm)
.then(response => {
console.log('this.postForm', this.postForm);
this.dialogVisible = false;
this.$modal.msgSuccess("修改成功");
this.getList();
})
.catch(err => {
// 处理错误
});
}
} else if (this.nowType == 0) { // 新增操作
if (this.postForm.disposeState === "1" || this.postForm.disposeState === "0") {
this.postForm.repairState = "1";
} else if (this.postForm.disposeState === null) {
this.postForm.repairState = "0";
} else {
this.postForm.repairState = "0"; // 当 disposeState 不满足上述条件时,默认设置为 0
}
addRepair(this.postForm).then(response => {
console.log(this.postForm);
this.$modal.closeLoading();
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
}).catch(err => {
this.$modal.closeLoading();
});
addRepair(this.postForm)
.then(response => {
console.log('this.postForm', this.postForm);
this.dialogVisible = false;
this.$modal.msgSuccess("新增成功");
this.getList();
})
.catch(err => {
// 处理错误
});
}
}
}
);
});
},
},
// 取消按钮
cancel() {
this.open = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment