add.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929
  1. <template>
  2. <div class="app-container">
  3. <div class="bj-divider">
  4. <div class="left">
  5. <span class="default-text">档期信息</span>
  6. </div>
  7. <div class="right">
  8. <el-button type="mini" @click="goBack()">返 回</el-button>
  9. <span class="tips"></span>
  10. </div>
  11. </div>
  12. <el-form ref="form" :model="form" :rules="rules" label-width="90px" style="margin-bottom:50px">
  13. <el-form-item label="所属档期" prop="scheduleId">
  14. <el-select disabled style="width: 500px" v-model="form.scheduleId" placeholder="请选择档期" clearable size="small" >
  15. <el-option
  16. v-for="item in scheduleList"
  17. :key="item.id"
  18. :label="item.name"
  19. :value="item.id"
  20. />
  21. </el-select>
  22. </el-form-item>
  23. <el-row>
  24. <el-col :span="12">
  25. <el-form-item label="总进线" label-width="90px" prop="totalNum">
  26. <el-input :disabled="form.id>0" v-model="form.totalNum" onkeyup="value=(value.replace(/\D/g,'')==''?'':parseInt(value))" type="number" placeholder="请输入总进线" />
  27. </el-form-item>
  28. </el-col>
  29. <el-col :span="12">
  30. <el-form-item label="注册数" label-width="90px" prop="registerNum">
  31. <el-input :disabled="form.id>0" v-model="form.registerNum" onkeyup="value=(value.replace(/\D/g,'')==''?'':parseInt(value))" type="number" placeholder="请输入注册数" />
  32. </el-form-item>
  33. </el-col>
  34. </el-row>
  35. <el-row>
  36. <el-col :span="12">
  37. <el-form-item label="上线数" label-width="90px" prop="onlineNum">
  38. <el-input :disabled="form.id>0" v-model="form.onlineNum" onkeyup="value=(value.replace(/\D/g,'')==''?'':parseInt(value))" type="number" placeholder="请输入上线数" />
  39. </el-form-item>
  40. </el-col>
  41. <el-col :span="12">
  42. <el-form-item label="完课数" label-width="90px" prop="finishNum">
  43. <el-input :disabled="form.id>0" v-model="form.finishNum" onkeyup="value=(value.replace(/\D/g,'')==''?'':parseInt(value))" type="number" placeholder="请输入完课数" />
  44. </el-form-item>
  45. </el-col>
  46. </el-row>
  47. <el-row>
  48. <el-col :span="8" v-if="form.registerRate!='0'">
  49. <el-form-item label-width="80px" label="注册率" prop="registerRate">
  50. {{(form.registerRate*100).toFixed(2)+"%"}}
  51. </el-form-item>
  52. </el-col>
  53. <el-col :span="8" v-if="form.onlineRate!='0'">
  54. <el-form-item label-width="80px" label="上线率" prop="onlineRate" style="margin-right:10px">
  55. {{(form.onlineRate*100).toFixed(2)+"%"}}
  56. </el-form-item>
  57. </el-col>
  58. <el-col :span="8" v-if="form.onlineRate!='0'">
  59. <el-form-item label-width="80px" label="完课率" prop="onlineRate">
  60. {{(form.finishRate*100).toFixed(2)+"%"}}
  61. </el-form-item>
  62. </el-col>
  63. </el-row>
  64. <div class="bj-divider">
  65. <div class="left">
  66. <span class="default-text">轮次业绩</span>
  67. </div>
  68. </div>
  69. <el-row v-for="(item, index) in roundArr" :key="index">
  70. <el-col :span="7">
  71. <el-form-item :label="item+'业绩'" label-width="90px" :prop="'round'+(index+1)+'Money'">
  72. <el-input-number v-model="form['round'+(index+1)+'Money']" :step="10" :precision="2" :min="0.00" :placeholder="'请输入'+item+'业绩'" />
  73. </el-form-item>
  74. </el-col>
  75. <el-col :span="7">
  76. <el-form-item :label="item+'单数'" label-width="90px" :prop="'round'+(index+1)+'Order'">
  77. <el-input-number v-model="form['round'+(index+1)+'Order']" :min="0" :step="1" :placeholder="'请输入'+item+'单数'"/>
  78. </el-form-item>
  79. </el-col>
  80. <el-col :span="5">
  81. <el-form-item :label="item+'转化率:'" label-width="90px" :prop="'round'+(index+1)+'Rate'">
  82. <b class="span">{{ renderRate(index) }}</b>
  83. </el-form-item>
  84. </el-col>
  85. <el-col :span="5">
  86. <el-form-item :label="item+'客单价(元):'" label-width="110px" :prop="'round'+(index+1)+'Unit'">
  87. <b class="span">{{form['round'+(index+1)+'Unit']}}</b>
  88. </el-form-item>
  89. </el-col>
  90. </el-row>
  91. <el-row>
  92. <el-col :span="7">
  93. <el-form-item label="累计总业绩" label-width="90px" prop="totalMoney">
  94. <el-input-number disabled v-model="form.totalMoney" :step="10" :precision="2" :min="0.00" placeholder="请输入累计总业绩" />
  95. </el-form-item>
  96. </el-col>
  97. <el-col :span="7">
  98. <el-form-item label="累计总单" label-width="90px" prop="totalOrder">
  99. <el-input-number disabled v-model="form.totalOrder" :min="0" :step="1" placeholder="请输入累计总单" />
  100. </el-form-item>
  101. </el-col>
  102. <el-col :span="6">
  103. <el-form-item label="目标业绩" label-width="90px" prop="targetMoney">
  104. <el-input-number v-model="form.targetMoney" :step="10" :precision="2" :min="0.00" placeholder="请输入目标业绩" />
  105. </el-form-item>
  106. </el-col>
  107. <el-col :span="4">
  108. <el-form-item label="目标完成率" label-width="90px" prop="targetRate">
  109. <b class="span">{{ (form.targetRate*100).toFixed(2)+"%"}}</b>
  110. </el-form-item>
  111. </el-col>
  112. </el-row>
  113. <!-- <el-row>
  114. <el-col :span="7">
  115. <el-form-item label="二轮业绩" label-width="90px" prop="round2Money">
  116. <el-input-number v-model="form.round2Money" :precision="2" :min="0.00" placeholder="请输入二轮业绩" />
  117. </el-form-item>
  118. </el-col>
  119. <el-col :span="7">
  120. <el-form-item label="二轮单数" label-width="90px" prop="round2Order">
  121. <el-input-number v-model="form.round2Order" :min="0" :step="1" placeholder="请输入二轮单数" />
  122. </el-form-item>
  123. </el-col>
  124. <el-col :span="5">
  125. <el-form-item label="二轮转化率" label-width="90px" prop="round2Rate">
  126. {{(form.round2Rate*100).toFixed(2)+"%"}}
  127. </el-form-item>
  128. </el-col>
  129. <el-col :span="5">
  130. <el-form-item label="二轮客单价(元):" label-width="110px" prop="round2Unit">
  131. {{form.round2Unit}}
  132. </el-form-item>
  133. </el-col>
  134. </el-row>
  135. <el-row>
  136. <el-col :span="7">
  137. <el-form-item label="三轮业绩" label-width="90px" prop="round3Money">
  138. <el-input-number v-model="form.round3Money" :precision="2" :min="0.00" placeholder="请输入三轮业绩" />
  139. </el-form-item>
  140. </el-col>
  141. <el-col :span="7">
  142. <el-form-item label="三轮单数" label-width="90px" prop="round3Order">
  143. <el-input-number v-model="form.round3Order" :min="0" :step="1" placeholder="请输入三轮单数" />
  144. </el-form-item>
  145. </el-col>
  146. <el-col :span="5">
  147. <el-form-item label="三轮转化率" label-width="90px" prop="round3Rate">
  148. {{(form.round3Rate*100).toFixed(2)+"%"}}
  149. </el-form-item>
  150. </el-col>
  151. <el-col :span="5">
  152. <el-form-item label="三轮客单价(元):" label-width="110px" prop="round3Unit">
  153. {{form.round3Unit}}
  154. </el-form-item>
  155. </el-col>
  156. </el-row>
  157. <el-row>
  158. <el-col :span="7">
  159. <el-form-item label="四轮业绩" label-width="90px" prop="round4Money">
  160. <el-input-number v-model="form.round4Money" :precision="2" :min="0.00" placeholder="请输入四轮业绩" />
  161. </el-form-item>
  162. </el-col>
  163. <el-col :span="7">
  164. <el-form-item label="四轮单数" label-width="90px" prop="round4Order">
  165. <el-input-number v-model="form.round4Order" :min="0" :step="1" placeholder="请输入四轮单数" />
  166. </el-form-item>
  167. </el-col>
  168. <el-col :span="5">
  169. <el-form-item label="四轮转化率" label-width="90px" prop="round4Rate">
  170. {{(form.round4Rate*100).toFixed(2)+"%"}}
  171. </el-form-item>
  172. </el-col>
  173. <el-col :span="5">
  174. <el-form-item label="四轮客单价(元):" label-width="110px" prop="round4Unit">
  175. {{form.round4Unit}}
  176. </el-form-item>
  177. </el-col>
  178. </el-row>
  179. <el-row>
  180. <el-col :span="7">
  181. <el-form-item label="五轮业绩" label-width="90px" prop="round5Money">
  182. <el-input-number v-model="form.round5Money" :precision="2" :min="0.00" placeholder="请输入五轮业绩" />
  183. </el-form-item>
  184. </el-col>
  185. <el-col :span="7">
  186. <el-form-item label="五轮单数" label-width="90px" prop="round5Order">
  187. <el-input-number v-model="form.round5Order" :min="0" :step="1" placeholder="请输入五轮单数" />
  188. </el-form-item>
  189. </el-col>
  190. <el-col :span="5">
  191. <el-form-item label="五轮转化率" label-width="90px" prop="round5Rate">
  192. {{(form.round5Rate*100).toFixed(2)+"%"}}
  193. </el-form-item>
  194. </el-col>
  195. <el-col :span="5">
  196. <el-form-item label="五轮客单价(元):" label-width="110px" prop="round5Unit">
  197. {{form.round5Unit}}
  198. </el-form-item>
  199. </el-col>
  200. </el-row>
  201. <el-row>
  202. <el-col :span="7">
  203. <el-form-item label="六轮业绩" label-width="90px" prop="round6Money">
  204. <el-input-number v-model="form.round6Money" :precision="2" :min="0.00" placeholder="请输入六轮业绩" />
  205. </el-form-item>
  206. </el-col>
  207. <el-col :span="7">
  208. <el-form-item label="六轮单数" label-width="90px" prop="round6Order">
  209. <el-input-number v-model="form.round6Order" :min="0" :step="1" placeholder="请输入六轮单数" />
  210. </el-form-item>
  211. </el-col>
  212. <el-col :span="5">
  213. <el-form-item label="六轮转化率" label-width="90px" prop="round6Rate">
  214. {{(form.round6Rate*100).toFixed(2)+"%"}}
  215. </el-form-item>
  216. </el-col>
  217. <el-col :span="5">
  218. <el-form-item label="六轮客单价(元):" label-width="110px" prop="round6Unit">
  219. {{form.round6Unit}}
  220. </el-form-item>
  221. </el-col>
  222. </el-row>
  223. <el-row>
  224. <el-col :span="7">
  225. <el-form-item label="七轮业绩" label-width="90px" prop="round7Money">
  226. <el-input-number v-model="form.round7Money" :precision="2" :min="0.00" placeholder="请输入七轮业绩" />
  227. </el-form-item>
  228. </el-col>
  229. <el-col :span="7">
  230. <el-form-item label="七轮单数" label-width="90px" prop="round7Order">
  231. <el-input-number v-model="form.round7Order" :min="0" :step="1" placeholder="请输入七轮单数" />
  232. </el-form-item>
  233. </el-col>
  234. <el-col :span="5">
  235. <el-form-item label="七轮转化率" label-width="90px" prop="round7Rate">
  236. {{(form.round7Rate*100).toFixed(2)+"%"}}
  237. </el-form-item>
  238. </el-col>
  239. <el-col :span="5">
  240. <el-form-item label="七轮客单价(元):" label-width="110px" prop="round7Unit">
  241. {{form.round7Unit}}
  242. </el-form-item>
  243. </el-col>
  244. </el-row>
  245. <el-row>
  246. <el-col :span="7">
  247. <el-form-item label="八轮业绩" label-width="90px" prop="round8Money">
  248. <el-input-number v-model="form.round8Money" :precision="2" :min="0.00" placeholder="请输入八轮业绩" />
  249. </el-form-item>
  250. </el-col>
  251. <el-col :span="7">
  252. <el-form-item label="八轮单数" label-width="90px" prop="round8Order">
  253. <el-input-number v-model="form.round8Order" :min="0" :step="1" placeholder="请输入八轮单数" />
  254. </el-form-item>
  255. </el-col>
  256. <el-col :span="5">
  257. <el-form-item label="八轮转化率" label-width="90px" prop="round8Rate">
  258. {{(form.round8Rate*100).toFixed(2)+"%"}}
  259. </el-form-item>
  260. </el-col>
  261. <el-col :span="5">
  262. <el-form-item label="八轮客单价(元):" label-width="110px" prop="round8Unit">
  263. {{form.round8Unit}}
  264. </el-form-item>
  265. </el-col>
  266. </el-row>
  267. <el-row>
  268. <el-col :span="7">
  269. <el-form-item label="九轮业绩" label-width="90px" prop="round9Money">
  270. <el-input-number v-model="form.round9Money" :precision="2" :min="0.00" placeholder="请输入九轮业绩" />
  271. </el-form-item>
  272. </el-col>
  273. <el-col :span="7">
  274. <el-form-item label="九轮单数" label-width="90px" prop="round9Order">
  275. <el-input-number v-model="form.round9Order" :min="0" :step="1" placeholder="请输入九轮单数" />
  276. </el-form-item>
  277. </el-col>
  278. <el-col :span="5">
  279. <el-form-item label="九轮转化率" label-width="90px" prop="round9Rate">
  280. {{(form.round9Rate*100).toFixed(2)+"%"}}
  281. </el-form-item>
  282. </el-col>
  283. <el-col :span="5">
  284. <el-form-item label="九轮客单价(元):" label-width="110px" prop="round9Unit">
  285. {{form.round9Unit}}
  286. </el-form-item>
  287. </el-col>
  288. </el-row>
  289. -->
  290. </el-form>
  291. <div slot="footer" class="dialog-footer">
  292. <el-button :disabled="scheduleItem.status==0" type="primary" @click="submitForm">确 定</el-button>
  293. <el-button @click="cancel">取 消</el-button>
  294. </div>
  295. </div>
  296. </template>
  297. <script>
  298. import { treeselect } from "@/api/company/companyDept";
  299. import Treeselect from "@riophae/vue-treeselect";
  300. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  301. import { getTcmScheduleReport, addTcmScheduleReport, updateTcmScheduleReport,listAllSchedule } from "@/api/company/tcmScheduleReport";
  302. export default {
  303. name: "TcmScheduleAdd",
  304. components: { Treeselect },
  305. data() {
  306. const registerNumRule = (rule, value, callback) => {
  307. console.log('registerNumVal->',value)
  308. if (Number(value) > this.form.totalNum) {
  309. callback(new Error('注册数不能大于总进线'))
  310. } else {
  311. callback()
  312. }
  313. };
  314. const onlineNumRule = (rule, value, callback) => {
  315. console.log('onlineNumVal->',value)
  316. if (Number(value) > this.form.registerNum) {
  317. callback(new Error('上线数不能大于注册数'))
  318. } else {
  319. callback()
  320. }
  321. };
  322. const finishNumRule = (rule, value, callback) => {
  323. console.log('finishNumVal->',value)
  324. if (Number(value) > this.form.registerNum) {
  325. callback(new Error('完课数不能大于注册数'))
  326. } else {
  327. callback()
  328. }
  329. };
  330. const roundOrderRule = (rule, value, callback) => {
  331. console.log('round1Order rule'+JSON.stringify(rule)+' value:'+value);
  332. var orderNum=0;
  333. for (let index = 0; index < 9; index++) {
  334. if(!!this.form['round'+index+'Order']){
  335. orderNum+=this.form['round'+index+'Order'];
  336. }
  337. }
  338. console.log('qxj orderNum:'+orderNum);
  339. var roundRate=rule.field.replace('Order','Rate');
  340. if (Number(value) > this.form.totalNum) {
  341. this.form[roundRate]=0;
  342. //callback(new Error('当前轮次单数不能大于总进线'))
  343. }else if(orderNum>this.form.totalNum){
  344. this.form[roundRate]=0;
  345. //callback(new Error('所有轮次单数不能大于总进线'))
  346. }
  347. callback();
  348. };
  349. return {
  350. // 遮罩层
  351. loading: true,
  352. // 选中数组
  353. ids: [],
  354. // 非单个禁用
  355. single: true,
  356. // 非多个禁用
  357. multiple: true,
  358. // 显示搜索条件
  359. showSearch: true,
  360. // 总条数
  361. total: 0,
  362. // 中医档期业绩报表表格数据
  363. tcmScheduleReportList: [],
  364. scheduleList:[],
  365. scheduleId:null,
  366. scheduleItem:{status:1},
  367. reportId:null,
  368. roundArr:["一轮","二轮","三轮","四轮","五轮","六轮","七轮","八轮","九轮"],
  369. // 弹出层标题
  370. title: "",
  371. // 是否显示弹出层
  372. open: false,
  373. dateRange: [],
  374. users:[],
  375. // 部门树选项
  376. deptOptions: [],
  377. // 部门名称
  378. deptName: undefined,
  379. // 表单参数
  380. form: {},
  381. // 表单校验
  382. rules: {
  383. scheduleId: [
  384. { required: true, message: "请选择档期", trigger: "blur" }
  385. ],
  386. totalNum: [
  387. { required: true, message: "总进线不能为空", trigger: "blur" }
  388. ],
  389. registerNum: [
  390. { required: true, message: "注册数不能为空", trigger: "blur" },
  391. { required: true, validator: registerNumRule, trigger: "blur" },
  392. // { pattern: /^[1-9]\d*$/, message: '只能输入整数'}
  393. ],
  394. onlineNum: [
  395. { required: true, message: "上线数不能为空", trigger: "blur" },
  396. { required: true, validator: onlineNumRule, trigger: "blur" }
  397. ],
  398. finishNum: [
  399. { required: true, message: "完课数不能为空", trigger: "blur" },
  400. { required: true, validator: finishNumRule, trigger: "blur" }
  401. ],
  402. round1Order: [
  403. { required: false, validator: roundOrderRule, trigger: "blur" }
  404. ],
  405. round2Order: [
  406. { required: false, validator: roundOrderRule, trigger: "blur" }
  407. ],
  408. round3Order: [
  409. { required: false, validator: roundOrderRule, trigger: "blur" }
  410. ],
  411. round4Order: [
  412. { required: false, validator: roundOrderRule, trigger: "blur" }
  413. ],
  414. round5Order: [
  415. { required: false, validator: roundOrderRule, trigger: "blur" }
  416. ],
  417. round6Order: [
  418. { required: false, validator: roundOrderRule, trigger: "blur" }
  419. ],
  420. round7Order: [
  421. { required: false, validator: roundOrderRule, trigger: "blur" }
  422. ],
  423. round8Order: [
  424. { required: false, validator: roundOrderRule, trigger: "blur" }
  425. ],
  426. round9Order: [
  427. { required: false, validator: roundOrderRule, trigger: "blur" }
  428. ],
  429. }
  430. };
  431. },
  432. watch:{
  433. 'form.registerNum':function(newVal,oldVal){
  434. console.log('newVal->',newVal)
  435. console.log('oldVal->',oldVal)
  436. this.form.registerRate=0;
  437. if(!!newVal && Number(newVal)<=this.form.totalNum && this.form.totalNum>0){
  438. this.form.registerRate=(newVal/this.form.totalNum*1.0).toFixed(2);
  439. }
  440. },
  441. 'form.onlineNum':function(newVal,oldVal){
  442. console.log('newVal->',newVal)
  443. console.log('oldVal->',oldVal)
  444. this.form.onlineRate=0;
  445. if(!!newVal){
  446. this.form.onlineRate=(newVal/this.form.registerNum*1.0).toFixed(2);
  447. }
  448. },
  449. 'form.finishNum':function(newVal,oldVal){
  450. console.log('newVal->',newVal)
  451. console.log('oldVal->',oldVal)
  452. this.form.finishRate=0;
  453. if(!!newVal && this.form.registerNum>0){
  454. this.form.finishRate=(newVal/this.form.registerNum*1.0).toFixed(2);
  455. }
  456. },
  457. 'form.round1Money':function(newVal,oldVal){
  458. console.log("qxj newVal:"+newVal+",is:"+!!newVal);
  459. if(newVal!=undefined){
  460. if(this.form.round1Order>0){
  461. this.form.round1Unit=(newVal/this.form.round1Order*1.0).toFixed(2);
  462. }
  463. this.calcTotalMoney();
  464. }
  465. },
  466. 'form.round1Order':function(newVal,oldVal){
  467. if(newVal!=undefined){
  468. this.form.round1Rate=(newVal/this.form.totalNum*1.0).toFixed(2);
  469. this.form.round1Unit=0.0;
  470. if(newVal>0)
  471. this.form.round1Unit=(this.form.round1Money/newVal*1.0).toFixed(2);
  472. this.calcTotalOrder();
  473. }
  474. },
  475. 'form.round2Money':function(newVal,oldVal){
  476. if(newVal!=undefined){
  477. if(this.form.round2Order>0){
  478. this.form.round2Unit=(newVal/this.form.round2Order*1.0).toFixed(2);
  479. }
  480. this.calcTotalMoney();
  481. }
  482. },
  483. 'form.round2Order':function(newVal,oldVal){
  484. if(newVal!=undefined){
  485. this.form.round2Rate=(newVal/this.form.totalNum*1.0).toFixed(2);
  486. this.form.round2Unit=0.0;
  487. if(newVal>0)
  488. this.form.round2Unit=(this.form.round2Money/newVal*1.0).toFixed(2);
  489. this.calcTotalOrder();
  490. }
  491. },
  492. 'form.round3Money':function(newVal,oldVal){
  493. if(newVal!=undefined){
  494. if(this.form.round3Order>0){
  495. this.form.round3Unit=(newVal/this.form.round3Order*1.0).toFixed(2);
  496. }
  497. this.calcTotalMoney();
  498. }
  499. },
  500. 'form.round3Order':function(newVal,oldVal){
  501. if(newVal!=undefined){
  502. this.form.round3Rate=(newVal/this.form.totalNum*1.0).toFixed(2);
  503. this.form.round3Unit=0.0;
  504. if(newVal>0)
  505. this.form.round3Unit=(this.form.round3Money/newVal*1.0).toFixed(2);
  506. this.calcTotalOrder();
  507. }
  508. },
  509. 'form.round4Money':function(newVal,oldVal){
  510. if(newVal!=undefined){
  511. if(this.form.round4Order>0){
  512. this.form.round4Unit=(newVal/this.form.round4Order*1.0).toFixed(2);
  513. }
  514. this.calcTotalMoney();
  515. }
  516. },
  517. 'form.round4Order':function(newVal,oldVal){
  518. if(newVal!=undefined){
  519. this.form.round4Rate=(newVal/this.form.totalNum*1.0).toFixed(2);
  520. this.form.round4Unit=0.0;
  521. if(newVal>0)
  522. this.form.round4Unit=(this.form.round4Money/newVal*1.0).toFixed(2);
  523. this.calcTotalOrder();
  524. }
  525. },
  526. 'form.round5Money':function(newVal,oldVal){
  527. if(newVal!=undefined){
  528. if(this.form.round5Order>0){
  529. this.form.round5Unit=(newVal/this.form.round5Order*1.0).toFixed(2);
  530. }
  531. this.calcTotalMoney();
  532. }
  533. },
  534. 'form.round5Order':function(newVal,oldVal){
  535. if(newVal!=undefined){
  536. this.form.round5Rate=(newVal/this.form.totalNum*1.0).toFixed(2);
  537. this.form.round5Unit=0.0;
  538. if(newVal>0)
  539. this.form.round5Unit=(this.form.round5Money/newVal*1.0).toFixed(2);
  540. this.calcTotalOrder();
  541. }
  542. },
  543. 'form.round6Money':function(newVal,oldVal){
  544. if(newVal!=undefined){
  545. if(this.form.round6Order>0){
  546. this.form.round6Unit=(newVal/this.form.round6Order*1.0).toFixed(2);
  547. }
  548. this.calcTotalMoney();
  549. }
  550. },
  551. 'form.round6Order':function(newVal,oldVal){
  552. if(newVal!=undefined){
  553. this.form.round6Rate=(newVal/this.form.totalNum*1.0).toFixed(2);
  554. this.form.round6Unit=0.0;
  555. if(newVal>0)
  556. this.form.round6Unit=(this.form.round6Money/newVal*1.0).toFixed(2);
  557. this.calcTotalOrder();
  558. }
  559. },
  560. 'form.round7Money':function(newVal,oldVal){
  561. if(newVal!=undefined){
  562. if(this.form.round7Order>0){
  563. this.form.round7Unit=(newVal/this.form.round7Order*1.0).toFixed(2);
  564. }
  565. this.calcTotalMoney();
  566. }
  567. },
  568. 'form.round7Order':function(newVal,oldVal){
  569. if(newVal!=undefined){
  570. this.form.round7Rate=(newVal/this.form.totalNum*1.0).toFixed(2);
  571. this.form.round7Unit=0.0;
  572. if(newVal>0)
  573. this.form.round7Unit=(this.form.round7Money/newVal*1.0).toFixed(2);
  574. this.calcTotalOrder();
  575. }
  576. },
  577. 'form.round8Money':function(newVal,oldVal){
  578. if(newVal!=undefined){
  579. if(this.form.round8Order>0){
  580. this.form.round8Unit=(newVal/this.form.round8Order*1.0).toFixed(2);
  581. }
  582. this.calcTotalMoney();
  583. }
  584. },
  585. 'form.round8Order':function(newVal,oldVal){
  586. if(newVal!=undefined){
  587. this.form.round8Rate=(newVal/this.form.totalNum*1.0).toFixed(2);
  588. this.form.round8Unit=0.0;
  589. if(newVal>0)
  590. this.form.round8Unit=(this.form.round8Money/newVal*1.0).toFixed(2);
  591. this.calcTotalOrder();
  592. }
  593. },
  594. 'form.round9Money':function(newVal,oldVal){
  595. if(newVal!=undefined){
  596. if(this.form.round9Order>0){
  597. this.form.round9Unit=(newVal/this.form.round9Order*1.0).toFixed(2);
  598. }
  599. this.calcTotalMoney();
  600. }
  601. },
  602. 'form.round9Order':function(newVal,oldVal){
  603. if(newVal!=undefined){
  604. this.form.round9Rate=(newVal/this.form.totalNum*1.0).toFixed(2);
  605. this.form.round9Unit=0.0;
  606. if(newVal>0)
  607. this.form.round9Unit=(this.form.round9Money/newVal*1.0).toFixed(2);
  608. this.calcTotalOrder();
  609. }
  610. },
  611. 'form.targetMoney':function(newVal,oldVal){
  612. if(newVal!=undefined){
  613. this.form.targetRate=(this.form.totalMoney/newVal*1.0).toFixed(5);
  614. }
  615. },
  616. },
  617. created() {
  618. this.scheduleId=this.$route.query.scheduleId;
  619. this.reportId=this.$route.query.reportId;
  620. this.reset();
  621. this.getListSchedule();
  622. this.getTreeselect();
  623. this.requestData();
  624. },
  625. methods: {
  626. getTreeselect() {
  627. treeselect().then((response) => {
  628. this.deptOptions = response.data;
  629. });
  630. },
  631. getListSchedule() {
  632. this.loading = true;
  633. listAllSchedule().then(response => {
  634. this.scheduleList = response.rows;
  635. var listTemp = this.scheduleList.filter(item => item.id==this.scheduleId);
  636. console.log("qxj listTemp:"+JSON.stringify(listTemp));
  637. if(listTemp.length>0){
  638. this.scheduleItem=listTemp[0];
  639. }
  640. });
  641. },
  642. /** 查询中医档期业绩报表详情 */
  643. requestData() {
  644. this.reset();
  645. this.loading = true;
  646. getTcmScheduleReport(this.reportId).then(response => {
  647. this.form = response.data;
  648. console.log("qxj reportData:"+ JSON.stringify(response.data));
  649. this.loading = false;
  650. });
  651. },
  652. // 取消按钮
  653. cancel() {
  654. this.goBack();
  655. },
  656. // 表单重置
  657. reset() {
  658. this.form = { //totalMoney totalOrder targetMoney targetRate
  659. id: null,
  660. scheduleId: null,
  661. companyUserId: null,
  662. companyId: null,
  663. totalNum: null,
  664. registerNum: null,
  665. onlineNum: null,
  666. finishNum: null,
  667. registerRate: null,
  668. onlineRate: null,
  669. finishRate: null,
  670. totalMoney: 0,
  671. totalOrder: null,
  672. targetMoney: null,
  673. targetRate: null,
  674. round1Money: null,
  675. round1Order: null,
  676. round1Rate: null,
  677. round1Unit: null,
  678. round2Money: null,
  679. round2Order: null,
  680. round2Rate: null,
  681. round2Unit: null,
  682. round3Money: null,
  683. round3Order: null,
  684. round3Rate: null,
  685. round3Unit: null,
  686. round4Money: null,
  687. round4Order: null,
  688. round4Rate: null,
  689. round4Unit: null,
  690. round5Money: null,
  691. round5Order: null,
  692. round5Rate: null,
  693. round5Unit: null,
  694. round6Money: null,
  695. round6Order: null,
  696. round6Rate: null,
  697. round6Unit: null,
  698. round7Money: null,
  699. round7Order: null,
  700. round7Rate: null,
  701. round7Unit: null,
  702. round8Money: null,
  703. round8Order: null,
  704. round8Rate: null,
  705. round8Unit: null,
  706. round9Money: null,
  707. round9Order: null,
  708. round9Rate: null,
  709. round9Unit: null,
  710. createUserId:null,
  711. updateUserId:null,
  712. };
  713. this.resetForm("form");
  714. },
  715. /** 搜索按钮操作 */
  716. handleQuery() {
  717. this.queryParams.pageNum = 1;
  718. this.getList();
  719. },
  720. /** 重置按钮操作 */
  721. resetQuery() {
  722. this.resetForm("queryForm");
  723. this.handleQuery();
  724. },
  725. goBack(){
  726. this.$router.go(-1);
  727. },
  728. calcTotalMoney(){
  729. var totalMoney=0;
  730. for (let index = 1; index <= 9; index++) {
  731. if(!!this.form['round'+index+'Money']){
  732. totalMoney+=this.form['round'+index+'Money'];
  733. }
  734. }
  735. console.log("qxj totalMoney:"+totalMoney);
  736. this.form.totalMoney=totalMoney.toFixed(2);
  737. },
  738. calcTotalOrder(){
  739. var totalOrder=0;
  740. for (let index = 1; index <= 9; index++) {
  741. if(!!this.form['round'+index+'Order']){
  742. totalOrder+=this.form['round'+index+'Order'];
  743. }
  744. }
  745. console.log("qxj totalOrder:"+totalOrder);
  746. this.form.totalOrder=totalOrder;
  747. },
  748. renderRate(index){
  749. var val="0.00%";
  750. if((this.form['round'+(index+1)+'Rate'])!=Infinity){
  751. val=(this.form['round'+(index+1)+'Rate']*100).toFixed(2)+"%";
  752. }
  753. return val;
  754. },
  755. /** 提交按钮 */
  756. submitForm() {
  757. this.$refs["form"].validate(valid => {
  758. if (valid) {
  759. if (this.form.id != null) {
  760. updateTcmScheduleReport(this.form).then(response => {
  761. if (response.code === 200) {
  762. this.msgSuccess("修改成功");
  763. this.goBack();
  764. }
  765. });
  766. } else {
  767. addTcmScheduleReport(this.form).then(response => {
  768. if (response.code === 200) {
  769. this.msgSuccess("新增成功");
  770. this.goBack();
  771. }
  772. });
  773. }
  774. }
  775. });
  776. },
  777. toDecimal2(x) {
  778. var f = x;
  779. if (isNaN(f)) {
  780. return 0;
  781. }
  782. // var f = Math.round(x*100)/100;
  783. // var s = f.toString();
  784. // var rs = s.indexOf('.');
  785. // if (rs < 0) {
  786. // rs = s.length;
  787. // s += '.';
  788. // }
  789. // while (s.length <= rs + 2) {
  790. // s += '0';
  791. // }
  792. return x.toFixed(2);
  793. }
  794. }
  795. };
  796. </script>
  797. <style lang="scss" scoped>
  798. .app-main{
  799. background-color: #fff !important;
  800. }
  801. .app-container{
  802. margin: 0;
  803. }
  804. .bj-divider {
  805. padding: 10px 0;
  806. border-bottom: 1px solid #eee;
  807. margin-bottom: 16px;
  808. display: -webkit-box;
  809. display: -ms-flexbox;
  810. display: flex;
  811. -webkit-box-align: center;
  812. -ms-flex-align: center;
  813. align-items: center;
  814. -webkit-box-pack: justify;
  815. -ms-flex-pack: justify;
  816. justify-content: space-between;
  817. width: 100%
  818. }
  819. .bj-divider.small {
  820. font-size: 14px;
  821. padding: 8px 0;
  822. margin-bottom: 8px
  823. }
  824. .bj-divider.noPadding {
  825. padding: 0
  826. }
  827. .bj-divider .left {
  828. display: -webkit-box;
  829. display: -ms-flexbox;
  830. display: flex;
  831. -webkit-box-align: center;
  832. -ms-flex-align: center;
  833. align-items: center
  834. }
  835. .bj-divider .button {
  836. display: -webkit-box;
  837. display: -ms-flexbox;
  838. display: flex;
  839. background: #ffffff;
  840. border: 1px solid #fefefe;
  841. }
  842. .bj-divider .default-text {
  843. border-left: 4px #13c2c2 solid;
  844. padding-left: 16px;
  845. font-size: 18px
  846. }
  847. .bj-divider.small .default-text {
  848. font-size: 14px
  849. }
  850. .bj-divider .xs {
  851. font-size: 12px;
  852. padding: 0 8px
  853. }
  854. .bj-divider .tips {
  855. line-height: 20px;
  856. margin-left: 16px
  857. }
  858. .bj-divider .right {
  859. display: -webkit-box;
  860. display: -ms-flexbox;
  861. display: flex;
  862. -webkit-box-align: center;
  863. -ms-flex-align: center;
  864. align-items: center
  865. }
  866. .bj-divider .el-button {
  867. margin-left: 16px
  868. }
  869. .bj-divider .fixed {
  870. position: fixed;
  871. top: 55px;
  872. z-index: 9;
  873. right: 20px
  874. }
  875. .bj-divider .right .el-form-item--small.el-form-item {
  876. margin-bottom: 0
  877. }
  878. .dialog-footer{
  879. text-align: right;
  880. position: fixed;
  881. right: 0px;
  882. bottom: 0px;
  883. width: 90%;
  884. margin-right: 0px;
  885. padding:10px 20px;
  886. z-index: 9;
  887. background: #ffffff;
  888. height: 65px;
  889. }
  890. .span{
  891. font-size: 15px;
  892. font-weight:normal;
  893. }
  894. </style>