|
|
@@ -456,498 +456,496 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import DeptSelect from '@/components/CommomSelect/dept-select.vue';
|
|
|
- // import selectUpload from "@/components/selectUpload";
|
|
|
- // import UploadImg from "@/components/uploadImg/WithView.vue";
|
|
|
- import DialogGoods from './components/DialogGoods';
|
|
|
- // import { parseTime } from "@/utils/ruoyi.js";
|
|
|
- // import org from "@/api/main/org";
|
|
|
- // import user from "@/api/main/user";
|
|
|
- // import selectTree from "@/components/selectTree";
|
|
|
- // import dict from "@/api/main/craft/dict";
|
|
|
- // import { imageView } from "@/utils";
|
|
|
- // import {
|
|
|
- // getPlants,
|
|
|
- // getfactoryInfo,
|
|
|
- // getFactorys,
|
|
|
- // getProductionLine,
|
|
|
- // saveOrEdit,
|
|
|
- // getAssetNum,
|
|
|
- // getDetail,
|
|
|
- // getSupplier
|
|
|
- // } from '@/api/ledgerAssets/equipment';
|
|
|
- import { getFactoryarea } from '@/api/factoryModel/factoryManagement';
|
|
|
- import { saveOrEdit, getAssetInfo } from '@/api/ledgerAssets';
|
|
|
- import { getUserPage } from '@/api/system/organization';
|
|
|
- export default {
|
|
|
- components: {
|
|
|
- //selectUpload,
|
|
|
- //UploadImg,
|
|
|
- DialogGoods,
|
|
|
- DeptSelect
|
|
|
- },
|
|
|
- data () {
|
|
|
- return {
|
|
|
- title: '新建设备信息',
|
|
|
- pageType: 'add',
|
|
|
- btnLoading: false,
|
|
|
- // 设备主键id
|
|
|
- id: '',
|
|
|
- form: {
|
|
|
- extInfoSelf: [],
|
|
|
- // 基本信息
|
|
|
- code: '',
|
|
|
- name: '',
|
|
|
- productTime: ''
|
|
|
- },
|
|
|
- rules: {
|
|
|
- name: [
|
|
|
- { required: true, message: '请输入设备名称', trigger: 'blur' }
|
|
|
- ],
|
|
|
- code: [{ required: true, message: '请输入设备编码', trigger: 'blur' }]
|
|
|
- },
|
|
|
+import DeptSelect from '@/components/CommomSelect/dept-select.vue';
|
|
|
+// import selectUpload from "@/components/selectUpload";
|
|
|
+// import UploadImg from "@/components/uploadImg/WithView.vue";
|
|
|
+import DialogGoods from './components/DialogGoods';
|
|
|
+// import { parseTime } from "@/utils/ruoyi.js";
|
|
|
+// import org from "@/api/main/org";
|
|
|
+// import user from "@/api/main/user";
|
|
|
+// import selectTree from "@/components/selectTree";
|
|
|
+// import dict from "@/api/main/craft/dict";
|
|
|
+// import { imageView } from "@/utils";
|
|
|
+// import {
|
|
|
+// getPlants,
|
|
|
+// getfactoryInfo,
|
|
|
+// getFactorys,
|
|
|
+// getProductionLine,
|
|
|
+// saveOrEdit,
|
|
|
+// getAssetNum,
|
|
|
+// getDetail,
|
|
|
+// getSupplier
|
|
|
+// } from '@/api/ledgerAssets/equipment';
|
|
|
+import { getFactoryarea } from '@/api/factoryModel';
|
|
|
+import { saveOrEdit, getAssetInfo } from '@/api/ledgerAssets';
|
|
|
+import { getUserPage } from '@/api/system/organization';
|
|
|
+export default {
|
|
|
+ components: {
|
|
|
+ //selectUpload,
|
|
|
+ //UploadImg,
|
|
|
+ DialogGoods,
|
|
|
+ DeptSelect
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ title: '新建设备信息',
|
|
|
+ pageType: 'add',
|
|
|
+ btnLoading: false,
|
|
|
+ // 设备主键id
|
|
|
+ id: '',
|
|
|
+ form: {
|
|
|
+ extInfoSelf: [],
|
|
|
// 基本信息
|
|
|
- basicInfo: {},
|
|
|
- // 资产信息
|
|
|
- zcInfo: {
|
|
|
- // 固定资产编码
|
|
|
- fixCode: '',
|
|
|
- // 颜色
|
|
|
- color: '',
|
|
|
- // 重量
|
|
|
- weight: '',
|
|
|
- // 维护部门code
|
|
|
- repairGroupId: '',
|
|
|
- repairDeptName: '',
|
|
|
- repairUserId: '',
|
|
|
- // 权属部门
|
|
|
- ownershipGroupId: '',
|
|
|
- ownershipUserId: '',
|
|
|
- // 设备用途
|
|
|
- purpose: '',
|
|
|
- //品牌
|
|
|
- brand: '',
|
|
|
- // 供应商code
|
|
|
- supplierId: '',
|
|
|
- // 详细地址
|
|
|
- detailLocation: '',
|
|
|
- // 请选择产线
|
|
|
- lineCode: '',
|
|
|
- // 请选择车间
|
|
|
- workshopCode: '',
|
|
|
- // 请选择工厂
|
|
|
- factoryCode: '',
|
|
|
- // 厂房
|
|
|
- factoryPlantCode: '',
|
|
|
- roteCode: ''
|
|
|
- },
|
|
|
- // 图片
|
|
|
- imageUrl: null,
|
|
|
- // 文档信息
|
|
|
- attUrl: {
|
|
|
- operatingManual: null,
|
|
|
- productionLicence: null,
|
|
|
- explosionProofCertificate: null,
|
|
|
- surveyReport: null,
|
|
|
- inspectionCycleManual: null,
|
|
|
- informationDrawing: null,
|
|
|
- productCertificate: null
|
|
|
- },
|
|
|
- // 是否开始物联
|
|
|
- isIotEnable: true,
|
|
|
- // 物联ID
|
|
|
- iotId: '',
|
|
|
- // 回显过保时间
|
|
|
- cbexpirationTime: '',
|
|
|
- // 生命周期
|
|
|
- sourceDICT: '',
|
|
|
- // 网络状态
|
|
|
- networkStatus: '',
|
|
|
- options: {
|
|
|
- deptList: [],
|
|
|
- repairUserId: [],
|
|
|
- ownershipUserId: [],
|
|
|
- supplierId: [],
|
|
|
- factoryCode: [],
|
|
|
- workshopCode: [],
|
|
|
- lineCode: [],
|
|
|
- factoryPlantCode: [],
|
|
|
- brand: []
|
|
|
- }
|
|
|
- };
|
|
|
- },
|
|
|
- watch: {
|
|
|
- 'zcInfo.factoryCode': function (nVal) {
|
|
|
- if (this.pageType == 'add') {
|
|
|
- this.zcInfo.workshopCode = '';
|
|
|
- this.options.workshopCode = [];
|
|
|
- }
|
|
|
-
|
|
|
- // 获取车间
|
|
|
- this.getFactorys();
|
|
|
+ code: '',
|
|
|
+ name: '',
|
|
|
+ productTime: ''
|
|
|
},
|
|
|
- 'zcInfo.workshopCode': function (nVal) {
|
|
|
- if (this.pageType == 'add') {
|
|
|
- this.zcInfo.lineCode = '';
|
|
|
- this.options.lineCode = [];
|
|
|
- }
|
|
|
- // 获取产线
|
|
|
- this.getProductionLine();
|
|
|
+ rules: {
|
|
|
+ name: [{ required: true, message: '请输入设备名称', trigger: 'blur' }],
|
|
|
+ code: [{ required: true, message: '请输入设备编码', trigger: 'blur' }]
|
|
|
+ },
|
|
|
+ // 基本信息
|
|
|
+ basicInfo: {},
|
|
|
+ // 资产信息
|
|
|
+ zcInfo: {
|
|
|
+ // 固定资产编码
|
|
|
+ fixCode: '',
|
|
|
+ // 颜色
|
|
|
+ color: '',
|
|
|
+ // 重量
|
|
|
+ weight: '',
|
|
|
+ // 维护部门code
|
|
|
+ repairGroupId: '',
|
|
|
+ repairDeptName: '',
|
|
|
+ repairUserId: '',
|
|
|
+ // 权属部门
|
|
|
+ ownershipGroupId: '',
|
|
|
+ ownershipUserId: '',
|
|
|
+ // 设备用途
|
|
|
+ purpose: '',
|
|
|
+ //品牌
|
|
|
+ brand: '',
|
|
|
+ // 供应商code
|
|
|
+ supplierId: '',
|
|
|
+ // 详细地址
|
|
|
+ detailLocation: '',
|
|
|
+ // 请选择产线
|
|
|
+ lineCode: '',
|
|
|
+ // 请选择车间
|
|
|
+ workshopCode: '',
|
|
|
+ // 请选择工厂
|
|
|
+ factoryCode: '',
|
|
|
+ // 厂房
|
|
|
+ factoryPlantCode: '',
|
|
|
+ roteCode: ''
|
|
|
+ },
|
|
|
+ // 图片
|
|
|
+ imageUrl: null,
|
|
|
+ // 文档信息
|
|
|
+ attUrl: {
|
|
|
+ operatingManual: null,
|
|
|
+ productionLicence: null,
|
|
|
+ explosionProofCertificate: null,
|
|
|
+ surveyReport: null,
|
|
|
+ inspectionCycleManual: null,
|
|
|
+ informationDrawing: null,
|
|
|
+ productCertificate: null
|
|
|
+ },
|
|
|
+ // 是否开始物联
|
|
|
+ isIotEnable: true,
|
|
|
+ // 物联ID
|
|
|
+ iotId: '',
|
|
|
+ // 回显过保时间
|
|
|
+ cbexpirationTime: '',
|
|
|
+ // 生命周期
|
|
|
+ sourceDICT: '',
|
|
|
+ // 网络状态
|
|
|
+ networkStatus: '',
|
|
|
+ options: {
|
|
|
+ deptList: [],
|
|
|
+ repairUserId: [],
|
|
|
+ ownershipUserId: [],
|
|
|
+ supplierId: [],
|
|
|
+ factoryCode: [],
|
|
|
+ workshopCode: [],
|
|
|
+ lineCode: [],
|
|
|
+ factoryPlantCode: [],
|
|
|
+ brand: []
|
|
|
}
|
|
|
- // "zcInfo.repairGroupId": function (nVal) {
|
|
|
- // this.zcInfo.repairUserId = "";
|
|
|
- // this.options.repairUserId = [];
|
|
|
- // },
|
|
|
- // "zcInfo.ownershipDeptCode": function (nVal) {
|
|
|
- // this.zcInfo.ownershipUserId = "";
|
|
|
- // this.options.ownershipUserId = [];
|
|
|
- // },
|
|
|
- },
|
|
|
- computed: {
|
|
|
- // 过保时间
|
|
|
- expirationTime () {
|
|
|
- if (this.form.productTime && this.basicInfo.expirationDate) {
|
|
|
- return this.setGbTime(
|
|
|
- this.form.productTime,
|
|
|
- this.basicInfo.expirationDate,
|
|
|
- this.basicInfo.expirationDateUnit
|
|
|
- );
|
|
|
- } else {
|
|
|
- return '';
|
|
|
- }
|
|
|
+ };
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ 'zcInfo.factoryCode': function (nVal) {
|
|
|
+ if (this.pageType == 'add') {
|
|
|
+ this.zcInfo.workshopCode = '';
|
|
|
+ this.options.workshopCode = [];
|
|
|
}
|
|
|
+
|
|
|
+ // 获取车间
|
|
|
+ this.getFactorys();
|
|
|
},
|
|
|
- created () {
|
|
|
- if (this.$route.query.id) {
|
|
|
- this.pageType = 'edit';
|
|
|
- this.id = this.$route.query.id;
|
|
|
- this.getInfo();
|
|
|
- this.title = '编辑设备信息';
|
|
|
+ 'zcInfo.workshopCode': function (nVal) {
|
|
|
+ if (this.pageType == 'add') {
|
|
|
+ this.zcInfo.lineCode = '';
|
|
|
+ this.options.lineCode = [];
|
|
|
+ }
|
|
|
+ // 获取产线
|
|
|
+ this.getProductionLine();
|
|
|
+ }
|
|
|
+ // "zcInfo.repairGroupId": function (nVal) {
|
|
|
+ // this.zcInfo.repairUserId = "";
|
|
|
+ // this.options.repairUserId = [];
|
|
|
+ // },
|
|
|
+ // "zcInfo.ownershipDeptCode": function (nVal) {
|
|
|
+ // this.zcInfo.ownershipUserId = "";
|
|
|
+ // this.options.ownershipUserId = [];
|
|
|
+ // },
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ // 过保时间
|
|
|
+ expirationTime() {
|
|
|
+ if (this.form.productTime && this.basicInfo.expirationDate) {
|
|
|
+ return this.setGbTime(
|
|
|
+ this.form.productTime,
|
|
|
+ this.basicInfo.expirationDate,
|
|
|
+ this.basicInfo.expirationDateUnit
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ if (this.$route.query.id) {
|
|
|
+ this.pageType = 'edit';
|
|
|
+ this.id = this.$route.query.id;
|
|
|
+ this.getInfo();
|
|
|
+ this.title = '编辑设备信息';
|
|
|
+ }
|
|
|
+ // this.getTreeList();
|
|
|
+ // this.getgys();
|
|
|
+ // //this.getGxlist();
|
|
|
+ // this.getPlants();
|
|
|
+ this.getfactoryInfo();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ setImgs(type, sort, info) {
|
|
|
+ if (info[0]) {
|
|
|
+ this.attUrl[type] = info[0];
|
|
|
+ this.attUrl[type].sort = sort;
|
|
|
+ } else {
|
|
|
+ this.attUrl[type] = null;
|
|
|
}
|
|
|
- // this.getTreeList();
|
|
|
- // this.getgys();
|
|
|
- // //this.getGxlist();
|
|
|
- // this.getPlants();
|
|
|
- this.getfactoryInfo();
|
|
|
},
|
|
|
- methods: {
|
|
|
- setImgs (type, sort, info) {
|
|
|
- if (info[0]) {
|
|
|
- this.attUrl[type] = info[0];
|
|
|
- this.attUrl[type].sort = sort;
|
|
|
- } else {
|
|
|
- this.attUrl[type] = null;
|
|
|
- }
|
|
|
- },
|
|
|
- handlwpbm () {
|
|
|
- this.$refs.DialogGoods.open();
|
|
|
- },
|
|
|
- async cbDialogGoods (data) {
|
|
|
- this.basicInfo = data;
|
|
|
- this.form.rootCategoryLevelId = JSON.parse(
|
|
|
- this.basicInfo.categoryLevelPathId || '[]'
|
|
|
- )[0];
|
|
|
- this.form.categoryId = this.basicInfo.id;
|
|
|
- this.form.name = this.basicInfo.name;
|
|
|
- // let res = await getAssetNum({
|
|
|
- // assetCode: this.basicInfo.code,
|
|
|
- // num: 1
|
|
|
- // });
|
|
|
- this.form.code = Date.now(); //res.data[0].onlyCode;
|
|
|
- },
|
|
|
- // 计算过保时间
|
|
|
- setGbTime (basic, value, type) {
|
|
|
- basic = Date.parse(basic);
|
|
|
- let time;
|
|
|
- switch (type) {
|
|
|
- case 'minute':
|
|
|
- time = value * 1000 * 60;
|
|
|
- break;
|
|
|
- case 'hour':
|
|
|
- time = value * 1000 * 60 * 60;
|
|
|
- break;
|
|
|
- case 'day':
|
|
|
- time = value * 1000 * 60 * 60 * 24;
|
|
|
- break;
|
|
|
- case 'month':
|
|
|
- time = value * 1000 * 60 * 60 * 24 * 30;
|
|
|
- break;
|
|
|
- case 'year':
|
|
|
- time = value * 1000 * 60 * 60 * 24 * 365;
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
+ handlwpbm() {
|
|
|
+ this.$refs.DialogGoods.open();
|
|
|
+ },
|
|
|
+ async cbDialogGoods(data) {
|
|
|
+ this.basicInfo = data;
|
|
|
+ this.form.rootCategoryLevelId = JSON.parse(
|
|
|
+ this.basicInfo.categoryLevelPathId || '[]'
|
|
|
+ )[0];
|
|
|
+ this.form.categoryId = this.basicInfo.id;
|
|
|
+ this.form.name = this.basicInfo.name;
|
|
|
+ // let res = await getAssetNum({
|
|
|
+ // assetCode: this.basicInfo.code,
|
|
|
+ // num: 1
|
|
|
+ // });
|
|
|
+ this.form.code = Date.now(); //res.data[0].onlyCode;
|
|
|
+ },
|
|
|
+ // 计算过保时间
|
|
|
+ setGbTime(basic, value, type) {
|
|
|
+ basic = Date.parse(basic);
|
|
|
+ let time;
|
|
|
+ switch (type) {
|
|
|
+ case 'minute':
|
|
|
+ time = value * 1000 * 60;
|
|
|
+ break;
|
|
|
+ case 'hour':
|
|
|
+ time = value * 1000 * 60 * 60;
|
|
|
+ break;
|
|
|
+ case 'day':
|
|
|
+ time = value * 1000 * 60 * 60 * 24;
|
|
|
+ break;
|
|
|
+ case 'month':
|
|
|
+ time = value * 1000 * 60 * 60 * 24 * 30;
|
|
|
+ break;
|
|
|
+ case 'year':
|
|
|
+ time = value * 1000 * 60 * 60 * 24 * 365;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
|
|
|
- let num = basic + time;
|
|
|
- return parseTime(num);
|
|
|
- },
|
|
|
- async getwhbm () {
|
|
|
- if (!this.zcInfo.repairGroupId) return;
|
|
|
- let data = await getUserPage({
|
|
|
- pageNum: 1,
|
|
|
- size: 9999,
|
|
|
- groupId: this.zcInfo.repairGroupId
|
|
|
- });
|
|
|
- this.options.repairUserId = data.list;
|
|
|
- },
|
|
|
- async getqsbm () {
|
|
|
- if (!this.zcInfo.ownershipGroupId) return;
|
|
|
- let data = await getUserPage({
|
|
|
- pageNum: 1,
|
|
|
- size: 9999,
|
|
|
- groupId: this.zcInfo.ownershipGroupId
|
|
|
- });
|
|
|
- this.options.ownershipUserId = data.list;
|
|
|
- },
|
|
|
- // 树形结构数据
|
|
|
- getTreeList () {
|
|
|
- org.tree().then((res) => {
|
|
|
- this.options.deptList = res.data;
|
|
|
- });
|
|
|
- },
|
|
|
- // 获取供应商、工序列表
|
|
|
- async getgys () {
|
|
|
- let muster = await getSupplier({
|
|
|
- size: 999
|
|
|
- });
|
|
|
- this.options.supplierId = muster.data.items; //供应商
|
|
|
- },
|
|
|
- // 获取工序列表
|
|
|
- async getGxlist () {
|
|
|
- // let data = await dict.list({
|
|
|
- // size: 999
|
|
|
- // });
|
|
|
- // this.options.roteCode = data.data.items;
|
|
|
- },
|
|
|
- // 获取厂房列表
|
|
|
- async getPlants () {
|
|
|
- // let data = await getPlants({
|
|
|
- // size: 999
|
|
|
- // });
|
|
|
- // this.options.factoryPlantCode = data.data.items;
|
|
|
- },
|
|
|
- // 获取工厂列表
|
|
|
- async getfactoryInfo () {
|
|
|
- let data = await getFactoryarea({
|
|
|
- size: 999,
|
|
|
- type: 1,
|
|
|
- enable: 1
|
|
|
- });
|
|
|
- this.options.factoryCode = data.list;
|
|
|
- },
|
|
|
- // 获取车间列表
|
|
|
- async getFactorys () {
|
|
|
- // let data = await getFactorys({
|
|
|
- // factoryCode: this.zcInfo.factoryCode,
|
|
|
- // size: 999
|
|
|
- // });
|
|
|
- // this.options.workshopCode = data.data.items;
|
|
|
- },
|
|
|
- // 获取产线列表
|
|
|
- async getProductionLine () {
|
|
|
- // let data = await getProductionLine({
|
|
|
- // factory: this.zcInfo.factoryCode,
|
|
|
- // workshopId: this.zcInfo.workshopCode,
|
|
|
- // size: 999
|
|
|
- // });
|
|
|
- // this.options.lineCode = data.data.items;
|
|
|
- },
|
|
|
- // 选择图片回调
|
|
|
- cbUploadImg (data) {
|
|
|
- if (data.length > 0) {
|
|
|
- this.imageUrl = data[0];
|
|
|
+ let num = basic + time;
|
|
|
+ return parseTime(num);
|
|
|
+ },
|
|
|
+ async getwhbm() {
|
|
|
+ if (!this.zcInfo.repairGroupId) return;
|
|
|
+ let data = await getUserPage({
|
|
|
+ pageNum: 1,
|
|
|
+ size: 9999,
|
|
|
+ groupId: this.zcInfo.repairGroupId
|
|
|
+ });
|
|
|
+ this.options.repairUserId = data.list;
|
|
|
+ },
|
|
|
+ async getqsbm() {
|
|
|
+ if (!this.zcInfo.ownershipGroupId) return;
|
|
|
+ let data = await getUserPage({
|
|
|
+ pageNum: 1,
|
|
|
+ size: 9999,
|
|
|
+ groupId: this.zcInfo.ownershipGroupId
|
|
|
+ });
|
|
|
+ this.options.ownershipUserId = data.list;
|
|
|
+ },
|
|
|
+ // 树形结构数据
|
|
|
+ getTreeList() {
|
|
|
+ org.tree().then((res) => {
|
|
|
+ this.options.deptList = res.data;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 获取供应商、工序列表
|
|
|
+ async getgys() {
|
|
|
+ let muster = await getSupplier({
|
|
|
+ size: 999
|
|
|
+ });
|
|
|
+ this.options.supplierId = muster.data.items; //供应商
|
|
|
+ },
|
|
|
+ // 获取工序列表
|
|
|
+ async getGxlist() {
|
|
|
+ // let data = await dict.list({
|
|
|
+ // size: 999
|
|
|
+ // });
|
|
|
+ // this.options.roteCode = data.data.items;
|
|
|
+ },
|
|
|
+ // 获取厂房列表
|
|
|
+ async getPlants() {
|
|
|
+ // let data = await getPlants({
|
|
|
+ // size: 999
|
|
|
+ // });
|
|
|
+ // this.options.factoryPlantCode = data.data.items;
|
|
|
+ },
|
|
|
+ // 获取工厂列表
|
|
|
+ async getfactoryInfo() {
|
|
|
+ let data = await getFactoryarea({
|
|
|
+ size: 999,
|
|
|
+ type: 1,
|
|
|
+ enable: 1
|
|
|
+ });
|
|
|
+ this.options.factoryCode = data.list;
|
|
|
+ },
|
|
|
+ // 获取车间列表
|
|
|
+ async getFactorys() {
|
|
|
+ // let data = await getFactorys({
|
|
|
+ // factoryCode: this.zcInfo.factoryCode,
|
|
|
+ // size: 999
|
|
|
+ // });
|
|
|
+ // this.options.workshopCode = data.data.items;
|
|
|
+ },
|
|
|
+ // 获取产线列表
|
|
|
+ async getProductionLine() {
|
|
|
+ // let data = await getProductionLine({
|
|
|
+ // factory: this.zcInfo.factoryCode,
|
|
|
+ // workshopId: this.zcInfo.workshopCode,
|
|
|
+ // size: 999
|
|
|
+ // });
|
|
|
+ // this.options.lineCode = data.data.items;
|
|
|
+ },
|
|
|
+ // 选择图片回调
|
|
|
+ cbUploadImg(data) {
|
|
|
+ if (data.length > 0) {
|
|
|
+ this.imageUrl = data[0];
|
|
|
+ } else {
|
|
|
+ this.imageUrl = '';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 添加自定义参数
|
|
|
+ addItem() {
|
|
|
+ if (this.form.extInfoSelf.length < 10) {
|
|
|
+ let item = { key: '', value: '' };
|
|
|
+ this.form.extInfoSelf.push(item);
|
|
|
+ } else {
|
|
|
+ this.$message.warning('自定义参数最多添加10条');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 删除自定义参数
|
|
|
+ delt(item, index) {
|
|
|
+ this.form.extInfoSelf.splice(index, 1);
|
|
|
+ },
|
|
|
+ // 提交
|
|
|
+ submit() {
|
|
|
+ if (!this.basicInfo && this.pageType == 'add') {
|
|
|
+ return this.$message.error('请选择物品编码');
|
|
|
+ }
|
|
|
+ this.$refs.form.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ let par = {
|
|
|
+ //基本信息
|
|
|
+ ...this.form,
|
|
|
+ // id: this.basicInfo.id,
|
|
|
+ // assetCode: this.form.code,
|
|
|
+ // assetName: this.form.name,
|
|
|
+ assetType: 1,
|
|
|
+ // informationId: this.basicInfo.id,
|
|
|
+ // productTime: this.form.productTime,
|
|
|
+ // expirationTime: this.expirationTime,
|
|
|
+ // 资产信息
|
|
|
+ positionIds: '1,1,1,1',
|
|
|
+ ...this.zcInfo,
|
|
|
+ // 文档信息
|
|
|
+ attUrl: this.setWd() || [],
|
|
|
+ // // 设备图片
|
|
|
+ imageUrl: this.imageUrl || {},
|
|
|
+ // 是否启用物联
|
|
|
+ isIotEnable: this.isIotEnable
|
|
|
+ // // 扩展字段
|
|
|
+ // extInfoSelf: this.setKz()
|
|
|
+ };
|
|
|
+ if (this.pageType == 'edit') {
|
|
|
+ par.id = this.id;
|
|
|
+ }
|
|
|
+ this.btnLoading = true;
|
|
|
+ saveOrEdit(par)
|
|
|
+ .then((res) => {
|
|
|
+ this.$message.success('操作成功');
|
|
|
+ this.$router.go(-1);
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ this.btnLoading = false;
|
|
|
+ });
|
|
|
} else {
|
|
|
- this.imageUrl = '';
|
|
|
+ console.log('error submit!!');
|
|
|
+ return false;
|
|
|
}
|
|
|
- },
|
|
|
- // 添加自定义参数
|
|
|
- addItem () {
|
|
|
- if (this.form.extInfoSelf.length < 10) {
|
|
|
- let item = { key: '', value: '' };
|
|
|
- this.form.extInfoSelf.push(item);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 处理扩展字段
|
|
|
+ setKz() {
|
|
|
+ return this.form.extInfoSelf || [];
|
|
|
+ },
|
|
|
+ // 处理文档信息
|
|
|
+ setWd() {
|
|
|
+ let attUrl = [];
|
|
|
+ Object.entries(this.attUrl).forEach(([key, value], index) => {
|
|
|
+ if (value) {
|
|
|
+ attUrl.push(value);
|
|
|
} else {
|
|
|
- this.$message.warning('自定义参数最多添加10条');
|
|
|
+ attUrl.push({ sort: index + 1 });
|
|
|
}
|
|
|
- },
|
|
|
- // 删除自定义参数
|
|
|
- delt (item, index) {
|
|
|
- this.form.extInfoSelf.splice(index, 1);
|
|
|
- },
|
|
|
- // 提交
|
|
|
- submit () {
|
|
|
- if (!this.basicInfo && this.pageType == 'add') {
|
|
|
- return this.$message.error('请选择物品编码');
|
|
|
- }
|
|
|
- this.$refs.form.validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- let par = {
|
|
|
- //基本信息
|
|
|
- ...this.form,
|
|
|
- // id: this.basicInfo.id,
|
|
|
- // assetCode: this.form.code,
|
|
|
- // assetName: this.form.name,
|
|
|
- assetType: 1,
|
|
|
- // informationId: this.basicInfo.id,
|
|
|
- // productTime: this.form.productTime,
|
|
|
- // expirationTime: this.expirationTime,
|
|
|
- // 资产信息
|
|
|
- positionIds: '1,1,1,1',
|
|
|
- ...this.zcInfo,
|
|
|
- // 文档信息
|
|
|
- attUrl: this.setWd() || [],
|
|
|
- // // 设备图片
|
|
|
- imageUrl: this.imageUrl || {},
|
|
|
- // 是否启用物联
|
|
|
- isIotEnable: this.isIotEnable
|
|
|
- // // 扩展字段
|
|
|
- // extInfoSelf: this.setKz()
|
|
|
- };
|
|
|
- if (this.pageType == 'edit') {
|
|
|
- par.id = this.id;
|
|
|
- }
|
|
|
- this.btnLoading = true;
|
|
|
- saveOrEdit(par)
|
|
|
- .then((res) => {
|
|
|
- this.$message.success('操作成功');
|
|
|
- this.$router.go(-1);
|
|
|
- })
|
|
|
- .finally(() => {
|
|
|
- this.btnLoading = false;
|
|
|
- });
|
|
|
- } else {
|
|
|
- console.log('error submit!!');
|
|
|
- return false;
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- // 处理扩展字段
|
|
|
- setKz () {
|
|
|
- return this.form.extInfoSelf || [];
|
|
|
- },
|
|
|
- // 处理文档信息
|
|
|
- setWd () {
|
|
|
- let attUrl = [];
|
|
|
- Object.entries(this.attUrl).forEach(([key, value], index) => {
|
|
|
- if (value) {
|
|
|
- attUrl.push(value);
|
|
|
- } else {
|
|
|
- attUrl.push({ sort: index + 1 });
|
|
|
+ });
|
|
|
+ return attUrl;
|
|
|
+ },
|
|
|
+ // 获取设备详情
|
|
|
+ async getInfo() {
|
|
|
+ const data = await getAssetInfo(this.id);
|
|
|
+ this.form = data;
|
|
|
+ this.basicInfo = data.category;
|
|
|
+ this.cbexpirationTime = data.expirationTime;
|
|
|
+ this.sourceDICT = data.sourceDICT;
|
|
|
+ this.networkStatus = data.networkStatus;
|
|
|
+ // 资产信息
|
|
|
+ for (const key of Object.keys(this.zcInfo)) {
|
|
|
+ console.log(key, data[key]);
|
|
|
+ this.zcInfo[key] = data[key];
|
|
|
+ }
|
|
|
+ this.getwhbm();
|
|
|
+ this.getqsbm();
|
|
|
+ if (data.attUrl && data.attUrl.length > 0) {
|
|
|
+ // 文档信息
|
|
|
+ Object.keys(this.attUrl).forEach((n, index) => {
|
|
|
+ if (data.attUrl[index].accessUrl) {
|
|
|
+ this.attUrl[n] = data.attUrl[index];
|
|
|
}
|
|
|
});
|
|
|
- return attUrl;
|
|
|
- },
|
|
|
- // 获取设备详情
|
|
|
- async getInfo () {
|
|
|
- const data = await getAssetInfo(this.id);
|
|
|
- this.form = data;
|
|
|
- this.basicInfo = data.category;
|
|
|
- this.cbexpirationTime = data.expirationTime;
|
|
|
- this.sourceDICT = data.sourceDICT;
|
|
|
- this.networkStatus = data.networkStatus;
|
|
|
- // 资产信息
|
|
|
- for (const key of Object.keys(this.zcInfo)) {
|
|
|
- console.log(key, data[key]);
|
|
|
- this.zcInfo[key] = data[key];
|
|
|
- }
|
|
|
- this.getwhbm();
|
|
|
- this.getqsbm();
|
|
|
- if (data.attUrl && data.attUrl.length > 0) {
|
|
|
- // 文档信息
|
|
|
- Object.keys(this.attUrl).forEach((n, index) => {
|
|
|
- if (data.attUrl[index].accessUrl) {
|
|
|
- this.attUrl[n] = data.attUrl[index];
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- // 设备图片
|
|
|
- this.imageUrl = data.imageUrl;
|
|
|
- if (this.imageUrl) {
|
|
|
- // imageView(this.imageUrl).then((res) => {
|
|
|
- // this.$refs.UploadImg.setImg(res);
|
|
|
- // });
|
|
|
- }
|
|
|
- // 物联参数
|
|
|
- this.isIotEnable = data.isIotEnable;
|
|
|
- this.iotId = data.iotId;
|
|
|
- },
|
|
|
- // 设置标准产能
|
|
|
- setbzcn (val) {
|
|
|
- if (!val) {
|
|
|
- return '';
|
|
|
- }
|
|
|
- let item = JSON.parse(val);
|
|
|
- return item.standardCapacity || '';
|
|
|
- },
|
|
|
- hanldFactoryCode () {
|
|
|
- // 重置
|
|
|
- this.zcInfo.workshopCode = '';
|
|
|
- this.zcInfo.lineCode = '';
|
|
|
- this.options.workshopCode = [];
|
|
|
- this.options.lineCode = [];
|
|
|
- // 获取车间
|
|
|
- this.getFactorys();
|
|
|
- },
|
|
|
- hanldWorkshopCode () {
|
|
|
- // 重置
|
|
|
- this.options.workshopCode = [];
|
|
|
- this.options.lineCode = [];
|
|
|
- // 获取产线
|
|
|
- this.getProductionLine();
|
|
|
+ // 设备图片
|
|
|
+ this.imageUrl = data.imageUrl;
|
|
|
+ if (this.imageUrl) {
|
|
|
+ // imageView(this.imageUrl).then((res) => {
|
|
|
+ // this.$refs.UploadImg.setImg(res);
|
|
|
+ // });
|
|
|
}
|
|
|
+ // 物联参数
|
|
|
+ this.isIotEnable = data.isIotEnable;
|
|
|
+ this.iotId = data.iotId;
|
|
|
+ },
|
|
|
+ // 设置标准产能
|
|
|
+ setbzcn(val) {
|
|
|
+ if (!val) {
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ let item = JSON.parse(val);
|
|
|
+ return item.standardCapacity || '';
|
|
|
+ },
|
|
|
+ hanldFactoryCode() {
|
|
|
+ // 重置
|
|
|
+ this.zcInfo.workshopCode = '';
|
|
|
+ this.zcInfo.lineCode = '';
|
|
|
+ this.options.workshopCode = [];
|
|
|
+ this.options.lineCode = [];
|
|
|
+ // 获取车间
|
|
|
+ this.getFactorys();
|
|
|
+ },
|
|
|
+ hanldWorkshopCode() {
|
|
|
+ // 重置
|
|
|
+ this.options.workshopCode = [];
|
|
|
+ this.options.lineCode = [];
|
|
|
+ // 获取产线
|
|
|
+ this.getProductionLine();
|
|
|
}
|
|
|
- };
|
|
|
+ }
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
- .baseinfo-container .basic-details-title {
|
|
|
- font-size: 16px;
|
|
|
- margin: 15px 0;
|
|
|
- }
|
|
|
- .equipment-container {
|
|
|
- // .content {
|
|
|
- // padding: 0 20px;
|
|
|
- // }
|
|
|
- .label-none {
|
|
|
- .el-form-item__content {
|
|
|
- margin-left: 0 !important;
|
|
|
- }
|
|
|
- }
|
|
|
- .upload-container {
|
|
|
- display: flex;
|
|
|
- .file-list {
|
|
|
- margin-left: 50px;
|
|
|
- flex: 1;
|
|
|
- }
|
|
|
+.baseinfo-container .basic-details-title {
|
|
|
+ font-size: 16px;
|
|
|
+ margin: 15px 0;
|
|
|
+}
|
|
|
+.equipment-container {
|
|
|
+ // .content {
|
|
|
+ // padding: 0 20px;
|
|
|
+ // }
|
|
|
+ .label-none {
|
|
|
+ .el-form-item__content {
|
|
|
+ margin-left: 0 !important;
|
|
|
}
|
|
|
}
|
|
|
- .sbwz {
|
|
|
- .item {
|
|
|
- width: 120px;
|
|
|
- }
|
|
|
- .item + .item {
|
|
|
- margin-left: 10px;
|
|
|
- }
|
|
|
- .item-input {
|
|
|
- width: 350px;
|
|
|
+ .upload-container {
|
|
|
+ display: flex;
|
|
|
+ .file-list {
|
|
|
+ margin-left: 50px;
|
|
|
+ flex: 1;
|
|
|
}
|
|
|
}
|
|
|
- .input {
|
|
|
- width: 202px;
|
|
|
+}
|
|
|
+.sbwz {
|
|
|
+ .item {
|
|
|
+ width: 120px;
|
|
|
}
|
|
|
- .kzzd {
|
|
|
- width: 500px;
|
|
|
- .add-col {
|
|
|
- display: flex;
|
|
|
- .col-input {
|
|
|
- & + .col-input {
|
|
|
- margin-left: 10px;
|
|
|
- }
|
|
|
- }
|
|
|
- .del {
|
|
|
+ .item + .item {
|
|
|
+ margin-left: 10px;
|
|
|
+ }
|
|
|
+ .item-input {
|
|
|
+ width: 350px;
|
|
|
+ }
|
|
|
+}
|
|
|
+.input {
|
|
|
+ width: 202px;
|
|
|
+}
|
|
|
+.kzzd {
|
|
|
+ width: 500px;
|
|
|
+ .add-col {
|
|
|
+ display: flex;
|
|
|
+ .col-input {
|
|
|
+ & + .col-input {
|
|
|
margin-left: 10px;
|
|
|
}
|
|
|
}
|
|
|
+ .del {
|
|
|
+ margin-left: 10px;
|
|
|
+ }
|
|
|
}
|
|
|
+}
|
|
|
</style>
|