0
0

edit.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  1. {extend name="common/common2" /}
  2. {block name="main"}
  3. <style>
  4. .supervise-content{
  5. width: 60%;
  6. height: auto;
  7. margin-bottom: 20px;
  8. border: 1px solid #c3c3c3;
  9. box-shadow:4px 4px 15px #f1f1f1;
  10. padding: 10px;
  11. margin-left: 7%;
  12. }
  13. .question-form{
  14. height: 34px;
  15. line-height: 34px;
  16. margin: 5px 0;
  17. overflow: hidden;
  18. }
  19. .question-form-option{
  20. width: auto;
  21. height: auto;
  22. margin: 5px 0;
  23. overflow: hidden;
  24. }
  25. .question-form-title{
  26. display: inline-block;
  27. width: 70px;
  28. height: 100%;
  29. }
  30. .question-form-option{
  31. height: auto;
  32. margin: 5px 0;
  33. overflow: hidden;
  34. }
  35. .question-form-title{
  36. display: inline-block;
  37. width: 70px;
  38. height: 100%;
  39. }
  40. .question-form-input{
  41. display: inline-block;
  42. width: 65%;
  43. height: 100%;
  44. }
  45. .question-form-input1{
  46. display: inline-block;
  47. width: 80%;
  48. height: 100%;
  49. }
  50. .question-options{
  51. /*width: 640px;*/
  52. width: 90%;
  53. height: 32px;
  54. color: #606266!important;
  55. font-size: 13px!important;
  56. padding: 5px 15px!important;
  57. border-width: 1px;
  58. border-style: solid;
  59. border-color: rgb(229, 230, 231);
  60. }
  61. .xz:focus,.form-select:focus,.question-options:focus{
  62. border-color: #6eb7ff !important;
  63. outline:0;
  64. }
  65. ul, ol {
  66. margin: 0;
  67. }
  68. .standard-table{
  69. overflow: hidden;
  70. }
  71. .standard-input{
  72. width: 100%;
  73. height: 100%;
  74. color: #606266!important;
  75. font-size: 13px!important;
  76. padding: 5px 15px!important;
  77. border-width: 1px;
  78. border-style: solid;
  79. border-color: rgb(229, 230, 231);
  80. }
  81. .list-group-item{
  82. width: 74%;
  83. margin-bottom: 20px;
  84. border: 2px solid var(--themeColor) !important;
  85. position: relative;
  86. z-index: 20;
  87. }
  88. .a_add{
  89. width: 100%;
  90. height: 35px;
  91. line-height: 35px;
  92. text-align: center;
  93. }
  94. .sub_standard{
  95. border: 1px solid #0a6aa1;
  96. margin-bottom: 10px;
  97. padding: 8px;
  98. position: relative;
  99. z-index: 20;
  100. }
  101. .text-danger{
  102. position: absolute;
  103. z-index: 19;
  104. top: 10px;
  105. right: 10px;
  106. /*float: right;*/
  107. }
  108. </style>
  109. <div class="row">
  110. <div class="col-sm-12">
  111. <div class="ibox float-e-margins">
  112. <div class="ibox-title">
  113. <h5>{$meta_title}</h5>
  114. <div class="ibox-tools">
  115. <a class="toback" href="{:url('index')}">
  116. 返回上一页
  117. </a>
  118. </div>
  119. </div>
  120. <div class="ibox-content" id="vueapp">
  121. <form method="post" action="{:url('add')}" class="form-horizontal">
  122. <input type="hidden" name="id" value="{$info['id']|default='0'}">
  123. <input type="hidden" name="content" value="" id="content">
  124. <div class="question-form">
  125. <div class="question-form-title">名称</div>
  126. <div class="question-form-input">
  127. <input type="text" v-model="title" name="title" class="form-control">
  128. </div>
  129. </div>
  130. <div class="question-form">
  131. <div class="question-form-title">备注</div>
  132. <div class="question-form-input">
  133. <input type="text" v-model="remark" name="remark" class="form-control">
  134. </div>
  135. </div>
  136. <div class="question-form">
  137. <a href="javascript:;" style="margin-left:34.5%" @click="addStandard()">添加标准</a>
  138. </div>
  139. <div class="question-form-option">
  140. <ul class="list-group">
  141. <li class="list-group-item" v-for="(item,index) in content" :key="index">
  142. <a href="javascript:void(0)" class="text-danger" @click="delStandard(index)">删除</a>
  143. <div class="question-form">
  144. <div class="question-form-title">标准名称</div>
  145. <div class="question-form-input1">
  146. <input type="text" v-model="item.title" class="question-options">
  147. </div>
  148. </div>
  149. <div class="a_add">
  150. <a href="javascript:;" @click="addSubStandard(index)">添加子标准</a>
  151. </div>
  152. <div class="sub_standard" v-for="(item1,index1) in item.sub" :key="index1">
  153. <a href="javascript:void(0)" class="text-danger" @click="delSubStandard(index,index1)">删除</a>
  154. <div class="question-form">
  155. <div class="question-form-title">子标准名称</div>
  156. <div class="question-form-input1">
  157. <input type="text" v-model="item1.title" class="question-options">
  158. </div>
  159. </div>
  160. <!-- <div class="question-form">-->
  161. <!-- <div class="question-form-title">评分</div>-->
  162. <!-- <div class="question-form-input">-->
  163. <!-- <input type="number" v-model="item1.score" class="question-options">-->
  164. <!-- </div>-->
  165. <!-- </div>-->
  166. <div class="question-form">
  167. <div class="question-form-title">评分标准</div>
  168. <div class="question-form-input1">
  169. <input type="text" v-model="item1.standard" class="question-options">
  170. </div>
  171. </div>
  172. <a href="javascript:;" @click="addkhbz(index,index1)">添加考核标准</a>
  173. <div class="standard-table" >
  174. <table class="table table-bordered">
  175. <thead>
  176. <tr>
  177. <th style="width: 60%;">考核标准内容</th>
  178. <th>分值</th>
  179. <th>操作</th>
  180. </tr>
  181. </thead>
  182. <tbody>
  183. <tr v-for="(item2,index2) in item1.sub" :key="index2">
  184. <td style="width: 60%;"><input type="text" v-model="item2.title" class="standard-input"></td>
  185. <td><input type="number" onkeyup="clearNoNum1(this)" v-model="item2.score" class="standard-input"></td>
  186. <td><a href="javascript:;" @click="delkhbz(index,index1,index2)" style="color:#ed5565">删除</a></td>
  187. </tr>
  188. </tbody>
  189. </table>
  190. </div>
  191. </div>
  192. </li>
  193. </ul>
  194. </div>
  195. <div class="hr-line-dashed"></div>
  196. <div class="form-group">
  197. <div class="col-sm-6 col-sm-offset-2">
  198. <button class="btn btn-primary ajax-post" target-form="form-horizontal" type="submit">确 定</button>
  199. <a href="{:url('index')}" class="btn btn-default">取 消</a>
  200. </div>
  201. </div>
  202. </form>
  203. </div>
  204. </div>
  205. </div>
  206. </div>
  207. {/block}
  208. {block name="script"}
  209. <script type="text/javascript" src="/static/vuejs/require.js"></script>
  210. <script>
  211. $(document).ready(function(){
  212. // formSetValue("cate", {$info.cate|default=0});
  213. });
  214. var info = <?=json_encode($info)?>;
  215. var content = JSON.parse(info.content);
  216. var vm = new Vue({
  217. el: '#vueapp',
  218. data: {
  219. title:info.title,
  220. remark:info.remark,
  221. content:content,
  222. maxid:0,
  223. maxsubid:0,
  224. },
  225. computed: {
  226. resoptions: function () {
  227. return JSON.parse(JSON.stringify(this.content));
  228. }
  229. },
  230. watch: {
  231. resoptions: function (newval, oldval) {
  232. const str = JSON.stringify(newval)
  233. $('#content').val(str);
  234. },
  235. },
  236. created: function () {
  237. const str = JSON.stringify(content)
  238. $('#content').val(str);
  239. },
  240. methods: {
  241. addStandard(){
  242. const sub = {
  243. title:'工作标准名称',
  244. score:0,
  245. sub:[{
  246. title:'子标准名称',
  247. score:0,
  248. standard:'评分标准',
  249. sub:[{
  250. title:'考核标准内容',
  251. score:0,
  252. }]
  253. }]
  254. }
  255. this.content.push(sub);
  256. },
  257. addSubStandard(index){
  258. for(let i in this.content){
  259. if(i == Number(index)){
  260. const info = this.content[i];
  261. const sub = {
  262. title:'子标准名称',
  263. score:0,
  264. standard:'评分标准',
  265. sub:[{
  266. title:'考核标准内容',
  267. score:0,
  268. }]
  269. }
  270. info.sub.push(sub);
  271. }
  272. }
  273. },
  274. addkhbz(index,index1){
  275. for(let i in this.content){
  276. if(i == Number(index)){
  277. const info = this.content[i].sub;
  278. for (let o in info){
  279. const info2 = info[o];
  280. if(o == Number(index1)){
  281. const sub = {
  282. title:'考核标准内容',
  283. score:0,
  284. }
  285. info2.sub.push(sub);
  286. }
  287. }
  288. }
  289. }
  290. },
  291. delStandard(index){
  292. const newsArr = []
  293. for (let i in this.content){
  294. if(i != Number(index)){
  295. newsArr.push(this.content[i])
  296. }
  297. }
  298. this.content = newsArr;
  299. },
  300. delSubStandard(index,index1){
  301. for (let i in this.content){
  302. if(i == Number(index)){
  303. const sub = this.content[i].sub;
  304. const newsub = [];
  305. for (let o in sub){
  306. if(o != Number(index1)){
  307. newsub.push(sub[i]);
  308. }
  309. }
  310. this.content[i].sub = newsub;
  311. }
  312. }
  313. },
  314. delkhbz(index,index1,index2){
  315. for (let i in this.content){
  316. if(i == Number(index)){
  317. const sub = this.content[i].sub;
  318. for (let o in sub){
  319. if(o == Number(index1)){
  320. const subsub = sub[o].sub;
  321. const newsub = [];
  322. for (let t in subsub){
  323. if(t != Number(index2)){
  324. newsub.push(subsub[t]);
  325. }
  326. }
  327. this.content[i].sub[o].sub = newsub;
  328. }
  329. }
  330. }
  331. }
  332. },
  333. }
  334. })
  335. </script>
  336. {/block}