Explorar o código

Merge branch 'master' of https://git.agilestar.cn/spfm-group/spfm-market-front

daiqisheng %!s(int64=3) %!d(string=hai) anos
pai
achega
3573ce6f9a

+ 3 - 3
public/index.html

@@ -8,7 +8,7 @@
   <link rel="icon" href="<%= BASE_URL %>favicon.ico">
   <title>业务服务工作台</title>
   <script src="static/js/crypoto-js.js"></script>
-  
+
   <script src="/static/js/luckysheet/plugins/js/plugin.js"></script>
   <script src="/static/js/luckysheet/luckysheet.umd.js"></script>
   <link rel='stylesheet' href='/static/js/luckysheet/plugins/css/pluginsCss.css' />
@@ -25,9 +25,9 @@
   <div id="app"></div>
   <!-- built files will be auto injected -->
   <script type="text/javascript">
-    // window.staticHost = 'http://10.230.26.15:8000/spfm'; // 正式
+    window.staticHost = 'http://10.230.26.15:8000/spfm'; // 正式
     // window.staticHost = 'http://10.149.85.90:8000/spfm'; // 测试
-    window.staticHost = 'http://192.168.0.103:9600/';
+    // window.staticHost = 'http://192.168.0.103:9600/';
     // window.staticHost = 'http://192.168.2.142:9600/';
   </script>
 </body>

+ 54 - 26
src/pages/main/performance/components/sheet.vue

@@ -2,7 +2,7 @@
  * @Author       : yuanrunwei
  * @Date         : 2021-12-04 14:23:58
  * @LastEditors  : yuanrunwei
- * @LastEditTime : 2021-12-24 10:05:55
+ * @LastEditTime : 2021-12-24 16:00:44
  * @FilePath     : \spfm-market-front\src\pages\main\performance\components\sheet.vue
 -->
 
@@ -29,7 +29,7 @@
                     type="primary"
                     @click="handleSave"
                     :disabled="handleForbid()"
-                    >保存</el-button
+                    >{{ id ? "保存" : "新增" }}</el-button
                 >
             </template>
         </div>
@@ -39,7 +39,7 @@
             :visible="visible"
             :modal="false"
             width="700px"
-            @confirm="handlePower"
+            @confirm="handleAuth"
             @cancel="handleVisible"
         >
             <el-form ref="form" :model="form" label-width="100px">
