quwangxin 3 лет назад
Родитель
Сommit
0ca7e386ee

+ 73 - 0
src/components/CommomSelect/factory-area-select.vue

@@ -0,0 +1,73 @@
+<template>
+  <!-- 厂房 -->
+  <el-select
+    v-model="selectVal"
+    filterable
+    style="width: 100%"
+    v-bind="$attrs"
+    v-on="$listeners"
+    clearable
+  >
+    <el-option
+      v-for="item in dictList"
+      :key="item.id"
+      :label="item.name"
+      :value="item.id"
+    ></el-option>
+  </el-select>
+</template>
+
+<script>
+  import { getFactoryarea } from '@/api/factoryModel';
+  export default {
+    model: {
+      prop: 'value',
+      event: 'updateVal'
+    },
+    props: {
+      value: {
+        type: [String, Number, Array],
+        default: ''
+      },
+      init: {
+        type: Boolean,
+        default: true
+      }
+    },
+    data () {
+      return {
+        dictList: []
+      };
+    },
+    computed: {
+      selectVal: {
+        set (val) {
+          this.$emit('updateVal', val);
+          this.$emit(
+            'selfChange',
+            val,
+            this.dictList.find((i) => i.id === val)
+          );
+        },
+        get () {
+          return this.value;
+        }
+      }
+    },
+    created () {
+      if (this.init) {
+        this.getList();
+      }
+    },
+    methods: {
+      async getList () {
+        const res = await getFactoryarea({
+          pageNum: -1,
+          size: -1,
+          type: 2
+        });
+        this.dictList = res.list;
+      }
+    }
+  };
+</script>

+ 63 - 0
src/components/CommomSelect/factory-line-select.vue

@@ -0,0 +1,63 @@
+<template>
+  <el-select
+    v-model="selectVal"
+    filterable
+    style="width: 100%"
+    v-bind="$attrs"
+    v-on="$listeners"
+    clearable
+  >
+    <el-option
+      v-for="item in dictList"
+      :key="item.id"
+      :label="item.name"
+      :value="item.id"
+    ></el-option>
+  </el-select>
+</template>
+
+<script>
+  import { listFactoryLineByParentId } from '@/api/factoryModel';
+  export default {
+    model: {
+      prop: 'value',
+      event: 'updateVal'
+    },
+    props: {
+      value: {
+        type: [String, Number, Array],
+        default: ''
+      },
+      workshopId: {
+        type: [String, Number],
+        default: ''
+      }
+    },
+    data () {
+      return {
+        dictList: []
+      };
+    },
+    computed: {
+      selectVal: {
+        set (val) {
+          this.$emit('updateVal', val);
+          this.$emit(
+            'selfChange',
+            val,
+            this.dictList.find((i) => i.id === val)
+          );
+        },
+        get () {
+          return this.value;
+        }
+      }
+    },
+    methods: {
+      async getList () {
+        const res = await listFactoryLineByParentId(this.workshopId);
+        this.dictList = res;
+      }
+    }
+  };
+</script>

+ 1 - 0
src/components/CommomSelect/factory-select.vue

@@ -1,4 +1,5 @@
 <template>
+  <!-- 工厂 -->
   <el-select
     v-model="selectVal"
     filterable

+ 68 - 0
src/components/CommomSelect/workshop-select.vue

@@ -0,0 +1,68 @@
+<template>
+  <!-- 车间 -->
+  <el-select
+    v-model="selectVal"
+    filterable
+    style="width: 100%"
+    v-bind="$attrs"
+    v-on="$listeners"
+    clearable
+  >
+    <el-option
+      v-for="item in dictList"
+      :key="item.id"
+      :label="item.name"
+      :value="item.id"
+    ></el-option>
+  </el-select>
+</template>
+
+<script>
+  import { listWorkshopByParentId } from '@/api/factoryModel';
+  export default {
+    model: {
+      prop: 'value',
+      event: 'updateVal'
+    },
+    props: {
+      value: {
+        type: [String, Number, Array],
+        default: ''
+      },
+      init: {
+        type: Boolean,
+        default: true
+      },
+      factoryId: {
+        type: [String, Number],
+        default: ''
+      }
+    },
+    data () {
+      return {
+        dictList: []
+      };
+    },
+    computed: {
+      selectVal: {
+        set (val) {
+          this.$emit('updateVal', val);
+          this.$emit(
+            'selfChange',
+            val,
+            this.dictList.find((i) => i.id === val)
+          );
+        },
+        get () {
+          return this.value;
+        }
+      }
+    },
+    methods: {
+      async getList () {
+        const res = await listWorkshopByParentId(this.factoryId);
+        this.dictList = res;
+      }
+    }
+  };
+</script>

