|
@@ -1,8 +1,141 @@
|
|
|
<template>
|
|
|
- <div id="contact">
|
|
|
- <p>contact</p>
|
|
|
+ <div id="contactApply" v-loading="loading">
|
|
|
+ <custom-search-bar :fields="fields.filter((f) => f.isSearch)" v-model="searchForm" @search="search" @reset="toReset">
|
|
|
+ <template #status="{ item }">
|
|
|
+ <el-select v-model="searchForm[item.model]" clearable filterable :placeholder="$t('pages.contactApply.statusSelectPlaceholder')" style="width: 100%; min-width: 200px">
|
|
|
+ <el-option v-for="i in examStatusList" :key="i.id" :label="i.label" :value="i.value"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ </custom-search-bar>
|
|
|
+ <custom-button-bar :fields="buttonFields"></custom-button-bar>
|
|
|
+ <custom-table :data="data" :fields="fields" @query="search" :total="total" :opera="opera" @edit="toEdit" @exam="toExam">
|
|
|
+ <template #status="{ row }">
|
|
|
+ <el-tag v-if="row.status == '1'" type="success">{{ getDict(row.status, 'status') }}</el-tag>
|
|
|
+ <el-tag v-else-if="row.status == '0'" type="warning">{{ getDict(row.status, 'status') }}</el-tag>
|
|
|
+ <el-tag v-else-if="row.status == '-1'" type="danger">{{ getDict(row.status, 'status') }}</el-tag>
|
|
|
+ </template>
|
|
|
+ </custom-table>
|
|
|
+ <el-dialog v-model="dialog.show" :title="dialog.title" :destroy-on-close="false" @close="toClose">
|
|
|
+ <template v-if="dialog.type == '2'">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24">
|
|
|
+ <custom-desc v-model="form" :fields="statusFields"></custom-desc>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row style="text-align: center; padding-top: 20px" justify="center">
|
|
|
+ <el-col :span="6" style="">
|
|
|
+ <el-button type="success" @click="exam('1')">{{ $t('common.agree') }}</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6" style="text-align: center">
|
|
|
+ <el-button type="danger" @click="exam('-1')">{{ $t('common.refuse') }}</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
-<script setup></script>
|
|
|
+<script setup>
|
|
|
+//商协会
|
|
|
+import { ContactApplyStore } from '@/store/api/user/contactApply'
|
|
|
+import { DictDataStore } from '@/store/api/system/dictData'
|
|
|
+import { get, cloneDeep } from 'lodash-es'
|
|
|
+const store = ContactApplyStore()
|
|
|
+const dictDataStore = DictDataStore()
|
|
|
+const $checkRes = inject('$checkRes')
|
|
|
+let skip = 0
|
|
|
+const limit = inject('limit')
|
|
|
+const { t } = useI18n()
|
|
|
+// #region 列表页面设置
|
|
|
+const fields = [
|
|
|
+ { label: t('pages.contactApply.apply_user'), model: 'apply_user_name' },
|
|
|
+ { label: t('pages.contactApply.target_user'), model: 'target_user_name' },
|
|
|
+ { label: t('pages.contactApply.source'), model: 'sourceZh' },
|
|
|
+ { label: t('pages.contactApply.source_name'), model: 'source_name' },
|
|
|
+ { label: t('pages.contactApply.exam_admin'), model: 'exam_admin_name' },
|
|
|
+ { label: t('pages.contactApply.status'), model: 'status', custom: true }
|
|
|
+]
|
|
|
+const buttonFields = []
|
|
|
+const opera = [{ label: t('common.exam'), method: 'exam', type: 'warning', display: (i) => i.status !== '1' }]
|
|
|
+// #endregion
|
|
|
+
|
|
|
+// #region 列表操作
|
|
|
+const dialog = ref({ show: false })
|
|
|
+const toReset = async () => {
|
|
|
+ searchForm.value = {}
|
|
|
+ await search()
|
|
|
+}
|
|
|
+const toExam = (data) => {
|
|
|
+ form.value = cloneDeep(data)
|
|
|
+ dialog.value = { type: '2', show: true, title: t('pages.contactApply.examTitle') }
|
|
|
+}
|
|
|
+const toClose = () => {
|
|
|
+ form.value = {}
|
|
|
+ dialog.value = { show: false }
|
|
|
+}
|
|
|
+// #endregion
|
|
|
+
|
|
|
+// #region 表单
|
|
|
+const form = ref({})
|
|
|
+const statusFields = ref([
|
|
|
+ { label: t('pages.contactApply.apply_user'), model: 'apply_user_name' },
|
|
|
+ { label: t('pages.contactApply.target_user'), model: 'target_user_name' },
|
|
|
+ { label: t('pages.contactApply.source'), model: 'sourceZh' },
|
|
|
+ { label: t('pages.contactApply.source_name'), model: 'source_name' }
|
|
|
+])
|
|
|
+const exam = async (status) => {
|
|
|
+ const data = { id: get(form, 'value.id'), status }
|
|
|
+ const res = await store.examine(data)
|
|
|
+ if ($checkRes(res, true)) {
|
|
|
+ search({ skip, limit })
|
|
|
+ toClose()
|
|
|
+ }
|
|
|
+}
|
|
|
+// #endregion
|
|
|
+
|
|
|
+const loading = ref(false)
|
|
|
+onMounted(async () => {
|
|
|
+ loading.value = true
|
|
|
+ await searchOther()
|
|
|
+ await search({ skip, limit })
|
|
|
+ loading.value = false
|
|
|
+})
|
|
|
+// #region 字典表
|
|
|
+const examStatusList = ref([])
|
|
|
+const searchOther = async () => {
|
|
|
+ let result
|
|
|
+ result = await dictDataStore.query({ code: 'examStatus', is_use: '0' })
|
|
|
+ if ($checkRes(result)) examStatusList.value = result.data
|
|
|
+}
|
|
|
+const getDict = (data, type) => {
|
|
|
+ let list
|
|
|
+ let result
|
|
|
+ switch (type) {
|
|
|
+ case 'status':
|
|
|
+ list = examStatusList.value
|
|
|
+ break
|
|
|
+ default:
|
|
|
+ break
|
|
|
+ }
|
|
|
+ if (!list) return result
|
|
|
+ const i = list.find((f) => f.value === data)
|
|
|
+ if (!i) return result
|
|
|
+ return get(i, 'label')
|
|
|
+}
|
|
|
+// #endregion
|
|
|
+
|
|
|
+// #region 查询数据
|
|
|
+const searchForm = ref({})
|
|
|
+const data = ref([])
|
|
|
+const total = ref(0)
|
|
|
+const search = async (query = { skip, limit }) => {
|
|
|
+ const nq = { skip: get(query, 'skip'), limit: get(query, 'limit'), ...searchForm.value }
|
|
|
+ const res = await store.query(nq)
|
|
|
+ if ($checkRes(res)) {
|
|
|
+ data.value = get(res, 'data', [])
|
|
|
+ total.value = get(res, 'total', 0)
|
|
|
+ }
|
|
|
+}
|
|
|
+// #endregion
|
|
|
+</script>
|
|
|
<style scoped></style>
|