import request from "@/utils/httpRequest";
import { SYS_PATH as prefix } from "../AppPath";

export default {
	queryById: function (id) {
		return request({
			url: prefix + "/sys/dict/queryById",
			method: "get",
			params: { id: id },
		});
	},

	save: function (inputForm) {
		return request({
			url: prefix + "/sys/dict/save",
			method: "post",
			data: inputForm,
		});
	},

	list: function (params) {
		return request({
			url: prefix + "/sys/dict/type/list",
			method: "get",
			params: params,
		});
	},

	delete: function (ids) {
		return request({
			url: prefix + "/sys/dict/delete",
			method: "delete",
			params: { ids: ids },
		});
	},

	queryDictValue: function (id) {
		return request({
			url: prefix + "/sys/dict/queryDictValue",
			method: "get",
			params: { dictValueId: id },
			loading: false,
		});
	},

	saveDictValue: function (inputForm) {
		return request({
			url: prefix + "/sys/dict/saveDictValue",
			method: "post",
			data: inputForm,
		});
	},

	getDictValue: function (dictTypeId) {
		return request({
			url: prefix + "/sys/dict/getDictValue",
			method: "get",
			params: {
				dictTypeId: dictTypeId,
			},
		});
	},

	getDictMap: function (dictTypeId) {
		return request({
			url: prefix + "/sys/dict/getDictMap",
			method: "get",
			params: {
				dictTypeId: dictTypeId,
			},
		});
	},

	deleteDictValue: function (ids) {
		return request({
			url: prefix + "/sys/dict/deleteDictValue",
			method: "delete",
			params: { ids: ids },
		});
	},
	getList: function (value) {
		return request({
			url: prefix + "/sys/dict/type/getList",
			method: "get",
			params: {
				value: value,
			},
		});
	},
	getListData: function () {
		return request({
			url: prefix + "/sys/dict/type/getList",
			method: "get",
		});
	},
};