+ 180 - 19
src/components/upload/fileUpload.vue

@@ -1,22 +1,78 @@
 <template>
-  <el-upload
-    class="upload-demo"
-    action="#"
-    :http-request="handlRequest"
-    :before-remove="beforeRemove"
-    :on-remove="handleRemove"
-    multiple
-    :before-upload="beforeUpload"
-    :file-list="fileList"
-  >
-    <slot>
-      <el-button size="small" type="primary">点击上传</el-button>
-    </slot>
-  </el-upload>
+  <div class="upload-file">
+    <el-upload
+      class="upload-demo"
+      action="#"
+      :http-request="handlRequest"
+      :before-remove="beforeRemove"
+      :on-remove="handleRemove"
+      multiple
+      :before-upload="beforeUpload"
+      :file-list="fileList"
+      :show-file-list="!showLib"
+    >
+      <slot>
+        <el-button type="primary" icon="el-icon-plus">点击上传</el-button>
+      </slot>
+    </el-upload>
+    <el-button type="primary" class="lib" @click="handleOpenLib" v-if="showLib"
+      >文档库</el-button
+    >
+    <div class="imgs-box" v-if="fileList.length && showLib">
+      <p class="imgs-p">
+        <span> {{ fileList[0].name }}</span>
+        <el-link @click="delFileList" type="primary" class="link">删除</el-link>
+      </p>
+    </div>
+    <!--图文档弹窗 -->
+    <el-dialog
+      title="图文档"
+      append-to-body
+      :visible.sync="documentVisible"
+      width="72%"
+    >
+      <el-form label-width="100px">
+        <el-row :gutter="12">
+          <el-col :span="8">
+            <el-form-item label-width="70px" label="文档名称">
+              <el-input v-model="documentForm.name"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-button type="primary" @click="reload">搜索</el-button>
+          </el-col>
+        </el-row>
+      </el-form>
+      <ele-pro-table
+        ref="table"
+        :current.sync="selectItem"
+        :columns="columns"
+        highlight-current-row
+        :datasource="datasource"
+        :initLoad="false"
+        height="500px"
+        class="dict-table"
+        tool-class="ele-toolbar-actions"
+      >
+      </ele-pro-table>
+      <div slot="footer" class="dialog-footer">
+        <el-button size="small" @click="documentVisible = false"
+          >关 闭</el-button
+        >
+        <el-button size="small" @click="submitDocument" type="primary"
+          >确 认</el-button
+        >
+      </div>
+    </el-dialog>
+  </div>
 </template>
 
 <script>
-  import { uploadFile, removeFile } from '@/api/system/file/index.js';
+  import {
+    uploadFile,
+    removeFile,
+    getFileList
+  } from '@/api/system/file/index.js';
   import { getImageUrl, getImagePath } from '@/utils/file';
   export default {
     props: {
@@ -29,6 +85,11 @@
         type: String,
         required: true
       },
+      // 文档库
+      showLib: {
+        type: Boolean,
+        default: false
+      },
       // 限制数量
       limit: {
         type: Number,
@@ -40,6 +101,50 @@
         default: 10
       }
     },
