更新修改检测项目提成

This commit is contained in:
许允枞 2024-11-11 16:43:31 +08:00
parent c44da68d9c
commit a88664df4e
3 changed files with 282 additions and 26 deletions

View File

@ -90,8 +90,6 @@ export default {
if (res.data.projectRoyaltyList.length > 0){
this.tableData = res.data.projectRoyaltyList
console.log('tableData', this.tableData)
}else {
this.getGoods()
}
this.title = "修改检测项目";
} finally {
@ -109,25 +107,6 @@ export default {
this.formLoading = true;
try {
const data = this.formData;
//
if (data.id) {
this.tableData.map(item => {
if (!item.royaltyAmount) {
item.royaltyAmount = 0
}else {
/*将royaltyAmount的单位转为分*/
item.royaltyAmount = item.royaltyAmount * 100
}
})
data.projectRoyaltyList = this.tableData
console.log('商品及提成', this.tableData)
await DlInspectionProjectApi.updateDlInspectionProject(data);
this.$modal.msgSuccess("修改成功");
this.dialogVisible = false;
this.$emit('success');
return;
}
this.tableData.map(item => {
item.goodsId = item.id
/*如果royaltyAmount 为空则设置为0*/
@ -140,6 +119,15 @@ export default {
delete item.id
})
data.projectRoyaltyList = this.tableData
//
if (data.id) {
console.log('商品及提成', this.tableData)
await DlInspectionProjectApi.updateDlInspectionProject(data);
this.$modal.msgSuccess("修改成功");
this.dialogVisible = false;
this.$emit('success');
return;
}
console.log('商品及提成', this.tableData)
//
await DlInspectionProjectApi.createDlInspectionProject(data);

View File

@ -143,3 +143,20 @@ export function detail(params) {
params: params
})
}
export function getINspectionProject(params) {
return request({
url: '/inspection/dl-inspection-project/page',
method: 'get',
params: {
pageNo:1,
pageSize:10000
}
})
}
export function getWeorkNodesById(params) {
return request({
url: '/system/info/getWeorkNodesById',
method: 'get',
params: params
})
}

View File

@ -367,6 +367,44 @@
></el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="请选择检测项目">-->
<!-- 可选检测项目 -->
<div v-if="isInsert">
<div class="available-projects-title">可选检测项目</div>
<div class="available-projects-container">
<div
class="project-button"
:class="{ 'selected' : selectInspectionProjectIds.includes(item.id) }"
v-for="item in projectList"
:key="item.id"
@click="clickProject(item)"
>
{{ item.projectName }}
</div>
</div>
<!-- 已选检测项目标题 -->
<div class="selected-projects-title">已选检测项目</div>
<!-- 已选项目列表 -->
<div class="inspection-project-list">
<div class="project-item" v-for="(item, index) in selectInspectionProject" :key="index">
<div class="steps_">
<div class="index_2">{{ index + 1 }}</div>
<div class="project-name">{{ item.projectName }}</div>
</div>
<div class="arrow" v-if="index !== selectInspectionProject.length - 1">
<span></span>
</div>
</div>
</div>
</div>
<!-- </el-form-item>-->
</el-form>
@ -380,9 +418,24 @@
<script>
import {
listWorkOrder, workOrderData, listGoods, addWorkInfo, getWorker, shopInfo, settleAccounts,
workOrderView, inspectionDetail, offlineCharging,
getBankAccountList, makeCertOk, stopInspection, updateWorkInfo, delWorkInfo, detail
listWorkOrder,
workOrderData,
listGoods,
addWorkInfo,
getWorker,
shopInfo,
settleAccounts,
workOrderView,
inspectionDetail,
offlineCharging,
getBankAccountList,
makeCertOk,
stopInspection,
updateWorkInfo,
delWorkInfo,
detail,
getINspectionProject,
getWeorkNodesById
} from "./api/workOrder";
import {getCustomerSource} from "./api/index";
import print from 'vue-print-nb'
@ -403,6 +456,7 @@ export default {
payMoneySum: 0,
goodsPriceSum: 0
},
projectList:[],
isPass: 1,
isRetrial: '',
remark: '',
@ -459,6 +513,10 @@ export default {
openhe: false,
htmlStr: null,
detailForm: [],
selectInspectionProject:[],
inspectionWorkNodeStr:[],
selectInspectionProjectIds:[],
isInsert: false,
//
queryParams: {
pageNum: 1,
@ -532,6 +590,19 @@ export default {
this.getList()
})
},
clickProject(data) {
let idx = this.selectInspectionProjectIds.indexOf(data.id)
if (idx > -1) {
// 使splice
this.selectInspectionProject.splice(idx, 1);
this.selectInspectionProjectIds.splice(idx, 1)
} else {
this.selectInspectionProject.push(data)
this.selectInspectionProjectIds.push(data.id)
}
console.log('已选择的检测项目', this.selectInspectionProject)
},
jieshu(row) {
this.inspectionId = row.id
@ -540,6 +611,14 @@ export default {
this.remark = "",
this.openhe = true
},
/*获取检测项目*/
getINspectionProject() {
this.selectInspectionProject = []
getINspectionProject().then(res => {
console.log('检测项目', res)
this.projectList = res.data.records
})
},
zhizheng(row) {
console.log(row)
let data = {
@ -704,6 +783,7 @@ export default {
updateTime: null,
updateBy: null,
};
this.selectInspectionProject = []
this.resetForm("form");
},
@ -727,6 +807,8 @@ export default {
},
/** 新增按钮操作 */
handleAdd() {
this.getINspectionProject()
this.isInsert = true
listGoods().then(res => {
res.data.forEach(it => {
let temp = {}
@ -750,6 +832,7 @@ export default {
},
/** 修改按钮操作 */
handleUpdate(row) {
this.isInsert = false
this.reset();
this.form = row
let skuId = parseInt(row.skuId)
@ -772,7 +855,6 @@ export default {
})
console.log(this.options)
})
this.addOpen = true;
this.title = "工单";
},
@ -781,6 +863,18 @@ export default {
if (this.form.id) {
this.updateForm()
} else {
if (this.selectInspectionProject.length == 0) {
this.$modal.msgError("请选择项目")
}
for (var i = 0; i < this.selectInspectionProject.length; i++) {
this.selectInspectionProject[i].orderNum = i+1
this.selectInspectionProject[i].projectId = this.selectInspectionProject[i].id
this.selectInspectionProject[i].id = undefined
}
console.log('项目', this.selectInspectionProject)
this.form.inspectionWorkNodes = this.selectInspectionProject
console.log('最终提交的项目', this.form)
this.$refs["form"].validate(valid => {
if (valid) {
console.log(this.form.skuId[1])
@ -795,6 +889,16 @@ export default {
}
},
getWeorkNodesById(id){
const params = {
inspectionId: id
}
getWeorkNodesById(params).then(res => {
console.log('根据工单id获取流程', res)
this.selectInspectionProject = res.data
this.selectInspectionProjectIds = this.selectInspectionProject.map(it => it.projectId)
})
},
updateForm() {
this.$refs["form"].validate(valid => {
if (valid) {
@ -872,7 +976,10 @@ export default {
font-size: 22px;
font-weight: bold;
}
* 对话框整体样式 */
* 对话框整体样式 *
/
.custom-dialog {
border-radius: 8px;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
@ -909,4 +1016,148 @@ export default {
font-size: 14px;
color: #666;
}
.title_ {
font-weight: bold;
margin-bottom: 10px;
}
.box_ {
display: flex;
flex-wrap: wrap;
}
.box_button {
padding: 10px;
margin: 5px;
background-color: #f0f0f0;
cursor: pointer;
border: 1px solid #ccc;
}
.box_button_x {
background-color: #cce5ff;
border-color: #007bff;
}
.steps_ {
display: flex;
align-items: center;
}
.index_ {
margin-right: 10px;
font-size: 16px;
font-weight: bold;
}
.xb_ {
text-align: center;
font-size: 16px;
}
.steps_ {
display: flex;
align-items: center;
}.inspection-project-list {
display: flex;
flex-direction: column;
gap: 10px;
padding: 20px;
background-color: #f9f9f9;
border-radius: 10px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
.project-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 15px;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
transition: background-color 0.3s ease;
}
.project-item:hover {
background-color: #f1f1f1;
}
.steps_ {
display: flex;
align-items: center;
}
.index_2 {
font-size: 18px;
font-weight: bold;
margin-right: 10px;
color: #007BFF;
}
.project-name {
font-size: 16px;
color: #333;
text-transform: capitalize;
}
.arrow {
font-size: 18px;
color: #007BFF;
font-weight: bold;
}
/* 可选检测项目标题 */
.available-projects-title, .selected-projects-title {
font-size: 20px;
font-weight: bold;
color: #333;
margin-bottom: 10px;
padding-left: 20px;
border-left: 5px solid #007BFF;
padding-bottom: 5px;
}
/* 可选检测项目容器 */
.available-projects-container {
display: flex;
flex-wrap: wrap;
gap: 12px;
margin-bottom: 20px;
}
/* 每个按钮的样式 */
.project-button {
padding: 10px 15px;
background-color: #f0f0f0;
border-radius: 5px;
font-size: 16px;
color: #333;
cursor: pointer;
transition: background-color 0.3s ease, transform 0.2s ease;
display: inline-block;
white-space: nowrap;
}
.project-button:hover {
background-color: #007BFF;
color: white;
transform: scale(1.05);
}
/* 被选中的按钮样式 */
.project-button.selected {
background-color: #007BFF;
color: white;
font-weight: bold;
border: 2px solid #0056b3;
}
/* 可选检测项目容器的按钮排列 */
.available-projects-container {
display: flex;
flex-wrap: wrap;
gap: 12px;
}
</style>