Browse Source

Merge branch 'feature/系统管理' into develop

ZZH-wl 2 years ago
parent
commit
7c7fd597ae

+ 3 - 0
src/api/system/post.js

@@ -6,6 +6,9 @@ export default {
   getList(query) {
     return micro_request.postRequest(basePath, 'Post', 'GetList', query)
   },
+  getEntityById(query) {
+    return micro_request.postRequest(basePath, 'Post', 'GetEntityById', query)
+  },
   doAdd(query) {
     return micro_request.postRequest(basePath, 'Post', 'Create', query)
   },

+ 37 - 4
src/components/select/SelectBusiness.vue

@@ -42,8 +42,23 @@
         :sortable="item.sortable"
         :width="item.width">
         <template #default="{ row }">
-          <span v-if="item.prop === 'custStatus'">
-            {{ row.custStatus == 10 ? '正常' : '异常' }}
+          <span v-if="item.prop === 'estTransPrice'">
+            {{ formatPrice(row.estTransPrice) }}
+          </span>
+          <span v-else-if="item.prop === 'approStatus'">
+            {{ selectDictLabel(approStatusOptions, row.approStatus) }}
+          </span>
+          <span v-else-if="item.prop === 'nboStatus'">
+            {{ selectDictLabel(nboStatusOptions, row.nboStatus) }}
+          </span>
+          <span v-else-if="item.prop === 'nboPhase'">
+            {{ selectDictLabel(nboPhaseOptions, row.nboPhase) }}
+          </span>
+          <span v-else-if="item.prop === 'finalFollowTime'">
+            {{ parseTime(row.finalFollowTime, '{y}-{m}-{d} {h}:{i}') }}
+          </span>
+          <span v-else-if="item.prop === 'nextFollowTime'">
+            {{ parseTime(row.nextFollowTime, '{y}-{m}-{d} {h}:{i}') }}
           </span>
           <span v-else>{{ row[item.prop] }}</span>
         </template>
@@ -131,7 +146,7 @@
           {
             label: '项目金额',
             width: 'auto',
-            prop: 'nboBudget',
+            prop: 'estTransPrice',
           },
           {
             label: '最后跟进时间',
@@ -149,6 +164,10 @@
         layout: 'total, sizes, prev, pager, next, jumper',
         total: 0,
         selectRows: [],
+        nboTypeOptions: [],
+        nboPhaseOptions: [],
+        nboStatusOptions: [],
+        approStatusOptions: [],
       }
     },
     computed: {
@@ -157,14 +176,28 @@
       },
     },
     mounted() {
-      this.fetchData()
+      this.getDicts('proj_nbo_type').then((response) => {
+        this.nboTypeOptions = response.data.values || []
+      })
+      this.getDicts('proj_nbo_phase').then((response) => {
+        this.nboPhaseOptions = response.data.values || []
+      })
+      this.getDicts('proj_nbo_status').then((response) => {
+        this.nboStatusOptions = response.data.values || []
+      })
+      this.getDicts('proj_appro_status').then((response) => {
+        this.approStatusOptions = response.data.values || []
+      })
+      // this.fetchData()
     },
     methods: {
       open() {
         this.innerVisible = true
+        this.fetchData()
       },
       close() {
         this.selectRows = []
+        this.$refs.businessTable.clearSelection()
       },
       save() {
         this.innerVisible = false

+ 16 - 3
src/components/select/SelectBusinessContact.vue

@@ -23,8 +23,11 @@
         :sortable="item.sortable"
         :width="item.width">
         <template #default="{ row }">
-          <span v-if="item.prop === 'custStatus'">
-            {{ row.custStatus == 10 ? '正常' : '异常' }}
+          <span v-if="item.prop === 'policy'">
+            {{ selectDictLabel(yesNoOptions, row.policy) }}
+          </span>
+          <span v-else-if="item.prop === 'cuctGender'">
+            {{ selectDictLabel(sexOptions, row.cuctGender) }}
           </span>
           <span v-else>{{ row[item.prop] }}</span>
         </template>
@@ -135,6 +138,8 @@
         layout: 'total, sizes, prev, pager, next, jumper',
         total: 0,
         selectRows: [],
+        sexOptions: [],
+        yesNoOptions: [],
       }
     },
     computed: {
@@ -142,7 +147,14 @@
         return this.columns.filter((item) => this.checkList.includes(item.label))
       },
     },