+    data () {
+      return {
+        documentVisible: false,
+        selectItem: null,
+        documentForm: {
+          name: ''
+        },
+        columns: [
+          {
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center'
+          },
+          {
+            label: '文档名称',
+            prop: 'name',
+            minWidth: '180',
+            showOverflowTooltip: true
+          },
+          {
+            label: '文档类型',
+            prop: 'type'
+          },
+          {
+            label: '系统'
+          },
+          {
+            label: '储存路径',
+            prop: 'storePath',
+            minWidth: '180',
+            showOverflowTooltip: true
+          },
+          {
+            label: '模块名',
+            prop: 'module'
+          },
+          {
+            label: '上传时间',
+            prop: 'createTime'
+          }
+        ]
+      };
+    },
     computed: {
       fileList: {
         set (val) {
@@ -53,16 +158,45 @@
           );
         },
         get () {
-          const arr = this.value.map((item) => ({
-            ...item,
-            url: getImageUrl(item.url)
-          }));
+          const arr =
+            (this.value &&
+              this.value.map((item) => ({
+                ...item,
+                url: getImageUrl(item.url)
+              }))) ||
+            [];
           return arr;
         }
       }
     },
 
     methods: {
+      delFileList () {
+        this.$emit('input', []);
+      },
+      handleOpenLib () {
+        this.documentVisible = true;
+        this.$nextTick(() => {
+          this.reload();
+        });
+      },
+      //图文档勾选
+      submitDocument () {
+        this.$emit('input', [
+          { url: this.selectItem.storePath, ...this.selectItem }
+        ]);
+        this.documentVisible = false;
+      },
+      datasource ({ page, limit }) {
+        return getFileList({
+          ...this.documentForm,
+          pageNum: page,
+          size: limit
+        });
+      },
+      reload () {
+        this.$refs.table.reload();
+      },
       beforeRemove (file) {
         if (file.id) {
           return removeFile({
@@ -106,3 +240,30 @@
     }
   };
 </script>
+
+<style lang="scss" scoped>
+  .upload-file {
+    display: flex;
+    justify-content: flex-start;
+    align-items: center;
+
+    .lib {
+      margin-left: 12px;
+    }
+
+    .imgs-box {
+      margin-left: 10px;
+      flex: 1;
+    }
+    .imgs-box .imgs-p {
+      height: 30px;
+      background: #f0f3f3;
+      line-height: 30px;
+      min-width: 480px;
+      margin-bottom: 5px;
+      padding: 0 10px;
+      display: flex;
+      justify-content: space-between;
+    }
+  }
+</style>

+ 13 - 5
src/components/upload/imgUpload.vue

@@ -6,6 +6,7 @@
     :multiple="true"
     :upload-handler="uploadHandler"
     @upload="onUpload"
+    :list-type="pictureStyle"
   >
   </ele-image-upload>
 </template>
@@ -21,7 +22,7 @@
       // 所属模块
       module: {
         type: String,
-        required: true
+        default: 'main'
       },
       // 限制数量
       limit: {
@@ -31,6 +32,10 @@
       value: {
         type: Array,
         default: () => []
+      },
+      pictureStyle: {
+        type: Object,
+        default: () => ({})
       }
     },
     data () {
@@ -48,10 +53,13 @@
           );
         },
         get () {
-          const arr = this.value.map((item) => ({
-            ...item,
-            url: getImageUrl(item.url)
-          }));
+          const arr =
+            (this.value &&
+              this.value.map((item) => ({
+                ...item,
+                url: getImageUrl(item.url)
+              }))) ||
+            [];
 
           return arr;
         }

+ 103 - 0
src/views/documentManagement/certificateManagement/components/certificate-search.vue

@@ -0,0 +1,103 @@
+<!-- 搜索表单 -->
+<template>
+  <el-form
+    label-width="77px"
+    class="ele-form-search"
+    @keyup.enter.native="search"
+    @submit.native.prevent
+  >
+    <el-row :gutter="10">
+      <el-col v-bind="styleResponsive ? { md: 5 } : { span: 5 }">
+        <el-form-item label="有效期至">
+          <el-input clearable v-model="where.name" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { md: 5 } : { span: 5 }">
+        <el-form-item label="证件编号">
+          <el-input clearable v-model="where.module" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { md: 5 } : { span: 5 }">
+        <el-form-item label="持证人">
+          <el-date-picker
+            type="daterange"
+            class="ele-fluid"
+            end-placeholder="结束日期"
+            start-placeholder="开始日期"
+            v-model="where.time"
+            range-separator="至"
+            value-format="yyyy-MM-dd HH:mm:ss"
+          >
+          </el-date-picker>
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { md: 5 } : { span: 5 }">
+        <el-form-item label="证件类型">
+          <el-input clearable v-model="where.module" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { md: 4 } : { span: 4 }">
+        <el-form-item>
+          <el-button
+            type="primary"
+            icon="el-icon-search"
+            class="ele-btn-icon"
+            @click="search"
+          >
+            查询
+          </el-button>
+
+          <el-button
+            @click="reset"
+            icon="el-icon-refresh"
+            class="ele-btn-icon"
+            size="medium"
+            >重置</el-button
+          >
+        </el-form-item>
+      </el-col>
+    </el-row>
+  </el-form>
+</template>
+
+<script>
+  export default {
+    data () {
+      // 默认表单数据
+      const defaultWhere = {
+        module: '',
+        name: '',
+        time: []
+      };
+      return {
+        defaultWhere,
+        // 表单数据
+        where: { ...defaultWhere }
+      };
+    },
+    computed: {
+      // 是否开启响应式布局
+      styleResponsive () {
+        return this.$store.state.theme.styleResponsive;
+      }
+    },
+    methods: {
+      /* 搜索 */
+      search () {
+        const where = { ...this.where };
+        if (where.time?.length) {
+          where.startTime = where.time[0];
+          where.endTime = where.time[1];
+        }
+
+        delete where.time;
+        this.$emit('search', where);
+      },
+      /*  重置 */
+      reset () {
+        this.where = { ...this.defaultWhere };
+        this.search();
+      }
+    }
+  };
+</script>

+ 117 - 0
src/views/documentManagement/certificateManagement/components/upload-dialog.vue

@@ -0,0 +1,117 @@
+<template>
+  <!-- 上传 -->
+  <el-dialog title="文件上传" :visible.sync="dialogVisible" width="40%">
+    <el-form label-width="110px" class="zw-criterion">
+      <el-form-item label="选择文件">
+        <el-upload
+          class="avatar-uploader"
+          action="#"
+          :show-file-list="false"
+          :http-request="handlSuccess"
+          :before-upload="beforeUpload"
+        >
+          <el-button icon="el-icon-plus" size="small" type="primary"
+            >文件上传</el-button
+          >
+        </el-upload>
+      </el-form-item>
+      <el-form-item label="模块名">
+        <DictSelection v-model="module" dictName="文件模块"></DictSelection>
+      </el-form-item>
+      <el-form-item label="">
+        <div class="imgs-box">
+          <p v-for="(item, index) in attaments" :key="index" class="imgs-p">
+            <span> {{ item.name }}</span>
+            <el-link @click="delFileList(index)" type="primary">删除</el-link>
+          </p>
+        </div>
+      </el-form-item>
+    </el-form>
+    <div slot="footer" class="dialog-footer">
+      <el-button size="small" @click="dialogVisible = false">关 闭</el-button>
+      <el-button size="small" @click="upload" type="primary">上 传</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+  import { uploadBatch } from '@/api/system/file/index.js';
+
+  export default {
+    //注册组件
+    data () {
+      return {
+        showViewer: false, // 显示查看器
+        dialogVisible: false,
+        uploadShow: false,
+        attaments: [], //上传文件
+        module: '',
+        file: ''
+      };
+    },
+    created () {},
+    methods: {
+      open () {
+        this.attaments = [];
+        this.module = '';
+        this.dialogVisible = true;
+      },
+      //删除附件
+      delFileList (index) {
+        this.attaments.splice(index, 1);
+      },
+      //上传限制
+      beforeUpload (file) {
+        const isLt10M = file.size / 1024 / 1024 < 10;
+        if (!isLt10M) {
+          this.$message.error('上传文件大小不能超过 10MB!');
+        }
+        return isLt10M;
+      },
+      //图片上传
+      handlSuccess (param) {
+        this.file = param.file;
+        this.attaments.push(param.file);
+      },
+      // 文件上传
+      async upload () {
+        if (this.attaments.length == 0) {
+          return this.$message.warning('文件不能为空!');
+        }
+        if (!this.module) {
+          return this.$message.warning('模块名不能为空!');
+        }
+        await uploadBatch({
+          module: this.module,
+          multiPartFiles: this.attaments
+        });
+        this.$message.success('操作成功!');
+        this.dialogVisible = false;
+        this.$emit('success');
+      }
+    }
+  };
+</script>
+
+<style lang="scss">
+  .zw-table-header {
+    float: right;
+  }
+
+  .imgs-box .imgs-p {
+    height: 30px;
+    background: #f0f3f3;
+    line-height: 30px;
+    width: 372px;
+    margin-bottom: 5px;
+    padding: 0 10px;
+    display: flex;
+    justify-content: space-between;
+  }
+  .zw-criterion-normal {
+    padding: 20px 0 0 0;
+  }
+  .el-main {
+    overflow: hidden;
+  }
+</style>

+ 119 - 0
src/views/documentManagement/certificateManagement/index.vue

@@ -0,0 +1,119 @@
+<template>
+  <div class="ele-body">
+    <el-card shadow="never">
+      <certificate-search @search="reload" />
+      <ele-pro-table
+        ref="table"
+        :columns="columns"
+        :datasource="datasource"
+        height="calc(100vh - 350px)"
+        class="dict-table"
+        tool-class="ele-toolbar-actions"
+      >
+        <!-- 工具栏 -->
+        <template v-slot:toolbar>
+          <el-button type="primary" @click="handleUpload">新建</el-button>
+          <el-button type="primary" @click="handleUpload">导入</el-button>
+        </template>
+
+        <template v-slot:code="{ row }">
+          <el-link>2222</el-link>
+          <p class="ele-text-info">身份证</p>
+        </template>
+        <template v-slot:time="{ row }">
+          <p>起:2023-02-15 00:00</p>
+          <p class="ele-text-info">止:2023-02-15 00:00</p>
+        </template>
+        <template v-slot:createUser="{ row }">
+          <p>黄凯</p>
+          <p>株洲硬质合金集团型材分公司</p>
+          <p class="ele-text-info">2023-02-15 00:00</p>
+        </template>
+        <template v-slot:picture="{ row }">
+          <el-image
+            style="width: 100px; height: 100px"
+            :src="row.url"
+            :preview-src-list="[row.url]"
+          />
+        </template>
+      </ele-pro-table>
+    </el-card>
+    <uploadDialog ref="uploadDialogRef" @success="reload" />
+  </div>
+</template>
+
+<script>
+  import { getFile, getFileList } from '@/api/system/file/index.js';
+
+  import certificateSearch from './components/certificate-search';
+  import uploadDialog from './components/upload-dialog.vue';
+  export default {
+    components: { certificateSearch, uploadDialog },
+    data () {
+      return {
+        columns: [
+          {
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center'
+          },
+          {
+            label: '证照编号',
+            slot: 'code'
+          },
+          {
+            label: '状态',
+            prop: 'type'
+          },
+          {
+            label: '执证人'
+          },
+          {
+            label: '颁发机构',
+            prop: 'storePath',
+            showOverflowTooltip: true
+          },
+          {
+            label: '有效期限',
+            slot: 'time'
+          },
+          {
+            label: '创建人信息',
+            slot: 'createUser'
+          },
+          {
+            label: '证照',
+            slot: 'picture'
+          },
+          {
+            label: '备注',
+            prop: 'remark',
+            minWidth: '200',
+            showOverflowTooltip: true
+          }
+        ]
+      };
+    },
+    methods: {
+      datasource ({ page, where, limit }) {
+        return getFileList({
+          ...where,
+          pageNum: page,
+          size: limit
+        });
+      },
+      reload (where = {}) {
+        this.$refs.table.reload({ where });
+      },
+      handleUpload () {
+        this.$refs.uploadDialogRef.open();
+      },
+      handleDownload (row) {
+        getFile({ objectName: row.storePath }, row.name);
+      }
+    }
+  };
+</script>
+
+<style class=""></style>

+ 554 - 561
src/views/ledgerAssets/equipment/edit.vue

@@ -8,16 +8,17 @@
           </div>
         </el-page-header>
         <div>
-          <el-button
-            size="small"
-            type="primary"
-            @click="submit"
-            :loading="btnLoading"
+          <el-button type="primary" @click="submit" :loading="btnLoading"
             >确定</el-button
           >
         </div>
       </div>
-      <el-form label-width="120px" :model="form" ref="form" :rules="rules">
+      <el-form
+        label-width="120px"
+        :model="{ ...form, ...positionInfo }"
+        ref="form"
+        :rules="rules"
+      >
         <div class="content">
           <div class="basic-details-title border-none">
             <span class="border-span">基本信息</span>
@@ -41,7 +42,6 @@
                 <el-input
                   v-if="basicInfo"
                   class="input"
-                  size="small"
                   v-model="form.code"
                 ></el-input>
               </el-form-item>
@@ -57,7 +57,6 @@
                 <el-input
                   v-if="basicInfo"
                   class="input"
-                  size="small"
                   v-model="form.name"
                 ></el-input>
               </el-form-item>
@@ -126,29 +125,17 @@
           <el-row>
             <el-col :span="8">
               <el-form-item label="固资编码">
-                <el-input
-                  class="input"
-                  size="small"
-                  v-model="zcInfo.fixCode"
-                ></el-input>
+                <el-input class="input" v-model="zcInfo.fixCode"></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-input class="input" 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-input class="input" v-model="zcInfo.weight"></el-input>
               </el-form-item>
             </el-col>
             <el-col :span="8">
@@ -199,11 +186,7 @@
             </el-col>
             <el-col :span="8">
               <el-form-item label="设备用途">
-                <el-input
-                  v-model="zcInfo.purpose"
-                  size="small"
-                  class="input"
-                ></el-input>
+                <el-input v-model="zcInfo.purpose" class="input"></el-input>
               </el-form-item>
             </el-col>
             <el-col :span="8">
@@ -239,7 +222,8 @@
             </el-col>
             <el-col :span="8">
               <el-form-item label="所属厂房">
-                <el-select
+                <FactoryAreaSelect v-model="zcInfo.factoryPlantCode" />
+                <!-- <el-select
                   v-model="zcInfo.factoryPlantCode"
                   placeholder="请选择"
                 >
@@ -250,59 +234,80 @@
                     :value="item.code"
                   >
                   </el-option>
-                </el-select>
+                </el-select> -->
               </el-form-item>
             </el-col>
             <el-col :span="24">
-              <el-form-item label="设备位置">
+              <el-form-item label="设备位置" required>
                 <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>
+                  <el-row :gutter="12">
+                    <el-col :span="3">
+                      <el-form-item
+                        label=""
+                        label-width="0"
+                        prop="factoryCode"
+                        :rules="[
+                          {
+                            required: true,
+                            message: '请选择工厂',
+                            trigger: 'change'
+                          }
+                        ]"
+                        ><factorySelect
+                          v-model="positionInfo.factoryCode"
+                          placeholder="请选择工厂"
+                          @selfChange="hanldFactoryCode"
+                        /> </el-form-item
+                    ></el-col>
+                    <el-col :span="3">
+                      <el-form-item
+                        label=""
+                        label-width="0"
+                        prop="workshopCode"
+                        :rules="[
+                          {
+                            required: true,
+                            message: '请选择车间',
+                            trigger: 'change'
+                          }
+                        ]"
+                      >
+                        <WorkshopSelect
+                          ref="WorkshopSelectRef"
+                          :factoryId="positionInfo.factoryCode"
+                          v-model="positionInfo.workshopCode"
+                          @selfChange="hanldWorkshopCode"
+                          placeholder="请选择车间" /></el-form-item
+                    ></el-col>
+                    <el-col :span="3">
+                      <el-form-item
+                        label=""
+                        label-width="0"
+                        prop="lineCode"
+                        :rules="[
+                          {
+                            required: true,
+                            message: '请选择产线',
+                            trigger: 'change'
+                          }
+                        ]"
+                      >
+                        <FactoryLineSelect
+                          ref="FactoryLineSelectRef"
+                          :workshopId="positionInfo.workshopCode"
+                          v-model="positionInfo.lineCode"
+                          @selfChange="hanldlineCodeCode"
+                          placeholder="请选择产线"
+                        /> </el-form-item
+                    ></el-col>
+                    <el-col :span="4">
+                      <el-input
+                        class="item item-input"
+                        placeholder="详细地址"
+                        v-model="positionInfo.detailPosition"
+                      ></el-input
+                    ></el-col>
+                  </el-row>
                 </div>
               </el-form-item>
             </el-col>
