Commit 96d61a511c6b25da257f6c13fcc878d679db4e86
1 parent
9dd13ed7
更新
Showing
24 changed files
with
1679 additions
and
307 deletions
antis-ncc-admin/src/views/tbAreaLine/Form.vue
| 1 | 1 | <template> |
| 2 | - <el-dialog :title="!dataForm.id ? '新建' : isDetail ? '详情':'编辑'" :close-on-click-modal="false" :visible.sync="visible" class="NCC-dialog NCC-dialog_center" lock-scroll width="600px"> | |
| 3 | - <el-row :gutter="15" class="" > | |
| 4 | - <el-form ref="elForm" :model="dataForm" size="small" label-width="100px" label-position="right" :disabled="!!isDetail" :rules="rules"> | |
| 5 | - <el-col :span="24"> | |
| 6 | - <el-form-item label="地域" prop="areaId"> | |
| 7 | - <el-select v-model="dataForm.areaId" placeholder="请选择" clearable required :style='{"width":"100%"}' > | |
| 8 | - <el-option v-for="(item, index) in areaIdOptions" :key="index" :label="item.F_Name" :value="item.F_Id" ></el-option> | |
| 9 | - </el-select> | |
| 10 | - </el-form-item> | |
| 11 | - </el-col> | |
| 12 | - <el-col :span="24"> | |
| 13 | - <el-form-item label="线路标题" prop="title"> | |
| 14 | - <el-input v-model="dataForm.title" placeholder="请输入" clearable required :style='{"width":"100%"}' > | |
| 15 | - </el-input> | |
| 16 | - </el-form-item> | |
| 17 | - </el-col> | |
| 18 | - <el-col :span="24"> | |
| 19 | - <el-form-item label="线路概况" prop="remark"> | |
| 20 | - <el-input v-model="dataForm.remark" placeholder="请输入" required show-word-limit :style='{"width":"100%"}' type='textarea' :autosize='{"minRows":4,"maxRows":4}' > | |
| 21 | - </el-input> | |
| 22 | - </el-form-item> | |
| 23 | - </el-col> | |
| 24 | - <el-col :span="24"> | |
| 25 | - <el-form-item label="线路图片" prop="banner"> | |
| 26 | - <NCC-UploadImg v-model="dataForm.banner" required :fileSize="5" sizeUnit="MB" :limit="1" > | |
| 27 | - </NCC-UploadImg> | |
| 28 | - </el-form-item> | |
| 29 | - </el-col> | |
| 30 | - <el-col :span="24" v-if="false" > | |
| 31 | - <el-form-item label="创建时间" prop="creatorTime"> | |
| 32 | - <el-input v-model="dataForm.creatorTime" placeholder="系统自动生成" readonly > | |
| 33 | - </el-input> | |
| 34 | - </el-form-item> | |
| 35 | - </el-col> | |
| 36 | - <el-col :span="24" v-if="false" > | |
| 37 | - <el-form-item label="修改时间" prop="lastModifyTime"> | |
| 38 | - <el-input v-model="dataForm.lastModifyTime" placeholder="系统自动生成" readonly > | |
| 39 | - </el-input> | |
| 40 | - </el-form-item> | |
| 41 | - </el-col> | |
| 42 | - </el-form> | |
| 2 | + <el-dialog :title="!dataForm.id ? '新建' : isDetail ? '详情':'编辑'" :close-on-click-modal="false" | |
| 3 | + :visible.sync="visible" class="NCC-dialog NCC-dialog_center" lock-scroll width="600px"> | |
| 4 | + <el-row :gutter="15" class=""> | |
| 5 | + <el-form ref="elForm" :model="dataForm" size="small" label-width="100px" label-position="right" | |
| 6 | + :disabled="!!isDetail" :rules="rules"> | |
| 7 | + <el-col :span="24"> | |
| 8 | + <el-form-item label="地域" prop="areaId"> | |
| 9 | + <el-select v-model="dataForm.areaId" placeholder="请选择" clearable required | |
| 10 | + :style='{"width":"100%"}'> | |
| 11 | + <el-option v-for="(item, index) in areaIdOptions" :key="index" :label="item.F_Name" | |
| 12 | + :value="item.F_Id"></el-option> | |
| 13 | + </el-select> | |
| 14 | + </el-form-item> | |
| 15 | + </el-col> | |
| 16 | + <el-col :span="24"> | |
| 17 | + <el-form-item label="线路标题" prop="title"> | |
| 18 | + <el-input v-model="dataForm.title" placeholder="请输入" clearable required | |
| 19 | + :style='{"width":"100%"}'> | |
| 20 | + </el-input> | |
| 21 | + </el-form-item> | |
| 22 | + </el-col> | |
| 23 | + <el-col :span="24"> | |
| 24 | + <el-form-item label="线路概况" prop="remark"> | |
| 25 | + <el-input v-model="dataForm.remark" placeholder="请输入" required show-word-limit | |
| 26 | + :style='{"width":"100%"}' type='textarea' :autosize='{"minRows":4,"maxRows":4}'> | |
| 27 | + </el-input> | |
| 28 | + </el-form-item> | |
| 29 | + </el-col> | |
| 30 | + <el-col :span="24"> | |
| 31 | + <el-form-item label="线路图片" prop="banner"> | |
| 32 | + <NCC-UploadImg v-model="dataForm.banner" required :fileSize="5" sizeUnit="MB" :limit="1"> | |
| 33 | + </NCC-UploadImg> | |
| 34 | + </el-form-item> | |
| 35 | + </el-col> | |
| 36 | + <el-col :span="24"> | |
| 37 | + <el-form-item label="百分比%" prop="ratio"> | |
| 38 | + <el-input v-model="dataForm.ratio" placeholder="请输入" clearable required | |
| 39 | + :style='{"width":"100%"}'> | |
| 40 | + </el-input> | |
| 41 | + </el-form-item> | |
| 42 | + </el-col> | |
| 43 | + <el-col :span="24" v-if="false"> | |
| 44 | + <el-form-item label="创建时间" prop="creatorTime"> | |
| 45 | + <el-input v-model="dataForm.creatorTime" placeholder="系统自动生成" readonly> | |
| 46 | + </el-input> | |
| 47 | + </el-form-item> | |
| 48 | + </el-col> | |
| 49 | + <el-col :span="24" v-if="false"> | |
| 50 | + <el-form-item label="修改时间" prop="lastModifyTime"> | |
| 51 | + <el-input v-model="dataForm.lastModifyTime" placeholder="系统自动生成" readonly> | |
| 52 | + </el-input> | |
| 53 | + </el-form-item> | |
| 54 | + </el-col> | |
| 55 | + </el-form> | |
| 43 | 56 | </el-row> |
| 44 | 57 | <span slot="footer" class="dialog-footer"> |
| 45 | 58 | <el-button @click="visible = false">取 消</el-button> |
| ... | ... | @@ -49,8 +62,12 @@ |
| 49 | 62 | </template> |
| 50 | 63 | <script> |
| 51 | 64 | import request from '@/utils/request' |
| 52 | - import { getDictionaryDataSelector } from '@/api/systemData/dictionary' | |
| 53 | - import { previewDataInterface } from '@/api/systemData/dataInterface' | |
| 65 | + import { | |
| 66 | + getDictionaryDataSelector | |
| 67 | + } from '@/api/systemData/dictionary' | |
| 68 | + import { | |
| 69 | + previewDataInterface | |
| 70 | + } from '@/api/systemData/dataInterface' | |
| 54 | 71 | export default { |
| 55 | 72 | components: {}, |
| 56 | 73 | props: [], |
| ... | ... | @@ -60,118 +77,122 @@ |
| 60 | 77 | visible: false, |
| 61 | 78 | isDetail: false, |
| 62 | 79 | dataForm: { |
| 63 | - id:'', | |
| 64 | - areaId:undefined, | |
| 65 | - title:undefined, | |
| 66 | - remark:undefined, | |
| 67 | - banner:[], | |
| 68 | - creatorTime:undefined, | |
| 69 | - lastModifyTime:undefined, | |
| 80 | + id: '', | |
| 81 | + areaId: undefined, | |
| 82 | + title: undefined, | |
| 83 | + remark: undefined, | |
| 84 | + ratio: undefined, | |
| 85 | + | |
| 86 | + banner: [], | |
| 87 | + creatorTime: undefined, | |
| 88 | + lastModifyTime: undefined, | |
| 70 | 89 | }, |
| 71 | 90 | rules: { |
| 72 | - areaId:[ | |
| 73 | - { | |
| 74 | - required:true, | |
| 75 | - message:'请输入地域', | |
| 76 | - trigger:'change' | |
| 77 | - }, | |
| 78 | - ], | |
| 79 | - title:[ | |
| 80 | - { | |
| 81 | - required:true, | |
| 82 | - message:'请输入线路标题', | |
| 83 | - trigger:'blur' | |
| 91 | + areaId: [{ | |
| 92 | + required: true, | |
| 93 | + message: '请输入地域', | |
| 94 | + trigger: 'change' | |
| 95 | + }, ], | |
| 96 | + title: [{ | |
| 97 | + required: true, | |
| 98 | + message: '请输入线路标题', | |
| 99 | + trigger: 'blur' | |
| 100 | + }, ], | |
| 101 | + remark: [{ | |
| 102 | + required: true, | |
| 103 | + message: '请输入线路概况', | |
| 104 | + trigger: 'blur' | |
| 105 | + }, ], | |
| 106 | + banner: [{ | |
| 107 | + required: true, | |
| 108 | + message: '请输入线路图片', | |
| 109 | + trigger: 'click' | |
| 110 | + }, ], | |
| 111 | + ratio: [{ | |
| 112 | + required: true, | |
| 113 | + message: '请输入百分比%', | |
| 114 | + trigger: 'blur' | |
| 84 | 115 | }, |
| 85 | - ], | |
| 86 | - remark:[ | |
| 87 | 116 | { |
| 88 | - required:true, | |
| 89 | - message:'请输入线路概况', | |
| 90 | - trigger:'blur' | |
| 91 | - }, | |
| 92 | - ], | |
| 93 | - banner:[ | |
| 94 | - { | |
| 95 | - required:true, | |
| 96 | - message:'请输入线路图片', | |
| 97 | - trigger:'click' | |
| 117 | + pattern: /^\d+$/, | |
| 118 | + message: '请输入正确的数字', | |
| 119 | + trigger: 'blur' | |
| 98 | 120 | }, |
| 99 | 121 | ], |
| 100 | 122 | }, |
| 101 | - areaIdOptions : [], | |
| 123 | + areaIdOptions: [], | |
| 102 | 124 | } |
| 103 | 125 | }, |
| 104 | 126 | computed: {}, |
| 105 | - watch: {}, | |
| 106 | - created() { | |
| 127 | + watch: {}, | |
| 128 | + created() { | |
| 107 | 129 | this.getareaIdOptions(); |
| 108 | 130 | }, |
| 109 | - mounted() { | |
| 110 | - }, | |
| 131 | + mounted() {}, | |
| 111 | 132 | methods: { |
| 112 | - getareaIdOptions(){ | |
| 133 | + getareaIdOptions() { | |
| 113 | 134 | previewDataInterface('393301869759300869').then(res => { |
| 114 | 135 | this.areaIdOptions = res.data |
| 115 | 136 | }); |
| 116 | 137 | }, |
| 117 | 138 | goBack() { |
| 118 | - this.$emit('refresh') | |
| 119 | - }, | |
| 139 | + this.$emit('refresh') | |
| 140 | + }, | |
| 120 | 141 | init(id, isDetail) { |
| 121 | 142 | this.dataForm.id = id || 0; |
| 122 | - this.visible = true; | |
| 123 | - this.isDetail = isDetail || false; | |
| 143 | + this.visible = true; | |
| 144 | + this.isDetail = isDetail || false; | |
| 124 | 145 | this.$nextTick(() => { |
| 125 | 146 | this.$refs['elForm'].resetFields(); |
| 126 | 147 | if (this.dataForm.id) { |
| 127 | 148 | request({ |
| 128 | 149 | url: '/api/Blind/TbAreaLine/' + this.dataForm.id, |
| 129 | 150 | method: 'get' |
| 130 | - }).then(res =>{ | |
| 151 | + }).then(res => { | |
| 131 | 152 | this.dataForm = res.data; |
| 132 | - if(!this.dataForm.banner)this.dataForm.banner=[]; | |
| 153 | + if (!this.dataForm.banner) this.dataForm.banner = []; | |
| 133 | 154 | }) |
| 134 | 155 | } |
| 135 | 156 | }) |
| 136 | 157 | }, |
| 137 | 158 | dataFormSubmit() { |
| 138 | 159 | this.$refs['elForm'].validate((valid) => { |
| 139 | - if (valid) { | |
| 140 | - if (!this.dataForm.id) { | |
| 141 | - request({ | |
| 142 | - url: `/api/Blind/TbAreaLine`, | |
| 143 | - method: 'post', | |
| 144 | - data: this.dataForm, | |
| 145 | - }).then((res) => { | |
| 146 | - this.$message({ | |
| 147 | - message: res.msg, | |
| 148 | - type: 'success', | |
| 149 | - duration: 1000, | |
| 150 | - onClose: () => { | |
| 151 | - this.visible = false, | |
| 152 | - this.$emit('refresh', true) | |
| 153 | - } | |
| 154 | - }) | |
| 155 | - }) | |
| 156 | - } else { | |
| 157 | - request({ | |
| 158 | - url: '/api/Blind/TbAreaLine/' + this.dataForm.id, | |
| 159 | - method: 'PUT', | |
| 160 | - data: this.dataForm | |
| 161 | - }).then((res) => { | |
| 162 | - this.$message({ | |
| 163 | - message: res.msg, | |
| 164 | - type: 'success', | |
| 165 | - duration: 1000, | |
| 166 | - onClose: () => { | |
| 167 | - this.visible = false | |
| 168 | - this.$emit('refresh', true) | |
| 169 | - } | |
| 170 | - }) | |
| 171 | - }) | |
| 172 | - } | |
| 173 | - } | |
| 174 | - }) | |
| 160 | + if (valid) { | |
| 161 | + if (!this.dataForm.id) { | |
| 162 | + request({ | |
| 163 | + url: `/api/Blind/TbAreaLine`, | |
| 164 | + method: 'post', | |
| 165 | + data: this.dataForm, | |
| 166 | + }).then((res) => { | |
| 167 | + this.$message({ | |
| 168 | + message: res.msg, | |
| 169 | + type: 'success', | |
| 170 | + duration: 1000, | |
| 171 | + onClose: () => { | |
| 172 | + this.visible = false, | |
| 173 | + this.$emit('refresh', true) | |
| 174 | + } | |
| 175 | + }) | |
| 176 | + }) | |
| 177 | + } else { | |
| 178 | + request({ | |
| 179 | + url: '/api/Blind/TbAreaLine/' + this.dataForm.id, | |
| 180 | + method: 'PUT', | |
| 181 | + data: this.dataForm | |
| 182 | + }).then((res) => { | |
| 183 | + this.$message({ | |
| 184 | + message: res.msg, | |
| 185 | + type: 'success', | |
| 186 | + duration: 1000, | |
| 187 | + onClose: () => { | |
| 188 | + this.visible = false | |
| 189 | + this.$emit('refresh', true) | |
| 190 | + } | |
| 191 | + }) | |
| 192 | + }) | |
| 193 | + } | |
| 194 | + } | |
| 195 | + }) | |
| 175 | 196 | }, |
| 176 | 197 | } |
| 177 | 198 | } | ... | ... |
antis-ncc-admin/src/views/tbAreaLine/index.vue
| ... | ... | @@ -5,19 +5,20 @@ |
| 5 | 5 | <el-form @submit.native.prevent> |
| 6 | 6 | <el-col :span="6"> |
| 7 | 7 | <el-form-item label="地域"> |
| 8 | - <el-select v-model="query.areaId" placeholder="地域" clearable > | |
| 9 | - <el-option v-for="(item, index) in areaIdOptions" :key="index" :label="item.F_Name" :value="item.F_Id" /> | |
| 8 | + <el-select v-model="query.areaId" placeholder="地域" clearable> | |
| 9 | + <el-option v-for="(item, index) in areaIdOptions" :key="index" :label="item.F_Name" | |
| 10 | + :value="item.F_Id" /> | |
| 10 | 11 | </el-select> |
| 11 | 12 | </el-form-item> |
| 12 | 13 | </el-col> |
| 13 | 14 | <el-col :span="6"> |
| 14 | 15 | <el-form-item label="线路标题"> |
| 15 | - <el-input v-model="query.title" placeholder="线路标题" clearable /> | |
| 16 | + <el-input v-model="query.title" placeholder="线路标题" clearable /> | |
| 16 | 17 | </el-form-item> |
| 17 | 18 | </el-col> |
| 18 | 19 | <el-col :span="6"> |
| 19 | 20 | <el-form-item label="线路概况"> |
| 20 | - <el-input v-model="query.remark" placeholder="线路概况" /> | |
| 21 | + <el-input v-model="query.remark" placeholder="线路概况" /> | |
| 21 | 22 | </el-form-item> |
| 22 | 23 | </el-col> |
| 23 | 24 | <el-col :span="6"> |
| ... | ... | @@ -37,206 +38,240 @@ |
| 37 | 38 | </div> |
| 38 | 39 | <div class="NCC-common-head-right"> |
| 39 | 40 | <el-tooltip effect="dark" content="刷新" placement="top"> |
| 40 | - <el-link icon="icon-ym icon-ym-Refresh NCC-common-head-icon" :underline="false" @click="reset()" /> | |
| 41 | + <el-link icon="icon-ym icon-ym-Refresh NCC-common-head-icon" :underline="false" | |
| 42 | + @click="reset()" /> | |
| 41 | 43 | </el-tooltip> |
| 42 | 44 | <screenfull isContainer /> |
| 43 | 45 | </div> |
| 44 | 46 | </div> |
| 45 | - <NCC-table v-loading="listLoading" :data="list" has-c @selection-change="handleSelectionChange"> | |
| 47 | + <NCC-table v-loading="listLoading" :data="list" has-c @selection-change="handleSelectionChange"> | |
| 46 | 48 | <el-table-column label="地域" prop="Name" align="left"> |
| 47 | - <template slot-scope="scope">{{ scope.row.area&&scope.row.area.Name}}</template> | |
| 49 | + <template slot-scope="scope">{{ scope.row.area&&scope.row.area.Name}}</template> | |
| 48 | 50 | </el-table-column> |
| 49 | 51 | <el-table-column prop="title" label="线路标题" align="left" /> |
| 50 | 52 | <el-table-column prop="remark" label="线路概况" align="left" /> |
| 51 | - <el-table-column prop="creatorTime" label="创建时间" align="left" :formatter="ncc.tableDateFormat"/> | |
| 52 | - <el-table-column prop="lastModifyTime" label="修改时间" align="left" :formatter="ncc.tableDateFormat"/> | |
| 53 | + <el-table-column prop="ratio" label="百分比%" align="left" /> | |
| 54 | + | |
| 55 | + <el-table-column prop="creatorTime" label="创建时间" align="left" :formatter="ncc.tableDateFormat" /> | |
| 56 | + <el-table-column prop="lastModifyTime" label="修改时间" align="left" :formatter="ncc.tableDateFormat" /> | |
| 53 | 57 | <el-table-column label="操作" fixed="right" width="100"> |
| 54 | - <template slot-scope="scope"> | |
| 55 | - <el-button type="text" @click="addOrUpdateHandle(scope.row.id)" >编辑</el-button> | |
| 56 | - <el-button type="text" @click="handleDel(scope.row.id)" class="NCC-table-delBtn" >删除</el-button> | |
| 58 | + <template slot-scope="scope"> | |
| 59 | + <el-button type="text" @click="addOrUpdateHandle(scope.row.id)">编辑</el-button> | |
| 60 | + <el-button type="text" @click="handleDel(scope.row.id)" class="NCC-table-delBtn">删除 | |
| 61 | + </el-button> | |
| 57 | 62 | </template> |
| 58 | 63 | </el-table-column> |
| 59 | 64 | </NCC-table> |
| 60 | - <pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize" @pagination="initData" /> | |
| 61 | - </div> | |
| 62 | - </div> | |
| 65 | + <pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize" | |
| 66 | + @pagination="initData" /> | |
| 67 | + </div> | |
| 68 | + </div> | |
| 63 | 69 | <NCC-Form v-if="formVisible" ref="NCCForm" @refresh="refresh" /> |
| 64 | 70 | <ExportBox v-if="exportBoxVisible" ref="ExportBox" @download="download" /> |
| 65 | 71 | </div> |
| 66 | 72 | </template> |
| 67 | 73 | <script> |
| 68 | - import request from '@/utils/request' | |
| 69 | - import { getDictionaryDataSelector } from '@/api/systemData/dictionary' | |
| 70 | - import NCCForm from './Form' | |
| 71 | - import ExportBox from './ExportBox' | |
| 72 | - import { previewDataInterface } from '@/api/systemData/dataInterface' | |
| 74 | + import request from '@/utils/request' | |
| 75 | + import { | |
| 76 | + getDictionaryDataSelector | |
| 77 | + } from '@/api/systemData/dictionary' | |
| 78 | + import NCCForm from './Form' | |
| 79 | + import ExportBox from './ExportBox' | |
| 80 | + import { | |
| 81 | + previewDataInterface | |
| 82 | + } from '@/api/systemData/dataInterface' | |
| 73 | 83 | export default { |
| 74 | - components: { NCCForm, ExportBox }, | |
| 75 | - data() { | |
| 76 | - return { | |
| 77 | - showAll: false, | |
| 84 | + components: { | |
| 85 | + NCCForm, | |
| 86 | + ExportBox | |
| 87 | + }, | |
| 88 | + data() { | |
| 89 | + return { | |
| 90 | + showAll: false, | |
| 78 | 91 | query: { |
| 79 | - areaId:undefined, | |
| 80 | - title:undefined, | |
| 81 | - remark:undefined, | |
| 92 | + areaId: undefined, | |
| 93 | + title: undefined, | |
| 94 | + remark: undefined, | |
| 82 | 95 | }, |
| 83 | - list: [], | |
| 84 | - listLoading: true, | |
| 85 | - multipleSelection: [], total: 0, | |
| 86 | - listQuery: { | |
| 87 | - currentPage: 1, | |
| 88 | - pageSize: 20, | |
| 96 | + list: [], | |
| 97 | + listLoading: true, | |
| 98 | + multipleSelection: [], | |
| 99 | + total: 0, | |
| 100 | + listQuery: { | |
| 101 | + currentPage: 1, | |
| 102 | + pageSize: 20, | |
| 89 | 103 | sort: "desc", |
| 90 | - sidx: "", | |
| 91 | - }, | |
| 92 | - formVisible: false, | |
| 93 | - exportBoxVisible: false, | |
| 94 | - columnList: [ | |
| 95 | - { prop: 'areaId', label: '地域' }, | |
| 96 | - { prop: 'title', label: '线路标题' }, | |
| 97 | - { prop: 'remark', label: '线路概况' }, | |
| 98 | - { prop: 'creatorTime', label: '创建时间' }, | |
| 99 | - { prop: 'lastModifyTime', label: '修改时间' }, | |
| 104 | + sidx: "", | |
| 105 | + }, | |
| 106 | + formVisible: false, | |
| 107 | + exportBoxVisible: false, | |
| 108 | + columnList: [{ | |
| 109 | + prop: 'areaId', | |
| 110 | + label: '地域' | |
| 111 | + }, | |
| 112 | + { | |
| 113 | + prop: 'title', | |
| 114 | + label: '线路标题' | |
| 115 | + }, | |
| 116 | + { | |
| 117 | + prop: 'remark', | |
| 118 | + label: '线路概况' | |
| 119 | + }, | |
| 120 | + { | |
| 121 | + prop: 'creatorTime', | |
| 122 | + label: '创建时间' | |
| 123 | + }, | |
| 124 | + { | |
| 125 | + prop: 'lastModifyTime', | |
| 126 | + label: '修改时间' | |
| 127 | + }, { | |
| 128 | + prop: 'ratio', | |
| 129 | + label: '百分比%' | |
| 130 | + }, | |
| 131 | + | |
| 100 | 132 | ], |
| 101 | - areaIdOptions : [], | |
| 133 | + areaIdOptions: [], | |
| 102 | 134 | } |
| 103 | - }, | |
| 135 | + }, | |
| 104 | 136 | computed: {}, |
| 105 | 137 | created() { |
| 106 | 138 | this.initData() |
| 107 | 139 | this.getareaIdOptions(); |
| 108 | 140 | }, |
| 109 | 141 | methods: { |
| 110 | - getareaIdOptions(){ | |
| 142 | + getareaIdOptions() { | |
| 111 | 143 | previewDataInterface('393301869759300869').then(res => { |
| 112 | 144 | this.areaIdOptions = res.data |
| 113 | 145 | }); |
| 114 | 146 | }, |
| 115 | 147 | initData() { |
| 116 | - this.listLoading = true; | |
| 117 | - let _query = { | |
| 118 | - ...this.listQuery, | |
| 119 | - ...this.query | |
| 120 | - }; | |
| 121 | - let query = {} | |
| 122 | - for (let key in _query) { | |
| 123 | - if (Array.isArray(_query[key])) { | |
| 124 | - query[key] = _query[key].join() | |
| 125 | - } else { | |
| 126 | - query[key] = _query[key] | |
| 127 | - } | |
| 128 | - } | |
| 129 | - request({ | |
| 130 | - url: `/api/Blind/TbAreaLine`, | |
| 131 | - method: 'GET', | |
| 132 | - data: query | |
| 133 | - }).then(res => { | |
| 134 | - this.list = res.data.list | |
| 135 | - this.total = res.data.pagination.total | |
| 136 | - this.listLoading = false | |
| 137 | - }) | |
| 138 | - }, | |
| 148 | + this.listLoading = true; | |
| 149 | + let _query = { | |
| 150 | + ...this.listQuery, | |
| 151 | + ...this.query | |
| 152 | + }; | |
| 153 | + let query = {} | |
| 154 | + for (let key in _query) { | |
| 155 | + if (Array.isArray(_query[key])) { | |
| 156 | + query[key] = _query[key].join() | |
| 157 | + } else { | |
| 158 | + query[key] = _query[key] | |
| 159 | + } | |
| 160 | + } | |
| 161 | + request({ | |
| 162 | + url: `/api/Blind/TbAreaLine`, | |
| 163 | + method: 'GET', | |
| 164 | + data: query | |
| 165 | + }).then(res => { | |
| 166 | + this.list = res.data.list | |
| 167 | + this.total = res.data.pagination.total | |
| 168 | + this.listLoading = false | |
| 169 | + }) | |
| 170 | + }, | |
| 139 | 171 | handleDel(id) { |
| 140 | - this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', { | |
| 141 | - type: 'warning' | |
| 142 | - }).then(() => { | |
| 143 | - request({ | |
| 144 | - url: `/api/Blind/TbAreaLine/${id}`, | |
| 145 | - method: 'DELETE' | |
| 146 | - }).then(res => { | |
| 147 | - this.$message({ | |
| 148 | - type: 'success', | |
| 149 | - message: res.msg, | |
| 150 | - onClose: () => { | |
| 151 | - this.initData() | |
| 152 | - } | |
| 153 | - }); | |
| 154 | - }) | |
| 155 | - }).catch(() => { | |
| 156 | - }); | |
| 157 | - }, | |
| 172 | + this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', { | |
| 173 | + type: 'warning' | |
| 174 | + }).then(() => { | |
| 175 | + request({ | |
| 176 | + url: `/api/Blind/TbAreaLine/${id}`, | |
| 177 | + method: 'DELETE' | |
| 178 | + }).then(res => { | |
| 179 | + this.$message({ | |
| 180 | + type: 'success', | |
| 181 | + message: res.msg, | |
| 182 | + onClose: () => { | |
| 183 | + this.initData() | |
| 184 | + } | |
| 185 | + }); | |
| 186 | + }) | |
| 187 | + }).catch(() => {}); | |
| 188 | + }, | |
| 158 | 189 | handleSelectionChange(val) { |
| 159 | - const res = val.map(item => item.id) | |
| 160 | - this.multipleSelection = res | |
| 161 | - }, | |
| 162 | - handleBatchRemoveDel() { | |
| 163 | - if (!this.multipleSelection.length) { | |
| 164 | - this.$message({ | |
| 165 | - type: 'error', | |
| 166 | - message: '请选择一条数据', | |
| 167 | - duration: 1500, | |
| 168 | - }) | |
| 169 | - return | |
| 170 | - } | |
| 171 | - const ids = this.multipleSelection | |
| 172 | - this.$confirm('您确定要删除这些数据吗, 是否继续?', '提示', { | |
| 173 | - type: 'warning' | |
| 174 | - }).then(() => { | |
| 175 | - request({ | |
| 176 | - url: `/api/Blind/TbAreaLine/batchRemove`, | |
| 177 | - method: 'POST', | |
| 178 | - data: ids , | |
| 179 | - }).then(res => { | |
| 180 | - this.$message({ | |
| 181 | - type: 'success', | |
| 182 | - message: res.msg, | |
| 183 | - onClose: () => { | |
| 184 | - this.initData() | |
| 185 | - } | |
| 186 | - }); | |
| 187 | - }) | |
| 188 | - }).catch(() => { }) | |
| 189 | - }, | |
| 190 | + const res = val.map(item => item.id) | |
| 191 | + this.multipleSelection = res | |
| 192 | + }, | |
| 193 | + handleBatchRemoveDel() { | |
| 194 | + if (!this.multipleSelection.length) { | |
| 195 | + this.$message({ | |
| 196 | + type: 'error', | |
| 197 | + message: '请选择一条数据', | |
| 198 | + duration: 1500, | |
| 199 | + }) | |
| 200 | + return | |
| 201 | + } | |
| 202 | + const ids = this.multipleSelection | |
| 203 | + this.$confirm('您确定要删除这些数据吗, 是否继续?', '提示', { | |
| 204 | + type: 'warning' | |
| 205 | + }).then(() => { | |
| 206 | + request({ | |
| 207 | + url: `/api/Blind/TbAreaLine/batchRemove`, | |
| 208 | + method: 'POST', | |
| 209 | + data: ids, | |
| 210 | + }).then(res => { | |
| 211 | + this.$message({ | |
| 212 | + type: 'success', | |
| 213 | + message: res.msg, | |
| 214 | + onClose: () => { | |
| 215 | + this.initData() | |
| 216 | + } | |
| 217 | + }); | |
| 218 | + }) | |
| 219 | + }).catch(() => {}) | |
| 220 | + }, | |
| 190 | 221 | addOrUpdateHandle(id, isDetail) { |
| 191 | - this.formVisible = true | |
| 192 | - this.$nextTick(() => { | |
| 193 | - this.$refs.NCCForm.init(id, isDetail) | |
| 194 | - }) | |
| 195 | - }, | |
| 222 | + this.formVisible = true | |
| 223 | + this.$nextTick(() => { | |
| 224 | + this.$refs.NCCForm.init(id, isDetail) | |
| 225 | + }) | |
| 226 | + }, | |
| 196 | 227 | exportData() { |
| 197 | - this.exportBoxVisible = true | |
| 198 | - this.$nextTick(() => { | |
| 199 | - this.$refs.ExportBox.init(this.columnList) | |
| 200 | - }) | |
| 201 | - }, | |
| 202 | - download(data) { | |
| 203 | - let query = { ...data, ...this.listQuery, ...this.query } | |
| 204 | - request({ | |
| 205 | - url: `/api/Blind/TbAreaLine/Actions/Export`, | |
| 206 | - method: 'GET', | |
| 207 | - data: query | |
| 208 | - }).then(res => { | |
| 209 | - if (!res.data.url) return | |
| 210 | - window.location.href = this.define.comUrl + res.data.url | |
| 211 | - this.$refs.ExportBox.visible = false | |
| 212 | - this.exportBoxVisible = false | |
| 213 | - }) | |
| 214 | - }, | |
| 228 | + this.exportBoxVisible = true | |
| 229 | + this.$nextTick(() => { | |
| 230 | + this.$refs.ExportBox.init(this.columnList) | |
| 231 | + }) | |
| 232 | + }, | |
| 233 | + download(data) { | |
| 234 | + let query = { | |
| 235 | + ...data, | |
| 236 | + ...this.listQuery, | |
| 237 | + ...this.query | |
| 238 | + } | |
| 239 | + request({ | |
| 240 | + url: `/api/Blind/TbAreaLine/Actions/Export`, | |
| 241 | + method: 'GET', | |
| 242 | + data: query | |
| 243 | + }).then(res => { | |
| 244 | + if (!res.data.url) return | |
| 245 | + window.location.href = this.define.comUrl + res.data.url | |
| 246 | + this.$refs.ExportBox.visible = false | |
| 247 | + this.exportBoxVisible = false | |
| 248 | + }) | |
| 249 | + }, | |
| 215 | 250 | search() { |
| 216 | - this.listQuery = { | |
| 217 | - currentPage: 1, | |
| 218 | - pageSize: 20, | |
| 219 | - sort: "desc", | |
| 220 | - sidx: "", | |
| 221 | - } | |
| 222 | - this.initData() | |
| 223 | - }, | |
| 224 | - refresh(isrRefresh) { | |
| 225 | - this.formVisible = false | |
| 226 | - if (isrRefresh) this.reset() | |
| 227 | - }, | |
| 228 | - reset() { | |
| 229 | - for (let key in this.query) { | |
| 230 | - this.query[key] = undefined | |
| 231 | - } | |
| 232 | - this.listQuery = { | |
| 233 | - currentPage: 1, | |
| 234 | - pageSize: 20, | |
| 235 | - sort: "desc", | |
| 236 | - sidx: "", | |
| 237 | - } | |
| 238 | - this.initData() | |
| 239 | - } | |
| 251 | + this.listQuery = { | |
| 252 | + currentPage: 1, | |
| 253 | + pageSize: 20, | |
| 254 | + sort: "desc", | |
| 255 | + sidx: "", | |
| 256 | + } | |
| 257 | + this.initData() | |
| 258 | + }, | |
| 259 | + refresh(isrRefresh) { | |
| 260 | + this.formVisible = false | |
| 261 | + if (isrRefresh) this.reset() | |
| 262 | + }, | |
| 263 | + reset() { | |
| 264 | + for (let key in this.query) { | |
| 265 | + this.query[key] = undefined | |
| 266 | + } | |
| 267 | + this.listQuery = { | |
| 268 | + currentPage: 1, | |
| 269 | + pageSize: 20, | |
| 270 | + sort: "desc", | |
| 271 | + sidx: "", | |
| 272 | + } | |
| 273 | + this.initData() | |
| 274 | + } | |
| 240 | 275 | } |
| 241 | - } | |
| 242 | -</script> | |
| 243 | 276 | \ No newline at end of file |
| 277 | + } | |
| 278 | +</script> | ... | ... |
antis-ncc-admin/src/views/tbPoster/ExportBox.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <el-dialog title="导出数据" :close-on-click-modal="false" :visible.sync="visible" | |
| 3 | + class="NCC-dialog NCC-dialog_center" lock-scroll width="600px"> | |
| 4 | + <el-form label-position="top" label-width="80px"> | |
| 5 | + <el-form-item label="数据选择"> | |
| 6 | + <el-radio-group v-model="type"> | |
| 7 | + <el-radio :label="0">当前页面数据</el-radio> | |
| 8 | + <el-radio :label="1">全部页面数据</el-radio> | |
| 9 | + </el-radio-group> | |
| 10 | + </el-form-item> | |
| 11 | + <el-form-item label="导出字段"> | |
| 12 | + <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" | |
| 13 | + @change="handleCheckAllChange">全选</el-checkbox> | |
| 14 | + <el-checkbox-group v-model="columns" @change="handleCheckedChange"> | |
| 15 | + <el-checkbox v-for="item in columnList" :label="item.prop" :key="item.prop"> | |
| 16 | + {{item.label}} | |
| 17 | + </el-checkbox> | |
| 18 | + </el-checkbox-group> | |
| 19 | + </el-form-item> | |
| 20 | + </el-form> | |
| 21 | + <span slot="footer" class="dialog-footer"> | |
| 22 | + <el-button @click="visible=false">取 消</el-button> | |
| 23 | + <el-button type="primary" @click="downLoad">导 出</el-button> | |
| 24 | + </span> | |
| 25 | + </el-dialog> | |
| 26 | +</template> | |
| 27 | + | |
| 28 | +<script> | |
| 29 | +export default { | |
| 30 | + data() { | |
| 31 | + return { | |
| 32 | + visible: false, | |
| 33 | + btnLoading: false, | |
| 34 | + type: 0, | |
| 35 | + columns: [], | |
| 36 | + checkAll: true, | |
| 37 | + isIndeterminate: false, | |
| 38 | + columnList: [] | |
| 39 | + } | |
| 40 | + }, | |
| 41 | + methods: { | |
| 42 | + init(columnList) { | |
| 43 | + this.visible = true | |
| 44 | + this.columnList = columnList | |
| 45 | + this.columns = columnList.map(o => o.prop) | |
| 46 | + }, | |
| 47 | + handleCheckAllChange(val) { | |
| 48 | + this.columns = val ? this.columnList.map(o => o.prop) : []; | |
| 49 | + this.isIndeterminate = false; | |
| 50 | + }, | |
| 51 | + handleCheckedChange(value) { | |
| 52 | + let checkedCount = value.length; | |
| 53 | + this.checkAll = checkedCount === this.columnList.length; | |
| 54 | + this.isIndeterminate = checkedCount > 0 && checkedCount < this.columnList.length; | |
| 55 | + }, | |
| 56 | + downLoad() { | |
| 57 | + this.$emit('download', { dataType: this.type, selectKey: this.columns.join(',') }) | |
| 58 | + } | |
| 59 | + } | |
| 60 | +} | |
| 61 | +</script> | |
| 62 | +<style lang="scss" scoped> | |
| 63 | +>>> .el-dialog__body { | |
| 64 | + padding: 20px !important; | |
| 65 | +} | |
| 66 | +</style> | |
| 0 | 67 | \ No newline at end of file | ... | ... |
antis-ncc-admin/src/views/tbPoster/Form.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <el-dialog :title="!dataForm.id ? '新建' : isDetail ? '详情':'编辑'" :close-on-click-modal="false" :visible.sync="visible" class="NCC-dialog NCC-dialog_center" lock-scroll width="600px"> | |
| 3 | + <el-row :gutter="15" class="" > | |
| 4 | + <el-form ref="elForm" :model="dataForm" size="small" label-width="100px" label-position="right" :disabled="!!isDetail" :rules="rules"> | |
| 5 | + <el-col :span="24"> | |
| 6 | + <el-form-item label="标题" prop="title"> | |
| 7 | + <el-input v-model="dataForm.title" placeholder="请输入" clearable required :style='{"width":"100%"}' > | |
| 8 | + </el-input> | |
| 9 | + </el-form-item> | |
| 10 | + </el-col> | |
| 11 | + <el-col :span="24"> | |
| 12 | + <el-form-item label="图片" prop="banner"> | |
| 13 | + <NCC-UploadImg v-model="dataForm.banner" required :fileSize="5" sizeUnit="MB" :limit="1" > | |
| 14 | + </NCC-UploadImg> | |
| 15 | + </el-form-item> | |
| 16 | + </el-col> | |
| 17 | + <el-col :span="24" v-if="false" > | |
| 18 | + <el-form-item label="创建时间" prop="creatorTime"> | |
| 19 | + <el-input v-model="dataForm.creatorTime" placeholder="系统自动生成" readonly > | |
| 20 | + </el-input> | |
| 21 | + </el-form-item> | |
| 22 | + </el-col> | |
| 23 | + <el-col :span="24" v-if="false" > | |
| 24 | + <el-form-item label="修改时间" prop="lastModifyTime"> | |
| 25 | + <el-input v-model="dataForm.lastModifyTime" placeholder="系统自动生成" readonly > | |
| 26 | + </el-input> | |
| 27 | + </el-form-item> | |
| 28 | + </el-col> | |
| 29 | + <el-col :span="24" v-if="false" > | |
| 30 | + <el-form-item label="创建用户" prop="creatorUserId"> | |
| 31 | + <el-input v-model="dataForm.creatorUserId" placeholder="系统自动生成" readonly > | |
| 32 | + </el-input> | |
| 33 | + </el-form-item> | |
| 34 | + </el-col> | |
| 35 | + </el-form> | |
| 36 | + </el-row> | |
| 37 | + <span slot="footer" class="dialog-footer"> | |
| 38 | + <el-button @click="visible = false">取 消</el-button> | |
| 39 | + <el-button type="primary" @click="dataFormSubmit()" v-if="!isDetail">确 定</el-button> | |
| 40 | + </span> | |
| 41 | + </el-dialog> | |
| 42 | +</template> | |
| 43 | +<script> | |
| 44 | + import request from '@/utils/request' | |
| 45 | + import { getDictionaryDataSelector } from '@/api/systemData/dictionary' | |
| 46 | + import { previewDataInterface } from '@/api/systemData/dataInterface' | |
| 47 | + export default { | |
| 48 | + components: {}, | |
| 49 | + props: [], | |
| 50 | + data() { | |
| 51 | + return { | |
| 52 | + loading: false, | |
| 53 | + visible: false, | |
| 54 | + isDetail: false, | |
| 55 | + dataForm: { | |
| 56 | + id:'', | |
| 57 | + title:undefined, | |
| 58 | + banner:[], | |
| 59 | + creatorTime:undefined, | |
| 60 | + lastModifyTime:undefined, | |
| 61 | + creatorUserId:undefined, | |
| 62 | + }, | |
| 63 | + rules: { | |
| 64 | + title:[ | |
| 65 | + { | |
| 66 | + required:true, | |
| 67 | + message:'请输入标题', | |
| 68 | + trigger:'blur' | |
| 69 | + }, | |
| 70 | + ], | |
| 71 | + banner:[ | |
| 72 | + { | |
| 73 | + required:true, | |
| 74 | + message:'请输入图片', | |
| 75 | + trigger:'click' | |
| 76 | + }, | |
| 77 | + ], | |
| 78 | + }, | |
| 79 | + } | |
| 80 | + }, | |
| 81 | + computed: {}, | |
| 82 | + watch: {}, | |
| 83 | + created() { | |
| 84 | + }, | |
| 85 | + mounted() { | |
| 86 | + }, | |
| 87 | + methods: { | |
| 88 | + goBack() { | |
| 89 | + this.$emit('refresh') | |
| 90 | + }, | |
| 91 | + init(id, isDetail) { | |
| 92 | + this.dataForm.id = id || 0; | |
| 93 | + this.visible = true; | |
| 94 | + this.isDetail = isDetail || false; | |
| 95 | + this.$nextTick(() => { | |
| 96 | + this.$refs['elForm'].resetFields(); | |
| 97 | + if (this.dataForm.id) { | |
| 98 | + request({ | |
| 99 | + url: '/api/Blind/TbPoster/' + this.dataForm.id, | |
| 100 | + method: 'get' | |
| 101 | + }).then(res =>{ | |
| 102 | + this.dataForm = res.data; | |
| 103 | + if(!this.dataForm.banner)this.dataForm.banner=[]; | |
| 104 | + }) | |
| 105 | + } | |
| 106 | + }) | |
| 107 | + }, | |
| 108 | + dataFormSubmit() { | |
| 109 | + this.$refs['elForm'].validate((valid) => { | |
| 110 | + if (valid) { | |
| 111 | + if (!this.dataForm.id) { | |
| 112 | + request({ | |
| 113 | + url: `/api/Blind/TbPoster`, | |
| 114 | + method: 'post', | |
| 115 | + data: this.dataForm, | |
| 116 | + }).then((res) => { | |
| 117 | + this.$message({ | |
| 118 | + message: res.msg, | |
| 119 | + type: 'success', | |
| 120 | + duration: 1000, | |
| 121 | + onClose: () => { | |
| 122 | + this.visible = false, | |
| 123 | + this.$emit('refresh', true) | |
| 124 | + } | |
| 125 | + }) | |
| 126 | + }) | |
| 127 | + } else { | |
| 128 | + request({ | |
| 129 | + url: '/api/Blind/TbPoster/' + this.dataForm.id, | |
| 130 | + method: 'PUT', | |
| 131 | + data: this.dataForm | |
| 132 | + }).then((res) => { | |
| 133 | + this.$message({ | |
| 134 | + message: res.msg, | |
| 135 | + type: 'success', | |
| 136 | + duration: 1000, | |
| 137 | + onClose: () => { | |
| 138 | + this.visible = false | |
| 139 | + this.$emit('refresh', true) | |
| 140 | + } | |
| 141 | + }) | |
| 142 | + }) | |
| 143 | + } | |
| 144 | + } | |
| 145 | + }) | |
| 146 | + }, | |
| 147 | + } | |
| 148 | + } | |
| 149 | +</script> | ... | ... |
antis-ncc-admin/src/views/tbPoster/index.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="NCC-common-layout"> | |
| 3 | + <div class="NCC-common-layout-center"> | |
| 4 | + <el-row class="NCC-common-search-box" :gutter="16"> | |
| 5 | + <el-form @submit.native.prevent> | |
| 6 | + <el-col :span="6"> | |
| 7 | + <el-form-item label="标题"> | |
| 8 | + <el-input v-model="query.title" placeholder="标题" clearable /> | |
| 9 | + </el-form-item> | |
| 10 | + </el-col> | |
| 11 | + <el-col :span="6"> | |
| 12 | + <el-form-item> | |
| 13 | + <el-button type="primary" icon="el-icon-search" @click="search()">查询</el-button> | |
| 14 | + <el-button icon="el-icon-refresh-right" @click="reset()">重置</el-button> | |
| 15 | + </el-form-item> | |
| 16 | + </el-col> | |
| 17 | + </el-form> | |
| 18 | + </el-row> | |
| 19 | + <div class="NCC-common-layout-main NCC-flex-main"> | |
| 20 | + <div class="NCC-common-head"> | |
| 21 | + <div> | |
| 22 | + <el-button type="primary" icon="el-icon-plus" @click="addOrUpdateHandle()">新增</el-button> | |
| 23 | + <el-button type="text" icon="el-icon-download" @click="exportData()">导出</el-button> | |
| 24 | + <el-button type="text" icon="el-icon-delete" @click="handleBatchRemoveDel()">批量删除</el-button> | |
| 25 | + </div> | |
| 26 | + <div class="NCC-common-head-right"> | |
| 27 | + <el-tooltip effect="dark" content="刷新" placement="top"> | |
| 28 | + <el-link icon="icon-ym icon-ym-Refresh NCC-common-head-icon" :underline="false" @click="reset()" /> | |
| 29 | + </el-tooltip> | |
| 30 | + <screenfull isContainer /> | |
| 31 | + </div> | |
| 32 | + </div> | |
| 33 | + <NCC-table v-loading="listLoading" :data="list" has-c @selection-change="handleSelectionChange"> | |
| 34 | + <el-table-column prop="title" label="标题" align="left" /> | |
| 35 | + <el-table-column prop="creatorTime" label="创建时间" align="left" :formatter="ncc.tableDateFormat" /> | |
| 36 | + <el-table-column prop="lastModifyTime" label="修改时间" align="left" :formatter="ncc.tableDateFormat" /> | |
| 37 | + <el-table-column prop="creatorUserId" label="创建用户" align="left" /> | |
| 38 | + <el-table-column label="操作" fixed="right" width="100"> | |
| 39 | + <template slot-scope="scope"> | |
| 40 | + <el-button type="text" @click="addOrUpdateHandle(scope.row.id)" >编辑</el-button> | |
| 41 | + <el-button type="text" @click="handleDel(scope.row.id)" class="NCC-table-delBtn" >删除</el-button> | |
| 42 | + </template> | |
| 43 | + </el-table-column> | |
| 44 | + </NCC-table> | |
| 45 | + <pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize" @pagination="initData" /> | |
| 46 | + </div> | |
| 47 | + </div> | |
| 48 | + <NCC-Form v-if="formVisible" ref="NCCForm" @refresh="refresh" /> | |
| 49 | + <ExportBox v-if="exportBoxVisible" ref="ExportBox" @download="download" /> | |
| 50 | + </div> | |
| 51 | +</template> | |
| 52 | +<script> | |
| 53 | + import request from '@/utils/request' | |
| 54 | + import { getDictionaryDataSelector } from '@/api/systemData/dictionary' | |
| 55 | + import NCCForm from './Form' | |
| 56 | + import ExportBox from './ExportBox' | |
| 57 | + import { previewDataInterface } from '@/api/systemData/dataInterface' | |
| 58 | + export default { | |
| 59 | + components: { NCCForm, ExportBox }, | |
| 60 | + data() { | |
| 61 | + return { | |
| 62 | + query: { | |
| 63 | + title:undefined, | |
| 64 | + }, | |
| 65 | + list: [], | |
| 66 | + listLoading: true, | |
| 67 | + multipleSelection: [], total: 0, | |
| 68 | + listQuery: { | |
| 69 | + currentPage: 1, | |
| 70 | + pageSize: 20, | |
| 71 | + sort: "desc", | |
| 72 | + sidx: "", | |
| 73 | + }, | |
| 74 | + formVisible: false, | |
| 75 | + exportBoxVisible: false, | |
| 76 | + columnList: [ | |
| 77 | + { prop: 'title', label: '标题' }, | |
| 78 | + { prop: 'creatorTime', label: '创建时间' }, | |
| 79 | + { prop: 'lastModifyTime', label: '修改时间' }, | |
| 80 | + { prop: 'creatorUserId', label: '创建用户' }, | |
| 81 | + ], | |
| 82 | + } | |
| 83 | + }, | |
| 84 | + computed: {}, | |
| 85 | + created() { | |
| 86 | + this.initData() | |
| 87 | + }, | |
| 88 | + methods: { | |
| 89 | + initData() { | |
| 90 | + this.listLoading = true; | |
| 91 | + let _query = { | |
| 92 | + ...this.listQuery, | |
| 93 | + ...this.query | |
| 94 | + }; | |
| 95 | + let query = {} | |
| 96 | + for (let key in _query) { | |
| 97 | + if (Array.isArray(_query[key])) { | |
| 98 | + query[key] = _query[key].join() | |
| 99 | + } else { | |
| 100 | + query[key] = _query[key] | |
| 101 | + } | |
| 102 | + } | |
| 103 | + request({ | |
| 104 | + url: `/api/Blind/TbPoster`, | |
| 105 | + method: 'GET', | |
| 106 | + data: query | |
| 107 | + }).then(res => { | |
| 108 | + this.list = res.data.list | |
| 109 | + this.total = res.data.pagination.total | |
| 110 | + this.listLoading = false | |
| 111 | + }) | |
| 112 | + }, | |
| 113 | + handleDel(id) { | |
| 114 | + this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', { | |
| 115 | + type: 'warning' | |
| 116 | + }).then(() => { | |
| 117 | + request({ | |
| 118 | + url: `/api/Blind/TbPoster/${id}`, | |
| 119 | + method: 'DELETE' | |
| 120 | + }).then(res => { | |
| 121 | + this.$message({ | |
| 122 | + type: 'success', | |
| 123 | + message: res.msg, | |
| 124 | + onClose: () => { | |
| 125 | + this.initData() | |
| 126 | + } | |
| 127 | + }); | |
| 128 | + }) | |
| 129 | + }).catch(() => { | |
| 130 | + }); | |
| 131 | + }, | |
| 132 | + handleSelectionChange(val) { | |
| 133 | + const res = val.map(item => item.id) | |
| 134 | + this.multipleSelection = res | |
| 135 | + }, | |
| 136 | + handleBatchRemoveDel() { | |
| 137 | + if (!this.multipleSelection.length) { | |
| 138 | + this.$message({ | |
| 139 | + type: 'error', | |
| 140 | + message: '请选择一条数据', | |
| 141 | + duration: 1500, | |
| 142 | + }) | |
| 143 | + return | |
| 144 | + } | |
| 145 | + const ids = this.multipleSelection | |
| 146 | + this.$confirm('您确定要删除这些数据吗, 是否继续?', '提示', { | |
| 147 | + type: 'warning' | |
| 148 | + }).then(() => { | |
| 149 | + request({ | |
| 150 | + url: `/api/Blind/TbPoster/batchRemove`, | |
| 151 | + method: 'POST', | |
| 152 | + data: ids , | |
| 153 | + }).then(res => { | |
| 154 | + this.$message({ | |
| 155 | + type: 'success', | |
| 156 | + message: res.msg, | |
| 157 | + onClose: () => { | |
| 158 | + this.initData() | |
| 159 | + } | |
| 160 | + }); | |
| 161 | + }) | |
| 162 | + }).catch(() => { }) | |
| 163 | + }, | |
| 164 | + addOrUpdateHandle(id, isDetail) { | |
| 165 | + this.formVisible = true | |
| 166 | + this.$nextTick(() => { | |
| 167 | + this.$refs.NCCForm.init(id, isDetail) | |
| 168 | + }) | |
| 169 | + }, | |
| 170 | + exportData() { | |
| 171 | + this.exportBoxVisible = true | |
| 172 | + this.$nextTick(() => { | |
| 173 | + this.$refs.ExportBox.init(this.columnList) | |
| 174 | + }) | |
| 175 | + }, | |
| 176 | + download(data) { | |
| 177 | + let query = { ...data, ...this.listQuery, ...this.query } | |
| 178 | + request({ | |
| 179 | + url: `/api/Blind/TbPoster/Actions/Export`, | |
| 180 | + method: 'GET', | |
| 181 | + data: query | |
| 182 | + }).then(res => { | |
| 183 | + if (!res.data.url) return | |
| 184 | + window.location.href = this.define.comUrl + res.data.url | |
| 185 | + this.$refs.ExportBox.visible = false | |
| 186 | + this.exportBoxVisible = false | |
| 187 | + }) | |
| 188 | + }, | |
| 189 | + search() { | |
| 190 | + this.listQuery = { | |
| 191 | + currentPage: 1, | |
| 192 | + pageSize: 20, | |
| 193 | + sort: "desc", | |
| 194 | + sidx: "", | |
| 195 | + } | |
| 196 | + this.initData() | |
| 197 | + }, | |
| 198 | + refresh(isrRefresh) { | |
| 199 | + this.formVisible = false | |
| 200 | + if (isrRefresh) this.reset() | |
| 201 | + }, | |
| 202 | + reset() { | |
| 203 | + for (let key in this.query) { | |
| 204 | + this.query[key] = undefined | |
| 205 | + } | |
| 206 | + this.listQuery = { | |
| 207 | + currentPage: 1, | |
| 208 | + pageSize: 20, | |
| 209 | + sort: "desc", | |
| 210 | + sidx: "", | |
| 211 | + } | |
| 212 | + this.initData() | |
| 213 | + } | |
| 214 | + } | |
| 215 | + } | |
| 216 | +</script> | |
| 0 | 217 | \ No newline at end of file | ... | ... |
antis-ncc-net-core/NCC.BlindBox.Entitys/MBT人格线路节点/Dto/TbMbtLineNodeListOutput.cs
| ... | ... | @@ -73,4 +73,77 @@ namespace NCC.Blind.Entitys.Dto.TbMbtLineNode |
| 73 | 73 | } } |
| 74 | 74 | |
| 75 | 75 | } |
| 76 | + | |
| 77 | + | |
| 78 | + /// <summary> | |
| 79 | + /// MBT人格线路节点输入参数自定义 | |
| 80 | + /// </summary> | |
| 81 | + public class TbMbtLineNodeListOutputCustom | |
| 82 | + { | |
| 83 | + /// <summary> | |
| 84 | + /// 主键 | |
| 85 | + /// </summary> | |
| 86 | + public string id { get; set; } | |
| 87 | + | |
| 88 | + /// <summary> | |
| 89 | + /// MBT人格线路ID | |
| 90 | + /// </summary> | |
| 91 | + public string mbtLineId { get; set; } | |
| 92 | + /// <summary> | |
| 93 | + /// MBT人格线路信息 | |
| 94 | + /// </summary> | |
| 95 | + public TbMbtLineEntity mbtLine { get; set; } | |
| 96 | + | |
| 97 | + /// <summary> | |
| 98 | + /// 节点标题 | |
| 99 | + /// </summary> | |
| 100 | + public string title { get; set; } | |
| 101 | + | |
| 102 | + /// <summary> | |
| 103 | + /// 节点简介 | |
| 104 | + /// </summary> | |
| 105 | + public string description { get; set; } | |
| 106 | + | |
| 107 | + /// <summary> | |
| 108 | + /// 节点注意事项 | |
| 109 | + /// </summary> | |
| 110 | + public string remark { get; set; } | |
| 111 | + | |
| 112 | + /// <summary> | |
| 113 | + /// 创建时间 | |
| 114 | + /// </summary> | |
| 115 | + public DateTime? creatorTime { get; set; } | |
| 116 | + | |
| 117 | + /// <summary> | |
| 118 | + /// 修改时间 | |
| 119 | + /// </summary> | |
| 120 | + public DateTime? lastModifyTime { get; set; } | |
| 121 | + /// <summary> | |
| 122 | + /// 排序 | |
| 123 | + /// </summary> | |
| 124 | + public int? sorts { get; set; } | |
| 125 | + | |
| 126 | + /// <summary> | |
| 127 | + /// 图片信息 | |
| 128 | + /// </summary> | |
| 129 | + public string banner { get; set; } | |
| 130 | + /// <summary> | |
| 131 | + /// 图片信息 | |
| 132 | + /// </summary> | |
| 133 | + public List<FileControlsModel> Banner | |
| 134 | + { | |
| 135 | + get | |
| 136 | + { | |
| 137 | + try | |
| 138 | + { | |
| 139 | + return JsonConvert.DeserializeObject<List<FileControlsModel>>(banner); | |
| 140 | + } | |
| 141 | + catch (Exception ex) | |
| 142 | + { | |
| 143 | + return new List<FileControlsModel>(); | |
| 144 | + } | |
| 145 | + } | |
| 146 | + } | |
| 147 | + | |
| 148 | + } | |
| 76 | 149 | } | ... | ... |
antis-ncc-net-core/NCC.BlindBox.Entitys/地域线路/Dto/TbAreaLineCrInput.cs
antis-ncc-net-core/NCC.BlindBox.Entitys/地域线路/Dto/TbAreaLineInfoOutput.cs
antis-ncc-net-core/NCC.BlindBox.Entitys/地域线路/Dto/TbAreaLineListOutput.cs
antis-ncc-net-core/NCC.BlindBox.Entitys/地域线路/Entity/TbAreaLineEntity.cs
| ... | ... | @@ -52,6 +52,13 @@ namespace NCC.Blind.Entitys |
| 52 | 52 | /// </summary> |
| 53 | 53 | [SugarColumn(ColumnName = "F_Banner")] |
| 54 | 54 | public string Banner { get; set; } |
| 55 | - | |
| 55 | + | |
| 56 | + | |
| 57 | + /// <summary> | |
| 58 | + /// 百分比% | |
| 59 | + /// </summary> | |
| 60 | + [SugarColumn(ColumnName = "F_Ratio")] | |
| 61 | + public decimal Ratio { get; set; } | |
| 62 | + | |
| 56 | 63 | } |
| 57 | 64 | } |
| 58 | 65 | \ No newline at end of file | ... | ... |
antis-ncc-net-core/NCC.BlindBox.Entitys/地域线路节点/Dto/TbAreaLineNodeListOutput.cs
| ... | ... | @@ -76,4 +76,80 @@ namespace NCC.Blind.Entitys.Dto.TbAreaLineNode |
| 76 | 76 | |
| 77 | 77 | |
| 78 | 78 | } |
| 79 | + | |
| 80 | + | |
| 81 | + /// <summary> | |
| 82 | + /// 地域线路节点输入参数自定义 | |
| 83 | + /// </summary> | |
| 84 | + public class TbAreaLineNodeCustomListOutput | |
| 85 | + { | |
| 86 | + /// <summary> | |
| 87 | + /// 主键 | |
| 88 | + /// </summary> | |
| 89 | + public string id { get; set; } | |
| 90 | + | |
| 91 | + /// <summary> | |
| 92 | + /// 地域线路ID | |
| 93 | + /// </summary> | |
| 94 | + public string areaLineId { get; set; } | |
| 95 | + /// <summary> | |
| 96 | + /// 地域线路信息 | |
| 97 | + /// </summary> | |
| 98 | + public TbAreaLineEntity areaLine { get; set; } | |
| 99 | + | |
| 100 | + /// <summary> | |
| 101 | + /// 节点标题 | |
| 102 | + /// </summary> | |
| 103 | + public string title { get; set; } | |
| 104 | + | |
| 105 | + /// <summary> | |
| 106 | + /// 节点简介 | |
| 107 | + /// </summary> | |
| 108 | + public string description { get; set; } | |
| 109 | + | |
| 110 | + /// <summary> | |
| 111 | + /// 节点注意事项 | |
| 112 | + /// </summary> | |
| 113 | + public string remark { get; set; } | |
| 114 | + | |
| 115 | + /// <summary> | |
| 116 | + /// 创建时间 | |
| 117 | + /// </summary> | |
| 118 | + public DateTime? creatorTime { get; set; } | |
| 119 | + | |
| 120 | + /// <summary> | |
| 121 | + /// 修改时间 | |
| 122 | + /// </summary> | |
| 123 | + public DateTime? lastModifyTime { get; set; } | |
| 124 | + | |
| 125 | + /// <summary> | |
| 126 | + /// 图片信息 | |
| 127 | + /// </summary> | |
| 128 | + public string banner { get; set; } | |
| 129 | + | |
| 130 | + /// <summary> | |
| 131 | + /// 图片信息 | |
| 132 | + /// </summary> | |
| 133 | + public List<FileControlsModel> Banner | |
| 134 | + { | |
| 135 | + get | |
| 136 | + { | |
| 137 | + try | |
| 138 | + { | |
| 139 | + return JsonConvert.DeserializeObject<List<FileControlsModel>>(banner); | |
| 140 | + } | |
| 141 | + catch (Exception ex) | |
| 142 | + { | |
| 143 | + return new List<FileControlsModel>(); | |
| 144 | + } | |
| 145 | + } | |
| 146 | + } | |
| 147 | + | |
| 148 | + /// <summary> | |
| 149 | + /// 排序 | |
| 150 | + /// </summary> | |
| 151 | + public int? sorts { get; set; } | |
| 152 | + | |
| 153 | + | |
| 154 | + } | |
| 79 | 155 | } | ... | ... |
antis-ncc-net-core/NCC.BlindBox.Entitys/海报管理/Dto/TbPosterCrInput.cs
0 → 100644
| 1 | +using System; | |
| 2 | +using System.Collections.Generic; | |
| 3 | +using NCC.Common.Model; | |
| 4 | + | |
| 5 | +namespace NCC.Blind.Entitys.Dto.TbPoster | |
| 6 | +{ | |
| 7 | + /// <summary> | |
| 8 | + /// 海报管理修改输入参数 | |
| 9 | + /// </summary> | |
| 10 | + public class TbPosterCrInput | |
| 11 | + { | |
| 12 | + /// <summary> | |
| 13 | + /// 图片 | |
| 14 | + /// </summary> | |
| 15 | + public List<FileControlsModel> banner { get; set; } | |
| 16 | + | |
| 17 | + /// <summary> | |
| 18 | + /// 创建时间 | |
| 19 | + /// </summary> | |
| 20 | + public DateTime? creatorTime { get; set; } | |
| 21 | + | |
| 22 | + /// <summary> | |
| 23 | + /// 修改时间 | |
| 24 | + /// </summary> | |
| 25 | + public DateTime? lastModifyTime { get; set; } | |
| 26 | + | |
| 27 | + /// <summary> | |
| 28 | + /// 创建用户 | |
| 29 | + /// </summary> | |
| 30 | + public string creatorUserId { get; set; } | |
| 31 | + | |
| 32 | + /// <summary> | |
| 33 | + /// 标题 | |
| 34 | + /// </summary> | |
| 35 | + public string title { get; set; } | |
| 36 | + | |
| 37 | + } | |
| 38 | +} | ... | ... |
antis-ncc-net-core/NCC.BlindBox.Entitys/海报管理/Dto/TbPosterInfoOutput.cs
0 → 100644
| 1 | +using System; | |
| 2 | +using System.Collections.Generic; | |
| 3 | +using NCC.Common.Model; | |
| 4 | + | |
| 5 | +namespace NCC.Blind.Entitys.Dto.TbPoster | |
| 6 | +{ | |
| 7 | + /// <summary> | |
| 8 | + /// 海报管理输出参数 | |
| 9 | + /// </summary> | |
| 10 | + public class TbPosterInfoOutput | |
| 11 | + { | |
| 12 | + /// <summary> | |
| 13 | + /// 主键 | |
| 14 | + /// </summary> | |
| 15 | + public string id { get; set; } | |
| 16 | + | |
| 17 | + /// <summary> | |
| 18 | + /// 图片 | |
| 19 | + /// </summary> | |
| 20 | + public List<FileControlsModel> banner { get; set; } | |
| 21 | + | |
| 22 | + /// <summary> | |
| 23 | + /// 创建时间 | |
| 24 | + /// </summary> | |
| 25 | + public DateTime? creatorTime { get; set; } | |
| 26 | + | |
| 27 | + /// <summary> | |
| 28 | + /// 修改时间 | |
| 29 | + /// </summary> | |
| 30 | + public DateTime? lastModifyTime { get; set; } | |
| 31 | + | |
| 32 | + /// <summary> | |
| 33 | + /// 创建用户 | |
| 34 | + /// </summary> | |
| 35 | + public string creatorUserId { get; set; } | |
| 36 | + | |
| 37 | + /// <summary> | |
| 38 | + /// 标题 | |
| 39 | + /// </summary> | |
| 40 | + public string title { get; set; } | |
| 41 | + | |
| 42 | + } | |
| 43 | +} | ... | ... |
antis-ncc-net-core/NCC.BlindBox.Entitys/海报管理/Dto/TbPosterListOutput.cs
0 → 100644
| 1 | +using System; | |
| 2 | + | |
| 3 | +namespace NCC.Blind.Entitys.Dto.TbPoster | |
| 4 | +{ | |
| 5 | + /// <summary> | |
| 6 | + /// 海报管理输入参数 | |
| 7 | + /// </summary> | |
| 8 | + public class TbPosterListOutput | |
| 9 | + { | |
| 10 | + /// <summary> | |
| 11 | + /// 主键 | |
| 12 | + /// </summary> | |
| 13 | + public string id { get; set; } | |
| 14 | + | |
| 15 | + /// <summary> | |
| 16 | + /// 创建时间 | |
| 17 | + /// </summary> | |
| 18 | + public DateTime? creatorTime { get; set; } | |
| 19 | + | |
| 20 | + /// <summary> | |
| 21 | + /// 修改时间 | |
| 22 | + /// </summary> | |
| 23 | + public DateTime? lastModifyTime { get; set; } | |
| 24 | + | |
| 25 | + /// <summary> | |
| 26 | + /// 创建用户 | |
| 27 | + /// </summary> | |
| 28 | + public string creatorUserId { get; set; } | |
| 29 | + | |
| 30 | + /// <summary> | |
| 31 | + /// 标题 | |
| 32 | + /// </summary> | |
| 33 | + public string title { get; set; } | |
| 34 | + | |
| 35 | + } | |
| 36 | +} | ... | ... |
antis-ncc-net-core/NCC.BlindBox.Entitys/海报管理/Dto/TbPosterListQueryInput.cs
0 → 100644
| 1 | +using NCC.Common.Filter; | |
| 2 | +using System.Collections.Generic; | |
| 3 | + | |
| 4 | +namespace NCC.Blind.Entitys.Dto.TbPoster | |
| 5 | +{ | |
| 6 | + /// <summary> | |
| 7 | + /// 海报管理列表查询输入 | |
| 8 | + /// </summary> | |
| 9 | + public class TbPosterListQueryInput : PageInputBase | |
| 10 | + { | |
| 11 | + /// <summary> | |
| 12 | + /// 选择导出数据key | |
| 13 | + /// </summary> | |
| 14 | + public string selectKey { get; set; } | |
| 15 | + | |
| 16 | + /// <summary> | |
| 17 | + /// | |
| 18 | + /// </summary> | |
| 19 | + public int dataType { get; set; } | |
| 20 | + | |
| 21 | + | |
| 22 | + /// <summary> | |
| 23 | + /// 标题 | |
| 24 | + /// </summary> | |
| 25 | + public string title { get; set; } | |
| 26 | + | |
| 27 | + } | |
| 28 | +} | ... | ... |
antis-ncc-net-core/NCC.BlindBox.Entitys/海报管理/Dto/TbPosterUpInput.cs
0 → 100644
| 1 | +using System; | |
| 2 | +using System.Collections.Generic; | |
| 3 | + | |
| 4 | +namespace NCC.Blind.Entitys.Dto.TbPoster | |
| 5 | +{ | |
| 6 | + /// <summary> | |
| 7 | + /// 海报管理更新输入参数 | |
| 8 | + /// </summary> | |
| 9 | + public class TbPosterUpInput : TbPosterCrInput | |
| 10 | + { | |
| 11 | + /// <summary> | |
| 12 | + /// 主键 | |
| 13 | + /// </summary> | |
| 14 | + public string id { get; set; } | |
| 15 | + | |
| 16 | + } | |
| 17 | +} | ... | ... |
antis-ncc-net-core/NCC.BlindBox.Entitys/海报管理/Entity/TbPosterEntity.cs
0 → 100644
| 1 | +using NCC.Common.Const; | |
| 2 | +using SqlSugar; | |
| 3 | +using System; | |
| 4 | + | |
| 5 | +namespace NCC.Blind.Entitys | |
| 6 | +{ | |
| 7 | + /// <summary> | |
| 8 | + /// 海报管理 | |
| 9 | + /// </summary> | |
| 10 | + [SugarTable("tb_Poster")] | |
| 11 | + [Tenant(ClaimConst.TENANT_ID)] | |
| 12 | + public class TbPosterEntity | |
| 13 | + { | |
| 14 | + /// <summary> | |
| 15 | + /// 主键 | |
| 16 | + /// </summary> | |
| 17 | + [SugarColumn(ColumnName = "F_Id", IsPrimaryKey = true)] | |
| 18 | + public string Id { get; set; } | |
| 19 | + | |
| 20 | + /// <summary> | |
| 21 | + /// 图片 | |
| 22 | + /// </summary> | |
| 23 | + [SugarColumn(ColumnName = "F_Banner")] | |
| 24 | + public string Banner { get; set; } | |
| 25 | + | |
| 26 | + /// <summary> | |
| 27 | + /// 创建时间 | |
| 28 | + /// </summary> | |
| 29 | + [SugarColumn(ColumnName = "F_CreatorTime")] | |
| 30 | + public DateTime? CreatorTime { get; set; } | |
| 31 | + | |
| 32 | + /// <summary> | |
| 33 | + /// 修改时间 | |
| 34 | + /// </summary> | |
| 35 | + [SugarColumn(ColumnName = "F_LastModifyTime")] | |
| 36 | + public DateTime? LastModifyTime { get; set; } | |
| 37 | + | |
| 38 | + /// <summary> | |
| 39 | + /// 创建用户 | |
| 40 | + /// </summary> | |
| 41 | + [SugarColumn(ColumnName = "F_CreatorUserId")] | |
| 42 | + public string CreatorUserId { get; set; } | |
| 43 | + | |
| 44 | + /// <summary> | |
| 45 | + /// 标题 | |
| 46 | + /// </summary> | |
| 47 | + [SugarColumn(ColumnName = "F_Title")] | |
| 48 | + public string Title { get; set; } | |
| 49 | + | |
| 50 | + } | |
| 51 | +} | |
| 0 | 52 | \ No newline at end of file | ... | ... |
antis-ncc-net-core/NCC.BlindBox.Entitys/海报管理/Mapper/TbPosterMapper.cs
0 → 100644
| 1 | +using NCC.Common.Helper; | |
| 2 | +using NCC.Common.Model; | |
| 3 | +using NCC.Blind.Entitys.Dto.TbPoster; | |
| 4 | +using Mapster; | |
| 5 | +using System.Collections.Generic; | |
| 6 | + | |
| 7 | +namespace NCC.Blind.Entitys.Mapper.TbPoster | |
| 8 | +{ | |
| 9 | + public class Mapper : IRegister | |
| 10 | + { | |
| 11 | + public void Register(TypeAdapterConfig config) | |
| 12 | + { | |
| 13 | + config.ForType<TbPosterCrInput, TbPosterEntity>() | |
| 14 | + .Map(dest => dest.Banner, src => src.banner.ToJson()) | |
| 15 | + ; | |
| 16 | + config.ForType<TbPosterEntity, TbPosterInfoOutput>() | |
| 17 | + .Map(dest => dest.banner, src => src.Banner.ToObject<List<FileControlsModel>>()) | |
| 18 | + ; | |
| 19 | + } | |
| 20 | + } | |
| 21 | +} | ... | ... |
antis-ncc-net-core/NCC.BlindBox.Interfaces/海报管理/ITbPosterService.cs
0 → 100644
antis-ncc-net-core/NCC.BlindBox/MBT人格线路节点/TbMbtLineNodeService.cs
| ... | ... | @@ -78,6 +78,53 @@ namespace NCC.Blind.TbMbtLineNode |
| 78 | 78 | return output; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + /// <summary> | |
| 85 | + /// 获取MBT人格线路节点列表自定义 | |
| 86 | + /// </summary> | |
| 87 | + /// <param name="input">请求参数</param> | |
| 88 | + /// <returns></returns> | |
| 89 | + [HttpPost("GetMbtLineNodeCustomList")] | |
| 90 | + public async Task<dynamic> GetMbtLineNodeCustomList(TbMbtLineNodeListQueryInput input) | |
| 91 | + { | |
| 92 | + var dbLink = await _dbLinkService.GetInfo("218239598550058245"); | |
| 93 | + _db.AddConnection(new ConnectionConfig() | |
| 94 | + { | |
| 95 | + ConfigId = dbLink.Id, | |
| 96 | + DbType = _dataBaseService.ToDbType(dbLink.DbType), | |
| 97 | + ConnectionString = _dataBaseService.ToConnectionString(dbLink), | |
| 98 | + InitKeyType = InitKeyType.Attribute, | |
| 99 | + IsAutoCloseConnection = true | |
| 100 | + }); | |
| 101 | + _db.ChangeDatabase(dbLink.Id); | |
| 102 | + var sidx = input.sidx == null ? "id" : input.sidx; | |
| 103 | + var data = await _db.Queryable<TbMbtLineNodeEntity>() | |
| 104 | + .WhereIF(!string.IsNullOrEmpty(input.mbtLineId), p => p.MbtLineId.Equals(input.mbtLineId)) | |
| 105 | + .WhereIF(!string.IsNullOrEmpty(input.title), p => p.Title.Contains(input.title)) | |
| 106 | + .WhereIF(!string.IsNullOrEmpty(input.description), p => p.Description.Contains(input.description)) | |
| 107 | + .WhereIF(!string.IsNullOrEmpty(input.remark), p => p.Remark.Contains(input.remark)) | |
| 108 | + .Select(it => new TbMbtLineNodeListOutputCustom | |
| 109 | + { | |
| 110 | + id = it.Id, | |
| 111 | + mbtLineId = it.MbtLineId, | |
| 112 | + title = it.Title, | |
| 113 | + description = it.Description, | |
| 114 | + remark = it.Remark, | |
| 115 | + creatorTime = it.CreatorTime, | |
| 116 | + lastModifyTime = it.LastModifyTime, | |
| 117 | + sorts = it.Sorts, | |
| 118 | + banner = it.Banner, | |
| 119 | + }).MergeTable().Mapper(p => | |
| 120 | + { | |
| 121 | + p.mbtLine = _db.Queryable<TbMbtLineEntity>().Where(o => o.Id == p.mbtLineId).First(); | |
| 122 | + }).OrderBy(sidx + " " + input.sort).ToPagedListAsync(input.currentPage, input.pageSize); | |
| 123 | + return PageResult<TbMbtLineNodeListOutputCustom>.SqlSugarPageResult(data); | |
| 124 | + } | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 81 | 128 | /// <summary> |
| 82 | 129 | /// 获取MBT人格线路节点列表 |
| 83 | 130 | /// </summary> |
| ... | ... | @@ -107,12 +154,12 @@ namespace NCC.Blind.TbMbtLineNode |
| 107 | 154 | id = it.Id, |
| 108 | 155 | mbtLineId=it.MbtLineId, |
| 109 | 156 | title=it.Title, |
| 110 | - description=it.Description, | |
| 157 | + //description=it.Description, | |
| 111 | 158 | remark=it.Remark, |
| 112 | 159 | creatorTime=it.CreatorTime, |
| 113 | 160 | lastModifyTime=it.LastModifyTime, |
| 114 | 161 | sorts=it.Sorts, |
| 115 | - banner=it.Banner, | |
| 162 | + //banner=it.Banner, | |
| 116 | 163 | }).MergeTable().Mapper(p => |
| 117 | 164 | { |
| 118 | 165 | p.mbtLine = _db.Queryable<TbMbtLineEntity>().Where(o => o.Id == p.mbtLineId).First(); | ... | ... |
antis-ncc-net-core/NCC.BlindBox/地域线路/TbAreaLineService.cs
| ... | ... | @@ -124,6 +124,8 @@ namespace NCC.Blind.TbAreaLine |
| 124 | 124 | creatorTime=it.CreatorTime, |
| 125 | 125 | lastModifyTime=it.LastModifyTime, |
| 126 | 126 | banner=it.Banner, |
| 127 | + ratio = it.Ratio, | |
| 128 | + | |
| 127 | 129 | }).MergeTable().Mapper(p => |
| 128 | 130 | { |
| 129 | 131 | p.area = _db.Queryable<TbAreaEntity>().Where(o => o.Id == p.areaId).First(); |
| ... | ... | @@ -190,6 +192,8 @@ namespace NCC.Blind.TbAreaLine |
| 190 | 192 | remark=it.Remark, |
| 191 | 193 | creatorTime=it.CreatorTime, |
| 192 | 194 | lastModifyTime=it.LastModifyTime, |
| 195 | + ratio = it.Ratio, | |
| 196 | + | |
| 193 | 197 | }).MergeTable().OrderBy(sidx+" "+input.sort).ToListAsync(); |
| 194 | 198 | return data; |
| 195 | 199 | } |
| ... | ... | @@ -213,7 +217,7 @@ namespace NCC.Blind.TbAreaLine |
| 213 | 217 | { |
| 214 | 218 | exportData = await this.GetNoPagingList(input); |
| 215 | 219 | } |
| 216 | - List<ParamsModel> paramList = "[{\"value\":\"地域\",\"field\":\"areaId\"},{\"value\":\"线路标题\",\"field\":\"title\"},{\"value\":\"线路概况\",\"field\":\"remark\"},{\"value\":\"创建时间\",\"field\":\"creatorTime\"},{\"value\":\"修改时间\",\"field\":\"lastModifyTime\"},]".ToList<ParamsModel>(); | |
| 220 | + List<ParamsModel> paramList = "[{\"value\":\"地域\",\"field\":\"areaId\"},{\"value\":\"线路标题\",\"field\":\"title\"},{\"value\":\"线路概况\",\"field\":\"remark\"},{\"value\":\"创建时间\",\"field\":\"creatorTime\"},{\"value\":\"修改时间\",\"field\":\"lastModifyTime\"},{\"value\":\"百分比%\",\"field\":\"ratio\"},]".ToList<ParamsModel>(); | |
| 217 | 221 | ExcelConfig excelconfig = new ExcelConfig(); |
| 218 | 222 | excelconfig.FileName = "地域线路.xls"; |
| 219 | 223 | excelconfig.HeadFont = "微软雅黑"; | ... | ... |
antis-ncc-net-core/NCC.BlindBox/地域线路节点/TbAreaLineNodeService.cs
| ... | ... | @@ -80,6 +80,60 @@ namespace NCC.Blind.TbAreaLineNode |
| 80 | 80 | return output; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | + | |
| 84 | + | |
| 85 | + /// <summary> | |
| 86 | + /// 获取地域线路节点列表自定义 | |
| 87 | + /// </summary> | |
| 88 | + /// <param name="input">请求参数</param> | |
| 89 | + /// <returns></returns> | |
| 90 | + [HttpPost("GetAreaLineList")] | |
| 91 | + public async Task<dynamic> GetAreaLineList(TbAreaLineNodeListQueryInput input) | |
| 92 | + { | |
| 93 | + var dbLink = await _dbLinkService.GetInfo("218239598550058245"); | |
| 94 | + _db.AddConnection(new ConnectionConfig() | |
| 95 | + { | |
| 96 | + ConfigId = dbLink.Id, | |
| 97 | + DbType = _dataBaseService.ToDbType(dbLink.DbType), | |
| 98 | + ConnectionString = _dataBaseService.ToConnectionString(dbLink), | |
| 99 | + InitKeyType = InitKeyType.Attribute, | |
| 100 | + IsAutoCloseConnection = true | |
| 101 | + }); | |
| 102 | + _db.ChangeDatabase(dbLink.Id); | |
| 103 | + var sidx = input.sidx == null ? "id" : input.sidx; | |
| 104 | + var data = await _db.Queryable<TbAreaLineNodeEntity>() | |
| 105 | + .WhereIF(!string.IsNullOrEmpty(input.areaLineId), p => p.AreaLineId.Equals(input.areaLineId)) | |
| 106 | + .WhereIF(!string.IsNullOrEmpty(input.title), p => p.Title.Contains(input.title)) | |
| 107 | + .WhereIF(!string.IsNullOrEmpty(input.description), p => p.Description.Contains(input.description)) | |
| 108 | + .WhereIF(!string.IsNullOrEmpty(input.remark), p => p.Remark.Contains(input.remark)) | |
| 109 | + .Select(it => new TbAreaLineNodeCustomListOutput | |
| 110 | + { | |
| 111 | + id = it.Id, | |
| 112 | + areaLineId = it.AreaLineId, | |
| 113 | + title = it.Title, | |
| 114 | + description = it.Description, | |
| 115 | + remark = it.Remark, | |
| 116 | + creatorTime = it.CreatorTime, | |
| 117 | + lastModifyTime = it.LastModifyTime, | |
| 118 | + banner = it.Banner, | |
| 119 | + sorts = it.Sorts, | |
| 120 | + | |
| 121 | + }).MergeTable().Mapper(p => | |
| 122 | + { | |
| 123 | + p.areaLine = _db.Queryable<TbAreaLineEntity>().Where(o => o.Id == p.areaLineId).First(); | |
| 124 | + }).OrderBy(sidx + " " + input.sort).ToPagedListAsync(input.currentPage, input.pageSize); | |
| 125 | + return PageResult<TbAreaLineNodeCustomListOutput>.SqlSugarPageResult(data); | |
| 126 | + } | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 83 | 137 | /// <summary> |
| 84 | 138 | /// 获取地域线路节点列表 |
| 85 | 139 | /// </summary> |
| ... | ... | @@ -109,11 +163,11 @@ namespace NCC.Blind.TbAreaLineNode |
| 109 | 163 | id = it.Id, |
| 110 | 164 | areaLineId=it.AreaLineId, |
| 111 | 165 | title =it.Title, |
| 112 | - description=it.Description, | |
| 113 | - remark=it.Remark, | |
| 114 | - creatorTime=it.CreatorTime, | |
| 166 | + //description=it.Description, | |
| 167 | + remark = it.Remark, | |
| 168 | + creatorTime =it.CreatorTime, | |
| 115 | 169 | lastModifyTime=it.LastModifyTime, |
| 116 | - banner=it.Banner, | |
| 170 | + //banner=it.Banner, | |
| 117 | 171 | sorts = it.Sorts, |
| 118 | 172 | |
| 119 | 173 | }).MergeTable().Mapper(p => | ... | ... |
antis-ncc-net-core/NCC.BlindBox/海报管理/TbPosterService.cs
0 → 100644
| 1 | +using NCC.Common.Core.Manager; | |
| 2 | +using NCC.Common.Enum; | |
| 3 | +using NCC.Common.Extension; | |
| 4 | +using NCC.Common.Filter; | |
| 5 | +using NCC.Dependency; | |
| 6 | +using NCC.DynamicApiController; | |
| 7 | +using NCC.FriendlyException; | |
| 8 | +using NCC.Blind.Interfaces.TbPoster; | |
| 9 | +using Mapster; | |
| 10 | +using Microsoft.AspNetCore.Mvc; | |
| 11 | +using SqlSugar; | |
| 12 | +using System; | |
| 13 | +using System.Collections.Generic; | |
| 14 | +using System.Linq; | |
| 15 | +using System.Threading.Tasks; | |
| 16 | +using NCC.Blind.Entitys; | |
| 17 | +using NCC.Blind.Entitys.Dto.TbPoster; | |
| 18 | +using Yitter.IdGenerator; | |
| 19 | +using NCC.Common.Helper; | |
| 20 | +using NCC.JsonSerialization; | |
| 21 | +using NCC.Common.Model.NPOI; | |
| 22 | +using NCC.Common.Configuration; | |
| 23 | +using NCC.DataEncryption; | |
| 24 | +using NCC.ClayObject; | |
| 25 | +using NCC.System.Interfaces.System; | |
| 26 | + | |
| 27 | +namespace NCC.Blind.TbPoster | |
| 28 | +{ | |
| 29 | + /// <summary> | |
| 30 | + /// 海报管理服务 | |
| 31 | + /// </summary> | |
| 32 | + [ApiDescriptionSettings(Tag = "海报管理",Name = "TbPoster", Order = 200)] | |
| 33 | + [Route("api/Blind/[controller]")] | |
| 34 | + public class TbPosterService : ITbPosterService, IDynamicApiController, ITransient | |
| 35 | + { | |
| 36 | + private readonly ISqlSugarRepository<TbPosterEntity> _tbPosterRepository; | |
| 37 | + private readonly IDbLinkService _dbLinkService; | |
| 38 | + private readonly IDataBaseService _dataBaseService; | |
| 39 | + private readonly SqlSugarScope _db; | |
| 40 | + private readonly IUserManager _userManager; | |
| 41 | + | |
| 42 | + /// <summary> | |
| 43 | + /// 初始化一个<see cref="TbPosterService"/>类型的新实例 | |
| 44 | + /// </summary> | |
| 45 | + public TbPosterService( | |
| 46 | + ISqlSugarRepository<TbPosterEntity> tbPosterRepository, | |
| 47 | + IDbLinkService dbLinkService, | |
| 48 | + IDataBaseService dataBaseService, | |
| 49 | + IUserManager userManager) | |
| 50 | + { | |
| 51 | + _tbPosterRepository = tbPosterRepository; | |
| 52 | + _db = _tbPosterRepository.Context; | |
| 53 | + _dbLinkService = dbLinkService; | |
| 54 | + _dataBaseService = dataBaseService; | |
| 55 | + _userManager = userManager; | |
| 56 | + } | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + /// <summary> | |
| 64 | + /// 获取海报管理 | |
| 65 | + /// </summary> | |
| 66 | + /// <param name="id">参数</param> | |
| 67 | + /// <returns></returns> | |
| 68 | + [HttpGet("{id}")] | |
| 69 | + public async Task<dynamic> GetInfo(string id) | |
| 70 | + { | |
| 71 | + var dbLink = await _dbLinkService.GetInfo("218239598550058245"); | |
| 72 | + _db.AddConnection(new ConnectionConfig() | |
| 73 | + { | |
| 74 | + ConfigId = dbLink.Id, | |
| 75 | + DbType = _dataBaseService.ToDbType(dbLink.DbType), | |
| 76 | + ConnectionString = _dataBaseService.ToConnectionString(dbLink), | |
| 77 | + InitKeyType = InitKeyType.Attribute, | |
| 78 | + IsAutoCloseConnection = true | |
| 79 | + }); | |
| 80 | + _db.ChangeDatabase(dbLink.Id); | |
| 81 | + var entity = await _db.Queryable<TbPosterEntity>().FirstAsync(p => p.Id == id); | |
| 82 | + var output = entity.Adapt<TbPosterInfoOutput>(); | |
| 83 | + return output; | |
| 84 | + } | |
| 85 | + | |
| 86 | + | |
| 87 | + /// <summary> | |
| 88 | + /// 随机返回海报 | |
| 89 | + /// </summary> | |
| 90 | + /// <returns></returns> | |
| 91 | + [HttpPost("GetRandomPoster")] | |
| 92 | + public async Task<dynamic> GetRandomPoster() | |
| 93 | + { | |
| 94 | + var list = _db.Queryable<TbPosterEntity>().ToList(); | |
| 95 | + if (list.Count > 0) | |
| 96 | + { | |
| 97 | + List<string> ids = new List<string>(); | |
| 98 | + foreach (var item in list) | |
| 99 | + { | |
| 100 | + ids.Add(item.Id); | |
| 101 | + } | |
| 102 | + int r = new Random().Next(ids.Count); | |
| 103 | + var data = list.Find(o => o.Id == ids[r]); | |
| 104 | + return data; | |
| 105 | + } | |
| 106 | + else | |
| 107 | + { | |
| 108 | + return ""; | |
| 109 | + } | |
| 110 | + | |
| 111 | + } | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + /// <summary> | |
| 116 | + /// 获取海报管理列表 | |
| 117 | + /// </summary> | |
| 118 | + /// <param name="input">请求参数</param> | |
| 119 | + /// <returns></returns> | |
| 120 | + [HttpGet("")] | |
| 121 | + public async Task<dynamic> GetList([FromQuery] TbPosterListQueryInput input) | |
| 122 | + { | |
| 123 | + var dbLink = await _dbLinkService.GetInfo("218239598550058245"); | |
| 124 | + _db.AddConnection(new ConnectionConfig() | |
| 125 | + { | |
| 126 | + ConfigId = dbLink.Id, | |
| 127 | + DbType = _dataBaseService.ToDbType(dbLink.DbType), | |
| 128 | + ConnectionString = _dataBaseService.ToConnectionString(dbLink), | |
| 129 | + InitKeyType = InitKeyType.Attribute, | |
| 130 | + IsAutoCloseConnection = true | |
| 131 | + }); | |
| 132 | + _db.ChangeDatabase(dbLink.Id); | |
| 133 | + var sidx = input.sidx == null ? "id" : input.sidx; | |
| 134 | + var data = await _db.Queryable<TbPosterEntity>() | |
| 135 | + .WhereIF(!string.IsNullOrEmpty(input.title), p => p.Title.Contains(input.title)) | |
| 136 | + .Select(it=> new TbPosterListOutput | |
| 137 | + { | |
| 138 | + id = it.Id, | |
| 139 | + creatorTime=it.CreatorTime, | |
| 140 | + lastModifyTime=it.LastModifyTime, | |
| 141 | + creatorUserId=it.CreatorUserId, | |
| 142 | + title=it.Title, | |
| 143 | + }).MergeTable().OrderBy(sidx+" "+input.sort).ToPagedListAsync(input.currentPage, input.pageSize); | |
| 144 | + return PageResult<TbPosterListOutput>.SqlSugarPageResult(data); | |
| 145 | + } | |
| 146 | + | |
| 147 | + /// <summary> | |
| 148 | + /// 新建海报管理 | |
| 149 | + /// </summary> | |
| 150 | + /// <param name="input">参数</param> | |
| 151 | + /// <returns></returns> | |
| 152 | + [HttpPost("")] | |
| 153 | + public async Task Create([FromBody] TbPosterCrInput input) | |
| 154 | + { | |
| 155 | + var dbLink = await _dbLinkService.GetInfo("218239598550058245"); | |
| 156 | + _db.AddConnection(new ConnectionConfig() | |
| 157 | + { | |
| 158 | + ConfigId = dbLink.Id, | |
| 159 | + DbType = _dataBaseService.ToDbType(dbLink.DbType), | |
| 160 | + ConnectionString = _dataBaseService.ToConnectionString(dbLink), | |
| 161 | + InitKeyType = InitKeyType.Attribute, | |
| 162 | + IsAutoCloseConnection = true | |
| 163 | + }); | |
| 164 | + _db.ChangeDatabase(dbLink.Id); | |
| 165 | + var userInfo = await _userManager.GetUserInfo(); | |
| 166 | + var entity = input.Adapt<TbPosterEntity>(); | |
| 167 | + entity.Id = YitIdHelper.NextId().ToString(); | |
| 168 | + entity.CreatorTime = DateTime.Now; | |
| 169 | + entity.CreatorUserId = _userManager.UserId; | |
| 170 | + var isOk = await _db.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandAsync(); | |
| 171 | + if (!(isOk > 0)) throw NCCException.Oh(ErrorCode.COM1000); | |
| 172 | + } | |
| 173 | + | |
| 174 | + /// <summary> | |
| 175 | + /// 获取海报管理无分页列表 | |
| 176 | + /// </summary> | |
| 177 | + /// <param name="input">请求参数</param> | |
| 178 | + /// <returns></returns> | |
| 179 | + [NonAction] | |
| 180 | + public async Task<dynamic> GetNoPagingList([FromQuery] TbPosterListQueryInput input) | |
| 181 | + { | |
| 182 | + var dbLink = await _dbLinkService.GetInfo("218239598550058245"); | |
| 183 | + _db.AddConnection(new ConnectionConfig() | |
| 184 | + { | |
| 185 | + ConfigId = dbLink.Id, | |
| 186 | + DbType = _dataBaseService.ToDbType(dbLink.DbType), | |
| 187 | + ConnectionString = _dataBaseService.ToConnectionString(dbLink), | |
| 188 | + InitKeyType = InitKeyType.Attribute, | |
| 189 | + IsAutoCloseConnection = true | |
| 190 | + }); | |
| 191 | + _db.ChangeDatabase(dbLink.Id); | |
| 192 | + var sidx = input.sidx == null ? "id" : input.sidx; | |
| 193 | + var data = await _db.Queryable<TbPosterEntity>() | |
| 194 | + .WhereIF(!string.IsNullOrEmpty(input.title), p => p.Title.Contains(input.title)) | |
| 195 | + .Select(it=> new TbPosterListOutput | |
| 196 | + { | |
| 197 | + id = it.Id, | |
| 198 | + creatorTime=it.CreatorTime, | |
| 199 | + lastModifyTime=it.LastModifyTime, | |
| 200 | + creatorUserId=it.CreatorUserId, | |
| 201 | + title=it.Title, | |
| 202 | + }).MergeTable().OrderBy(sidx+" "+input.sort).ToListAsync(); | |
| 203 | + return data; | |
| 204 | + } | |
| 205 | + | |
| 206 | + /// <summary> | |
| 207 | + /// 导出海报管理 | |
| 208 | + /// </summary> | |
| 209 | + /// <param name="input">请求参数</param> | |
| 210 | + /// <returns></returns> | |
| 211 | + [HttpGet("Actions/Export")] | |
| 212 | + public async Task<dynamic> Export([FromQuery] TbPosterListQueryInput input) | |
| 213 | + { | |
| 214 | + var userInfo = await _userManager.GetUserInfo(); | |
| 215 | + var exportData = new List<TbPosterListOutput>(); | |
| 216 | + if (input.dataType == 0) | |
| 217 | + { | |
| 218 | + var data = Clay.Object(await this.GetList(input)); | |
| 219 | + exportData = data.Solidify<PageResult<TbPosterListOutput>>().list; | |
| 220 | + } | |
| 221 | + else | |
| 222 | + { | |
| 223 | + exportData = await this.GetNoPagingList(input); | |
| 224 | + } | |
| 225 | + List<ParamsModel> paramList = "[{\"value\":\"标题\",\"field\":\"title\"},{\"value\":\"创建时间\",\"field\":\"creatorTime\"},{\"value\":\"修改时间\",\"field\":\"lastModifyTime\"},{\"value\":\"创建用户\",\"field\":\"creatorUserId\"},]".ToList<ParamsModel>(); | |
| 226 | + ExcelConfig excelconfig = new ExcelConfig(); | |
| 227 | + excelconfig.FileName = "海报管理.xls"; | |
| 228 | + excelconfig.HeadFont = "微软雅黑"; | |
| 229 | + excelconfig.HeadPoint = 10; | |
| 230 | + excelconfig.IsAllSizeColumn = true; | |
| 231 | + excelconfig.ColumnModel = new List<ExcelColumnModel>(); | |
| 232 | + List<string> selectKeyList = input.selectKey.Split(',').ToList(); | |
| 233 | + foreach (var item in selectKeyList) | |
| 234 | + { | |
| 235 | + var isExist = paramList.Find(p => p.field == item); | |
| 236 | + if (isExist != null) | |
| 237 | + { | |
| 238 | + excelconfig.ColumnModel.Add(new ExcelColumnModel() { Column = isExist.field, ExcelColumn = isExist.value }); | |
| 239 | + } | |
| 240 | + } | |
| 241 | + var addPath = FileVariable.TemporaryFilePath + excelconfig.FileName; | |
| 242 | + ExcelExportHelper<TbPosterListOutput>.Export(exportData, excelconfig, addPath); | |
| 243 | + var fileName = _userManager.UserId + "|" + addPath + "|xls"; | |
| 244 | + var output = new | |
| 245 | + { | |
| 246 | + name = excelconfig.FileName, | |
| 247 | + url = "/api/File/Download?encryption=" + DESCEncryption.Encrypt(fileName, "NCC") | |
| 248 | + }; | |
| 249 | + return output; | |
| 250 | + } | |
| 251 | + | |
| 252 | + /// <summary> | |
| 253 | + /// 批量删除海报管理 | |
| 254 | + /// </summary> | |
| 255 | + /// <param name="ids">主键数组</param> | |
| 256 | + /// <returns></returns> | |
| 257 | + [HttpPost("batchRemove")] | |
| 258 | + public async Task BatchRemove([FromBody] List<string> ids) | |
| 259 | + { | |
| 260 | + var dbLink = await _dbLinkService.GetInfo("218239598550058245"); | |
| 261 | + _db.AddConnection(new ConnectionConfig() | |
| 262 | + { | |
| 263 | + ConfigId = dbLink.Id, | |
| 264 | + DbType = _dataBaseService.ToDbType(dbLink.DbType), | |
| 265 | + ConnectionString = _dataBaseService.ToConnectionString(dbLink), | |
| 266 | + InitKeyType = InitKeyType.Attribute, | |
| 267 | + IsAutoCloseConnection = true | |
| 268 | + }); | |
| 269 | + _db.ChangeDatabase(dbLink.Id); | |
| 270 | + var entitys = await _db.Queryable<TbPosterEntity>().In(it => it.Id, ids).ToListAsync(); | |
| 271 | + if (entitys.Count > 0) | |
| 272 | + { | |
| 273 | + try | |
| 274 | + { | |
| 275 | + //开启事务 | |
| 276 | + _db.BeginTran(); | |
| 277 | + //批量删除海报管理 | |
| 278 | + await _db.Deleteable<TbPosterEntity>().In(d => d.Id,ids).ExecuteCommandAsync(); | |
| 279 | + //关闭事务 | |
| 280 | + _db.CommitTran(); | |
| 281 | + } | |
| 282 | + catch (Exception) | |
| 283 | + { | |
| 284 | + //回滚事务 | |
| 285 | + _db.RollbackTran(); | |
| 286 | + throw NCCException.Oh(ErrorCode.COM1002); | |
| 287 | + } | |
| 288 | + } | |
| 289 | + } | |
| 290 | + | |
| 291 | + /// <summary> | |
| 292 | + /// 更新海报管理 | |
| 293 | + /// </summary> | |
| 294 | + /// <param name="id">主键</param> | |
| 295 | + /// <param name="input">参数</param> | |
| 296 | + /// <returns></returns> | |
| 297 | + [HttpPut("{id}")] | |
| 298 | + public async Task Update(string id, [FromBody] TbPosterUpInput input) | |
| 299 | + { | |
| 300 | + var dbLink = await _dbLinkService.GetInfo("218239598550058245"); | |
| 301 | + _db.AddConnection(new ConnectionConfig() | |
| 302 | + { | |
| 303 | + ConfigId = dbLink.Id, | |
| 304 | + DbType = _dataBaseService.ToDbType(dbLink.DbType), | |
| 305 | + ConnectionString = _dataBaseService.ToConnectionString(dbLink), | |
| 306 | + InitKeyType = InitKeyType.Attribute, | |
| 307 | + IsAutoCloseConnection = true | |
| 308 | + }); | |
| 309 | + _db.ChangeDatabase(dbLink.Id); | |
| 310 | + var entity = input.Adapt<TbPosterEntity>(); | |
| 311 | + entity.LastModifyTime = DateTime.Now; | |
| 312 | + var isOk = await _db.Updateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); | |
| 313 | + if (!(isOk > 0)) throw NCCException.Oh(ErrorCode.COM1001); | |
| 314 | + } | |
| 315 | + | |
| 316 | + /// <summary> | |
| 317 | + /// 删除海报管理 | |
| 318 | + /// </summary> | |
| 319 | + /// <returns></returns> | |
| 320 | + [HttpDelete("{id}")] | |
| 321 | + public async Task Delete(string id) | |
| 322 | + { | |
| 323 | + var dbLink = await _dbLinkService.GetInfo("218239598550058245"); | |
| 324 | + _db.AddConnection(new ConnectionConfig() | |
| 325 | + { | |
| 326 | + ConfigId = dbLink.Id, | |
| 327 | + DbType = _dataBaseService.ToDbType(dbLink.DbType), | |
| 328 | + ConnectionString = _dataBaseService.ToConnectionString(dbLink), | |
| 329 | + InitKeyType = InitKeyType.Attribute, | |
| 330 | + IsAutoCloseConnection = true | |
| 331 | + }); | |
| 332 | + _db.ChangeDatabase(dbLink.Id); | |
| 333 | + var entity = await _db.Queryable<TbPosterEntity>().FirstAsync(p => p.Id == id); | |
| 334 | + _ = entity ?? throw NCCException.Oh(ErrorCode.COM1005); | |
| 335 | + var isOk = await _db.Deleteable<TbPosterEntity>().Where(d => d.Id == id).ExecuteCommandAsync(); | |
| 336 | + if (!(isOk > 0)) throw NCCException.Oh(ErrorCode.COM1002); | |
| 337 | + } | |
| 338 | + } | |
| 339 | +} | ... | ... |
antis-ncc-net-core/NCC.BlindBox/盲盒订单/TbBoxOrderService.cs
| ... | ... | @@ -342,9 +342,11 @@ namespace NCC.Blind.TbBoxOrder |
| 342 | 342 | { |
| 343 | 343 | ids.Add(item.Id); |
| 344 | 344 | } |
| 345 | - int r = new Random().Next(ids.Count); | |
| 346 | - var data = list.Find(o => o.Id == ids[r]); | |
| 347 | - if (data.IsNullOrEmpty()) throw NCCException.Oh($"暂无地域路线哦"); | |
| 345 | + var data = GetRandomItem(list); | |
| 346 | + Log.Information($"概率值:{JsonConvert.SerializeObject(data)}"); | |
| 347 | + //int r = new Random().Next(ids.Count); | |
| 348 | + //var data = list.Find(o => o.Id == ids[r]); | |
| 349 | + if (data.IsNullOrEmpty()) throw NCCException.Oh($"暂无地域路线或者百分比之和不等于100!"); | |
| 348 | 350 | var logResult = new TbBoxLogEntity |
| 349 | 351 | { |
| 350 | 352 | Id = YitIdHelper.NextId().ToString(), |
| ... | ... | @@ -389,6 +391,29 @@ namespace NCC.Blind.TbBoxOrder |
| 389 | 391 | |
| 390 | 392 | } |
| 391 | 393 | |
| 394 | + /// <summary> | |
| 395 | + /// 概率算法 | |
| 396 | + /// </summary> | |
| 397 | + /// <param name="items"></param> | |
| 398 | + /// <returns></returns> | |
| 399 | + public static TbAreaLineEntity GetRandomItem(List<TbAreaLineEntity> items) | |
| 400 | + { | |
| 401 | + double totalPercentage = items.Sum(x => x.Ratio.ToDouble()); | |
| 402 | + double randomValue = new Random().NextDouble() * totalPercentage; | |
| 403 | + | |
| 404 | + foreach (TbAreaLineEntity item in items) | |
| 405 | + { | |
| 406 | + randomValue -= item.Ratio.ToDouble(); | |
| 407 | + if (randomValue <= 0) | |
| 408 | + { | |
| 409 | + return item; | |
| 410 | + } | |
| 411 | + } | |
| 412 | + | |
| 413 | + return null; // 如果总百分比小于100%或列表为空,则返回null | |
| 414 | + } | |
| 415 | + | |
| 416 | + | |
| 392 | 417 | |
| 393 | 418 | |
| 394 | 419 | |
| ... | ... | @@ -513,14 +538,19 @@ namespace NCC.Blind.TbBoxOrder |
| 513 | 538 | // if (areaLine.IsNullOrEmpty()) throw NCCException.Oh($"暂未查询到地域路线"); |
| 514 | 539 | // } |
| 515 | 540 | //} |
| 516 | - var settingPrice = _db.Queryable<TbSettingPriceEntity>().Where(o => o.Type == BlindBoxStatus.BlindBoxSettingPriceType.盲盒价格.GetHashCode().ToString()) | |
| 517 | -.First(); | |
| 518 | - if (settingPrice.IsNullOrEmpty()) throw NCCException.Oh($"暂未查询到盲盒价格,请联系管理员!"); | |
| 541 | + var settingPrice = _db.Queryable<TbSettingPriceEntity>().ToList(); | |
| 542 | + if (settingPrice.IsNullOrEmpty()) throw NCCException.Oh($"暂未查询到价格设定数据,请联系管理员!"); | |
| 543 | + var manghe = settingPrice.Find(o => o.Type == BlindBoxStatus.BlindBoxSettingPriceType.盲盒价格.GetHashCode().ToString()); | |
| 544 | + var menpiao = settingPrice.Find(o => o.Type == BlindBoxStatus.BlindBoxSettingPriceType.门票价格.GetHashCode().ToString()); | |
| 545 | + if (menpiao.IsNullOrEmpty()) throw NCCException.Oh($"暂未查询到门票价格,请联系管理员!"); | |
| 546 | + if (manghe.IsNullOrEmpty()) throw NCCException.Oh($"暂未查询到盲盒价格,请联系管理员!"); | |
| 547 | + decimal totalMoneys = manghe.Price + menpiao.Price; | |
| 548 | + Log.Information($"支付总价:{totalMoneys}"); | |
| 519 | 549 | var entity = input.Adapt<TbBoxOrderEntity>(); |
| 520 | 550 | entity.OrderNumber = ServiceHelper.getTime().ToString(); |
| 521 | 551 | entity.Status = BlindBoxStatus.BlindBoxOrderStatus.未付款.GetHashCode().ToString(); |
| 522 | 552 | entity.CreatorTime = DateTime.Now; |
| 523 | - entity.TotalPrice = settingPrice.Price; | |
| 553 | + entity.TotalPrice = totalMoneys; | |
| 524 | 554 | entity.Status = BlindBoxStatus.BlindBoxOrderStatus.未付款.GetHashCode().ToString(); |
| 525 | 555 | entity.Id = YitIdHelper.NextId().ToString(); |
| 526 | 556 | entity.CreatorTime = DateTime.Now; | ... | ... |