parent
be9171d907
commit
25fa8562c2
@ -0,0 +1,64 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
export function index (params,isLoading=true) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/api/admin/department-category/index",
|
||||
params,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
|
||||
export function store (data,isLoading=true) {
|
||||
return request({
|
||||
method: "post",
|
||||
url: "/api/admin/department-category/store",
|
||||
data,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
|
||||
export function show (params,isLoading=true) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/api/admin/department-category/show",
|
||||
params,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
|
||||
export function save (data,isLoading=true) {
|
||||
return request({
|
||||
method: "post",
|
||||
url: "/api/admin/department-category/save",
|
||||
data,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
|
||||
export function destroy (data,isLoading=true) {
|
||||
return request({
|
||||
method: "post",
|
||||
url: "/api/admin/department-category/delete",
|
||||
data,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
|
||||
export function categoryYears(params,isLoading=true) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/api/admin/get-years",
|
||||
params,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
|
||||
export function categoryTypes(params,isLoading=true) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/api/admin/get-department-category-types",
|
||||
params,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
export function index (params,isLoading=true) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/api/admin/category-rule/list",
|
||||
params,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
|
||||
export function store (data,isLoading=true) {
|
||||
return request({
|
||||
method: "post",
|
||||
url: "/api/admin/category-rule/store",
|
||||
data,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
|
||||
export function save (data,isLoading=true) {
|
||||
return request({
|
||||
method: "post",
|
||||
url: "/api/admin/category-rule/save",
|
||||
data,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
|
||||
export function destroy (data,isLoading=true) {
|
||||
return request({
|
||||
method: "post",
|
||||
url: "/api/admin/category-rule/delete",
|
||||
data,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
export function index (params,isLoading=true) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/api/admin/department-category-type/index",
|
||||
params,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
|
||||
export function store (data,isLoading=true) {
|
||||
return request({
|
||||
method: "post",
|
||||
url: "/api/admin/department-category-type/store",
|
||||
data,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
|
||||
export function show (params,isLoading=true) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/api/admin/department-category-type/show",
|
||||
params,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
|
||||
export function save (data,isLoading=true) {
|
||||
return request({
|
||||
method: "post",
|
||||
url: "/api/admin/department-category-type/save",
|
||||
data,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
|
||||
export function destroy (data,isLoading=true) {
|
||||
return request({
|
||||
method: "post",
|
||||
url: "/api/admin/department-category-type/delete",
|
||||
data,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
|
||||
import request from "@/utils/request";
|
||||
|
||||
export function index (params,isLoading=true) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/api/admin/department-record/get-by-category",
|
||||
params,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
|
||||
export function recordStore (data,isLoading=true) {
|
||||
return request({
|
||||
method: "post",
|
||||
url: "/api/admin/department-record/store",
|
||||
data,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
|
||||
export function show (params,isLoading=true) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/api/admin/department-record/show",
|
||||
params,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
|
||||
export function save (data,isLoading=true) {
|
||||
return request({
|
||||
method: "post",
|
||||
url: "/api/admin/department-record/save",
|
||||
data,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
|
||||
export function destroy (data,isLoading=true) {
|
||||
return request({
|
||||
method: "post",
|
||||
url: "/api/admin/department-record/delete",
|
||||
data,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
@ -0,0 +1,100 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-drawer
|
||||
size="600px"
|
||||
title="设置清单类型"
|
||||
:visible.sync="drawer"
|
||||
direction="rtl">
|
||||
<div style="padding: 10px 20px;">
|
||||
<el-descriptions direction="vertical" :column="2" :labelStyle="{ 'font-weight': 600 }">
|
||||
<el-descriptions-item label="已选清单" :span="2">
|
||||
<div v-for="(item, index) in selections">
|
||||
<Tag closable color="primary" @on-close="selections.splice(index, 1)">
|
||||
{{ item.title }}
|
||||
</Tag>
|
||||
</div>
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item label="人员选择" :span="2">
|
||||
<Transfer
|
||||
:data="persons"
|
||||
:target-keys="selectedPersons"
|
||||
filterable
|
||||
:filter-method="filterMethod"
|
||||
@on-change="arr => selectedPersons = arr"></Transfer>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="开始填报月份">
|
||||
<DatePicker type="month" v-model="startMonth" placeholder="请选择开始填报月份"></DatePicker>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="结束填报月份">
|
||||
<DatePicker type="month" v-model="endMonth" placeholder="请选择结束填报月份"></DatePicker>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<Button type="primary" shape="circle" style="width: 40%;margin-top: 20px;" @click="submit">确定</Button>
|
||||
</div>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { index, assignCategoryType } from "@/api/person";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
drawer: false,
|
||||
selections: [],
|
||||
persons: [],
|
||||
selectedPersons: [],
|
||||
startMonth: '',
|
||||
endMonth: ''
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async getPersons () {
|
||||
this.persons = (await index({ page: 1, page_size: 9999 },false)).data.map(i => ({
|
||||
key: i.id,
|
||||
label: i.name
|
||||
}))
|
||||
},
|
||||
filterMethod (data, query) {
|
||||
return data.label.indexOf(query) > -1;
|
||||
},
|
||||
setSelections (arr) {
|
||||
if (arr instanceof Array) {
|
||||
this.selections = arr
|
||||
}
|
||||
},
|
||||
show () {
|
||||
this.drawer = true;
|
||||
},
|
||||
hide () {
|
||||
this.drawer = false;
|
||||
},
|
||||
submit () {
|
||||
assignCategoryType({
|
||||
person_id: this.selectedPersons.toString(),
|
||||
category_id: this.selections.map(i => i.id).toString(),
|
||||
start_year_month: this.$moment(this.startMonth).format("YYYY-MM"),
|
||||
end_year_month: this.$moment(this.endMonth).format("YYYY-MM"),
|
||||
}).then(res => {
|
||||
this.hide()
|
||||
})
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
created() {
|
||||
this.getPersons()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
::v-deep .ivu-tag {
|
||||
height: auto;
|
||||
line-height: 1.5;
|
||||
padding: 4px 8px;
|
||||
}
|
||||
::v-deep .ivu-tag .ivu-icon-ios-close {
|
||||
top: 0;
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,390 @@
|
||||
<script>
|
||||
import { index as typeIndex } from "@/api/departmentCategoryType";
|
||||
import { index as formIndex } from "@/api/system/customForm";
|
||||
import { save, show, store, index, destroy } from "@/api/departmentCategory";
|
||||
import { CreateDialog } from "@/utils/createDialog"
|
||||
import { deepCopy } from "@/utils";
|
||||
export default {
|
||||
props: {
|
||||
options: [Array,Object]
|
||||
},
|
||||
render(h) {
|
||||
let dialog = new CreateDialog(this,[
|
||||
],{
|
||||
width: "45%"
|
||||
})
|
||||
return dialog.render()
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
columns: 1,
|
||||
row: {},
|
||||
formInfo: [
|
||||
{
|
||||
name: '清单名称',
|
||||
field: 'title',
|
||||
edit_input: 'text',
|
||||
form_show: true,
|
||||
// _props: {
|
||||
// type: "textarea",
|
||||
// autoSize: {
|
||||
// minRows: 2
|
||||
// }
|
||||
// }
|
||||
},
|
||||
// {
|
||||
// name: '填报要求',
|
||||
// field: 'require',
|
||||
// edit_input: 'text',
|
||||
// form_show: true,
|
||||
// _props: {
|
||||
// type: "textarea",
|
||||
// autoSize: {
|
||||
// minRows: 4
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
{
|
||||
name: '父栏目',
|
||||
field: 'pid',
|
||||
_default: 0,
|
||||
edit_input: 'el-cascader',
|
||||
form_show: true,
|
||||
_props: {
|
||||
disabled:true,
|
||||
options: this.options,
|
||||
props: { checkStrictly: true, value: "id", label: "title", disabled: "_disabled" },
|
||||
},
|
||||
_events: {
|
||||
change: (e) => {
|
||||
this.form.pid = e.at(-1);
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "年份",
|
||||
field: "year",
|
||||
edit_input: "el-date-picker",
|
||||
// edit_input: "text",
|
||||
form_show: true,
|
||||
_props: {
|
||||
'disabled':true,
|
||||
type: "year",
|
||||
"value-format": "yyyy"
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "清单类型",
|
||||
field: "type_id",
|
||||
edit_input: "radio",
|
||||
form_show: true,
|
||||
_props:{
|
||||
'disabled':true
|
||||
},
|
||||
_params: []
|
||||
},
|
||||
// {
|
||||
// name: "考核周期",
|
||||
// field: "measure_duration",
|
||||
// edit_input: "radio",
|
||||
// form_show: true,
|
||||
// _params: [
|
||||
// {
|
||||
// value: "monthly",
|
||||
// label: "月度"
|
||||
// },
|
||||
// {
|
||||
// value: "quarterly",
|
||||
// label: "季度"
|
||||
// },
|
||||
// {
|
||||
// value: "yearly",
|
||||
// label: "年度"
|
||||
// },
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// name: "考核方式",
|
||||
// field: "measure_type",
|
||||
// edit_input: "radio",
|
||||
// form_show: true,
|
||||
// _params: [
|
||||
// {
|
||||
// value: "check",
|
||||
// label: "仅回复是否执行"
|
||||
// },
|
||||
// {
|
||||
// value: "reply",
|
||||
// label: "需回复具体内容"
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// name: "考核数量",
|
||||
// field: "measure_reply_quantity",
|
||||
// edit_input: "el-input-number",
|
||||
// form_show: true,
|
||||
// _props: {
|
||||
// precision: 0,
|
||||
// controls: false
|
||||
// }
|
||||
// },
|
||||
{
|
||||
name: '排序值',
|
||||
field: 'myindex',
|
||||
edit_input: 'el-input-number',
|
||||
form_show: true,
|
||||
_props: {
|
||||
controls: false
|
||||
}
|
||||
}
|
||||
],
|
||||
id: "",
|
||||
type: "add",
|
||||
dialogVisible: false,
|
||||
form: {},
|
||||
originalForm: {},
|
||||
rules: {
|
||||
title: [
|
||||
{ required: true,message: "请填写清单名称" }
|
||||
],
|
||||
// type_id: [
|
||||
// { required: true,message: "请选择清单类型" }
|
||||
// ],
|
||||
// measure_reply_quantity: [
|
||||
// {
|
||||
// validator:(rule,value,cb) => {
|
||||
// if (this.form['measure_type'] === 'reply') {
|
||||
// value > 0 ? cb() : cb(new Error('数量需大于0'))
|
||||
// } else {
|
||||
// cb()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// ]
|
||||
},
|
||||
file: {},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
setRow (row) {
|
||||
this.row = row
|
||||
},
|
||||
init() {
|
||||
for (let key in this.form) {
|
||||
if (this.formInfo.find(i => i.field === key)?._default) {
|
||||
this.form[key] = this.formInfo.find(i => i.field === key)._default
|
||||
}
|
||||
else if (this.form[key] instanceof Array) {
|
||||
this.form[key] = [];
|
||||
} else {
|
||||
this.form[key] = "";
|
||||
}
|
||||
}
|
||||
this.$refs["elForm"].clearValidate();
|
||||
},
|
||||
setForm(key = [], value = []) {
|
||||
if (key instanceof Array) {
|
||||
key.forEach((key, index) => {
|
||||
this.form[key] = value[index] ?? "";
|
||||
});
|
||||
}
|
||||
if (typeof key === "string") {
|
||||
this.form[key] = value;
|
||||
}
|
||||
if (!key) {
|
||||
this.init();
|
||||
}
|
||||
},
|
||||
show() {
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
hidden() {
|
||||
this.dialogVisible = false;
|
||||
},
|
||||
setType(type = "add") {
|
||||
let types = ["add", "editor", "show"];
|
||||
if (types.includes(type)) {
|
||||
this.type = type;
|
||||
} else {
|
||||
console.warn("Unknown type: " + type);
|
||||
}
|
||||
},
|
||||
setId(id) {
|
||||
if (typeof id == "number") {
|
||||
this.id = id;
|
||||
} else {
|
||||
console.error("error typeof id: " + typeof id);
|
||||
}
|
||||
},
|
||||
|
||||
async getDetail() {
|
||||
const res = await show({ id: this.id });
|
||||
this.$integrateData(this.form, res);
|
||||
|
||||
this.formInfo.forEach((i) => {
|
||||
if (i && (i.edit_input === "file" || i.edit_input === "files")) {
|
||||
res[i._relations.link_with_name]
|
||||
? (this.file[i.field] =
|
||||
res[i._relations.link_with_name] instanceof Array
|
||||
? res[i._relations.link_with_name].map((i) => {
|
||||
return {
|
||||
name: i?.name,
|
||||
url: i?.url,
|
||||
response: i,
|
||||
};
|
||||
})
|
||||
: [
|
||||
{
|
||||
name: res[i._relations.link_with_name]?.name,
|
||||
url: res[i._relations.link_with_name]?.url,
|
||||
response: res[i._relations.link_with_name],
|
||||
},
|
||||
])
|
||||
: (this.file[i.field] = []);
|
||||
}
|
||||
|
||||
this.form = Object.assign({}, this.form);
|
||||
this.originalForm = deepCopy(res);
|
||||
});
|
||||
},
|
||||
|
||||
submit() {
|
||||
if (this.type === "add") {
|
||||
if (this.form.hasOwnProperty("id")) {
|
||||
delete this.form.id;
|
||||
}
|
||||
store(this.form).then(res => {
|
||||
this.$Message.success({
|
||||
content: `${this.type === "add" ? "新增" : "编辑"}成功`,
|
||||
});
|
||||
this.$emit("refresh");
|
||||
this.hidden();
|
||||
})
|
||||
}
|
||||
if (this.type === "editor") {
|
||||
Object.defineProperty(this.form, "id", {
|
||||
value: this.id,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
});
|
||||
save(this.form).then(res => {
|
||||
this.$Message.success({
|
||||
content: `${this.type === "add" ? "新增" : "编辑"}成功`,
|
||||
});
|
||||
this.$emit("refresh");
|
||||
this.hidden();
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
title () {
|
||||
if (this.type === 'add') return '新增'
|
||||
if (this.type === 'editor') return '编辑'
|
||||
if (this.type === 'show') return '查看'
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
"form.year":{
|
||||
handler:function (newVal) {
|
||||
this.form.year = newVal.toString()
|
||||
}
|
||||
},
|
||||
options(val){
|
||||
this.$set(this.formInfo.find(i => i.field === 'pid')._props,'options',val)
|
||||
},
|
||||
formInfo: {
|
||||
handler: function (newVal) {
|
||||
this.form = {};
|
||||
this.file = {};
|
||||
newVal.forEach((i) => {
|
||||
if (i.field) {
|
||||
this.form[i.field] = (i._default || i._default === 0)? i._default : '';
|
||||
if (
|
||||
i.validation instanceof Array &&
|
||||
i.validation.length > 0 &&
|
||||
!!i.validation.find((i) => i === "required")
|
||||
) {
|
||||
}
|
||||
if (i.edit_input === "files") {
|
||||
this.form[i.field] = [];
|
||||
}
|
||||
if (i.edit_input === "files" || i.edit_input === "file") {
|
||||
this.file[i.field] = [];
|
||||
}
|
||||
if (i.edit_input === "checkbox") {
|
||||
this.form[i.field] = [];
|
||||
}
|
||||
if (i._relations) {
|
||||
this.form[i._relations?.link_with_name] = [];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.columns = newVal.length > 11 ? '2' : '1'
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
dialogVisible(val) {
|
||||
if (val) {
|
||||
document.documentElement.style.setProperty(
|
||||
"--column-num",
|
||||
this.columns
|
||||
);
|
||||
if (this.type === "editor" || this.type === "show") {
|
||||
this.$nextTick(() => this.getDetail());
|
||||
}
|
||||
} else {
|
||||
this.id = "";
|
||||
this.type = "";
|
||||
this.init();
|
||||
this.$refs["elForm"].clearValidate();
|
||||
delete this.form.id;
|
||||
for (let key in this.file) {
|
||||
this.file[key] = [];
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
created() {
|
||||
typeIndex({ page: 1,page_size: 999 }).then(res => {
|
||||
this.formInfo.find(i => i.field === 'type_id')._params = res.data
|
||||
})
|
||||
formIndex({ page: 1,page_size: 999 }).then(res => {
|
||||
this.formInfo.find(i => i.field === 'form_id')._params = res.data
|
||||
})
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
:root {
|
||||
--column-num: 2;
|
||||
}
|
||||
</style>
|
||||
<style scoped lang="scss">
|
||||
.uploaded-a {
|
||||
color: red;
|
||||
text-decoration: none;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.uploaded-a:hover {
|
||||
color: red;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.form-body {
|
||||
display: grid;
|
||||
grid-gap: 10px;
|
||||
grid-template-columns: repeat(var(--column-num), 1fr);
|
||||
}
|
||||
|
||||
::v-deep .el-input-number.is-without-controls .el-input__inner {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
</style>
|
||||
@ -0,0 +1,237 @@
|
||||
<script>
|
||||
import { save, show, store, index, destroy } from "@/api/departmentCategoryType";
|
||||
import { CreateDialog } from "@/utils/createDialog"
|
||||
import { deepCopy } from "@/utils";
|
||||
export default {
|
||||
props: {
|
||||
tableName: String,
|
||||
},
|
||||
render(h) {
|
||||
let dialog = new CreateDialog(this,[
|
||||
],{
|
||||
width: "480px"
|
||||
})
|
||||
return dialog.render()
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
columns: 1,
|
||||
row: {},
|
||||
formInfo: [
|
||||
{
|
||||
name: '清单类型名称',
|
||||
field: 'title',
|
||||
edit_input: 'text',
|
||||
form_show: true
|
||||
},
|
||||
{
|
||||
name: '排序值',
|
||||
field: 'myindex',
|
||||
edit_input: 'el-input-number',
|
||||
form_show: true,
|
||||
_props: {
|
||||
controls: false
|
||||
}
|
||||
}
|
||||
],
|
||||
id: "",
|
||||
type: "add",
|
||||
dialogVisible: false,
|
||||
form: {},
|
||||
originalForm: {},
|
||||
rules: {
|
||||
title: [
|
||||
{ required: true,message: "请填写清单名称" }
|
||||
]
|
||||
},
|
||||
file: {},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
setRow (row) {
|
||||
this.row = row
|
||||
},
|
||||
init() {
|
||||
for (let key in this.form) {
|
||||
if (this.form[key] instanceof Array) {
|
||||
this.form[key] = [];
|
||||
} else {
|
||||
this.form[key] = "";
|
||||
}
|
||||
}
|
||||
this.$refs["elForm"].clearValidate();
|
||||
},
|
||||
show() {
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
hidden() {
|
||||
this.dialogVisible = false;
|
||||
},
|
||||
setType(type = "add") {
|
||||
let types = ["add", "editor", "show"];
|
||||
if (types.includes(type)) {
|
||||
this.type = type;
|
||||
} else {
|
||||
console.warn("Unknown type: " + type + "type:add or editor or show");
|
||||
}
|
||||
},
|
||||
setId(id) {
|
||||
if (typeof id == "number") {
|
||||
this.id = id;
|
||||
} else {
|
||||
console.error("error typeof id: " + typeof id);
|
||||
}
|
||||
},
|
||||
|
||||
async getDetail() {
|
||||
const res = await show({ id: this.id });
|
||||
this.$integrateData(this.form, res);
|
||||
|
||||
this.formInfo.forEach((i) => {
|
||||
if (i && (i.edit_input === "file" || i.edit_input === "files")) {
|
||||
res[i._relations.link_with_name]
|
||||
? (this.file[i.field] =
|
||||
res[i._relations.link_with_name] instanceof Array
|
||||
? res[i._relations.link_with_name].map((i) => {
|
||||
return {
|
||||
name: i?.name,
|
||||
url: i?.url,
|
||||
response: i,
|
||||
};
|
||||
})
|
||||
: [
|
||||
{
|
||||
name: res[i._relations.link_with_name]?.name,
|
||||
url: res[i._relations.link_with_name]?.url,
|
||||
response: res[i._relations.link_with_name],
|
||||
},
|
||||
])
|
||||
: (this.file[i.field] = []);
|
||||
}
|
||||
|
||||
this.form = Object.assign({}, this.form);
|
||||
this.originalForm = deepCopy(res);
|
||||
});
|
||||
},
|
||||
|
||||
submit() {
|
||||
if (this.type === "add") {
|
||||
if (this.form.hasOwnProperty("id")) {
|
||||
delete this.form.id;
|
||||
}
|
||||
store(this.form).then(res => {
|
||||
this.$Message.success({
|
||||
content: `${this.type === "add" ? "新增" : "编辑"}成功`,
|
||||
});
|
||||
this.$emit("refresh");
|
||||
this.hidden();
|
||||
})
|
||||
}
|
||||
if (this.type === "editor") {
|
||||
Object.defineProperty(this.form, "id", {
|
||||
value: this.id,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
});
|
||||
save(this.form).then(res => {
|
||||
this.$Message.success({
|
||||
content: `${this.type === "add" ? "新增" : "编辑"}成功`,
|
||||
});
|
||||
this.$emit("refresh");
|
||||
this.hidden();
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
title () {
|
||||
if (this.type === 'add') return '新增'
|
||||
if (this.type === 'editor') return '编辑'
|
||||
if (this.type === 'show') return '查看'
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
formInfo: {
|
||||
handler: function (newVal) {
|
||||
this.form = {};
|
||||
this.file = {};
|
||||
newVal.forEach((i) => {
|
||||
if (i.field) {
|
||||
this.form[i.field] = "";
|
||||
if (
|
||||
i.validation instanceof Array &&
|
||||
i.validation.length > 0 &&
|
||||
!!i.validation.find((i) => i === "required")
|
||||
) {
|
||||
}
|
||||
if (i.edit_input === "files") {
|
||||
this.form[i.field] = [];
|
||||
}
|
||||
if (i.edit_input === "files" || i.edit_input === "file") {
|
||||
this.file[i.field] = [];
|
||||
}
|
||||
if (i.edit_input === "checkbox") {
|
||||
this.form[i.field] = [];
|
||||
}
|
||||
if (i._relations) {
|
||||
this.form[i._relations?.link_with_name] = [];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.columns = newVal.length > 11 ? '2' : '1'
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
dialogVisible(val) {
|
||||
if (val) {
|
||||
document.documentElement.style.setProperty(
|
||||
"--column-num",
|
||||
this.columns
|
||||
);
|
||||
if (this.type === "editor" || this.type === "show") {
|
||||
this.$nextTick(() => this.getDetail());
|
||||
}
|
||||
} else {
|
||||
this.id = "";
|
||||
this.type = "";
|
||||
this.init();
|
||||
this.$refs["elForm"].clearValidate();
|
||||
delete this.form.id;
|
||||
for (let key in this.file) {
|
||||
this.file[key] = [];
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
:root {
|
||||
--column-num: 2;
|
||||
}
|
||||
</style>
|
||||
<style scoped lang="scss">
|
||||
.uploaded-a {
|
||||
color: red;
|
||||
text-decoration: none;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.uploaded-a:hover {
|
||||
color: red;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.form-body {
|
||||
display: grid;
|
||||
grid-gap: 10px;
|
||||
grid-template-columns: repeat(var(--column-num), 1fr);
|
||||
}
|
||||
|
||||
::v-deep .el-input-number.is-without-controls .el-input__inner {
|
||||
text-align: left;
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,88 @@
|
||||
<template>
|
||||
<div>
|
||||
<div>
|
||||
<div ref="lxHeader">
|
||||
<LxHeader
|
||||
style="margin-bottom: 10px; border: 0px; margin-top: 15px"
|
||||
>
|
||||
<div slot="content"></div>
|
||||
<slot>
|
||||
<header-content :auths="auths_auth_mixin">
|
||||
<template #search>
|
||||
<div style="display: flex">
|
||||
<Button
|
||||
type="primary"
|
||||
@click="$refs['xyTable'].getTableData(true)"
|
||||
>查询</Button
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
<template #create>
|
||||
<Button
|
||||
type="primary"
|
||||
@click="$refs['create'].setType('add'),$refs['create'].show()"
|
||||
>新增</Button
|
||||
>
|
||||
</template>
|
||||
</header-content>
|
||||
</slot>
|
||||
</LxHeader>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<xy-table ref="xyTable"
|
||||
:table-item="table"
|
||||
:auths="auths_auth_mixin"
|
||||
:action="index"
|
||||
:destroy-action="destroy"
|
||||
@editor="row => {
|
||||
$refs['create'].setId(row.id);
|
||||
$refs['create'].setType('editor');
|
||||
$refs['create'].show();
|
||||
}"></xy-table>
|
||||
|
||||
<create ref="create" @refresh="$refs['xyTable'].getTableData()"></create>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { index,destroy } from "@/api/departmentCategoryType"
|
||||
import { authMixin } from "@/mixin/authMixin";
|
||||
import headerContent from "@/components/LxHeader/XyContent.vue";
|
||||
import LxHeader from "@/components/LxHeader/index.vue";
|
||||
import create from "./component/create.vue"
|
||||
export default {
|
||||
mixins: [authMixin],
|
||||
components: {
|
||||
headerContent,
|
||||
LxHeader,
|
||||
create
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
table: [
|
||||
{
|
||||
type: "index",
|
||||
width: 46,
|
||||
label: "序号"
|
||||
},
|
||||
{
|
||||
prop: "title",
|
||||
label: "清单类型名称"
|
||||
},
|
||||
{
|
||||
prop: "myindex",
|
||||
label: "排序"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
index,destroy,
|
||||
},
|
||||
computed: {},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
</style>
|
||||
@ -0,0 +1,164 @@
|
||||
<template>
|
||||
<div>
|
||||
<div>
|
||||
<div ref="lxHeader">
|
||||
<LxHeader style="margin-bottom: 10px; border: 0px; margin-top: 15px">
|
||||
<div slot="content"></div>
|
||||
<slot>
|
||||
<header-content :auths="auths_auth_mixin">
|
||||
<template #search>
|
||||
|
||||
</template>
|
||||
</header-content>
|
||||
</slot>
|
||||
</LxHeader>
|
||||
</div>
|
||||
<div>
|
||||
<div>
|
||||
<div style="margin-bottom:15px;margin-top:15px;">
|
||||
<span style="margin-bottom:15px;display: inline-block;width:45px;vertical-align: top;">年度 </span>
|
||||
<el-radio-group style="width:90%" v-model="select.year" @change="changeYear">
|
||||
<el-radio style="margin-right:5px;margin-bottom:15px;margin-left:0" v-for="item in yearList" border
|
||||
:label="item">{{item}}</el-radio>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
<div style="margin-bottom:15px;margin-top:15px;">
|
||||
<span style="margin-bottom:15px;display: inline-block;width:45px;vertical-align: top;">部门 </span>
|
||||
<el-select v-model="select.department_id" @change="changeDep" placeholder="请选择">
|
||||
<el-option v-for="item in depList" :key="item.id" :label="item.name" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div style="margin-bottom:15px;margin-top:15px;">
|
||||
<span style="margin-bottom:15px;display: inline-block;width:45px;vertical-align: top;">类型 </span>
|
||||
<el-radio-group style="width:90%" @change="changeCategoryType" v-model="select.category_type_id">
|
||||
<el-radio style="margin-right:5px;margin-bottom:5px;margin-left:0" v-for="item in categoryTypeList" border
|
||||
:label="item.id">{{item.title}}</el-radio>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
<!-- <el-date-picker size="small" style="width: 110px;" placeholder="请选择日期" value-format="yyyy" v-model="select.year" type="year"></el-date-picker> -->
|
||||
<Button style="margin-left: 10px;width:300px" type="primary" @click="goForm">进入填报</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
categoryYears,
|
||||
categoryTypes
|
||||
} from "@/api/departmentCategory"
|
||||
import {
|
||||
listdept
|
||||
} from "../../api/system/department.js";
|
||||
import {
|
||||
authMixin
|
||||
} from "@/mixin/authMixin";
|
||||
import headerContent from "@/components/LxHeader/XyContent.vue";
|
||||
import LxHeader from "@/components/LxHeader/index.vue";
|
||||
|
||||
export default {
|
||||
mixins: [authMixin],
|
||||
components: {
|
||||
headerContent,
|
||||
LxHeader,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
yearList: [],
|
||||
categoryTypeList: [],
|
||||
depList: [],
|
||||
select: {
|
||||
year: '',
|
||||
department_id: '',
|
||||
department_name:'',
|
||||
category_type_id: '',
|
||||
categoryTypeName: ''
|
||||
},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getPastYears()
|
||||
this.getCategoryType()
|
||||
this.getDep()
|
||||
},
|
||||
methods: {
|
||||
async getDep() {
|
||||
var that = this;
|
||||
listdept().then(response => {
|
||||
that.depList = response;
|
||||
}).catch(error => {
|
||||
//reject(error)
|
||||
})
|
||||
},
|
||||
async getCategoryType() {
|
||||
await categoryTypes().then(res => {
|
||||
this.categoryTypeList = res
|
||||
this.select.category_type_id = res.length > 0 ? res[0].id : ''
|
||||
this.select.categoryTypeName = res.length > 0 ? res[0].title : ''
|
||||
|
||||
})
|
||||
},
|
||||
changeDep(e){
|
||||
this.depList.map(item=>{
|
||||
if(item.id===e){
|
||||
this.select.department_id = item.id
|
||||
this.select.department_name = item.name
|
||||
}
|
||||
})
|
||||
},
|
||||
changeYear(e) {},
|
||||
changeCategoryType(e) {
|
||||
this.categoryTypeList.map(item=>{
|
||||
if(item.id===e){
|
||||
this.select.category_type_id = item.id
|
||||
this.select.categoryTypeName = item.title
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
async getPastYears(years) {
|
||||
await categoryYears().then(res => {
|
||||
this.yearList = res.years
|
||||
this.select.year = res.selected_year
|
||||
})
|
||||
},
|
||||
goForm(){
|
||||
if(!this.select.department_id){
|
||||
this.$message({
|
||||
type:'warning',
|
||||
message:'请选择部门'
|
||||
})
|
||||
return
|
||||
}
|
||||
this.$router.push({
|
||||
path:'/departmentH5',
|
||||
query:this.select
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
computed: {},
|
||||
watch: {}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
a {
|
||||
color: $primaryColor;
|
||||
text-decoration: none;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: $primaryColor;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
::v-deep .el-table .cell.el-tooltip {
|
||||
white-space: wrap !important;
|
||||
text-wrap: wrap
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,126 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-dialog title="填报" width="860px" :visible.sync="visible">
|
||||
|
||||
<xy-table style="width: 820px"
|
||||
stripe
|
||||
ref="xyTable"
|
||||
:req-opt="select"
|
||||
:is-first-req="false"
|
||||
:height="500"
|
||||
:action="getByCategory"
|
||||
:table-item="table"
|
||||
:destroy-action="destroy">
|
||||
</xy-table>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { index as getByCategory, destroy } from "@/api/departmentRecord";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
auth: ['delete'],
|
||||
visible: false,
|
||||
select: {
|
||||
category_id: ""
|
||||
},
|
||||
table: [
|
||||
{
|
||||
prop: "title",
|
||||
label: "标题",
|
||||
fixed: "left",
|
||||
width: 180
|
||||
},
|
||||
{
|
||||
prop: "created_at",
|
||||
label: "填报日期",
|
||||
width: 160
|
||||
},
|
||||
{
|
||||
prop: "content",
|
||||
label: "内容",
|
||||
align: "left",
|
||||
minWidth: 200
|
||||
},
|
||||
{
|
||||
prop: "operate",
|
||||
label: "操作",
|
||||
align: "left",
|
||||
width: 140,
|
||||
customFn: row => {
|
||||
const _this = this
|
||||
return (
|
||||
<div>
|
||||
<Button type="primary"
|
||||
size="small"
|
||||
on={{
|
||||
['click']:_ => {
|
||||
this.$emit('edit', row.id)
|
||||
}
|
||||
}}>编辑</Button>
|
||||
<Button type="error"
|
||||
size="small"
|
||||
on={{
|
||||
['click']:_ => {
|
||||
this.$confirm('此操作将永久删除该填报, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
destroy({
|
||||
id: row.id
|
||||
}).then(_ => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
_this.$refs['xyTable'].getTableData()
|
||||
this.$emit('destroyed')
|
||||
})
|
||||
})
|
||||
}
|
||||
}}>删除</Button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getByCategory,destroy,
|
||||
show () {
|
||||
this.visible = true;
|
||||
},
|
||||
hide () {
|
||||
this.visible = false;
|
||||
},
|
||||
setId (id) {
|
||||
this.select.category_id = id;
|
||||
},
|
||||
getData () {
|
||||
this.$refs['xyTable'].getTableData()
|
||||
}
|
||||
|
||||
},
|
||||
computed: {},
|
||||
watch: {
|
||||
visible (newVal) {
|
||||
if (newVal) {
|
||||
this.$nextTick(_ => {
|
||||
this.$refs['xyTable'].getTableData(true)
|
||||
})
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
</style>
|
||||
Loading…
Reference in new issue