|
@@ -65,7 +65,7 @@
|
|
|
prop="fields"
|
|
|
>
|
|
|
<el-checkbox
|
|
|
- v-for="field in signDatas.header"
|
|
|
+ v-for="field in signDatas.basic"
|
|
|
:key="field.code"
|
|
|
v-model="field.enable"
|
|
|
:disabled="field.disabled"
|
|
@@ -73,7 +73,7 @@
|
|
|
>
|
|
|
<el-divider></el-divider>
|
|
|
<el-checkbox
|
|
|
- v-for="field in signDatas.body"
|
|
|
+ v-for="field in signDatas.table"
|
|
|
:key="field.code"
|
|
|
v-model="field.enable"
|
|
|
:disabled="field.disabled"
|
|
@@ -115,7 +115,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { updateTemplate } from "../api";
|
|
|
+import { templateDetail, updateTemplate } from "../api";
|
|
|
import { attachmentDetail } from "../../login/api";
|
|
|
import UploadFileView from "@/components/UploadFileView";
|
|
|
import { TEMPLATE_TYPE } from "@/constants/enumerate";
|
|
@@ -173,8 +173,8 @@ export default {
|
|
|
return callback();
|
|
|
} else {
|
|
|
if (
|
|
|
- !this.signDatas.header.some(item => item.enable) ||
|
|
|
- !this.signDatas.body.some(item => item.enable)
|
|
|
+ !this.signDatas.basic.some(item => item.enable) ||
|
|
|
+ !this.signDatas.table.some(item => item.enable)
|
|
|
) {
|
|
|
return callback(new Error("请选择显示字段"));
|
|
|
}
|
|
@@ -235,17 +235,44 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
- initData(val) {
|
|
|
- this.modalForm = this.$objAssign(initModalForm, val);
|
|
|
+ async initData(val) {
|
|
|
if (val.id) {
|
|
|
- this.getAttachment();
|
|
|
+ const data = await templateDetail(val.id);
|
|
|
+ this.modalForm = this.$objAssign(initModalForm, data);
|
|
|
+
|
|
|
+ const unAttachmentTemps = ["SIGN", "PACKAGE"];
|
|
|
+ if (unAttachmentTemps.includes(this.modalForm.classify)) {
|
|
|
+ this.initFieldData(data);
|
|
|
+ } else {
|
|
|
+ this.getAttachment();
|
|
|
+ }
|
|
|
} else {
|
|
|
+ this.modalForm = this.$objAssign(initModalForm, val);
|
|
|
+ this.packageDatas = [...PACKAGE_DATA];
|
|
|
+ this.signDatas = { ...SIGN_DATA };
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs.UploadFileView.setAttachmentName("");
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
+ initFieldData(data) {
|
|
|
+ const displayRange = data.displayRange
|
|
|
+ ? JSON.parse(data.displayRange)
|
|
|
+ : null;
|
|
|
+ if (!displayRange) {
|
|
|
+ this.packageDatas = [...PACKAGE_DATA];
|
|
|
+ this.signDatas = { ...SIGN_DATA };
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (data.classify === "PACKAGE") {
|
|
|
+ this.packageDatas = displayRange;
|
|
|
+ } else {
|
|
|
+ this.signDatas = displayRange;
|
|
|
+ }
|
|
|
+ },
|
|
|
async getAttachment() {
|
|
|
+ if (!this.instance.attachmentId) return;
|
|
|
const data = await attachmentDetail(this.instance.attachmentId);
|
|
|
this.attachment = data;
|
|
|
|
|
@@ -280,11 +307,8 @@ export default {
|
|
|
};
|
|
|
if (this.modalForm.classify === "PACKAGE") {
|
|
|
datas.displayRange = this.packageDatas;
|
|
|
- } else {
|
|
|
- datas.displayRange = {
|
|
|
- basic: this.signDatas.header,
|
|
|
- table: this.signDatas.body
|
|
|
- };
|
|
|
+ } else if (this.modalForm.classify === "SIGN") {
|
|
|
+ datas.displayRange = this.signDatas;
|
|
|
}
|
|
|
const data = await updateTemplate(datas).catch(() => {});
|
|
|
this.isSubmit = false;
|