scorpio 3 years ago
parent
commit
4b0468d68c

+ 6 - 56
src/components/basic-form/index.vue

@@ -4,68 +4,14 @@
              :label-width='option.hasOwnProperty("labelWidth") ? option.labelWidth : "150px" '
              class='form'>
       <!--      input-->
-      <el-col v-if='item.type ==="input" ' class='full-width'>
-        <div class='flex item full-width'>
-          <el-form-item class='full-width '>
-            <template v-slot:label>
-              <div class='label white-bg full-width padding-left text-left bold'>
-                {{ item.label }}
-              </div>
-            </template>
-            <div class='full-width text-left flex full-width'>
-              <input v-model='form[item.prop]' :disabled='option.detail' :placeholder='`请输入` + item.label'
-                     class='full-width'/>
-              <el-icon v-if='!option.detail' class="padding-right">
-                <edit/>
-              </el-icon>
-            </div>
-          </el-form-item>
-        </div>
-      </el-col>
-      <!--textarea-->
-      <el-col v-if='item.type ==="textarea" ' :style='`height:` + item.rows * 35 + `px`' class='full-width'>
-        <div class='flex item full-width'>
-          <el-form-item class='full-width '>
-            <template v-slot:label>
-              <div :style='`height:` + item.rows * 35 + `px`'
-                   class='label white-bg full-width text-left padding-left bold'>
-                {{ item.label }}
-              </div>
-            </template>
-            <div class='full-width flex flex-align-start full-height text-left full-width'
-                 style='white-space: pre-wrap;text-overflow: ellipsis;'>
-              <textarea v-model='form[item.prop]' :disabled='option.detail'
-                        :placeholder='`请输入` + item.label'
-                        :style='`height:` + item.rows * 35 + `px`'
-                        class='full-width padding-right full-height padding-top'
-                        style='line-height:20px;resize:none '/>
-              <el-icon v-if='!option.detail' class="padding-right padding-top">
-                <edit/>
-              </el-icon>
-            </div>
-          </el-form-item>
-        </div>
-      </el-col>
+      <xsub :option='option' :item='item'/>
       <!--row-->
       <el-col v-if='item.type === "row" ' :span='24' class='flex full-width '>
         <div class='flex full-width'>
           <div v-for='sub in item.children' :key='sub.label' class='full-width sub-item'>
             <el-col :span='24'>
               <div class='full-width item '>
-                <el-form-item class='full-width'>
-                  <template v-slot:label>
-                    <div class='label white-bg full-width text-left padding-left bold'>
-                      {{ sub.label }}
-                    </div>
-                  </template>
-                  <div class='full-width flex flex-center'>
-                    <input v-model='form[sub.prop]' :disabled='option.detail' :placeholder='`请输入` + sub.label'
-                           class='full-width'>
-                    <el-icon v-if='!option.detail' class="padding-left padding-right">
-                      <edit/>
-                    </el-icon>
-                  </div>
-                </el-form-item>
+                <xsub :option='option' :item='sub'/>
               </div>
             </el-col>
           </div>
@@ -76,12 +22,16 @@
 </template>
 
 <script>
