|
|
@@ -106,7 +106,7 @@
|
|
|
<el-row>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="接收人部门:" prop="recipient">
|
|
|
-<!-- <selectTree
|
|
|
+ <!-- <selectTree
|
|
|
class="form-ipt"
|
|
|
style="width: 100%"
|
|
|
ref="tree"
|
|
|
@@ -169,7 +169,7 @@
|
|
|
</el-col>
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="图片:" prop="repairsImg">
|
|
|
- <!-- <SelectUpload
|
|
|
+ <!-- <SelectUpload
|
|
|
multiple
|
|
|
ref="selectUploadRef"
|
|
|
@getImgs="getImgs"
|
|
|
@@ -188,267 +188,267 @@
|
|
|
<el-button type="primary" size="small" @click="submitAdd">提交</el-button>
|
|
|
<el-button size="small" @click="handleClose">关闭</el-button>
|
|
|
</div>
|
|
|
- <EquipmentDialog ref="equipmentDialogRef" @submit="selectedEquipment" />
|
|
|
+ <CategoryDialog
|
|
|
+ ref="equipmentDialogRef"
|
|
|
+ @success="selectedEquipment"
|
|
|
+ type="1"
|
|
|
+ />
|
|
|
</el-dialog>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-// import repair from '@/api/maintenance/repair/repair'
|
|
|
-// import { geDeptTree, geUserlist } from '@/api/maintenance/repair/repair'
|
|
|
-import EquipmentDialog from './EquipmentDialog.vue'
|
|
|
-// import SelectUpload from '@/components/selectUpload'
|
|
|
-// import { getRuleNo } from '@/utils'
|
|
|
-// import selectTree from '@/components/selectTree'
|
|
|
-// import user from '@/api/main/user'
|
|
|
-// import { getNewinfo } from '@/api/stockManagement/stocking'
|
|
|
+ import CategoryDialog from '@/components/AssetDialog/categoryDialog';
|
|
|
|
|
|
-export default {
|
|
|
- props: {
|
|
|
- dialogTitle: {
|
|
|
- type: String,
|
|
|
- default: '新增报修记录'
|
|
|
+ export default {
|
|
|
+ props: {
|
|
|
+ dialogTitle: {
|
|
|
+ type: String,
|
|
|
+ default: '新增报修记录'
|
|
|
+ },
|
|
|
+ deviceInfo: {
|
|
|
+ type: Object,
|
|
|
+ default: {}
|
|
|
+ },
|
|
|
+ infoData: {
|
|
|
+ type: Object,
|
|
|
+ default: {}
|
|
|
+ }
|
|
|
},
|
|
|
- deviceInfo: {
|
|
|
- type: Object,
|
|
|
- default: {}
|
|
|
+ components: {
|
|
|
+ CategoryDialog
|
|
|
+ // SelectUpload, selectTree
|
|
|
},
|
|
|
- infoData: {
|
|
|
- type: Object,
|
|
|
- default: {}
|
|
|
- }
|
|
|
- },
|
|
|
- components: { EquipmentDialog,
|
|
|
- // 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
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
+ 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)
|
|
|
- }
|
|
|
+ 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)
|
|
|
- })
|
|
|
- },
|
|
|
- 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: '' // 视频
|
|
|
+ this.$set(this.addForm, 'expectedTime', val.expectedTime);
|
|
|
+ this.$set(this.addForm, 'repairsDescription', val.repairsDescription);
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.recipientDep = val.repairsDeptCode;
|
|
|
+ this.getUserList(this.recipientDep);
|
|
|
+ });
|
|
|
},
|
|
|
- initData: [],
|
|
|
- recipientDep: '', // 接收人部门
|
|
|
- deptName: '', //接收人部门名称
|
|
|
- recipientDepList: [], // 接收人部门列表
|
|
|
- recipientList: [], // 接收人
|
|
|
- addFormRules: {},
|
|
|
- deviceData: {
|
|
|
- ownerName: '', // 权属人
|
|
|
- ownerPhone: '', // 权属部门电话
|
|
|
- equiLocation: '' // 设备位置
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- created () {
|
|
|
- // this.getrecipientDep()
|
|
|
- },
|
|
|
- methods: {
|
|
|
- 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: '' // 设备位置
|
|
|
+ deviceInfo (val) {
|
|
|
+ this.deviceData = val;
|
|
|
}
|
|
|
},
|
|
|
- // 打开选择设备弹窗
|
|
|
- selectEquipment () {
|
|
|
- this.$refs.equipmentDialogRef.equipmentdialog = true
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ addRepairNotesDialog: false,
|
|
|
+ addForm: {
|
|
|
+ // repairsCode: getRuleNo('BX'), // 报修记录编号
|
|
|
+ equiCode: '', // 设备编码
|
|
|
+ equiName: '', // 设备名称
|
|
|
+ fixedAssetCode: '', // 固定资产编码
|
|
|
+ equiModel: '', // 规格型号
|
|
|
+ ownerDeptCode: '', // 权属部门code
|
|
|
+ ownerDeptName: '', // 权属部门名称
|
|
|
+ expectedTime: '', // 期望完成时间
|
|
|
+ recipient: [], // 接收人集合
|
|
|
+ repairsDescription: '', // 故障描述
|
|
|
+ repairsImg: '' // 图片
|
|
|
+ // repairsVideo: '' // 视频
|
|
|
+ },
|
|
|
+ initData: [],
|
|
|
+ recipientDep: '', // 接收人部门
|
|
|
+ deptName: '', //接收人部门名称
|
|
|
+ recipientDepList: [], // 接收人部门列表
|
|
|
+ recipientList: [], // 接收人
|
|
|
+ addFormRules: {},
|
|
|
+ deviceData: {
|
|
|
+ ownerName: '', // 权属人
|
|
|
+ ownerPhone: '', // 权属部门电话
|
|
|
+ equiLocation: '' // 设备位置
|
|
|
+ }
|
|
|
+ };
|
|
|
},
|
|
|
- // 上传图片
|
|
|
- getImgs (list) {
|
|
|
- this.addForm.repairsImg = list.map(item => item.accessUrl).join(',')
|
|
|
- console.log('上传的图片:', this.addForm.repairsImg)
|
|
|
+ created () {
|
|
|
+ // this.getrecipientDep()
|
|
|
},
|
|
|
+ methods: {
|
|
|
+ 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: '' // 设备位置
|
|
|
+ };
|
|
|
+ },
|
|
|
+ // 打开选择设备弹窗
|
|
|
+ selectEquipment () {
|
|
|
+ this.$refs.equipmentDialogRef.open();
|
|
|
+ },
|
|
|
+ // 上传图片
|
|
|
+ getImgs (list) {
|
|
|
+ this.addForm.repairsImg = list.map((item) => item.accessUrl).join(',');
|
|
|
+ console.log('上传的图片:', this.addForm.repairsImg);
|
|
|
+ },
|
|
|
|
|
|
- // 获取接收人列表
|
|
|
- getUserList (deptCode) {
|
|
|
- let par = {
|
|
|
- deptCode,
|
|
|
- page: 1,
|
|
|
- size: 999999
|
|
|
- }
|
|
|
- geUserlist(par).then(res => {
|
|
|
- this.recipientList = res.data.items
|
|
|
- })
|
|
|
- },
|
|
|
+ // 获取接收人列表
|
|
|
+ getUserList (deptCode) {
|
|
|
+ let par = {
|
|
|
+ deptCode,
|
|
|
+ page: 1,
|
|
|
+ size: 999999
|
|
|
+ };
|
|
|
+ geUserlist(par).then((res) => {
|
|
|
+ this.recipientList = res.data.items;
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
- // 选择的设备
|
|
|
- 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 // 权属人
|
|
|
+ // 选择的设备
|
|
|
+ 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 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 // 设备位置
|
|
|
- }
|
|
|
- })
|
|
|
- // this.addForm['equiTypeName'] = row.equiTypeName // 设备分类名称
|
|
|
- // this.deviceData.equiLocation = row.positionFarm // 设备位置
|
|
|
- },
|
|
|
- // 提交新增
|
|
|
- submitAdd () {
|
|
|
- if (!this.addForm.equiCode) {
|
|
|
- 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
|
|
|
+ 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; // 设备位置
|
|
|
}
|
|
|
- })
|
|
|
- }
|
|
|
- let form = JSON.parse(JSON.stringify(this.addForm))
|
|
|
+ });
|
|
|
+ // this.addForm['equiTypeName'] = row.equiTypeName // 设备分类名称
|
|
|
+ // this.deviceData.equiLocation = row.positionFarm // 设备位置
|
|
|
+ },
|
|
|
+ // 提交新增
|
|
|
+ submitAdd () {
|
|
|
+ if (!this.addForm.equiCode) {
|
|
|
+ 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)
|
|
|
- },
|
|
|
- // 如果没先选接受部门,则提示
|
|
|
- focusRecipient () {
|
|
|
- if (!this.recipientDep) {
|
|
|
- this.$message.warning('请选择接收人部门')
|
|
|
+ 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);
|
|
|
+ },
|
|
|
+ // 如果没先选接受部门,则提示
|
|
|
+ focusRecipient () {
|
|
|
+ if (!this.recipientDep) {
|
|
|
+ this.$message.warning('请选择接收人部门');
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
-}
|
|
|
+ };
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
-.dialog_top {
|
|
|
- display: flex;
|
|
|
- justify-content: space-between;
|
|
|
- align-items: center;
|
|
|
- margin-bottom: 10px;
|
|
|
-}
|
|
|
-.btns {
|
|
|
- text-align: right;
|
|
|
- margin: 10px 0;
|
|
|
-}
|
|
|
+ .dialog_top {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ }
|
|
|
+ .btns {
|
|
|
+ text-align: right;
|
|
|
+ margin: 10px 0;
|
|
|
+ }
|
|
|
</style>
|