From b6a04be0a4cbf5d5a44006a09b83f52a71dfce27 Mon Sep 17 00:00:00 2001
From: haoyahui <2032914783@qq.com>
Date: 星期五, 17 十一月 2023 10:19:48 +0800
Subject: [PATCH] 部门管理,仓库管理库管员,库存管理

---
 admin-web/src/views/systemSetting/department/index.vue |  407 +++++++++++++++++----------------------------------------
 1 files changed, 121 insertions(+), 286 deletions(-)

diff --git a/admin-web/src/views/systemSetting/department/index.vue b/admin-web/src/views/systemSetting/department/index.vue
index f4e556c..9544286 100644
--- a/admin-web/src/views/systemSetting/department/index.vue
+++ b/admin-web/src/views/systemSetting/department/index.vue
@@ -2,88 +2,14 @@
   <div class="app-container">
     <!--宸︿晶鏍戝舰寮�濮�-->
     <el-col :span="5">
-        <el-card class="box-card" shadow="never">
-          <my-tree ref="searchTree" :tree-list="treeDataList" @setNode="nodeClick" @search="search"></my-tree>
-        </el-card>
-      </el-col>
-      <!--宸︿晶鏍戝舰缁撴潫-->
-      <!--鍙充晶鍒楄〃寮�濮�-->
+      <el-card class="box-card" shadow="never">
+        <my-tree ref="searchTree" :tree-list="treeDataList" @setNode="nodeClick" @search="search"></my-tree>
+      </el-card>
+    </el-col>
+    <!--宸︿晶鏍戝舰缁撴潫-->
+    <!--鍙充晶鍒楄〃寮�濮�-->
     <el-container>
       <el-card class="box-card" style="width: 100%" shadow="never">
-<!--      <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">-->
-<!--        <el-form-item label="瀛楀吀鍚嶇О" prop="dictName">-->
-<!--          <el-input-->
-<!--            v-model="queryParams.dictName"-->
-<!--            placeholder="璇疯緭鍏�"-->
-<!--            clearable-->
-<!--            style="width: 150px"-->
-<!--            @keyup.enter.native="handleQuery"-->
-<!--          />-->
-<!--        </el-form-item>-->
-<!--        <el-form-item label="鐘舵��" prop="status">-->
-<!--          <el-select-->
-<!--            v-model="queryParams.status"-->
-<!--            placeholder="璇烽�夋嫨"-->
-<!--            clearable-->
-<!--            style="width: 150px"-->
-<!--          >-->
-<!--            <el-option-->
-<!--              v-for="item in constants.normalOrDisabled"-->
-<!--              :key="item.value"-->
-<!--              :label="item.label"-->
-<!--              :value="item.value"-->
-<!--            />-->
-<!--          </el-select>-->
-<!--        </el-form-item>-->
-<!--        <el-form-item>-->
-<!--          <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鏌ヨ</el-button>-->
-<!--          <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button>-->
-<!--        </el-form-item>-->
-<!--      </el-form>-->
-<!--      <el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange">-->
-<!--        <el-table-column type="selection" width="55" align="center" />-->
-<!--        <el-table-column label="瀛楀吀缂栧彿" align="center" prop="dict_id" />-->
-<!--        <el-table-column label="瀛楀吀鍚嶇О" align="center" prop="dict_name" :show-overflow-tooltip="true" />-->
-<!--        <el-table-column label="瀛楀吀绫诲瀷" align="center" :show-overflow-tooltip="true">-->
-<!--          <template slot-scope="scope">-->
-<!--            <router-link :to="'/systemSetting/dictdata/data/' + scope.row.dict_id" class="link-type">-->
-<!--              <span>{{ scope.row.dict_type }}</span>-->
-<!--            </router-link>-->
-<!--          </template>-->
-<!--        </el-table-column>-->
-<!--        <el-table-column label="鐘舵��" align="center" prop="status">-->
-<!--          <template slot-scope="scope">-->
-<!--            <span>{{ scope.row.status == 0? '姝e父':'绂佺敤' }}</span>-->
-<!--          </template>-->
-<!--        </el-table-column>-->
-<!--        <el-table-column label="澶囨敞" align="center" prop="remark" :show-overflow-tooltip="true" />-->
-<!--        <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="create_time" width="180">-->
-<!--          <template slot-scope="scope">-->
-<!--            <span>{{ dateTo(scope.row.create_time) }}</span>-->
-<!--          </template>-->
-<!--          &lt;!&ndash;        <template slot-scope="scope">&ndash;&gt;-->
-<!--          &lt;!&ndash;          <span>{{ parseTime(scope.row.create_time) }}</span>&ndash;&gt;-->
-<!--          &lt;!&ndash;        </template>&ndash;&gt;-->
-<!--        </el-table-column>-->
-<!--        <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width" width="180">-->
-<!--          <template slot-scope="scope">-->
-<!--            <el-button-->
-<!--              size="mini"-->
-<!--              type="text"-->
-<!--              icon="el-icon-edit"-->
-<!--              @click="handleUpdate(scope.row)"-->
-<!--              v-hasPermi="['system:dict:edit']"-->
-<!--            >淇敼</el-button>-->
-<!--  &lt;!&ndash;          <el-button-->
-<!--              size="mini"-->
-<!--              type="text"-->
-<!--              icon="el-icon-delete"-->
-<!--              @click="handleDelete(scope.row)"-->
-<!--              v-hasPermi="['system:dict:remove']"-->
-<!--            >鍒犻櫎</el-button>&ndash;&gt;-->
-<!--          </template>-->
-<!--        </el-table-column>-->
-<!--      </el-table>-->
         <!--鎼滅储鏉′欢-->
         <div class="filter-container">
           <my-search ref="searchBar" :items="items" @search="fifterForm"></my-search>
