quwangxin пре 3 година
родитељ
комит
b95843d4cb

+ 48 - 0
src/components/CommomSelect/dept-select.vue

@@ -0,0 +1,48 @@
+<!-- 部门树形选择下拉框 -->
+<template>
+  <ele-tree-select
+    clearable
+    :value="value || ''"
+    :data="treeData"
+    label-key="name"
+    value-key="id"
+    default-expand-all
+    :placeholder="placeholder"
+    @input="updateValue"
+    @change="handleChange"
+  />
+</template>
+
+<script>
+  import { listOrganizations } from '@/api/system/organization';
+  export default {
+    props: {
+      // 选中的数据(v-model)
+      value: [Number, String],
+      // 提示信息
+      placeholder: {
+        type: String,
+        default: '请选择'
+      }
+    },
+    data () {
+      return {
+        treeData: []
+      };
+    },
+    created () {},
+    methods: {
+      async getData (parmas = {}) {
+        const data = await listOrganizations(parmas);
+        this.treeData = data || [];
+      },
+      /* 更新选中数据 */
+      updateValue (value) {
+        this.$emit('input', value);
+      },
+      handleChange (item) {
+        console.log(item);
+      }
+    }
+  };
+</script>

+ 11 - 0
src/styles/transition/common.scss

@@ -1,3 +1,14 @@
 .w100 {
   width: 100%;
 }
+
+.ele-body {
+  .page-title {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    border-bottom: 1px solid #eaeefb;
+    padding-bottom: 8px;
+    margin-bottom: 16px;
+  }
+}

+ 258 - 0
src/views/ledgerAssets/equipment/components/DialogGoods.vue