@@ -310,67 +315,78 @@
           <div class="basic-details-title border-none">
             <span class="border-span">文档信息</span>
           </div>
-          <!-- <div class="upload-container">
-            <UploadImg @getImgs="cbUploadImg" ref="UploadImg" />
+          <div class="upload-container">
+            <imgUpload
+              v-model="imageUrl"
+              :limit="1"
+              :pictureStyle="{ width: '300px', height: '300px' }"
+            />
             <div class="file-list">
               <div>
                 <el-form-item prop="image" label="使用说明书">
-                  <selectUpload
-                    @getImgs="setImgs('operatingManual', 1, $event)"
-                    :ininObj="attUrl.operatingManual"
+                  <fileUpload
+                    v-model="attUrl.operatingManual"
+                    module="main"
+                    :showLib="true"
                   />
                 </el-form-item>
               </div>
               <div>
                 <el-form-item prop="image" label="生产许可证书">
-                  <selectUpload
-                    @getImgs="setImgs('productionLicence', 2, $event)"
-                    :ininObj="attUrl.productionLicence"
+                  <fileUpload
+                    v-model="attUrl.productionLicence"
+                    module="main"
+                    :showLib="true"
                   />
                 </el-form-item>
               </div>
               <div>
                 <el-form-item prop="image" label="防爆合格证书">