@@ -91,52 +17,28 @@
         <el-row style="margin-top: 8px">
           <el-col>
             <!--鍒楄〃-->
-            <my-table-v2 ref="myTable" :filter="queryParams" :table="table"/>
+            <my-table-v2 ref="myTable" :filter="filterFrom" :table="table" />
           </el-col>
         </el-row>
       </el-card>
     </el-container>
     <!-- 娣诲姞鎴栦慨鏀瑰弬鏁伴厤缃璇濇 -->
-    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
-      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="瀛楀吀鍚嶇О" prop="dictName">
-          <el-input v-model="form.dictName" placeholder="璇疯緭鍏ュ瓧鍏稿悕绉�" />
-        </el-form-item>
-        <el-form-item label="瀛楀吀绫诲瀷" prop="dictType">
-          <el-input v-model="form.dictType" placeholder="璇疯緭鍏ュ瓧鍏哥被鍨�" />
-        </el-form-item>
-        <el-form-item label="鐘舵��" prop="status">
-          <el-radio-group v-model="form.status">
-            <el-radio
-              v-for="item in constants.normalOrDisabled"
-              :key="item.value"
-              :label="item.value"
-            >{{item.label}}</el-radio>
-          </el-radio-group>
-        </el-form-item>
-        <el-form-item label="澶囨敞" prop="remark">
-          <el-input v-model="form.remark" type="textarea" placeholder="璇疯緭鍏ュ唴瀹�"></el-input>
-        </el-form-item>
-      </el-form>
-      <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitForm">纭� 瀹�</el-button>
-        <el-button @click="cancel">鍙� 娑�</el-button>
-      </div>
-    </el-dialog>
+
+    <edit v-if="editSetting.show" :setting="editSetting" @close="editSetting.show = false" @search="search()" />
   </div>
 </template>
 
 <script>
 import myTree from '@/components/myTree/index';
-import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type";
-import * as DateFormatter from "@/utils/DateFormatter";
-import MyTableV2 from "@/components/myTable/myTableV2";
+import { listType, getType, delType, addType, updateType, refreshCache } from '@/api/system/dict/type';
+import * as DateFormatter from '@/utils/DateFormatter';
+import MyTableV2 from '@/components/myTable/myTableV2';
 import SettingIplatform from '@/utils/settingIplatform';
