Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mes-ui
Project
Project
Details
Activity
Releases
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
周远喜
mes-ui
Commits
cf20974b
Commit
cf20974b
authored
Nov 04, 2020
by
renjintao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tasktime
parent
03194a8a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
345 additions
and
378 deletions
+345
-378
orderlistWorkHour.vue
pages/produce/execute/components/orderlistWorkHour.vue
+1
-4
index.vue
pages/produce/execute/taskTime/index.vue
+344
-374
No files found.
pages/produce/execute/components/orderlistWorkHour.vue
View file @
cf20974b
...
...
@@ -3,12 +3,9 @@
<div
class=
"card_box"
>
<Card
class=
"card_order"
v-for=
"(item,index) in listTasks"
:style=
"order==item.id?'box-shadow: 0px 0px 15px #333;':''"
@
click
.
native=
"goPage(item)"
:key=
"index"
:class=
"item.status==12 ? 'card_border1' : (item.status==14 ? 'card_border2': (item.status==5 ?'card_border3':
(item.status==7?'card_border4':(item.status==-1?'card_border5':''))))"
>
<!-- :class="item.status=='未开工'? 'card_border1' : (item.status=='执行中' ? 'card_border2': (item.status=='暂停中' ?'card_border3':
(item.status=='交检中'?'card_border4':(item.status=='交接中'?'card_border5':''))))"-->
<p
slot=
"title"
>
{{
item
.
mesCode
}}
<state
code=
"taskList.status"
ref=
"state"
class=
"fr"
:value=
"item.status"
type=
"text"
></state>
<!--
<span
>
{{
item
.
status
}}
</span>
-->
<state
code=
"orderList.workHourStatus"
ref=
"state"
class=
"fr"
:value=
"item.workHourStatus"
type=
"text"
></state>
</p>
<p
class=
"order_tit"
>
{{
item
.
productName
}}
</p>
<p>
...
...
pages/produce/execute/taskTime/index.vue
View file @
cf20974b
<
template
>
<div
class=
"gs_set"
>
<div
class=
"gs_set"
>
<div
style=
"text-align: center; background: wihte; height: 50px"
>
产品名称:
<span
class=
""
>
{{
topInfoShow
.
productName
}}
</span
>
工序号:
<span
class=
""
>
{{
topInfoShow
.
taskSeq
}}
</span
>
工序名称:
<span
class=
""
>
{{
topInfoShow
.
name
}}
</span
>
派工数量:
<span
class=
""
>
{{
topInfoShow
.
count
}}
</span
>
绩效单件:
<span
class=
""
>
{{
topInfoShow
.
performanceHours
}}
</span
>
绩效准结:
<span
class=
""
>
{{
topInfoShow
.
performanceWorkingHours
}}
</span>
产品名称:
<span
class=
""
>
{{
topInfoShow
.
productName
}}
</span>
工序号:
<span
class=
""
>
{{
topInfoShow
.
taskSeq
}}
</span>
工序名称:
<span
class=
""
>
{{
topInfoShow
.
name
}}
</span>
派工数量:
<span
class=
""
>
{{
topInfoShow
.
count
}}
</span>
绩效单件:
<span
class=
""
>
{{
topInfoShow
.
performanceHours
}}
</span>
绩效准结:
<span
class=
""
>
{{
topInfoShow
.
performanceWorkingHours
}}
</span>
</div>
<div
class=
"gs_top"
>
<div
class=
"gs_top_box total_time"
>
<img
src=
"@/assets/imgicon/execute/time01.png"
alt
/>
<!--
<Icon
type=
"ios-time"
/>
-->
<div
class=
"gs_bo01"
>
<span
class=
"shi"
>
总工时
</span>
<span
class=
"number"
>
{{
allHours
}}
</span>
<div
class=
"gs_top_box total_time"
>
<img
src=
"@/assets/imgicon/execute/time01.png"
alt
/>
<!--
<Icon
type=
"ios-time"
/>
-->
<div
class=
"gs_bo01"
>
<span
class=
"shi"
>
总工时
</span>
<span
class=
"number"
>
{{
allHours
}}
</span>
</div>
</div>
</div
>
<Divider
type=
"vertical"
class=
"line_slit"
/
>
<div
class=
"gs_top_box allocated"
>
<!--
<Icon
type=
"md-pie"
/>
--
>
<img
src=
"@/assets/imgicon/execute/time02.png"
alt
/
>
<div
class=
"gs_bo01"
>
<span
class=
"shi"
>
待分配
</span>
<span
class=
"number"
>
{{
waitHours
}}
</span
>
<Divider
type=
"vertical"
class=
"line_slit"
/
>
<div
class=
"gs_top_box allocated"
>
<!--
<Icon
type=
"md-pie"
/>
--
>
<img
src=
"@/assets/imgicon/execute/time02.png"
alt
/
>
<div
class=
"gs_bo01"
>
<span
class=
"shi"
>
待分配
</span
>
<span
class=
"number"
>
{{
waitHours
}}
</span>
</div
>
</div>
</div>
</div>
<div
class=
"gs_card_box"
>
<Card
class=
"gs_card"
v-for=
"(item, index) in cardMan"
:key=
"index"
>
<p
slot=
"title"
class=
"gs_title"
>
{{
item
.
userTitle
}}
<span
class=
"fr"
>
{{
item
.
userCardNo
}}
</span>
</p>
<p>
所属车间:
{{
item
.
workShopTitle
}}
</p>
<p>
所属班组:
{{
item
.
groupTitle
}}
</p>
<p
class=
"gs_time"
>
<span
v-show=
"!item.showInputWorkHour"
class=
"b_size"
>
{{
<Card
class=
"gs_card"
v-for=
"(item, index) in cardMan"
:key=
"index"
>
<p
slot=
"title"
class=
"gs_title"
>
{{
item
.
userTitle
}}
<span
class=
"fr"
>
{{
item
.
userCardNo
}}
</span>
</p>
<p>
所属车间:
{{
item
.
workShopTitle
}}
</p>
<p>
所属班组:
{{
item
.
groupTitle
}}
</p>
<p
class=
"gs_time"
>
<span
v-show=
"!item.showInputWorkHour"
class=
"b_size"
>
{{
item
.
workHour
}}
</span>
<InputNumber
style=
"margin: 10px 0"
v-show=
"item.showInputWorkHour"
:max=
"maxHour"
:min=
"1"
:editable=
"false"
v-model=
"item.workHour"
@
on-change=
"testChange(item.workHour)"
></InputNumber>
工时
</p>
<InputNumber
style=
"margin: 10px 0"
v-show=
"item.showInputWorkHour"
:max=
"maxHour"
:min=
"1"
:editable=
"false"
v-model=
"item.workHour"
@
on-change=
"testChange(item.workHour)"
></InputNumber>
工时
</p>
<!--
<p
class=
"gs_p"
>
<!--
<p
class=
"gs_p"
>
<span
class=
"b_size"
>
100
</span>
分
</p>
<p
class=
"gs_p"
>
<span
class=
"b_size"
>
100
</span>
秒
</p>
-->
<p
class=
"gs_footer"
>
<a
class=
"gs_edit"
@
click=
"editItem(item, index)"
>
<Icon
type=
"md-create"
/>
编辑
</a
>
<a
class=
"gs_del"
style=
"position: absolute; right: 0px; width: 50%"
@
click=
"delItem(item.id)"
>
<Icon
type=
"ios-trash-outline"
/>
删除
</a>
</p>
</Card>
<a
class=
"gs_card gs_add"
@
click=
"addItem"
v-show=
"this.waitHours != 0"
>
<Icon
type=
"ios-add"
style=
"vertical-align: middle"
/>
</a>
<p
class=
"gs_footer"
>
<a
class=
"gs_edit"
@
click=
"editItem(item, index)"
>
<Icon
type=
"md-create"
/>
编辑
</a>
<a
class=
"gs_del"
style=
"position: absolute; right: 0px; width: 50%"
@
click=
"delItem(item.id)"
>
<Icon
type=
"ios-trash-outline"
/>
删除
</a>
</p>
</Card>
<a
class=
"gs_card gs_add"
@
click=
"addItem"
v-show=
"this.waitHours != 0"
>
<Icon
type=
"ios-add"
style=
"vertical-align: middle"
/>
</a>
</div>
<div
style=
"
<div
style=
"
text-align: center;
height: 50px;
width: 100%;
position: absolute;
bottom: 25px;
"
>
<Button
type=
"primary"
v-noClick
@
click=
"submitWorkHour"
style=
"height: 50px; width: 100px"
>
提交
</Button>
<Button
class=
"mr20"
style=
"background: #d0d2d9; height: 50px; width: 100px"
v-noClick
@
click=
"editCancel"
>
取消
</Button>
"
>
<Button
type=
"primary"
v-noClick
@
click=
"submitWorkHour"
style=
"height: 50px; width: 100px"
>
提交
</Button>
<Button
class=
"mr20"
style=
"background: #d0d2d9; height: 50px; width: 100px"
v-noClick
@
click=
"editCancel"
>
取消
</Button>
</div>
<!-- 新增弹框 -->
<Modal
v-model=
"addmodal"
width=
"1100"
:mask-closable=
"false"
title=
"添加人员"
footer-hide
>
<addview
ref=
"addview"
@
on-close=
"cancel"
@
on-ok=
"addInfo"
></addview>
<Modal
v-model=
"addmodal"
width=
"1100"
:mask-closable=
"false"
title=
"添加人员"
footer-hide
>
<addview
ref=
"addview"
@
on-close=
"cancel"
@
on-ok=
"addInfo"
></addview>
</Modal>
</div>
</div>
</
template
>
<
script
>
import
addview
from
"./add"
;
import
Api
from
"../api"
;
export
default
{
name
:
"starOrder"
,
components
:
{
addview
},
data
()
{
return
{
starmodal
:
false
,
msg
:
"确认要删除吗?"
,
title
:
"删除确认"
,
addmodal
:
false
,
allHours
:
0
,
waitHours
:
0
,
cardMan
:
[
// {
// showInputWorkHour: true,
// userName: "张三",
// cardNo: 123123,
// workHour: 0,
// },
],
cardManCopy
:
[],
topInfoShow
:
{},
maxHour
:
10
,
};
},
created
()
{
// this.treeHeight = window.innerHeight - 120;
this
.
Initload
();
},
async
fetch
({
store
,
params
})
{
await
store
.
dispatch
(
"loadDictionary"
);
// 加载数据字典
},
mounted
()
{
window
.
onresize
=
()
=>
{
///浏览器窗口大小变化
return
(()
=>
{
this
.
treeHeight
=
window
.
innerHeight
-
120
;
})();
};
},
methods
:
{
// 初始化加载
Initload
()
{
let
parme
=
{
dispatchId
:
this
.
$route
.
query
.
id
,
routingDetailId
:
this
.
$route
.
query
.
routid
,
count
:
this
.
$route
.
query
.
quantity
,
};
// 最上边的信息
Api
.
gethourinfo
(
parme
).
then
((
res
)
=>
{
let
result
=
res
.
result
;
result
.
productName
=
this
.
$route
.
query
.
productName
;
this
.
topInfoShow
=
result
;
});
// 工时信息
Api
.
getallhours
(
parme
).
then
((
res
)
=>
{
if
(
res
.
result
)
{
this
.
allHours
=
res
.
result
.
allHours
;
// 总工时
this
.
waitHours
=
res
.
result
.
waitHours
;
// 待分配工时
this
.
$refs
.
addview
.
maxHour
=
this
.
waitHours
;
// 如果工时还未分配,则默认人员平均分配
if
(
res
.
result
.
allHours
==
res
.
result
.
waitHours
)
{
let
id
=
this
.
$route
.
query
.
id
;
// 获取既定users
Api
.
getentryusers
({
Id
:
id
}).
then
((
res
)
=>
{
let
result
=
res
.
result
;
// 默认工时分配
this
.
defaultWorkTime
(
result
);
this
.
waitHours
=
0
;
});
}
// 工时分配列表
this
.
getWorkTimelist
();
}
else
{
console
.
log
(
"获取失败。"
);
}
});
name
:
"starOrder"
,
components
:
{
addview
},
// 刷新加载
laodHorse
()
{
let
parme
=
{
dispatchId
:
this
.
$route
.
query
.
id
,
routingDetailId
:
this
.
$route
.
query
.
routid
,
count
:
this
.
$route
.
query
.
quantity
,
};
Api
.
getallhours
(
parme
).
then
((
res
)
=>
{
if
(
res
.
result
)
{
this
.
allHours
=
res
.
result
.
allHours
;
// 总工时
this
.
waitHours
=
res
.
result
.
waitHours
;
// 待分配工时
this
.
$refs
.
addview
.
maxHour
=
this
.
waitHours
;
// 工时分配列表
this
.
getWorkTimelist
();
}
else
{
console
.
log
(
"获取失败。"
);
}
});
},
// 默认工时分配
defaultWorkTime
(
result
)
{
var
length
=
result
.
length
;
//平均工时
var
averageHour
=
parseInt
(
this
.
allHours
/
length
);
//最后一个人的工时
var
lastHour
=
this
.
allHours
-
averageHour
*
(
length
-
1
);
let
parme
=
[];
for
(
var
i
=
0
;
i
<
length
;
i
++
)
{
var
model
=
{
userId
:
result
[
i
].
id
,
userTitle
:
result
[
i
].
userName
,
userCardNo
:
result
[
i
].
cardNo
,
workHour
:
i
==
length
-
1
?
lastHour
:
averageHour
,
dispatchId
:
this
.
$route
.
query
.
id
,
routingDetailId
:
this
.
$route
.
query
.
routid
,
count
:
this
.
$route
.
query
.
quantity
,
data
()
{
return
{
starmodal
:
false
,
msg
:
"确认要删除吗?"
,
title
:
"删除确认"
,
addmodal
:
false
,
allHours
:
0
,
waitHours
:
0
,
cardMan
:
[
// {
// showInputWorkHour: true,
// userName: "张三",
// cardNo: 123123,
// workHour: 0,
// },
],
cardManCopy
:
[],
topInfoShow
:
{},
maxHour
:
10
,
};
parme
.
push
(
model
);
}
// 默认工时创建
Api
.
subcreatemodelhours
(
parme
).
then
((
res
)
=>
{
if
(
res
.
success
)
{
// 工时分配列表
this
.
getWorkTimelist
();
}
else
{
console
.
log
(
"默认工时创建失败。"
);
}
});
},
// 工时分配列表
getWorkTimelist
()
{
let
parm
=
{
conditions
:
[
{
fieldName
:
"dispatchId"
,
fieldValue
:
this
.
$route
.
query
.
id
,
conditionalType
:
"Equal"
,
},
],
};
Api
.
getentrylist
(
parm
).
then
((
rest
)
=>
{
if
(
rest
.
success
)
{
this
.
cardMan
=
rest
.
result
;
}
else
{
console
.
log
(
"获取失败。"
);
}
});
created
()
{
// this.treeHeight = window.innerHeight - 120;
this
.
Initload
();
},
// 编辑工时
editItem
(
item
,
index
)
{
// 关闭其他编辑框
for
(
var
i
=
0
;
i
<
this
.
cardMan
.
length
;
i
++
)
{
if
(
this
.
cardMan
[
i
]
!=
item
&&
this
.
cardMan
[
i
].
showInputWorkHour
==
true
)
{
this
.
cardMan
[
i
].
showInputWorkHour
=
false
;
this
.
$set
(
this
.
cardMan
,
i
,
this
.
cardMan
[
i
]);
}
}
// 编辑或关闭当前编辑框
console
.
log
(
item
.
workHour
);
this
.
maxHour
=
item
.
workHour
+
this
.
waitHours
;
item
.
showInputWorkHour
=
!
item
.
showInputWorkHour
;
this
.
$set
(
this
.
cardMan
,
index
,
item
);
async
fetch
({
store
,
params
})
{
await
store
.
dispatch
(
"loadDictionary"
);
// 加载数据字典
},
// 删除工时
delItem
(
itmid
)
{
this
.
$Modal
.
confirm
({
title
:
this
.
title
,
content
:
"<p>"
+
this
.
msg
+
"</p>"
,
onOk
:
()
=>
{
Api
.
deletehours
(
itmid
).
then
((
res
)
=>
{
if
(
res
.
success
)
{
this
.
laodHorse
();
this
.
$Message
.
success
(
"工时已删除"
);
}
else
{
this
.
$Message
.
error
(
"删除失败..."
);
mounted
()
{
window
.
onresize
=
()
=>
{
///浏览器窗口大小变化
return
(()
=>
{
this
.
treeHeight
=
window
.
innerHeight
-
120
;
})();
};
},
methods
:
{
// 初始化加载
Initload
()
{
let
parme
=
{
dispatchId
:
this
.
$route
.
query
.
id
,
routingDetailId
:
this
.
$route
.
query
.
routid
,
count
:
this
.
$route
.
query
.
quantity
,
};
// 最上边的信息
Api
.
gethourinfo
(
parme
).
then
((
res
)
=>
{
let
result
=
res
.
result
;
result
.
productName
=
this
.
$route
.
query
.
productName
;
this
.
topInfoShow
=
result
;
});
// 工时信息
Api
.
getallhours
(
parme
).
then
((
res
)
=>
{
if
(
res
.
result
)
{
this
.
allHours
=
res
.
result
.
allHours
;
// 总工时
this
.
waitHours
=
res
.
result
.
waitHours
;
// 待分配工时
this
.
$refs
.
addview
.
maxHour
=
this
.
waitHours
;
// 如果工时还未分配,则默认人员平均分配
if
(
res
.
result
.
allHours
==
res
.
result
.
waitHours
)
{
let
id
=
this
.
$route
.
query
.
id
;
// 获取既定users
Api
.
getentryusers
({
Id
:
id
}).
then
((
res
)
=>
{
let
result
=
res
.
result
;
// 默认工时分配
this
.
defaultWorkTime
(
result
);
this
.
waitHours
=
0
;
});
}
// 工时分配列表
this
.
getWorkTimelist
();
}
else
{
console
.
log
(
"获取失败。"
);
}
});
},
// 刷新加载
laodHorse
()
{
let
parme
=
{
dispatchId
:
this
.
$route
.
query
.
id
,
routingDetailId
:
this
.
$route
.
query
.
routid
,
count
:
this
.
$route
.
query
.
quantity
,
};
Api
.
getallhours
(
parme
).
then
((
res
)
=>
{
if
(
res
.
result
)
{
this
.
allHours
=
res
.
result
.
allHours
;
// 总工时
this
.
waitHours
=
res
.
result
.
waitHours
;
// 待分配工时
this
.
$refs
.
addview
.
maxHour
=
this
.
waitHours
;
// 工时分配列表
this
.
getWorkTimelist
();
}
else
{
console
.
log
(
"获取失败。"
);
}
});
},
// 默认工时分配
defaultWorkTime
(
result
)
{
var
length
=
result
.
length
;
//平均工时
var
averageHour
=
parseInt
(
this
.
allHours
/
length
);
//最后一个人的工时
var
lastHour
=
this
.
allHours
-
averageHour
*
(
length
-
1
);
let
parme
=
[];
for
(
var
i
=
0
;
i
<
length
;
i
++
)
{
var
model
=
{
userId
:
result
[
i
].
id
,
userTitle
:
result
[
i
].
userName
,
userCardNo
:
result
[
i
].
cardNo
,
workHour
:
i
==
length
-
1
?
lastHour
:
averageHour
,
dispatchId
:
this
.
$route
.
query
.
id
,
routingDetailId
:
this
.
$route
.
query
.
routid
,
count
:
this
.
$route
.
query
.
quantity
,
};
parme
.
push
(
model
);
}
});
// 默认工时创建
Api
.
subcreatemodelhours
(
parme
).
then
((
res
)
=>
{
if
(
res
.
success
)
{
// 工时分配列表
this
.
getWorkTimelist
();
}
else
{
console
.
log
(
"默认工时创建失败。"
);
}
});
},
});
},
// 提交
submitWorkHour
()
{
if
(
this
.
cardMan
.
length
==
0
)
{
return
this
.
$Message
.
success
(
"没有工时可提交"
);
}
Api
.
subupdatehours
(
this
.
cardMan
).
then
((
res
)
=>
{
if
(
res
.
success
)
{
let
id
=
this
.
$route
.
query
.
id
;
Api
.
workhourstatus
({
Id
:
id
}).
then
((
res
)
=>
{
if
(
res
.
success
)
{
this
.
$Message
.
success
(
"已提交"
);
this
.
laodHorse
();
}
else
{
this
.
$Message
.
error
(
"提交失败..."
);
// 工时分配列表
getWorkTimelist
()
{
let
parm
=
{
conditions
:
[{
fieldName
:
"dispatchId"
,
fieldValue
:
this
.
$route
.
query
.
id
,
conditionalType
:
"Equal"
,
},
],
};
Api
.
getentrylist
(
parm
).
then
((
rest
)
=>
{
if
(
rest
.
success
)
{
this
.
cardMan
=
rest
.
result
;
}
else
{
console
.
log
(
"获取失败。"
);
}
});
},
// 编辑工时
editItem
(
item
,
index
)
{
// 关闭其他编辑框
for
(
var
i
=
0
;
i
<
this
.
cardMan
.
length
;
i
++
)
{
if
(
this
.
cardMan
[
i
]
!=
item
&&
this
.
cardMan
[
i
].
showInputWorkHour
==
true
)
{
this
.
cardMan
[
i
].
showInputWorkHour
=
false
;
this
.
$set
(
this
.
cardMan
,
i
,
this
.
cardMan
[
i
]);
}
}
});
}
else
{
this
.
$Message
.
error
(
"提交失败..."
);
}
});
},
editCancel
()
{
this
.
laodHorse
();
},
cancel
()
{
this
.
addmodal
=
false
;
},
// 打开添加分配人员页面
addItem
()
{
// 添加分配人员时关闭所有编辑框
for
(
var
i
=
0
;
i
<
this
.
cardMan
.
length
;
i
++
)
{
if
(
this
.
cardMan
[
i
].
showInputWorkHour
==
true
)
{
this
.
cardMan
[
i
].
showInputWorkHour
=
false
;
this
.
$set
(
this
.
cardMan
,
i
,
this
.
cardMan
[
i
]);
}
}
this
.
$refs
.
addview
.
maxHour
=
this
.
waitHours
;
this
.
addmodal
=
true
;
// 获取人员
let
parm
=
{
partmentId
:
0
,
search
:
""
,
};
Api
.
getusers
(
parm
).
then
((
res
)
=>
{
let
result
=
res
.
result
;
this
.
$refs
.
addview
.
listMan
=
result
;
});
this
.
$refs
.
addview
.
entity
=
{
userCardNo
:
""
,
oldUserse
:
null
,
userse
:
null
,
workHour
:
1
,
};
},
// 保存 添加分配人员
addInfo
(
formdata
)
{
// 修改之前未保存的编辑
Api
.
subupdatehours
(
this
.
cardMan
);
// 编辑或关闭当前编辑框
console
.
log
(
item
.
workHour
);
this
.
maxHour
=
item
.
workHour
+
this
.
waitHours
;
item
.
showInputWorkHour
=
!
item
.
showInputWorkHour
;
this
.
$set
(
this
.
cardMan
,
index
,
item
);
},
// 删除工时
delItem
(
itmid
)
{
this
.
$Modal
.
confirm
({
title
:
this
.
title
,
content
:
"<p>"
+
this
.
msg
+
"</p>"
,
onOk
:
()
=>
{
Api
.
deletehours
(
itmid
).
then
((
res
)
=>
{
if
(
res
.
success
)
{
this
.
laodHorse
();
this
.
$Message
.
success
(
"工时已删除"
);
}
else
{
this
.
$Message
.
error
(
"删除失败..."
);
}
});
},
});
},
// 提交
submitWorkHour
()
{
if
(
this
.
cardMan
.
length
==
0
)
{
return
this
.
$Message
.
success
(
"没有工时可提交"
);
}
Api
.
subupdatehours
(
this
.
cardMan
).
then
((
res
)
=>
{
if
(
res
.
success
)
{
let
id
=
this
.
$route
.
query
.
id
;
Api
.
workhourstatus
({
Id
:
id
}).
then
((
res
)
=>
{
if
(
res
.
success
)
{
this
.
$Message
.
success
(
"已提交"
);
this
.
laodHorse
();
}
else
{
this
.
$Message
.
error
(
"提交失败..."
);
}
});
}
else
{
this
.
$Message
.
error
(
"提交失败..."
);
}
});
},
editCancel
()
{
this
.
laodHorse
();
},
cancel
()
{
this
.
addmodal
=
false
;
},
// 打开添加分配人员页面
addItem
()
{
// 添加分配人员时关闭所有编辑框
for
(
var
i
=
0
;
i
<
this
.
cardMan
.
length
;
i
++
)
{
if
(
this
.
cardMan
[
i
].
showInputWorkHour
==
true
)
{
this
.
cardMan
[
i
].
showInputWorkHour
=
false
;
this
.
$set
(
this
.
cardMan
,
i
,
this
.
cardMan
[
i
]);
}
}
this
.
$refs
.
addview
.
maxHour
=
this
.
waitHours
;
this
.
addmodal
=
true
;
// 获取人员
let
parm
=
{
partmentId
:
0
,
search
:
""
,
};
Api
.
getusers
(
parm
).
then
((
res
)
=>
{
let
result
=
res
.
result
;
this
.
$refs
.
addview
.
listMan
=
result
;
});
this
.
$refs
.
addview
.
entity
=
{
userCardNo
:
""
,
oldUserse
:
null
,
userse
:
null
,
workHour
:
1
,
};
},
// 保存 添加分配人员
addInfo
(
formdata
)
{
// 修改之前未保存的编辑
Api
.
subupdatehours
(
this
.
cardMan
);
let
parme
=
[
{
userTitle
:
formdata
.
userName
,
userId
:
formdata
.
userId
,
userCardNo
:
formdata
.
cardNo
,
workHour
:
formdata
.
workHour
,
dispatchId
:
this
.
$route
.
query
.
id
,
routingDetailId
:
this
.
$route
.
query
.
routid
,
count
:
this
.
$route
.
query
.
quantity
,
let
parme
=
[{
userTitle
:
formdata
.
userName
,
userId
:
formdata
.
userId
,
userCardNo
:
formdata
.
cardNo
,
workHour
:
formdata
.
workHour
,
dispatchId
:
this
.
$route
.
query
.
id
,
routingDetailId
:
this
.
$route
.
query
.
routid
,
count
:
this
.
$route
.
query
.
quantity
,
},
];
Api
.
subcreatemodelhours
(
parme
).
then
((
res
)
=>
{
if
(
res
.
success
)
{
this
.
laodHorse
();
}
else
{
this
.
addmodal
=
true
;
}
});
this
.
addmodal
=
false
;
},
// 检验编辑内容
testChange
(
workHour
)
{
// 该方法在input内容改变是就会触发进行检测
this
.
numberChange
(
workHour
);
// 调用函数
// 编辑框发生变化时,修改待分配工时
let
editWorkHour
=
0
;
this
.
cardMan
.
forEach
((
item
)
=>
{
editWorkHour
+=
item
.
workHour
;
});
this
.
waitHours
=
this
.
allHours
-
editWorkHour
;
},
// 封装控制小数点位数的函数
numberChange
(
VauleNumber
)
{
// VauleNumber你想要控制位数的数字
let
newNumber
=
null
;
if
(
VauleNumber
>=
0
)
{
let
reg
=
/.*
\.
.*/
;
if
(
reg
.
test
(
VauleNumber
))
{
newNumber
=
parseFloat
(
VauleNumber
.
toFixed
(
1
));
}
else
{
newNumber
=
VauleNumber
;
}
}
return
newNumber
;
},
];
Api
.
subcreatemodelhours
(
parme
).
then
((
res
)
=>
{
if
(
res
.
success
)
{
this
.
laodHorse
();
}
else
{
this
.
addmodal
=
true
;
}
});
this
.
addmodal
=
false
;
},
// 检验编辑内容
testChange
(
workHour
)
{
// 该方法在input内容改变是就会触发进行检测
this
.
numberChange
(
workHour
);
// 调用函数
// 编辑框发生变化时,修改待分配工时
let
editWorkHour
=
0
;
this
.
cardMan
.
forEach
((
item
)
=>
{
editWorkHour
+=
item
.
workHour
;
});
this
.
waitHours
=
this
.
allHours
-
editWorkHour
;
},
// 封装控制小数点位数的函数
numberChange
(
VauleNumber
)
{
// VauleNumber你想要控制位数的数字
let
newNumber
=
null
;
if
(
VauleNumber
>=
0
)
{
let
reg
=
/.*
\.
.*/
;
if
(
reg
.
test
(
VauleNumber
))
{
newNumber
=
parseFloat
(
VauleNumber
.
toFixed
(
1
));
}
else
{
newNumber
=
VauleNumber
;
}
}
return
newNumber
;
},
},
};
</
script
>
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