|
|
@@ -14,9 +14,22 @@
|
|
|
<div>
|
|
|
<uploads ref='upload' max="9" btn-text="点击进行文件上传" @before="before" @success="upload"
|
|
|
:loading='loading'
|
|
|
+ :data='dept'
|
|
|
action='/api/wutong-parse-file/import-excel/v1/parse-excel'
|
|
|
accept=".xls,.xlsx"/>
|
|
|
</div>
|
|
|
+ <span class='bold ml-10 mr-10'>项目所属机构:</span>
|
|
|
+ <div>
|
|
|
+ <el-autocomplete
|
|
|
+ v-model='deptName'
|
|
|
+ clearable
|
|
|
+ placeholder="快速搜索机构"
|
|
|
+ prefix-icon="Search"
|
|
|
+ :trigger-on-focus="false"
|
|
|
+ :fetch-suggestions="querySearchDept"
|
|
|
+ @select="handleSelectDept"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div class="flex flex-justify-start full-width">
|
|
|
<span class="font-12 mt-10"
|
|
|
@@ -105,10 +118,15 @@
|
|
|
<script>
|
|
|
import BaseButton from '@/components/base-button.vue'
|
|
|
import uploads from '@/components/uploads.vue'
|
|
|
+import { useStore } from '@/store/user.js'
|
|
|
|
|
|
export default {
|
|
|
name: 'form_dialog',
|
|
|
components: { BaseButton, uploads },
|
|
|
+ setup () {
|
|
|
+ const user = useStore()
|
|
|
+ return { user }
|
|
|
+ },
|
|
|
props: {
|
|
|
dialogType: {
|
|
|
type: String,
|
|
|
@@ -134,6 +152,9 @@ export default {
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
|
+ deptName: '',
|
|
|
+ deptList: [],
|
|
|
+ dept: null,
|
|
|
loading: false,
|
|
|
active: 0,
|
|
|
checked: true,
|
|
|
@@ -175,7 +196,6 @@ export default {
|
|
|
this.close()
|
|
|
},
|
|
|
before (files) {
|
|
|
- console.log(files)
|
|
|
this.attaches = files
|
|
|
},
|
|
|
removeFile (item) {
|
|
|
@@ -205,6 +225,14 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
importExcel () {
|
|
|
+ if (this.attaches && this.attaches.length === 0) {
|
|
|
+ this.$message.error('请选择要上传的文件')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.dept === null) {
|
|
|
+ this.$message.error('请选择项目所属机构')
|
|
|
+ return
|
|
|
+ }
|
|
|
this.loading = true
|
|
|
this.$message.success('正在导入,请稍后...')
|
|
|
this.$refs.upload.submit()
|
|
|
@@ -228,6 +256,23 @@ export default {
|
|
|
this.$message.error('未选择任何字段进行导出')
|
|
|
}
|
|
|
},
|
|
|
+ querySearchDept (key, cb) {
|
|
|
+ if (key && key.length === 0) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ setTimeout(() => {
|
|
|
+ const parentId = [1, 2].includes(this.user.info.viewStage) ? this.user.info.parentDeptId : this.user.info.deptId
|
|
|
+ this.$api.system.getDeptLazy({ deptName: key, parentId }).then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ const tmp = res.data.map(sub => {
|
|
|
+ const item = { value: sub.deptName, label: sub.deptName, deptId: sub.id }
|
|
|
+ return item
|
|
|
+ })
|
|
|
+ cb(tmp)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }, 500)
|
|
|
+ },
|
|
|
querySearch (string, cb) {
|
|
|
if (string && string.length === 0) {
|
|
|
return
|
|
|
@@ -244,6 +289,9 @@ export default {
|
|
|
})
|
|
|
}, 500)
|
|
|
},
|
|
|
+ handleSelectDept (item) {
|
|
|
+ this.dept = item
|
|
|
+ },
|
|
|
handleSelect (item) {
|
|
|
const sub = item
|
|
|
sub.search = true
|