@@ -194,7 +194,7 @@ export default {
         },
         async handleQuery() {
             const {
-                data: { templateContent, templateName },
+                data: { templateContent, templateName, list },
             } = await this.$http({
                 url: "/market/CMKFileTemplate/QueryCMKFileTemplateById",
                 method: "post",
@@ -205,6 +205,20 @@ export default {
                     templateId: this.id,
                 },
             });
+            if (list && list.length) {
+                const [{ type, allowEditingColumns }] = list;
+                this.form = {
+                    ...this.form,
+                    type: JSON.parse(type),
+                    array: allowEditingColumns.split(","),
+                    charge: list.map(
+                        ({ principalId, principalName, rowNum }) => ({
+                            value: `${principalId},${principalName}`,
+                            key: rowNum.split(","),
+                        })
+                    ),
+                };
+            }
             this.handleCreate({
                 json: JSON.parse(templateContent),
                 name: templateName,
@@ -296,23 +310,7 @@ export default {
                 window.luckysheet.getWorkbookName()
             );
         },
-        async handleSave() {
-            const sheet_name = window.luckysheet.getSheet().name;
-            const data = window.luckysheet.getSheet(sheet_name);
-            const workbook_name = window.luckysheet.getWorkbookName();
-            const {
-                data: { body },
-            } = await this.$http({
-                url: "/market/CMKFileTemplate/CMKFileTemplateAdd",
-                method: "post",
-                headers: {
-                    "Content-Type": "application/json",
-                },
-                data: {
-                    templateContent: JSON.stringify(data),
-                    templateName: workbook_name,
-                },
-            });
+        async handleAddAuth({ id }) {
             const object = {};
             const { array, charge, type } = this.form;
             charge.map(({ key, value }) => {
@@ -321,7 +319,9 @@ export default {
                 }
             });
             await this.$http({
-                url: "/market/CMKFileTemplateAuthority/CMKFileTemplateAuthorityAdd",
+                url: this.id
+                    ? "/market/CMKFileTemplateAuthority/CMKFileTemplateAuthorityUpdate"
+                    : "/market/CMKFileTemplateAuthority/CMKFileTemplateAuthorityAdd",
                 method: "post",
                 headers: {
                     "Content-Type": "application/json",
@@ -329,13 +329,37 @@ export default {
                 data: {
                     allowEditingColumns: array.join(","),
                     auth: JSON.stringify(object),
-                    templateId: body,
+                    templateId: id,
                     type,
                 },
             });
-            this.$message.success("保存成功");
+            this.$message.success("操作成功");
+        },
+        async handleSave() {
+            const sheet_name = window.luckysheet.getSheet().name;
+            const data = window.luckysheet.getSheet(sheet_name);
+            const workbook_name = window.luckysheet.getWorkbookName();
+            const {
+                data: { body },
+            } = await this.$http({
+                url: this.id
+                    ? "/market/CMKIssued/CMKIssuedSubmit"
+                    : "/market/CMKFileTemplate/CMKFileTemplateAdd",
+                method: "post",
+                headers: {
+                    "Content-Type": "application/json",
+                },
+                data: {
+                    id: this.id,
+                    templateContent: JSON.stringify(data),
+                    templateName: workbook_name,
+                },
+            });
+            if (!this.id) {
+                this.handleAddAuth({ id: body });
+            }
         },
-        handlePower() {
+        handleAuth() {
             this.$refs["form"].validate((valid) => {
                 if (valid) {
                     if (this.handleForbid()) {
@@ -343,7 +367,11 @@ export default {
                         return false;
                     }
                     this.handleVisible();
-                    this.$message.success("设置成功");
+                    if (this.id) {
+                        this.handleAddAuth({ id: this.id });
+                    } else {
+                        this.$message.success("设置成功");
+                    }
                 }
             });
         },

+ 50 - 23
src/pages/main/performance/mould.vue

@@ -29,14 +29,38 @@
             @confirm="handleIssue"
             :visible="issue_visible"
         >
-            <el-form label-width="100px" :model="issue_form">
-                <el-form-item label="填报事由">
+            <el-form label-width="120px" :model="issue_form" ref="issue_ref">
+                <el-form-item
+                    label="填报事由"
+                    prop="reason"
+                    :rules="{
+                        required: true,
+                        message: '填报事由不能为空',
+                        trigger: 'blur',
+                    }"
+                >
                     <el-input v-model="issue_form.reason"></el-input>
                 </el-form-item>
-                <el-form-item label="填报注意事项">
+                <el-form-item
+                    label="填报注意事项"
+                    prop="precautions"
+                    :rules="{
+                        required: true,
+                        message: '填报注意事项不能为空',
+                        trigger: 'blur',
+                    }"
+                >
                     <el-input v-model="issue_form.precautions"></el-input>
                 </el-form-item>
-                <el-form-item label="截止时间">
+                <el-form-item
+                    label="截止时间"
+                    prop="endTime"
+                    :rules="{
+                        required: true,
+                        message: '截止时间不能为空',
+                        trigger: 'change',
+                    }"
+                >
                     <el-date-picker v-model="issue_form.endTime" type="date">
                     </el-date-picker>
                 </el-form-item>
@@ -216,25 +240,28 @@ export default {
             });
         },
         handleIssue() {
-            this.$http({
-                url: "/market/CMKFileTemplate/issuedCMKFileTemplateById",
-                method: "post",
-                headers: {
-                    "Content-Type": "application/json",
-                },
-                data: {
-                    ...this.issue_form,
-                    endTime: this.$formatDate(
-                        this.issue_form.endTime,
-                        "YYYY-MM-DD"
-                    ),
-                    templateId: this.issue_id,
-                },
-            }).then(() => {
-                this.handleVisible("issue");
-                this.$message.success("下发成功");
-
-                this.handleInit();
+            this.$refs["issue_ref"].validate((valid) => {
+                if (valid) {
+                    this.$http({
+                        url: "/market/CMKFileTemplate/issuedCMKFileTemplateById",
+                        method: "post",
+                        headers: {
+                            "Content-Type": "application/json",
+                        },
+                        data: {
+                            ...this.issue_form,
+                            endTime: this.$formatDate(
+                                this.issue_form.endTime,
+                                "YYYY-MM-DD"
+                            ),
+                            templateId: this.issue_id,
+                        },
+                    }).then(() => {
+                        this.handleVisible("issue");
+                        this.$message.success("下发成功");
+                        this.handleInit();
+                    });
+                }
             });
         },
     },