-                  <selectUpload
-                    @getImgs="setImgs('explosionProofCertificate', 3, $event)"
-                    :ininObj="attUrl.explosionProofCertificate"
+                  <fileUpload
+                    v-model="attUrl.explosionProofCertificate"
+                    module="main"
+                    :showLib="true"
                   />
                 </el-form-item>
               </div>
               <div>
                 <el-form-item prop="image" label="检验报告">
-                  <selectUpload
-                    @getImgs="setImgs('surveyReport', 4, $event)"
-                    :ininObj="attUrl.surveyReport"
+                  <fileUpload
+                    v-model="attUrl.surveyReport"
+                    module="main"
+                    :showLib="true"
                   />
                 </el-form-item>
               </div>
               <div>
                 <el-form-item prop="image" label="检验周期说明">
-                  <selectUpload
-                    @getImgs="setImgs('inspectionCycleManual', 5, $event)"
-                    :ininObj="attUrl.inspectionCycleManual"
+                  <fileUpload
+                    v-model="attUrl.inspectionCycleManual"
+                    module="main"
+                    :showLib="true"
                   />
                 </el-form-item>
               </div>
               <div>
                 <el-form-item prop="image" label="图纸资料">
-                  <selectUpload
-                    @getImgs="setImgs('informationDrawing', 6, $event)"
-                    :ininObj="attUrl.informationDrawing"
+                  <fileUpload
+                    v-model="attUrl.informationDrawing"
+                    module="main"
+                    :showLib="true"
                   />
                 </el-form-item>
               </div>
               <div>
                 <el-form-item prop="image" label="产品合格证">
