serviceTargetDistributionDialog.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673
  1. <template>
  2. <el-dialog :title="title" :visible.sync="dialogVisible" width="65%" center :close-on-click-modal="false" :before-close="beforeClose" @clsoe="dialogClose">
  3. <div>
  4. <div class="message">
  5. 本系统中的年度服务目标、【年度服务预算】、年度服务计划等,无论是否经由一方或双方同意或者确认,均不构成双方之间的协议;服务量、服务费用价格与金额等应以另行签署的合同为准。
  6. </div>
  7. <el-form :model="form" :rules="rules" ref="ruleForm" label-width="100px" :disabled="formDisabled">
  8. <el-row>
  9. <el-col :span="12">
  10. <el-form-item label="目标产品" :prop="type === 'add' ? 'skuId' : 'skuName'">
  11. <el-select v-if="type === 'add'" v-model="form.skuId" placeholder="下拉选择" class="w100" @change="skuIdChange">
  12. <el-option v-for="item in drugList" :key="item.drug_id" :label="item.drug_name" :value="item.drug_id"></el-option>
  13. </el-select>
  14. <el-input v-else v-model="form.skuName" placeholder="目标产品" :disabled="formItemDisabled" />
  15. </el-form-item>
  16. </el-col>
  17. <el-col :span="12">
  18. <el-form-item label="生产企业" prop="ent_name">
  19. <el-input v-model="form.ent_name" placeholder="生产企业" disabled />
  20. </el-form-item>
  21. </el-col>
  22. </el-row>
  23. <el-row>
  24. <el-col :span="12">
  25. <el-form-item label="目标总值" prop="planScore">
  26. <el-input v-model="form.planScore"></el-input>
  27. </el-form-item>
  28. </el-col>
  29. <el-col :span="12">
  30. <el-form-item label="承接对象" prop="consigneeId">
  31. <el-select v-model="form.consigneeId" placeholder="下拉选择" class="w100" @change="consigneeIdChange">
  32. <el-option v-for="item in csoList" :key="item.deptId" :label="item.name" :value="item.deptId"></el-option>
  33. </el-select>
  34. </el-form-item>
  35. </el-col>
  36. </el-row>
  37. <el-row>
  38. <el-col :span="12">
  39. <el-form-item label="目标类型" prop="planType">
  40. <el-select v-model="form.planType" placeholder="请选择" class="w100" :disabled="formItemDisabled" @change="planTypeChange">
  41. <el-option label="年度计划" value="ANN" />
  42. <el-option label="季度计划" value="QRT" />
  43. </el-select>
  44. </el-form-item>
  45. </el-col>
  46. <el-col :span="12">
  47. <el-form-item label="目标周期" prop="monthrange">
  48. <template v-if="form.planType === ''">
  49. <el-date-picker disabled class="w100" type="year" placeholder="请选择" value-format="yyyy"></el-date-picker>
  50. </template>
  51. <template v-else-if="form.planType === 'ANN'">
  52. <el-date-picker class="w100" :disabled="formItemDisabled" v-model="form.monthrange" type="year" @change="monthrangeChange" placeholder="请选择" value-format="yyyy">
  53. </el-date-picker>
  54. </template>
  55. <template v-else-if="form.planType === 'QRT'">
  56. <ElQuarterPicker :disabled="formItemDisabled" placeholder="请选择" v-model="form.monthrange" @change="monthrangeChange" class="w100" />
  57. </template>
  58. </el-form-item>
  59. </el-col>
  60. </el-row>
  61. <el-row>
  62. <el-col :span="24">
  63. <el-form-item label="目标名称" prop="planName">
  64. <el-input v-model="form.planName" placeholder="目标名称" />
  65. </el-form-item>
  66. </el-col>
  67. </el-row>
  68. </el-form>
  69. <template v-if="type === 'distribute'"> 剩余积分值: {{ form.availScore }} </template>
  70. <!-- 审核说明表单 -->
  71. <el-form class="reviewForm" v-if="type === 'review' || type === 'dismantleReview'" :model="reviewForm" ref="reviewFormRef" label-width="100px">
  72. <el-form-item
  73. label="审核说明"
  74. prop="msg"
  75. :rules="[
  76. {
  77. required: reviewFormMsgRequired,
  78. message: '请填写审核说明',
  79. trigger: 'blur'
  80. }
  81. ]"
  82. >
  83. <el-input type="textarea" v-model="reviewForm.msg"></el-input>
  84. </el-form-item>
  85. </el-form>
  86. <!-- 拆解 -->
  87. <div v-if="type === 'dismantle'">
  88. <dismantleTable :planScore="form.planScore" ref="dismantleTableTable" />
  89. </div>
  90. <!-- 拆解审核 -->
  91. <div v-if="type === 'dismantleReview' || type === 'statistics'">
  92. <tableDate :planScore="form.planScore" :propsTableData="dismantleReviewData" />
  93. </div>
  94. </div>
  95. <div slot="footer" class="dialog-footer">
  96. <!-- 药企新增 || 区域分发 -->
  97. <template v-if="type === 'add' || type === 'distribute'">
  98. <el-button @click="dialogClose">取消</el-button>
  99. <el-button type="primary" @click="confirm">确定</el-button>
  100. </template>
  101. <template v-if="type === 'review'">
  102. <el-button @click="reviewClick(false)">拒绝</el-button>
  103. <el-button type="primary" @click="reviewClick(true)">通过</el-button>
  104. </template>
  105. <template v-if="type === 'dismantle'">
  106. <el-button @click="dialogClose">取消</el-button>
  107. <el-button type="primary" @click="dismantleSubmit">提交</el-button>
  108. </template>
  109. <template v-if="type === 'dismantleReview'">
  110. <el-button @click="dismantleReviewSubmt(false)">拒绝</el-button>
  111. <el-button type="primary" @click="dismantleReviewSubmt(true)">通过</el-button>
  112. </template>
  113. <template v-if="type === 'statistics'">
  114. <el-button @click="dialogClose">关闭</el-button>
  115. </template>
  116. </div>
  117. </el-dialog>
  118. </template>
  119. <script>
  120. import dayjs from 'dayjs';
  121. import ElQuarterPicker from '@/components/ElQuarterPicker/index';
  122. import dismantleTable from './dismantleTable.vue';
  123. import tableDate from './tableDate.vue';
  124. import { createListApi, planCheckApi, planDetailCreateApi, getPlanDetailsApi, checkPlanDetailsApi, planUpdateApi, getListDescendantApi } from '@/api/wmdeptbudget/plan.js';
  125. import { getListDrugApi } from '@/api/assignPoints/currency/index';
  126. import { listCsoApi } from '@/api/csmpages/index.js';
  127. export default {
  128. components: { dismantleTable, tableDate, ElQuarterPicker },
  129. data() {
  130. return {
  131. btnType: '',
  132. type: 'add',
  133. currentRow: {},
  134. title: '新增',
  135. dismantleReviewData: [],
  136. detailsState: '',
  137. dialogVisible: false,
  138. formDisabled: false,
  139. formItemDisabled: false,
  140. drugList: [],
  141. csoList: [],
  142. value1: [],
  143. planIssueRange: '',
  144. planExpiryRange: '',
  145. form: {
  146. planType: '',
  147. parentId: 0,
  148. skuId: '',
  149. ent_name: '',
  150. planName: '',
  151. planScore: '',
  152. monthrange: '2024',
  153. consigneeId: '',
  154. planIssue: '',
  155. planExpiry: '',
  156. locFlag: 'UN_LOCK'
  157. },
  158. rules: {
  159. skuId: [{ required: true, message: '请填写生产企业', trigger: 'blur' }],
  160. planName: [{ required: true, message: '请填写目标名称', trigger: 'blur' }],
  161. monthrange: [{ required: true, message: '请选择目标周期' }],
  162. consigneeId: [{ required: true, message: '请选择承接对象', trigger: 'blur' }],
  163. planScore: [{ required: true, message: '请填写目标总值', trigger: 'blur' }],
  164. planType: [{ required: true, message: '请选择承接对象', trigger: 'blur' }]
  165. },
  166. reviewForm: {
  167. msg: ''
  168. },
  169. reviewFormMsgRequired: false,
  170. pickerOptions: {
  171. disabledDate: (time) => {
  172. // 使用箭头函数保持this上下文
  173. const planIssueDate = new Date(this.planIssueRange);
  174. const planExpiryDate = new Date(this.planExpiryRange);
  175. return time.getTime() <= planIssueDate.getTime() || time.getTime() >= planExpiryDate.getTime();
  176. }
  177. }
  178. };
  179. },
  180. methods: {
  181. async getDrugList() {
  182. const res = await getListDrugApi();
  183. this.drugList = res.data.data;
  184. },
  185. async getCsoList() {
  186. const res = await getListDescendantApi();
  187. this.csoList = res.data.data;
  188. },
  189. skuIdChange(e) {
  190. if (e) {
  191. const curr = this.drugList.find((item) => item.drug_id === e);
  192. if (curr) this.form.ent_name = curr.ent_name;
  193. }
  194. this.nameChange();
  195. },
  196. nameChange() {
  197. if (this.form.skuId && this.form.consigneeId && this.form.planType && this.form.planExpiry && this.form.planIssue) {
  198. let skuIdName;
  199. let consigneeIdName;
  200. if (this.form.skuId && this.form.consigneeId) {
  201. skuIdName = this.drugList.find((item) => item.drug_id === this.form.skuId);
  202. consigneeIdName = this.csoList.find((item) => item.deptId === this.form.consigneeId);
  203. }
  204. if (this.form.planType === 'ANN') {
  205. if (skuIdName && consigneeIdName) {
  206. const name = `${this.form.monthrange}年度-全年-${consigneeIdName.name}-${skuIdName.drug_name}`;
  207. this.form.planName = name;
  208. }
  209. } else {
  210. const arr = this.form.monthrange.split('-');
  211. let text;
  212. switch (arr[1]) {
  213. case '01':
  214. text = '第一';
  215. break;
  216. case '02':
  217. text = '第二';
  218. break;
  219. case '03':
  220. text = '第三';
  221. break;
  222. case '04':
  223. text = '第四';
  224. break;
  225. }
  226. const name = `${arr[0]}年度-${text}季度-${consigneeIdName.name}-${skuIdName.drug_name}`;
  227. this.form.planName = name;
  228. }
  229. }
  230. },
  231. confirm() {
  232. this.$refs.ruleForm.validate(async (valid) => {
  233. if (valid) {
  234. // 判断如果是编辑 走编辑接口
  235. // 分发限制目标总值不能超过剩余积分值
  236. if (this.type === 'distribute') {
  237. if (this.form.planScore > this.form.availScore) {
  238. return this.$message.info('当前分发目标总值不能超过剩余积分值!');
  239. }
  240. }
  241. if (this.btnType === 'edit') {
  242. return this.updateConfirm();
  243. }
  244. const res = await createListApi(this.form);
  245. if (res.data.data) {
  246. this.$message.success('添加成功');
  247. this.$emit('updateList');
  248. this.dialogClose();
  249. }
  250. } else {
  251. console.log('error submit!!');
  252. return false;
  253. }
  254. });
  255. },
  256. async updateConfirm() {
  257. const obj = Object.assign(this.form, {
  258. planId: this.currentRow.planId
  259. });
  260. const res = await planUpdateApi(obj);
  261. if (res.data.data) {
  262. this.$message.success('编辑成功');
  263. this.$emit('updateList');
  264. this.dialogClose();
  265. }
  266. },
  267. getQuarterRange(dateString) {
  268. const [year, quarterCode] = dateString.split('-').map(Number);
  269. let startMonth, endMonth, endDay;
  270. switch (quarterCode) {
  271. case 1: // Q1
  272. startMonth = 1;
  273. endMonth = 3;
  274. endDay = 31;
  275. break;
  276. case 2: // Q2
  277. startMonth = 4;
  278. endMonth = 6;
  279. endDay = 30;
  280. break;
  281. case 3: // Q3
  282. startMonth = 7;
  283. endMonth = 9;
  284. endDay = 30;
  285. break;
  286. case 4: // Q4
  287. startMonth = 10;
  288. endMonth = 12;
  289. endDay = 31;
  290. break;
  291. default:
  292. throw new Error('Invalid quarter code');
  293. }
  294. const startDate = `${year}-${String(startMonth).padStart(2, '0')}-01`;
  295. const endDate = `${year}-${String(endMonth).padStart(2, '0')}-${endDay}`;
  296. return [startDate, endDate];
  297. },
  298. planTypeChange() {
  299. this.form.monthrange = '';
  300. this.form.planIssue = '';
  301. this.form.planExpiry = '';
  302. this.form.planName = '';
  303. },
  304. monthrangeChange(e) {
  305. console.log('e', e);
  306. let skuIdName;
  307. let consigneeIdName;
  308. if (this.form.skuId && this.form.consigneeId) {
  309. skuIdName = this.drugList.find((item) => item.drug_id === this.form.skuId);
  310. consigneeIdName = this.csoList.find((item) => item.deptId === this.form.consigneeId);
  311. }
  312. if (this.form.planType === 'ANN') {
  313. this.form.planIssue = e + '-01-01';
  314. this.form.planExpiry = e + '-12-31';
  315. if (skuIdName && consigneeIdName) {
  316. const name = `${e}年度-全年-${consigneeIdName.name}-${skuIdName.drug_name}`;
  317. this.form.planName = name;
  318. }
  319. } else if (this.form.planType === 'QRT') {
  320. if (skuIdName && consigneeIdName) {
  321. const arr = e.split('-');
  322. let text;
  323. switch (arr[1]) {
  324. case '01':
  325. text = '第一';
  326. break;
  327. case '02':
  328. text = '第二';
  329. break;
  330. case '03':
  331. text = '第三';
  332. break;
  333. case '04':
  334. text = '第四';
  335. break;
  336. }
  337. const name = `${arr[0]}年度-${text}季度-${consigneeIdName.name}-${skuIdName.drug_name}`;
  338. this.form.planName = name;
  339. }
  340. let arr = this.getQuarterRange(e);
  341. this.form.planIssue = arr[0];
  342. this.form.planExpiry = arr[1];
  343. }
  344. },
  345. beforeClose(done) {
  346. this.dialogClose();
  347. },
  348. dialogClose() {
  349. this.formDisabled = false;
  350. this.formItemDisabled = false;
  351. this.type = '';
  352. this.title = '';
  353. this.dismantleReviewData = [];
  354. this.detailsState = '';
  355. this.btnType = '';
  356. this.$refs.ruleForm.resetFields();
  357. const obj = {
  358. planType: '',
  359. parentId: 0,
  360. skuId: '',
  361. planName: '',
  362. planScore: '',
  363. monthrange: '',
  364. consigneeId: '',
  365. planIssue: '',
  366. planExpiry: '',
  367. locFlag: 'UN_LOCK'
  368. };
  369. this.$set(this, 'form', obj);
  370. this.reviewForm.msg = '';
  371. this.dialogVisible = false;
  372. },
  373. addBtn() {
  374. this.getDrugList();
  375. this.getCsoList();
  376. this.formDisabled = false;
  377. this.dialogVisible = true;
  378. this.type = 'add';
  379. this.title = '新增';
  380. },
  381. getQuarterCodeByDate(dateString) {
  382. const [year, month] = dateString.split('-').map(Number);
  383. let quarterCode;
  384. if (month >= 1 && month <= 3) {
  385. quarterCode = 1; // Q1
  386. } else if (month >= 4 && month <= 6) {
  387. quarterCode = 2; // Q2
  388. } else if (month >= 7 && month <= 9) {
  389. quarterCode = 3; // Q3
  390. } else if (month >= 10 && month <= 12) {
  391. quarterCode = 4; // Q4
  392. } else {
  393. throw new Error('Invalid month value');
  394. }
  395. return `${year}-0${quarterCode}`;
  396. },
  397. initForm(row) {
  398. // 年度计划
  399. if (row.planType === 'ANN') {
  400. const year = row.planIssue.slice(0, 4);
  401. row.monthrange = year;
  402. }
  403. if (row.planType === 'QRT') {
  404. const str = this.getQuarterCodeByDate(row.planIssue);
  405. row.monthrange = str;
  406. }
  407. if (row.skuInfo) {
  408. row.ent_name = row.skuInfo.manufacturer;
  409. row.skuName = row.skuInfo.skuName;
  410. }
  411. this.form = row;
  412. this.dialogVisible = true;
  413. },
  414. // 审核 0 事业部上级审核
  415. reviewFn(row) {
  416. this.title = '审核';
  417. this.type = 'review';
  418. const arr = [
  419. {
  420. name: row.consigneeName,
  421. deptId: row.consigneeId
  422. }
  423. ];
  424. this.csoList = arr;
  425. this.formDisabled = true;
  426. row.consigneeId = Number(row.consigneeId);
  427. this.initForm(row);
  428. },
  429. reviewClick(result) {
  430. this.reviewFormMsgRequired = !result;
  431. this.$nextTick(() => {
  432. this.$refs.reviewFormRef.validate(async (valid) => {
  433. if (valid) {
  434. const obj = {
  435. planId: this.form.planId,
  436. result: result,
  437. msg: this.reviewForm.msg
  438. };
  439. const res = await planCheckApi(obj);
  440. if (res.data.data) {
  441. this.$message.success('审核提交成功');
  442. this.$emit('updateList');
  443. this.dialogClose();
  444. }
  445. console.log('res', res);
  446. } else {
  447. console.log('error submit!!');
  448. return false;
  449. }
  450. });
  451. });
  452. },
  453. // 分发
  454. distributeFn(row) {
  455. this.type = 'distribute';
  456. this.currentRow = row;
  457. this.title = '分发';
  458. this.getCsoList();
  459. this.formItemDisabled = true;
  460. if (row.skuInfo) {
  461. this.form.ent_name = row.skuInfo.manufacturer;
  462. this.form.skuName = row.skuInfo.skuName;
  463. this.form.skuId = row.skuInfo.skuId;
  464. }
  465. this.form.parentId = row.planId;
  466. this.form.availScore = row.availScore;
  467. this.form.planType = row.planType;
  468. this.form.planIssue = row.planIssue;
  469. this.form.planExpiry = row.planExpiry;
  470. // 年度计划
  471. if (row.planType === 'ANN') {
  472. const year = row.planIssue.slice(0, 4);
  473. this.form.monthrange = year;
  474. }
  475. if (row.planType === 'QRT') {
  476. const str = this.getQuarterCodeByDate(row.planIssue);
  477. this.form.monthrange = str;
  478. }
  479. this.dialogVisible = true;
  480. },
  481. consigneeIdChange(e) {
  482. if (this.type === 'distribute') {
  483. if (e) {
  484. const consigneeIdName = this.csoList.find((item) => item.deptId === e);
  485. const name = this.currentRow.planName + '-' + consigneeIdName.name;
  486. this.form.planName = name;
  487. }
  488. }
  489. this.nameChange();
  490. },
  491. // 拆解
  492. dismantleFn(row) {
  493. this.type = 'dismantle';
  494. this.form.planType = row.planType;
  495. const arr = [
  496. {
  497. name: row.consigneeName,
  498. deptId: row.consigneeId
  499. }
  500. ];
  501. this.csoList = arr;
  502. this.initForm(row);
  503. row.consigneeId = Number(row.consigneeId);
  504. this.formDisabled = true;
  505. },
  506. async dismantleSubmit() {
  507. const data = this.$refs.dismantleTableTable.tableData;
  508. const allQty = data.reduce((prev, curr) => prev + curr.qty, 0);
  509. const allTotal = data.reduce((prev, curr) => prev + curr.subtotal, 0);
  510. if (allTotal != this.form.planScore) {
  511. return this.$message.info('拆解总任务分值需等于目标总值');
  512. }
  513. const obj = {
  514. planId: this.form.planId,
  515. qty: allQty,
  516. total: allTotal,
  517. items: data
  518. };
  519. const res = await planDetailCreateApi(obj);
  520. if (res.data.data) {
  521. this.$message.success('拆解积分包成功');
  522. this.$emit('updateList');
  523. this.beforeClose();
  524. }
  525. },
  526. // 拆解审核
  527. dismantleReviewFn(row) {
  528. this.statisticsFn(row);
  529. this.type = 'dismantleReview';
  530. this.title = '拆解审核';
  531. },
  532. // 拆解审核提交
  533. dismantleReviewSubmt(type) {
  534. this.reviewFormMsgRequired = !type;
  535. this.$nextTick(() => {
  536. this.$refs.reviewFormRef.validate(async (valid) => {
  537. if (valid) {
  538. const obj = {
  539. detailsId: this.form.planDetails.detailsId,
  540. result: type,
  541. msg: this.reviewForm.msg,
  542. currentState: this.detailsState
  543. };
  544. const res = await checkPlanDetailsApi(obj);
  545. if (res.data.data) {
  546. this.$message.success('审核提交成功');
  547. this.$emit('updateList');
  548. this.dialogClose();
  549. }
  550. } else {
  551. console.log('error submit!!');
  552. return false;
  553. }
  554. });
  555. });
  556. },
  557. // 获取拆解详情数据
  558. async getPlanDetails(id) {
  559. const res = await getPlanDetailsApi(id);
  560. if (res.data.code === 0) {
  561. this.dismantleReviewData = res.data.data.items;
  562. this.detailsState = res.data.data.detailsState;
  563. }
  564. },
  565. // 数据统计
  566. statisticsFn(row) {
  567. this.title = '数据统计';
  568. this.type = 'statistics';
  569. this.formDisabled = true;
  570. if (row.planDetails.detailsId) {
  571. this.getPlanDetails(row.planDetails.detailsId);
  572. }
  573. const arr = [
  574. {
  575. name: row.consigneeName,
  576. deptId: row.consignorId
  577. }
  578. ];
  579. this.csoList = arr;
  580. row.consigneeId = Number(row.consignorId);
  581. this.initForm(row);
  582. this.dialogVisible = true;
  583. },
  584. async editFn(row, type) {
  585. console.log('row', row);
  586. if (row.parentId == 0) {
  587. this.type = 'add';
  588. } else {
  589. this.type = 'distribute';
  590. this.formItemDisabled = true;
  591. if (row.planState == 'INIT') {
  592. row.availScore = row.parentPlanAvailScore + row.planScore;
  593. } else if (row.planState == 'REJECTED') {
  594. row.availScore = row.parentPlanAvailScore;
  595. }
  596. }
  597. this.currentRow = row;
  598. this.btnType = 'edit';
  599. await this.getDrugList();
  600. await this.getCsoList();
  601. row.skuId = row.skuId + '';
  602. this.skuIdChange(row.skuId);
  603. this.form = row;
  604. if (this.type === 'distribute') {
  605. this.form.ent_name = row.skuInfo.manufacturer;
  606. this.form.skuName = row.skuInfo.skuName;
  607. this.form.skuId = row.skuInfo.skuId;
  608. }
  609. // 年度计划
  610. if (row.planType === 'ANN') {
  611. const arr = row.planIssue.split('-');
  612. this.$set(this.form, 'monthrange', arr[0]);
  613. } else {
  614. const str = this.convertToQuarterStart(row.planIssue);
  615. this.$set(this.form, 'monthrange', str);
  616. }
  617. this.dialogVisible = true;
  618. },
  619. convertToQuarterStart(dateString) {
  620. const date = new Date(dateString);
  621. const year = date.getFullYear();
  622. const month = date.getMonth(); // 0 为 1 月,11 为 12 月
  623. // 根据月份计算季度开始月份
  624. let quarterStartMonth;
  625. if (month >= 0 && month <= 2) {
  626. quarterStartMonth = '01'; // Q1: 1月
  627. } else if (month >= 3 && month <= 5) {
  628. quarterStartMonth = '02'; // Q2: 4月
  629. } else if (month >= 6 && month <= 8) {
  630. quarterStartMonth = '03'; // Q3: 7月
  631. } else {
  632. quarterStartMonth = '04'; // Q4: 10月
  633. }
  634. return `${year}-${quarterStartMonth}`;
  635. }
  636. }
  637. };
  638. </script>
  639. <style lang="scss" scoped>
  640. .message {
  641. margin-bottom: 20px;
  642. border-radius: 10px;
  643. border: 1px solid #ccc;
  644. line-height: 35px;
  645. margin-left: 20px;
  646. padding: 10px 20px;
  647. color: #f56c6c;
  648. font-size: 16px;
  649. font-weight: 600;
  650. }
  651. </style>