-import items from './items'
+import edit from './edit';
 import * as finsystenant from '@/api/baseSetting/finsystenant';
 export default {
-  name: "Dict",
-  components: { MyTableV2, myTree },
+  name: 'Dict',
+  components: { MyTableV2, myTree, edit },
   data() {
     return {
       // 鏍戞暟鎹�
@@ -157,75 +59,103 @@
       // 瀛楀吀琛ㄦ牸鏁版嵁
       typeList: [],
       // 寮瑰嚭灞傛爣棰�
-      title: "",
+      title: '',
       // 鏄惁鏄剧ず寮瑰嚭灞�
       open: false,
       // 鏃ユ湡鑼冨洿
       dateRange: [],
-      // 鏌ヨ鍙傛暟
-      queryParams: {
-        dictName: undefined,
-        dictType: undefined,
-        status: 0
+      editSetting: {
+        title: '',
+        id: '',
+        show: false,
       },
-      items:items,
+      filterFrom: {},
+      items: [
+        {
+          type: 'text',
+          dataIndex: 'name',
+          label: '閮ㄩ棬鍚嶇О',
+          placeholder: '璇疯緭鍏�',
+          defaultValue: '',
+        },
+        {
+          type: 'text',
+          dataIndex: 'code',
+          label: '缂栧彿',
+          placeholder: '璇疯緭鍏�',
+          defaultValue: '',
+        },
+        {
+          type: 'select',
+          dataIndex: 'status',
+          label: '鐘舵��',
+          placeholder: '璇烽�夋嫨',
+          defaultValue: '0',
+          options: [
+            {
+              value: '0',
+              label: '鍚敤',
+            },
+            {
+              value: '1',
+              label: '绂佺敤',
+            },
+          ],
+        },
+      ],
       table: {
         showIndex: true, // 鏄惁鏄剧ず搴忓彿
         expand: false, // 鏄惁鏄剧ず璇︽儏鏁版嵁
-        url: SettingIplatform.apiBaseURL + '/system/dict/type/list', // 璇锋眰鍦板潃
+        url: SettingIplatform.apiBaseURL + '/pc/fin/sys/tenant/department/list', // 璇锋眰鍦板潃
         // 宸ュ叿鏉�
         tools: {
-          columnsCtrl: {// 鍒楁帶鍒舵寜閽�
-            show: false
+          columnsCtrl: {
+            // 鍒楁帶鍒舵寜閽�
+            show: false,
           },
-          generalExport: {// 閫氱敤瀵煎嚭鎸夐挳
-            show: false
+          generalExport: {
+            // 閫氱敤瀵煎嚭鎸夐挳
+            show: false,
           },
           // 鑷畾涔夊伐鍏锋潯鎸夐挳
           custom: [
-          {
+            {
               name: '鏂板',
               click: () => {
-                this.showAdd(null);
+                this.handleAdd(null);
               },
             },
-          ]
+          ],
         },
         // 鍒椾俊鎭�
         columns: [
-          {title: '缂栧彿', field: 'dict_id', align: 'center', width: '100px'},
-          {title: '閮ㄩ棬', field: 'dict_name', align: 'left'},
-          {title: '椤哄簭鍙�', field: 'dict_name', align: 'left'},
-          {title: '澶囨敞', field: 'remark', align: 'left', width: '200px'},
+          { title: '缂栧彿', field: 'code', align: 'center', width: '100px' },
+          { title: '閮ㄩ棬', field: 'name', align: 'left' },
+          { title: '椤哄簭鍙�', field: 'orderNum', align: 'left' },
+          { title: '澶囨敞', field: 'remark', align: 'left', width: '200px' },
           {
-            title: '鐘舵��', field: 'status', align: 'center', width: '180px',
-            formatter: row => {
-              return { value: row.status=== 0? '鍚敤':'绂佺敤'  }
-            }
+            title: '鐘舵��',
+            field: 'status',
+            align: 'center',
+            width: '180px',
+            formatter: (row) => {
+              return { value: row.status === 0 ? '鍚敤' : '绂佺敤' };
+            },
           },
         ],
         // 鎿嶄綔淇℃伅
         operation: {
-          // width: 150,
+          width: 150,
           align: 'center',
-          show: false, // 鏄剧ず鎿嶄綔鍒�
+          show: true, // 鏄剧ず鎿嶄綔鍒�
           attr: [
-            // 鍒嗙被涓嬫湁姝e湪杩涜涓殑椤圭洰鏃讹紝缁欏嚭鎻愮ず涓嶅厑璁哥鐢ㄥ拰鍒犻櫎銆備笖绂佺敤涓�绾у垎绫诲墠闇�瑕佸厛绂佺敤涓嬮潰鐨勬墍鏈変簩绾э紝鏈夊惎鐢ㄧ殑浜岀骇鏃朵笉鍏佽绂佺敤涓�绾�
             {
-              // checkPermission:'system:role:edit',
-              title: '淇敼',
-              events: row => {
-                this.handleUpdate(row)
-              }
+              title: '缂栬緫',
+              events: (row) => {
+                this.showEdit(row);
+              },
             },
-            // {
-            //   // checkPermission: 'system:role:remove',
-            //   title: '鍒犻櫎',
-            //   events: row => {
-            //     this.handleDelete(row)
-            //   }
-            // },
-          ]
+          ],
         },
         paging: {
           show: true, // 鏄剧ず鍒嗛〉
@@ -234,25 +164,14 @@
             small: false,
             pageNum: 1,
             pageSize: 10,
-            total: 0
-          }
-        }
+            total: 0,
+          },
+        },
       },
-      // 琛ㄥ崟鍙傛暟
-      form: {},
-      // 琛ㄥ崟鏍¢獙
-      rules: {
-        dictName: [
-          { required: true, message: "瀛楀吀鍚嶇О涓嶈兘涓虹┖", trigger: "blur" }
-        ],
-        dictType: [
-          { required: true, message: "瀛楀吀绫诲瀷涓嶈兘涓虹┖", trigger: "blur" }
-        ]
-      }
     };
   },
   created() {
-    this.initTreeData()
+    this.initTreeData();
   },
   methods: {
     // 宸︿晶鏍戝垵濮嬪寲
@@ -269,137 +188,53 @@
       });
     },
     nodeClick(param) {
-      console.log(param,'param');
-      this.search(1)
+      console.log(param, 'param');
+      this.p = Object.assign(
+        {},
+        {
+          id: param.id,
+          name: param.name,
+        },
+      );
+      if (this.p.id) {
+        this.filterFrom.tenantId = this.p.id;
+        this.editSetting.tenantId = this.p.id;
+      } else {
+        this.filterFrom.tenantId = null;
+        this.editSetting.tenantId = null;
+      }
+      this.search(1);
     },
     fifterForm(params) {
-      this.queryParams = Object.assign(this.queryParams, params)
-      this.search(1)
+      this.filterFrom = Object.assign(this.filterFrom, params);
+      this.search(1);
     },
     // 鏌ヨtable鍒楄〃
     search(pageNum) {
       if (pageNum != undefined) {
-        this.$refs.myTable.search(pageNum)
+        this.$refs.myTable.search(pageNum);
       } else {
-        this.$refs.myTable.search()
+        this.$refs.myTable.search();
       }
-    },
-    dateTo(val) {
-      return DateFormatter.LongToDateTime(val);
-    },
-    changeSize(e){
-      this.queryParams.pageSize = e
-      this.getList()
-    },
-    changePage(e){
-      this.queryParams.pageNum = e
-      this.getList()
-    },
-    /** 鏌ヨ瀛楀吀绫诲瀷鍒楄〃 */
-    getList() {
-      this.loading = true;
-      listType(this.queryParams).then(response => {
-          // this.typeList = response.rows;
-          this.typeList = response.datas;
-          this.total = response.totalRows;
-          this.loading = false;
-        }
-      );
-    },
-    // 鍙栨秷鎸夐挳
-    cancel() {
-      this.open = false;
-      this.reset();
-    },
-    // 琛ㄥ崟閲嶇疆
-    reset() {
-      this.form = {
-        dictId: undefined,
-        dictName: undefined,
-        dictType: undefined,
-        status: "0",
-        remark: undefined
-      };
-      this.resetForm("form");
-    },
-    /** 鎼滅储鎸夐挳鎿嶄綔 */
-    handleQuery() {
-      this.queryParams.pageNum = 1;
-      this.getList();
-    },
-    /** 閲嶇疆鎸夐挳鎿嶄綔 */
-    resetQuery() {
-      this.dateRange = [];
-      this.resetForm("queryForm");
-      this.handleQuery();
     },
     /** 鏂板鎸夐挳鎿嶄綔 */
     handleAdd() {
-      this.reset();
-      this.open = true;
-      this.title = "娣诲姞瀛楀吀绫诲瀷";
+      if (this.editSetting.tenantId) {
+        this.editSetting.id = null;
+        this.editSetting.info = null;
+        this.editSetting.title = '鏂板';
+        this.editSetting.show = true;
+      } else {
+        this.$message.warning('璇峰厛閫夋嫨宸︿晶鏈烘瀯');
+      }
     },
