12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <template>
- <el-dialog
- class="edit-line edit-dialog"
- :visible.sync="dialogIsShow"
- title="线条编辑"
- top="10vh"
- width="640px"
- :close-on-click-modal="false"
- :close-on-press-escape="false"
- append-to-body
- @open="opened"
- @close="closed"
- >
- <el-form
- ref="modalFormComp"
- :model="modalForm"
- :key="modalForm.id"
- label-width="100px"
- >
- <el-form-item label="线条颜色:">
- <color-select v-model="modalForm.color"></color-select>
- </el-form-item>
- <el-form-item label="线条粗细:">
- <line-width-select v-model="modalForm.bold"></line-width-select>
- </el-form-item>
- <el-form-item label="线条形状:">
- <line-style-select v-model="modalForm.style"></line-style-select>
- </el-form-item>
- </el-form>
- <div slot="footer">
- <el-button type="primary" @click="submit">确认</el-button>
- <el-button @click="cancel" plain>取消</el-button>
- </div>
- </el-dialog>
- </template>
- <script>
- import ColorSelect from "../common/ColorSelect";
- import LineStyleSelect from "../common/LineStyleSelect";
- import LineWidthSelect from "../common/LineWidthSelect";
- const initModalForm = {
- id: "",
- bold: "1px",
- color: "#000000",
- style: "solid"
- };
- export default {
- name: "edit-line",
- components: { ColorSelect, LineStyleSelect, LineWidthSelect },
- props: {
- instance: {
- type: Object,
- default() {
- return {};
- }
- }
- },
- data() {
- return {
- dialogIsShow: false,
- modalForm: { ...initModalForm }
- };
- },
- methods: {
- initData(val) {
- this.modalForm = { ...val };
- },
- opened() {
- this.initData(this.instance);
- },
- closed() {
- this.$emit("closed");
- },
- cancel() {
- this.dialogIsShow = false;
- },
- open() {
- this.dialogIsShow = true;
- },
- submit() {
- this.$emit("modified", this.modalForm);
- this.cancel();
- }
- }
- };
- </script>
|