|
|
@@ -129,13 +129,13 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
|
- <el-form-item label="用途:" prop="purpose">
|
|
|
+ <el-form-item label="用途:">
|
|
|
<el-input v-model="form.purpose" type="textarea" :rows="2" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<!-- 配件信息 -->
|
|
|
- <spareInfo ref="spareInfoRef" />
|
|
|
+ <spareInfo ref="spareInfoRef" :detailList="detailList" v-if="addRepairNotesDialog" />
|
|
|
</el-form>
|
|
|
<workOrderList ref="workOrderListRef" @changeSelect="changeSelect" />
|
|
|
<div slot="footer" class="footer">
|
|
|
@@ -150,6 +150,8 @@ import deptSelect from '@/components/CommomSelect/dept-select.vue';
|
|
|
import workOrderList from './workOrderList.vue';
|
|
|
import spareInfo from './spareInfo.vue';
|
|
|
import { getUserPage } from '@/api/system/organization';
|
|
|
+import { accessorySave } from '@/api/salesServiceManagement/index';
|
|
|
+
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -158,7 +160,8 @@ export default {
|
|
|
type: 'add',
|
|
|
form: {},
|
|
|
loginChangeRoleVOList: [],
|
|
|
- executorList: [] // 执行人列表
|
|
|
+ executorList: [], // 执行人列表
|
|
|
+ detailList:[],
|
|
|
};
|
|
|
},
|
|
|
components: { workOrderList, spareInfo, deptSelect },
|
|
|
@@ -170,17 +173,31 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
init(row, type) {
|
|
|
- let currentUser = JSON.parse(sessionStorage['currentUser']);
|
|
|
- this.form.receivingDeptId = currentUser.currentGroupId; // 部门id
|
|
|
- this.form.recipientId = currentUser.currentRoleId; // 领用人Id
|
|
|
this.roleVOListData();
|
|
|
this.addRepairNotesDialog = true;
|
|
|
this.type = type;
|
|
|
this.title = type == 'add' ? '新增' : type == 'view' ? '详情' : '修改';
|
|
|
if (row?.id) {
|
|
|
- this.getDetail(row.id);
|
|
|
+ this.getDetail(row);
|
|
|
+ } else {
|
|
|
+ let currentUser = JSON.parse(sessionStorage['currentUser']);
|
|
|
+ this.form.receivingDeptId = currentUser.currentGroupId; // 部门id
|
|
|
+ this.form.recipientId = currentUser.currentRoleId; // 领用人Id
|
|
|
+ // 下拉数据 name 赋值
|
|
|
+ this.echoData();
|
|
|
}
|
|
|
},
|
|
|
+ // 领用部门/领用人 name 赋值
|
|
|
+ echoData() {
|
|
|
+ const depObj = this.loginChangeGroupVOList.find(
|
|
|
+ (item) => item.groupId === this.form.receivingDeptId
|
|
|
+ );
|
|
|
+ const roleObj = this.loginChangeRoleVOList.find(
|
|
|
+ (item) => item.roleId === this.form.recipientId
|
|
|
+ );
|
|
|
+ this.form.receivingDeptName = depObj.groupName;
|
|
|
+ this.form.recipientName = roleObj.roleName;
|
|
|
+ },
|
|
|
// 选择工单
|
|
|
handHead() {
|
|
|
if (this.type != 'view') {
|
|
|
@@ -234,18 +251,38 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- getDetail(id) {},
|
|
|
+ getDetail(row) {
|
|
|
+ this.$set(this.form,'code',row.code);
|
|
|
+ this.$set(this.form,'name',row.name);
|
|
|
+ this.$set(this.form,'receivingDeptId',row.receivingDeptId);
|
|
|
+ this.$set(this.form,'recipientId',row.recipientId);
|
|
|
+ this.$set(this.form,'usageTime',row.usageTime);
|
|
|
+ this.$set(this.form,'useDeptId',row.useDeptId);
|
|
|
+ this.$set(this.form,'userId',row.userId);
|
|
|
+ this.$set(this.form,'purpose',row.purpose);
|
|
|
+ this.detailList = row.details
|
|
|
+ },
|
|
|
save() {
|
|
|
this.$refs.accessoryFormRef.validate(async (valid) => {
|
|
|
if (valid) {
|
|
|
-
|
|
|
- console.log(this.form,'00000');
|
|
|
+ let details = this.$refs.spareInfoRef.getSpareData() || [];
|
|
|
+ let data = {
|
|
|
+ ...this.form,
|
|
|
+ details
|
|
|
+ };
|
|
|
+ const res = await accessorySave(data);
|
|
|
+ if (res) {
|
|
|
+ this.$message.success('操作成功');
|
|
|
+ this.handleClose();
|
|
|
+ this.$emit('refresh');
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
handleClose() {
|
|
|
this.addRepairNotesDialog = false;
|
|
|
this.form = {};
|
|
|
+ this.$refs.accessoryFormRef.resetFields();
|
|
|
}
|
|
|
}
|
|
|
};
|