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.

395 lines
13 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
12 hours ago
1 year ago
1 year ago
12 hours ago
1 year ago
1 year ago
12 hours ago
1 year ago
12 hours ago
1 year ago
12 months ago
1 year ago
12 hours ago
1 year ago
12 hours ago
1 year ago
12 hours ago
1 year ago
12 hours ago
1 year ago
12 hours ago
1 year ago
12 hours ago
1 year ago
12 hours ago
1 year ago
12 hours ago
1 year ago
12 hours ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
12 hours ago
1 year ago
  1. <template>
  2. <div class="customer-css">
  3. <el-dialog :title="titleCon" :close-on-click-modal="false" :visible.sync="visible" width="350px" style="height: 420px;" 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.customerId>
  9. <el-input v-model="pageData.customerId" :readonly="labelNoReadOnly" style="width: 120px;" ></el-input>
  10. </el-form-item>
  11. </el-col>
  12. <el-col :span="12">
  13. <el-form-item class="customer-item" :label=labels.addressNo>
  14. <el-input v-model="pageData.addressNo" :readonly="labelNoReadOnly" style="width: 120px;" ></el-input>
  15. </el-form-item>
  16. </el-col>
  17. </el-row>
  18. <el-row>
  19. <el-col :span="12">
  20. <el-form-item class="customer-item" :label=labels.labelType>
  21. <el-select v-model="pageData.labelType" disabled style="width: 150px;" >
  22. <el-option label="外箱标签" value="外箱标签"></el-option>
  23. <el-option label="卷标签" value="卷标签"></el-option>
  24. </el-select >
  25. </el-form-item>
  26. </el-col>
  27. <el-col :span="12">
  28. <el-form-item class="customer-item">
  29. <span slot="label" style="" @click="getBaseList(1099)"><a herf="#">{{labels.labelNo}}</a></span>
  30. <el-input v-model="pageData.labelNo" :readonly="labelNoReadOnly" @blur="checkLabelNoMethod()" style="width: 120px;" ></el-input>
  31. </el-form-item>
  32. </el-col>
  33. </el-row>
  34. <!-- <el-row>
  35. <el-col :span="12">
  36. <el-form-item class="customer-item" :label=labels.labelClass>
  37. <el-select v-model="pageData.labelClass" disabled style="width: 150px;" >
  38. <el-option label="打印软件" value="打印软件"></el-option>
  39. </el-select>
  40. </el-form-item>
  41. </el-col>
  42. <el-col :span="12">
  43. <el-form-item class="customer-item" :label=labels.labelName>
  44. <el-input v-model="pageData.labelName" disabled style="width: 120px;" ></el-input>
  45. </el-form-item>
  46. </el-col>
  47. </el-row>-->
  48. <el-row>
  49. <el-col :span="12">
  50. <el-form-item class="customer-item" style="margin-top: -8px;">
  51. <span>{{labels.subLabelFlag}}</span>
  52. <el-checkbox v-model="pageData.subLabelFlag" @change="changeParentLabelNo()" true-label="Y" false-label="N"
  53. style="margin-top: 28px; margin-left: 10px;"></el-checkbox>
  54. </el-form-item>
  55. </el-col>
  56. <el-col :span="12">
  57. <el-form-item class="customer-item" :label=labels.parentLabelNo>
  58. <el-input v-model="pageData.parentLabelNo" :disabled="pageData.subLabelFlag !== 'Y'" style="width: 120px;" ></el-input>
  59. </el-form-item>
  60. </el-col>
  61. </el-row>
  62. <el-row>
  63. <el-col :span="24">
  64. <el-form-item class="customer-item" :label=labels.remark>
  65. <el-input v-model="pageData.remark" style="width: 310px;" ></el-input>
  66. </el-form-item>
  67. </el-col>
  68. </el-row>
  69. </el-form>
  70. <span slot="footer" class="dialog-footer">
  71. <el-button type="primary" @click="saveLabelSetting()">{{ buttons.saveButton }}</el-button>
  72. <el-button type="primary" @click="closeDialog">{{buttons.closeButton}}</el-button>
  73. </span>
  74. </el-dialog>
  75. <!--列表的组件-->
  76. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  77. </div>
  78. </template>
  79. <script>
  80. import {
  81. insertLabelSetting,
  82. updateLabelSetting,
  83. checkLabelNo,
  84. } from '@/api/labelSetting/com_add_update_customer_label.js';
  85. import {
  86. searchSysLanguagePackList,
  87. searchSysLanguageParam,
  88. searchFunctionButtonList,
  89. saveButtonList,
  90. searchSysLanguage,
  91. searchLanguageListByLanguageCode,
  92. saveSysLanguageOne,
  93. searchPageLanguageData,
  94. removerLanguage,
  95. saveSysLanguageList
  96. } from "@/api/sysLanguage.js";
  97. /* 引入组件 */
  98. import Chooselist from '@/views/modules/common/Chooselist'/* 列表组件 */
  99. var functionId = 'C10000053';
  100. export default {
  101. data() {
  102. return {
  103. titleCon: '客户标签定义维护',
  104. showDefault: false,
  105. visible: false,
  106. userId: this.$store.state.user.name,
  107. pageData: {
  108. site: this.$store.state.user.site,
  109. username: this.$store.state.user.name,
  110. customerId: '',
  111. addressNo: '',
  112. labelNo: '',
  113. labelType: '',
  114. labelName: '',
  115. labelClass: '',
  116. subLabelFlag: 'N',
  117. parentLabelNo: '',
  118. remark: '',
  119. addFlag: false,
  120. },
  121. labelNoReadOnly: false,
  122. dataListLoading: false,
  123. buttons: {
  124. saveButton: '保存',
  125. closeButton: '关闭',
  126. },
  127. queryButton: {
  128. functionId: functionId,
  129. table_id: '*',
  130. languageCode: this.$i18n.locale,
  131. objectType: 'button'
  132. },
  133. labels: {
  134. site: '工厂编号:',
  135. customerId: '客户编码:',
  136. addressNo: '地址编码:',
  137. titleCon: '客户标签定义维护',
  138. labelNo: '标签编号:',
  139. labelType: '标签类型:',
  140. labelName: '报表文件名:',
  141. labelClass: '标签种类:',
  142. subLabelFlag: '子报表:',
  143. parentLabelNo: '上级标签编号:',
  144. remark: '备注:',
  145. confirmLabel: '确认',
  146. cancelLabel: '取消',
  147. tipsLabel: '提示',
  148. labelNoCantBeNull: '标签编号不能为空!',
  149. labelTypeCantBeNull: '标签类型不能为空!',
  150. labelNameCantBeNull: '报表文件名不能为空!',
  151. },
  152. queryLabel: {
  153. functionId: functionId,
  154. table_id: '*',
  155. languageCode: this.$i18n.locale,
  156. objectType: 'label'
  157. },
  158. }
  159. },
  160. methods: {
  161. //初始化组件的参数
  162. init(currentRow) {
  163. //初始化参数
  164. this.pageData = JSON.parse(JSON.stringify(currentRow));
  165. //统一子报表标识和值,避免页面展示为*
  166. this.pageData.subLabelFlag = this.pageData.subLabelFlag === 'Y' ? 'Y' : 'N';
  167. this.pageData.parentLabelNo = this.getDisplayParentLabelNo(this.pageData.parentLabelNo, this.pageData.subLabelFlag);
  168. //打开页面
  169. this.visible = true;
  170. //判断是否是新增
  171. if(this.pageData.addFlag == 'Y'){
  172. this.labelNoReadOnly = false;
  173. }else{
  174. this.labelNoReadOnly = true;
  175. }
  176. //重置人员信息
  177. this.pageData.username = this.userId;
  178. //判断是否启用多语言
  179. //this.getMultiLanguageList();
  180. //重置标题
  181. this.titleCon = this.labels.titleCon;
  182. },
  183. /*检验标签的编码*/
  184. checkLabelNoMethod(){
  185. checkLabelNo(this.pageData).then(({data}) => {
  186. //判断是否查询到了
  187. if(data && data.code == 200){
  188. //设置参数
  189. let labelSetting = data.resultRow;
  190. this.pageData.labelType = labelSetting.labelType;
  191. this.pageData.labelClass = labelSetting.labelClass;
  192. this.pageData.labelName = labelSetting.labelName;
  193. }else{
  194. this.pageData.labelName = '';
  195. this.pageData.labelNo = '';
  196. this.pageData.labelType = '';
  197. this.pageData.labelClass = '';
  198. this.$message.error(data.msg);
  199. }
  200. })
  201. },
  202. /*子报表事件触发*/
  203. changeParentLabelNo(){
  204. //首选判断是否是选中状态
  205. if(this.pageData.subLabelFlag === 'Y'){
  206. this.pageData.parentLabelNo = '';
  207. }else{
  208. this.pageData.parentLabelNo = '';
  209. }
  210. },
  211. /*根据子报表标识处理上级标签显示值*/
  212. getDisplayParentLabelNo(parentLabelNo, subLabelFlag){
  213. if(subLabelFlag !== 'Y'){
  214. return '';
  215. }
  216. if(parentLabelNo == null || parentLabelNo === '*'){
  217. return '';
  218. }
  219. return parentLabelNo;
  220. },
  221. /*构建提交参数*/
  222. buildSubmitData(){
  223. let submitData = JSON.parse(JSON.stringify(this.pageData));
  224. submitData.customerId = (submitData.customerId || '').trim().toUpperCase();
  225. submitData.addressNo = (submitData.addressNo || '').trim().toUpperCase();
  226. submitData.labelNo = (submitData.labelNo || '').trim().toUpperCase();
  227. submitData.labelType = (submitData.labelType || '').trim();
  228. submitData.labelName = (submitData.labelName || '').trim();
  229. submitData.remark = (submitData.remark || '').trim();
  230. submitData.subLabelFlag = submitData.subLabelFlag === 'Y' ? 'Y' : 'N';
  231. let parentLabelNo = (submitData.parentLabelNo || '').trim().toUpperCase();
  232. submitData.parentLabelNo = submitData.subLabelFlag === 'Y' ? parentLabelNo : '*';
  233. return submitData;
  234. },
  235. /*保存前校验*/
  236. validateSubmitData(submitData){
  237. if(!submitData.customerId){
  238. this.$message.error('客户编码不能为空!');
  239. return false;
  240. }
  241. if(!submitData.addressNo){
  242. this.$message.error('地址编码不能为空!');
  243. return false;
  244. }
  245. if(!submitData.labelNo){
  246. this.$message.error(this.labels.labelNoCantBeNull);
  247. return false;
  248. }
  249. if(!submitData.labelType){
  250. this.$message.error(this.labels.labelTypeCantBeNull);
  251. return false;
  252. }
  253. if(submitData.subLabelFlag === 'Y' && (!submitData.parentLabelNo || submitData.parentLabelNo === '*')){
  254. this.$message.error('子报表必须维护上级标签编号!');
  255. return false;
  256. }
  257. return true;
  258. },
  259. /*保存标签自定义的信息*/
  260. saveLabelSetting(){
  261. let submitData = this.buildSubmitData();
  262. if(!this.validateSubmitData(submitData)){
  263. return false;
  264. }
  265. //判断是否是新增标签自定义
  266. if(this.pageData.addFlag === 'Y'){
  267. this.insertLabelSettingData(submitData);
  268. }else{
  269. this.updateLabelSettingData(submitData);
  270. }
  271. },
  272. /*数量失去焦点的事件*/
  273. insertLabelSettingData(submitData){
  274. insertLabelSetting(submitData).then(({data}) => {
  275. if(data.code == 200){
  276. this.$message.success(data.msg);
  277. setTimeout(() => {
  278. this.closeDialog();
  279. }, 200);
  280. }else{
  281. this.$message.error(data.msg);
  282. }
  283. })
  284. },
  285. /*验证时长的参数*/
  286. updateLabelSettingData(submitData){
  287. updateLabelSetting(submitData).then(({data}) => {
  288. if(data.code == 200){
  289. this.$message.success(data.msg);
  290. setTimeout(() => {
  291. this.closeDialog();
  292. }, 200);
  293. }else{
  294. this.$message.error(data.msg);
  295. }
  296. })
  297. },
  298. /*关闭modal*/
  299. closeDialog(){
  300. //刷新报工的页面
  301. this.$emit('refreshPageTables');
  302. //关闭当前的页面
  303. this.visible = false;
  304. },
  305. /* 列表方法的回调 */
  306. getBaseData(val) {
  307. if (this.tagNo === 1099) {
  308. //设置参数
  309. this.pageData.labelNo = val.ReportID;
  310. this.pageData.labelType = val.ReportFamily;
  311. this.pageData.labelName = val.Reportfile;
  312. this.pageData.labelClass = val.ReportType;
  313. }
  314. },
  315. // 获取基础数据列表
  316. getBaseList(val) {
  317. this.tagNo = val
  318. this.$nextTick(() => {
  319. let strVal = ''
  320. if (val === 1099) {
  321. strVal = this.pageData.labelNo;
  322. }
  323. this.$refs.baseList.init(val, strVal)
  324. })
  325. },
  326. /*getMultiLanguageList() {
  327. //首先查询当前按钮的多语言
  328. searchFunctionButtonList(this.queryButton).then(({data}) => {
  329. if (data && data.code == 0) {
  330. this.buttons = data.data
  331. } else {
  332. // saveButtonList(this.buttonList).then(({data}) => {
  333. // })
  334. }
  335. });
  336. //其次查询当前标签的多语言
  337. searchFunctionButtonList(this.queryLabel).then(({data}) => {
  338. if (data && data.code == 0 ) {
  339. this.labels = data.data
  340. } else {
  341. // saveButtonList(this.buttonList).then(({data}) => {
  342. // })
  343. }
  344. });
  345. },*/
  346. },
  347. components: {
  348. Chooselist, /* 选择的组件 */
  349. },
  350. watch: {
  351. pageData: {
  352. deep: true,
  353. handler: function (newV, oldV) {
  354. let labelNo = (this.pageData.labelNo || '').toUpperCase();
  355. let parentLabelNo = (this.pageData.parentLabelNo || '').toUpperCase();
  356. if(this.pageData.labelNo !== labelNo){
  357. this.pageData.labelNo = labelNo;
  358. }
  359. if(this.pageData.parentLabelNo !== parentLabelNo){
  360. this.pageData.parentLabelNo = parentLabelNo;
  361. }
  362. }
  363. },
  364. },
  365. created() {
  366. // this.factoryList()
  367. // this.getLanguageList()
  368. }
  369. }
  370. </script>
  371. <style scoped lang="scss">
  372. </style>