物料绑定基础

master
mhsnet 2 months ago
parent d04fe0af2b
commit 67ed7b35b2

@ -0,0 +1,194 @@
<template>
<el-dialog
title="物料信息"
:close-on-click-modal="false"
:visible.sync="visible"
class="JNPF-dialog JNPF-dialog_center"
lock-scroll
append-to-body
width="1300px"
>
<el-row>
<el-col :span="24">
<el-row :style="{ margin: '15px 0px' }">
<el-col :span="8">
<el-row>
<el-col :span="5" :style="{ lineHeight: '30px' }">
母件编码
</el-col>
<el-col :span="14">
<el-input
placeholder="请输入内容"
v-model="queryParams.pieceId"
clearable
></el-input>
</el-col>
</el-row>
</el-col>
<el-col :span="8">
<el-row>
<el-col :span="5" :style="{ lineHeight: '30px' }">
母件名称
</el-col>
<el-col :span="14">
<el-input
placeholder="请输入内容"
v-model="queryParams.pieceName"
clearable
></el-input>
</el-col>
</el-row>
</el-col>
<el-col :span="8">
<el-button type="primary" icon="el-icon-search" @click="fnSch"
>查询</el-button
>
<el-button icon="el-icon-refresh-right" @click="fnResetSch"
>重置</el-button
>
</el-col>
</el-row>
</el-col>
<el-col :span="24">
<el-table
ref="multipleTable"
:data="dbList"
tooltip-effect="dark"
style="width: 100%"
@selection-change="fnSltChg"
>
<el-table-column type="selection" width="55"> </el-table-column>
<el-table-column label="母件编码" width="120">
<template slot-scope="scope">{{ scope.row.pieceId }}</template>
</el-table-column>
<el-table-column label="母件名称" width="120">
<template slot-scope="scope">{{ scope.row.pieceName }}</template>
</el-table-column>
<el-table-column label="规格型号" width="120">
<template slot-scope="scope">{{ scope.row.models }}</template>
</el-table-column>
<el-table-column label="计量单位" width="120">
<template slot-scope="scope">{{ scope.row.unit }}</template>
</el-table-column>
<el-table-column label="版本代号" width="120">
<template slot-scope="scope">{{ scope.row.versionCode }}</template>
</el-table-column>
<el-table-column label="版本说明" width="120">
<template slot-scope="scope">{{
scope.row.versionIllustrate
}}</template>
</el-table-column>
<el-table-column label="版本日期" width="120">
<template slot-scope="scope">{{ scope.row.versionDate }}</template>
</el-table-column>
<el-table-column label="单据状态" width="120">
<template slot-scope="scope">{{
scope.row.documentStatus
}}</template>
</el-table-column>
<el-table-column label="创建时间">
<template slot-scope="scope">{{ scope.row.creatorTime }}</template>
</el-table-column>
</el-table>
</el-col>
<el-col :span="24" :style="{ textAlign: 'right', margin: '15px 0px' }">
<el-pagination
@size-change="fnPageSizeChg"
@current-change="fnPageCurrentChg"
:current-page="pageCurrent"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="pageTotal"
layout="total, sizes, prev, pager, next, jumper"
>
</el-pagination>
</el-col>
</el-row>
<div slot="footer">
<el-button @click="fnCancel"> </el-button>
<el-button type="primary" @click="fnOk"> </el-button>
</div>
</el-dialog>
</template>
<script>
import request from "@/utils/request";
export default {
data() {
return {
visible: false,
dbList: [],
sltdRows: [],
pageSize: 10,
pageCurrent: 1,
pageTotal: 0,
queryParams: {
pieceId: "",
pieceName: ""
}
};
},
methods: {
init() {
this.getList();
this.visible = true;
},
getList() {
this.listLoading = true;
let _query = {
dataType: 0,
keyword: "",
menuId: "591256890197938117",
moduleId: "591255830234402757",
sidx: "",
sort: "desc",
superQueryJson: "",
type: 1,
documentStatus: "1",
pieceId: this.queryParams.pieceId,
pieceName: this.queryParams.pieceName,
pageSize: this.pageSize,
currentPage: this.pageCurrent
};
request({
url: `/api/example/YysBillMaterial/getList`,
method: "post",
data: _query
}).then(res => {
var _list = res.data.list;
this.dbList = _list;
this.pageTotal = res.data.pagination.total;
});
},
fnSltChg(sltdRowsNow) {
this.sltdRows = sltdRowsNow;
},
fnPageSizeChg(pageSizeNow) {
this.pageSize = pageSizeNow;
this.pageCurrent = 1;
this.fnSch();
},
fnPageCurrentChg(pageCurrentNow) {
this.pageCurrent = pageCurrentNow;
this.fnSch();
},
fnSch() {
this.getList();
},
fnResetSch() {
this.queryParams.pieceId = "";
this.queryParams.pieceName = "";
this.fnSch();
},
fnCancel() {
this.visible = false;
},
fnOk() {
this.$emit('cbSltdChg', this.sltdRows)
this.fnCancel();
}
}
};
</script>
<style lang="scss" scoped></style>

