You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

307 lines
10 KiB

2 years ago
​
​
​
​
​
​
​
​
1 year ago
2 years ago
​
​
​
​
​
​
2 years ago
​
​
3 months ago
3 months ago
​
​
​
1 year ago
​
3 months ago
​
1 year ago
​
1 year ago
2 years ago
1 year ago
2 years ago
2 years ago
​
1 year ago
3 months ago
2 years ago
​
1 year ago
2 years ago
1 year ago
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 months ago
2 years ago
​
​
​
​
​
​
​
​
​
​
1 year ago
2 years ago
​
​
2 years ago
3 months ago
​
2 years ago
​
​
​
​
​
​
​
3 months ago
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
1 year ago
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 months ago
​
​
​
​
​
​
​
3 months ago
​
​
​
​
3 months ago
​
​
​
​
​
​
2 years ago
​
​
​
​
2 years ago
3 months ago
2 years ago
​
​
3 months ago
2 years ago
​
3 months ago
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
2 years ago
  1. <template>
  2. <div class="customer-css">
  3. <el-dialog :title="titleCon" :close-on-click-modal="false" :visible.sync="visible" width="380px" style="height: 380px;" class="customer-dialog">
  4. <el-form :inline="true" label-position="top" label-width="80px">
  5. <!-- 标签自定义信息 -->
  6. <el-row>
  7. <el-col :span="12">
  8. <el-form-item class="customer-item" :label=labels.labelNo>
  9. <el-input v-model="pageData.labelNo" :readonly="labelNoReadOnly" ></el-input>
  10. </el-form-item>
  11. </el-col>
  12. <el-col :span="12">
  13. <el-form-item class="customer-item" :label=labels.labelType>
  14. <el-select v-model="pageData.labelType" :loading="dataListLoading">
  15. <el-option
  16. v-for="option in labelTypeOptions"
  17. :key="option.value"
  18. :label="displayLabelType(option.value)"
  19. :value="option.value">
  20. </el-option>
  21. </el-select >
  22. </el-form-item>
  23. </el-col>
  24. <el-col :span="12">
  25. <el-form-item class="customer-item" :label="$t('labelSetting.fields.rfidLabel')">
  26. <el-select v-model="pageData.rfidFlag" >
  27. <el-option :label="$t('labelSetting.common.yes')" value="Y"></el-option>
  28. <el-option :label="$t('labelSetting.common.no')" value="N"></el-option>
  29. </el-select>
  30. </el-form-item>
  31. </el-col>
  32. <!-- <el-col :span="12">
  33. <el-form-item class="customer-item" :label=labels.printDirection>
  34. <el-select v-model="pageData.printDirection" >
  35. <el-option :label="$t('labelSetting.options.portrait')" value="纵向设计"></el-option>
  36. <el-option :label="$t('labelSetting.options.landscape')" value="横向设计"></el-option>
  37. </el-select>
  38. </el-form-item>
  39. </el-col>
  40. &lt;!&ndash; <el-col :span="12">
  41. <el-form-item class="customer-item" :label=labels.labelName>
  42. <el-input v-model="pageData.labelName" ></el-input>
  43. </el-form-item>
  44. </el-col>&ndash;&gt;
  45. <el-col :span="12">
  46. <el-form-item class="customer-item" :label=labels.labelClass>
  47. <el-select v-model="pageData.labelClass" >
  48. <el-option :label="$t('labelSetting.options.printSoftware')" value="打印软件"></el-option>
  49. </el-select>
  50. </el-form-item>
  51. </el-col>-->
  52. <el-col :span="12">
  53. <el-form-item class="customer-item" :label=labels.remark>
  54. <el-input v-model="pageData.remark" ></el-input>
  55. </el-form-item>
  56. </el-col>
  57. </el-row>
  58. </el-form>
  59. <span slot="footer" class="dialog-footer">
  60. <el-button type="primary" @click="saveLabelSetting()">{{ buttons.saveButton }}</el-button>
  61. <el-button type="primary" @click="closeDialog">{{buttons.closeButton}}</el-button>
  62. </span>
  63. </el-dialog>
  64. </div>
  65. </template>
  66. <script>
  67. import {
  68. insertLabelSetting,
  69. updateLabelSetting,
  70. getLabelTypeList,
  71. } from '@/api/labelSetting/com_add_update_label.js';
  72. import { labelTypeDisplayText } from './labelTypeDisplay';
  73. import {
  74. searchSysLanguagePackList,
  75. searchSysLanguageParam,
  76. searchFunctionButtonList,
  77. saveButtonList,
  78. searchSysLanguage,
  79. searchLanguageListByLanguageCode,
  80. saveSysLanguageOne,
  81. searchPageLanguageData,
  82. removerLanguage,
  83. saveSysLanguageList
  84. } from "@/api/sysLanguage.js";
  85. var functionId = 'C10000043';
  86. export default {
  87. data() {
  88. return {
  89. titleCon: this.$t('labelSetting.form.customTitle'),
  90. showDefault: false,
  91. visible: false,
  92. pageData: {
  93. site: this.$store.state.user.site,
  94. username: this.$store.state.user.name,
  95. labelNo: '',
  96. labelType: '',
  97. labelName: '',
  98. labelClass: '',
  99. remark: '',
  100. addFlag: false,
  101. printDirection : '纵向设计',
  102. rfidFlag:''
  103. },
  104. labelNoReadOnly: false,
  105. dataListLoading: false,
  106. labelTypeOptions: [], // 标签类型选项列表
  107. buttons: {
  108. saveButton: this.$t('labelSetting.common.save'),
  109. closeButton: this.$t('labelSetting.common.close'),
  110. },
  111. queryButton: {
  112. functionId: functionId,
  113. table_id: '*',
  114. languageCode: this.$i18n.locale,
  115. objectType: 'button'
  116. },
  117. labels: {
  118. titleCon: this.$t('labelSetting.form.customTitle'),
  119. labelNo: this.$t('labelSetting.fields.labelNoColon'),
  120. labelType: this.$t('labelSetting.fields.labelTypeColon'),
  121. labelName: this.$t('labelSetting.fields.reportFileNameColon'),
  122. labelClass: this.$t('labelSetting.fields.labelClassColon'),
  123. printDirection: this.$t('labelSetting.fields.printDirectionColon'),
  124. remark: this.$t('labelSetting.fields.remarkColon'),
  125. confirmLabel: this.$t('labelSetting.common.confirm'),
  126. cancelLabel: this.$t('labelSetting.common.cancel'),
  127. labelNoCantBeNull: this.$t('labelSetting.form.labelNoRequired'),
  128. labelTypeCantBeNull: this.$t('labelSetting.form.labelTypeRequired'),
  129. labelNameCantBeNull: this.$t('labelSetting.form.reportFileRequired'),
  130. },
  131. queryLabel: {
  132. functionId: functionId,
  133. table_id: '*',
  134. languageCode: this.$i18n.locale,
  135. objectType: 'label'
  136. },
  137. }
  138. },
  139. methods: {
  140. //初始化组件的参数
  141. init(currentRow) {
  142. //初始化参数
  143. this.pageData = JSON.parse(JSON.stringify(currentRow));
  144. //打开页面
  145. this.visible = true;
  146. //判断是否是新增
  147. if(this.pageData.addFlag == 'Y'){
  148. this.labelNoReadOnly = true;
  149. }else{
  150. this.labelNoReadOnly = true;
  151. }
  152. //加载标签类型列表
  153. this.loadLabelTypeList();
  154. //判断是否启用多语言
  155. //this.getMultiLanguageList();
  156. //重置标题
  157. this.titleCon = this.labels.titleCon;
  158. },
  159. // 展示走语言包,value 仍是库里的中文类型名
  160. displayLabelType(storedName) {
  161. return labelTypeDisplayText(this.$i18n, storedName)
  162. },
  163. // 加载标签类型列表
  164. loadLabelTypeList() {
  165. this.dataListLoading = true;
  166. getLabelTypeList({
  167. site: this.$store.state.user.site || 'default'
  168. }).then(({data}) => {
  169. if (data.code === 200) {
  170. this.labelTypeOptions = data.data || [];
  171. console.log('标签类型加载成功:', this.labelTypeOptions.length);
  172. } else {
  173. this.$message({
  174. message: data.msg || this.$t('labelSetting.form.getLabelTypesFailed'),
  175. type: 'error',
  176. customClass: 'top-message'
  177. });
  178. this.labelTypeOptions = [];
  179. }
  180. }).catch(error => {
  181. console.error('获取标签类型失败:', error);
  182. this.$message({
  183. message: this.$t('labelSetting.form.getLabelTypesRetry'),
  184. type: 'error',
  185. customClass: 'top-message'
  186. });
  187. // 如果API调用失败,使用默认选项作为降级方案
  188. this.labelTypeOptions = [
  189. { label: this.$t('labelSetting.options.outerBoxLabel'), value: '外箱标签' },
  190. { label: this.$t('labelSetting.options.rollLabel'), value: '卷标签' }
  191. ];
  192. }).finally(() => {
  193. this.dataListLoading = false;
  194. });
  195. },
  196. /*保存标签自定义的信息*/
  197. saveLabelSetting(){
  198. //判断标签内容是否为空
  199. let labelNo = this.pageData.labelNo.trim();
  200. let labelType = this.pageData.labelType.trim();
  201. let rfidFlag = this.pageData.rfidFlag.trim();
  202. if(labelNo == null || labelNo === ''){
  203. this.$message.error(this.$t('labelSetting.form.labelNoRequired'));
  204. return false;
  205. }
  206. if(labelType == null || labelType === ''){
  207. this.$message.error(this.$t('labelSetting.form.labelTypeRequired'));
  208. return false;
  209. }
  210. if(rfidFlag == null || rfidFlag === ''){
  211. this.$message.error(this.$t('labelSetting.form.rfidRequired'));
  212. return false;
  213. }
  214. //判断是否是新增标签自定义
  215. if(this.pageData.addFlag === 'Y'){
  216. this.insertLabelSettingData();
  217. }else{
  218. this.updateLabelSettingData();
  219. }
  220. },
  221. /*数量失去焦点的事件*/
  222. insertLabelSettingData(){
  223. insertLabelSetting(this.pageData).then(({data}) => {
  224. if(data.code == 200){
  225. this.$message.success(data.msg);
  226. setTimeout(this.closeDialog(), 2000);
  227. }else{
  228. this.$message.error(data.msg);
  229. }
  230. })
  231. },
  232. /*验证时长的参数*/
  233. updateLabelSettingData(){
  234. updateLabelSetting(this.pageData).then(({data}) => {
  235. if(data.code == 200){
  236. this.$message.success(data.msg);
  237. setTimeout(this.closeDialog(), 2000);
  238. }else{
  239. this.$message.error(data.msg);
  240. }
  241. })
  242. },
  243. /*关闭modal*/
  244. closeDialog(){
  245. //刷新报工的页面
  246. this.$emit('refreshPageTables');
  247. //关闭当前的页面
  248. this.visible = false;
  249. },
  250. getMultiLanguageList() {
  251. //首先查询当前按钮的多语言
  252. searchFunctionButtonList(this.queryButton).then(({data}) => {
  253. if (data && data.code == 0 ) {
  254. this.buttons = data.data
  255. } else {
  256. // saveButtonList(this.buttonList).then(({data}) => {
  257. // })
  258. }
  259. });
  260. //其次查询当前标签的多语言
  261. searchFunctionButtonList(this.queryLabel).then(({data}) => {
  262. if (data && data.code == 0 ) {
  263. this.labels = data.data
  264. } else {
  265. // saveButtonList(this.buttonList).then(({data}) => {
  266. // })
  267. }
  268. });
  269. },
  270. },
  271. created() {
  272. // 预加载标签类型列表
  273. this.loadLabelTypeList();
  274. }
  275. }
  276. </script>
  277. <style scoped lang="scss">
  278. .customer-css {
  279. .customer-dialog {
  280. .customer-item {
  281. margin-bottom: 15px;
  282. }
  283. }
  284. }
  285. </style>
  286. <!-- 确保消息提示显示在最上层 -->
  287. <style>
  288. .el-message.top-message {
  289. z-index: 4000 !important;
  290. }
  291. </style>