字段修改

This commit is contained in:
wcy 2024-09-06 15:35:16 +08:00
parent 42cc440727
commit fcfe1cdc40
7 changed files with 102 additions and 80 deletions

View File

@ -197,7 +197,16 @@ export function handleTree(data, id, parentId, children) {
adaptToChildrenList(c);
}
}
if (o.buyPrice !== undefined) {
o.buyPrice = formatBuyPrice(o.buyPrice);
}
}
function formatBuyPrice(price) {
if (price === undefined || price === null) return '';
return parseFloat(price).toFixed(2);
}
return tree;
}

View File

@ -97,24 +97,24 @@
:disabled="!isRequired"
></el-input>
</el-form-item>
<el-form-item
v-if="domain.partType == 1"
:prop="'premiumList.' + index + '.partCost'"
label="配件单价:"
:rules="{
required: false,
validator: meneyIntegerValidator,
trigger: 'blur',
}"
>
<el-input
v-model="domain.partCost"
placeholder="请输入"
size="small"
maxlength="10"
style="width: 350px"
></el-input>
</el-form-item>
<el-form-item
v-if="domain.partType == 1"
:prop="'premiumList.' + index + '.partCost'"
label="配件单价:"
:rules="{
required: false,
validator: meneyIntegerValidator,
trigger: 'blur',
}"
>
<el-input
v-model="domain.partCost"
placeholder="请输入"
size="small"
maxlength="10"
style="width: 350px"
></el-input>
</el-form-item>
<el-form-item
:prop="'premiumList.' + index + '.repairContent'"
label="维修内容:"
@ -265,24 +265,24 @@
:disabled="!isRequired"
></el-input>
</el-form-item>
<el-form-item
v-if="domain.partType == 1"
:prop="'premiumListTwo.' + index + '.partCost'"
label="配件单价:"
:rules="{
required: false,
validator: meneyIntegerValidator,
trigger: 'blur',
}"
>
<el-input
v-model="domain.partCost"
placeholder="请输入"
size="small"
maxlength="10"
style="width: 350px"
></el-input>
</el-form-item>
<!-- <el-form-item-->
<!-- v-if="domain.partType == 1"-->
<!-- :prop="'premiumListTwo.' + index + '.partCost'"-->
<!-- label="配件单价:"-->
<!-- :rules="{-->
<!-- required: false,-->
<!-- validator: meneyIntegerValidator,-->
<!-- trigger: 'blur',-->
<!-- }"-->
<!-- >-->
<!-- <el-input-->
<!-- v-model="domain.partCost"-->
<!-- placeholder="请输入"-->
<!-- size="small"-->
<!-- maxlength="10"-->
<!-- style="width: 350px"-->
<!-- ></el-input>-->
<!-- </el-form-item>-->
<el-form-item
:prop="'premiumListTwo.' + index + '.repairContent'"
label="维修内容:"
@ -585,6 +585,7 @@ export default {
this.index = null
this.$message.success('操作成功!')
this.$emit('domainChange', res.code)
}
})
.catch(() => {

View File

@ -252,19 +252,19 @@
trigger: 'blur',
}"
> -->
<el-form-item
v-if="domain.partType == 1"
label="配件单价(元)"
label-width="120px"
>
<el-input
v-model="domain.partPrice"
placeholder="请输入"
size="small"
maxlength="10"
style="width: 330px"
></el-input>
</el-form-item>
<!-- <el-form-item-->
<!-- v-if="domain.partType == 1"-->
<!-- label="配件单价(元)"-->
<!-- label-width="120px"-->
<!-- >-->
<!-- <el-input-->
<!-- v-model="domain.partPrice"-->
<!-- placeholder="请输入"-->
<!-- size="small"-->
<!-- maxlength="10"-->
<!-- style="width: 330px"-->
<!-- ></el-input>-->
<!-- </el-form-item>-->
<el-form-item
label="配件数量:"
:rules="{

View File

@ -108,7 +108,7 @@
></el-table-column>
<el-table-column
prop="buyPrice"
label="购置价格"
label="价格"
min-width="260"
></el-table-column>
<el-table-column
@ -472,7 +472,9 @@ export default {
// this.loading = true;
listPartType(this.queryParams)
.then((response) => {
console.log(this.deptList)
this.deptList = this.handleTree(response.data, 'paId')
console.log(this.deptList)
this.loading = false
})
.catch((err) => {
@ -544,7 +546,7 @@ export default {
handleUpdate(row) {
this.reset()
this.open = true
this.title = '修改部门'
this.title = '修改配件'
this.isEdit = true
this.initGetPartType(row)
},
@ -554,6 +556,11 @@ export default {
if (valid) {
if (this.form.paId != undefined) {
delete this.form.currentId
// buyPrice null
this.form.buyPrice = this.form.buyPrice ? Number(this.form.buyPrice) : null;
// num null
this.form.num = this.form.num ? Number(this.form.num) : null;
console.log(this.form)
updatePartTypeById(this.form).then((response) => {
this.$modal.msgSuccess('修改成功')
this.open = false
@ -641,6 +648,7 @@ export default {
this.form.currentId = row.parentId
},
async initGetPartType(row) {
console.log(row, '-----------------------')
const currentItem = this.getAllParentArr(
this.deptList,
row.parentId,

View File

@ -135,13 +135,13 @@
prop="buyPrice"
show-overflow-tooltip
/>
<el-table-column
label="丢失赔偿"
align="center"
key="payPrice"
prop="payPrice"
show-overflow-tooltip
/>
<!-- <el-table-column-->
<!-- label="丢失赔偿"-->
<!-- align="center"-->
<!-- key="payPrice"-->
<!-- prop="payPrice"-->
<!-- show-overflow-tooltip-->
<!-- />-->
<el-table-column
label="库管员"
align="center"
@ -360,7 +360,6 @@
<el-form-item label="内部租赁价" prop="leasePrice">
<el-input
v-model="form.leasePrice"
type="number"
placeholder="请输入租赁价格"
maxlength="10"
/>

View File

@ -75,7 +75,7 @@
:disable-branch-nodes="true"
placeholder="请选择机具类型"
@select="select"
:disabled="isDisabled"
:disabled="isDisabled "
style="width: 240px"
/>
</el-form-item>
@ -140,7 +140,7 @@
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
@click="handleDelete"
>删除</el-button>
</el-col>-->
<!-- <el-col :span="1.5">
@ -149,7 +149,7 @@
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
@click="handleExport"
>导出</el-button>
</el-col>-->
</el-row>
@ -358,9 +358,9 @@
>
</el-form-item>
<!-- <el-form-item label="验收图片" prop="checkUrl">
<el-upload
<el-upload
:http-request="(obj) => imgUpLoad(obj,'fileUrl')"
action="#"
action="#"
:file-list="fileList"
:show-file-list="false"
list-type="picture-card"
@ -616,21 +616,23 @@ export default {
},
/** 配件类型 */
getAccessoryTree() {
getAccessoryTree().then((response) => {
this.equipmentTypeList = response.data
this.equipmentTypeList.forEach((item, index) => {
if (item.children.length > 0) {
item.children.forEach((item2, index2) => {
if (item2.children.length > 0) {
item2.children.forEach((item3) => {
item3.machineTypeName = item2.label
item3.specificationType = item3.label
item3.partId = item3.id
// item3.purchasePrice = 1
// item3.purchaseNum = 1
this.$set(item3, 'purchasePrice', 0)
this.$set(item3, 'purchaseNum', 1)
})
getAccessoryTree().then((response) => {
this.equipmentTypeList = response.data;
this.equipmentTypeList.forEach((item, index) => {
// item.children
if (Array.isArray(item.children) && item.children.length > 0) {
item.children.forEach((item2, index2) => {
// item2.children
if (Array.isArray(item2.children) && item2.children.length > 0) {
item2.children.forEach((item3) => {
item3.machineTypeName = item2.label;
item3.specificationType = item3.label;
item3.partId = item3.id;
// 使 Vue $set
this.$set(item3, 'purchasePrice', 0);
this.$set(item3, 'purchaseNum', 1);
});
}
})
}
@ -647,6 +649,7 @@ export default {
break
}
}
this.$set(row, 'supplierId', '')
this.$set(row, 'purchasePrice', 0)
this.$set(row, 'purchaseNum', 1)
@ -676,6 +679,7 @@ export default {
this.maForm.taskId = this.taskId
this.maForm.partDetailsList = this.equipmentList
console.log(this.maForm)
if (isEmpty) {
if (this.equipmentList.length > 0) {

View File

@ -55,6 +55,7 @@ export default {
this.isDisabled = false
this.isCheck = false
this.isShow = true
this.isEdit = false
},
/* 查询配件 */
queryParts(taskId) {
@ -99,4 +100,4 @@ export default {
</script>
<style>
</style>
</style>