-    mounted() {},
+    mounted() {
+      this.getDicts('sys_sex').then((response) => {
+        this.sexOptions = response.data.values || []
+      })
+      this.getDicts('sys_yes_no').then((response) => {
+        this.yesNoOptions = response.data.values || []
+      })
+    },
     methods: {
       open() {
         this.innerVisible = true
@@ -150,6 +162,7 @@
       },
       close() {
         this.selectRows = []
+        this.$refs.contactTable.clearSelection()
       },
       save() {
         this.innerVisible = false

+ 6 - 1
src/components/select/SelectCustomer.vue

@@ -45,6 +45,9 @@
           <span v-if="item.prop === 'custStatus'">
             {{ row.custStatus == 10 ? '正常' : '异常' }}
           </span>
+          <span v-else-if="item.prop === 'createdTime'">
+            {{ parseTime(row.createdTime, '{y}-{m}-{d} {h}:{i}') }}
+          </span>
           <span v-else>{{ row[item.prop] }}</span>
         </template>
       </el-table-column>
@@ -161,14 +164,16 @@
       },
     },
     mounted() {
-      this.fetchData()
+      // this.fetchData()
     },
     methods: {
       open() {
         this.innerVisible = true
+        this.fetchData()
       },
       close() {
         this.selectRows = []
+        this.$refs.customerTable.clearSelection()
       },
       save() {
         this.innerVisible = false

+ 16 - 3
src/components/select/SelectCustomerContact.vue

@@ -42,8 +42,11 @@
         :sortable="item.sortable"
         :width="item.width">
         <template #default="{ row }">
-          <span v-if="item.prop === 'custStatus'">
-            {{ row.custStatus == 10 ? '正常' : '异常' }}
+          <span v-if="item.prop === 'policy'">
+            {{ selectDictLabel(yesNoOptions, row.policy) }}
+          </span>
+          <span v-else-if="item.prop === 'cuctGender'">
+            {{ selectDictLabel(sexOptions, row.cuctGender) }}
           </span>
           <span v-else>{{ row[item.prop] }}</span>
         </template>
@@ -157,6 +160,8 @@
         layout: 'total, sizes, prev, pager, next, jumper',
         total: 0,
         selectRows: [],
+        sexOptions: [],
+        yesNoOptions: [],
       }
     },
     computed: {
@@ -164,7 +169,14 @@
         return this.columns.filter((item) => this.checkList.includes(item.label))
       },
     },
