|
|
@@ -48,7 +48,34 @@
|
|
|
<el-row>
|
|
|
<el-col :span="24">
|
|
|
<el-form-item prop="templateName" label="模板名称">
|
|
|
- <el-input v-model="formData.templateName"/>
|
|
|
+ <el-input v-model.trim="formData.templateName"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item prop="productIdentities" label="产品ID">
|
|
|
+ <el-tag
|
|
|
+ v-for="tag in productIdentities"
|
|
|
+ :key="tag"
|
|
|
+ closable
|
|
|
+ :disable-transitions="false"
|
|
|
+ @close="handleDeleteProductId(tag)"
|
|
|
+ >
|
|
|
+ {{ tag }}
|
|
|
+ </el-tag>
|
|
|
+ <el-input
|
|
|
+ v-if="productInputVisible"
|
|
|
+ ref="productInputRef"
|
|
|
+ v-model.trim="productInputValue"
|
|
|
+ style="width: 80px !important;"
|
|
|
+ size="small"
|
|
|
+ @keyup.enter="handleProductInputConfirm"
|
|
|
+ @blur="handleProductInputConfirm"
|
|
|
+ />
|
|
|
+ <el-button v-else size="small" @click="showProductInput">
|
|
|
+ + 产品ID
|
|
|
+ </el-button>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
@@ -94,15 +121,41 @@ const exportFileDialog = ref(false)
|
|
|
|
|
|
const showSaveDlg = ref(false)
|
|
|
const formRef = ref<FormInstance>();
|
|
|
+
|
|
|
+const productIdentities = ref([])
|
|
|
+const productInputVisible = ref(false)
|
|
|
+const productInputRef = ref()
|
|
|
+const productInputValue = ref("")
|
|
|
+
|
|
|
const rules = reactive({
|
|
|
templateName: [{required: true, message: "请输入名称", trigger: "blur"}],
|
|
|
});
|
|
|
const formData = reactive({
|
|
|
templateName: '',
|
|
|
+ productIdentity: '',
|
|
|
jsonContent: '',
|
|
|
id: 0,
|
|
|
});
|
|
|
|
|
|
+const showProductInput = () => {
|
|
|
+ productInputVisible.value = true
|
|
|
+ nextTick(() => {
|
|
|
+ productInputRef.value!.input!.focus()
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+const handleDeleteProductId = (tag) => {
|
|
|
+ productIdentities.value.splice(productIdentities.value.indexOf(tag), 1)
|
|
|
+}
|
|
|
+
|
|
|
+const handleProductInputConfirm = () => {
|
|
|
+ if (productInputValue.value) {
|
|
|
+ productIdentities.value.push(productInputValue.value)
|
|
|
+ }
|
|
|
+ productInputVisible.value = false
|
|
|
+ productInputValue.value = ''
|
|
|
+}
|
|
|
+
|
|
|
const exportFileHide = () => {
|
|
|
exportFileDialog.value = false
|
|
|
}
|
|
|
@@ -141,6 +194,7 @@ const onSaveTemplate = () => {
|
|
|
|
|
|
|
|
|
formData.templateName = templatesStore.templateName
|
|
|
+ productIdentities.value = templatesStore.productIdentity
|
|
|
showSaveDlg.value = true
|
|
|
}
|
|
|
|
|
|
@@ -148,6 +202,7 @@ const handleSubmit = () => {
|
|
|
formRef.value.validate((valid: any) => {
|
|
|
if (valid) {
|
|
|
formData.id = templatesStore.templateId
|
|
|
+ formData.productIdentity = productIdentities.value ? productIdentities.value.join(",") : ""
|
|
|
formData.jsonContent = getJSONData()
|
|
|
|
|
|
updateDesignTemplate(JSON.stringify(formData)).then((res) => {
|