Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
K
klck
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
位宇华
klck
Commits
0f0f04bd
Commit
0f0f04bd
authored
Aug 09, 2023
by
张兴海
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
模板管理添加修改导入规则,优化状态代码
parent
cc15ce74
Changes
32
Show whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
1413 additions
and
1587 deletions
+1413
-1587
pom.xml
pom.xml
+9
-0
ruoyi-supplies/src/main/java/com/ruoyi/system/controller/ActSuppliesController.java
...va/com/ruoyi/system/controller/ActSuppliesController.java
+17
-8
ruoyi-supplies/src/main/java/com/ruoyi/system/controller/ActSuppliesConvertController.java
...ruoyi/system/controller/ActSuppliesConvertController.java
+0
-3
ruoyi-supplies/src/main/java/com/ruoyi/system/controller/ActSuppliesDetailsController.java
...ruoyi/system/controller/ActSuppliesDetailsController.java
+19
-8
ruoyi-supplies/src/main/java/com/ruoyi/system/controller/ActSuppliesRoleController.java
...om/ruoyi/system/controller/ActSuppliesRoleController.java
+19
-16
ruoyi-supplies/src/main/java/com/ruoyi/system/controller/ActSuppliesTemplateController.java
...uoyi/system/controller/ActSuppliesTemplateController.java
+30
-2
ruoyi-supplies/src/main/java/com/ruoyi/system/mapper/ActSuppliesDetailsMapper.java
...ava/com/ruoyi/system/mapper/ActSuppliesDetailsMapper.java
+5
-0
ruoyi-supplies/src/main/java/com/ruoyi/system/mapper/ActSuppliesMapper.java
.../main/java/com/ruoyi/system/mapper/ActSuppliesMapper.java
+5
-1
ruoyi-supplies/src/main/java/com/ruoyi/system/mapper/ActSuppliesRoleMapper.java
...n/java/com/ruoyi/system/mapper/ActSuppliesRoleMapper.java
+6
-1
ruoyi-supplies/src/main/java/com/ruoyi/system/mapper/ActSuppliesTemplateMapper.java
...va/com/ruoyi/system/mapper/ActSuppliesTemplateMapper.java
+10
-3
ruoyi-supplies/src/main/java/com/ruoyi/system/service/ActSuppliesTemplateService.java
.../com/ruoyi/system/service/ActSuppliesTemplateService.java
+24
-0
ruoyi-supplies/src/main/java/com/ruoyi/system/service/IActSuppliesDetailsService.java
.../com/ruoyi/system/service/IActSuppliesDetailsService.java
+7
-5
ruoyi-supplies/src/main/java/com/ruoyi/system/service/IActSuppliesRoleService.java
...ava/com/ruoyi/system/service/IActSuppliesRoleService.java
+4
-3
ruoyi-supplies/src/main/java/com/ruoyi/system/service/IActSuppliesService.java
...in/java/com/ruoyi/system/service/IActSuppliesService.java
+4
-3
ruoyi-supplies/src/main/java/com/ruoyi/system/service/impl/ActSuppliesDetailsServiceImpl.java
...yi/system/service/impl/ActSuppliesDetailsServiceImpl.java
+19
-29
ruoyi-supplies/src/main/java/com/ruoyi/system/service/impl/ActSuppliesRoleServiceImpl.java
...ruoyi/system/service/impl/ActSuppliesRoleServiceImpl.java
+14
-4
ruoyi-supplies/src/main/java/com/ruoyi/system/service/impl/ActSuppliesServiceImpl.java
...com/ruoyi/system/service/impl/ActSuppliesServiceImpl.java
+23
-33
ruoyi-supplies/src/main/java/com/ruoyi/system/service/impl/ActSuppliesTemplateServiceImpl.java
...i/system/service/impl/ActSuppliesTemplateServiceImpl.java
+29
-0
ruoyi-supplies/src/main/resources/mapper/system/ActSuppliesDetailsMapper.xml
...main/resources/mapper/system/ActSuppliesDetailsMapper.xml
+12
-0
ruoyi-supplies/src/main/resources/mapper/system/ActSuppliesMapper.xml
...es/src/main/resources/mapper/system/ActSuppliesMapper.xml
+14
-0
ruoyi-supplies/src/main/resources/mapper/system/ActSuppliesRoleMapper.xml
...rc/main/resources/mapper/system/ActSuppliesRoleMapper.xml
+12
-0
ruoyi-supplies/src/main/resources/mapper/system/ActSuppliesTemplateMapper.xml
...ain/resources/mapper/system/ActSuppliesTemplateMapper.xml
+39
-0
ruoyi-ui/src/api/ActSuppliesDetails/ActSuppliesDetails.js
ruoyi-ui/src/api/ActSuppliesDetails/ActSuppliesDetails.js
+8
-9
ruoyi-ui/src/api/Actsupplies/Actsupplies.js
ruoyi-ui/src/api/Actsupplies/Actsupplies.js
+17
-4
ruoyi-ui/src/api/ruoyi-myLuckyexcel/myluckyexcel.js
ruoyi-ui/src/api/ruoyi-myLuckyexcel/myluckyexcel.js
+25
-0
ruoyi-ui/src/api/system/suppliesrole.js
ruoyi-ui/src/api/system/suppliesrole.js
+9
-10
ruoyi-ui/src/views/system/ActSuppliesDetails/ActSuppliesDetails/index.vue
...ws/system/ActSuppliesDetails/ActSuppliesDetails/index.vue
+426
-426
ruoyi-ui/src/views/system/Actsupplies/Actsupplies/index.vue
ruoyi-ui/src/views/system/Actsupplies/Actsupplies/index.vue
+3
-3
ruoyi-ui/src/views/system/Actsupplies/Actsupplies/indexone.vue
...-ui/src/views/system/Actsupplies/Actsupplies/indexone.vue
+4
-4
ruoyi-ui/src/views/system/supplies/index.vue
ruoyi-ui/src/views/system/supplies/index.vue
+443
-918
ruoyi-ui/src/views/system/supplies/index_template.vue
ruoyi-ui/src/views/system/supplies/index_template.vue
+92
-33
ruoyi-ui/src/views/system/suppliesrole/index.vue
ruoyi-ui/src/views/system/suppliesrole/index.vue
+65
-61
No files found.
pom.xml
View file @
0f0f04bd
...
...
@@ -4,6 +4,7 @@
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
com.ruoyi
</groupId>
<artifactId>
ruoyi
</artifactId>
<version>
3.4.0
</version>
...
...
@@ -121,6 +122,14 @@
<version>
${swagger.version}
</version>
</dependency>
<!-- lombok的依赖项-->
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
<version>
1.18.26
</version>
<scope>
provided
</scope>
</dependency>
<!--io常用工具类 -->
<dependency>
<groupId>
commons-io
</groupId>
...
...
ruoyi-supplies/src/main/java/com/ruoyi/system/controller/ActSuppliesController.java
View file @
0f0f04bd
...
...
@@ -10,6 +10,7 @@ import com.ruoyi.common.utils.SecurityUtils;
import
com.ruoyi.common.utils.poi.ExcelUtil
;
import
com.ruoyi.system.domain.ActSupplies
;
import
com.ruoyi.system.service.IActSuppliesService
;
import
com.ruoyi.system.web.ServiceCode
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -164,20 +165,24 @@ public class ActSuppliesController extends BaseController
* 启用物料总分类管理
*/
@PreAuthorize
(
"@ss.hasPermi('Actsupplies:Actsupplies:enable')"
)
@
GetMapping
(
"/enable/{id}
"
)
public
AjaxResult
setEnable
(
@PathVariable
(
"id"
)
Long
id
)
@
PutMapping
(
"/{id}/enable
"
)
public
AjaxResult
setEnable
(
@PathVariable
(
"id"
)
Long
id
,
@RequestParam
(
"status"
)
Integer
status
)
{
actSuppliesService
.
setEnable
(
id
);
return
AjaxResult
.
success
();
actSuppliesService
.
setEnable
(
id
,
status
);
if
(
status
<
0
){
return
AjaxResult
.
error
(
ServiceCode
.
ERR_CODE
+
""
,
"启用失败"
);
}
else
{
return
AjaxResult
.
success
(
ServiceCode
.
OK
+
""
,
"启用成功"
);
}
}
/**
* 禁用物料总分类管理
*/
@PreAuthorize
(
"@ss.hasPermi('Actsupplies:Actsupplies:Disable')"
)
@
GetMapping
(
"/disable/{id}
"
)
public
AjaxResult
setDisable
(
@PathVariable
(
"id"
)
Long
id
)
@
PutMapping
(
"/{id}/disable
"
)
public
AjaxResult
setDisable
(
@PathVariable
(
"id"
)
Long
id
,
@RequestParam
(
"status"
)
Integer
status
)
{
if
(
actSuppliesService
.
find
(
id
).
size
()>
0
||
actSuppliesService
.
findId
(
id
).
size
()>
0
){
...
...
@@ -186,9 +191,13 @@ public class ActSuppliesController extends BaseController
}
actSuppliesService
.
setDisable
(
id
);
return
AjaxResult
.
success
(
"200"
,
"修改成功"
);
actSuppliesService
.
setDisable
(
id
,
status
);
if
(
status
>
1
){
return
AjaxResult
.
error
(
ServiceCode
.
ERR_CODE
+
""
,
"禁用失败"
);
}
return
AjaxResult
.
success
(
"200"
,
"禁用成功"
);
}
...
...
ruoyi-supplies/src/main/java/com/ruoyi/system/controller/ActSuppliesConvertController.java
View file @
0f0f04bd
...
...
@@ -114,9 +114,6 @@ public class ActSuppliesConvertController extends BaseController{
}
/**
*
* */
}
ruoyi-supplies/src/main/java/com/ruoyi/system/controller/ActSuppliesDetailsController.java
View file @
0f0f04bd
...
...
@@ -12,6 +12,7 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
import
com.ruoyi.system.domain.ActSupplies
;
import
com.ruoyi.system.domain.ActSuppliesDetails
;
import
com.ruoyi.system.service.IActSuppliesDetailsService
;
import
com.ruoyi.system.web.ServiceCode
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -133,24 +134,34 @@ public class ActSuppliesDetailsController extends BaseController
* 启用物料细分类管理
*/
@PreAuthorize
(
"@ss.hasPermi('ActSuppliesDetails:ActSuppliesDetails:enable')"
)
@GetMapping
(
"/
enable/{id}
"
)
public
AjaxResult
setEnable
(
@PathVariable
(
"id"
)
Long
id
)
@GetMapping
(
"/
{id}/enable
"
)
public
AjaxResult
setEnable
(
@PathVariable
(
"id"
)
Long
id
,
@RequestParam
(
"status"
)
Integer
status
)
{
actSuppliesDetailsService
.
setEnable
(
id
);
return
AjaxResult
.
success
();
actSuppliesDetailsService
.
setEnable
(
id
,
status
);
if
(
status
<
0
){
return
AjaxResult
.
error
(
ServiceCode
.
ERR_CODE
+
""
,
"启用失败"
);
}
else
{
return
AjaxResult
.
success
(
ServiceCode
.
OK
+
""
,
"启用成功"
);
}
}
/**
* 禁用物料细分类管理
*/
@PreAuthorize
(
"@ss.hasPermi('ActSuppliesDetails:ActSuppliesDetails:Disable')"
)
@GetMapping
(
"/
disable/{id}
"
)
public
AjaxResult
setDisable
(
@PathVariable
(
"id"
)
Long
id
)
@GetMapping
(
"/
{id}/disable
"
)
public
AjaxResult
setDisable
(
@PathVariable
(
"id"
)
Long
id
,
@RequestParam
(
"status"
)
Integer
status
)
{
actSuppliesDetailsService
.
setDisable
(
id
);
return
AjaxResult
.
success
();
actSuppliesDetailsService
.
setDisable
(
id
,
status
);
if
(
status
>
1
){
return
AjaxResult
.
error
(
ServiceCode
.
ERR_CODE
+
""
,
"禁用失败"
);
}
return
AjaxResult
.
success
(
ServiceCode
.
OK
+
""
,
"启动成功"
);
}
}
ruoyi-supplies/src/main/java/com/ruoyi/system/controller/ActSuppliesRoleController.java
View file @
0f0f04bd
...
...
@@ -10,6 +10,7 @@ import com.ruoyi.common.core.domain.entity.SysUser;
import
com.ruoyi.common.utils.SecurityUtils
;
import
com.ruoyi.system.domain.ActSuppliesRoleDetail
;
import
com.ruoyi.system.domain.ActSuppliesTemplate
;
import
com.ruoyi.system.web.ServiceCode
;
import
org.springframework.beans.propertyeditors.CustomDateEditor
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.security.access.prepost.PreAuthorize
;
...
...
@@ -65,12 +66,6 @@ public class ActSuppliesRoleController extends BaseController
return
getDataTable
(
list
);
}
@InitBinder
public
void
initBinder
(
WebDataBinder
binder
,
WebRequest
request
)
{
//转换日期 注意这里的转化要和传进来的字符串的格式一直 如2015-9-9 就应该为yyyy-MM-dd
DateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
binder
.
registerCustomEditor
(
Date
.
class
,
new
CustomDateEditor
(
dateFormat
,
true
));
// CustomDateEditor为自定义日期编辑器
}
/**
* 查询规则详情列表
*/
...
...
@@ -172,33 +167,41 @@ public class ActSuppliesRoleController extends BaseController
return
toAjax
(
actSuppliesRoleService
.
deleteActSuppliesRoleByIds
(
ids
));
}
/**
* 启用物料总分类管理
*/
@PreAuthorize
(
"@ss.hasPermi('system:suppliesrole:enable')"
)
@
GetMapping
(
"/enable/{id}
"
)
public
AjaxResult
setEnable
(
@PathVariable
(
"id"
)
Long
id
)
@
PutMapping
(
"/{id}/enable
"
)
public
AjaxResult
setEnable
(
@PathVariable
(
"id"
)
Long
id
,
@RequestParam
(
"status"
)
Integer
status
)
{
actSuppliesRoleService
.
setEnable
(
id
);
return
AjaxResult
.
success
();
actSuppliesRoleService
.
setEnable
(
id
,
status
);
if
(
status
<
0
){
return
AjaxResult
.
error
(
ServiceCode
.
ERR_CODE
+
""
,
"启用失败"
);
}
else
{
return
AjaxResult
.
success
(
ServiceCode
.
OK
+
""
,
"启用成功"
);
}
}
/**
* 禁用物料总分类管理
*/
@PreAuthorize
(
"@ss.hasPermi('system:suppliesrole:Disable')"
)
@
GetMapping
(
"/disable/{id}
"
)
public
AjaxResult
setDisable
(
@PathVariable
(
"id"
)
Long
id
)
@
PutMapping
(
"/{id}/disable
"
)
public
AjaxResult
setDisable
(
@PathVariable
(
"id"
)
Long
id
,
@RequestParam
(
"status"
)
Integer
status
)
{
if
(
actSuppliesRoleService
.
find
(
Math
.
toIntExact
(
id
)).
size
()>
0
){
return
AjaxResult
.
success
(
"该规则下存在关联规则,请先删除关联规则!!!"
,
"操作失败"
);
return
AjaxResult
.
error
(
"该规则下存在关联规则,请先删除关联规则!!!"
,
"操作失败"
);
}
actSuppliesRoleService
.
setDisable
(
id
);
return
AjaxResult
.
success
(
"200"
,
"修改成功"
);
actSuppliesRoleService
.
setDisable
(
id
,
status
);
if
(
status
>
1
){
return
AjaxResult
.
error
(
ServiceCode
.
ERR_CODE
+
""
,
"禁用失败"
);
}
return
AjaxResult
.
success
(
ServiceCode
.
OK
+
""
,
"禁用成功"
);
}
...
...
ruoyi-supplies/src/main/java/com/ruoyi/system/controller/ActSuppliesTemplateController.java
View file @
0f0f04bd
...
...
@@ -3,9 +3,12 @@ package com.ruoyi.system.controller;
import
com.ruoyi.common.annotation.Log
;
import
com.ruoyi.common.core.controller.BaseController
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.common.core.domain.entity.SysUser
;
import
com.ruoyi.common.core.page.TableDataInfo
;
import
com.ruoyi.common.enums.BusinessType
;
import
com.ruoyi.common.utils.SecurityUtils
;
import
com.ruoyi.common.utils.poi.ExcelUtil
;
import
com.ruoyi.system.domain.ActSuppliesRole
;
import
com.ruoyi.system.domain.ActSuppliesTemplate
;
import
com.ruoyi.system.service.ActSuppliesTemplateService
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -41,6 +44,31 @@ public class ActSuppliesTemplateController extends BaseController {
}
/**
* 查询导入规则列表
*/
@PreAuthorize
(
"@ss.hasPermi('SuppliesTemplate:SuppliesTemplate:lists')"
)
@GetMapping
(
"/lists/{id}"
)
public
TableDataInfo
lists
(
@PathVariable
(
"id"
)
Integer
id
)
{
startPage
();
List
<
ActSuppliesRole
>
list
=
actSuppliesTemplateService
.
selectActSuppliesRoleList
(
id
);
return
getDataTable
(
list
);
}
/**
* 修改导入规则
*/
@PreAuthorize
(
"@ss.hasPermi('SuppliesTemplate:SuppliesTemplate:edit')"
)
@Log
(
title
=
"导入规则"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
(
"/edit/{id}"
)
public
AjaxResult
edit
(
@RequestBody
ActSuppliesRole
actSuppliesRole
)
{
SysUser
user
=
SecurityUtils
.
getLoginUser
().
getUser
();
actSuppliesRole
.
setUpdateBy
(
user
.
getUserName
());
return
toAjax
(
actSuppliesTemplateService
.
updateActSuppliesRole
(
actSuppliesRole
));
}
/**
* 导出Excel模板列表
*/
...
...
@@ -169,7 +197,7 @@ public class ActSuppliesTemplateController extends BaseController {
@GetMapping
(
"/enable/{id}"
)
public
AjaxResult
setEnable
(
@PathVariable
(
"id"
)
Long
id
)
{
System
.
out
.
println
(
"开始处理【启用物料总分类管理】的请求,参数:{}"
+
id
);
actSuppliesTemplateService
.
setEnable
(
id
);
return
AjaxResult
.
success
();
}
...
...
@@ -184,7 +212,7 @@ public class ActSuppliesTemplateController extends BaseController {
// if(actSuppliesTemplateService.find(id).size()>0){
// return AjaxResult.success("该物料下存在关联物料,请先删除关联物料!!!","操作失败");
// }
System
.
out
.
println
(
"开始处理【禁用物料总分类管理】的请求,参数:{}"
+
id
);
actSuppliesTemplateService
.
setDisable
(
id
);
return
AjaxResult
.
success
();
...
...
ruoyi-supplies/src/main/java/com/ruoyi/system/mapper/ActSuppliesDetailsMapper.java
View file @
0f0f04bd
...
...
@@ -5,6 +5,7 @@ import com.ruoyi.system.domain.ActSuppliesDetails;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
import
java.util.Map
;
/**
* 物料细分类管理Mapper接口
...
...
@@ -70,5 +71,9 @@ public interface ActSuppliesDetailsMapper
*/
public
int
countByDetailsName
(
String
detailsName
);
int
updateActSuppliesDetails
(
Map
<
String
,
Object
>
paramMap
);
int
setEnable
(
Map
<
String
,
Object
>
paramMap
);
int
setDisable
(
Map
<
String
,
Object
>
paramMap
);
List
<
ActSupplies
>
saveSid
();
}
ruoyi-supplies/src/main/java/com/ruoyi/system/mapper/ActSuppliesMapper.java
View file @
0f0f04bd
...
...
@@ -2,9 +2,11 @@ package com.ruoyi.system.mapper;
import
com.ruoyi.system.domain.ActSupplies
;
import
com.ruoyi.system.domain.ActSuppliesRole
;
import
io.lettuce.core.dynamic.annotation.Param
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
import
java.util.Map
;
/**
* 物料总分类管理Mapper接口
...
...
@@ -83,7 +85,9 @@ public interface ActSuppliesMapper
*/
public
int
countBySuppliesName
(
String
suppliesName
);
int
updateActSupplies
(
Map
<
String
,
Object
>
paramMap
);
int
setEnable
(
Map
<
String
,
Object
>
paramMap
);
int
setDisable
(
Map
<
String
,
Object
>
paramMap
);
List
<
ActSupplies
>
selectActSuppliesListOne
(
ActSupplies
actSupplies
);
}
ruoyi-supplies/src/main/java/com/ruoyi/system/mapper/ActSuppliesRoleMapper.java
View file @
0f0f04bd
package
com.ruoyi.system.mapper
;
import
java.util.List
;
import
java.util.Map
;
import
com.ruoyi.system.domain.ActSuppliesRole
;
import
com.ruoyi.system.domain.ActSuppliesRoleDetail
;
import
com.ruoyi.system.domain.ActSuppliesTemplate
;
...
...
@@ -85,9 +87,12 @@ public interface ActSuppliesRoleMapper
List
<
ActSuppliesTemplate
>
saveSid
();
int
updateActSuppliesRole
(
Map
<
String
,
Object
>
paramMap
);
int
setEnable
(
Map
<
String
,
Object
>
paramMap
);
int
setDisable
(
Map
<
String
,
Object
>
paramMap
);
List
<
Integer
>
findall
(
Integer
[]
ids
);
List
<
Integer
>
find
(
Integer
id
);
public
int
countByRoleName
(
ActSuppliesRole
actSuppliesRole
);
...
...
ruoyi-supplies/src/main/java/com/ruoyi/system/mapper/ActSuppliesTemplateMapper.java
View file @
0f0f04bd
package
com.ruoyi.system.mapper
;
import
com.ruoyi.system.domain.ActSuppliesRole
;
import
com.ruoyi.system.domain.ActSuppliesTemplate
;
import
org.springframework.stereotype.Repository
;
...
...
@@ -43,7 +44,13 @@ public interface ActSuppliesTemplateMapper
List
<
ActSuppliesTemplate
>
saveTemplateStatus
(
Long
[]
ids
);
int
selectHistory
(
Long
id
);
void
updateRelease
(
ActSuppliesTemplate
actSuppliesTemplate
);
ActSuppliesRole
selectActSuppliesRoleById
(
Integer
id
);
List
<
ActSuppliesRole
>
selectActSuppliesRoleList
(
Integer
id
);
int
updateActSuppliesRole
(
ActSuppliesRole
actSuppliesRole
);
int
selectHistory
(
Long
id
);
}
\ No newline at end of file
ruoyi-supplies/src/main/java/com/ruoyi/system/service/ActSuppliesTemplateService.java
View file @
0f0f04bd
package
com.ruoyi.system.service
;
import
com.ruoyi.system.domain.ActSuppliesRole
;
import
com.ruoyi.system.domain.ActSuppliesTemplate
;
import
java.util.List
;
...
...
@@ -50,4 +51,27 @@ public interface ActSuppliesTemplateService
int
offShelfStatus
(
Long
[]
ids
);
String
copyTemplate
(
Long
id
);
/**
* 查询导入规则
*
* @param id 导入规则ID
* @return 导入规则
*/
public
ActSuppliesRole
selectActSuppliesRoleById
(
Integer
id
);
/**
* 查询导入规则列表
*
* @param id 导入规则
* @return 导入规则集合
*/
public
List
<
ActSuppliesRole
>
selectActSuppliesRoleList
(
Integer
id
);
/**
* 修改导入规则
*
* @param actSuppliesRole 导入规则
* @return 结果
*/
public
int
updateActSuppliesRole
(
ActSuppliesRole
actSuppliesRole
);
}
ruoyi-supplies/src/main/java/com/ruoyi/system/service/IActSuppliesDetailsService.java
View file @
0f0f04bd
...
...
@@ -3,6 +3,7 @@ package com.ruoyi.system.service;
import
com.ruoyi.system.domain.ActSupplies
;
import
com.ruoyi.system.domain.ActSuppliesDetails
;
import
io.lettuce.core.dynamic.annotation.Param
;
import
java.util.List
;
...
...
@@ -65,18 +66,19 @@ public interface IActSuppliesDetailsService
List
<
ActSupplies
>
saveSid
();
/**
* 启用物料
总
分类管理
* 启用物料
细
分类管理
*
* @param id 尝试启用物料
总
分类管理的id
* @param id 尝试启用物料
细
分类管理的id
* @return
*/
void
setEnable
(
Long
id
);
int
setEnable
(
@Param
(
"id"
)
Long
id
,
@Param
(
"status"
)
Integer
status
);
/**
* 禁用
*
* @param id 尝试禁用物料
总
分类管理的id
* @param id 尝试禁用物料
细
分类管理的id
*/
void
setDisable
(
Long
id
);
int
setDisable
(
@Param
(
"id"
)
Long
id
,
@Param
(
"status"
)
Integer
status
);
}
ruoyi-supplies/src/main/java/com/ruoyi/system/service/IActSuppliesRoleService.java
View file @
0f0f04bd
...
...
@@ -4,7 +4,7 @@ import java.util.List;
import
com.ruoyi.system.domain.ActSuppliesRole
;
import
com.ruoyi.system.domain.ActSuppliesRoleDetail
;
import
com.ruoyi.system.domain.ActSuppliesTemplate
;
import
org.springframework.stereotype.Repository
;
import
io.lettuce.core.dynamic.annotation.Param
;
/**
* 导入规则Service接口
...
...
@@ -88,14 +88,15 @@ public interface IActSuppliesRoleService
* @param id 尝试启用物料细分类管理的id
* @return
*/
void
setEnable
(
Long
id
);
int
setEnable
(
@Param
(
"id"
)
Long
id
,
@Param
(
"status"
)
Integer
status
);
/**
* 禁用
*
* @param id 尝试禁用物料细分类管理的id
*/
void
setDisable
(
Long
id
);
int
setDisable
(
@Param
(
"id"
)
Long
id
,
@Param
(
"status"
)
Integer
status
);
List
<
Integer
>
findall
(
Integer
[]
ids
);
List
<
Integer
>
find
(
Integer
id
);
...
...
ruoyi-supplies/src/main/java/com/ruoyi/system/service/IActSuppliesService.java
View file @
0f0f04bd
package
com.ruoyi.system.service
;
import
com.ruoyi.system.domain.ActSupplies
;
import
io.lettuce.core.dynamic.annotation.Param
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
...
...
@@ -64,21 +65,21 @@ public interface IActSuppliesService
List
<
ActSupplies
>
options
();
/**
* 启用物料细分类管理
*
* @param id 尝试启用物料细分类管理的id
* @return
*/
void
setEnable
(
Long
id
);
int
setEnable
(
@Param
(
"id"
)
Long
id
,
@Param
(
"status"
)
Integer
status
);
/**
* 禁用
*
* @param id 尝试禁用物料细分类管理的id
*/
void
setDisable
(
Long
id
);
int
setDisable
(
@Param
(
"id"
)
Long
id
,
@Param
(
"status"
)
Integer
status
);
List
<
Integer
>
findall
(
Long
[]
ids
);
...
...
ruoyi-supplies/src/main/java/com/ruoyi/system/service/impl/ActSuppliesDetailsServiceImpl.java
View file @
0f0f04bd
...
...
@@ -10,7 +10,9 @@ import org.springframework.beans.BeanUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 物料细分类管理Service业务层处理
...
...
@@ -122,44 +124,32 @@ public class ActSuppliesDetailsServiceImpl implements IActSuppliesDetailsService
return
actSuppliesDetailsMapper
.
saveSid
();
}
@Override
public
void
setEnable
(
Long
id
)
{
updateStatusById
(
id
,
0
);
public
int
setEnable
(
Long
id
,
Integer
status
)
{
updateStatusById
(
id
,
status
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"id"
,
id
);
paramMap
.
put
(
"status"
,
status
);
return
actSuppliesDetailsMapper
.
setEnable
(
paramMap
);
}
@Override
public
void
setDisable
(
Long
id
)
{
updateStatusById
(
id
,
1
);
public
int
setDisable
(
Long
id
,
Integer
status
)
{
updateStatusById
(
id
,
status
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"id"
,
id
);
paramMap
.
put
(
"status"
,
status
);
return
actSuppliesDetailsMapper
.
setDisable
(
paramMap
);
}
private
void
updateStatusById
(
Long
id
,
Integer
status
){
String
[]
statusText
={
"禁用"
,
"启用"
};
private
int
updateStatusById
(
Long
id
,
Integer
status
){
//判断查询结果是否为空
ActSuppliesDetails
queryResult
=
actSuppliesDetailsMapper
.
selectActSuppliesDetailsById
(
id
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"id"
,
id
);
paramMap
.
put
(
"status"
,
status
);
if
(
queryResult
==
null
)
{
String
message
=
statusText
[
status
]
+
"物料细分类管理失败,尝试访问的数据不存在"
;
System
.
out
.
println
(
message
);
throw
new
RuntimeException
(
message
);
}
return
actSuppliesDetailsMapper
.
updateActSuppliesDetails
(
paramMap
);
//判断以上查询结果中的status是否与参数status相同
if
(
queryResult
.
getStatus
().
equals
(
status
)){
String
message
=
statusText
[
status
]
+
"物料细分类管理失败,当前物料细分类管理已经处理"
+
statusText
[
status
]
+
"状态!"
;
System
.
out
.
println
(
message
);
throw
new
RuntimeException
(
message
);
}
ActSuppliesDetails
actSuppliesDetails
=
new
ActSuppliesDetails
();
actSuppliesDetails
.
setId
(
id
);
actSuppliesDetails
.
setStatus
(
status
);
int
rows
=
actSuppliesDetailsMapper
.
updateActSuppliesDetails
(
actSuppliesDetails
);
if
(
rows
!=
1
)
{
String
message
=
statusText
[
status
]
+
"物料细分类管理失败,服务器忙请再次重试"
;
System
.
out
.
println
(
message
);
throw
new
RuntimeException
(
message
);
}
}
}
ruoyi-supplies/src/main/java/com/ruoyi/system/service/impl/ActSuppliesRoleServiceImpl.java
View file @
0f0f04bd
package
com.ruoyi.system.service.impl
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
com.ruoyi.common.core.domain.entity.SysUser
;
import
com.ruoyi.common.utils.DateUtils
;
...
...
@@ -219,13 +221,21 @@ public class ActSuppliesRoleServiceImpl implements IActSuppliesRoleService
}
@Override
public
void
setEnable
(
Long
id
)
{
updateStatusById
(
id
,
0
);
public
int
setEnable
(
Long
id
,
Integer
status
)
{
updateStatusById
(
id
,
status
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"id"
,
id
);
paramMap
.
put
(
"status"
,
status
);
return
actSuppliesRoleMapper
.
setEnable
(
paramMap
);
}
@Override
public
void
setDisable
(
Long
id
)
{
updateStatusById
(
id
,
1
);
public
int
setDisable
(
Long
id
,
Integer
status
)
{
updateStatusById
(
id
,
status
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"id"
,
id
);
paramMap
.
put
(
"status"
,
status
);
return
actSuppliesRoleMapper
.
setDisable
(
paramMap
);
}
@Override
...
...
ruoyi-supplies/src/main/java/com/ruoyi/system/service/impl/ActSuppliesServiceImpl.java
View file @
0f0f04bd
...
...
@@ -11,7 +11,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
javax.sql.rowset.serial.SerialException
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
static
jdk
.
nashorn
.
internal
.
runtime
.
regexp
.
joni
.
Config
.
log
;
...
...
@@ -126,19 +128,29 @@ public class ActSuppliesServiceImpl implements IActSuppliesService
return
actSuppliesMapper
.
options
();
}
@Override
public
List
<
Integer
>
findall
(
Long
[]
ids
)
{
return
actSuppliesMapper
.
findall
(
ids
);
public
int
setEnable
(
Long
id
,
Integer
status
)
{
updateStatusById
(
id
,
status
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"id"
,
id
);
paramMap
.
put
(
"status"
,
status
);
return
actSuppliesMapper
.
setEnable
(
paramMap
);
}
@Override
public
void
setEnable
(
Long
id
)
{
updateStatusById
(
id
,
0
);
public
int
setDisable
(
Long
id
,
Integer
status
)
{
updateStatusById
(
id
,
status
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"id"
,
id
);
paramMap
.
put
(
"status"
,
status
);
return
actSuppliesMapper
.
setDisable
(
paramMap
);
}
@Override
public
void
setDisable
(
Long
id
)
{
updateStatusById
(
id
,
1
);
public
List
<
Integer
>
findall
(
Long
[]
ids
)
{
return
actSuppliesMapper
.
findall
(
ids
);
}
@Override
...
...
@@ -162,35 +174,13 @@ public class ActSuppliesServiceImpl implements IActSuppliesService
return
actSuppliesMapper
.
selectActSuppliesListOne
(
actSupplies
);
}
private
void
updateStatusById
(
Long
id
,
Integer
status
){
String
[]
statusText
={
"禁用"
,
"启用"
};
private
int
updateStatusById
(
Long
id
,
Integer
status
){
//判断查询结果是否为空
ActSupplies
queryResult
=
actSuppliesMapper
.
selectActSuppliesById
(
id
);
if
(
queryResult
==
null
)
{
String
message
=
statusText
[
status
]
+
"物料总分类管理失败,尝试访问的数据不存在"
;
System
.
out
.
println
(
message
);
throw
new
RuntimeException
(
message
);
}
//判断以上查询结果中的status是否与参数status相同
if
(
queryResult
.
getStatus
().
equals
(
status
)){
String
message
=
statusText
[
status
]
+
"物料总分类管理失败,当前物料总分类管理已经处理"
+
statusText
[
status
]
+
"状态!"
;
System
.
out
.
println
(
message
);
throw
new
RuntimeException
(
message
);
}
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"id"
,
id
);
paramMap
.
put
(
"status"
,
status
);
ActSupplies
actSupplies
=
new
ActSupplies
();
actSupplies
.
setId
(
id
);
actSupplies
.
setStatus
(
status
);
int
rows
=
actSuppliesMapper
.
updateActSupplies
(
actSupplies
);
if
(
rows
!=
1
)
{
String
message
=
statusText
[
status
]
+
"物料总分类管理失败,服务器忙请再次重试"
;
System
.
out
.
println
(
message
);
throw
new
RuntimeException
(
message
);
}
return
actSuppliesMapper
.
updateActSupplies
(
paramMap
);
}
}
...
...
ruoyi-supplies/src/main/java/com/ruoyi/system/service/impl/ActSuppliesTemplateServiceImpl.java
View file @
0f0f04bd
...
...
@@ -4,7 +4,9 @@ import com.ruoyi.common.core.domain.AjaxResult;
import
com.ruoyi.common.core.domain.entity.SysUser
;
import
com.ruoyi.common.utils.DateUtils
;
import
com.ruoyi.common.utils.SecurityUtils
;
import
com.ruoyi.system.domain.ActSuppliesRole
;
import
com.ruoyi.system.domain.ActSuppliesTemplate
;
import
com.ruoyi.system.mapper.ActSuppliesRoleMapper
;
import
com.ruoyi.system.mapper.ActSuppliesTemplateMapper
;
import
com.ruoyi.system.service.ActSuppliesTemplateService
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -26,6 +28,9 @@ public class ActSuppliesTemplateServiceImpl implements ActSuppliesTemplateServic
@Autowired
private
ActSuppliesTemplateMapper
actSuppliesTemplateMapper
;
@Autowired
private
ActSuppliesRoleMapper
actSuppliesRoleMapper
;
@Override
public
List
<
ActSuppliesTemplate
>
selectSuppliesTemplateList
(
ActSuppliesTemplate
sysSupplies
)
{
...
...
@@ -57,6 +62,28 @@ public class ActSuppliesTemplateServiceImpl implements ActSuppliesTemplateServic
sysSupplies
.
setUpdateTime
(
DateUtils
.
getNowDate
());
return
actSuppliesTemplateMapper
.
updateSuppliesTemplate
(
sysSupplies
);
}
/**
* 查询导入规则
*
* @param id 导入规则
* @return 导入规则
*/
@Override
public
ActSuppliesRole
selectActSuppliesRoleById
(
Integer
id
)
{
return
actSuppliesTemplateMapper
.
selectActSuppliesRoleById
(
id
);
}
@Override
public
List
<
ActSuppliesRole
>
selectActSuppliesRoleList
(
Integer
id
)
{
return
actSuppliesTemplateMapper
.
selectActSuppliesRoleList
(
id
);
}
@Override
public
int
updateActSuppliesRole
(
ActSuppliesRole
actSuppliesRole
)
{
actSuppliesRole
.
setUpdateTime
(
DateUtils
.
getNowDate
());
return
actSuppliesTemplateMapper
.
updateActSuppliesRole
(
actSuppliesRole
);
}
@Override
public
List
<
String
>
deleteSuppliesTemplateByIds
(
Long
[]
ids
)
{
...
...
@@ -192,6 +219,8 @@ public class ActSuppliesTemplateServiceImpl implements ActSuppliesTemplateServic
}
private
void
updateStatusById
(
Long
id
,
Integer
status
){
String
[]
statusText
={
"禁用"
,
"启用"
};
...
...
ruoyi-supplies/src/main/resources/mapper/system/ActSuppliesDetailsMapper.xml
View file @
0f0f04bd
...
...
@@ -55,6 +55,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select a.id,a.pid,b.supplies_name fname,a.supplies_name,a.status from act_supplies a LEFT JOIN act_supplies b on a.pid =b.id where a.status = 0
</select>
<update
id=
"setEnable"
parameterType=
"java.util.Map"
>
UPDATE act_supplies_details
SET status = 0
WHERE id = #{id}
</update>
<update
id=
"setDisable"
parameterType=
"java.util.Map"
>
UPDATE act_supplies_details
SET status = 1
WHERE id = #{id}
</update>
<select
id=
"selectActSuppliesDetailsList"
parameterType=
"ActSuppliesDetails"
resultMap=
"OneActSuppliesDetailsResult"
>
select a.id, a.sid,b.supplies_name,a.details_name,a.sysclassify,a.status from act_supplies_details a left join act_supplies b on a.sid = b.id
<where>
...
...
ruoyi-supplies/src/main/resources/mapper/system/ActSuppliesMapper.xml
View file @
0f0f04bd
...
...
@@ -25,6 +25,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select
id=
"countBySuppliesName"
resultType=
"int"
>
select count(*) from act_supplies where supplies_name=#{suppliesName}
</select>
<select
id=
"selectActSuppliesList"
parameterType=
"ActSupplies"
resultMap=
"ActSuppliesResult"
>
select a.id,a.pid,b.supplies_name fname,a.supplies_name,a.status from act_supplies a , act_supplies b
<where>
...
...
@@ -96,6 +98,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</update>
<update
id=
"setEnable"
parameterType=
"java.util.Map"
>
UPDATE act_supplies
SET status = 0
WHERE id = #{id}
</update>
<update
id=
"setDisable"
parameterType=
"java.util.Map"
>
UPDATE act_supplies
SET status = 1
WHERE id = #{id}
</update>
<select
id=
"findall"
parameterType=
"String"
resultType=
"Integer"
>
...
...
@@ -127,6 +140,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- <delete id="deleteActSuppliesById" parameterType="Long">-->
<!-- delete from act_supplies where id = #{id}-->
<!-- </delete>-->
...
...
ruoyi-supplies/src/main/resources/mapper/system/ActSuppliesRoleMapper.xml
View file @
0f0f04bd
...
...
@@ -74,6 +74,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select id, temp_id, role_name, status, create_by, create_time, update_by, update_time from act_supplies_role
</sql>
<update
id=
"setEnable"
parameterType=
"java.util.Map"
>
UPDATE act_supplies_role
SET status = 0
WHERE id = #{id}
</update>
<update
id=
"setDisable"
parameterType=
"java.util.Map"
>
UPDATE act_supplies_role
SET status = 1
WHERE id = #{id}
</update>
<sql
id=
"selectActSuppliesRoleDetailVo"
>
select id, role_id, detail_name, detail_m_h, detail_m_l, detail_y_h, detail_y_l,detail_y_s, detail_content,convert_status, status, create_by, create_time, update_by, update_time from act_supplies_role_detail
</sql>
...
...
ruoyi-supplies/src/main/resources/mapper/system/ActSuppliesTemplateMapper.xml
View file @
0f0f04bd
...
...
@@ -17,6 +17,19 @@
</resultMap>
<resultMap
type=
"ActSuppliesRole"
id=
"ActSuppliesRoleResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"tempId"
column=
"temp_id"
/>
<result
property=
"roleName"
column=
"role_name"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"updateBy"
column=
"update_by"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
<result
property=
"templateName"
column=
"template_name"
/>
</resultMap>
<sql
id=
"selectSuppliesTemplateVo"
>
select id, det_id, template_name, template_content, status, create_by, create_time, update_by, update_time from act_supplies_template
</sql>
...
...
@@ -34,6 +47,32 @@
select template_name from act_supplies_template
</select>
<sql
id=
"selectActSuppliesRoleVo"
>
select id, temp_id, role_name, status, create_by, create_time, update_by, update_time from act_supplies_role
</sql>
<select
id=
"selectActSuppliesRoleList"
parameterType=
"Integer"
resultMap=
"ActSuppliesRoleResult"
>
select id , role_name from act_supplies_role where temp_id = #{id}
</select>
<select
id=
"selectActSuppliesRoleById"
parameterType=
"Integer"
resultMap=
"ActSuppliesRoleResult"
>
<include
refid=
"selectActSuppliesRoleVo"
/>
where temp_id = #{id}
</select>
<update
id=
"updateActSuppliesRole"
parameterType=
"ActSuppliesRole"
>
update act_supplies_role
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"tempId != null"
>
temp_id = #{tempId},
</if>
<if
test=
"roleName != null"
>
role_name = #{roleName},
</if>
<if
test=
"status != null"
>
status = #{status},
</if>
<if
test=
"createBy != null"
>
create_by = #{createBy},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
<if
test=
"updateBy != null"
>
update_by = #{updateBy},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime},
</if>
</trim>
where id = #{id}
</update>
<select
id=
"selectSuppliesTemplateList"
parameterType=
"ActSuppliesTemplate"
resultMap=
"SuppliesTemplateResult"
>
select id, det_id, template_name, status from act_supplies_template
<where>
...
...
ruoyi-ui/src/api/ActSuppliesDetails/ActSuppliesDetails.js
View file @
0f0f04bd
...
...
@@ -62,15 +62,14 @@ export function exportActSuppliesDetails(query) {
//启用
export
function
toggleEnable
(
id
)
{
return
request
({
url
:
'
/ActSuppliesDetails/ActSuppliesDetails/enable/
'
+
id
,
method
:
'
get
'
,
url
:
`/Actsupplies/Actsupplies/
${
id
}
/enable?status=0`
,
method
:
'
put
'
,
})
}
//禁用
export
function
toggleDisable
(
id
)
{
return
request
({
url
:
'
/ActSuppliesDetails/ActSuppliesDetails/disable/
'
+
id
,
method
:
'
ge
t
'
,
url
:
`/Actsupplies/Actsupplies/
${
id
}
/disable?status=1`
,
method
:
'
pu
t
'
,
})
}
ruoyi-ui/src/api/Actsupplies/Actsupplies.js
View file @
0f0f04bd
...
...
@@ -59,22 +59,35 @@ export function delSupplies(id) {
method
:
'
delete
'
})
}
//启用
export
function
toggleEnable
(
id
)
{
return
request
({
url
:
`/Actsupplies/Actsupplies/
${
id
}
/enable?status=0`
,
method
:
'
put
'
,
})
}
/*//启用
export function toggleEnable(id) {
return request({
url: '/Actsupplies/Actsupplies/enable/' +id,
method: 'get',
})
}
//禁用
}*/
export
function
toggleDisable
(
id
)
{
return
request
({
url
:
`/Actsupplies/Actsupplies/
${
id
}
/disable?status=1`
,
method
:
'
put
'
,
})
}
/*//禁用
export function toggleDisable(id) {
return request({
url: '/Actsupplies/Actsupplies/disable/' +id,
method: 'get',
})
}
}
*/
...
...
ruoyi-ui/src/api/ruoyi-myLuckyexcel/myluckyexcel.js
View file @
0f0f04bd
...
...
@@ -19,6 +19,22 @@ export function listSuppliesTemplate(query) {
})
}
// 查询导入规则列表
export
function
listSuppliesrole
(
id
)
{
return
request
({
url
:
'
/SuppliesTemplate/SuppliesTemplate/lists/
'
+
id
,
method
:
'
get
'
,
})
}
// 查询导入规则详细
export
function
getSuppliesrole
(
id
)
{
return
request
({
url
:
'
/system/suppliesrole/
'
+
id
,
method
:
'
get
'
})
}
//展示excel模板
export
function
listSuppliesTemplateId
(
id
)
{
return
request
({
...
...
@@ -35,6 +51,15 @@ export function getSuppliesTemplate(id) {
})
}
// 修改导入规则
export
function
updateSuppliesrole
(
id
)
{
return
request
({
url
:
'
/system/suppliesrole/edit
'
+
id
,
method
:
'
put
'
,
})
}
// 新增Excel模板
export
function
addSuppliesTemplate
(
data
)
{
return
request
({
...
...
ruoyi-ui/src/api/system/suppliesrole.js
View file @
0f0f04bd
...
...
@@ -87,17 +87,16 @@ export function exportSuppliesrole(query) {
//启用
export
function
toggleEnable
(
id
)
{
return
request
({
url
:
'
/system/suppliesrole/enable/
'
+
id
,
method
:
'
get
'
,
url
:
`/system/suppliesrole/
${
id
}
/enable?status=0`
,
method
:
'
put
'
,
})
}
//禁用
export
function
toggleDisable
(
id
)
{
return
request
({
url
:
'
/system/suppliesrole/disable/
'
+
id
,
method
:
'
get
'
,
url
:
`/system/suppliesrole/
${
id
}
/disable?status=1`
,
method
:
'
put
'
,
})
}
...
...
ruoyi-ui/src/views/system/ActSuppliesDetails/ActSuppliesDetails/index.vue
View file @
0f0f04bd
ruoyi-ui/src/views/system/Actsupplies/Actsupplies/index.vue
View file @
0f0f04bd
...
...
@@ -223,7 +223,7 @@ export default {
{
required
:
true
,
message
:
"
关联id不能为空
"
,
trigger
:
"
change
"
},
],
suppliesName
:[
{
required
:
true
,
message
:
"
物料
名称不能为空
"
,
trigger
:
"
blur
"
}
{
required
:
true
,
message
:
"
二级分类
名称不能为空
"
,
trigger
:
"
blur
"
}
],
},
idRules
:[
...
...
@@ -351,7 +351,7 @@ export default {
getSupplies
(
id
).
then
(
response
=>
{
this
.
form
=
response
.
data
;
this
.
open
=
true
;
this
.
title
=
"
修改
物料总分类管理
"
;
this
.
title
=
"
修改
二级分类
"
;
});
},
/** 提交按钮 */
...
...
@@ -380,7 +380,7 @@ export default {
handleDelete
(
row
)
{
const
ids
=
row
.
id
||
this
.
ids
;
const
name
=
row
.
suppliesName
||
this
.
name
;
this
.
$confirm
(
'
是否确认删除
物料总分类管理
编号为"
'
+
name
+
'
"的数据项?
'
,
"
警告
"
,
{
this
.
$confirm
(
'
是否确认删除
二级分类
编号为"
'
+
name
+
'
"的数据项?
'
,
"
警告
"
,
{
confirmButtonText
:
"
确定
"
,
cancelButtonText
:
"
取消
"
,
type
:
"
warning
"
...
...
ruoyi-ui/src/views/system/Actsupplies/Actsupplies/indexone.vue
View file @
0f0f04bd
...
...
@@ -215,7 +215,7 @@ export default {
{
required
:
true
,
message
:
"
关联id不能为空
"
,
trigger
:
"
change
"
},
],
suppliesName
:[
{
required
:
true
,
message
:
"
物料
名称不能为空
"
,
trigger
:
"
blur
"
}
{
required
:
true
,
message
:
"
一级分类
名称不能为空
"
,
trigger
:
"
blur
"
}
],
},
idRules
:[
...
...
@@ -339,7 +339,7 @@ export default {
this
.
reset
();
this
.
form
.
pid
=
0
;
this
.
open
=
true
;
this
.
title
=
"
新增
二
级分类
"
;
this
.
title
=
"
新增
一
级分类
"
;
},
/** 修改按钮操作 */
handleUpdate
(
row
)
{
...
...
@@ -348,7 +348,7 @@ export default {
getSupplies
(
id
).
then
(
response
=>
{
this
.
form
=
response
.
data
;
this
.
open
=
true
;
this
.
title
=
"
修改
物料总分类管理
"
;
this
.
title
=
"
修改
一级分类
"
;
});
},
/** 提交按钮 */
...
...
@@ -377,7 +377,7 @@ export default {
handleDelete
(
row
)
{
const
ids
=
row
.
id
||
this
.
ids
;
const
name
=
row
.
suppliesName
||
this
.
name
;
this
.
$confirm
(
'
是否确认删除
物料总分类管理
编号为"
'
+
name
+
'
"的数据项?
'
,
"
警告
"
,
{
this
.
$confirm
(
'
是否确认删除
一级分类
编号为"
'
+
name
+
'
"的数据项?
'
,
"
警告
"
,
{
confirmButtonText
:
"
确定
"
,
cancelButtonText
:
"
取消
"
,
type
:
"
warning
"
...
...
ruoyi-ui/src/views/system/supplies/index.vue
View file @
0f0f04bd
...
...
@@ -29,6 +29,7 @@
icon=
"el-icon-upload2"
size=
"mini"
@
click=
"handleExport"
v-hasPermi=
"['ruoyi-myexcel:myexcel:export']"
>
导出
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
...
...
@@ -110,6 +111,7 @@ export default {
this
.
depss
=
response
.
rows
;
});
},
/** 下拉选和页面luckysheet绑定 */
handleOptionChange
()
{
...
...
@@ -233,346 +235,91 @@ export default {
luckysheet
.
create
(
options
);
},
/** 导入事件*/
async
handleFileChange
(
evt
)
{
let
exx
;
const
cons
=
new
Promise
((
resolve
,
reject
)
=>
{
LuckyExcel
.
transformExcelToLucky
(
evt
,
exportJson
=>
{
exx
=
exportJson
;
resolve
(
exx
);
});
});
try
{
const
exportJson
=
await
cons
;
await
this
.
summary
(
exportJson
);
console
.
log
(
'
summary 执行完毕
'
);
this
.
submit
(
exportJson
);
}
catch
(
Error
)
{
/** 导入事件*/
handleFileChange
(
evt
)
{
if
(
this
.
disableNextButton
)
{
this
.
$message
.
warning
(
"
请先选择模板再进行导入!
"
);
return
false
;
// 如果按钮被禁用,提前返回,避免执行下一步操作
}
let
name
=
evt
.
name
let
suffixArr
=
name
.
split
(
'
.
'
),
suffix
=
suffixArr
[
suffixArr
.
length
-
1
]
if
(
suffix
!==
'
xlsx
'
)
{
this
.
$message
({
message
:
Error
.
message
,
type
:
"
error
"
});
console
.
log
(
Error
.
message
);
console
.
log
(
"
这里是最外面的地方
"
);
message
:
"
上传格式不正确,请上传xlsx格式文件
"
,
type
:
"
warning
"
});
return
}
LuckyExcel
.
transformExcelToLucky
(
evt
,
function
(
exportJson
)
{
if
(
exportJson
.
sheets
===
null
||
exportJson
.
sheets
.
length
===
0
)
{
this
.
$message
({
message
:
"
导入失败,请检查上传的文件是否正确
"
,
type
:
"
warning
"
});
return
}
},
/** 物料转换汇总到页面*/
summary
(
exportJson
){
let
sysRulez
;
let
sysRules
;
let
sysConver
;
let
value
=
[];
let
data
;
//获取规则 sysRulez是物料转换 sysRules是数据汇总规则 13
let
map
=
new
Map
();
//获取物料转换的规则
//
for
(
let
i
=
0
;
i
<
rule
.
length
;
i
++
){
if
(
rule
[
i
].
convertStatus
==
1
){
if
(
rule
[
i
].
convertStatus
=
==
1
){
sysRulez
=
JSON
.
parse
(
rule
[
i
].
detailContent
);
}
if
(
rule
[
i
].
convertStatus
==
2
){
if
(
parseInt
(
rule
[
i
].
detailYS
)
===
1
){
sysConver
=
JSON
.
parse
(
rule
[
i
].
detailContent
)
}
else
{
if
(
rule
[
i
].
convertStatus
===
2
){
sysRules
=
JSON
.
parse
(
rule
[
i
].
detailContent
);
}
}
}
try
{
//获取物料转换的sheet表
data
=
window
.
luckysheet
.
transToData
(
exportJson
.
sheets
[
sysRulez
[
0
].
se
].
celldata
);
}
catch
(
err
){
throw
new
Error
(
"
导入失败,所选文件或规则有误
"
);
}
//获取物料转换中导入表的列,用来获取物料名
let
key_i
=
parseInt
(
sysRulez
[
0
].
ce
);
let
data
=
window
.
luckysheet
.
transToData
(
exportJson
.
sheets
[
sysRulez
[
0
].
se
].
celldata
);
window
.
luckysheet
.
set
let
key_i
=
sysRulez
[
0
].
ce
;
//获取物料转换的数据
for
(
let
i
=
0
;
i
<
sysRules
.
length
;
i
++
){
//value.push(data[sysRules[i].re][sysRules[i].ce].m);
value
.
push
(
sysRules
[
i
].
ce
);
}
//console.log("value的值为:"+value);
return
new
Promise
((
resolve
,
reject
)
=>
{
const
asyncTasks
=
[];
switch
(
tempId
)
{
case
2
:
{
let
departmentMap
=
new
Map
();
let
departments
=
[];
departmentMap
.
set
(
'
原煤
'
,
[
'
综一队
'
,
'
综二队
'
,
'
综三队
'
,
'
开一区
'
,
'
开二区
'
,
'
准备一区
'
,
'
准备二区
'
,
'
掘进一区
'
,
'
掘进二区
'
,
'
掘进三区
'
,
'
开拓项目部
'
,
'
巷修区
'
,
'
井运区
'
,
'
通风区
'
,
'
机电运转中心
'
,
'
皮带运输中心
'
]);
departmentMap
.
set
(
'
风选煤
'
,
'
洗煤厂
'
);
departmentMap
.
set
(
'
制造费用
'
,
[
'
机电检修中心
'
,
'
地测科
'
,
'
设备管理科
'
,
'
旧品利用中心
'
,
'
机修加工中心
'
,
'
网络安全与信息通讯中心
'
,
'
保卫科
'
,
'
煤质管理科
'
,
'
迁建科
'
,
'
综合服务中心
'
]);
departmentMap
.
set
(
'
管理费用
'
,
[
'
财务部
'
,
'
综合办公室
'
,
'
纪委监察科
'
,
'
工会
'
,
'
团委
'
,
'
安全管理部
'
,
'
经营管理部
'
,
'
党委组织部(人力资源部)
'
,
'
党委宣传部
'
,
'
生产技术部
'
,
'
机电运输部
'
,
'
科协
'
,
'
节能环保法律办公室
'
,
'
党委组织部
'
,
'
人力资源部
'
]);
for
(
let
i
=
parseFloat
(
sysRulez
[
0
].
re
)
+
1
;
i
<
data
.
length
;
i
++
)
{
let
n
=
parseInt
(
sysRules
[
0
].
ce
)
+
2
;
if
(
data
[
i
][
key_i
]
!=
null
&&
data
[
i
][
n
]
!=
null
)
{
let
num
=
data
[
i
][
n
].
m
;
//根据得到的num,找到对应的key
let
keyy
=
getKeyByValue
(
departmentMap
,
num
);
departments
.
push
(
keyy
);
}
else
{
departments
.
push
(
null
);
}
}
for
(
let
key
of
departmentMap
.
keys
())
{
let
map
=
new
Map
();
let
smallMat
=
[];
//console.log(departments);
for
(
let
i
=
parseFloat
(
sysRulez
[
0
].
re
)
+
1
;
i
<
data
.
length
;
i
++
)
{
if
(
data
[
i
][
key_i
]
!=
null
&&
departments
[
i
-
1
]
===
key
)
{
let
num
=
data
[
i
][
key_i
].
m
;
smallMat
.
push
(
num
);
}
else
{
smallMat
.
push
(
null
);
}
}
//console.log(smallMat);
asyncTasks
.
push
(
new
Promise
((
innerResolve
,
innerReject
)
=>
{
const
allNull
=
smallMat
.
every
(
item
=>
item
===
null
);
if
(
allNull
)
{
throw
new
Error
(
"
导入失败,导入文件错误,所选文件与模板规则不匹
"
);
}
materialConvert
(
smallMat
)
.
then
(
response
=>
{
let
array
=
response
.
rows
;
//console.log(array);
//luckysheet.setCellValue(12, 1, {bg:"#FF0000"})
for
(
let
i
=
parseFloat
(
sysRulez
[
0
].
re
)
+
1
;
i
<
data
.
length
;
i
++
)
{
let
values
=
[];
if
(
data
[
i
][
13
]
!=
null
&&
departments
[
i
-
1
]
===
key
&&
data
[
i
][
key_i
]
!=
null
)
{
for
(
let
j
=
0
;
j
<
value
.
length
;
j
++
)
{
let
a
=
parseFloat
(
data
[
i
][
value
[
j
]].
v
);
values
.
push
(
a
);
}
//插入多个value的值
let
index
=
smallMat
.
indexOf
(
data
[
i
][
key_i
].
m
);
let
key
=
array
[
index
];
if
(
map
.
has
(
key
))
{
let
oldValues
=
map
.
get
(
key
);
for
(
let
i
=
0
;
i
<
values
.
length
;
i
++
)
{
values
[
i
]
=
parseFloat
(
parseFloat
(
values
[
i
]
+
oldValues
[
i
]).
toFixed
(
2
));
}
map
.
set
(
key
,
values
);
}
else
{
map
.
set
(
key
,
values
);
}
}
}
//循环得到汇总结果
//console.log(map);
let
cells
;
let
rowss
=
luckysheet
.
find
(
key
);
if
(
rowss
.
length
!=
0
)
{
for
(
let
i
=
0
;
i
<
sysRules
.
length
;
i
++
)
{
map
.
forEach
((
value
,
key
)
=>
{
let
searchResult
=
luckysheet
.
find
(
key
);
if
(
searchResult
.
length
!=
0
&&
key
!=
null
)
{
cells
=
searchResult
[
0
].
column
;
luckysheet
.
setCellValue
(
rowss
[
0
].
row
,
cells
,
value
[
i
]);
luckysheet
.
setCellValue
(
rowss
[
0
].
row
,
cells
,
{
"
ct
"
:
{
"
fa
"
:
"
General
"
,
"
t
"
:
"
n
"
}
});
}
});
}
value
.
push
(
sysRules
[
i
].
ce
);
}
}).
catch
(
Error
=>
{
console
.
log
(
"
这里是单个异步请求出错处
"
);
//必须加,不能删除
innerReject
(
Error
);
// 异步请求出错
});
}));
}
}
break
;
case
6
:
{
let
deps
=
[];
let
exps
=
[];
let
map
=
new
Map
();
let
smallMat
=
[];
for
(
let
i
=
parseFloat
(
sysRulez
[
0
].
re
)
+
1
;
i
<
data
.
length
;
i
++
)
{
if
(
data
[
i
][
key_i
]
!=
null
)
{
let
num
=
data
[
i
][
key_i
].
m
;
let
dep
=
data
[
i
][
1
].
m
;
let
exp
=
data
[
i
][
14
].
m
;
let
smallMat
=
[];
for
(
let
i
=
parseInt
(
sysRulez
[
0
].
re
)
+
1
;
i
<
data
.
length
;
i
++
){
if
(
data
[
i
][
key_i
]
!=
null
){
let
num
=
data
[
i
][
key_i
].
m
;
smallMat
.
push
(
num
);
deps
.
push
(
dep
);
exps
.
push
(
exp
);
}
else
{
}
else
{
smallMat
.
push
(
null
);
deps
.
push
(
null
);
exps
.
push
(
null
);
}
}
//console.log(smallMat);
asyncTasks
.
push
(
new
Promise
((
innerResolve
,
innerReject
)
=>
{
const
allNull
=
smallMat
.
every
(
item
=>
item
===
null
);
const
allNull1
=
deps
.
every
(
item
=>
item
===
null
);
const
allNull2
=
exps
.
every
(
item
=>
item
===
null
);
if
(
allNull
||
allNull1
||
allNull2
)
{
throw
new
Error
(
"
导入失败,导入文件错误,所选文件与模板规则不匹
"
);
}
materialConvert
(
smallMat
)
.
then
(
response
=>
{
let
array
=
response
.
rows
;
//console.log(array);
//luckysheet.setCellValue(12, 1, {bg:"#FF0000"})
for
(
let
i
=
parseFloat
(
sysRulez
[
0
].
re
)
+
1
,
k
=
0
;
i
<
data
.
length
;
i
++
,
k
++
)
{
let
values
=
[];
if
(
data
[
i
][
key_i
]
!=
null
)
{
for
(
let
j
=
0
;
j
<
value
.
length
;
j
++
)
{
try
{
let
a
=
parseFloat
(
data
[
i
][
value
[
j
]].
v
);
values
.
push
(
a
);
}
catch
(
err
){
throw
new
Error
(
"
导入失败,导入文件不匹
"
);
}
}
//插入多个value的值
let
key
=
exps
[
k
]
+
'
/
'
+
deps
[
k
]
+
'
/
'
+
array
[
k
];
if
(
map
.
has
(
key
))
{
let
oldValues
=
map
.
get
(
key
);
for
(
let
i
=
0
;
i
<
values
.
length
;
i
++
)
{
values
[
i
]
=
parseFloat
(
parseFloat
(
values
[
i
]
+
oldValues
[
i
]).
toFixed
(
2
));
}
map
.
set
(
key
,
values
);
}
else
{
map
.
set
(
key
,
values
);
}
}
}
//循环得到汇总结果
console
.
log
(
map
);
if
(
map
.
size
===
0
)
{
throw
new
Error
(
"
导入失败,导入文件错误
"
);
}
//循环得到汇总结果
let
cells
;
let
rowws
;
let
con
=
0
;
let
warn
;
for
(
let
i
=
0
;
i
<
sysRules
.
length
;
i
++
)
{
map
.
forEach
((
value
,
key
)
=>
{
const
suffixArr
=
key
.
split
(
'
/
'
),
mat
=
suffixArr
[
2
],
depp
=
suffixArr
[
1
],
expp
=
suffixArr
[
0
];
//console.log(expp);console.log(depp);console.log(mat);
let
searchResult
=
luckysheet
.
find
(
expp
);
if
(
searchResult
.
length
===
0
&&
expp
==
null
)
{
warn
++
;
return
}
rowws
=
searchResult
[
0
].
row
;
for
(
let
i
=
1
;
i
<
10000000000000000000000000
;
i
++
)
{
let
n
=
rowws
+
i
;
let
gg
=
luckysheet
.
getCellValue
(
n
,
0
);
if
(
gg
!==
null
)
{
con
=
rowws
+
i
;
break
;
}
}
searchResult
=
luckysheet
.
find
(
depp
);
let
k
=
0
;
let
r
;
for
(
let
i
=
0
;
i
<
searchResult
.
length
;
i
++
){
r
=
searchResult
[
i
].
row
;
if
(
r
<
con
&&
r
>=
rowws
){
k
=
1
;
break
;
}
}
if
(
k
===
1
){
let
matResult
=
luckysheet
.
find
(
mat
);
if
(
matResult
.
length
!==
0
&&
mat
!=
null
)
{
cells
=
matResult
[
0
].
column
;
luckysheet
.
setCellValue
(
r
,
cells
,
value
[
i
]);
luckysheet
.
setCellValue
(
r
,
cells
,
{
"
ct
"
:
{
"
fa
"
:
"
General
"
,
"
t
"
:
"
n
"
}
});
}
}
});
}
}).
catch
(
Error
=>
{
console
.
log
(
"
这里是单个异步请求出错处
"
);
//必须加,不能删除
innerReject
(
Error
);
// 异步请求出错
});
}));
}
break
;
case
1
:
{
let
map
=
new
Map
();
let
smallMat
=
[];
for
(
let
i
=
parseInt
(
sysRulez
[
0
].
re
)
+
1
;
i
<
data
.
length
;
i
++
)
{
if
(
data
[
i
][
key_i
]
!=
null
)
{
let
num
=
data
[
i
][
key_i
].
m
;
smallMat
.
push
(
num
);
}
else
{
smallMat
.
push
(
null
);
}
}
for
(
let
j
=
0
;
j
<
value
.
length
;
j
++
)
{
if
(
data
[
sysRulez
[
0
].
re
][
value
[
j
]]
!=
null
)
{
let
num
=
data
[
sysRulez
[
0
].
re
][
value
[
j
]].
m
;
smallMat
.
push
(
num
);
}
else
{
smallMat
.
push
(
null
);
}
}
//console.log(smallMat);
asyncTasks
.
push
(
new
Promise
((
innerResolve
,
innerReject
)
=>
{
const
allNull
=
smallMat
.
every
(
item
=>
item
===
null
);
if
(
allNull
)
{
throw
new
Error
(
"
导入失败,导入文件错误,所选文件与模板规则不匹
"
);
}
materialConvert
(
smallMat
)
.
then
(
response
=>
{
materialConvert
(
smallMat
).
then
(
response
=>
{
debugger
let
array
=
response
.
rows
;
//console.log(array);
//luckysheet.setCellValue(12, 1, {bg:"#FF0000"})
for
(
let
i
=
parseInt
(
sysRulez
[
0
].
re
)
+
1
;
i
<
data
.
length
;
i
++
)
{
for
(
let
i
=
parseInt
(
sysRulez
[
0
].
re
)
+
1
;
i
<
data
.
length
;
i
++
)
{
let
values
=
[];
if
(
data
[
i
][
key_i
]
!=
null
)
{
for
(
let
j
=
0
;
j
<
value
.
length
;
j
++
)
{
try
{
if
(
data
[
i
][
key_i
]
!=
null
){
for
(
let
j
=
0
;
j
<
value
.
length
;
j
++
)
{
let
a
=
parseFloat
(
data
[
i
][
value
[
j
]].
v
);
if
(
isNaN
(
a
))
{
a
=
0
;
if
(
isNaN
(
a
))
{
a
=
0
;
}
values
.
push
(
a
);
}
catch
(
err
){
throw
new
Error
(
"
导入失败,导入文件不匹
"
);
}
}
}
else
{
}
else
{
break
;
}
//插入多个value的值
let
index
=
smallMat
.
indexOf
(
data
[
i
][
key_i
].
m
);
let
key
=
array
[
index
];
key
=
key
+
"
-
"
+
data
[
i
][
sysRulez
[
1
].
ce
].
m
if
(
map
.
has
(
key
))
{
let
oldValues
=
map
.
get
(
key
);
for
(
let
i
=
0
;
i
<
values
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
values
.
length
;
i
++
)
{
values
[
i
]
=
parseFloat
(
parseFloat
(
parseFloat
(
values
[
i
])
+
parseFloat
(
oldValues
[
i
])).
toFixed
(
2
));
}
map
.
set
(
key
,
values
);
...
...
@@ -580,182 +327,54 @@ export default {
map
.
set
(
key
,
values
);
}
}
if
(
map
.
size
===
0
)
{
throw
new
Error
(
"
导入失败,导入文件错误
"
);
}
//循环得到汇总结果
let
row
;
let
con
;
let
warn
=
0
;
console
.
log
(
map
);
for
(
let
i
=
0
;
i
<
sysRules
.
length
;
i
++
)
{
map
.
forEach
((
value
,
key
)
=>
{
let
matchingCells
=
[];
let
name
=
data
[
sysRules
[
i
].
re
][
sysRules
[
i
].
ce
].
m
if
(
name
.
includes
(
"
洗煤
"
))
{
row
=
sysRules
[
i
].
rt
;
con
=
parseInt
(
sysRules
[
i
].
rt
)
+
10
;
let
splitElement
=
key
.
split
(
"
-
"
);
row
=
luckysheet
.
find
(
splitElement
[
0
])[
0
].
row
if
(
splitElement
[
1
]
!==
'
undefined
'
)
{
let
find
=
luckysheet
.
find
(
splitElement
[
1
])[
0
];
if
(
find
!=
null
&&
luckysheet
.
getCellValue
(
find
.
row
,
0
)
===
0
)
{
// for (let i =0;i
<
value
.
length
;
i
++
)
{
// luckysheet.setCellValue(sysConver[i].rt, sysConver[i].ct, value[i]);
// luckysheet.setCellValue(sysConver[i].rt, sysConver[i].ct, {
// "ct": {
// "fa": "General",
// "t": "n"
// }
// });
// }
}
else
{
row
=
sysRules
[
i
].
rt
;
con
=
54
;
}
for
(;
row
<=
con
;
row
++
)
{
let
cellValue
=
luckysheet
.
getCellValue
(
row
,
parseInt
(
sysRulez
[
0
].
ct
));
if
(
cellValue
===
null
)
{
warn
++
}
else
{
if
(
cellValue
.
includes
(
key
))
{
luckysheet
.
setCellValue
(
row
,
sysRules
[
i
].
ct
,
value
[
i
]);
luckysheet
.
setCellValue
(
row
,
sysRules
[
i
].
ct
,
{
"
ct
"
:
{
"
fa
"
:
"
General
"
,
"
t
"
:
"
n
"
}
});
break
;
}
else
{
}
}
}
});
}
let
value2
=
[];
let
map2
=
new
Map
;
for
(
let
i
=
0
;
i
<
sysConver
.
length
;
i
++
)
{
//value.push(data[sysRules[i].re][sysRules[i].ce].m);
value2
.
push
(
sysConver
[
i
].
ce
);
}
for
(
let
i
=
parseInt
(
sysRulez
[
0
].
re
)
+
1
;
i
<
data
.
length
;
i
++
)
{
let
values2
=
[];
if
(
data
[
i
][
key_i
]
!=
null
)
{
for
(
let
j
=
0
;
j
<
value2
.
length
;
j
++
)
{
try
{
let
a
=
parseFloat
(
data
[
i
][
value2
[
j
]].
v
);
if
(
isNaN
(
a
))
{
a
=
0
;
}
values2
.
push
(
a
);
}
catch
(
err
){
throw
new
Error
(
"
导入失败,导入文件不匹
"
);
}
}
}
else
{
break
;
}
//插入多个value的值
let
key
=
data
[
sysConver
[
0
].
re
][
sysConver
[
0
].
ce
].
v
;
if
(
map2
.
has
(
key
))
{
let
oldValues
=
map2
.
get
(
key
);
for
(
let
i
=
0
;
i
<
values2
.
length
;
i
++
)
{
values2
[
i
]
=
parseFloat
(
parseFloat
(
parseFloat
(
values2
[
i
])
+
parseFloat
(
oldValues
[
i
])).
toFixed
(
2
));
}
map2
.
set
(
key
,
values2
);
}
else
{
map2
.
set
(
key
,
values2
);
}
}
if
(
map2
.
size
===
0
)
{
throw
new
Error
(
"
导入失败,导入文件错误
"
);
}
map2
.
forEach
((
value
,
key
)
=>
{
for
(
let
i
=
0
;
i
<
value
.
length
;
i
++
)
{
luckysheet
.
setCellValue
(
sysConver
[
i
].
rt
,
sysConver
[
i
].
ct
,
value
[
i
]);
luckysheet
.
setCellValue
(
sysConver
[
i
].
rt
,
sysConver
[
i
].
ct
,
{
"
ct
"
:
{
"
fa
"
:
"
General
"
,
"
t
"
:
"
n
"
}
});
}
})
}).
catch
(
Error
=>
{
console
.
log
(
"
这里是单个异步请求出错处
"
);
//必须加,不能删除
innerReject
(
Error
);
// 异步请求出错
});
}));
}
break
;
case
7
:
{
let
map
=
new
Map
();
let
smallMat
=
[];
let
deps
=
[];
for
(
let
i
=
parseFloat
(
sysRulez
[
0
].
re
)
+
1
;
i
<
data
.
length
;
i
++
)
{
if
(
data
[
i
][
sysRulez
[
1
].
ce
]
!=
null
&&
data
[
i
][
key_i
]
!=
null
)
{
let
num
=
data
[
i
][
key_i
].
m
;
let
dep
=
data
[
i
][
sysRulez
[
1
].
ce
].
m
;
if
(
dep
){
smallMat
.
push
(
null
);
deps
.
push
(
null
);
}
else
{
smallMat
.
push
(
num
);
deps
.
push
(
dep
);
}
}
else
{
smallMat
.
push
(
null
);
deps
.
push
(
null
);
}
}
debugger
console
.
log
(
deps
);
asyncTasks
.
push
(
new
Promise
((
innerResolve
,
innerReject
)
=>
{
const
allNull
=
smallMat
.
every
(
item
=>
item
===
null
);
if
(
allNull
)
{
throw
new
Error
(
"
导入失败,导入文件错误,所选文件与模板规则不匹
"
);
}
materialConvert
(
smallMat
)
.
then
(
response
=>
{
let
array
=
response
.
rows
;
for
(
let
i
=
parseFloat
(
sysRulez
[
0
].
re
)
+
1
,
k
=
0
;
i
<
data
.
length
;
i
++
,
k
++
)
{
let
values
=
[];
if
(
data
[
i
][
key_i
]
!=
null
)
{
for
(
let
j
=
0
;
j
<
value
.
length
;
j
++
)
{
try
{
let
a
=
parseFloat
(
data
[
i
][
value
[
j
]].
v
);
values
.
push
(
a
);
}
catch
(
err
){
this
.
$message
({
message
:
"
导入失败,导入文件不匹
"
,
type
:
"
error
"
});
innerReject
(
error
);
// 异步请求出错
}
}
//插入多个value的值
//此方法只适用于一对一唯一值
/*let index = smallMat.indexOf(data[i][key_i].m);
let key = array[index];*/
let
key
=
array
[
k
]
+
'
/
'
+
deps
[
k
];
if
(
map
.
has
(
key
))
{
let
oldValues
=
map
.
get
(
key
);
for
(
let
i
=
0
;
i
<
values
.
length
;
i
++
)
{
values
[
i
]
=
parseFloat
(
parseFloat
(
values
[
i
]
+
oldValues
[
i
]).
toFixed
(
2
));
}
map
.
set
(
key
,
values
);
}
else
{
map
.
set
(
key
,
values
);
}
}
}
//循环得到汇总结果
console
.
log
(
map
);
if
(
map
.
size
===
0
)
{
this
.
$message
({
message
:
"
导入失败,导入文件错误
"
,
type
:
"
error
"
});
innerReject
(
error
);
// 异步请求出错
}
//返回单元格第二行的数据
//let celn=luckysheet.getcellvalue(1);
//返回当前工作表第1列数据
//let cown=luckysheet.getcellvalue(null,0);
let
rowws
;
let
rowindex
;
let
colindex
;
let
config
;
// let bord={
// "rangeType": "cell",
// "value": {
// "row_index": 0,
// "col_index": 0,
// "l": {
// "style": 1,
// "color": "#000000"
// },
// "r": {
// "style": 1,
// "color": "#000000"
// },
// "t": {
// "style": 1,
// "color": "#000000"
// },
// "b": {
// "style": 1,
// "color": "#000000"
// }
// }
// };
let
bord
=
{
"
rangeType
"
:
"
range
"
,
"
borderType
"
:
"
border-all
"
,
...
...
@@ -766,186 +385,102 @@ export default {
"
column
"
:
[
0
,
0
]
}]
}
let
warn
=
0
;
map
.
forEach
((
value
,
key
)
=>
{
const
suffixArr
=
key
.
split
(
'
/
'
),
mat
=
suffixArr
[
0
],
depp
=
suffixArr
[
1
];
//console.log(mat);console.log(depp);
let
searchResult
=
luckysheet
.
find
(
mat
);
rowws
=
searchResult
[
0
].
row
;
if
(
searchResult
.
length
!=
0
&&
key
!=
null
)
{
luckysheet
.
insertRow
(
rowws
+
1
);
//输出部门数量金额
luckysheet
.
setCellValue
(
rowws
+
1
,
sysRulez
[
1
].
ct
,
depp
);
for
(
let
i
=
0
;
i
<
sysRules
.
length
;
i
++
)
{
luckysheet
.
setCellValue
(
rowws
+
1
,
sysRules
[
i
].
ct
,
value
[
i
]);
//修改单元格样式
/*luckysheet.setCellValue(rowws+g, sysRules[i].ct, {
"ct": {
"fa": "General",
"t": "n"
}
});*/
let
cellValue
=
luckysheet
.
getcellvalue
(
row
);
luckysheet
.
insertRow
(
row
+
1
)
luckysheet
.
setCellValue
(
row
+
1
,
sysRulez
[
0
].
ct
,
splitElement
[
0
]);
luckysheet
.
setCellValue
(
row
+
1
,
sysRulez
[
0
].
ct
,
cellValue
[
0
]);
// config = luckysheet.getConfig(0);
// bord.value.row_index = row+1;
// bord.value.col_index = parseInt(sysRulez[0].ct);
// config.borderInfo.push(bord);
// luckysheet.setConfig(config);
//
// config = luckysheet.getConfig(0);
// bord.value.row_index = row+1;
// bord.value.col_index = parseInt(sysRulez[0].ct)+1;
// config.borderInfo.push(bord);
// luckysheet.setConfig(config);
luckysheet
.
setCellValue
(
row
+
1
,
sysRulez
[
1
].
ct
,
splitElement
[
1
]);
luckysheet
.
setCellValue
(
row
+
1
,
sysRulez
[
1
].
ct
,
cellValue
[
2
]);
// config = luckysheet.getConfig(0);
// bord.value.row_index = row+1;
// bord.value.col_index = parseInt(sysRulez[1].ct);
// config.borderInfo.push(bord);
// luckysheet.setConfig(config);
if
(
value
[
0
]
===
0
){
luckysheet
.
setCellValue
(
row
+
1
,
parseInt
(
sysRules
[
0
].
ct
)
+
1
,
0
);
luckysheet
.
setCellValue
(
row
+
1
,
parseInt
(
sysRules
[
0
].
ct
)
+
1
,
cellValue
[
4
]);
}
else
{
luckysheet
.
setCellValue
(
row
+
1
,
parseInt
(
sysRules
[
0
].
ct
)
+
1
,
value
[
1
]
/
value
[
0
]);
luckysheet
.
setCellValue
(
row
+
1
,
parseInt
(
sysRules
[
0
].
ct
)
+
1
,
cellValue
[
4
]);
}
//输出单价
luckysheet
.
setCellValue
(
rowws
+
1
,
parseInt
(
sysRules
[
0
].
ct
)
+
1
,
value
[
1
]
/
value
[
0
]);
//修改单价样式
/*luckysheet.setCellValue(rowws+g,parseInt(sysRules[0].ct)+1,{
// config = luckysheet.getConfig(0);
// bord.value.row_index = row+1;
// bord.value.col_index = parseInt(sysRules[0].ct)+1;
// config.borderInfo.push(bord);
// luckysheet.setConfig(config);
for
(
let
i
=
0
;
i
<
value
.
length
;
i
++
)
{
luckysheet
.
setCellValue
(
row
+
1
,
sysRules
[
i
].
ct
,
value
[
i
]);
luckysheet
.
setCellValue
(
row
+
1
,
sysRules
[
i
].
ct
,
{
"
ct
"
:
{
"fa": "0.0000
",
"
fa
"
:
"
General
"
,
"
t
"
:
"
n
"
}
});*/
}
else
{
warn
++
;
});
luckysheet
.
setCellValue
(
row
+
1
,
sysRules
[
i
].
ct
,
cellValue
[
3
]);
// config = luckysheet.getConfig(0);
// bord.value.row_index = row+1;
// bord.value.col_index = parseInt(sysRules[i].ct);
// config.borderInfo.push(bord);
// luckysheet.setConfig(config);
}
config
=
luckysheet
.
getConfig
(
0
);
bord
.
range
[
0
].
row
=
[
rowws
+
1
,
rowws
+
1
];
bord
.
range
[
0
].
column
=
[
0
,
sysRules
[
sysRules
.
length
-
1
].
ct
];
bord
.
range
[
0
].
row
=
[
row
+
1
,
row
+
1
];
bord
.
range
[
0
].
column
=
[
sysRulez
[
0
].
ct
,
sysRules
[
sysRules
.
length
-
1
].
ct
];
config
.
borderInfo
.
push
(
bord
);
luckysheet
.
setConfig
(
config
);
});
console
.
log
(
warn
);
/*let find1 = luckysheet.find("合计");
let number = parseInt(find1[0].row)-1;
luckysheet.setCellValue(find1[0].row, sysRules[sysRules.length-1].ct, "=SUM(F2:F"+number+")")*/
}).
catch
(
Error
=>
{
console
.
log
(
"
这里是单个异步请求出错处
"
);
//必须加,不能删除
innerReject
(
Error
);
// 异步请求出错
});
}));
}
break
;
default
:
{
let
map
=
new
Map
();
let
smallMat
=
[];
for
(
let
i
=
parseFloat
(
sysRulez
[
0
].
re
)
+
1
;
i
<
data
.
length
;
i
++
)
{
if
(
data
[
i
][
key_i
]
!=
null
)
{
let
num
=
data
[
i
][
key_i
].
m
;
smallMat
.
push
(
num
);
}
else
{
smallMat
.
push
(
null
);
}
}
asyncTasks
.
push
(
new
Promise
((
innerResolve
,
innerReject
)
=>
{
const
allNull
=
smallMat
.
every
(
item
=>
item
===
null
);
if
(
allNull
)
{
throw
new
Error
(
"
导入失败,导入文件错误,所选文件与模板规则不匹
"
);
}
materialConvert
(
smallMat
)
.
then
(
response
=>
{
let
array
=
response
.
rows
;
for
(
let
i
=
parseFloat
(
sysRulez
[
0
].
re
)
+
1
;
i
<
data
.
length
;
i
++
)
{
let
values
=
[];
let
index
;
if
(
data
[
i
][
key_i
]
!=
null
)
{
for
(
let
j
=
0
;
j
<
value
.
length
;
j
++
)
{
try
{
let
a
=
parseFloat
(
data
[
i
][
value
[
j
]].
v
);
values
.
push
(
a
);
}
catch
(
err
){
throw
new
Error
(
"
导入失败,导入文件不匹
"
);
}
}
//插入多个value的值
index
=
smallMat
.
indexOf
(
data
[
i
][
key_i
].
m
);
let
key
=
array
[
index
];
if
(
map
.
has
(
key
))
{
let
oldValues
=
map
.
get
(
key
);
for
(
let
i
=
0
;
i
<
values
.
length
;
i
++
)
{
values
[
i
]
=
parseFloat
(
parseFloat
(
values
[
i
]
+
oldValues
[
i
]).
toFixed
(
2
));
}
map
.
set
(
key
,
values
);
}
else
{
map
.
set
(
key
,
values
);
}
else
{
luckysheet
.
setCellValue
(
row
,
parseInt
(
sysRulez
[
1
].
ct
),
"
无
"
);
if
(
value
[
0
]
===
0
){
luckysheet
.
setCellValue
(
row
,
parseInt
(
sysRules
[
0
].
ct
)
+
1
,
0
);
}
else
{
luckysheet
.
setCellValue
(
row
,
parseInt
(
sysRules
[
0
].
ct
)
+
1
,
value
[
1
]
/
value
[
0
]);
}
for
(
let
i
=
0
;
i
<
value
.
length
;
i
++
)
{
luckysheet
.
setCellValue
(
row
,
sysRules
[
i
].
ct
,
value
[
i
]);
// config = luckysheet.getConfig(0);
// bord.value.row_index = row+1;
// bord.value.col_index = parseInt(sysRules[i].ct);
// config.borderInfo.push(bord);
// luckysheet.setConfig(config);
}
}
//循环得到汇总结果
console
.
log
(
map
);
if
(
map
.
size
===
0
)
{
throw
new
Error
(
"
导入失败,导入文件错误
"
);
}
let
rowws
;
let
warn
=
0
;
for
(
let
i
=
0
;
i
<
sysRules
.
length
;
i
++
)
{
map
.
forEach
((
value
,
key
)
=>
{
let
searchResult
;
searchResult
=
luckysheet
.
find
(
key
);
if
(
searchResult
&&
searchResult
.
length
!==
0
&&
key
!=
null
)
{
rowws
=
searchResult
[
0
].
row
;
luckysheet
.
setCellValue
(
rowws
,
sysRules
[
i
].
ct
,
value
[
i
]);
luckysheet
.
setCellValue
(
rowws
,
sysRules
[
i
].
ct
,
{
"
ct
"
:
{
"
fa
"
:
"
General
"
,
"
t
"
:
"
n
"
}
});
}
else
{
warn
++
;
}
});
}
if
(
warn
/
sysRules
.
length
===
map
.
size
)
{
throw
new
Error
(
"
导入文件与所选模板规则不匹配
"
);
}
else
if
(
warn
>
0
)
{
this
.
$message
({
message
:
"
还有
"
+
warn
/
sysRules
.
length
+
"
条大类未能匹配到
"
,
type
:
"
warning
"
});
}
resolve
(
response
.
rows
);
innerResolve
();
// 标记当前异步任务完成
}).
catch
(
Error
=>
{
console
.
log
(
"
这里是单个异步请求出错处
"
);
//必须加,不能删除
innerReject
(
Error
);
// 异步请求出错
let
find1
=
luckysheet
.
find
(
"
合计
"
);
let
number
=
parseInt
(
find1
[
0
].
row
)
-
1
;
luckysheet
.
setCellValue
(
find1
[
0
].
row
,
sysRules
[
sysRules
.
length
-
1
].
ct
,
"
=SUM(F2:F
"
+
number
+
"
)
"
);
}).
catch
(()
=>
{
// 处理错误逻辑,这里是一个空的错误处理函数
console
.
log
(
"
走到这了,物料转换后续处理出问题了!!
"
);
});
}));
}
break
;
}
//切换到想要的sheet
luckysheet
.
setSheetActive
(
0
);
Promise
.
all
(
asyncTasks
)
.
then
(()
=>
{
resolve
();
// 所有异步请求执行完成
})
.
catch
(
Error
=>
{
console
.
log
(
"
这里是所有的异步请求出错处
"
);
reject
(
Error
);
// 异步请求出错
});
});
},
/** 保存导入文件和生成文件 */
submit
(
contents
){
debugger
console
.
log
(
"
还是执行了保存方法
"
);
const
name
=
contents
.
info
.
name
;
let
objsheet
=
luckysheet
.
getAllSheets
()
// 得到表的数据
//LuckyExcel = objsheet // 将表的数据保存本地
let
strsheet
=
JSON
.
stringify
(
objsheet
)
// 对象转化为字符串
const
data
=
{
name
:
name
,
jsons
:
strsheet
};
/*addMyluckyexcel(data).then(response => {
if(response.code==200){
this.$message({
message: '保存成功', type: 'success'
});
this.dialogVisible=false;
//this.$router.replace({ path: '/' }); //刷新整个页面会出错
//window.location.reload();//也是全局刷新,不合适
this.$router.go(-1);
}else{
this.$message.error('保存失败');
}
});*/
},
/** 导出设置 */
handleExport
:
debounce
(
function
()
{
// 处理点击事件
...
...
@@ -966,15 +501,5 @@ function debounce(func, delay) {
},
delay
);
};
}
function
getKeyByValue
(
map
,
value
)
{
for
(
let
[
key
,
val
]
of
map
)
{
if
(
val
===
value
)
{
return
key
;
}
if
(
Array
.
isArray
(
val
)
&&
val
.
includes
(
value
))
{
return
key
;
}
}
}
</
script
>
ruoyi-ui/src/views/system/supplies/index_template.vue
View file @
0f0f04bd
...
...
@@ -35,18 +35,18 @@
>
新增
</el-button>
</el-col>
<!--
<el-col
:span=
"1.5"
>
-->
<!--
<el-button-->
<!-- type="success"-->
<!-- plain-->
<!-- icon="el-icon-edit"-->
<!-- size="mini"-->
<!-- :disabled="single"-->
<!-- @click="handleUpdate"-->
<!-- v-hasPermi="['SuppliesTemplate:SuppliesTemplate:edit']"-->
<!-- >修改-->
<!--
</el-button>
--
>
<!--
</el-col>
-->
<!--
<el-col
:span=
"1.5"
>
<el-button
type=
"success"
plain
icon=
"el-icon-edit"
size=
"mini"
:disabled=
"single"
@
click=
"handleUpdate"
v-hasPermi=
"['SuppliesTemplate:SuppliesTemplate:edit']"
>
修改
</el-button
>
</el-col>
-->
<el-col
:span=
"1.5"
>
<el-button
type=
"danger"
...
...
@@ -71,6 +71,7 @@
>
发布
</el-button>
</el-col>
<right-toolbar
:showSearch.sync=
"showSearch"
@
queryTable=
"getList"
></right-toolbar>
</el-row>
...
...
@@ -78,24 +79,22 @@
<el-table-column
type=
"selection"
width=
"55"
align=
"center"
/>
<el-table-column
type=
"index"
width=
"80"
align=
"center"
label=
"序号"
:index=
"indexMethod"
/>
<el-table-column
label=
"模板名称"
align=
"center"
prop=
"templateName"
/>
<!--
<el-table-column
label=
"状态"
align=
"center"
prop=
"status"
>
-->
<!--
<template
slot-scope=
"scope"
>
-->
<!--
<div>
-->
<!--
<el-switch-->
<!-- @change="toggleEnable(scope.row)"-->
<!-- v-model="scope.row.status"-->
<!-- :active-value="0"-->
<!-- :inactive-value="1"-->
<!-- active-color="#13ce66"-->
<!-- inactive-color="#cccccc"-->
<!-- active-text="已发布"-->
<!-- inactive-text="未发布"-->
<!-- disabled = "true">-->
<!--
</el-switch>
-->
<!--
</div>
-->
<!--
</
template
>
-->
<!-- </el-table-column>-->
<!--
<el-table-column
label=
"状态"
align=
"center"
prop=
"status"
>
<template
slot-scope=
"scope"
>
<div>
<el-switch
@
change=
"toggleEnable(scope.row)"
v-model=
"scope.row.status"
:active-value=
"0"
:inactive-value=
"1"
active-color=
"#13ce66"
inactive-color=
"#cccccc"
active-text=
"已发布"
inactive-text=
"未发布"
>
</el-switch>
</div>
</
template
>
</el-table-column>
-->
<el-table-column
label=
"状态"
align=
"center"
>
<
template
slot-scope=
"scope"
>
<div>
...
...
@@ -112,7 +111,7 @@
</template>
</el-table-column>
<el-table-column
label=
"操作"
align=
"center"
class-name=
"small-padding fixed-width"
>
<el-table-column
label=
"操作"
align=
"center"
class-name=
"small-padding fixed-width"
>
<
template
slot-scope=
"scope"
>
<el-button
size=
"mini"
...
...
@@ -169,6 +168,14 @@
v-hasPermi=
"['SuppliesTemplate:SuppliesTemplate:remove']"
>
删除
</el-button>
<el-button
size=
"mini"
type=
"text"
icon=
"el-icon-detailUpdate"
@
click=
"detailUpdate(scope.row)"
v-hasPermi=
"['SuppliesTemplate:SuppliesTemplate:detailUpdate']"
>
修改购入规则
</el-button>
</
template
>
</el-table-column>
</el-table>
...
...
@@ -215,6 +222,29 @@
</div>
</el-dialog>
<!-- 添加或修改导入规则对话框 -->
<el-dialog
:title=
"title"
:visible.sync=
"optionRole"
width=
"500px"
append-to-body
>
<el-form
ref=
"forms"
:model=
"forms"
:rules=
"rules"
label-width=
"80px"
>
<el-form-item
label=
"所属模板"
prop=
"tempId"
>
<el-select
v-model=
"selectedOption"
filterable
placeholder=
"请选择关联项"
style=
"width:380px"
@
change=
"handleOptionChange(selectedOption)"
>
<el-option
v-for=
"option in options1"
:key=
"option.roleName"
:label=
"option.roleName"
:value=
"option.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label=
"规则名称"
prop=
"roleName"
>
<el-input
v-model=
"forms.roleName"
placeholder=
"请输入规则名称"
maxlength=
"36"
/>
</el-form-item>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
type=
"primary"
@
click=
"submitForm"
>
确 定
</el-button>
<el-button
@
click=
"cancel"
>
取 消
</el-button>
</div>
</el-dialog>
<div
id=
"luckysheet"
:style=
"{ position: positionValue, top: '0', left: '0', right: '0', bottom: '0' }"
></div>
<!-- 遮罩层组件 -->
...
...
@@ -277,6 +307,9 @@
<
script
>
import
{
listSuppliesTemplate
,
listSuppliesrole
,
getSuppliesrole
,
updateSuppliesrole
,
getSuppliesTemplate
,
delSuppliesTemplate
,
addSuppliesTemplate
,
...
...
@@ -293,6 +326,7 @@ export default {
name
:
"
SuppliesTemplate
"
,
data
()
{
return
{
selectedOption
:
''
,
positionValue
:
'
static
'
,
fileList
:
[{
name
:
'
food.jpeg
'
,
...
...
@@ -329,6 +363,10 @@ export default {
open1
:
false
,
showProgress
:
false
,
uploadProgress
:
0
,
optionRole
:
false
,
options1
:[],
// 查询参数
queryParams
:
{
pageNum
:
1
,
...
...
@@ -339,6 +377,7 @@ export default {
status
:
null
,
},
form
:
{},
forms
:
{},
rules
:
{},
}
},
...
...
@@ -355,7 +394,6 @@ export default {
},
methods
:
{
/**启用 */
toggleEnable
(
SuppliesTemplate
)
{
console
.
log
(
'
你点击了【
'
+
SuppliesTemplate
.
s
+
'
】的开关控件,当前开关值:
'
+
SuppliesTemplate
.
status
);
...
...
@@ -427,7 +465,6 @@ export default {
});
this
.
uploading
=
false
;
return
isJpgOrPng
;
},
// handleFileChange(event){
...
...
@@ -453,6 +490,7 @@ export default {
// 取消按钮
cancel
()
{
this
.
open
=
false
;
this
.
optionRole
=
false
;
this
.
reset
();
},
// 表单重置
...
...
@@ -510,6 +548,27 @@ export default {
this
.
msgError
(
"
文件文件已发布无法修改!!!
"
)
}
},
detailUpdate
(
row
)
{
this
.
title
=
"
修改导入规则
"
;
this
.
selectedOption
=
''
;
this
.
forms
=
''
;
this
.
instea
=
''
;
const
id
=
row
.
id
||
this
.
ids
listSuppliesrole
(
id
).
then
(
response
=>
{
this
.
options1
=
response
.
rows
;
});
this
.
optionRole
=
true
;
},
handleOptionChange
(
selectedOption
)
{
getSuppliesrole
(
selectedOption
).
then
(
response
=>
{
this
.
forms
=
response
.
data
;
this
.
optionRole
=
true
;
});
},
/** 提交按钮 */
submitForm
()
{
if
(
!
this
.
form
.
templateName
)
{
...
...
ruoyi-ui/src/views/system/suppliesrole/index.vue
View file @
0f0f04bd
...
...
@@ -20,7 +20,7 @@
</el-select>
</el-form-item>
<el-form-item
label=
"规则名称"
prop=
"roleName"
>
<!--
<el-select
v-model=
"queryParams.roleName"
filterable
clearable
placeholder=
"请选择规则"
>
<!--
<el-select
v-model=
"queryParams.roleName"
filterable
clearable
placeholder=
"请选择规则"
>
<el-option
v-for=
"option in options1"
:key=
"option.roleName"
...
...
@@ -34,7 +34,7 @@
size=
"small"
@
keyup.enter.native=
"handleQuery"
/>
<!--
</el-select>
-->
<!--
</el-select>
-->
</el-form-item>
<el-form-item
label=
"状态"
prop=
"status"
>
<el-select
v-model=
"queryParams.status"
placeholder=
"请选择状态"
>
...
...
@@ -59,17 +59,17 @@
v-hasPermi=
"['system:suppliesrole:add']"
>
新增
</el-button>
</el-col>
<!--
<el-col
:span=
"1.5"
>
-->
<!--
<el-button-->
<!-- type="success"-->
<!-- plain-->
<!-- icon="el-icon-edit"-->
<!-- size="mini"-->
<!-- :disabled="single"-->
<!-- @click="handleUpdate"-->
<!-- v-hasPermi="['system:suppliesrole:edit']"-->
<!-- >修改
</el-button>
-->
<!--
</el-col>
-->
<!--
<el-col
:span=
"1.5"
>
-->
<!--
<el-button-->
<!-- type="success"-->
<!-- plain-->
<!-- icon="el-icon-edit"-->
<!-- size="mini"-->
<!-- :disabled="single"-->
<!-- @click="handleUpdate"-->
<!-- v-hasPermi="['system:suppliesrole:edit']"-->
<!-- >修改
</el-button>
-->
<!--
</el-col>
-->
<el-col
:span=
"1.5"
>
<el-button
type=
"danger"
...
...
@@ -109,23 +109,23 @@
<el-table-column
type=
"index"
width=
"80"
align=
"center"
label=
"序号"
:index=
"indexMethod"
/>
<el-table-column
label=
"所属模板"
align=
"center"
prop=
"templateName"
/>
<el-table-column
label=
"规则名称"
align=
"center"
prop=
"roleName"
/>
<!--
<el-table-column
label=
"状态"
align=
"center"
>
-->
<!--
<template
slot-scope=
"scope"
>
-->
<!--
<div>
-->
<!--
<el-switch-->
<!-- @change="toggleEnable(scope.row)"-->
<!-- v-model="scope.row.status"-->
<!-- :active-value="0"-->
<!-- :inactive-value="1"-->
<!-- active-color="#13ce66"-->
<!-- inactive-color="#cccccc"-->
<!-- active-text="已发布"-->
<!-- inactive-text="未发布"-->
<!-- disabled = "true">-->
<!--
</el-switch>
-->
<!--
</div>
-->
<!--
</
template
>
-->
<!-- </el-table-column>-->
<!--
<el-table-column
label=
"状态"
align=
"center"
>
-->
<!--
<template
slot-scope=
"scope"
>
-->
<!--
<div>
-->
<!--
<el-switch-->
<!-- @change="toggleEnable(scope.row)"-->
<!-- v-model="scope.row.status"-->
<!-- :active-value="0"-->
<!-- :inactive-value="1"-->
<!-- active-color="#13ce66"-->
<!-- inactive-color="#cccccc"-->
<!-- active-text="已发布"-->
<!-- inactive-text="未发布"-->
<!-- disabled = "true">-->
<!--
</el-switch>
-->
<!--
</div>
-->
<!--
</
template
>
-->
<!-- </el-table-column>-->
<el-table-column
label=
"状态"
align=
"center"
>
<
template
slot-scope=
"scope"
>
<div>
...
...
@@ -215,7 +215,7 @@
</el-form-item>
<el-form-item
label=
"规则名称"
prop=
"roleName"
>
<el-input
v-model=
"form.roleName"
placeholder=
"请输入规则名称"
maxlength=
"15"
/>
<!-- <el-select v-model="queryParams.roleName" filterable clearable placeholder="请选择规则" >
<!-- <el-select v-model="queryParams.roleName" filterable clearable placeholder="请选择规则" >
<el-option
v-for="option in options1"
:key="option.roleName"
...
...
@@ -224,12 +224,12 @@
></el-option>
</el-select>-->
</el-form-item>
<!-- <el-form-item label="状态">-->
<!-- <el-select v-model="form.status" style="width:380px">-->
<!-- <el-option label="启用" :value="0"></el-option>-->
<!-- <el-option label="禁用" :value="1"></el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="状态">-->
<!-- <el-select v-model="form.status" style="width:380px">-->
<!-- <el-option label="启用" :value="0"></el-option>-->
<!-- <el-option label="禁用" :value="1"></el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
type=
"primary"
@
click=
"submitForm"
>
确 定
</el-button>
...
...
@@ -241,7 +241,7 @@
<el-dialog
:title=
"title"
:visible.sync=
"optionDetail"
width=
"1300px"
append-to-body
>
<el-form
ref=
"forms"
:model=
"forms"
:rules=
"rules"
label-width=
"80px"
>
<el-form-item
label=
"规则详情"
prop=
"roleId"
>
<el-select
v-model=
"
forms.roleId"
filterable
placeholder=
"请选择关联项"
@
change=
"handleOptionChange(forms.roleId
)"
>
<el-select
v-model=
"
selectedOption"
filterable
placeholder=
"请选择关联项"
@
change=
"handleOptionChange(selectedOption
)"
>
<el-option
v-for=
"option in options1"
:key=
"option.detailName"
...
...
@@ -333,7 +333,7 @@
</
style
>
<
script
>
import
{
listSuppliesrole
,
detailUpdate
,
updateSuppliesroledetail
,
listSuppliesroledetail
,
toggleEnable
,
toggleDisable
,
getSuppliesrole
,
getSuppliesroledetail
,
delSuppliesrole
,
addSuppliesrole
,
updateSuppliesrole
,
exportSuppliesrole
,
saveSid
,
releaseRoleStatus
,
offShelfRoleStatus
}
from
"
@/api/system/suppliesrole
"
;
import
{
listSuppliesrole
,
updateSuppliesroledetail
,
listSuppliesroledetail
,
toggleEnable
,
toggleDisable
,
getSuppliesrole
,
getSuppliesroledetail
,
delSuppliesrole
,
addSuppliesrole
,
updateSuppliesrole
,
exportSuppliesrole
,
saveSid
,
releaseRoleStatus
,
offShelfRoleStatus
}
from
"
@/api/system/suppliesrole
"
;
import
{
delActSuppliesDetails
}
from
"
@/api/ActSuppliesDetails/ActSuppliesDetails
"
;
/*import {listSuppliesroledetail, updateSuppliesroledetail} from "../../../api/system/suppliesrole";*/
...
...
@@ -343,6 +343,7 @@ export default {
},
data
()
{
return
{
selectedOption
:
''
,
// 遮罩层
loading
:
true
,
// 选中数组
...
...
@@ -542,20 +543,22 @@ export default {
}
},
/** 修改规则详情按钮操作*/
detailUpdate
(
row
)
{
this
.
reset
();
this
.
title
=
"
修改规则详情
"
;
this
.
selectedOption
=
''
;
this
.
forms
=
''
;
this
.
instea
=
''
;
const
id
=
row
.
id
||
this
.
ids
listSuppliesroledetail
(
row
.
id
).
then
(
response
=>
{
listSuppliesroledetail
(
id
).
then
(
response
=>
{
this
.
options1
=
response
.
rows
;
});
this
.
optionDetail
=
true
;
},
handleOptionChange
(
id
){
getSuppliesroledetail
(
id
).
then
(
response
=>
{
/** 修改规则下的规则 */
handleOptionChange
(
selectedOption
){
getSuppliesroledetail
(
selectedOption
).
then
(
response
=>
{
this
.
forms
=
response
.
data
;
const
detailContent
=
response
.
data
.
detailContent
;
const
parse
=
JSON
.
parse
(
detailContent
);
...
...
@@ -567,9 +570,10 @@ export default {
this
.
instea
=
this
.
detailMH
.
length
;
this
.
optionDetail
=
true
;
this
.
title
=
"
修改规则详情
"
;
});
},
/** 提交按钮 */
...
...
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