-    mounted() {},
+    mounted() {
+      this.getDicts('sys_sex').then((response) => {
+        this.sexOptions = response.data.values || []
+      })
+      this.getDicts('sys_yes_no').then((response) => {
+        this.yesNoOptions = response.data.values || []
+      })
+    },
     methods: {
       open() {
         this.innerVisible = true
@@ -172,6 +184,7 @@
       },
       close() {
         this.selectRows = []
+        this.$refs.contactTable.clearSelection()
       },
       save() {
         this.innerVisible = false

+ 5 - 3
src/components/select/SelectDistributor.vue

@@ -37,8 +37,8 @@
         :sortable="item.sortable"
         :width="item.width">
         <template #default="{ row }">
-          <span v-if="item.prop === 'custStatus'">
-            {{ row.custStatus == 10 ? '正常' : '异常' }}
+          <span v-if="item.prop === 'createdTime'">
+            {{ parseTime(row.createdTime, '{y}-{m}-{d} {h}:{i}') }}
           </span>
           <span v-else>{{ row[item.prop] }}</span>
         </template>
@@ -157,14 +157,16 @@
       },
     },
     mounted() {
-      this.fetchData()
+      // this.fetchData()
     },
     methods: {
       open() {
         this.innerVisible = true
+        this.fetchData()
       },
       close() {
         this.selectRows = []
+        this.$refs.distributorTable.clearSelection()
       },
       save() {
         this.innerVisible = false

+ 5 - 3
src/components/select/SelectProduct.vue

@@ -37,8 +37,8 @@
         :sortable="item.sortable"
         :width="item.width">
         <template #default="{ row }">
-          <span v-if="item.prop === 'custStatus'">
-            {{ row.custStatus == 10 ? '正常' : '异常' }}
+          <span v-if="item.prop === 'createdTime'">
+            {{ parseTime(row.createdTime, '{y}-{m}-{d} {h}:{i}') }}
           </span>
           <span v-else>{{ row[item.prop] }}</span>
         </template>
@@ -158,14 +158,16 @@
       },
     },
     mounted() {
-      this.fetchData()
+      // this.fetchData()
     },
     methods: {
       open() {
         this.innerVisible = true
+        this.fetchData()
       },
       close() {
         this.selectRows = []
+        this.$refs.productTable.clearSelection()
       },
       save() {
         this.innerVisible = false

+ 2 - 1
src/main.js

@@ -13,13 +13,14 @@ import store from './store'
 import router from './router'
 import '@/vab'
 
-import { parseTime, translateDataToTree, resetForm, formatPrice } from '@/utils'
+import { parseTime, translateDataToTree, resetForm, formatPrice, selectDictLabel } from '@/utils'
 import dictApi from '@/api/system/dict'
 
 Vue.prototype.parseTime = parseTime
 Vue.prototype.translateDataToTree = translateDataToTree
 Vue.prototype.getDicts = dictApi.getDictDataByType
 Vue.prototype.resetForm = resetForm
+Vue.prototype.selectDictLabel = selectDictLabel
 Vue.prototype.formatPrice = formatPrice
 
 Vue.config.productionTip = false

+ 12 - 0
src/utils/index.js

@@ -275,3 +275,15 @@ export function formatPrice(price, currency = 'CNY') {
   if (!price) price = 0
   return price.toLocaleString('zh-CN', { style: 'currency', currency })
 }
+
+// 回显数据字典
+export function selectDictLabel(datas, value) {
+  var actions = []
+  Object.keys(datas).map((key) => {
+    if (datas[key].key == '' + value) {
+      actions.push(datas[key].value)
+      return false
+    }
+  })
+  return actions.join('')
+}

+ 1 - 1
src/views/proj/business/components/BusinessEdit.vue

@@ -72,7 +72,7 @@
         </el-col>
         <el-col :span="8">
           <el-form-item label="项目预算" prop="nboBudget">
-            <amount-input v-model.trim="form.nboBudget" placeholder="请输入金额" :value="form.nboBudget" />
+            <amount-input v-model.trim="form.nboBudget" placeholder="请输入金额" />
           </el-form-item>
         </el-col>
         <!--        <el-col :span="8">-->

+ 12 - 5
src/views/proj/business/components/BusinessGradation.vue

@@ -4,6 +4,13 @@
     <el-button :disabled="nboType === 'C'" type="danger" @click="handleClick('降级')">降级</el-button>
     <el-dialog :title="title" :visible.sync="dialogFormVisible" width="500px" @close="close">
       <el-form ref="form" label-width="80px" :model="form" :rules="rules">
+        <el-form-item label="项目类别" prop="nboType">
+          <el-select v-model="form.nboType" placeholder="请选择项目类别" style="width: 100%">
+            <el-option :disabled="nboType === 'A'" label="A" value="A" />
+            <el-option label="B" value="B" />
+            <el-option :disabled="nboType === 'C'" label="C" value="C" />
+          </el-select>
+        </el-form-item>
         <el-form-item label="备注信息" prop="remark">
           <el-input
             v-model="form.remark"
@@ -71,11 +78,11 @@
         this.dialogFormVisible = false
       },
       save() {
-        if ((this.title === '降级' && this.nboType === 'A') || (this.title === '升级' && this.nboType === 'C')) {
-          this.form.nboType = 'B'
-        } else {
-          this.form.nboType = this.title === '升级' ? 'A' : 'C'
-        }
+        // if ((this.title === '降级' && this.nboType === 'A') || (this.title === '升级' && this.nboType === 'C')) {
+        //   this.form.nboType = 'B'
+        // } else {
+        //   this.form.nboType = this.title === '升级' ? 'A' : 'C'
+        // }
         this.$baseConfirm('你确定要对当前项目' + this.title + '吗', null, async () => {
           const { msg } = await businessApi.businessGradation(this.form)
           this.$baseMessage(msg, 'success')

+ 2 - 0
src/views/proj/business/components/DetailsContact.vue

@@ -115,6 +115,7 @@
           const { msg } = await businessContactApi.doAdd(form)
           this.$baseMessage(msg, 'success')
           await this.fetchData()
+          this.$emit('fetch-data')
         }
       },
       handleDisassociation() {
@@ -124,6 +125,7 @@
             const { msg } = await businessContactApi.doDelete({ ids })
             this.$baseMessage(msg, 'success')
             await this.fetchData()
+            this.$emit('fetch-data')
           })
         } else {
           this.$baseMessage('未选中任何行', 'error')

+ 8 - 3
src/views/proj/business/detail.vue

@@ -61,7 +61,7 @@
                 {{ details.contactTelephone }}
               </el-descriptions-item>
               <el-descriptions-item label="销售模式">
-                {{ details.salesModel }}
+                {{ selectDictLabel(salesModelOptions, details.salesModel) }}
               </el-descriptions-item>
               <el-descriptions-item label="经销商/代理商">
                 {{ details.distributorName }}
@@ -108,7 +108,7 @@
               :bus-id="id"
               :customer-info="{ custId: details.custId, custName: details.custName }"
               :primacy-contact-id="details.contactId"
-              @fetch-data="init" />
+              @fetch-data="getRecord" />
           </el-tab-pane>
           <el-tab-pane label="合同记录" name="contract">
             <details-contract ref="detailsContract" :bus-id="id" />
@@ -134,6 +134,7 @@
         <div class="buttons">
           <el-button type="primary" @click="handleEdit">编辑</el-button>
           <el-button @click="handleDelete">删除</el-button>
+          <el-button @click="$router.go(-1)">返回</el-button>
         </div>
         <details-records :dynamics-list="dynamicsList" />
       </div>
@@ -186,6 +187,7 @@
         belongLoading: false,
         belongTotal: 0,
         belongs: [],
+        salesModelOptions: [],
       }
     },
     computed: {
@@ -199,6 +201,9 @@
     },
     mounted() {
       this.init()
+      this.getDicts('proj_sales_model').then((response) => {
+        this.salesModelOptions = response.data.values || []
+      })
     },
     methods: {
       init() {
@@ -290,7 +295,7 @@
 <style lang="scss" scoped>
   $base: '.details';
   #{$base} {
-    height: calc(100vh - 60px - 50px - 12px * 2 - 40px);
+    height: calc(100vh - 60px - 12px * 2 - 40px);
     display: flex;
     padding: 20px 40px;
 

+ 24 - 2
src/views/proj/business/index.vue

@@ -78,7 +78,21 @@
           <span v-else-if="item.prop === 'estTransPrice'">
             {{ formatPrice(row.estTransPrice) }}
           </span>
-          <span v-else-if="item.prop === 'approStatus'"></span>
+          <span v-else-if="item.prop === 'approStatus'">
+            {{ selectDictLabel(approStatusOptions, row.approStatus) }}
+          </span>
+          <span v-else-if="item.prop === 'nboStatus'">
+            {{ selectDictLabel(nboStatusOptions, row.nboStatus) }}
+          </span>
+          <span v-else-if="item.prop === 'nboPhase'">
+            {{ selectDictLabel(nboPhaseOptions, row.nboPhase) }}
+          </span>
+          <span v-else-if="item.prop === 'finalFollowTime'">
+            {{ parseTime(row.finalFollowTime, '{y}-{m}-{d} {h}:{i}') }}
+          </span>
+          <span v-else-if="item.prop === 'nextFollowTime'">
+            {{ parseTime(row.nextFollowTime, '{y}-{m}-{d} {h}:{i}') }}
+          </span>
           <span v-else>{{ row[item.prop] }}</span>
         </template>
       </el-table-column>
@@ -146,7 +160,7 @@
           {
             label: '项目状态',
             width: '120px',
-            prop: 'nboPhase',
+            prop: 'nboStatus',
           },
           {
             label: '项目类别',
@@ -183,6 +197,8 @@
           saleName: undefined,
         },
         nboTypeOptions: [],
+        nboPhaseOptions: [],
+        nboStatusOptions: [],
         approStatusOptions: [],
         followup: {},
       }
@@ -197,6 +213,12 @@
       this.getDicts('proj_nbo_type').then((response) => {
         this.nboTypeOptions = response.data.values || []
       })
+      this.getDicts('proj_nbo_phase').then((response) => {
+        this.nboPhaseOptions = response.data.values || []
+      })
+      this.getDicts('proj_nbo_status').then((response) => {
+        this.nboStatusOptions = response.data.values || []
+      })
       this.getDicts('proj_appro_status').then((response) => {
         this.approStatusOptions = response.data.values || []
       })

+ 1 - 0
src/views/system/dict/components/DataEdit.vue

@@ -62,6 +62,7 @@
         form: {
           dictSort: 1,
           status: '10',
+          isDefault: '20',
         },
         rules: {
           dictLabel: [{ required: true, message: '数据标签不能为空', trigger: 'blur' }],

+ 1 - 1
src/views/system/group/index.vue

@@ -28,7 +28,7 @@
 
     <el-table v-loading="listLoading" border :data="list" :height="height" @selection-change="setSelectRows">
       <el-table-column align="center" show-overflow-tooltip type="selection" />
-      <el-table-column align="center" label="用户组编号" prop="id" show-overflow-tooltip />
+      <!--      <el-table-column align="center" label="用户组编号" prop="id" show-overflow-tooltip />-->
       <el-table-column align="center" label="用户组名称" prop="groupName" show-overflow-tooltip />
       <el-table-column align="center" label="用户组编码" prop="groupCode" show-overflow-tooltip />
       <el-table-column align="center" label="状态" prop="status">

+ 19 - 1
src/views/system/post/components/PostEdit.vue

@@ -18,6 +18,11 @@
           </el-radio-group>
         </el-radio-group>
       </el-form-item>
+      <el-form-item label="角色">
+        <el-select v-model="form.roleIds" multiple placeholder="请选择" style="width: 100%">
+          <el-option v-for="item in roleOptions" :key="item.id" :label="item.roleName" :value="item.id" />
+        </el-select>
+      </el-form-item>
       <el-form-item label="备注" prop="remark">
         <el-input v-model="form.remark" placeholder="请输入内容" type="textarea" />
       </el-form-item>
@@ -31,6 +36,7 @@
 
 <script>
   import postApi from '@/api/system/post'
+  import roleApi from '@/api/system/role'
 
   export default {
     name: 'PostEdit',
@@ -43,18 +49,30 @@
         },
         title: '',
         dialogFormVisible: false,
+        // 角色选项
+        roleOptions: [],
       }
     },
