comp-info-setting.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <basic-container>
  3. <basic-card title="LOGO设置" v-loading="tenantLoading">
  4. <avue-form :option="logoOption" v-model="logoForm" style="width: 100%; margin: 0;" @submit="handleSubmitLogo"></avue-form>
  5. </basic-card>
  6. <div style="padding-left: 16px;">
  7. <!-- <el-date-picker
  8. v-model="yearAndMonth"
  9. type="year"
  10. placeholder="选择年"
  11. value-format="yyyy"
  12. :clearable="false"
  13. style="margin-bottom: 6px;"
  14. >
  15. </el-date-picker> -->
  16. <year-month-select v-model="yearAndMonth" :showMonth="false" />
  17. </div>
  18. <basic-card title="企业基础信息表">
  19. <comp-info-table :yearAndMonth="yearAndMonth"></comp-info-table>
  20. </basic-card>
  21. <basic-card title="所属二级单位/部门">
  22. <div style="width: 680px;">
  23. <comp-dept-list :yearAndMonth="yearAndMonth"></comp-dept-list>
  24. </div>
  25. </basic-card>
  26. <basic-card title="高企证书上传" v-loading="compBasicLoading">
  27. <el-button type="primary" plain size="small" @click="handleLastYearData(2)" style="margin-bottom: 12px;">读取上年度数据</el-button>
  28. <avue-form :option="picOption" v-model="picForm" style="width: 100%; margin: 0;" @submit="handleHighTecChange"></avue-form>
  29. </basic-card>
  30. <basic-card title="出勤时间设置" v-loading="compBasicLoading">
  31. <el-button type="primary" plain size="small" @click="handleLastYearData(1)" style="margin-bottom: 12px;">读取上年度数据</el-button>
  32. <avue-form :option="attendOption" v-model="attendForm" @submit="handleSubmitAtten" style="width: 600px; margin: 0;"></avue-form>
  33. </basic-card>
  34. </basic-container>
  35. </template>
  36. <script>
  37. import {mapGetters} from "vuex";
  38. import { getDetail as getTenantDetail, update as updateTenant } from '@/api/system/tenant';
  39. import { getAttenDetail, settingAttenInfo, getLastYearAttenInfo } from "@/api/basicResource/compInfoSetting";
  40. import YearMonthSelect from "@/components/year-month-select";
  41. import basicCard from "@/components/basic-card";
  42. import compInfoTable from "./components/comp-info-table.vue";
  43. import compDeptList from "./components/comp-dept-list.vue";
  44. import moment from "moment";
  45. export default {
  46. components: {
  47. YearMonthSelect,
  48. basicCard,
  49. compDeptList,
  50. compInfoTable
  51. },
  52. data() {
  53. return {
  54. yearAndMonth: '',
  55. logoForm: {},
  56. logoOption: {
  57. submitText: '保存',
  58. emptyBtn: false,
  59. menuSpan: 4,
  60. column: [
  61. {
  62. label: "企业LOGO",
  63. prop: "logoUrl",
  64. type: "upload",
  65. listType: "picture-img",
  66. span: 24,
  67. fileType: "img", //img/video/audio
  68. accept: "image/png, image/jpeg",
  69. propsHttp: {
  70. res: 'data',
  71. url: 'link',
  72. },
  73. canvasOption: {
  74. text: ' ',
  75. ratio: 0.1
  76. },
  77. action: '/api/kd-resource/oss/endpoint/put-file',
  78. tip: "注:上传LOGO图片,尺寸推荐:20*20,显示在系统左上角。",
  79. },
  80. ],
  81. },
  82. picForm: {
  83. highTechUrl: [],
  84. },
  85. picOption: {
  86. submitText: '保存',
  87. emptyBtn: false,
  88. menuSpan: 4,
  89. column: [
  90. {
  91. label: "高企证书",
  92. prop: "highTechUrl",
  93. type: "upload",
  94. listType: "picture-card",
  95. span: 24,
  96. fileType: "img", //img/video/audio
  97. accept: "image/png, image/jpeg",
  98. limit: 5,
  99. propsHttp: {
  100. res: "data",
  101. url: 'link',
  102. },
  103. tip: "请上传当前年度的高企证书",
  104. action: '/api/kd-resource/oss/endpoint/put-file',
  105. },
  106. ],
  107. },
  108. attendForm: {},
  109. attendOption: {
  110. submitText: '保存',
  111. emptyBtn: false,
  112. menuSpan: 4,
  113. column: [
  114. {
  115. label: '作息时间',
  116. prop: 'workHours',
  117. type: 'number',
  118. span: 9,
  119. min: 0,
  120. precision: 1,
  121. }
  122. ]
  123. },
  124. tenantLoading: false,
  125. compBasicLoading: false,
  126. }
  127. },
  128. computed: {
  129. ...mapGetters(["userInfo", 'pageYear']),
  130. },
  131. watch: {
  132. yearAndMonth(newVal) {
  133. this.getAttenDetailFunc(newVal)
  134. }
  135. },
  136. mounted() {
  137. this.getTenantDetailFunc(this.userInfo.tenant_id);
  138. },
  139. activated() {
  140. if (this.yearAndMonth != this.pageYear) {
  141. this.yearAndMonth = this.pageYear;
  142. }
  143. },
  144. methods: {
  145. /**
  146. * 读取上年度高企证书或出勤信息
  147. * @param type 1、出勤时长;2、高企证书
  148. */
  149. handleLastYearData(type) {
  150. this.$confirm('请注意!读取上年度数据将覆盖当前所有数据,确认要读取吗?', '提示').then(() => {
  151. this.loading = true;
  152. getLastYearAttenInfo({ yearAndMonth: this.yearAndMonth, type }).then(({ data }) => {
  153. this.loading = false;
  154. if (data.code == 200) {
  155. this.$message.success('读取成功!');
  156. this.getAttenDetailFunc(this.yearAndMonth);
  157. }
  158. }).catch(() => {
  159. this.loading = false;
  160. });
  161. });
  162. },
  163. getTenantDetailFunc(tenantId) {
  164. this.tenantLoading = true;
  165. getTenantDetail(tenantId).then(({ data }) => {
  166. this.tenantLoading = false;
  167. if (data.code == 200) {
  168. this.logoForm = data.data;
  169. }
  170. }).catch(() => {
  171. this.tenantLoading = false;
  172. });
  173. },
  174. handleSubmitLogo(form, done) {
  175. const params = { ...this.logoForm, tenantId: this.userInfo.tenant_id };
  176. updateTenant(params).then(({ data }) => {
  177. done();
  178. if (data.code == 200) {
  179. this.$message.success('保存成功!');
  180. }
  181. }).catch(() => {
  182. done();
  183. })
  184. },
  185. getAttenDetailFunc(yearAndMonth) {
  186. this.compBasicLoading = true;
  187. getAttenDetail(yearAndMonth).then(({ data }) => {
  188. this.compBasicLoading = false;
  189. if (data.code == 200) {
  190. if (Object.keys(data.data).length) {
  191. const _data = data.data;
  192. this.picForm = { id: _data.id, yearAndMonth: _data.yearAndMonth, highTechUrl: _data.highTechUrl ? _data.highTechUrl.split(',') : [] };
  193. this.attendForm = { id: _data.id, yearAndMonth: _data.yearAndMonth, workHours: _data.workHours };
  194. } else {
  195. this.picForm = { id: undefined, highTechUrl: [] };
  196. this.attendForm = { id: undefined, workHours: undefined };
  197. }
  198. }
  199. }).catch(() => {
  200. this.compBasicLoading = false;
  201. })
  202. },
  203. handleHighTecChange(form, done) {
  204. const params = { ...this.picForm, yearAndMonth: this.yearAndMonth, highTechUrl: this.picForm.highTechUrl.join(',') };
  205. settingAttenInfo(params).then(({ data }) => {
  206. done();
  207. if (data.code == 200) {
  208. this.$message.success('保存成功!');
  209. }
  210. }).catch(() => {
  211. done();
  212. })
  213. },
  214. handleSubmitAtten(form, done) {
  215. const params = { ...this.attendForm, yearAndMonth: this.yearAndMonth };
  216. params.workHours = params.workHours ? params.workHours : 0;
  217. settingAttenInfo(params).then(({ data }) => {
  218. done();
  219. if (data.code == 200) {
  220. this.$message.success('保存成功!');
  221. }
  222. }).catch(() => {
  223. done();
  224. })
  225. },
  226. }
  227. }
  228. </script>