setting.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <drawer-tabs-container>
  3. <div class="project-setting">
  4. <Form ref="formSystem" :model="formSystem" :label-width="110">
  5. <div class="project-setting-title">{{$L('项目信息')}}:</div>
  6. <FormItem :label="$L('项目简介')">
  7. <Input v-model="formSystem.project_desc" type="textarea" :autosize="{minRows:3,maxRows:20}" style="max-width:450px"/>
  8. </FormItem>
  9. <div class="project-setting-title">{{$L('权限设置')}}:</div>
  10. <FormItem :label="$L('添加任务')">
  11. <Checkbox :value="true" disabled>{{$L('项目负责人')}}</Checkbox>
  12. <CheckboxGroup v-model="formSystem.add_role" class="project-setting-group">
  13. <Checkbox label="member">{{$L('项目成员')}}</Checkbox>
  14. </CheckboxGroup>
  15. </FormItem>
  16. <FormItem :label="$L('修改任务')">
  17. <Checkbox :value="true" disabled>{{$L('项目负责人')}}</Checkbox>
  18. <CheckboxGroup v-model="formSystem.edit_role" class="project-setting-group">
  19. <Checkbox label="owner">{{$L('任务负责人')}}</Checkbox>
  20. <Checkbox label="member">{{$L('项目成员')}}</Checkbox>
  21. </CheckboxGroup>
  22. </FormItem>
  23. <FormItem :label="$L('标记完成')">
  24. <Checkbox :value="true" disabled>{{$L('项目负责人')}}</Checkbox>
  25. <CheckboxGroup v-model="formSystem.complete_role" class="project-setting-group">
  26. <Checkbox label="owner">{{$L('任务负责人')}}</Checkbox>
  27. <Checkbox label="member">{{$L('项目成员')}}</Checkbox>
  28. </CheckboxGroup>
  29. </FormItem>
  30. <FormItem :label="$L('归档任务')">
  31. <Checkbox :value="true" disabled>{{$L('项目负责人')}}</Checkbox>
  32. <CheckboxGroup v-model="formSystem.archived_role" class="project-setting-group">
  33. <Checkbox label="owner">{{$L('任务负责人')}}</Checkbox>
  34. <Checkbox label="member">{{$L('项目成员')}}</Checkbox>
  35. </CheckboxGroup>
  36. </FormItem>
  37. <FormItem :label="$L('删除任务')">
  38. <Checkbox :value="true" disabled>{{$L('项目负责人')}}</Checkbox>
  39. <CheckboxGroup v-model="formSystem.del_role" class="project-setting-group">
  40. <Checkbox label="owner">{{$L('任务负责人')}}</Checkbox>
  41. <Checkbox label="member">{{$L('项目成员')}}</Checkbox>
  42. </CheckboxGroup>
  43. </FormItem>
  44. <div class="project-setting-title">{{$L('面板显示')}}:</div>
  45. <FormItem :label="$L('显示已完成')">
  46. <div>
  47. <RadioGroup v-model="formSystem.complete_show">
  48. <Radio label="show">{{$L('显示')}}</Radio>
  49. <Radio label="hide">{{$L('隐藏')}}</Radio>
  50. </RadioGroup>
  51. </div>
  52. <div v-if="formSystem.complete_show=='show'" class="form-placeholder">
  53. {{$L('项目面板显示已完成的任务。')}}
  54. </div>
  55. <div v-else class="form-placeholder">
  56. {{$L('项目面板隐藏已完成的任务。')}}
  57. </div>
  58. </FormItem>
  59. <FormItem>
  60. <Button :loading="loadIng > 0" type="primary" @click="handleSubmit('formSystem')">{{$L('提交')}}</Button>
  61. <Button :loading="loadIng > 0" @click="handleReset('formSystem')" style="margin-left: 8px">{{$L('重置')}}</Button>
  62. </FormItem>
  63. </Form>
  64. </div>
  65. </drawer-tabs-container>
  66. </template>
  67. <style lang="scss" scoped>
  68. .project-setting {
  69. padding: 0 12px;
  70. .project-setting-title {
  71. padding: 12px;
  72. font-size: 14px;
  73. font-weight: 600;
  74. }
  75. .project-setting-group {
  76. display: inline-block;
  77. }
  78. .form-placeholder {
  79. font-size: 12px;
  80. color: #999999;
  81. }
  82. .form-placeholder:hover {
  83. color: #000000;
  84. }
  85. }
  86. </style>
  87. <script>
  88. import DrawerTabsContainer from "../DrawerTabsContainer";
  89. export default {
  90. name: 'ProjectSetting',
  91. components: {DrawerTabsContainer},
  92. props: {
  93. projectid: {
  94. default: 0
  95. },
  96. canload: {
  97. type: Boolean,
  98. default: true
  99. },
  100. },
  101. data () {
  102. return {
  103. loadYet: false,
  104. loadIng: 0,
  105. formSystem: {},
  106. }
  107. },
  108. mounted() {
  109. if (this.canload) {
  110. this.loadYet = true;
  111. this.getSetting();
  112. }
  113. },
  114. watch: {
  115. projectid() {
  116. if (this.loadYet) {
  117. this.getSetting();
  118. }
  119. },
  120. canload(val) {
  121. if (val && !this.loadYet) {
  122. this.loadYet = true;
  123. this.getSetting();
  124. }
  125. }
  126. },
  127. methods: {
  128. getSetting(save) {
  129. this.loadIng++;
  130. $A.apiAjax({
  131. url: 'project/setting?act=' + (save ? 'save' : 'get'),
  132. data: Object.assign(this.formSystem, {
  133. projectid: this.projectid
  134. }),
  135. complete: () => {
  136. this.loadIng--;
  137. },
  138. success: (res) => {
  139. if (res.ret === 1) {
  140. this.formSystem = res.data;
  141. if (save) {
  142. this.$Message.success(this.$L('修改成功'));
  143. this.$emit('on-change', res.data);
  144. }
  145. } else {
  146. if (save) {
  147. this.$Modal.error({title: this.$L('温馨提示'), content: res.msg });
  148. }
  149. }
  150. }
  151. });
  152. },
  153. handleSubmit(name) {
  154. this.$refs[name].validate((valid) => {
  155. if (valid) {
  156. switch (name) {
  157. case "formSystem": {
  158. this.getSetting(true);
  159. break;
  160. }
  161. }
  162. }
  163. })
  164. },
  165. handleReset(name) {
  166. this.$refs[name].resetFields();
  167. },
  168. }
  169. }
  170. </script>