소스 검색

work 财务结算-账户列表 开发

jiayufei 3 년 전
부모
커밋
08bfa8b9e7
3개의 변경된 파일146개의 추가작업 그리고 3개의 파일을 삭제
  1. 6 0
      src/views/modules/settlement-account/settlement-account.less
  2. 139 2
      src/views/modules/settlement-account/settlement-account.vue
  3. 1 1
      vue.config.js

+ 6 - 0
src/views/modules/settlement-account/settlement-account.less

@@ -47,4 +47,10 @@
 }
 /deep/ .settlement-modal-class {
     width: 700px !important;
+    .file-down-title {
+        margin-left: 12px;
+        position: absolute;
+        top: -10px;
+        right: -100px;
+    }
 }

+ 139 - 2
src/views/modules/settlement-account/settlement-account.vue

@@ -146,28 +146,62 @@
                             <a-select-option :value="2">头条</a-select-option>
                         </a-select>
                     </a-form-model-item>
-                    <a-form-model-item label="选择项目名称" prop="name7">
+                    <a-form-model-item label="选择项目名称" prop="name8">
                         <a-select v-model="policyOperationForm.name8" placeholder="请选择项目名称">
                             <a-select-option :value="1">快手</a-select-option>
                             <a-select-option :value="2">头条</a-select-option>
                         </a-select>
                     </a-form-model-item>
+                    <a-form-model-item label="选择媒体">
+                        <a-radio-group v-model="policyOperationForm.name9" button-style="solid">
+                            <a-radio-button value="a">头条</a-radio-button>
+                            <a-radio-button value="b">快手</a-radio-button>
+                        </a-radio-group>
+                    </a-form-model-item>
+                    <a-form-model-item label="运营方式">
+                        <a-radio-group v-model="policyOperationForm.name10" button-style="solid">
+                            <a-radio-button value="a">自运营</a-radio-button>
+                            <a-radio-button value="b">代运营</a-radio-button>
+                        </a-radio-group>
+                    </a-form-model-item>
+                    <a-form-model-item label="附件上传">
+                        <a-upload
+                            name="file"
+                            :file-list="fileList"
+                            :before-upload="beforeUpload"
+                            @change="handleChange"
+                        >
+                            <a-button><a-icon type="upload" />文件上传</a-button>
+                        </a-upload>
+                        <a class="file-down-title" @click="handleFileDownTitle">文件格式下载</a>
+                        <p class="upload-txt-rules">支持扩展名:.xlxs</p>
+                    </a-form-model-item>
                 </a-form-model>
             </div>
         </a-modal>
     </div>
 </template>
 <script>
+import BMF from 'browser-md5-file';
+let COS = require('cos-js-sdk-v5');
+let cos = new COS({
+    SecretId: 'AKIDE6IpMi8fJQRCg1iuWzFajjRs43kbbets',
+    SecretKey: 'tXzuwMfplTTK3c9GFUyETilasvQfePu9'
+});
+
 export default {
     name: 'settlement-account',
     data() {
         return {
+            fileList: [],
             labelCol: {span: 7},
             wrapperCol: {span: 14},
             policyOperationForm: {
                 name6: undefined,
                 name7: undefined,
                 name8: undefined,
+                name9: 'a',
+                name10: 'a',
             },
             policyOperationRules: {
                 name6: [{required: true, message: '请选择广告主公司名称', trigger: 'change'}],
@@ -276,18 +310,121 @@ export default {
         this.searchForm = this.$form.createForm(this);
     },
     methods: {
+        // 文件格式下载
+        handleFileDownTitle() {
+            console.log('文件格式下载');
+        },
+        beforeUpload(file) {
+            this.cosUpload(file);
+        },
+        handleMd5(file) {
+            let bmf = new BMF();
+            let that = this;
+            return new Promise(function (resolve, reject) {
+                bmf.md5(file, (err, md5) => {
+                    getAction('kuaishouPopulationPackage/checkPopulationPackage', {signature: md5}).then(result => {
+                        if (result.code === 200) {
+                            that.personNameDisabled = false;
+                            that.personResourceDisabled = false;
+                            resolve();
+                        }
+                        else if (result.code === 201) {
+                            that.$message.error(result.message);
+                            that.personForm.name = result.result.orientationName;
+                            that.personForm.resource = result.result.type;
+                            that.personNameDisabled = true;
+                            that.personResourceDisabled = true;
+                            reject();
+                        }
+                    }).catch(error => {
+                        console.log(error, 'eeee');
+                        reject();
+                    });
+                });
+            });
+        },
+        handleChange(info) {
+            this.fileList = info.fileList;
+        },
+        cosUpload(file) {
+            let that = this;
+            let date = new Date();
+            let y = date.getFullYear();
+            let MM = date.getMonth() + 1;
+            MM = MM < 10 ? '0' + MM : MM;
+            let d = date.getDate();
+            d = d < 10 ? '0' + d : d;
+            let timeElse = new Date().getTime();
+            let arr = file.name.split('.');
+            let str = '';
+            for (let i = 0; i < arr.length; i++) {
+                if (i === arr.length - 1) {
+                }
+                else {
+                    if (i === arr.length - 2) {
+                        str += arr[i];
+                    }
+                    else {
+                        str += arr[i] + '.';
+                    }
+                }
+            }
+            cos.putObject(
+                {
+                    Bucket: 'media-1301855440',
+                    Region: 'ap-chongqing',
+                    // 存储桶所在地域,必须字段
+                    Key: that.uploadType + '/' + y + '-' + MM + '-' + d + '/' + str + '-' + timeElse + '.' + arr[arr.length - 1],
+                    StorageClass: 'STANDARD',
+                    Body: file // 上传文件对象
+                },
+                function (err, data) {
+                    if (err) {
+                        that.$message.error('上传失败!!!' + err);
+                        return;
+                    }
+                    that.loadingElse = false;
+                    that.fileList.push({
+                        uid: file.name,
+                        name: file.name,
+                        status: 'done',
+                        url: '//' + data.Location
+                    });
+                    if (that.fileList.length > 1) {
+                        that.fileList = that.fileList.slice(-1);
+                    }
+                    const isZip = file.type.includes('xlxs');
+                    const fileOvesize = file.size > (1024 * 1024 * 1024);
+                    if (!isZip) {
+                        that.$message.error('只能上传xlxs格式的文件');
+                        return;
+                    }
+                    if (fileOvesize) {
+                        that.$message.error('文件大小不能超过1G');
+                        return;
+                    }
+                    // that.handleMd5(file);
+                }
+            );
+        },
         // 上传确定按钮操作
         handlePolicyOperationSure() {
             console.log('上传确定按钮操作');
         },
         // 上传取消按钮操作
-        handlePolicyOperationSure() {
+        handlePolicyOperationCancel() {
             console.log('上传取消按钮操作');
             this.policyOperationStatus = false;
         },
         // 删除操作
         handleSettleDel(list) {
             console.log(list, '删除操作');
+            let that = this;
+            this.$confirm({
+                title: '提示',
+                content: '确认删除该条数据',
+                onOk() {}
+            });
         },
         // 分页操作按钮
         onShowSizeChange(current, pageSize) {

+ 1 - 1
vue.config.js

@@ -64,7 +64,7 @@ module.exports = {
 	devServer: {
 		hot:true,
 		// inline: true,
-		port: 3000,
+		port: 8080,
 		open : true,
 		proxy: {
 			'/jeecg-boot': {