|
|
@@ -15,18 +15,18 @@
|
|
|
<el-form :model="addForm" :rules="addFormRules" label-width="120px">
|
|
|
<el-row>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="设备编码:" prop="equiCode">
|
|
|
+ <el-form-item label="设备编码:" prop="code">
|
|
|
<el-input
|
|
|
- v-model="addForm.equiCode"
|
|
|
+ v-model="addForm.code"
|
|
|
placeholder="选择设备带出"
|
|
|
disabled
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="权属部门:" prop="ownerDeptName">
|
|
|
+ <el-form-item label="权属部门:" prop="ownershipGroupName">
|
|
|
<el-input
|
|
|
- v-model="addForm.ownerDeptName"
|
|
|
+ v-model="addForm.ownershipGroupName"
|
|
|
placeholder="选择设备带出"
|
|
|
disabled
|
|
|
></el-input>
|
|
|
@@ -35,18 +35,18 @@
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="设备名称:" prop="equiName">
|
|
|
+ <el-form-item label="设备名称:" prop="name">
|
|
|
<el-input
|
|
|
- v-model="addForm.equiName"
|
|
|
+ v-model="addForm.name"
|
|
|
placeholder="选择设备带出"
|
|
|
disabled
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="权属人:" prop="ownerName">
|
|
|
+ <el-form-item label="权属人:" prop="ownershipUserName">
|
|
|
<el-input
|
|
|
- v-model="deviceData.ownerName"
|
|
|
+ v-model="addForm.ownershipUserName"
|
|
|
placeholder="选择设备带出"
|
|
|
disabled
|
|
|
></el-input>
|
|
|
@@ -55,18 +55,18 @@
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="固定资产编码:" prop="fixedAssetCode">
|
|
|
+ <el-form-item label="固定资产编码:" prop="fixCode">
|
|
|
<el-input
|
|
|
- v-model="addForm.fixedAssetCode"
|
|
|
+ v-model="addForm.fixCode"
|
|
|
placeholder="选择设备带出"
|
|
|
disabled
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="权属人电话:" prop="ownerPhone">
|
|
|
+ <el-form-item label="权属人电话:" prop="ownershipUserMobile">
|
|
|
<el-input
|
|
|
- v-model="deviceData.ownerPhone"
|
|
|
+ v-model="addForm.ownershipUserMobile"
|
|
|
placeholder="选择设备带出"
|
|
|
disabled
|
|
|
></el-input>
|
|
|
@@ -86,17 +86,27 @@
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="设备位置:" prop="equiLocation">
|
|
|
<el-input
|
|
|
- v-model="deviceData.equiLocation"
|
|
|
+ v-model="addForm.equiLocation"
|
|
|
placeholder="选择设备带出"
|
|
|
disabled
|
|
|
></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-row>
|
|
|
<el-row>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="接收人部门:" prop="recipient">
|
|
|
- <dept-select v-model="addForm.recipientdept" />
|
|
|
+ <el-form-item label="接收人部门:" prop="repairDeptId">
|
|
|
+ <dept-select v-model="addForm.repairDeptId" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
@@ -113,16 +123,16 @@
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="接收人:" prop="recipient">
|
|
|
- <person-select v-model="addForm.recipient" multiple clearable />
|
|
|
+ <el-form-item label="接收人:" prop="repairUserId">
|
|
|
+ <person-select v-model="addForm.repairUserId" clearable @change="changeUser"/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="24">
|
|
|
- <el-form-item label="故障描述:" prop="repairsDescription">
|
|
|
+ <el-form-item label="故障描述:" prop="remark">
|
|
|
<el-input
|
|
|
type="textarea"
|
|
|
:rows="3"
|
|
|
- v-model="addForm.repairsDescription"
|
|
|
+ v-model="addForm.remark"
|
|
|
placeholder="请输入故障描述"
|
|
|
resize="none"
|
|
|
maxlength="500"
|
|
|
@@ -130,17 +140,17 @@
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="24">
|
|
|
+<!-- <el-col :span="24">
|
|
|
<el-form-item label="图片:" prop="repairsImg">
|
|
|
- <!-- <SelectUpload
|
|
|
+ <SelectUpload
|
|
|
multiple
|
|
|
ref="selectUploadRef"
|
|
|
@getImgs="getImgs"
|
|
|
:limit="4"
|
|
|
:initData="initData"
|
|
|
- /> -->
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
- </el-col>
|
|
|
+ </el-col> -->
|
|
|
<!-- <el-col :span="24">
|
|
|
<el-form-item label="视频:" prop="repairsVideo"> </el-form-item>
|
|
|
</el-col> -->
|
|
|
@@ -148,13 +158,13 @@
|
|
|
</el-form>
|
|
|
</div>
|
|
|
<div class="btns">
|
|
|
- <el-button type="primary" @click="submitAdd">提交</el-button>
|
|
|
+ <el-button type="primary" @click="submitAdd" :loading="loading">提交</el-button>
|
|
|
<el-button @click="handleClose">关闭</el-button>
|
|
|
</div>
|
|
|
<CategoryDialog
|
|
|
ref="equipmentDialogRef"
|
|
|
@success="selectedEquipment"
|
|
|
- type="1"
|
|
|
+ :type="'1'"
|
|
|
/>
|
|
|
</el-dialog>
|
|
|
</template>
|
|
|
@@ -163,17 +173,15 @@
|
|
|
import CategoryDialog from '@/components/AssetDialog/categoryDialog';
|
|
|
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 { getUserPage } from '@/api/system/organization';
|
|
|
export default {
|
|
|
props: {
|
|
|
dialogTitle: {
|
|
|
type: String,
|
|
|
default: '新增报修记录'
|
|
|
},
|
|
|
- deviceInfo: {
|
|
|
- type: Object,
|
|
|
- default: {}
|
|
|
- },
|
|
|
infoData: {
|
|
|
type: Object,
|
|
|
default: {}
|
|
|
@@ -183,100 +191,42 @@
|
|
|
CategoryDialog,
|
|
|
DeptSelect,
|
|
|
PersonSelect
|
|
|
- // SelectUpload, selectTree
|
|
|
},
|
|
|
watch: {
|
|
|
infoData (val) {
|
|
|
- console.log('vall', val);
|
|
|
- this.selectedEquipment(val);
|
|
|
- // this.addForm = JSON.parse(JSON.stringify(val))
|
|
|
- // console.log(' this.addForm', this.addForm)
|
|
|
- if (val.repairsImg) {
|
|
|
- this.initData = val.repairsImg.split(',').map((item) => {
|
|
|
- return {
|
|
|
- name: item.substring('/download/'.length),
|
|
|
- url: item
|
|
|
- };
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- if (val.receiveUser) {
|
|
|
- const recipient = JSON.parse(val.receiveUser).map((item) => {
|
|
|
- return item.receiveUserId + ',' + item.receiveUserName;
|
|
|
- });
|
|
|
- this.$set(this.addForm, 'recipient', recipient);
|
|
|
- }
|
|
|
-
|
|
|
- this.$set(this.addForm, 'expectedTime', val.expectedTime);
|
|
|
- this.$set(this.addForm, 'repairsDescription', val.repairsDescription);
|
|
|
- this.$nextTick(() => {
|
|
|
- this.recipientDep = val.repairsDeptCode;
|
|
|
- this.getUserList(this.recipientDep);
|
|
|
- });
|
|
|
+ let id = val.id
|
|
|
+ this.selectedEquipment(id);
|
|
|
},
|
|
|
- deviceInfo (val) {
|
|
|
- this.deviceData = val;
|
|
|
- }
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
|
addRepairNotesDialog: false,
|
|
|
- addForm: {
|
|
|
- // repairsCode: getRuleNo('BX'), // 报修记录编号
|
|
|
- equiCode: '', // 设备编码
|
|
|
- equiName: '', // 设备名称
|
|
|
- fixedAssetCode: '', // 固定资产编码
|
|
|
- equiModel: '', // 规格型号
|
|
|
- ownerDeptCode: '', // 权属部门code
|
|
|
- ownerDeptName: '', // 权属部门名称
|
|
|
- expectedTime: '', // 期望完成时间
|
|
|
- recipient: [], // 接收人集合
|
|
|
- repairsDescription: '', // 故障描述
|
|
|
- repairsImg: '' // 图片
|
|
|
- // repairsVideo: '' // 视频
|
|
|
- },
|
|
|
+ addForm: { },
|
|
|
initData: [],
|
|
|
- recipientDep: '', // 接收人部门
|
|
|
- deptName: '', //接收人部门名称
|
|
|
- recipientDepList: [], // 接收人部门列表
|
|
|
- recipientList: [], // 接收人
|
|
|
addFormRules: {},
|
|
|
- deviceData: {
|
|
|
- ownerName: '', // 权属人
|
|
|
- ownerPhone: '', // 权属部门电话
|
|
|
- equiLocation: '' // 设备位置
|
|
|
- }
|
|
|
+ loading:false,
|
|
|
+ row:null,
|
|
|
+ receiverList:[]
|
|
|
};
|
|
|
},
|
|
|
created () {
|
|
|
- // this.getrecipientDep()
|
|
|
+ this.getUserList()
|
|
|
},
|
|
|
methods: {
|
|
|
+ init(row){
|
|
|
+ this.addRepairNotesDialog = true;
|
|
|
+ this.row = row
|
|
|
+ if(row){
|
|
|
+ this.selectedEquipment(row.deviceId)
|
|
|
+ }else{
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
handleClose () {
|
|
|
- // this.$refs.selectUploadRef.clearUploadFiles()
|
|
|
this.initData = [];
|
|
|
this.addRepairNotesDialog = false;
|
|
|
- this.recipientDep = '';
|
|
|
- this.addForm = {
|
|
|
- // repairsCode: getRuleNo('BX'), // 报修记录编号
|
|
|
- equiTypeId: '', // 设备分类ID
|
|
|
- equiTypeName: '', // 设备分类名称
|
|
|
- equiCode: '', // 设备编码
|
|
|
- equiName: '', // 设备名称
|
|
|
- fixedAssetCode: '', // 固定资产编码
|
|
|
- equiModel: '', // 规格型号
|
|
|
- ownerDeptCode: '', // 权属部门code
|
|
|
- ownerDeptName: '', // 权属部门名称
|
|
|
- expectedTime: '', // 期望完成时间
|
|
|
- repairsDescription: '', // 故障描述
|
|
|
- repairsImg: '' // 图片
|
|
|
- // repairsVideo: '' // 视频
|
|
|
- };
|
|
|
- this.deviceData = {
|
|
|
- ownerName: '', // 权属人
|
|
|
- ownerPhone: '', // 权属人电话
|
|
|
- equiLocation: '' // 设备位置
|
|
|
- };
|
|
|
+ this.addForm = {}
|
|
|
},
|
|
|
// 打开选择设备弹窗
|
|
|
selectEquipment () {
|
|
|
@@ -289,120 +239,87 @@
|
|
|
},
|
|
|
|
|
|
// 获取接收人列表
|
|
|
- getUserList (deptCode) {
|
|
|
- let par = {
|
|
|
- deptCode,
|
|
|
- page: 1,
|
|
|
- size: 999999
|
|
|
- };
|
|
|
- geUserlist(par).then((res) => {
|
|
|
- this.recipientList = res.data.items;
|
|
|
- });
|
|
|
+ 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
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
|
|
|
// 选择的设备
|
|
|
- selectedEquipment (row) {
|
|
|
- // console.log('选择的设备信息',row)
|
|
|
- getNewinfo({ code: row.code }).then((res) => {
|
|
|
- if (res.success) {
|
|
|
- console.log('选择的设备信息res', res.data);
|
|
|
- let info = res.data.information;
|
|
|
- this.addForm.equiTypeId = res.data.assetType; // 设备分类id
|
|
|
- this.addForm.equiId = res.data.id; // 设备id
|
|
|
- this.addForm.equiName = res.data.assetName; // 设备名称
|
|
|
- this.addForm.equiCode = res.data.assetCode; // 设备编码
|
|
|
- this.addForm.fixedAssetCode = res.data.fixAssetCode; // 固定资产编码
|
|
|
- this.addForm.ownerDeptName = res.data.ownershipDeptName; // 权属部门名称
|
|
|
- this.deviceData.ownerPhone = res.data.ownershipUserMobile; // 权属人电话
|
|
|
- this.deviceData.ownerName = res.data.ownershipUserName; // 权属人
|
|
|
-
|
|
|
- const model = info.modelType ? info.modelType : '';
|
|
|
- const specification = info.specification
|
|
|
- ? info.specification + '|'
|
|
|
- : info.modelType
|
|
|
- ? '|'
|
|
|
- : '';
|
|
|
- this.addForm.equiModel = specification + model; // 规格型号
|
|
|
-
|
|
|
- const factoryName = res.data.factoryName
|
|
|
- ? res.data.factoryName + '-'
|
|
|
- : '';
|
|
|
- const workshopName = res.data.workshopName
|
|
|
- ? res.data.workshopName + '-'
|
|
|
- : '';
|
|
|
- const lineName = res.data.lineName ? res.data.lineName + '-' : '';
|
|
|
- const detailLocation = res.data.detailLocation
|
|
|
- ? res.data.detailLocation
|
|
|
- : '';
|
|
|
- this.deviceData.equiLocation =
|
|
|
- factoryName + workshopName + lineName + detailLocation; // 设备位置
|
|
|
- }
|
|
|
+ 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['equiTypeName'] = row.equiTypeName // 设备分类名称
|
|
|
- // this.deviceData.equiLocation = row.positionFarm // 设备位置
|
|
|
},
|
|
|
// 提交新增
|
|
|
- submitAdd () {
|
|
|
- if (!this.addForm.equiCode) {
|
|
|
+ submitAdd () {
|
|
|
+ if (!this.addForm.code) {
|
|
|
return this.$message.warning('请选择报修设备!');
|
|
|
}
|
|
|
- let msg = '新增成功!';
|
|
|
- // 编辑
|
|
|
- if (this.addForm.id) {
|
|
|
- delete this.addForm.repairInfoLogs;
|
|
|
- msg = '修改成功!';
|
|
|
- }
|
|
|
- if (this.addForm.recipient) {
|
|
|
- this.addForm['receiveUserList'] = this.addForm.recipient.map(
|
|
|
- (item) => {
|
|
|
- return {
|
|
|
- receiveUserId: item.split(',')[0],
|
|
|
- receiveUserName: item.split(',')[1],
|
|
|
- deptName: this.deptName
|
|
|
- };
|
|
|
- }
|
|
|
- );
|
|
|
- }
|
|
|
- let form = JSON.parse(JSON.stringify(this.addForm));
|
|
|
-
|
|
|
- if (this.infoData.id) {
|
|
|
- form.id = this.infoData.id;
|
|
|
- }
|
|
|
- delete form.recipient;
|
|
|
- delete form.receiveUser;
|
|
|
- delete form.source;
|
|
|
- delete form.sourceCode;
|
|
|
- form.ownerPhone = this.deviceData.ownerPhone;
|
|
|
- form.ownerPhone = this.deviceData.ownerName;
|
|
|
- form.equiLocation = this.deviceData.equiLocation;
|
|
|
- repair
|
|
|
- .saveOrEditInfo(form)
|
|
|
- .then((res) => {
|
|
|
- this.handleClose();
|
|
|
- this.$message.success(msg);
|
|
|
- this.$emit('refresh');
|
|
|
- })
|
|
|
- .catch(() => {});
|
|
|
- },
|
|
|
- // 获取接收人部门
|
|
|
- getrecipientDep () {
|
|
|
- geDeptTree().then((res) => {
|
|
|
- console.log('asdasd', res);
|
|
|
- this.recipientDepList = res.data;
|
|
|
- });
|
|
|
- },
|
|
|
- nodeClick (info) {
|
|
|
- //部门
|
|
|
- this.recipientDep = info.code;
|
|
|
- this.deptName = info.name;
|
|
|
- this.getUserList(this.recipientDep);
|
|
|
+ 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;
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
- // 如果没先选接受部门,则提示
|
|
|
- focusRecipient () {
|
|
|
- if (!this.recipientDep) {
|
|
|
- this.$message.warning('请选择接收人部门');
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
};
|
|
|
</script>
|