@ -1,68 +1,152 @@
<template> <template>
<el-dialog :title="!dataForm.id ? '新建' : '编辑'" :close-on-click-modal="false" append-to-body :visible.sync="visible" <el-dialog
class="JNPF-dialog JNPF-dialog_center" lock-scroll width="600px"> :title="!dataForm.id ? '新建' : '编辑'"
:close-on-click-modal="false"
append-to-body
:visible.sync="visible"
class="JNPF-dialog JNPF-dialog_center"
lock-scroll
width="600px"
>
<el-row :gutter="15" class=""> <el-row :gutter="15" class="">
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px" <el-form
label-position="right"> ref="formRef"
:model="dataForm"
:rules="dataRule"
size="small"
label-width="100px"
label-position="right"
>
<template v-if="!loading"> <template v-if="!loading">
<!-- 具体表单 --> <!-- 具体表单 -->
<el-col :span="24"> <el-col :span="24">
<jnpf-form-tip-item label="设备编号" prop="deviceCode"> <jnpf-form-tip-item label="设备编号" prop="deviceCode">
<JnpfInput v-model="dataForm.deviceCode" @change="changeData('deviceCode', -1)" <JnpfInput
placeholder="请输入设备编号" clearable :style='{ "width": "100%" }'> v-model="dataForm.deviceCode"
@change="changeData('deviceCode', -1)"
placeholder="请输入设备编号"
clearable
:style="{ width: '100%' }"
>
</JnpfInput> </JnpfInput>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<jnpf-form-tip-item label="设备名称" prop="deviceName"> <jnpf-form-tip-item label="设备名称" prop="deviceName">
<JnpfInput v-model="dataForm.deviceName" @change="changeData('deviceName', -1)" <JnpfInput
placeholder="请输入设备名称" clearable :style='{ "width": "100%" }'> v-model="dataForm.deviceName"
@change="changeData('deviceName', -1)"
placeholder="请输入设备名称"
clearable
:style="{ width: '100%' }"
>
</JnpfInput> </JnpfInput>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<jnpf-form-tip-item label="所属部门" prop="deviceDept"> <jnpf-form-tip-item label="所属部门" prop="deviceDept">
<JnpfDepSelect v-model="dataForm.deviceDept" @change="changeData('deviceDept', -1)" <JnpfDepSelect
placeholder="请选择所属部门" selectType="all" :ableIds="ableAll.deviceDeptableIds" clearable v-model="dataForm.deviceDept"
:style='{ "width": "100%" }'> @change="changeData('deviceDept', -1)"
placeholder="请选择所属部门"
selectType="all"
:ableIds="ableAll.deviceDeptableIds"
clearable
:style="{ width: '100%' }"
>
</JnpfDepSelect> </JnpfDepSelect>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<jnpf-form-tip-item label="设备类型" prop="deivceType"> <jnpf-form-tip-item label="设备类型" prop="deivceType">
<JnpfSelect v-model="dataForm.deivceType" @change="changeData('deivceType', -1)" <JnpfSelect
placeholder="请选择" clearable :style='{ "width": "100%" }' :options="deivceTypeOptions" v-model="dataForm.deivceType"
:props="deivceTypeProps"> @change="changeData('deivceType', -1)"
placeholder="请选择"
clearable
:style="{ width: '100%' }"
:options="deivceTypeOptions"
:props="deivceTypeProps"
>
</JnpfSelect> </JnpfSelect>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<jnpf-form-tip-item label="启用状态" prop="enabledStatus"> <jnpf-form-tip-item label="启用状态" prop="enabledStatus">
<JnpfSelect v-model="dataForm.enabledStatus" @change="changeData('enabledStatus', -1)" <JnpfSelect
placeholder="请选择" clearable :style='{ "width": "100%" }' :options="enabledStatusOptions" v-model="dataForm.enabledStatus"
:props="enabledStatusProps"> @change="changeData('enabledStatus', -1)"
placeholder="请选择"
clearable
:style="{ width: '100%' }"
:options="enabledStatusOptions"
:props="enabledStatusProps"
>
</JnpfSelect> </JnpfSelect>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<jnpf-form-tip-item label="8小时产量" prop="eightOutput"> <jnpf-form-tip-item label="8小时产量" prop="eightOutput">
<JnpfInput v-model="dataForm.eightOutput" @change="changeData('eightOutput', -1)" <JnpfInput
placeholder="请输入8小时产量" clearable :style='{ "width": "100%" }'> v-model="dataForm.eightOutput"
@change="changeData('eightOutput', -1)"
placeholder="请输入8小时产量"
clearable
:style="{ width: '100%' }"
>
</JnpfInput> </JnpfInput>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<jnpf-form-tip-item label="12小时产量" prop="twelveOutput"> <jnpf-form-tip-item label="12小时产量" prop="twelveOutput">
<JnpfInput v-model="dataForm.twelveOutput" @change="changeData('twelveOutput', -1)" <JnpfInput
placeholder="请输入12小时产量" clearable :style='{ "width": "100%" }'> v-model="dataForm.twelveOutput"
@change="changeData('twelveOutput', -1)"
placeholder="请输入12小时产量"
clearable
:style="{ width: '100%' }"
>
</JnpfInput> </JnpfInput>
</jnpf-form-tip-item> </jnpf-form-tip-item>
</el-col> </el-col>
<el-col :span="24">
<jnpf-form-tip-item label-width="0">
<div class="JNPF-common-title">
<h2>绑定物料列表</h2>
</div>
<el-table :data="dataForm.data" size="mini">
<el-table-column label="设备编码">
<template slot-scope="scope">
{{ scope.row.deviceCode }}
</template>
</el-table-column>
<el-table-column label="母件编码">
<template slot-scope="scope">
{{ scope.row.materialId }}
</template>
</el-table-column>
<el-table-column label="母件名称">
<template slot-scope="scope">
{{ scope.row.materialName }}
</template>
</el-table-column>
</el-table>
<div class="table-actions" @click="fnMaterialListDialog()">
<el-button type="text" icon="el-icon-plus">物料绑定</el-button>
</div>
</jnpf-form-tip-item>
</el-col>
<!-- 表单结束 --> <!-- 表单结束 -->
</template> </template>
</el-form> </el-form>
<SelectDialog v-if="selectDialogVisible" :config="currTableConf" :formData="dataForm" ref="selectDialog" <SelectDialog
@select="addForSelect" @close="selectDialogVisible = false" /> v-if="selectDialogVisible"
:config="currTableConf"
:formData="dataForm"
ref="selectDialog"
@select="addForSelect"
@close="selectDialogVisible = false"
/>
</el-row> </el-row>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<!-- <div class="upAndDown-button" v-if="dataForm.id"> <!-- <div class="upAndDown-button" v-if="dataForm.id">
@ -76,23 +160,37 @@
<el-button type="primary" @click="dataFormSubmit(2)" :loading="continueBtnLoading"> <el-button type="primary" @click="dataFormSubmit(2)" :loading="continueBtnLoading">
{{ !dataForm.id ? '确定并新增' : '确定并继续' }}</el-button> --> {{ !dataForm.id ? '确定并新增' : '确定并继续' }}</el-button> -->
<el-button @click="visible = false"> </el-button> <el-button @click="visible = false"> </el-button>
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading"> </el-button> <el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading">
</el-button
>
</span> </span>
<MaterialListDialog
ref="materialListDialog"
@cbSltdChg="fnSltdMaterialChg"
/>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import request from '@/utils/request' import request from "@/utils/request";
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import { getDataInterfaceRes } from '@/api/systemData/dataInterface' import { getDataInterfaceRes } from "@/api/systemData/dataInterface";
import { getDictionaryDataSelector } from '@/api/systemData/dictionary' import { getDictionaryDataSelector } from "@/api/systemData/dictionary";
import { getDefaultCurrentValueUserId } from '@/api/permission/user' import { getDefaultCurrentValueUserId } from "@/api/permission/user";
import { getDefaultCurrentValueDepartmentId } from '@/api/permission/organize' import { getDefaultCurrentValueDepartmentId } from "@/api/permission/organize";
import { getDateDay, getLaterData, getBeforeData, getBeforeTime, getLaterTime } from '@/components/Generator/utils/index.js' import {
import { thousandsFormat } from "@/components/Generator/utils/index" getDateDay,
getLaterData,
getBeforeData,
getBeforeTime,
getLaterTime
} from "@/components/Generator/utils/index.js";
import { thousandsFormat } from "@/components/Generator/utils/index";
import MaterialListDialog from "@/views/yys/yysdevice/MaterialListDialog";
export default { export default {
components: {}, components: {
MaterialListDialog
},
props: [], props: [],
data() { data() {
return { return {
@ -105,20 +203,17 @@ export default {
visible: false, visible: false,
loading: false, loading: false,
btnLoading: false, btnLoading: false,
formRef: 'formRef', formRef: "formRef",
setting: {}, setting: {},
eventType: '', eventType: "",
userBoxVisible: false, userBoxVisible: false,
selectDialogVisible: false, selectDialogVisible: false,
currTableConf: {}, currTableConf: {},
dataValueAll: {}, dataValueAll: {},
addTableConf: { addTableConf: {},
},
// //
ableAll: { ableAll: {},
}, tableRows: {},
tableRows: {
},
Vmodel: "", Vmodel: "",
currVmodel: "", currVmodel: "",
dataForm: { dataForm: {
@ -129,36 +224,43 @@ export default {
twelveOutput: undefined, twelveOutput: undefined,
deivceType: undefined, deivceType: undefined,
enabledStatus: "1", enabledStatus: "1",
data: []
}, },
tableRequiredData: {}, tableRequiredData: {},
dataRule: dataRule: {
{
deviceCode: [ deviceCode: [
{ {
required: true, required: true,
message: '请输入设备编号', message: "请输入设备编号",
trigger: 'blur' trigger: "blur"
}, }
], ],
deviceName: [ deviceName: [
{ {
required: true, required: true,
message: '请输入设备名称', message: "请输入设备名称",
trigger: 'blur' trigger: "blur"
}, }
], ],
deviceDept: [ deviceDept: [
{ {
required: true, required: true,
message: '请选择所属部门', message: "请选择所属部门",
trigger: 'change' trigger: "change"
}
]
}, },
deivceTypeOptions: [
{ fullName: "生产线", id: "1" },
{ fullName: "包装线", id: "2" },
{ fullName: "其它", id: "3" }
], ],
}, deivceTypeProps: { label: "fullName", value: "id" },
deivceTypeOptions: [{ "fullName": "生产线", "id": "1" }, { "fullName": "包装线", "id": "2" }, { "fullName": "其它", "id": "3" }], enabledStatusOptions: [
deivceTypeProps: { "label": "fullName", "value": "id" }, { fullName: "启用", id: "1" },
enabledStatusOptions: [{ "fullName": "启用", "id": "1" }, { "fullName": "未启用", "id": "2" }], { fullName: "未启用", id: "2" }
enabledStatusProps: { "label": "fullName", "value": "id" }, ],
enabledStatusProps: { label: "fullName", value: "id" },
childIndex: -1, childIndex: -1,
isEdit: false, isEdit: false,
interfaceRes: { interfaceRes: {
@ -168,62 +270,90 @@ export default {
eightOutput: [], eightOutput: [],
twelveOutput: [], twelveOutput: [],
deivceType: [], deivceType: [],
enabledStatus: [], enabledStatus: []
},
} }
};
}, },
computed: { computed: {
...mapGetters(['userInfo']) ...mapGetters(["userInfo"])
}, },
watch: {}, watch: {},
created() { created() {
this.dataAll() this.dataAll();
this.initDefaultData() this.initDefaultData();
this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm)) this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm));
}, },
mounted() {}, mounted() {},
methods: { methods: {
fnMaterialListDialog() {
this.$nextTick(() => {
this.$refs.materialListDialog.init();
});
},
fnSltdMaterialChg(nowRows) {
let _nowRows = nowRows.map(o1 => {
let _row = {
deviceCode: this.dataForm.deviceCode,
materialId: o1.pieceId,
materialName: o1.pieceName
};
return _row;
});
let _dataForm = { ...this.dataForm };
_dataForm.data = _nowRows;
this.dataForm = _dataForm;
},
choice(stationId) {
this.recycleSaffDeviceBoxVisible = true;
let excludeIdList = [];
for (let i = 0; i < this.dataForm.recycleStaffDeviceList.length; i++) {
excludeIdList.push(this.dataForm.recycleStaffDeviceList[i].deviceCode);
}
this.$nextTick(() => {
this.$refs.deviceBox.init(excludeIdList, stationId);
});
},
prev() { prev() {
this.index-- this.index--;
if (this.index === 0) { if (this.index === 0) {
this.prevDis = true this.prevDis = true;
} }
this.nextDis = false this.nextDis = false;
for (let index = 0; index < this.allList.length; index++) { for (let index = 0; index < this.allList.length; index++) {
const element = this.allList[index]; const element = this.allList[index];
if (this.index == index) { if (this.index == index) {
this.getInfo(element.id) this.getInfo(element.id);
} }
} }
}, },
next() { next() {
this.index++ this.index++;
if (this.index === this.allList.length - 1) { if (this.index === this.allList.length - 1) {
this.nextDis = true this.nextDis = true;
} }
this.prevDis = false this.prevDis = false;
for (let index = 0; index < this.allList.length; index++) { for (let index = 0; index < this.allList.length; index++) {
const element = this.allList[index]; const element = this.allList[index];
if (this.index == index) { if (this.index == index) {
this.getInfo(element.id) this.getInfo(element.id);
} }
} }
}, },
getInfo(id) { getInfo(id) {
request({ request({
url: '/api/example/YysDevice/' + id, url: "/api/example/YysDevice/" + id,
method: 'get' method: "get"
}).then(res => { }).then(res => {
this.dataInfo(res.data) this.dataInfo(res.data);
}); });
}, },
goBack() { goBack() {
this.visible = false this.visible = false;
this.$emit('refreshDataList', true) this.$emit("refreshDataList", true);
}, },
changeData(model, index) { changeData(model, index) {
this.isEdit = false this.isEdit = false;
this.childIndex = index this.childIndex = index;
let modelAll = model.split("-"); let modelAll = model.split("-");
let faceMode = ""; let faceMode = "";
for (let i = 0; i < modelAll.length; i++) { for (let i = 0; i < modelAll.length; i++) {
@ -231,14 +361,14 @@ export default {
} }
for (let key in this.interfaceRes) { for (let key in this.interfaceRes) {
if (key != faceMode) { if (key != faceMode) {
let faceReList = this.interfaceRes[key] let faceReList = this.interfaceRes[key];
for (let i = 0; i < faceReList.length; i++) { for (let i = 0; i < faceReList.length; i++) {
if (faceReList[i].relationField == model) { if (faceReList[i].relationField == model) {
let options = 'get' + key + 'Options'; let options = "get" + key + "Options";
if (this[options]) { if (this[options]) {
this[options]() this[options]();
} }
this.changeData(key, index) this.changeData(key, index);
} }
} }
} }
@ -249,202 +379,204 @@ export default {
if (type == 2) { if (type == 2) {
for (let i = 0; i < this.dataForm[data].length; i++) { for (let i = 0; i < this.dataForm[data].length; i++) {
if (index == -1) { if (index == -1) {
this.dataForm[data][i][model] = defaultValue this.dataForm[data][i][model] = defaultValue;
} else if (index == i) { } else if (index == i) {
this.dataForm[data][i][model] = defaultValue this.dataForm[data][i][model] = defaultValue;
} }
} }
} else { } else {
this.dataForm[data] = defaultValue this.dataForm[data] = defaultValue;
} }
} }
}, },
dataAll() { dataAll() {},
},
clearData() { clearData() {
this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll)) this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll));
}, },
init(id, isDetail, allList) { init(id, isDetail, allList) {
this.prevDis = false this.prevDis = false;
this.nextDis = false this.nextDis = false;
this.allList = allList || [] this.allList = allList || [];
if (allList.length) { if (allList.length) {
this.index = this.allList.findIndex(item => item.id === id) this.index = this.allList.findIndex(item => item.id === id);
if (this.index == 0) { if (this.index == 0) {
this.prevDis = true this.prevDis = true;
} }
if (this.index == this.allList.length - 1) { if (this.index == this.allList.length - 1) {
this.nextDis = true this.nextDis = true;
} }
} else { } else {
this.prevDis = true this.prevDis = true;
this.nextDis = true this.nextDis = true;
} }
this.dataForm.id = id || 0; this.dataForm.id = id || 0;
this.visible = true; this.visible = true;
this.$nextTick(() => { this.$nextTick(() => {
if (this.dataForm.id) { if (this.dataForm.id) {
this.loading = true this.loading = true;
request({ request({
url: '/api/example/YysDevice/' + this.dataForm.id, url: "/api/example/YysDevice/" + this.dataForm.id,
method: 'get' method: "get"
}).then(res => { }).then(res => {
this.dataInfo(res.data) this.dataInfo(res.data);
this.loading = false this.loading = false;
}); });
} else { } else {
this.clearData() this.clearData();
this.initDefaultData() this.initDefaultData();
} }
}); });
this.$store.commit('generator/UPDATE_RELATION_DATA', {}) this.$store.commit("generator/UPDATE_RELATION_DATA", {});
}, },
// //
initDefaultData() { initDefaultData() {},
},
// //
dataFormSubmit(type) { dataFormSubmit(type) {
this.dataFormSubmitType = type ? type : 0 this.dataFormSubmitType = type ? type : 0;
this.$refs['formRef'].validate((valid) => { this.$refs["formRef"].validate(valid => {
if (valid) { if (valid) {
this.request() this.request();
} }
}) });
}, },
request() { request() {
let _data = this.dataList() let _data = this.dataList();
if (this.dataFormSubmitType == 2) { if (this.dataFormSubmitType == 2) {
this.continueBtnLoading = true this.continueBtnLoading = true;
} else { } else {
this.btnLoading = true this.btnLoading = true;
} }
if (!this.dataForm.id) { if (!this.dataForm.id) {
request({ request({
url: '/api/example/YysDevice', url: "/api/example/YysDevice",
method: 'post', method: "post",
data: _data data: _data
}).then((res) => { })
.then(res => {
this.$message({ this.$message({
message: res.msg, message: res.msg,
type: 'success', type: "success",
duration: 1000, duration: 1000,
onClose: () => { onClose: () => {
if (this.dataFormSubmitType == 2) { if (this.dataFormSubmitType == 2) {
this.$nextTick(() => { this.$nextTick(() => {
this.clearData() this.clearData();
this.initDefaultData() this.initDefaultData();
}) });
this.continueBtnLoading = false this.continueBtnLoading = false;
return return;
} }
this.visible = false this.visible = false;
this.btnLoading = false this.btnLoading = false;
this.$emit('refresh', true) this.$emit("refresh", true);
} }
});
}) })
}).catch(() => { .catch(() => {
this.btnLoading = false this.btnLoading = false;
this.continueBtnLoading = false this.continueBtnLoading = false;
}) });
} else { } else {
request({ request({
url: '/api/example/YysDevice/' + this.dataForm.id, url: "/api/example/YysDevice/" + this.dataForm.id,
method: 'PUT', method: "PUT",
data: _data data: _data
}).then((res) => { })
.then(res => {
this.$message({ this.$message({
message: res.msg, message: res.msg,
type: 'success', type: "success",
duration: 1000, duration: 1000,
onClose: () => { onClose: () => {
if (this.dataFormSubmitType == 2) return this.continueBtnLoading = false if (this.dataFormSubmitType == 2)
this.visible = false return (this.continueBtnLoading = false);
this.btnLoading = false this.visible = false;
this.$emit('refresh', true) this.btnLoading = false;
this.$emit("refresh", true);
} }
});
}) })
}).catch(() => { .catch(() => {
this.btnLoading = false this.btnLoading = false;
this.continueBtnLoading = false this.continueBtnLoading = false;
}) });
} }
}, },
openSelectDialog(key) { openSelectDialog(key) {
this.currTableConf = this.addTableConf[key] this.currTableConf = this.addTableConf[key];
this.currVmodel = key this.currVmodel = key;
this.selectDialogVisible = true this.selectDialogVisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.selectDialog.init() this.$refs.selectDialog.init();
}) });
}, },
addForSelect(data) { addForSelect(data) {
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
let t = data[i] let t = data[i];
if (this['get' + this.currVmodel]) { if (this["get" + this.currVmodel]) {
this['get' + this.currVmodel](t) this["get" + this.currVmodel](t);
} }
} }
}, },
dateTime(timeRule, timeType, timeTarget, timeValueData, dataValue) { dateTime(timeRule, timeType, timeTarget, timeValueData, dataValue) {
let timeDataValue = null; let timeDataValue = null;
let timeValue = Number(timeValueData) let timeValue = Number(timeValueData);
if (timeRule) { if (timeRule) {
if (timeType == 1) { if (timeType == 1) {
timeDataValue = timeValue timeDataValue = timeValue;
} else if (timeType == 2) { } else if (timeType == 2) {
timeDataValue = dataValue timeDataValue = dataValue;
} else if (timeType == 3) { } else if (timeType == 3) {
timeDataValue = new Date().getTime() timeDataValue = new Date().getTime();
} else if (timeType == 4) { } else if (timeType == 4) {
let previousDate = ''; let previousDate = "";
if (timeTarget == 1 || timeTarget == 2) { if (timeTarget == 1 || timeTarget == 2) {
previousDate = getDateDay(timeTarget, timeType, timeValue) previousDate = getDateDay(timeTarget, timeType, timeValue);
timeDataValue = new Date(previousDate).getTime() timeDataValue = new Date(previousDate).getTime();
} else if (timeTarget == 3) { } else if (timeTarget == 3) {
previousDate = getBeforeData(timeValue) previousDate = getBeforeData(timeValue);
timeDataValue = new Date(previousDate).getTime() timeDataValue = new Date(previousDate).getTime();
} else { } else {
timeDataValue = getBeforeTime(timeTarget, timeValue).getTime() timeDataValue = getBeforeTime(timeTarget, timeValue).getTime();
} }
} else if (timeType == 5) { } else if (timeType == 5) {
let previousDate = ''; let previousDate = "";
if (timeTarget == 1 || timeTarget == 2) { if (timeTarget == 1 || timeTarget == 2) {
previousDate = getDateDay(timeTarget, timeType, timeValue) previousDate = getDateDay(timeTarget, timeType, timeValue);
timeDataValue = new Date(previousDate).getTime() timeDataValue = new Date(previousDate).getTime();
} else if (timeTarget == 3) { } else if (timeTarget == 3) {
previousDate = getLaterData(timeValue) previousDate = getLaterData(timeValue);
timeDataValue = new Date(previousDate).getTime() timeDataValue = new Date(previousDate).getTime();
} else { } else {
timeDataValue = getLaterTime(timeTarget, timeValue).getTime() timeDataValue = getLaterTime(timeTarget, timeValue).getTime();
} }
} }
} }
return timeDataValue; return timeDataValue;
}, },
time(timeRule, timeType, timeTarget, timeValue, formatType, dataValue) { time(timeRule, timeType, timeTarget, timeValue, formatType, dataValue) {
let format = formatType == 'HH:mm' ? 'HH:mm:00' : formatType let format = formatType == "HH:mm" ? "HH:mm:00" : formatType;
let timeDataValue = null let timeDataValue = null;
if (timeRule) { if (timeRule) {
if (timeType == 1) { if (timeType == 1) {
timeDataValue = timeValue || '00:00:00' timeDataValue = timeValue || "00:00:00";
if (timeDataValue.split(':').length == 3) { if (timeDataValue.split(":").length == 3) {
timeDataValue = timeDataValue timeDataValue = timeDataValue;
} else { } else {
timeDataValue = timeDataValue + ':00' timeDataValue = timeDataValue + ":00";
} }
} else if (timeType == 2) { } else if (timeType == 2) {
timeDataValue = dataValue timeDataValue = dataValue;
} else if (timeType == 3) { } else if (timeType == 3) {
timeDataValue = this.jnpf.toDate(new Date(), format) timeDataValue = this.jnpf.toDate(new Date(), format);
} else if (timeType == 4) { } else if (timeType == 4) {
let previousDate = ''; let previousDate = "";
previousDate = getBeforeTime(timeTarget, timeValue) previousDate = getBeforeTime(timeTarget, timeValue);
timeDataValue = this.jnpf.toDate(previousDate, format) timeDataValue = this.jnpf.toDate(previousDate, format);
} else if (timeType == 5) { } else if (timeType == 5) {
let previousDate = ''; let previousDate = "";
previousDate = getLaterTime(timeTarget, timeValue) previousDate = getLaterTime(timeTarget, timeValue);
timeDataValue = this.jnpf.toDate(previousDate, format) timeDataValue = this.jnpf.toDate(previousDate, format);
} }
} }
return timeDataValue; return timeDataValue;
@ -454,13 +586,12 @@ export default {
return _data; return _data;
}, },
dataInfo(dataAll) { dataInfo(dataAll) {
let _dataAll = dataAll let _dataAll = dataAll;
this.dataForm = _dataAll this.dataForm = _dataAll;
this.isEdit = true this.isEdit = true;
this.dataAll() this.dataAll();
this.childIndex = -1 this.childIndex = -1;
},
},
} }
}
};
</script> </script>

Loading…
Cancel
Save