-    // 澶氶�夋閫変腑鏁版嵁
-    handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.dictId)
-      this.single = selection.length!=1
-      this.multiple = !selection.length
+    showEdit(row) {
+      console.log(row);
+      this.editSetting.id = row.id;
+      this.editSetting.info = row;
+      this.editSetting.title = '缂栬緫';
+      this.editSetting.show = true;
     },
-    /** 淇敼鎸夐挳鎿嶄綔 */
-    handleUpdate(row) {
-      this.reset();
-      const dictId = row.dict_id || this.ids
-      getType(dictId).then(response => {
-        this.form = response;
-        this.form.dictName = this.form.dict_name
-        this.form.dictType = this.form.dict_type
-        this.open = true;
-        this.title = "淇敼瀛楀吀绫诲瀷";
-      });
-    },
-    /** 鎻愪氦鎸夐挳 */
-    submitForm: function() {
-      this.$refs["form"].validate(valid => {
-        if (valid) {
-          if (this.form.dictId != undefined) {
-            updateType(this.form).then(response => {
-              this.$modal.msgSuccess("淇敼鎴愬姛");
-              this.open = false;
-              this.getList();
-            });
-          } else {
-            addType(this.form).then(response => {
-              this.$modal.msgSuccess("鏂板鎴愬姛");
-              this.open = false;
-              this.getList();
-            });
-          }
-        }
-      });
-    },
-    /** 鍒犻櫎鎸夐挳鎿嶄綔 */
-    handleDelete(row) {
-      const dictIds = row.dictId || this.ids;
-      this.$modal.confirm('鏄惁纭鍒犻櫎瀛楀吀缂栧彿涓�"' + dictIds + '"鐨勬暟鎹」锛�').then(function() {
-        return delType(dictIds);
-      }).then(() => {
-        this.getList();
-        this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
-      }).catch(() => {});
-    },
-    /** 瀵煎嚭鎸夐挳鎿嶄綔 */
-    handleExport() {
-      this.download('system/dict/type/export', {
-        ...this.queryParams
-      }, `type_${new Date().getTime()}.xlsx`)
-    },
-    /** 鍒锋柊缂撳瓨鎸夐挳鎿嶄綔 */
-    handleRefreshCache() {
-      refreshCache().then(() => {
-        this.$modal.msgSuccess("鍒锋柊鎴愬姛");
-        this.$store.dispatch('dict/cleanDict');
-      });
-    }
-  }
+  },
 };
 </script>

--
Gitblit v1.9.1