From 5506edbe54883b31db3cc8e4a1d9d0795a18a3c9 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期五, 27 十二月 2024 14:37:54 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/2.0.1' into 2.0.1

---
 company/src/components/business/OperaCompanyUserApplyWindow.vue |  247 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 247 insertions(+), 0 deletions(-)

diff --git a/company/src/components/business/OperaCompanyUserApplyWindow.vue b/company/src/components/business/OperaCompanyUserApplyWindow.vue
new file mode 100644
index 0000000..17e1d39
--- /dev/null
+++ b/company/src/components/business/OperaCompanyUserApplyWindow.vue
@@ -0,0 +1,247 @@
+<template>
+    <GlobalWindow
+        :title="title"
+        width="50%"
+        :visible.sync="visible"
+        :confirm-working="isWorking"
+        @confirm="confirm"
+    >
+        <el-form :model="form" ref="form" :rules="rules">
+            <el-form-item label="鎺堟潈璐﹀彿" prop="userId">
+                <el-select v-model="form.userId" filterable placeholder="璇烽�夋嫨">
+                    <el-option
+                        v-for="item in account"
+                        :key="item.id"
+                        :label="item.username"
+                        :value="item.id">
+                    </el-option>
+                </el-select>
+            </el-form-item>
+            <el-form-item label="鐢宠鎺堟潈浼佷笟" prop="companyIds">
+                <el-select
+                    v-model="form.companyIds"
+                    multiple
+                    filterable
+                    placeholder="璇烽�夋嫨">
+                    <el-option
+                        v-for="item in company"
+                        :key="item.id"
+                        :label="item.name"
+                        :value="item.id">
+                    </el-option>
+                </el-select>
+            </el-form-item>
+            <el-form-item label="鐢宠璇存槑" prop="content">
+                <el-input
+                    type="textarea"
+                    placeholder="璇疯緭鍏ョ敵璇疯鏄�"
+                    v-model="form.content"
+                    maxlength="300"
+                    show-word-limit />
+            </el-form-item>
+            <el-form-item label="鎺堟潈涔�" prop="multifileList">
+                <UploadFile v-if="visible" @remove="deleFile" :limit="99" :uploadData="{ folder: 'companyUserApply', fileType:'.pdf' }" :fileList="fileList" @uploadSuccess="editFanganFile" />
+            </el-form-item>
+        </el-form>
+    </GlobalWindow>
+</template>
+
+<script>
+  import BaseOpera from '@/components/base/BaseOpera'
+  import GlobalWindow from '@/components/common/GlobalWindow'
+  import UploadFile from '@/components/common/UploadFile'
+  import { findUserList } from '@/api/system/user'
+  import { findAllCompanyList } from '@/api/business/company'
+  export default {
+    name: 'OperaCompanyUserApplyWindow',
+    extends: BaseOpera,
+    components: { GlobalWindow, UploadFile },
+    data () {
+      return {
+        // 琛ㄥ崟鏁版嵁
+        form: {
+          id: null,
+          userId: '',
+          content: '',
+          companyIds: [],
+          multifileList: []
+        },
+        // 楠岃瘉瑙勫垯
+        rules: {
+          multifileList: [
+            { required: true, message: '璇蜂笂浼犳巿鏉冧功' }
+          ],
+          companyIds: [
+            { required: true, message: '璇烽�夋嫨鎺堟潈浼佷笟' }
+          ],
+          userId: [
+            { required: true, message: '璇烽�夋嫨鎺堟潈璐﹀彿' }
+          ]
+        },
+        account: [],
+        fileList: [],
+        company: []
+      }
+    },
+    created () {
+      this.config({
+        api: '/business/companyUserApply',
+        'field.id': 'id'
+      })
+    },
+    methods: {
+      __confirmCreate () {
+        this.$refs.form.validate((valid) => {
+          if (!valid) {
+            return
+          }
+          let obj = JSON.parse(JSON.stringify(this.form))
+          obj.companyIds = obj.companyIds.join(',')
+          obj.companyNames = []
+          this.form.companyIds.forEach(item => {
+            this.company.forEach(row => {
+              if (item === row.id) {
+                obj.companyNames.push(row.name)
+              }
+            })
+          })
+          obj.companyNames = obj.companyNames.join(',')
+          this.isWorking = true
+          this.api.create(obj)
+            .then(() => {
+              this.visible = false
+              this.$tip.apiSuccess('鏂板缓鎴愬姛')
+              this.$emit('success')
+            })
+            .catch(e => {
+              this.$tip.apiFailed(e)
+            })
+            .finally(() => {
+              this.isWorking = false
+            })
+        })
+      },
+      // 纭淇敼
+      __confirmEdit () {
+        this.$refs.form.validate((valid) => {
+          if (!valid) {
+            return
+          }
+          let obj = JSON.parse(JSON.stringify(this.form))
+          obj.companyIds = obj.companyIds.join(',')
+          obj.companyNames = []
+          this.form.companyIds.forEach(item => {
+            this.company.forEach(row => {
+              if (item === row.id) {
+                obj.companyNames.push(row.name)
+              }
+            })
+          })
+          obj.companyNames = obj.companyNames.join(',')
+          this.isWorking = true
+          this.api.updateById(obj)
+            .then(() => {
+              this.visible = false
+              this.$tip.apiSuccess('淇敼鎴愬姛')
+              this.$emit('success')
+            })
+            .catch(e => {
+              this.$tip.apiFailed(e)
+            })
+            .finally(() => {
+              this.isWorking = false
+            })
+        })
+      },
+      open (title, target) {
+        this.title = title
+        this.visible = true
+        this.getAccount()
+        this.getFindAllCompanyList()
+        // 鏂板缓
+        if (target == null) {
+          this.$nextTick(() => {
+            this.$refs.form.resetFields()
+            this.form[this.configData['field.id']] = null
+          })
+          return
+        }
+        // 缂栬緫
+        this.$nextTick(() => {
+          for (const key in this.form) {
+            this.form[key] = target[key]
+          }
+        })
+      },
+      deleFile (imgaddr) {
+        this.form.multifileList.forEach((item, index) => {
+          if (item.imgaddr === imgaddr) {
+            this.form.multifileList.splice(index, 1)
+          }
+        })
+      },
+      editFanganFile (data) {
+        this.form.multifileList.push(data)
+      },
+      getAccount() {
+        findUserList({})
+          .then(res => {
+            console.log(res)
+            this.account = res
+          })
+      },
+      getFindAllCompanyList() {
+        findAllCompanyList({})
+          .then(res => {
+            console.log(res)
+            this.company = res
+          })
+      }
+    }
+  }
+</script>
+
+<style lang="scss" scoped>
+    .list {
+        width: 100%;
+        padding: 10px 16px;
+        box-sizing: border-box;
+        background: #F4F7FC;
+        border-radius: 2px;
+        border: 1px solid #DFE2E8;
+        margin-top: 10px;
+        .list_label {
+            font-weight: 400;
+            font-size: 13px;
+            color: #333333;
+        }
+        .list_box {
+            width: 100%;
+            display: flex;
+            align-items: center;
+            flex-wrap: wrap;
+            .list_box_row {
+                padding: 0 10px;
+                box-sizing: border-box;
+                background: #FFFFFF;
+                border-radius: 2px;
+                display: flex;
+                align-items: center;
+                margin-right: 10px;
+                &:last-child {
+                    margin: 0 !important;
+                }
+                span {
+                    font-weight: 400;
+                    font-size: 12px;
+                    color: #3F4F69;
+                    margin-right: 12px;
+                }
+                i {
+                    color: #BFC3CB;
+                    cursor: pointer;
+                }
+            }
+        }
+    }
+</style>

--
Gitblit v1.9.3