forked from kuaifan/dootask
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
333 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
database/migrations/2022_02_08_211051_insert_setting_column_template.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class InsertSettingColumnTemplate extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
$array = \App\Module\Base::setting('columnTemplate'); | ||
if (empty($array)) { | ||
\App\Module\Base::setting('columnTemplate', [ | ||
[ | ||
'name' => '软件开发', | ||
'columns' => ['产品规划', '前端开发', '后端开发', '测试', '发布', '其他'], | ||
], | ||
[ | ||
'name' => '产品开发', | ||
'columns' => ['产品计划', '正在设计', '正在研发', '测试', '准备发布', '发布成功'], | ||
], | ||
]); | ||
} | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
120 changes: 120 additions & 0 deletions
120
resources/assets/js/pages/manage/setting/preference/columnTemplate.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
<template> | ||
<div class="preference-project-create"> | ||
<Form ref="formDatum" label-width="auto" @submit.native.prevent> | ||
<Row class="setting-template"> | ||
<Col span="8">{{$L('名称')}}</Col> | ||
<Col span="16">{{$L('列表模板')}}</Col> | ||
</Row> | ||
<Row v-for="(item, key) in formDatum" :key="key" class="setting-template"> | ||
<Col span="8"> | ||
<Input | ||
v-model="item.name" | ||
:maxlength="20" | ||
:placeholder="$L('请输入名称')" | ||
clearable | ||
@on-clear="delDatum(key)"/> | ||
</Col> | ||
<Col span="16"> | ||
<TagInput v-model="item.columns"/> | ||
</Col> | ||
</Row> | ||
<Button type="default" icon="md-add" @click="addDatum">{{$L('添加模板')}}</Button> | ||
</Form> | ||
<div class="setting-footer"> | ||
<Button :loading="loadIng > 0" type="primary" @click="submitForm">{{$L('提交')}}</Button> | ||
<Button :loading="loadIng > 0" @click="resetForm" style="margin-left: 8px">{{$L('重置')}}</Button> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import {mapState} from "vuex"; | ||
export default { | ||
name: 'PreferenceColumnTemplate', | ||
data() { | ||
return { | ||
loadIng: 0, | ||
formDatum: [], | ||
nullDatum: { | ||
'name': '', | ||
'columns': '', | ||
} | ||
} | ||
}, | ||
mounted() { | ||
this.systemSetting(); | ||
}, | ||
computed: { | ||
...mapState(['columnTemplate']), | ||
}, | ||
watch: { | ||
columnTemplate: { | ||
handler(data) { | ||
this.formDatum = $A.cloneJSON(data); | ||
if (this.formDatum.length === 0) { | ||
this.addDatum(); | ||
} | ||
}, | ||
immediate: true, | ||
} | ||
}, | ||
methods: { | ||
submitForm() { | ||
this.$refs.formDatum.validate((valid) => { | ||
if (valid) { | ||
this.systemSetting(true); | ||
} | ||
}) | ||
}, | ||
resetForm() { | ||
this.formDatum = $A.cloneJSON(this.columnTemplate); | ||
}, | ||
addDatum() { | ||
this.formDatum.push($A.cloneJSON(this.nullDatum)); | ||
}, | ||
delDatum(key) { | ||
this.formDatum.splice(key, 1); | ||
if (this.formDatum.length === 0) { | ||
this.addDatum(); | ||
} | ||
}, | ||
systemSetting(save) { | ||
this.loadIng++; | ||
this.$store.dispatch("call", { | ||
url: 'system/column/template?type=' + (save ? 'save' : 'get'), | ||
method: 'post', | ||
data: { | ||
list: this.formDatum | ||
}, | ||
}).then(({data}) => { | ||
if (save) { | ||
$A.messageSuccess('修改成功'); | ||
} | ||
this.loadIng--; | ||
this.$store.state.columnTemplate = $A.cloneJSON(data).map(item => { | ||
if ($A.isArray(item.columns)) { | ||
item.columns = item.columns.join(",") | ||
} | ||
return item; | ||
}); | ||
}).catch(({msg}) => { | ||
if (save) { | ||
$A.modalError(msg); | ||
} | ||
this.loadIng--; | ||
}); | ||
} | ||
} | ||
} | ||
</script> |
25 changes: 25 additions & 0 deletions
25
resources/assets/js/pages/manage/setting/preference/index.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<template> | ||
<div class="setting-item submit"> | ||
<Tabs v-model="tabAction"> | ||
<TabPane :label="$L('任务优先级')" name="priority"> | ||
<PreferenceTaskPriority/> | ||
</TabPane> | ||
<TabPane :label="$L('新建项目模板')" name="columnTemplate"> | ||
<PreferenceColumnTemplate/> | ||
</TabPane> | ||
</Tabs> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import PreferenceTaskPriority from "./taskPriority"; | ||
import PreferenceColumnTemplate from "./columnTemplate"; | ||
export default { | ||
components: {PreferenceColumnTemplate, PreferenceTaskPriority}, | ||
data() { | ||
return { | ||
tabAction: 'priority', | ||
} | ||
}, | ||
} | ||
</script> |
Oops, something went wrong.