@@ -0,0 +1,258 @@
+<template>
+  <div class="dialogBox">
+    <el-dialog
+      :close-on-click-modal="false"
+      :append-to-body="appendToBody"
+      :title="title"
+      :visible.sync="visibleSync"
+      :before-close="close"
+      :width="width"
+      :custom-class="customClass"
+    >
+      <div class="boy-main">
+        <div class="from-search-bar">
+          <el-form>
+            <el-form-item>
+              <el-input
+                type="text"
+                v-model="searchForm.searchKey"
+                size="small"
+                placeholder="搜索物品编码/名称"
+              ></el-input>
+            </el-form-item>
+          </el-form>
+          <div class="btn-wrap">
+            <el-button icon="el-icon-refresh-left" size="small" @click="rest"
+              >重置</el-button
+            >
+            <el-button
+              type="primary"
+              icon="el-icon-search"
+              size="small"
+              @click="getData"
+              >搜索</el-button
+            >
+          </div>
+        </div>
+        <div class="main">
+          <div class="tree-col">
+            <AssetTree
+              @handleNodeClick="handleNodeClick"
+              ref="AssetTree"
+              :defaultExpandAll="true"
+              :init="true"
+              type="1"
+            />
+          </div>
+          <div class="right-wrap">
+            <el-table
+              ref="multipleTable"
+              class="tableRef"
+              :data="tableData"
+              tooltip-effect="dark"
+              stripe
+              row-key="index"
+              max-height="450"
+              border
+              :header-cell-style="{ background: '#EEEEEE', border: 'none' }"
+              @select-all="onSelectAll"
+              @selection-change="selectItem"
+              @row-click="onSelectOp"
+            >
+              <el-table-column label="序号" type="index" width="50">
+              </el-table-column>
+              <el-table-column
+                label="物品编码"
+                prop="informationCode"
+                width="120"
+              >
+              </el-table-column>
+              <el-table-column
+                label="物品名称"
+                prop="informationName"
+                width="100"
+              >
+              </el-table-column>
+              <el-table-column
+                label="规格"
+                prop="specification"
+              ></el-table-column>
+              <el-table-column label="型号" prop="modelType"> </el-table-column>
+              <el-table-column
+                label="物品类型"
+                prop="classificationCode"
+                :formatter="classificationCodeFormatter"
+              >
+              </el-table-column>
+              <el-table-column label="分类" prop="classificationUrl">
+              </el-table-column>
+              <el-table-column type="selection" width="55"> </el-table-column>
+            </el-table>
+            <div class="btn-wrap">
+              <el-button size="small" @click="close">取消</el-button>
+              <el-button type="primary" size="small" @click="submit"
+                >确认</el-button
+              >
+            </div>
+          </div>
+        </div>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+<script>
+  import AssetTree from '@/components/AssetTree';
+  // import { getList } from "@/api/stockManagement/itemInformation";
+  export default {
+    props: {
+      // 宽度
+      width: {
+        type: String,
+        default: () => null
+      },
+      // 类名
+      customClass: {
+        type: String,
+        default: () => null
+      },
+      appendToBody: {
+        type: Boolean,
+        default: () => false
+      }
+    },
+    components: {
+      AssetTree
+    },
+    data () {
+      return {
+        visibleSync: false,
+        title: '选择物品编码',
+        searchForm: {
+          searchKey: '',
+          classificationId: ''
+        },
+        tableData: [],
+        multipleSelection: [],
+        typeList: [
+          { id: 1, value: 'w01  生产设备', prefix: 'w01', code: 1 },
+          { id: 2, value: 'w02  舟皿', prefix: 'w02', code: 2 },
+          { id: 3, value: 'w03  周转车', prefix: 'w03', code: 5 },
+          { id: 4, value: 'w04  模具', prefix: 'w04', code: 6 },
+          { id: 5, value: 'w05  备品备件', prefix: 'w05', code: 7 },
+          { id: 6, value: 'w06  物料', prefix: 'w06', code: 3 },
+          { id: 7, value: 'w07  产品', prefix: 'w07', code: 4 },
+          { id: 8, value: 'w08  耗材', prefix: 'w08', code: 8 }
+        ]
+      };
+    },
+    methods: {
+      open () {
+        this.visibleSync = true;
+      },
+      close () {
+        this.visibleSync = false;
+      },
+      rest () {
+        this.searchForm.searchKey = '';
+        this.getData();
+      },
+      async getData () {
+        let par = {
+          ...this.searchForm,
+          size: 999,
+          page: 1
+        };
+        const res = await getList(par);
+        if (res?.success) {
+          this.tableData = res.data.records;
+        }
+      },
+      handleNodeClick (info) {
+        this.searchForm.classificationId = info.id;
+        this.getData();
+      },
+
+      onSelectAll () {
+        this.$refs.multipleTable.clearSelection();
+      },
+      selectItem (rows) {
+        if (rows.length > 1) {
+          const newRows = rows.filter((it, index) => {
+            if (index == rows.length - 1) {
+              this.$refs.multipleTable.toggleRowSelection(it, true);
+              return true;
+            } else {
+              this.$refs.multipleTable.toggleRowSelection(it, false);
+              return false;
+            }
+          });
+          this.multipleSelection = newRows;
+        } else {
+          this.multipleSelection = rows;
+        }
+        this.userId = this.multipleSelection.length
+          ? this.multipleSelection[0].guid
+          : '';
+      },
+      onSelectOp (row) {
+        this.$refs.multipleTable.clearSelection();
+        this.$refs.multipleTable.toggleRowSelection(row, true);
+        this.multipleSelection = [];
+        this.multipleSelection.push(row);
+      },
+      submit () {
+        if (this.multipleSelection.length < 1) {
+          return this.$message.error('请选择物品编码');
+        }
+        this.$emit('succeed', this.multipleSelection[0]);
+        this.close();
+      },
+      // 物品类型格式化
+      classificationCodeFormatter (row) {
+        let itemName = '';
+        this.typeList.map((item) => {
+          if (item.prefix == row.classificationCode) {
+            itemName = item.value;
+          }
+        });
+        return itemName;
+      }
+    }
+  };
+</script>
+<style lang="scss" scoped>
+  .from-search-bar {
+    display: flex;
+    .btn-wrap {
+      margin-left: 20px;
+    }
+  }
+  .main {
+    display: flex;
+    .tree-col {
+      margin-right: 10px;
+      width: 350px;
+      height: 500px;
+      overflow-y: auto;
+      padding: 0 !important;
+      background-color: #fff;
+      margin-top: 10px;
+      border: 1px solid #e6ebf5;
+      border-radius: 4px;
+      overflow-x: auto;
+      box-sizing: border-box;
+    }
+    .right-wrap {
+      width: 100%;
+      margin-top: 10px;
+      .tableRef {
+        height: 450px;
+      }
+      .btn-wrap {
+        display: flex;
+        justify-content: flex-end;
+        margin-top: 20px;
+      }
+    }
+  }
+</style>