+import sub from './sub.vue'
 export default {
   name: 'index',
   props: {
     option: Object,
     data: Object
   },
+  components: {
+    xsub: sub
+  },
   watch: {
     data: {
       handler (val) {

+ 92 - 0
src/components/basic-form/sub.vue

@@ -0,0 +1,92 @@
+<template>
+  <div>
+    <el-col v-if='item.type ==="input" ' class='full-width'>
+      <div class='flex item full-width'>
+        <el-form-item class='full-width '>
+          <template v-slot:label>
+            <div class='label white-bg full-width padding-left text-left bold'>
+              {{ item.label }}
+            </div>
+          </template>
+          <div class='full-width text-left flex full-width'>
+            <input v-model='form[item.prop]' :disabled='option.detail' :placeholder='`请输入` + item.label'
+                   class='full-width'/>
+            <el-icon v-if='!option.detail' class="padding-right">
+              <edit/>
+            </el-icon>
+          </div>
+        </el-form-item>
+      </div>
+    </el-col>
+    <!--textarea-->
+    <el-col v-if='item.type ==="textarea" ' :style='`height:` + item.rows * 35 + `px`' class='full-width'>
+      <div class='flex item full-width'>
+        <el-form-item class='full-width '>
+          <template v-slot:label>
+            <div :style='`height:` + item.rows * 35 + `px`'
+                 class='label white-bg full-width text-left padding-left bold'>
+              {{ item.label }}
+            </div>
+          </template>
+          <div class='full-width flex flex-align-start full-height text-left full-width'
+               style='white-space: pre-wrap;text-overflow: ellipsis;'>
+              <textarea v-model='form[item.prop]' :disabled='option.detail'
+                        :placeholder='`请输入` + item.label'
+                        :style='`height:` + item.rows * 35 + `px`'
+                        class='full-width padding-right full-height padding-top'
+                        style='line-height:20px;resize:none '/>
+            <el-icon v-if='!option.detail' class="padding-right padding-top">
+              <edit/>
+            </el-icon>
+          </div>
+        </el-form-item>
+      </div>
+    </el-col>
+<!--    autoinput-->
+    <el-col v-if='item.type ==="autoInput" ' :style='`height:` + item.rows * 35 + `px`' class='full-width'>
+      <div class='flex item full-width'>
+        <el-form-item class='full-width '>
+          <template v-slot:label>
+            <div :style='`height:` + item.rows * 35 + `px`'
+                 class='label white-bg full-width text-left padding-left bold'>
+              {{ item.label }}
+            </div>
+          </template>
+          <div class='full-width flex flex-align-start full-height text-left full-width'
+               style='white-space: pre-wrap;text-overflow: ellipsis;'>
+              <el-button>input</el-button>
+            <el-icon v-if='!option.detail' class="padding-right padding-top">
+              <edit/>
+            </el-icon>
+          </div>
+        </el-form-item>
+      </div>
+    </el-col>
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'sub',
+  props: {
+    option: {
+      type: Object,
+      default: null
+    },
+    item: {
+      type: Object,
+      default: null
+    }
+  },
+  data () {
+    return {
+      form: {},
+      disable: true
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 2 - 1
src/main.js

@@ -9,6 +9,7 @@ import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
 import * as wps from './assets/static/web-office-sdk-v1.1.19.es.js'
 import elementPlus from 'element-plus'
 import * as ElementPlusIconsVue from '@element-plus/icons-vue'
+import locale from 'element-plus/lib/locale/lang/zh-cn'
 import '@/assets/style/theme/index.scss'
 // import 'element-plus/dist/index.css'
 import 'animate.css'
@@ -33,5 +34,5 @@ myApp
   .use(pinia)
   .use(router)
   .use(Avue).use(bus)
-  .use(elementPlus, { size: 'default', zIndex: 300 })
+  .use(elementPlus, { locale, size: 'default', zIndex: 300 })
   .mount('#app')

+ 1 - 1
src/views/home/component/authorize.vue

@@ -35,7 +35,7 @@
     <div class='full-width flex flex-align-center mt-10'>
       <span class='font-14 bold'>生成授权连接</span>
       <el-button circle class='ml-20' icon="Picture" type="danger" @click='initCode'/>
-      <el-button circle icon="Paperclip" type="danger"/>
+<!--      <el-button circle icon="Paperclip" type="danger"/>-->
     </div>
     <div class='full-width mt-20 border-top padding-top flex flex-justify-end'>
       <el-button @click='close'>取消</el-button>

+ 103 - 50
src/views/home/component/dash.vue

@@ -15,7 +15,8 @@
           <span class="ml-15 sp1 mt-5">{{ item.projectNumber }}<span class="grey font-14 ml-5">个</span></span>
         </div>
       </div>
-      <base-button v-if='permissions.permissions.projectAdd' class="ml-20 mt-20" icon="Plus" title="新增" @click="showAdd = true"/>
+      <base-button v-if='permissions.permissions.projectAdd' class="ml-20 mt-20" icon="Plus" title="新增"
+                   @click="showAdd = true"/>
     </div>
     <avue-crud ref="crud"
                v-model="form"
@@ -41,23 +42,25 @@
                title="新增项目"
                width="35%">
       <div>
-        <el-form v-model="projectForm" class="lab mt-20" label-width="100px">
+        <el-form ref='form' :model="projectForm" class="lab mt-20" label-width="100px" :rules="rules">
           <div class="flex flex-center flex-col mr-20">
-            <el-form-item class="full-width" label="项目名称">
+            <el-form-item class="full-width" label="项目名称" prop='name'>
               <el-input
                   v-model="projectForm.name"
                   clearable
                   placeholder="输入项目名称"
               />
             </el-form-item>
-            <el-form-item class="full-width" label="项目总投">
+            <el-form-item class="full-width" label="项目总投" prop='totalAmount'>
               <el-input
                   v-model="projectForm.totalAmount"
                   clearable
-                  placeholder="输入项目总投"
-              />
+                  placeholder="输入项目总投(万元)"
+              >
+                <template #append>(万元)</template>
+              </el-input>
             </el-form-item>
-            <el-form-item class="full-width" label="项目类型">
+            <el-form-item class="full-width" label="项目类型" prop='projectType'>
               <el-select
                   v-model="projectForm.projectType"
                   clearable
@@ -72,13 +75,20 @@
                 />
               </el-select>
             </el-form-item>
-            <el-form-item class="full-width" label="项目标签">
+            <el-form-item class="full-width" label="项目标签" prop='tags'>
               <el-select
                   v-model="projectForm.tags"
                   clearable
                   placeholder="选择项目标签"
                   style="width: 100%"
-              />
+              >
+                <el-option
+                    v-for="item in tagsList"
+                    :key="item.dictKey"
+                    :label="item.dictValue"
+                    :value="item.dictKey"
+                />
+              </el-select>
             </el-form-item>
             <el-form-item class="full-width" label="建设内容">
               <el-input
@@ -103,16 +113,16 @@
 <script>
 import BaseButton from '../../../components/base-button.vue'
 import permissionStore from '@/store/permission.js'
-import {vaildData} from '@/utils/tools.js'
+import { vaildData } from '@/utils/tools.js'
 
 export default {
   name: 'dash',
-  components: {BaseButton},
-  setup() {
+  components: { BaseButton },
+  setup () {
     const permissions = permissionStore()
-    return {permissions}
+    return { permissions }
   },
-  data() {
+  data () {
     return {
       showAdd: false,
       active: 0,
@@ -147,21 +157,34 @@ export default {
           {
             label: '项目总投资(万元)',
             prop: 'totalAmount',
-            width: 180
+            width: 180,
+            type: 'number',
+            precision: 2,
+            formatter: (val, value, label) => {
+              return val.totalAmount.toLocaleString()
+            }
           },
           {
             label: '项目类型',
             prop: 'projectTypeName',
-            width: 240
+            type: 'select',
+            width: 240,
+            dicUrl: '/api/blade-system/dict-biz/dictionary?code=project-tags',
+            props: {
+              label: 'dictValue',
+              value: 'dictKey'
+            }
           },
           {
             label: '项目领域',
-            prop: 'dictName'
+            prop: 'dictName',
+            width: 240
           },
           {
             label: '发债时间',
             prop: 'issueDate',
             type: 'month',
+            width: 240,
             format: 'yyyy-MM',
             valueFormat: 'yyyy-MM'
           },
@@ -169,6 +192,7 @@ export default {
             label: '更新时间',
             prop: 'updateTime',
             type: 'month',
+            width: 240,
             format: 'yyyy-MM-dd',
             valueFormat: 'yyyy-MM-dd'
           }]
@@ -180,6 +204,7 @@ export default {
       },
       stage: [],
       typeList: [],
+      tagsList: [],
       num: '',
       projectForm: {
         name: '',
@@ -187,10 +212,29 @@ export default {
         projectType: '',
         tags: '',
         introduction: ''
+      },
+      rules: {
+        name: [
+          { required: true, message: '请输入项目名称', trigger: 'blur' }
+        ],
+        projectType: [
+          {
+            required: true,
+            message: '请选择项目类型',
+            trigger: 'change'
+          }
+        ],
+        tags: [
+          {
+            required: true,
+            message: '请选择项目标签',
+            trigger: 'change'
+          }
+        ]
       }
     }
   },
-  created() {
+  created () {
     this.getStageList()
     this.getTypeList()
     this.$bus.on('serach', (res) => {
@@ -198,16 +242,16 @@ export default {
     })
   },
   computed: {
-    permissionList() {
+    permissionList () {
       return {
         delBtn: vaildData(this.permissions.permissions.home_del, false)
       }
     }
   },
   methods: {
-    switchTab(item, index) {
+    switchTab (item, index) {
       this.active = index
-      this.onLoad({stageId: item.id === -1 ? '' : item.id})
+      this.onLoad({ stageId: item.id === -1 ? '' : item.id })
     },
     // track(id) {
     //   this.$router.push({
@@ -215,8 +259,8 @@ export default {
     //     query: {id: id, type: '1'}
     //   })
     // },
-    onLoad(query = {}) {
-      const data = {...query, ...this.page}
+    onLoad (query = {}) {
+      const data = { ...query, ...this.page }
       this.$api.project.projectList(data).then(res => {
         if (res.code === 200) {
           this.data = res.data.content
@@ -226,66 +270,75 @@ export default {
         }
       })
     },
-    beforeOpen(done, type) {
+    beforeOpen (done, type) {
       if (['view'].includes(type)) {
         this.$router.push({
           path: '/home/details',
-          query: {id: this.form.id, type: '0'}
+          query: { id: this.form.id, type: '0' }
         })
       } else if (type === 'edit') {
         this.$router.push({
           path: '/home/details',
-          query: {id: this.form.id, type: '1'}
+          query: { id: this.form.id, type: '1' }
         })
       }
     },
-    currentChange(currentPage) {
+    currentChange (currentPage) {
       this.page.currentPage = currentPage
     },
-    sizeChange(pageSize) {
+    sizeChange (pageSize) {
       this.page.pageSize = pageSize
     },
-    refreshChange() {
+    refreshChange () {
       this.onLoad(this.page, this.query)
     },
-    rowDel(row) {
+    rowDel (row) {
       this.$confirm('确定删除选择的项目?', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
       })
-          .then(() => {
-            this.$api.project.projectRemove({ids: row.id}).then(res => {
-              if (res.code === 200) {
-                this.$message.success(res.msg)
-                this.onLoad()
-              } else {
-                this.$message.error(res.msg)
-              }
-            })
+        .then(() => {
+          this.$api.project.projectRemove({ ids: row.id }).then(res => {
+            if (res.code === 200) {
+              this.$message.success(res.msg)
+              this.onLoad()
+            } else {
+              this.$message.error(res.msg)
+            }
           })
+        })
     },
-    getStageList() {
+    getStageList () {
       this.$api.project.userStageList().then(res => {
         if (res.code === 200) {
           this.stage = res.data
         }
       })
     },
-    getTypeList() {
+    getTypeList () {
       this.$api.project.typeList().then(res => {
         this.typeList = res.data.records
       })
-    },
-    projectSave() {
-      this.$api.project.projectAdd(this.projectForm).then(res => {
+      this.$api.common.dicList({ code: 'project-tags' }).then(res => {
         if (res.code === 200) {
-          this.showAdd = false
-          this.$message.success(res.msg)
-          this.onLoad()
-        } else {
-          this.showAdd = false
-          this.$message.error(res.msg)
+          this.tagsList = res.data
+        }
+      })
+    },
+    projectSave () {
+      this.$refs.form.validate((valid) => {
+        if (valid) {
+          this.$api.project.projectAdd(this.projectForm).then(res => {
+            if (res.code === 200) {
+              this.showAdd = false
+              this.$message.success(res.msg)
+              this.onLoad()
+            } else {
+              this.showAdd = false
+              this.$message.error(res.msg)
+            }
+          })
         }
       })
     }

+ 21 - 20
src/views/home/component/files_list.vue

@@ -16,6 +16,7 @@
           <img v-if="item.suffix === 'docx'" class="icon" src="../../../assets/svg/folder/doc.svg">
           <img v-else-if="item.suffix === 'pdf'" class="icon" src="../../../assets/svg/folder/pdf.svg">
           <img v-else-if="item.suffix === 'xlsx'" class="icon" src="../../../assets/svg/folder/xls.svg">
+          <img v-else class="icon" src="../../../assets/svg/folder/other.svg">
         </div>
         <span style="flex: 2">{{ item.title }}</span>
         <span style="flex: 1">{{ item.updateTime }}</span>
@@ -46,19 +47,19 @@
 
 <script>
 import mainButton from '../../../components/main-button.vue'
-import {bytesToSize} from '@/utils/tools.js'
-import {useStore} from '@/store/user.js'
+import { bytesToSize } from '@/utils/tools.js'
+import { useStore } from '@/store/user.js'
 import permissionStore from '@/store/permission.js'
 
 export default {
   name: 'files_list',
-  components: {mainButton},
+  components: { mainButton },
   props: {
     data: Object
   },
   watch: {
     data: {
-      handler(val) {
+      handler (val) {
         if (val === '' || val === null) {
           return
         }
@@ -85,12 +86,12 @@ export default {
       immediate: true
     }
   },
-  setup() {
+  setup () {
     const user = useStore()
     const permission = permissionStore()
-    return {user, permission}
+    return { user, permission }
   },
-  data() {
+  data () {
     return {
       files: [],
       showImage: false,
@@ -98,7 +99,7 @@ export default {
     }
   },
   methods: {
-    View(item) {
+    View (item) {
       if (['png', 'jpg'].includes(item.suffix)) {
         this.showImage = true
         this.imgList.push(item.url)
@@ -106,29 +107,29 @@ export default {
       }
       this.$router.push('/home/file_detail?id=' + item.fileId)
     },
-    downFile(item) {
+    downFile (item) {
       window.open(item.url, '')
     },
-    viewerClose() {
+    viewerClose () {
       this.showImage = false
       this.imgList = []
     },
-    removeFile(item) {
+    removeFile (item) {
       this.$confirm('确认是否删除该文件?', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
       })
-          .then(() => {
-            this.$api.project.fileRemove({ids: item.id}).then(res => {
-              if (res.code === 200) {
-                this.$bus.emit('delete')
-                this.$message.success(res.msg)
-              } else {
-                this.$message.error(res.msg)
-              }
-            })
+        .then(() => {
+          this.$api.project.fileRemove({ ids: item.id }).then(res => {
+            if (res.code === 200) {
+              this.$bus.emit('delete')
+              this.$message.success(res.msg)
+            } else {
+              this.$message.error(res.msg)
+            }
           })
+        })
     }
 
   }

+ 1 - 1
src/views/home/component/folder_info.vue

@@ -28,7 +28,7 @@
       </div>
       <div class="flex flex-center mr-5 " style="flex: 1.2">
         <base-button v-if='permissions.permissions.home_folder_new' icon="Plus" title="添加文件夹" type="0" @click="addShow = true"/>
-        <base-button v-if='permissions.permissions.home_folders_apply' class="ml-10" icon="User" title="批量授权"/>
+<!--        <base-button v-if='permissions.permissions.home_folders_apply' class="ml-10" icon="User" title="批量授权"/>-->
       </div>
     </div>
     <div class="mt-20">

+ 1 - 1
src/views/home/component/folder_list.vue

@@ -21,7 +21,7 @@
           <main-button v-if='[1,2].includes(item.isAccess)' icon="View" title="详情" width="85" @click="fileView(item)"/>
           <main-button v-if='permissions.permissions.home_folder_add  && item.isAccess === 2 ' icon="Upload" title="上传文件" width="85" @click="uploadFiles(item)"/>
           <main-button v-if="permissions.permissions.home_folder_authorize" icon="Pointer" title="授权操作" width="85" @click='getFileList(item)'/>
-          <main-button v-if="permissions.permissions.home_folder_apply" icon="Position" title="授权申请" width="85" @click="folderApply(item)"/>
+          <main-button v-if="permissions.permissions.home_folder_apply && item.isAccess === 3" icon="Position" title="授权申请" width="85" @click="folderApply(item)"/>
           <main-button v-if="permissions.permissions.home_folder_del" icon="Delete" title="删除" width="85" @click="folderRemove(item)"/>
         </div>
       </div>

+ 5 - 2
src/views/home/details.vue

@@ -1,7 +1,7 @@
 <template>
   <div class='flex flex-justify-start full-height'>
     <div class="full-height">
-      <left-bar :active="type === '0' ? -1 : 0 " :data="data" :stage="stage" @typeChange="typeChange"/>
+      <left-bar :active="type === '0' ? -1 : active " :data="data" :stage="stage" @typeChange="typeChange"/>
     </div>
     <div class="full-height full-width white-bg padding-left padding-top" style="margin-left: 300px">
       <proinfo v-if="type === '0'" :data="data" :issue="list" @refInfo="proInfo" @refresh="issueList"/>
@@ -41,7 +41,8 @@ export default {
       data: {},
       list: [],
       stage: [],
-      projectStageId: ''
+      projectStageId: '',
+      active: 0
     }
   },
   created () {
@@ -52,7 +53,9 @@ export default {
     this.getStage()
     this.$bus.on('change', (index) => {
       this.type = '1'
+      this.active = index
       this.projectStageId = this.stage[index] === undefined ? '' : this.stage[index].id
+      console.log(index)
     })
   },
   methods: {