initMuban.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. <template>
  2. <div id="select-dom" class="container" style="margin: 15px 0 0 0" v-loading="loading">
  3. <fullscreen :fullscreen.sync="fullscreen" class="container-box"
  4. style="margin: 0 !important; padding: 0 !important">
  5. <div class="titbox">
  6. <h2>绩效模板</h2>
  7. <div>
  8. <i class="el-icon-refresh" @click="iconCli(1)"></i>
  9. <i class="el-icon-full-screen" @click="iconCli(2)"></i>
  10. </div>
  11. </div>
  12. <div style="overflow: hidden">
  13. <el-select placeholder="选择接模板类型" v-model="tempType" filterable clearable
  14. style="float: left; margin-top: 20px" @change="selectType">
  15. <el-option value="0" label="科室绩效"> </el-option>
  16. <el-option value="1" label="部门绩效"> </el-option>
  17. <el-option value="2" label="副总GS"> </el-option>
  18. <el-option value="3" label="集团绩效"> </el-option>
  19. </el-select>
  20. <el-select v-if="tempType == '1'" placeholder="选择接模板种类" v-model="subType" filterable clearable
  21. style="float: left; margin-top: 20px">
  22. <el-option value="0" label="KPI"> </el-option>
  23. <el-option value="1" label="GS"> </el-option>
  24. </el-select>
  25. <el-select v-if="tempType == '2'" placeholder="选择接模板种类" v-model="subType" filterable clearable
  26. style="float: left; margin-top: 20px">
  27. <el-option value="0" label="考核目标"> </el-option>
  28. <el-option value="1" label="考核项目"> </el-option>
  29. <el-option value="2" label="营销活动落地目标"> </el-option>
  30. <el-option value="3" label="渠道销售能力目标"> </el-option>
  31. <el-option value="4" label="家庭营销能力目标"> </el-option>
  32. <el-option value="5" label="业务管理提升目标"> </el-option>
  33. <el-option value="6" label="绩效完成情况"> </el-option>
  34. </el-select>
  35. <el-select v-if="groupFlag" placeholder="选择接部门" v-model="groupId" filterable clearable
  36. style="float: left; margin-top: 20px" @change="selectHandel">
  37. <el-option v-for="items in options" :key="items.value" :label="items.groupName"
  38. :value="items.groupId">
  39. </el-option>
  40. </el-select>
  41. <div class="search" style="float: right; margin-right: 20px">
  42. <el-button size="small" @click="goBack" type="primary">返回</el-button>
  43. </div>
  44. <el-upload style="float: right; margin-top: 20px" class="upload-demo"
  45. action="http://192.168.2.143:9600/spfm/market/kpitemps/addTemp" :before-upload="beforeUploadForm"
  46. :http-request="fileChange" :show-file-list="false" :file-list="fileList" :disabled="disabled">
  47. <el-button size="small" @click="isDisabled" type="primary">点击上传</el-button>
  48. </el-upload>
  49. </div>
  50. <div v-if="dataBody.rows.length > 0" id="tabbox" cellspacing="0" cellpadding="0">
  51. <div style="width: 50%; margin: 0px auto">
  52. <el-input v-model="dataBody.table.tabName"></el-input>
  53. </div>
  54. <table class="dataBody-box" ref="tableBox" border-collapse="collapse" border="1">
  55. <tbody>
  56. <tr v-for="(item, index) in formList" :key="index">
  57. <td class="cell" v-for="(row, zindex) in formList[index]" :key="zindex"
  58. :rowspan="row.rowSpan" :colspan="row.colSpan">
  59. <div v-show="false">
  60. {{ (row.rowNum = index) }}
  61. {{ (row.colNum = zindex) }}
  62. </div>
  63. <!-- <el-tooltip :content="row.cellVal" placement="bottom" effect="light"> -->
  64. <el-input autosize class="table-input" v-model="row.cellVal"></el-input>
  65. <!-- </el-tooltip> -->
  66. <div class="auto-dom" v-if="index == 0"></div>
  67. </td>
  68. </tr>
  69. </tbody>
  70. </table>
  71. </div>
  72. <div class="center-style" v-else>等待上传模板</div>
  73. </fullscreen>
  74. </div>
  75. </template>
  76. <script>
  77. export default {
  78. data() {
  79. return {
  80. groupFlag: true,
  81. user: "",
  82. loading: false,
  83. dataBody: {
  84. rows: [],
  85. table: {
  86. opName: "",
  87. opNo: "",
  88. opTime: "",
  89. opTimeFrom: "",
  90. opTimeTo: "",
  91. tabCode: "",
  92. tabCodePks: "",
  93. tabName: "",
  94. },
  95. },
  96. fullscreen: false,
  97. fileList: [],
  98. closeMenu: false,
  99. options: [],
  100. groupId: "",
  101. groupName: "",
  102. tempTypeDesc: "科室绩效",
  103. tempType: "",
  104. disabled: true,
  105. subType: "",
  106. };
  107. },
  108. computed: {
  109. formList: function() {
  110. return this.dataBody.rows.map((item) => {
  111. return item.filter((row) => {
  112. if (row.displayFlag == "0") {
  113. return row;
  114. }
  115. });
  116. });
  117. },
  118. },
  119. methods: {
  120. selectType(val) {
  121. if (!val) {
  122. this.disabled = true;
  123. }
  124. if (val == "0") {
  125. this.groupFlag = true;
  126. } else {
  127. this.groupFlag = false;
  128. }
  129. this.subType = "";
  130. },
  131. isDisabled() {
  132. if (this.tempType == "") {
  133. this.$message({
  134. message: "请先选择模板类型",
  135. type: "error",
  136. });
  137. return;
  138. } else {
  139. if (this.tempType == "0" && this.groupId == "") {
  140. this.$message({
  141. message: "请先选择部门",
  142. type: "error",
  143. });
  144. return;
  145. } else if (
  146. (this.tempType == "1" || this.tempType == "2") &&
  147. this.subType == ""
  148. ) {
  149. this.$message({
  150. message: "请先选择模板种类",
  151. type: "error",
  152. });
  153. return;
  154. } else {
  155. this.disabled = false;
  156. }
  157. }
  158. },
  159. selectHandel(val) {
  160. this.options.map((item) => {
  161. if (item.groupId == val) {
  162. this.groupName = item.groupName;
  163. }
  164. });
  165. if (this.groupId == "") {
  166. this.disabled = true;
  167. }
  168. },
  169. beforeUploadForm(file) {
  170. // 验证文件类型
  171. var testmsg = file.name.substring(file.name.lastIndexOf(".") + 1);
  172. const extension = testmsg === "xlsx";
  173. if (!extension) {
  174. this.$message({
  175. message: "上传文件只能是excel格式!",
  176. duration: 1000,
  177. showClose: true,
  178. type: "warning",
  179. });
  180. return false;
  181. }
  182. },
  183. // 提交文件
  184. fileChange(param, type) {
  185. let formData = new FormData();
  186. formData.append("file", param.file);
  187. formData.append("tabCode", "");
  188. formData.append("tempType", this.tempType);
  189. formData.append("subType", this.subType);
  190. formData.append(
  191. "subTypeDesc",
  192. this.tempType == "1" && this.subType == "0" ?
  193. "KPI" :
  194. this.tempType == "1" && this.subType == "1" ?
  195. "GS" :
  196. this.tempType == "2" && this.subType == "0" ?
  197. "考核目标" :
  198. this.tempType == "2" && this.subType == "1" ?
  199. "营销活动落地目标" :
  200. this.tempType == "2" && this.subType == "2" ?
  201. "渠道销售能力目标" :
  202. this.tempType == "2" && this.subType == "3" ?
  203. "家庭营销能力目标" :
  204. this.tempType == "2" && this.subType == "4" ?
  205. "业务管理提升目标" :
  206. this.tempType == "2" && this.subType == "5" ?
  207. "绩效完成情况" :
  208. this.tempType == "3" ?
  209. "绩效完成情况" :
  210. ""
  211. );
  212. formData.append(
  213. "tempTypeDesc",
  214. this.tempType == "0" ?
  215. "科室绩效" :
  216. this.tempType == "1" ?
  217. "部门绩效" :
  218. this.tempType == "3" ?
  219. "集团绩效" :
  220. "副总GS"
  221. );
  222. formData.append("groupId", this.groupId);
  223. formData.append("groupName", this.groupName);
  224. this.loading = true;
  225. this.$http({
  226. url: "/market/kpitemps/addTemp",
  227. method: "post",
  228. headers: {
  229. "Content-Type": "application/json",
  230. },
  231. data: formData,
  232. })
  233. .then((res) => {
  234. if (res.data.result == 0) {
  235. this.$message({
  236. message: "上传成功",
  237. type: "success",
  238. });
  239. this.dataBody = res.data.body;
  240. this.$forceUpdate();
  241. }
  242. this.loading = false;
  243. })
  244. .catch((err) => {
  245. this.loading = false;
  246. });
  247. },
  248. goBack() {
  249. this.$router.push("/kpiMuban");
  250. },
  251. //功能栏
  252. iconCli(v) {
  253. if (v === 1) {
  254. this.getList(this.params, this.pageSize);
  255. }
  256. if (v === 2) {
  257. this.fullscreen = !this.fullscreen;
  258. }
  259. },
  260. getOpations() {
  261. this.$http({
  262. url: "/sysmgr/sys/mk/offices/queryList",
  263. method: "post",
  264. headers: {
  265. "Content-Type": "application/json",
  266. },
  267. data: {},
  268. }).then((res) => {
  269. this.options = res.data.body;
  270. });
  271. },
  272. },
  273. mounted() {
  274. this.getOpations();
  275. },
  276. };
  277. </script>
  278. <style lang="scss" scoped>
  279. #tabbox {
  280. height: 75%;
  281. overflow-y: auto;
  282. }
  283. .dataBody-box {
  284. border-collapse: collapse;
  285. margin-top: 20px;
  286. .cell {
  287. position: relative;
  288. }
  289. }
  290. .center-style {
  291. display: flex;
  292. align-items: center;
  293. justify-content: center;
  294. height: 300px;
  295. }
  296. .btn-wrapper-simple {
  297. height: auto !important;
  298. }
  299. .fcous {
  300. border-color: red;
  301. }
  302. .auto-dom {
  303. width: 3px;
  304. opacity: 0;
  305. position: absolute;
  306. right: 0;
  307. top: 0;
  308. z-index: 1000;
  309. cursor: pointer;
  310. height: 100%;
  311. }
  312. </style>>
  313. <style scoped lang="scss">
  314. .btn-default {
  315. display: inline;
  316. margin-left: 10px;
  317. }
  318. .titbox {
  319. div {
  320. float: right;
  321. i {
  322. font-size: 22px;
  323. margin-left: 20px;
  324. cursor: pointer;
  325. }
  326. }
  327. }
  328. .tabbox {
  329. margin-top: 15px;
  330. }
  331. .pageBox {
  332. text-align: right;
  333. margin-top: 10px;
  334. }
  335. </style>