疯狂的狮子li
2021-12-16 d600cdd8a0a590d43c141c36f5ba7077fc81c420
ruoyi-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm
@@ -11,7 +11,7 @@
#else
#set($comment=$column.columnComment)
#end
#if($column.htmlType == "input")
#if($column.htmlType == "input" || $column.htmlType == "textarea")
      <el-form-item label="${comment}" prop="${column.javaField}">
        <el-input
          v-model="queryParams.${column.javaField}"
@@ -105,7 +105,7 @@
          <span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
#elseif($column.list && "" != $column.dictType)
#elseif($column.list && $column.dictType && "" != $column.dictType)
      <el-table-column label="${comment}" align="center" prop="${javaField}">
        <template #default="scope">
#if($column.htmlType == "checkbox")
@@ -156,7 +156,6 @@
#foreach($column in $columns)
#set($field=$column.javaField)
#if($column.insert && !$column.pk)
#if(($column.usableColumn) || (!$column.superColumn))
#set($parentheseIndex=$column.columnComment.indexOf("("))
#if($parentheseIndex != -1)
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
@@ -245,8 +244,8 @@
        <el-form-item label="${comment}" prop="${field}">
          <el-date-picker clearable size="small"
            v-model="form.${field}"
            type="date"
            value-format="YYYY-MM-DD"
            type="datetime"
            value-format="YYYY-MM-DD HH:mm:ss"
            placeholder="选择${comment}">
          </el-date-picker>
        </el-form-item>
@@ -281,6 +280,7 @@
const ${businessName}List = ref([]);
const ${businessName}Options = ref([]);
const open = ref(false);
const buttonLoading = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const title = ref("");
@@ -294,14 +294,14 @@
const data = reactive({
  form: {},
  queryParams: {
    #foreach ($column in $columns)
#foreach ($column in $columns)
#if($column.query)
    $column.javaField: null#if($foreach.count != $columns.size()),#end
    $column.javaField: undefined#if($foreach.count != $columns.size()),#end
#end
#end
  },
  rules: {
    #foreach ($column in $columns)
#foreach ($column in $columns)
#if($column.required)
#set($parentheseIndex=$column.columnComment.indexOf("("))
#if($parentheseIndex != -1)
@@ -352,7 +352,7 @@
    ${businessName}Options.value.push(data);
  });
}
// 取消按钮
function cancel() {
  open.value = false;
@@ -408,12 +408,14 @@
/** 修改按钮操作 */
async function handleUpdate(row) {
  loading.value = true;
  reset();
  await getTreeselect();
  if (row != null) {
    form.value.${treeParentCode} = row.${treeCode};
  }
  get${BusinessName}(row.${pkColumn.javaField}).then(response => {
    loading.value = false;
    form.value = response.data;
#foreach ($column in $columns)
#if($column.htmlType == "checkbox")
@@ -429,6 +431,7 @@
function submitForm() {
  proxy.#[[$]]#refs["${businessName}Ref"].validate(valid => {
    if (valid) {
      buttonLoading.value = true;
#foreach ($column in $columns)
#if($column.htmlType == "checkbox")
      form.value.$column.javaField = form.value.${column.javaField}.join(",");
@@ -439,12 +442,16 @@
          proxy.#[[$modal]]#.msgSuccess("修改成功");
          open.value = false;
          getList();
        }).finally(() => {
          buttonLoading.value = false;
        });
      } else {
        add${BusinessName}(form.value).then(response => {
          proxy.#[[$modal]]#.msgSuccess("新增成功");
          open.value = false;
          getList();
        }).finally(() => {
          buttonLoading.value = false;
        });
      }
    }
@@ -454,11 +461,15 @@
/** 删除按钮操作 */
function handleDelete(row) {
  proxy.#[[$modal]]#.confirm('是否确认删除${functionName}编号为"' + row.${pkColumn.javaField} + '"的数据项?').then(function() {
    loading.value = true;
    return del${BusinessName}(row.${pkColumn.javaField});
  }).then(() => {
    loading.value = false;
    getList();
    proxy.#[[$modal]]#.msgSuccess("删除成功");
  }).catch(() => {});
  }).finally(() => {
    loading.value = false;
  });
}
getList();