+ 19 - 1
src/views/ledgerAssets/equipment/components/equipment-list.vue

@@ -13,6 +13,15 @@
     >
       <!-- 表头工具栏 -->
       <template v-slot:toolbar>
+        <el-button
+          size="small"
+          type="primary"
+          icon="el-icon-plus"
+          class="ele-btn-icon"
+          @click="add"
+        >
+          新建
+        </el-button>
         <el-button
           size="small"
           type="primary"
@@ -140,7 +149,16 @@
       // 跳转到详情页
       handEdit ({ id }) {
         this.$router.push({
-          path: '/ledgerAssets/boat/detail',
+          path: '/ledgerAssets/equipment/detail',
+          query: {
+            id
+          }
+        });
+      },
+      // 跳转到详情页
+      add ({ id }) {
+        this.$router.push({
+          path: '/ledgerAssets/equipment/edit',
           query: {
             id
           }

+ 984 - 0
src/views/ledgerAssets/equipment/edit.vue

@@ -0,0 +1,984 @@
+<template>
+  <div class="ele-body">
+    <el-card shadow="never">
+      <div class="page-title">
+        <el-page-header @back="$router.go(-1)">
+          <div slot="content" class="pageContent">
+            <div>{{ title }}</div>
+          </div>
+        </el-page-header>
+        <div>
+          <el-button size="small" @click="$router.go(-1)">取消</el-button>
+          <el-button
+            size="small"
+            type="primary"
+            @click="submit"
+            v-loading="btnLoading"
+            >确定</el-button
+          >
+        </div>
+      </div>
+      <el-form label-width="120px" :model="form" ref="form" :rules="rules">
+        <div class="content">
+          <div class="basic-details-title border-none">
+            <span class="border-span">基本信息</span>
+          </div>
+          <el-descriptions title="" :column="4" size="medium" border>
+            <template slot="title" v-if="pageType == 'add'">
+              <el-form-item class="label-none">
+                <span style="color: red; padding-right: 5px">*</span>
+                <el-button type="primary" plain @click="handlwpbm"
+                  >选择物品编码</el-button
+                >
+              </el-form-item>
+            </template>
+            <el-descriptions-item>
+              <template slot="label"> 设备编码 </template>
+              <el-form-item
+                prop="informationCode"
+                label-width="0"
+                v-if="pageType == 'add'"
+              >
+                <el-input
+                  v-if="basicInfo"
+                  class="input"
+                  size="small"
+                  v-model="form.informationCode"
+                ></el-input>
+              </el-form-item>
+              <span v-if="pageType == 'edit'">{{ form.informationCode }}</span>
+            </el-descriptions-item>
+            <el-descriptions-item>
+              <template slot="label"> 设备名称 </template>
+              <el-form-item
+                prop="informationName"
+                label-width="0"
+                v-if="pageType == 'add'"
+              >
+                <el-input
+                  v-if="basicInfo"
+                  class="input"
+                  size="small"
+                  v-model="form.informationName"
+                ></el-input>
+              </el-form-item>
+              <span v-if="pageType == 'edit'">{{ form.informationName }}</span>
+            </el-descriptions-item>
+            <el-descriptions-item>
+              <template slot="label"> 型号</template>
+              {{ basicInfo.modelType }}
+            </el-descriptions-item>
+            <el-descriptions-item>
+              <template slot="label"> 规格 </template>
+              {{ basicInfo.specification }}
+            </el-descriptions-item>
+            <el-descriptions-item :span="2">
+              <template slot="label"> 分类 </template>
+              {{ basicInfo.classificationUrl }}
+            </el-descriptions-item>
+            <el-descriptions-item>
+              <template slot="label"> 生产日期 </template>
+              <el-form-item
+                prop="productTime"
+                label-width="0"
+                v-if="pageType == 'add'"
+              >
+                <el-date-picker
+                  v-if="basicInfo"
+                  v-model="form.productTime"
+                  type="datetime"
+                  placeholder="选择日期时间"
+                  value-format="yyyy-MM-dd HH:mm:ss"
+                >
+                </el-date-picker>
+              </el-form-item>
+              <span v-if="pageType == 'edit'">{{ form.productTime }}</span>
+            </el-descriptions-item>
+            <el-descriptions-item>
+              <template slot="label"> 过保日期 </template>
+              <span v-if="pageType == 'add'">{{ expirationTime }}</span>
+              <span v-if="pageType == 'edit'">{{ cbexpirationTime }}</span>
+            </el-descriptions-item>
+            <el-descriptions-item>
+              <template slot="label"> 计量单位 </template>
+              {{ basicInfo.measuringUnit }}
+            </el-descriptions-item>
+            <el-descriptions-item>
+              <template slot="label"> 标准产能 </template>
+              {{ setbzcn(basicInfo.extendField) }}
+            </el-descriptions-item>
+            <!-- <el-descriptions-item v-if="pageType == 'edit'">
+            <template slot="label"> 实际产能 </template>
+            {{ basicInfo.measuringUnit }}
+          </el-descriptions-item> -->
+            <el-descriptions-item v-if="pageType == 'edit'">
+              <template slot="label"> 生命周期</template>
+              {{ sourceDICT }}
+            </el-descriptions-item>
+            <el-descriptions-item v-if="pageType == 'edit'">
+              <template slot="label"> 网络状态</template>
+              {{ networkStatus == 1 ? '在线' : '离线' }}
+            </el-descriptions-item>
+          </el-descriptions>
+
+          <div class="basic-details-title border-none">
+            <span class="border-span">资产信息</span>
+          </div>
+          <el-row>
+            <el-col :span="8">
+              <el-form-item label="固资编码">
+                <el-input
+                  class="input"
+                  size="small"
+                  v-model="zcInfo.fixAssetCode"
+                ></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="颜色">
+                <el-input
+                  class="input"
+                  size="small"
+                  v-model="zcInfo.color"
+                ></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="重量">
+                <el-input
+                  size="small"
+                  class="input"
+                  v-model="zcInfo.weight"
+                ></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="维护部门">
+                <DeptSelect v-model="zcInfo.repairDeptCode" />
+                <!-- <selectTree
+                ref="tree1"
+                class="input"
+                :options="options.deptList"
+                :initStr="zcInfo.repairDeptName"
+                :props="{
+                  value: 'code',
+                  label: 'name',
+                  children: 'children'
+                }"
+                @getValue="whDeptClick"
+              /> -->
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="维护人">
+                <el-select v-model="zcInfo.repairUserId" placeholder="请选择">
+                  <el-option
+                    v-for="item in options.repairUserId"
+                    :key="item.id"
+                    :label="item.name"
+                    :value="item.id"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="权属部门">
+                <selectTree
+                  ref="tree2"
+                  class="input"
+                  :initStr="zcInfo.ownershipDeptName"
+                  :options="options.deptList"
+                  :props="{
+                    value: 'code',
+                    label: 'name',
+                    children: 'children'
+                  }"
+                  @getValue="qsDeptClick"
+                />
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="权属人">
+                <el-select
+                  v-model="zcInfo.ownershipUserId"
+                  placeholder="请选择"
+                >
+                  <el-option
+                    v-for="item in options.ownershipUserId"
+                    :key="item.id"
+                    :label="item.name"
+                    :value="item.id"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="设备用途">
+                <el-input
+                  v-model="zcInfo.purpose"
+                  size="small"
+                  class="input"
+                ></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="所属工序">
+                <!-- <el-select v-model="zcInfo.roteCode" placeholder="请选择">
+                <el-option
+                  v-for="item in options.roteCode"
+                  :key="item.code"
+                  :label="item.name"
+                  :value="item.code"
+                >
+                </el-option>
+              </el-select> -->
+                {{ '成型工序' }}
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="品牌">
+                <el-select v-model="zcInfo.brand" placeholder="请选择">
+                  <el-option
+                    v-for="item in options.brand"
+                    :key="item.id"
+                    :label="item.name"
+                    :value="item.id"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="供应商">
+                <el-select v-model="zcInfo.supplierId" placeholder="请选择">
+                  <el-option
+                    v-for="item in options.supplierId"
+                    :key="item.id"
+                    :label="item.name"
+                    :value="item.id"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="所属厂房">
+                <el-select
+                  v-model="zcInfo.factoryPlantCode"
+                  placeholder="请选择"
+                >
+                  <el-option
+                    v-for="item in options.factoryPlantCode"
+                    :key="item.code"
+                    :label="item.name"
+                    :value="item.code"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="24">
+              <el-form-item label="设备位置">
+                <div class="sbwz">
+                  <el-select
+                    class="item"
+                    v-model="zcInfo.factoryCode"
+                    placeholder="请选择工厂"
+                    @change="hanldFactoryCode"
+                  >
+                    <el-option
+                      v-for="item in options.factoryCode"
+                      :key="item.code"
+                      :label="item.name"
+                      :value="item.code"
+                    >
+                    </el-option>
+                  </el-select>
+                  <el-select
+                    class="item"
+                    v-model="zcInfo.workshopCode"
+                    placeholder="请选择车间"
+                    @change="hanldWorkshopCode"
+                  >
+                    <el-option
+                      v-for="item in options.workshopCode"
+                      :key="item.id"
+                      :label="item.name"
+                      :value="item.id"
+                    >
+                    </el-option>
+                  </el-select>
+                  <el-select
+                    class="item"
+                    v-model="zcInfo.lineCode"
+                    placeholder="请选择产线"
+                  >
+                    <el-option
+                      v-for="item in options.lineCode"
+                      :key="item.code"
+                      :label="item.name"
+                      :value="item.code"
+                    >
+                    </el-option>
+                  </el-select>
+                  <el-input
+                    class="item item-input"
+                    size="small"
+                    placeholder="详细地址"
+                    v-model="zcInfo.detailLocation"
+                  ></el-input>
+                </div>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <div class="basic-details-title border-none">
+            <span class="border-span">文档信息</span>
+          </div>
+          <div class="upload-container">
+            <UploadImg @getImgs="cbUploadImg" ref="UploadImg" />
+            <div class="file-list">
+              <div>
+                <el-form-item prop="image" label="使用说明书">
+                  <selectUpload
+                    @getImgs="setImgs('operatingManual', 1, $event)"
+                    :ininObj="attUrl.operatingManual"
+                  />
+                </el-form-item>
+              </div>
+              <div>
+                <el-form-item prop="image" label="生产许可证书">
+                  <selectUpload
+                    @getImgs="setImgs('productionLicence', 2, $event)"
+                    :ininObj="attUrl.productionLicence"
+                  />
+                </el-form-item>
+              </div>
+              <div>
+                <el-form-item prop="image" label="防爆合格证书">
+                  <selectUpload
+                    @getImgs="setImgs('explosionProofCertificate', 3, $event)"
+                    :ininObj="attUrl.explosionProofCertificate"
+                  />
+                </el-form-item>
+              </div>
+              <div>
+                <el-form-item prop="image" label="检验报告">
+                  <selectUpload
+                    @getImgs="setImgs('surveyReport', 4, $event)"
+                    :ininObj="attUrl.surveyReport"
+                  />
+                </el-form-item>
+              </div>
+              <div>
+                <el-form-item prop="image" label="检验周期说明">
+                  <selectUpload
+                    @getImgs="setImgs('inspectionCycleManual', 5, $event)"
+                    :ininObj="attUrl.inspectionCycleManual"
+                  />
+                </el-form-item>
+              </div>
+              <div>
+                <el-form-item prop="image" label="图纸资料">
+                  <selectUpload
+                    @getImgs="setImgs('informationDrawing', 6, $event)"
+                    :ininObj="attUrl.informationDrawing"
+                  />
+                </el-form-item>
+              </div>
+              <div>
+                <el-form-item prop="image" label="产品合格证">
+                  <selectUpload
+                    @getImgs="setImgs('productCertificate', 7, $event)"
+                    :ininObj="attUrl.productCertificate"
+                  />
+                </el-form-item>
+              </div>
+            </div>
+          </div>
+          <div class="basic-details-title border-none">
+            <span class="border-span">物联参数</span>
+          </div>
+          <el-row>
+            <el-col>
+              <el-form-item label="是否启用物联">
+                <el-switch
+                  v-model="isIotEnable"
+                  active-text="开"
+                  inactive-text="关"
+                >
+                </el-switch>
+              </el-form-item>
+            </el-col>
+            <el-col>
+              <el-form-item label="物联ID">{{ iotId }}</el-form-item>
+            </el-col>
+          </el-row>
+          <div class="basic-details-title border-none">
+            <span class="border-span">扩展信息</span>
+          </div>
+          <div class="kzzd">
+            <el-row>
+              <el-col
+                :span="24"
+                v-for="(item, index) in form.addList"
+                :key="index"
+                style="margin-bottom: 20px"
+              >
+                <el-form-item
+                  label-width="0"
+                  :prop="'addList.' + index + '.key'"
+                  :rules="{
+                    required: true,
+                    message: '自定义参数名称不能为空',
+                    trigger: 'blur'
+                  }"
+                >
+                  <div class="add-col">
+                    <el-input
+                      class="col-input"
+                      v-model="item.key"
+                      placeholder="参数名称"
+                    ></el-input>
+                    <el-input
+                      class="col-input"
+                      v-model="item.value"
+                      placeholder="参数值"
+                    ></el-input>
+                    <el-button
+                      class="del"
+                      type="text"
+                      @click="delt(item, index)"
+                    >
+                      删除
+                    </el-button>
+                  </div>
+                </el-form-item>
+              </el-col>
+              <el-col :span="24" v-if="form.addList.length < 10">
+                <el-form-item label-width="0">
+                  <el-button
+                    class="primarybutton"
+                    type="primary"
+                    @click="addItem"
+                    >增加自定义参数</el-button
+                  >
+                </el-form-item>
+              </el-col>
+            </el-row>
+          </div>
+        </div>
+      </el-form>
+      <DialogGoods
+        ref="DialogGoods"
+        @succeed="cbDialogGoods"
+        width="1200px"
+      ></DialogGoods>
+    </el-card>
+  </div>
+</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';
+  export default {
+    components: {
+      //selectUpload,
+      //UploadImg,
+      DialogGoods,
+      DeptSelect
+    },
+    data () {
+      return {
+        title: '新建设备信息',
+        pageType: 'add',
+        btnLoading: false,
+        // 设备主键id
+        id: '',
+        form: {
+          addList: [],
+          // 基本信息
+          informationCode: '',
+          informationName: '',
+          productTime: ''
+        },
+        rules: {
+          informationName: [
+            { required: true, message: '请输入设备名称', trigger: 'blur' }
+          ],
+          informationCode: [
+            { required: true, message: '请输入设备编码', trigger: 'blur' }
+          ]
+        },
+        // 基本信息
+        basicInfo: '',
+        // 资产信息
+        zcInfo: {
+          // 	固定资产编码
+          fixAssetCode: '',
+          // 颜色
+          color: '',
+          // 重量
+          weight: '',
+          // 维护部门code
+          repairDeptCode: '',
+          repairDeptName: '',
+          repairUserId: '',
+          // 权属部门
+          ownershipDeptCode: '',
+          ownershipDeptName: '',
+          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();
+      },
+      'zcInfo.workshopCode': function (nVal) {
+        if (this.pageType == 'add') {
+          this.zcInfo.lineCode = '';
+          this.options.lineCode = [];
+        }
+        // 获取产线
+        this.getProductionLine();
+      }
+      // "zcInfo.repairDeptCode": 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.pageType == "add") {
+      //   this.pageType = "add";
+      //   this.title = "新建设备信息";
+      // } else if (this.$route.query.pageType == "edit") {
+      //   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;
+        }
+      },
+      handlwpbm () {
+        this.$refs.DialogGoods.open();
+      },
+      async cbDialogGoods (data) {
+        this.basicInfo = data;
+        this.form.informationName = this.basicInfo.informationName;
+        let res = await getAssetNum({
+          assetCode: this.basicInfo.informationCode,
+          num: 1
+        });
+        this.form.informationCode = 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);
+      },
+      // 维护部门点击回调
+      whDeptClick (info) {
+        this.zcInfo.repairDeptCode = info.code;
+        // 重置
+        this.zcInfo.repairUserId = '';
+        this.getwhbm();
+      },
+      async getwhbm () {
+        let res = await user.user({ deptCode: this.zcInfo.repairDeptCode });
+        this.options.repairUserId = res.data;
+      },
+      // 权属部门点击回调
+      qsDeptClick (info) {
+        this.zcInfo.ownershipDeptCode = info.code;
+        // 重置
+        this.zcInfo.ownershipUserId = '';
+        this.getqsbm();
+      },
+      async getqsbm () {
+        let res = await user.user({ deptCode: this.zcInfo.ownershipDeptCode });
+        this.options.ownershipUserId = res.data;
+      },
+      // 树形结构数据
+      getTreeList () {
+        org.tree().then((res) => {
+          this.options.deptList = res.data;
+        });
+      },
+      // 获取供应商、工序列表
+      async getgys () {
+        let muster = await getSupplier({
+          size: 999
+        });
+        console.log(muster);
+        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 getfactoryInfo({
+          size: 999
+        });
+        this.options.factoryCode = data.data.items;
+      },
+      // 获取车间列表
+      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.addList.length < 10) {
+          let item = { key: '', value: '' };
+          this.form.addList.push(item);
+        } else {
+          this.$message.warning('自定义参数最多添加10条');
+        }
+      },
+      // 删除自定义参数
+      delt (item, index) {
+        this.form.addList.splice(index, 1);
+      },
+      // 提交
+      submit () {
+        if (!this.basicInfo && this.pageType == 'add') {
+          return this.$message.error('请选择物品编码');
+        }
+        this.$refs.form.validate((valid) => {
+          if (valid) {
+            let par = {
+              //基本信息
+              assetCode: this.form.informationCode,
+              assetName: this.form.informationName,
+              assetType: 1,
+              informationId: this.basicInfo.id,
+              productTime: this.form.productTime,
+              expirationTime: this.expirationTime,
+              // 资产信息
+              ...this.zcInfo,
+              // 文档信息
+              attUrl: this.setWd(),
+              // 设备图片
+              imageUrl: this.imageUrl,
+              // 是否启用物联
+              isIotEnable: this.isIotEnable,
+              // 扩展字段
+              extendField: 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 JSON.stringify(this.form.addList);
+      },
+      // 处理文档信息
+      setWd () {
+        let attUrl = [];
+        Object.entries(this.attUrl).forEach(([key, value], index) => {
+          if (value) {
+            attUrl.push(value);
+          } else {
+            attUrl.push({ sort: index + 1 });
+          }
+        });
+        return attUrl;
+      },
+      // 获取设备详情
+      getInfo () {
+        getDetail({
+          id: this.id
+        }).then((res) => {
+          this.$nextTick(() => {
+            let data = res.data;
+            // 基本信息
+            this.form.informationCode = data.assetCode;
+            this.form.informationName = data.assetName;
+            this.form.productTime = data.productTime;
+            this.basicInfo = data.information;
+            this.cbexpirationTime = data.expirationTime;
+            this.sourceDICT = data.sourceDICT;
+            this.networkStatus = data.networkStatus;
+            // 资产信息
+            for (const key of Object.keys(this.zcInfo)) {
+              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;
+            // 扩展字段
+            if (data.extendField) {
+              this.form.addList = JSON.parse(data.extendField);
+            }
+          });
+        });
+      },
+      // 设置标准产能
+      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>
+  ::v-deep.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;
+      }
+    }
+  }
+  .sbwz {
+    .item {
+      width: 120px;
+    }
+    .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>