+    mounted() {
+      // 获取角色
+      roleApi.getList({ status: '10' }).then((response) => {
+        this.roleOptions = response.data.list
+      })
+    },
     methods: {
       showEdit(row) {
         if (!row) {
           this.title = '添加'
         } else {
           this.title = '编辑'
-          this.form = Object.assign({}, row)
+          this.getDetailsInfo(row.id)
         }
         this.dialogFormVisible = true
       },
+      async getDetailsInfo(id) {
+        const { data: data } = await postApi.getEntityById({ id: id })
+        this.form = data
+      },
       close() {
         this.$refs['form'].resetFields()
         this.form = this.$options.data().form

+ 1 - 1
src/views/system/post/index.vue

@@ -28,7 +28,7 @@
 
     <el-table v-loading="listLoading" border :data="list" :height="height" @selection-change="setSelectRows">
       <el-table-column align="center" show-overflow-tooltip type="selection" />
-      <el-table-column align="center" label="岗位编号" prop="id" show-overflow-tooltip />
+      <!--      <el-table-column align="center" label="岗位编号" prop="id" show-overflow-tooltip />-->
       <el-table-column align="center" label="岗位名称" prop="postName" show-overflow-tooltip />
       <el-table-column align="center" label="岗位编码" prop="postCode" show-overflow-tooltip />
       <el-table-column align="center" label="状态" prop="status">

+ 8 - 8
src/views/system/user/index.vue

@@ -54,14 +54,14 @@
           <el-table-column align="center" label="昵称" prop="nickName" show-overflow-tooltip />
           <el-table-column align="center" label="手机号" prop="phone" show-overflow-tooltip />
           <el-table-column align="center" label="邮箱" prop="email" show-overflow-tooltip />
-          <el-table-column align="center" label="部门" prop="email" show-overflow-tooltip />
-          <el-table-column align="center" label="角色" show-overflow-tooltip>
-            <template #default="{ row }">
-              <el-tag v-for="(item, index) in row.roles" :key="index">
-                {{ item }}
-              </el-tag>
-            </template>
-          </el-table-column>
+          <el-table-column align="center" label="部门" prop="deptName" show-overflow-tooltip />
+          <!--          <el-table-column align="center" label="角色" show-overflow-tooltip>-->
+          <!--            <template #default="{ row }">-->
+          <!--              <el-tag v-for="(item, index) in row.roles" :key="index">-->
+          <!--                {{ item }}-->
+          <!--              </el-tag>-->
+          <!--            </template>-->
+          <!--          </el-table-column>-->
 
           <el-table-column align="center" label="创建时间" prop="createdTime">
             <template #default="scope">