Browse Source

物料客户

master
han\hanst 23 hours ago
parent
commit
acd31e2346
  1. 133
      src/views/modules/sampleTracking/projectProofTracking.vue

133
src/views/modules/sampleTracking/projectProofTracking.vue

@ -70,6 +70,8 @@
</el-form-item>
<el-form-item v-if="isRfidBuNo(searchData.buNo)" label="分类">
<el-select v-model="searchData.dryWetType" clearable placeholder="全部" style="width: 100px">
<!-- 查询专用值与清空筛选全部区分不加入新增/编辑选项 -->
<el-option label="空" value="__EMPTY__" />
<el-option v-for="item in dryWetTypeList" :key="`searchDryWet_${item}`" :label="item" :value="item" />
</el-select>
</el-form-item>
@ -631,15 +633,15 @@
<el-col :span="6" v-show="isOneKeyCreateFieldVisible('customerNo')">
<el-form-item>
<span slot="label" class="big-label">
<a href="javascript:void(0)" @click="getBaseList(509)">客户编码</a>
<a href="javascript:void(0)" @click="getBaseList(509)">{{ oneKeyDialogMode === 'create' ? '客户编码' : '项目客户编码' }}</a>
<a href="javascript:void(0)" @click="newCustomer">新客户</a>
</span>
<el-input v-model="oneKeyForm.customerNo" @blur="customerNoBlur" style="width: 100%"></el-input>
</el-form-item>
</el-col>
<el-col :span="12" v-show="isOneKeyCreateFieldVisible('customerDesc')">
<el-form-item label="客户名称">
<el-input v-model="oneKeyForm.customerDesc" :disabled="!isOneKeyDetailMode" style="width: 100%"></el-input>
<el-form-item :label="oneKeyDialogMode === 'create' ? '客户名称' : '项目客户名称'">
<el-input v-model="oneKeyForm.customerDesc" disabled style="width: 100%"></el-input>
</el-form-item>
</el-col>
<el-col :span="6" v-show="isOneKeyCreateFieldVisible('cProjectRegion')">
@ -656,6 +658,23 @@
</el-col>
</el-row>
<el-row v-if="oneKeyDialogMode !== 'create'" :gutter="16">
<el-col :span="6">
<el-form-item>
<span slot="label" class="big-label">
<a href="javascript:void(0)" @click="getBaseList(509, 'part')">物料客户编码</a>
<a href="javascript:void(0)" @click="newCustomer('part')">新客户</a>
</span>
<el-input v-model="oneKeyForm.partCustomerNo" @blur="customerNoBlur('part')" style="width: 100%"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物料客户名称">
<el-input v-model="oneKeyForm.partCustomerDesc" disabled style="width: 100%"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="16">
<el-col :span="6" v-show="isOneKeyCreateFieldVisible('projectCreationDate')">
<el-form-item label="立项日期">
@ -738,7 +757,7 @@
<el-col :span="6" v-show="isOneKeyCreateFieldVisible('projectManager')">
<el-form-item>
<span slot="label" class="big-label"><a href="javascript:void(0)" @click="openRoleDialog('projectManager')">PM/Sales</a></span>
<el-input v-model="oneKeyForm.projectManagerName" :disabled="!isOneKeyDetailMode" style="width: 100%"></el-input>
<el-input v-model="oneKeyForm.projectManagerName" disabled style="width: 100%"></el-input>
</el-form-item>
</el-col>
<el-col :span="6" v-show="isOneKeyCreateFieldVisible('projectOwner')">
@ -915,7 +934,7 @@
</el-col>
<el-col :span="6" v-show="isOneKeyCreateFieldVisible('importance')">
<el-form-item label="Importance">
<el-checkbox v-model="oneKeyForm.importance" true-label="Y" false-label="N" :disabled="isOneKeyDetailMode"></el-checkbox>
<el-checkbox v-model="oneKeyForm.importance" true-label="Y" false-label="N"></el-checkbox>
</el-form-item>
</el-col>
<el-col :span="6" v-show="isOneKeyCreateFieldVisible('pmInqueryTime')">
@ -951,7 +970,7 @@
</el-form>
<el-footer style="height: 40px; margin-top: 40px; text-align: center">
<el-button @click="oneKeyDialogVisible = false">{{ isOneKeyDetailMode ? '关闭' : '取消' }}</el-button>
<el-button v-if="!isOneKeyDetailMode" type="primary" :loading="saveOneKeyLoading" @click="submitOneKey">{{ oneKeyDialogMode === 'edit' ? '保存修改' : '保存' }}</el-button>
<el-button type="primary" :loading="saveOneKeyLoading" @click="submitOneKey">{{ oneKeyDialogMode === 'create' ? '保存' : '保存修改' }}</el-button>
</el-footer>
</el-dialog>
@ -1848,6 +1867,8 @@ export default {
oneKeyDialogVisible: false,
oneKeyDialogMode: 'create',
customerChooserScope: 'project',
newCustomerScope: 'project',
saveOneKeyLoading: false,
oneKeyForm: {},
oneKeyProofingApplyOptions: [],
@ -3911,14 +3932,22 @@ export default {
return []
})
},
newCustomer () {
getOneKeyCustomerFields (scope) {
return scope === 'part'
? { no: 'partCustomerNo', desc: 'partCustomerDesc' }
: { no: 'customerNo', desc: 'customerDesc' }
},
newCustomer (scope) {
this.newCustomerScope = scope === 'part' ? 'part' : 'project'
this.newCustomerData.customerDesc = ''
this.newCustomerFlag = true
},
getBaseList (val) {
getBaseList (val, scope) {
this.tagNo = val
this.customerChooserScope = scope === 'part' ? 'part' : 'project'
this.$nextTick(() => {
const strVal = val === 509 ? (this.oneKeyForm.customerNo || '') : ''
const fields = this.getOneKeyCustomerFields(this.customerChooserScope)
const strVal = val === 509 ? (this.oneKeyForm[fields.no] || '') : ''
this.$refs.baseList.init(val, strVal, '')
})
},
@ -3946,8 +3975,9 @@ export default {
},
getBaseData (val) {
if (this.tagNo === 509) {
this.oneKeyForm.customerNo = val.customer_no
this.oneKeyForm.customerDesc = val.customer_desc
const fields = this.getOneKeyCustomerFields(this.customerChooserScope)
this.oneKeyForm[fields.no] = val.customer_no
this.oneKeyForm[fields.desc] = val.customer_desc
return
}
// IQC/SQE/FQC2/IPQC-Hardtag/ NPI Chooselist
@ -3957,21 +3987,25 @@ export default {
}
this.setOneKeyRoleFieldValue(roleField, this.buildRoleValueFromChooserRow(val))
},
customerNoBlur () {
if (!this.oneKeyForm.customerNo) {
this.oneKeyForm.customerDesc = ''
customerNoBlur (scope) {
const fields = this.getOneKeyCustomerFields(scope)
const form = this.oneKeyForm
const customerNo = form[fields.no]
if (!customerNo) {
form[fields.desc] = ''
return
}
const params = {
customerNo: this.oneKeyForm.customerNo,
customerNo,
createBy: this.$store.state.user.name
}
queryCustomerList(params).then(({ data }) => {
if (data && data.code === 0 && data.rows && data.rows.length === 1) {
this.oneKeyForm.customerDesc = data.rows[0].customerDesc
} else {
this.oneKeyForm.customerDesc = ''
return queryCustomerList(params).then(({ data }) => {
//
if (this.oneKeyForm !== form || form[fields.no] !== customerNo) {
return
}
form[fields.desc] = data && data.code === 0 && data.rows && data.rows.length === 1
? data.rows[0].customerDesc : ''
})
},
saveNewCustomer () {
@ -3979,7 +4013,10 @@ export default {
this.$message.warning('请输入客户名称!')
return
}
this.generateNextCustomerNo().then(customerNo => {
const form = this.oneKeyForm
const fields = this.getOneKeyCustomerFields(this.newCustomerScope)
const customerDesc = this.newCustomerData.customerDesc
return this.generateNextCustomerNo().then(customerNo => {
if (!customerNo) {
this.$alert('该客户已存在,请重新输入客户名称!', '提示', {
confirmButtonText: '确定',
@ -3990,13 +4027,15 @@ export default {
const params = {
site: this.$store.state.user.site,
customerNo: customerNo,
customerDesc: this.newCustomerData.customerDesc,
customerDesc,
createBy: this.$store.state.user.name
}
saveNewCustomer(params).then(({ data }) => {
return saveNewCustomer(params).then(({ data }) => {
if (data && data.code === 0) {
this.oneKeyForm.customerNo = customerNo
this.oneKeyForm.customerDesc = this.newCustomerData.customerDesc
if (this.oneKeyForm === form) {
form[fields.no] = customerNo
form[fields.desc] = customerDesc
}
this.newCustomerFlag = false
this.$message.success(data.msg || '新增客户成功')
} else {
@ -5292,6 +5331,10 @@ export default {
}
this.oneKeyForm.testPartNo = partNo
this.oneKeyPartNoSnapshot = partNo
if (this.oneKeyDialogMode !== 'create') {
this.oneKeyForm.partCustomerNo = selectedPart.customerNo || ''
this.oneKeyForm.partCustomerDesc = selectedPart.customerDesc || ''
}
if (!this.isBlankValue(selectedPart.partDesc)) {
this.oneKeyForm.partDesc = String(selectedPart.partDesc).trim()
}
@ -5362,6 +5405,11 @@ export default {
}
inData.pmInqueryTime = this.isBlankValue(inData.pmInqueryTime) ? null : this.formatDate(inData.pmInqueryTime)
inData.importance = this.normalizeImportanceValue(inData.importance)
if (this.oneKeyDialogMode === 'create') {
//
delete inData.partCustomerNo
}
delete inData.partCustomerDesc
return inData
},
validateOneKeySubmitPayload (inData) {
@ -5384,7 +5432,7 @@ export default {
return false
}
}
if (this.oneKeyDialogMode === 'edit') {
if (this.oneKeyDialogMode === 'edit' || this.oneKeyDialogMode === 'detail') {
if (!inData.projectId || !inData.projectPartId || !inData.trackingId) {
this.$message.error('项目/物料/打样记录ID缺失,无法修改')
return false
@ -5432,8 +5480,11 @@ export default {
finalPartNo: part.finalPartNo || current.finalPartNo || '',
baseNo: part.baseNo || '',
revNo: part.revNo || '',
customerNo: project.customerNo || part.customerNo || current.customerNo || '',
customerDesc: project.customerDesc || current.customerDesc || '',
// 使退
customerNo: project.customerNo || '',
customerDesc: project.customerDesc || '',
partCustomerNo: part.customerNo || '',
partCustomerDesc: part.customerDesc || '',
finalCustomerId: project.finalCustomerId || '',
customerRemark: project.customerRemark || '',
parentProjectNo: project.parentProjectNo || '',
@ -5585,14 +5636,31 @@ export default {
this.saveOneKeyLoading = false
})
},
submitOneKey () {
async submitOneKey () {
if (this.saveOneKeyLoading) {
return
}
const inData = this.buildOneKeySubmitPayload()
if (!this.validateOneKeySubmitPayload(inData)) {
return
}
this.saveOneKeyLoading = true
if (this.oneKeyDialogMode === 'edit') {
oneKeyUpdateProofTracking(inData).then(({ data }) => {
// 使
if (this.oneKeyDialogMode === 'detail' ||
(this.oneKeyDialogMode === 'edit' && this.isProofingFinishedForTrackingStatus(this.oneKeyForm))) {
try {
await this.$confirm('打样已完成,是否确定修改?', '提示', {
confirmButtonText: '确定修改',
cancelButtonText: '取消',
type: 'warning'
})
} catch (e) {
this.saveOneKeyLoading = false
return
}
}
if (this.oneKeyDialogMode === 'edit' || this.oneKeyDialogMode === 'detail') {
return oneKeyUpdateProofTracking(inData).then(({ data }) => {
if (!data || data.code !== 0) {
throw new Error((data && data.msg) || '修改项目/物料/打样失败')
}
@ -5604,9 +5672,8 @@ export default {
}).finally(() => {
this.saveOneKeyLoading = false
})
return
}
oneKeyCreateProofTracking(inData).then(({ data }) => {
return oneKeyCreateProofTracking(inData).then(({ data }) => {
this.saveOneKeyLoading = false
if (data && data.code === 0) {
this.$message.success('一键创建成功')

Loading…
Cancel
Save