-                  <selectUpload
-                    @getImgs="setImgs('productCertificate', 7, $event)"
-                    :ininObj="attUrl.productCertificate"
+                  <fileUpload
+                    v-model="attUrl.productCertificate"
+                    module="main"
+                    :showLib="true"
                   />
                 </el-form-item>
               </div>
             </div>
-          </div> -->
+          </div>
           <div class="basic-details-title border-none">
             <span class="border-span">物联参数</span>
           </div>
@@ -456,496 +472,473 @@
 </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';
-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' }]
-      },
-      // 基本信息
-      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();
-    },
-    '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;
-      }
-    },
-    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;
+  import DeptSelect from '@/components/CommomSelect/dept-select.vue';
+  import FactoryLineSelect from '@/components/CommomSelect/factory-line-select.vue';
+  import WorkshopSelect from '@/components/CommomSelect/workshop-select.vue';
+  import FactoryAreaSelect from '@/components/CommomSelect/factory-area-select.vue';
+  import factorySelect from '@/components/CommomSelect/factory-select.vue';
+  import fileUpload from '@/components/upload/fileUpload';
+  import imgUpload from '@/components/upload/imgUpload';
+  // 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,
+      FactoryLineSelect,
+      WorkshopSelect,
+      FactoryAreaSelect,
+      fileUpload,
+      imgUpload,
+      factorySelect,
+      DialogGoods,
+      DeptSelect
     },
