| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380 |
- {
- "vueinit": {
- "prefix": "vueinit",
- "body": [
- "<template>",
- " <div> </div>",
- "</template>",
- "",
- "<script setup></script>",
- "",
- "<style lang=\"\"></style>"
- ],
- "description": "vueinit"
- },
- "List page": {
- "prefix": "lp",
- "body": [
- "<template>",
- " <div class=\"p-10\">",
- " <a-card :title=\"route.meta.title\">",
- " <template #extra>",
- " <a-button type=\"primary\" @click=\"eidtModal.show()\">",
- " <template #icon> <icon-plus /> </template>创建",
- " </a-button>",
- " </template>",
- "",
- " <div class=\"pb-10\">",
- " <a-form layout=\"inline\" :model=\"searchParam\">",
- " <a-form-item",
- " field=\"name\"",
- " label=\"名称\"",
- " validate-trigger=\"blur\"",
- " :rules=\"[]\"",
- " >",
- " <a-input v-model=\"searchParam.name\" />",
- " </a-form-item>",
- "",
- " <a-form-item>",
- " <a-space>",
- " <a-button type=\"primary\" @click=\"search\">查询</a-button>",
- " <a-button @click=\"reset\">重置</a-button>",
- " </a-space>",
- " </a-form-item>",
- " </a-form>",
- " </div>",
- "",
- " <a-table",
- " :loading=\"loading\"",
- " :data=\"tableData\"",
- " :pagination=\"pagination\"",
- " @pageChange=\"handleCurrentChange\"",
- " @pageSizeChange=\"handleSizeChange\"",
- " >",
- " <template #columns>",
- " <a-table-column",
- " v-for=\"(col, index) in columns\"",
- " :key=\"index\"",
- " v-bind=\"col\"",
- " >",
- " <template",
- " #cell=\"{ record }\"",
- " v-if=\"col.dataIndex.indexOf('Time') > -1\"",
- " >",
- " {{ dayjs(record[col.dataIndex]).format('YYYY-MM-DD HH:mm:ss') }}",
- " </template>",
- " </a-table-column>",
- "",
- " <a-table-column",
- " title=\"操作\"",
- " data-index=\"actions\"",
- " fixed=\"right\"",
- " :width=\"200\"",
- " >",
- " <template #cell=\"{ record }\">",
- " <a-space>",
- " <a-button",
- " size=\"small\"",
- " type=\"outline\"",
- " @click=\"eidtModal.show(record)\"",
- " >",
- " 编辑",
- " </a-button>",
- "",
- " <a-button",
- " size=\"small\"",
- " type=\"outline\"",
- " status=\"danger\"",
- " @click=\"handleDelete(record.id)\"",
- " >",
- " 删除",
- " </a-button>",
- " </a-space>",
- " </template>",
- " </a-table-column>",
- " </template>",
- " </a-table>",
- " </a-card>",
- "",
- " <EidtModal ref=\"eidtModal\" @update=\"getTableList\"></EidtModal>",
- " </div>",
- "</template>",
- "",
- "<script setup>",
- " import { useTable } from '@/hooks/useTable';",
- " import { meterialApi as api } from '@/api/material';",
- "",
- " import EidtModal from './Modal.vue';",
- " import { Modal } from '@arco-design/web-vue';",
- " import dayjs from 'dayjs';",
- "",
- " const route = useRoute();",
- " const eidtModal = ref();",
- "",
- " const initParam = reactive({",
- " name: '',",
- " });",
- "",
- " const columns = [",
- " { title: '名称', dataIndex: 'name', fixed: 'left' },",
- " { title: '名称', dataIndex: 'name' },",
- " ];",
- "",
- " const {",
- " loading,",
- " tableData,",
- " pagination,",
- " searchParam,",
- " search,",
- " getTableList,",
- " reset,",
- " handleSizeChange,",
- " handleCurrentChange,",
- " } = useTable({",
- " api: api.getList,",
- " initParam,",
- " showPage: true,",
- " });",
- "",
- " const handleDelete = (id) => {",
- " Modal.confirm({",
- " title: '提示',",
- " content: `确定删除吗?`,",
- " onOk: async () => {",
- " await api.deleteItem(id);",
- "",
- " getTableList();",
- " },",
- " });",
- " };",
- "</script>",
- "",
- "<style lang=\"\"></style>"
- ],
- "description": "Modal page"
- },
- "Modal page": {
- "prefix": "mp",
- "body": [
- "<template>",
- " <a-modal",
- " :title=\"title\"",
- " v-model:visible=\"visible\"",
- " @cancel=\"hide\"",
- " @before-ok=\"handleSubmit\"",
- " unmount-on-close",
- " >",
- " <a-form",
- " ref=\"formRef\"",
- " auto-label-width",
- " class=\"max-w-[80%] px-5 mx-auto\"",
- " layout=\"horizontal\"",
- " :model=\"form\"",
- " >",
- " <a-form-item",
- " field=\"name\"",
- " label=\"名称\"",
- " :rules=\"[{ required: true, message: '请输入' }]\"",
- " >",
- " <a-input v-model=\"form.name\"></a-input>",
- " </a-form-item>",
- " </a-form>",
- " </a-modal>",
- "</template>",
- "",
- "<script setup>",
- " import useModal from '@/hooks/useModal';",
- " import { api } from '@/api/${1}';",
- "",
- " const emit = defineEmits(['update']);",
- "",
- " const route = useRoute();",
- " const title = computed(() => {",
- " return (editType.value === 'add' ? '新增' : '编辑') + route.meta.title;",
- " });",
- "",
- " const { visible, editType, form, show, hide, formRef, handleSubmit } =",
- " useModal({",
- " emit,",
- " add: api.addItem,",
- " update: api.updateItem,",
- " defaultForm: {",
- " name: '',",
- " seq: '',",
- " description: '',",
- " },",
- " });",
- "",
- " defineExpose({",
- " show,",
- " });",
- "</script>"
- ],
- "description": "Modal page"
- },
- "form-submit": {
- "prefix": "form-submit",
- "body": [
- "const formRef = ref(null);",
- "const handleSubmit = async (done) => {",
- " const res = await formRef.value?.validate();",
- "",
- " if (res) return;",
- "};"
- ],
- "description": "form-submit"
- },
- "form-validate": {
- "prefix": "form-validate",
- "body": [
- "const res = await formRef.value?.validate();",
- " ",
- "if (res) return;"
- ],
- "description": "form-validate"
- },
- "use-modal": {
- "prefix": "use-modal",
- "body": [
- "import useModal from '@/hooks/useModal';",
- "import { add, update} from '';",
- "const emit = defineEmits(['update']);",
- "const { visible, editType, form, show, hide, formRef, handleSubmit } =",
- " useModal({",
- " emit,",
- " add,",
- " update,",
- " defaultForm: {",
- " name: '',",
- " nick_name: '',",
- " deptId: '',",
- " },",
- " });",
- "",
- " defineExpose({",
- " show,",
- " });"
- ],
- "description": "use-modal"
- },
- "form switch": {
- "prefix": "form-switch",
- "body": [
- "<a-form-item field=\"${1}\" label=\"${2}\" :rules=\"[]\">",
- " <a-switch v-model=\"form.${1}\"></a-switch>",
- "</a-form-item>"
- ],
- "description": "form switch"
- },
- "form radio map": {
- "prefix": "form-radio-map",
- "body": [
- "<a-form-item",
- " field=\"${1}\"",
- " label=\"${2}\"",
- " :rules=\"[{ required: true, message: '请输入' }]\"",
- ">",
- " <a-radio-group v-model=\"form.${1}\">",
- " <a-radio",
- " v-for=\"[key,item] in ${3}\"",
- " :key=\"key\"",
- " :value=\"key\"",
- " >",
- " {{ item }}",
- " </a-radio>",
- " </a-radio-group>",
- "</a-form-item>"
- ],
- "description": "form radio map"
- },
- "form radio array": {
- "prefix": "form-radio-array",
- "body": [
- "<a-form-item",
- " field=\"${1}\"",
- " label=\"${2}\"",
- " :rules=\"[{ required: true, message: '请输入' }]\"",
- ">",
- " <a-radio-group v-model=\"form.${1}\">",
- " <a-radio",
- " v-for=\"(item, index) in ${3}\"",
- " :key=\"index\"",
- " :value=\"index\"",
- " >",
- " {{ item }}",
- " </a-radio>",
- " </a-radio-group>",
- "</a-form-item>"
- ],
- "description": "form radio array"
- },
- "form select array": {
- "prefix": "form-select-array",
- "body": [
- "<a-form-item",
- " field=\"${1}\"",
- " label=\"${2}\"",
- " :rules=\"[{ required: true, message: '请输入' }]\"",
- ">",
- " <a-select v-model=\"form.${1}\" placeholder=\"请选择\">",
- " <a-option",
- " v-for=\"(item,index) in ${3}\"",
- " :key=\"index\"",
- " :value=\"\"",
- " >",
- " {{ item }}",
- " </a-option>",
- " </a-select>",
- "</a-form-item>"
- ],
- "description": "form select array"
- },
- "form select map": {
- "prefix": "form-select-map",
- "body": [
- "<a-form-item",
- " field=\"${1}\"",
- " label=\"${2}\"",
- " :rules=\"[{ required: true, message: '请输入' }]\"",
- ">",
- " <a-select v-model=\"form.${1}\" placeholder=\"请选择\">",
- " <a-option",
- " v-for=\"[key, item] in ${3}\"",
- " :key=\"key\"",
- " :value=\"key\"",
- " >",
- " {{ item }}",
- " </a-option>",
- " </a-select>",
- "</a-form-item>"
- ],
- "description": "form select map"
- },
- "form textarea": {
- "prefix": "form-textarea",
- "body": [
- "<a-form-item field=\"${1}\" label=\"${2}\" :rules=\"[{ required: true, message: '请输入' }]\">",
- " <a-textarea v-model=\"form.${1}\"></a-textarea>",
- "</a-form-item>"
- ],
- "description": "form textarea"
- },
- "form number": {
- "prefix": "form-number",
- "body": [
- "<a-form-item field=\"${1}\" label=\"${2}\" :rules=\"[{ required: true, message: '请输入' }]\">",
- " <a-input-number v-model=\"form.${1}\"></a-input-number>",
- "</a-form-item>"
- ],
- "description": "form number"
- },
- "form input": {
- "prefix": "form-input",
- "body": [
- "<a-form-item field=\"${1}\" label=\"${2}\" :rules=\"[{ required: true, message: '请输入' }]\">",
- " <a-input v-model=\"form.${1}\"></a-input>",
- "</a-form-item>"
- ],
- "description": "form input"
- }
- }
|