clusteringDetail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. <!--新增、编辑、查看集群信息-->
  2. <template>
  3. <div>
  4. <el-form
  5. ref="form"
  6. :model="form"
  7. :rules="rules"
  8. label-width="200px"
  9. class="flexBox"
  10. >
  11. <div class="formItemBox">
  12. <el-form-item label="账户名称:" prop="userName">
  13. <el-input
  14. placeholder="请输入"
  15. disabled
  16. v-model="form.userName"
  17. >
  18. </el-input>
  19. </el-form-item>
  20. <el-form-item label="独占类型:" prop="useType">
  21. <!--<el-select v-model="form.useType" disabled>
  22. <el-option
  23. v-for="item in useTypeList"
  24. :label="item.caption"
  25. :value="item.code"
  26. :key="item.code"
  27. ></el-option>
  28. </el-select>-->
  29. <el-input
  30. placeholder="请输入"
  31. disabled
  32. v-model="form.useType"
  33. >
  34. </el-input>
  35. </el-form-item>
  36. <el-form-item label="仿真软件license数量:" prop="numSimulationLicense">
  37. <el-input
  38. :placeholder="validNumSimLicense?'请输入仿真软件license数量,最大值:'+validNumSimLicense:'请输入仿真软件license数量'"
  39. maxlength="20"
  40. v-autoTrim="{ obj: form, key: 'numSimulationLicense' }"
  41. v-model="form.numSimulationLicense"
  42. >
  43. </el-input>
  44. </el-form-item>
  45. <el-form-item label="到期时间:" prop="dateSimulationLicense">
  46. <el-date-picker
  47. v-model="form.dateSimulationLicense"
  48. type="date"
  49. placeholder="选择日期"
  50. value-format="yyyy-MM-dd"
  51. :picker-options="pickerOptionsSimulation"
  52. ></el-date-picker>
  53. </el-form-item>
  54. <el-form-item label="动力学软件license数量:" prop="numDynamicLicense">
  55. <el-input
  56. :placeholder="validNumDynLicense?('请输入动力学软件license数量,最大值:'+validNumDynLicense):'请输入动力学软件license数量'"
  57. maxlength="20"
  58. v-autoTrim="{ obj: form, key: 'numDynamicLicense' }"
  59. v-model="form.numDynamicLicense"
  60. >
  61. </el-input>
  62. </el-form-item>
  63. <el-form-item label="到期时间:" prop="dateDynamicLicense">
  64. <el-date-picker
  65. v-model="form.dateDynamicLicense"
  66. type="date"
  67. placeholder="选择日期"
  68. value-format="yyyy-MM-dd"
  69. :picker-options="pickerOptionsDynamic"
  70. ></el-date-picker>
  71. </el-form-item>
  72. </div>
  73. </el-form>
  74. <div class="title">历史记录</div>
  75. <tableList
  76. ref="table"
  77. style="width:60%;min-width: 900px;margin: auto;"
  78. :columns="columns"
  79. :getDataWay="getDataWay"
  80. index
  81. >
  82. </tableList>
  83. <div class="btns">
  84. <el-button type="primary" @click="save">保存</el-button>
  85. <el-button type="primary" plain @click="cancel">取消</el-button>
  86. </div>
  87. </div>
  88. </template>
  89. <script>
  90. import tableList from "@/components/grid/TableList";
  91. export default {
  92. name: "clusteringDetail",
  93. components: {tableList},
  94. data() {
  95. return {
  96. useTypeList: [],
  97. getDataWay:{
  98. dataType: "url",
  99. type: "post",
  100. firstRequest: false,
  101. data: this.$api.systemManagement.getClusterHistory,
  102. param: {
  103. //userId: this.$route.query.userId
  104. },
  105. },
  106. columns: [
  107. //表格列
  108. {
  109. label: "仿真软件license",
  110. prop: "numSimulationLicense",
  111. },
  112. {
  113. label: "到期时间",
  114. prop: "dateSimulationLicense",
  115. formatter:(data)=>{
  116. return data.dateSimulationLicense?data.dateSimulationLicense.slice(0,10):''
  117. }
  118. },
  119. {
  120. label: "动力学软件license",
  121. prop: "numDynamicLicense",
  122. },
  123. {
  124. label: "到期时间",
  125. prop: "dateDynamicLicense",
  126. formatter:(data)=>{
  127. return data.dateDynamicLicense?data.dateDynamicLicense.slice(0,10):''
  128. }
  129. },
  130. {
  131. label: "操作时间",
  132. prop: "modifyTime",
  133. /*formatter:(data)=>{
  134. return this.$timeFormatter(data.modifyTime)
  135. }*/
  136. }
  137. ],
  138. form: {
  139. userName:"",
  140. useType: "",
  141. id: "",
  142. userId: "",
  143. numSimulationLicense: "",
  144. dateSimulationLicense: "",
  145. numDynamicLicense: "",
  146. dateDynamicLicense: ""
  147. },
  148. pickerOptionsSimulation:{
  149. disabledDate: (date)=>{
  150. if(this.validDateSimulation){
  151. if(new Date(date).getTime() > new Date(this.validDateSimulation).getTime()){
  152. return true
  153. }else{
  154. return false
  155. }
  156. }else{
  157. return false
  158. }
  159. }
  160. },
  161. pickerOptionsDynamic:{
  162. disabledDate: (date)=>{
  163. if(this.validDateDynamic){
  164. if(new Date(date).getTime() > new Date(this.validDateDynamic).getTime()){
  165. return true
  166. }else{
  167. return false
  168. }
  169. }else{
  170. return false
  171. }
  172. }
  173. },
  174. validNumSimLicense: undefined,
  175. validNumDynLicense: undefined,
  176. validDateSimulation: undefined,
  177. validDateDynamic: undefined,
  178. rules: {
  179. numSimulationLicense: [
  180. { required: true, message: "请输入", trigger: "blur" },
  181. {
  182. validator: (rule, value, callback) => {
  183. if(this.$validateInteger(value)){
  184. callback()
  185. }else{
  186. callback(new Error('格式错误'))
  187. }
  188. },
  189. trigger: "blur"
  190. },
  191. ],
  192. dateSimulationLicense: [
  193. { required: true, message: "请选择", trigger: "blur" },
  194. ],
  195. numDynamicLicense: [
  196. { required: true, message: "请输入", trigger: "blur" },
  197. {
  198. validator: (rule, value, callback) => {
  199. if(this.$validateInteger(value)){
  200. callback()
  201. }else{
  202. callback(new Error('格式错误'))
  203. }
  204. },
  205. trigger: "blur"
  206. }
  207. ],
  208. dateDynamicLicense: [{ required: true, message: "请选择", trigger: "blur" }]
  209. }
  210. };
  211. },
  212. created(){
  213. if(this.$route.query.userId){
  214. this.form = {...this.$route.query}
  215. delete this.form.modifyTime
  216. }
  217. this.getValidNum()
  218. },
  219. async mounted() {
  220. if(this.$route.query.userId){
  221. this.getDataWay.param = {
  222. userId: this.$route.query.userId
  223. }
  224. this.$refs.table.loadData()
  225. }
  226. await this.$dicsListsInit({
  227. useTypeList: "useType"
  228. });
  229. },
  230. computed: {},
  231. methods: {
  232. getValidNum(){
  233. this.$axios({
  234. method: 'POST',
  235. url: this.$api.systemManagement.getValidClusterInfo,
  236. data:{
  237. userId: this.$route.query.userId
  238. }
  239. }).then(res=>{
  240. if(res.code == '200' && res.info){
  241. this.validNumDynLicense = res.info.validNumDynLicense
  242. this.validNumSimLicense = res.info.validNumSimLicense
  243. this.validDateDynamic = res.info.dateDynamicLicense
  244. this.validDateSimulation = res.info.dateSimulationLicense
  245. }
  246. })
  247. },
  248. save(){
  249. this.$refs.form.validate(valid=>{
  250. if(valid){
  251. if(this.validNumSimLicense && this.form.numSimulationLicense > this.validNumSimLicense){
  252. this.$message.warning('仿真软件license超数量出最大数量')
  253. return
  254. }
  255. if(this.validNumDynLicense && this.form.numDynamicLicense > this.validNumDynLicense){
  256. this.$message.warning('仿真软件license超数量出最大数量')
  257. return
  258. }
  259. this.$axios({
  260. method:"POST",
  261. url:this.$api.systemManagement.saveCluster,
  262. data:{
  263. ...this.form
  264. }
  265. }).then(res=>{
  266. if(res.code == 200){
  267. this.$message.success("保存成功");
  268. this.cancel()
  269. }else{
  270. this.$message.error(res.message || "保存失败");
  271. }
  272. })
  273. }
  274. })
  275. },
  276. cancel(){
  277. this.$router.replace({path: '/clusteringManagement'})
  278. },
  279. },
  280. };
  281. </script>
  282. <style lang="less" scoped>
  283. .el-form {
  284. width: 60%;
  285. min-width: 900px;
  286. padding-top: 60px;
  287. margin: 0 auto;
  288. .formItemBox {
  289. flex: 1;
  290. /deep/ .el-input,
  291. .el-select {
  292. width: 100%;
  293. }
  294. }
  295. .el-textarea {
  296. height: 96px;
  297. }
  298. }
  299. .btns {
  300. padding-top: 30px;
  301. text-align: center;
  302. }
  303. .title {
  304. width: 60%;
  305. min-width: 900px;
  306. margin: 4px auto;
  307. border-left: 6px solid @themeColor;
  308. padding-left: 20px;
  309. color: @themeColor;
  310. font-size: 16px;
  311. font-weight: bold;
  312. }
  313. </style>