-    // 获取厂房列表
-    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;
+    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' }]
+        },
+        // 基本信息
+        basicInfo: {},
+        // 资产信息
+        zcInfo: {
+          // 	固定资产编码
+          fixCode: '',
+          // 颜色
+          color: '',
+          // 重量
+          weight: '',
+          // 维护部门code
+          repairGroupId: '',
+          repairDeptName: '',
+          repairUserId: '',
+          // 权属部门
+          ownershipGroupId: '',
+          ownershipUserId: '',
+          // 设备用途
+          purpose: '',
+          //品牌
+          brand: '',
+          // 	供应商code
+          supplierId: '',
+          // 厂房
+          factoryPlantCode: '',
+          roteCode: ''
+        },
+        positionInfo: {
+          // 详细地址
+          detailPosition: '',
+          // 请选择产线
+          lineCode: '',
+          lineName: '',
+          // 请选择车间
+          workshopCode: '',
+          workshopName: '',
+          // 请选择工厂
+          factoryCode: '',
+          factoryName: ''
+        },
+        // 图片
+        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: [],
+          brand: []
+        }
+      };
     },
-    // 选择图片回调
-    cbUploadImg(data) {
-      if (data.length > 0) {
-        this.imageUrl = data[0];
-      } else {
-        this.imageUrl = '';
+    watch: {},
+    computed: {
+      // 过保时间
+      expirationTime () {
+        if (this.form.productTime && this.basicInfo.expirationDate) {
+          return this.setGbTime(
+            this.form.productTime,
+            this.basicInfo.expirationDate,
+            this.basicInfo.expirationDateUnit
+          );
+        } else {
+          return '';
+        }
       }
     },
-    // 添加自定义参数
-    addItem() {
-      if (this.form.extInfoSelf.length < 10) {
-        let item = { key: '', value: '' };
-        this.form.extInfoSelf.push(item);
-      } else {
-        this.$message.warning('自定义参数最多添加10条');
+    created () {
+      if (this.$route.query.id) {
+        this.pageType = 'edit';
+        this.id = this.$route.query.id;
+        this.getInfo();
+        this.title = '编辑设备信息';
       }
     },
-    // 删除自定义参数
-    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;
-            });
+    methods: {
+      setImgs (type, sort, info) {
+        if (info[0]) {
+          this.attUrl[type] = info[0];
+          this.attUrl[type].sort = sort;
         } else {
-          console.log('error submit!!');
-          return false;
+          this.attUrl[type] = null;
         }
-      });
-    },
-    // 处理扩展字段
-    setKz() {
-      return this.form.extInfoSelf || [];
-    },
-    // 处理文档信息
-    setWd() {
-      let attUrl = [];
-      Object.entries(this.attUrl).forEach(([key, value], index) => {
-        if (value) {
-          attUrl.push(value);
+      },
+      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; //供应商
+      },
+
+      // 添加自定义参数
+      addItem () {
+        if (this.form.extInfoSelf.length < 10) {
+          let item = { key: '', value: '' };
+          this.form.extInfoSelf.push(item);
         } else {
-          attUrl.push({ sort: index + 1 });
+          this.$message.warning('自定义参数最多添加10条');
         }
-      });
-      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];
+      },
+      // 删除自定义参数
+      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,
+              position: {
+                detailPosition: this.positionInfo.detailPosition,
+                pathIds: `${this.positionInfo.factoryCode},${this.positionInfo.workshopCode},${this.positionInfo.lineCode}`,
+                pathName: `${this.positionInfo.factoryName},${this.positionInfo.workshopName},${this.positionInfo.lineName}`,
+                type: 'PRODUCTION_LINE'
+              },
+              // 文档信息
+              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);
+        data.extInfoSelf = data.extInfoSelf || [];
 
