修改加工单

jg-waiwang-pro
XI_TENG\xixi_ 9 months ago
parent 964aa37af0
commit f52210dbe6

@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-02-02
* 2024-02-05
*/
public interface WorkOrderMapper extends BaseMapper<WorkOrderEntity> {

@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-02-02
* 2024-02-05
*/
public interface WorkOrderPrimaryMapper extends BaseMapper<WorkOrderPrimaryEntity> {

@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-02-02
* 2024-02-05
*/
public interface WorkOrderProductMapper extends BaseMapper<WorkOrderProductEntity> {

@ -11,7 +11,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-02-02
* 2024-02-05
*/
public interface WorkOrderPrimaryService extends IService<WorkOrderPrimaryEntity> {
QueryWrapper<WorkOrderPrimaryEntity> getChild(WorkOrderPagination pagination,QueryWrapper<WorkOrderPrimaryEntity> workOrderPrimaryQueryWrapper);

@ -11,7 +11,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-02-02
* 2024-02-05
*/
public interface WorkOrderProductService extends IService<WorkOrderProductEntity> {
QueryWrapper<WorkOrderProductEntity> getChild(WorkOrderPagination pagination,QueryWrapper<WorkOrderProductEntity> workOrderProductQueryWrapper);

@ -11,7 +11,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-02-02
* 2024-02-05
*/
public interface WorkOrderService extends IService<WorkOrderEntity> {
List<WorkOrderEntity> getList(WorkOrderPagination workOrderPagination);
@ -31,6 +31,10 @@ public interface WorkOrderService extends IService<WorkOrderEntity> {
List<WorkOrderProductEntity> getWorkOrderProductList(String id);
List<WorkOrderPrimaryEntity> getWorkOrderPrimaryList(String id,WorkOrderPagination workOrderPagination);
List<WorkOrderPrimaryEntity> getWorkOrderPrimaryList(String id);
//副表数据方法
String checkForm(WorkOrderForm form,int i);

@ -33,7 +33,7 @@ import jnpf.permission.entity.UserEntity;
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-02-02
* 2024-02-05
*/
@Service
public class WorkOrderPrimaryServiceImpl extends ServiceImpl<WorkOrderPrimaryMapper, WorkOrderPrimaryEntity> implements WorkOrderPrimaryService{

@ -33,7 +33,7 @@ import jnpf.permission.entity.UserEntity;
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-02-02
* 2024-02-05
*/
@Service
public class WorkOrderProductServiceImpl extends ServiceImpl<WorkOrderProductMapper, WorkOrderProductEntity> implements WorkOrderProductService{

@ -36,7 +36,7 @@ import jnpf.permission.entity.UserEntity;
* V3.5
* https://www.jnpfsoft.com
* JNPF
* 2024-02-02
* 2024-02-05
*/
@Service
public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrderEntity> implements WorkOrderService{
@ -48,7 +48,6 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder
@Autowired
private WorkOrderProductService workOrderProductService;
@Autowired
private WorkOrderPrimaryService workOrderPrimaryService;
@Override
@ -370,6 +369,27 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder
queryWrapper.lambda().eq(WorkOrderProductEntity::getWorkId, id);
return workOrderProductService.list(queryWrapper);
}
/** WorkOrderPrimary子表方法 */
@Override
public List<WorkOrderPrimaryEntity> getWorkOrderPrimaryList(String id,WorkOrderPagination workOrderPagination){
Map<String, Object> newtabMap=WorkOrderConstant.TABLEFIELDKEY.entrySet()
.stream().collect( Collectors.toMap(e->e.getValue(),e->e.getKey()));
String tableName="workOrderPrimary";
tableName=newtabMap.get(tableName)==null?tableName:newtabMap.get(tableName).toString();
QueryWrapper<WorkOrderPrimaryEntity> queryWrapper = new QueryWrapper<>();
queryWrapper = workOrderPrimaryService.getChild(workOrderPagination,queryWrapper);
queryWrapper.lambda().eq(WorkOrderPrimaryEntity::getWorkId, id);
generaterSwapUtil.wrapperHandle(WorkOrderConstant.getColumnData(), WorkOrderConstant.getAppColumnData(), queryWrapper,WorkOrderPrimaryEntity.class,"sub",tableName);
return workOrderPrimaryService.list(queryWrapper);
}
/** WorkOrderPrimary子表方法 */
@Override
public List<WorkOrderPrimaryEntity> getWorkOrderPrimaryList(String id){
QueryWrapper<WorkOrderPrimaryEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(WorkOrderPrimaryEntity::getWorkId, id);
return workOrderPrimaryService.list(queryWrapper);
}
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
@Override
public String checkForm(WorkOrderForm form,int i) {
@ -391,6 +411,8 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder
}
}
}
if (form.getWorkOrderPrimaryList()!=null){
}
return countRecover;
}
/**
@ -437,5 +459,22 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder
workOrderProductService.saveOrUpdate(entitys);
}
}
//WorkOrderPrimary子表数据新增修改
if(!isSave){
QueryWrapper<WorkOrderPrimaryEntity> WorkOrderPrimaryqueryWrapper = new QueryWrapper<>();
WorkOrderPrimaryqueryWrapper.lambda().eq(WorkOrderPrimaryEntity::getWorkId, entity.getId());
workOrderPrimaryService.remove(WorkOrderPrimaryqueryWrapper);
}
if (workOrderForm.getWorkOrderPrimaryList()!=null){
List<WorkOrderPrimaryEntity> tableField126 = JsonUtil.getJsonToList(workOrderForm.getWorkOrderPrimaryList(),WorkOrderPrimaryEntity.class);
for(WorkOrderPrimaryEntity entitys : tableField126){
entitys.setId(RandomUtil.uuId());
entitys.setWorkId(entity.getId());
if(isSave){
}else{
}
workOrderPrimaryService.saveOrUpdate(entitys);
}
}
}
}

@ -54,7 +54,7 @@ import org.springframework.transaction.annotation.Transactional;
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-02-02
* @ 2024-02-05
*/
@Slf4j
@RestController
@ -73,6 +73,8 @@ public class WorkOrderController {
@Autowired
private WorkOrderProductService workOrderProductService;
@Autowired
private WorkOrderPrimaryService workOrderPrimaryService;
@Autowired
@ -96,6 +98,8 @@ public class WorkOrderController {
//子表数据
List<WorkOrderProductEntity> workOrderProductList = workOrderService.getWorkOrderProductList(entity.getId(),workOrderPagination);
workOrderMap.put("tableField116",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(workOrderProductList)));
List<WorkOrderPrimaryEntity> workOrderPrimaryList = workOrderService.getWorkOrderPrimaryList(entity.getId(),workOrderPagination);
workOrderMap.put("tableField126",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(workOrderPrimaryList)));
realList.add(workOrderMap);
}
//数据转换
@ -168,6 +172,8 @@ public class WorkOrderController {
//子表数据
List<WorkOrderProductEntity> workOrderProductList = workOrderService.getWorkOrderProductList(entity.getId(),workOrderPagination);
workOrderMap.put("tableField116",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(workOrderProductList)));
List<WorkOrderPrimaryEntity> workOrderPrimaryList = workOrderService.getWorkOrderPrimaryList(entity.getId(),workOrderPagination);
workOrderMap.put("tableField126",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(workOrderPrimaryList)));
realList.add(workOrderMap);
}
//数据转换
@ -187,6 +193,8 @@ public class WorkOrderController {
if(keys.length>0){
ExcelExportEntity tableField116ExcelEntity = new ExcelExportEntity("设计子表","tableField116");
List<ExcelExportEntity> tableField116List = new ArrayList<>();
ExcelExportEntity tableField126ExcelEntity = new ExcelExportEntity("设计子表","tableField126");
List<ExcelExportEntity> tableField126List = new ArrayList<>();
for(String key:keys){
switch(key){
case "type" :
@ -231,6 +239,15 @@ public class WorkOrderController {
case "tableField116-remark":
tableField116List.add(new ExcelExportEntity("备注" ,"remark"));
break;
case "tableField126-productId":
tableField126List.add(new ExcelExportEntity("商品id" ,"productId"));
break;
case "tableField126-theoryNum":
tableField126List.add(new ExcelExportEntity("理论发料量" ,"theoryNum"));
break;
case "tableField126-realityNum":
tableField126List.add(new ExcelExportEntity("实际发料量" ,"realityNum"));
break;
default:
break;
}
@ -239,6 +256,10 @@ public class WorkOrderController {
tableField116ExcelEntity.setList(tableField116List);
entitys.add(tableField116ExcelEntity);
}
if(tableField126List.size() > 0){
tableField126ExcelEntity.setList(tableField126List);
entitys.add(tableField126ExcelEntity);
}
}
ExportParams exportParams = new ExportParams(null, "表单信息");
@ -411,6 +432,8 @@ public class WorkOrderController {
//子表数据
List<WorkOrderProductEntity> workOrderProductList = workOrderService.getWorkOrderProductList(entity.getId());
workOrderMap.put("tableField116",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(workOrderProductList)));
List<WorkOrderPrimaryEntity> workOrderPrimaryList = workOrderService.getWorkOrderPrimaryList(entity.getId());
workOrderMap.put("tableField126",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(workOrderPrimaryList)));
workOrderMap = generaterSwapUtil.swapDataDetail(workOrderMap,WorkOrderConstant.getFormData(),"523046103495488069",false);
return ActionResult.success(workOrderMap);
}
@ -433,6 +456,8 @@ public class WorkOrderController {
//子表数据
List<WorkOrderProductEntity> workOrderProductList = workOrderService.getWorkOrderProductList(entity.getId());
workOrderMap.put("workOrderProductList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(workOrderProductList)));
List<WorkOrderPrimaryEntity> workOrderPrimaryList = workOrderService.getWorkOrderPrimaryList(entity.getId());
workOrderMap.put("workOrderPrimaryList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(workOrderPrimaryList)));
workOrderMap = generaterSwapUtil.swapDataForm(workOrderMap,WorkOrderConstant.getFormData(),WorkOrderConstant.TABLEFIELDKEY,WorkOrderConstant.TABLERENAMES);
return ActionResult.success(workOrderMap);
}

@ -9,7 +9,7 @@ import java.util.Date;
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-02-02
* @ 2024-02-05
*/
@Data
@TableName("jg_work_order")
@ -52,10 +52,9 @@ public class WorkOrderEntity {
private String flowId;
@TableField("F_VERSION")
private Integer version;
@TableField(value = "company_id" , fill = FieldFill.INSERT)
@TableField("COMPANY_ID")
private String companyId;
@TableField(value = "department_id" , fill = FieldFill.INSERT)
@TableField("DEPARTMENT_ID")
private String departmentId;
@ -73,4 +72,6 @@ public class WorkOrderEntity {
private String deleteUserId;
@TableField(value = "f_delete_mark" , updateStrategy = FieldStrategy.IGNORED)
private Integer deleteMark;
}

@ -11,18 +11,18 @@ import java.math.BigDecimal;
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-02-02
* @ 2024-02-05
*/
@Data
@TableName("jg_work_order_primary")
public class WorkOrderPrimaryEntity {
@TableId(value ="ID" )
private String id;
@TableField("PRODUCT_ID")
@TableField(value = "PRODUCT_ID" , updateStrategy = FieldStrategy.IGNORED)
private String productId;
@TableField("THEORY_NUM")
@TableField(value = "THEORY_NUM" , updateStrategy = FieldStrategy.IGNORED)
private BigDecimal theoryNum;
@TableField("REALITY_NUM")
@TableField(value = "REALITY_NUM" , updateStrategy = FieldStrategy.IGNORED)
private BigDecimal realityNum;
@TableField("F_CREATOR_TIME")
private Date creatorTime;

@ -10,7 +10,7 @@ import java.math.BigDecimal;
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-02-02
* @ 2024-02-05
*/
@Data
@TableName("jg_work_order_product")

@ -10,7 +10,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-02-02
* @ 2024-02-05
*/
@Data
public class WorkOrderForm {
@ -19,6 +19,9 @@ public class WorkOrderForm {
/** 子表数据 **/
@JsonProperty("workOrderProductList")
private List<WorkOrderProductModel> workOrderProductList;
/** 子表数据 **/
@JsonProperty("workOrderPrimaryList")
private List<WorkOrderPrimaryModel> workOrderPrimaryList;
/** 乐观锁 **/
@JsonProperty("version")
private Integer version;

@ -11,7 +11,7 @@ import java.util.List;
* @ V3.5
* @ https://www.jnpfsoft.com
* @ JNPF
* @ 2024-02-02
* @ 2024-02-05
*/
@Data
public class WorkOrderPagination extends Pagination {

@ -0,0 +1,30 @@
package jnpf.model.workorder;
import lombok.Data;
import java.util.List;
import java.util.Date;
import java.math.BigDecimal;
import com.alibaba.fastjson.annotation.JSONField;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
*
* workOrder
* V3.5
* : https://www.jnpfsoft.com
* JNPF
* 2024-02-05
*/
@Data
public class WorkOrderPrimaryModel {
/** 商品id **/
@JSONField(name = "productId")
private String productId;
/** 理论发料量 **/
@JSONField(name = "theoryNum")
private String theoryNum;
/** 实际发料量 **/
@JSONField(name = "realityNum")
private String realityNum;
}

@ -14,7 +14,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* V3.5
* : https://www.jnpfsoft.com
* JNPF
* 2024-02-02
* 2024-02-05
*/
@Data
public class WorkOrderProductModel {

@ -98,7 +98,7 @@
<div class="JNPF-common-title">
<h2>班次列表</h2>
</div>
<el-table :data="dataForm.classplanitemList" size='mini'>
<el-table :data="dataForm.classPlanItemList" size='mini'>
<el-table-column type="index" width="50" label="序号" align="center" />
<el-table-column label="班次名称" prop="timeId">
<template slot="header" v-if="true">
@ -171,13 +171,13 @@
<el-col :span="24">
<jnpf-form-tip-item label-width="0">
<div class="JNPF-common-title">
<h2>列表</h2>
<h2>列表</h2>
</div>
<el-table :data="dataForm.classplanteamList" size='mini'>
<el-table :data="dataForm.classPlanTeamList" size='mini'>
<el-table-column type="index" width="50" label="序号" align="center" />
<el-table-column label="班组id" prop="teamId">
<el-table-column label="班组名称" prop="teamId">
<template slot="header" v-if="true">
<span class="required-sign">*</span>班组id
<span class="required-sign">*</span>班组名称
</template>
<template slot-scope="scope">
<JnpfPopupSelect v-model="scope.row.teamId"
@ -186,11 +186,25 @@
:templateJson="interfaceRes.classplanteamteamId" placeholder="请选择" hasPage
propsValue="id" popupWidth="800px" popupTitle="选择数据" popupType="dialog"
relationField='team_name' :field="'teamId'+scope.$index"
interfaceId="523033213203919429" :pageSize="20"
interfaceId="523050983727575621" :pageSize="20"
:columnOptions="classplanteamteamIdcolumnOptions" clearable
:style='{"width":"100%"}'>
</JnpfPopupSelect>
</template>
<!-- <template slot-scope="scope">
<JnpfPopupSelect v-model="scope.row.timeId"
@change="changeData('classplanitem-timeId',scope.$index)"
:rowIndex="scope.$index" :formData="dataForm"
:templateJson="interfaceRes.classplanitemtimeId" placeholder="请选择" hasPage
propsValue="id" popupWidth="800px" popupTitle="选择数据" popupType="dialog"
relationField='time_name' :field="'timeId'+scope.$index"
interfaceId="523033213203919429" :pageSize="20"
:columnOptions="classplanitemtimeIdcolumnOptions" clearable
:style='{"width":"100%"}'>
</JnpfPopupSelect>
</template> -->
</el-table-column>
<el-table-column label="删除时间" prop="deleteTime">
<template slot="header" v-if="false">
@ -292,14 +306,14 @@ export default {
currTableConf: {},
dataValueAll: {},
addTableConf: {
classplanitemList: { "popupType": "dialog", "hasPage": true, "popupTitle": "选择数据", "pageSize": 20, "columnOptions": [], "interfaceId": "", "interfaceName": "", "relationOptions": [], "templateJson": [], "popupWidth": "800px" },
classplanteamList: { "popupType": "dialog", "hasPage": true, "popupTitle": "选择数据", "pageSize": 20, "columnOptions": [], "interfaceId": "", "interfaceName": "", "relationOptions": [], "templateJson": [], "popupWidth": "800px" },
classPlanItemList: { "popupType": "dialog", "hasPage": true, "popupTitle": "选择数据", "pageSize": 20, "columnOptions": [], "interfaceId": "", "interfaceName": "", "relationOptions": [], "templateJson": [], "popupWidth": "800px" },
classPlanTeamList: { "popupType": "dialog", "hasPage": true, "popupTitle": "选择数据", "pageSize": 20, "columnOptions": [], "interfaceId": "", "interfaceName": "", "relationOptions": [], "templateJson": [], "popupWidth": "800px" },
},
//
ableAll: {
},
tableRows: {
classplanitemList: {
classPlanItemList: {
timeId: '',
timeIdOptions: [],
creatorTime: '',
@ -310,7 +324,7 @@ export default {
remarkOptions: [],
enabledmark: undefined
},
classplanteamList: {
classPlanTeamList: {
teamId: '',
teamIdOptions: [],
deleteTime: '',
@ -333,8 +347,8 @@ export default {
timeStatus: "1",
remark: undefined,
shiftMethod: undefined,
classplanitemList: [],
classplanteamList: [],
classPlanItemList: [],
classPlanTeamList: [],
version: 0,
},
tableRequiredData: {},
@ -381,7 +395,7 @@ export default {
shiftMethodOptions: [{ "fullName": "按天", "id": "1" }, { "fullName": "按周", "id": "2" }, { "fullName": "按月", "id": "3" }, { "fullName": "按季度", "id": "4" }],
shiftMethodProps: { "label": "fullName", "value": "id" },
classplanitemtimeIdcolumnOptions: [{ "label": "班次编号", "value": "time_code" }, { "label": "班次名称", "value": "time_name" },],
classplanteamteamIdcolumnOptions: [{ "label": "班编号", "value": "team_code" }, { "label": "班名称", "value": "team_name" },],
classplanteamteamIdcolumnOptions: [{ "label": "班编号", "value": "team_code" }, { "label": "班名称", "value": "team_name" },],
childIndex: -1,
isEdit: false,
interfaceRes: {
@ -495,8 +509,8 @@ export default {
},
classplanitemExist() {
let isOk = true;
for (let i = 0; i < this.dataForm.classplanitemList.length; i++) {
const e = this.dataForm.classplanitemList[i];
for (let i = 0; i < this.dataForm.classPlanItemList.length; i++) {
const e = this.dataForm.classPlanItemList[i];
if (!e.timeId) {
this.$message({
message: '班次名称不能为空',
@ -511,11 +525,11 @@ export default {
},
classplanteamExist() {
let isOk = true;
for (let i = 0; i < this.dataForm.classplanteamList.length; i++) {
const e = this.dataForm.classplanteamList[i];
for (let i = 0; i < this.dataForm.classPlanTeamList.length; i++) {
const e = this.dataForm.classPlanTeamList[i];
if (!e.teamId) {
this.$message({
message: '班组id不能为空',
message: '班组名称不能为空',
type: 'error',
duration: 1000
});
@ -649,14 +663,14 @@ export default {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
type: 'warning'
}).then(() => {
this.dataForm.classplanitemList.splice(index, 1);
this.dataForm.classPlanItemList.splice(index, 1);
}).catch(() => {
});
},
getclassplanitemList(value) {
let item = { ...this.tableRows.classplanitemList, ...value }
this.dataForm.classplanitemList.push(item)
this.childIndex = this.dataForm.classplanitemList.length - 1
let item = { ...this.tableRows.classPlanItemList, ...value }
this.dataForm.classPlanItemList.push(item)
this.childIndex = this.dataForm.classPlanItemList.length - 1
this.isEdit = true
this.isEdit = false
this.childIndex = -1
@ -674,14 +688,14 @@ export default {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
type: 'warning'
}).then(() => {
this.dataForm.classplanteamList.splice(index, 1);
this.dataForm.classPlanTeamList.splice(index, 1);
}).catch(() => {
});
},
getclassplanteamList(value) {
let item = { ...this.tableRows.classplanteamList, ...value }
this.dataForm.classplanteamList.push(item)
this.childIndex = this.dataForm.classplanteamList.length - 1
let item = { ...this.tableRows.classPlanTeamList, ...value }
this.dataForm.classPlanTeamList.push(item)
this.childIndex = this.dataForm.classPlanTeamList.length - 1
this.isEdit = true
this.isEdit = false
this.childIndex = -1
@ -774,10 +788,10 @@ export default {
this.dataForm = _dataAll
this.isEdit = true
this.dataAll()
for (let i = 0; i < _dataAll.classplanitemList.length; i++) {
for (let i = 0; i < _dataAll.classPlanItemList.length; i++) {
this.childIndex = i
}
for (let i = 0; i < _dataAll.classplanteamList.length; i++) {
for (let i = 0; i < _dataAll.classPlanTeamList.length; i++) {
this.childIndex = i
}
this.childIndex = -1

@ -1,10 +1,5 @@
<template>
<div class="JNPF-common-layout">
<div class="JNPF-common-layout-center">
@ -63,19 +58,27 @@
</div>
<JNPF-table v-loading="listLoading" :data="list" @sort-change='sortChange' has-c
@selection-change="handleSelectionChange" :span-method="arraySpanMethod">
<el-table-column prop="timeCode" label="计划编号" align="left">
</el-table-column>
<el-table-column prop="timeName" label="计划名称" align="left">
</el-table-column>
<el-table-column prop="startTime" label="有效时间" align="left">
<el-table-column prop="timeCode" label="计划编号" align="left">
</el-table-column>
<el-table-column prop="startTime" label="有效时间(开始)" align="left">
</el-table-column>
<el-table-column prop="endTime" label="结束时间" align="left">
<el-table-column prop="endTime" label="结束时间(结束)" align="left">
</el-table-column>
<el-table-column label="计划状态" prop="timeStatus" algin="left">
<el-table-column label="单据状态" prop="timeStatus" algin="left">
<template slot-scope="scope">
{{ scope.row.timeStatus}}
</template>
</el-table-column>
<el-table-column prop="creatorTime" label="添加时间" align="left">
</el-table-column>
<el-table-column prop="creatorUserId" label="添加人" align="left">
</el-table-column>
<el-table-column prop="lastModifyTime" label="更新时间" align="left">
</el-table-column>
<el-table-column label="操作" fixed="right" width="150">
<template slot-scope="scope">
<el-button type="text" @click="addOrUpdateHandle(scope.row)" v-has="'btn_edit'">

@ -65,17 +65,28 @@
</el-table-column>
<el-table-column prop="timeName" label="班组名称" align="left">
</el-table-column>
<el-table-column prop="timeNm" label="班组简称" align="left">
</el-table-column>
<el-table-column prop="startTime" label="开始时间" align="left">
</el-table-column>
<el-table-column prop="endTime" label="结束时间" align="left">
</el-table-column>
<el-table-column prop="timeNm" label="班组简称" align="left">
</el-table-column>
<el-table-column label="状态" prop="timeStatus" algin="left">
<template slot-scope="scope">
{{ scope.row.timeStatus}}
</template>
</el-table-column>
<el-table-column prop="creatorTime" label="添加时间" align="left">
</el-table-column>
<el-table-column prop="creatorUserId" label="添加人" align="left">
</el-table-column>
<el-table-column prop="lastModifyTime" label="更新时间" align="left">
</el-table-column>
<el-table-column label="操作" fixed="right" width="150">
<template slot-scope="scope">
<el-button type="text" @click="addOrUpdateHandle(scope.row)" v-has="'btn_edit'">

@ -3,7 +3,7 @@
<template>
<el-dialog :title="!dataForm.id ? '新建' :'编辑'" :close-on-click-modal="false" append-to-body
:visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll width="600px">
:visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll width="1000px">
<el-row :gutter="15" class="">
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px"
label-position="right">

@ -0,0 +1,852 @@
<template>
<div :style="{margin: '0 auto',width:'100%'}">
<el-row :gutter="15" class="">
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px"
label-position="right" :disabled="setting.readonly">
<template v-if="!loading && formOperates">
<!-- 具体表单 -->
<el-col :span="24">
<jnpf-form-tip-item>
<JnpfGroupTitle content="单据类型" contentPosition="left">
</JnpfGroupTitle>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item>
<JnpfText
:textStyle='{"color":"#000000","font-weight":"normal","text-decoration":"none","font-size":12,"line-height":32,"font-style":"normal","text-align":"left"}'
content=" 不同的单据类型,需要选择不同的收货信息">
</JnpfText>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" v-if="judgeShow('type')">
<jnpf-form-tip-item label="单据类型" v-if="judgeShow('type')" prop="type">
<JnpfRadio v-model="dataForm.type" @change="changeData('type',-1)"
:disabled="judgeWrite('type')" optionType="button" direction="horizontal"
size="medium" :options="typeOptions" :props="typeProps">
</JnpfRadio>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item>
<JnpfGroupTitle content="基础信息" contentPosition="left">
</JnpfGroupTitle>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" v-if="judgeShow('code')">
<jnpf-form-tip-item label="单据编号" v-if="judgeShow('code')" prop="code">
<JnpfInput v-model="dataForm.code" @change="changeData('code',-1)"
placeholder="系统自动生成" :disabled="judgeWrite('code')" readonly
:style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" v-if="judgeShow('businessfactoryId')">
<jnpf-form-tip-item label="工厂名称" v-if="judgeShow('businessfactoryId')"
prop="businessfactoryId">
<JnpfPopupSelect v-model="dataForm.businessfactoryId"
@change="changeData('businessfactoryId',-1)" :rowIndex="null" :formData="dataForm"
:templateJson="interfaceRes.businessfactoryId" placeholder="请选择"
:disabled="judgeWrite('businessfactoryId')" hasPage propsValue="id"
popupWidth="800px" popupTitle="选择数据" popupType="dialog" relationField='name'
field='businessfactoryId' interfaceId="521651055751075845" :pageSize="20"
:columnOptions="businessfactoryIdcolumnOptions" clearable :style='{"width":"100%"}'>
</JnpfPopupSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" v-if="judgeShow('businessId')">
<jnpf-form-tip-item label="生产线" v-if="judgeShow('businessId')" prop="businessId">
<JnpfPopupSelect v-model="dataForm.businessId" @change="changeData('businessId',-1)"
:rowIndex="null" :formData="dataForm" :templateJson="interfaceRes.businessId"
placeholder="请选择" :disabled="judgeWrite('businessId')" hasPage propsValue="id"
popupWidth="800px" popupTitle="选择数据" popupType="dialog" relationField='name'
field='businessId' interfaceId="517979330417001669" :pageSize="20"
:columnOptions="businessIdcolumnOptions" clearable :style='{"width":"100%"}'>
</JnpfPopupSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" v-if="judgeShow('workTime')">
<jnpf-form-tip-item label="加工时间" v-if="judgeShow('workTime')" prop="workTime">
<JnpfDatePicker v-model="dataForm.workTime" @change="changeData('workTime',-1)"
:startTime="dateTime(false,1,1,'','')" :endTime="dateTime(false,1,1,'','')"
placeholder="请选择" :disabled="judgeWrite('workTime')" clearable
:style='{"width":"100%"}' type="date" format="yyyy-MM-dd">
</JnpfDatePicker>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" v-if="judgeShow('businessCode')">
<jnpf-form-tip-item label="外部单据编号" v-if="judgeShow('businessCode')" prop="businessCode">
<JnpfInput v-model="dataForm.businessCode" @change="changeData('businessCode',-1)"
placeholder="请输入" :disabled="judgeWrite('businessCode')" clearable
:style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" v-if="judgeShow('teamId')">
<jnpf-form-tip-item label="生产班组" v-if="judgeShow('teamId')" prop="teamId">
<JnpfPopupSelect v-model="dataForm.teamId" @change="changeData('teamId',-1)"
:rowIndex="null" :formData="dataForm" :templateJson="interfaceRes.teamId"
placeholder="请选择" :disabled="judgeWrite('teamId')" hasPage propsValue="id"
popupWidth="800px" popupTitle="选择数据" popupType="dialog" relationField='team_name'
field='teamId' interfaceId="523050983727575621" :pageSize="20"
:columnOptions="teamIdcolumnOptions" clearable :style='{"width":"100%"}'>
</JnpfPopupSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item label="状态" prop="status">
<JnpfRadio v-model="dataForm.status" @change="changeData('status',-1)"
optionType="button" direction="horizontal" size="medium" :options="statusOptions"
:props="statusProps">
</JnpfRadio>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" v-if="judgeShow('remark')">
<jnpf-form-tip-item label="备注" v-if="judgeShow('remark')" prop="remark">
<JnpfInput v-model="dataForm.remark" @change="changeData('remark',-1)"
placeholder="请输入" :disabled="judgeWrite('remark')" clearable
:style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item>
<JnpfGroupTitle content="加工成品" contentPosition="left">
</JnpfGroupTitle>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" v-if="judgeShow('-${html.relationField}')">
<jnpf-form-tip-item label-width="0">
<!-- <div class="JNPF-common-title">
<h2>设计子表</h2>
</div> -->
<el-table :data="dataForm.workOrderProductList" size='mini'>
<el-table-column type="index" width="50" label="序号" align="center" />
<el-table-column label="商品名称" v-if="judgeShow('workorderproduct-productId')"
prop="productId">
<template slot="header">
<span class="required-sign"
v-if="judgeRequired('workorderproductList-productId')">*</span>商品名称
</template>
<template slot-scope="scope">
<JnpfPopupSelect v-model="scope.row.productId"
@change="changeData('workorderproduct-productId',scope.$index)"
:rowIndex="scope.$index" :formData="dataForm"
:templateJson="interfaceRes.workorderproductproductId" placeholder="请选择"
:disabled="judgeWrite('workorderproductList')||judgeWrite('workorderproductList-productId')"
hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据"
popupType="dialog" relationField='name' :field="'productId'+scope.$index"
interfaceId="519505017699307077" :pageSize="20"
:columnOptions="workorderproductproductIdcolumnOptions" clearable
:style='{"width":"100%"}'>
</JnpfPopupSelect>
</template>
</el-table-column>
<el-table-column label="加工单位" v-if="judgeShow('workorderproduct-unitId')"
prop="unitId">
<template slot="header">
<span class="required-sign"
v-if="judgeRequired('workorderproductList-unitId')">*</span>加工单位
</template>
<template slot-scope="scope">
<JnpfPopupSelect v-model="scope.row.unitId"
@change="changeData('workorderproduct-unitId',scope.$index)"
:rowIndex="scope.$index" :formData="dataForm"
:templateJson="interfaceRes.workorderproductunitId" placeholder="请选择"
:disabled="judgeWrite('workorderproductList')||judgeWrite('workorderproductList-unitId')"
hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据"
popupType="dialog" relationField='unit_name' :field="'unitId'+scope.$index"
interfaceId="523054191598383685" :pageSize="20"
:columnOptions="workorderproductunitIdcolumnOptions" clearable
:style='{"width":"100%"}'>
</JnpfPopupSelect>
</template>
</el-table-column>
<el-table-column label="加工数量" v-if="judgeShow('workorderproduct-proportionNum')"
prop="proportionNum">
<template slot="header">
<span class="required-sign"
v-if="judgeRequired('workorderproductList-proportionNum')">*</span>加工数量
</template>
<template slot-scope="scope">
<JnpfInput v-model="scope.row.proportionNum"
@change="changeData('workorderproduct-proportionNum',scope.$index)"
placeholder="请输入"
:disabled="judgeWrite('workorderproductList')||judgeWrite('workorderproductList-proportionNum')"
clearable :style='{"width":"100%"}'>
</JnpfInput>
</template>
</el-table-column>
<el-table-column label="BOM" v-if="judgeShow('workorderproduct-bomId')"
prop="bomId">
<template slot="header">
<span class="required-sign"
v-if="judgeRequired('workorderproductList-bomId')">*</span>BOM
</template>
<template slot-scope="scope">
<JnpfPopupSelect v-model="scope.row.bomId"
@change="changeData('workorderproduct-bomId',scope.$index)"
:rowIndex="scope.$index" :formData="dataForm"
:templateJson="interfaceRes.workorderproductbomId" placeholder="请选择"
:disabled="judgeWrite('workorderproductList')||judgeWrite('workorderproductList-bomId')"
hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据"
popupType="dialog" relationField='bom_name' :field="'bomId'+scope.$index"
interfaceId="523054588681531973" :pageSize="20"
:columnOptions="workorderproductbomIdcolumnOptions" clearable
:style='{"width":"100%"}'>
</JnpfPopupSelect>
</template>
</el-table-column>
<el-table-column label="参考成本价" v-if="judgeShow('workorderproduct-cost')"
prop="cost">
<template slot="header">
<span class="required-sign"
v-if="judgeRequired('workorderproductList-cost')">*</span>参考成本价
</template>
<template slot-scope="scope">
<JnpfInput v-model="scope.row.cost"
@change="changeData('workorderproduct-cost',scope.$index)" placeholder="请输入"
:disabled="judgeWrite('workorderproductList')||judgeWrite('workorderproductList-cost')"
clearable :style='{"width":"100%"}'>
</JnpfInput>
</template>
</el-table-column>
<el-table-column label="备注" v-if="judgeShow('workorderproduct-remark')"
prop="remark">
<template slot="header">
<span class="required-sign"
v-if="judgeRequired('workorderproductList-remark')">*</span>备注
</template>
<template slot-scope="scope">
<JnpfInput v-model="scope.row.remark"
@change="changeData('workorderproduct-remark',scope.$index)" placeholder="请输入"
:disabled="judgeWrite('workorderproductList')||judgeWrite('workorderproductList-remark')"
clearable :style='{"width":"100%"}'>
</JnpfInput>
</template>
</el-table-column>
<el-table-column label="操作" width="50" v-if="!judgeWrite('workorderproductList')">
<template slot-scope="scope">
<el-button size="mini" type="text" class="JNPF-table-delBtn"
@click="delworkorderproductList(scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="table-actions" @click="addworkorderproductList()"
v-if="!judgeWrite('workorderproductList')">
<el-button type="text" icon="el-icon-plus">添加</el-button>
</div>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24">
<jnpf-form-tip-item>
<JnpfGroupTitle content="原材料" contentPosition="left">
</JnpfGroupTitle>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" v-if="judgeShow('workorderproduct-${html.relationField}')">
<jnpf-form-tip-item label-width="0">
<!-- <div class="JNPF-common-title">
<h2>设计子表</h2>
</div> -->
<el-table :data="dataForm.workOrderPrimaryList" size='mini'>
<el-table-column type="index" width="50" label="序号" align="center" />
<el-table-column label="商品id" v-if="judgeShow('workorderprimary-productId')"
prop="productId">
<template slot="header">
<span class="required-sign"
v-if="judgeRequired('workorderprimaryList-productId')">*</span>商品id
</template>
<template slot-scope="scope">
<JnpfPopupSelect v-model="scope.row.productId"
@change="changeData('workorderprimary-productId',scope.$index)"
:rowIndex="scope.$index" :formData="dataForm"
:templateJson="interfaceRes.workorderprimaryproductId" placeholder="请选择"
hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据"
popupType="dialog" relationField='name' :field="'productId'+scope.$index"
interfaceId="519505017699307077" :pageSize="20"
:columnOptions="workorderprimaryproductIdcolumnOptions" clearable
:style='{"width":"100%"}'>
</JnpfPopupSelect>
</template>
<!-- <template slot-scope="scope">
<JnpfPopupSelect v-model="scope.row.productId"
@change="changeData('workorderprimary-productId',scope.$index)"
:rowIndex="scope.$index" :formData="dataForm"
:templateJson="interfaceRes.workorderprimaryproductId" placeholder="请选择"
:disabled="judgeWrite('workorderprimaryList')||judgeWrite('workorderprimaryList-productId')"
hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据"
popupType="dialog" relationField='name' :field="'productId'+scope.$index"
interfaceId="519505017699307077" :pageSize="20"
:columnOptions="workorderprimaryproductIdcolumnOptions" clearable
:style='{"width":"100%"}'>
</JnpfPopupSelect>
</template>
-->
</el-table-column>
<el-table-column label="理论发料量" v-if="judgeShow('workorderprimary-theoryNum')"
prop="theoryNum">
<template slot="header">
<span class="required-sign"
v-if="judgeRequired('workorderprimaryList-theoryNum')">*</span>理论发料量
</template>
<!-- <template slot-scope="scope">
<JnpfInput v-model="scope.row.theoryNum"
@change="changeData('workorderprimary-theoryNum',scope.$index)"
placeholder="请输入"
:disabled="judgeWrite('workorderprimaryList')||judgeWrite('workorderprimaryList-theoryNum')"
clearable :style='{"width":"100%"}'>
</JnpfInput>
</template> -->
<template slot-scope="scope">
<JnpfInput v-model="scope.row.theoryNum"
@change="changeData('workorderprimary-theoryNum',scope.$index)"
placeholder="请输入" clearable :style='{"width":"100%"}'>
</JnpfInput>
</template>
</el-table-column>
<el-table-column label="实际发料量" v-if="judgeShow('workorderprimary-realityNum')"
prop="realityNum">
<template slot="header">
<span class="required-sign"
v-if="judgeRequired('workorderprimaryList-realityNum')">*</span>实际发料量
</template>
<!-- <template slot-scope="scope">
<JnpfInput v-model="scope.row.realityNum"
@change="changeData('workorderprimary-realityNum',scope.$index)"
placeholder="请输入"
:disabled="judgeWrite('workorderprimaryList')||judgeWrite('workorderprimaryList-realityNum')"
clearable :style='{"width":"100%"}'>
</JnpfInput>
</template> -->
<template slot-scope="scope">
<JnpfInput v-model="scope.row.realityNum"
@change="changeData('workorderprimary-realityNum',scope.$index)"
placeholder="请输入" clearable :style='{"width":"100%"}'>
</JnpfInput>
</template>
</el-table-column>
<el-table-column label="操作" width="50" v-if="!judgeWrite('workorderprimaryList')">
<template slot-scope="scope">
<el-button size="mini" type="text" class="JNPF-table-delBtn"
@click="delworkorderprimaryList(scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- <div class="table-actions" @click="addworkorderprimaryList()"
v-if="!judgeWrite('workorderprimaryList')">
<el-button type="text" icon="el-icon-plus">添加</el-button>
</div> -->
<div class="table-actions" @click="addworkorderprimaryList()">
<el-button type="text" icon="el-icon-plus">添加</el-button>
</div>
</jnpf-form-tip-item>
</el-col>
<!-- 表单结束 -->
</template>
<SelectDialog v-if="selectDialogVisible" :config="currTableConf" :formData="dataForm"
ref="selectDialog" @select="addForSelect" @close="selectDialogVisible=false" />
</el-form>
</el-row>
<UserBox v-if="userBoxVisible" ref="userBox" @submit="submit" />
</div>
</template>
<script>
import request from '@/utils/request'
import { mapGetters } from "vuex";
import { getFormById } from '@/api/workFlow/FormDesign'
import comMixin from '@/views/workFlow/workFlowForm/mixin';
import { getDataInterfaceRes } from '@/api/systemData/dataInterface'
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
import { getDefaultCurrentValueUserId } from '@/api/permission/user'
import { getDefaultCurrentValueDepartmentId } from '@/api/permission/organize'
import { getDateDay, getLaterData, getBeforeData, getBeforeTime, getLaterTime } from '@/components/Generator/utils/index.js'
import { thousandsFormat } from "@/components/Generator/utils/index"
export default {
mixins: [comMixin],
components: {},
props: [],
data() {
return {
dataFormSubmitType: 0,
continueBtnLoading: false,
index: 0,
prevDis: false,
nextDis: false,
allList: [],
visible: false,
loading: false,
btnLoading: false,
formRef: 'formRef',
setting: {},
eventType: '',
userBoxVisible: false,
selectDialogVisible: false,
currTableConf: {},
dataValueAll: {},
addTableConf: {
workOrderProductList: { "popupType": "dialog", "hasPage": true, "popupTitle": "选择数据", "pageSize": 20, "columnOptions": [], "interfaceId": "", "interfaceName": "", "relationOptions": [], "templateJson": [], "popupWidth": "800px" },
workOrderPrimaryList: { "popupType": "dialog", "hasPage": true, "popupTitle": "选择数据", "pageSize": 20, "columnOptions": [], "interfaceId": "", "interfaceName": "", "relationOptions": [], "templateJson": [], "popupWidth": "800px" },
},
//
ableAll: {
},
tableRows: {
workOrderProductList: {
productId: '',
productIdOptions: [],
unitId: '',
unitIdOptions: [],
proportionNum: '',
proportionNumOptions: [],
bomId: '',
bomIdOptions: [],
cost: '',
costOptions: [],
remark: '',
remarkOptions: [],
enabledmark: undefined
},
workOrderPrimaryList: {
productId: '',
productIdOptions: [],
theoryNum: '',
theoryNumOptions: [],
realityNum: '',
realityNumOptions: [],
enabledmark: undefined
},
},
Vmodel: "",
currVmodel: "",
dataForm: {
type: undefined,
code: undefined,
businessfactoryId: undefined,
businessId: undefined,
workTime: undefined,
businessCode: undefined,
teamId: undefined,
remark: undefined,
status: "1",
workOrderProductList: [],
workOrderPrimaryList: [],
version: 0,
},
tableRequiredData: {},
dataRule:
{
type: [
{
required: true,
message: '不能为空',
trigger: 'change'
},
],
businessfactoryId: [
{
required: true,
message: '请选择',
trigger: 'change'
},
],
businessId: [
{
required: true,
message: '请选择',
trigger: 'change'
},
],
workTime: [
{
required: true,
message: '请选择',
trigger: 'change'
},
],
teamId: [
{
required: true,
message: '请选择',
trigger: 'change'
},
],
status: [
{
required: true,
message: '请至少选择一个',
trigger: 'change'
},
],
},
statusOptions: [{ "fullName": "待加工", "id": "1" }, { "fullName": "加工重", "id": "2" }],
statusProps: { "label": "fullName", "value": "id" },
typeOptions: [{ "fullName": "完工入库", "id": "1" }, { "fullName": "计划加工", "id": "2" }, { "fullName": "其他加工", "id": "3" }],
typeProps: { "label": "fullName", "value": "id" },
businessfactoryIdcolumnOptions: [{ "label": "工厂编码", "value": "code" }, { "label": "工厂名称", "value": "name" },],
businessIdcolumnOptions: [{ "label": "生产线编码", "value": "code" }, { "label": "生产线名称", "value": "name" },],
teamIdcolumnOptions: [{ "label": "班组编码", "value": "team_code" }, { "label": "班组名称", "value": "team_name" },],
workorderproductproductIdcolumnOptions: [{ "label": "商品编码", "value": "code" }, { "label": "商品名称", "value": "name" },],
workorderproductunitIdcolumnOptions: [{ "label": "单位名称", "value": "unit_name" },],
workorderproductbomIdcolumnOptions: [{ "label": "bom名称", "value": "bom_name" }, { "label": "bom编码", "value": "bom_code" },],
workorderprimaryproductIdcolumnOptions: [{ "label": "商品编码", "value": "code" }, { "label": "商品名称", "value": "name" },],
childIndex: -1,
isEdit: false,
interfaceRes: {
type: [],
code: [],
businessfactoryId: [],
businessId: [],
workTime: [],
businessCode: [],
teamId: [],
status: [],
remark: [],
workorderproductproductId: [],
workorderproductunitId: [],
workorderproductproportionNum: [],
workorderproductbomId: [],
workorderproductcost: [],
workorderproductremark: [],
workorderprimaryproductId: [],
workorderprimarytheoryNum: [],
workorderprimaryrealityNum: [],
},
}
},
computed: {
formOperates() {
return this.setting.formOperates
}
},
watch: {},
created() {
this.getFormById()
if (this.dataForm.id == null || this.dataForm.id == '' && this.dataForm.id == undefined || this.dataForm.id == 0) {
this.initDefaultData()
}
this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm))
},
mounted() { },
methods: {
changeData(model, index) {
this.isEdit = false
this.childIndex = index
let modelAll = model.split("-");
let faceMode = "";
for (let i = 0; i < modelAll.length; i++) {
faceMode += modelAll[i];
}
for (let key in this.interfaceRes) {
if (key != faceMode) {
let faceReList = this.interfaceRes[key]
for (let i = 0; i < faceReList.length; i++) {
if (faceReList[i].relationField == model) {
let options = 'get' + key + 'Options';
if (this[options]) {
this[options]()
}
this.changeData(key, index)
}
}
}
}
},
changeDataFormData(type, data, model, index, defaultValue) {
if (!this.isEdit) {
if (type == 2) {
for (let i = 0; i < this.dataForm[data].length; i++) {
if (index == -1) {
this.dataForm[data][i][model] = defaultValue
} else if (index == i) {
this.dataForm[data][i][model] = defaultValue
}
}
} else {
this.dataForm[data] = defaultValue
}
}
},
dataAll() {
},
selfGetInfo(dataForm) {
this.dataInfo(dataForm)
},
beforeSubmit() {
const _data = this.dataList()
return _data
},
selfInit() {
this.dataAll()
},
getFormById() {
getFormById("523046103495488069").then(res => {
this.dataForm.flowId = res.data && res.data.flowId
// this.encode = res.data&&res.data.encode
})
},
exist() {
let isOk = true
for (let key in this.tableRequiredData) {
if (this.dataForm[key] && Array.isArray(this.dataForm[key])) {
for (let i = 0; i < this.dataForm[key].length; i++) {
let item = this.dataForm[key][i]
inner: for (let id in item) {
let arr = this.tableRequiredData[key].filter(o => o.id === id) || []
if (!arr.length) continue inner
if (arr[0].required) {
let msg = `${arr[0].name}不能为空`
let boo = true
if (arr[0].dataType === 'array') {
boo = !this.jnpf.isEmptyArray(item[id])
} else {
boo = !this.jnpf.isEmpty(item[id])
}
if (!boo) {
this.$message({
message: msg,
type: 'error',
duration: 1000
})
isOk = false
break
}
}
}
}
}
}
if (!this.workorderproductExist()) return
if (!this.workorderprimaryExist()) return
return isOk
},
workorderproductExist() {
let isOk = true;
for (let i = 0; i < this.dataForm.workOrderProductList.length; i++) {
const e = this.dataForm.workOrderProductList[i];
if (!e.productId) {
this.$message({
message: '商品名称不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
if (!e.unitId) {
this.$message({
message: '加工单位不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
if (!e.proportionNum) {
this.$message({
message: '加工数量不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
if (!e.bomId) {
this.$message({
message: 'BOM不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
}
return isOk;
},
workorderprimaryExist() {
let isOk = true;
for (let i = 0; i < this.dataForm.workOrderPrimaryList.length; i++) {
const e = this.dataForm.workOrderPrimaryList[i];
if (!e.productId) {
this.$message({
message: '商品id不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
}
return isOk;
},
clearData() {
this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll))
},
//
initDefaultData() {
},
addworkorderproductList() {
let item = {
productId: '',
unitId: '',
proportionNum: undefined,
bomId: '',
cost: undefined,
remark: undefined,
}
this.getworkorderproductList(item)
},
delworkorderproductList(index) {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
type: 'warning'
}).then(() => {
this.dataForm.workOrderProductList.splice(index, 1);
}).catch(() => {
});
},
getworkorderproductList(value) {
let item = { ...this.tableRows.workOrderProductList, ...value }
this.dataForm.workOrderProductList.push(item)
this.childIndex = this.dataForm.workOrderProductList.length - 1
this.isEdit = true
this.isEdit = false
this.childIndex = -1
},
addworkorderprimaryList() {
let item = {
productId: '',
theoryNum: undefined,
realityNum: undefined,
}
this.getworkorderprimaryList(item)
},
delworkorderprimaryList(index) {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
type: 'warning'
}).then(() => {
this.dataForm.workOrderPrimaryList.splice(index, 1);
}).catch(() => {
});
},
getworkorderprimaryList(value) {
let item = { ...this.tableRows.workOrderPrimaryList, ...value }
this.dataForm.workOrderPrimaryList.push(item)
this.childIndex = this.dataForm.workOrderPrimaryList.length - 1
this.isEdit = true
this.isEdit = false
this.childIndex = -1
},
openSelectDialog(key) {
this.currTableConf = this.addTableConf[key]
this.currVmodel = key
this.selectDialogVisible = true
this.$nextTick(() => {
this.$refs.selectDialog.init()
})
},
addForSelect(data) {
for (let i = 0; i < data.length; i++) {
let t = data[i]
if (this['get' + this.currVmodel]) {
this['get' + this.currVmodel](t)
}
}
},
dateTime(timeRule, timeType, timeTarget, timeValueData, dataValue) {
let timeDataValue = null;
let timeValue = Number(timeValueData)
if (timeRule) {
if (timeType == 1) {
timeDataValue = timeValue
} else if (timeType == 2) {
timeDataValue = dataValue
} else if (timeType == 3) {
timeDataValue = new Date().getTime()
} else if (timeType == 4) {
let previousDate = '';
if (timeTarget == 1 || timeTarget == 2) {
previousDate = getDateDay(timeTarget, timeType, timeValue)
timeDataValue = new Date(previousDate).getTime()
} else if (timeTarget == 3) {
previousDate = getBeforeData(timeValue)
timeDataValue = new Date(previousDate).getTime()
} else {
timeDataValue = getBeforeTime(timeTarget, timeValue).getTime()
}
} else if (timeType == 5) {
let previousDate = '';
if (timeTarget == 1 || timeTarget == 2) {
previousDate = getDateDay(timeTarget, timeType, timeValue)
timeDataValue = new Date(previousDate).getTime()
} else if (timeTarget == 3) {
previousDate = getLaterData(timeValue)
timeDataValue = new Date(previousDate).getTime()
} else {
timeDataValue = getLaterTime(timeTarget, timeValue).getTime()
}
}
}
return timeDataValue;
},
time(timeRule, timeType, timeTarget, timeValue, formatType, dataValue) {
let format = formatType == 'HH:mm' ? 'HH:mm:00' : formatType
let timeDataValue = null
if (timeRule) {
if (timeType == 1) {
timeDataValue = timeValue || '00:00:00'
if (timeDataValue.split(':').length == 3) {
timeDataValue = timeDataValue
} else {
timeDataValue = timeDataValue + ':00'
}
} else if (timeType == 2) {
timeDataValue = dataValue
} else if (timeType == 3) {
timeDataValue = this.jnpf.toDate(new Date(), format)
} else if (timeType == 4) {
let previousDate = '';
previousDate = getBeforeTime(timeTarget, timeValue)
timeDataValue = this.jnpf.toDate(previousDate, format)
} else if (timeType == 5) {
let previousDate = '';
previousDate = getLaterTime(timeTarget, timeValue)
timeDataValue = this.jnpf.toDate(previousDate, format)
}
}
return timeDataValue;
},
dataList() {
var _data = this.dataForm;
return _data;
},
dataInfo(dataAll) {
let _dataAll = dataAll
this.dataForm = _dataAll
this.isEdit = true
this.dataAll()
for (let i = 0; i < _dataAll.workOrderProductList.length; i++) {
this.childIndex = i
}
for (let i = 0; i < _dataAll.workOrderPrimaryList.length; i++) {
this.childIndex = i
}
this.childIndex = -1
},
},
}
</script>

@ -210,6 +210,7 @@
tableField116_productIdcolumnOptions:[ {"label":"商品编码","value":"code"}, {"label":"商品名称","value":"name"},],
tableField116_unitIdcolumnOptions:[ {"label":"单位名称","value":"unit_name"},],
tableField116_bomIdcolumnOptions:[ {"label":"bom名称","value":"bom_name"}, {"label":"bom编码","value":"bom_code"},],
tableField126_productIdcolumnOptions:[ {"label":"商品编码","value":"code"}, {"label":"商品名称","value":"name"},],
interfaceRes: {
businessfactoryId:[] ,
businessId:[] ,
@ -217,6 +218,7 @@
tableField116_productId: [] ,
tableField116_unitId: [] ,
tableField116_bomId: [] ,
tableField126_productId: [] ,
},
}
},

@ -1,613 +0,0 @@
<template>
<div :style="{margin: '0 auto',width:'100%'}">
<el-row :gutter="15" class="">
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px" label-position="right" :disabled="setting.readonly" >
<template v-if="!loading && formOperates">
<!-- 具体表单 -->
<el-col :span="24" >
<jnpf-form-tip-item>
<JnpfGroupTitle
content="单据类型" contentPosition="left" >
</JnpfGroupTitle>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item>
<JnpfText
:textStyle='{"color":"#000000","font-weight":"normal","text-decoration":"none","font-size":12,"line-height":32,"font-style":"normal","text-align":"left"}' content=" 不同的单据类型,需要选择不同的收货信息">
</JnpfText>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" v-if="judgeShow('type')" >
<jnpf-form-tip-item
label="单据类型" v-if="judgeShow('type')" prop="type" >
<JnpfRadio v-model="dataForm.type" @change="changeData('type',-1)"
:disabled="judgeWrite('type')" optionType="button" direction="horizontal" size="medium" :options="typeOptions" :props="typeProps" >
</JnpfRadio>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item>
<JnpfGroupTitle
content="基础信息" contentPosition="left" >
</JnpfGroupTitle>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" v-if="judgeShow('code')" >
<jnpf-form-tip-item
label="单据编号" v-if="judgeShow('code')" prop="code" >
<JnpfInput v-model="dataForm.code" @change="changeData('code',-1)"
placeholder="系统自动生成" :disabled="judgeWrite('code')" readonly :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" v-if="judgeShow('businessfactoryId')" >
<jnpf-form-tip-item
label="工厂名称" v-if="judgeShow('businessfactoryId')" prop="businessfactoryId" >
<JnpfPopupSelect v-model="dataForm.businessfactoryId" @change="changeData('businessfactoryId',-1)"
:rowIndex="null" :formData="dataForm" :templateJson="interfaceRes.businessfactoryId" placeholder="请选择" :disabled="judgeWrite('businessfactoryId')" hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据" popupType="dialog" relationField='name' field='businessfactoryId' interfaceId="521651055751075845" :pageSize="20" :columnOptions="businessfactoryIdcolumnOptions" clearable :style='{"width":"100%"}'>
</JnpfPopupSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" v-if="judgeShow('businessId')" >
<jnpf-form-tip-item
label="生产线" v-if="judgeShow('businessId')" prop="businessId" >
<JnpfPopupSelect v-model="dataForm.businessId" @change="changeData('businessId',-1)"
:rowIndex="null" :formData="dataForm" :templateJson="interfaceRes.businessId" placeholder="请选择" :disabled="judgeWrite('businessId')" hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据" popupType="dialog" relationField='name' field='businessId' interfaceId="517979330417001669" :pageSize="20" :columnOptions="businessIdcolumnOptions" clearable :style='{"width":"100%"}'>
</JnpfPopupSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" v-if="judgeShow('workTime')" >
<jnpf-form-tip-item
label="加工时间" v-if="judgeShow('workTime')" prop="workTime" >
<JnpfDatePicker v-model="dataForm.workTime" @change="changeData('workTime',-1)"
:startTime="dateTime(false,1,1,'','')" :endTime="dateTime(false,1,1,'','')" placeholder="请选择" :disabled="judgeWrite('workTime')" clearable :style='{"width":"100%"}' type="date" format="yyyy-MM-dd" >
</JnpfDatePicker>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" v-if="judgeShow('businessCode')" >
<jnpf-form-tip-item
label="外部单据编号" v-if="judgeShow('businessCode')" prop="businessCode" >
<JnpfInput v-model="dataForm.businessCode" @change="changeData('businessCode',-1)"
placeholder="请输入" :disabled="judgeWrite('businessCode')" clearable :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8" v-if="judgeShow('teamId')" >
<jnpf-form-tip-item
label="生产班组" v-if="judgeShow('teamId')" prop="teamId" >
<JnpfPopupSelect v-model="dataForm.teamId" @change="changeData('teamId',-1)"
:rowIndex="null" :formData="dataForm" :templateJson="interfaceRes.teamId" placeholder="请选择" :disabled="judgeWrite('teamId')" hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据" popupType="dialog" relationField='name' field='teamId' interfaceId="523050983727575621" :pageSize="20" :columnOptions="teamIdcolumnOptions" clearable :style='{"width":"100%"}'>
</JnpfPopupSelect>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" v-if="judgeShow('remark')" >
<jnpf-form-tip-item
label="备注" v-if="judgeShow('remark')" prop="remark" >
<JnpfInput v-model="dataForm.remark" @change="changeData('remark',-1)"
placeholder="请输入" :disabled="judgeWrite('remark')" clearable :style='{"width":"100%"}'>
</JnpfInput>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" >
<jnpf-form-tip-item>
<JnpfGroupTitle
content="加工成品" contentPosition="left" >
</JnpfGroupTitle>
</jnpf-form-tip-item>
</el-col>
<el-col :span="24" v-if="judgeShow('-${html.relationField}')" >
<jnpf-form-tip-item label-width="0">
<div class="JNPF-common-title">
<h2>设计子表</h2>
</div>
<el-table :data="dataForm.workorderproductList" size='mini' >
<el-table-column type="index" width="50" label="序号" align="center" />
<el-table-column
label="商品名称" v-if="judgeShow('workorderproduct-productId')" prop="productId" >
<template slot="header" >
<span class="required-sign" v-if="judgeRequired('workorderproductList-productId')" >*</span>商品名称
</template>
<template slot-scope="scope">
<JnpfPopupSelect v-model="scope.row.productId" @change="changeData('workorderproduct-productId',scope.$index)"
:rowIndex="scope.$index" :formData="dataForm" :templateJson="interfaceRes.workorderproductproductId" placeholder="请选择" :disabled="judgeWrite('workorderproductList')||judgeWrite('workorderproductList-productId')" hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据" popupType="dialog" relationField='name' :field="'productId'+scope.$index" interfaceId="519505017699307077" :pageSize="20" :columnOptions="workorderproductproductIdcolumnOptions" clearable :style='{"width":"100%"}'>
</JnpfPopupSelect>
</template>
</el-table-column>
<el-table-column
label="加工单位" v-if="judgeShow('workorderproduct-unitId')" prop="unitId" >
<template slot="header" >
<span class="required-sign" v-if="judgeRequired('workorderproductList-unitId')" >*</span>加工单位
</template>
<template slot-scope="scope">
<JnpfPopupSelect v-model="scope.row.unitId" @change="changeData('workorderproduct-unitId',scope.$index)"
:rowIndex="scope.$index" :formData="dataForm" :templateJson="interfaceRes.workorderproductunitId" placeholder="请选择" :disabled="judgeWrite('workorderproductList')||judgeWrite('workorderproductList-unitId')" hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据" popupType="dialog" relationField='name' :field="'unitId'+scope.$index" interfaceId="523054191598383685" :pageSize="20" :columnOptions="workorderproductunitIdcolumnOptions" clearable :style='{"width":"100%"}'>
</JnpfPopupSelect>
</template>
</el-table-column>
<el-table-column
label="加工数量" v-if="judgeShow('workorderproduct-proportionNum')" prop="proportionNum" >
<template slot="header" >
<span class="required-sign" v-if="judgeRequired('workorderproductList-proportionNum')" >*</span>加工数量
</template>
<template slot-scope="scope">
<JnpfInput v-model="scope.row.proportionNum" @change="changeData('workorderproduct-proportionNum',scope.$index)"
placeholder="请输入" :disabled="judgeWrite('workorderproductList')||judgeWrite('workorderproductList-proportionNum')" clearable :style='{"width":"100%"}'>
</JnpfInput>
</template>
</el-table-column>
<el-table-column
label="BOM" v-if="judgeShow('workorderproduct-bomId')" prop="bomId" >
<template slot="header" >
<span class="required-sign" v-if="judgeRequired('workorderproductList-bomId')" >*</span>BOM
</template>
<template slot-scope="scope">
<JnpfPopupSelect v-model="scope.row.bomId" @change="changeData('workorderproduct-bomId',scope.$index)"
:rowIndex="scope.$index" :formData="dataForm" :templateJson="interfaceRes.workorderproductbomId" placeholder="请选择" :disabled="judgeWrite('workorderproductList')||judgeWrite('workorderproductList-bomId')" hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据" popupType="dialog" relationField='name' :field="'bomId'+scope.$index" interfaceId="523054588681531973" :pageSize="20" :columnOptions="workorderproductbomIdcolumnOptions" clearable :style='{"width":"100%"}'>
</JnpfPopupSelect>
</template>
</el-table-column>
<el-table-column
label="参考成本价" v-if="judgeShow('workorderproduct-cost')" prop="cost" >
<template slot="header" >
<span class="required-sign" v-if="judgeRequired('workorderproductList-cost')" >*</span>参考成本价
</template>
<template slot-scope="scope">
<JnpfInput v-model="scope.row.cost" @change="changeData('workorderproduct-cost',scope.$index)"
placeholder="请输入" :disabled="judgeWrite('workorderproductList')||judgeWrite('workorderproductList-cost')" clearable :style='{"width":"100%"}'>
</JnpfInput>
</template>
</el-table-column>
<el-table-column
label="备注" v-if="judgeShow('workorderproduct-remark')" prop="remark" >
<template slot="header" >
<span class="required-sign" v-if="judgeRequired('workorderproductList-remark')" >*</span>备注
</template>
<template slot-scope="scope">
<JnpfInput v-model="scope.row.remark" @change="changeData('workorderproduct-remark',scope.$index)"
placeholder="请输入" :disabled="judgeWrite('workorderproductList')||judgeWrite('workorderproductList-remark')" clearable :style='{"width":"100%"}'>
</JnpfInput>
</template>
</el-table-column>
<el-table-column label="操作" width="50" v-if="!judgeWrite('workorderproductList')">
<template slot-scope="scope">
<el-button size="mini" type="text" class="JNPF-table-delBtn" @click="delworkorderproductList(scope.$index)"></el-button>
</template>
</el-table-column>
</el-table>
<div class="table-actions" @click="addworkorderproductList()" v-if="!judgeWrite('workorderproductList')">
<el-button type="text" icon="el-icon-plus">添加</el-button>
</div>
</jnpf-form-tip-item>
</el-col>
<!-- 表单结束 -->
</template>
<SelectDialog v-if="selectDialogVisible" :config="currTableConf" :formData="dataForm"
ref="selectDialog" @select="addForSelect" @close="selectDialogVisible=false"/>
</el-form>
</el-row>
<UserBox v-if="userBoxVisible" ref="userBox" @submit="submit" />
</div>
</template>
<script>
import request from '@/utils/request'
import {mapGetters} from "vuex";
import {getFormById} from '@/api/workFlow/FormDesign'
import comMixin from '@/views/workFlow/workFlowForm/mixin';
import { getDataInterfaceRes } from '@/api/systemData/dataInterface'
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
import { getDefaultCurrentValueUserId } from '@/api/permission/user'
import { getDefaultCurrentValueDepartmentId } from '@/api/permission/organize'
import { getDateDay, getLaterData, getBeforeData, getBeforeTime, getLaterTime } from '@/components/Generator/utils/index.js'
import { thousandsFormat } from "@/components/Generator/utils/index"
export default {
mixins: [comMixin],
components: { },
props: [],
data() {
return {
dataFormSubmitType: 0,
continueBtnLoading: false,
index: 0,
prevDis: false,
nextDis: false,
allList: [],
visible: false,
loading: false,
btnLoading: false,
formRef: 'formRef',
setting:{},
eventType: '',
userBoxVisible:false,
selectDialogVisible: false,
currTableConf:{},
dataValueAll:{},
addTableConf:{
workorderproductList :{"popupType":"dialog","hasPage":true,"popupTitle":"选择数据","pageSize":20,"columnOptions":[],"interfaceId":"","interfaceName":"","relationOptions":[],"templateJson":[],"popupWidth":"800px"},
},
//
ableAll:{
},
tableRows:{
workorderproductList:{
productId : '',
productIdOptions:[],
unitId : '',
unitIdOptions:[],
proportionNum : '',
proportionNumOptions:[],
bomId : '',
bomIdOptions:[],
cost : '',
costOptions:[],
remark : '',
remarkOptions:[],
enabledmark:undefined
},
},
Vmodel:"",
currVmodel:"",
dataForm: {
type : undefined,
code : undefined,
businessfactoryId : undefined,
businessId : undefined,
workTime : undefined,
businessCode : undefined,
teamId : undefined,
remark : undefined,
workorderproductList:[],
version: 0,
},
tableRequiredData: {},
dataRule:
{
type: [
{
required: true,
message: '不能为空',
trigger: 'change'
},
],
businessfactoryId: [
{
required: true,
message: '请选择',
trigger: 'change'
},
],
businessId: [
{
required: true,
message: '请选择',
trigger: 'change'
},
],
workTime: [
{
required: true,
message: '请选择',
trigger: 'change'
},
],
teamId: [
{
required: true,
message: '请选择',
trigger: 'change'
},
],
},
typeOptions:[{"fullName":"完工入库","id":"1"},{"fullName":"计划加工","id":"2"},{"fullName":"其他加工","id":"3"}],
typeProps:{"label":"fullName","value":"id" },
businessfactoryIdcolumnOptions:[ {"label":"工厂编码","value":"code"}, {"label":"工厂名称","value":"name"},],
businessIdcolumnOptions:[ {"label":"生产线编码","value":"code"}, {"label":"生产线名称","value":"name"},],
teamIdcolumnOptions:[ {"label":"班组编码","value":"team_code"}, {"label":"班组名称","value":"team_name"},],
workorderproductproductIdcolumnOptions:[ {"label":"商品编码","value":"code"}, {"label":"商品名称","value":"name"},],
workorderproductunitIdcolumnOptions:[ {"label":"单位名称","value":"unit_name"},],
workorderproductbomIdcolumnOptions:[ {"label":"bom名称","value":"bom_name"}, {"label":"bom编码","value":"bom_code"},],
childIndex:-1,
isEdit:false,
interfaceRes: {
type:[] ,
code:[] ,
businessfactoryId:[] ,
businessId:[] ,
workTime:[] ,
businessCode:[] ,
teamId:[] ,
remark:[] ,
workorderproductproductId: [] ,
workorderproductunitId: [] ,
workorderproductproportionNum: [] ,
workorderproductbomId: [] ,
workorderproductcost: [] ,
workorderproductremark: [] ,
},
}
},
computed: {
formOperates() {
return this.setting.formOperates
}
},
watch: {},
created() {
this.getFormById()
if(this.dataForm.id == null || this.dataForm.id == '' && this.dataForm.id == undefined || this.dataForm.id == 0) {
this.initDefaultData()
}
this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm))
},
mounted() {},
methods: {
changeData(model, index) {
this.isEdit = false
this.childIndex = index
let modelAll = model.split("-");
let faceMode = "";
for (let i = 0; i < modelAll.length; i++) {
faceMode += modelAll[i];
}
for (let key in this.interfaceRes) {
if (key != faceMode) {
let faceReList = this.interfaceRes[key]
for (let i = 0; i < faceReList.length; i++) {
if (faceReList[i].relationField == model) {
let options = 'get' + key + 'Options';
if(this[options]){
this[options]()
}
this.changeData(key, index)
}
}
}
}
},
changeDataFormData(type, data, model,index,defaultValue) {
if(!this.isEdit) {
if (type == 2) {
for (let i = 0; i < this.dataForm[data].length; i++) {
if (index == -1) {
this.dataForm[data][i][model] = defaultValue
} else if (index == i) {
this.dataForm[data][i][model] = defaultValue
}
}
} else {
this.dataForm[data] = defaultValue
}
}
},
dataAll(){
},
selfGetInfo(dataForm) {
this.dataInfo(dataForm)
},
beforeSubmit(){
const _data =this.dataList()
return _data
},
selfInit() {
this.dataAll()
},
getFormById() {
getFormById("523046103495488069").then(res => {
this.dataForm.flowId = res.data&&res.data.flowId
// this.encode = res.data&&res.data.encode
})
},
exist() {
let isOk = true
for (let key in this.tableRequiredData) {
if (this.dataForm[key] && Array.isArray(this.dataForm[key])) {
for (let i = 0; i < this.dataForm[key].length; i++) {
let item = this.dataForm[key][i]
inner: for (let id in item) {
let arr = this.tableRequiredData[key].filter(o => o.id === id) || []
if (!arr.length) continue inner
if (arr[0].required) {
let msg = `${arr[0].name}不能为空`
let boo = true
if (arr[0].dataType === 'array') {
boo = !this.jnpf.isEmptyArray(item[id])
} else {
boo = !this.jnpf.isEmpty(item[id])
}
if (!boo) {
this.$message({
message: msg,
type: 'error',
duration: 1000
})
isOk = false
break
}
}
}
}
}
}
if (!this.workorderproductExist()) return
return isOk
},
workorderproductExist() {
let isOk = true;
for(let i=0;i<this.dataForm.workorderproductList.length;i++){
const e = this.dataForm.workorderproductList[i];
if (!e.productId) {
this.$message({
message: '商品名称不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
if (!e.unitId) {
this.$message({
message: '加工单位不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
if (!e.proportionNum) {
this.$message({
message: '加工数量不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
if (!e.bomId) {
this.$message({
message: 'BOM不能为空',
type: 'error',
duration: 1000
});
isOk = false
break
}
}
return isOk;
},
clearData(){
this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll))
},
//
initDefaultData() {
},
addworkorderproductList(){
let item = {
productId:'',
unitId:'',
proportionNum:undefined,
bomId:'',
cost:undefined,
remark:undefined,
}
this.getworkorderproductList(item)
},
delworkorderproductList(index) {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
type: 'warning'
}).then(() => {
this.dataForm.workorderproductList.splice(index, 1);
}).catch(() => {
});
},
getworkorderproductList(value){
let item={...this.tableRows.workorderproductList,...value}
this.dataForm.workorderproductList.push(item)
this.childIndex=this.dataForm.workorderproductList.length-1
this.isEdit = true
this.isEdit = false
this.childIndex = -1
},
openSelectDialog(key) {
this.currTableConf=this.addTableConf[key]
this.currVmodel=key
this.selectDialogVisible = true
this.$nextTick(() => {
this.$refs.selectDialog.init()
})
},
addForSelect(data) {
for (let i = 0; i < data.length; i++) {
let t = data[i]
if(this['get'+this.currVmodel]){
this['get'+this.currVmodel](t)
}
}
},
dateTime(timeRule, timeType, timeTarget, timeValueData, dataValue) {
let timeDataValue = null;
let timeValue = Number(timeValueData)
if (timeRule) {
if (timeType == 1) {
timeDataValue = timeValue
} else if (timeType == 2) {
timeDataValue = dataValue
} else if (timeType == 3) {
timeDataValue = new Date().getTime()
} else if (timeType == 4) {
let previousDate = '';
if (timeTarget == 1 || timeTarget == 2) {
previousDate = getDateDay(timeTarget, timeType, timeValue)
timeDataValue = new Date(previousDate).getTime()
} else if (timeTarget == 3) {
previousDate = getBeforeData(timeValue)
timeDataValue = new Date(previousDate).getTime()
} else {
timeDataValue = getBeforeTime(timeTarget, timeValue).getTime()
}
} else if (timeType == 5) {
let previousDate = '';
if (timeTarget == 1 || timeTarget == 2) {
previousDate = getDateDay(timeTarget, timeType, timeValue)
timeDataValue = new Date(previousDate).getTime()
} else if (timeTarget == 3) {
previousDate = getLaterData(timeValue)
timeDataValue = new Date(previousDate).getTime()
} else {
timeDataValue = getLaterTime(timeTarget, timeValue).getTime()
}
}
}
return timeDataValue;
},
time(timeRule, timeType, timeTarget, timeValue, formatType, dataValue) {
let format = formatType == 'HH:mm' ? 'HH:mm:00' : formatType
let timeDataValue = null
if (timeRule) {
if (timeType == 1) {
timeDataValue = timeValue || '00:00:00'
if (timeDataValue.split(':').length == 3) {
timeDataValue = timeDataValue
} else {
timeDataValue = timeDataValue + ':00'
}
} else if (timeType == 2) {
timeDataValue = dataValue
} else if (timeType == 3) {
timeDataValue = this.jnpf.toDate(new Date(), format)
} else if (timeType == 4) {
let previousDate = '';
previousDate = getBeforeTime(timeTarget, timeValue)
timeDataValue = this.jnpf.toDate(previousDate, format)
} else if (timeType == 5) {
let previousDate = '';
previousDate = getLaterTime(timeTarget, timeValue)
timeDataValue = this.jnpf.toDate(previousDate, format)
}
}
return timeDataValue;
},
dataList(){
var _data = this.dataForm;
return _data;
},
dataInfo(dataAll){
let _dataAll =dataAll
this.dataForm = _dataAll
this.isEdit = true
this.dataAll()
for(let i=0;i<_dataAll.workorderproductList.length;i++){
this.childIndex = i
}
this.childIndex=-1
},
},
}
</script>
Loading…
Cancel
Save