|
|
@@ -92,16 +92,26 @@
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="维修部门:" prop="repairGroupName">
|
|
|
- <dept-select v-model="addForm.repairGroupName" placeholder="选择设备带出" disabled/>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="维修人:" prop="repairUserName">
|
|
|
- <person-select v-model="addForm.repairUserName" multiple clearable placeholder="选择设备带出" disabled/>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="维修部门:" prop="repairGroupName">
|
|
|
+ <dept-select
|
|
|
+ v-model="addForm.repairGroupName"
|
|
|
+ placeholder="选择设备带出"
|
|
|
+ disabled
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="维修人:" prop="repairUserName">
|
|
|
+ <person-select
|
|
|
+ v-model="addForm.repairUserName"
|
|
|
+ multiple
|
|
|
+ clearable
|
|
|
+ placeholder="选择设备带出"
|
|
|
+ disabled
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
<el-col :span="12">
|
|
|
@@ -124,7 +134,11 @@
|
|
|
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="接收人:" prop="repairUserId">
|
|
|
- <person-select v-model="addForm.repairUserId" clearable @change="changeUser"/>
|
|
|
+ <person-select
|
|
|
+ v-model="addForm.repairUserId"
|
|
|
+ clearable
|
|
|
+ @change="changeUser"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="24">
|
|
|
@@ -140,7 +154,7 @@
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
-<!-- <el-col :span="24">
|
|
|
+ <!-- <el-col :span="24">
|
|
|
<el-form-item label="图片:" prop="repairsImg">
|
|
|
<SelectUpload
|
|
|
multiple
|
|
|
@@ -158,7 +172,9 @@
|
|
|
</el-form>
|
|
|
</div>
|
|
|
<div class="btns">
|
|
|
- <el-button type="primary" @click="submitAdd" :loading="loading">提交</el-button>
|
|
|
+ <el-button type="primary" @click="submitAdd" :loading="loading"
|
|
|
+ >提交</el-button
|
|
|
+ >
|
|
|
<el-button @click="handleClose">关闭</el-button>
|
|
|
</div>
|
|
|
<CategoryDialog
|
|
|
@@ -174,7 +190,7 @@
|
|
|
import DeptSelect from '@/components/CommomSelect/dept-select.vue';
|
|
|
import PersonSelect from '@/components/CommomSelect/person-select.vue';
|
|
|
import { getAssetInfo } from '@/api/ledgerAssets';
|
|
|
- import { save , update } from '@/api/maintenance/repair_report';
|
|
|
+ import { save, update } from '@/api/maintenance/repair_report';
|
|
|
import { getUserPage } from '@/api/system/organization';
|
|
|
export default {
|
|
|
props: {
|
|
|
@@ -193,133 +209,129 @@
|
|
|
PersonSelect
|
|
|
},
|
|
|
watch: {
|
|
|
- infoData (val) {
|
|
|
- let id = val.id
|
|
|
+ infoData(val) {
|
|
|
+ let id = val.id;
|
|
|
this.selectedEquipment(id);
|
|
|
- },
|
|
|
+ }
|
|
|
},
|
|
|
- data () {
|
|
|
+ data() {
|
|
|
return {
|
|
|
addRepairNotesDialog: false,
|
|
|
- addForm: { },
|
|
|
+ addForm: {},
|
|
|
initData: [],
|
|
|
addFormRules: {},
|
|
|
- loading:false,
|
|
|
- row:null,
|
|
|
- receiverList:[]
|
|
|
+ loading: false,
|
|
|
+ row: null,
|
|
|
+ receiverList: []
|
|
|
};
|
|
|
},
|
|
|
- created () {
|
|
|
- this.getUserList()
|
|
|
+ created() {
|
|
|
+ this.getUserList();
|
|
|
},
|
|
|
methods: {
|
|
|
- init(row){
|
|
|
- this.addRepairNotesDialog = true;
|
|
|
- this.row = row
|
|
|
- if(row){
|
|
|
- this.selectedEquipment(row.deviceId)
|
|
|
- }else{
|
|
|
-
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- handleClose () {
|
|
|
+ init(row) {
|
|
|
+ this.addRepairNotesDialog = true;
|
|
|
+ this.row = row;
|
|
|
+ if (row) {
|
|
|
+ this.selectedEquipment(row.deviceId);
|
|
|
+ } else {
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ handleClose() {
|
|
|
this.initData = [];
|
|
|
this.addRepairNotesDialog = false;
|
|
|
- this.addForm = {}
|
|
|
+ this.addForm = {};
|
|
|
},
|
|
|
// 打开选择设备弹窗
|
|
|
- selectEquipment () {
|
|
|
+ selectEquipment() {
|
|
|
this.$refs.equipmentDialogRef.open();
|
|
|
},
|
|
|
// 上传图片
|
|
|
- getImgs (list) {
|
|
|
+ getImgs(list) {
|
|
|
this.addForm.repairsImg = list.map((item) => item.accessUrl).join(',');
|
|
|
console.log('上传的图片:', this.addForm.repairsImg);
|
|
|
},
|
|
|
|
|
|
// 获取接收人列表
|
|
|
- async getUserList (deptCode) {
|
|
|
+ async getUserList(deptCode) {
|
|
|
let data = { pageNum: 1, size: -1 };
|
|
|
const res = await getUserPage(data);
|
|
|
this.receiverList = res.list;
|
|
|
},
|
|
|
-
|
|
|
- changeUser(data){
|
|
|
- this.receiverList.map(item=>{
|
|
|
- if(item.id==data){
|
|
|
- this.addForm.repairUserName = item.name
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
+
|
|
|
+ changeUser(data) {
|
|
|
+ this.receiverList.map((item) => {
|
|
|
+ if (item.id == data) {
|
|
|
+ this.addForm.repairUserName = item.name;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
// 选择的设备
|
|
|
- selectedEquipment (id) {
|
|
|
+ selectedEquipment(id) {
|
|
|
getAssetInfo(id).then((res) => {
|
|
|
- this.addForm = res
|
|
|
- this.addForm.equiLocation = res.positionList[0].pathName
|
|
|
- const model = res.category.modelType ? res.category.modelType : "";
|
|
|
- const specification = res.category.specification
|
|
|
- ? res.category.specification + "|"
|
|
|
- : res.category.modelType
|
|
|
- ? "|"
|
|
|
- : "";
|
|
|
- this.addForm.equiModel = specification + model; // 规格型号
|
|
|
- if(this.row){
|
|
|
- this.$set(this.addForm,'repairDeptId',this.row.repairDeptId)
|
|
|
- this.$set(this.addForm,'repairUserId',this.row.repairUserId)
|
|
|
- this.$set(this.addForm,'expectedTime',this.row.expectedTime)
|
|
|
- this.$set(this.addForm,'remark',this.row.remark)
|
|
|
- }
|
|
|
+ this.addForm = res;
|
|
|
+ this.addForm.equiLocation = res.positionList[0].pathName;
|
|
|
+ const model = res.category.modelType ? res.category.modelType : '';
|
|
|
+ const specification = res.category.specification
|
|
|
+ ? res.category.specification + '|'
|
|
|
+ : res.category.modelType
|
|
|
+ ? '|'
|
|
|
+ : '';
|
|
|
+ this.addForm.equiModel = specification + model; // 规格型号
|
|
|
+ if (this.row) {
|
|
|
+ this.$set(this.addForm, 'repairDeptId', this.row.repairDeptId);
|
|
|
+ this.$set(this.addForm, 'repairUserId', this.row.repairUserId);
|
|
|
+ this.$set(this.addForm, 'expectedTime', this.row.expectedTime);
|
|
|
+ this.$set(this.addForm, 'remark', this.row.remark);
|
|
|
+ }
|
|
|
});
|
|
|
},
|
|
|
// 提交新增
|
|
|
- submitAdd () {
|
|
|
+ submitAdd() {
|
|
|
if (!this.addForm.code) {
|
|
|
return this.$message.warning('请选择报修设备!');
|
|
|
}
|
|
|
- const params = {
|
|
|
- deviceId: this.addForm.id,
|
|
|
- expectedTime : this.addForm.expectedTime,
|
|
|
- remark: this.addForm.remark,
|
|
|
- repairDeptId: this.addForm.repairDeptId,
|
|
|
- repairUserId: this.addForm.repairUserId,
|
|
|
- status:0,
|
|
|
- sourceType:1,
|
|
|
- deviceCode: this.addForm.code,
|
|
|
- deviceName: this.addForm.name,
|
|
|
- repairUserName: this.addForm.repairUserName
|
|
|
- }
|
|
|
- this.loading = true;
|
|
|
- if(this.row){
|
|
|
- params.id = this.row.id
|
|
|
- params.code = this.row.code
|
|
|
- update(params).then(res=>{
|
|
|
- this.$message.success('修改成功!');
|
|
|
- this.$emit('refresh');
|
|
|
- this.loading = false;
|
|
|
- this.handleClose()
|
|
|
- })
|
|
|
- .catch((e) => {
|
|
|
- this.loading = false;
|
|
|
- });
|
|
|
- }else{
|
|
|
- save(params).then(res=>{
|
|
|
- this.$message.success('新增成功!');
|
|
|
- this.$emit('refresh');
|
|
|
- this.loading = false;
|
|
|
- this.handleClose()
|
|
|
- })
|
|
|
- .catch((e) => {
|
|
|
- this.loading = false;
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ const params = {
|
|
|
+ deviceId: this.addForm.id,
|
|
|
+ expectedTime: new Date(this.addForm.expectedTime),
|
|
|
+ remark: this.addForm.remark,
|
|
|
+ repairDeptId: this.addForm.repairDeptId,
|
|
|
+ repairUserId: this.addForm.repairUserId,
|
|
|
+ status: 0,
|
|
|
+ sourceType: 1,
|
|
|
+ deviceCode: this.addForm.code,
|
|
|
+ deviceName: this.addForm.name,
|
|
|
+ repairUserName: this.addForm.repairUserName
|
|
|
+ };
|
|
|
+ this.loading = true;
|
|
|
+ if (this.row) {
|
|
|
+ params.id = this.row.id;
|
|
|
+ params.code = this.row.code;
|
|
|
+ update(params)
|
|
|
+ .then((res) => {
|
|
|
+ this.$message.success('修改成功!');
|
|
|
+ this.$emit('refresh');
|
|
|
+ this.loading = false;
|
|
|
+ this.handleClose();
|
|
|
+ })
|
|
|
+ .catch((e) => {
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ save(params)
|
|
|
+ .then((res) => {
|
|
|
+ this.$message.success('新增成功!');
|
|
|
+ this.$emit('refresh');
|
|
|
+ this.loading = false;
|
|
|
+ this.handleClose();
|
|
|
+ })
|
|
|
+ .catch((e) => {
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
</script>
|