Commit eb0f9e5f by lixiaomin

修改机型

parent d0e3d7f6
......@@ -85,4 +85,13 @@ export function getMessageMoudle() {
});
}
// 赠送优惠券
export function giveCoupon(data) {
return request({
url: "/coupon-user/give",
method: "post",
data: data,
});
}
......@@ -35,6 +35,14 @@ export function addComponent(data) {
});
}
// 删除机型组件
export function delComponent(id,model_id) {
return request({
url: "/v1/del/model/component?id=" + id + "&model_id="+model_id,
method: "get"
});
}
// 新增机型组件属性
export function addComponentProperty(data) {
return request({
......@@ -45,6 +53,15 @@ export function addComponentProperty(data) {
}
// 机型组件属性列表
export function getComponentPropertyList(model_id,ros_code) {
return request({
url: "/v1/model/component/property?model_id=" + model_id + "&ros_code="+ros_code,
method: "get",
});
}
......
......@@ -523,7 +523,11 @@ export default {
this.form.times=[response.data.useStartTime,response.data.useEndTime];
this.form.relativeTime=response.data.relativeTime;
this.form.receivableTime=response.data.receivableTime;
this.form.weekLimit=response.data.weekLimit;
if(response.data.weekLimit[0]==0){
this.form.weekLimit=[];
}else{
this.form.weekLimit=response.data.weekLimit;
}
//短信通知
if(response.data.sendMsg){
this.form.sendMsgTag=1
......@@ -752,6 +756,9 @@ export default {
}else if(this.form.sendMsgTag==2){
this.form.sendMsg=false;
}
if(this.form.weekLimit.length==0){
this.form.weekLimit=[0]
}
console.log("this.form",this.form);
if (this.form.id != null) {
updateCoupon(this.form).then((response) => {
......
......@@ -49,7 +49,7 @@
<template slot-scope="scope">
<el-button size="mini" type="text" @click="handleEditDialog(scope.row)" v-show=!scope.row.isShow>编辑组件属性</el-button>
<el-button size="mini" type="text" @click="handleEnter(scope.$index, scope.row)" v-show=scope.row.isShow>确定</el-button>
<el-button size="mini" type="text" @click="handlDelete(scope.row)(scope.row)">删除</el-button>
<el-button size="mini" type="text" @click="handlDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
......@@ -69,10 +69,10 @@
<el-col :span="3"><div >组件属性:</div></el-col>
<el-col :span="21">
<el-row v-for="(item,idx) in comAry" :key="idx">
<el-col :span="4"><div ><el-input v-model="item.pro_name" placeholder="输入属性名"/></div></el-col>
<el-col :span="4"><div ><el-input v-model="item.pro_name" placeholder="输入属性名" clearable/></div></el-col>
<el-col :span="6">
<div>
<el-select v-model="item.type" placeholder="请选择属性类型">
<el-select v-model="item.type" placeholder="请选择属性类型" clearable>
<el-option
v-for="item in options"
:key="item.value"
......@@ -82,8 +82,8 @@
</el-select>
</div>
</el-col>
<el-col :span="4"><div ><el-input v-model="item.pro_ros_code" placeholder="ROS硬件编码"/></div></el-col>
<el-col :span="4"><div ><el-input v-model="item.desc" placeholder="备注描述"/></div></el-col>
<el-col :span="4"><div ><el-input v-model="item.pro_ros_code" placeholder="ROS硬件编码" clearable/></div></el-col>
<el-col :span="4"><div ><el-input v-model="item.desc" placeholder="备注描述" clearable/></div></el-col>
<el-col :span="1.5">
<el-button @click="addItem">+</el-button>
</el-col>
......@@ -102,7 +102,7 @@
</div>
</template>
<script>
import {getModelComponentList,getComponentList,addComponent,addComponentProperty} from "@/api/model/model";
import {getModelComponentList,getComponentList,addComponent,addComponentProperty,getComponentPropertyList,delComponent} from "@/api/model/model";
export default {
data() {
return {
......@@ -177,14 +177,23 @@ export default {
this.com_ros_code=row.ros_code;
this.comAry=[{pro_name:"",type:null,pro_ros_code:null,desc:""}],
this.editDiaLog=true;
this.getComponentPropertyList(row.model_id,row.ros_code);
},
comDiaLogCancel(){
this.comDiaLog=false
},
//编辑组件属性
editDiaLogCancel(){
var regular=/(^[+]{0,1}([0-9]+)$)/;
let hang=0;
for(let i=0;i<this.comAry.length;i++){
this.comAry[i].pro_ros_code=parseFloat(this.comAry[i].pro_ros_code);
if(!regular.test(this.comAry[i].pro_ros_code)){
hang=i+1;
this.$message.error('第'+hang+'行,ROS硬件编码,请输入大于0的正数');
return;
}else{
this.comAry[i].pro_ros_code=parseFloat(this.comAry[i].pro_ros_code);
}
}
let obj={
com_ros_code:this.com_ros_code,
......@@ -238,6 +247,20 @@ export default {
},
//提交组件
handleEnter(index,row){
if(row.type==""){
this.$message.error('请选择组件类型!');
return;
}
var regular=/(^[+]{0,1}([0-9]+)$)/;
if(row.ros_code==""){
this.$message.error('请选择输入ROS硬件编码!');
return;
}else{
if(!regular.test(row.ros_code)){
this.$message.error('ROS硬件编码,请输入大于0的正数');
return;
}
}
row.isShow = false;
let obj={
"model_id":this.modelId,
......@@ -253,6 +276,30 @@ export default {
this.getModelComponentList();
}
});
},
//获取组件属性列表
getComponentPropertyList(model_id,ros_code){
this.comAry=[];
getComponentPropertyList(model_id,ros_code).then((response) => {
if(response.code==0){
if(response.data.length>0){
for(let i=0;i<response.data.length;i++){
this.comAry.push({pro_name:response.data[i].pro_name,type:response.data[i].type,
pro_ros_code:response.data[i].pro_ros_code,desc:response.data[i].desc})
}
}else{
this.comAry=[{pro_name:"",type:null,pro_ros_code:null,desc:""}];
}
}
});
},
handlDelete(row){
delComponent(row.id,row.model_id).then((response) => {
if(response.code==0){
this.$modal.msgSuccess("删除组件成功!");
this.getModelComponentList();
}
});
}
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment