Ver Fonte

设备台账

quwangxin há 3 anos atrás
pai
commit
f407b81501

+ 8 - 13
src/api/ledgerAssets/index.js

@@ -1,6 +1,5 @@
 import request from '@/utils/request';
 
-
 // 获取类别实体分页
 export async function getBoatList (data) {
   let par = new URLSearchParams(data);
@@ -20,7 +19,6 @@ export async function getBoatList (data) {
 //   return Promise.reject(new Error(res.data.message));
 // }
 
-
 // 获取单个类别实体明细分页
 export async function getPageSingle (data) {
   let par = new URLSearchParams(data);
@@ -31,7 +29,6 @@ export async function getPageSingle (data) {
   return Promise.reject(new Error(res.data.message));
 }
 
-
 // 获取实体列表分页
 export async function getAssetList (data) {
   let par = new URLSearchParams(data);
@@ -42,21 +39,19 @@ export async function getAssetList (data) {
   return Promise.reject(new Error(res.data.message));
 }
 
-
-
 // 查询实例详情
 export async function getAssetInfo (id) {
   const res = await request.get(`/main/asset/login/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+// 保存or更新
+export async function saveOrEdit (data) {
+  const res = await request.post(`/main/asset/saveOrEdit`, data);
   if (res.data.code == 0) {
     return res.data;
   }
   return Promise.reject(new Error(res.data.message));
 }
-
-
-
-
-
-
-
-

+ 8 - 6
src/components/CommomSelect/dept-select.vue

@@ -9,7 +9,6 @@
     default-expand-all
     :placeholder="placeholder"
     @input="updateValue"
-    @change="handleChange"
   />
 </template>
 
@@ -30,18 +29,21 @@
         treeData: []
       };
     },
-    created () {},
+    created () {
+      this.getData();
+    },
     methods: {
       async getData (parmas = {}) {
         const data = await listOrganizations(parmas);
-        this.treeData = data || [];
+        this.treeData = this.$util.toTreeData({
+          data: data || [],
+          idField: 'id',
+          parentIdField: 'parentId'
+        });
       },
       /* 更新选中数据 */
       updateValue (value) {
         this.$emit('input', value);
-      },
-      handleChange (item) {
-        console.log(item);
       }
     }
   };

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

@@ -24,3 +24,36 @@
   border-style: solid;
   overflow: auto;
 }
+
+// tab切换框
+.switch {
+  display: flex;
+  justify-content: space-between;
+}
+
+.switch_left ul {
+  list-style-type: none;
+  display: flex;
+  padding: 0;
+  margin: 0;
+}
+
+.switch_left ul li {
+  min-width: 80px;
+  padding: 0 10px;
+  text-align: center;
+  background: #dfdfdf;
+  color: #333;
+  font-size: 14px;
+  height: 36px;
+  line-height: 32px;
+  margin-right: 5px;
+  border-top: 4px solid #dfdfdf;
+  cursor: pointer;
+}
+
+.switch_left ul .active {
+  background: #fff;
+  border-top: 4px solid #157a2c;
+  color: #157a2c;
+}

+ 186 - 149
src/views/ledgerAssets/boat/components/baseInfo.vue

@@ -22,39 +22,80 @@
       </el-descriptions-item>
       <el-descriptions-item :span="2">
         <template slot="label"> 分类 </template>
-        {{information.categoryLevelPath}}
+        {{ information.categoryLevelPath }}
       </el-descriptions-item>
       <el-descriptions-item>
         <template slot="label"> 长/宽/高(mm) </template>
-        {{information.extendField.length}}/{{information.extendField.width}}/{{information.extendField.high}}
+        {{ information.extendField.length }}/{{
+          information.extendField.width
+        }}/{{ information.extendField.high }}
       </el-descriptions-item>
       <el-descriptions-item>
         <template slot="label"> 计量单位</template>
-        {{information.measuringUnit}}
+        {{ information.measuringUnit }}
       </el-descriptions-item>
     </el-descriptions>
     <div class="basic-details-title border-none">
       <span class="border-span">舟皿明细</span>
     </div>
     <div>
-      <el-tabs v-model="activeName" type="card" @tab-click="tabClick" class="basic-tab">
-          <el-tab-pane :label="`在用(${countInfo.inUseSum?countInfo.inUseSum:'0'})`" name="inUse" >
-          </el-tab-pane>
-          <el-tab-pane :label="`在库(${countInfo.inLibrarySum?countInfo.inLibrarySum:'0'})`" name="inLibrary">
-          </el-tab-pane>
-          <el-tab-pane :label="`消耗(${countInfo.consumeSum?countInfo.consumeSum:'0'})`" name="hasConsume">
-          </el-tab-pane>
+      <el-tabs
+        v-model="activeName"
+        type="card"
+        @tab-click="tabClick"
+        class="basic-tab"
+      >
+        <el-tab-pane
+          :label="`在用(${countInfo.inUseSum ? countInfo.inUseSum : '0'})`"
+          name="inUse"
+        >
+        </el-tab-pane>
+        <el-tab-pane
+          :label="`在库(${
+            countInfo.inLibrarySum ? countInfo.inLibrarySum : '0'
+          })`"
+          name="inLibrary"
+        >
+        </el-tab-pane>
+        <el-tab-pane
+          :label="`消耗(${countInfo.consumeSum ? countInfo.consumeSum : '0'})`"
+          name="hasConsume"
+        >
+        </el-tab-pane>
       </el-tabs>
-      <el-table :data="tableData" class="table-box"
-         :header-cell-style="{ background: '#F0F3F3', border: 'none'}"
+      <el-table
+        :data="tableData"
+        class="table-box"
+        :header-cell-style="{ background: '#F0F3F3', border: 'none' }"
       >
-           <el-table-column type="index" label="序号"  width="100"> </el-table-column>
-           <el-table-column prop="code" label="编码" > </el-table-column>
-           <el-table-column prop="name" label="名称" > </el-table-column>
-           <el-table-column prop="inCode" label="入库单号" v-if="activeName=='inLibrary'"> </el-table-column>
-           <el-table-column prop="inTime" label="入库时间" v-if="activeName=='inLibrary'"> </el-table-column>
-           <el-table-column prop="outCode" label="出库单号" v-if="activeName!='inLibrary'"> </el-table-column>
-           <el-table-column prop="outTime" label="出库时间" v-if="activeName!='inLibrary'"> </el-table-column>
+        <el-table-column type="index" label="序号" width="100">
+        </el-table-column>
+        <el-table-column prop="code" label="编码"> </el-table-column>
+        <el-table-column prop="name" label="名称"> </el-table-column>
+        <el-table-column
+          prop="inCode"
+          label="入库单号"
+          v-if="activeName == 'inLibrary'"
+        >
+        </el-table-column>
+        <el-table-column
+          prop="inTime"
+          label="入库时间"
+          v-if="activeName == 'inLibrary'"
+        >
+        </el-table-column>
+        <el-table-column
+          prop="outCode"
+          label="出库单号"
+          v-if="activeName != 'inLibrary'"
+        >
+        </el-table-column>
+        <el-table-column
+          prop="outTime"
+          label="出库时间"
+          v-if="activeName != 'inLibrary'"
+        >
+        </el-table-column>
       </el-table>
       <div class="pagination">
         <el-pagination
@@ -74,170 +115,166 @@
 </template>
 
 <script>
-  import {
-    getCategoryInfo,
-    getPageSingle
-  } from '@/api/ledgerAssets';
-export default {
-  props: {
-    rowId:{
-      type:String ,
-      default:''
+  import { getCategoryInfo, getPageSingle } from '@/api/ledgerAssets';
+  export default {
+    props: {
+      rowId: {
+        type: String,
+        default: ''
+      }
     },
-  },
-  data () {
-    return {
-      information:{
-        extendField:{}
-      },
-      activeName:'inUse',
-      tableData:[],
-      pagination: {
-        pageNum: 1,
-        size: 15
-      },
-      total: 0,
-      searchForm:{
-        categoryId:this.rowId,
-        positionType:1
-      },
-      countInfo:{}
-
-    }
-  },
-  created () {
-    this.getDetilInfo()
-    this.handleList()
-    // this.getCountNum()
-  },
-  methods:{
-     getDetilInfo(){
-       getCategoryInfo(this.rowId).then(res=>{
-          this.information = res.data
-          if(res.data.extendField){
-            this.$set(this.information, 'extendField', JSON.parse(res.data.extendField))
+    data () {
+      return {
+        information: {
+          extendField: {}
+        },
+        activeName: 'inUse',
+        tableData: [],
+        pagination: {
+          pageNum: 1,
+          size: 15
+        },
+        total: 0,
+        searchForm: {
+          categoryId: this.rowId,
+          positionType: 1
+        },
+        countInfo: {}
+      };
+    },
+    created () {
+      this.getDetilInfo();
+      this.handleList();
+      // this.getCountNum()
+    },
+    methods: {
+      getDetilInfo () {
+        getCategoryInfo(this.rowId).then((res) => {
+          this.information = res.data;
+          if (res.data.extendField) {
+            this.$set(
+              this.information,
+              'extendField',
+              JSON.parse(res.data.extendField)
+            );
           }
-       })
-     },
-     tabClick(val){
+        });
+      },
+      tabClick (val) {
         switch (this.activeName) {
           case 'inUse': {
-            this.searchForm.positionType = 1
+            this.searchForm.positionType = 1;
             break;
           }
           case 'inLibrary': {
-            this.searchForm.positionType = 2
+            this.searchForm.positionType = 2;
             break;
           }
           case 'hasConsume': {
-            this.searchForm.positionType = 3
+            this.searchForm.positionType = 3;
             break;
           }
           default:
             break;
         }
-        this.handleList()
-     },
+        this.handleList();
+      },
 
-     handleCurrent (page) {
-       this.pagination.pageNum = page
-       this.handleList()
-     },
-     handleSize (size) {
-       this.pagination.pageNum = 1
-       this.pagination.size = size
-       this.handleList()
-     },
+      handleCurrent (page) {
+        this.pagination.pageNum = page;
+        this.handleList();
+      },
+      handleSize (size) {
+        this.pagination.pageNum = 1;
+        this.pagination.size = size;
+        this.handleList();
+      },
 
       handleList () {
-         const params = {
-           ...this.searchForm,
-           ...this.pagination
-         }
-         getPageSingle(params).then(res=>{
-            this.tableData = res.list
-            this.total = res.count
-         })
-
+        const params = {
+          ...this.searchForm,
+          ...this.pagination
+        };
+        getPageSingle(params).then((res) => {
+          this.tableData = res.list;
+          this.total = res.count;
+        });
       },
 
-     getCountNum(){
-       const params = {
-           assetType:'ZHOUMIN',
-           informationId:this.rowInfo.id
-       }
-       getCount(params).then(res=>{
-           if(res?.success){
-               this.countInfo = res.data
-           }
-       })
-     }
-
-
-  },
-
-  watch:{
-    // 监听类别id变化
-    // rowId() {
-    //   this.getDetilInfo()
-    // }
-  },
+      getCountNum () {
+        const params = {
+          assetType: 'ZHOUMIN',
+          informationId: this.rowInfo.id
+        };
+        getCount(params).then((res) => {
+          if (res?.success) {
+            this.countInfo = res.data;
+          }
+        });
+      }
+    },
 
-}
+    watch: {
+      // 监听类别id变化
+      // rowId() {
+      //   this.getDetilInfo()
+      // }
+    }
+  };
 </script>
 
 <style lang="scss" scoped>
- .baseinfo-container {
+  .baseinfo-container {
     background-color: #fff;
     padding: 20px;
     .content {
       padding: 0 20px;
     }
-  .basic-details-title{
-    font-size: 16px;
-    margin: 15px 0;
-  }
-  .basic-tab{
-    margin-bottom: 15px;
-  }
-  .upload-container {
-    display: flex;
-    .img-box {
-      width: 280px;
-      height: 342px;
-      border: 1px solid rgba(215, 215, 215, 1);
-      display: flex;
-      justify-content: center;
-      align-items: center;
-      img {
-        max-width: 100%;
-      }
+    .basic-details-title {
+      font-size: 16px;
+      margin: 15px 0;
     }
-    .file-list {
-      margin-left: 50px;
-      flex: 1;
+    .basic-tab {
+      margin-bottom: 15px;
+    }
+    .upload-container {
       display: flex;
-      justify-content: space-between;
-      flex-wrap: wrap;
-      justify-items: baseline;
-      align-content: flex-start;
-      .file-box {
-        width: 30%;
-        margin-bottom: 20px;
-        height: 57px;
-        text-align: center;
-        line-height: 55px;
-        border: 1px solid var(--mainColor);
-        color: var(--mainColor);
-        cursor: pointer;
+      .img-box {
+        width: 280px;
+        height: 342px;
+        border: 1px solid rgba(215, 215, 215, 1);
+        display: flex;
+        justify-content: center;
+        align-items: center;
+        img {
+          max-width: 100%;
+        }
+      }
+      .file-list {
+        margin-left: 50px;
+        flex: 1;
+        display: flex;
+        justify-content: space-between;
+        flex-wrap: wrap;
+        justify-items: baseline;
+        align-content: flex-start;
+        .file-box {
+          width: 30%;
+          margin-bottom: 20px;
+          height: 57px;
+          text-align: center;
+          line-height: 55px;
+          border: 1px solid var(--mainColor);
+          color: var(--mainColor);
+          cursor: pointer;
 
-        &.disabled {
-          cursor: not-allowed;
-          border-color: rgba(215, 215, 215, 1);
-          color: rgba(215, 215, 215, 1);
+          &.disabled {
+            cursor: not-allowed;
+            border-color: rgba(215, 215, 215, 1);
+            color: rgba(215, 215, 215, 1);
+          }
         }
       }
     }
   }
-}
 </style>

+ 140 - 155
src/views/ledgerAssets/equipment/components/DialogGoods.vue

@@ -9,101 +9,72 @@
       :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>
+      <ele-split-layout
+        width="256px"
+        allow-collapse
+        :right-style="{ overflow: 'hidden' }"
+      >
+        <div class="minHeight ele-border-lighter split-layout-right-content">
+          <asset-tree @handleNodeClick="handleNodeClick" ref="AssetTree" />
         </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>
+        <template v-slot:content>
+          <!-- 数据表格 -->
+          <ele-pro-table
+            ref="table"
+            :initLoad="false"
+            :columns="columns"
+            height="60vh"
+            :current.sync="current"
+            highlight-current-row
+            :datasource="datasource"
+            tool-class="ele-toolbar-form"
+            cache-key="systemOrgUserTable"
+          >
+            <!-- 表头工具栏 -->
+            <template v-slot:toolbar>
+              <el-row :gutter="22">
+                <el-col :span="8">
+                  <el-input
+                    type="text"
+                    v-model="searchForm.searchKey"
+                    size="small"
+                    placeholder="搜索物品编码/名称"
+                  ></el-input>
+                </el-col>
+                <el-col :span="8">
+                  <el-button
+                    icon="el-icon-refresh-left"
+                    size="small"
+                    @click="rest"
+                    >重置</el-button
+                  >
+                  <el-button
+                    type="primary"
+                    icon="el-icon-search"
+                    size="small"
+                    @click="reload"
+                    >搜索</el-button
+                  >
+                </el-col>
+              </el-row>
+            </template>
+          </ele-pro-table>
+        </template>
+      </ele-split-layout>
+      <footer slot="footer">
+        <el-button @click="close">取消</el-button>
+        <el-button @click="submit" type="primary">确认</el-button>
+      </footer>
     </el-dialog>
   </div>
 </template>
 <script>
   import AssetTree from '@/components/AssetTree';
   // import { getList } from "@/api/stockManagement/itemInformation";
+  import { getList } from '@/api/classifyManage/itemInformation';
+  import dictMixins from '@/mixins/dictMixins';
   export default {
+    mixins: [dictMixins],
     props: {
       // 宽度
       width: {
@@ -129,23 +100,86 @@
         title: '选择物品编码',
         searchForm: {
           searchKey: '',
-          classificationId: ''
+          categoryLevelId: ''
         },
-        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 }
-        ]
+        current: {}
       };
     },
+    computed: {
+      // 表格列配置
+      columns () {
+        return [
+          {
+            columnKey: 'index',
+            type: 'index',
+            width: 80,
+            label: '序号',
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            prop: 'code',
+            label: '物品编码',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'name',
+            label: '物品名称',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'specification',
+            label: '规格',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'modelType',
+            label: '型号',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'type',
+            label: '物品类型',
+            showOverflowTooltip: true,
+            formatter: (_row) => this.getDictValue('类型用途', _row.type)
+          },
+          {
+            prop: 'categoryLevelPath',
+            label: '分类',
+            showOverflowTooltip: true
+          },
+          {
+            columnKey: 'selection',
+            type: 'selection',
+            align: 'center',
+            fixed: 'right'
+          }
+        ];
+      }
+    },
+    created () {
+      this.requestDict('类型用途');
+    },
     methods: {
+      /* 表格数据源 */
+      datasource ({ page, limit, where }) {
+        return getList({
+          ...where,
+          pageNum: page,
+          size: limit
+        });
+      },
+      reload () {
+        this.$nextTick(() => {
+          this.$refs.table.reload({
+            pageNum: 1,
+            where: {
+              ...this.searchForm
+            }
+          });
+        });
+      },
       open () {
         this.visibleSync = true;
       },
@@ -154,68 +188,18 @@
       },
       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;
-        }
+        this.reload();
       },
       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);
+        this.searchForm.categoryLevelId = info.id;
+        this.reload();
       },
       submit () {
-        if (this.multipleSelection.length < 1) {
+        if (!this.current.id) {
           return this.$message.error('请选择物品编码');
         }
-        this.$emit('succeed', this.multipleSelection[0]);
+        this.$emit('succeed', this.current);
         this.close();
-      },
-      // 物品类型格式化
-      classificationCodeFormatter (row) {
-        let itemName = '';
-        this.typeList.map((item) => {
-          if (item.prefix == row.classificationCode) {
-            itemName = item.value;
-          }
-        });
-        return itemName;
       }
     }
   };
@@ -227,6 +211,7 @@
       margin-left: 20px;
     }
   }
+
   .main {
     display: flex;
     .tree-col {

+ 270 - 174
src/views/ledgerAssets/equipment/components/baseInfo.vue

@@ -5,238 +5,312 @@
     </div>
     <el-descriptions title="" :column="4" size="medium" border>
       <el-descriptions-item>
-        <template slot="label"> 类别编码 </template>
-        {{ information.code }}
+        <template slot="label"> 设备编码 </template>
+        {{ basicInfo.code }}
       </el-descriptions-item>
       <el-descriptions-item>
-        <template slot="label"> 舟皿名称 </template>
-        {{ information.name }}
+        <template slot="label"> 设备名称 </template>
+        {{ basicInfo.name }}
       </el-descriptions-item>
       <el-descriptions-item>
         <template slot="label"> 型号</template>
-        {{ information.modelType }}
+        {{ basicInfo.modelType }}
       </el-descriptions-item>
       <el-descriptions-item>
         <template slot="label"> 规格 </template>
-        {{ information.specification }}
+        {{ basicInfo.specification }}
       </el-descriptions-item>
       <el-descriptions-item :span="2">
         <template slot="label"> 分类 </template>
-        {{ information.categoryLevelPath }}
+        {{ basicInfo.categoryLevelPath }}
       </el-descriptions-item>
       <el-descriptions-item>
-        <template slot="label"> 长/宽/高(mm) </template>
-        {{ information.extendField.length }}/{{
-          information.extendField.width
-        }}/{{ information.extendField.high }}
+        <template slot="label"> 采购日期 </template>
+        {{
+          basicInfo.warehouseDetail && basicInfo.warehouseDetail.procurementTime
+        }}
       </el-descriptions-item>
+      <!-- <el-descriptions-item>
+        <template slot="label"> 生产日期 </template>
+        {{ basicInfo.productTime }}
+      </el-descriptions-item> -->
       <el-descriptions-item>
-        <template slot="label"> 计量单位</template>
-        {{ information.measuringUnit }}
+        <template slot="label"> 过保日期 </template>
+        {{ basicInfo.expirationTime }}
+      </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>
+        <template slot="label"> 生命周期</template>
+        <div v-if="info.source == 1" style="color: #70b603">在用</div>
+        <div v-if="info.source == 2" style="color: #f59a23">在库</div>
+        <div v-if="info.source == 3" style="color: #aaaaaa">消耗</div>
+        <!-- {{ basicInfo.sourceDICT }} -->
+      </el-descriptions-item>
+      <el-descriptions-item>
+        <template slot="label"> 网络状态</template>
+        {{ basicInfo.networkStatus == 1 ? '在线' : '离线' }}
       </el-descriptions-item>
     </el-descriptions>
+
     <div class="basic-details-title border-none">
-      <span class="border-span">舟皿明细</span>
+      <span class="border-span">投产信息</span>
     </div>
-    <div>
-      <el-tabs
-        v-model="activeName"
-        type="card"
-        @tab-click="tabClick"
-        class="basic-tab"
-      >
-        <el-tab-pane
-          :label="`在用(${countInfo.inUseSum ? countInfo.inUseSum : '0'})`"
-          name="inUse"
-        >
-        </el-tab-pane>
-        <el-tab-pane
-          :label="`在库(${
-            countInfo.inLibrarySum ? countInfo.inLibrarySum : '0'
-          })`"
-          name="inLibrary"
-        >
-        </el-tab-pane>
-        <el-tab-pane
-          :label="`消耗(${countInfo.consumeSum ? countInfo.consumeSum : '0'})`"
-          name="hasConsume"
-        >
-        </el-tab-pane>
-      </el-tabs>
-      <el-table
-        :data="tableData"
-        class="table-box"
-        :header-cell-style="{ background: '#F0F3F3', border: 'none' }"
+
+    <el-descriptions title="" :column="4" size="medium" border>
+      <el-descriptions-item
+        v-for="(item, index) in prodOpt"
+        :key="index"
+        :span="item.span || 1"
       >
-        <el-table-column type="index" label="序号" width="100">
-        </el-table-column>
-        <el-table-column prop="code" label="编码"> </el-table-column>
-        <el-table-column prop="name" label="名称"> </el-table-column>
-        <el-table-column
-          prop="inCode"
-          label="入库单号"
-          v-if="activeName == 'inLibrary'"
-        >
-        </el-table-column>
-        <el-table-column
-          prop="inTime"
-          label="入库时间"
-          v-if="activeName == 'inLibrary'"
+        <template slot="label" v-if="item.key == 'bizNum'">{{
+          info.source == 2 ? '入库单号' : '出库单号'
+        }}</template>
+        <template slot="label" v-else> {{ item.label }} </template>
+        <div v-if="item.key == 'bizNum'">
+          <el-link style="color: #70b603" @click="jumpDetails">{{
+            info.warehouseDetail && info.warehouseDetail.bizNum
+          }}</el-link>
+        </div>
+        <div v-else-if="item.key == 'detailLocation'">
+          {{ initDetailLocation(item.value) }}
+        </div>
+        <div v-else>{{ item.value }}</div>
+      </el-descriptions-item>
+    </el-descriptions>
+    <div class="basic-details-title border-none">
+      <span class="border-span">文档信息</span>
+    </div>
+    <!-- <div class="upload-container">
+      <div class="img-box">
+        <img
+          src="~@/assets/img/upload-placeholder.svg"
+          alt=""
+          v-if="!imageUrl"
+        />
+        <img v-else :src="imageUrl" alt="设备图片" />
+      </div>
+      <div class="file-list">
+        <div
+          :class="{ disabled: !item.accessUrl }"
+          @click="openfile(item)"
+          v-for="(item, index) in fileList"
+          :key="index"
+          class="file-box"
         >
-        </el-table-column>
-        <el-table-column
-          prop="outCode"
-          label="出库单号"
-          v-if="activeName != 'inLibrary'"
+          {{ item.t_name }}
+        </div>
+      </div>
+    </div> -->
+    <div class="basic-details-title border-none">
+      <span class="border-span">物联参数</span>
+    </div>
+    <el-row>
+      <el-col style="padding-left: 30px">
+        <span style="color: #3e3e3e; padding-right: 20px; font-size: 14px"
+          >是否启用物联</span
         >
-        </el-table-column>
-        <el-table-column
-          prop="outTime"
-          label="出库时间"
-          v-if="activeName != 'inLibrary'"
+        <el-switch
+          v-model="info.isIotEnable"
+          disabled
+          active-text="开"
+          inactive-text="关"
+          :active-value="1"
+          :inactive-value="0"
         >
-        </el-table-column>
-      </el-table>
-      <div class="pagination">
-        <el-pagination
-          background
-          layout="total, sizes, prev, pager, next, jumper"
-          :total="total"
-          :page-sizes="[15, 30, 50, 100, 500]"
-          :page-size="pagination.size"
-          :current-page.sync="pagination.pageNum"
-          @current-change="handleCurrent"
-          @size-change="handleSize"
+        </el-switch>
+      </el-col>
+      <el-col style="margin-top: 20px; padding-left: 30px; font-size: 14px">
+        <span style="color: #3e3e3e">物联ID</span>
+        <span style="color: #3e3e3e; padding-left: 10px">{{ info.iotId }}</span>
+      </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 info.extInfoSelf"
+          :key="index"
+          style="margin-bottom: 20px"
         >
-        </el-pagination>
-      </div>
+          <div class="add-col">
+            <el-input
+              disabled
+              class="col-input"
+              v-model="item.key"
+              placeholder="参数名称"
+            ></el-input>
+            <el-input
+              disabled
+              class="col-input"
+              v-model="item.value"
+              placeholder="参数值"
+            ></el-input>
+          </div>
+        </el-col>
+      </el-row>
     </div>
+    <!-- <DetailsDialog ref="detailsDialogRef" /> -->
   </div>
 </template>
 
 <script>
-  import { getCategoryInfo, getPageSingle } from '@/api/ledgerAssets';
+  import { getAssetInfo } from '@/api/ledgerAssets';
+  // import { imageView, fileSystemDownload } from '@/utils'
+  // import DetailsDialog from '@/views/ledgerAssets/components/outstoreDetailsDialog.vue'
   export default {
-    props: {
-      rowId: {
-        type: String,
-        default: ''
-      }
+    props: ['id'],
+    components: {
+      // DetailsDialog
     },
     data () {
       return {
-        information: {
-          extendField: {}
+        prodOpt: [
+          { label: '固资编码', key: 'fixCode', value: '' },
+          { label: '投产日期', key: 'startUpTime', value: '' },
+          { label: '所属工厂', key: 'factoryName', value: '' },
+          { label: '所属工序', key: 'roteName', value: '' },
+          { label: '维护部门', key: 'repairGroupName', value: '' },
+          { label: '维护人', key: 'repairUserName', value: '' },
+          { label: '维护人电话', key: 'repairUserMobile', value: '' },
+          { label: '出库单号', key: 'bizNum', value: '' },
+          { label: '权属部门', key: 'ownershipGroupName', value: '' },
+          { label: '权属人', key: 'ownershipUserName', value: '' },
+          { label: '权属人电话', key: 'ownershipUserMobile', value: '' },
+          { label: '品牌', key: 'brand', value: '' },
+          { label: '供应商', key: 'supplierName', span: 2, value: '' },
+          { label: '供应商电话', key: 'supplierMobile', value: '' },
+          { label: '设备用途', key: 'purpose', value: '' },
+          { label: '设备位置', key: 'detailLocation', span: 2, value: '' },
+          { label: '颜色', key: 'color', value: '' },
+          { label: '重量', key: 'weight', value: '' }
+        ],
+        fileList: [
+          { t_name: '使用说明书' },
+          { t_name: '生产许可证书' },
+          { t_name: '防爆合格证书' },
+          { t_name: '检验报告' },
+          { t_name: '检验周期说明' },
+          { t_name: '图纸资料' },
+          { t_name: '产品合格证' }
+        ],
+        // 基本信息
+        basicInfo: {
+          assetCode: '',
+          assetName: '',
+          // 资产管理物品信息
+          information: '',
+          productTime: '',
+          expirationTime: '',
+          networkStatus: '',
+          sourceDICT: ''
         },
-        activeName: 'inUse',
-        tableData: [],
-        pagination: {
-          pageNum: 1,
-          size: 15
-        },
-        total: 0,
-        searchForm: {
-          categoryId: this.rowId,
-          positionType: 1
-        },
-        countInfo: {}
+        // 设备图片
+        imageUrl: '',
+        // 扩展字段
+        extInfoSelf: [],
+        // 所有信息
+        info: {}
       };
     },
     created () {
-      this.getDetilInfo();
-      this.handleList();
-      // this.getCountNum()
+      this.getInfo();
     },
     methods: {
-      getDetilInfo () {
-        getCategoryInfo(this.rowId).then((res) => {
-          this.information = res.data;
-          if (res.data.extendField) {
-            this.$set(
-              this.information,
-              'extendField',
-              JSON.parse(res.data.extendField)
-            );
-          }
-        });
-      },
-      tabClick (val) {
-        switch (this.activeName) {
-          case 'inUse': {
-            this.searchForm.positionType = 1;
-            break;
+      // 获取设备详情
+      getInfo () {
+        getAssetInfo(this.id).then((data) => {
+          this.info = data;
+          this.basicInfo = data.category;
+          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];
+            //   }
+            // });
           }
-          case 'inLibrary': {
-            this.searchForm.positionType = 2;
-            break;
+
+          // 资产信息
+          for (const item of this.prodOpt) {
+            // 地址
+            if (item.key == 'detailLocation') {
+              item.value = data.positionList[0]?.path
+                ?.map((i) => i.name)
+                .join(',');
+            } else {
+              item.value = data[item.key] || this.basicInfo[item.key];
+            }
           }
-          case 'hasConsume': {
-            this.searchForm.positionType = 3;
-            break;
+
+          console.log('this.prodOpt', this.prodOpt);
+
+          // 设备图片
+          this.imageUrl = data.imageUrl;
+          if (this.imageUrl) {
+            // imageView(this.imageUrl).then((res) => {
+            //   this.$refs.UploadImg.setImg(res);
+            // });
           }
-          default:
-            break;
-        }
-        this.handleList();
+        });
       },
-
-      handleCurrent (page) {
-        this.pagination.pageNum = page;
-        this.handleList();
+      // 设置标准产能
+      setbzcn (val) {
+        if (!val) {
+          return '';
+        }
+        let item = JSON.parse(val);
+        return item.standardCapacity || '';
       },
-      handleSize (size) {
-        this.pagination.pageNum = 1;
-        this.pagination.size = size;
-        this.handleList();
+      openfile (row) {
+        if (row.accessUrl) {
+          fileSystemDownload(row);
+        }
       },
-
-      handleList () {
-        const params = {
-          ...this.searchForm,
-          ...this.pagination
-        };
-        getPageSingle(params).then((res) => {
-          this.tableData = res.list;
-          this.total = res.count;
-        });
+      // 打开详情弹窗
+      jumpDetails () {
+        if (!this.info.warehouseDetail) {
+          return;
+        }
+        this.$refs.detailsDialogRef.init(
+          this.info.warehouseDetail,
+          this.info.source
+        );
       },
-
-      getCountNum () {
-        const params = {
-          assetType: 'ZHOUMIN',
-          informationId: this.rowInfo.id
-        };
-        getCount(params).then((res) => {
-          if (res?.success) {
-            this.countInfo = res.data;
-          }
-        });
+      // 设备位置
+      initDetailLocation (val) {
+        console.log(val);
+        let list = String(val)
+          .split('/')
+          .filter((n) => {
+            return n !== 'null';
+          });
+        return list.join('/');
       }
-    },
-
-    watch: {
-      // 监听类别id变化
-      // rowId() {
-      //   this.getDetilInfo()
-      // }
     }
   };
 </script>
 
 <style lang="scss" scoped>
+  .baseinfo-container .basic-details-title {
+    font-size: 16px;
+    margin: 15px 0;
+  }
   .baseinfo-container {
     background-color: #fff;
     padding: 20px;
     .content {
       padding: 0 20px;
     }
-    .basic-details-title {
-      font-size: 16px;
-      margin: 15px 0;
-    }
-    .basic-tab {
-      margin-bottom: 15px;
-    }
     .upload-container {
       display: flex;
       .img-box {
@@ -277,4 +351,26 @@
       }
     }
   }
+  .kzxx-wrap {
+    .item {
+      display: flex;
+      .key {
+        margin-right: 10px;
+      }
+    }
+  }
+  .kzzd {
+    width: 500px;
+    .add-col {
+      display: flex;
+      .col-input {
+        & + .col-input {
+          margin-left: 10px;
+        }
+      }
+      .del {
+        margin-left: 10px;
+      }
+    }
+  }
 </style>

+ 36 - 11
src/views/ledgerAssets/equipment/components/equipment-list.vue

@@ -32,6 +32,11 @@
         </el-button>
       </template>
       <!-- 编码列 -->
+      <template v-slot:code="{ row }">
+        <el-link type="primary" :underline="false" @click="handleView(row)">
+          {{ row.code }}
+        </el-link>
+      </template>
       <!-- 操作列 -->
       <template v-slot:action="{ row }">
         <el-link
@@ -50,9 +55,11 @@
 <script>
   import EquipmentSearch from './equipment-search.vue';
   import { getAssetList } from '@/api/ledgerAssets';
+  import dictMixins from '@/mixins/dictMixins';
 
   export default {
     components: { EquipmentSearch },
+    mixins: [dictMixins],
     props: {
       // 类别id
       categoryId: [Number, String],
@@ -72,32 +79,39 @@
             fixed: 'left'
           },
           {
-            prop: 'assetCode',
+            columnKey: 'code',
+            slot: 'code',
             label: '设备编码',
             showOverflowTooltip: true,
-            minWidth: 110,
-            slot: 'code'
+            minWidth: 60
           },
+          // {
+          //   prop: 'code',
+          //   label: '设备编码',
+          //   showOverflowTooltip: true,
+          //   minWidth: 110,
+          //   slot: 'code'
+          // },
           {
-            prop: 'assetName',
+            prop: 'name',
             label: '设备名称',
             showOverflowTooltip: true,
             minWidth: 110
           },
           {
-            prop: 'fixAssetCode',
+            prop: 'fixCode',
             label: '固资编码',
             showOverflowTooltip: true,
             minWidth: 110
           },
           {
-            prop: 'module',
+            prop: 'category.modelType',
             label: '型号',
             showOverflowTooltip: true,
             minWidth: 110
           },
           {
-            prop: 'specification',
+            prop: 'category.specification',
             label: '规格',
             showOverflowTooltip: true,
             minWidth: 110
@@ -118,7 +132,9 @@
             prop: 'networkStatus',
             label: '网络状态',
             showOverflowTooltip: true,
-            minWidth: 110
+            minWidth: 110,
+            formatter: (_row) =>
+              this.getDictValue('网络状态', _row.networkStatus)
           },
           {
             columnKey: 'action',
@@ -129,6 +145,9 @@
         ]
       };
     },
+    created () {
+      this.requestDict('网络状态');
+    },
     methods: {
       /* 表格数据源 */
       datasource ({ page, limit, where, order }) {
@@ -147,7 +166,7 @@
       },
 
       // 跳转到详情页
-      handEdit ({ id }) {
+      handleView ({ id }) {
         this.$router.push({
           path: '/ledgerAssets/equipment/detail',
           query: {
@@ -155,14 +174,20 @@
           }
         });
       },
-      // 跳转到详情页
-      add ({ id }) {
+      // 跳转到编辑
+      handEdit ({ id }) {
         this.$router.push({
           path: '/ledgerAssets/equipment/edit',
           query: {
             id
           }
         });
+      },
+      // 跳转到详情页
+      add () {
+        this.$router.push({
+          path: '/ledgerAssets/equipment/edit'
+        });
       }
     },
     watch: {

+ 70 - 55
src/views/ledgerAssets/equipment/detail.vue

@@ -1,66 +1,81 @@
 <template>
-  <div>
-    <!-- tab切换 -->
-<!--   <div class="switch">
-      <div class="switch_left">
-        <ul>
-          <li
-            v-for="item in tabOptions"
-            :key="item.key"
-            :class="{ active: activeComp == item.key }"
-            @click="activeComp = item.key"
-          >
-            {{ item.name }}
-          </li>
-        </ul>
-        <el-button size="small" @click="$router.go(-1)">返回</el-button>
+  <div class="ele-body">
+    <el-card :body-style="{ padding: 0 }">
+      <!-- tab切换 -->
+      <div class="switch">
+        <div class="switch_left">
+          <ul>
+            <li
+              v-for="item in tabOptions"
+              :key="item.key"
+              :class="{ active: activeComp == item.key }"
+              @click="activeComp = item.key"
+            >
+              {{ item.name }}
+            </li>
+          </ul>
+        </div>
+        <div class="right" style="padding: 10px">
+          <el-button @click="$router.go(-1)">返回</el-button>
+        </div>
       </div>
-    </div> -->
-    <div class="content-wrapper">
-      <component :is="activeComp" :rowId="rowId"></component>
-    </div>
+      <div class="content-wrapper">
+        <component :is="activeComp" :id="id" :code="code"></component>
+      </div>
+    </el-card>
   </div>
 </template>
 
 <script>
-import baseInfo from './components/baseInfo.vue'
-export default {
-  components: {
-    baseInfo
-  },
-  data () {
-    return {
-      activeComp: 'baseInfo',
-      tabOptions: [
-        { key: 'baseInfo', name: '舟皿信息' },
-      ],
-      rowId:null,
+  import baseInfo from './components/baseInfo.vue';
+  // import mould from '../components/details/mould.vue'
+  // import maintain from '../components/details/maintain.vue'
+  // import repair from '../components/details/repair.vue'
+  // import malfunction from '../components/details/malfunction.vue'
+  // import InternetRecord from '../components/details/InternetRecord.vue'
+  // import production from '../components/details/production.vue'
+  // import pointInspection from '../components/details/point-inspection.vue'
+  // import internet from '../components/details/internet.vue'
+  export default {
+    components: {
+      baseInfo
+      // mould,
+      // pointInspection,
+      // maintain,
+      // repair,
+      // production,
+      // InternetRecord,
+      // malfunction,
+      // internet
+    },
+    data () {
+      return {
+        // 设备主键id
+        id: '',
+        code: '',
+        activeComp: 'baseInfo',
+        tabOptions: [
+          { key: 'baseInfo', name: '设备信息' }
+          // { key: 'mould', name: '关联模具' },
+          // { key: 'pointInspection', name: '巡点检记录' },
+          // { key: 'maintain', name: '保养记录' },
+          // { key: 'repair', name: '维修记录' },
+          // { key: 'malfunction', name: '故障记录' },
+          // // { key: 'production', name: '生产记录' },
+          // { key: 'internet', name: '物联数据' }
+          // // { key: "InternetRecord", name: "物联记录" },
+        ]
+      };
+    },
+    created () {
+      this.id = this.$route.query.id;
+      this.code = this.$route.query.code;
     }
-  },
-  created () {
-     this.rowId = this.$route.query.id
-  },
-  methods:{
-     // async getDetilInfo(id){
-     //   const res = await getDetails({id:id})
-     //   if (res.success){
-
-     //   }
-     // },
-  }
-
-}
+  };
 </script>
 
 <style lang="scss" scoped>
-.content-wrapper {
-  background-color: #fff;
-}
-.switch_left{
-  width:100%;
-  display:flex;
-  align-items:center;
-  justify-content: space-between;
-  padding-right:20px;
-}
+  .content-wrapper {
+    background-color: #fff;
+  }
 </style>

+ 149 - 180
src/views/ledgerAssets/equipment/edit.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="ele-body">
+  <div class="ele-body baseinfo-container">
     <el-card shadow="never">
       <div class="page-title">
         <el-page-header @back="$router.go(-1)">
@@ -8,12 +8,11 @@
           </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"
+            :loading="btnLoading"
             >确定</el-button
           >
         </div>
@@ -25,7 +24,7 @@
           </div>
           <el-descriptions title="" :column="4" size="medium" border>
             <template slot="title" v-if="pageType == 'add'">
-              <el-form-item class="label-none">
+              <el-form-item class="label-none" label-width="0">
                 <span style="color: red; padding-right: 5px">*</span>
                 <el-button type="primary" plain @click="handlwpbm"
                   >选择物品编码</el-button
@@ -35,7 +34,7 @@
             <el-descriptions-item>
               <template slot="label"> 设备编码 </template>
               <el-form-item
-                prop="informationCode"
+                prop="code"
                 label-width="0"
                 v-if="pageType == 'add'"
               >
@@ -43,15 +42,15 @@
                   v-if="basicInfo"
                   class="input"
                   size="small"
-                  v-model="form.informationCode"
+                  v-model="form.code"
                 ></el-input>
               </el-form-item>
-              <span v-if="pageType == 'edit'">{{ form.informationCode }}</span>
+              <span v-if="pageType == 'edit'">{{ form.code }}</span>
             </el-descriptions-item>
             <el-descriptions-item>
               <template slot="label"> 设备名称 </template>
               <el-form-item
-                prop="informationName"
+                prop="name"
                 label-width="0"
                 v-if="pageType == 'add'"
               >
@@ -59,10 +58,10 @@
                   v-if="basicInfo"
                   class="input"
                   size="small"
-                  v-model="form.informationName"
+                  v-model="form.name"
                 ></el-input>
               </el-form-item>
-              <span v-if="pageType == 'edit'">{{ form.informationName }}</span>
+              <span v-if="pageType == 'edit'">{{ form.name }}</span>
             </el-descriptions-item>
             <el-descriptions-item>
               <template slot="label"> 型号</template>
@@ -74,7 +73,7 @@
             </el-descriptions-item>
             <el-descriptions-item :span="2">
               <template slot="label"> 分类 </template>
-              {{ basicInfo.classificationUrl }}
+              {{ basicInfo.categoryLevelPath }}
             </el-descriptions-item>
             <el-descriptions-item>
               <template slot="label"> 生产日期 </template>
@@ -130,7 +129,7 @@
                 <el-input
                   class="input"
                   size="small"
-                  v-model="zcInfo.fixAssetCode"
+                  v-model="zcInfo.fixCode"
                 ></el-input>
               </el-form-item>
             </el-col>
@@ -154,19 +153,9 @@
             </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"
-              /> -->
+                <div class="input">
+                  <DeptSelect v-model="zcInfo.repairGroupId" @input="getwhbm" />
+                </div>
               </el-form-item>
             </el-col>
             <el-col :span="8">
@@ -184,18 +173,12 @@
             </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"
-                />
+                <div class="input">
+                  <DeptSelect
+                    v-model="zcInfo.ownershipGroupId"
+                    @input="getqsbm"
+                  />
+                </div>
               </el-form-item>
             </el-col>
             <el-col :span="8">
@@ -225,15 +208,6 @@
             </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>
@@ -336,7 +310,7 @@
           <div class="basic-details-title border-none">
             <span class="border-span">文档信息</span>
           </div>
-          <div class="upload-container">
+          <!-- <div class="upload-container">
             <UploadImg @getImgs="cbUploadImg" ref="UploadImg" />
             <div class="file-list">
               <div>
@@ -396,7 +370,7 @@
                 </el-form-item>
               </div>
             </div>
-          </div>
+          </div> -->
           <div class="basic-details-title border-none">
             <span class="border-span">物联参数</span>
           </div>
@@ -407,6 +381,8 @@
                   v-model="isIotEnable"
                   active-text="开"
                   inactive-text="关"
+                  :active-value="1"
+                  :inactive-value="0"
                 >
                 </el-switch>
               </el-form-item>
@@ -422,13 +398,13 @@
             <el-row>
               <el-col
                 :span="24"
-                v-for="(item, index) in form.addList"
+                v-for="(item, index) in form.extInfoSelf"
                 :key="index"
                 style="margin-bottom: 20px"
               >
                 <el-form-item
                   label-width="0"
-                  :prop="'addList.' + index + '.key'"
+                  :prop="'extInfoSelf.' + index + '.key'"
                   :rules="{
                     required: true,
                     message: '自定义参数名称不能为空',
@@ -456,7 +432,7 @@
                   </div>
                 </el-form-item>
               </el-col>
-              <el-col :span="24" v-if="form.addList.length < 10">
+              <el-col :span="24" v-if="form.extInfoSelf.length < 10">
                 <el-form-item label-width="0">
                   <el-button
                     class="primarybutton"
@@ -500,6 +476,9 @@
   //   getDetail,
   //   getSupplier
   // } from '@/api/ledgerAssets/equipment';
+  import { getFactoryarea } from '@/api/factoryModel/factoryManagement';
+  import { saveOrEdit, getAssetInfo } from '@/api/ledgerAssets';
+  import { getUserPage } from '@/api/system/organization';
   export default {
     components: {
       //selectUpload,
@@ -515,37 +494,34 @@
         // 设备主键id
         id: '',
         form: {
-          addList: [],
+          extInfoSelf: [],
           // 基本信息
-          informationCode: '',
-          informationName: '',
+          code: '',
+          name: '',
           productTime: ''
         },
         rules: {
-          informationName: [
+          name: [
             { required: true, message: '请输入设备名称', trigger: 'blur' }
           ],
-          informationCode: [
-            { required: true, message: '请输入设备编码', trigger: 'blur' }
-          ]
+          code: [{ required: true, message: '请输入设备编码', trigger: 'blur' }]
         },
         // 基本信息
-        basicInfo: '',
+        basicInfo: {},
         // 资产信息
         zcInfo: {
           // 	固定资产编码
-          fixAssetCode: '',
+          fixCode: '',
           // 颜色
           color: '',
           // 重量
           weight: '',
           // 维护部门code
-          repairDeptCode: '',
+          repairGroupId: '',
           repairDeptName: '',
           repairUserId: '',
           // 权属部门
-          ownershipDeptCode: '',
-          ownershipDeptName: '',
+          ownershipGroupId: '',
           ownershipUserId: '',
           // 设备用途
           purpose: '',
@@ -618,7 +594,7 @@
         // 获取产线
         this.getProductionLine();
       }
-      // "zcInfo.repairDeptCode": function (nVal) {
+      // "zcInfo.repairGroupId": function (nVal) {
       //   this.zcInfo.repairUserId = "";
       //   this.options.repairUserId = [];
       // },
@@ -642,20 +618,17 @@
       }
     },
     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 = "编辑设备信息";
-      // }
+      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();
+      this.getfactoryInfo();
     },
     methods: {
       setImgs (type, sort, info) {
@@ -671,12 +644,16 @@
       },
       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;
+        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) {
@@ -705,27 +682,23 @@
         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();
+        if (!this.zcInfo.repairGroupId) return;
+        let data = await getUserPage({
+          pageNum: 1,
+          size: 9999,
+          groupId: this.zcInfo.repairGroupId
+        });
+        this.options.repairUserId = data.list;
       },
       async getqsbm () {
-        let res = await user.user({ deptCode: this.zcInfo.ownershipDeptCode });
-        this.options.ownershipUserId = res.data;
+        if (!this.zcInfo.ownershipGroupId) return;
+        let data = await getUserPage({
+          pageNum: 1,
+          size: 9999,
+          groupId: this.zcInfo.ownershipGroupId
+        });
+        this.options.ownershipUserId = data.list;
       },
       // 树形结构数据
       getTreeList () {
@@ -738,46 +711,47 @@
         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;
+        // 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;
+        // let data = await getPlants({
+        //   size: 999
+        // });
+        // this.options.factoryPlantCode = data.data.items;
       },
       // 获取工厂列表
       async getfactoryInfo () {
-        let data = await getfactoryInfo({
-          size: 999
+        let data = await getFactoryarea({
+          size: 999,
+          type: 1,
+          enable: 1
         });
-        this.options.factoryCode = data.data.items;
+        this.options.factoryCode = data.list;
       },
       // 获取车间列表
       async getFactorys () {
-        let data = await getFactorys({
-          factoryCode: this.zcInfo.factoryCode,
-          size: 999
-        });
-        this.options.workshopCode = data.data.items;
+        // 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;
+        // let data = await getProductionLine({
+        //   factory: this.zcInfo.factoryCode,
+        //   workshopId: this.zcInfo.workshopCode,
+        //   size: 999
+        // });
+        // this.options.lineCode = data.data.items;
       },
       // 选择图片回调
       cbUploadImg (data) {
@@ -789,16 +763,16 @@
       },
       // 添加自定义参数
       addItem () {
-        if (this.form.addList.length < 10) {
+        if (this.form.extInfoSelf.length < 10) {
           let item = { key: '', value: '' };
-          this.form.addList.push(item);
+          this.form.extInfoSelf.push(item);
         } else {
           this.$message.warning('自定义参数最多添加10条');
         }
       },
       // 删除自定义参数
       delt (item, index) {
-        this.form.addList.splice(index, 1);
+        this.form.extInfoSelf.splice(index, 1);
       },
       // 提交
       submit () {
@@ -809,22 +783,25 @@
           if (valid) {
             let par = {
               //基本信息
-              assetCode: this.form.informationCode,
-              assetName: this.form.informationName,
+              ...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,
+              // informationId: this.basicInfo.id,
+              // productTime: this.form.productTime,
+              // expirationTime: this.expirationTime,
               // 资产信息
+              positionIds: '1,1,1,1',
               ...this.zcInfo,
               // 文档信息
-              attUrl: this.setWd(),
-              // 设备图片
-              imageUrl: this.imageUrl,
+              attUrl: this.setWd() || [],
+              // // 设备图片
+              imageUrl: this.imageUrl || {},
               // 是否启用物联
-              isIotEnable: this.isIotEnable,
-              // 扩展字段
-              extendField: this.setKz()
+              isIotEnable: this.isIotEnable
+              // // 扩展字段
+              // extInfoSelf: this.setKz()
             };
             if (this.pageType == 'edit') {
               par.id = this.id;
@@ -846,7 +823,7 @@
       },
       // 处理扩展字段
       setKz () {
-        return JSON.stringify(this.form.addList);
+        return this.form.extInfoSelf || [];
       },
       // 处理文档信息
       setWd () {
@@ -861,51 +838,39 @@
         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);
+      async getInfo () {
+        const data = await getAssetInfo(this.id);
+        this.form = data;
+        this.basicInfo = data.category;
+        this.cbexpirationTime = data.expirationTime;
+        this.sourceDICT = data.sourceDICT;
+        this.networkStatus = data.networkStatus;
+        // 资产信息
+        for (const key of Object.keys(this.zcInfo)) {
+          console.log(key, data[key]);
+          this.zcInfo[key] = data[key];
+        }
+        this.getwhbm();
+        this.getqsbm();
+        if (data.attUrl && data.attUrl.length > 0) {
+          // 文档信息
+          Object.keys(this.attUrl).forEach((n, index) => {
+            if (data.attUrl[index].accessUrl) {
+              this.attUrl[n] = data.attUrl[index];
             }
           });
-        });
+        }
+
+        // 设备图片
+        this.imageUrl = data.imageUrl;
+        if (this.imageUrl) {
+          // imageView(this.imageUrl).then((res) => {
+          //   this.$refs.UploadImg.setImg(res);
+          // });
+        }
+        // 物联参数
+        this.isIotEnable = data.isIotEnable;
+        this.iotId = data.iotId;
       },
       // 设置标准产能
       setbzcn (val) {
@@ -936,7 +901,11 @@
 </script>
 
 <style lang="scss" scoped>
-  ::v-deep.equipment-container {
+  .baseinfo-container .basic-details-title {
+    font-size: 16px;
+    margin: 15px 0;
+  }
+  .equipment-container {
     // .content {
     //   padding: 0 20px;
     // }

+ 0 - 1
src/views/ledgerAssets/equipment/index.vue

@@ -32,7 +32,6 @@
 <script>
   import AssetTree from '@/components/AssetTree';
   import EquipmentList from './components/equipment-list.vue';
-  import { getBoatList } from '@/api/ledgerAssets';
   export default {
     components: {
       AssetTree,