-      // 设备图片
-      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 '';
+        this.form = data;
+        this.basicInfo = data.category;
+        this.cbexpirationTime = data.expirationTime;
+        this.sourceDICT = data.sourceDICT;
+        this.networkStatus = data.networkStatus;
+        if (data.positionList?.length) {
+          this.positionInfo.detailPosition =
+            data.positionList[0].detailPosition;
+
+          const pathIds = data.positionList[0].pathIds.split(',');
+          const pathName = data.positionList[0].pathName.split(',');
+
+          this.positionInfo.factoryCode = pathIds[0];
+          this.positionInfo.factoryName = pathName[0];
+
+          this.positionInfo.workshopCode = pathIds[1];
+          this.positionInfo.workshopName = pathName[1];
+
+          this.positionInfo.lineCode = pathIds[2];
+          this.positionInfo.lineName = pathName[2];
+
+          console.log(this.positionInfo, 'this.positionInfo');
+          this.$nextTick(() => {
+            this.$refs.WorkshopSelectRef.getList();
+            this.$refs.FactoryLineSelectRef.getList();
+          });
+        }
+        // 资产信息
+        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 = [];
+        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 (val, item) {
+        this.positionInfo.factoryName = item?.name;
+        // 重置
+        this.zcInfo.workshopCode = '';
+        this.zcInfo.lineCode = '';
+        this.options.workshopCode = [];
+        this.options.lineCode = [];
+        // 获取车间
+        this.$nextTick(() => {
+          this.$refs.WorkshopSelectRef.getList();
+        });
+      },
+      hanldWorkshopCode (val, item) {
+        this.positionInfo.workshopName = item?.name;
+        // 重置
+        this.options.workshopCode = [];
+        this.options.lineCode = [];
+        // 获取产线
+        this.$nextTick(() => {
+          this.$refs.FactoryLineSelectRef.getList();
+        });
+      },
+      hanldlineCodeCode (val, item) {
+        this.positionInfo.lineName = item?.name;
       }
-      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;
-    }
+  .baseinfo-container .basic-details-title {
+    font-size: 16px;
+    margin: 15px 0;
   }
   .upload-container {
     display: flex;
+    justify-content: flex-start;
     .file-list {
       margin-left: 50px;
       flex: 1;
     }
   }
-}
-.sbwz {
-  .item {
-    width: 120px;
+  .equipment-container {
+    // .content {
+    //   padding: 0 20px;
+    // }
+    .label-none {
+      .el-form-item__content {
+        margin-left: 0 !important;
+      }
+    }
   }
-  .item + .item {
-    margin-left: 10px;
+  .sbwz {
+    .item {
+      width: 120px !important;
+    }
+    .item + .item {
+      margin-left: 10px;
+    }
+    .item-input {
+      width: 350px !important;
+    }
   }
-  .item-input {
-    width: 350px;
+  .input {
+    width: 202px;
   }
-}
-.input {
-  width: 202px;
-}
-.kzzd {
-  width: 500px;
-  .add-col {
-    display: flex;
-    .col-input {
-      & + .col-input {
+  .kzzd {
+    width: 500px;
+    .add-col {
+      display: flex;
+      .col-input {
+        & + .col-input {
+          margin-left: 10px;
+        }
+      }
+      .del {
         margin-left: 10px;
       }
     }
-    .del {
-      margin-left: 10px;
-    }
   }
-}
 </style>