123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281 |
- <template>
- <div class="pageIndexClass">
- <div>
- <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" highlight-current-row
- :selectConfig="selectConfig" :action-list="[
- {
- text: '添加专利',
- action: () => openModal('add'),
- disabled: false,
- },
- ]" @get-list="getList">
- <template #name="{ item }">
- <div>
- <span class="el-click">{{ item.name }}</span>
- </div>
- </template>
- </byTable>
- </div>
- <el-dialog :title="modalType == 'add' ? '添加专利' : '编辑专利'" v-model="dialogVisible" width="500px" destroy-on-close>
- <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="formDom" v-loading="submitLoading">
- </byForm>
- <template #footer>
- <el-button @click="dialogVisible = false" size="defualt" v-debounce>取 消</el-button>
- <el-button type="primary" @click="submitForm()" size="defualt" v-debounce :loading="submitLoading">
- 确 定
- </el-button>
- </template>
- </el-dialog>
- </div>
- </template>
- <script setup>
- import byTable from "@/components/byTable/index";
- import byForm from "@/components/byForm/index";
- const { proxy } = getCurrentInstance();
- const loading = ref(false);
- const submitLoading = ref(false);
- const sourceList = ref({
- data: [],
- pagination: {
- total: 3,
- pageNum: 1,
- pageSize: 10,
- keyword: "",
- },
- });
- const treeData = ref([]);
- const dialogVisible = ref(false);
- const modalType = ref("add");
- const selectConfig = computed(() => []);
- const config = computed(() => {
- return [
- {
- attrs: {
- label: "业务公司",
- prop: "companyName",
- },
- },
- {
- attrs: {
- label: "专利编号",
- prop: "code",
- },
- },
- {
- attrs: {
- label: "专利名称",
- prop: "name",
- },
- },
- // {
- // attrs: {
- // label: "开户行",
- // prop: "accountBank",
- // },
- // },
- // {
- // attrs: {
- // label: "开户名",
- // prop: "accountName",
- // },
- // },
- // {
- // attrs: {
- // label: "账号",
- // prop: "accountNumber",
- // },
- // },
- {
- attrs: {
- label: "操作",
- width: "120",
- align: "center",
- fixed: "right",
- },
- renderHTML(row) {
- return [
- {
- attrs: {
- label: "修改",
- type: "primary",
- text: true,
- },
- el: "button",
- click() {
- getDtl(row);
- },
- },
- {
- attrs: {
- label: "删除",
- type: "danger",
- text: true,
- },
- el: "button",
- click() {
- proxy
- .msgConfirm()
- .then((res) => {
- proxy
- .post("/patent/delete", {
- id: row.id,
- })
- .then((res) => {
- proxy.msgTip("删除成功", 1);
- getList();
- });
- })
- .catch((err) => {});
- },
- },
- ];
- },
- },
- ];
- });
- const formData = reactive({
- data: {},
- });
- const formOption = reactive({
- inline: true,
- labelWidth: 100,
- itemWidth: 100,
- });
- const formDom = ref(null);
- const formConfig = computed(() => {
- return [
- {
- type: "treeSelect",
- prop: "companyId",
- label: "业务公司",
- data: treeData.value,
- propsTreeLabel: "deptName",
- propsTreeValue: "deptId",
- itemWidth: 100,
- disabled: false,
- },
- {
- type: "input",
- prop: "name",
- label: "专利名称",
- itemWidth: 100,
- disabled: false,
- },
- {
- type: "input",
- prop: "code",
- label: "专利号",
- itemWidth: 100,
- disabled: false,
- },
- // {
- // type: "input",
- // prop: "accountBank",
- // label: "开户行",
- // placeholder: "请输入开户行",
- // itemWidth: 100,
- // },
- // {
- // type: "input",
- // prop: "accountName",
- // label: "开户名",
- // placeholder: "请输入开户名",
- // itemWidth: 100,
- // },
- // {
- // type: "input",
- // prop: "accountNumber",
- // label: "账号",
- // placeholder: "请输入账号",
- // itemWidth: 100,
- // },
- {
- type: "input",
- prop: "jdSubjectCode",
- label: "金蝶编号",
- },
- {
- type: "input",
- prop: "jdSubjectName",
- label: "金蝶名称",
- },
- ];
- });
- const rules = ref({
- companyId: [{ required: true, message: "请选择业务公司", trigger: "change" }],
- name: [{ required: true, message: "请输入专利名称", trigger: "blur" }],
- code: [{ required: true, message: "请输入专利编号", trigger: "blur" }],
- });
- const getDeptData = () => {
- proxy
- .get("/tenantDept/list", {
- pageNum: 1,
- pageSize: 9999,
- keyword: "",
- tenantId: proxy.useUserStore().user.tenantId,
- type: 0,
- })
- .then((res) => {
- treeData.value = proxy.handleTree(res.data, "deptId");
- });
- };
- getDeptData();
- const getList = async (req) => {
- sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
- loading.value = true;
- proxy.post("/patent/page", sourceList.value.pagination).then((res) => {
- sourceList.value.data = res.rows;
- sourceList.value.pagination.total = res.total;
- setTimeout(() => {
- loading.value = false;
- }, 200);
- });
- };
- const openModal = () => {
- dialogVisible.value = true;
- modalType.value = "add";
- formData.data = {
- definition: "2",
- fileList: [],
- };
- };
- const submitForm = () => {
- formDom.value.handleSubmit((valid) => {
- submitLoading.value = true;
- proxy.post("/patent/" + modalType.value, formData.data).then(
- (res) => {
- proxy.msgTip("操作成功", 1);
- dialogVisible.value = false;
- submitLoading.value = false;
- getList();
- },
- (err) => {
- submitLoading.value = false;
- }
- );
- });
- };
- const getDtl = (row) => {
- modalType.value = "edit";
- proxy.post("/patent/detail", { id: row.id }).then((res) => {
- formData.data = res;
- dialogVisible.value = true;
- });
- };
- getList();
- </script>
- <style lang="scss" scoped>
- .content {
- padding: 20px;
- }
- </style>
|