Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
soss
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hooloo
web
soss
Commits
bdffa312
Commit
bdffa312
authored
Aug 21, 2022
by
赵永成
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
spec
parent
ee955bab
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
117 additions
and
37 deletions
+117
-37
src/views/goods/goods/components/SpecSetting.vue
+117
-37
No files found.
src/views/goods/goods/components/SpecSetting.vue
View file @
bdffa312
...
...
@@ -9,10 +9,10 @@
<el-row
v-for=
"(step,step_idx) in scope.row.tb_steps"
:key=
step_idx
style=
"margin-top:5px;"
>
<span>
{{
step
.
step_lab
}}
:
</span>
<el-cascader
:options=
"scope.row.step_opts"
v-model=
"step.step_akv"
style=
"margin-left:10px"
></el-cascader>
<el-cascader
:options=
"scope.row.step_opts"
v-model=
"step.step_akv"
style=
"margin-left:10px"
:disabled=
"step_btn_state('diabled',scope.row,step_idx)"
></el-cascader>
<el-button
@
click
.
prevent=
"spec_add_step(scope.row
)"
style=
"margin-left:10px"
>
增加步骤
</el-button>
<el-button
@
click
.
prevent=
"spec_add_step(scope.row
,step_idx)"
style=
"margin-left:10px"
:disabled=
"step_btn_state('disabled',scope.row,step_idx)"
>
增加步骤
</el-button>
<el-button
@
click
.
prevent=
"spec_del_step(scope.row,step_idx)"
style=
"margin-left:10px"
:disabled=
"step_btn_state('diabled',scope.row,step_idx)"
v-if=
"step_btn_show('del',scope.row,step_idx)"
>
删除步骤
</el-button>
</el-row>
</el-form>
</
template
>
...
...
@@ -26,9 +26,9 @@
<el-table-column
label=
"操作"
>
<
template
slot-scope=
"scope"
>
<el-button
@
click=
"specal_opt(scope.$index,scope.row,'view_step')"
type=
"text"
size=
"small"
>
查看步骤
</el-button>
<el-button
@
click
.
native
.
prevent=
"specal_opt(scope.$index,scope.row,'
save')"
type=
"text"
size=
"small"
>
保存
</el-button>
<el-button
@
click
.
native
.
prevent=
"specal_opt(scope.$index,scope.row,'del')"
type=
"text"
size=
"small"
>
删除
</el-button>
<el-button
@
click
.
native
.
prevent=
"specal_opt(scope.$index,scope.row,'restore')"
type=
"text"
size=
"small"
>
恢复
</el-button>
<el-button
@
click
.
native
.
prevent=
"specal_opt(scope.$index,scope.row,'
edit')"
type=
"text"
size=
"small"
>
{{
scope
.
row
.
btnName
}}
</el-button>
<el-button
@
click
.
native
.
prevent=
"specal_opt(scope.$index,scope.row,'del')"
type=
"text"
size=
"small"
>
删除
全部步骤
</el-button>
</
template
>
</el-table-column>
</el-table>
...
...
@@ -49,6 +49,7 @@ export default {
return
{
open
:
false
,
goods
:{},
crowext
:
false
,
special_tb_data
:[],
...
...
@@ -148,6 +149,9 @@ export default {
sku_spec_model
.
mach_mode
=
mach_mode
;
sku_spec_model
.
sku
=
skuObj
;
sku_spec_model
.
btnName
=
"编辑"
sku_spec_model
.
currOptTag
=
'view'
;
t_special_tb_data
.
push
(
sku_spec_model
);
}
}
...
...
@@ -211,7 +215,16 @@ export default {
},
closeSpecial
(
tag
){
//检查有需要保存的项未提交,则提示是否确定关闭
//TODO
if
(
tag
==
'confim'
){
for
(
let
i
=
0
;
i
<
this
.
special_tb_data
.
length
;
i
++
){
let
item
=
this
.
special_tb_data
[
i
];
if
(
item
.
currOptTag
==
'edit'
){
this
.
$modal
.
msgWarning
(
"第"
+
(
i
+
1
)
+
"行步骤编辑后未保存"
);
return
;
}
}
}
this
.
open
=
false
;
},
openSpecial
(
tag
){
...
...
@@ -281,7 +294,7 @@ export default {
console
.
log
(
"initStepData step_data"
,
step_data
);
let
tb_steps
=
tb_data
.
tb_steps
;
console
.
log
(
"initStepData tb_steps"
,
tb_steps
);
//如果返回的步骤有数据,
则情况初始化默认的一个步骤,将回显步骤赋值
//如果返回的步骤有数据,
将回显步骤赋值,如果没数据则初始化默认的第一个步骤,
if
(
step_data
&&
step_data
.
length
>
0
){
tb_steps
=
[];
...
...
@@ -313,14 +326,21 @@ export default {
console
.
log
(
"click view step"
);
}
if
(
tag
==
"save"
){
console
.
log
(
"special_tb_data"
,
this
.
special_tb_data
);
this
.
spec_step_save
(
prow
);
}
if
(
tag
==
"del"
){
this
.
spec_step_del
(
prow
);
}
if
(
tag
==
"edit"
){
console
.
log
(
"prow edit "
,
prow
);
if
(
prow
.
currOptTag
==
'view'
){
prow
.
btnName
=
"保存"
;
prow
.
currOptTag
=
"edit"
;
}
else
if
(
prow
.
currOptTag
==
'edit'
){
this
.
spec_step_save
(
prow
);
}
}
},
specal_tb_row_click
(
r
,
c
,
e
){
...
...
@@ -330,13 +350,46 @@ export default {
// });
// console.log("spec_mach_step_list",2)
},
spec_add_step
(
prow
){
let
step_i
=
prow
.
tb_steps
.
length
+
1
prow
.
tb_steps
.
push
({
spec_add_step
(
prow
,
pidx
){
let
step_i
=
pidx
+
1
+
1
let
tObj
=
{
"step_lab"
:
"步骤"
+
step_i
,
"step_akv"
:[]
}
);
//在当前索引下方插入一条数据
prow
.
tb_steps
.
splice
(
pidx
+
1
,
0
,
tObj
);
this
.
step_sort
(
prow
.
tb_steps
);
},
spec_del_step
(
prow
,
pidx
){
prow
.
tb_steps
.
splice
(
pidx
,
1
);
this
.
step_sort
(
prow
.
tb_steps
);
},
//增加或删除后,将步骤标签重新排序
step_sort
(
psteps
){
for
(
let
i
=
0
;
i
<
psteps
.
length
;
i
++
){
let
pstep
=
psteps
[
i
];
pstep
.
step_lab
=
"步骤"
+
(
i
+
1
)
}
},
step_btn_show
(
btag
,
prow
,
pidx
){
//删除按钮 如果是第一行则不可见
if
(
btag
==
'del'
){
if
(
pidx
==
0
){
return
false
;
}
else
{
return
true
;
}
}
return
true
;
},
step_btn_state
(
btag
,
prow
,
pidx
){
//按钮默认是不可用状态,根据每行是否点击了编辑按钮 ,disabled=false可编辑,=true禁用
if
(
prow
.
currOptTag
==
'edit'
){
return
false
;
}
return
true
;
},
/**获取机型列表 */
spec_mach_model_list
(){
...
...
@@ -349,17 +402,31 @@ export default {
},
/**保存步骤 */
spec_step_save
(
prow
){
// {
// "sku_id": 1,
// "risc_id": 1,
// "risc_code": 1,
// "risc_desc": "取杯",
// "turn": 1,
// "model_id": 1,
// "result": 1
// }
let
step_ary
=
[];
console
.
log
(
"spec_step_save"
,
prow
);
//如果步骤数据没有,提示没有编辑,最少一步。
let
t_steps
=
prow
.
tb_steps
;
if
(
t_steps
.
length
==
0
){
this
.
$modal
.
msgWarning
(
"未编辑步骤信息"
);
return
;
}
//先检查所有步骤是否有值,没有值则提示后不处理。
for
(
let
i
=
0
;
i
<
t_steps
.
length
;
i
++
){
let
t_step
=
t_steps
[
i
];
if
(
t_step
.
step_akv
.
length
==
0
){
this
.
$modal
.
msgWarning
(
t_step
.
step_lab
+
"信息为空"
);
return
;
}
}
//如果步骤第一步不是取杯,则提示。
if
(
t_steps
[
0
].
step_akv
[
0
]
!=
1
){
this
.
$modal
.
msgWarning
(
"步骤1必须是取杯"
);
return
;
}
let
step_ary
=
[];
for
(
let
i
=
0
;
i
<
prow
.
tb_steps
.
length
;
i
++
){
let
step_obj
=
{}
let
t_step
=
prow
.
tb_steps
[
i
];
...
...
@@ -369,23 +436,36 @@ export default {
step_obj
=
this
.
fillStepById
(
step_obj
,
t_step
,
prow
);
step_ary
.
push
(
step_obj
);
}
console
.
log
(
"step_ary "
,
step_ary
);
//提交到后台
add_spec_step
(
step_ary
).
then
((
response
)
=>
{
this
.
$modal
.
confirm
(
'是否确认保存当前sku操作步骤?'
).
then
(
function
()
{
return
add_spec_step
(
step_ary
);
}).
then
((
response
)
=>
{
console
.
log
(
"response "
,
response
);
}).
catch
((
response
)
=>
{
console
.
log
(
"error "
,
response
);
});
//保存成功后将按钮还原,需要再次点击编辑才能保存
prow
.
currOptTag
=
"view"
;
prow
.
btnName
=
'编辑'
this
.
$modal
.
msgSuccess
(
"保存成功"
);
}).
catch
(()
=>
{
});
},
/**删除步骤 */
spec_step_del
(
prow
){
console
.
log
(
"prow "
,
prow
);
this
.
queryParams
=
{
sku_id
:
prow
.
sku_id
,
model_id
:
prow
.
model_id
};
//提交到后台
del_spec_step
(
this
.
queryParams
).
then
((
response
)
=>
{
let
t_queryParams
=
{
sku_id
:
prow
.
sku_id
,
model_id
:
prow
.
model_id
};
this
.
$modal
.
confirm
(
'是否确认删除当前sku操作步骤?'
).
then
(
function
()
{
return
del_spec_step
(
t_queryParams
);
}).
then
((
response
)
=>
{
console
.
log
(
"response del_spec_step"
,
response
);
//删除成功后将表格中对应步骤数据删除(没有从后台获取)
prow
.
tb_steps
=
[]
let
tObj
=
{
"step_lab"
:
"步骤"
+
1
,
"step_akv"
:[]
}
prow
.
tb_steps
.
push
(
tObj
);
this
.
$modal
.
msgSuccess
(
"删除成功"
);
}).
catch
((
response
)
=>
{
console
.
log
(
"error del_spec_step"
,
response
);
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment