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
10bb6221
Commit
10bb6221
authored
Jul 31, 2022
by
赵永成
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Specification
parent
f57b897e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
141 additions
and
15 deletions
+141
-15
src/api/system/specification.js
+19
-0
src/views/goods/goods/components/Specification.vue
+117
-15
src/views/goods/goods/index.vue
+5
-0
No files found.
src/api/system/specification.js
View file @
10bb6221
...
...
@@ -26,3 +26,22 @@ export function add_spec_step(data) {
data
:
data
})
}
// 获取机型规格已保存的操作步骤列表
export
function
list_data_spec_step
(
query
)
{
return
request
({
url
:
'/v1/sku/model/risc/list'
,
method
:
'get'
,
params
:
query
})
}
// 获取机型规格已保存的操作步骤列表
export
function
del_spec_step
(
query
)
{
return
request
({
url
:
'/v1/del/sku/model/risc'
,
method
:
'get'
,
params
:
query
})
}
src/views/goods/goods/components/Specification.vue
View file @
10bb6221
...
...
@@ -32,11 +32,15 @@
</
template
>
</el-table-column>
</el-table>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click=
"closeSpecial('cancel');"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"closeSpecial('confim');"
>
确 定
</el-button>
</div>
</el-dialog>
</div>
</template>
<
script
>
import
{
list_machine_model
,
list_step
,
add_spec_step
}
from
"@/api/system/specification.js"
;
import
{
list_machine_model
,
list_step
,
add_spec_step
,
list_data_spec_step
,
del_spec_step
}
from
"@/api/system/specification.js"
;
import
{
stringify
}
from
"querystring"
;
export
default
{
props
:
{
...
...
@@ -45,6 +49,7 @@ export default {
return
{
open
:
false
,
goods
:{},
crowext
:
false
,
special_tb_data
:[],
steps
:[{
...
...
@@ -80,7 +85,11 @@ export default {
this
.
spec_mach_model_list
();
},
methods
:
{
/**打卡规格详情配置,并初始化显示内容 */
/**提前将商品信息传入 */
setSpecGoods
(
pgoods
){
this
.
goods
=
pgoods
;
},
/**打开规格详情配置,并初始化显示内容 */
showSpecial
(
isShow
,
pgoods
){
// 样例
// {
...
...
@@ -97,7 +106,6 @@ export default {
//商品规格,和机器型号组合
let
spec_str
=
pgoods
.
spec
;
let
spec
=
JSON
.
parse
(
spec_str
);
console
.
log
(
"spec.length"
,
spec
.
length
);
for
(
let
i
=
0
;
i
<
spec
.
length
;
i
++
){
for
(
let
j
=
0
;
j
<
this
.
mach_model_list
.
length
;
j
++
){
let
spec_model
=
{
...
...
@@ -114,15 +122,15 @@ export default {
}],
"step_opts"
:[]
}
//理论上,初始化时根据规格和型号获取可能的步骤会比较靠谱,省的以后步骤不一样用同一个数据源麻烦;
//this.spec_mach_step_list(spec_model.model_id,spec_model.spec_id);
//this.spec_mach_step_list(spec_model.model_id,2823);
let
that
=
this
;
//理论上,初始化时根据规格和型号获取可能的步骤会比较靠谱,省的以后步骤不一样用同一个数据源麻烦;
//this.spec_mach_step_list(spec_model.model_id,spec_model.spec_id);
//this.spec_mach_step_list(spec_model.model_id,2823);
//this.queryParams={model_id:spec_model.model_id,sku_id:spec_model.spec_id};
this
.
queryParams
=
{
model_id
:
spec_model
.
model_id
,
sku_id
:
2823
};
this
.
queryParams
=
{
model_id
:
spec_model
.
model_id
,
sku_id
:
2823
};
//2823 测试数据,有数据。。。
///获取可能的步骤
list_step
(
this
.
queryParams
).
then
((
response
)
=>
{
//将步骤list转换为下拉框能识别的数组;
//样例
...
...
@@ -163,16 +171,64 @@ export default {
}
spec_model
.
step_opts
=
step_opts
;
that
.
special_tb_data
.
push
(
spec_model
);
console
.
log
(
that
.
special_tb_data
);
//
异步处理后放到外面去
//th
is.$nextTick();
that
.
open
=
isShow
//
显示窗体
//th
at.open = isShow
//this.initStepData();
});
}
}
},
closeSpecial
(
tag
){
//检查有需要保存的项未提交,则提示是否确定关闭
//TODO
this
.
open
=
false
;
},
openSpecial
(
tag
){
this
.
open
=
true
;
},
/** 规格详情配置窗体初始化数据,如果已经有配置数据则获取*/
initAll
(){
this
.
get_step_data
();
},
/**获取已保存的步骤数据 */
get_step_data
(){
console
.
log
(
"get_step_data goods"
,
this
.
goods
);
this
.
queryParams
=
{
goods_id
:
this
.
goods
.
id
};
//测试数据也不好使
// this.queryParams={goods_id:152};
list_data_spec_step
(
this
.
queryParams
).
then
((
response
)
=>
{
console
.
log
(
"get_step_data response"
,
response
);
}).
catch
((
response
)
=>
{
console
.
log
(
"get_step_data error"
,
response
);
});
//数据返回后调用下面的方法
this
.
initStepData
();
},
/**初始化已保存的步骤数据 */
initStepData
(
pata
){
//将后台返回的已保存的步骤数据初始化到数据结构里
console
.
log
(
"this.special_tb_data"
,
this
.
special_tb_data
);
//tb_steps,将数据填充到tb_steps,如果没值则填充默认值
let
tb_steps
=
this
.
special_tb_data
.
tb_steps
;
if
(
true
){
tb_steps
=
[];
tb_steps
.
push
({
step_lab
:
"步骤1"
,
step_akv
:[
1
,
1
]})
tb_steps
.
push
({
step_lab
:
"步骤2"
,
step_akv
:[
3
,
84
]})
}
else
{
tb_steps
=
[{
"step_lab"
:
"步骤1"
,
"step_akv"
:[]
}]
}
this
.
special_tb_data
.
tb_steps
=
tb_steps
this
.
open
=
true
;
//
},
/**列表操作 */
specal_opt
(
pindex
,
prow
,
tag
){
if
(
tag
==
"view_step"
){
this
.
crowext
=
!
this
.
crowext
;
...
...
@@ -185,6 +241,10 @@ export default {
this
.
spec_step_save
(
prow
);
}
if
(
tag
==
"del"
){
this
.
spec_step_del
(
prow
);
}
},
specal_tb_row_click
(
r
,
c
,
e
){
// this.testPromic(1,2823).then((response) => {
...
...
@@ -229,14 +289,56 @@ export default {
//填充对应的值
step_obj
.
sku_id
=
prow
.
spec_id
;
step_obj
.
model_id
=
prow
.
model_id
;
step_obj
=
this
.
fi
ndStepById
(
step_obj
,
t_step
);
step_obj
=
this
.
fi
llStepById
(
step_obj
,
t_step
,
prow
);
step_ary
.
push
(
step_obj
);
}
//提交到后台
add_spec_step
(
step_ary
);
add_spec_step
(
step_ary
).
then
((
response
)
=>
{
console
.
log
(
"response "
,
response
);
}).
catch
((
response
)
=>
{
console
.
log
(
"error "
,
response
);
});
},
/**删除步骤 */
spec_step_del
(
prow
){
console
.
log
(
"prow "
,
prow
);
this
.
queryParams
=
{
sku_id
:
prow
.
spec_id
,
model_id
:
prow
.
model_id
};
//提交到后台
del_spec_step
(
this
.
queryParams
).
then
((
response
)
=>
{
console
.
log
(
"response del_spec_step"
,
response
);
}).
catch
((
response
)
=>
{
console
.
log
(
"error del_spec_step"
,
response
);
});
},
findStepById
(
step_obj
){
fillStepById
(
step_obj
,
t_step
,
prow
){
//TODO
console
.
log
(
"step_obj"
,
step_obj
);
console
.
log
(
"t_step"
,
t_step
);
console
.
log
(
"prow"
,
prow
);
let
step_ak
=
t_step
.
step_akv
[
0
];
let
step_av
=
t_step
.
step_akv
[
1
];
step_obj
.
result
=
step_av
;
for
(
let
i
=
0
;
i
<
prow
.
step_opts
.
length
;
i
++
){
let
step_opt
=
prow
.
step_opts
[
i
];
if
(
step_opt
.
value
==
step_ak
){
step_obj
.
risc_id
=
step_opt
.
risc_id
step_obj
.
risc_code
=
step_opt
.
risc_code
step_obj
.
risc_desc
=
step_opt
.
risc_desc
step_obj
.
turn
=
step_opt
.
turn
// for(let j=0;j
<
step_opt
.
children
.
length
;
j
++
){
// if(step_opt.children[j].value == step_av){
// step_obj.result=step_av
// break;
// }
// }
break
;
}
}
return
step_obj
;
},
/**获取可能的步骤 */
...
...
src/views/goods/goods/index.vue
View file @
10bb6221
...
...
@@ -249,9 +249,14 @@ export default {
},
setGoodsConfig
(
prow
){
this
.
$refs
.
Specification
.
setSpecGoods
(
prow
);
this
.
$nextTick
(
this
.
$refs
.
Specification
.
showSpecial
(
true
,
prow
)
);
this
.
$refs
.
Specification
.
initAll
();
}
},
};
...
...
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