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
f57b897e
Commit
f57b897e
authored
Jul 30, 2022
by
赵永成
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
specification
parent
2e4a2738
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
118 additions
and
13 deletions
+118
-13
src/api/system/specification.js
+9
-0
src/views/goods/goods/components/Specification.vue
+105
-11
src/views/goods/goods/index.vue
+4
-2
No files found.
src/api/system/specification.js
View file @
f57b897e
...
...
@@ -17,3 +17,12 @@ export function list_step(query) {
params
:
query
,
});
}
// 保存操作步骤
export
function
add_spec_step
(
data
)
{
return
request
({
url
:
'/v1/add/sku/model/risc'
,
method
:
'post'
,
data
:
data
})
}
src/views/goods/goods/components/Specification.vue
View file @
f57b897e
...
...
@@ -9,7 +9,7 @@
<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=
"s
tep
s"
v-model=
"step.step_akv"
style=
"margin-left:10px"
></el-cascader>
<el-cascader
:options=
"s
cope.row.step_opt
s"
v-model=
"step.step_akv"
style=
"margin-left:10px"
></el-cascader>
<el-button
@
click
.
prevent=
"spec_add_step(scope.row)"
style=
"margin-left:10px"
>
增加步骤
</el-button>
...
...
@@ -36,7 +36,7 @@
</div>
</template>
<
script
>
import
{
list_machine_model
,
list_step
}
from
"@/api/system/specification.js"
;
import
{
list_machine_model
,
list_step
,
add_spec_step
}
from
"@/api/system/specification.js"
;
import
{
stringify
}
from
"querystring"
;
export
default
{
props
:
{
...
...
@@ -111,18 +111,67 @@ export default {
"tb_steps"
:[{
"step_lab"
:
"步骤1"
,
"step_akv"
:[]
}]
}],
"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
);
//
this.spec_mach_step_list(spec_model.model_id,2823);
this
.
special_tb_data
.
push
(
spec_model
);
let
that
=
this
;
//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
};
list_step
(
this
.
queryParams
).
then
((
response
)
=>
{
//将步骤list转换为下拉框能识别的数组;
//样例
// {
// "step_key": 1,
// "risc_id": 1,
// "risc_code": 1,
// "risc_desc": "取杯",
// label:"取杯",
// value: 1,
// "turn": 1,
// "model_id": 1,
// "check": "radio",
// "options": {"冷杯":1,"热杯":2},
// "children":[ {label:"冷杯",value:1},{label:"热杯",value:2}]
// }
let
step_opts
=
[];
for
(
let
obj
in
response
.
data
){
//console.log(obj,spec_model.step_list[obj]);
let
step_obj
=
{};
step_obj
=
response
.
data
[
obj
];
step_obj
.
step_key
=
obj
;
step_obj
.
label
=
step_obj
.
risc_desc
step_obj
.
value
=
step_obj
.
risc_id
let
children
=
[];
let
childrenObj
=
{};
let
options
=
JSON
.
parse
(
step_obj
.
options
);
for
(
let
opt
in
options
){
childrenObj
=
{};
childrenObj
.
label
=
opt
;
childrenObj
.
value
=
options
[
opt
];
children
.
push
(
childrenObj
);
}
step_obj
.
children
=
children
step_opts
.
push
(
step_obj
);
}
spec_model
.
step_opts
=
step_opts
;
that
.
special_tb_data
.
push
(
spec_model
);
console
.
log
(
that
.
special_tb_data
);
//异步处理后放到外面去
//this.$nextTick();
that
.
open
=
isShow
});
}
}
console
.
log
(
this
.
special_tb_data
);
this
.
open
=
isShow
;
},
specal_opt
(
pindex
,
prow
,
tag
){
if
(
tag
==
"view_step"
){
...
...
@@ -133,11 +182,16 @@ export default {
}
if
(
tag
==
"save"
){
console
.
log
(
"special_tb_data"
,
this
.
special_tb_data
);
this
.
spec_step_save
(
prow
);
}
},
specal_tb_row_click
(
r
,
c
,
e
){
console
.
log
(
r
,
c
,
e
);
// this.testPromic(1,2823).then((response) => {
// console.log("xxxx",response);
// console.log("spec_mach_step_list",3)
// });
// console.log("spec_mach_step_list",2)
},
spec_add_step
(
prow
){
let
step_i
=
prow
.
tb_steps
.
length
+
1
...
...
@@ -152,19 +206,59 @@ export default {
if
(
this
.
mach_model_list
.
length
==
0
){
this
.
queryParams
=
{};
list_machine_model
(
this
.
queryParams
).
then
((
response
)
=>
{
console
.
log
(
"response"
,
response
);
this
.
mach_model_list
=
response
.
data
;
});
}
},
/**保存步骤 */
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
=
[];
for
(
let
i
=
0
;
i
<
prow
.
tb_steps
.
length
;
i
++
){
let
step_obj
=
{}
let
t_step
=
prow
.
tb_steps
[
i
];
//填充对应的值
step_obj
.
sku_id
=
prow
.
spec_id
;
step_obj
.
model_id
=
prow
.
model_id
;
step_obj
=
this
.
findStepById
(
step_obj
,
t_step
);
step_ary
.
push
(
step_obj
);
}
//提交到后台
add_spec_step
(
step_ary
);
},
findStepById
(
step_obj
){
//TODO
return
step_obj
;
},
/**获取可能的步骤 */
spec_mach_step_list
(
model_id
,
sku_id
){
this
.
queryParams
=
{
model_id
:
model_id
,
sku_id
:
sku_id
};
list_step
(
this
.
queryParams
).
then
((
response
)
=>
{
console
.
log
(
"response"
,
response
);
console
.
log
(
"spec_mach_step_list"
,
1
)
});
console
.
log
(
"spec_mach_step_list"
,
2
)
},
testPromic
(
model_id
,
sku_id
){
var
param
=
{
model_id
:
model_id
,
sku_id
:
sku_id
};
return
new
Promise
(
function
(
resolve
,
reject
){
list_step
(
param
).
then
((
response
)
=>
{
resolve
(
response
);
});
}
).
then
(
function
(
res
){
return
res
;
}).
catch
(
function
(
cat
){
return
cat
})
}
}
...
...
src/views/goods/goods/index.vue
View file @
f57b897e
...
...
@@ -248,8 +248,10 @@ export default {
})
},
setGoodsConfig
(
prow
){
console
.
log
(
"prow"
,
prow
);
this
.
$refs
.
Specification
.
showSpecial
(
true
,
prow
);
this
.
$nextTick
(
this
.
$refs
.
Specification
.
showSpecial
(
true
,
prow
)
);
}
},
};
...
...
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